summaryrefslogtreecommitdiffstats
path: root/crypto/dsa
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-10-30 11:12:26 +0000
committerMatt Caswell <matt@openssl.org>2015-11-09 22:48:41 +0000
commit90945fa31a42dcf3beb90540c618e4d627c595ea (patch)
treee73870c253abf0c37ca618384e30a7937a996b55 /crypto/dsa
parenta71edf3ba275b946224b5bcded0a8ecfce1855c0 (diff)
Continue standardising malloc style for libcrypto
Continuing from previous commit ensure our style is consistent for malloc return checks. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Diffstat (limited to 'crypto/dsa')
-rw-r--r--crypto/dsa/dsa_ameth.c4
-rw-r--r--crypto/dsa/dsa_asn1.c4
-rw-r--r--crypto/dsa/dsa_depr.c2
-rw-r--r--crypto/dsa/dsa_gen.c4
-rw-r--r--crypto/dsa/dsa_key.c2
-rw-r--r--crypto/dsa/dsa_ossl.c6
-rw-r--r--crypto/dsa/dsa_pmeth.c8
-rw-r--r--crypto/dsa/dsa_prn.c4
8 files changed, 17 insertions, 17 deletions
diff --git a/crypto/dsa/dsa_ameth.c b/crypto/dsa/dsa_ameth.c
index 0002e0810e..d1d32c6959 100644
--- a/crypto/dsa/dsa_ameth.c
+++ b/crypto/dsa/dsa_ameth.c
@@ -136,7 +136,7 @@ static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
dsa = pkey->pkey.dsa;
if (pkey->save_parameters && dsa->p && dsa->q && dsa->g) {
str = ASN1_STRING_new();
- if (!str) {
+ if (str == NULL) {
DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
goto err;
}
@@ -298,7 +298,7 @@ static int dsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
params = ASN1_STRING_new();
- if (!params) {
+ if (params == NULL) {
DSAerr(DSA_F_DSA_PRIV_ENCODE, ERR_R_MALLOC_FAILURE);
goto err;
}
diff --git a/crypto/dsa/dsa_asn1.c b/crypto/dsa/dsa_asn1.c
index 99bca3b260..5225a389e6 100644
--- a/crypto/dsa/dsa_asn1.c
+++ b/crypto/dsa/dsa_asn1.c
@@ -71,7 +71,7 @@ static int sig_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
if (operation == ASN1_OP_NEW_PRE) {
DSA_SIG *sig;
sig = OPENSSL_malloc(sizeof(*sig));
- if (!sig) {
+ if (sig == NULL) {
DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE);
return 0;
}
@@ -96,7 +96,7 @@ static int dsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
{
if (operation == ASN1_OP_NEW_PRE) {
*pval = (ASN1_VALUE *)DSA_new();
- if (*pval)
+ if (*pval != NULL)
return 2;
return 0;
} else if (operation == ASN1_OP_FREE_PRE) {
diff --git a/crypto/dsa/dsa_depr.c b/crypto/dsa/dsa_depr.c
index f14e587646..0b18776845 100644
--- a/crypto/dsa/dsa_depr.c
+++ b/crypto/dsa/dsa_depr.c
@@ -89,7 +89,7 @@ DSA *DSA_generate_parameters(int bits,
if ((ret = DSA_new()) == NULL)
return NULL;
cb = BN_GENCB_new();
- if (!cb)
+ if (cb == NULL)
goto err;
BN_GENCB_set_old(cb, callback, cb_arg);
diff --git a/crypto/dsa/dsa_gen.c b/crypto/dsa/dsa_gen.c
index 480c29dbae..106ec3cb5f 100644
--- a/crypto/dsa/dsa_gen.c
+++ b/crypto/dsa/dsa_gen.c
@@ -387,7 +387,7 @@ int dsa_builtin_paramgen2(DSA *ret, size_t L, size_t N,
else
seed_tmp = OPENSSL_malloc(seed_len);
- if (!seed || !seed_tmp)
+ if (seed == NULL || seed_tmp == NULL)
goto err;
if (seed_in)
@@ -650,7 +650,7 @@ int dsa_paramgen_check_g(DSA *dsa)
BN_MONT_CTX *mont = NULL;
int rv = -1;
ctx = BN_CTX_new();
- if (!ctx)
+ if (ctx == NULL)
return -1;
BN_CTX_start(ctx);
if (BN_cmp(dsa->g, BN_value_one()) <= 0)
diff --git a/crypto/dsa/dsa_key.c b/crypto/dsa/dsa_key.c
index 19d21eacf7..d27d47a3b8 100644
--- a/crypto/dsa/dsa_key.c
+++ b/crypto/dsa/dsa_key.c
@@ -104,7 +104,7 @@ static int dsa_builtin_keygen(DSA *dsa)
if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) == 0) {
local_prk = prk = BN_new();
- if (!local_prk)
+ if (local_prk == NULL)
goto err;
BN_with_flags(prk, priv_key, BN_FLG_CONSTTIME);
} else
diff --git a/crypto/dsa/dsa_ossl.c b/crypto/dsa/dsa_ossl.c
index 19a75834fb..34b4a4ea4a 100644
--- a/crypto/dsa/dsa_ossl.c
+++ b/crypto/dsa/dsa_ossl.c
@@ -144,7 +144,7 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
m = BN_new();
xr = BN_new();
- if (!m || !xr)
+ if (m == NULL || xr == NULL)
goto err;
if (!dsa->p || !dsa->q || !dsa->g) {
@@ -242,7 +242,7 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in,
k = BN_new();
kq = BN_new();
- if (!k || !kq)
+ if (k == NULL || kq == NULL)
goto err;
if (ctx_in == NULL) {
@@ -356,7 +356,7 @@ static int dsa_do_verify(const unsigned char *dgst, int dgst_len,
u2 = BN_new();
t1 = BN_new();
ctx = BN_CTX_new();
- if (!u1 || !u2 || !t1 || !ctx)
+ if (u1 == NULL || u2 == NULL || t1 == NULL || ctx == NULL)
goto err;
if (BN_is_zero(sig->r) || BN_is_negative(sig->r) ||
diff --git a/crypto/dsa/dsa_pmeth.c b/crypto/dsa/dsa_pmeth.c
index 1adab4f8ec..1110e01b39 100644
--- a/crypto/dsa/dsa_pmeth.c
+++ b/crypto/dsa/dsa_pmeth.c
@@ -82,7 +82,7 @@ static int pkey_dsa_init(EVP_PKEY_CTX *ctx)
{
DSA_PKEY_CTX *dctx;
dctx = OPENSSL_malloc(sizeof(*dctx));
- if (!dctx)
+ if (dctx == NULL)
return 0;
dctx->nbits = 1024;
dctx->qbits = 160;
@@ -255,13 +255,13 @@ static int pkey_dsa_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
int ret;
if (ctx->pkey_gencb) {
pcb = BN_GENCB_new();
- if (!pcb)
+ if (pcb == NULL)
return 0;
evp_pkey_set_cb_translate(pcb, ctx);
} else
pcb = NULL;
dsa = DSA_new();
- if (!dsa) {
+ if (dsa == NULL) {
BN_GENCB_free(pcb);
return 0;
}
@@ -283,7 +283,7 @@ static int pkey_dsa_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
return 0;
}
dsa = DSA_new();
- if (!dsa)
+ if (dsa == NULL)
return 0;
EVP_PKEY_assign_DSA(pkey, dsa);
/* Note: if error return, pkey is freed by parent routine */
diff --git a/crypto/dsa/dsa_prn.c b/crypto/dsa/dsa_prn.c
index 64c51fced1..d1aef75b0f 100644
--- a/crypto/dsa/dsa_prn.c
+++ b/crypto/dsa/dsa_prn.c
@@ -99,7 +99,7 @@ int DSA_print(BIO *bp, const DSA *x, int off)
EVP_PKEY *pk;
int ret;
pk = EVP_PKEY_new();
- if (!pk || !EVP_PKEY_set1_DSA(pk, (DSA *)x))
+ if (pk == NULL || !EVP_PKEY_set1_DSA(pk, (DSA *)x))
return 0;
ret = EVP_PKEY_print_private(bp, pk, off, NULL);
EVP_PKEY_free(pk);
@@ -111,7 +111,7 @@ int DSAparams_print(BIO *bp, const DSA *x)
EVP_PKEY *pk;
int ret;
pk = EVP_PKEY_new();
- if (!pk || !EVP_PKEY_set1_DSA(pk, (DSA *)x))
+ if (pk == NULL || !EVP_PKEY_set1_DSA(pk, (DSA *)x))
return 0;
ret = EVP_PKEY_print_params(bp, pk, 4, NULL);
EVP_PKEY_free(pk);