aboutsummaryrefslogtreecommitdiff
path: root/crypto/pkcs12
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2000-06-01 22:19:21 +0000
committerRichard Levitte <levitte@openssl.org>2000-06-01 22:19:21 +0000
commit26a3a48d65c7464b400ec1de439994d7f0d25fed (patch)
tree91abb7d351b174e58f60e5353b731b916eaf0c5c /crypto/pkcs12
parentde42b6a7a82be33d2976ab605e74d7bc95b71447 (diff)
downloadopenssl-26a3a48d65c7464b400ec1de439994d7f0d25fed.zip
openssl-26a3a48d65c7464b400ec1de439994d7f0d25fed.tar.gz
openssl-26a3a48d65c7464b400ec1de439994d7f0d25fed.tar.bz2
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/pkcs12')
-rw-r--r--crypto/pkcs12/p12_attr.c4
-rw-r--r--crypto/pkcs12/p12_bags.c2
-rw-r--r--crypto/pkcs12/p12_decr.c14
-rw-r--r--crypto/pkcs12/p12_key.c18
-rw-r--r--crypto/pkcs12/p12_lib.c2
-rw-r--r--crypto/pkcs12/p12_mac.c2
-rw-r--r--crypto/pkcs12/p12_mutl.c2
-rw-r--r--crypto/pkcs12/p12_sbag.c2
-rw-r--r--crypto/pkcs12/p12_utl.c4
9 files changed, 25 insertions, 25 deletions
diff --git a/crypto/pkcs12/p12_attr.c b/crypto/pkcs12/p12_attr.c
index f559351..b370c9c 100644
--- a/crypto/pkcs12/p12_attr.c
+++ b/crypto/pkcs12/p12_attr.c
@@ -157,7 +157,7 @@ int PKCS12_add_friendlyname_asc (PKCS12_SAFEBAG *bag, const char *name,
return 0;
}
ret = PKCS12_add_friendlyname_uni (bag, uniname, unilen);
- Free(uniname);
+ OPENSSL_free(uniname);
return ret;
}
@@ -181,7 +181,7 @@ int PKCS12_add_friendlyname_uni (PKCS12_SAFEBAG *bag,
ERR_R_MALLOC_FAILURE);
return 0;
}
- if (!(bmp->data = Malloc (namelen))) {
+ if (!(bmp->data = OPENSSL_malloc (namelen))) {
PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI,
ERR_R_MALLOC_FAILURE);
return 0;
diff --git a/crypto/pkcs12/p12_bags.c b/crypto/pkcs12/p12_bags.c
index c358b06..56547ef 100644
--- a/crypto/pkcs12/p12_bags.c
+++ b/crypto/pkcs12/p12_bags.c
@@ -188,5 +188,5 @@ void PKCS12_BAGS_free (PKCS12_BAGS *a)
}
ASN1_OBJECT_free (a->type);
- Free (a);
+ OPENSSL_free (a);
}
diff --git a/crypto/pkcs12/p12_decr.c b/crypto/pkcs12/p12_decr.c
index 778954b..9ba90bb 100644
--- a/crypto/pkcs12/p12_decr.c
+++ b/crypto/pkcs12/p12_decr.c
@@ -65,7 +65,7 @@
/* Encrypt/Decrypt a buffer based on password and algor, result in a
- * Malloc'ed buffer
+ * OPENSSL_malloc'ed buffer
*/
unsigned char * PKCS12_pbe_crypt (X509_ALGOR *algor, const char *pass,
@@ -83,7 +83,7 @@ unsigned char * PKCS12_pbe_crypt (X509_ALGOR *algor, const char *pass,
return NULL;
}
- if(!(out = Malloc (inlen + EVP_CIPHER_CTX_block_size(&ctx)))) {
+ if(!(out = OPENSSL_malloc (inlen + EVP_CIPHER_CTX_block_size(&ctx)))) {
PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,ERR_R_MALLOC_FAILURE);
return NULL;
}
@@ -91,7 +91,7 @@ unsigned char * PKCS12_pbe_crypt (X509_ALGOR *algor, const char *pass,
EVP_CipherUpdate (&ctx, out, &i, in, inlen);
outlen = i;
if(!EVP_CipherFinal (&ctx, out + i, &i)) {
- Free (out);
+ OPENSSL_free (out);
PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,PKCS12_R_PKCS12_CIPHERFINAL_ERROR);
return NULL;
}
@@ -139,7 +139,7 @@ char * PKCS12_decrypt_d2i (X509_ALGOR *algor, char * (*d2i)(),
else ret = d2i(NULL, &p, outlen);
if (seq & 2) memset(out, 0, outlen);
if(!ret) PKCS12err(PKCS12_F_PKCS12_DECRYPT_D2I,PKCS12_R_DECODE_ERROR);
- Free (out);
+ OPENSSL_free (out);
return ret;
}
@@ -166,7 +166,7 @@ ASN1_OCTET_STRING *PKCS12_i2d_encrypt (X509_ALGOR *algor, int (*i2d)(),
PKCS12err(PKCS12_F_PKCS12_I2D_ENCRYPT,PKCS12_R_ENCODE_ERROR);
return NULL;
}
- if (!(in = Malloc (inlen))) {
+ if (!(in = OPENSSL_malloc (inlen))) {
PKCS12err(PKCS12_F_PKCS12_I2D_ENCRYPT,ERR_R_MALLOC_FAILURE);
return NULL;
}
@@ -177,10 +177,10 @@ ASN1_OCTET_STRING *PKCS12_i2d_encrypt (X509_ALGOR *algor, int (*i2d)(),
if (!PKCS12_pbe_crypt (algor, pass, passlen, in, inlen, &oct->data,
&oct->length, 1)) {
PKCS12err(PKCS12_F_PKCS12_I2D_ENCRYPT,PKCS12_R_ENCRYPT_ERROR);
- Free(in);
+ OPENSSL_free(in);
return NULL;
}
- Free (in);
+ OPENSSL_free (in);
return oct;
}
diff --git a/crypto/pkcs12/p12_key.c b/crypto/pkcs12/p12_key.c
index 743b5bd..b042dcf 100644
--- a/crypto/pkcs12/p12_key.c
+++ b/crypto/pkcs12/p12_key.c
@@ -92,7 +92,7 @@ int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt,
id, iter, n, out, md_type);
if(unipass) {
memset(unipass, 0, uniplen); /* Clear password from memory */
- Free(unipass);
+ OPENSSL_free(unipass);
}
return ret;
}
@@ -128,14 +128,14 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
#endif
v = EVP_MD_block_size (md_type);
u = EVP_MD_size (md_type);
- D = Malloc (v);
- Ai = Malloc (u);
- B = Malloc (v + 1);
+ D = OPENSSL_malloc (v);
+ Ai = OPENSSL_malloc (u);
+ B = OPENSSL_malloc (v + 1);
Slen = v * ((saltlen+v-1)/v);
if(passlen) Plen = v * ((passlen+v-1)/v);
else Plen = 0;
Ilen = Slen + Plen;
- I = Malloc (Ilen);
+ I = OPENSSL_malloc (Ilen);
Ij = BN_new();
Bpl1 = BN_new();
if (!D || !Ai || !B || !I || !Ij || !Bpl1) {
@@ -158,10 +158,10 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
}
memcpy (out, Ai, min (n, u));
if (u >= n) {
- Free (Ai);
- Free (B);
- Free (D);
- Free (I);
+ OPENSSL_free (Ai);
+ OPENSSL_free (B);
+ OPENSSL_free (D);
+ OPENSSL_free (I);
BN_free (Ij);
BN_free (Bpl1);
#ifdef DEBUG_KEYGEN
diff --git a/crypto/pkcs12/p12_lib.c b/crypto/pkcs12/p12_lib.c
index 7ca9c14..7d464e3 100644
--- a/crypto/pkcs12/p12_lib.c
+++ b/crypto/pkcs12/p12_lib.c
@@ -107,5 +107,5 @@ void PKCS12_free (PKCS12 *a)
M_ASN1_INTEGER_free(a->version);
PKCS12_MAC_DATA_free (a->mac);
PKCS7_free (a->authsafes);
- Free (a);
+ OPENSSL_free (a);
}
diff --git a/crypto/pkcs12/p12_mac.c b/crypto/pkcs12/p12_mac.c
index f5ab0d6..fbd1eca 100644
--- a/crypto/pkcs12/p12_mac.c
+++ b/crypto/pkcs12/p12_mac.c
@@ -106,5 +106,5 @@ void PKCS12_MAC_DATA_free (PKCS12_MAC_DATA *a)
X509_SIG_free (a->dinfo);
M_ASN1_OCTET_STRING_free(a->salt);
M_ASN1_INTEGER_free(a->iter);
- Free (a);
+ OPENSSL_free (a);
}
diff --git a/crypto/pkcs12/p12_mutl.c b/crypto/pkcs12/p12_mutl.c
index a335a7b..13d866d 100644
--- a/crypto/pkcs12/p12_mutl.c
+++ b/crypto/pkcs12/p12_mutl.c
@@ -149,7 +149,7 @@ int PKCS12_setup_mac (PKCS12 *p12, int iter, unsigned char *salt, int saltlen,
}
if (!saltlen) saltlen = PKCS12_SALT_LEN;
p12->mac->salt->length = saltlen;
- if (!(p12->mac->salt->data = Malloc (saltlen))) {
+ if (!(p12->mac->salt->data = OPENSSL_malloc (saltlen))) {
PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE);
return 0;
}
diff --git a/crypto/pkcs12/p12_sbag.c b/crypto/pkcs12/p12_sbag.c
index 6ae2096..64ac32e 100644
--- a/crypto/pkcs12/p12_sbag.c
+++ b/crypto/pkcs12/p12_sbag.c
@@ -226,7 +226,7 @@ void PKCS12_SAFEBAG_free (PKCS12_SAFEBAG *a)
ASN1_OBJECT_free (a->type);
sk_X509_ATTRIBUTE_pop_free (a->attrib, X509_ATTRIBUTE_free);
- Free (a);
+ OPENSSL_free (a);
}
IMPLEMENT_STACK_OF(PKCS12_SAFEBAG)
diff --git a/crypto/pkcs12/p12_utl.c b/crypto/pkcs12/p12_utl.c
index 2adcbc9..17f41b4 100644
--- a/crypto/pkcs12/p12_utl.c
+++ b/crypto/pkcs12/p12_utl.c
@@ -67,7 +67,7 @@ unsigned char *asc2uni (const char *asc, unsigned char **uni, int *unilen)
int ulen, i;
unsigned char *unitmp;
ulen = strlen(asc)*2 + 2;
- if (!(unitmp = Malloc (ulen))) return NULL;
+ if (!(unitmp = OPENSSL_malloc (ulen))) return NULL;
for (i = 0; i < ulen; i+=2) {
unitmp[i] = 0;
unitmp[i + 1] = asc[i>>1];
@@ -85,7 +85,7 @@ char *uni2asc (unsigned char *uni, int unilen)
/* If no terminating zero allow for one */
if (uni[unilen - 1]) asclen++;
uni++;
- if (!(asctmp = Malloc (asclen))) return NULL;
+ if (!(asctmp = OPENSSL_malloc (asclen))) return NULL;
for (i = 0; i < unilen; i+=2) asctmp[i>>1] = uni[i];
asctmp[asclen - 1] = 0;
return asctmp;