diff options
Diffstat (limited to 'crypto/engine')
-rw-r--r-- | crypto/engine/eng_cryptodev.c | 4 | ||||
-rw-r--r-- | crypto/engine/eng_dyn.c | 10 | ||||
-rw-r--r-- | crypto/engine/eng_lib.c | 2 | ||||
-rw-r--r-- | crypto/engine/eng_list.c | 6 | ||||
-rw-r--r-- | crypto/engine/eng_openssl.c | 6 | ||||
-rw-r--r-- | crypto/engine/eng_rdrand.c | 2 | ||||
-rw-r--r-- | crypto/engine/eng_table.c | 2 |
7 files changed, 19 insertions, 13 deletions
diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c index d058dba0a8..d1c0029d35 100644 --- a/crypto/engine/eng_cryptodev.c +++ b/crypto/engine/eng_cryptodev.c @@ -1233,6 +1233,8 @@ cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g, int ret = 0; t2 = BN_new(); + if (t2 == NULL) + goto err; /* v = ( g^u1 * y^u2 mod p ) mod q */ /* let t1 = g ^ u1 mod p */ @@ -1289,6 +1291,8 @@ static DSA_SIG *cryptodev_dsa_do_sign(const unsigned char *dgst, int dlen, if (cryptodev_asym(&kop, BN_num_bytes(dsa->q), r, BN_num_bytes(dsa->q), s) == 0) { dsaret = DSA_SIG_new(); + if (dsaret == NULL) + goto err; dsaret->r = r; dsaret->s = s; } else { diff --git a/crypto/engine/eng_dyn.c b/crypto/engine/eng_dyn.c index 100b050b9d..aed50f6474 100644 --- a/crypto/engine/eng_dyn.c +++ b/crypto/engine/eng_dyn.c @@ -204,12 +204,12 @@ static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) { dynamic_data_ctx *c = OPENSSL_zalloc(sizeof(*c)); - if (!c) { + if (c == NULL) { ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX, ERR_R_MALLOC_FAILURE); return 0; } c->dirs = sk_OPENSSL_STRING_new_null(); - if (!c->dirs) { + if (c->dirs == NULL) { ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX, ERR_R_MALLOC_FAILURE); OPENSSL_free(c); return 0; @@ -278,7 +278,7 @@ static dynamic_data_ctx *dynamic_get_data_ctx(ENGINE *e) static ENGINE *engine_dynamic(void) { ENGINE *ret = ENGINE_new(); - if (!ret) + if (ret == NULL) return NULL; if (!ENGINE_set_id(ret, engine_dynamic_id) || !ENGINE_set_name(ret, engine_dynamic_name) || @@ -438,8 +438,10 @@ static int dynamic_load(ENGINE *e, dynamic_data_ctx *ctx) ENGINE cpy; dynamic_fns fns; - if (!ctx->dynamic_dso) + if (ctx->dynamic_dso == NULL) ctx->dynamic_dso = DSO_new(); + if (ctx->dynamic_dso == NULL) + return 0; if (!ctx->DYNAMIC_LIBNAME) { if (!ctx->engine_id) return 0; diff --git a/crypto/engine/eng_lib.c b/crypto/engine/eng_lib.c index a113ebc57c..9ebb6943be 100644 --- a/crypto/engine/eng_lib.c +++ b/crypto/engine/eng_lib.c @@ -163,7 +163,7 @@ static int int_cleanup_check(int create) static ENGINE_CLEANUP_ITEM *int_cleanup_item(ENGINE_CLEANUP_CB *cb) { ENGINE_CLEANUP_ITEM *item = OPENSSL_malloc(sizeof(*item)); - if (!item) + if (item == NULL) return NULL; item->cb = cb; return item; diff --git a/crypto/engine/eng_list.c b/crypto/engine/eng_list.c index 54141f3ea6..cfd4f7e25c 100644 --- a/crypto/engine/eng_list.c +++ b/crypto/engine/eng_list.c @@ -332,7 +332,7 @@ ENGINE *ENGINE_by_id(const char *id) iterator = engine_list_head; while (iterator && (strcmp(id, iterator->id) != 0)) iterator = iterator->next; - if (iterator) { + if (iterator != NULL) { /* * We need to return a structural reference. If this is an ENGINE * type that returns copies, make a duplicate - otherwise increment @@ -340,7 +340,7 @@ ENGINE *ENGINE_by_id(const char *id) */ if (iterator->flags & ENGINE_FLAGS_BY_ID_COPY) { ENGINE *cp = ENGINE_new(); - if (!cp) + if (cp == NULL) iterator = NULL; else { engine_cpy(cp, iterator); @@ -352,7 +352,7 @@ ENGINE *ENGINE_by_id(const char *id) } } CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); - if (iterator) + if (iterator != NULL) return iterator; /* * Prevent infinite recusrion if we're looking for the dynamic engine. diff --git a/crypto/engine/eng_openssl.c b/crypto/engine/eng_openssl.c index 244a6096c6..41754f7627 100644 --- a/crypto/engine/eng_openssl.c +++ b/crypto/engine/eng_openssl.c @@ -186,7 +186,7 @@ static int bind_helper(ENGINE *e) static ENGINE *engine_openssl(void) { ENGINE *ret = ENGINE_new(); - if (!ret) + if (ret == NULL) return NULL; if (!bind_helper(ret)) { ENGINE_free(ret); @@ -429,7 +429,7 @@ static int ossl_hmac_init(EVP_PKEY_CTX *ctx) OSSL_HMAC_PKEY_CTX *hctx; hctx = OPENSSL_zalloc(sizeof(*hctx)); - if (!hctx) + if (hctx == NULL) return 0; hctx->ktmp.type = V_ASN1_OCTET_STRING; HMAC_CTX_init(&hctx->ctx); @@ -579,7 +579,7 @@ static int ossl_register_hmac_meth(void) { EVP_PKEY_METHOD *meth; meth = EVP_PKEY_meth_new(EVP_PKEY_HMAC, 0); - if (!meth) + if (meth == NULL) return 0; EVP_PKEY_meth_set_init(meth, ossl_hmac_init); EVP_PKEY_meth_set_copy(meth, ossl_hmac_copy); diff --git a/crypto/engine/eng_rdrand.c b/crypto/engine/eng_rdrand.c index 9316d6fe21..48726e2543 100644 --- a/crypto/engine/eng_rdrand.c +++ b/crypto/engine/eng_rdrand.c @@ -120,7 +120,7 @@ static int bind_helper(ENGINE *e) static ENGINE *ENGINE_rdrand(void) { ENGINE *ret = ENGINE_new(); - if (!ret) + if (ret == NULL) return NULL; if (!bind_helper(ret)) { ENGINE_free(ret); diff --git a/crypto/engine/eng_table.c b/crypto/engine/eng_table.c index 26b92308af..5fd00ddc2c 100644 --- a/crypto/engine/eng_table.c +++ b/crypto/engine/eng_table.c @@ -148,7 +148,7 @@ int engine_table_register(ENGINE_TABLE **table, ENGINE_CLEANUP_CB *cleanup, fnd = lh_ENGINE_PILE_retrieve(&(*table)->piles, &tmplate); if (!fnd) { fnd = OPENSSL_malloc(sizeof(*fnd)); - if (!fnd) + if (fnd == NULL) goto end; fnd->uptodate = 1; fnd->nid = *nids; |