Skip to content

Commit

Permalink
feat: Add EVP_CIPHER_CTX_init_wrapper (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-Lees11 authored Feb 15, 2019
1 parent 203bfc8 commit 6c7e2e3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Sources/OpenSSL/shim.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static inline int HMAC_Init_wrapper(HMAC_CTX *ctx, const void *key, int len, con
return HMAC_Init_ex(ctx, key, len, md, NULL);
#else
return HMAC_Init(ctx, key, len, md);
#endif
#endif
}

// This wrapper allows for a common call for both versions of OpenSSL when creating a new EVP_MD_CTX.
Expand Down Expand Up @@ -176,6 +176,16 @@ static inline EVP_CIPHER_CTX *EVP_CIPHER_CTX_new_wrapper(void) {
#endif
}

// This wrapper allows for a common call for both versions of OpenSSL when initalizing an EVP_CIPHER_CTX.
static inline void EVP_CIPHER_CTX_init_wrapper(EVP_CIPHER_CTX *ctx) {

#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
EVP_CIPHER_CTX_reset(ctx);
#else
EVP_CIPHER_CTX_init(ctx);
#endif
}

// This wrapper allows for a common call for both versions of OpenSSL when resetting an EVP_CIPHER_CTX.
static inline int EVP_CIPHER_CTX_reset_wrapper(EVP_CIPHER_CTX *ctx) {

Expand Down

0 comments on commit 6c7e2e3

Please sign in to comment.