From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0050.outbound.protection.outlook.com [104.47.0.50]) by dpdk.org (Postfix) with ESMTP id 083C41B115 for ; Mon, 22 Oct 2018 16:18:03 +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=Rod73y2fYMEBFAFa8iz69KH5LnOvYmjnp29ZOrXWQC4=; b=pJalu1XU9XwNQMj8X4GMal5pJbhdOkss81SgvTJre/OFhB8oSQYRR0dkzFeuRHEIC9et5WH22rhMAM3o+FLgBzWRThoUMvSBux3VA3dEOq3SVHYO+WyvmE5SL3JsrEwdAFafhg1VUdkY5geQBKFnizpiklBgOBPlEo2RixuZars= Received: from HE1PR04MB1530.eurprd04.prod.outlook.com (10.164.48.20) by HE1PR04MB1372.eurprd04.prod.outlook.com (10.163.175.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 14:17:57 +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 14:17:57 +0000 From: Gagandeep Singh To: "dev@dpdk.org" , Akhil Goyal CC: Gagandeep Singh , Hemant Agrawal Thread-Topic: [PATCH v4 11/15] crypto/caam_jr: add scatter gather Thread-Index: AQHUahIHhfsk4uvH6UGZYnbBoSFBAg== Date: Mon, 22 Oct 2018 14:17:57 +0000 Message-ID: <20181022141657.4727-12-g.singh@nxp.com> References: <20181022133021.11264-1-g.singh@nxp.com> <20181022141657.4727-1-g.singh@nxp.com> In-Reply-To: <20181022141657.4727-1-g.singh@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR0101CA0025.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::11) 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; HE1PR04MB1372; 6:ixrEnTtkoTEIOYgkk/6Nvb/t1McTEr/WkbYmYGqLc9H+pUPczQFN7QIaBRHXfmOXY8ex896ZTrvh9L1xUU4kNeX/fKl7VxxXSjONenafZpxxlFKi8KtQqWGxyzF/HIcr+WLkybd7EWZAE540jIjXO9ebUDk7VLirMBCx8qTY6HsvSS/LeU22W4cp2bbNvvkrJb87we5rAX9i3mufSCaiHE3RY+JyI2oQKmt6W6XtrdMBl9aqby0aYa/fd5fXKgr0MkAmn5B+8FnzH++vrtHqpqeNlVyyrkevTbsCfnCake/QkDLm9yZU39XV+inxjTsNodyvxB9Lj/E/Xzy36aLuBXlEJIa3XQCw9MFaPTx0fOy4ZQX8PzudvvslPD2lJicgmtpdK0ILwz8ckDBLgWVY3oy4lxLTLVpGEeBH/T4laPAKFX9fzHMVEe94V0P/T6Ujk8xRbSn3sHrbeu2x0jEGtw==; 5:trLSCz6DZBDapcFu/1ZsIcRdqqK5v3me5tQ6UAUrGmrxxYY+OXen1S5yrylnU/73uwrO1oYxZ9YcfMMbFfYi0p+Y/3TAPzRYWASBGMTVTLQBbOqoD+IzX5g/H1mwa45O0a4BTJp3654o2ob0CDxut79IUpfYkVrVnzEV4vUeH3c=; 7:ViaRkdanzE8HwM88NUNDMsk5hJJZBwqkhdu+eXGd70OhhmilVDGXRvJg60/MzbTMOzIhZav9rucJNriszS5GNyIUMgCVkcYfEBFL9PzOXRKsaeJb8BhxkZIVwRYp9ZgaPsvwJN/KJgZXuA1tQWX9zNDYDWx9ykynSA+VbDMiGK5vAOOpVj401hQD7JYWo5NRuGOWLuQzfonmFcDj4DhiuMaJCnQmSJn+FZzYIN4UBX5sEROwh66WKAbriE/UD7IP x-ms-office365-filtering-correlation-id: 9a65f996-8d53-4ea2-d547-08d638292982 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:HE1PR04MB1372; x-ms-traffictypediagnostic: HE1PR04MB1372: 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)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:HE1PR04MB1372; BCL:0; PCL:0; RULEID:; SRVR:HE1PR04MB1372; x-forefront-prvs: 08331F819E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(396003)(366004)(136003)(39860400002)(346002)(189003)(199004)(4326008)(52116002)(446003)(8936002)(2501003)(55236004)(486006)(2906002)(72206003)(102836004)(1076002)(6486002)(2616005)(99286004)(5660300001)(6436002)(476003)(11346002)(186003)(14454004)(81166006)(5250100002)(3846002)(8676002)(81156014)(68736007)(256004)(6116002)(97736004)(14444005)(86362001)(6636002)(105586002)(106356001)(6506007)(386003)(478600001)(305945005)(4744004)(6512007)(7736002)(2900100001)(110136005)(54906003)(53936002)(71190400001)(71200400001)(25786009)(316002)(66066001)(26005)(78486010)(76176011)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR04MB1372; 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: IgfEwFCRyqlL89tKFlivB0dYjKF+wF54cW55Rnu0HpLk931wjS701a4d5Ls8Sbi+d+7+I85XP/Lw6ojHxBrpzvB8eIHu+uDvpX6E7Rn3HBTOT0C5Jo+9LDUHjE7tynPASZNi2ogRtVLluNewn6nwJ9bzovga4DnuDducnwZHwWPeCCB+yqHdJOj6hiUFJDE9vNvbdgrXMwWNyDB/lJwDoW3bbFjyNbYRw1egk95Flh5kxr+S4E4U5Wnaua7f+dkJTUr3GehsexERenLv/0ufcQpKejc6h1liVUzVgBqGskYHVQTAyDolIgBKhxakCNm0j9zGpnZsjLxm+OGYqm2HDuvA1CgdPDmvbl+SrkllNg0= 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: 9a65f996-8d53-4ea2-d547-08d638292982 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Oct 2018 14:17:57.5210 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB1372 Subject: [dpdk-dev] [PATCH v4 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 14:18:03 -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 594ae8ded..0d3a49145 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -602,6 +602,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) { @@ -667,6 +762,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) { @@ -731,6 +943,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) { @@ -878,8 +1245,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