From: Dmitry Eremin-Solenikov <[email protected]>
Signed-off-by: Dmitry Eremin-Solenikov <[email protected]>
---
/** Email created from pull request 24 (lumag:crypto-dal)
** https://github.com/Linaro/odp/pull/24
** Patch: https://github.com/Linaro/odp/pull/24.patch
** Base sha: 540490ddf3a1b3da4b80ed15fc874ccdfc49b60c
** Merge commit sha: d097dfa56ce6abf579ef39d07f3ac39d6badbc92
**/
.../validation/api/crypto/odp_crypto_test_inp.c | 40 ++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
index db380c2..de48ac0 100644
--- a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
+++ b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
@@ -697,10 +697,13 @@ void crypto_test_dec_alg_aes128_gcm(void)
odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 },
auth_key = { .data = NULL, .length = 0 };
odp_crypto_iv_t iv = { .data = NULL, .length = AES128_GCM_IV_LEN };
+ uint8_t wrong_digest[AES128_GCM_DIGEST_LEN];
unsigned int test_vec_num = (sizeof(aes128_gcm_reference_length) /
sizeof(aes128_gcm_reference_length[0]));
unsigned int i;
+ memset(wrong_digest, 0xa5, sizeof(wrong_digest));
+
for (i = 0; i < test_vec_num; i++) {
cipher_key.data = aes128_gcm_reference_key[i];
cipher_key.length = sizeof(aes128_gcm_reference_key[i]);
@@ -731,6 +734,23 @@ void crypto_test_dec_alg_aes128_gcm(void)
aes128_gcm_reference_ciphertext[i] +
aes128_gcm_reference_length[i],
AES128_GCM_CHECK_LEN);
+
+ alg_test(ODP_CRYPTO_OP_DECODE,
+ 1,
+ ODP_CIPHER_ALG_AES_GCM,
+ iv,
+ NULL,
+ cipher_key,
+ ODP_AUTH_ALG_AES_GCM,
+ auth_key,
+ &aes128_gcm_cipher_range[i],
+ &aes128_gcm_auth_range[i],
+ aes128_gcm_reference_ciphertext[i],
+ aes128_gcm_reference_length[i] + AES128_GCM_CHECK_LEN,
+ aes128_gcm_reference_plaintext[i],
+ aes128_gcm_reference_length[i],
+ wrong_digest,
+ AES128_GCM_CHECK_LEN);
}
}
@@ -744,10 +764,13 @@ void crypto_test_dec_alg_aes128_gcm_ovr_iv(void)
odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 },
auth_key = { .data = NULL, .length = 0 };
odp_crypto_iv_t iv = { .data = NULL, .length = AES128_GCM_IV_LEN };
+ uint8_t wrong_digest[AES128_GCM_DIGEST_LEN];
unsigned int test_vec_num = (sizeof(aes128_gcm_reference_length) /
sizeof(aes128_gcm_reference_length[0]));
unsigned int i;
+ memset(wrong_digest, 0xa5, sizeof(wrong_digest));
+
for (i = 0; i < test_vec_num; i++) {
cipher_key.data = aes128_gcm_reference_key[i];
cipher_key.length = sizeof(aes128_gcm_reference_key[i]);
@@ -776,6 +799,23 @@ void crypto_test_dec_alg_aes128_gcm_ovr_iv(void)
aes128_gcm_reference_ciphertext[i] +
aes128_gcm_reference_length[i],
AES128_GCM_CHECK_LEN);
+
+ alg_test(ODP_CRYPTO_OP_DECODE,
+ 1,
+ ODP_CIPHER_ALG_AES_GCM,
+ iv,
+ aes128_gcm_reference_iv[i],
+ cipher_key,
+ ODP_AUTH_ALG_AES_GCM,
+ auth_key,
+ &aes128_gcm_cipher_range[i],
+ &aes128_gcm_auth_range[i],
+ aes128_gcm_reference_ciphertext[i],
+ aes128_gcm_reference_length[i] + AES128_GCM_CHECK_LEN,
+ aes128_gcm_reference_plaintext[i],
+ aes128_gcm_reference_length[i],
+ wrong_digest,
+ AES128_GCM_CHECK_LEN);
}
}