Skip to content

Commit

Permalink
fix(Crypto): EVP_CIPHER_CTX_init is incorrectly defined in Envelope.c…
Browse files Browse the repository at this point in the history
…pp if it is not defined already by OpenSSL. Fixed to properly use EVP_CIPHER_CTX_reset.
  • Loading branch information
matejk committed Jan 5, 2024
1 parent 071de05 commit 7c8d5e2
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions Crypto/src/Envelope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@

#include "Poco/Crypto/Envelope.h"

#if OPENSSL_VERSION_NUMBER >= 0x10100000L
#if !defined(EVP_CIPHER_CTX_init)
#define EVP_CIPHER_CTX_init(a)
#endif
#endif

namespace Poco {
namespace Crypto {

Expand All @@ -30,8 +24,8 @@ Envelope::Envelope(int cipherNID): _pCipher(EVP_get_cipherbynid(cipherNID)),
poco_check_ptr(_pCipher);
poco_check_ptr(_pCtx);
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
if (1 != EVP_CIPHER_CTX_init(_pCtx))
handleErrors(std::string("Envelope():EVP_CIPHER_CTX_init()"));
if (1 != EVP_CIPHER_CTX_reset(_pCtx))
handleErrors(std::string("Envelope():EVP_CIPHER_CTX_reset()"));
#else
EVP_CIPHER_CTX_init(_pCtx);
#endif
Expand Down

0 comments on commit 7c8d5e2

Please sign in to comment.