mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-06 01:30:49 +02:00
F-2192 - Add negative test for AES-SIV authentication tag verification
This commit is contained in:
@@ -66715,6 +66715,29 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes_siv_test(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Negative test: corrupted SIV must be rejected with AES_SIV_AUTH_E. */
|
||||
{
|
||||
ret = wc_AesSivEncrypt(testVectors[0].key, testVectors[0].keySz,
|
||||
testVectors[0].assoc1, testVectors[0].assoc1Sz,
|
||||
testVectors[0].nonce, testVectors[0].nonceSz,
|
||||
testVectors[0].plaintext,
|
||||
testVectors[0].plaintextSz, siv,
|
||||
computedCiphertext);
|
||||
if (ret != 0) {
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
}
|
||||
/* Corrupt one byte of the SIV tag. */
|
||||
siv[0] ^= 0x01;
|
||||
ret = wc_AesSivDecrypt(testVectors[0].key, testVectors[0].keySz,
|
||||
testVectors[0].assoc1, testVectors[0].assoc1Sz,
|
||||
testVectors[0].nonce, testVectors[0].nonceSz,
|
||||
computedCiphertext, testVectors[0].plaintextSz,
|
||||
siv, computedPlaintext);
|
||||
if (ret != AES_SIV_AUTH_E) {
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
+2
-2
@@ -28,8 +28,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define LIBWOLFSSL_VERSION_STRING "5.9.0"
|
||||
#define LIBWOLFSSL_VERSION_HEX 0x05009000
|
||||
#define LIBWOLFSSL_VERSION_STRING "5.8.4"
|
||||
#define LIBWOLFSSL_VERSION_HEX 0x05008004
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user