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/srp/srp_lib.c | 12 ++++++------ src/lib/libcrypto/srp/srp_vfy.c | 40 ++++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 26 deletions(-) (limited to 'src/lib/libcrypto/srp') diff --git a/src/lib/libcrypto/srp/srp_lib.c b/src/lib/libcrypto/srp/srp_lib.c index 7c1dcc5111..8cc94f51db 100644 --- a/src/lib/libcrypto/srp/srp_lib.c +++ b/src/lib/libcrypto/srp/srp_lib.c @@ -89,7 +89,7 @@ static BIGNUM *srp_Calc_k(BIGNUM *N, BIGNUM *g) int longg ; int longN = BN_num_bytes(N); - if ((tmp = OPENSSL_malloc(longN)) == NULL) + if ((tmp = malloc(longN)) == NULL) return NULL; BN_bn2bin(N,tmp) ; @@ -102,7 +102,7 @@ static BIGNUM *srp_Calc_k(BIGNUM *N, BIGNUM *g) /* use the zeros behind to pad on left */ EVP_DigestUpdate(&ctxt, tmp + longg, longN-longg); EVP_DigestUpdate(&ctxt, tmp, longg); - OPENSSL_free(tmp); + free(tmp); EVP_DigestFinal_ex(&ctxt, digest, NULL); EVP_MD_CTX_cleanup(&ctxt); @@ -123,7 +123,7 @@ BIGNUM *SRP_Calc_u(BIGNUM *A, BIGNUM *B, BIGNUM *N) longN= BN_num_bytes(N); - if ((cAB = OPENSSL_malloc(2*longN)) == NULL) + if ((cAB = malloc(2*longN)) == NULL) return NULL; memset(cAB, 0, longN); @@ -132,7 +132,7 @@ BIGNUM *SRP_Calc_u(BIGNUM *A, BIGNUM *B, BIGNUM *N) EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL); EVP_DigestUpdate(&ctxt, cAB + BN_bn2bin(A,cAB+longN), longN); EVP_DigestUpdate(&ctxt, cAB + BN_bn2bin(B,cAB+longN), longN); - OPENSSL_free(cAB); + free(cAB); EVP_DigestFinal_ex(&ctxt, cu, NULL); EVP_MD_CTX_cleanup(&ctxt); @@ -215,7 +215,7 @@ BIGNUM *SRP_Calc_x(BIGNUM *s, const char *user, const char *pass) (pass == NULL)) return NULL; - if ((cs = OPENSSL_malloc(BN_num_bytes(s))) == NULL) + if ((cs = malloc(BN_num_bytes(s))) == NULL) return NULL; EVP_MD_CTX_init(&ctxt); @@ -228,7 +228,7 @@ BIGNUM *SRP_Calc_x(BIGNUM *s, const char *user, const char *pass) EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL); BN_bn2bin(s,cs); EVP_DigestUpdate(&ctxt, cs, BN_num_bytes(s)); - OPENSSL_free(cs); + free(cs); EVP_DigestUpdate(&ctxt, dig, sizeof(dig)); EVP_DigestFinal_ex(&ctxt, dig, NULL); EVP_MD_CTX_cleanup(&ctxt); diff --git a/src/lib/libcrypto/srp/srp_vfy.c b/src/lib/libcrypto/srp/srp_vfy.c index 4a3d13edf6..de7dbe5bbd 100644 --- a/src/lib/libcrypto/srp/srp_vfy.c +++ b/src/lib/libcrypto/srp/srp_vfy.c @@ -185,14 +185,14 @@ static void SRP_user_pwd_free(SRP_user_pwd *user_pwd) return; BN_free(user_pwd->s); BN_clear_free(user_pwd->v); - OPENSSL_free(user_pwd->id); - OPENSSL_free(user_pwd->info); - OPENSSL_free(user_pwd); + free(user_pwd->id); + free(user_pwd->info); + free(user_pwd); } static SRP_user_pwd *SRP_user_pwd_new() { - SRP_user_pwd *ret = OPENSSL_malloc(sizeof(SRP_user_pwd)); + SRP_user_pwd *ret = malloc(sizeof(SRP_user_pwd)); if (ret == NULL) return NULL; ret->N = NULL; @@ -243,14 +243,14 @@ static int SRP_user_pwd_set_sv_BN(SRP_user_pwd *vinfo, BIGNUM *s, BIGNUM *v) SRP_VBASE *SRP_VBASE_new(char *seed_key) { - SRP_VBASE *vb = (SRP_VBASE *) OPENSSL_malloc(sizeof(SRP_VBASE)); + SRP_VBASE *vb = (SRP_VBASE *) malloc(sizeof(SRP_VBASE)); if (vb == NULL) return NULL; if (!(vb->users_pwd = sk_SRP_user_pwd_new_null()) || !(vb->gN_cache = sk_SRP_gN_cache_new_null())) { - OPENSSL_free(vb); + free(vb); return NULL; } vb->default_g = NULL; @@ -261,7 +261,7 @@ SRP_VBASE *SRP_VBASE_new(char *seed_key) { sk_SRP_user_pwd_free(vb->users_pwd); sk_SRP_gN_cache_free(vb->gN_cache); - OPENSSL_free(vb); + free(vb); return NULL; } return vb; @@ -272,8 +272,8 @@ int SRP_VBASE_free(SRP_VBASE *vb) { sk_SRP_user_pwd_pop_free(vb->users_pwd,SRP_user_pwd_free); sk_SRP_gN_cache_free(vb->gN_cache); - OPENSSL_free(vb->seed_key); - OPENSSL_free(vb); + free(vb->seed_key); + free(vb); return 0; } @@ -283,7 +283,7 @@ static SRP_gN_cache *SRP_gN_new_init(const char *ch) unsigned char tmp[MAX_LEN]; int len; - SRP_gN_cache *newgN = (SRP_gN_cache *)OPENSSL_malloc(sizeof(SRP_gN_cache)); + SRP_gN_cache *newgN = (SRP_gN_cache *)malloc(sizeof(SRP_gN_cache)); if (newgN == NULL) return NULL; @@ -294,9 +294,9 @@ static SRP_gN_cache *SRP_gN_new_init(const char *ch) if ((newgN->bn = BN_bin2bn(tmp, len, NULL))) return newgN; - OPENSSL_free(newgN->b64_bn); + free(newgN->b64_bn); err: - OPENSSL_free(newgN); + free(newgN); return NULL; } @@ -305,9 +305,9 @@ static void SRP_gN_free(SRP_gN_cache *gN_cache) { if (gN_cache == NULL) return; - OPENSSL_free(gN_cache->b64_bn); + free(gN_cache->b64_bn); BN_free(gN_cache->bn); - OPENSSL_free(gN_cache); + free(gN_cache); } static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab) @@ -395,7 +395,7 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file) { /*we add this couple in the internal Stack */ - if ((gN = (SRP_gN *)OPENSSL_malloc(sizeof(SRP_gN))) == NULL) + if ((gN = (SRP_gN *)malloc(sizeof(SRP_gN))) == NULL) goto err; if (!(gN->id = BUF_strdup(pp[DB_srpid])) @@ -456,8 +456,8 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file) if (gN != NULL) { - OPENSSL_free(gN->id); - OPENSSL_free(gN); + free(gN->id); + free(gN); } SRP_user_pwd_free(user_pwd); @@ -573,7 +573,7 @@ char *SRP_create_verifier(const char *user, const char *pass, char **salt, if(!SRP_create_verifier_BN(user, pass, &s, &v, N_bn, g_bn)) goto err; BN_bn2bin(v,tmp); - if (((vf = OPENSSL_malloc(BN_num_bytes(v)*2)) == NULL)) + if (((vf = malloc(BN_num_bytes(v)*2)) == NULL)) goto err; t_tob64(vf, tmp, BN_num_bytes(v)); @@ -582,9 +582,9 @@ char *SRP_create_verifier(const char *user, const char *pass, char **salt, { char *tmp_salt; - if ((tmp_salt = OPENSSL_malloc(SRP_RANDOM_SALT_LEN * 2)) == NULL) + if ((tmp_salt = malloc(SRP_RANDOM_SALT_LEN * 2)) == NULL) { - OPENSSL_free(vf); + free(vf); goto err; } t_tob64(tmp_salt, tmp2, SRP_RANDOM_SALT_LEN); -- cgit v1.2.3-55-g6feb