From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C0C5545844; Thu, 22 Aug 2024 09:41:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BDCE042E8F; Thu, 22 Aug 2024 09:41:28 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 71EFD42E75 for ; Thu, 22 Aug 2024 09:41:23 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47M1U7G7009992; Thu, 22 Aug 2024 00:41:22 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=c nNB3cggIce/WyKCpEjrxQtrDoIlOkERdnlw7icgJfs=; b=Fmds+9X7/wIsG8mao bjodnqHay4pyntDGSGPIOUPG9Gu3vVgeyhfmE42X+bKLUBnwj48q1kbK7ZJmxJAy SZq2mNGHW6rmS84sF86EwmBeVlDOKR11ztWWKh4xP+083c+G7/1H3J+rGU89ioNd BlVFlacCtiL++WPkweysLUM4TVnDEDMCZ/ac+aoigcrC48sN3Pnqv1Wv5S3rPgF9 QWUqkBJiIhT6NL9BHB2RgIhuy2EG69nzdtdi+4WFDJAParR7oeXGjZduWIDPurKa uDv1+r5ltWuSVBfnGewLQO/eE7ccrcybtRL8rTUxlolypgSQQfNrIfJQud3TnGpk ArqgA== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 415uqns0yr-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Aug 2024 00:41:22 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 22 Aug 2024 00:41:20 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 22 Aug 2024 00:41:20 -0700 Received: from anoobj2204.marvell.com (unknown [10.28.34.118]) by maili.marvell.com (Postfix) with ESMTP id 1694B5B6C4D; Thu, 22 Aug 2024 00:16:55 -0700 (PDT) From: Anoob Joseph To: Akhil Goyal , Fan Zhang CC: Hemant Agrawal , Jerin Jacob , Aakash Sasidharan , Tejasree Kondoj , Vidya Sagar Velumuri , Subject: [PATCH 1/6] test/crypto: add asserts to validate test lengths Date: Thu, 22 Aug 2024 07:16:29 +0000 Message-ID: <20240822071651.2403105-2-anoobj@marvell.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240822071651.2403105-1-anoobj@marvell.com> References: <20240822071651.2403105-1-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: Pukk50bOJaNizUw4pyuBuTeMSscZOLML X-Proofpoint-ORIG-GUID: Pukk50bOJaNizUw4pyuBuTeMSscZOLML X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-22_03,2024-08-19_03,2024-05-17_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add asserts to validate the max lengths set. Signed-off-by: Anoob Joseph --- app/test/test_cryptodev.c | 2 +- app/test/test_cryptodev.h | 2 ++ app/test/test_cryptodev_aead_test_vectors.h | 14 +++++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 0c445f9eae..9d8ca8f616 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -665,7 +665,7 @@ testsuite_setup(void) /* Not already created so create */ ts_params->large_mbuf_pool = rte_pktmbuf_pool_create( "CRYPTO_LARGE_MBUFPOOL", - 1, 0, 0, UINT16_MAX, + 1, 0, 0, LARGE_MBUF_SIZE, rte_socket_id()); if (ts_params->large_mbuf_pool == NULL) { RTE_LOG(ERR, USER1, diff --git a/app/test/test_cryptodev.h b/app/test/test_cryptodev.h index fd9ea0dd81..af56145cdd 100644 --- a/app/test/test_cryptodev.h +++ b/app/test/test_cryptodev.h @@ -24,6 +24,8 @@ #define MBUF_DATAPAYLOAD_SIZE (4096 + DIGEST_BYTE_LENGTH_SHA512) #define MBUF_SIZE (sizeof(struct rte_mbuf) + \ RTE_PKTMBUF_HEADROOM + MBUF_DATAPAYLOAD_SIZE) +#define LARGE_MBUF_DATAPAYLOAD_SIZE (UINT16_MAX - RTE_PKTMBUF_HEADROOM) +#define LARGE_MBUF_SIZE (RTE_PKTMBUF_HEADROOM + LARGE_MBUF_DATAPAYLOAD_SIZE) #define BYTE_LENGTH(x) (x/8) /* HASH DIGEST LENGTHS */ diff --git a/app/test/test_cryptodev_aead_test_vectors.h b/app/test/test_cryptodev_aead_test_vectors.h index e9b0590048..73bfb8dad4 100644 --- a/app/test/test_cryptodev_aead_test_vectors.h +++ b/app/test/test_cryptodev_aead_test_vectors.h @@ -5,11 +5,23 @@ #ifndef TEST_CRYPTODEV_AEAD_TEST_VECTORS_H_ #define TEST_CRYPTODEV_AEAD_TEST_VECTORS_H_ +#include "test_cryptodev.h" + #define GMAC_LARGE_PLAINTEXT_LENGTH 65344 -#define MAX_AAD_LENGTH 65536 +#define MAX_AAD_LENGTH (65535 - RTE_PKTMBUF_HEADROOM) #define GCM_LARGE_AAD_LENGTH 65296 #define AEAD_TEXT_MAX_LENGTH 8096 +static_assert(GMAC_LARGE_PLAINTEXT_LENGTH <= LARGE_MBUF_DATAPAYLOAD_SIZE, + "GMAC_LARGE_PLAINTEXT_LENGTH should not be greater than LARGE_MBUF_DATAPAYLOAD_SIZE"); +static_assert(MAX_AAD_LENGTH <= LARGE_MBUF_DATAPAYLOAD_SIZE, + "MAX_AAD_LENGTH should not be greater than LARGE_MBUF_DATAPAYLOAD_SIZE"); +static_assert(GCM_LARGE_AAD_LENGTH <= LARGE_MBUF_DATAPAYLOAD_SIZE, + "GCM_LARGE_AAD_LENGTH should not be greater than LARGE_MBUF_DATAPAYLOAD_SIZE"); +static_assert(AEAD_TEXT_MAX_LENGTH <= LARGE_MBUF_DATAPAYLOAD_SIZE, + "AEAD_TEXT_MAX_LENGTH should not be greater than LARGE_MBUF_DATAPAYLOAD_SIZE"); + + static uint8_t gcm_aad_zero_text[MAX_AAD_LENGTH] = { 0 }; static uint8_t gcm_aad_text[MAX_AAD_LENGTH] = { -- 2.45.2