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 A851CA00C4; Wed, 28 Sep 2022 14:46:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF53C42825; Wed, 28 Sep 2022 14:45:57 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id AAF0F4113C for ; Wed, 28 Sep 2022 14:45:54 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28SA4cpY003076; Wed, 28 Sep 2022 05:45:53 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=58/O1mcwTDicOvDIlhmklHYq1AvzXWa785ByM9CWvns=; b=MMmFzqW8nNbZybH5/zgSb9J4J2AJGqdkVzKTCmaRPPPRhB/ewe0hd/X++XM7u9INRk2A NgarPHXJ727BbfSDqcgcGTEGcG5YoUdQOyS9MzUVag7HMsCaunN4X/qLqXEVEsojck47 71OddDQ8LUziOdv7yTF50sWwsbsOfUQMrG2plXXlIkzymOpxmln/Eor0EJagGu7tLalH 5Go8yba3z0S3hBeKgtSZ6Ro2U6pk0+YgoLYRfG1xVAiUkhx6yrSlUA/zcCSsJYINDBJc MmnRtEjsrU/mBU1a9a9Hlkqk091v0LKTHu2mU+9Bur1gQTs0+mVqJk4Ef0lJgGZoo5Gf 8w== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3jvjkk8skd-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 28 Sep 2022 05:45:51 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 28 Sep 2022 05:45:34 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 28 Sep 2022 05:45:34 -0700 Received: from localhost.localdomain (unknown [10.28.36.102]) by maili.marvell.com (Postfix) with ESMTP id 304A53F7080; Wed, 28 Sep 2022 05:45:29 -0700 (PDT) From: Akhil Goyal To: CC: , , , , , , , , , , , , , , , Akhil Goyal Subject: [PATCH 2/5] common/cnxk: derive hash key for MACsec Date: Wed, 28 Sep 2022 18:15:13 +0530 Message-ID: <20220928124516.93050-3-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220928124516.93050-1-gakhil@marvell.com> References: <20220928122253.23108-4-gakhil@marvell.com> <20220928124516.93050-1-gakhil@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: 6hwHOgjpzNrSNPQGNDK474LidMphZfDw X-Proofpoint-ORIG-GUID: 6hwHOgjpzNrSNPQGNDK474LidMphZfDw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-28_06,2022-09-28_01,2022-06-22_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 Signed-off-by: Akhil Goyal --- drivers/common/cnxk/roc_aes.c | 17 +++++++++++++++++ drivers/common/cnxk/roc_aes.h | 2 ++ drivers/common/cnxk/version.map | 1 + 3 files changed, 20 insertions(+) diff --git a/drivers/common/cnxk/roc_aes.c b/drivers/common/cnxk/roc_aes.c index f821c8b710..f69ecc1d58 100644 --- a/drivers/common/cnxk/roc_aes.c +++ b/drivers/common/cnxk/roc_aes.c @@ -206,3 +206,20 @@ roc_aes_xcbc_key_derive(const uint8_t *auth_key, uint8_t *derived_key) cipher(k3, derived_key, aes_ks); } + +void +roc_aes_hash_key_derive(const uint8_t *key, uint16_t len, uint8_t hash_key[]) +{ + uint32_t aes_ks[KEY_SCHEDULE_LEN] = {0}; + uint8_t data[16] = {0x0}; + int i; + + if (len == 16) { + aes_key_expand(key, aes_ks); + cipher(data, hash_key, aes_ks); + for (i = 0; i < 16; i++) + plt_info(" 0x%x", hash_key[i]); + } else { + plt_err("\n AES-256 key conversion not supported"); + } +} diff --git a/drivers/common/cnxk/roc_aes.h b/drivers/common/cnxk/roc_aes.h index 954039139f..e3f6160e7c 100644 --- a/drivers/common/cnxk/roc_aes.h +++ b/drivers/common/cnxk/roc_aes.h @@ -10,5 +10,7 @@ */ void __roc_api roc_aes_xcbc_key_derive(const uint8_t *auth_key, uint8_t *derived_key); +void __roc_api roc_aes_hash_key_derive(const uint8_t *key, uint16_t len, + uint8_t *hash_key); #endif /* _ROC_AES_H_ */ diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 5cdc70e0e0..38bf832388 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -29,6 +29,7 @@ INTERNAL { roc_ae_ec_grp_put; roc_ae_fpm_get; roc_ae_fpm_put; + roc_aes_hash_key_derive; roc_aes_xcbc_key_derive; roc_bphy_cgx_cpri_mode_change; roc_bphy_cgx_cpri_mode_misc; -- 2.25.1