From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0050.outbound.protection.outlook.com [104.47.32.50]) by dpdk.org (Postfix) with ESMTP id E8E8B558C for ; Mon, 12 Sep 2016 13:17:04 +0200 (CEST) Received: from BY2PR03CA070.namprd03.prod.outlook.com (10.141.249.43) by CY1PR0301MB0714.namprd03.prod.outlook.com (10.160.159.144) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.619.10; Mon, 12 Sep 2016 11:17:01 +0000 Received: from BL2FFO11FD029.protection.gbl (2a01:111:f400:7c09::140) by BY2PR03CA070.outlook.office365.com (2a01:111:e400:2c5d::43) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9 via Frontend Transport; Mon, 12 Sep 2016 11:17:01 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD029.mail.protection.outlook.com (10.173.160.69) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.587.6 via Frontend Transport; Mon, 12 Sep 2016 11:17:00 +0000 Received: from [127.0.0.1] ([10.232.134.49]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u8CBGrFS015957; Mon, 12 Sep 2016 04:16:57 -0700 To: Piotr Azarewicz , , References: <1472196117-21750-1-git-send-email-piotrx.t.azarewicz@intel.com> <1472196117-21750-2-git-send-email-piotrx.t.azarewicz@intel.com> CC: Marcin Kerlin , Slawomir Mrozowicz , Michal Kobylinski , Tomasz Kulasek , Daniel Mrzyglod From: Akhil Goyal Message-ID: <4d920e7a-cebc-4ece-e5a2-dccfc3e66a3b@nxp.com> Date: Mon, 12 Sep 2016 16:46:53 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <1472196117-21750-2-git-send-email-piotrx.t.azarewicz@intel.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Matching-Connectors: 131181526209205182; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1110001)(1109001)(3190300001)(339900001)(377454003)(199003)(24454002)(189002)(9170700003)(31686004)(31696002)(106466001)(47776003)(50466002)(64126003)(105606002)(65806001)(65956001)(7846002)(36756003)(23746002)(5660300001)(5001770100001)(4001520100001)(4001350100001)(356003)(7126002)(65826007)(92566002)(586003)(7246003)(120886001)(626004)(305945005)(33646002)(189998001)(11100500001)(4326007)(2950100001)(77096005)(2906002)(8936002)(8676002)(230700001)(81166006)(104016004)(85426001)(83506001)(2201001)(86362001)(54356999)(76176999)(50986999)(87936001)(5001760100003)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB0714; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD029; 1:hz8K67m3PXWVPapV3Qp4M2PfNZKbodt2KZvdKKRba/sfGXqGrr9xKRl+dVALx81FFqyMg2wK56767yV2G7cnS7YdgarbCTQzacvO4DufhaUI9ZHxc6Ml/6Pf3GbAEVSMQcbCjGyh1mEOhkY77HYzBGExHnjke3Y7cYE7kVB8X5zXPKmwBB9lCzAfO9GlZv+cZaxST5AmuSo4x+Qu+b6VqmLDBtk0WeQNnk1ekZuq8/+bKJA6V1whH0F9BiVY9GQz1r0uvqUJRJ0aO3Z4XIF0NUK7dMUV4Im70cmttTAiy/+pHXutRa/o6muZ9lf6eVKfdDMhmldY9GCXX2NkDi1W7KEs6GwP4XdLiBC2Ca+94W6/3N/XJwvrDf4HayauWzBtiLdEJ9jP0kMAA2I7M8kIdjoW64S5CKtTbbDU0YwOUT2/eUXCqJGuYKJQaSSyEcfPmmzVeBGsLMKn1fO5yST/Hu0BXe0aGnnKjYDD7bq5VYiN7YwwEn/NunAj+L7y3vf1WHqU02F7LMH97oem5hl9vPMaVUEn27h6nUg7hptF68cECNUP6OSo62hYHb3Ggbuxst1auB0djIFOqvtdTcMz2JBCtmBRgzZBG69KjKlPVVKt/6IJpKFl1OowHdzTg4rvmqlLwTLcjMUao56qDNU67w== X-MS-Office365-Filtering-Correlation-Id: bab16e6b-102e-4442-13be-08d3dafe5142 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0714; 2:MpkOZObzYrbMd9O48IEAwOrmb9LertI/dKLNSzuI9ffwRwZ7sCksNYnMnCF1HVFof8c17q0e9qGtulbBzZQykDETnzrNJI+zzXoMh+bKvO4QKZac9mGoOzV1xXPA/uy8KpmmDZwGzJUiFIG6aD4SfC+W7ZJB0PIW1pGXgRJrWnDgH4Qnw7gadqxM5P2le8CL; 3:RfS7bek05CJG6TOHH3dw8jsBnTYk6cwIpwMZ9TJ6AcC1N8X+seUnQXTSmiiAodIWPGJ1b3deQCjqunfjAc4ApJ/mTTpLBJSUZAojd9KgHWabJSJ5bdAGQSyeKyGm2DbdyGb0WafzJpBX/u1/11HbZxzbvZX3Sssb1Yw9Gn+I1k8og9ykhbJ9GVx2bNFpQuNvOL6lEgXr5xtT86KSsnnzHrHUx8n2b2MpZL44SFBEi80= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB0714; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0714; 25:g6nAdqzS2NU7cpjxA+JtmLA7X/gY1UdhjjFkjrby48mIqaAysdncfdj4/1ZLRHoFLvqAdp9qiIWaKZcnkbrr+B6Ijc8jfRv2zoyYup+hewvXPHHtKt75a5FR4cSrEHdoxD7WMWALa8o19GkbHPDQeWBux6DE6vzukIV2cWfapcyoNA88rWvxT+G1py3dFLsKdJKyoHH3y9K9sjwoTdi53ofi9BJ7XmSocB+HGfaGaLV8bUqmKXf8Bnyf8EVb1JLipktmbyCf0WkqP5B+stjX/WX1PM5ENEI3SP/mvJk7Bn0weptGPIxkFA5JW4bpRM+oaiFg+IZ1dOr3SsdzvUejUtaGtIPCZ0siM/N+6YYfzFbDPQT3M6UTtOeAJ/NM8uDQONzD05XkljQrxq7xo2oPwRVZO5umJz9JlPuxnIr7ouZc0dGdMfuO6mM238dNtPSAXmX2wkprm7CvGrzdsqWFrhoUkHz7IKiufrbQ35D/TozkVV6Qk5dyB05pz/crfgz69Hsc93l+ie/nmlQit0boG6dmo3+FsZ0+FHi9qim3qrspasRYFpP4dE+QoGxZymRii8oSqqw2TR7u19JjF8y7AxxLphGCM0uSnkiBJXo5J4KCE5KqKEYmcIH2zrD/16eZerDtDihpSoGfj5eKpPU68wfzMYXjv1vPLxwTFXahFgQdzbIu2tbmZnUPT1HvjDF32O004Io7uX4nSSDAJtZdtUDfp6Gb7fpi2iFiUSURcF3s3OCAoPIGtttnUGFhYHzQuAnzziiMFD2rngzuHAFlFw== X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0714; 31:S7bkkBgeVnaC7dWDVmTUCAlngBqg1+k7qD6V3Nh2tyEehUFmCcgUhUWDAsMkX78BfQ1eiKLYhdbjJDdv2BNUq06+935F/2mTEdywqsDxrb4/VODWR+OwbKmtf4AoF20p9d8joYdvER8xdRWlNrO4YqotZgyxUJl0j5soT0OW0nsOqOOas3iSDDXjlyhS+rpC55N453kZnnjq348sBvoOvVtWyvpTuilPUkj8dQy5tio=; 4:Oh+xL1C0H6H//l3uac2QoOaEp9eYdF9GUtWCx6az9zMqgsL/VzxoT2ulNHjdj/fCUeB3GJFSbAg7lSR717eTPDofVl+1PUg1/IahA43cUxBoVTIRdNZIaX3svda560V/NQQM4SOcc7rjqRDdB2qQ38HlJJbm9esnQv6uNkI1IJ/fkDOxaZLrzINAwBNES9927s8qfeC/uAdKcwDDM0ZnYpLOgPzRe8/Skw8oERINfxFFzssGs4ZglG807PqAnA0euvfVdLbxA3S1tZoK2v/dzCkesxosyqyl6iwBf14+eA5BRvslmXoIb/k1gIGxBybmdnEItxmQV9GtczBMLGThOOLtcOFLtsBfK5ZYcl/qeu5hFdjNCLgExlfK0onf+C3p1SIBgrVq8diKYUpp6CTXL3an4uA6i1PULXKH+aMZ9mc+tlBspmwmZ9u9h6U5p4BKcr5/Mh9aE9rygIke1S3jq/S0xwpmuQCQ4Pk7M23vr6X8d7dGpg7mzJMfEC7SVWDs X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13015025)(13017025)(13023025)(13024025)(13018025)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:CY1PR0301MB0714; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB0714; X-Forefront-PRVS: 006339698F X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; CY1PR0301MB0714; 23:MfMQjDws9cS83fd9s7mdHPgA9OB7Hq8VGy3?= =?Windows-1252?Q?Ln1RfElVt+lPyFSik3G9DXmBbeIX7EuTf1yj/fp4XMrKTTS2nNH7ft3E?= =?Windows-1252?Q?MVww43rLcUr4W6cK8Sv2CxStAtFMQr376F+NK0M+hAK/EO88zESjkhn4?= =?Windows-1252?Q?QK7LIp5EFekgKWmXWfLD2mxQHSY3qFuhx19cZEehtDMKs4ahOrkEApy2?= =?Windows-1252?Q?Awc+KK0xLcnZzgCvmMW7VC5kVe/tyAbNqapnrTch+ce+8kk6wS6r4yDq?= =?Windows-1252?Q?PO8ZN0SJ1fBTMN5dYRPR9/PMt8SvQD7xfEFFdSg2MbTxoERDHFVpZc+a?= =?Windows-1252?Q?QtUdMvON1XvDr2hj9IH7sbHiRpg+Y1RDgxBeooAvvImfPzLe6w+CnY1k?= =?Windows-1252?Q?RwASgXnoz+CHZufuQKnZ4UiYG/3zpysQiqs6PCF67VUDbvTYiP4PS5G4?= =?Windows-1252?Q?ufVnNIK9LN9qtg2fVWv24wha0BOfS1C3Vy5O8qjKmKs5K+BWV8CjPIOZ?= =?Windows-1252?Q?YRb8/b0vORIFTNGAdt4tImqrnM2J7wpksM72T9UX21OX/SLlJGgG1JpQ?= =?Windows-1252?Q?jDplSTgl9Qk4at71CDM5LuhQCjz8lzPmaxIO4vc7nmLv1uZR31mzdRs+?= =?Windows-1252?Q?YTN3Five5gDIzhjmz5wnYDfn8W0gEKeZCOyZR2bou5X/cGXnArbnXu+p?= =?Windows-1252?Q?SCpTgwRGIGZfRvXPY8Mw7BFo1iUsFv7jARAg1b6332+8DcjFHsNuZ0hA?= =?Windows-1252?Q?0N7s3cbCciUuCjjCimsfyAdbX1V97eduQXxHH4Z6PMYKZ7+Up88A3Pnc?= =?Windows-1252?Q?1i+NCLLvRrnOZuLqQW2H3xoYph6xTljEo2dU6vxl1h/iWtXXlKeUymgo?= =?Windows-1252?Q?zAx8qB4B81lcanGTJ85OlIF7BuIzQkkYg7yyp1sbaAUrdU+rreJPro7Q?= =?Windows-1252?Q?LjtvxlnCMJS8yOsyMiJ8+4Rgn8e8rwoSB5T+0zqmpDQjCD04rcnKrt4s?= =?Windows-1252?Q?hAJLSgABSNB/RagsZmib4c6Q0QuMNxv3G95w1MNLbDeuzkZzRVI3zaA3?= =?Windows-1252?Q?Ao9bAH9itGhPz+sQDG/mtrLsKFosE02f7Y75XO/LWQ0iRoPfygLuynGk?= =?Windows-1252?Q?Wzgmim3EEQsh7avn1OIR6BtwvB0NAJmlzOTzoY3R/SfX0FVp6pP+rTW1?= =?Windows-1252?Q?4BZ2+tw5dIVshjMali0lA2UBPIvFjzDMHikzNa+xJiMKIQ+lG07Xu5RC?= =?Windows-1252?Q?aQN5tgWoeitW9soZf4HSixW1ryH5iRoFthAFJ4N81RGWhdoXdZdk8RtQ?= =?Windows-1252?Q?UR+Bbm12gNxKDIT8aRdgiCdrnJyuAc59xkFCBQkePK2Yh4xeF/MO8XA+?= =?Windows-1252?Q?heLvCJuYntdxFC0Ry+hW3qPNpg6efP2nWlZdEQ0yThGRl4kMN3K2aEH7?= =?Windows-1252?Q?Nw/Ns+EM2A46iph2oQoakboWFvuYIZtr2qPzl6yICQuTbz3gRclHREyu?= =?Windows-1252?Q?dsgLp1SV1pCeMJK9q7rMQFy9v6oPtziNw0vRX9qbInRpHFUHl1Q=3D?= =?Windows-1252?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0714; 6:L+ZYPlCFzinascWker9uPtwSnyH551DCssZPd7b0DIqhg3yaHGuB335K5jLGLGtujyC0dihaH+vczoNB6UqdPYyB4zmdHhCQrFwzU6DsRjfWZ4BKlC2mb33x+jx2BmMMNdVo4CW3ZwbMm8WjZN306LIDxJ0J55/jF3B3f86neb/32Bq8SvP8w786p9TzuGzGY+IfmOcKG4fDeQsOqCeE3hNVUm/3VBlN1D0jvALHEm6gwm5OasF6BP7rgZwr2KTTgH3lxpJMRv19ga2UyoGr8P7qIzrlOrtsjgEwzpR74QE=; 5:ghgnBjjjxB5DMY/WrAPhEma76WkE/Hiey9Gi+8mgENI1OOsRpF4sIVJe/dlx0CudLNmLnWsFeo2Y3SRjDTmPl1t5N0TZy6nyENhuus9mnaBdV+IUIfvKgLBFsk57+m3bWsdcg1gJPti3TzJxwj73RXVbXSnuErZrm5txjhkfWIg=; 24:dv1UkMac8zg4X4FRYmwznn13SDwxaa51xwtb/F8Ydtdjj5jp2z4SlEFKPMvRD+SJlJWr3Pd5omg2Oh5O6gu7qY7fhUfvMa/PaQitQx9E744=; 7:6V9Q+goZyfAUBbi1wmewPdu/RD2h9tds4lPWJ/XKFzrdSNT/QINO2VNnBLDGEu2Db6waFw8WIorxT9LFYh6FVQW+qvDR38Wkbkf5JfLm6Ew6HujCdsY+mf8FH359ScRDMewb6sbaCHs7nJHv2PGiMrEsJQH1eBkHSJ6GytYoolQfGa7XQrfwEG8qh3Yzslrnj5C/PSfckXaTEQuOSftc5cbQLX65L1S4oloCfWuS0LxVRd3DpOSYPGaUJYgvVaMs SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2016 11:17:00.7021 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB0714 Subject: Re: [dpdk-dev] [PATCH 1/4] libcrypto_pmd: initial implementation of SW crypto device X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 11:17:05 -0000 On 8/26/2016 12:51 PM, Piotr Azarewicz wrote: > +/** Provide session for operation */ > +static struct libcrypto_session * > +get_session(struct libcrypto_qp *qp, struct rte_crypto_op *op) > +{ > + struct libcrypto_session *sess = NULL; > + > + if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { > + /* get existing session */ > + if (!unlikely(op->sym->session == NULL || > + op->sym->session->dev_type != > + RTE_CRYPTODEV_LIBCRYPTO_PMD)) > + sess = (struct libcrypto_session *) > + op->sym->session->_private; > + } else { > + /* provide internal session */ > + void *_sess = NULL; > + > + if (!rte_mempool_get(qp->sess_mp, (void **)&_sess)) { > + sess = (struct libcrypto_session *) > + ((struct rte_cryptodev_sym_session *)_sess) > + ->_private; > + > + if (unlikely(libcrypto_set_session_parameters( > + sess, op->sym->xform) != 0)) { > + rte_mempool_put(qp->sess_mp, _sess); > + sess = NULL; > + } else > + op->sym->session = _sess; > + } > + } > + > + if (sess == NULL) > + op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION; > + > + return sess; > +} > + > +/* > + *------------------------------------------------------------------------------ > + * Process Operations > + *------------------------------------------------------------------------------ > + */ > + > +/** Process standard libcrypto cipher encryption */ > +static int > +process_libcrypto_cipher_encrypt(uint8_t *src, uint8_t *dst, > + uint8_t *iv, uint8_t *key, int srclen, > + EVP_CIPHER_CTX *ctx, const EVP_CIPHER *algo) > +{ > + int dstlen, totlen; > + > + if (EVP_EncryptInit_ex(ctx, algo, NULL, key, iv) <= 0) > + goto process_cipher_encrypt_err; [Akhil] this EVP_EncryptInit_ex() can be done for each session instead of each packet. This will improve the performance. Also if there is some change in the parameters later then it can be called again here with the updated parameters only. Same comment is for all cases (hmac, auth, etc) > + > + if (EVP_EncryptUpdate(ctx, dst, &dstlen, src, srclen) <= 0) > + goto process_cipher_encrypt_err; > + > + if (EVP_EncryptFinal_ex(ctx, dst + dstlen, &totlen) <= 0) > + goto process_cipher_encrypt_err; > + > + return 0; > + > +process_cipher_encrypt_err: > + LIBCRYPTO_LOG_ERR("Process libcrypto cipher encrypt failed"); > + return -EINVAL; > +} > + > +/** Process standard libcrypto cipher decryption */ > +static int > +process_libcrypto_cipher_decrypt(uint8_t *src, uint8_t *dst, > + uint8_t *iv, uint8_t *key, int srclen, > + EVP_CIPHER_CTX *ctx, const EVP_CIPHER *algo) > +{ > + int dstlen, totlen; > + > + if (EVP_DecryptInit_ex(ctx, algo, NULL, key, iv) <= 0) > + goto process_cipher_decrypt_err; > + > + if (EVP_CIPHER_CTX_set_padding(ctx, 0) <= 0) > + goto process_cipher_decrypt_err; > + > + if (EVP_DecryptUpdate(ctx, dst, &dstlen, src, srclen) <= 0) > + goto process_cipher_decrypt_err; > + > + if (EVP_DecryptFinal_ex(ctx, dst + dstlen, &totlen) <= 0) > + goto process_cipher_decrypt_err; > + > + return 0; > + > +process_cipher_decrypt_err: > + LIBCRYPTO_LOG_ERR("Process libcrypto cipher decrypt failed"); > + return -EINVAL; > +} > + > +/** Process cipher des 3 ctr encryption, decryption algorithm */ > +static int > +process_libcrypto_cipher_des3ctr(uint8_t *src, uint8_t *dst, > + uint8_t *iv, uint8_t *key, int srclen, EVP_CIPHER_CTX *ctx) > +{ > + uint8_t ebuf[8], ctr[8]; > + int unused, n; > + > + /* We use 3DES encryption also for decryption. > + * IV is not important for 3DES ecb > + */ > + if (EVP_EncryptInit_ex(ctx, EVP_des_ede3_ecb(), NULL, key, NULL) <= 0) > + goto process_cipher_des3ctr_err; > + > + memcpy(ctr, iv, 8); > + n = 0; > + > + while (n < srclen) { > + if (n % 8 == 0) { > + if (EVP_EncryptUpdate(ctx, (unsigned char *)&ebuf, &unused, > + (const unsigned char *)&ctr, 8) <= 0) > + goto process_cipher_des3ctr_err; > + ctr_inc(ctr); > + } > + dst[n] = src[n] ^ ebuf[n % 8]; > + n++; > + } > + > + return 0; > + > +process_cipher_des3ctr_err: > + LIBCRYPTO_LOG_ERR("Process libcrypto cipher des 3 ede ctr failed"); > + return -EINVAL; > +} > + > +/** Process auth gmac algorithm */ > +static int > +process_libcrypto_auth_gmac(uint8_t *src, uint8_t *dst, > + uint8_t *iv, uint8_t *key, int srclen, int ivlen, > + EVP_CIPHER_CTX *ctx, const EVP_CIPHER *algo) > +{ > + int unused; > + > + if (EVP_EncryptInit_ex(ctx, algo, NULL, NULL, NULL) <= 0) > + goto process_auth_gmac_err; > + > + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, ivlen, NULL) <= 0) > + goto process_auth_gmac_err; > + > + if (EVP_EncryptInit_ex(ctx, NULL, NULL, key, iv) <= 0) > + goto process_auth_gmac_err; > + > + if (EVP_EncryptUpdate(ctx, NULL, &unused, src, srclen) <= 0) > + goto process_auth_gmac_err; > + > + if (EVP_EncryptFinal_ex(ctx, NULL, &unused) <= 0) > + goto process_auth_gmac_err; > + > + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, 16, dst) <= 0) > + goto process_auth_gmac_err; > + > + return 0; > + > +process_auth_gmac_err: > + LIBCRYPTO_LOG_ERR("Process libcrypto auth gmac failed"); > + return -EINVAL; > +} > + > +/** Process standard libcrypto auth algorithms */ > +static int > +process_libcrypto_auth(uint8_t *src, uint8_t *dst, > + __rte_unused uint8_t *iv, __rte_unused EVP_PKEY * pkey, > + int srclen, EVP_MD_CTX *ctx, const EVP_MD *algo) > +{ > + size_t dstlen; > + > + if (EVP_DigestInit_ex(ctx, algo, NULL) <= 0) > + goto process_auth_err; > + > + if (EVP_DigestUpdate(ctx, (char *)src, srclen) <= 0) > + goto process_auth_err; > + > + if (EVP_DigestFinal_ex(ctx, dst, (unsigned int *)&dstlen) <= 0) > + goto process_auth_err; > + > + return 0; > + > +process_auth_err: > + LIBCRYPTO_LOG_ERR("Process libcrypto auth failed"); > + return -EINVAL; > +} > + > +/** Process standard libcrypto auth algorithms with hmac */ > +static int > +process_libcrypto_auth_hmac(uint8_t *src, uint8_t *dst, > + __rte_unused uint8_t *iv, EVP_PKEY *pkey, > + int srclen, EVP_MD_CTX *ctx, const EVP_MD *algo) > +{ > + size_t dstlen; > + > + if (EVP_DigestSignInit(ctx, NULL, algo, NULL, pkey) <= 0) > + goto process_auth_err; > + > + if (EVP_DigestSignUpdate(ctx, (char *)src, srclen) <= 0) > + goto process_auth_err; > + > + if (EVP_DigestSignFinal(ctx, dst, &dstlen) <= 0) > + goto process_auth_err; > + > + return 0; > + > +process_auth_err: > + LIBCRYPTO_LOG_ERR("Process libcrypto auth failed"); > + return -EINVAL; > +} > + > +/*----------------------------------------------------------------------------*/ > +