diff options
author | Richard Levitte <levitte@openssl.org> | 2000-06-01 22:19:21 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2000-06-01 22:19:21 +0000 |
commit | 26a3a48d65c7464b400ec1de439994d7f0d25fed (patch) | |
tree | 91abb7d351b174e58f60e5353b731b916eaf0c5c /crypto/x509 | |
parent | de42b6a7a82be33d2976ab605e74d7bc95b71447 (diff) |
There have been a number of complaints from a number of sources that names
like Malloc, Realloc and especially Free conflict with already existing names
on some operating systems or other packages. That is reason enough to change
the names of the OpenSSL memory allocation macros to something that has a
better chance of being unique, like prepending them with OPENSSL_.
This change includes all the name changes needed throughout all C files.
Diffstat (limited to 'crypto/x509')
-rw-r--r-- | crypto/x509/by_dir.c | 22 | ||||
-rw-r--r-- | crypto/x509/x509_cmp.c | 4 | ||||
-rw-r--r-- | crypto/x509/x509_lu.c | 16 | ||||
-rw-r--r-- | crypto/x509/x509_obj.c | 4 | ||||
-rw-r--r-- | crypto/x509/x509_req.c | 6 | ||||
-rw-r--r-- | crypto/x509/x509_trs.c | 10 | ||||
-rw-r--r-- | crypto/x509/x509_vfy.c | 8 | ||||
-rw-r--r-- | crypto/x509/x509spki.c | 12 |
8 files changed, 41 insertions, 41 deletions
diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c index 14d12c56bd..c5920cc7dd 100644 --- a/crypto/x509/by_dir.c +++ b/crypto/x509/by_dir.c @@ -146,11 +146,11 @@ static int new_dir(X509_LOOKUP *lu) { BY_DIR *a; - if ((a=(BY_DIR *)Malloc(sizeof(BY_DIR))) == NULL) + if ((a=(BY_DIR *)OPENSSL_malloc(sizeof(BY_DIR))) == NULL) return(0); if ((a->buffer=BUF_MEM_new()) == NULL) { - Free(a); + OPENSSL_free(a); return(0); } a->num_dirs=0; @@ -168,11 +168,11 @@ static void free_dir(X509_LOOKUP *lu) a=(BY_DIR *)lu->method_data; for (i=0; i<a->num_dirs; i++) - if (a->dirs[i] != NULL) Free(a->dirs[i]); - if (a->dirs != NULL) Free(a->dirs); - if (a->dirs_type != NULL) Free(a->dirs_type); + if (a->dirs[i] != NULL) OPENSSL_free(a->dirs[i]); + if (a->dirs != NULL) OPENSSL_free(a->dirs); + if (a->dirs_type != NULL) OPENSSL_free(a->dirs_type); if (a->buffer != NULL) BUF_MEM_free(a->buffer); - Free(a); + OPENSSL_free(a); } static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) @@ -204,9 +204,9 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) if (ctx->num_dirs_alloced < (ctx->num_dirs+1)) { ctx->num_dirs_alloced+=10; - pp=(char **)Malloc(ctx->num_dirs_alloced* + pp=(char **)OPENSSL_malloc(ctx->num_dirs_alloced* sizeof(char *)); - ip=(int *)Malloc(ctx->num_dirs_alloced* + ip=(int *)OPENSSL_malloc(ctx->num_dirs_alloced* sizeof(int)); if ((pp == NULL) || (ip == NULL)) { @@ -218,14 +218,14 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) memcpy(ip,ctx->dirs_type,(ctx->num_dirs_alloced-10)* sizeof(int)); if (ctx->dirs != NULL) - Free(ctx->dirs); + OPENSSL_free(ctx->dirs); if (ctx->dirs_type != NULL) - Free(ctx->dirs_type); + OPENSSL_free(ctx->dirs_type); ctx->dirs=pp; ctx->dirs_type=ip; } ctx->dirs_type[ctx->num_dirs]=type; - ctx->dirs[ctx->num_dirs]=(char *)Malloc((unsigned int)len+1); + ctx->dirs[ctx->num_dirs]=(char *)OPENSSL_malloc((unsigned int)len+1); if (ctx->dirs[ctx->num_dirs] == NULL) return(0); strncpy(ctx->dirs[ctx->num_dirs],ss,(unsigned int)len); ctx->dirs[ctx->num_dirs][len]='\0'; diff --git a/crypto/x509/x509_cmp.c b/crypto/x509/x509_cmp.c index 0452b025b9..b147d573d2 100644 --- a/crypto/x509/x509_cmp.c +++ b/crypto/x509/x509_cmp.c @@ -204,14 +204,14 @@ unsigned long X509_NAME_hash(X509_NAME *x) i=i2d_X509_NAME(x,NULL); if (i > sizeof(str)) - p=Malloc(i); + p=OPENSSL_malloc(i); else p=str; pp=p; i2d_X509_NAME(x,&pp); MD5((unsigned char *)p,i,&(md[0])); - if (p != str) Free(p); + if (p != str) OPENSSL_free(p); ret=( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)| ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L) diff --git a/crypto/x509/x509_lu.c b/crypto/x509/x509_lu.c index a20006d67e..5e5458568f 100644 --- a/crypto/x509/x509_lu.c +++ b/crypto/x509/x509_lu.c @@ -68,7 +68,7 @@ X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method) { X509_LOOKUP *ret; - ret=(X509_LOOKUP *)Malloc(sizeof(X509_LOOKUP)); + ret=(X509_LOOKUP *)OPENSSL_malloc(sizeof(X509_LOOKUP)); if (ret == NULL) return(NULL); ret->init=0; @@ -78,7 +78,7 @@ X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method) ret->store_ctx=NULL; if ((method->new_item != NULL) && !method->new_item(ret)) { - Free(ret); + OPENSSL_free(ret); return(NULL); } return(ret); @@ -90,7 +90,7 @@ void X509_LOOKUP_free(X509_LOOKUP *ctx) if ( (ctx->method != NULL) && (ctx->method->free != NULL)) ctx->method->free(ctx); - Free(ctx); + OPENSSL_free(ctx); } int X509_LOOKUP_init(X509_LOOKUP *ctx) @@ -197,7 +197,7 @@ X509_STORE *X509_STORE_new(void) { X509_STORE *ret; - if ((ret=(X509_STORE *)Malloc(sizeof(X509_STORE))) == NULL) + if ((ret=(X509_STORE *)OPENSSL_malloc(sizeof(X509_STORE))) == NULL) return(NULL); ret->certs=lh_new(x509_object_hash,x509_object_cmp); ret->cache=1; @@ -223,7 +223,7 @@ static void cleanup(X509_OBJECT *a) else abort(); - Free(a); + OPENSSL_free(a); } void X509_STORE_free(X509_STORE *vfy) @@ -247,7 +247,7 @@ void X509_STORE_free(X509_STORE *vfy) CRYPTO_free_ex_data(x509_store_meth,vfy,&vfy->ex_data); lh_doall(vfy->certs,cleanup); lh_free(vfy->certs); - Free(vfy); + OPENSSL_free(vfy); } X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m) @@ -384,7 +384,7 @@ X509_OBJECT *X509_OBJECT_retrieve_by_subject(LHASH *h, int type, X509_STORE_CTX *X509_STORE_CTX_new(void) { X509_STORE_CTX *ctx; - ctx = (X509_STORE_CTX *)Malloc(sizeof(X509_STORE_CTX)); + ctx = (X509_STORE_CTX *)OPENSSL_malloc(sizeof(X509_STORE_CTX)); if(ctx) memset(ctx, 0, sizeof(X509_STORE_CTX)); return ctx; } @@ -392,7 +392,7 @@ X509_STORE_CTX *X509_STORE_CTX_new(void) void X509_STORE_CTX_free(X509_STORE_CTX *ctx) { X509_STORE_CTX_cleanup(ctx); - Free(ctx); + OPENSSL_free(ctx); } void X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, diff --git a/crypto/x509/x509_obj.c b/crypto/x509/x509_obj.c index 691b71f031..6a3ba8eb15 100644 --- a/crypto/x509/x509_obj.c +++ b/crypto/x509/x509_obj.c @@ -91,7 +91,7 @@ int i; if(b) { buf=b->data; - Free(b); + OPENSSL_free(b); } strncpy(buf,"NO X509_NAME",len); return buf; @@ -210,7 +210,7 @@ int i; if (b != NULL) { p=b->data; - Free(b); + OPENSSL_free(b); } else p=buf; diff --git a/crypto/x509/x509_req.c b/crypto/x509/x509_req.c index baef8790eb..7eca1bd57a 100644 --- a/crypto/x509/x509_req.c +++ b/crypto/x509/x509_req.c @@ -83,7 +83,7 @@ X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md) ri=ret->req_info; ri->version->length=1; - ri->version->data=(unsigned char *)Malloc(1); + ri->version->data=(unsigned char *)OPENSSL_malloc(1); if (ri->version->data == NULL) goto err; ri->version->data[0]=0; /* version == 0 */ @@ -188,7 +188,7 @@ int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, /* Generate encoding of extensions */ len = i2d_ASN1_SET_OF_X509_EXTENSION(exts, NULL, i2d_X509_EXTENSION, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, IS_SEQUENCE); - if(!(p = Malloc(len))) goto err; + if(!(p = OPENSSL_malloc(len))) goto err; q = p; i2d_ASN1_SET_OF_X509_EXTENSION(exts, &q, i2d_X509_EXTENSION, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, IS_SEQUENCE); @@ -204,7 +204,7 @@ int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, if(!sk_X509_ATTRIBUTE_push(req->req_info->attributes, attr)) goto err; return 1; err: - if(p) Free(p); + if(p) OPENSSL_free(p); X509_ATTRIBUTE_free(attr); ASN1_TYPE_free(at); return 0; diff --git a/crypto/x509/x509_trs.c b/crypto/x509/x509_trs.c index 8637e56d9c..a7b1543461 100644 --- a/crypto/x509/x509_trs.c +++ b/crypto/x509/x509_trs.c @@ -154,15 +154,15 @@ int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int), idx = X509_TRUST_get_by_id(id); /* Need a new entry */ if(idx == -1) { - if(!(trtmp = Malloc(sizeof(X509_TRUST)))) { + if(!(trtmp = OPENSSL_malloc(sizeof(X509_TRUST)))) { X509err(X509_F_X509_TRUST_ADD,ERR_R_MALLOC_FAILURE); return 0; } trtmp->flags = X509_TRUST_DYNAMIC; } else trtmp = X509_TRUST_get0(idx); - /* Free existing name if dynamic */ - if(trtmp->flags & X509_TRUST_DYNAMIC_NAME) Free(trtmp->name); + /* OPENSSL_free existing name if dynamic */ + if(trtmp->flags & X509_TRUST_DYNAMIC_NAME) OPENSSL_free(trtmp->name); /* dup supplied name */ if(!(trtmp->name = BUF_strdup(name))) { X509err(X509_F_X509_TRUST_ADD,ERR_R_MALLOC_FAILURE); @@ -198,8 +198,8 @@ static void trtable_free(X509_TRUST *p) if (p->flags & X509_TRUST_DYNAMIC) { if (p->flags & X509_TRUST_DYNAMIC_NAME) - Free(p->name); - Free(p); + OPENSSL_free(p->name); + OPENSSL_free(p); } } diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c index 3ddb2303d3..e9311d5ea8 100644 --- a/crypto/x509/x509_vfy.c +++ b/crypto/x509/x509_vfy.c @@ -612,7 +612,7 @@ int X509_STORE_add_cert(X509_STORE *ctx, X509 *x) int ret=1; if (x == NULL) return(0); - obj=(X509_OBJECT *)Malloc(sizeof(X509_OBJECT)); + obj=(X509_OBJECT *)OPENSSL_malloc(sizeof(X509_OBJECT)); if (obj == NULL) { X509err(X509_F_X509_STORE_ADD_CERT,ERR_R_MALLOC_FAILURE); @@ -630,7 +630,7 @@ int X509_STORE_add_cert(X509_STORE *ctx, X509 *x) { /* oops, put it back */ lh_delete(ctx->certs,obj); X509_OBJECT_free_contents(obj); - Free(obj); + OPENSSL_free(obj); lh_insert(ctx->certs,r); X509err(X509_F_X509_STORE_ADD_CERT,X509_R_CERT_ALREADY_IN_HASH_TABLE); ret=0; @@ -647,7 +647,7 @@ int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x) int ret=1; if (x == NULL) return(0); - obj=(X509_OBJECT *)Malloc(sizeof(X509_OBJECT)); + obj=(X509_OBJECT *)OPENSSL_malloc(sizeof(X509_OBJECT)); if (obj == NULL) { X509err(X509_F_X509_STORE_ADD_CRL,ERR_R_MALLOC_FAILURE); @@ -665,7 +665,7 @@ int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x) { /* oops, put it back */ lh_delete(ctx->certs,obj); X509_OBJECT_free_contents(obj); - Free(obj); + OPENSSL_free(obj); lh_insert(ctx->certs,r); X509err(X509_F_X509_STORE_ADD_CRL,X509_R_CERT_ALREADY_IN_HASH_TABLE); ret=0; diff --git a/crypto/x509/x509spki.c b/crypto/x509/x509spki.c index b35c3f92e7..fd0a534d88 100644 --- a/crypto/x509/x509spki.c +++ b/crypto/x509/x509spki.c @@ -82,7 +82,7 @@ NETSCAPE_SPKI * NETSCAPE_SPKI_b64_decode(const char *str, int len) int spki_len; NETSCAPE_SPKI *spki; if(len <= 0) len = strlen(str); - if (!(spki_der = Malloc(len + 1))) { + if (!(spki_der = OPENSSL_malloc(len + 1))) { X509err(X509_F_NETSCAPE_SPKI_B64_DECODE, ERR_R_MALLOC_FAILURE); return NULL; } @@ -90,12 +90,12 @@ NETSCAPE_SPKI * NETSCAPE_SPKI_b64_decode(const char *str, int len) if(spki_len < 0) { X509err(X509_F_NETSCAPE_SPKI_B64_DECODE, X509_R_BASE64_DECODE_ERROR); - Free(spki_der); + OPENSSL_free(spki_der); return NULL; } p = spki_der; spki = d2i_NETSCAPE_SPKI(NULL, &p, spki_len); - Free(spki_der); + OPENSSL_free(spki_der); return spki; } @@ -107,8 +107,8 @@ char * NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *spki) char *b64_str; int der_len; der_len = i2d_NETSCAPE_SPKI(spki, NULL); - der_spki = Malloc(der_len); - b64_str = Malloc(der_len * 2); + der_spki = OPENSSL_malloc(der_len); + b64_str = OPENSSL_malloc(der_len * 2); if(!der_spki || !b64_str) { X509err(X509_F_NETSCAPE_SPKI_B64_ENCODE, ERR_R_MALLOC_FAILURE); return NULL; @@ -116,6 +116,6 @@ char * NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *spki) p = der_spki; i2d_NETSCAPE_SPKI(spki, &p); EVP_EncodeBlock((unsigned char *)b64_str, der_spki, der_len); - Free(der_spki); + OPENSSL_free(der_spki); return b64_str; } |