1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-22 23:48:58 +00:00

Don't fail if decapsulating with wrong keys doesn't return -1

Closes #11
This commit is contained in:
Thom Wiggers 2019-01-29 16:05:44 +01:00
parent 31449679bd
commit 37be4a2044
No known key found for this signature in database
GPG Key ID: 001BB0A7CE26E363
2 changed files with 3 additions and 3 deletions

View File

@ -42,7 +42,7 @@ _The checking of items on this list is still being developed. Checked items shou
* [x] `randombytes.c` * [x] `randombytes.c`
* [ ] API functions return `0` on success, negative on failure * [ ] API functions return `0` on success, negative on failure
* [x] 0 on success * [x] 0 on success
* [ ] Negative on failure (currently: partially) * [ ] Negative on failure (within restrictions of FO transform).
* [ ] No dynamic memory allocations * [ ] No dynamic memory allocations
* [ ] No branching on secret data (dynamically checked using valgrind) * [ ] No branching on secret data (dynamically checked using valgrind)
* [ ] No access to secret memory locations (dynamically checked using valgrind) * [ ] No access to secret memory locations (dynamically checked using valgrind)

View File

@ -137,8 +137,8 @@ static int test_invalid_ciphertext(void) {
sendb[pos % CRYPTO_CIPHERTEXTBYTES] ^= 23; sendb[pos % CRYPTO_CIPHERTEXTBYTES] ^= 23;
// Alice uses Bobs response to get her secret key // Alice uses Bobs response to get her secret key
if ((returncode = crypto_kem_dec(key_a, sendb, sk_a)) > -1) { if ((returncode = crypto_kem_dec(key_a, sendb, sk_a)) > 0) {
printf("ERROR crypto_kem_dec should fail (negative returncode) but returned %d\n", returncode); printf("ERROR crypto_kem_dec should either fail (negative returncode) or succeed (return 0) but returned %d\n", returncode);
return -1; return -1;
} }