2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-23 02:28:55 +00:00

Do not assign NULL conditionally in OpenSSL < 1.1, make it always explicit.

This commit is contained in:
Petr Mensik 2018-02-24 10:47:35 -08:00 committed by Ondřej Surý
parent 01cc622e7b
commit edaafacf36
4 changed files with 7 additions and 5 deletions

View File

@ -9,8 +9,6 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: dst_openssl.h,v 1.11 2011/03/12 04:59:48 tbox Exp $ */
#ifndef DST_OPENSSL_H #ifndef DST_OPENSSL_H
#define DST_OPENSSL_H 1 #define DST_OPENSSL_H 1
@ -41,7 +39,7 @@
* _cb; * _cb;
* #endif * #endif
*/ */
#define BN_GENCB_free(x) (x = NULL); #define BN_GENCB_free(x) ((void)0)
#define BN_GENCB_new() (&_cb) #define BN_GENCB_new() (&_cb)
#define BN_GENCB_get_arg(x) ((x)->arg) #define BN_GENCB_get_arg(x) ((x)->arg)
#endif #endif

View File

@ -25,7 +25,6 @@
/* /*
* Principal Author: Brian Wellington * Principal Author: Brian Wellington
* $Id: openssldh_link.c,v 1.20 2011/01/11 23:47:13 tbox Exp $
*/ */
#ifdef OPENSSL #ifdef OPENSSL
@ -308,6 +307,7 @@ openssldh_generate(dst_key_t *key, int generator, void (*callback)(int)) {
DST_R_OPENSSLFAILURE)); DST_R_OPENSSLFAILURE));
} }
BN_GENCB_free(cb); BN_GENCB_free(cb);
cb = NULL;
#else #else
dh = DH_generate_parameters(key->key_size, generator, dh = DH_generate_parameters(key->key_size, generator,
NULL, NULL); NULL, NULL);

View File

@ -487,6 +487,7 @@ openssldsa_generate(dst_key_t *key, int unused, void (*callback)(int)) {
DST_R_OPENSSLFAILURE)); DST_R_OPENSSLFAILURE));
} }
BN_GENCB_free(cb); BN_GENCB_free(cb);
cb = NULL;
#else #else
dsa = DSA_generate_parameters(key->key_size, rand_array, dsa = DSA_generate_parameters(key->key_size, rand_array,
ISC_SHA1_DIGESTLENGTH, NULL, NULL, ISC_SHA1_DIGESTLENGTH, NULL, NULL,

View File

@ -1043,6 +1043,7 @@ opensslrsa_generate(dst_key_t *key, int exp, void (*callback)(int)) {
if (RSA_generate_key_ex(rsa, key->key_size, e, cb)) { if (RSA_generate_key_ex(rsa, key->key_size, e, cb)) {
BN_free(e); BN_free(e);
BN_GENCB_free(cb); BN_GENCB_free(cb);
cb = NULL;
SET_FLAGS(rsa); SET_FLAGS(rsa);
#if USE_EVP #if USE_EVP
key->keydata.pkey = pkey; key->keydata.pkey = pkey;
@ -1065,8 +1066,10 @@ opensslrsa_generate(dst_key_t *key, int exp, void (*callback)(int)) {
BN_free(e); BN_free(e);
if (rsa != NULL) if (rsa != NULL)
RSA_free(rsa); RSA_free(rsa);
if (cb != NULL) if (cb != NULL) {
BN_GENCB_free(cb); BN_GENCB_free(cb);
cb = NULL;
}
return (dst__openssl_toresult(ret)); return (dst__openssl_toresult(ret));
#else #else
RSA *rsa; RSA *rsa;