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

@@ -93,6 +93,7 @@ static int nonce_function_bip340(unsigned char *nonce32, const unsigned char *ms
secp256k1_sha256_write(&sha, xonly_pk32, 32);
secp256k1_sha256_write(&sha, msg, msglen);
secp256k1_sha256_finalize(&sha, nonce32);
secp256k1_sha256_clear(&sha);
return 1;
}