Introduce separate _clear functions for hash module

This gives the caller more control about whether the state should
be cleaned (= should be considered secret). Moreover, it gives the
caller the possibility to clean a hash struct without finalizing it.
This commit is contained in:
Tim Ruffing
2020-04-27 18:55:36 +02:00
committed by Sebastian Falbesoner
parent 99cc9fd6d0
commit 349e6ab916
8 changed files with 26 additions and 7 deletions

View File

@@ -19,6 +19,7 @@ static int ecdh_hash_function_sha256(unsigned char *output, const unsigned char
secp256k1_sha256_write(&sha, &version, 1);
secp256k1_sha256_write(&sha, x32, 32);
secp256k1_sha256_finalize(&sha, output);
secp256k1_sha256_clear(&sha);
return 1;
}