summaryrefslogtreecommitdiff
path: root/src/or/torcert.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-01-31 09:19:55 -0500
committerNick Mathewson <nickm@torproject.org>2018-01-31 09:19:55 -0500
commitc0447033f5e1032be379b9b78d9085f71fd51bd6 (patch)
tree9fc16176eca8ccab792aa9e460ed689e08d10a5c /src/or/torcert.c
parentd2ae1bfcb314965fd1ff1353308da0e92a00c958 (diff)
parentee5c624bebbc8e823ed49fe563fd56294fb226d4 (diff)
downloadtor-c0447033f5e1032be379b9b78d9085f71fd51bd6.tar.gz
tor-c0447033f5e1032be379b9b78d9085f71fd51bd6.zip
Merge branch 'maint-0.3.2'
Diffstat (limited to 'src/or/torcert.c')
-rw-r--r--src/or/torcert.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/or/torcert.c b/src/or/torcert.c
index bd677d1f4a..51935ddf72 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)