From bddb7c686e3d1aeb156722adc64b6c35ae720f87 Mon Sep 17 00:00:00 2001 From: beck <> Date: Thu, 17 Apr 2014 13:37:50 +0000 Subject: Change library to use intrinsic memory allocation functions instead of OPENSSL_foo wrappers. This changes: OPENSSL_malloc->malloc OPENSSL_free->free OPENSSL_relloc->realloc OPENSSL_freeFunc->free --- src/lib/libcrypto/evp/bio_b64.c | 4 ++-- src/lib/libcrypto/evp/bio_enc.c | 4 ++-- src/lib/libcrypto/evp/bio_ok.c | 4 ++-- src/lib/libcrypto/evp/digest.c | 12 ++++++------ src/lib/libcrypto/evp/e_aes.c | 6 +++--- src/lib/libcrypto/evp/evp_enc.c | 10 +++++----- src/lib/libcrypto/evp/evp_pbe.c | 4 ++-- src/lib/libcrypto/evp/p_lib.c | 4 ++-- src/lib/libcrypto/evp/p_open.c | 4 ++-- src/lib/libcrypto/evp/pmeth_lib.c | 10 +++++----- 10 files changed, 31 insertions(+), 31 deletions(-) (limited to 'src/lib/libcrypto/evp') diff --git a/src/lib/libcrypto/evp/bio_b64.c b/src/lib/libcrypto/evp/bio_b64.c index ac6d441aad..27fc587ca8 100644 --- a/src/lib/libcrypto/evp/bio_b64.c +++ b/src/lib/libcrypto/evp/bio_b64.c @@ -113,7 +113,7 @@ static int b64_new(BIO *bi) { BIO_B64_CTX *ctx; - ctx=(BIO_B64_CTX *)OPENSSL_malloc(sizeof(BIO_B64_CTX)); + ctx=(BIO_B64_CTX *)malloc(sizeof(BIO_B64_CTX)); if (ctx == NULL) return(0); ctx->buf_len=0; @@ -134,7 +134,7 @@ static int b64_new(BIO *bi) static int b64_free(BIO *a) { if (a == NULL) return(0); - OPENSSL_free(a->ptr); + free(a->ptr); a->ptr=NULL; a->init=0; a->flags=0; diff --git a/src/lib/libcrypto/evp/bio_enc.c b/src/lib/libcrypto/evp/bio_enc.c index b6efb5fbc4..8fe9a45e48 100644 --- a/src/lib/libcrypto/evp/bio_enc.c +++ b/src/lib/libcrypto/evp/bio_enc.c @@ -109,7 +109,7 @@ static int enc_new(BIO *bi) { BIO_ENC_CTX *ctx; - ctx=(BIO_ENC_CTX *)OPENSSL_malloc(sizeof(BIO_ENC_CTX)); + ctx=(BIO_ENC_CTX *)malloc(sizeof(BIO_ENC_CTX)); if (ctx == NULL) return(0); EVP_CIPHER_CTX_init(&ctx->cipher); @@ -133,7 +133,7 @@ static int enc_free(BIO *a) b=(BIO_ENC_CTX *)a->ptr; EVP_CIPHER_CTX_cleanup(&(b->cipher)); OPENSSL_cleanse(a->ptr,sizeof(BIO_ENC_CTX)); - OPENSSL_free(a->ptr); + free(a->ptr); a->ptr=NULL; a->init=0; a->flags=0; diff --git a/src/lib/libcrypto/evp/bio_ok.c b/src/lib/libcrypto/evp/bio_ok.c index e64335353f..fdb742f554 100644 --- a/src/lib/libcrypto/evp/bio_ok.c +++ b/src/lib/libcrypto/evp/bio_ok.c @@ -178,7 +178,7 @@ static int ok_new(BIO *bi) { BIO_OK_CTX *ctx; - ctx=(BIO_OK_CTX *)OPENSSL_malloc(sizeof(BIO_OK_CTX)); + ctx=(BIO_OK_CTX *)malloc(sizeof(BIO_OK_CTX)); if (ctx == NULL) return(0); ctx->buf_len=0; @@ -203,7 +203,7 @@ static int ok_free(BIO *a) if (a == NULL) return(0); EVP_MD_CTX_cleanup(&((BIO_OK_CTX *)a->ptr)->md); OPENSSL_cleanse(a->ptr,sizeof(BIO_OK_CTX)); - OPENSSL_free(a->ptr); + free(a->ptr); a->ptr=NULL; a->init=0; a->flags=0; diff --git a/src/lib/libcrypto/evp/digest.c b/src/lib/libcrypto/evp/digest.c index 782d3199a5..2fae68ef5e 100644 --- a/src/lib/libcrypto/evp/digest.c +++ b/src/lib/libcrypto/evp/digest.c @@ -124,7 +124,7 @@ void EVP_MD_CTX_init(EVP_MD_CTX *ctx) EVP_MD_CTX *EVP_MD_CTX_create(void) { - EVP_MD_CTX *ctx=OPENSSL_malloc(sizeof *ctx); + EVP_MD_CTX *ctx=malloc(sizeof *ctx); if (ctx) EVP_MD_CTX_init(ctx); @@ -198,12 +198,12 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) if (ctx->digest != type) { if (ctx->digest && ctx->digest->ctx_size) - OPENSSL_free(ctx->md_data); + free(ctx->md_data); ctx->digest=type; if (!(ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) && type->ctx_size) { ctx->update = type->update; - ctx->md_data=OPENSSL_malloc(type->ctx_size); + ctx->md_data=malloc(type->ctx_size); if (ctx->md_data == NULL) { EVPerr(EVP_F_EVP_DIGESTINIT_EX, @@ -298,7 +298,7 @@ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in) out->md_data = tmp_buf; else { - out->md_data=OPENSSL_malloc(out->digest->ctx_size); + out->md_data=malloc(out->digest->ctx_size); if (!out->md_data) { EVPerr(EVP_F_EVP_MD_CTX_COPY_EX,ERR_R_MALLOC_FAILURE); @@ -347,7 +347,7 @@ void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx) if (ctx) { EVP_MD_CTX_cleanup(ctx); - OPENSSL_free(ctx); + free(ctx); } } @@ -364,7 +364,7 @@ int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) { OPENSSL_cleanse(ctx->md_data,ctx->digest->ctx_size); - OPENSSL_free(ctx->md_data); + free(ctx->md_data); } if (ctx->pctx) EVP_PKEY_CTX_free(ctx->pctx); diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c index c7eaafe89b..d6f0124a94 100644 --- a/src/lib/libcrypto/evp/e_aes.c +++ b/src/lib/libcrypto/evp/e_aes.c @@ -679,7 +679,7 @@ static int aes_gcm_cleanup(EVP_CIPHER_CTX *c) EVP_AES_GCM_CTX *gctx = c->cipher_data; OPENSSL_cleanse(&gctx->gcm, sizeof(gctx->gcm)); if (gctx->iv != c->iv) - OPENSSL_free(gctx->iv); + free(gctx->iv); return 1; } @@ -724,8 +724,8 @@ static int aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) if ((arg > EVP_MAX_IV_LENGTH) && (arg > gctx->ivlen)) { if (gctx->iv != c->iv) - OPENSSL_free(gctx->iv); - gctx->iv = OPENSSL_malloc(arg); + free(gctx->iv); + gctx->iv = malloc(arg); if (!gctx->iv) return 0; } diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c index 50403a7578..e8ca502633 100644 --- a/src/lib/libcrypto/evp/evp_enc.c +++ b/src/lib/libcrypto/evp/evp_enc.c @@ -78,7 +78,7 @@ void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx) EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) { - EVP_CIPHER_CTX *ctx=OPENSSL_malloc(sizeof *ctx); + EVP_CIPHER_CTX *ctx=malloc(sizeof *ctx); if (ctx) EVP_CIPHER_CTX_init(ctx); return ctx; @@ -164,7 +164,7 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *imp ctx->cipher=cipher; if (ctx->cipher->ctx_size) { - ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size); + ctx->cipher_data=malloc(ctx->cipher->ctx_size); if (!ctx->cipher_data) { EVPerr(EVP_F_EVP_CIPHERINIT_EX, ERR_R_MALLOC_FAILURE); @@ -546,7 +546,7 @@ void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx) if (ctx) { EVP_CIPHER_CTX_cleanup(ctx); - OPENSSL_free(ctx); + free(ctx); } } @@ -561,7 +561,7 @@ int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size); } if (c->cipher_data) - OPENSSL_free(c->cipher_data); + free(c->cipher_data); #ifndef OPENSSL_NO_ENGINE if (c->engine) /* The EVP_CIPHER we used belongs to an ENGINE, release the @@ -644,7 +644,7 @@ int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in) if (in->cipher_data && in->cipher->ctx_size) { - out->cipher_data=OPENSSL_malloc(in->cipher->ctx_size); + out->cipher_data=malloc(in->cipher->ctx_size); if (!out->cipher_data) { EVPerr(EVP_F_EVP_CIPHER_CTX_COPY,ERR_R_MALLOC_FAILURE); diff --git a/src/lib/libcrypto/evp/evp_pbe.c b/src/lib/libcrypto/evp/evp_pbe.c index f8c32d825e..c808b96fef 100644 --- a/src/lib/libcrypto/evp/evp_pbe.c +++ b/src/lib/libcrypto/evp/evp_pbe.c @@ -238,7 +238,7 @@ int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, int md_nid, EVP_PBE_CTL *pbe_tmp; if (!pbe_algs) pbe_algs = sk_EVP_PBE_CTL_new(pbe_cmp); - if (!(pbe_tmp = (EVP_PBE_CTL*) OPENSSL_malloc (sizeof(EVP_PBE_CTL)))) + if (!(pbe_tmp = (EVP_PBE_CTL*) malloc (sizeof(EVP_PBE_CTL)))) { EVPerr(EVP_F_EVP_PBE_ALG_ADD_TYPE,ERR_R_MALLOC_FAILURE); return 0; @@ -306,7 +306,7 @@ int EVP_PBE_find(int type, int pbe_nid, static void free_evp_pbe_ctl(EVP_PBE_CTL *pbe) { - OPENSSL_freeFunc(pbe); + free(pbe); } void EVP_PBE_cleanup(void) diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c index e26ccd0d08..7a9da3487a 100644 --- a/src/lib/libcrypto/evp/p_lib.c +++ b/src/lib/libcrypto/evp/p_lib.c @@ -183,7 +183,7 @@ EVP_PKEY *EVP_PKEY_new(void) { EVP_PKEY *ret; - ret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY)); + ret=(EVP_PKEY *)malloc(sizeof(EVP_PKEY)); if (ret == NULL) { EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE); @@ -405,7 +405,7 @@ void EVP_PKEY_free(EVP_PKEY *x) EVP_PKEY_free_it(x); if (x->attributes) sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free); - OPENSSL_free(x); + free(x); } static void EVP_PKEY_free_it(EVP_PKEY *x) diff --git a/src/lib/libcrypto/evp/p_open.c b/src/lib/libcrypto/evp/p_open.c index c748fbea87..2a5ab2b6cc 100644 --- a/src/lib/libcrypto/evp/p_open.c +++ b/src/lib/libcrypto/evp/p_open.c @@ -87,7 +87,7 @@ int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, } size=RSA_size(priv->pkey.rsa); - key=(unsigned char *)OPENSSL_malloc(size+2); + key=(unsigned char *)malloc(size+2); if (key == NULL) { /* ERROR */ @@ -106,7 +106,7 @@ int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, ret=1; err: if (key != NULL) OPENSSL_cleanse(key,size); - OPENSSL_free(key); + free(key); return(ret); } diff --git a/src/lib/libcrypto/evp/pmeth_lib.c b/src/lib/libcrypto/evp/pmeth_lib.c index acfa7b6f87..a9fb15fdfe 100644 --- a/src/lib/libcrypto/evp/pmeth_lib.c +++ b/src/lib/libcrypto/evp/pmeth_lib.c @@ -165,7 +165,7 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id) return NULL; } - ret = OPENSSL_malloc(sizeof(EVP_PKEY_CTX)); + ret = malloc(sizeof(EVP_PKEY_CTX)); if (!ret) { #ifndef OPENSSL_NO_ENGINE @@ -200,7 +200,7 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id) EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags) { EVP_PKEY_METHOD *pmeth; - pmeth = OPENSSL_malloc(sizeof(EVP_PKEY_METHOD)); + pmeth = malloc(sizeof(EVP_PKEY_METHOD)); if (!pmeth) return NULL; @@ -291,7 +291,7 @@ void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src) void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth) { if (pmeth && (pmeth->flags & EVP_PKEY_FLAG_DYNAMIC)) - OPENSSL_free(pmeth); + free(pmeth); } EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e) @@ -317,7 +317,7 @@ EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *pctx) return 0; } #endif - rctx = OPENSSL_malloc(sizeof(EVP_PKEY_CTX)); + rctx = malloc(sizeof(EVP_PKEY_CTX)); if (!rctx) return NULL; @@ -378,7 +378,7 @@ void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx) * functional reference we held for this reason. */ ENGINE_finish(ctx->engine); #endif - OPENSSL_free(ctx); + free(ctx); } int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, -- cgit v1.2.3-55-g6feb