Skip to content

Commit 63774c0

Browse files
bairemonakhilnxp
authored andcommitted
test/ipsec: fix initialisation
Fix xform initialisation. Fix testsuite_setup. Remove unused variables. Fixes: 05fe65e ("test/ipsec: introduce functional test") Fixes: 59d7353 ("test/ipsec: fix test suite setup") Cc: [email protected] Signed-off-by: Bernard Iremonger <[email protected]> Acked-by: Konstantin Ananyev <[email protected]>
1 parent bf0cd22 commit 63774c0

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

app/test/test_ipsec.c

+15-19
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ struct ipsec_unitest_params {
7979
struct rte_mbuf *obuf[BURST_SIZE], *ibuf[BURST_SIZE],
8080
*testbuf[BURST_SIZE];
8181

82-
uint8_t *digest;
8382
uint16_t pkt_index;
8483
};
8584

@@ -111,8 +110,6 @@ static struct ipsec_testsuite_params testsuite_params = { NULL };
111110
static struct ipsec_unitest_params unittest_params;
112111
static struct user_params uparams;
113112

114-
static uint8_t global_key[128] = { 0 };
115-
116113
struct supported_cipher_algo {
117114
const char *keyword;
118115
enum rte_crypto_cipher_algorithm algo;
@@ -215,30 +212,26 @@ fill_crypto_xform(struct ipsec_unitest_params *ut_params,
215212
const struct supported_auth_algo *auth_algo,
216213
const struct supported_cipher_algo *cipher_algo)
217214
{
218-
ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
219-
ut_params->auth_xform.auth.algo = auth_algo->algo;
220-
ut_params->auth_xform.auth.key.data = global_key;
221-
ut_params->auth_xform.auth.key.length = auth_algo->key_len;
222-
ut_params->auth_xform.auth.digest_length = auth_algo->digest_len;
223-
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
224-
225215
ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
226216
ut_params->cipher_xform.cipher.algo = cipher_algo->algo;
227-
ut_params->cipher_xform.cipher.key.data = global_key;
228-
ut_params->cipher_xform.cipher.key.length = cipher_algo->key_len;
229-
ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT;
230-
ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
231-
ut_params->cipher_xform.cipher.iv.length = cipher_algo->iv_len;
217+
ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
218+
ut_params->auth_xform.auth.algo = auth_algo->algo;
232219

233220
if (ut_params->ipsec_xform.direction ==
234221
RTE_SECURITY_IPSEC_SA_DIR_INGRESS) {
235-
ut_params->crypto_xforms = &ut_params->auth_xform;
236-
ut_params->auth_xform.next = &ut_params->cipher_xform;
222+
ut_params->cipher_xform.cipher.op =
223+
RTE_CRYPTO_CIPHER_OP_DECRYPT;
224+
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
237225
ut_params->cipher_xform.next = NULL;
226+
ut_params->auth_xform.next = &ut_params->cipher_xform;
227+
ut_params->crypto_xforms = &ut_params->auth_xform;
238228
} else {
239-
ut_params->crypto_xforms = &ut_params->cipher_xform;
240-
ut_params->cipher_xform.next = &ut_params->auth_xform;
229+
ut_params->cipher_xform.cipher.op =
230+
RTE_CRYPTO_CIPHER_OP_ENCRYPT;
231+
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
241232
ut_params->auth_xform.next = NULL;
233+
ut_params->cipher_xform.next = &ut_params->auth_xform;
234+
ut_params->crypto_xforms = &ut_params->cipher_xform;
242235
}
243236
}
244237

@@ -287,9 +280,12 @@ testsuite_setup(void)
287280
int rc;
288281

289282
memset(ts_params, 0, sizeof(*ts_params));
283+
memset(ut_params, 0, sizeof(*ut_params));
284+
memset(&uparams, 0, sizeof(struct user_params));
290285

291286
uparams.auth = RTE_CRYPTO_SYM_XFORM_AUTH;
292287
uparams.cipher = RTE_CRYPTO_SYM_XFORM_CIPHER;
288+
uparams.aead = RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED;
293289
strcpy(uparams.auth_algo, "null");
294290
strcpy(uparams.cipher_algo, "null");
295291

0 commit comments

Comments
 (0)