From patchwork Fri Feb 8 11:13:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadiusz Kusztal X-Patchwork-Id: 50256 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 729141B8C3; Fri, 8 Feb 2019 12:13:46 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id A74B91B8BD for ; Fri, 8 Feb 2019 12:13:45 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Feb 2019 03:13:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,347,1544515200"; d="scan'208";a="141749563" Received: from akusztax-mobl.ger.corp.intel.com ([10.104.14.178]) by fmsmga002.fm.intel.com with ESMTP; 08 Feb 2019 03:13:43 -0800 From: Arek Kusztal To: dev@dpdk.org Cc: akhil.goyal@nxp.com, fiona.trahe@intel.com, shally.verma@caviumnetworks.com, Arek Kusztal Date: Fri, 8 Feb 2019 12:13:36 +0100 Message-Id: <20190208111338.4544-2-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 2.19.1.windows.1 In-Reply-To: <20190208111338.4544-1-arkadiuszx.kusztal@intel.com> References: <20190208111338.4544-1-arkadiuszx.kusztal@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 1/3] cryptodev: add result field to mod exp and inverse operations 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" This commit adds result field to be used when modular exponentiation or modular multiplicative inverse operation is used Signed-off-by: Arek Kusztal Acked-by: Shally Verma --- lib/librte_cryptodev/rte_crypto_asym.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/librte_cryptodev/rte_crypto_asym.h b/lib/librte_cryptodev/rte_crypto_asym.h index 0a50cd5..991263f 100644 --- a/lib/librte_cryptodev/rte_crypto_asym.h +++ b/lib/librte_cryptodev/rte_crypto_asym.h @@ -339,6 +339,16 @@ struct rte_crypto_mod_op_param { * be relatively prime to modulus in corresponding Modular * Multiplicative Inverse rte_crypto_modinv_xform */ + + rte_crypto_param result; + /**< + * Pointer to the result of modular exponentiation/multiplicative inverse + * data in octet-string network byte order format. + * + * This field shall be big enough to hold the result of Modular + * Exponentiation or Modular Multplicative Inverse + * (bigger or equal to length of modulus) + */ }; /** From patchwork Fri Feb 8 11:13:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadiusz Kusztal X-Patchwork-Id: 50257 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B38681B8C2; Fri, 8 Feb 2019 12:13:50 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 972731B8B7 for ; Fri, 8 Feb 2019 12:13:49 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Feb 2019 03:13:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,347,1544515200"; d="scan'208";a="141749572" Received: from akusztax-mobl.ger.corp.intel.com ([10.104.14.178]) by fmsmga002.fm.intel.com with ESMTP; 08 Feb 2019 03:13:45 -0800 From: Arek Kusztal To: dev@dpdk.org Cc: akhil.goyal@nxp.com, fiona.trahe@intel.com, shally.verma@caviumnetworks.com, Arek Kusztal Date: Fri, 8 Feb 2019 12:13:37 +0100 Message-Id: <20190208111338.4544-3-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 2.19.1.windows.1 In-Reply-To: <20190208111338.4544-1-arkadiuszx.kusztal@intel.com> References: <20190208111338.4544-1-arkadiuszx.kusztal@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 2/3] openssl: add result field to mod exp and mod inv operations 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" This patch adds result field to modular exponentiation and modular multiplicative inverse operations in openssl pmd functions Signed-off-by: Arek Kusztal --- drivers/crypto/openssl/rte_openssl_pmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index 0230050..5096ca1 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -1790,7 +1790,7 @@ process_openssl_modinv_op(struct rte_crypto_op *cop, if (BN_mod_inverse(res, base, sess->u.m.modulus, sess->u.m.ctx)) { cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS; - op->modinv.base.length = BN_bn2bin(res, op->modinv.base.data); + op->modinv.result.length = BN_bn2bin(res, op->modinv.result.data); } else { cop->status = RTE_CRYPTO_OP_STATUS_ERROR; } @@ -1819,7 +1819,7 @@ process_openssl_modexp_op(struct rte_crypto_op *cop, if (BN_mod_exp(res, base, sess->u.e.exp, sess->u.e.mod, sess->u.e.ctx)) { - op->modex.base.length = BN_bn2bin(res, op->modex.base.data); + op->modex.result.length = BN_bn2bin(res, op->modex.result.data); cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS; } else { cop->status = RTE_CRYPTO_OP_STATUS_ERROR; From patchwork Fri Feb 8 11:13:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadiusz Kusztal X-Patchwork-Id: 50258 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0653D1B8D1; Fri, 8 Feb 2019 12:13:54 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 9455A1B8CD for ; Fri, 8 Feb 2019 12:13:52 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Feb 2019 03:13:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,347,1544515200"; d="scan'208";a="141749584" Received: from akusztax-mobl.ger.corp.intel.com ([10.104.14.178]) by fmsmga002.fm.intel.com with ESMTP; 08 Feb 2019 03:13:50 -0800 From: Arek Kusztal To: dev@dpdk.org Cc: akhil.goyal@nxp.com, fiona.trahe@intel.com, shally.verma@caviumnetworks.com, Arek Kusztal Date: Fri, 8 Feb 2019 12:13:38 +0100 Message-Id: <20190208111338.4544-4-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 2.19.1.windows.1 In-Reply-To: <20190208111338.4544-1-arkadiuszx.kusztal@intel.com> References: <20190208111338.4544-1-arkadiuszx.kusztal@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 3/3] test: add result field to mod exp and mod inv 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" This patch adds result field to modular exponentiation and modular multiplicative inverse tests Signed-off-by: Arek Kusztal Acked-by: Shally Verma --- test/test/test_cryptodev_asym.c | 6 ++++++ test/test/test_cryptodev_asym_util.h | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/test/test/test_cryptodev_asym.c b/test/test/test_cryptodev_asym.c index 0f6fc57..a779e8f 100644 --- a/test/test/test_cryptodev_asym.c +++ b/test/test/test_cryptodev_asym.c @@ -940,6 +940,7 @@ test_mod_inv(void) const struct rte_cryptodev_asymmetric_xform_capability *capability; uint8_t input[TEST_DATA_SIZE] = {0}; int ret = 0; + uint8_t result[sizeof(mod_p)] = { 0 }; if (rte_cryptodev_asym_get_xform_enum( &modinv_xform.xform_type, "modinv") < 0) { @@ -993,6 +994,8 @@ test_mod_inv(void) memcpy(input, base, sizeof(base)); asym_op->modinv.base.data = input; asym_op->modinv.base.length = sizeof(base); + asym_op->modinv.result.data = result; + asym_op->modinv.result.length = sizeof(result); /* attach asymmetric crypto session to crypto operations */ rte_crypto_op_attach_asym_session(op, sess); @@ -1055,6 +1058,7 @@ test_mod_exp(void) const struct rte_cryptodev_asymmetric_xform_capability *capability; uint8_t input[TEST_DATA_SIZE] = {0}; int ret = 0; + uint8_t result[sizeof(mod_p)] = { 0 }; if (rte_cryptodev_asym_get_xform_enum(&modex_xform.xform_type, "modexp") @@ -1109,6 +1113,8 @@ test_mod_exp(void) memcpy(input, base, sizeof(base)); asym_op->modex.base.data = input; asym_op->modex.base.length = sizeof(base); + asym_op->modex.result.data = result; + asym_op->modex.result.length = sizeof(result); /* attach asymmetric crypto session to crypto operations */ rte_crypto_op_attach_asym_session(op, sess); diff --git a/test/test/test_cryptodev_asym_util.h b/test/test/test_cryptodev_asym_util.h index dff0c2a..b3d9fb4 100644 --- a/test/test/test_cryptodev_asym_util.h +++ b/test/test/test_cryptodev_asym_util.h @@ -20,8 +20,8 @@ static inline int rsa_verify(struct rsa_test_data *rsa_param, static inline int verify_modinv(uint8_t *mod_inv, struct rte_crypto_op *result_op) { - if (memcmp(mod_inv, result_op->asym->modinv.base.data, - result_op->asym->modinv.base.length)) + if (memcmp(mod_inv, result_op->asym->modinv.result.data, + result_op->asym->modinv.result.length)) return -1; return 0; } @@ -29,8 +29,8 @@ static inline int verify_modinv(uint8_t *mod_inv, static inline int verify_modexp(uint8_t *mod_exp, struct rte_crypto_op *result_op) { - if (memcmp(mod_exp, result_op->asym->modex.base.data, - result_op->asym->modex.base.length)) + if (memcmp(mod_exp, result_op->asym->modex.result.data, + result_op->asym->modex.result.length)) return -1; return 0; }