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.
This commit is contained in:
12
apps/apps.c
12
apps/apps.c
@@ -91,8 +91,8 @@ int args_from_file(char *file, int *argc, char **argv[])
|
||||
*argv=NULL;
|
||||
|
||||
len=(unsigned int)stbuf.st_size;
|
||||
if (buf != NULL) Free(buf);
|
||||
buf=(char *)Malloc(len+1);
|
||||
if (buf != NULL) OPENSSL_free(buf);
|
||||
buf=(char *)OPENSSL_malloc(len+1);
|
||||
if (buf == NULL) return(0);
|
||||
|
||||
len=fread(buf,1,len,fp);
|
||||
@@ -102,8 +102,8 @@ int args_from_file(char *file, int *argc, char **argv[])
|
||||
i=0;
|
||||
for (p=buf; *p; p++)
|
||||
if (*p == '\n') i++;
|
||||
if (arg != NULL) Free(arg);
|
||||
arg=(char **)Malloc(sizeof(char *)*(i*2));
|
||||
if (arg != NULL) OPENSSL_free(arg);
|
||||
arg=(char **)OPENSSL_malloc(sizeof(char *)*(i*2));
|
||||
|
||||
*argv=arg;
|
||||
num=0;
|
||||
@@ -266,7 +266,7 @@ int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[])
|
||||
if (arg->count == 0)
|
||||
{
|
||||
arg->count=20;
|
||||
arg->data=(char **)Malloc(sizeof(char *)*arg->count);
|
||||
arg->data=(char **)OPENSSL_malloc(sizeof(char *)*arg->count);
|
||||
}
|
||||
for (i=0; i<arg->count; i++)
|
||||
arg->data[i]=NULL;
|
||||
@@ -285,7 +285,7 @@ int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[])
|
||||
if (num >= arg->count)
|
||||
{
|
||||
arg->count+=20;
|
||||
arg->data=(char **)Realloc(arg->data,
|
||||
arg->data=(char **)OPENSSL_realloc(arg->data,
|
||||
sizeof(char *)*arg->count);
|
||||
if (argc == 0) return(0);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ int MAIN(int argc, char **argv)
|
||||
argv++;
|
||||
if ((osk=sk_new_null()) == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"Malloc failure\n");
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
goto end;
|
||||
}
|
||||
while (argc >= 1)
|
||||
|
||||
50
apps/ca.c
50
apps/ca.c
@@ -808,7 +808,7 @@ bad:
|
||||
{
|
||||
if ((f=BN_bn2hex(serial)) == NULL) goto err;
|
||||
BIO_printf(bio_err,"next serial number is %s\n",f);
|
||||
Free(f);
|
||||
OPENSSL_free(f);
|
||||
}
|
||||
|
||||
if ((attribs=CONF_get_section(conf,policy)) == NULL)
|
||||
@@ -819,7 +819,7 @@ bad:
|
||||
|
||||
if ((cert_sk=sk_X509_new_null()) == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"Malloc failure\n");
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
if (spkac_file != NULL)
|
||||
@@ -836,7 +836,7 @@ bad:
|
||||
if (!BN_add_word(serial,1)) goto err;
|
||||
if (!sk_X509_push(cert_sk,x))
|
||||
{
|
||||
BIO_printf(bio_err,"Malloc failure\n");
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
if (outfile)
|
||||
@@ -860,7 +860,7 @@ bad:
|
||||
if (!BN_add_word(serial,1)) goto err;
|
||||
if (!sk_X509_push(cert_sk,x))
|
||||
{
|
||||
BIO_printf(bio_err,"Malloc failure\n");
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@@ -879,7 +879,7 @@ bad:
|
||||
if (!BN_add_word(serial,1)) goto err;
|
||||
if (!sk_X509_push(cert_sk,x))
|
||||
{
|
||||
BIO_printf(bio_err,"Malloc failure\n");
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@@ -898,7 +898,7 @@ bad:
|
||||
if (!BN_add_word(serial,1)) goto err;
|
||||
if (!sk_X509_push(cert_sk,x))
|
||||
{
|
||||
BIO_printf(bio_err,"Malloc failure\n");
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@@ -1580,7 +1580,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
|
||||
/* Ok, now we check the 'policy' stuff. */
|
||||
if ((subject=X509_NAME_new()) == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"Malloc failure\n");
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -1678,7 +1678,7 @@ again2:
|
||||
{
|
||||
if (push != NULL)
|
||||
X509_NAME_ENTRY_free(push);
|
||||
BIO_printf(bio_err,"Malloc failure\n");
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@@ -1700,7 +1700,7 @@ again2:
|
||||
row[DB_serial]=BN_bn2hex(serial);
|
||||
if ((row[DB_name] == NULL) || (row[DB_serial] == NULL))
|
||||
{
|
||||
BIO_printf(bio_err,"Malloc failure\n");
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -1841,32 +1841,32 @@ again2:
|
||||
goto err;
|
||||
|
||||
/* We now just add it to the database */
|
||||
row[DB_type]=(char *)Malloc(2);
|
||||
row[DB_type]=(char *)OPENSSL_malloc(2);
|
||||
|
||||
tm=X509_get_notAfter(ret);
|
||||
row[DB_exp_date]=(char *)Malloc(tm->length+1);
|
||||
row[DB_exp_date]=(char *)OPENSSL_malloc(tm->length+1);
|
||||
memcpy(row[DB_exp_date],tm->data,tm->length);
|
||||
row[DB_exp_date][tm->length]='\0';
|
||||
|
||||
row[DB_rev_date]=NULL;
|
||||
|
||||
/* row[DB_serial] done already */
|
||||
row[DB_file]=(char *)Malloc(8);
|
||||
row[DB_file]=(char *)OPENSSL_malloc(8);
|
||||
/* row[DB_name] done already */
|
||||
|
||||
if ((row[DB_type] == NULL) || (row[DB_exp_date] == NULL) ||
|
||||
(row[DB_file] == NULL))
|
||||
{
|
||||
BIO_printf(bio_err,"Malloc failure\n");
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
strcpy(row[DB_file],"unknown");
|
||||
row[DB_type][0]='V';
|
||||
row[DB_type][1]='\0';
|
||||
|
||||
if ((irow=(char **)Malloc(sizeof(char *)*(DB_NUMBER+1))) == NULL)
|
||||
if ((irow=(char **)OPENSSL_malloc(sizeof(char *)*(DB_NUMBER+1))) == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"Malloc failure\n");
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -1886,7 +1886,7 @@ again2:
|
||||
ok=1;
|
||||
err:
|
||||
for (i=0; i<DB_NUMBER; i++)
|
||||
if (row[i] != NULL) Free(row[i]);
|
||||
if (row[i] != NULL) OPENSSL_free(row[i]);
|
||||
|
||||
if (CAname != NULL)
|
||||
X509_NAME_free(CAname);
|
||||
@@ -2137,7 +2137,7 @@ static int do_revoke(X509 *x509, TXT_DB *db)
|
||||
BN_free(bn);
|
||||
if ((row[DB_name] == NULL) || (row[DB_serial] == NULL))
|
||||
{
|
||||
BIO_printf(bio_err,"Malloc failure\n");
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
/* We have to lookup by serial number because name lookup
|
||||
@@ -2149,33 +2149,33 @@ static int do_revoke(X509 *x509, TXT_DB *db)
|
||||
BIO_printf(bio_err,"Adding Entry to DB for %s\n", row[DB_name]);
|
||||
|
||||
/* We now just add it to the database */
|
||||
row[DB_type]=(char *)Malloc(2);
|
||||
row[DB_type]=(char *)OPENSSL_malloc(2);
|
||||
|
||||
tm=X509_get_notAfter(x509);
|
||||
row[DB_exp_date]=(char *)Malloc(tm->length+1);
|
||||
row[DB_exp_date]=(char *)OPENSSL_malloc(tm->length+1);
|
||||
memcpy(row[DB_exp_date],tm->data,tm->length);
|
||||
row[DB_exp_date][tm->length]='\0';
|
||||
|
||||
row[DB_rev_date]=NULL;
|
||||
|
||||
/* row[DB_serial] done already */
|
||||
row[DB_file]=(char *)Malloc(8);
|
||||
row[DB_file]=(char *)OPENSSL_malloc(8);
|
||||
|
||||
/* row[DB_name] done already */
|
||||
|
||||
if ((row[DB_type] == NULL) || (row[DB_exp_date] == NULL) ||
|
||||
(row[DB_file] == NULL))
|
||||
{
|
||||
BIO_printf(bio_err,"Malloc failure\n");
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
strcpy(row[DB_file],"unknown");
|
||||
row[DB_type][0]='V';
|
||||
row[DB_type][1]='\0';
|
||||
|
||||
if ((irow=(char **)Malloc(sizeof(char *)*(DB_NUMBER+1))) == NULL)
|
||||
if ((irow=(char **)OPENSSL_malloc(sizeof(char *)*(DB_NUMBER+1))) == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"Malloc failure\n");
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -2218,7 +2218,7 @@ static int do_revoke(X509 *x509, TXT_DB *db)
|
||||
revtm=X509_gmtime_adj(revtm,0);
|
||||
rrow[DB_type][0]='R';
|
||||
rrow[DB_type][1]='\0';
|
||||
rrow[DB_rev_date]=(char *)Malloc(revtm->length+1);
|
||||
rrow[DB_rev_date]=(char *)OPENSSL_malloc(revtm->length+1);
|
||||
memcpy(rrow[DB_rev_date],revtm->data,revtm->length);
|
||||
rrow[DB_rev_date][revtm->length]='\0';
|
||||
ASN1_UTCTIME_free(revtm);
|
||||
@@ -2228,7 +2228,7 @@ err:
|
||||
for (i=0; i<DB_NUMBER; i++)
|
||||
{
|
||||
if (row[i] != NULL)
|
||||
Free(row[i]);
|
||||
OPENSSL_free(row[i]);
|
||||
}
|
||||
return(ok);
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ bad:
|
||||
if (crl != NULL)
|
||||
{
|
||||
sk_X509_CRL_push(crl_stack,crl);
|
||||
crl=NULL; /* now part of p7 for Freeing */
|
||||
crl=NULL; /* now part of p7 for OPENSSL_freeing */
|
||||
}
|
||||
|
||||
if ((cert_stack=sk_X509_new(NULL)) == NULL) goto end;
|
||||
@@ -327,7 +327,7 @@ static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile)
|
||||
|
||||
ret=count;
|
||||
end:
|
||||
/* never need to Free x */
|
||||
/* never need to OPENSSL_free x */
|
||||
if (in != NULL) BIO_free(in);
|
||||
if (sk != NULL) sk_X509_INFO_free(sk);
|
||||
return(ret);
|
||||
|
||||
@@ -92,7 +92,7 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
apps_startup();
|
||||
|
||||
if ((buf=(unsigned char *)Malloc(BUFSIZE)) == NULL)
|
||||
if ((buf=(unsigned char *)OPENSSL_malloc(BUFSIZE)) == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"out of memory\n");
|
||||
goto end;
|
||||
@@ -192,7 +192,7 @@ end:
|
||||
if (buf != NULL)
|
||||
{
|
||||
memset(buf,0,BUFSIZE);
|
||||
Free(buf);
|
||||
OPENSSL_free(buf);
|
||||
}
|
||||
if (in != NULL) BIO_free(in);
|
||||
if (bmd != NULL) BIO_free(bmd);
|
||||
|
||||
@@ -251,10 +251,10 @@ bad:
|
||||
|
||||
len=BN_num_bytes(dh->p);
|
||||
bits=BN_num_bits(dh->p);
|
||||
data=(unsigned char *)Malloc(len);
|
||||
data=(unsigned char *)OPENSSL_malloc(len);
|
||||
if (data == NULL)
|
||||
{
|
||||
perror("Malloc");
|
||||
perror("OPENSSL_malloc");
|
||||
goto end;
|
||||
}
|
||||
l=BN_bn2bin(dh->p,data);
|
||||
@@ -285,7 +285,7 @@ bad:
|
||||
printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n");
|
||||
printf("\t\treturn(NULL);\n");
|
||||
printf("\treturn(dh);\n\t}\n");
|
||||
Free(data);
|
||||
OPENSSL_free(data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -432,10 +432,10 @@ bad:
|
||||
|
||||
len=BN_num_bytes(dh->p);
|
||||
bits=BN_num_bits(dh->p);
|
||||
data=(unsigned char *)Malloc(len);
|
||||
data=(unsigned char *)OPENSSL_malloc(len);
|
||||
if (data == NULL)
|
||||
{
|
||||
perror("Malloc");
|
||||
perror("OPENSSL_malloc");
|
||||
goto end;
|
||||
}
|
||||
printf("#ifndef HEADER_DH_H\n"
|
||||
@@ -472,7 +472,7 @@ bad:
|
||||
if (dh->length)
|
||||
printf("\tdh->length = %d;\n", dh->length);
|
||||
printf("\treturn(dh);\n\t}\n");
|
||||
Free(data);
|
||||
OPENSSL_free(data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -283,8 +283,8 @@ end:
|
||||
if(in != NULL) BIO_free(in);
|
||||
if(out != NULL) BIO_free(out);
|
||||
if(dsa != NULL) DSA_free(dsa);
|
||||
if(passin) Free(passin);
|
||||
if(passout) Free(passout);
|
||||
if(passin) OPENSSL_free(passin);
|
||||
if(passout) OPENSSL_free(passout);
|
||||
EXIT(ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -260,10 +260,10 @@ bad:
|
||||
bits_p=BN_num_bits(dsa->p);
|
||||
bits_q=BN_num_bits(dsa->q);
|
||||
bits_g=BN_num_bits(dsa->g);
|
||||
data=(unsigned char *)Malloc(len+20);
|
||||
data=(unsigned char *)OPENSSL_malloc(len+20);
|
||||
if (data == NULL)
|
||||
{
|
||||
perror("Malloc");
|
||||
perror("OPENSSL_malloc");
|
||||
goto end;
|
||||
}
|
||||
l=BN_bn2bin(dsa->p,data);
|
||||
|
||||
12
apps/enc.c
12
apps/enc.c
@@ -343,11 +343,11 @@ bad:
|
||||
if (verbose) BIO_printf(bio_err,"bufsize=%d\n",bsize);
|
||||
}
|
||||
|
||||
strbuf=Malloc(SIZE);
|
||||
buff=(unsigned char *)Malloc(EVP_ENCODE_LENGTH(bsize));
|
||||
strbuf=OPENSSL_malloc(SIZE);
|
||||
buff=(unsigned char *)OPENSSL_malloc(EVP_ENCODE_LENGTH(bsize));
|
||||
if ((buff == NULL) || (strbuf == NULL))
|
||||
{
|
||||
BIO_printf(bio_err,"Malloc failure %ld\n",(long)EVP_ENCODE_LENGTH(bsize));
|
||||
BIO_printf(bio_err,"OPENSSL_malloc failure %ld\n",(long)EVP_ENCODE_LENGTH(bsize));
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -581,13 +581,13 @@ bad:
|
||||
}
|
||||
end:
|
||||
ERR_print_errors(bio_err);
|
||||
if (strbuf != NULL) Free(strbuf);
|
||||
if (buff != NULL) Free(buff);
|
||||
if (strbuf != NULL) OPENSSL_free(strbuf);
|
||||
if (buff != NULL) OPENSSL_free(buff);
|
||||
if (in != NULL) BIO_free(in);
|
||||
if (out != NULL) BIO_free(out);
|
||||
if (benc != NULL) BIO_free(benc);
|
||||
if (b64 != NULL) BIO_free(b64);
|
||||
if(pass) Free(pass);
|
||||
if(pass) OPENSSL_free(pass);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ end:
|
||||
if (in != NULL) BIO_free(in);
|
||||
if (out != NULL) BIO_free(out);
|
||||
if (dsa != NULL) DSA_free(dsa);
|
||||
if(passout) Free(passout);
|
||||
if(passout) OPENSSL_free(passout);
|
||||
EXIT(ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -213,7 +213,7 @@ bad:
|
||||
err:
|
||||
if (rsa != NULL) RSA_free(rsa);
|
||||
if (out != NULL) BIO_free(out);
|
||||
if(passout) Free(passout);
|
||||
if(passout) OPENSSL_free(passout);
|
||||
if (ret != 0)
|
||||
ERR_print_errors(bio_err);
|
||||
EXIT(ret);
|
||||
|
||||
@@ -201,7 +201,7 @@ end:
|
||||
config=NULL;
|
||||
}
|
||||
if (prog != NULL) lh_free(prog);
|
||||
if (arg.data != NULL) Free(arg.data);
|
||||
if (arg.data != NULL) OPENSSL_free(arg.data);
|
||||
ERR_remove_state(0);
|
||||
|
||||
EVP_cleanup();
|
||||
|
||||
@@ -200,7 +200,7 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
passwd_malloc_size = pw_maxlen + 2;
|
||||
/* longer than necessary so that we can warn about truncation */
|
||||
passwd = passwd_malloc = Malloc(passwd_malloc_size);
|
||||
passwd = passwd_malloc = OPENSSL_malloc(passwd_malloc_size);
|
||||
if (passwd_malloc == NULL)
|
||||
goto err;
|
||||
}
|
||||
@@ -266,9 +266,9 @@ int MAIN(int argc, char **argv)
|
||||
err:
|
||||
ERR_print_errors(bio_err);
|
||||
if (salt_malloc)
|
||||
Free(salt_malloc);
|
||||
OPENSSL_free(salt_malloc);
|
||||
if (passwd_malloc)
|
||||
Free(passwd_malloc);
|
||||
OPENSSL_free(passwd_malloc);
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
if (out)
|
||||
@@ -399,7 +399,7 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
|
||||
{
|
||||
if (*salt_malloc_p == NULL)
|
||||
{
|
||||
*salt_p = *salt_malloc_p = Malloc(3);
|
||||
*salt_p = *salt_malloc_p = OPENSSL_malloc(3);
|
||||
if (*salt_malloc_p == NULL)
|
||||
goto err;
|
||||
}
|
||||
@@ -422,7 +422,7 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
|
||||
|
||||
if (*salt_malloc_p == NULL)
|
||||
{
|
||||
*salt_p = *salt_malloc_p = Malloc(9);
|
||||
*salt_p = *salt_malloc_p = OPENSSL_malloc(9);
|
||||
if (*salt_malloc_p == NULL)
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -565,8 +565,8 @@ int MAIN(int argc, char **argv)
|
||||
#endif
|
||||
BIO_free(in);
|
||||
BIO_free(out);
|
||||
if(passin) Free(passin);
|
||||
if(passout) Free(passout);
|
||||
if(passin) OPENSSL_free(passin);
|
||||
if(passout) OPENSSL_free(passout);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
@@ -774,7 +774,7 @@ int print_attribs (BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst, char *name)
|
||||
value = uni2asc(av->value.bmpstring->data,
|
||||
av->value.bmpstring->length);
|
||||
BIO_printf(out, "%s\n", value);
|
||||
Free(value);
|
||||
OPENSSL_free(value);
|
||||
break;
|
||||
|
||||
case V_ASN1_OCTET_STRING:
|
||||
|
||||
@@ -254,8 +254,8 @@ int MAIN(int argc, char **argv)
|
||||
PKCS8_PRIV_KEY_INFO_free (p8inf);
|
||||
EVP_PKEY_free(pkey);
|
||||
BIO_free(out);
|
||||
if(passin) Free(passin);
|
||||
if(passout) Free(passout);
|
||||
if(passin) OPENSSL_free(passin);
|
||||
if(passout) OPENSSL_free(passout);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -338,8 +338,8 @@ int MAIN(int argc, char **argv)
|
||||
EVP_PKEY_free(pkey);
|
||||
BIO_free(out);
|
||||
BIO_free(in);
|
||||
if(passin) Free(passin);
|
||||
if(passout) Free(passout);
|
||||
if(passin) OPENSSL_free(passin);
|
||||
if(passout) OPENSSL_free(passout);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -878,8 +878,8 @@ end:
|
||||
EVP_PKEY_free(pkey);
|
||||
X509_REQ_free(req);
|
||||
X509_free(x509ss);
|
||||
if(passargin && passin) Free(passin);
|
||||
if(passargout && passout) Free(passout);
|
||||
if(passargin && passin) OPENSSL_free(passin);
|
||||
if(passargout && passout) OPENSSL_free(passout);
|
||||
OBJ_cleanup();
|
||||
#ifndef NO_DSA
|
||||
if (dsa_params != NULL) DSA_free(dsa_params);
|
||||
|
||||
10
apps/rsa.c
10
apps/rsa.c
@@ -345,15 +345,15 @@ bad:
|
||||
|
||||
i=1;
|
||||
size=i2d_Netscape_RSA(rsa,NULL,NULL);
|
||||
if ((p=(unsigned char *)Malloc(size)) == NULL)
|
||||
if ((p=(unsigned char *)OPENSSL_malloc(size)) == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"Malloc failure\n");
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
goto end;
|
||||
}
|
||||
pp=p;
|
||||
i2d_Netscape_RSA(rsa,&p,NULL);
|
||||
BIO_write(out,(char *)pp,size);
|
||||
Free(pp);
|
||||
OPENSSL_free(pp);
|
||||
}
|
||||
#endif
|
||||
else if (outformat == FORMAT_PEM) {
|
||||
@@ -376,8 +376,8 @@ end:
|
||||
if(in != NULL) BIO_free(in);
|
||||
if(out != NULL) BIO_free(out);
|
||||
if(rsa != NULL) RSA_free(rsa);
|
||||
if(passin) Free(passin);
|
||||
if(passout) Free(passout);
|
||||
if(passin) OPENSSL_free(passin);
|
||||
if(passout) OPENSSL_free(passout);
|
||||
EXIT(ret);
|
||||
}
|
||||
#else /* !NO_RSA */
|
||||
|
||||
@@ -201,8 +201,8 @@ int MAIN(int argc, char **argv)
|
||||
if (bio_err == NULL)
|
||||
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
|
||||
|
||||
if ( ((cbuf=Malloc(BUFSIZZ)) == NULL) ||
|
||||
((sbuf=Malloc(BUFSIZZ)) == NULL))
|
||||
if ( ((cbuf=OPENSSL_malloc(BUFSIZZ)) == NULL) ||
|
||||
((sbuf=OPENSSL_malloc(BUFSIZZ)) == NULL))
|
||||
{
|
||||
BIO_printf(bio_err,"out of memory\n");
|
||||
goto end;
|
||||
@@ -753,8 +753,8 @@ end:
|
||||
if (con != NULL) SSL_free(con);
|
||||
if (con2 != NULL) SSL_free(con2);
|
||||
if (ctx != NULL) SSL_CTX_free(ctx);
|
||||
if (cbuf != NULL) { memset(cbuf,0,BUFSIZZ); Free(cbuf); }
|
||||
if (sbuf != NULL) { memset(sbuf,0,BUFSIZZ); Free(sbuf); }
|
||||
if (cbuf != NULL) { memset(cbuf,0,BUFSIZZ); OPENSSL_free(cbuf); }
|
||||
if (sbuf != NULL) { memset(sbuf,0,BUFSIZZ); OPENSSL_free(sbuf); }
|
||||
if (bio_c_out != NULL)
|
||||
{
|
||||
BIO_free(bio_c_out);
|
||||
|
||||
@@ -285,7 +285,7 @@ static int ebcdic_new(BIO *bi)
|
||||
{
|
||||
EBCDIC_OUTBUFF *wbuf;
|
||||
|
||||
wbuf = (EBCDIC_OUTBUFF *)Malloc(sizeof(EBCDIC_OUTBUFF) + 1024);
|
||||
wbuf = (EBCDIC_OUTBUFF *)OPENSSL_malloc(sizeof(EBCDIC_OUTBUFF) + 1024);
|
||||
wbuf->alloced = 1024;
|
||||
wbuf->buff[0] = '\0';
|
||||
|
||||
@@ -299,7 +299,7 @@ static int ebcdic_free(BIO *a)
|
||||
{
|
||||
if (a == NULL) return(0);
|
||||
if (a->ptr != NULL)
|
||||
Free(a->ptr);
|
||||
OPENSSL_free(a->ptr);
|
||||
a->ptr=NULL;
|
||||
a->init=0;
|
||||
a->flags=0;
|
||||
@@ -336,8 +336,8 @@ static int ebcdic_write(BIO *b, char *in, int inl)
|
||||
num = num + num; /* double the size */
|
||||
if (num < inl)
|
||||
num = inl;
|
||||
Free(wbuf);
|
||||
wbuf=(EBCDIC_OUTBUFF *)Malloc(sizeof(EBCDIC_OUTBUFF) + num);
|
||||
OPENSSL_free(wbuf);
|
||||
wbuf=(EBCDIC_OUTBUFF *)OPENSSL_malloc(sizeof(EBCDIC_OUTBUFF) + num);
|
||||
|
||||
wbuf->alloced = num;
|
||||
wbuf->buff[0] = '\0';
|
||||
@@ -766,7 +766,7 @@ static int sv_body(char *hostname, int s, unsigned char *context)
|
||||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if ((buf=Malloc(bufsize)) == NULL)
|
||||
if ((buf=OPENSSL_malloc(bufsize)) == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"out of memory\n");
|
||||
goto err;
|
||||
@@ -1028,7 +1028,7 @@ err:
|
||||
if (buf != NULL)
|
||||
{
|
||||
memset(buf,0,bufsize);
|
||||
Free(buf);
|
||||
OPENSSL_free(buf);
|
||||
}
|
||||
if (ret >= 0)
|
||||
BIO_printf(bio_s_out,"ACCEPT\n");
|
||||
@@ -1145,7 +1145,7 @@ static int www_body(char *hostname, int s, unsigned char *context)
|
||||
BIO *io,*ssl_bio,*sbio;
|
||||
long total_bytes;
|
||||
|
||||
buf=Malloc(bufsize);
|
||||
buf=OPENSSL_malloc(bufsize);
|
||||
if (buf == NULL) return(0);
|
||||
io=BIO_new(BIO_f_buffer());
|
||||
ssl_bio=BIO_new(BIO_f_ssl());
|
||||
@@ -1474,7 +1474,7 @@ err:
|
||||
if (ret >= 0)
|
||||
BIO_printf(bio_s_out,"ACCEPT\n");
|
||||
|
||||
if (buf != NULL) Free(buf);
|
||||
if (buf != NULL) OPENSSL_free(buf);
|
||||
if (io != NULL) BIO_free_all(io);
|
||||
/* if (ssl_bio != NULL) BIO_free(ssl_bio);*/
|
||||
return(ret);
|
||||
|
||||
@@ -241,7 +241,7 @@ int do_server(int port, int *ret, int (*cb)(), char *context)
|
||||
return(0);
|
||||
}
|
||||
i=(*cb)(name,sock, context);
|
||||
if (name != NULL) Free(name);
|
||||
if (name != NULL) OPENSSL_free(name);
|
||||
SHUTDOWN2(sock);
|
||||
if (i < 0)
|
||||
{
|
||||
@@ -372,9 +372,9 @@ redoit:
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((*host=(char *)Malloc(strlen(h1->h_name)+1)) == NULL)
|
||||
if ((*host=(char *)OPENSSL_malloc(strlen(h1->h_name)+1)) == NULL)
|
||||
{
|
||||
perror("Malloc");
|
||||
perror("OPENSSL_malloc");
|
||||
return(0);
|
||||
}
|
||||
strcpy(*host,h1->h_name);
|
||||
|
||||
@@ -443,7 +443,7 @@ end:
|
||||
BIO_free(in);
|
||||
BIO_free(indata);
|
||||
BIO_free(out);
|
||||
if(passin) Free(passin);
|
||||
if(passin) OPENSSL_free(passin);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -362,7 +362,7 @@ int MAIN(int argc, char **argv)
|
||||
rsa_key[i]=NULL;
|
||||
#endif
|
||||
|
||||
if ((buf=(unsigned char *)Malloc((int)BUFSIZE)) == NULL)
|
||||
if ((buf=(unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"out of memory\n");
|
||||
goto end;
|
||||
@@ -370,7 +370,7 @@ int MAIN(int argc, char **argv)
|
||||
#ifndef NO_DES
|
||||
buf_as_des_cblock = (des_cblock *)buf;
|
||||
#endif
|
||||
if ((buf2=(unsigned char *)Malloc((int)BUFSIZE)) == NULL)
|
||||
if ((buf2=(unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"out of memory\n");
|
||||
goto end;
|
||||
@@ -1173,8 +1173,8 @@ int MAIN(int argc, char **argv)
|
||||
#endif
|
||||
mret=0;
|
||||
end:
|
||||
if (buf != NULL) Free(buf);
|
||||
if (buf2 != NULL) Free(buf2);
|
||||
if (buf != NULL) OPENSSL_free(buf);
|
||||
if (buf2 != NULL) OPENSSL_free(buf2);
|
||||
#ifndef NO_RSA
|
||||
for (i=0; i<RSA_NUM; i++)
|
||||
if (rsa_key[i] != NULL)
|
||||
|
||||
@@ -200,7 +200,7 @@ bad:
|
||||
goto end;
|
||||
}
|
||||
BIO_printf(out, "SPKAC=%s\n", spkstr);
|
||||
Free(spkstr);
|
||||
OPENSSL_free(spkstr);
|
||||
ret = 0;
|
||||
goto end;
|
||||
}
|
||||
@@ -271,6 +271,6 @@ end:
|
||||
BIO_free(out);
|
||||
BIO_free(key);
|
||||
EVP_PKEY_free(pkey);
|
||||
if(passin) Free(passin);
|
||||
if(passin) OPENSSL_free(passin);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
10
apps/x509.c
10
apps/x509.c
@@ -696,7 +696,7 @@ bad:
|
||||
BIO_printf(STDout,"/* issuer :%s */\n",buf);
|
||||
|
||||
z=i2d_X509(x,NULL);
|
||||
m=Malloc(z);
|
||||
m=OPENSSL_malloc(z);
|
||||
|
||||
d=(unsigned char *)m;
|
||||
z=i2d_X509_NAME(X509_get_subject_name(x),&d);
|
||||
@@ -734,7 +734,7 @@ bad:
|
||||
if (y%16 != 0) BIO_printf(STDout,"\n");
|
||||
BIO_printf(STDout,"};\n");
|
||||
|
||||
Free(m);
|
||||
OPENSSL_free(m);
|
||||
}
|
||||
else if (text == i)
|
||||
{
|
||||
@@ -917,7 +917,7 @@ end:
|
||||
X509_REQ_free(rq);
|
||||
sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free);
|
||||
sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free);
|
||||
if(passin) Free(passin);
|
||||
if(passin) OPENSSL_free(passin);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
@@ -939,7 +939,7 @@ static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
|
||||
EVP_PKEY_free(upkey);
|
||||
|
||||
X509_STORE_CTX_init(&xsc,ctx,x,NULL);
|
||||
buf=Malloc(EVP_PKEY_size(pkey)*2+
|
||||
buf=OPENSSL_malloc(EVP_PKEY_size(pkey)*2+
|
||||
((serialfile == NULL)
|
||||
?(strlen(CAfile)+strlen(POSTFIX)+1)
|
||||
:(strlen(serialfile)))+1);
|
||||
@@ -1062,7 +1062,7 @@ end:
|
||||
X509_STORE_CTX_cleanup(&xsc);
|
||||
if (!ret)
|
||||
ERR_print_errors(bio_err);
|
||||
if (buf != NULL) Free(buf);
|
||||
if (buf != NULL) OPENSSL_free(buf);
|
||||
if (bs != NULL) ASN1_INTEGER_free(bs);
|
||||
if (io != NULL) BIO_free(io);
|
||||
if (serial != NULL) BN_free(serial);
|
||||
|
||||
Reference in New Issue
Block a user