summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/crypto.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 851f11bf3b..235bd88ffa 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -1663,6 +1663,10 @@ crypto_digest_get_digest(crypto_digest_env_t *digest,
SHA256_Final(r, &tmpenv.d.sha2);
break;
default:
+ log_warn(LD_BUG, "Called with unknown algorithm %d", digest->algorithm);
+ /* If fragile_assert is not enabled, then we should at least not
+ * leak anything. */
+ memset(r, 0xff, sizeof(r));
tor_fragile_assert();
break;
}