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:
37
server/core/encryption.c
Normal file
37
server/core/encryption.c
Normal 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/cdefs.h>
|
||||
|
||||
#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
|
||||
}
|
Reference in New Issue
Block a user