* [dpdk-dev] [PATCH] crypto/openssl: fix compilation break with openssl 1.1
@ 2017-09-20 9:50 Akhil Goyal
2017-09-20 15:01 ` De Lara Guarch, Pablo
0 siblings, 1 reply; 2+ messages in thread
From: Akhil Goyal @ 2017-09-20 9:50 UTC (permalink / raw)
To: dev; +Cc: declan.doherty, pablo.de.lara.guarch, hemant.agrawal, Akhil Goyal
hmac APIs are changed in openssl version 1.1.
this patch handles both versions of openssl for hmac APIs
Fixes: d7174e8f368f ("crypto/openssl: replace evp APIs with HMAC APIs")
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
---
drivers/crypto/openssl/rte_openssl_pmd.c | 27 ++++++++++++++++++++----
drivers/crypto/openssl/rte_openssl_pmd_private.h | 2 +-
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 438535e..280148e 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -48,6 +48,25 @@
static uint8_t cryptodev_driver_id;
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
+static HMAC_CTX *HMAC_CTX_new(void)
+{
+ HMAC_CTX *ctx = OPENSSL_malloc(sizeof(*ctx));
+
+ if (ctx != NULL)
+ HMAC_CTX_init(ctx);
+ return ctx;
+}
+
+static void HMAC_CTX_free(HMAC_CTX *ctx)
+{
+ if (ctx != NULL) {
+ HMAC_CTX_cleanup(ctx);
+ OPENSSL_free(ctx);
+ }
+}
+#endif
+
static int cryptodev_openssl_remove(struct rte_vdev_device *vdev);
/*----------------------------------------------------------------------------*/
@@ -437,12 +456,12 @@ openssl_set_session_auth_parameters(struct openssl_session *sess,
case RTE_CRYPTO_AUTH_SHA384_HMAC:
case RTE_CRYPTO_AUTH_SHA512_HMAC:
sess->auth.mode = OPENSSL_AUTH_AS_HMAC;
- HMAC_CTX_init(&sess->auth.hmac.ctx);
+ sess->auth.hmac.ctx = HMAC_CTX_new();
if (get_auth_algo(xform->auth.algo,
&sess->auth.hmac.evp_algo) != 0)
return -EINVAL;
- if (HMAC_Init_ex(&sess->auth.hmac.ctx,
+ if (HMAC_Init_ex(sess->auth.hmac.ctx,
xform->auth.key.data,
xform->auth.key.length,
sess->auth.hmac.evp_algo, NULL) != 1)
@@ -585,7 +604,7 @@ openssl_reset_session(struct openssl_session *sess)
break;
case OPENSSL_AUTH_AS_HMAC:
EVP_PKEY_free(sess->auth.hmac.pkey);
- HMAC_CTX_cleanup(&sess->auth.hmac.ctx);
+ HMAC_CTX_free(sess->auth.hmac.ctx);
break;
default:
break;
@@ -1293,7 +1312,7 @@ process_openssl_auth_op(struct openssl_qp *qp, struct rte_crypto_op *op,
case OPENSSL_AUTH_AS_HMAC:
status = process_openssl_auth_hmac(mbuf_src, dst,
op->sym->auth.data.offset, srclen,
- &sess->auth.hmac.ctx);
+ sess->auth.hmac.ctx);
break;
default:
status = -1;
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_private.h b/drivers/crypto/openssl/rte_openssl_pmd_private.h
index cbb8f8d..26bf862 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_private.h
+++ b/drivers/crypto/openssl/rte_openssl_pmd_private.h
@@ -172,7 +172,7 @@ struct openssl_session {
/**< pointer to EVP key */
const EVP_MD *evp_algo;
/**< pointer to EVP algorithm function */
- HMAC_CTX ctx;
+ HMAC_CTX *ctx;
/**< pointer to EVP context structure */
} hmac;
};
--
2.9.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH] crypto/openssl: fix compilation break with openssl 1.1
2017-09-20 9:50 [dpdk-dev] [PATCH] crypto/openssl: fix compilation break with openssl 1.1 Akhil Goyal
@ 2017-09-20 15:01 ` De Lara Guarch, Pablo
0 siblings, 0 replies; 2+ messages in thread
From: De Lara Guarch, Pablo @ 2017-09-20 15:01 UTC (permalink / raw)
To: Akhil Goyal, dev; +Cc: Doherty, Declan, hemant.agrawal
> -----Original Message-----
> From: Akhil Goyal [mailto:akhil.goyal@nxp.com]
> Sent: Wednesday, September 20, 2017 10:50 AM
> To: dev@dpdk.org
> Cc: Doherty, Declan <declan.doherty@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; hemant.agrawal@nxp.com; Akhil Goyal
> <akhil.goyal@nxp.com>
> Subject: [PATCH] crypto/openssl: fix compilation break with openssl 1.1
>
> hmac APIs are changed in openssl version 1.1.
>
> this patch handles both versions of openssl for hmac APIs
>
> Fixes: d7174e8f368f ("crypto/openssl: replace evp APIs with HMAC APIs")
>
> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Merged the patch to "crypto/openssl: replace evp APIs with HMAC APIs").
Applied to dpdk-next-crypto.
Thanks,
Pablo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-20 15:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-20 9:50 [dpdk-dev] [PATCH] crypto/openssl: fix compilation break with openssl 1.1 Akhil Goyal
2017-09-20 15:01 ` De Lara Guarch, Pablo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).