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) { switch (digest->algorithm) {
case DIGEST_SHA1: case DIGEST_SHA1:
tor_assert(out_len <= DIGEST_LEN); tor_assert(out_len <= DIGEST_LEN);
SHA1_Final(r, &digest->d.sha1); SHA1_Final(r, &tmpenv.d.sha1);
break; break;
case DIGEST_SHA256: case DIGEST_SHA256:
tor_assert(out_len <= DIGEST256_LEN); tor_assert(out_len <= DIGEST256_LEN);
SHA256_Final(r, &digest->d.sha2); SHA256_Final(r, &tmpenv.d.sha2);
break; break;
default: default:
tor_fragile_assert(); tor_fragile_assert();