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

Closes #11
这个提交包含在:
Thom Wiggers 2019-01-29 16:05:44 +01:00
父节点 31449679bd
当前提交 37be4a2044
找不到此签名对应的密钥
GPG 密钥 ID: 001BB0A7CE26E363
共有 2 个文件被更改,包括 3 次插入3 次删除

查看文件

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

查看文件

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