BIO_free(in);
if (out != NULL)
BIO_free_all(out);
- if (dh != NULL)
- DH_free(dh);
+ DH_free(dh);
apps_shutdown();
OPENSSL_EXIT(ret);
}
if (!dsa
|| !DSA_generate_parameters_ex(dsa, num, NULL, 0, NULL, NULL,
cb)) {
- if (dsa)
- DSA_free(dsa);
+ DSA_free(dsa);
BN_GENCB_free(cb);
ERR_print_errors(bio_err);
goto end;
BIO_free(in);
if (out != NULL)
BIO_free_all(out);
- if (dh != NULL)
- DH_free(dh);
+ DH_free(dh);
apps_shutdown();
OPENSSL_EXIT(ret);
}
BIO_free(in);
if (out != NULL)
BIO_free_all(out);
- if (dsa != NULL)
- DSA_free(dsa);
+ DSA_free(dsa);
if (passin)
OPENSSL_free(passin);
if (passout)
BIO_free(in);
if (out != NULL)
BIO_free_all(out);
- if (dsa != NULL)
- DSA_free(dsa);
+ DSA_free(dsa);
apps_shutdown();
OPENSSL_EXIT(ret);
}
ERR_print_errors(bio_err);
if (out != NULL)
BIO_free_all(out);
- if (dh != NULL)
- DH_free(dh);
+ DH_free(dh);
if (cb != NULL)
BN_GENCB_free(cb);
apps_shutdown();
BIO_free(in);
if (out != NULL)
BIO_free_all(out);
- if (dsa != NULL)
- DSA_free(dsa);
+ DSA_free(dsa);
if (passout)
OPENSSL_free(passout);
apps_shutdown();
BN_free(bn);
if (cb)
BN_GENCB_free(cb);
- if (rsa)
- RSA_free(rsa);
+ RSA_free(rsa);
if (out)
BIO_free_all(out);
if (passout)
end:
if (out != NULL)
BIO_free_all(out);
- if (rsa != NULL)
- RSA_free(rsa);
+ RSA_free(rsa);
if (passin)
OPENSSL_free(passin);
if (passout)
}
if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) ||
!RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) {
- if (rsa_tmp)
- RSA_free(rsa_tmp);
+ RSA_free(rsa_tmp);
rsa_tmp = NULL;
}
if (!s_quiet) {
OPENSSL_free(buf2_malloc);
#ifndef OPENSSL_NO_RSA
for (i = 0; i < RSA_NUM; i++)
- if (rsa_key[i] != NULL)
- RSA_free(rsa_key[i]);
+ RSA_free(rsa_key[i]);
#endif
#ifndef OPENSSL_NO_DSA
for (i = 0; i < DSA_NUM; i++)
- if (dsa_key[i] != NULL)
- DSA_free(dsa_key[i]);
+ DSA_free(dsa_key[i]);
#endif
#ifndef OPENSSL_NO_EC
err:
if (public_key)
ASN1_INTEGER_free(public_key);
- if (dh)
- DH_free(dh);
+ DH_free(dh);
return 0;
}
ASN1_INTEGER_free(public_key);
if (pkpeer)
EVP_PKEY_free(pkpeer);
- if (dhpeer)
- DH_free(dhpeer);
+ DH_free(dhpeer);
return rv;
}
}
if (a) {
- if (*a)
- DH_free(*a);
+ DH_free(*a);
*a = dh;
}
void DH_free(DH *r)
{
int i;
+
if (r == NULL)
return;
i = CRYPTO_add(&r->references, -1, CRYPTO_LOCK_DH);
OPENSSL_free(abuf);
if (bbuf != NULL)
OPENSSL_free(bbuf);
- if (b != NULL)
- DH_free(b);
- if (a != NULL)
- DH_free(a);
+ DH_free(b);
+ DH_free(a);
if (_cb)
BN_GENCB_free(_cb);
BIO_free(out);
err:
if (public_key)
ASN1_INTEGER_free(public_key);
- if (dsa)
- DSA_free(dsa);
+ DSA_free(dsa);
return 0;
}
if ((ret = DSA_new()) == NULL)
return NULL;
cb = BN_GENCB_new();
- if (!cb) {
- DSA_free(ret);
- return NULL;
- }
+ if (!cb)
+ goto err;
BN_GENCB_set_old(cb, callback, cb_arg);
return ret;
}
BN_GENCB_free(cb);
+err:
DSA_free(ret);
return NULL;
}
return ret;
err:
- if (ret != NULL)
- DH_free(ret);
+ DH_free(ret);
return NULL;
}
#endif
end:
if (!ret)
ERR_print_errors(bio_err);
- if (dsa != NULL)
- DSA_free(dsa);
+ DSA_free(dsa);
if (cb != NULL)
BN_GENCB_free(cb);
CRYPTO_cleanup_all_ex_data();
if (pkey) {
EVP_PKEY_free(pkey);
}
- if (rsa) {
- RSA_free(rsa);
- }
+ RSA_free(rsa);
return ret;
}
memerr:
PEMerr(PEM_F_B2I_DSS, ERR_R_MALLOC_FAILURE);
- if (dsa)
- DSA_free(dsa);
+ DSA_free(dsa);
if (ret)
EVP_PKEY_free(ret);
if (ctx)
return ret;
memerr:
PEMerr(PEM_F_B2I_RSA, ERR_R_MALLOC_FAILURE);
- if (rsa)
- RSA_free(rsa);
+ RSA_free(rsa);
if (ret)
EVP_PKEY_free(ret);
return NULL;
err:
if (e)
BN_free(e);
- if (rsa)
- RSA_free(rsa);
+ RSA_free(rsa);
if (cb)
BN_GENCB_free(cb);
return 0;
tls_openssl_errors("", "", NULL, apparg);
return;
}
- if (tls_dhe1024 != NULL)
- DH_free(tls_dhe1024);
+ DH_free(tls_dhe1024);
tls_dhe1024 = dhparams;
}
DH_free() frees the B<DH> structure and its components. The values are
erased before the memory is returned to the system.
+If B<dh> is NULL nothing is done.
=head1 RETURN VALUES
DSA_free() frees the B<DSA> structure and its components. The values are
erased before the memory is returned to the system.
+If B<dsa> is NULL nothing is done.
=head1 RETURN VALUES
RSA_free() frees the B<RSA> structure and its components. The key is
erased before the memory is returned to the system.
+If B<rsa> is NULL nothing is done.
=head1 RETURN VALUES
/* --------------------- free functions * ------------------------------*/
static void pkey_free_gost94(EVP_PKEY *key)
{
- if (key->pkey.dsa) {
- DSA_free(key->pkey.dsa);
- }
+ DSA_free(key->pkey.dsa);
}
static void pkey_free_gost01(EVP_PKEY *key)
if (pubkey)
OPENSSL_free(pubkey);
if (!ret) {
- if (rkey)
- RSA_free(rkey);
- if (dkey)
- DSA_free(dkey);
+ RSA_free(rkey);
+ DSA_free(dkey);
}
return ret;
return res;
err:
# ifndef OPENSSL_NO_RSA
- if (rtmp)
- RSA_free(rtmp);
+ RSA_free(rtmp);
# endif
return NULL;
}
return res;
err:
# ifndef OPENSSL_NO_RSA
- if (rsatmp)
- RSA_free(rsatmp);
+ RSA_free(rsatmp);
# endif
# ifndef OPENSSL_NO_DSA
- if (dsatmp)
- DSA_free(dsatmp);
+ DSA_free(dsatmp);
# endif
return NULL;
}
param = p = (unsigned char *)s->init_msg;
if (s->session->sess_cert != NULL) {
#ifndef OPENSSL_NO_RSA
- if (s->session->sess_cert->peer_rsa_tmp != NULL) {
- RSA_free(s->session->sess_cert->peer_rsa_tmp);
- s->session->sess_cert->peer_rsa_tmp = NULL;
- }
+ RSA_free(s->session->sess_cert->peer_rsa_tmp);
+ s->session->sess_cert->peer_rsa_tmp = NULL;
#endif
#ifndef OPENSSL_NO_DH
- if (s->session->sess_cert->peer_dh_tmp) {
- DH_free(s->session->sess_cert->peer_dh_tmp);
- s->session->sess_cert->peer_dh_tmp = NULL;
- }
+ DH_free(s->session->sess_cert->peer_dh_tmp);
+ s->session->sess_cert->peer_dh_tmp = NULL;
#endif
#ifndef OPENSSL_NO_EC
if (s->session->sess_cert->peer_ecdh_tmp) {
err:
EVP_PKEY_free(pkey);
#ifndef OPENSSL_NO_RSA
- if (rsa != NULL)
- RSA_free(rsa);
+ RSA_free(rsa);
#endif
#ifndef OPENSSL_NO_DH
- if (dh != NULL)
- DH_free(dh);
+ DH_free(dh);
#endif
#ifndef OPENSSL_NO_EC
BN_CTX_free(bn_ctx);
if (s->s3->rrec.comp != NULL)
OPENSSL_free(s->s3->rrec.comp);
#ifndef OPENSSL_NO_DH
- if (s->s3->tmp.dh != NULL)
- DH_free(s->s3->tmp.dh);
+ DH_free(s->s3->tmp.dh);
#endif
#ifndef OPENSSL_NO_EC
if (s->s3->tmp.ecdh != NULL)
s->s3->rrec.comp = NULL;
}
#ifndef OPENSSL_NO_DH
- if (s->s3->tmp.dh != NULL) {
- DH_free(s->s3->tmp.dh);
- s->s3->tmp.dh = NULL;
- }
+ DH_free(s->s3->tmp.dh);
+ s->s3->tmp.dh = NULL;
#endif
#ifndef OPENSSL_NO_EC
if (s->s3->tmp.ecdh != NULL) {
SSLerr(SSL_F_SSL3_CTRL, ERR_R_RSA_LIB);
return (ret);
}
- if (s->cert->rsa_tmp != NULL)
- RSA_free(s->cert->rsa_tmp);
+ RSA_free(s->cert->rsa_tmp);
s->cert->rsa_tmp = rsa;
ret = 1;
}
return (ret);
}
}
- if (s->cert->dh_tmp != NULL)
- DH_free(s->cert->dh_tmp);
+ DH_free(s->cert->dh_tmp);
s->cert->dh_tmp = dh;
ret = 1;
}
SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_RSA_LIB);
return (0);
} else {
- if (cert->rsa_tmp != NULL)
- RSA_free(cert->rsa_tmp);
+ RSA_free(cert->rsa_tmp);
cert->rsa_tmp = rsa;
return (1);
}
return 0;
}
}
- if (cert->dh_tmp != NULL)
- DH_free(cert->dh_tmp);
+ DH_free(cert->dh_tmp);
cert->dh_tmp = new;
return 1;
}
#endif
#ifndef OPENSSL_NO_RSA
- if (c->rsa_tmp)
- RSA_free(c->rsa_tmp);
+ RSA_free(c->rsa_tmp);
#endif
#ifndef OPENSSL_NO_DH
- if (c->dh_tmp)
- DH_free(c->dh_tmp);
+ DH_free(c->dh_tmp);
#endif
#ifndef OPENSSL_NO_EC
if (c->ecdh_tmp)
}
#ifndef OPENSSL_NO_RSA
- if (sc->peer_rsa_tmp != NULL)
- RSA_free(sc->peer_rsa_tmp);
+ RSA_free(sc->peer_rsa_tmp);
#endif
#ifndef OPENSSL_NO_DH
- if (sc->peer_dh_tmp != NULL)
- DH_free(sc->peer_dh_tmp);
+ DH_free(sc->peer_dh_tmp);
#endif
#ifndef OPENSSL_NO_EC
if (sc->peer_ecdh_tmp != NULL)
if (cctx->ssl)
rv = SSL_set_tmp_dh(cctx->ssl, dh);
end:
- if (dh)
- DH_free(dh);
+ DH_free(dh);
if (in)
BIO_free(in);
return rv > 0;
static void free_tmp_rsa(void)
{
- if (rsa_tmp != NULL) {
- RSA_free(rsa_tmp);
- rsa_tmp = NULL;
- }
+ RSA_free(rsa_tmp);
+ rsa_tmp = NULL;
}
#endif