2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

Remove HAVE_OPENSSL guard from openssl_shim.{c,h} and uncrustify it

This commit is contained in:
Ondřej Surý 2018-10-05 13:06:31 +02:00
parent 0fffb82f81
commit 5ccbb274d2
2 changed files with 30 additions and 27 deletions

View File

@ -11,8 +11,6 @@
#include <config.h>
#if HAVE_OPENSSL
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
@ -24,22 +22,25 @@
#include <openssl/hmac.h>
#include <openssl/crypto.h>
void *OPENSSL_zalloc(size_t size)
void *
OPENSSL_zalloc(size_t size)
{
void *ret = OPENSSL_malloc(size);
if (ret != NULL) {
memset(ret, 0, size);
}
return ret;
return (ret);
}
EVP_CIPHER_CTX* EVP_CIPHER_CTX_new(void)
EVP_CIPHER_CTX *
EVP_CIPHER_CTX_new(void)
{
EVP_CIPHER_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
return ctx;
return (ctx);
}
void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)
void
EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)
{
if (ctx != NULL) {
EVP_CIPHER_CTX_cleanup(ctx);
@ -47,16 +48,18 @@ void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)
}
}
EVP_MD_CTX *EVP_MD_CTX_new(void)
EVP_MD_CTX *
EVP_MD_CTX_new(void)
{
EVP_MD_CTX *ctx = OPENSSL_malloc(sizeof(*ctx));
if (ctx != NULL) {
memset(ctx, 0, sizeof(*ctx));
}
return ctx;
return (ctx);
}
void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
void
EVP_MD_CTX_free(EVP_MD_CTX *ctx)
{
if (ctx != NULL) {
EVP_MD_CTX_cleanup(ctx);
@ -64,24 +67,27 @@ void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
}
}
int EVP_MD_CTX_reset(EVP_MD_CTX *ctx)
int
EVP_MD_CTX_reset(EVP_MD_CTX *ctx)
{
return EVP_MD_CTX_cleanup(ctx);
return (EVP_MD_CTX_cleanup(ctx));
}
HMAC_CTX *HMAC_CTX_new(void)
HMAC_CTX *
HMAC_CTX_new(void)
{
HMAC_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
if (ctx != NULL) {
if (!HMAC_CTX_reset(ctx)) {
HMAC_CTX_free(ctx);
return NULL;
return (NULL);
}
}
return ctx;
return (ctx);
}
void HMAC_CTX_free(HMAC_CTX *ctx)
void
HMAC_CTX_free(HMAC_CTX *ctx)
{
if (ctx != NULL) {
HMAC_CTX_cleanup(ctx);
@ -89,11 +95,11 @@ void HMAC_CTX_free(HMAC_CTX *ctx)
}
}
int HMAC_CTX_reset(HMAC_CTX *ctx) {
int
HMAC_CTX_reset(HMAC_CTX *ctx) {
HMAC_CTX_cleanup(ctx);
return 1;
return (1);
}
#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) */
#endif /* HAVE_OPENSSL */
#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L ||
* defined(LIBRESSL_VERSION_NUMBER) */

View File

@ -13,8 +13,6 @@
#include <config.h>
#if HAVE_OPENSSL
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
@ -23,7 +21,7 @@
#include <openssl/hmac.h>
void *OPENSSL_zalloc(size_t size);
EVP_CIPHER_CTX* EVP_CIPHER_CTX_new(void);
EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void);
void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx);
EVP_MD_CTX *EVP_MD_CTX_new(void);
void EVP_MD_CTX_free(EVP_MD_CTX *ctx);
@ -32,6 +30,5 @@ HMAC_CTX *HMAC_CTX_new(void);
void HMAC_CTX_free(HMAC_CTX *ctx);
int HMAC_CTX_reset(HMAC_CTX *ctx);
#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) */
#endif /* HAVE_OPENSSL */
#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L ||
* defined(LIBRESSL_VERSION_NUMBER) */