summaryrefslogtreecommitdiffstats
path: root/crypto/dh/dh_ameth.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/dh/dh_ameth.c')
-rw-r--r--crypto/dh/dh_ameth.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/crypto/dh/dh_ameth.c b/crypto/dh/dh_ameth.c
index bb319e774d..a699afabbf 100644
--- a/crypto/dh/dh_ameth.c
+++ b/crypto/dh/dh_ameth.c
@@ -120,7 +120,7 @@ static int dh_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
ptype = V_ASN1_SEQUENCE;
pub_key = BN_to_ASN1_INTEGER(dh->pub_key, NULL);
- if (!pub_key)
+ if (pub_key == NULL)
goto err;
penclen = i2d_ASN1_INTEGER(pub_key, &penc);
@@ -158,7 +158,6 @@ static int dh_priv_decode(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8)
const ASN1_STRING *pstr;
const X509_ALGOR *palg;
ASN1_INTEGER *privkey = NULL;
-
DH *dh = NULL;
if (!PKCS8_pkey_get0(NULL, &p, &pklen, &palg, p8))
@@ -225,7 +224,7 @@ static int dh_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
/* Get private key into integer */
prkey = BN_to_ASN1_INTEGER(pkey->pkey.dh->priv_key, NULL);
- if (!prkey) {
+ if (prkey == NULL) {
DHerr(DH_F_DH_PRIV_ENCODE, DH_R_BN_ERROR);
goto err;
}
@@ -703,7 +702,7 @@ static int dh_cms_set_peerkey(EVP_PKEY_CTX *pctx,
goto err;
pk = EVP_PKEY_CTX_get0_pkey(pctx);
- if (!pk)
+ if (pk == NULL)
goto err;
if (pk->type != EVP_PKEY_DHX)
goto err;
@@ -712,7 +711,7 @@ static int dh_cms_set_peerkey(EVP_PKEY_CTX *pctx,
/* We have parameters now set public key */
plen = ASN1_STRING_length(pubkey);
p = ASN1_STRING_get0_data(pubkey);
- if (!p || !plen)
+ if (p == NULL || plen == 0)
goto err;
if ((public_key = d2i_ASN1_INTEGER(NULL, &p, plen)) == NULL) {
@@ -821,7 +820,8 @@ static int dh_cms_decrypt(CMS_RecipientInfo *ri)
{
EVP_PKEY_CTX *pctx;
pctx = CMS_RecipientInfo_get0_pkey_ctx(ri);
- if (!pctx)
+
+ if (pctx == NULL)
return 0;
/* See if we need to set peer key */
if (!EVP_PKEY_CTX_get0_peerkey(pctx)) {
@@ -862,8 +862,9 @@ static int dh_cms_encrypt(CMS_RecipientInfo *ri)
int rv = 0;
int kdf_type, wrap_nid;
const EVP_MD *kdf_md;
+
pctx = CMS_RecipientInfo_get0_pkey_ctx(ri);
- if (!pctx)
+ if (pctx == NULL)
return 0;
/* Get ephemeral key */
pkey = EVP_PKEY_CTX_get0_pkey(pctx);
@@ -874,7 +875,8 @@ static int dh_cms_encrypt(CMS_RecipientInfo *ri)
/* Is everything uninitialised? */
if (aoid == OBJ_nid2obj(NID_undef)) {
ASN1_INTEGER *pubk = BN_to_ASN1_INTEGER(pkey->pkey.dh->pub_key, NULL);
- if (!pubk)
+
+ if (pubk == NULL)
goto err;
/* Set the key */
@@ -960,7 +962,7 @@ static int dh_cms_encrypt(CMS_RecipientInfo *ri)
*/
penc = NULL;
penclen = i2d_X509_ALGOR(wrap_alg, &penc);
- if (!penc || !penclen)
+ if (penc == NULL || penclen == 0)
goto err;
wrap_str = ASN1_STRING_new();
if (wrap_str == NULL)