From patchwork Sun Oct 11 21:34:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil Goyal X-Patchwork-Id: 80315 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4470AA04B6; Sun, 11 Oct 2020 23:36:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 35ADD1D5FA; Sun, 11 Oct 2020 23:34:31 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 16F551D597; Sun, 11 Oct 2020 23:34:20 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id EE1371A0D1A; Sun, 11 Oct 2020 23:34:19 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 14AF21A0D16; Sun, 11 Oct 2020 23:34:16 +0200 (CEST) Received: from lsv03273.swis.in-blr01.nxp.com (lsv03273.swis.in-blr01.nxp.com [92.120.147.113]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 6F0F94032B; Sun, 11 Oct 2020 23:34:10 +0200 (CEST) From: Akhil Goyal To: dev@dpdk.org, techboard@dpdk.org Cc: thomas@monjalon.net, anoobj@marvell.com, hemant.agrawal@nxp.com, declan.doherty@intel.com, david.coyle@intel.com, Franck LENORMAND , Akhil Goyal Date: Mon, 12 Oct 2020 03:04:03 +0530 Message-Id: <20201011213403.21169-9-akhil.goyal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201011213403.21169-1-akhil.goyal@nxp.com> References: <20200903160652.31654-1-akhil.goyal@nxp.com> <20201011213403.21169-1-akhil.goyal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v2 8/8] test/crypto: Add PDCP-SDAP cases X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Franck LENORMAND A new functions which uses the structure of the test vectors for SDAP is added and call a functions responsible to call the test_pdcp_proto with the test vector both for encapsulation and decapsulation. Signed-off-by: Franck LENORMAND Signed-off-by: Akhil Goyal --- app/test/test_cryptodev.c | 95 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 7cea914f9..590691521 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2015-2020 Intel Corporation + * Copyright 2020 NXP */ #include @@ -42,8 +43,12 @@ #include "test_cryptodev_mixed_test_vectors.h" #ifdef RTE_LIBRTE_SECURITY #include "test_cryptodev_security_pdcp_test_vectors.h" +#include "test_cryptodev_security_pdcp_sdap_test_vectors.h" #include "test_cryptodev_security_pdcp_test_func.h" #include "test_cryptodev_security_docsis_test_vectors.h" + +#define SDAP_DISABLED 0 +#define SDAP_ENABLED 1 #endif #define VDEV_ARGS_SIZE 100 @@ -52,6 +57,10 @@ #define IN_PLACE 0 #define OUT_OF_PLACE 1 +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#endif + static int gbl_driver_id; static enum rte_security_session_action_type gbl_action_type = @@ -7743,6 +7752,90 @@ test_PDCP_PROTO_SGL_oop_128B_32B(void) 128, 32); } +static int +test_PDCP_SDAP_PROTO_encap_all(void) +{ + int i = 0, size = 0; + int err, all_err = TEST_SUCCESS; + const struct pdcp_sdap_test *cur_test; + + size = ARRAY_SIZE(list_pdcp_sdap_tests); + + for (i = 0; i < size; i++) { + cur_test = &list_pdcp_sdap_tests[i]; + err = test_pdcp_proto( + i, 0, RTE_CRYPTO_CIPHER_OP_ENCRYPT, + RTE_CRYPTO_AUTH_OP_GENERATE, cur_test->data_in, + cur_test->in_len, cur_test->data_out, + cur_test->in_len + ((cur_test->auth_key) ? 4 : 0), + cur_test->param.cipher_alg, cur_test->cipher_key, + cur_test->param.cipher_key_len, + cur_test->param.auth_alg, + cur_test->auth_key, cur_test->param.auth_key_len, + cur_test->bearer, cur_test->param.domain, + cur_test->packet_direction, cur_test->sn_size, + cur_test->hfn, + cur_test->hfn_threshold, SDAP_ENABLED); + if (err) { + printf("\t%d) %s: Encapsulation failed\n", + cur_test->test_idx, + cur_test->param.name); + err = TEST_FAILED; + } else { + printf("\t%d) %s: Encap PASS\n", cur_test->test_idx, + cur_test->param.name); + err = TEST_SUCCESS; + } + all_err += err; + } + + printf("Success: %d, Failure: %d\n", size + all_err, -all_err); + + return (all_err == TEST_SUCCESS) ? TEST_SUCCESS : TEST_FAILED; +} + +static int +test_PDCP_SDAP_PROTO_decap_all(void) +{ + int i = 0, size = 0; + int err, all_err = TEST_SUCCESS; + const struct pdcp_sdap_test *cur_test; + + size = ARRAY_SIZE(list_pdcp_sdap_tests); + + for (i = 0; i < size; i++) { + cur_test = &list_pdcp_sdap_tests[i]; + err = test_pdcp_proto( + i, 0, RTE_CRYPTO_CIPHER_OP_DECRYPT, + RTE_CRYPTO_AUTH_OP_VERIFY, + cur_test->data_out, + cur_test->in_len + ((cur_test->auth_key) ? 4 : 0), + cur_test->data_in, cur_test->in_len, + cur_test->param.cipher_alg, + cur_test->cipher_key, cur_test->param.cipher_key_len, + cur_test->param.auth_alg, cur_test->auth_key, + cur_test->param.auth_key_len, cur_test->bearer, + cur_test->param.domain, cur_test->packet_direction, + cur_test->sn_size, cur_test->hfn, + cur_test->hfn_threshold, SDAP_ENABLED); + if (err) { + printf("\t%d) %s: Decapsulation failed\n", + cur_test->test_idx, + cur_test->param.name); + err = TEST_FAILED; + } else { + printf("\t%d) %s: Decap PASS\n", cur_test->test_idx, + cur_test->param.name); + err = TEST_SUCCESS; + } + all_err += err; + } + + printf("Success: %d, Failure: %d\n", size + all_err, -all_err); + + return (all_err == TEST_SUCCESS) ? TEST_SUCCESS : TEST_FAILED; +} + static int test_PDCP_PROTO_all(void) { @@ -7774,6 +7867,8 @@ test_PDCP_PROTO_all(void) status += test_PDCP_PROTO_SGL_oop_32B_128B(); status += test_PDCP_PROTO_SGL_oop_32B_40B(); status += test_PDCP_PROTO_SGL_oop_128B_32B(); + status += test_PDCP_SDAP_PROTO_encap_all(); + status += test_PDCP_SDAP_PROTO_decap_all(); if (status) return TEST_FAILED;