@@ -79,6 +79,7 @@ static int alg_op(odp_packet_t pkt,
odp_bool_t *ok,
odp_crypto_session_t session,
uint8_t *op_iv_ptr,
+ uint8_t *op_auth_iv_ptr,
odp_packet_data_range_t *cipher_range,
odp_packet_data_range_t *auth_range,
uint8_t *aad,
@@ -99,8 +100,10 @@ static int alg_op(odp_packet_t pkt,
op_params.cipher_range = *cipher_range;
op_params.auth_range = *auth_range;
- if (op_iv_ptr)
+ if (op_iv_ptr) {
op_params.override_iv_ptr = op_iv_ptr;
+ op_params.override_auth_iv_ptr = op_auth_iv_ptr;
+ }
op_params.aad_ptr = aad;
@@ -154,6 +157,7 @@ static int alg_packet_op(odp_packet_t pkt,
odp_bool_t *ok,
odp_crypto_session_t session,
uint8_t *op_iv_ptr,
+ uint8_t *op_auth_iv_ptr,
odp_packet_data_range_t *cipher_range,
odp_packet_data_range_t *auth_range,
uint8_t *aad,
@@ -171,8 +175,10 @@ static int alg_packet_op(odp_packet_t pkt,
op_params.cipher_range = *cipher_range;
op_params.auth_range = *auth_range;
- if (op_iv_ptr)
+ if (op_iv_ptr) {
op_params.override_iv_ptr = op_iv_ptr;
+ op_params.override_auth_iv_ptr = op_auth_iv_ptr;
+ }
op_params.aad_ptr = aad;
@@ -211,6 +217,7 @@ static int alg_packet_op_enq(odp_packet_t pkt,
odp_bool_t *ok,
odp_crypto_session_t session,
uint8_t *op_iv_ptr,
+ uint8_t *op_auth_iv_ptr,
odp_packet_data_range_t *cipher_range,
odp_packet_data_range_t *auth_range,
uint8_t *aad,
@@ -229,8 +236,10 @@ static int alg_packet_op_enq(odp_packet_t pkt,
op_params.cipher_range = *cipher_range;
op_params.auth_range = *auth_range;
- if (op_iv_ptr)
+ if (op_iv_ptr) {
op_params.override_iv_ptr = op_iv_ptr;
+ op_params.override_auth_iv_ptr = op_auth_iv_ptr;
+ }
op_params.aad_ptr = aad;
@@ -494,16 +503,19 @@ static void alg_test(odp_crypto_op_t op,
if (!suite_context.packet)
rc = alg_op(pkt, &ok, session,
ovr_iv ? ref->iv : NULL,
+ ovr_iv ? ref->auth_iv : NULL,
&cipher_range, &auth_range,
ref->aad, ref->length);
else if (ODP_CRYPTO_ASYNC == suite_context.op_mode)
rc = alg_packet_op_enq(pkt, &ok, session,
ovr_iv ? ref->iv : NULL,
+ ovr_iv ? ref->auth_iv : NULL,
&cipher_range, &auth_range,
ref->aad, ref->length);
else
rc = alg_packet_op(pkt, &ok, session,
ovr_iv ? ref->iv : NULL,
+ ovr_iv ? ref->auth_iv : NULL,
&cipher_range, &auth_range,
ref->aad, ref->length);
if (rc < 0)
@@ -1167,6 +1179,20 @@ static void crypto_test_gen_alg_aes_gmac(void)
false);
}
+static void crypto_test_gen_alg_aes_gmac_ovr_iv(void)
+{
+ unsigned int test_vec_num = (sizeof(aes_gmac_reference) /
+ sizeof(aes_gmac_reference[0]));
+ unsigned int i;
+
+ for (i = 0; i < test_vec_num; i++)
+ alg_test(ODP_CRYPTO_OP_ENCODE,
+ ODP_CIPHER_ALG_NULL,
+ ODP_AUTH_ALG_AES_GMAC,
+ &aes_gmac_reference[i],
+ true);
+}
+
static void crypto_test_check_alg_aes_gmac(void)
{
unsigned int test_vec_num = (sizeof(aes_gmac_reference) /
@@ -1181,6 +1207,20 @@ static void crypto_test_check_alg_aes_gmac(void)
false);
}
+static void crypto_test_check_alg_aes_gmac_ovr_iv(void)
+{
+ unsigned int test_vec_num = (sizeof(aes_gmac_reference) /
+ sizeof(aes_gmac_reference[0]));
+ unsigned int i;
+
+ for (i = 0; i < test_vec_num; i++)
+ alg_test(ODP_CRYPTO_OP_DECODE,
+ ODP_CIPHER_ALG_NULL,
+ ODP_AUTH_ALG_AES_GMAC,
+ &aes_gmac_reference[i],
+ true);
+}
+
int crypto_suite_sync_init(void)
{
suite_context.pool = odp_pool_lookup("packet_pool");
@@ -1288,8 +1328,12 @@ odp_testinfo_t crypto_suite[] = {
check_alg_hmac_sha512),
ODP_TEST_INFO_CONDITIONAL(crypto_test_gen_alg_aes_gmac,
check_alg_aes_gmac),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_gen_alg_aes_gmac_ovr_iv,
+ check_alg_aes_gmac),
ODP_TEST_INFO_CONDITIONAL(crypto_test_check_alg_aes_gmac,
check_alg_aes_gmac),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_check_alg_aes_gmac_ovr_iv,
+ check_alg_aes_gmac),
ODP_TEST_INFO_NULL,
};