Abstract EVP cipher context creation

The EVP_CIPHER_CTX is now created inside a wrapper function to add support
for OpenSSL 1.1. Also fixed improper use of the EVP_CIPHER_CTX internals
in binlogrouter.
This commit is contained in:
Markus Mäkelä
2017-06-27 00:54:19 +03:00
parent 750f2ef96c
commit 09fb336403
4 changed files with 83 additions and 21 deletions

37
server/core/encryption.cc Normal file
View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
*
* Change Date: 2020-01-01
*
* On the date above, in accordance with the Business Source License, use
* of this software will be governed by version 2 or later of the General
* Public License.
*/
#include <maxscale/cppdefs.hh>
#include <maxscale/alloc.h>
#include <maxscale/encryption.h>
EVP_CIPHER_CTX* mxs_evp_cipher_ctx_alloc()
{
#ifdef OPENSSL_1_1
return EVP_CIPHER_CTX_new();
#else
EVP_CIPHER_CTX* rval = (EVP_CIPHER_CTX*)MXS_MALLOC(sizeof(*rval));
EVP_CIPHER_CTX_init(rval);
return rval;
#endif
}
void mxs_evp_cipher_ctx_free(EVP_CIPHER_CTX* ctx)
{
#ifdef OPENSSL_1_1
EVP_CIPHER_CTX_free(ctx);
#else
MXS_FREE(ctx);
#endif
}