diff options
47 files changed, 78 insertions, 469 deletions
diff --git a/apps/s_cb.c b/apps/s_cb.c index 07ce997081..a1305d339f 100644 --- a/apps/s_cb.c +++ b/apps/s_cb.c @@ -991,14 +991,7 @@ static int ssl_excert_prepend(SSL_EXCERT **pexc) { SSL_EXCERT *exc = app_malloc(sizeof(*exc), "prepend cert"); - exc->certfile = NULL; - exc->keyfile = NULL; - exc->chainfile = NULL; - exc->cert = NULL; - exc->key = NULL; - exc->chain = NULL; - exc->prev = NULL; - exc->build_chain = 0; + memset(exc, 0, sizeof(*exc)); exc->next = *pexc; *pexc = exc; diff --git a/crypto/asn1/a_object.c b/crypto/asn1/a_object.c index ab37fa315f..44473dc1b3 100644 --- a/crypto/asn1/a_object.c +++ b/crypto/asn1/a_object.c @@ -345,16 +345,11 @@ ASN1_OBJECT *ASN1_OBJECT_new(void) { ASN1_OBJECT *ret; - ret = OPENSSL_malloc(sizeof(*ret)); + ret = OPENSSL_zalloc(sizeof(*ret)); if (ret == NULL) { ASN1err(ASN1_F_ASN1_OBJECT_NEW, ERR_R_MALLOC_FAILURE); return (NULL); } - ret->length = 0; - ret->data = NULL; - ret->nid = 0; - ret->sn = NULL; - ret->ln = NULL; ret->flags = ASN1_OBJECT_FLAG_DYNAMIC; return (ret); } diff --git a/crypto/asn1/ameth_lib.c b/crypto/asn1/ameth_lib.c index 155de83aaa..feef015acc 100644 --- a/crypto/asn1/ameth_lib.c +++ b/crypto/asn1/ameth_lib.c @@ -296,48 +296,17 @@ EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags, ameth->info = BUF_strdup(info); if (!ameth->info) goto err; - } else - ameth->info = NULL; + } if (pem_str) { ameth->pem_str = BUF_strdup(pem_str); if (!ameth->pem_str) goto err; - } else - ameth->pem_str = NULL; - - ameth->pub_decode = 0; - ameth->pub_encode = 0; - ameth->pub_cmp = 0; - ameth->pub_print = 0; - - ameth->priv_decode = 0; - ameth->priv_encode = 0; - ameth->priv_print = 0; - - ameth->old_priv_encode = 0; - ameth->old_priv_decode = 0; - - ameth->item_verify = 0; - ameth->item_sign = 0; - - ameth->pkey_size = 0; - ameth->pkey_bits = 0; - - ameth->param_decode = 0; - ameth->param_encode = 0; - ameth->param_missing = 0; - ameth->param_copy = 0; - ameth->param_cmp = 0; - ameth->param_print = 0; - - ameth->pkey_free = 0; - ameth->pkey_ctrl = 0; + } return ameth; err: - EVP_PKEY_asn1_free(ameth); return NULL; diff --git a/crypto/asn1/asn1_lib.c b/crypto/asn1/asn1_lib.c index 94b5ad5d91..3b366449a9 100644 --- a/crypto/asn1/asn1_lib.c +++ b/crypto/asn1/asn1_lib.c @@ -348,15 +348,12 @@ ASN1_STRING *ASN1_STRING_type_new(int type) { ASN1_STRING *ret; - ret = OPENSSL_malloc(sizeof(*ret)); + ret = OPENSSL_zalloc(sizeof(*ret)); if (ret == NULL) { ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE); return (NULL); } - ret->length = 0; ret->type = type; - ret->data = NULL; - ret->flags = 0; return (ret); } diff --git a/crypto/asn1/tasn_prn.c b/crypto/asn1/tasn_prn.c index 716db8f7c2..5314c61b24 100644 --- a/crypto/asn1/tasn_prn.c +++ b/crypto/asn1/tasn_prn.c @@ -85,16 +85,12 @@ ASN1_PCTX default_pctx = { ASN1_PCTX *ASN1_PCTX_new(void) { ASN1_PCTX *ret; - ret = OPENSSL_malloc(sizeof(*ret)); + + ret = OPENSSL_zalloc(sizeof(*ret)); if (ret == NULL) { ASN1err(ASN1_F_ASN1_PCTX_NEW, ERR_R_MALLOC_FAILURE); return NULL; } - ret->flags = 0; - ret->nm_flags = 0; - ret->cert_flags = 0; - ret->oid_flags = 0; - ret->str_flags = 0; return ret; } diff --git a/crypto/asn1/x_info.c b/crypto/asn1/x_info.c index 5be934c690..0a75e49361 100644 --- a/crypto/asn1/x_info.c +++ b/crypto/asn1/x_info.c @@ -64,22 +64,14 @@ X509_INFO *X509_INFO_new(void) { - X509_INFO *ret = NULL; + X509_INFO *ret; - ret = OPENSSL_malloc(sizeof(*ret)); + ret = OPENSSL_zalloc(sizeof(*ret)); if (ret == NULL) { ASN1err(ASN1_F_X509_INFO_NEW, ERR_R_MALLOC_FAILURE); return (NULL); } - - ret->enc_cipher.cipher = NULL; - ret->enc_len = 0; - ret->enc_data = NULL; - ret->references = 1; - ret->x509 = NULL; - ret->crl = NULL; - ret->x_pkey = NULL; return (ret); } diff --git a/crypto/asn1/x_pkey.c b/crypto/asn1/x_pkey.c index 0710419596..0665aab622 100644 --- a/crypto/asn1/x_pkey.c +++ b/crypto/asn1/x_pkey.c @@ -70,17 +70,10 @@ X509_PKEY *X509_PKEY_new(void) if (!ret) goto err; - ret->version = 0; ret->enc_algor = X509_ALGOR_new(); ret->enc_pkey = ASN1_OCTET_STRING_new(); if (!ret->enc_algor || !ret->enc_pkey) goto err; - ret->dec_pkey = NULL; - ret->key_length = 0; - ret->key_data = NULL; - ret->key_free = 0; - ret->cipher.cipher = NULL; - memset(ret->cipher.iv, 0, EVP_MAX_IV_LENGTH); ret->references = 1; return ret; err: diff --git a/crypto/bio/bf_buff.c b/crypto/bio/bf_buff.c index 4fd8d15405..b7a3772979 100644 --- a/crypto/bio/bf_buff.c +++ b/crypto/bio/bf_buff.c @@ -91,27 +91,23 @@ BIO_METHOD *BIO_f_buffer(void) static int buffer_new(BIO *bi) { - BIO_F_BUFFER_CTX *ctx = OPENSSL_malloc(sizeof(*ctx)); + BIO_F_BUFFER_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); if (ctx == NULL) return (0); + ctx->ibuf_size = DEFAULT_BUFFER_SIZE; ctx->ibuf = OPENSSL_malloc(DEFAULT_BUFFER_SIZE); if (ctx->ibuf == NULL) { OPENSSL_free(ctx); return (0); } + ctx->obuf_size = DEFAULT_BUFFER_SIZE; ctx->obuf = OPENSSL_malloc(DEFAULT_BUFFER_SIZE); if (ctx->obuf == NULL) { OPENSSL_free(ctx->ibuf); OPENSSL_free(ctx); return (0); } - ctx->ibuf_size = DEFAULT_BUFFER_SIZE; - ctx->obuf_size = DEFAULT_BUFFER_SIZE; - ctx->ibuf_len = 0; - ctx->ibuf_off = 0; - ctx->obuf_len = 0; - ctx->obuf_off = 0; bi->init = 1; bi->ptr = (char *)ctx; diff --git a/crypto/bio/bf_nbio.c b/crypto/bio/bf_nbio.c index 7980711d3d..2a2e3146a2 100644 --- a/crypto/bio/bf_nbio.c +++ b/crypto/bio/bf_nbio.c @@ -102,13 +102,12 @@ static int nbiof_new(BIO *bi) { NBIO_TEST *nt; - if ((nt = OPENSSL_malloc(sizeof(*nt))) == NULL) + if ((nt = OPENSSL_zalloc(sizeof(*nt))) == NULL) return (0); nt->lrn = -1; nt->lwn = -1; bi->ptr = (char *)nt; bi->init = 1; - bi->flags = 0; return (1); } diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c index bbb9aca1c4..91474fcb60 100644 --- a/crypto/bio/bss_dgram.c +++ b/crypto/bio/bss_dgram.c @@ -225,10 +225,7 @@ static int dgram_new(BIO *bi) if (data == NULL) return 0; - bi->init = 0; - bi->num = 0; bi->ptr = data; - bi->flags = 0; return (1); } diff --git a/crypto/bn/bn_ctx.c b/crypto/bn/bn_ctx.c index 660e626a91..756d404c13 100644 --- a/crypto/bn/bn_ctx.c +++ b/crypto/bn/bn_ctx.c @@ -190,17 +190,13 @@ BN_CTX *BN_CTX_new(void) { BN_CTX *ret; - if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) { + if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); return NULL; } /* Initialise the structure */ BN_POOL_init(&ret->pool); BN_STACK_init(&ret->stack); - ret->used = 0; - ret->err_stack = 0; - ret->too_many = 0; - ret->flags = 0; return ret; } diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c index 2ca6beab36..3b07d7d28c 100644 --- a/crypto/bn/bn_lib.c +++ b/crypto/bn/bn_lib.c @@ -275,15 +275,11 @@ BIGNUM *BN_new(void) { BIGNUM *ret; - if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) { + if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); return (NULL); } ret->flags = BN_FLG_MALLOCED; - ret->top = 0; - ret->neg = 0; - ret->dmax = 0; - ret->d = NULL; bn_check_top(ret); return (ret); } diff --git a/crypto/buffer/buffer.c b/crypto/buffer/buffer.c index 5ee11f4c70..705037b06d 100644 --- a/crypto/buffer/buffer.c +++ b/crypto/buffer/buffer.c @@ -81,15 +81,11 @@ BUF_MEM *BUF_MEM_new(void) { BUF_MEM *ret; - ret = OPENSSL_malloc(sizeof(*ret)); + ret = OPENSSL_zalloc(sizeof(*ret)); if (ret == NULL) { BUFerr(BUF_F_BUF_MEM_NEW, ERR_R_MALLOC_FAILURE); return (NULL); } - ret->flags = 0; - ret->length = 0; - ret->max = 0; - ret->data = NULL; return (ret); } diff --git a/crypto/comp/c_zlib.c b/crypto/comp/c_zlib.c index 474751192a..ea01ba46e5 100644 --- a/crypto/comp/c_zlib.c +++ b/crypto/comp/c_zlib.c @@ -166,7 +166,7 @@ struct zlib_state { static int zlib_stateful_init(COMP_CTX *ctx) { int err; - struct zlib_state *state = OPENSSL_malloc(sizeof(*state)); + struct zlib_state *state = OPENSSL_zalloc(sizeof(*state)); if (state == NULL) goto err; @@ -176,8 +176,6 @@ static int zlib_stateful_init(COMP_CTX *ctx) state->istream.opaque = Z_NULL; state->istream.next_in = Z_NULL; state->istream.next_out = Z_NULL; - state->istream.avail_in = 0; - state->istream.avail_out = 0; err = inflateInit_(&state->istream, ZLIB_VERSION, sizeof(z_stream)); if (err != Z_OK) goto err; @@ -187,8 +185,6 @@ static int zlib_stateful_init(COMP_CTX *ctx) state->ostream.opaque = Z_NULL; state->ostream.next_in = Z_NULL; state->ostream.next_out = Z_NULL; - state->ostream.avail_in = 0; - state->ostream.avail_out = 0; err = deflateInit_(&state->ostream, Z_DEFAULT_COMPRESSION, ZLIB_VERSION, sizeof(z_stream)); if (err != Z_OK) @@ -367,28 +363,17 @@ static int bio_zlib_new(BIO *bi) return 0; } # endif - ctx = OPENSSL_malloc(sizeof(*ctx)); + ctx = OPENSSL_zalloc(sizeof(*ctx)); if (!ctx) { COMPerr(COMP_F_BIO_ZLIB_NEW, ERR_R_MALLOC_FAILURE); return 0; } - ctx->ibuf = NULL; - ctx->obuf = NULL; ctx->ibufsize = ZLIB_DEFAULT_BUFSIZE; ctx->obufsize = ZLIB_DEFAULT_BUFSIZE; ctx->zin.zalloc = Z_NULL; ctx->zin.zfree = Z_NULL; - ctx->zin.next_in = NULL; - ctx->zin.avail_in = 0; - ctx->zin.next_out = NULL; - ctx->zin.avail_out = 0; ctx->zout.zalloc = Z_NULL; ctx->zout.zfree = Z_NULL; - ctx->zout.next_in = NULL; - ctx->zout.avail_in = 0; - ctx->zout.next_out = NULL; - ctx->zout.avail_out = 0; - ctx->odone = 0; ctx->comp_level = Z_DEFAULT_COMPRESSION; bi->init = 1; bi->ptr = (char *)ctx; diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c index 7fbb4ad9a4..c23a0f6a46 100644 --- a/crypto/conf/conf_mod.c +++ b/crypto/conf/conf_mod.c @@ -281,7 +281,7 @@ static CONF_MODULE *module_add(DSO *dso, const char *name, supported_modules = sk_CONF_MODULE_new_null(); if (supported_modules == NULL) return NULL; - tmod = OPENSSL_malloc(sizeof(*tmod)); + tmod = OPENSSL_zalloc(sizeof(*tmod)); if (tmod == NULL) return NULL; @@ -289,7 +289,6 @@ static CONF_MODULE *module_add(DSO *dso, const char *name, tmod->name = BUF_strdup(name); tmod->init = ifunc; tmod->finish = ffunc; - tmod->links = 0; if (!sk_CONF_MODULE_push(supported_modules, tmod)) { OPENSSL_free(tmod); diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c index 4e087d0357..49f82d867f 100644 --- a/crypto/dh/dh_lib.c +++ b/crypto/dh/dh_lib.c @@ -107,7 +107,7 @@ DH *DH_new(void) DH *DH_new_method(ENGINE *engine) { - DH *ret = OPENSSL_malloc(sizeof(*ret)); + DH *ret = OPENSSL_zalloc(sizeof(*ret)); if (ret == NULL) { DHerr(DH_F_DH_NEW_METHOD, ERR_R_MALLOC_FAILURE); @@ -136,19 +136,6 @@ DH *DH_new_method(ENGINE *engine) } #endif - ret->pad = 0; - ret->version = 0; - ret->p = NULL; - ret->g = NULL; - ret->length = 0; - ret->pub_key = NULL; - ret->priv_key = NULL; - ret->q = NULL; - ret->j = NULL; - ret->seed = NULL; - ret->seedlen = 0; - ret->counter = NULL; - ret->method_mont_p = NULL; ret->references = 1; ret->flags = ret->meth->flags; CRYPTO_new_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data); diff --git a/crypto/dh/dh_pmeth.c b/crypto/dh/dh_pmeth.c index 751428cb66..ff27221644 100644 --- a/crypto/dh/dh_pmeth.c +++ b/crypto/dh/dh_pmeth.c @@ -98,22 +98,14 @@ typedef struct { static int pkey_dh_init(EVP_PKEY_CTX *ctx) { DH_PKEY_CTX *dctx; - dctx = OPENSSL_malloc(sizeof(*dctx)); + + dctx = OPENSSL_zalloc(sizeof(*dctx)); if (!dctx) return 0; dctx->prime_len = 1024; dctx->subprime_len = -1; dctx->generator = 2; - dctx->use_dsa = 0; - dctx->md = NULL; - dctx->rfc5114_param = 0; - dctx->kdf_type = EVP_PKEY_DH_KDF_NONE; - dctx->kdf_oid = NULL; - dctx->kdf_md = NULL; - dctx->kdf_ukm = NULL; - dctx->kdf_ukmlen = 0; - dctx->kdf_outlen = 0; ctx->data = dctx; ctx->keygen_info = dctx->gentmp; diff --git a/crypto/dsa/dsa_lib.c b/crypto/dsa/dsa_lib.c index a4a8163477..b78a2bf5d6 100644 --- a/crypto/dsa/dsa_lib.c +++ b/crypto/dsa/dsa_lib.c @@ -115,7 +115,7 @@ DSA *DSA_new_method(ENGINE *engine) { DSA *ret; - ret = OPENSSL_malloc(sizeof(*ret)); + ret = OPENSSL_zalloc(sizeof(*ret)); if (ret == NULL) { DSAerr(DSA_F_DSA_NEW_METHOD, ERR_R_MALLOC_FAILURE); return (NULL); @@ -142,19 +142,6 @@ DSA *DSA_new_method(ENGINE *engine) } #endif - ret->pad = 0; - ret->version = 0; - ret->p = NULL; - ret->q = NULL; - ret->g = NULL; - - ret->pub_key = NULL; - ret->priv_key = NULL; - - ret->kinv = NULL; - ret->r = NULL; - ret->method_mont_p = NULL; - ret->references = 1; ret->flags = ret->meth->flags & ~DSA_FLAG_NON_FIPS_ALLOW; CRYPTO_new_ex_data(CRYPTO_EX_INDEX_DSA, ret, &ret->ex_data); diff --git a/crypto/ec/ec_key.c b/crypto/ec/ec_key.c index a954c8e72a..238009788a 100644 --- a/crypto/ec/ec_key.c +++ b/crypto/ec/ec_key.c @@ -67,7 +67,7 @@ EC_KEY *EC_KEY_new(void) { - EC_KEY *ret = OPENSSL_malloc(sizeof(*ret)); + EC_KEY *ret = OPENSSL_zalloc(sizeof(*ret)); if (ret == NULL) { ECerr(EC_F_EC_KEY_NEW, ERR_R_MALLOC_FAILURE); @@ -75,14 +75,8 @@ EC_KEY *EC_KEY_new(void) } ret->version = 1; - ret->flags = 0; - ret->group = NULL; - ret->pub_key = NULL; - ret->priv_key = NULL; - ret->enc_flag = 0; ret->conv_form = POINT_CONVERSION_UNCOMPRESSED; ret->references = 1; - ret->method_data = NULL; return (ret); } diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c index cd08a5553c..793645de8a 100644 --- a/crypto/ec/ec_lib.c +++ b/crypto/ec/ec_lib.c @@ -83,37 +83,25 @@ EC_GROUP *EC_GROUP_new(const EC_METHOD *meth) return NULL; } - ret = OPENSSL_malloc(sizeof(*ret)); + ret = OPENSSL_zalloc(sizeof(*ret)); if (ret == NULL) { ECerr(EC_F_EC_GROUP_NEW, ERR_R_MALLOC_FAILURE); return NULL; } ret->meth = meth; - - ret->extra_data = NULL; - ret->mont_data = NULL; - - ret->generator = NULL; ret->order = BN_new(); - ret->cofactor = NULL; if (!ret->order) goto err; ret->cofactor = BN_new(); if (!ret->cofactor) goto err; - - ret->curve_name = 0; ret->asn1_flag = OPENSSL_EC_NAMED_CURVE; ret->asn1_form = POINT_CONVERSION_UNCOMPRESSED; - - ret->seed = NULL; - ret->seed_len = 0; - if (!meth->group_init(ret)) goto err; - return ret; + err: BN_free(ret->order); BN_free(ret->cofactor); diff --git a/crypto/ec/ec_mult.c b/crypto/ec/ec_mult.c index 09f042ee3a..a3d9885dcf 100644 --- a/crypto/ec/ec_mult.c +++ b/crypto/ec/ec_mult.c @@ -100,17 +100,14 @@ static EC_PRE_COMP *ec_pre_comp_new(const EC_GROUP *group) if (!group) return NULL; - ret = OPENSSL_malloc(sizeof(*ret)); + ret = OPENSSL_zalloc(sizeof(*ret)); if (!ret) { ECerr(EC_F_EC_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); return ret; } ret->group = group; ret->blocksize = 8; /* default */ - ret->numblocks = 0; ret->w = 4; /* default */ - ret->points = NULL; - ret->num = 0; ret->references = 1; return ret; } diff --git a/crypto/ec/ec_pmeth.c b/crypto/ec/ec_pmeth.c index 5ca8ed9dfd..aa1fa9f53f 100644 --- a/crypto/ec/ec_pmeth.c +++ b/crypto/ec/ec_pmeth.c @@ -92,22 +92,13 @@ static int pkey_ec_init(EVP_PKEY_CTX *ctx) { EC_PKEY_CTX *dctx; - dctx = OPENSSL_malloc(sizeof(*dctx)); + dctx = OPENSSL_zalloc(sizeof(*dctx)); if (!dctx) return 0; - dctx->gen_group = NULL; - dctx->md = NULL; dctx->cofactor_mode = -1; - dctx->co_key = NULL; dctx->kdf_type = EVP_PKEY_ECDH_KDF_NONE; - dctx->kdf_md = NULL; - dctx->kdf_outlen = 0; - dctx->kdf_ukm = NULL; - dctx->kdf_ukmlen = 0; - ctx->data = dctx; - return 1; } diff --git a/crypto/ecdsa/ecs_lib.c b/crypto/ecdsa/ecs_lib.c index 0db35346de..f3007e5043 100644 --- a/crypto/ecdsa/ecs_lib.c +++ b/crypto/ecdsa/ecs_lib.c @@ -251,7 +251,7 @@ ECDSA_METHOD *ECDSA_METHOD_new(ECDSA_METHOD *ecdsa_meth) { ECDSA_METHOD *ret; - ret = OPENSSL_malloc(sizeof(*ret)); + ret = OPENSSL_zalloc(sizeof(*ret)); if (ret == NULL) { ECDSAerr(ECDSA_F_ECDSA_METHOD_NEW, ERR_R_MALLOC_FAILURE); return NULL; @@ -259,13 +259,6 @@ ECDSA_METHOD *ECDSA_METHOD_new(ECDSA_METHOD *ecdsa_meth) if (ecdsa_meth) *ret = *ecdsa_meth; - else { - ret->ecdsa_sign_setup = 0; - ret->ecdsa_do_sign = 0; - ret->ecdsa_do_verify = 0; - ret->name = NULL; - ret->flags = 0; - } ret->flags |= ECDSA_METHOD_FLAG_ALLOCATED; return ret; } diff --git a/crypto/engine/eng_dyn.c b/crypto/engine/eng_dyn.c index 777f44018b..100b050b9d 100644 --- a/crypto/engine/eng_dyn.c +++ b/crypto/engine/eng_dyn.c @@ -208,22 +208,15 @@ static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX, ERR_R_MALLOC_FAILURE); return 0; } - c->dynamic_dso = NULL; - c->v_check = NULL; - c->bind_engine = NULL; - c->DYNAMIC_LIBNAME = NULL; - c->no_vcheck = 0; - c->engine_id = NULL; - c->list_add_value = 0; - c->DYNAMIC_F1 = "v_check"; - c->DYNAMIC_F2 = "bind_engine"; - c->dir_load = 1; c->dirs = sk_OPENSSL_STRING_new_null(); if (!c->dirs) { ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX, ERR_R_MALLOC_FAILURE); OPENSSL_free(c); return 0; } + c->DYNAMIC_F1 = "v_check"; + c->DYNAMIC_F2 = "bind_engine"; + c->dir_load = 1; CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); if ((*ctx = (dynamic_data_ctx *)ENGINE_get_ex_data(e, dynamic_ex_data_idx)) diff --git a/crypto/engine/eng_openssl.c b/crypto/engine/eng_openssl.c index eaf06180c9..4bc9b2ec69 100644 --- a/crypto/engine/eng_openssl.c +++ b/crypto/engine/eng_openssl.c @@ -425,13 +425,10 @@ typedef struct { static int ossl_hmac_init(EVP_PKEY_CTX *ctx) { OSSL_HMAC_PKEY_CTX *hctx; - hctx = OPENSSL_malloc(sizeof(*hctx)); + + hctx = OPENSSL_zalloc(sizeof(*hctx)); if (!hctx) return 0; - hctx->md = NULL; - hctx->ktmp.data = NULL; - hctx->ktmp.length = 0; - hctx->ktmp.flags = 0; hctx->ktmp.type = V_ASN1_OCTET_STRING; HMAC_CTX_init(&hctx->ctx); EVP_PKEY_CTX_set_data(ctx, hctx); diff --git a/crypto/evp/bio_b64.c b/crypto/evp/bio_b64.c index dcb96956c5..00febc720e 100644 --- a/crypto/evp/bio_b64.c +++ b/crypto/evp/bio_b64.c @@ -115,18 +115,12 @@ static int b64_new(BIO *bi) { BIO_B64_CTX *ctx; - ctx = OPENSSL_malloc(sizeof(*ctx)); + ctx = OPENSSL_zalloc(sizeof(*ctx)); if (ctx == NULL) return (0); - ctx->buf_len = 0; - ctx->tmp_len = 0; - ctx->tmp_nl = 0; - ctx->buf_off = 0; ctx->cont = 1; ctx->start = 1; - ctx->encode = 0; - bi->init = 1; bi->ptr = (char *)ctx; bi->flags = 0; diff --git a/crypto/evp/bio_enc.c b/crypto/evp/bio_enc.c index bf74a0ac72..2e6ce33e4e 100644 --- a/crypto/evp/bio_enc.c +++ b/crypto/evp/bio_enc.c @@ -112,17 +112,13 @@ static int enc_new(BIO *bi) { |