Skip to content

Commit

Permalink
crypto/openssl: skip workaround at compilation time
Browse files Browse the repository at this point in the history
[ upstream commit 5b94ac1965620e945a3b8fcff84fab4fcb2ef801 ]

This workaround was needed before version 1.0.1f.
Do not build it for versions >= 1.1.

Fixes: d61f70b ("crypto/libcrypto: add driver for OpenSSL library")

Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
Acked-by: Kai Ji <kai.ji@intel.com>
  • Loading branch information
didier-pallard authored and kevintraynor committed Jul 12, 2023
1 parent ad9d440 commit 1cf0bf4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions drivers/crypto/openssl/rte_openssl_pmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,8 +1061,11 @@ process_openssl_auth_encryption_gcm(struct rte_mbuf *mbuf_src, int offset,
int srclen, uint8_t *aad, int aadlen, uint8_t *iv,
uint8_t *dst, uint8_t *tag, EVP_CIPHER_CTX *ctx)
{
int len = 0, unused = 0;
int len = 0;
#if OPENSSL_VERSION_NUMBER < 0x10100000L
int unused = 0;
uint8_t empty[] = {};
#endif

if (EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv) <= 0)
goto process_auth_encryption_gcm_err;
Expand All @@ -1076,9 +1079,11 @@ process_openssl_auth_encryption_gcm(struct rte_mbuf *mbuf_src, int offset,
srclen, ctx, 0))
goto process_auth_encryption_gcm_err;

#if OPENSSL_VERSION_NUMBER < 0x10100000L
/* Workaround open ssl bug in version less then 1.0.1f */
if (EVP_EncryptUpdate(ctx, empty, &unused, empty, 0) <= 0)
goto process_auth_encryption_gcm_err;
#endif

if (EVP_EncryptFinal_ex(ctx, dst, &len) <= 0)
goto process_auth_encryption_gcm_err;
Expand Down Expand Up @@ -1140,8 +1145,11 @@ process_openssl_auth_decryption_gcm(struct rte_mbuf *mbuf_src, int offset,
int srclen, uint8_t *aad, int aadlen, uint8_t *iv,
uint8_t *dst, uint8_t *tag, EVP_CIPHER_CTX *ctx)
{
int len = 0, unused = 0;
int len = 0;
#if OPENSSL_VERSION_NUMBER < 0x10100000L
int unused = 0;
uint8_t empty[] = {};
#endif

if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, 16, tag) <= 0)
goto process_auth_decryption_gcm_err;
Expand All @@ -1158,9 +1166,11 @@ process_openssl_auth_decryption_gcm(struct rte_mbuf *mbuf_src, int offset,
srclen, ctx, 0))
goto process_auth_decryption_gcm_err;

#if OPENSSL_VERSION_NUMBER < 0x10100000L
/* Workaround open ssl bug in version less then 1.0.1f */
if (EVP_DecryptUpdate(ctx, empty, &unused, empty, 0) <= 0)
goto process_auth_decryption_gcm_err;
#endif

if (EVP_DecryptFinal_ex(ctx, dst, &len) <= 0)
return -EFAULT;
Expand Down

0 comments on commit 1cf0bf4

Please sign in to comment.