diff mbox series

[API-NEXT,v1,7/7] test: crypto: explicitly pass AAD to crypto subsystem

Message ID 1493953207-9115-5-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [API-NEXT,v1,1/7] linux: crypto: use auth_digest_len when calculating HMACs | expand

Commit Message

Github ODP bot May 5, 2017, 3 a.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** 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    | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)
diff mbox series

Patch

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 16c2efa..5c36f87 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
@@ -74,6 +74,8 @@  static void alg_test(odp_crypto_op_t op,
 		     odp_crypto_key_t auth_key,
 		     odp_crypto_data_range_t *cipher_range,
 		     odp_crypto_data_range_t *auth_range,
+		     uint8_t *aad,
+		     uint32_t aad_len,
 		     const uint8_t *plaintext,
 		     unsigned int plaintext_len,
 		     const uint8_t *ciphertext,
@@ -240,6 +242,9 @@  static void alg_test(odp_crypto_op_t op,
 	if (op_iv_ptr)
 		op_params.override_iv_ptr = op_iv_ptr;
 
+	op_params.aad.ptr = aad;
+	op_params.aad.length = aad_len;
+
 	op_params.hash_result_offset = plaintext_len;
 	if (0 != digest_len) {
 		memcpy(data_addr + op_params.hash_result_offset,
@@ -472,6 +477,7 @@  void crypto_test_enc_alg_3des_cbc(void)
 			 ODP_AUTH_ALG_NULL,
 			 auth_key,
 			 NULL, NULL,
+			 NULL, 0,
 			 tdes_cbc_reference_plaintext[i],
 			 tdes_cbc_reference_length[i],
 			 tdes_cbc_reference_ciphertext[i],
@@ -508,6 +514,7 @@  void crypto_test_enc_alg_3des_cbc_ovr_iv(void)
 			 ODP_AUTH_ALG_NULL,
 			 auth_key,
 			 NULL, NULL,
+			 NULL, 0,
 			 tdes_cbc_reference_plaintext[i],
 			 tdes_cbc_reference_length[i],
 			 tdes_cbc_reference_ciphertext[i],
@@ -548,6 +555,7 @@  void crypto_test_dec_alg_3des_cbc(void)
 			 ODP_AUTH_ALG_NULL,
 			 auth_key,
 			 NULL, NULL,
+			 NULL, 0,
 			 tdes_cbc_reference_ciphertext[i],
 			 tdes_cbc_reference_length[i],
 			 tdes_cbc_reference_plaintext[i],
@@ -586,6 +594,7 @@  void crypto_test_dec_alg_3des_cbc_ovr_iv(void)
 			 ODP_AUTH_ALG_NULL,
 			 auth_key,
 			 NULL, NULL,
+			 NULL, 0,
 			 tdes_cbc_reference_ciphertext[i],
 			 tdes_cbc_reference_length[i],
 			 tdes_cbc_reference_plaintext[i],
@@ -635,6 +644,9 @@  void crypto_test_enc_alg_aes128_gcm(void)
 			 &aes128_gcm_cipher_range[i],
 			 &aes128_gcm_auth_range[i],
 			 aes128_gcm_reference_plaintext[i],
+			 aes128_gcm_cipher_range[i].offset -
+			 aes128_gcm_auth_range[i].offset,
+			 aes128_gcm_reference_plaintext[i],
 			 aes128_gcm_reference_length[i],
 			 aes128_gcm_reference_ciphertext[i],
 			 aes128_gcm_reference_length[i],
@@ -679,6 +691,9 @@  void crypto_test_enc_alg_aes128_gcm_ovr_iv(void)
 			 &aes128_gcm_cipher_range[i],
 			 &aes128_gcm_auth_range[i],
 			 aes128_gcm_reference_plaintext[i],
+			 aes128_gcm_cipher_range[i].offset -
+			 aes128_gcm_auth_range[i].offset,
+			 aes128_gcm_reference_plaintext[i],
 			 aes128_gcm_reference_length[i],
 			 aes128_gcm_reference_ciphertext[i],
 			 aes128_gcm_reference_length[i],
@@ -728,6 +743,9 @@  void crypto_test_dec_alg_aes128_gcm(void)
 			 auth_key,
 			 &aes128_gcm_cipher_range[i],
 			 &aes128_gcm_auth_range[i],
+			 aes128_gcm_reference_plaintext[i],
+			 aes128_gcm_cipher_range[i].offset -
+			 aes128_gcm_auth_range[i].offset,
 			 aes128_gcm_reference_ciphertext[i],
 			 aes128_gcm_reference_length[i] + aes128_gcm_reference_tag_length[i],
 			 aes128_gcm_reference_plaintext[i],
@@ -746,6 +764,9 @@  void crypto_test_dec_alg_aes128_gcm(void)
 			 auth_key,
 			 &aes128_gcm_cipher_range[i],
 			 &aes128_gcm_auth_range[i],
+			 aes128_gcm_reference_plaintext[i],
+			 aes128_gcm_cipher_range[i].offset -
+			 aes128_gcm_auth_range[i].offset,
 			 aes128_gcm_reference_ciphertext[i],
 			 aes128_gcm_reference_length[i] + aes128_gcm_reference_tag_length[i],
 			 aes128_gcm_reference_plaintext[i],
@@ -793,6 +814,9 @@  void crypto_test_dec_alg_aes128_gcm_ovr_iv(void)
 			 auth_key,
 			 &aes128_gcm_cipher_range[i],
 			 &aes128_gcm_auth_range[i],
+			 aes128_gcm_reference_plaintext[i],
+			 aes128_gcm_cipher_range[i].offset -
+			 aes128_gcm_auth_range[i].offset,
 			 aes128_gcm_reference_ciphertext[i],
 			 aes128_gcm_reference_length[i] + aes128_gcm_reference_tag_length[i],
 			 aes128_gcm_reference_plaintext[i],
@@ -811,6 +835,9 @@  void crypto_test_dec_alg_aes128_gcm_ovr_iv(void)
 			 auth_key,
 			 &aes128_gcm_cipher_range[i],
 			 &aes128_gcm_auth_range[i],
+			 aes128_gcm_reference_plaintext[i],
+			 aes128_gcm_cipher_range[i].offset -
+			 aes128_gcm_auth_range[i].offset,
 			 aes128_gcm_reference_ciphertext[i],
 			 aes128_gcm_reference_length[i] + aes128_gcm_reference_tag_length[i],
 			 aes128_gcm_reference_plaintext[i],
@@ -857,6 +884,7 @@  void crypto_test_enc_alg_aes128_cbc(void)
 			 ODP_AUTH_ALG_NULL,
 			 auth_key,
 			 NULL, NULL,
+			 NULL, 0,
 			 aes128_cbc_reference_plaintext[i],
 			 aes128_cbc_reference_length[i],
 			 aes128_cbc_reference_ciphertext[i],
@@ -893,6 +921,7 @@  void crypto_test_enc_alg_aes128_cbc_ovr_iv(void)
 			 ODP_AUTH_ALG_NULL,
 			 auth_key,
 			 NULL, NULL,
+			 NULL, 0,
 			 aes128_cbc_reference_plaintext[i],
 			 aes128_cbc_reference_length[i],
 			 aes128_cbc_reference_ciphertext[i],
@@ -933,6 +962,7 @@  void crypto_test_dec_alg_aes128_cbc(void)
 			 ODP_AUTH_ALG_NULL,
 			 auth_key,
 			 NULL, NULL,
+			 NULL, 0,
 			 aes128_cbc_reference_ciphertext[i],
 			 aes128_cbc_reference_length[i],
 			 aes128_cbc_reference_plaintext[i],
@@ -971,6 +1001,7 @@  void crypto_test_dec_alg_aes128_cbc_ovr_iv(void)
 			 ODP_AUTH_ALG_NULL,
 			 auth_key,
 			 NULL, NULL,
+			 NULL, 0,
 			 aes128_cbc_reference_ciphertext[i],
 			 aes128_cbc_reference_length[i],
 			 aes128_cbc_reference_plaintext[i],
@@ -1017,6 +1048,7 @@  void crypto_test_gen_alg_hmac_md5(void)
 			 ODP_AUTH_ALG_MD5_HMAC,
 			 auth_key,
 			 NULL, NULL,
+			 NULL, 0,
 			 hmac_md5_reference_plaintext[i],
 			 hmac_md5_reference_length[i],
 			 NULL, 0,
@@ -1055,6 +1087,7 @@  void crypto_test_check_alg_hmac_md5(void)
 			 ODP_AUTH_ALG_MD5_HMAC,
 			 auth_key,
 			 NULL, NULL,
+			 NULL, 0,
 			 hmac_md5_reference_plaintext[i],
 			 hmac_md5_reference_length[i],
 			 NULL, 0,
@@ -1070,6 +1103,7 @@  void crypto_test_check_alg_hmac_md5(void)
 			 ODP_AUTH_ALG_MD5_HMAC,
 			 auth_key,
 			 NULL, NULL,
+			 NULL, 0,
 			 hmac_md5_reference_plaintext[i],
 			 hmac_md5_reference_length[i],
 			 NULL, 0,
@@ -1119,6 +1153,7 @@  void crypto_test_gen_alg_hmac_sha256(void)
 			 ODP_AUTH_ALG_SHA256_HMAC,
 			 auth_key,
 			 NULL, NULL,
+			 NULL, 0,
 			 hmac_sha256_reference_plaintext[i],
 			 hmac_sha256_reference_length[i],
 			 NULL, 0,
@@ -1159,6 +1194,7 @@  void crypto_test_check_alg_hmac_sha256(void)
 			 ODP_AUTH_ALG_SHA256_HMAC,
 			 auth_key,
 			 NULL, NULL,
+			 NULL, 0,
 			 hmac_sha256_reference_plaintext[i],
 			 hmac_sha256_reference_length[i],
 			 NULL, 0,
@@ -1174,6 +1210,7 @@  void crypto_test_check_alg_hmac_sha256(void)
 			 ODP_AUTH_ALG_SHA256_HMAC,
 			 auth_key,
 			 NULL, NULL,
+			 NULL, 0,
 			 hmac_sha256_reference_plaintext[i],
 			 hmac_sha256_reference_length[i],
 			 NULL, 0,