From: Dmitry Eremin-Solenikov <[email protected]>

Signed-off-by: Dmitry Eremin-Solenikov <[email protected]>
---
/** Email created from pull request 23 (lumag:crypto-gcm)
 ** https://github.com/Linaro/odp/pull/23
 ** Patch: https://github.com/Linaro/odp/pull/23.patch
 ** Base sha: 79ba737a404d2833ad33d8f84ed6ce82c9a8c18e
 ** Merge commit sha: 112534710993d985f65827b45c81fc8fa9dec40f
 **/
 .../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 a415f5c..7fd23cd 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
@@ -689,10 +689,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]);
@@ -723,6 +726,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);
        }
 }
 
@@ -736,10 +756,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]);
@@ -768,6 +791,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);
        }
 }
 

Reply via email to