-/* $OpenBSD: a_object.c,v 1.21 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: a_object.c,v 1.22 2014/07/12 16:03:36 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
}
if (tmp != ftmp)
free(tmp);
- if (bl)
- BN_free(bl);
+ BN_free(bl);
return (len);
err:
if (tmp != ftmp)
free(tmp);
- if (bl)
- BN_free(bl);
+ BN_free(bl);
return (0);
}
-/* $OpenBSD: asn1_par.c,v 1.19 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: asn1_par.c,v 1.20 2014/07/12 16:03:36 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
nl = 1;
}
}
- if (os != NULL) {
- M_ASN1_OCTET_STRING_free(os);
- os = NULL;
- }
+ M_ASN1_OCTET_STRING_free(os);
+ os = NULL;
} else if (tag == V_ASN1_INTEGER) {
ASN1_INTEGER *bs;
int i;
end:
if (o != NULL)
ASN1_OBJECT_free(o);
- if (os != NULL)
- M_ASN1_OCTET_STRING_free(os);
+ M_ASN1_OCTET_STRING_free(os);
*pp = p;
return (ret);
}
-/* $OpenBSD: evp_asn1.c,v 1.12 2014/07/11 13:41:59 miod Exp $ */
+/* $OpenBSD: evp_asn1.c,v 1.13 2014/07/12 16:03:36 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
ASN1err(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,
ASN1_R_DATA_IS_WRONG);
}
- if (os != NULL)
- M_ASN1_OCTET_STRING_free(os);
- if (ai != NULL)
- M_ASN1_INTEGER_free(ai);
+ M_ASN1_OCTET_STRING_free(os);
+ M_ASN1_INTEGER_free(ai);
return (ret);
}
-/* $OpenBSD: x_pkey.c,v 1.14 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: x_pkey.c,v 1.15 2014/07/12 16:03:36 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
if (x->enc_algor != NULL)
X509_ALGOR_free(x->enc_algor);
- if (x->enc_pkey != NULL)
- M_ASN1_OCTET_STRING_free(x->enc_pkey);
- if (x->dec_pkey != NULL)
- EVP_PKEY_free(x->dec_pkey);
+ M_ASN1_OCTET_STRING_free(x->enc_pkey);
+ EVP_PKEY_free(x->dec_pkey);
if ((x->key_data != NULL) && (x->key_free))
free(x->key_data);
free(x);
-/* $OpenBSD: x_pubkey.c,v 1.21 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: x_pubkey.c,v 1.22 2014/07/12 16:03:36 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
return ret;
error:
- if (ret != NULL)
- EVP_PKEY_free(ret);
+ EVP_PKEY_free(ret);
return (NULL);
}
-/* $OpenBSD: bn_blind.c,v 1.13 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: bn_blind.c,v 1.14 2014/07/12 16:03:36 miod Exp $ */
/* ====================================================================
* Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
*
if (r == NULL)
return;
- if (r->A != NULL)
- BN_clear_free(r->A );
- if (r->Ai != NULL)
- BN_clear_free(r->Ai);
- if (r->e != NULL)
- BN_clear_free(r->e );
- if (r->mod != NULL)
- BN_clear_free(r->mod);
+ BN_clear_free(r->A);
+ BN_clear_free(r->Ai);
+ BN_clear_free(r->e);
+ BN_clear_free(r->mod);
free(r);
}
goto err;
if (e != NULL) {
- if (ret->e != NULL)
- BN_free(ret->e);
+ BN_free(ret->e);
ret->e = BN_dup(e);
}
if (ret->e == NULL)
-/* $OpenBSD: bn_lib.c,v 1.32 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: bn_lib.c,v 1.33 2014/07/12 16:03:36 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
i = ((n - 1) / BN_BYTES) + 1;
m = ((n - 1) % (BN_BYTES));
if (bn_wexpand(ret, (int)i) == NULL) {
- if (bn)
- BN_free(bn);
+ BN_free(bn);
return NULL;
}
ret->top = i;
-/* $OpenBSD: bn_mod.c,v 1.8 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: bn_mod.c,v 1.9 2014/07/12 16:03:36 miod Exp $ */
/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
* for the OpenSSL project. */
/* ====================================================================
ret = BN_mod_lshift_quick(r, r, n, (abs_m ? abs_m : m));
bn_check_top(r);
- if (abs_m)
- BN_free(abs_m);
+ BN_free(abs_m);
return ret;
}
-/* $OpenBSD: bn_prime.c,v 1.10 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: bn_prime.c,v 1.11 2014/07/12 16:03:36 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
if (ctx_passed == NULL)
BN_CTX_free(ctx);
}
- if (mont != NULL)
- BN_MONT_CTX_free(mont);
+ BN_MONT_CTX_free(mont);
return (ret);
}
-/* $OpenBSD: bn_print.c,v 1.22 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: bn_print.c,v 1.23 2014/07/12 16:03:36 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
err:
free(bn_data);
- if (t != NULL)
- BN_free(t);
+ BN_free(t);
if (!ok && buf) {
free(buf);
buf = NULL;
-/* $OpenBSD: cm_ameth.c,v 1.6 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: cm_ameth.c,v 1.7 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2010.
*/
{
CMAC_CTX *cmctx = (CMAC_CTX *)pkey->pkey.ptr;
- if (cmctx)
- CMAC_CTX_free(cmctx);
+ CMAC_CTX_free(cmctx);
}
const EVP_PKEY_ASN1_METHOD cmac_asn1_meth = {
-/* $OpenBSD: cms_asn1.c,v 1.4 2014/06/12 15:49:28 deraadt Exp $ */
+/* $OpenBSD: cms_asn1.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
{
if (operation == ASN1_OP_FREE_POST) {
CMS_SignerInfo *si = (CMS_SignerInfo *)*pval;
- if (si->pkey)
- EVP_PKEY_free(si->pkey);
+ EVP_PKEY_free(si->pkey);
if (si->signer)
X509_free(si->signer);
}
CMS_RecipientInfo *ri = (CMS_RecipientInfo *)*pval;
if (ri->type == CMS_RECIPINFO_TRANS) {
CMS_KeyTransRecipientInfo *ktri = ri->d.ktri;
- if (ktri->pkey)
- EVP_PKEY_free(ktri->pkey);
+ EVP_PKEY_free(ktri->pkey);
if (ktri->recip)
X509_free(ktri->recip);
} else if (ri->type == CMS_RECIPINFO_KEK) {
-/* $OpenBSD: cms_env.c,v 1.6 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: cms_env.c,v 1.7 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
ret = 1;
err:
- if (pctx)
- EVP_PKEY_CTX_free(pctx);
+ EVP_PKEY_CTX_free(pctx);
free(ek);
return ret;
}
ec->keylen = eklen;
err:
- if (pctx)
- EVP_PKEY_CTX_free(pctx);
+ EVP_PKEY_CTX_free(pctx);
if (!ret && ek)
free(ek);
-/* $OpenBSD: cms_sd.c,v 1.7 2014/07/11 13:02:10 miod Exp $ */
+/* $OpenBSD: cms_sd.c,v 1.8 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
{
if (signer) {
CRYPTO_add(&signer->references, 1, CRYPTO_LOCK_X509);
- if (si->pkey)
- EVP_PKEY_free(si->pkey);
+ EVP_PKEY_free(si->pkey);
si->pkey = X509_get_pubkey(signer);
}
if (si->signer)
-/* $OpenBSD: dh_ameth.c,v 1.11 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dh_ameth.c,v 1.12 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
err:
if (public_key)
ASN1_INTEGER_free(public_key);
- if (dh)
- DH_free(dh);
+ DH_free(dh);
return 0;
}
if ((a = BN_dup(from->pkey.dh->p)) == NULL)
return 0;
- if (to->pkey.dh->p != NULL)
- BN_free(to->pkey.dh->p);
+ BN_free(to->pkey.dh->p);
to->pkey.dh->p = a;
if ((a = BN_dup(from->pkey.dh->g)) == NULL)
return 0;
- if (to->pkey.dh->g != NULL)
- BN_free(to->pkey.dh->g);
+ BN_free(to->pkey.dh->g);
to->pkey.dh->g = a;
return 1;
-/* $OpenBSD: dh_check.c,v 1.13 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dh_check.c,v 1.14 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
}
ok = 1;
err:
- if (ctx != NULL)
- BN_CTX_free(ctx);
- if (q != NULL)
- BN_free(q);
+ BN_CTX_free(ctx);
+ BN_free(q);
return ok;
}
-/* $OpenBSD: dh_key.c,v 1.20 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dh_key.c,v 1.21 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
static int
dh_finish(DH *dh)
{
- if (dh->method_mont_p)
- BN_MONT_CTX_free(dh->method_mont_p);
+ BN_MONT_CTX_free(dh->method_mont_p);
return 1;
}
-/* $OpenBSD: dh_lib.c,v 1.19 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dh_lib.c,v 1.20 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, r, &r->ex_data);
- if (r->p != NULL)
- BN_clear_free(r->p);
- if (r->g != NULL)
- BN_clear_free(r->g);
- if (r->q != NULL)
- BN_clear_free(r->q);
- if (r->j != NULL)
- BN_clear_free(r->j);
+ BN_clear_free(r->p);
+ BN_clear_free(r->g);
+ BN_clear_free(r->q);
+ BN_clear_free(r->j);
free(r->seed);
- if (r->counter != NULL)
- BN_clear_free(r->counter);
- if (r->pub_key != NULL)
- BN_clear_free(r->pub_key);
- if (r->priv_key != NULL)
- BN_clear_free(r->priv_key);
+ BN_clear_free(r->counter);
+ BN_clear_free(r->pub_key);
+ BN_clear_free(r->priv_key);
free(r);
}
-/* $OpenBSD: dsa.h,v 1.17 2014/06/12 15:49:28 deraadt Exp $ */
+/* $OpenBSD: dsa.h,v 1.18 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
DSA * DSA_new(void);
DSA * DSA_new_method(ENGINE *engine);
-void DSA_free (DSA *r);
+void DSA_free(DSA *r);
/* "up" the DSA object's reference count */
int DSA_up_ref(DSA *r);
int DSA_size(const DSA *);
-/* $OpenBSD: dsa_ameth.c,v 1.12 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dsa_ameth.c,v 1.13 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
err:
if (public_key)
ASN1_INTEGER_free(public_key);
- if (dsa)
- DSA_free(dsa);
+ DSA_free(dsa);
return 0;
}
}
EVP_PKEY_assign_DSA(pkey, dsa);
- BN_CTX_free (ctx);
+ BN_CTX_free(ctx);
if (ndsa)
sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free);
else
decerr:
DSAerr(DSA_F_DSA_PRIV_DECODE, EVP_R_DECODE_ERROR);
dsaerr:
- BN_CTX_free (ctx);
+ BN_CTX_free(ctx);
if (privkey)
ASN1_INTEGER_free(privkey);
sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free);
if ((a = BN_dup(from->pkey.dsa->p)) == NULL)
return 0;
- if (to->pkey.dsa->p != NULL)
- BN_free(to->pkey.dsa->p);
+ BN_free(to->pkey.dsa->p);
to->pkey.dsa->p = a;
if ((a = BN_dup(from->pkey.dsa->q)) == NULL)
return 0;
- if (to->pkey.dsa->q != NULL)
- BN_free(to->pkey.dsa->q);
+ BN_free(to->pkey.dsa->q);
to->pkey.dsa->q = a;
if ((a = BN_dup(from->pkey.dsa->g)) == NULL)
return 0;
- if (to->pkey.dsa->g != NULL)
- BN_free(to->pkey.dsa->g);
+ BN_free(to->pkey.dsa->g);
to->pkey.dsa->g = a;
return 1;
}
-/* $OpenBSD: dsa_gen.c,v 1.15 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dsa_gen.c,v 1.16 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
ok = 1;
err:
if (ok) {
- if (ret->p)
- BN_free(ret->p);
- if (ret->q)
- BN_free(ret->q);
- if (ret->g)
- BN_free(ret->g);
+ BN_free(ret->p);
+ BN_free(ret->q);
+ BN_free(ret->g);
ret->p = BN_dup(p);
ret->q = BN_dup(q);
ret->g = BN_dup(g);
BN_CTX_end(ctx);
BN_CTX_free(ctx);
}
- if (mont != NULL)
- BN_MONT_CTX_free(mont);
+ BN_MONT_CTX_free(mont);
return ok;
}
#endif
-/* $OpenBSD: dsa_key.c,v 1.18 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dsa_key.c,v 1.19 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
BN_free(pub_key);
if (priv_key != NULL && dsa->priv_key == NULL)
BN_free(priv_key);
- if (ctx != NULL)
- BN_CTX_free(ctx);
+ BN_CTX_free(ctx);
return ok;
}
#endif
-/* $OpenBSD: dsa_lib.c,v 1.20 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dsa_lib.c,v 1.21 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DSA, r, &r->ex_data);
- if (r->p != NULL)
- BN_clear_free(r->p);
- if (r->q != NULL)
- BN_clear_free(r->q);
- if (r->g != NULL)
- BN_clear_free(r->g);
- if (r->pub_key != NULL)
- BN_clear_free(r->pub_key);
- if (r->priv_key != NULL)
- BN_clear_free(r->priv_key);
- if (r->kinv != NULL)
- BN_clear_free(r->kinv);
- if (r->r != NULL)
- BN_clear_free(r->r);
+ BN_clear_free(r->p);
+ BN_clear_free(r->q);
+ BN_clear_free(r->g);
+ BN_clear_free(r->pub_key);
+ BN_clear_free(r->priv_key);
+ BN_clear_free(r->kinv);
+ BN_clear_free(r->r);
free(r);
}
return ret;
err:
- if (ret != NULL)
- DH_free(ret);
+ DH_free(ret);
return NULL;
}
#endif
-/* $OpenBSD: dsa_ossl.c,v 1.20 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dsa_ossl.c,v 1.21 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
BN_free(r);
BN_free(s);
}
- if (ctx != NULL)
- BN_CTX_free(ctx);
+ BN_CTX_free(ctx);
BN_clear_free(&m);
BN_clear_free(&xr);
- if (kinv != NULL) /* dsa->kinv is NULL now if we used it */
- BN_clear_free(kinv);
+ BN_clear_free(kinv);
return ret;
}
if ((kinv = BN_mod_inverse(NULL, &k, dsa->q, ctx)) == NULL)
goto err;
- if (*kinvp != NULL)
- BN_clear_free(*kinvp);
+ BN_clear_free(*kinvp);
*kinvp = kinv;
kinv = NULL;
- if (*rp != NULL)
- BN_clear_free(*rp);
+ BN_clear_free(*rp);
*rp = r;
ret = 1;
err:
if (!ret) {
DSAerr(DSA_F_DSA_SIGN_SETUP, ERR_R_BN_LIB);
- if (r != NULL)
- BN_clear_free(r);
+ BN_clear_free(r);
}
if (ctx_in == NULL)
BN_CTX_free(ctx);
there is no error in BN. Test should be ret == -1 (Ben) */
if (ret != 1)
DSAerr(DSA_F_DSA_DO_VERIFY, ERR_R_BN_LIB);
- if (ctx != NULL)
- BN_CTX_free(ctx);
+ BN_CTX_free(ctx);
BN_free(&u1);
BN_free(&u2);
BN_free(&t1);
static int
dsa_finish(DSA *dsa)
{
- if (dsa->method_mont_p)
- BN_MONT_CTX_free(dsa->method_mont_p);
+ BN_MONT_CTX_free(dsa->method_mont_p);
return 1;
}
-/* $OpenBSD: dsa_sign.c,v 1.17 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dsa_sign.c,v 1.18 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
DSA_SIG_free(DSA_SIG *sig)
{
if (sig) {
- if (sig->r)
- BN_free(sig->r);
- if (sig->s)
- BN_free(sig->s);
+ BN_free(sig->r);
+ BN_free(sig->s);
free(sig);
}
}
-/* $OpenBSD: ec2_mult.c,v 1.4 2014/07/10 22:45:56 jsing Exp $ */
+/* $OpenBSD: ec2_mult.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */
/* ====================================================================
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
ret = 1;
err:
- if (p)
- EC_POINT_free(p);
- if (acc)
- EC_POINT_free(acc);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ EC_POINT_free(p);
+ EC_POINT_free(acc);
+ BN_CTX_free(new_ctx);
return ret;
}
-/* $OpenBSD: ec2_oct.c,v 1.4 2014/07/10 22:45:56 jsing Exp $ */
+/* $OpenBSD: ec2_oct.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */
/* ====================================================================
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
}
if (used_ctx)
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
err:
if (used_ctx)
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return 0;
}
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
#endif
-/* $OpenBSD: ec2_smpl.c,v 1.11 2014/07/10 22:45:56 jsing Exp $ */
+/* $OpenBSD: ec2_smpl.c,v 1.12 2014/07/12 16:03:37 miod Exp $ */
/* ====================================================================
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
err:
if (ctx != NULL)
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
if (ctx)
BN_CTX_end(ctx);
- if (new_ctx)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
if (ctx)
BN_CTX_end(ctx);
- if (new_ctx)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
if (ctx)
BN_CTX_end(ctx);
- if (new_ctx)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
-/* $OpenBSD: ec_ameth.c,v 1.11 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: ec_ameth.c,v 1.12 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
err:
if (!ret)
ECerr(EC_F_DO_EC_KEY_PRINT, reason);
- if (pub_key)
- BN_free(pub_key);
- if (order)
- BN_free(order);
- if (ctx)
- BN_CTX_free(ctx);
+ BN_free(pub_key);
+ BN_free(order);
+ BN_CTX_free(ctx);
free(buffer);
return (ret);
}
-/* $OpenBSD: ec_asn1.c,v 1.9 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: ec_asn1.c,v 1.10 2014/07/12 16:03:37 miod Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
ok = 1;
-err: if (tmp)
- BN_free(tmp);
+err:
+ BN_free(tmp);
return (ok);
}
ok = 1;
-err: free(buffer_1);
+err:
+ free(buffer_1);
free(buffer_2);
- if (tmp_1)
- BN_free(tmp_1);
- if (tmp_2)
- BN_free(tmp_2);
+ BN_free(tmp_1);
+ BN_free(tmp_2);
return (ok);
}
ECPARAMETERS_free(ret);
ret = NULL;
}
- if (tmp)
- BN_free(tmp);
+ BN_free(tmp);
free(buffer);
return (ret);
}
}
/* extract the cofactor (optional) */
if (params->cofactor == NULL) {
- if (b) {
- BN_free(b);
- b = NULL;
- }
+ BN_free(b);
+ b = NULL;
} else if ((b = ASN1_INTEGER_to_BN(params->cofactor, b)) == NULL) {
ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_ASN1_LIB);
goto err;
ok = 1;
err: if (!ok) {
- if (ret)
- EC_GROUP_clear_free(ret);
+ EC_GROUP_clear_free(ret);
ret = NULL;
}
- if (p)
- BN_free(p);
- if (a)
- BN_free(a);
- if (b)
- BN_free(b);
- if (point)
- EC_POINT_free(point);
+ BN_free(p);
+ BN_free(a);
+ BN_free(b);
+ EC_POINT_free(point);
return (ret);
}
ret = *a;
if (priv_key->parameters) {
- if (ret->group)
- EC_GROUP_clear_free(ret->group);
+ EC_GROUP_clear_free(ret->group);
ret->group = ec_asn1_pkparameters2group(priv_key->parameters);
}
if (ret->group == NULL) {
const unsigned char *pub_oct;
size_t pub_oct_len;
- if (ret->pub_key)
- EC_POINT_clear_free(ret->pub_key);
+ EC_POINT_clear_free(ret->pub_key);
ret->pub_key = EC_POINT_new(ret->group);
if (ret->pub_key == NULL) {
ECerr(EC_F_D2I_ECPRIVATEKEY, ERR_R_EC_LIB);
-/* $OpenBSD: ec_check.c,v 1.3 2014/06/12 15:49:29 deraadt Exp $ */
+/* $OpenBSD: ec_check.c,v 1.4 2014/07/12 16:03:37 miod Exp $ */
/* ====================================================================
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
*
err:
if (ctx != NULL)
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
- if (point)
- EC_POINT_free(point);
+ BN_CTX_free(new_ctx);
+ EC_POINT_free(point);
return ret;
}
-/* $OpenBSD: ec_curve.c,v 1.6 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: ec_curve.c,v 1.7 2014/07/12 16:03:37 miod Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
EC_GROUP_free(group);
group = NULL;
}
- if (P)
- EC_POINT_free(P);
- if (ctx)
- BN_CTX_free(ctx);
- if (p)
- BN_free(p);
- if (a)
- BN_free(a);
- if (b)
- BN_free(b);
- if (order)
- BN_free(order);
- if (x)
- BN_free(x);
- if (y)
- BN_free(y);
+ EC_POINT_free(P);
+ BN_CTX_free(ctx);
+ BN_free(p);
+ BN_free(a);
+ BN_free(b);
+ BN_free(order);
+ BN_free(x);
+ BN_free(y);
return group;
}
-/* $OpenBSD: ec_key.c,v 1.8 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: ec_key.c,v 1.9 2014/07/12 16:03:37 miod Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
if (i > 0)
return;
- if (r->group != NULL)
- EC_GROUP_free(r->group);
- if (r->pub_key != NULL)
- EC_POINT_free(r->pub_key);
- if (r->priv_key != NULL)
- BN_clear_free(r->priv_key);
+ EC_GROUP_free(r->group);
+ EC_POINT_free(r->pub_key);
+ BN_clear_free(r->priv_key);
EC_EX_DATA_free_all_data(&r->method_data);
if (src->group) {
const EC_METHOD *meth = EC_GROUP_method_of(src->group);
/* clear the old group */
- if (dest->group)
- EC_GROUP_free(dest->group);
+ EC_GROUP_free(dest->group);
dest->group = EC_GROUP_new(meth);
if (dest->group == NULL)
return NULL;
}
/* copy the public key */
if (src->pub_key && src->group) {
- if (dest->pub_key)
- EC_POINT_free(dest->pub_key);
+ EC_POINT_free(dest->pub_key);
dest->pub_key = EC_POINT_new(src->group);
if (dest->pub_key == NULL)
return NULL;
ok = 1;
err:
- if (order)
- BN_free(order);
+ BN_free(order);
if (pub_key != NULL && eckey->pub_key == NULL)
EC_POINT_free(pub_key);
if (priv_key != NULL && eckey->priv_key == NULL)
BN_free(priv_key);
- if (ctx != NULL)
- BN_CTX_free(ctx);
+ BN_CTX_free(ctx);
return (ok);
}
}
ok = 1;
err:
- if (ctx != NULL)
- BN_CTX_free(ctx);
- if (point != NULL)
- EC_POINT_free(point);
+ BN_CTX_free(ctx);
+ EC_POINT_free(point);
return (ok);
}
ok = 1;
err:
- if (ctx)
- BN_CTX_free(ctx);
- if (point)
- EC_POINT_free(point);
+ BN_CTX_free(ctx);
+ EC_POINT_free(point);
return ok;
}
int
EC_KEY_set_group(EC_KEY * key, const EC_GROUP * group)
{
- if (key->group != NULL)
- EC_GROUP_free(key->group);
+ EC_GROUP_free(key->group);
key->group = EC_GROUP_dup(group);
return (key->group == NULL) ? 0 : 1;
}
int
EC_KEY_set_private_key(EC_KEY * key, const BIGNUM * priv_key)
{
- if (key->priv_key)
- BN_clear_free(key->priv_key);
+ BN_clear_free(key->priv_key);
key->priv_key = BN_dup(priv_key);
return (key->priv_key == NULL) ? 0 : 1;
}
int
EC_KEY_set_public_key(EC_KEY * key, const EC_POINT * pub_key)
{
- if (key->pub_key != NULL)
- EC_POINT_free(key->pub_key);
+ EC_POINT_free(key->pub_key);
key->pub_key = EC_POINT_dup(pub_key, key->group);
return (key->pub_key == NULL) ? 0 : 1;
}
-/* $OpenBSD: ec_lib.c,v 1.14 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: ec_lib.c,v 1.15 2014/07/12 16:03:37 miod Exp $ */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
EC_EX_DATA_free_all_data(&group->extra_data);
- if (group->generator != NULL)
- EC_POINT_free(group->generator);
+ EC_POINT_free(group->generator);
BN_free(&group->order);
BN_free(&group->cofactor);
EC_EX_DATA_clear_free_all_data(&group->extra_data);
- if (group->generator != NULL)
- EC_POINT_clear_free(group->generator);
+ EC_POINT_clear_free(group->generator);
BN_clear_free(&group->order);
BN_clear_free(&group->cofactor);
return 0;
} else {
/* src->generator == NULL */
- if (dest->generator != NULL) {
- EC_POINT_clear_free(dest->generator);
- dest->generator = NULL;
- }
+ EC_POINT_clear_free(dest->generator);
+ dest->generator = NULL;
}
if (!BN_copy(&dest->order, &src->order))
err:
if (!ok) {
- if (t)
- EC_GROUP_free(t);
+ EC_GROUP_free(t);
return NULL;
} else
return t;
-/* $OpenBSD: ec_mult.c,v 1.13 2014/06/12 15:49:29 deraadt Exp $ */
+/* $OpenBSD: ec_mult.c,v 1.14 2014/07/12 16:03:37 miod Exp $ */
/*
* Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project.
*/
ret = 1;
err:
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
- if (tmp != NULL)
- EC_POINT_free(tmp);
+ BN_CTX_free(new_ctx);
+ EC_POINT_free(tmp);
free(wsize);
free(wNAF_len);
if (wNAF != NULL) {
err:
if (ctx != NULL)
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
- if (pre_comp)
- ec_pre_comp_free(pre_comp);
+ BN_CTX_free(new_ctx);
+ ec_pre_comp_free(pre_comp);
if (points) {
EC_POINT **p;
EC_POINT_free(*p);
free(points);
}
- if (tmp_point)
- EC_POINT_free(tmp_point);
- if (base)
- EC_POINT_free(base);
+ EC_POINT_free(tmp_point);
+ EC_POINT_free(base);
return ret;
}
-/* $OpenBSD: ec_pmeth.c,v 1.7 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: ec_pmeth.c,v 1.8 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
{
EC_PKEY_CTX *dctx = ctx->data;
if (dctx) {
- if (dctx->gen_group)
- EC_GROUP_free(dctx->gen_group);
+ EC_GROUP_free(dctx->gen_group);
free(dctx);
}
}
ECerr(EC_F_PKEY_EC_CTRL, EC_R_INVALID_CURVE);
return 0;
}
- if (dctx->gen_group)
- EC_GROUP_free(dctx->gen_group);
+ EC_GROUP_free(dctx->gen_group);
dctx->gen_group = group;
return 1;
-/* $OpenBSD: eck_prn.c,v 1.9 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: eck_prn.c,v 1.10 2014/07/12 16:03:37 miod Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
err:
if (!ret)
ECerr(EC_F_ECPKPARAMETERS_PRINT, reason);
- if (p)
- BN_free(p);
- if (a)
- BN_free(a);
- if (b)
- BN_free(b);
- if (gen)
- BN_free(gen);
- if (order)
- BN_free(order);
- if (cofactor)
- BN_free(cofactor);
- if (ctx)
- BN_CTX_free(ctx);
+ BN_free(p);
+ BN_free(a);
+ BN_free(b);
+ BN_free(gen);
+ BN_free(order);
+ BN_free(cofactor);
+ BN_CTX_free(ctx);
free(buffer);
return (ret);
}
-/* $OpenBSD: ecp_mont.c,v 1.8 2014/06/12 15:49:29 deraadt Exp $ */
+/* $OpenBSD: ecp_mont.c,v 1.9 2014/07/12 16:03:37 miod Exp $ */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
void
ec_GFp_mont_group_finish(EC_GROUP * group)
{
- if (group->field_data1 != NULL) {
- BN_MONT_CTX_free(group->field_data1);
- group->field_data1 = NULL;
- }
- if (group->field_data2 != NULL) {
- BN_free(group->field_data2);
- group->field_data2 = NULL;
- }
+ BN_MONT_CTX_free(group->field_data1);
+ group->field_data1 = NULL;
+ BN_free(group->field_data2);
+ group->field_data2 = NULL;
ec_GFp_simple_group_finish(group);
}
void
ec_GFp_mont_group_clear_finish(EC_GROUP * group)
{
- if (group->field_data1 != NULL) {
- BN_MONT_CTX_free(group->field_data1);
- group->field_data1 = NULL;
- }
- if (group->field_data2 != NULL) {
- BN_clear_free(group->field_data2);
- group->field_data2 = NULL;
- }
+ BN_MONT_CTX_free(group->field_data1);
+ group->field_data1 = NULL;
+ BN_clear_free(group->field_data2);
+ group->field_data2 = NULL;
ec_GFp_simple_group_clear_finish(group);
}
int
ec_GFp_mont_group_copy(EC_GROUP * dest, const EC_GROUP * src)
{
- if (dest->field_data1 != NULL) {
- BN_MONT_CTX_free(dest->field_data1);
- dest->field_data1 = NULL;
- }
- if (dest->field_data2 != NULL) {
- BN_clear_free(dest->field_data2);
- dest->field_data2 = NULL;
- }
+ BN_MONT_CTX_free(dest->field_data1);
+ dest->field_data1 = NULL;
+ BN_clear_free(dest->field_data2);
+ dest->field_data2 = NULL;
+
if (!ec_GFp_simple_group_copy(dest, src))
return 0;
BIGNUM *one = NULL;
int ret = 0;
- if (group->field_data1 != NULL) {
- BN_MONT_CTX_free(group->field_data1);
- group->field_data1 = NULL;
- }
- if (group->field_data2 != NULL) {
- BN_free(group->field_data2);
- group->field_data2 = NULL;
- }
+ BN_MONT_CTX_free(group->field_data1);
+ group->field_data1 = NULL;
+ BN_free(group->field_data2);
+ group->field_data2 = NULL;
if (ctx == NULL) {
ctx = new_ctx = BN_CTX_new();
if (ctx == NULL)
group->field_data2 = NULL;
}
err:
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
- if (mont != NULL)
- BN_MONT_CTX_free(mont);
+ BN_CTX_free(new_ctx);
+ BN_MONT_CTX_free(mont);
return ret;
}
-/* $OpenBSD: ecp_nist.c,v 1.8 2014/06/12 15:49:29 deraadt Exp $ */
+/* $OpenBSD: ecp_nist.c,v 1.9 2014/07/12 16:03:37 miod Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
ret = 1;
err:
- if (ctx_new)
- BN_CTX_free(ctx_new);
+ BN_CTX_free(ctx_new);
return ret;
}
ret = 1;
err:
- if (ctx_new)
- BN_CTX_free(ctx_new);
+ BN_CTX_free(ctx_new);
return ret;
}
-/* $OpenBSD: ecp_nistp224.c,v 1.14 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: ecp_nistp224.c,v 1.15 2014/07/12 16:03:37 miod Exp $ */
/*
* Written by Emilia Kasper (Google) for the OpenSSL project.
*/
ret = ec_GFp_simple_group_set_curve(group, p, a, b, ctx);
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
BN_CTX_end(ctx);
- if (generator != NULL)
- EC_POINT_free(generator);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ EC_POINT_free(generator);
+ BN_CTX_free(new_ctx);
free(secrets);
free(pre_comp);
free(tmp_felems);
pre = NULL;
err:
BN_CTX_end(ctx);
- if (generator != NULL)
- EC_POINT_free(generator);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
- if (pre)
- nistp224_pre_comp_free(pre);
+ EC_POINT_free(generator);
+ BN_CTX_free(new_ctx);
+ nistp224_pre_comp_free(pre);
return ret;
}
-/* $OpenBSD: ecp_nistp256.c,v 1.13 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: ecp_nistp256.c,v 1.14 2014/07/12 16:03:37 miod Exp $ */
/*
* Written by Adam Langley (Google) for the OpenSSL project
*/
ret = ec_GFp_simple_group_set_curve(group, p, a, b, ctx);
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
BN_CTX_end(ctx);
- if (generator != NULL)
- EC_POINT_free(generator);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ EC_POINT_free(generator);
+ BN_CTX_free(new_ctx);
free(secrets);
free(pre_comp);
free(tmp_smallfelems);
pre = NULL;
err:
BN_CTX_end(ctx);
- if (generator != NULL)
- EC_POINT_free(generator);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
- if (pre)
- nistp256_pre_comp_free(pre);
+ EC_POINT_free(generator);
+ BN_CTX_free(new_ctx);
+ nistp256_pre_comp_free(pre);
return ret;
}
-/* $OpenBSD: ecp_nistp521.c,v 1.14 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: ecp_nistp521.c,v 1.15 2014/07/12 16:03:37 miod Exp $ */
/*
* Written by Adam Langley (Google) for the OpenSSL project
*/
ret = ec_GFp_simple_group_set_curve(group, p, a, b, ctx);
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
BN_CTX_end(ctx);
- if (generator != NULL)
- EC_POINT_free(generator);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ EC_POINT_free(generator);
+ BN_CTX_free(new_ctx);
free(secrets);
free(pre_comp);
free(tmp_felems);
pre = NULL;
err:
BN_CTX_end(ctx);
- if (generator != NULL)
- EC_POINT_free(generator);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
- if (pre)
- nistp521_pre_comp_free(pre);
+ EC_POINT_free(generator);
+ BN_CTX_free(new_ctx);
+ nistp521_pre_comp_free(pre);
return ret;
}
-/* $OpenBSD: ecp_oct.c,v 1.4 2014/06/12 15:49:29 deraadt Exp $ */
+/* $OpenBSD: ecp_oct.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */
/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
* for the OpenSSL project.
* Includes code written by Bodo Moeller for the OpenSSL project.
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
}
if (used_ctx)
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
err:
if (used_ctx)
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return 0;
}
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
-/* $OpenBSD: ecp_smpl.c,v 1.12 2014/06/12 15:49:29 deraadt Exp $ */
+/* $OpenBSD: ecp_smpl.c,v 1.13 2014/07/12 16:03:37 miod Exp $ */
/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
* for the OpenSSL project.
* Includes code written by Bodo Moeller for the OpenSSL project.
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
ret = 1;
err:
- if (new_ctx)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
if (ctx != NULL)
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
ret = 1;
err:
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
ret = 1;
err:
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
end:
if (ctx) /* otherwise we already called BN_CTX_end */
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
end:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
if (heap != NULL) {
/*
* heap[pow2/2] .. heap[pow2-1] have not been allocated
* locally!
*/
for (i = pow2 / 2 - 1; i > 0; i--) {
- if (heap[i] != NULL)
- BN_clear_free(heap[i]);
+ BN_clear_free(heap[i]);
}
free(heap);
}
-/* $OpenBSD: ech_ossl.c,v 1.7 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: ech_ossl.c,v 1.8 2014/07/12 16:03:37 miod Exp $ */
/* ====================================================================
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
}
err:
- if (tmp) EC_POINT_free(tmp);
- if (ctx) BN_CTX_end(ctx);
- if (ctx) BN_CTX_free(ctx);
+ EC_POINT_free(tmp);
+ if (ctx)
+ BN_CTX_end(ctx);
+ BN_CTX_free(ctx);
free(buf);
return(ret);
}
-/* $OpenBSD: ecs_ossl.c,v 1.4 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: ecs_ossl.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project
*/
goto err;
}
/* clear old values if necessary */
- if (*rp != NULL)
- BN_clear_free(*rp);
- if (*kinvp != NULL)
- BN_clear_free(*kinvp);
+ BN_clear_free(*rp);
+ BN_clear_free(*kinvp);
/* save the pre-computed values */
*rp = r;
*kinvp = k;
ret = 1;
err:
- if (!ret)
- {
- if (k != NULL) BN_clear_free(k);
- if (r != NULL) BN_clear_free(r);
+ if (!ret) {
+ BN_clear_free(k);
+ BN_clear_free(r);
}
if (ctx_in == NULL)
BN_CTX_free(ctx);
- if (order != NULL)
- BN_free(order);
- if (tmp_point != NULL)
- EC_POINT_free(tmp_point);
- if (X)
- BN_clear_free(X);
+ BN_free(order);
+ EC_POINT_free(tmp_point);
+ BN_clear_free(X);
return(ret);
}
ECDSA_SIG_free(ret);
ret = NULL;
}
- if (ctx)
- BN_CTX_free(ctx);
- if (m)
- BN_clear_free(m);
- if (tmp)
- BN_clear_free(tmp);
- if (order)
- BN_free(order);
- if (kinv)
- BN_clear_free(kinv);
+ BN_CTX_free(ctx);
+ BN_clear_free(m);
+ BN_clear_free(tmp);
+ BN_free(order);
+ BN_clear_free(kinv);
return ret;
}
err:
BN_CTX_end(ctx);
BN_CTX_free(ctx);
- if (point)
- EC_POINT_free(point);
+ EC_POINT_free(point);
return ret;
}
-/* $OpenBSD: eng_rsax.c,v 1.9 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: eng_rsax.c,v 1.10 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (c) 2010-2010 Intel Corp.
* Author: Vinodh.Gopal@intel.com
* Jim Guilford
free(hptr);
RSA_set_ex_data(rsa, rsax_ex_data_idx, NULL);
}
- if (rsa->_method_mod_n)
- BN_MONT_CTX_free(rsa->_method_mod_n);
- if (rsa->_method_mod_p)
- BN_MONT_CTX_free(rsa->_method_mod_p);
- if (rsa->_method_mod_q)
- BN_MONT_CTX_free(rsa->_method_mod_q);
+ BN_MONT_CTX_free(rsa->_method_mod_n);
+ BN_MONT_CTX_free(rsa->_method_mod_p);
+ BN_MONT_CTX_free(rsa->_method_mod_q);
return 1;
}
-/* $OpenBSD: digest.c,v 1.21 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: digest.c,v 1.22 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
OPENSSL_cleanse(ctx->md_data, ctx->digest->ctx_size);
free(ctx->md_data);
}
- if (ctx->pctx)
- EVP_PKEY_CTX_free(ctx->pctx);
+ EVP_PKEY_CTX_free(ctx->pctx);
#ifndef OPENSSL_NO_ENGINE
if (ctx->engine)
/* The EVP_MD we used belongs to an ENGINE, release the
-/* $OpenBSD: evp_pkey.c,v 1.16 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: evp_pkey.c,v 1.17 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999.
*/
return pkey;
error:
- EVP_PKEY_free (pkey);
+ EVP_PKEY_free(pkey);
return NULL;
}
-/* $OpenBSD: pmeth_fn.c,v 1.4 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: pmeth_fn.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
return -1;
}
- if (ctx->peerkey)
- EVP_PKEY_free(ctx->peerkey);
+ EVP_PKEY_free(ctx->peerkey);
ctx->peerkey = peer;
ret = ctx->pmeth->ctrl(ctx, EVP_PKEY_CTRL_PEER_KEY, 1, peer);
-/* $OpenBSD: pmeth_gn.c,v 1.4 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: pmeth_gn.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
goto merr;
merr:
- if (mac_ctx)
- EVP_PKEY_CTX_free(mac_ctx);
+ EVP_PKEY_CTX_free(mac_ctx);
return mac_key;
}
-/* $OpenBSD: pmeth_lib.c,v 1.8 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: pmeth_lib.c,v 1.9 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
return;
if (ctx->pmeth && ctx->pmeth->cleanup)
ctx->pmeth->cleanup(ctx);
- if (ctx->pkey)
- EVP_PKEY_free(ctx->pkey);
- if (ctx->peerkey)
- EVP_PKEY_free(ctx->peerkey);
+ EVP_PKEY_free(ctx->pkey);
+ EVP_PKEY_free(ctx->peerkey);
#ifndef OPENSSL_NO_ENGINE
if (ctx->engine)
/* The EVP_PKEY_CTX we used belongs to an ENGINE, release the
-/* $OpenBSD: pem_pk8.c,v 1.7 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: pem_pk8.c,v 1.8 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
if (!ret)
return NULL;
if (x) {
- if (*x)
- EVP_PKEY_free(*x);
+ EVP_PKEY_free(*x);
*x = ret;
}
return ret;
-/* $OpenBSD: pem_pkey.c,v 1.17 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: pem_pkey.c,v 1.18 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
goto p8err;
ret = EVP_PKCS82PKEY(p8inf);
if (x) {
- if (*x)
- EVP_PKEY_free((EVP_PKEY *)*x);
+ EVP_PKEY_free(*x);
*x = ret;
}
PKCS8_PRIV_KEY_INFO_free(p8inf);
goto p8err;
ret = EVP_PKCS82PKEY(p8inf);
if (x) {
- if (*x)
- EVP_PKEY_free((EVP_PKEY *)*x);
+ EVP_PKEY_free(*x);
*x = ret;
}
PKCS8_PRIV_KEY_INFO_free(p8inf);
goto err;
}
if (x) {
- if (*x)
- EVP_PKEY_free((EVP_PKEY *)*x);
+ EVP_PKEY_free(*x);
*x = ret;
}
}
-/* $OpenBSD: pvkfmt.c,v 1.10 2014/07/11 15:35:53 miod Exp $ */
+/* $OpenBSD: pvkfmt.c,v 1.11 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2005.
*/
memerr:
PEMerr(PEM_F_B2I_DSS, ERR_R_MALLOC_FAILURE);
- if (dsa)
- DSA_free(dsa);
- if (ret)
- EVP_PKEY_free(ret);
- if (ctx)
- BN_CTX_free(ctx);
+ DSA_free(dsa);
+ EVP_PKEY_free(ret);
+ BN_CTX_free(ctx);
return NULL;
}
memerr:
PEMerr(PEM_F_B2I_RSA, ERR_R_MALLOC_FAILURE);
- if (rsa)
- RSA_free(rsa);
- if (ret)
- EVP_PKEY_free(ret);
+ RSA_free(rsa);
+ EVP_PKEY_free(ret);
return NULL;
}
-/* $OpenBSD: p12_key.c,v 1.20 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: p12_key.c,v 1.21 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999.
*/
PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI, ERR_R_MALLOC_FAILURE);
end:
- free (Ai);
- free (B);
- free (D);
- free (I);
- BN_free (Ij);
- BN_free (Bpl1);
+ free(Ai);
+ free(B);
+ free(D);
+ free(I);
+ BN_free(Ij);
+ BN_free(Bpl1);
EVP_MD_CTX_cleanup(&ctx);
return ret;
}
-/* $OpenBSD: pk7_doit.c,v 1.27 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: pk7_doit.c,v 1.28 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
ret = 1;
err:
- if (pkey)
- EVP_PKEY_free(pkey);
- if (pctx)
- EVP_PKEY_CTX_free(pctx);
+ EVP_PKEY_free(pkey);
+ EVP_PKEY_CTX_free(pctx);
free(ek);
return ret;
}
*peklen = eklen;
err:
- if (pctx)
- EVP_PKEY_CTX_free(pctx);
+ EVP_PKEY_CTX_free(pctx);
if (!ret && ek)
free(ek);
-/* $OpenBSD: pk7_lib.c,v 1.13 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: pk7_lib.c,v 1.14 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
return 1;
err:
- if (pkey)
- EVP_PKEY_free(pkey);
+ EVP_PKEY_free(pkey);
return 0;
}
-/* $OpenBSD: rsa.h,v 1.25 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: rsa.h,v 1.26 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
unsigned char *to, RSA *rsa, int padding);
int RSA_private_decrypt(int flen, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
-void RSA_free (RSA *r);
+void RSA_free(RSA *r);
/* "up" the RSA object's reference count */
int RSA_up_ref(RSA *r);
-/* $OpenBSD: rsa_saos.c,v 1.15 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: rsa_saos.c,v 1.16 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
} else
ret = 1;
err:
- if (sig != NULL)
- M_ASN1_OCTET_STRING_free(sig);
+ M_ASN1_OCTET_STRING_free(sig);
if (s != NULL) {
OPENSSL_cleanse(s, (unsigned int)siglen);
free(s);
-/* $OpenBSD: ts_rsp_sign.c,v 1.17 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: ts_rsp_sign.c,v 1.18 2014/07/12 16:03:37 miod Exp $ */
/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
* project 2002.
*/
int
TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key)
{
- if (ctx->signer_key)
- EVP_PKEY_free(ctx->signer_key);
+ EVP_PKEY_free(ctx->signer_key);
ctx->signer_key = key;
CRYPTO_add(&ctx->signer_key->references, +1, CRYPTO_LOCK_EVP_PKEY);
-/* $OpenBSD: x509_cmp.c,v 1.22 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: x509_cmp.c,v 1.23 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
X509err(X509_F_X509_CHECK_PRIVATE_KEY,
X509_R_UNKNOWN_KEY_TYPE);
}
- if (xk)
- EVP_PKEY_free(xk);
+ EVP_PKEY_free(xk);
if (ret > 0)
return 1;
return 0;
-/* $OpenBSD: a_object.c,v 1.21 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: a_object.c,v 1.22 2014/07/12 16:03:36 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
}
if (tmp != ftmp)
free(tmp);
- if (bl)
- BN_free(bl);
+ BN_free(bl);
return (len);
err:
if (tmp != ftmp)
free(tmp);
- if (bl)
- BN_free(bl);
+ BN_free(bl);
return (0);
}
-/* $OpenBSD: asn1_par.c,v 1.19 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: asn1_par.c,v 1.20 2014/07/12 16:03:36 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
nl = 1;
}
}
- if (os != NULL) {
- M_ASN1_OCTET_STRING_free(os);
- os = NULL;
- }
+ M_ASN1_OCTET_STRING_free(os);
+ os = NULL;
} else if (tag == V_ASN1_INTEGER) {
ASN1_INTEGER *bs;
int i;
end:
if (o != NULL)
ASN1_OBJECT_free(o);
- if (os != NULL)
- M_ASN1_OCTET_STRING_free(os);
+ M_ASN1_OCTET_STRING_free(os);
*pp = p;
return (ret);
}
-/* $OpenBSD: evp_asn1.c,v 1.12 2014/07/11 13:41:59 miod Exp $ */
+/* $OpenBSD: evp_asn1.c,v 1.13 2014/07/12 16:03:36 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
ASN1err(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,
ASN1_R_DATA_IS_WRONG);
}
- if (os != NULL)
- M_ASN1_OCTET_STRING_free(os);
- if (ai != NULL)
- M_ASN1_INTEGER_free(ai);
+ M_ASN1_OCTET_STRING_free(os);
+ M_ASN1_INTEGER_free(ai);
return (ret);
}
-/* $OpenBSD: x_pkey.c,v 1.14 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: x_pkey.c,v 1.15 2014/07/12 16:03:36 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
if (x->enc_algor != NULL)
X509_ALGOR_free(x->enc_algor);
- if (x->enc_pkey != NULL)
- M_ASN1_OCTET_STRING_free(x->enc_pkey);
- if (x->dec_pkey != NULL)
- EVP_PKEY_free(x->dec_pkey);
+ M_ASN1_OCTET_STRING_free(x->enc_pkey);
+ EVP_PKEY_free(x->dec_pkey);
if ((x->key_data != NULL) && (x->key_free))
free(x->key_data);
free(x);
-/* $OpenBSD: x_pubkey.c,v 1.21 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: x_pubkey.c,v 1.22 2014/07/12 16:03:36 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
return ret;
error:
- if (ret != NULL)
- EVP_PKEY_free(ret);
+ EVP_PKEY_free(ret);
return (NULL);
}
-/* $OpenBSD: bn_blind.c,v 1.13 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: bn_blind.c,v 1.14 2014/07/12 16:03:36 miod Exp $ */
/* ====================================================================
* Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
*
if (r == NULL)
return;
- if (r->A != NULL)
- BN_clear_free(r->A );
- if (r->Ai != NULL)
- BN_clear_free(r->Ai);
- if (r->e != NULL)
- BN_clear_free(r->e );
- if (r->mod != NULL)
- BN_clear_free(r->mod);
+ BN_clear_free(r->A);
+ BN_clear_free(r->Ai);
+ BN_clear_free(r->e);
+ BN_clear_free(r->mod);
free(r);
}
goto err;
if (e != NULL) {
- if (ret->e != NULL)
- BN_free(ret->e);
+ BN_free(ret->e);
ret->e = BN_dup(e);
}
if (ret->e == NULL)
-/* $OpenBSD: bn_lib.c,v 1.32 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: bn_lib.c,v 1.33 2014/07/12 16:03:36 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
i = ((n - 1) / BN_BYTES) + 1;
m = ((n - 1) % (BN_BYTES));
if (bn_wexpand(ret, (int)i) == NULL) {
- if (bn)
- BN_free(bn);
+ BN_free(bn);
return NULL;
}
ret->top = i;
-/* $OpenBSD: bn_mod.c,v 1.8 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: bn_mod.c,v 1.9 2014/07/12 16:03:36 miod Exp $ */
/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
* for the OpenSSL project. */
/* ====================================================================
ret = BN_mod_lshift_quick(r, r, n, (abs_m ? abs_m : m));
bn_check_top(r);
- if (abs_m)
- BN_free(abs_m);
+ BN_free(abs_m);
return ret;
}
-/* $OpenBSD: bn_prime.c,v 1.10 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: bn_prime.c,v 1.11 2014/07/12 16:03:36 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
if (ctx_passed == NULL)
BN_CTX_free(ctx);
}
- if (mont != NULL)
- BN_MONT_CTX_free(mont);
+ BN_MONT_CTX_free(mont);
return (ret);
}
-/* $OpenBSD: bn_print.c,v 1.22 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: bn_print.c,v 1.23 2014/07/12 16:03:36 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
err:
free(bn_data);
- if (t != NULL)
- BN_free(t);
+ BN_free(t);
if (!ok && buf) {
free(buf);
buf = NULL;
-/* $OpenBSD: cm_ameth.c,v 1.6 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: cm_ameth.c,v 1.7 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2010.
*/
{
CMAC_CTX *cmctx = (CMAC_CTX *)pkey->pkey.ptr;
- if (cmctx)
- CMAC_CTX_free(cmctx);
+ CMAC_CTX_free(cmctx);
}
const EVP_PKEY_ASN1_METHOD cmac_asn1_meth = {
-/* $OpenBSD: cms_asn1.c,v 1.4 2014/06/12 15:49:28 deraadt Exp $ */
+/* $OpenBSD: cms_asn1.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
{
if (operation == ASN1_OP_FREE_POST) {
CMS_SignerInfo *si = (CMS_SignerInfo *)*pval;
- if (si->pkey)
- EVP_PKEY_free(si->pkey);
+ EVP_PKEY_free(si->pkey);
if (si->signer)
X509_free(si->signer);
}
CMS_RecipientInfo *ri = (CMS_RecipientInfo *)*pval;
if (ri->type == CMS_RECIPINFO_TRANS) {
CMS_KeyTransRecipientInfo *ktri = ri->d.ktri;
- if (ktri->pkey)
- EVP_PKEY_free(ktri->pkey);
+ EVP_PKEY_free(ktri->pkey);
if (ktri->recip)
X509_free(ktri->recip);
} else if (ri->type == CMS_RECIPINFO_KEK) {
-/* $OpenBSD: cms_env.c,v 1.6 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: cms_env.c,v 1.7 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
ret = 1;
err:
- if (pctx)
- EVP_PKEY_CTX_free(pctx);
+ EVP_PKEY_CTX_free(pctx);
free(ek);
return ret;
}
ec->keylen = eklen;
err:
- if (pctx)
- EVP_PKEY_CTX_free(pctx);
+ EVP_PKEY_CTX_free(pctx);
if (!ret && ek)
free(ek);
-/* $OpenBSD: cms_sd.c,v 1.7 2014/07/11 13:02:10 miod Exp $ */
+/* $OpenBSD: cms_sd.c,v 1.8 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
{
if (signer) {
CRYPTO_add(&signer->references, 1, CRYPTO_LOCK_X509);
- if (si->pkey)
- EVP_PKEY_free(si->pkey);
+ EVP_PKEY_free(si->pkey);
si->pkey = X509_get_pubkey(signer);
}
if (si->signer)
-/* $OpenBSD: dh_ameth.c,v 1.11 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dh_ameth.c,v 1.12 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
err:
if (public_key)
ASN1_INTEGER_free(public_key);
- if (dh)
- DH_free(dh);
+ DH_free(dh);
return 0;
}
if ((a = BN_dup(from->pkey.dh->p)) == NULL)
return 0;
- if (to->pkey.dh->p != NULL)
- BN_free(to->pkey.dh->p);
+ BN_free(to->pkey.dh->p);
to->pkey.dh->p = a;
if ((a = BN_dup(from->pkey.dh->g)) == NULL)
return 0;
- if (to->pkey.dh->g != NULL)
- BN_free(to->pkey.dh->g);
+ BN_free(to->pkey.dh->g);
to->pkey.dh->g = a;
return 1;
-/* $OpenBSD: dh_check.c,v 1.13 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dh_check.c,v 1.14 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
}
ok = 1;
err:
- if (ctx != NULL)
- BN_CTX_free(ctx);
- if (q != NULL)
- BN_free(q);
+ BN_CTX_free(ctx);
+ BN_free(q);
return ok;
}
-/* $OpenBSD: dh_key.c,v 1.20 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dh_key.c,v 1.21 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
static int
dh_finish(DH *dh)
{
- if (dh->method_mont_p)
- BN_MONT_CTX_free(dh->method_mont_p);
+ BN_MONT_CTX_free(dh->method_mont_p);
return 1;
}
-/* $OpenBSD: dh_lib.c,v 1.19 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dh_lib.c,v 1.20 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, r, &r->ex_data);
- if (r->p != NULL)
- BN_clear_free(r->p);
- if (r->g != NULL)
- BN_clear_free(r->g);
- if (r->q != NULL)
- BN_clear_free(r->q);
- if (r->j != NULL)
- BN_clear_free(r->j);
+ BN_clear_free(r->p);
+ BN_clear_free(r->g);
+ BN_clear_free(r->q);
+ BN_clear_free(r->j);
free(r->seed);
- if (r->counter != NULL)
- BN_clear_free(r->counter);
- if (r->pub_key != NULL)
- BN_clear_free(r->pub_key);
- if (r->priv_key != NULL)
- BN_clear_free(r->priv_key);
+ BN_clear_free(r->counter);
+ BN_clear_free(r->pub_key);
+ BN_clear_free(r->priv_key);
free(r);
}
-/* $OpenBSD: dsa.h,v 1.17 2014/06/12 15:49:28 deraadt Exp $ */
+/* $OpenBSD: dsa.h,v 1.18 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
DSA * DSA_new(void);
DSA * DSA_new_method(ENGINE *engine);
-void DSA_free (DSA *r);
+void DSA_free(DSA *r);
/* "up" the DSA object's reference count */
int DSA_up_ref(DSA *r);
int DSA_size(const DSA *);
-/* $OpenBSD: dsa_ameth.c,v 1.12 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dsa_ameth.c,v 1.13 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
err:
if (public_key)
ASN1_INTEGER_free(public_key);
- if (dsa)
- DSA_free(dsa);
+ DSA_free(dsa);
return 0;
}
}
EVP_PKEY_assign_DSA(pkey, dsa);
- BN_CTX_free (ctx);
+ BN_CTX_free(ctx);
if (ndsa)
sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free);
else
decerr:
DSAerr(DSA_F_DSA_PRIV_DECODE, EVP_R_DECODE_ERROR);
dsaerr:
- BN_CTX_free (ctx);
+ BN_CTX_free(ctx);
if (privkey)
ASN1_INTEGER_free(privkey);
sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free);
if ((a = BN_dup(from->pkey.dsa->p)) == NULL)
return 0;
- if (to->pkey.dsa->p != NULL)
- BN_free(to->pkey.dsa->p);
+ BN_free(to->pkey.dsa->p);
to->pkey.dsa->p = a;
if ((a = BN_dup(from->pkey.dsa->q)) == NULL)
return 0;
- if (to->pkey.dsa->q != NULL)
- BN_free(to->pkey.dsa->q);
+ BN_free(to->pkey.dsa->q);
to->pkey.dsa->q = a;
if ((a = BN_dup(from->pkey.dsa->g)) == NULL)
return 0;
- if (to->pkey.dsa->g != NULL)
- BN_free(to->pkey.dsa->g);
+ BN_free(to->pkey.dsa->g);
to->pkey.dsa->g = a;
return 1;
}
-/* $OpenBSD: dsa_gen.c,v 1.15 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dsa_gen.c,v 1.16 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
ok = 1;
err:
if (ok) {
- if (ret->p)
- BN_free(ret->p);
- if (ret->q)
- BN_free(ret->q);
- if (ret->g)
- BN_free(ret->g);
+ BN_free(ret->p);
+ BN_free(ret->q);
+ BN_free(ret->g);
ret->p = BN_dup(p);
ret->q = BN_dup(q);
ret->g = BN_dup(g);
BN_CTX_end(ctx);
BN_CTX_free(ctx);
}
- if (mont != NULL)
- BN_MONT_CTX_free(mont);
+ BN_MONT_CTX_free(mont);
return ok;
}
#endif
-/* $OpenBSD: dsa_key.c,v 1.18 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dsa_key.c,v 1.19 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
BN_free(pub_key);
if (priv_key != NULL && dsa->priv_key == NULL)
BN_free(priv_key);
- if (ctx != NULL)
- BN_CTX_free(ctx);
+ BN_CTX_free(ctx);
return ok;
}
#endif
-/* $OpenBSD: dsa_lib.c,v 1.20 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dsa_lib.c,v 1.21 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DSA, r, &r->ex_data);
- if (r->p != NULL)
- BN_clear_free(r->p);
- if (r->q != NULL)
- BN_clear_free(r->q);
- if (r->g != NULL)
- BN_clear_free(r->g);
- if (r->pub_key != NULL)
- BN_clear_free(r->pub_key);
- if (r->priv_key != NULL)
- BN_clear_free(r->priv_key);
- if (r->kinv != NULL)
- BN_clear_free(r->kinv);
- if (r->r != NULL)
- BN_clear_free(r->r);
+ BN_clear_free(r->p);
+ BN_clear_free(r->q);
+ BN_clear_free(r->g);
+ BN_clear_free(r->pub_key);
+ BN_clear_free(r->priv_key);
+ BN_clear_free(r->kinv);
+ BN_clear_free(r->r);
free(r);
}
return ret;
err:
- if (ret != NULL)
- DH_free(ret);
+ DH_free(ret);
return NULL;
}
#endif
-/* $OpenBSD: dsa_ossl.c,v 1.20 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dsa_ossl.c,v 1.21 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
BN_free(r);
BN_free(s);
}
- if (ctx != NULL)
- BN_CTX_free(ctx);
+ BN_CTX_free(ctx);
BN_clear_free(&m);
BN_clear_free(&xr);
- if (kinv != NULL) /* dsa->kinv is NULL now if we used it */
- BN_clear_free(kinv);
+ BN_clear_free(kinv);
return ret;
}
if ((kinv = BN_mod_inverse(NULL, &k, dsa->q, ctx)) == NULL)
goto err;
- if (*kinvp != NULL)
- BN_clear_free(*kinvp);
+ BN_clear_free(*kinvp);
*kinvp = kinv;
kinv = NULL;
- if (*rp != NULL)
- BN_clear_free(*rp);
+ BN_clear_free(*rp);
*rp = r;
ret = 1;
err:
if (!ret) {
DSAerr(DSA_F_DSA_SIGN_SETUP, ERR_R_BN_LIB);
- if (r != NULL)
- BN_clear_free(r);
+ BN_clear_free(r);
}
if (ctx_in == NULL)
BN_CTX_free(ctx);
there is no error in BN. Test should be ret == -1 (Ben) */
if (ret != 1)
DSAerr(DSA_F_DSA_DO_VERIFY, ERR_R_BN_LIB);
- if (ctx != NULL)
- BN_CTX_free(ctx);
+ BN_CTX_free(ctx);
BN_free(&u1);
BN_free(&u2);
BN_free(&t1);
static int
dsa_finish(DSA *dsa)
{
- if (dsa->method_mont_p)
- BN_MONT_CTX_free(dsa->method_mont_p);
+ BN_MONT_CTX_free(dsa->method_mont_p);
return 1;
}
-/* $OpenBSD: dsa_sign.c,v 1.17 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: dsa_sign.c,v 1.18 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
DSA_SIG_free(DSA_SIG *sig)
{
if (sig) {
- if (sig->r)
- BN_free(sig->r);
- if (sig->s)
- BN_free(sig->s);
+ BN_free(sig->r);
+ BN_free(sig->s);
free(sig);
}
}
-/* $OpenBSD: ec2_mult.c,v 1.4 2014/07/10 22:45:56 jsing Exp $ */
+/* $OpenBSD: ec2_mult.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */
/* ====================================================================
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
ret = 1;
err:
- if (p)
- EC_POINT_free(p);
- if (acc)
- EC_POINT_free(acc);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ EC_POINT_free(p);
+ EC_POINT_free(acc);
+ BN_CTX_free(new_ctx);
return ret;
}
-/* $OpenBSD: ec2_oct.c,v 1.4 2014/07/10 22:45:56 jsing Exp $ */
+/* $OpenBSD: ec2_oct.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */
/* ====================================================================
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
}
if (used_ctx)
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
err:
if (used_ctx)
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return 0;
}
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
#endif
-/* $OpenBSD: ec2_smpl.c,v 1.11 2014/07/10 22:45:56 jsing Exp $ */
+/* $OpenBSD: ec2_smpl.c,v 1.12 2014/07/12 16:03:37 miod Exp $ */
/* ====================================================================
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
err:
if (ctx != NULL)
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
if (ctx)
BN_CTX_end(ctx);
- if (new_ctx)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
if (ctx)
BN_CTX_end(ctx);
- if (new_ctx)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
if (ctx)
BN_CTX_end(ctx);
- if (new_ctx)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
-/* $OpenBSD: ec_ameth.c,v 1.11 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: ec_ameth.c,v 1.12 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
err:
if (!ret)
ECerr(EC_F_DO_EC_KEY_PRINT, reason);
- if (pub_key)
- BN_free(pub_key);
- if (order)
- BN_free(order);
- if (ctx)
- BN_CTX_free(ctx);
+ BN_free(pub_key);
+ BN_free(order);
+ BN_CTX_free(ctx);
free(buffer);
return (ret);
}
-/* $OpenBSD: ec_asn1.c,v 1.9 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: ec_asn1.c,v 1.10 2014/07/12 16:03:37 miod Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
ok = 1;
-err: if (tmp)
- BN_free(tmp);
+err:
+ BN_free(tmp);
return (ok);
}
ok = 1;
-err: free(buffer_1);
+err:
+ free(buffer_1);
free(buffer_2);
- if (tmp_1)
- BN_free(tmp_1);
- if (tmp_2)
- BN_free(tmp_2);
+ BN_free(tmp_1);
+ BN_free(tmp_2);
return (ok);
}
ECPARAMETERS_free(ret);
ret = NULL;
}
- if (tmp)
- BN_free(tmp);
+ BN_free(tmp);
free(buffer);
return (ret);
}
}
/* extract the cofactor (optional) */
if (params->cofactor == NULL) {
- if (b) {
- BN_free(b);
- b = NULL;
- }
+ BN_free(b);
+ b = NULL;
} else if ((b = ASN1_INTEGER_to_BN(params->cofactor, b)) == NULL) {
ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_ASN1_LIB);
goto err;
ok = 1;
err: if (!ok) {
- if (ret)
- EC_GROUP_clear_free(ret);
+ EC_GROUP_clear_free(ret);
ret = NULL;
}
- if (p)
- BN_free(p);
- if (a)
- BN_free(a);
- if (b)
- BN_free(b);
- if (point)
- EC_POINT_free(point);
+ BN_free(p);
+ BN_free(a);
+ BN_free(b);
+ EC_POINT_free(point);
return (ret);
}
ret = *a;
if (priv_key->parameters) {
- if (ret->group)
- EC_GROUP_clear_free(ret->group);
+ EC_GROUP_clear_free(ret->group);
ret->group = ec_asn1_pkparameters2group(priv_key->parameters);
}
if (ret->group == NULL) {
const unsigned char *pub_oct;
size_t pub_oct_len;
- if (ret->pub_key)
- EC_POINT_clear_free(ret->pub_key);
+ EC_POINT_clear_free(ret->pub_key);
ret->pub_key = EC_POINT_new(ret->group);
if (ret->pub_key == NULL) {
ECerr(EC_F_D2I_ECPRIVATEKEY, ERR_R_EC_LIB);
-/* $OpenBSD: ec_check.c,v 1.3 2014/06/12 15:49:29 deraadt Exp $ */
+/* $OpenBSD: ec_check.c,v 1.4 2014/07/12 16:03:37 miod Exp $ */
/* ====================================================================
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
*
err:
if (ctx != NULL)
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
- if (point)
- EC_POINT_free(point);
+ BN_CTX_free(new_ctx);
+ EC_POINT_free(point);
return ret;
}
-/* $OpenBSD: ec_curve.c,v 1.6 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: ec_curve.c,v 1.7 2014/07/12 16:03:37 miod Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
EC_GROUP_free(group);
group = NULL;
}
- if (P)
- EC_POINT_free(P);
- if (ctx)
- BN_CTX_free(ctx);
- if (p)
- BN_free(p);
- if (a)
- BN_free(a);
- if (b)
- BN_free(b);
- if (order)
- BN_free(order);
- if (x)
- BN_free(x);
- if (y)
- BN_free(y);
+ EC_POINT_free(P);
+ BN_CTX_free(ctx);
+ BN_free(p);
+ BN_free(a);
+ BN_free(b);
+ BN_free(order);
+ BN_free(x);
+ BN_free(y);
return group;
}
-/* $OpenBSD: ec_key.c,v 1.8 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: ec_key.c,v 1.9 2014/07/12 16:03:37 miod Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
if (i > 0)
return;
- if (r->group != NULL)
- EC_GROUP_free(r->group);
- if (r->pub_key != NULL)
- EC_POINT_free(r->pub_key);
- if (r->priv_key != NULL)
- BN_clear_free(r->priv_key);
+ EC_GROUP_free(r->group);
+ EC_POINT_free(r->pub_key);
+ BN_clear_free(r->priv_key);
EC_EX_DATA_free_all_data(&r->method_data);
if (src->group) {
const EC_METHOD *meth = EC_GROUP_method_of(src->group);
/* clear the old group */
- if (dest->group)
- EC_GROUP_free(dest->group);
+ EC_GROUP_free(dest->group);
dest->group = EC_GROUP_new(meth);
if (dest->group == NULL)
return NULL;
}
/* copy the public key */
if (src->pub_key && src->group) {
- if (dest->pub_key)
- EC_POINT_free(dest->pub_key);
+ EC_POINT_free(dest->pub_key);
dest->pub_key = EC_POINT_new(src->group);
if (dest->pub_key == NULL)
return NULL;
ok = 1;
err:
- if (order)
- BN_free(order);
+ BN_free(order);
if (pub_key != NULL && eckey->pub_key == NULL)
EC_POINT_free(pub_key);
if (priv_key != NULL && eckey->priv_key == NULL)
BN_free(priv_key);
- if (ctx != NULL)
- BN_CTX_free(ctx);
+ BN_CTX_free(ctx);
return (ok);
}
}
ok = 1;
err:
- if (ctx != NULL)
- BN_CTX_free(ctx);
- if (point != NULL)
- EC_POINT_free(point);
+ BN_CTX_free(ctx);
+ EC_POINT_free(point);
return (ok);
}
ok = 1;
err:
- if (ctx)
- BN_CTX_free(ctx);
- if (point)
- EC_POINT_free(point);
+ BN_CTX_free(ctx);
+ EC_POINT_free(point);
return ok;
}
int
EC_KEY_set_group(EC_KEY * key, const EC_GROUP * group)
{
- if (key->group != NULL)
- EC_GROUP_free(key->group);
+ EC_GROUP_free(key->group);
key->group = EC_GROUP_dup(group);
return (key->group == NULL) ? 0 : 1;
}
int
EC_KEY_set_private_key(EC_KEY * key, const BIGNUM * priv_key)
{
- if (key->priv_key)
- BN_clear_free(key->priv_key);
+ BN_clear_free(key->priv_key);
key->priv_key = BN_dup(priv_key);
return (key->priv_key == NULL) ? 0 : 1;
}
int
EC_KEY_set_public_key(EC_KEY * key, const EC_POINT * pub_key)
{
- if (key->pub_key != NULL)
- EC_POINT_free(key->pub_key);
+ EC_POINT_free(key->pub_key);
key->pub_key = EC_POINT_dup(pub_key, key->group);
return (key->pub_key == NULL) ? 0 : 1;
}
-/* $OpenBSD: ec_lib.c,v 1.14 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: ec_lib.c,v 1.15 2014/07/12 16:03:37 miod Exp $ */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
EC_EX_DATA_free_all_data(&group->extra_data);
- if (group->generator != NULL)
- EC_POINT_free(group->generator);
+ EC_POINT_free(group->generator);
BN_free(&group->order);
BN_free(&group->cofactor);
EC_EX_DATA_clear_free_all_data(&group->extra_data);
- if (group->generator != NULL)
- EC_POINT_clear_free(group->generator);
+ EC_POINT_clear_free(group->generator);
BN_clear_free(&group->order);
BN_clear_free(&group->cofactor);
return 0;
} else {
/* src->generator == NULL */
- if (dest->generator != NULL) {
- EC_POINT_clear_free(dest->generator);
- dest->generator = NULL;
- }
+ EC_POINT_clear_free(dest->generator);
+ dest->generator = NULL;
}
if (!BN_copy(&dest->order, &src->order))
err:
if (!ok) {
- if (t)
- EC_GROUP_free(t);
+ EC_GROUP_free(t);
return NULL;
} else
return t;
-/* $OpenBSD: ec_mult.c,v 1.13 2014/06/12 15:49:29 deraadt Exp $ */
+/* $OpenBSD: ec_mult.c,v 1.14 2014/07/12 16:03:37 miod Exp $ */
/*
* Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project.
*/
ret = 1;
err:
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
- if (tmp != NULL)
- EC_POINT_free(tmp);
+ BN_CTX_free(new_ctx);
+ EC_POINT_free(tmp);
free(wsize);
free(wNAF_len);
if (wNAF != NULL) {
err:
if (ctx != NULL)
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
- if (pre_comp)
- ec_pre_comp_free(pre_comp);
+ BN_CTX_free(new_ctx);
+ ec_pre_comp_free(pre_comp);
if (points) {
EC_POINT **p;
EC_POINT_free(*p);
free(points);
}
- if (tmp_point)
- EC_POINT_free(tmp_point);
- if (base)
- EC_POINT_free(base);
+ EC_POINT_free(tmp_point);
+ EC_POINT_free(base);
return ret;
}
-/* $OpenBSD: ec_pmeth.c,v 1.7 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: ec_pmeth.c,v 1.8 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
{
EC_PKEY_CTX *dctx = ctx->data;
if (dctx) {
- if (dctx->gen_group)
- EC_GROUP_free(dctx->gen_group);
+ EC_GROUP_free(dctx->gen_group);
free(dctx);
}
}
ECerr(EC_F_PKEY_EC_CTRL, EC_R_INVALID_CURVE);
return 0;
}
- if (dctx->gen_group)
- EC_GROUP_free(dctx->gen_group);
+ EC_GROUP_free(dctx->gen_group);
dctx->gen_group = group;
return 1;
-/* $OpenBSD: eck_prn.c,v 1.9 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: eck_prn.c,v 1.10 2014/07/12 16:03:37 miod Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
err:
if (!ret)
ECerr(EC_F_ECPKPARAMETERS_PRINT, reason);
- if (p)
- BN_free(p);
- if (a)
- BN_free(a);
- if (b)
- BN_free(b);
- if (gen)
- BN_free(gen);
- if (order)
- BN_free(order);
- if (cofactor)
- BN_free(cofactor);
- if (ctx)
- BN_CTX_free(ctx);
+ BN_free(p);
+ BN_free(a);
+ BN_free(b);
+ BN_free(gen);
+ BN_free(order);
+ BN_free(cofactor);
+ BN_CTX_free(ctx);
free(buffer);
return (ret);
}
-/* $OpenBSD: ecp_mont.c,v 1.8 2014/06/12 15:49:29 deraadt Exp $ */
+/* $OpenBSD: ecp_mont.c,v 1.9 2014/07/12 16:03:37 miod Exp $ */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
void
ec_GFp_mont_group_finish(EC_GROUP * group)
{
- if (group->field_data1 != NULL) {
- BN_MONT_CTX_free(group->field_data1);
- group->field_data1 = NULL;
- }
- if (group->field_data2 != NULL) {
- BN_free(group->field_data2);
- group->field_data2 = NULL;
- }
+ BN_MONT_CTX_free(group->field_data1);
+ group->field_data1 = NULL;
+ BN_free(group->field_data2);
+ group->field_data2 = NULL;
ec_GFp_simple_group_finish(group);
}
void
ec_GFp_mont_group_clear_finish(EC_GROUP * group)
{
- if (group->field_data1 != NULL) {
- BN_MONT_CTX_free(group->field_data1);
- group->field_data1 = NULL;
- }
- if (group->field_data2 != NULL) {
- BN_clear_free(group->field_data2);
- group->field_data2 = NULL;
- }
+ BN_MONT_CTX_free(group->field_data1);
+ group->field_data1 = NULL;
+ BN_clear_free(group->field_data2);
+ group->field_data2 = NULL;
ec_GFp_simple_group_clear_finish(group);
}
int
ec_GFp_mont_group_copy(EC_GROUP * dest, const EC_GROUP * src)
{
- if (dest->field_data1 != NULL) {
- BN_MONT_CTX_free(dest->field_data1);
- dest->field_data1 = NULL;
- }
- if (dest->field_data2 != NULL) {
- BN_clear_free(dest->field_data2);
- dest->field_data2 = NULL;
- }
+ BN_MONT_CTX_free(dest->field_data1);
+ dest->field_data1 = NULL;
+ BN_clear_free(dest->field_data2);
+ dest->field_data2 = NULL;
+
if (!ec_GFp_simple_group_copy(dest, src))
return 0;
BIGNUM *one = NULL;
int ret = 0;
- if (group->field_data1 != NULL) {
- BN_MONT_CTX_free(group->field_data1);
- group->field_data1 = NULL;
- }
- if (group->field_data2 != NULL) {
- BN_free(group->field_data2);
- group->field_data2 = NULL;
- }
+ BN_MONT_CTX_free(group->field_data1);
+ group->field_data1 = NULL;
+ BN_free(group->field_data2);
+ group->field_data2 = NULL;
if (ctx == NULL) {
ctx = new_ctx = BN_CTX_new();
if (ctx == NULL)
group->field_data2 = NULL;
}
err:
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
- if (mont != NULL)
- BN_MONT_CTX_free(mont);
+ BN_CTX_free(new_ctx);
+ BN_MONT_CTX_free(mont);
return ret;
}
-/* $OpenBSD: ecp_nist.c,v 1.8 2014/06/12 15:49:29 deraadt Exp $ */
+/* $OpenBSD: ecp_nist.c,v 1.9 2014/07/12 16:03:37 miod Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
ret = 1;
err:
- if (ctx_new)
- BN_CTX_free(ctx_new);
+ BN_CTX_free(ctx_new);
return ret;
}
ret = 1;
err:
- if (ctx_new)
- BN_CTX_free(ctx_new);
+ BN_CTX_free(ctx_new);
return ret;
}
-/* $OpenBSD: ecp_nistp224.c,v 1.14 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: ecp_nistp224.c,v 1.15 2014/07/12 16:03:37 miod Exp $ */
/*
* Written by Emilia Kasper (Google) for the OpenSSL project.
*/
ret = ec_GFp_simple_group_set_curve(group, p, a, b, ctx);
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
BN_CTX_end(ctx);
- if (generator != NULL)
- EC_POINT_free(generator);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ EC_POINT_free(generator);
+ BN_CTX_free(new_ctx);
free(secrets);
free(pre_comp);
free(tmp_felems);
pre = NULL;
err:
BN_CTX_end(ctx);
- if (generator != NULL)
- EC_POINT_free(generator);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
- if (pre)
- nistp224_pre_comp_free(pre);
+ EC_POINT_free(generator);
+ BN_CTX_free(new_ctx);
+ nistp224_pre_comp_free(pre);
return ret;
}
-/* $OpenBSD: ecp_nistp256.c,v 1.13 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: ecp_nistp256.c,v 1.14 2014/07/12 16:03:37 miod Exp $ */
/*
* Written by Adam Langley (Google) for the OpenSSL project
*/
ret = ec_GFp_simple_group_set_curve(group, p, a, b, ctx);
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
BN_CTX_end(ctx);
- if (generator != NULL)
- EC_POINT_free(generator);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ EC_POINT_free(generator);
+ BN_CTX_free(new_ctx);
free(secrets);
free(pre_comp);
free(tmp_smallfelems);
pre = NULL;
err:
BN_CTX_end(ctx);
- if (generator != NULL)
- EC_POINT_free(generator);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
- if (pre)
- nistp256_pre_comp_free(pre);
+ EC_POINT_free(generator);
+ BN_CTX_free(new_ctx);
+ nistp256_pre_comp_free(pre);
return ret;
}
-/* $OpenBSD: ecp_nistp521.c,v 1.14 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: ecp_nistp521.c,v 1.15 2014/07/12 16:03:37 miod Exp $ */
/*
* Written by Adam Langley (Google) for the OpenSSL project
*/
ret = ec_GFp_simple_group_set_curve(group, p, a, b, ctx);
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
BN_CTX_end(ctx);
- if (generator != NULL)
- EC_POINT_free(generator);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ EC_POINT_free(generator);
+ BN_CTX_free(new_ctx);
free(secrets);
free(pre_comp);
free(tmp_felems);
pre = NULL;
err:
BN_CTX_end(ctx);
- if (generator != NULL)
- EC_POINT_free(generator);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
- if (pre)
- nistp521_pre_comp_free(pre);
+ EC_POINT_free(generator);
+ BN_CTX_free(new_ctx);
+ nistp521_pre_comp_free(pre);
return ret;
}
-/* $OpenBSD: ecp_oct.c,v 1.4 2014/06/12 15:49:29 deraadt Exp $ */
+/* $OpenBSD: ecp_oct.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */
/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
* for the OpenSSL project.
* Includes code written by Bodo Moeller for the OpenSSL project.
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
}
if (used_ctx)
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
err:
if (used_ctx)
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return 0;
}
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
-/* $OpenBSD: ecp_smpl.c,v 1.12 2014/06/12 15:49:29 deraadt Exp $ */
+/* $OpenBSD: ecp_smpl.c,v 1.13 2014/07/12 16:03:37 miod Exp $ */
/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
* for the OpenSSL project.
* Includes code written by Bodo Moeller for the OpenSSL project.
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
ret = 1;
err:
- if (new_ctx)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
if (ctx != NULL)
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
ret = 1;
err:
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
ret = 1;
err:
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
end:
if (ctx) /* otherwise we already called BN_CTX_end */
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
end:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
if (heap != NULL) {
/*
* heap[pow2/2] .. heap[pow2-1] have not been allocated
* locally!
*/
for (i = pow2 / 2 - 1; i > 0; i--) {
- if (heap[i] != NULL)
- BN_clear_free(heap[i]);
+ BN_clear_free(heap[i]);
}
free(heap);
}
-/* $OpenBSD: ech_ossl.c,v 1.7 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: ech_ossl.c,v 1.8 2014/07/12 16:03:37 miod Exp $ */
/* ====================================================================
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
}
err:
- if (tmp) EC_POINT_free(tmp);
- if (ctx) BN_CTX_end(ctx);
- if (ctx) BN_CTX_free(ctx);
+ EC_POINT_free(tmp);
+ if (ctx)
+ BN_CTX_end(ctx);
+ BN_CTX_free(ctx);
free(buf);
return(ret);
}
-/* $OpenBSD: ecs_ossl.c,v 1.4 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: ecs_ossl.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project
*/
goto err;
}
/* clear old values if necessary */
- if (*rp != NULL)
- BN_clear_free(*rp);
- if (*kinvp != NULL)
- BN_clear_free(*kinvp);
+ BN_clear_free(*rp);
+ BN_clear_free(*kinvp);
/* save the pre-computed values */
*rp = r;
*kinvp = k;
ret = 1;
err:
- if (!ret)
- {
- if (k != NULL) BN_clear_free(k);
- if (r != NULL) BN_clear_free(r);
+ if (!ret) {
+ BN_clear_free(k);
+ BN_clear_free(r);
}
if (ctx_in == NULL)
BN_CTX_free(ctx);
- if (order != NULL)
- BN_free(order);
- if (tmp_point != NULL)
- EC_POINT_free(tmp_point);
- if (X)
- BN_clear_free(X);
+ BN_free(order);
+ EC_POINT_free(tmp_point);
+ BN_clear_free(X);
return(ret);
}
ECDSA_SIG_free(ret);
ret = NULL;
}
- if (ctx)
- BN_CTX_free(ctx);
- if (m)
- BN_clear_free(m);
- if (tmp)
- BN_clear_free(tmp);
- if (order)
- BN_free(order);
- if (kinv)
- BN_clear_free(kinv);
+ BN_CTX_free(ctx);
+ BN_clear_free(m);
+ BN_clear_free(tmp);
+ BN_free(order);
+ BN_clear_free(kinv);
return ret;
}
err:
BN_CTX_end(ctx);
BN_CTX_free(ctx);
- if (point)
- EC_POINT_free(point);
+ EC_POINT_free(point);
return ret;
}
-/* $OpenBSD: eng_rsax.c,v 1.9 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: eng_rsax.c,v 1.10 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (c) 2010-2010 Intel Corp.
* Author: Vinodh.Gopal@intel.com
* Jim Guilford
free(hptr);
RSA_set_ex_data(rsa, rsax_ex_data_idx, NULL);
}
- if (rsa->_method_mod_n)
- BN_MONT_CTX_free(rsa->_method_mod_n);
- if (rsa->_method_mod_p)
- BN_MONT_CTX_free(rsa->_method_mod_p);
- if (rsa->_method_mod_q)
- BN_MONT_CTX_free(rsa->_method_mod_q);
+ BN_MONT_CTX_free(rsa->_method_mod_n);
+ BN_MONT_CTX_free(rsa->_method_mod_p);
+ BN_MONT_CTX_free(rsa->_method_mod_q);
return 1;
}
-/* $OpenBSD: digest.c,v 1.21 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: digest.c,v 1.22 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
OPENSSL_cleanse(ctx->md_data, ctx->digest->ctx_size);
free(ctx->md_data);
}
- if (ctx->pctx)
- EVP_PKEY_CTX_free(ctx->pctx);
+ EVP_PKEY_CTX_free(ctx->pctx);
#ifndef OPENSSL_NO_ENGINE
if (ctx->engine)
/* The EVP_MD we used belongs to an ENGINE, release the
-/* $OpenBSD: evp_pkey.c,v 1.16 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: evp_pkey.c,v 1.17 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999.
*/
return pkey;
error:
- EVP_PKEY_free (pkey);
+ EVP_PKEY_free(pkey);
return NULL;
}
-/* $OpenBSD: pmeth_fn.c,v 1.4 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: pmeth_fn.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
return -1;
}
- if (ctx->peerkey)
- EVP_PKEY_free(ctx->peerkey);
+ EVP_PKEY_free(ctx->peerkey);
ctx->peerkey = peer;
ret = ctx->pmeth->ctrl(ctx, EVP_PKEY_CTRL_PEER_KEY, 1, peer);
-/* $OpenBSD: pmeth_gn.c,v 1.4 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: pmeth_gn.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
goto merr;
merr:
- if (mac_ctx)
- EVP_PKEY_CTX_free(mac_ctx);
+ EVP_PKEY_CTX_free(mac_ctx);
return mac_key;
}
-/* $OpenBSD: pmeth_lib.c,v 1.8 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: pmeth_lib.c,v 1.9 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
return;
if (ctx->pmeth && ctx->pmeth->cleanup)
ctx->pmeth->cleanup(ctx);
- if (ctx->pkey)
- EVP_PKEY_free(ctx->pkey);
- if (ctx->peerkey)
- EVP_PKEY_free(ctx->peerkey);
+ EVP_PKEY_free(ctx->pkey);
+ EVP_PKEY_free(ctx->peerkey);
#ifndef OPENSSL_NO_ENGINE
if (ctx->engine)
/* The EVP_PKEY_CTX we used belongs to an ENGINE, release the
-/* $OpenBSD: pem_pk8.c,v 1.7 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: pem_pk8.c,v 1.8 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
if (!ret)
return NULL;
if (x) {
- if (*x)
- EVP_PKEY_free(*x);
+ EVP_PKEY_free(*x);
*x = ret;
}
return ret;
-/* $OpenBSD: pem_pkey.c,v 1.17 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: pem_pkey.c,v 1.18 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
goto p8err;
ret = EVP_PKCS82PKEY(p8inf);
if (x) {
- if (*x)
- EVP_PKEY_free((EVP_PKEY *)*x);
+ EVP_PKEY_free(*x);
*x = ret;
}
PKCS8_PRIV_KEY_INFO_free(p8inf);
goto p8err;
ret = EVP_PKCS82PKEY(p8inf);
if (x) {
- if (*x)
- EVP_PKEY_free((EVP_PKEY *)*x);
+ EVP_PKEY_free(*x);
*x = ret;
}
PKCS8_PRIV_KEY_INFO_free(p8inf);
goto err;
}
if (x) {
- if (*x)
- EVP_PKEY_free((EVP_PKEY *)*x);
+ EVP_PKEY_free(*x);
*x = ret;
}
}
-/* $OpenBSD: pvkfmt.c,v 1.10 2014/07/11 15:35:53 miod Exp $ */
+/* $OpenBSD: pvkfmt.c,v 1.11 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2005.
*/
memerr:
PEMerr(PEM_F_B2I_DSS, ERR_R_MALLOC_FAILURE);
- if (dsa)
- DSA_free(dsa);
- if (ret)
- EVP_PKEY_free(ret);
- if (ctx)
- BN_CTX_free(ctx);
+ DSA_free(dsa);
+ EVP_PKEY_free(ret);
+ BN_CTX_free(ctx);
return NULL;
}
memerr:
PEMerr(PEM_F_B2I_RSA, ERR_R_MALLOC_FAILURE);
- if (rsa)
- RSA_free(rsa);
- if (ret)
- EVP_PKEY_free(ret);
+ RSA_free(rsa);
+ EVP_PKEY_free(ret);
return NULL;
}
-/* $OpenBSD: p12_key.c,v 1.20 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: p12_key.c,v 1.21 2014/07/12 16:03:37 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999.
*/
PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI, ERR_R_MALLOC_FAILURE);
end:
- free (Ai);
- free (B);
- free (D);
- free (I);
- BN_free (Ij);
- BN_free (Bpl1);
+ free(Ai);
+ free(B);
+ free(D);
+ free(I);
+ BN_free(Ij);
+ BN_free(Bpl1);
EVP_MD_CTX_cleanup(&ctx);
return ret;
}
-/* $OpenBSD: pk7_doit.c,v 1.27 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: pk7_doit.c,v 1.28 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
ret = 1;
err:
- if (pkey)
- EVP_PKEY_free(pkey);
- if (pctx)
- EVP_PKEY_CTX_free(pctx);
+ EVP_PKEY_free(pkey);
+ EVP_PKEY_CTX_free(pctx);
free(ek);
return ret;
}
*peklen = eklen;
err:
- if (pctx)
- EVP_PKEY_CTX_free(pctx);
+ EVP_PKEY_CTX_free(pctx);
if (!ret && ek)
free(ek);
-/* $OpenBSD: pk7_lib.c,v 1.13 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: pk7_lib.c,v 1.14 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
return 1;
err:
- if (pkey)
- EVP_PKEY_free(pkey);
+ EVP_PKEY_free(pkey);
return 0;
}
-/* $OpenBSD: rsa.h,v 1.25 2014/07/10 22:45:57 jsing Exp $ */
+/* $OpenBSD: rsa.h,v 1.26 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
unsigned char *to, RSA *rsa, int padding);
int RSA_private_decrypt(int flen, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
-void RSA_free (RSA *r);
+void RSA_free(RSA *r);
/* "up" the RSA object's reference count */
int RSA_up_ref(RSA *r);
-/* $OpenBSD: rsa_saos.c,v 1.15 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: rsa_saos.c,v 1.16 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
} else
ret = 1;
err:
- if (sig != NULL)
- M_ASN1_OCTET_STRING_free(sig);
+ M_ASN1_OCTET_STRING_free(sig);
if (s != NULL) {
OPENSSL_cleanse(s, (unsigned int)siglen);
free(s);
-/* $OpenBSD: ts_rsp_sign.c,v 1.17 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: ts_rsp_sign.c,v 1.18 2014/07/12 16:03:37 miod Exp $ */
/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
* project 2002.
*/
int
TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key)
{
- if (ctx->signer_key)
- EVP_PKEY_free(ctx->signer_key);
+ EVP_PKEY_free(ctx->signer_key);
ctx->signer_key = key;
CRYPTO_add(&ctx->signer_key->references, +1, CRYPTO_LOCK_EVP_PKEY);
-/* $OpenBSD: x509_cmp.c,v 1.22 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: x509_cmp.c,v 1.23 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
X509err(X509_F_X509_CHECK_PRIVATE_KEY,
X509_R_UNKNOWN_KEY_TYPE);
}
- if (xk)
- EVP_PKEY_free(xk);
+ EVP_PKEY_free(xk);
if (ret > 0)
return 1;
return 0;
-/* $OpenBSD: ssl_lib.c,v 1.75 2014/07/12 13:11:53 jsing Exp $ */
+/* $OpenBSD: ssl_lib.c,v 1.76 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
if (s != NULL) {
if (s->cert != NULL)
ssl_cert_free(s->cert);
- if (s->ctx != NULL)
- SSL_CTX_free(s->ctx); /* decrement reference count */
+ SSL_CTX_free(s->ctx); /* decrement reference count */
free(s);
}
SSLerr(SSL_F_SSL_NEW,
/* Free up if allocated */
free(s->tlsext_hostname);
- if (s->initial_ctx)
- SSL_CTX_free(s->initial_ctx);
+ SSL_CTX_free(s->initial_ctx);
free(s->tlsext_ecpointformatlist);
free(s->tlsext_ellipticcurvelist);
if (s->tlsext_ocsp_exts)
if (s->method != NULL)
s->method->ssl_free(s);
- if (s->ctx)
- SSL_CTX_free(s->ctx);
+ SSL_CTX_free(s->ctx);
#ifndef OPENSSL_NO_NEXTPROTONEG
SSLerr(SSL_F_SSL_CTX_NEW,
ERR_R_MALLOC_FAILURE);
err2:
- if (ret != NULL)
- SSL_CTX_free(ret);
+ SSL_CTX_free(ret);
return (NULL);
}
ssl_cert_free(ssl->cert);
ssl->cert = ssl_cert_dup(ctx->cert);
CRYPTO_add(&ctx->references, 1, CRYPTO_LOCK_SSL_CTX);
- if (ssl->ctx != NULL)
- SSL_CTX_free(ssl->ctx); /* decrement reference count */
+ SSL_CTX_free(ssl->ctx); /* decrement reference count */
ssl->ctx = ctx;
return (ssl->ctx);
}
-/* $OpenBSD: ssl_rsa.c,v 1.15 2014/06/22 19:09:37 guenther Exp $ */
+/* $OpenBSD: ssl_rsa.c,v 1.16 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
}
}
- if (c->pkeys[i].privatekey != NULL)
- EVP_PKEY_free(c->pkeys[i].privatekey);
+ EVP_PKEY_free(c->pkeys[i].privatekey);
CRYPTO_add(&pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
c->pkeys[i].privatekey = pkey;
c->key = &(c->pkeys[i]);
-/* $OpenBSD: ssl_lib.c,v 1.75 2014/07/12 13:11:53 jsing Exp $ */
+/* $OpenBSD: ssl_lib.c,v 1.76 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
if (s != NULL) {
if (s->cert != NULL)
ssl_cert_free(s->cert);
- if (s->ctx != NULL)
- SSL_CTX_free(s->ctx); /* decrement reference count */
+ SSL_CTX_free(s->ctx); /* decrement reference count */
free(s);
}
SSLerr(SSL_F_SSL_NEW,
/* Free up if allocated */
free(s->tlsext_hostname);
- if (s->initial_ctx)
- SSL_CTX_free(s->initial_ctx);
+ SSL_CTX_free(s->initial_ctx);
free(s->tlsext_ecpointformatlist);
free(s->tlsext_ellipticcurvelist);
if (s->tlsext_ocsp_exts)
if (s->method != NULL)
s->method->ssl_free(s);
- if (s->ctx)
- SSL_CTX_free(s->ctx);
+ SSL_CTX_free(s->ctx);
#ifndef OPENSSL_NO_NEXTPROTONEG
SSLerr(SSL_F_SSL_CTX_NEW,
ERR_R_MALLOC_FAILURE);
err2:
- if (ret != NULL)
- SSL_CTX_free(ret);
+ SSL_CTX_free(ret);
return (NULL);
}
ssl_cert_free(ssl->cert);
ssl->cert = ssl_cert_dup(ctx->cert);
CRYPTO_add(&ctx->references, 1, CRYPTO_LOCK_SSL_CTX);
- if (ssl->ctx != NULL)
- SSL_CTX_free(ssl->ctx); /* decrement reference count */
+ SSL_CTX_free(ssl->ctx); /* decrement reference count */
ssl->ctx = ctx;
return (ssl->ctx);
}
-/* $OpenBSD: ssl_rsa.c,v 1.15 2014/06/22 19:09:37 guenther Exp $ */
+/* $OpenBSD: ssl_rsa.c,v 1.16 2014/07/12 16:03:37 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
}
}
- if (c->pkeys[i].privatekey != NULL)
- EVP_PKEY_free(c->pkeys[i].privatekey);
+ EVP_PKEY_free(c->pkeys[i].privatekey);
CRYPTO_add(&pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
c->pkeys[i].privatekey = pkey;
c->key = &(c->pkeys[i]);