From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10076.outbound.protection.outlook.com [40.107.1.76]) by dpdk.org (Postfix) with ESMTP id 5DCEE5B40 for ; Mon, 22 Oct 2018 15:31:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y7zHIGB+06UrDKeIutJlCs3TU6OXkh6kkQGbv4ZEiNI=; b=QhwBJfLidYt3Z1vuEJN1jliPzk/CgoykLkl0uPGQS7ggAeWVC7DAKALdFCTgW/MdVLQNpzj1hhyz2wvOb/lUAY7z5v+nQ9MPsyE5my1UgcNNBZGvIriDkFVsdwsRnXrz7/uk0UaXjztFvX6IvuI2IPFiyA+vovvC4ZFN8DEBH9Y= Received: from HE1PR04MB1530.eurprd04.prod.outlook.com (10.164.48.20) by HE1PR04MB3131.eurprd04.prod.outlook.com (10.171.196.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1250.30; Mon, 22 Oct 2018 13:31:25 +0000 Received: from HE1PR04MB1530.eurprd04.prod.outlook.com ([fe80::95cd:198:d5c5:59a4]) by HE1PR04MB1530.eurprd04.prod.outlook.com ([fe80::95cd:198:d5c5:59a4%5]) with mapi id 15.20.1250.028; Mon, 22 Oct 2018 13:31:25 +0000 From: Gagandeep Singh To: "dev@dpdk.org" , Akhil Goyal CC: Gagandeep Singh , Hemant Agrawal Thread-Topic: [PATCH v3 11/15] crypto/caam_jr: add scatter gather Thread-Index: AQHUaguHcJNb3Qv5lUqM+uyOX6jE8w== Date: Mon, 22 Oct 2018 13:31:24 +0000 Message-ID: <20181022133021.11264-12-g.singh@nxp.com> References: <20181012144055.9461-1-g.singh@nxp.com> <20181022133021.11264-1-g.singh@nxp.com> In-Reply-To: <20181022133021.11264-1-g.singh@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR0101CA0016.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:18::26) To HE1PR04MB1530.eurprd04.prod.outlook.com (2a01:111:e400:59a8::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=G.Singh@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [14.142.187.166] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR04MB3131; 6:JfdcK3AFw+9L9+j7ZlxpjuCsOCgUzA4uCeJVjgGuvKimVNR7uZal2tzs8H9kb/7OxpGpg5io8fnKrTi5oO1xH1sggqKHYjjERAd4gfipn73fRbx9HtXYyPm5719PjqgpOapEcdV57OthB88kNlLI+40dwzrchlZNdKjYxJ++1HLfVZLvGW9fkUt6sqvTAM17/1xZtDHVXVN0m4E4lQMTTDr/fgXvZULMKaASOnQfyEyNMzaPH7gMajqyMnQa6KqLLsqlAkv/85vx26VP5DQVLPI0LhVy3C7eWqC2bQ59ttt1ATQJARKf2BVg4wBOA34lmNdluttRKnWdG44PjrF22ECze6IGy8VO9rOEC1M2WYtR7zjoep0G8joXs7n1UKUVWfGfTHtpZEH54pzt0O7OTVEADIq4+bMKYHQ5vAm9p8ZGfoiAxW71Jf0WwOvFOIb64TZT+34WAbSzqdhvhMZ1/g==; 5:6onKmXD3oczDrZenAvSVYA6b5RokvOQKugDWAFc68N3gKkdzvGjhjn6J0nkyICo5OYWkZdKAyWwHxQaeGW7DBiLh9EZBlNuE69onnRD4N43Z+lXmwOd1UVQRucbXEV5hJTxxgou/1+zGV2AN7VLrocU9eDLeAR1ZhTFSxFKEukk=; 7:116ij9ZHOOygb8mCFq2Gu27jkCYVtRiy+N54JystwNWv3+AZS2IPG/JJ6u8PmB95NFFFYfskRSVfXospz8w+KAvM1BALw1osxgKYssvJlzUqu0QZnAVF9OaqK2hpHnxJ07UGG8zIDKdW/TuW8JJxvv7d9Ap/1a3xljl1MKlwCv3yai9biqrgn1GxEVirpjNXutg99ZWOawZSLpkov0YrJIxaNNfef4tNSqgSLSzwuEfFssv4miBhXl6EMzI+hz/v x-ms-office365-filtering-correlation-id: 8235120e-9a9f-4e53-b5a8-08d63822a966 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:HE1PR04MB3131; x-ms-traffictypediagnostic: HE1PR04MB3131: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:HE1PR04MB3131; BCL:0; PCL:0; RULEID:; SRVR:HE1PR04MB3131; x-forefront-prvs: 08331F819E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(376002)(39860400002)(136003)(346002)(396003)(189003)(199004)(110136005)(99286004)(316002)(54906003)(81156014)(14454004)(25786009)(72206003)(81166006)(2900100001)(8936002)(106356001)(8676002)(6116002)(3846002)(86362001)(2616005)(476003)(6506007)(386003)(102836004)(1076002)(11346002)(446003)(26005)(186003)(305945005)(478600001)(4326008)(2906002)(76176011)(68736007)(7736002)(6636002)(97736004)(486006)(52116002)(36756003)(55236004)(105586002)(71190400001)(5660300001)(4744004)(6436002)(6486002)(78486010)(53936002)(14444005)(2501003)(256004)(66066001)(71200400001)(5250100002)(6512007); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR04MB3131; H:HE1PR04MB1530.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: hkzh325jfWDfOZBcsFDnfZuAZ1NYgJzU0F8lw/fmpU5UYm//bUYP4lAAyRQb79vt3SYEcDuNBSkZtuXYWJPa5qpehaeZjvpGGayNiVqZ32JcsCSxg/4MxEi/fjrrTNNB1OuqGkxUPwXsZ8bik9/Ms0FLR3OVjB74HcDSMfjifUfNi5vwBtTbuCgJKdsuyAeuA+9ABV8brJz3NpRPz3a3qOPxFFt4Ec+nPv4CUx4VQkp7JZCreTS+X2xflqzAWH8f+rQXdiHXw3Bz+z1oCV+ceIF/eovnvz0s2bUmXPa1BUShFKq954lwsOu8P0pZeOTUuYvnV9jCTrZdomMRGJEH4URErqnkFBWpZBuVEee9ZkM= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8235120e-9a9f-4e53-b5a8-08d63822a966 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Oct 2018 13:31:24.9334 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB3131 Subject: [dpdk-dev] [PATCH v3 11/15] crypto/caam_jr: add scatter gather 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: , X-List-Received-Date: Mon, 22 Oct 2018 13:31:26 -0000 This patch add the scatter gather feature for auth-only, cipher-only and cipher-auth operations Signed-off-by: Gagandeep Singh Signed-off-by: Hemant Agrawal Acked-by: Akhil Goyal --- drivers/crypto/caam_jr/caam_jr.c | 375 ++++++++++++++++++++++++++++++- 1 file changed, 374 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam= _jr.c index 9652342a6..e62ce6186 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -623,6 +623,101 @@ caam_jr_dequeue_burst(void *qp, struct rte_crypto_op = **ops, return num_rx; } =20 +/** + * packet looks like: + * |<----data_len------->| + * |ip_header|ah_header|icv|payload| + * ^ + * | + * mbuf->pkt.data + */ +static inline struct caam_jr_op_ctx * +build_auth_only_sg(struct rte_crypto_op *op, struct caam_jr_session *ses) +{ + struct rte_crypto_sym_op *sym =3D op->sym; + struct rte_mbuf *mbuf =3D sym->m_src; + struct caam_jr_op_ctx *ctx; + struct sec4_sg_entry *sg; + int length; + struct sec_cdb *cdb; + uint64_t sdesc_offset; + struct sec_job_descriptor_t *jobdescr; + uint8_t extra_segs; + + PMD_INIT_FUNC_TRACE(); + if (is_decode(ses)) + extra_segs =3D 2; + else + extra_segs =3D 1; + + if ((mbuf->nb_segs + extra_segs) > MAX_SG_ENTRIES) { + CAAM_JR_DP_ERR("Auth: Max sec segs supported is %d", + MAX_SG_ENTRIES); + return NULL; + } + + ctx =3D caam_jr_alloc_ctx(ses); + if (!ctx) + return NULL; + + ctx->op =3D op; + + cdb =3D ses->cdb; + sdesc_offset =3D (size_t) ((char *)&cdb->sh_desc - (char *)cdb); + + jobdescr =3D (struct sec_job_descriptor_t *) ctx->jobdes.desc; + + SEC_JD_INIT(jobdescr); + SEC_JD_SET_SD(jobdescr, + (phys_addr_t)(caam_jr_dma_vtop(cdb)) + sdesc_offset, + cdb->sh_hdr.hi.field.idlen); + + /* output */ + SEC_JD_SET_OUT_PTR(jobdescr, (uint64_t)sym->auth.digest.phys_addr, + 0, ses->digest_length); + + /*input */ + sg =3D &ctx->sg[0]; + length =3D sym->auth.data.length; + sg->ptr =3D cpu_to_caam64(rte_pktmbuf_iova(mbuf) + sym->auth.data.offset)= ; + sg->len =3D cpu_to_caam32(mbuf->data_len - sym->auth.data.offset); + + /* Successive segs */ + mbuf =3D mbuf->next; + while (mbuf) { + sg++; + sg->ptr =3D cpu_to_caam64(rte_pktmbuf_iova(mbuf)); + sg->len =3D cpu_to_caam32(mbuf->data_len); + mbuf =3D mbuf->next; + } + + if (is_decode(ses)) { + /* digest verification case */ + sg++; + /* hash result or digest, save digest first */ + rte_memcpy(ctx->digest, sym->auth.digest.data, + ses->digest_length); +#if CAAM_JR_DBG + rte_hexdump(stdout, "ICV", ctx->digest, ses->digest_length); +#endif + sg->ptr =3D cpu_to_caam64(caam_jr_vtop_ctx(ctx, ctx->digest)); + sg->len =3D cpu_to_caam32(ses->digest_length); + length +=3D ses->digest_length; + } else { + length -=3D ses->digest_length; + } + + /* last element*/ + sg->len |=3D cpu_to_caam32(SEC4_SG_LEN_FIN); + + SEC_JD_SET_IN_PTR(jobdescr, + (uint64_t)caam_jr_vtop_ctx(ctx, &ctx->sg[0]), 0, length); + /* enabling sg list */ + (jobdescr)->seq_in.command.word |=3D 0x01000000; + + return ctx; +} + static inline struct caam_jr_op_ctx * build_auth_only(struct rte_crypto_op *op, struct caam_jr_session *ses) { @@ -688,6 +783,123 @@ build_auth_only(struct rte_crypto_op *op, struct caam= _jr_session *ses) return ctx; } =20 +static inline struct caam_jr_op_ctx * +build_cipher_only_sg(struct rte_crypto_op *op, struct caam_jr_session *ses= ) +{ + struct rte_crypto_sym_op *sym =3D op->sym; + struct rte_mbuf *mbuf =3D sym->m_src; + struct caam_jr_op_ctx *ctx; + struct sec4_sg_entry *sg, *in_sg; + int length; + struct sec_cdb *cdb; + uint64_t sdesc_offset; + uint8_t *IV_ptr =3D rte_crypto_op_ctod_offset(op, uint8_t *, + ses->iv.offset); + struct sec_job_descriptor_t *jobdescr; + uint8_t reg_segs; + + PMD_INIT_FUNC_TRACE(); + if (sym->m_dst) { + mbuf =3D sym->m_dst; + reg_segs =3D mbuf->nb_segs + sym->m_src->nb_segs + 2; + } else { + mbuf =3D sym->m_src; + reg_segs =3D mbuf->nb_segs * 2 + 2; + } + + if (reg_segs > MAX_SG_ENTRIES) { + CAAM_JR_DP_ERR("Cipher: Max sec segs supported is %d", + MAX_SG_ENTRIES); + return NULL; + } + + ctx =3D caam_jr_alloc_ctx(ses); + if (!ctx) + return NULL; + + ctx->op =3D op; + cdb =3D ses->cdb; + sdesc_offset =3D (size_t) ((char *)&cdb->sh_desc - (char *)cdb); + + jobdescr =3D (struct sec_job_descriptor_t *) ctx->jobdes.desc; + + SEC_JD_INIT(jobdescr); + SEC_JD_SET_SD(jobdescr, + (phys_addr_t)(caam_jr_dma_vtop(cdb)) + sdesc_offset, + cdb->sh_hdr.hi.field.idlen); + +#if CAAM_JR_DBG + CAAM_JR_INFO("mbuf offset =3D%d, cipher offset =3D %d, length =3D%d+%d", + sym->m_src->data_off, sym->cipher.data.offset, + sym->cipher.data.length, ses->iv.length); +#endif + /* output */ + if (sym->m_dst) + mbuf =3D sym->m_dst; + else + mbuf =3D sym->m_src; + + sg =3D &ctx->sg[0]; + length =3D sym->cipher.data.length; + + sg->ptr =3D cpu_to_caam64(rte_pktmbuf_iova(mbuf) + + sym->cipher.data.offset); + sg->len =3D cpu_to_caam32(mbuf->data_len - sym->cipher.data.offset); + + /* Successive segs */ + mbuf =3D mbuf->next; + while (mbuf) { + sg++; + sg->ptr =3D cpu_to_caam64(rte_pktmbuf_iova(mbuf)); + sg->len =3D cpu_to_caam32(mbuf->data_len); + mbuf =3D mbuf->next; + } + /* last element*/ + sg->len |=3D cpu_to_caam32(SEC4_SG_LEN_FIN); + + SEC_JD_SET_OUT_PTR(jobdescr, + (uint64_t)caam_jr_vtop_ctx(ctx, &ctx->sg[0]), 0, + length); + /*enabling sg bit */ + (jobdescr)->seq_out.command.word |=3D 0x01000000; + + /*input */ + sg++; + mbuf =3D sym->m_src; + in_sg =3D sg; + + length =3D sym->cipher.data.length + ses->iv.length; + + /* IV */ + sg->ptr =3D cpu_to_caam64(caam_jr_dma_vtop(IV_ptr)); + sg->len =3D cpu_to_caam32(ses->iv.length); + + /* 1st seg */ + sg++; + sg->ptr =3D cpu_to_caam64(rte_pktmbuf_iova(mbuf) + + sym->cipher.data.offset); + sg->len =3D cpu_to_caam32(mbuf->data_len - sym->cipher.data.offset); + + /* Successive segs */ + mbuf =3D mbuf->next; + while (mbuf) { + sg++; + sg->ptr =3D cpu_to_caam64(rte_pktmbuf_iova(mbuf)); + sg->len =3D cpu_to_caam32(mbuf->data_len); + mbuf =3D mbuf->next; + } + /* last element*/ + sg->len |=3D cpu_to_caam32(SEC4_SG_LEN_FIN); + + + SEC_JD_SET_IN_PTR(jobdescr, (uint64_t)caam_jr_vtop_ctx(ctx, in_sg), 0, + length); + /*enabling sg bit */ + (jobdescr)->seq_in.command.word |=3D 0x01000000; + + return ctx; +} + static inline struct caam_jr_op_ctx * build_cipher_only(struct rte_crypto_op *op, struct caam_jr_session *ses) { @@ -752,6 +964,161 @@ build_cipher_only(struct rte_crypto_op *op, struct ca= am_jr_session *ses) return ctx; } =20 +/* For decapsulation: + * Input: + * +----+----------------+--------------------------------+-----+ + * | IV | Auth-only data | Authenticated & Encrypted data | ICV | + * +----+----------------+--------------------------------+-----+ + * Output: + * +----+--------------------------+ + * | Decrypted & authenticated data | + * +----+--------------------------+ + */ + +static inline struct caam_jr_op_ctx * +build_cipher_auth_sg(struct rte_crypto_op *op, struct caam_jr_session *ses= ) +{ + struct rte_crypto_sym_op *sym =3D op->sym; + struct caam_jr_op_ctx *ctx; + struct sec4_sg_entry *sg, *out_sg, *in_sg; + struct rte_mbuf *mbuf; + uint32_t length =3D 0; + struct sec_cdb *cdb; + uint64_t sdesc_offset; + uint8_t req_segs; + uint8_t *IV_ptr =3D rte_crypto_op_ctod_offset(op, uint8_t *, + ses->iv.offset); + struct sec_job_descriptor_t *jobdescr; + uint32_t auth_only_len; + + PMD_INIT_FUNC_TRACE(); + auth_only_len =3D op->sym->auth.data.length - + op->sym->cipher.data.length; + + if (sym->m_dst) { + mbuf =3D sym->m_dst; + req_segs =3D mbuf->nb_segs + sym->m_src->nb_segs + 3; + } else { + mbuf =3D sym->m_src; + req_segs =3D mbuf->nb_segs * 2 + 3; + } + + if (req_segs > MAX_SG_ENTRIES) { + CAAM_JR_DP_ERR("Cipher-Auth: Max sec segs supported is %d", + MAX_SG_ENTRIES); + return NULL; + } + + ctx =3D caam_jr_alloc_ctx(ses); + if (!ctx) + return NULL; + + ctx->op =3D op; + cdb =3D ses->cdb; + sdesc_offset =3D (size_t) ((char *)&cdb->sh_desc - (char *)cdb); + + jobdescr =3D (struct sec_job_descriptor_t *) ctx->jobdes.desc; + + SEC_JD_INIT(jobdescr); + SEC_JD_SET_SD(jobdescr, + (phys_addr_t)(caam_jr_dma_vtop(cdb)) + sdesc_offset, + cdb->sh_hdr.hi.field.idlen); + + /* output */ + if (sym->m_dst) + mbuf =3D sym->m_dst; + else + mbuf =3D sym->m_src; + + out_sg =3D &ctx->sg[0]; + if (is_encode(ses)) + length =3D sym->auth.data.length + ses->digest_length; + else + length =3D sym->auth.data.length; + + sg =3D &ctx->sg[0]; + + /* 1st seg */ + sg->ptr =3D cpu_to_caam64(rte_pktmbuf_iova(mbuf) + + sym->auth.data.offset); + sg->len =3D cpu_to_caam32(mbuf->data_len - sym->auth.data.offset); + + /* Successive segs */ + mbuf =3D mbuf->next; + while (mbuf) { + sg++; + sg->ptr =3D cpu_to_caam64(rte_pktmbuf_iova(mbuf)); + sg->len =3D cpu_to_caam32(mbuf->data_len); + mbuf =3D mbuf->next; + } + + if (is_encode(ses)) { + /* set auth output */ + sg++; + sg->ptr =3D cpu_to_caam64(sym->auth.digest.phys_addr); + sg->len =3D cpu_to_caam32(ses->digest_length); + } + /* last element*/ + sg->len |=3D cpu_to_caam32(SEC4_SG_LEN_FIN); + + SEC_JD_SET_OUT_PTR(jobdescr, + (uint64_t)caam_jr_dma_vtop(out_sg), 0, length); + /* set sg bit */ + (jobdescr)->seq_out.command.word |=3D 0x01000000; + + /* input */ + sg++; + mbuf =3D sym->m_src; + in_sg =3D sg; + if (is_encode(ses)) + length =3D ses->iv.length + sym->auth.data.length; + else + length =3D ses->iv.length + sym->auth.data.length + + ses->digest_length; + + sg->ptr =3D cpu_to_caam64(caam_jr_dma_vtop(IV_ptr)); + sg->len =3D cpu_to_caam32(ses->iv.length); + + sg++; + /* 1st seg */ + sg->ptr =3D cpu_to_caam64(rte_pktmbuf_iova(mbuf) + + sym->auth.data.offset); + sg->len =3D cpu_to_caam32(mbuf->data_len - sym->auth.data.offset); + + /* Successive segs */ + mbuf =3D mbuf->next; + while (mbuf) { + sg++; + sg->ptr =3D cpu_to_caam64(rte_pktmbuf_iova(mbuf)); + sg->len =3D cpu_to_caam32(mbuf->data_len); + mbuf =3D mbuf->next; + } + + if (is_decode(ses)) { + sg++; + rte_memcpy(ctx->digest, sym->auth.digest.data, + ses->digest_length); + sg->ptr =3D cpu_to_caam64(caam_jr_dma_vtop(ctx->digest)); + sg->len =3D cpu_to_caam32(ses->digest_length); + } + /* last element*/ + sg->len |=3D cpu_to_caam32(SEC4_SG_LEN_FIN); + + SEC_JD_SET_IN_PTR(jobdescr, (uint64_t)caam_jr_dma_vtop(in_sg), 0, + length); + /* set sg bit */ + (jobdescr)->seq_in.command.word |=3D 0x01000000; + /* Auth_only_len is set as 0 in descriptor and it is + * overwritten here in the jd which will update + * the DPOVRD reg. + */ + if (auth_only_len) + /* set sg bit */ + (jobdescr)->dpovrd =3D 0x80000000 | auth_only_len; + + return ctx; +} + static inline struct caam_jr_op_ctx * build_cipher_auth(struct rte_crypto_op *op, struct caam_jr_session *ses) { @@ -899,8 +1266,14 @@ caam_jr_enqueue_op(struct rte_crypto_op *op, struct c= aam_jr_qp *qp) else if (is_cipher_only(ses)) ctx =3D build_cipher_only(op, ses); } else { - if (is_aead(ses)) + if (is_auth_cipher(ses)) + ctx =3D build_cipher_auth_sg(op, ses); + else if (is_aead(ses)) goto err1; + else if (is_auth_only(ses)) + ctx =3D build_auth_only_sg(op, ses); + else if (is_cipher_only(ses)) + ctx =3D build_cipher_only_sg(op, ses); } err1: if (unlikely(!ctx)) { --=20 2.17.1