}
ctx = capi_ctx_new();
- if (!ctx)
+ if (ctx == NULL)
goto memerr;
ENGINE_set_ex_data(e, capi_idx, ctx);
static ENGINE *engine_capi(void)
{
ENGINE *ret = ENGINE_new();
- if (!ret)
+ if (ret == NULL)
return NULL;
if (!bind_capi(ret)) {
ENGINE_free(ret);
pubkey = OPENSSL_malloc(len);
- if (!pubkey)
+ if (pubkey == NULL)
goto memerr;
if (!CryptExportKey(key->key, 0, PUBLICKEYBLOB, 0, pubkey, &len)) {
rkey->e = BN_new();
rkey->n = BN_new();
- if (!rkey->e || !rkey->n)
+ if (rkey->e == NULL || rkey->n == NULL)
goto memerr;
if (!BN_set_word(rkey->e, rp->pubexp))
dkey->q = BN_new();
dkey->g = BN_new();
dkey->pub_key = BN_new();
- if (!dkey->p || !dkey->q || !dkey->g || !dkey->pub_key)
+ if (dkey->p == NULL || dkey->q == NULL || dkey->g == NULL
+ || dkey->pub_key == NULL)
goto memerr;
if (!lend_tobn(dkey->p, btmp, dsa_plen))
goto memerr;
goto err;
} else {
ret = DSA_SIG_new();
- if (!ret)
+ if (ret == NULL)
goto err;
ret->r = BN_new();
ret->s = BN_new();
- if (!ret->r || !ret->s)
+ if (ret->r == NULL || ret->s == NULL)
goto err;
if (!lend_tobn(ret->r, csigbuf, 20)
|| !lend_tobn(ret->s, csigbuf + 20, 20)) {
return NULL;
}
str = OPENSSL_malloc(sz);
- if (!str) {
+ if (str == NULL) {
CAPIerr(CAPI_F_WIDE_TO_ASC, ERR_R_MALLOC_FAILURE);
return NULL;
}
if (buflen == 0)
buflen = 1024;
cname = OPENSSL_malloc(buflen);
- if (!cname) {
+ if (cname == NULL) {
CAPIerr(CAPI_F_CAPI_LIST_CONTAINERS, ERR_R_MALLOC_FAILURE);
goto err;
}
(cert, CERT_KEY_PROV_INFO_PROP_ID, NULL, &len))
return NULL;
pinfo = OPENSSL_malloc(len);
- if (!pinfo) {
+ if (pinfo == NULL) {
CAPIerr(CAPI_F_CAPI_GET_PROV_INFO, ERR_R_MALLOC_FAILURE);
return NULL;
}
{
CAPI_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
- if (!ctx) {
+ if (ctx == NULL) {
CAPIerr(CAPI_F_CAPI_CTX_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
}
static ENGINE *engine_chil(void)
{
ENGINE *ret = ENGINE_new();
- if (!ret)
+ if (ret == NULL)
return NULL;
if (!bind_helper(ret)) {
ENGINE_free(ret);
}
# ifndef OPENSSL_NO_RSA
hptr = OPENSSL_malloc(sizeof(*hptr));
- if (!hptr) {
+ if (hptr == NULL) {
HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PRIVKEY, ERR_R_MALLOC_FAILURE);
goto err;
}
bn_fix_top(rtmp->n);
res = EVP_PKEY_new();
+ if (res == NULL) {
+ HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PRIVKEY, HWCRHK_R_CHIL_ERROR);
+ goto err;
+ }
EVP_PKEY_assign_RSA(res, rtmp);
# endif
- if (!res)
+ if (res == NULL)
HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PRIVKEY,
HWCRHK_R_PRIVATE_KEY_ALGORITHMS_DISABLED);
static ENGINE *engine_gmp(void)
{
ENGINE *ret = ENGINE_new();
- if (!ret)
+ if (ret == NULL)
return NULL;
if (!bind_helper(ret)) {
ENGINE_free(ret);
} else {
int toret;
char *tmpchar = OPENSSL_malloc(mpz_sizeinbase(g, 16) + 10);
- if (!tmpchar)
+ if (tmpchar == NULL)
return 0;
mpz_get_str(tmpchar, 16, g);
toret = BN_hex2bn(&bn, tmpchar);
if (hptr)
return hptr;
hptr = OPENSSL_malloc(sizeof(*hptr));
- if (!hptr)
+ if (hptr == NULL)
return NULL;
/*
* These inits could probably be replaced by more intelligent mpz_init2()
static ENGINE *engine_ossltest(void)
{
ENGINE *ret = ENGINE_new();
- if (!ret)
+ if (ret == NULL)
return NULL;
if (!bind_ossltest(ret)) {
ENGINE_free(ret);
* run time
*/
ctx->cipher_data = OPENSSL_zalloc(EVP_aes_128_cbc()->ctx_size);
- if (!ctx->cipher_data) {
+ if (ctx->cipher_data == NULL) {
OSSLTESTerr(OSSLTEST_F_OSSLTEST_AES128_INIT_KEY,
ERR_R_MALLOC_FAILURE);
return 0;