summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
Diffstat (limited to 'src/or')
-rw-r--r--src/or/channeltls.c5
-rw-r--r--src/or/routerkeys.c10
-rw-r--r--src/or/routerkeys.h1
-rw-r--r--src/or/torcert.c27
4 files changed, 30 insertions, 13 deletions
diff --git a/src/or/channeltls.c b/src/or/channeltls.c
index e5e82dd11f..7a6f0b37ce 100644
--- a/src/or/channeltls.c
+++ b/src/or/channeltls.c
@@ -1954,8 +1954,11 @@ channel_tls_process_certs_cell(var_cell_t *cell, channel_tls_t *chan)
ERR("Couldn't compute digests for key in ID cert");
identity_rcvd = tor_tls_cert_get_key(id_cert);
- if (!identity_rcvd)
+ if (!identity_rcvd) {
+ //LCOV_EXCL_START
ERR("Internal error: Couldn't get RSA key from ID cert.");
+ //LCOV_EXCL_STOP
+ }
memcpy(chan->conn->handshake_state->authenticated_rsa_peer_id,
id_digests->d[DIGEST_SHA1], DIGEST_LEN);
channel_set_circid_type(TLS_CHAN_TO_BASE(chan), identity_rcvd,
diff --git a/src/or/routerkeys.c b/src/or/routerkeys.c
index 88d091a58c..f0f62522ae 100644
--- a/src/or/routerkeys.c
+++ b/src/or/routerkeys.c
@@ -1059,6 +1059,16 @@ get_master_identity_key(void)
return &master_identity_key->pubkey;
}
+#ifdef TOR_UNIT_TESTS
+/* only exists for the unit tests, since otherwise the identity key
+ * should be used to sign nothing but the signing key. */
+const ed25519_keypair_t *
+get_master_identity_keypair(void)
+{
+ return master_identity_key;
+}
+#endif
+
const ed25519_keypair_t *
get_master_signing_keypair(void)
{
diff --git a/src/or/routerkeys.h b/src/or/routerkeys.h
index c2b20b3871..307a1cd234 100644
--- a/src/or/routerkeys.h
+++ b/src/or/routerkeys.h
@@ -74,6 +74,7 @@ int write_encrypted_secret_key(const ed25519_secret_key_t *out,
void routerkeys_free_all(void);
#ifdef TOR_UNIT_TESTS
+const ed25519_keypair_t *get_master_identity_keypair(void);
void init_mock_ed_keys(const crypto_pk_t *rsa_identity_key);
#endif
diff --git a/src/or/torcert.c b/src/or/torcert.c
index cff1ed10c5..cfd2210309 100644
--- a/src/or/torcert.c
+++ b/src/or/torcert.c
@@ -461,7 +461,7 @@ or_handshake_certs_rsa_ok(int severity,
if (certs->started_here) {
if (! (id_cert && link_cert))
- ERR("The certs we wanted were missing");
+ ERR("The certs we wanted (ID, Link) were missing");
if (! tor_tls_cert_matches_key(tls, link_cert))
ERR("The link certificate didn't match the TLS public key");
if (! tor_tls_cert_is_valid(severity, link_cert, id_cert, now, 0))
@@ -470,7 +470,7 @@ or_handshake_certs_rsa_ok(int severity,
ERR("The ID certificate was not valid");
} else {
if (! (id_cert && auth_cert))
- ERR("The certs we wanted were missing");
+ ERR("The certs we wanted (ID, Auth) were missing");
/* Remember these certificates so we can check an AUTHENTICATE cell
* XXXX make sure we do that
*/
@@ -505,20 +505,20 @@ or_handshake_certs_ed25519_ok(int severity,
ERR("Could not get checkable cert."); \
} while (0)
- if (! certs->ed_id_sign || !certs->ed_id_sign->signing_key_included)
- ERR("No signing key");
+ if (! certs->ed_id_sign || !certs->ed_id_sign->signing_key_included) {
+ ERR("No Ed25519 signing key");
+ }
ADDCERT(certs->ed_id_sign, NULL);
if (certs->started_here) {
if (! certs->ed_sign_link)
- ERR("No link key");
+ ERR("No Ed25519 link key");
{
/* check for a match with the TLS cert. */
tor_x509_cert_t *peer_cert = tor_tls_get_peer_cert(tls);
- /* XXXX Does 'cert' match spec in this case? I hope so; if not, fix
- * spec */
- if (!peer_cert)
- ERR("No x509 peer cert");
+ if (BUG(!peer_cert)) {
+ ERR("No x509 peer cert"); // LCOV_EXCL_LINE
+ }
const common_digests_t *peer_cert_digests =
tor_x509_cert_get_cert_digests(peer_cert);
int okay = tor_memeq(peer_cert_digests->d[DIGEST_SHA256],
@@ -526,14 +526,14 @@ or_handshake_certs_ed25519_ok(int severity,
DIGEST256_LEN);
tor_x509_cert_free(peer_cert);
if (!okay)
- ERR("link certificate does not match TLS certificate");
+ ERR("Link certificate does not match TLS certificate");
}
ADDCERT(certs->ed_sign_link, &certs->ed_id_sign->signed_key);
} else {
if (! certs->ed_sign_auth)
- ERR("No link authentiction key");
+ ERR("No Ed25519 link authentication key");
ADDCERT(certs->ed_sign_auth, &certs->ed_id_sign->signed_key);
}
@@ -555,6 +555,9 @@ or_handshake_certs_ed25519_ok(int severity,
if (! tor_tls_cert_is_valid(severity, rsa_id_cert, rsa_id_cert, now, 1)) {
ERR("The legacy RSA ID certificate was not valid");
}
+ if (! certs->ed_rsa_crosscert) {
+ ERR("Missing RSA->Ed25519 crosscert");
+ }
crypto_pk_t *rsa_id_key = tor_tls_cert_get_key(rsa_id_cert);
if (rsa_ed25519_crosscert_check(certs->ed_rsa_crosscert,
@@ -563,7 +566,7 @@ or_handshake_certs_ed25519_ok(int severity,
&certs->ed_id_sign->signing_key,
now) < 0) {
crypto_pk_free(rsa_id_key);
- ERR("Invalid/missing RSA crosscert");
+ ERR("Invalid RSA->Ed25519 crosscert");
}
crypto_pk_free(rsa_id_key);
rsa_id_key = NULL;