diff options
author | Nick Mathewson <nickm@torproject.org> | 2023-01-19 09:06:47 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2023-01-19 09:09:09 -0500 |
commit | 5629a391c25db8611ec43065ebbdce492b30b669 (patch) | |
tree | bac58587fafb7440894e2e44566a7a29463f608d /src/test | |
parent | 60f70be547f4125c8fc2ed7c962704db1b17a9c3 (diff) | |
download | tor-5629a391c25db8611ec43065ebbdce492b30b669.tar.gz tor-5629a391c25db8611ec43065ebbdce492b30b669.zip |
Add a test vector for crypto_mac_sha3
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_crypto.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c index 87e309f25a..fd5a14b503 100644 --- a/src/test/test_crypto.c +++ b/src/test/test_crypto.c @@ -1043,6 +1043,7 @@ test_crypto_mac_sha3(void *arg) { const char msg[] = "i am in a library somewhere using my computer"; const char key[] = "i'm from the past talking to the future."; + char *mem_op_hex_tmp = NULL; uint8_t hmac_test[DIGEST256_LEN]; char hmac_manual[DIGEST256_LEN]; @@ -1077,7 +1078,12 @@ test_crypto_mac_sha3(void *arg) /* Now compare the two results */ tt_mem_op(hmac_test, OP_EQ, hmac_manual, DIGEST256_LEN); - done: ; + /* Check against a known correct value (computed from python) */ + test_memeq_hex(hmac_test, + "753fba6d87d49497238a512a3772dd29" + "1e55f7d1cd332c9fb5c967c7a10a13ca"); + done: + tor_free(mem_op_hex_tmp); } /** Run unit tests for our public key crypto functions */ |