diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-01-26 13:55:25 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-01-26 13:55:25 -0500 |
commit | ee5c624bebbc8e823ed49fe563fd56294fb226d4 (patch) | |
tree | 173f584f3f03e6d62000dd0583b9b5f6521c069f /src/or/torcert.c | |
parent | 6ba2881aec7299fb486ab0f821c4f2ddcc88190e (diff) | |
download | tor-ee5c624bebbc8e823ed49fe563fd56294fb226d4.tar.gz tor-ee5c624bebbc8e823ed49fe563fd56294fb226d4.zip |
When a tor_cert_T check fails, log the reason why.
Diagnostic attempt for 24972.
Diffstat (limited to 'src/or/torcert.c')
-rw-r--r-- | src/or/torcert.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/or/torcert.c b/src/or/torcert.c index befb39d6e8..212534d311 100644 --- a/src/or/torcert.c +++ b/src/or/torcert.c @@ -93,7 +93,8 @@ tor_cert_sign_impl(const ed25519_keypair_t *signing_key, if (tor_cert_checksig(torcert, &signing_key->pubkey, now) < 0) { /* LCOV_EXCL_START */ - log_warn(LD_BUG, "Generated a certificate whose signature we can't check"); + log_warn(LD_BUG, "Generated a certificate whose signature we can't " + "check: %s", tor_cert_describe_signature_status(torcert)); goto err; /* LCOV_EXCL_STOP */ } @@ -267,6 +268,24 @@ tor_cert_checksig(tor_cert_t *cert, } } +/** Return a string describing the status of the signature on <b>cert</b> + * + * Will always be "unchecked" unless tor_cert_checksig has been called. + */ +const char * +tor_cert_describe_signature_status(const tor_cert_t *cert) +{ + if (cert->cert_expired) { + return "expired"; + } else if (cert->sig_bad) { + return "mis-signed"; + } else if (cert->sig_ok) { + return "okay"; + } else { + return "unchecked"; + } +} + /** Return a new copy of <b>cert</b> */ tor_cert_t * tor_cert_dup(const tor_cert_t *cert) |