From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 11633A04FA; Wed, 5 Feb 2020 14:17:19 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C56DD1C1E1; Wed, 5 Feb 2020 14:16:54 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 1C09D1C1D3 for ; Wed, 5 Feb 2020 14:16:52 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 015DFMiV004806; Wed, 5 Feb 2020 05:16:52 -0800 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=pfpt0818; bh=pE3/0+gfh+sfm3ftWPbWkfVnW1LD1ZNS4c9dgzrsSN8=; b=CNkWe5RReWysthNIX3Eshm7QlQuMuYGvHTBpNSV+jNNpwXotz4Jmp07PwuKs7lpRpfKO cBip5N9X6fRtmrihQ37ncmIrqnUrN8Frx8XTM3wWYjNPWHXPFm3WW3dUPEU4pTD5rrv7 +aEjAwumN5t7fIgDLd8bkZCKLgObO/1PMIAfFX3izx5qQ1VJVjBjCZxfCEsNrYORqBW4 pS2HF1fE/a978Eh98z9kZL1f83wb/RaSFKSxXpReNDCKCtRYUfR4clHZwrvCpbv4Aron oALK9aMQHhouXbuSHIQ+KIuEpKL4QwsvZ4SMOqJZRl9NLUY+tgCuNO/ujEHF15JEB+Nb +Q== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2xyhmtauvf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 05 Feb 2020 05:16:52 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 Feb 2020 05:16:51 -0800 Received: from SC-EXCH02.marvell.com (10.93.176.82) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 Feb 2020 05:16:50 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 5 Feb 2020 05:16:50 -0800 Received: from ajoseph83.caveonetworks.com (unknown [10.29.45.60]) by maili.marvell.com (Postfix) with ESMTP id 9E48E3F72F8; Wed, 5 Feb 2020 05:16:48 -0800 (PST) From: Anoob Joseph To: Akhil Goyal CC: Archana Muniganti , , Anoob Joseph Date: Wed, 5 Feb 2020 18:46:16 +0530 Message-ID: <1580908578-3384-5-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1580908578-3384-1-git-send-email-anoobj@marvell.com> References: <1580908578-3384-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-02-05_04:2020-02-04, 2020-02-05 signatures=0 Subject: [dpdk-dev] [PATCH 4/6] common/cpt: fix error path when cipher and auth key are not set 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: Archana Muniganti Returning error when cipher and auth key are not getting set Fixes: 6cc54096520d ("crypto/octeontx: add supported sessions") Signed-off-by: Archana Muniganti Signed-off-by: Anoob Joseph --- drivers/common/cpt/cpt_ucode.h | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/drivers/common/cpt/cpt_ucode.h b/drivers/common/cpt/cpt_ucode.h index 4ef87c2..081249c 100644 --- a/drivers/common/cpt/cpt_ucode.h +++ b/drivers/common/cpt/cpt_ucode.h @@ -298,7 +298,7 @@ cpt_fc_ciph_set_key(void *ctx, cipher_type_t type, const uint8_t *key, cpt_fc_ciph_set_key_kasumi_f8_cbc(cpt_ctx, key, key_len); goto success; default: - break; + return -1; } /* Only for FC_GEN case */ @@ -2616,10 +2616,13 @@ fill_sess_aead(struct rte_crypto_sym_xform *xform, sess->iv_length = aead_form->iv.length; sess->aad_length = aead_form->aad_length; - cpt_fc_ciph_set_key(ctx, enc_type, aead_form->key.data, - aead_form->key.length, NULL); + if (unlikely(cpt_fc_ciph_set_key(ctx, enc_type, aead_form->key.data, + aead_form->key.length, NULL))) + return -1; - cpt_fc_auth_set_key(ctx, auth_type, NULL, 0, aead_form->digest_length); + if (unlikely(cpt_fc_auth_set_key(ctx, auth_type, NULL, 0, + aead_form->digest_length))) + return -1; return 0; } @@ -2719,8 +2722,9 @@ fill_sess_cipher(struct rte_crypto_sym_xform *xform, sess->iv_length = c_form->iv.length; sess->is_null = is_null; - cpt_fc_ciph_set_key(SESS_PRIV(sess), enc_type, c_form->key.data, - c_form->key.length, NULL); + if (unlikely(cpt_fc_ciph_set_key(SESS_PRIV(sess), enc_type, + c_form->key.data, c_form->key.length, NULL))) + return -1; return 0; } @@ -2814,8 +2818,10 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, sess->auth_iv_offset = a_form->iv.offset; sess->auth_iv_length = a_form->iv.length; } - cpt_fc_auth_set_key(SESS_PRIV(sess), auth_type, a_form->key.data, - a_form->key.length, a_form->digest_length); + if (unlikely(cpt_fc_auth_set_key(SESS_PRIV(sess), auth_type, + a_form->key.data, a_form->key.length, + a_form->digest_length))) + return -1; return 0; } @@ -2858,9 +2864,13 @@ fill_sess_gmac(struct rte_crypto_sym_xform *xform, sess->iv_length = a_form->iv.length; sess->mac_len = a_form->digest_length; - cpt_fc_ciph_set_key(ctx, enc_type, a_form->key.data, - a_form->key.length, NULL); - cpt_fc_auth_set_key(ctx, auth_type, NULL, 0, a_form->digest_length); + if (unlikely(cpt_fc_ciph_set_key(ctx, enc_type, a_form->key.data, + a_form->key.length, NULL))) + return -1; + + if (unlikely(cpt_fc_auth_set_key(ctx, auth_type, NULL, 0, + a_form->digest_length))) + return -1; return 0; } -- 2.7.4