Skip to content

Commit 273fe9f

Browse files
feat: Add EVP_CIPHER_CTX_init_wrapper (#20)
1 parent a39f934 commit 273fe9f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

shim.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,16 @@ static inline EVP_CIPHER_CTX *EVP_CIPHER_CTX_new_wrapper(void) {
176176
#endif
177177
}
178178

179+
// This wrapper allows for a common call for both versions of OpenSSL when initalizing an EVP_CIPHER_CTX.
180+
static inline void EVP_CIPHER_CTX_init_wrapper(EVP_CIPHER_CTX *ctx) {
181+
182+
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
183+
EVP_CIPHER_CTX_reset(ctx);
184+
#else
185+
EVP_CIPHER_CTX_init(ctx);
186+
#endif
187+
}
188+
179189
// This wrapper allows for a common call for both versions of OpenSSL when resetting an EVP_CIPHER_CTX.
180190
static inline int EVP_CIPHER_CTX_reset_wrapper(EVP_CIPHER_CTX *ctx) {
181191

0 commit comments

Comments
 (0)