Make crypto_digest_get_digest nondestructive again.

Fixes bug in f57883a39.
This commit is contained in:
Nick Mathewson 2009-08-20 12:03:32 -04:00
parent 8771fdfda4
commit 5da3b45fdc

View File

@ -1510,11 +1510,11 @@ crypto_digest_get_digest(crypto_digest_env_t *digest,
switch (digest->algorithm) {
case DIGEST_SHA1:
tor_assert(out_len <= DIGEST_LEN);
SHA1_Final(r, &digest->d.sha1);
SHA1_Final(r, &tmpenv.d.sha1);
break;
case DIGEST_SHA256:
tor_assert(out_len <= DIGEST256_LEN);
SHA256_Final(r, &digest->d.sha2);
SHA256_Final(r, &tmpenv.d.sha2);
break;
default:
tor_fragile_assert();