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/engine/eng_dyn.c | 22 +++++++++++----------- src/lib/libcrypto/engine/eng_lib.c | 8 ++++---- src/lib/libcrypto/engine/eng_rsax.c | 4 ++-- src/lib/libcrypto/engine/eng_table.c | 6 +++--- 4 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src/lib/libcrypto/engine') diff --git a/src/lib/libcrypto/engine/eng_dyn.c b/src/lib/libcrypto/engine/eng_dyn.c index 807da7a5eb..7878bd802e 100644 --- a/src/lib/libcrypto/engine/eng_dyn.c +++ b/src/lib/libcrypto/engine/eng_dyn.c @@ -153,7 +153,7 @@ struct st_dynamic_data_ctx * structure. */ static int dynamic_ex_data_idx = -1; -static void int_free_str(char *s) { OPENSSL_free(s); } +static void int_free_str(char *s) { free(s); } /* Because our ex_data element may or may not get allocated depending on whether * a "first-use" occurs before the ENGINE is freed, we have a memory leak * problem to solve. We can't declare a "new" handler for the ex_data as we @@ -170,12 +170,12 @@ static void dynamic_data_ctx_free_func(void *parent, void *ptr, if(ctx->dynamic_dso) DSO_free(ctx->dynamic_dso); if(ctx->DYNAMIC_LIBNAME) - OPENSSL_free((void*)ctx->DYNAMIC_LIBNAME); + free((void*)ctx->DYNAMIC_LIBNAME); if(ctx->engine_id) - OPENSSL_free((void*)ctx->engine_id); + free((void*)ctx->engine_id); if(ctx->dirs) sk_OPENSSL_STRING_pop_free(ctx->dirs, int_free_str); - OPENSSL_free(ctx); + free(ctx); } } @@ -186,7 +186,7 @@ static void dynamic_data_ctx_free_func(void *parent, void *ptr, static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) { dynamic_data_ctx *c; - c = OPENSSL_malloc(sizeof(dynamic_data_ctx)); + c = malloc(sizeof(dynamic_data_ctx)); if(!c) { ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE); @@ -207,7 +207,7 @@ static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) if(!c->dirs) { ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE); - OPENSSL_free(c); + free(c); return 0; } CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); @@ -223,7 +223,7 @@ static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) /* If we lost the race to set the context, c is non-NULL and *ctx is the * context of the thread that won. */ if(c) - OPENSSL_free(c); + free(c); return 1; } @@ -337,7 +337,7 @@ static int dynamic_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)) if(p && (strlen((const char *)p) < 1)) p = NULL; if(ctx->DYNAMIC_LIBNAME) - OPENSSL_free((void*)ctx->DYNAMIC_LIBNAME); + free((void*)ctx->DYNAMIC_LIBNAME); if(p) ctx->DYNAMIC_LIBNAME = BUF_strdup(p); else @@ -351,7 +351,7 @@ static int dynamic_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)) if(p && (strlen((const char *)p) < 1)) p = NULL; if(ctx->engine_id) - OPENSSL_free((void*)ctx->engine_id); + free((void*)ctx->engine_id); if(p) ctx->engine_id = BUF_strdup(p); else @@ -422,10 +422,10 @@ static int int_load(dynamic_data_ctx *ctx) if(DSO_load(ctx->dynamic_dso, merge, NULL, 0)) { /* Found what we're looking for */ - OPENSSL_free(merge); + free(merge); return 1; } - OPENSSL_free(merge); + free(merge); } return 0; } diff --git a/src/lib/libcrypto/engine/eng_lib.c b/src/lib/libcrypto/engine/eng_lib.c index 18a6664645..126bc02296 100644 --- a/src/lib/libcrypto/engine/eng_lib.c +++ b/src/lib/libcrypto/engine/eng_lib.c @@ -65,7 +65,7 @@ ENGINE *ENGINE_new(void) { ENGINE *ret; - ret = (ENGINE *)OPENSSL_malloc(sizeof(ENGINE)); + ret = (ENGINE *)malloc(sizeof(ENGINE)); if(ret == NULL) { ENGINEerr(ENGINE_F_ENGINE_NEW, ERR_R_MALLOC_FAILURE); @@ -133,7 +133,7 @@ int engine_free_util(ENGINE *e, int locked) if(e->destroy) e->destroy(e); CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ENGINE, e, &e->ex_data); - OPENSSL_free(e); + free(e); return 1; } @@ -158,7 +158,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( + ENGINE_CLEANUP_ITEM *item = malloc(sizeof( ENGINE_CLEANUP_ITEM)); if(!item) return NULL; item->cb = cb; @@ -184,7 +184,7 @@ void engine_cleanup_add_last(ENGINE_CLEANUP_CB *cb) static void engine_cleanup_cb_free(ENGINE_CLEANUP_ITEM *item) { (*(item->cb))(); - OPENSSL_free(item); + free(item); } void ENGINE_cleanup(void) { diff --git a/src/lib/libcrypto/engine/eng_rsax.c b/src/lib/libcrypto/engine/eng_rsax.c index 96e63477ee..fa9159499d 100644 --- a/src/lib/libcrypto/engine/eng_rsax.c +++ b/src/lib/libcrypto/engine/eng_rsax.c @@ -282,7 +282,7 @@ static E_RSAX_MOD_CTX *e_rsax_get_ctx(RSA *rsa, int idx, BIGNUM* m) hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx); if (!hptr) { - hptr = OPENSSL_malloc(3*sizeof(E_RSAX_MOD_CTX)); + hptr = malloc(3*sizeof(E_RSAX_MOD_CTX)); if (!hptr) return NULL; hptr[2].type = hptr[1].type= hptr[0].type = 0; RSA_set_ex_data(rsa, rsax_ex_data_idx, hptr); @@ -307,7 +307,7 @@ static int e_rsax_rsa_finish(RSA *rsa) E_RSAX_MOD_CTX *hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx); if(hptr) { - OPENSSL_free(hptr); + free(hptr); RSA_set_ex_data(rsa, rsax_ex_data_idx, NULL); } if (rsa->_method_mod_n) diff --git a/src/lib/libcrypto/engine/eng_table.c b/src/lib/libcrypto/engine/eng_table.c index 4fde948185..b7e77f7625 100644 --- a/src/lib/libcrypto/engine/eng_table.c +++ b/src/lib/libcrypto/engine/eng_table.c @@ -146,14 +146,14 @@ 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(ENGINE_PILE)); + fnd = malloc(sizeof(ENGINE_PILE)); if(!fnd) goto end; fnd->uptodate = 1; fnd->nid = *nids; fnd->sk = sk_ENGINE_new_null(); if(!fnd->sk) { - OPENSSL_free(fnd); + free(fnd); goto end; } fnd->funct = NULL; @@ -218,7 +218,7 @@ static void int_cleanup_cb_doall(ENGINE_PILE *p) sk_ENGINE_free(p->sk); if(p->funct) engine_unlocked_finish(p->funct, 0); - OPENSSL_free(p); + free(p); } static IMPLEMENT_LHASH_DOALL_FN(int_cleanup_cb, ENGINE_PILE) -- cgit v1.2.3-55-g6feb