There have been a number of complaints from a number of sources that names
authorRichard Levitte <levitte@openssl.org>
Thu, 1 Jun 2000 22:19:21 +0000 (22:19 +0000)
committerRichard Levitte <levitte@openssl.org>
Thu, 1 Jun 2000 22:19:21 +0000 (22:19 +0000)
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.

203 files changed:
apps/apps.c
apps/asn1pars.c
apps/ca.c
apps/crl2p7.c
apps/dgst.c
apps/dh.c
apps/dhparam.c
apps/dsa.c
apps/dsaparam.c
apps/enc.c
apps/gendsa.c
apps/genrsa.c
apps/openssl.c
apps/passwd.c
apps/pkcs12.c
apps/pkcs8.c
apps/req.c
apps/rsa.c
apps/s_client.c
apps/s_server.c
apps/s_socket.c
apps/smime.c
apps/speed.c
apps/spkac.c
apps/x509.c
crypto/asn1/a_bitstr.c
crypto/asn1/a_bytes.c
crypto/asn1/a_digest.c
crypto/asn1/a_dup.c
crypto/asn1/a_enum.c
crypto/asn1/a_gentm.c
crypto/asn1/a_hdr.c
crypto/asn1/a_i2d_fp.c
crypto/asn1/a_int.c
crypto/asn1/a_mbstr.c
crypto/asn1/a_object.c
crypto/asn1/a_set.c
crypto/asn1/a_sign.c
crypto/asn1/a_strnid.c
crypto/asn1/a_type.c
crypto/asn1/a_utctm.c
crypto/asn1/a_verify.c
crypto/asn1/asn1_lib.c
crypto/asn1/asn1_mac.h
crypto/asn1/asn_pack.c
crypto/asn1/f_enum.c
crypto/asn1/f_int.c
crypto/asn1/f_string.c
crypto/asn1/i2d_dhp.c
crypto/asn1/i2d_dsap.c
crypto/asn1/i2d_r_pr.c
crypto/asn1/i2d_r_pu.c
crypto/asn1/i2d_s_pr.c
crypto/asn1/i2d_s_pu.c
crypto/asn1/n_pkey.c
crypto/asn1/nsseq.c
crypto/asn1/p5_pbe.c
crypto/asn1/p5_pbev2.c
crypto/asn1/p7_dgst.c
crypto/asn1/p7_enc.c
crypto/asn1/p7_enc_c.c
crypto/asn1/p7_evp.c
crypto/asn1/p7_i_s.c
crypto/asn1/p7_lib.c
crypto/asn1/p7_recip.c
crypto/asn1/p7_s_e.c
crypto/asn1/p7_signd.c
crypto/asn1/p7_signi.c
crypto/asn1/p8_key.c
crypto/asn1/p8_pkey.c
crypto/asn1/t_pkey.c
crypto/asn1/t_x509.c
crypto/asn1/x_algor.c
crypto/asn1/x_attrib.c
crypto/asn1/x_cinf.c
crypto/asn1/x_crl.c
crypto/asn1/x_exten.c
crypto/asn1/x_info.c
crypto/asn1/x_name.c
crypto/asn1/x_pkey.c
crypto/asn1/x_pubkey.c
crypto/asn1/x_req.c
crypto/asn1/x_sig.c
crypto/asn1/x_spki.c
crypto/asn1/x_val.c
crypto/asn1/x_x509.c
crypto/asn1/x_x509a.c
crypto/bio/b_print.c
crypto/bio/b_sock.c
crypto/bio/bf_buff.c
crypto/bio/bf_nbio.c
crypto/bio/bio_lib.c
crypto/bio/bss_acpt.c
crypto/bio/bss_bio.c
crypto/bio/bss_conn.c
crypto/bio/bss_log.c
crypto/bio/bss_rtcp.c
crypto/bn/bn_blind.c
crypto/bn/bn_ctx.c
crypto/bn/bn_lib.c
crypto/bn/bn_mont.c
crypto/bn/bn_print.c
crypto/bn/bn_rand.c
crypto/bn/bn_recp.c
crypto/buffer/buffer.c
crypto/comp/comp_lib.c
crypto/conf/conf_api.c
crypto/conf/conf_def.c
crypto/cryptlib.c
crypto/crypto.h
crypto/des/des.c
crypto/des/enc_read.c
crypto/des/enc_writ.c
crypto/dh/dh_lib.c
crypto/dh/dhtest.c
crypto/dsa/dsa_asn1.c
crypto/dsa/dsa_lib.c
crypto/dso/dso_lib.c
crypto/dso/dso_win32.c
crypto/err/err.c
crypto/evp/bio_b64.c
crypto/evp/bio_enc.c
crypto/evp/bio_md.c
crypto/evp/bio_ok.c
crypto/evp/evp_pbe.c
crypto/evp/evp_pkey.c
crypto/evp/p_lib.c
crypto/evp/p_open.c
crypto/ex_data.c
crypto/lhash/lh_test.c
crypto/lhash/lhash.c
crypto/mem.c
crypto/mem_dbg.c
crypto/objects/o_names.c
crypto/objects/obj_dat.c
crypto/objects/obj_lib.c
crypto/pem/pem_info.c
crypto/pem/pem_lib.c
crypto/pem/pem_seal.c
crypto/pem/pem_sign.c
crypto/pkcs12/p12_attr.c
crypto/pkcs12/p12_bags.c
crypto/pkcs12/p12_decr.c
crypto/pkcs12/p12_key.c
crypto/pkcs12/p12_lib.c
crypto/pkcs12/p12_mac.c
crypto/pkcs12/p12_mutl.c
crypto/pkcs12/p12_sbag.c
crypto/pkcs12/p12_utl.c
crypto/pkcs7/bio_ber.c
crypto/pkcs7/pk7_attr.c
crypto/pkcs7/pk7_doit.c
crypto/pkcs7/pk7_mime.c
crypto/rand/rand_win.c
crypto/rand/randfile.c
crypto/rsa/rsa_eay.c
crypto/rsa/rsa_lib.c
crypto/rsa/rsa_oaep.c
crypto/rsa/rsa_saos.c
crypto/rsa/rsa_sign.c
crypto/stack/stack.c
crypto/threads/mttest.c
crypto/threads/th-lock.c
crypto/tmdiff.c
crypto/txt_db/txt_db.c
crypto/x509/by_dir.c
crypto/x509/x509_cmp.c
crypto/x509/x509_lu.c
crypto/x509/x509_obj.c
crypto/x509/x509_req.c
crypto/x509/x509_trs.c
crypto/x509/x509_vfy.c
crypto/x509/x509spki.c
crypto/x509v3/v3_akey.c
crypto/x509v3/v3_bcons.c
crypto/x509v3/v3_conf.c
crypto/x509v3/v3_cpols.c
crypto/x509v3/v3_crld.c
crypto/x509v3/v3_genn.c
crypto/x509v3/v3_ia5.c
crypto/x509v3/v3_info.c
crypto/x509v3/v3_lib.c
crypto/x509v3/v3_pku.c
crypto/x509v3/v3_prn.c
crypto/x509v3/v3_purp.c
crypto/x509v3/v3_sxnet.c
crypto/x509v3/v3_utl.c
demos/b64.c
ssl/bio_ssl.c
ssl/s23_srvr.c
ssl/s2_enc.c
ssl/s2_lib.c
ssl/s2_srvr.c
ssl/s3_both.c
ssl/s3_enc.c
ssl/s3_lib.c
ssl/ssl_asn1.c
ssl/ssl_cert.c
ssl/ssl_ciph.c
ssl/ssl_lib.c
ssl/ssl_sess.c
ssl/ssltest.c
ssl/t1_enc.c

index a87d23bf3312e0a2f042fcda8db9031c517d674c..f063d8312834b2c021067a3fbe5daa3a175b8c76 100644 (file)
@@ -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);
                        }
index f104ebc1f08ae27078c4a98b501dcfefd6b7e239..2d64492ffd8412172eec06e3af80c610f71b133f 100644 (file)
@@ -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)
index 62747ec47c4869e389f9991de6de2dda77cfe2b4..69352654e2e1fd0bbd356f399c91399b8b0e3059 100644 (file)
--- a/apps/ca.c
+++ b/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);
 }
index 40565916769896f35ca44437cf85488786b75b31..ebf5fe90eca7503fe2ee2a21c1ebc895c6662ff8 100644 (file)
@@ -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);
index 1b56d6ef44167bbe1ac3c2a4f00bab2bf27cce98..3db28d25ca09592cc97063bc0e08207066d38275 100644 (file)
@@ -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);
index 674963f81a901ad98c80d493f41748596f433345..ee71d95f0c5acfa766835dbd55085e0431b85c2b 100644 (file)
--- a/apps/dh.c
+++ b/apps/dh.c
@@ -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);
                }
 
 
index 709547ff5e6f5567f261e059eb4fc6942756c46f..f570f5f02489a9e96fc405671302f5a0161a58f7 100644 (file)
@@ -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);
                }
 
 
index 4977671b8adc125a93052a346669737916e0ccea..842e0c0d15ae9ad292342b34f32a12368fc3b2d3 100644 (file)
@@ -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
index 4d4e1ad2b500826af400ae05d50029f7fd6ee6e8..a15d6ea3096714abbdb3e81e67fe1fe9d875316f 100644 (file)
@@ -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);
index 6531c58c542e70aa04a243a101afeddb55b5b822..49338aca0fdc7ceeb6f3686589fb8ad59d41299c 100644 (file)
@@ -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);
        }
 
index b1a1c4fcfae9fdfb3c1aa1435b1566066be4659d..1937613849fc02e178cc565ba2de1720f9cb592c 100644 (file)
@@ -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
index 6fe578d69feb675ed44216a1704ee9d51b9cb096..4cbccf8456e003bc3a7a89b070ce4f07216213e1 100644 (file)
@@ -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);
index a2a263062dfb5bfdb5224bec95e9630c043a7de9..5f0ffa9fd49704bccb5cb30ad4eb8114c0064a0d 100644 (file)
@@ -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();
index 4650ea503dde68e347ad08dc34403de6d1217c9b..e991fefaa5e0ad2cf49a47ab2c45f7991500a3bb 100644 (file)
@@ -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;
                                }
index a45b2da72f101764a5ebd3f9efa1f8f02786f67f..3f958943b4a37379c8c8337d605f96fd5e1ddef0 100644 (file)
@@ -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:
index 3e59b74124a2a9f615a6c3d93ef489a069945fa1..b0914cd453375d24adceec678393f778a786d88a 100644 (file)
@@ -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);
 }
index eb338eeb1b2b2dd42c244132b40bfd4476353266..dd376949fda39c5e887dbbb4afc7b812944adb63 100644 (file)
@@ -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);
index 9d4c2e6564050916bd11e3296d52e73ace47aa3a..1269f65703ef8b27e3be76ace1359203fce1dac0 100644 (file)
@@ -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 */
index 277417efd8ae72bfd7aaa19b4cf405c6ee196c7e..c93531718a4eeb8d2cf8a01b314934d117309ee1 100644 (file)
@@ -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);
index af19b89227a0140454d32afe88d66cb58dab46ce..b5932832569a693eb6db6e883d33226ea8214eb9 100644 (file)
@@ -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);
index 081b1a57d1745d7e0e57748b185ac75eac565405..0238566a819696c665e2c4b4d66f0f87ad8b9af2 100644 (file)
@@ -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);
index 7dc66d6ecd56672f8769b6d7830b7cab90d4fc14..e2fc828737117eec2b6710653bc484f86d83f840 100644 (file)
@@ -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);
 }
 
index f7a8e00a8bc29923b7cc9c2b7d91b1df82b3baa7..163d5237c2969b3b58f2f0c899ccd88869a00063 100644 (file)
@@ -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)
index f3ee7e34e3a7e96dc0d61bebf89e7e63c02d9683..ad45c2ddb7779df59f699ff3712a065f1c6e406c 100644 (file)
@@ -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);
        }
index 0184c62bb28e658a4c3fda59ced1a0ecc5ccd0f8..88ef1e064d5a071afe65b9e816828b0d161e81b3 100644 (file)
@@ -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);
index c77456b315b5f1cf886626e03146b1e80e83bec4..f6cadc530a201295511a6e0ba3478a0961c69bf2 100644 (file)
@@ -159,7 +159,7 @@ ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp,
 
        if (len-- > 1) /* using one because of the bits left byte */
                {
-               s=(unsigned char *)Malloc((int)len);
+               s=(unsigned char *)OPENSSL_malloc((int)len);
                if (s == NULL)
                        {
                        i=ERR_R_MALLOC_FAILURE;
@@ -173,7 +173,7 @@ ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp,
                s=NULL;
 
        ret->length=(int)len;
-       if (ret->data != NULL) Free(ret->data);
+       if (ret->data != NULL) OPENSSL_free(ret->data);
        ret->data=s;
        ret->type=V_ASN1_BIT_STRING;
        if (a != NULL) (*a)=ret;
@@ -204,9 +204,9 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
                {
                if (!value) return(1); /* Don't need to set */
                if (a->data == NULL)
-                       c=(unsigned char *)Malloc(w+1);
+                       c=(unsigned char *)OPENSSL_malloc(w+1);
                else
-                       c=(unsigned char *)Realloc(a->data,w+1);
+                       c=(unsigned char *)OPENSSL_realloc(a->data,w+1);
                if (c == NULL) return(0);
                a->data=c;
                a->length=w+1;
index 8cde69580402baf2a7d1ce2d7d9322518495a7ee..3a0c0c783551bca509e3efa230625a65e63b7e2c 100644 (file)
@@ -111,7 +111,7 @@ ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, unsigned char **pp,
 
        if (len != 0)
                {
-               s=(unsigned char *)Malloc((int)len+1);
+               s=(unsigned char *)OPENSSL_malloc((int)len+1);
                if (s == NULL)
                        {
                        i=ERR_R_MALLOC_FAILURE;
@@ -124,7 +124,7 @@ ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, unsigned char **pp,
        else
                s=NULL;
 
-       if (ret->data != NULL) Free(ret->data);
+       if (ret->data != NULL) OPENSSL_free(ret->data);
        ret->length=(int)len;
        ret->data=s;
        ret->type=tag;
@@ -218,8 +218,8 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, long length,
                        {
                        if ((ret->length < len) || (ret->data == NULL))
                                {
-                               if (ret->data != NULL) Free(ret->data);
-                               s=(unsigned char *)Malloc((int)len + 1);
+                               if (ret->data != NULL) OPENSSL_free(ret->data);
+                               s=(unsigned char *)OPENSSL_malloc((int)len + 1);
                                if (s == NULL)
                                        {
                                        i=ERR_R_MALLOC_FAILURE;
@@ -235,7 +235,7 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, long length,
                else
                        {
                        s=NULL;
-                       if (ret->data != NULL) Free(ret->data);
+                       if (ret->data != NULL) OPENSSL_free(ret->data);
                        }
 
                ret->length=(int)len;
@@ -310,14 +310,14 @@ static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c)
        if (!asn1_Finish(c)) goto err;
 
        a->length=num;
-       if (a->data != NULL) Free(a->data);
+       if (a->data != NULL) OPENSSL_free(a->data);
        a->data=(unsigned char *)b.data;
        if (os != NULL) ASN1_STRING_free(os);
        return(1);
 err:
        ASN1err(ASN1_F_ASN1_COLLATE_PRIMITIVE,c->error);
        if (os != NULL) ASN1_STRING_free(os);
-       if (b.data != NULL) Free(b.data);
+       if (b.data != NULL) OPENSSL_free(b.data);
        return(0);
        }
 
index 3370aae998d423661fcb5ff56ff75217126b093a..8257b8639e12f3a6fd2ec8204a93e79f9e06e4fa 100644 (file)
@@ -77,14 +77,14 @@ int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data,
        unsigned char *str,*p;
 
        i=i2d(data,NULL);
-       if ((str=(unsigned char *)Malloc(i)) == NULL) return(0);
+       if ((str=(unsigned char *)OPENSSL_malloc(i)) == NULL) return(0);
        p=str;
        i2d(data,&p);
 
        EVP_DigestInit(&ctx,type);
        EVP_DigestUpdate(&ctx,str,i);
        EVP_DigestFinal(&ctx,md,len);
-       Free(str);
+       OPENSSL_free(str);
        return(1);
        }
 
index 3202a816d0adae53b3ebd774a3892a352d48d346..c3bda58a5d9ec849fcc1cf7cd3df5ebc079a890b 100644 (file)
@@ -71,13 +71,13 @@ char *ASN1_dup(int (*i2d)(), char *(*d2i)(), char *x)
        if (x == NULL) return(NULL);
 
        i=(long)i2d(x,NULL);
-       b=(unsigned char *)Malloc((unsigned int)i+10);
+       b=(unsigned char *)OPENSSL_malloc((unsigned int)i+10);
        if (b == NULL)
                { ASN1err(ASN1_F_ASN1_DUP,ERR_R_MALLOC_FAILURE); return(NULL); }
        p= b;
        i=i2d(x,&p);
        p= b;
        ret=d2i(NULL,&p,i);
-       Free(b);
+       OPENSSL_free(b);
        return(ret);
        }
index ccf62e5a044011e95c6f04be609f6b2517d0ae11..572ba2e1b2c867c03d80c3f491c886aa1fd95065 100644 (file)
@@ -168,9 +168,9 @@ ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, unsigned char **pp,
                goto err;
                }
 
-       /* We must Malloc stuff, even for 0 bytes otherwise it
+       /* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it
         * signifies a missing NULL parameter. */
-       s=(unsigned char *)Malloc((int)len+1);
+       s=(unsigned char *)OPENSSL_malloc((int)len+1);
        if (s == NULL)
                {
                i=ERR_R_MALLOC_FAILURE;
@@ -219,7 +219,7 @@ ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, unsigned char **pp,
                p+=len;
        }
 
-       if (ret->data != NULL) Free(ret->data);
+       if (ret->data != NULL) OPENSSL_free(ret->data);
        ret->data=s;
        ret->length=(int)len;
        if (a != NULL) (*a)=ret;
@@ -242,8 +242,8 @@ int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v)
        if (a->length < (sizeof(long)+1))
                {
                if (a->data != NULL)
-                       Free(a->data);
-               if ((a->data=(unsigned char *)Malloc(sizeof(long)+1)) != NULL)
+                       OPENSSL_free(a->data);
+               if ((a->data=(unsigned char *)OPENSSL_malloc(sizeof(long)+1)) != NULL)
                        memset((char *)a->data,0,sizeof(long)+1);
                }
        if (a->data == NULL)
@@ -318,7 +318,7 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai)
        else ret->type=V_ASN1_ENUMERATED;
        j=BN_num_bits(bn);
        len=((j == 0)?0:((j/8)+1));
-       ret->data=(unsigned char *)Malloc(len+4);
+       ret->data=(unsigned char *)OPENSSL_malloc(len+4);
        ret->length=BN_bn2bin(bn,ret->data);
        return(ret);
 err:
index 84062170e8389ca945a885ab0a6904bbb59fc1f8..314479a03dad4481bdfc58d003ee1b635b57bd08 100644 (file)
@@ -212,10 +212,10 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
        p=(char *)s->data;
        if ((p == NULL) || (s->length < 16))
                {
-               p=Malloc(20);
+               p=OPENSSL_malloc(20);
                if (p == NULL) return(NULL);
                if (s->data != NULL)
-                       Free(s->data);
+                       OPENSSL_free(s->data);
                s->data=(unsigned char *)p;
                }
 
index 434610e8e124cef02ba80f69833405299fe14160..b1aad81f77314420379ea236ee42353a486ad8fe 100644 (file)
@@ -115,5 +115,5 @@ void ASN1_HEADER_free(ASN1_HEADER *a)
        M_ASN1_OCTET_STRING_free(a->header);
        if (a->meth != NULL)
                a->meth->destroy(a->data);
-       Free(a);
+       OPENSSL_free(a);
        }
index d9b8035e172c38908c76bece9579db0e2e44ca1a..aee29a779000c444ea3996da7c298647bc6b49ba 100644 (file)
@@ -86,7 +86,7 @@ int ASN1_i2d_bio(int (*i2d)(), BIO *out, unsigned char *x)
        int i,j=0,n,ret=1;
 
        n=i2d(x,NULL);
-       b=(char *)Malloc(n);
+       b=(char *)OPENSSL_malloc(n);
        if (b == NULL)
                {
                ASN1err(ASN1_F_ASN1_I2D_BIO,ERR_R_MALLOC_FAILURE);
@@ -108,6 +108,6 @@ int ASN1_i2d_bio(int (*i2d)(), BIO *out, unsigned char *x)
                j+=i;
                n-=i;
                }
-       Free(b);
+       OPENSSL_free(b);
        return(ret);
        }
index c6a6b725c68e162c5d8eb158f263b6b67233c71a..82db75f5e163638d9ac69e9ec998269ce10866f3 100644 (file)
@@ -193,9 +193,9 @@ ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, unsigned char **pp,
                goto err;
                }
 
-       /* We must Malloc stuff, even for 0 bytes otherwise it
+       /* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it
         * signifies a missing NULL parameter. */
-       s=(unsigned char *)Malloc((int)len+1);
+       s=(unsigned char *)OPENSSL_malloc((int)len+1);
        if (s == NULL)
                {
                i=ERR_R_MALLOC_FAILURE;
@@ -248,7 +248,7 @@ ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, unsigned char **pp,
                memcpy(s,p,(int)len);
        }
 
-       if (ret->data != NULL) Free(ret->data);
+       if (ret->data != NULL) OPENSSL_free(ret->data);
        ret->data=s;
        ret->length=(int)len;
        if (a != NULL) (*a)=ret;
@@ -297,9 +297,9 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, unsigned char **pp,
                goto err;
                }
 
-       /* We must Malloc stuff, even for 0 bytes otherwise it
+       /* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it
         * signifies a missing NULL parameter. */
-       s=(unsigned char *)Malloc((int)len+1);
+       s=(unsigned char *)OPENSSL_malloc((int)len+1);
        if (s == NULL)
                {
                i=ERR_R_MALLOC_FAILURE;
@@ -317,7 +317,7 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, unsigned char **pp,
                p+=len;
        }
 
-       if (ret->data != NULL) Free(ret->data);
+       if (ret->data != NULL) OPENSSL_free(ret->data);
        ret->data=s;
        ret->length=(int)len;
        if (a != NULL) (*a)=ret;
@@ -340,8 +340,8 @@ int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
        if (a->length < (sizeof(long)+1))
                {
                if (a->data != NULL)
-                       Free(a->data);
-               if ((a->data=(unsigned char *)Malloc(sizeof(long)+1)) != NULL)
+                       OPENSSL_free(a->data);
+               if ((a->data=(unsigned char *)OPENSSL_malloc(sizeof(long)+1)) != NULL)
                        memset((char *)a->data,0,sizeof(long)+1);
                }
        if (a->data == NULL)
@@ -416,7 +416,7 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai)
        else ret->type=V_ASN1_INTEGER;
        j=BN_num_bits(bn);
        len=((j == 0)?0:((j/8)+1));
-       ret->data=(unsigned char *)Malloc(len+4);
+       ret->data=(unsigned char *)OPENSSL_malloc(len+4);
        ret->length=BN_bn2bin(bn,ret->data);
        return(ret);
 err:
index 7a710d54590cdb04224f8825c4cbd03cfa279188..867f860752bfcd17dfa024930fe300caff9f5958 100644 (file)
@@ -183,7 +183,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
                dest = *out;
                if(dest->data) {
                        dest->length = 0;
-                       Free(dest->data);
+                       OPENSSL_free(dest->data);
                        dest->data = NULL;
                }
                dest->type = str_type;
@@ -228,7 +228,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
                cpyfunc = cpy_utf8;
                break;
        }
-       if(!(p = Malloc(outlen + 1))) {
+       if(!(p = OPENSSL_malloc(outlen + 1))) {
                ASN1_STRING_free(dest);
                ASN1err(ASN1_F_ASN1_MBSTRING_COPY,ERR_R_MALLOC_FAILURE);
                return -1;
index 09d56fb669006c755d904351e4828974440854f6..7e1300021ec39ac5f00a2c43bf06cf58836941bc 100644 (file)
@@ -222,8 +222,8 @@ ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, unsigned char **pp,
                }
        if ((ret->data == NULL) || (ret->length < len))
                {
-               if (ret->data != NULL) Free(ret->data);
-               ret->data=(unsigned char *)Malloc(len ? (int)len : 1);
+               if (ret->data != NULL) OPENSSL_free(ret->data);
+               ret->data=(unsigned char *)OPENSSL_malloc(len ? (int)len : 1);
                ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA;
                if (ret->data == NULL)
                        { i=ERR_R_MALLOC_FAILURE; goto err; }
@@ -249,7 +249,7 @@ ASN1_OBJECT *ASN1_OBJECT_new(void)
        {
        ASN1_OBJECT *ret;
 
-       ret=(ASN1_OBJECT *)Malloc(sizeof(ASN1_OBJECT));
+       ret=(ASN1_OBJECT *)OPENSSL_malloc(sizeof(ASN1_OBJECT));
        if (ret == NULL)
                {
                ASN1err(ASN1_F_ASN1_OBJECT_NEW,ERR_R_MALLOC_FAILURE);
@@ -270,19 +270,19 @@ void ASN1_OBJECT_free(ASN1_OBJECT *a)
        if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS)
                {
 #ifndef CONST_STRICT /* disable purely for compile-time strict const checking. Doing this on a "real" compile will cause memory leaks */
-               if (a->sn != NULL) Free((void *)a->sn);
-               if (a->ln != NULL) Free((void *)a->ln);
+               if (a->sn != NULL) OPENSSL_free((void *)a->sn);
+               if (a->ln != NULL) OPENSSL_free((void *)a->ln);
 #endif
                a->sn=a->ln=NULL;
                }
        if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA)
                {
-               if (a->data != NULL) Free(a->data);
+               if (a->data != NULL) OPENSSL_free(a->data);
                a->data=NULL;
                a->length=0;
                }
        if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC)
-               Free(a);
+               OPENSSL_free(a);
        }
 
 ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
index c2481e7597406ea87532cae03c3db9de2a160a7d..8cde8486894c3f83e6f095fff914c0b51f1a46ea 100644 (file)
@@ -116,7 +116,7 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, int (*func)(), int ex_tag,
                }
 
         pStart  = p; /* Catch the beg of Setblobs*/
-        rgSetBlob = (MYBLOB *)Malloc( sk_num(a) * sizeof(MYBLOB)); /* In this array
+        rgSetBlob = (MYBLOB *)OPENSSL_malloc( sk_num(a) * sizeof(MYBLOB)); /* In this array
 we will store the SET blobs */
 
         for (i=0; i<sk_num(a); i++)
@@ -133,7 +133,7 @@ SetBlob
  /* Now we have to sort the blobs. I am using a simple algo.
     *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/
         qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp);
-        pTempMem = Malloc(totSize);
+        pTempMem = OPENSSL_malloc(totSize);
 
 /* Copy to temp mem */
         p = pTempMem;
@@ -145,8 +145,8 @@ SetBlob
 
 /* Copy back to user mem*/
         memcpy(pStart, pTempMem, totSize);
-        Free(pTempMem);
-        Free(rgSetBlob);
+        OPENSSL_free(pTempMem);
+        OPENSSL_free(rgSetBlob);
 
         return(r);
         }
index cfb4bca4f1c6a8e31b7f8031b0bb051b16443ea8..4c651706d2d6a2acfb345cb0661c2ef54fcef13a 100644 (file)
@@ -108,9 +108,9 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
                        }
                }
        inl=i2d(data,NULL);
-       buf_in=(unsigned char *)Malloc((unsigned int)inl);
+       buf_in=(unsigned char *)OPENSSL_malloc((unsigned int)inl);
        outll=outl=EVP_PKEY_size(pkey);
-       buf_out=(unsigned char *)Malloc((unsigned int)outl);
+       buf_out=(unsigned char *)OPENSSL_malloc((unsigned int)outl);
        if ((buf_in == NULL) || (buf_out == NULL))
                {
                outl=0;
@@ -129,7 +129,7 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
                ASN1err(ASN1_F_ASN1_SIGN,ERR_R_EVP_LIB);
                goto err;
                }
-       if (signature->data != NULL) Free(signature->data);
+       if (signature->data != NULL) OPENSSL_free(signature->data);
        signature->data=buf_out;
        buf_out=NULL;
        signature->length=outl;
@@ -141,8 +141,8 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
 err:
        memset(&ctx,0,sizeof(ctx));
        if (buf_in != NULL)
-               { memset((char *)buf_in,0,(unsigned int)inl); Free(buf_in); }
+               { memset((char *)buf_in,0,(unsigned int)inl); OPENSSL_free(buf_in); }
        if (buf_out != NULL)
-               { memset((char *)buf_out,0,outll); Free(buf_out); }
+               { memset((char *)buf_out,0,outll); OPENSSL_free(buf_out); }
        return(outl);
        }
index 1ef1478304bce0b0e2179fbca628ac821f976d4c..4a65e4097b107dceeb858a04f3a9b38e7fa50d3f 100644 (file)
@@ -215,7 +215,7 @@ int ASN1_STRING_TABLE_add(int nid,
                return 0;
        }
        if(!(tmp = ASN1_STRING_TABLE_get(nid))) {
-               tmp = Malloc(sizeof(ASN1_STRING_TABLE));
+               tmp = OPENSSL_malloc(sizeof(ASN1_STRING_TABLE));
                if(!tmp) {
                        ASN1err(ASN1_F_ASN1_STRING_TABLE_ADD,
                                                        ERR_R_MALLOC_FAILURE);
@@ -243,7 +243,7 @@ void ASN1_STRING_TABLE_cleanup(void)
 
 static void st_free(ASN1_STRING_TABLE *tbl)
 {
-       if(tbl->flags & STABLE_FLAGS_MALLOC) Free(tbl);
+       if(tbl->flags & STABLE_FLAGS_MALLOC) OPENSSL_free(tbl);
 }
 
 IMPLEMENT_STACK_OF(ASN1_STRING_TABLE)
index 161ef8119737446f4a6cea8d3e4b9a18ffe27eac..3620e60e99ada82452fea7bb673311a515ef4e84 100644 (file)
@@ -282,7 +282,7 @@ void ASN1_TYPE_free(ASN1_TYPE *a)
        {
        if (a == NULL) return;
        ASN1_TYPE_component_free(a);
-       Free(a);
+       OPENSSL_free(a);
        }
 
 int ASN1_TYPE_get(ASN1_TYPE *a)
index e3e5c45906ed19408ee21e583b208a95ba5c80e9..2ee572e2281aad2e7c9cad76379e7608ebc680f8 100644 (file)
@@ -248,10 +248,10 @@ ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
        p=(char *)s->data;
        if ((p == NULL) || (s->length < 14))
                {
-               p=Malloc(20);
+               p=OPENSSL_malloc(20);
                if (p == NULL) return(NULL);
                if (s->data != NULL)
-                       Free(s->data);
+                       OPENSSL_free(s->data);
                s->data=(unsigned char *)p;
                }
 
index d4aede85c37e11c6a467e21d883a9ca8349bad74..2a11927e5c1c2a68e415dbda002f711dde730c41 100644 (file)
@@ -88,7 +88,7 @@ int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
                }
        
        inl=i2d(data,NULL);
-       buf_in=Malloc((unsigned int)inl);
+       buf_in=OPENSSL_malloc((unsigned int)inl);
        if (buf_in == NULL)
                {
                ASN1err(ASN1_F_ASN1_VERIFY,ERR_R_MALLOC_FAILURE);
@@ -101,7 +101,7 @@ int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
        EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
 
        memset(buf_in,0,(unsigned int)inl);
-       Free(buf_in);
+       OPENSSL_free(buf_in);
 
        if (EVP_VerifyFinal(&ctx,(unsigned char *)signature->data,
                        (unsigned int)signature->length,pkey) <= 0)
index be8daa8688dd109444be74b0012aa6675dd880ef..11f8654c36e4c56b7250827a36f23ab4896cb458 100644 (file)
@@ -335,9 +335,9 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
                {
                c=str->data;
                if (c == NULL)
-                       str->data=Malloc(len+1);
+                       str->data=OPENSSL_malloc(len+1);
                else
-                       str->data=Realloc(c,len+1);
+                       str->data=OPENSSL_realloc(c,len+1);
 
                if (str->data == NULL)
                        {
@@ -365,7 +365,7 @@ ASN1_STRING *ASN1_STRING_type_new(int type)
        {
        ASN1_STRING *ret;
 
-       ret=(ASN1_STRING *)Malloc(sizeof(ASN1_STRING));
+       ret=(ASN1_STRING *)OPENSSL_malloc(sizeof(ASN1_STRING));
        if (ret == NULL)
                {
                ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW,ERR_R_MALLOC_FAILURE);
@@ -381,8 +381,8 @@ ASN1_STRING *ASN1_STRING_type_new(int type)
 void ASN1_STRING_free(ASN1_STRING *a)
        {
        if (a == NULL) return;
-       if (a->data != NULL) Free(a->data);
-       Free(a);
+       if (a->data != NULL) OPENSSL_free(a->data);
+       OPENSSL_free(a);
        }
 
 int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b)
index 653f5fe1c948ef599fc7c8d4702699855672b6e9..4512ba6cc60420af84a8ae28c411ed967056bd04 100644 (file)
@@ -340,7 +340,7 @@ err:\
 
 /* New macros */
 #define M_ASN1_New_Malloc(ret,type) \
-       if ((ret=(type *)Malloc(sizeof(type))) == NULL) \
+       if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \
                { c.line=__LINE__; goto err2; }
 
 #define M_ASN1_New(arg,func) \
index 662a2626a1969fd6f751f5dc38eee926f81dee44..2969d5f8e361f7fe14db54d2f769b269c24542aa 100644 (file)
@@ -77,7 +77,7 @@ STACK *ASN1_seq_unpack(unsigned char *buf, int len, char *(*d2i)(),
 }
 
 /* Turn a STACK structures into an ASN1 encoded SEQUENCE OF structure in a
- * Malloc'ed buffer
+ * OPENSSL_malloc'ed buffer
  */
 
 unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(), unsigned char **buf,
@@ -90,7 +90,7 @@ unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(), unsigned char **buf,
                ASN1err(ASN1_F_ASN1_SEQ_PACK,ASN1_R_ENCODE_ERROR);
                return NULL;
        }
-       if (!(safe = Malloc (safelen))) {
+       if (!(safe = OPENSSL_malloc (safelen))) {
                ASN1err(ASN1_F_ASN1_SEQ_PACK,ERR_R_MALLOC_FAILURE);
                return NULL;
        }
@@ -134,7 +134,7 @@ ASN1_STRING *ASN1_pack_string (void *obj, int (*i2d)(), ASN1_STRING **oct)
                ASN1err(ASN1_F_ASN1_PACK_STRING,ASN1_R_ENCODE_ERROR);
                return NULL;
        }
-       if (!(p = Malloc (octmp->length))) {
+       if (!(p = OPENSSL_malloc (octmp->length))) {
                ASN1err(ASN1_F_ASN1_PACK_STRING,ERR_R_MALLOC_FAILURE);
                return NULL;
        }
index 3d0b1107cba6b5dc0b3ce19205ec11981e5319a0..56e3cc8df2b79b6bd0aff3a24383c8e48b0547eb 100644 (file)
@@ -153,15 +153,15 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size)
                if (num+i > slen)
                        {
                        if (s == NULL)
-                               sp=(unsigned char *)Malloc(
+                               sp=(unsigned char *)OPENSSL_malloc(
                                        (unsigned int)num+i*2);
                        else
-                               sp=(unsigned char *)Realloc(s,
+                               sp=(unsigned char *)OPENSSL_realloc(s,
                                        (unsigned int)num+i*2);
                        if (sp == NULL)
                                {
                                ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,ERR_R_MALLOC_FAILURE);
-                               if (s != NULL) Free(s);
+                               if (s != NULL) OPENSSL_free(s);
                                goto err;
                                }
                        s=sp;
index cd57331c3f0a57063f817c687681cc589cef50ac..6b090f6740c2c1f6a142773ae8787eee576651d9 100644 (file)
@@ -160,15 +160,15 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
                if (num+i > slen)
                        {
                        if (s == NULL)
-                               sp=(unsigned char *)Malloc(
+                               sp=(unsigned char *)OPENSSL_malloc(
                                        (unsigned int)num+i*2);
                        else
-                               sp=(unsigned char *)Realloc(s,
+                               sp=(unsigned char *)OPENSSL_realloc(s,
                                        (unsigned int)num+i*2);
                        if (sp == NULL)
                                {
                                ASN1err(ASN1_F_A2I_ASN1_INTEGER,ERR_R_MALLOC_FAILURE);
-                               if (s != NULL) Free(s);
+                               if (s != NULL) OPENSSL_free(s);
                                goto err;
                                }
                        s=sp;
index 088313689ab255ae9540874776b0ffa6293fd105..968698a79887744ac35c194f78b0c09071cddf00 100644 (file)
@@ -158,15 +158,15 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
                if (num+i > slen)
                        {
                        if (s == NULL)
-                               sp=(unsigned char *)Malloc(
+                               sp=(unsigned char *)OPENSSL_malloc(
                                        (unsigned int)num+i*2);
                        else
-                               sp=(unsigned char *)Realloc(s,
+                               sp=(unsigned char *)OPENSSL_realloc(s,
                                        (unsigned int)num+i*2);
                        if (sp == NULL)
                                {
                                ASN1err(ASN1_F_A2I_ASN1_STRING,ERR_R_MALLOC_FAILURE);
-                               if (s != NULL) Free(s);
+                               if (s != NULL) OPENSSL_free(s);
                                goto err;
                                }
                        s=sp;
index 61eeb646f9e2eb59a893a8b280febf9591d5a975..b1de17fe075f4cd7e7340e22c896dba2257caed5 100644 (file)
@@ -105,7 +105,7 @@ int i2d_DHparams(DH *a, unsigned char **pp)
        ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
 
        bs.type=V_ASN1_INTEGER;
-       bs.data=(unsigned char *)Malloc(max+4);
+       bs.data=(unsigned char *)OPENSSL_malloc(max+4);
        if (bs.data == NULL)
                {
                ASN1err(ASN1_F_I2D_DHPARAMS,ERR_R_MALLOC_FAILURE);
@@ -118,7 +118,7 @@ int i2d_DHparams(DH *a, unsigned char **pp)
                bs.length=BN_bn2bin(num[i],bs.data);
                i2d_ASN1_INTEGER(&bs,&p);
                }
-       Free(bs.data);
+       OPENSSL_free(bs.data);
        ret=t;
 err:
        if (num[2] != NULL) BN_free(num[2]);
index 4021123ba3f34cf3f7cad3f0ee8293740c9622ae..157fb43893fcf7f7f4603b0874b43e93e0686715 100644 (file)
@@ -94,7 +94,7 @@ int i2d_DSAparams(DSA *a, unsigned char **pp)
        ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
 
        bs.type=V_ASN1_INTEGER;
-       bs.data=(unsigned char *)Malloc(max+4);
+       bs.data=(unsigned char *)OPENSSL_malloc(max+4);
        if (bs.data == NULL)
                {
                ASN1err(ASN1_F_I2D_DSAPARAMS,ERR_R_MALLOC_FAILURE);
@@ -107,7 +107,7 @@ int i2d_DSAparams(DSA *a, unsigned char **pp)
                bs.length=BN_bn2bin(num[i],bs.data);
                i2d_ASN1_INTEGER(&bs,&p);
                }
-       Free(bs.data);
+       OPENSSL_free(bs.data);
        ret=t;
 err:
        *pp=p;
index 1250fa4b2dd83750a11069f88505e7a72aa17dd4..88b1aac989825c95b3f9c5ad5390b8fb1b66ca95 100644 (file)
@@ -107,7 +107,7 @@ int i2d_RSAPrivateKey(RSA *a, unsigned char **pp)
 
        i2d_ASN1_INTEGER(&bs,&p);
 
-       bs.data=(unsigned char *)Malloc(max+4);
+       bs.data=(unsigned char *)OPENSSL_malloc(max+4);
        if (bs.data == NULL)
                {
                ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ERR_R_MALLOC_FAILURE);
@@ -119,7 +119,7 @@ int i2d_RSAPrivateKey(RSA *a, unsigned char **pp)
                bs.length=BN_bn2bin(num[i],bs.data);
                i2d_ASN1_INTEGER(&bs,&p);
                }
-       Free(bs.data);
+       OPENSSL_free(bs.data);
        *pp=p;
        return(t);
        }
index 582b92ee4c19711f7de6df308d71cd145d47f311..8178c2c3b3e0a1c4c7010acf2487355862a4729a 100644 (file)
@@ -93,7 +93,7 @@ int i2d_RSAPublicKey(RSA *a, unsigned char **pp)
        ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
 
        bs.type=V_ASN1_INTEGER;
-       bs.data=(unsigned char *)Malloc(max+4);
+       bs.data=(unsigned char *)OPENSSL_malloc(max+4);
        if (bs.data == NULL)
                {
                ASN1err(ASN1_F_I2D_RSAPUBLICKEY,ERR_R_MALLOC_FAILURE);
@@ -105,7 +105,7 @@ int i2d_RSAPublicKey(RSA *a, unsigned char **pp)
                bs.length=BN_bn2bin(num[i],bs.data);
                i2d_ASN1_INTEGER(&bs,&p);
                }
-       Free(bs.data);
+       OPENSSL_free(bs.data);
        *pp=p;
        return(t);
        }
index e399ceaeb91d4b852f1fe691ad067b7ce53a472e..9922952ad77bba8e340f446b7f6891d192d734a9 100644 (file)
@@ -104,7 +104,7 @@ int i2d_DSAPrivateKey(DSA *a, unsigned char **pp)
 
        i2d_ASN1_INTEGER(&bs,&p);
 
-       bs.data=(unsigned char *)Malloc(max+4);
+       bs.data=(unsigned char *)OPENSSL_malloc(max+4);
        if (bs.data == NULL)
                {
                ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ERR_R_MALLOC_FAILURE);
@@ -116,7 +116,7 @@ int i2d_DSAPrivateKey(DSA *a, unsigned char **pp)
                bs.length=BN_bn2bin(num[i],bs.data);
                i2d_ASN1_INTEGER(&bs,&p);
                }
-       Free(bs.data);
+       OPENSSL_free(bs.data);
        *pp=p;
        return(t);
        }
index ca7f251b719ec86dcd0ed4ed37f02b46d6200dd0..e6014b82a84c5080c1510f2cdd2b1980ef4c2545 100644 (file)
@@ -109,7 +109,7 @@ int i2d_DSAPublicKey(DSA *a, unsigned char **pp)
                ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
 
        bs.type=V_ASN1_INTEGER;
-       bs.data=(unsigned char *)Malloc(max+4);
+       bs.data=(unsigned char *)OPENSSL_malloc(max+4);
        if (bs.data == NULL)
                {
                ASN1err(ASN1_F_I2D_DSAPUBLICKEY,ERR_R_MALLOC_FAILURE);
@@ -121,7 +121,7 @@ int i2d_DSAPublicKey(DSA *a, unsigned char **pp)
                bs.length=BN_bn2bin(num[i],bs.data);
                i2d_ASN1_INTEGER(&bs,&p);
                }
-       Free(bs.data);
+       OPENSSL_free(bs.data);
        *pp=p;
        if(all) return(t);
        else return(tot);
index 5a7d494ff06f39501b776bcf5939379f5cd0a6df..63f408885fd3c152471ebeabccfa57b8a9e83a8e 100644 (file)
@@ -139,8 +139,8 @@ int i2d_Netscape_RSA(RSA *a, unsigned char **pp, int (*cb)())
                }
 
        if (pkey->private_key->data != NULL)
-               Free(pkey->private_key->data);
-       if ((pkey->private_key->data=(unsigned char *)Malloc(l[0])) == NULL)
+               OPENSSL_free(pkey->private_key->data);
+       if ((pkey->private_key->data=(unsigned char *)OPENSSL_malloc(l[0])) == NULL)
                {
                ASN1err(ASN1_F_I2D_NETSCAPE_RSA,ERR_R_MALLOC_FAILURE);
                goto err;
@@ -148,7 +148,7 @@ int i2d_Netscape_RSA(RSA *a, unsigned char **pp, int (*cb)())
        zz=pkey->private_key->data;
        i2d_RSAPrivateKey(a,&zz);
 
-       if ((os2.data=(unsigned char *)Malloc(os2.length)) == NULL)
+       if ((os2.data=(unsigned char *)OPENSSL_malloc(os2.length)) == NULL)
                {
                ASN1err(ASN1_F_I2D_NETSCAPE_RSA,ERR_R_MALLOC_FAILURE);
                goto err;
@@ -182,7 +182,7 @@ int i2d_Netscape_RSA(RSA *a, unsigned char **pp, int (*cb)())
        i2d_ASN1_OCTET_STRING(&os2,&p);
        ret=l[5];
 err:
-       if (os2.data != NULL) Free(os2.data);
+       if (os2.data != NULL) OPENSSL_free(os2.data);
        if (alg != NULL) X509_ALGOR_free(alg);
        if (pkey != NULL) NETSCAPE_PKEY_free(pkey);
        r=r;
@@ -338,7 +338,7 @@ static void NETSCAPE_PKEY_free(NETSCAPE_PKEY *a)
        M_ASN1_INTEGER_free(a->version);
        X509_ALGOR_free(a->algor);
        M_ASN1_OCTET_STRING_free(a->private_key);
-       Free(a);
+       OPENSSL_free(a);
        }
 
 #endif /* NO_RC4 */
index 417d024b81179320390c5a42909b02c2bf4ec607..6e7f09ba236eb48bac075d531d7ed7bdfad18341 100644 (file)
@@ -114,5 +114,5 @@ void NETSCAPE_CERT_SEQUENCE_free (NETSCAPE_CERT_SEQUENCE *a)
        ASN1_OBJECT_free(a->type);
        if(a->certs)
            sk_X509_pop_free(a->certs, X509_free);
-       Free (a);
+       OPENSSL_free (a);
 }
index a147ac329536c892c4307ddc4b7b241e490d3096..b7ed538eb2c808c470a1789913650531a57a3c19 100644 (file)
@@ -103,7 +103,7 @@ void PBEPARAM_free (PBEPARAM *a)
        if(a==NULL) return;
        M_ASN1_OCTET_STRING_free(a->salt);
        M_ASN1_INTEGER_free (a->iter);
-       Free (a);
+       OPENSSL_free (a);
 }
 
 /* Return an algorithm identifier for a PKCS#5 PBE algorithm */
@@ -123,7 +123,7 @@ X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt,
        if(iter <= 0) iter = PKCS5_DEFAULT_ITER;
        ASN1_INTEGER_set (pbe->iter, iter);
        if (!saltlen) saltlen = PKCS5_SALT_LEN;
-       if (!(pbe->salt->data = Malloc (saltlen))) {
+       if (!(pbe->salt->data = OPENSSL_malloc (saltlen))) {
                ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);
                return NULL;
        }
index 1bbdb10c716a5818641badde6d9818b159da367f..6a7b578c0e2293aa97a40c87d587685efdb55e72 100644 (file)
@@ -104,7 +104,7 @@ void PBE2PARAM_free (PBE2PARAM *a)
        if(a==NULL) return;
        X509_ALGOR_free(a->keyfunc);
        X509_ALGOR_free(a->encryption);
-       Free (a);
+       OPENSSL_free (a);
 }
 
 int i2d_PBKDF2PARAM(PBKDF2PARAM *a, unsigned char **pp)
@@ -158,7 +158,7 @@ void PBKDF2PARAM_free (PBKDF2PARAM *a)
        M_ASN1_INTEGER_free(a->iter);
        M_ASN1_INTEGER_free(a->keylength);
        X509_ALGOR_free(a->prf);
-       Free (a);
+       OPENSSL_free (a);
 }
 
 /* Return an algorithm identifier for a PKCS#5 v2.0 PBE algorithm:
@@ -210,7 +210,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
        if(!(osalt = M_ASN1_OCTET_STRING_new())) goto merr;
 
        if (!saltlen) saltlen = PKCS5_SALT_LEN;
-       if (!(osalt->data = Malloc (saltlen))) goto merr;
+       if (!(osalt->data = OPENSSL_malloc (saltlen))) goto merr;
        osalt->length = saltlen;
        if (salt) memcpy (osalt->data, salt, saltlen);
        else if (RAND_pseudo_bytes (osalt->data, saltlen) < 0) goto merr;
index cba90e94a1e0e5313062f679aa8452bc8a90c6b1..c170244616b0b20e4df4b2c38172d6088db0437b 100644 (file)
@@ -116,6 +116,6 @@ void PKCS7_DIGEST_free(PKCS7_DIGEST *a)
        X509_ALGOR_free(a->md);
        PKCS7_free(a->contents);
        M_ASN1_OCTET_STRING_free(a->digest);
-       Free(a);
+       OPENSSL_free(a);
        }
 
index 83b0e15faa7e9edfee8b38a287ed118f7cc8bd15..38ccafbdb0ddaba99d83f71a6888a763189df230 100644 (file)
@@ -106,6 +106,6 @@ void PKCS7_ENCRYPT_free(PKCS7_ENCRYPT *a)
        if (a == NULL) return;
        M_ASN1_INTEGER_free(a->version);
        PKCS7_ENC_CONTENT_free(a->enc_data);
-       Free(a);
+       OPENSSL_free(a);
        }
 
index 582cc78b069dcdea568944694bfd5588439686ec..031178ab52c0f6c806669a541bf13547efd07dcd 100644 (file)
@@ -115,6 +115,6 @@ void PKCS7_ENC_CONTENT_free(PKCS7_ENC_CONTENT *a)
        ASN1_OBJECT_free(a->content_type);
        X509_ALGOR_free(a->algorithm);
        M_ASN1_OCTET_STRING_free(a->enc_data);
-       Free(a);
+       OPENSSL_free(a);
        }
 
index 4e734fdd289e7c97bbd62e72b96f9c27a0987caa..60be3e5f66036a00c14f226791147612fd402fe6 100644 (file)
@@ -114,6 +114,6 @@ void PKCS7_ENVELOPE_free(PKCS7_ENVELOPE *a)
        M_ASN1_INTEGER_free(a->version);
        sk_PKCS7_RECIP_INFO_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free);
        PKCS7_ENC_CONTENT_free(a->enc_data);
-       Free(a);
+       OPENSSL_free(a);
        }
 
index d21f7ddb846a40ae62ef1943845d42eefcc8db96..4a7260a5c84fcd49fb48cdeb0c9ccc4e91a0f183 100644 (file)
@@ -106,6 +106,6 @@ void PKCS7_ISSUER_AND_SERIAL_free(PKCS7_ISSUER_AND_SERIAL *a)
        if (a == NULL) return;
        X509_NAME_free(a->issuer);
        M_ASN1_INTEGER_free(a->serial);
-       Free(a);
+       OPENSSL_free(a);
        }
 
index 9effc28622bacc0a30a9c64663e54da9ac6d3d42..90ead17dbc756a6bf719eb7de035fda40e8418a7 100644 (file)
@@ -152,7 +152,7 @@ PKCS7 *d2i_PKCS7(PKCS7 **a, unsigned char **pp, long length)
                {
                if ((*a)->asn1 != NULL)
                        {
-                       Free((*a)->asn1);
+                       OPENSSL_free((*a)->asn1);
                        (*a)->asn1=NULL;
                        }
                (*a)->length=0;
@@ -251,7 +251,7 @@ void PKCS7_free(PKCS7 *a)
                {
                ASN1_OBJECT_free(a->type);
                }
-       Free(a);
+       OPENSSL_free(a);
        }
 
 void PKCS7_content_free(PKCS7 *a)
@@ -259,7 +259,7 @@ void PKCS7_content_free(PKCS7 *a)
        if(a == NULL)
            return;
 
-       if (a->asn1 != NULL) Free(a->asn1);
+       if (a->asn1 != NULL) OPENSSL_free(a->asn1);
 
        if (a->d.ptr != NULL)
                {
index b1abfa3b8f2bbb30892343710e0fcd747b333164..5f6c88a2fa476a36e356300297bda458ae42fcb5 100644 (file)
@@ -118,7 +118,7 @@ void PKCS7_RECIP_INFO_free(PKCS7_RECIP_INFO *a)
        X509_ALGOR_free(a->key_enc_algor);
        M_ASN1_OCTET_STRING_free(a->enc_key);
        if (a->cert != NULL) X509_free(a->cert);
-       Free(a);
+       OPENSSL_free(a);
        }
 
 IMPLEMENT_STACK_OF(PKCS7_RECIP_INFO)
index 3d18fedf8e5be79b9dfac58e8196676f7a693b3f..709eb24b27cc73b46c3d699bfc0d7f2b72aa17f6 100644 (file)
@@ -140,6 +140,6 @@ void PKCS7_SIGN_ENVELOPE_free(PKCS7_SIGN_ENVELOPE *a)
        sk_X509_pop_free(a->cert,X509_free);
        sk_X509_CRL_pop_free(a->crl,X509_CRL_free);
        sk_PKCS7_SIGNER_INFO_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free);
-       Free(a);
+       OPENSSL_free(a);
        }
 
index f6f16a87158dcf8b6ec949a64a20645bb9168263..c835f5475f973ceb3de62066d5e24f01da76f7a3 100644 (file)
@@ -131,5 +131,5 @@ void PKCS7_SIGNED_free(PKCS7_SIGNED *a)
        sk_X509_pop_free(a->cert,X509_free);
        sk_X509_CRL_pop_free(a->crl,X509_CRL_free);
        sk_PKCS7_SIGNER_INFO_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free);
-       Free(a);
+       OPENSSL_free(a);
        }
index f74658ffe68907cbd7332dd59536af71ab2154b8..248bf0094546955b9a107ac03872ab7307bf8e16 100644 (file)
@@ -143,7 +143,7 @@ void PKCS7_SIGNER_INFO_free(PKCS7_SIGNER_INFO *a)
        sk_X509_ATTRIBUTE_pop_free(a->unauth_attr,X509_ATTRIBUTE_free);
        if (a->pkey != NULL)
                EVP_PKEY_free(a->pkey);
-       Free(a);
+       OPENSSL_free(a);
        }
 
 IMPLEMENT_STACK_OF(PKCS7_SIGNER_INFO)
index 0b243746279c19b59bb4bb973afe7b1e3d1f6f4c..3a31248e14bed185395f27646d5afd7209678ab8 100644 (file)
@@ -94,7 +94,7 @@ X509 *X509_KEY_new(void)
        {
        X509_KEY *ret=NULL;
 
-       M_ASN1_New_Malloc(ret,X509_KEY);
+       M_ASN1_New_OPENSSL_malloc(ret,X509_KEY);
        ret->references=1;
        ret->type=NID
        M_ASN1_New(ret->cert_info,X509_CINF_new);
@@ -126,6 +126,6 @@ void X509_KEY_free(X509 *a)
        X509_CINF_free(a->cert_info);
        X509_ALGOR_free(a->sig_alg);
        ASN1_BIT_STRING_free(a->signature);
-       Free(a);
+       OPENSSL_free(a);
        }
 
index 59cfbe7f2805320710c73a207a99ee7b612f3ebd..fa6cbfb6f88562933f2ad7985cec10029d31e435 100644 (file)
@@ -123,5 +123,5 @@ void PKCS8_PRIV_KEY_INFO_free (PKCS8_PRIV_KEY_INFO *a)
                                 0, a->pkey->value.octet_string->length);
        ASN1_TYPE_free (a->pkey);
        sk_X509_ATTRIBUTE_pop_free (a->attributes, X509_ATTRIBUTE_free);
-       Free (a);
+       OPENSSL_free (a);
 }
index e570ed1c473804f0b6bb705cfcabf7f54bb4bf46..ae18da96e3d19b0856666c2e5728a7e3b365c786 100644 (file)
@@ -99,7 +99,7 @@ int RSA_print(BIO *bp, RSA *x, int off)
        int i,ret=0;
 
        i=RSA_size(x);
-       m=(unsigned char *)Malloc((unsigned int)i+10);
+       m=(unsigned char *)OPENSSL_malloc((unsigned int)i+10);
        if (m == NULL)
                {
                RSAerr(RSA_F_RSA_PRINT,ERR_R_MALLOC_FAILURE);
@@ -133,7 +133,7 @@ int RSA_print(BIO *bp, RSA *x, int off)
        if (!print(bp,"coefficient:",x->iqmp,m,off)) goto err;
        ret=1;
 err:
-       if (m != NULL) Free(m);
+       if (m != NULL) OPENSSL_free(m);
        return(ret);
        }
 #endif /* NO_RSA */
@@ -176,7 +176,7 @@ int DSA_print(BIO *bp, DSA *x, int off)
                i=BN_num_bytes(bn)*2;
        else
                i=256;
-       m=(unsigned char *)Malloc((unsigned int)i+10);
+       m=(unsigned char *)OPENSSL_malloc((unsigned int)i+10);
        if (m == NULL)
                {
                DSAerr(DSA_F_DSA_PRINT,ERR_R_MALLOC_FAILURE);
@@ -204,7 +204,7 @@ int DSA_print(BIO *bp, DSA *x, int off)
        if ((x->g != NULL) && !print(bp,"G:   ",x->g,m,off)) goto err;
        ret=1;
 err:
-       if (m != NULL) Free(m);
+       if (m != NULL) OPENSSL_free(m);
        return(ret);
        }
 #endif /* !NO_DSA */
@@ -284,7 +284,7 @@ int DHparams_print(BIO *bp, DH *x)
        int reason=ERR_R_BUF_LIB,i,ret=0;
 
        i=BN_num_bytes(x->p);
-       m=(unsigned char *)Malloc((unsigned int)i+10);
+       m=(unsigned char *)OPENSSL_malloc((unsigned int)i+10);
        if (m == NULL)
                {
                reason=ERR_R_MALLOC_FAILURE;
@@ -307,7 +307,7 @@ int DHparams_print(BIO *bp, DH *x)
 err:
                DHerr(DH_F_DHPARAMS_PRINT,reason);
                }
-       if (m != NULL) Free(m);
+       if (m != NULL) OPENSSL_free(m);
        return(ret);
        }
 #endif
@@ -337,7 +337,7 @@ int DSAparams_print(BIO *bp, DSA *x)
        int reason=ERR_R_BUF_LIB,i,ret=0;
 
        i=BN_num_bytes(x->p);
-       m=(unsigned char *)Malloc((unsigned int)i+10);
+       m=(unsigned char *)OPENSSL_malloc((unsigned int)i+10);
        if (m == NULL)
                {
                reason=ERR_R_MALLOC_FAILURE;
@@ -352,7 +352,7 @@ int DSAparams_print(BIO *bp, DSA *x)
        if (!print(bp,"g:",x->g,m,4)) goto err;
        ret=1;
 err:
-       if (m != NULL) Free(m);
+       if (m != NULL) OPENSSL_free(m);
        DSAerr(DSA_F_DSAPARAMS_PRINT,reason);
        return(ret);
        }
index 6ee1065ce9468c081f087d24dc3d2ecdf65c6e4f..314bdfb1c713d7cd218cefe1665c6668d8bd5c55 100644 (file)
@@ -223,7 +223,7 @@ int X509_print(BIO *bp, X509 *x)
        ret=1;
 err:
        if (str != NULL) ASN1_STRING_free(str);
-       if (m != NULL) Free(m);
+       if (m != NULL) OPENSSL_free(m);
        return(ret);
        }
 
index fe023842f84a302715e03431beb5e253a3cc29b2..853a8dfeef49b9cdb9d63d74de7715f00a60847f 100644 (file)
@@ -111,7 +111,7 @@ void X509_ALGOR_free(X509_ALGOR *a)
        if (a == NULL) return;
        ASN1_OBJECT_free(a->algorithm);
        ASN1_TYPE_free(a->parameter);
-       Free(a);
+       OPENSSL_free(a);
        }
 
 IMPLEMENT_STACK_OF(X509_ALGOR)
index a874df79db60d3a3f5751921234234d2646ea96d..14e5ea27aa76625c852fe32d58708e06cc2d692b 100644 (file)
@@ -160,6 +160,6 @@ void X509_ATTRIBUTE_free(X509_ATTRIBUTE *a)
                sk_ASN1_TYPE_pop_free(a->value.set,ASN1_TYPE_free);
        else
                ASN1_TYPE_free(a->value.single);
-       Free(a);
+       OPENSSL_free(a);
        }
 
index b87c8fff1713f4196e93c16a4a6fc9e4d9e8c7c2..339a110eefd62c4449f0a46d7c911ee67261a507 100644 (file)
@@ -196,6 +196,6 @@ void X509_CINF_free(X509_CINF *a)
        M_ASN1_BIT_STRING_free(a->issuerUID);
        M_ASN1_BIT_STRING_free(a->subjectUID);
        sk_X509_EXTENSION_pop_free(a->extensions,X509_EXTENSION_free);
-       Free(a);
+       OPENSSL_free(a);
        }
 
index 39fe8916fa4fab18b5195afa59553583f6dfbc42..1f302d0e01eb39b5ee32fd264d3986d4d2db9400 100644 (file)
@@ -286,7 +286,7 @@ void X509_REVOKED_free(X509_REVOKED *a)
        M_ASN1_INTEGER_free(a->serialNumber);
        M_ASN1_UTCTIME_free(a->revocationDate);
        sk_X509_EXTENSION_pop_free(a->extensions,X509_EXTENSION_free);
-       Free(a);
+       OPENSSL_free(a);
        }
 
 void X509_CRL_INFO_free(X509_CRL_INFO *a)
@@ -300,7 +300,7 @@ void X509_CRL_INFO_free(X509_CRL_INFO *a)
                M_ASN1_UTCTIME_free(a->nextUpdate);
        sk_X509_REVOKED_pop_free(a->revoked,X509_REVOKED_free);
        sk_X509_EXTENSION_pop_free(a->extensions,X509_EXTENSION_free);
-       Free(a);
+       OPENSSL_free(a);
        }
 
 void X509_CRL_free(X509_CRL *a)
@@ -325,7 +325,7 @@ void X509_CRL_free(X509_CRL *a)
        X509_CRL_INFO_free(a->crl);
        X509_ALGOR_free(a->sig_alg);
        M_ASN1_BIT_STRING_free(a->signature);
-       Free(a);
+       OPENSSL_free(a);
        }
 
 static int X509_REVOKED_cmp(const X509_REVOKED * const *a,
index 185cbd78a0fa2641889458629cad366a531614c6..fbfd963b4063900686d83fa98fdf0c75134614a9 100644 (file)
@@ -134,6 +134,6 @@ void X509_EXTENSION_free(X509_EXTENSION *a)
        if (a == NULL) return;
        ASN1_OBJECT_free(a->object);
        M_ASN1_OCTET_STRING_free(a->value);
-       Free(a);
+       OPENSSL_free(a);
        }
 
index 7fdc6f9dc81c7e63d84d94469eaf67a05725c0da..5e62fc2f6f1a4d0481c32f359040c4c3c43f546a 100644 (file)
@@ -66,7 +66,7 @@ X509_INFO *X509_INFO_new(void)
        {
        X509_INFO *ret=NULL;
 
-       ret=(X509_INFO *)Malloc(sizeof(X509_INFO));
+       ret=(X509_INFO *)OPENSSL_malloc(sizeof(X509_INFO));
        if (ret == NULL)
                {
                ASN1err(ASN1_F_X509_INFO_NEW,ERR_R_MALLOC_FAILURE);
@@ -106,8 +106,8 @@ void X509_INFO_free(X509_INFO *x)
        if (x->x509 != NULL) X509_free(x->x509);
        if (x->crl != NULL) X509_CRL_free(x->crl);
        if (x->x_pkey != NULL) X509_PKEY_free(x->x_pkey);
-       if (x->enc_data != NULL) Free(x->enc_data);
-       Free(x);
+       if (x->enc_data != NULL) OPENSSL_free(x->enc_data);
+       OPENSSL_free(x);
        }
 
 IMPLEMENT_STACK_OF(X509_INFO)
index 62e0ed0fc7fe5d99383d8ef35448cdf22d41e142..b832deb928b0fe48d35fd55ceb5a3f5126caabf2 100644 (file)
@@ -246,7 +246,7 @@ void X509_NAME_free(X509_NAME *a)
 
        BUF_MEM_free(a->bytes);
        sk_X509_NAME_ENTRY_pop_free(a->entries,X509_NAME_ENTRY_free);
-       Free(a);
+       OPENSSL_free(a);
        }
 
 void X509_NAME_ENTRY_free(X509_NAME_ENTRY *a)
@@ -254,7 +254,7 @@ void X509_NAME_ENTRY_free(X509_NAME_ENTRY *a)
        if (a == NULL) return;
        ASN1_OBJECT_free(a->object);
        M_ASN1_BIT_STRING_free(a->value);
-       Free(a);
+       OPENSSL_free(a);
        }
 
 int X509_NAME_set(X509_NAME **xn, X509_NAME *name)
index fe58919dbbaeddd3bfc7d11f4cbd89ea5065ac68..f1c6221ac3f1cd3e64f8293547100c1fd76a8168 100644 (file)
@@ -146,6 +146,6 @@ void X509_PKEY_free(X509_PKEY *x)
        if (x->enc_algor != NULL) X509_ALGOR_free(x->enc_algor);
        if (x->enc_pkey != NULL) M_ASN1_OCTET_STRING_free(x->enc_pkey);
        if (x->dec_pkey != NULL)EVP_PKEY_free(x->dec_pkey);
-       if ((x->key_data != NULL) && (x->key_free)) Free(x->key_data);
-       Free(x);
+       if ((x->key_data != NULL) && (x->key_free)) OPENSSL_free(x->key_data);
+       OPENSSL_free(x);
        }
index 7a05d575c992da5f7ec1ead114ae31eac4d9af91..b2e2a514777094311ebfb93e2013e1c705b3793a 100644 (file)
@@ -112,7 +112,7 @@ void X509_PUBKEY_free(X509_PUBKEY *a)
        X509_ALGOR_free(a->algor);
        M_ASN1_BIT_STRING_free(a->public_key);
        if (a->pkey != NULL) EVP_PKEY_free(a->pkey);
-       Free(a);
+       OPENSSL_free(a);
        }
 
 int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
@@ -156,14 +156,14 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
                dsa->write_params=0;
                ASN1_TYPE_free(a->parameter);
                i=i2d_DSAparams(dsa,NULL);
-               p=(unsigned char *)Malloc(i);
+               p=(unsigned char *)OPENSSL_malloc(i);
                pp=p;
                i2d_DSAparams(dsa,&pp);
                a->parameter=ASN1_TYPE_new();
                a->parameter->type=V_ASN1_SEQUENCE;
                a->parameter->value.sequence=ASN1_STRING_new();
                ASN1_STRING_set(a->parameter->value.sequence,p,i);
-               Free(p);
+               OPENSSL_free(p);
                }
        else
 #endif
@@ -173,7 +173,7 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
                }
 
        if ((i=i2d_PublicKey(pkey,NULL)) <= 0) goto err;
-       if ((s=(unsigned char *)Malloc(i+1)) == NULL) goto err;
+       if ((s=(unsigned char *)OPENSSL_malloc(i+1)) == NULL) goto err;
        p=s;
        i2d_PublicKey(pkey,&p);
        if (!M_ASN1_BIT_STRING_set(pk->public_key,s,i)) goto err;
@@ -181,7 +181,7 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
        pk->public_key->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
        pk->public_key->flags|=ASN1_STRING_FLAG_BITS_LEFT;
 
-       Free(s);
+       OPENSSL_free(s);
 
 #if 0
        CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY);
index 0cd572ee73b21470f1764d7da4e8de22f3900b98..0056009885acf4f063806b8c69e46b53eb56796a 100644 (file)
@@ -163,7 +163,7 @@ void X509_REQ_INFO_free(X509_REQ_INFO *a)
        X509_NAME_free(a->subject);
        X509_PUBKEY_free(a->pubkey);
        sk_X509_ATTRIBUTE_pop_free(a->attributes,X509_ATTRIBUTE_free);
-       Free(a);
+       OPENSSL_free(a);
        }
 
 int i2d_X509_REQ(X509_REQ *a, unsigned char **pp)
@@ -230,7 +230,7 @@ void X509_REQ_free(X509_REQ *a)
        X509_REQ_INFO_free(a->req_info);
        X509_ALGOR_free(a->sig_alg);
        M_ASN1_BIT_STRING_free(a->signature);
-       Free(a);
+       OPENSSL_free(a);
        }
 
 
index 3559bd536853dbdc7e1c1d357c68c8e27da25e42..d79f147647cc6bdaedaa9857cc7dfceb2f1c71d3 100644 (file)
@@ -104,7 +104,7 @@ void X509_SIG_free(X509_SIG *a)
        if (a == NULL) return;
        X509_ALGOR_free(a->algor);
        M_ASN1_OCTET_STRING_free(a->digest);
-       Free(a);
+       OPENSSL_free(a);
        }
 
 
index 8f5e7e6380a28e8252dad3e6ffeab69b1ee41a75..4f01888f7d53c892fd974356d4f7b13dc7185305 100644 (file)
@@ -109,7 +109,7 @@ void NETSCAPE_SPKAC_free(NETSCAPE_SPKAC *a)
        if (a == NULL) return;
        X509_PUBKEY_free(a->pubkey);
        M_ASN1_IA5STRING_free(a->challenge);
-       Free(a);
+       OPENSSL_free(a);
        }
 
 int i2d_NETSCAPE_SPKI(NETSCAPE_SPKI *a, unsigned char **pp)
@@ -161,6 +161,6 @@ void NETSCAPE_SPKI_free(NETSCAPE_SPKI *a)
        NETSCAPE_SPKAC_free(a->spkac);
        X509_ALGOR_free(a->sig_algor);
        M_ASN1_BIT_STRING_free(a->signature);
-       Free(a);
+       OPENSSL_free(a);
        }
 
index 1a2f49ffdfd2e227d876912232e0560f18f40f55..0f8f020b57d332f1d97c1819248bb0e44bd0bb3e 100644 (file)
@@ -104,6 +104,6 @@ void X509_VAL_free(X509_VAL *a)
        if (a == NULL) return;
        M_ASN1_TIME_free(a->notBefore);
        M_ASN1_TIME_free(a->notAfter);
-       Free(a);
+       OPENSSL_free(a);
        }
 
index 11e564ea30a8ca30157fab3ac5ef2228fa203810..ea71a29c9ab19776ed7bea9c563b3262561a499b 100644 (file)
@@ -102,7 +102,7 @@ X509 *d2i_X509(X509 **a, unsigned char **pp, long length)
        M_ASN1_D2I_get(ret->cert_info,d2i_X509_CINF);
        M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR);
        M_ASN1_D2I_get(ret->signature,d2i_ASN1_BIT_STRING);
-       if (ret->name != NULL) Free(ret->name);
+       if (ret->name != NULL) OPENSSL_free(ret->name);
        ret->name=X509_NAME_oneline(ret->cert_info->subject,NULL,0);
 
        M_ASN1_D2I_Finish(a,X509_free,ASN1_F_D2I_X509);
@@ -152,8 +152,8 @@ void X509_free(X509 *a)
        M_ASN1_BIT_STRING_free(a->signature);
        X509_CERT_AUX_free(a->aux);
 
-       if (a->name != NULL) Free(a->name);
-       Free(a);
+       if (a->name != NULL) OPENSSL_free(a->name);
+       OPENSSL_free(a);
        }
 
 int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
index b9987ea96890ec4f82db635681a77a02457c942b..42807cd334654e605cf837dec43a1b228d97cc05 100644 (file)
@@ -112,7 +112,7 @@ void X509_CERT_AUX_free(X509_CERT_AUX *a)
        ASN1_UTF8STRING_free(a->alias);
        ASN1_OCTET_STRING_free(a->keyid);
        sk_X509_ALGOR_pop_free(a->other, X509_ALGOR_free);
-       Free(a);
+       OPENSSL_free(a);
 }
 
 int i2d_X509_CERT_AUX(X509_CERT_AUX *a, unsigned char **pp)
index 33fa27ac6c9446c2764ba7798d84f98aa73e820b..aafa85bd12a55070805bc4745503889cbb8fe510 100644 (file)
@@ -792,11 +792,11 @@ doapr_outch(
     if (*buffer == NULL) {
        if (*maxlen == 0)
            *maxlen = 1024;
-       *buffer = Malloc(*maxlen);
+       *buffer = OPENSSL_malloc(*maxlen);
     }
     while (*currlen >= *maxlen) {
        *maxlen += 1024;
-       *buffer = Realloc(*buffer, *maxlen);
+       *buffer = OPENSSL_realloc(*buffer, *maxlen);
     }
     /* What to do if *buffer is NULL? */
     assert(*buffer != NULL);
@@ -834,7 +834,7 @@ int BIO_printf (BIO *bio, const char *format, ...)
                ret=BIO_write(bio, hugebuf, (int)retlen);
 
 #ifdef USE_ALLOCATING_PRINT
-               Free(hugebuf);
+               OPENSSL_free(hugebuf);
                }
        CRYPTO_pop_info();
 #endif
index 6409f98f570071b6e5a3501b5e98ec7cceda2ebe..b2958788b658bdd2c83f6e6f495b1461e4c70c0a 100644 (file)
@@ -267,14 +267,14 @@ static struct hostent *ghbn_dup(struct hostent *a)
        int i,j;
 
        MemCheck_off();
-       ret=(struct hostent *)Malloc(sizeof(struct hostent));
+       ret=(struct hostent *)OPENSSL_malloc(sizeof(struct hostent));
        if (ret == NULL) return(NULL);
        memset(ret,0,sizeof(struct hostent));
 
        for (i=0; a->h_aliases[i] != NULL; i++)
                ;
        i++;
-       ret->h_aliases = (char **)Malloc(i*sizeof(char *));
+       ret->h_aliases = (char **)OPENSSL_malloc(i*sizeof(char *));
        if (ret->h_aliases == NULL)
                goto err;
        memset(ret->h_aliases, 0, i*sizeof(char *));
@@ -282,25 +282,25 @@ static struct hostent *ghbn_dup(struct hostent *a)
        for (i=0; a->h_addr_list[i] != NULL; i++)
                ;
        i++;
-       ret->h_addr_list=(char **)Malloc(i*sizeof(char *));
+       ret->h_addr_list=(char **)OPENSSL_malloc(i*sizeof(char *));
        if (ret->h_addr_list == NULL)
                goto err;
        memset(ret->h_addr_list, 0, i*sizeof(char *));
 
        j=strlen(a->h_name)+1;
-       if ((ret->h_name=Malloc(j)) == NULL) goto err;
+       if ((ret->h_name=OPENSSL_malloc(j)) == NULL) goto err;
        memcpy((char *)ret->h_name,a->h_name,j);
        for (i=0; a->h_aliases[i] != NULL; i++)
                {
                j=strlen(a->h_aliases[i])+1;
-               if ((ret->h_aliases[i]=Malloc(j)) == NULL) goto err;
+               if ((ret->h_aliases[i]=OPENSSL_malloc(j)) == NULL) goto err;
                memcpy(ret->h_aliases[i],a->h_aliases[i],j);
                }
        ret->h_length=a->h_length;
        ret->h_addrtype=a->h_addrtype;
        for (i=0; a->h_addr_list[i] != NULL; i++)
                {
-               if ((ret->h_addr_list[i]=Malloc(a->h_length)) == NULL)
+               if ((ret->h_addr_list[i]=OPENSSL_malloc(a->h_length)) == NULL)
                        goto err;
                memcpy(ret->h_addr_list[i],a->h_addr_list[i],a->h_length);
                }
@@ -325,17 +325,17 @@ static void ghbn_free(struct hostent *a)
        if (a->h_aliases != NULL)
                {
                for (i=0; a->h_aliases[i] != NULL; i++)
-                       Free(a->h_aliases[i]);
-               Free(a->h_aliases);
+                       OPENSSL_free(a->h_aliases[i]);
+               OPENSSL_free(a->h_aliases);
                }
        if (a->h_addr_list != NULL)
                {
                for (i=0; a->h_addr_list[i] != NULL; i++)
-                       Free(a->h_addr_list[i]);
-               Free(a->h_addr_list);
+                       OPENSSL_free(a->h_addr_list[i]);
+               OPENSSL_free(a->h_addr_list);
                }
-       if (a->h_name != NULL) Free(a->h_name);
-       Free(a);
+       if (a->h_name != NULL) OPENSSL_free(a->h_name);
+       OPENSSL_free(a);
        }
 
 struct hostent *BIO_gethostbyname(const char *name)
@@ -628,7 +628,7 @@ again:
                }
        ret=1;
 err:
-       if (str != NULL) Free(str);
+       if (str != NULL) OPENSSL_free(str);
        if ((ret == 0) && (s != INVALID_SOCKET))
                {
                closesocket(s);
@@ -667,7 +667,7 @@ int BIO_accept(int sock, char **addr)
        port=ntohs(from.sin_port);
        if (*addr == NULL)
                {
-               if ((p=Malloc(24)) == NULL)
+               if ((p=OPENSSL_malloc(24)) == NULL)
                        {
                        BIOerr(BIO_F_BIO_ACCEPT,ERR_R_MALLOC_FAILURE);
                        goto end;
index edffe92bce9b0dbf23447fc8918dd1fb45f71ce7..e9916d29eb7de5497f4c9ef34446fb6608f6f119 100644 (file)
@@ -95,12 +95,12 @@ static int buffer_new(BIO *bi)
        {
        BIO_F_BUFFER_CTX *ctx;
 
-       ctx=(BIO_F_BUFFER_CTX *)Malloc(sizeof(BIO_F_BUFFER_CTX));
+       ctx=(BIO_F_BUFFER_CTX *)OPENSSL_malloc(sizeof(BIO_F_BUFFER_CTX));
        if (ctx == NULL) return(0);
-       ctx->ibuf=(char *)Malloc(DEFAULT_BUFFER_SIZE);
-       if (ctx->ibuf == NULL) { Free(ctx); return(0); }
-       ctx->obuf=(char *)Malloc(DEFAULT_BUFFER_SIZE);
-       if (ctx->obuf == NULL) { Free(ctx->ibuf); Free(ctx); return(0); }
+       ctx->ibuf=(char *)OPENSSL_malloc(DEFAULT_BUFFER_SIZE);
+       if (ctx->ibuf == NULL) { OPENSSL_free(ctx); return(0); }
+       ctx->obuf=(char *)OPENSSL_malloc(DEFAULT_BUFFER_SIZE);
+       if (ctx->obuf == NULL) { OPENSSL_free(ctx->ibuf); OPENSSL_free(ctx); return(0); }
        ctx->ibuf_size=DEFAULT_BUFFER_SIZE;
        ctx->obuf_size=DEFAULT_BUFFER_SIZE;
        ctx->ibuf_len=0;
@@ -120,9 +120,9 @@ static int buffer_free(BIO *a)
 
        if (a == NULL) return(0);
        b=(BIO_F_BUFFER_CTX *)a->ptr;
-       if (b->ibuf != NULL) Free(b->ibuf);
-       if (b->obuf != NULL) Free(b->obuf);
-       Free(a->ptr);
+       if (b->ibuf != NULL) OPENSSL_free(b->ibuf);
+       if (b->obuf != NULL) OPENSSL_free(b->obuf);
+       OPENSSL_free(a->ptr);
        a->ptr=NULL;
        a->init=0;
        a->flags=0;
@@ -319,9 +319,9 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)
        case BIO_C_SET_BUFF_READ_DATA:
                if (num > ctx->ibuf_size)
                        {
-                       p1=Malloc((int)num);
+                       p1=OPENSSL_malloc((int)num);
                        if (p1 == NULL) goto malloc_error;
-                       if (ctx->ibuf != NULL) Free(ctx->ibuf);
+                       if (ctx->ibuf != NULL) OPENSSL_free(ctx->ibuf);
                        ctx->ibuf=p1;
                        }
                ctx->ibuf_off=0;
@@ -353,21 +353,21 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)
                p2=ctx->obuf;
                if ((ibs > DEFAULT_BUFFER_SIZE) && (ibs != ctx->ibuf_size))
                        {
-                       p1=(char *)Malloc((int)num);
+                       p1=(char *)OPENSSL_malloc((int)num);
                        if (p1 == NULL) goto malloc_error;
                        }
                if ((obs > DEFAULT_BUFFER_SIZE) && (obs != ctx->obuf_size))
                        {
-                       p2=(char *)Malloc((int)num);
+                       p2=(char *)OPENSSL_malloc((int)num);
                        if (p2 == NULL)
                                {
-                               if (p1 != ctx->ibuf) Free(p1);
+                               if (p1 != ctx->ibuf) OPENSSL_free(p1);
                                goto malloc_error;
                                }
                        }
                if (ctx->ibuf != p1)
                        {
-                       Free(ctx->ibuf);
+                       OPENSSL_free(ctx->ibuf);
                        ctx->ibuf=p1;
                        ctx->ibuf_off=0;
                        ctx->ibuf_len=0;
@@ -375,7 +375,7 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)
                        }
                if (ctx->obuf != p2)
                        {
-                       Free(ctx->obuf);
+                       OPENSSL_free(ctx->obuf);
                        ctx->obuf=p2;
                        ctx->obuf_off=0;
                        ctx->obuf_len=0;
index 9b4bcb19d43792e04a1be8bb8b2bf7931c14c791..a4a60a0c6dbd2fb934a88f7e6926f0edce456a3f 100644 (file)
@@ -104,7 +104,7 @@ static int nbiof_new(BIO *bi)
        {
        NBIO_TEST *nt;
 
-       nt=(NBIO_TEST *)Malloc(sizeof(NBIO_TEST));
+       nt=(NBIO_TEST *)OPENSSL_malloc(sizeof(NBIO_TEST));
        nt->lrn= -1;
        nt->lwn= -1;
        bi->ptr=(char *)nt;
@@ -117,7 +117,7 @@ static int nbiof_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;
index 77e43763cb041267fd1d1f857916797d6fddb013..d8cb83aaabaf8c592588cfefeba7d48a7dacda8b 100644 (file)
@@ -70,7 +70,7 @@ BIO *BIO_new(BIO_METHOD *method)
        {
        BIO *ret=NULL;
 
-       ret=(BIO *)Malloc(sizeof(BIO));
+       ret=(BIO *)OPENSSL_malloc(sizeof(BIO));
        if (ret == NULL)
                {
                BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);
@@ -78,7 +78,7 @@ BIO *BIO_new(BIO_METHOD *method)
                }
        if (!BIO_set(ret,method))
                {
-               Free(ret);
+               OPENSSL_free(ret);
                ret=NULL;
                }
        return(ret);
@@ -133,7 +133,7 @@ int BIO_free(BIO *a)
 
        if ((a->method == NULL) || (a->method->destroy == NULL)) return(1);
        ret=a->method->destroy(a);
-       Free(a);
+       OPENSSL_free(a);
        return(1);
        }
 
index 09e8c90b536fac87ae20aa6c597418c2df6a0f78..4da5822062c173c13dec556bfec52158a02f6be0 100644 (file)
@@ -145,7 +145,7 @@ BIO_ACCEPT *BIO_ACCEPT_new(void)
        {
        BIO_ACCEPT *ret;
 
-       if ((ret=(BIO_ACCEPT *)Malloc(sizeof(BIO_ACCEPT))) == NULL)
+       if ((ret=(BIO_ACCEPT *)OPENSSL_malloc(sizeof(BIO_ACCEPT))) == NULL)
                return(NULL);
 
        memset(ret,0,sizeof(BIO_ACCEPT));
@@ -159,10 +159,10 @@ void BIO_ACCEPT_free(BIO_ACCEPT *a)
        if(a == NULL)
            return;
 
-       if (a->param_addr != NULL) Free(a->param_addr);
-       if (a->addr != NULL) Free(a->addr);
+       if (a->param_addr != NULL) OPENSSL_free(a->param_addr);
+       if (a->addr != NULL) OPENSSL_free(a->addr);
        if (a->bio_chain != NULL) BIO_free(a->bio_chain);
-       Free(a);
+       OPENSSL_free(a);
        }
 
 static void acpt_close_socket(BIO *bio)
@@ -355,7 +355,7 @@ static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr)
                                {
                                b->init=1;
                                if (data->param_addr != NULL)
-                                       Free(data->param_addr);
+                                       OPENSSL_free(data->param_addr);
                                data->param_addr=BUF_strdup(ptr);
                                }
                        else if (num == 1)
index 94cc63c9fe6f94fda150ef3e79da746658188bf3..78c6ab4fdd97ec2af93188ac69b6df04af9c0de3 100644 (file)
@@ -80,7 +80,7 @@ static int bio_new(BIO *bio)
        {
        struct bio_bio_st *b;
        
-       b = Malloc(sizeof *b);
+       b = OPENSSL_malloc(sizeof *b);
        if (b == NULL)
                return 0;
 
@@ -108,10 +108,10 @@ static int bio_free(BIO *bio)
        
        if (b->buf != NULL)
                {
-               Free(b->buf);
+               OPENSSL_free(b->buf);
                }
 
-       Free(b);
+       OPENSSL_free(b);
 
        return 1;
        }
@@ -464,7 +464,7 @@ static long bio_ctrl(BIO *bio, int cmd, long num, void *ptr)
                                {
                                if (b->buf) 
                                        {
-                                       Free(b->buf);
+                                       OPENSSL_free(b->buf);
                                        b->buf = NULL;
                                        }
                                b->size = new_size;
@@ -652,7 +652,7 @@ static int bio_make_pair(BIO *bio1, BIO *bio2)
        
        if (b1->buf == NULL)
                {
-               b1->buf = Malloc(b1->size);
+               b1->buf = OPENSSL_malloc(b1->size);
                if (b1->buf == NULL)
                        {
                        BIOerr(BIO_F_BIO_MAKE_PAIR, ERR_R_MALLOC_FAILURE);
@@ -664,7 +664,7 @@ static int bio_make_pair(BIO *bio1, BIO *bio2)
        
        if (b2->buf == NULL)
                {
-               b2->buf = Malloc(b2->size);
+               b2->buf = OPENSSL_malloc(b2->size);
                if (b2->buf == NULL)
                        {
                        BIOerr(BIO_F_BIO_MAKE_PAIR, ERR_R_MALLOC_FAILURE);
index f0466adca3045df42ac67fa254b766ef8e539095..1281a0af0dc8e7ed63e24f1cfedc39e82f446559 100644 (file)
@@ -165,7 +165,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
                                                        break;
                                                        }
                                        if (c->param_port != NULL)
-                                               Free(c->param_port);
+                                               OPENSSL_free(c->param_port);
                                        c->param_port=BUF_strdup(p);
                                        }
                                }
@@ -322,7 +322,7 @@ BIO_CONNECT *BIO_CONNECT_new(void)
        {
        BIO_CONNECT *ret;
 
-       if ((ret=(BIO_CONNECT *)Malloc(sizeof(BIO_CONNECT))) == NULL)
+       if ((ret=(BIO_CONNECT *)OPENSSL_malloc(sizeof(BIO_CONNECT))) == NULL)
                return(NULL);
        ret->state=BIO_CONN_S_BEFORE;
        ret->param_hostname=NULL;
@@ -344,10 +344,10 @@ void BIO_CONNECT_free(BIO_CONNECT *a)
            return;
 
        if (a->param_hostname != NULL)
-               Free(a->param_hostname);
+               OPENSSL_free(a->param_hostname);
        if (a->param_port != NULL)
-               Free(a->param_port);
-       Free(a);
+               OPENSSL_free(a->param_port);
+       OPENSSL_free(a);
        }
 
 BIO_METHOD *BIO_s_connect(void)
@@ -507,13 +507,13 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
                        if (num == 0)
                                {
                                if (data->param_hostname != NULL)
-                                       Free(data->param_hostname);
+                                       OPENSSL_free(data->param_hostname);
                                data->param_hostname=BUF_strdup(ptr);
                                }
                        else if (num == 1)
                                {
                                if (data->param_port != NULL)
-                                       Free(data->param_port);
+                                       OPENSSL_free(data->param_port);
                                data->param_port=BUF_strdup(ptr);
                                }
                        else if (num == 2)
@@ -524,7 +524,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
                                sprintf(buf,"%d.%d.%d.%d",
                                        p[0],p[1],p[2],p[3]);
                                if (data->param_hostname != NULL)
-                                       Free(data->param_hostname);
+                                       OPENSSL_free(data->param_hostname);
                                data->param_hostname=BUF_strdup(buf);
                                memcpy(&(data->ip[0]),ptr,4);
                                }
@@ -534,7 +534,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
 
                                sprintf(buf,"%d",*(int *)ptr);
                                if (data->param_port != NULL)
-                                       Free(data->param_port);
+                                       OPENSSL_free(data->param_port);
                                data->param_port=BUF_strdup(buf);
                                data->port= *(int *)ptr;
                                }
index a8e01a0f930100f8b6d38d40db0b77bd5868f801..be2ad38383b299dfcedcb13251626c1732129ae9 100644 (file)
@@ -160,7 +160,7 @@ static int MS_CALLBACK slg_write(BIO *b, const char *in, int inl)
        char* pp;
        int priority;
 
-       if((buf= (char *)Malloc(inl+ 1)) == NULL){
+       if((buf= (char *)OPENSSL_malloc(inl+ 1)) == NULL){
                return(0);
        }
        strncpy(buf, in, inl);
@@ -182,7 +182,7 @@ static int MS_CALLBACK slg_write(BIO *b, const char *in, int inl)
 
        xsyslog(b, priority, pp);
 
-       Free(buf);
+       OPENSSL_free(buf);
        return(ret);
        }
 
@@ -294,7 +294,7 @@ static void xsyslog(BIO *bp, int priority, const char *string)
        lib$sys_fao(&fao_cmd, &len, &buf_dsc, priority_tag, string);
 
        /* we know there's an 8 byte header.  That's documented */
-       opcdef_p = (struct opcdef *) Malloc(8 + len);
+       opcdef_p = (struct opcdef *) OPENSSL_malloc(8 + len);
        opcdef_p->opc$b_ms_type = OPC$_RQ_RQST;
        memcpy(opcdef_p->opc$z_ms_target_classes, &VMS_OPC_target, 3);
        opcdef_p->opc$l_ms_rqstid = 0;
@@ -307,7 +307,7 @@ static void xsyslog(BIO *bp, int priority, const char *string)
 
        sys$sndopr(opc_dsc, 0);
 
-       Free(opcdef_p);
+       OPENSSL_free(opcdef_p);
 }
 
 static void xcloselog(BIO* bp)
index 4ad0739464b9d19473f87f19d609363575eb549c..1a0078ad6e161793bf2592c5b926d06d1a468114 100644 (file)
@@ -156,7 +156,7 @@ static int rtcp_new(BIO *bi)
        bi->init=1;
        bi->num=0;
        bi->flags = 0;
-       bi->ptr=Malloc(sizeof(struct rpc_ctx));
+       bi->ptr=OPENSSL_malloc(sizeof(struct rpc_ctx));
        ctx = (struct rpc_ctx *) bi->ptr;
        ctx->filled = 0;
        ctx->pos = 0;
@@ -166,7 +166,7 @@ static int rtcp_new(BIO *bi)
 static int rtcp_free(BIO *a)
 {
        if (a == NULL) return(0);
-       if ( a->ptr ) Free ( a->ptr );
+       if ( a->ptr ) OPENSSL_free ( a->ptr );
        a->ptr = NULL;
        return(1);
 }
index 1b1bb060463f2eace94309e473bbc592cc30b784..2d287e6d1bb1568b3bc718d92f324e1745444ba6 100644 (file)
@@ -67,7 +67,7 @@ BN_BLINDING *BN_BLINDING_new(BIGNUM *A, BIGNUM *Ai, BIGNUM *mod)
        bn_check_top(Ai);
        bn_check_top(mod);
 
-       if ((ret=(BN_BLINDING *)Malloc(sizeof(BN_BLINDING))) == NULL)
+       if ((ret=(BN_BLINDING *)OPENSSL_malloc(sizeof(BN_BLINDING))) == NULL)
                {
                BNerr(BN_F_BN_BLINDING_NEW,ERR_R_MALLOC_FAILURE);
                return(NULL);
@@ -91,7 +91,7 @@ void BN_BLINDING_free(BN_BLINDING *r)
 
        if (r->A  != NULL) BN_free(r->A );
        if (r->Ai != NULL) BN_free(r->Ai);
-       Free(r);
+       OPENSSL_free(r);
        }
 
 int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx)
index 46132fd1806a04506803f23c4a2e03a4c4b2a336..b1a8d7571e83a23389ea0c2c8d6c34d9df72b55a 100644 (file)
@@ -69,7 +69,7 @@ BN_CTX *BN_CTX_new(void)
        {
        BN_CTX *ret;
 
-       ret=(BN_CTX *)Malloc(sizeof(BN_CTX));
+       ret=(BN_CTX *)OPENSSL_malloc(sizeof(BN_CTX));
        if (ret == NULL)
                {
                BNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE);
@@ -102,7 +102,7 @@ void BN_CTX_free(BN_CTX *ctx)
        for (i=0; i < BN_CTX_NUM; i++)
                BN_clear_free(&(ctx->bn[i]));
        if (ctx->flags & BN_FLG_MALLOCED)
-               Free(ctx);
+               OPENSSL_free(ctx);
        }
 
 void BN_CTX_start(BN_CTX *ctx)
index 0e6b12d9c3639c2b4f70e07ac02f25b4f78a8491..81e5d7d98e8d804d8150e6c58ea467f47cd8ead7 100644 (file)
@@ -264,22 +264,22 @@ void BN_clear_free(BIGNUM *a)
                {
                memset(a->d,0,a->max*sizeof(a->d[0]));
                if (!(BN_get_flags(a,BN_FLG_STATIC_DATA)))
-                       Free(a->d);
+                       OPENSSL_free(a->d);
                }
        i=BN_get_flags(a,BN_FLG_MALLOCED);
        memset(a,0,sizeof(BIGNUM));
        if (i)
-               Free(a);
+               OPENSSL_free(a);
        }
 
 void BN_free(BIGNUM *a)
        {
        if (a == NULL) return;
        if ((a->d != NULL) && !(BN_get_flags(a,BN_FLG_STATIC_DATA)))
-               Free(a->d);
+               OPENSSL_free(a->d);
        a->flags|=BN_FLG_FREE; /* REMOVE? */
        if (a->flags & BN_FLG_MALLOCED)
-               Free(a);
+               OPENSSL_free(a);
        }
 
 void BN_init(BIGNUM *a)
@@ -291,7 +291,7 @@ BIGNUM *BN_new(void)
        {
        BIGNUM *ret;
 
-       if ((ret=(BIGNUM *)Malloc(sizeof(BIGNUM))) == NULL)
+       if ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL)
                {
                BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE);
                return(NULL);
@@ -325,7 +325,7 @@ BIGNUM *bn_expand2(BIGNUM *b, int words)
                        BNerr(BN_F_BN_EXPAND2,BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
                        return(NULL);
                        }
-               a=A=(BN_ULONG *)Malloc(sizeof(BN_ULONG)*(words+1));
+               a=A=(BN_ULONG *)OPENSSL_malloc(sizeof(BN_ULONG)*(words+1));
                if (A == NULL)
                        {
                        BNerr(BN_F_BN_EXPAND2,ERR_R_MALLOC_FAILURE);
@@ -423,7 +423,7 @@ BIGNUM *bn_expand2(BIGNUM *b, int words)
                                case 0: ; /* ultrix cc workaround, see above */
                                }
 #endif
-                       Free(b->d);
+                       OPENSSL_free(b->d);
                        }
 
                b->d=a;
index 598fecbf0c89fb2d8932951105c79210a46ef4ac..b8eb2b7998e2384230fbfe57e2444e74ef8c6031 100644 (file)
@@ -234,7 +234,7 @@ BN_MONT_CTX *BN_MONT_CTX_new(void)
        {
        BN_MONT_CTX *ret;
 
-       if ((ret=(BN_MONT_CTX *)Malloc(sizeof(BN_MONT_CTX))) == NULL)
+       if ((ret=(BN_MONT_CTX *)OPENSSL_malloc(sizeof(BN_MONT_CTX))) == NULL)
                return(NULL);
 
        BN_MONT_CTX_init(ret);
@@ -260,7 +260,7 @@ void BN_MONT_CTX_free(BN_MONT_CTX *mont)
        BN_free(&(mont->N));
        BN_free(&(mont->Ni));
        if (mont->flags & BN_FLG_MALLOCED)
-               Free(mont);
+               OPENSSL_free(mont);
        }
 
 int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
index 782a96e7e0a69a2f6f5f84aecf0e2673f373fd07..532e66bcc3976bc305db799e9a95c23c978d63b9 100644 (file)
 
 static const char *Hex="0123456789ABCDEF";
 
-/* Must 'Free' the returned data */
+/* Must 'OPENSSL_free' the returned data */
 char *BN_bn2hex(const BIGNUM *a)
        {
        int i,j,v,z=0;
        char *buf;
        char *p;
 
-       buf=(char *)Malloc(a->top*BN_BYTES*2+2);
+       buf=(char *)OPENSSL_malloc(a->top*BN_BYTES*2+2);
        if (buf == NULL)
                {
                BNerr(BN_F_BN_BN2HEX,ERR_R_MALLOC_FAILURE);
@@ -99,7 +99,7 @@ err:
        return(buf);
        }
 
-/* Must 'Free' the returned data */
+/* Must 'OPENSSL_free' the returned data */
 char *BN_bn2dec(const BIGNUM *a)
        {
        int i=0,num;
@@ -110,8 +110,8 @@ char *BN_bn2dec(const BIGNUM *a)
 
        i=BN_num_bits(a)*3;
        num=(i/10+i/1000+3)+1;
-       bn_data=(BN_ULONG *)Malloc((num/BN_DEC_NUM+1)*sizeof(BN_ULONG));
-       buf=(char *)Malloc(num+3);
+       bn_data=(BN_ULONG *)OPENSSL_malloc((num/BN_DEC_NUM+1)*sizeof(BN_ULONG));
+       buf=(char *)OPENSSL_malloc(num+3);
        if ((buf == NULL) || (bn_data == NULL))
                {
                BNerr(BN_F_BN_BN2DEC,ERR_R_MALLOC_FAILURE);
@@ -149,7 +149,7 @@ char *BN_bn2dec(const BIGNUM *a)
                        }
                }
 err:
-       if (bn_data != NULL) Free(bn_data);
+       if (bn_data != NULL) OPENSSL_free(bn_data);
        if (t != NULL) BN_free(t);
        return(buf);
        }
index 943712c15b8f2e31b374f4e9af98000cfc43225b..b1163f7ec44172078a4a15564862db72ed752233 100644 (file)
@@ -72,7 +72,7 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
        bit=(bits-1)%8;
        mask=0xff<<bit;
 
-       buf=(unsigned char *)Malloc(bytes);
+       buf=(unsigned char *)OPENSSL_malloc(bytes);
        if (buf == NULL)
                {
                BNerr(BN_F_BN_RAND,ERR_R_MALLOC_FAILURE);
@@ -120,7 +120,7 @@ err:
        if (buf != NULL)
                {
                memset(buf,0,bytes);
-               Free(buf);
+               OPENSSL_free(buf);
                }
        return(ret);
        }
index a8796bd0aacfc34b20cc372974831df6dfa229ad..d019941d6be4140c5109d010915de148e9a65e78 100644 (file)
@@ -72,7 +72,7 @@ BN_RECP_CTX *BN_RECP_CTX_new(void)
        {
        BN_RECP_CTX *ret;
 
-       if ((ret=(BN_RECP_CTX *)Malloc(sizeof(BN_RECP_CTX))) == NULL)
+       if ((ret=(BN_RECP_CTX *)OPENSSL_malloc(sizeof(BN_RECP_CTX))) == NULL)
                return(NULL);
 
        BN_RECP_CTX_init(ret);
@@ -88,7 +88,7 @@ void BN_RECP_CTX_free(BN_RECP_CTX *recp)
        BN_free(&(recp->N));
        BN_free(&(recp->Nr));
        if (recp->flags & BN_FLG_MALLOCED)
-               Free(recp);
+               OPENSSL_free(recp);
        }
 
 int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx)
index c3a108ea52115af420c0c005f468e0d443e27208..b76ff3ad7acf24302a039e246455c34561fecfc7 100644 (file)
@@ -64,7 +64,7 @@ BUF_MEM *BUF_MEM_new(void)
        {
        BUF_MEM *ret;
 
-       ret=Malloc(sizeof(BUF_MEM));
+       ret=OPENSSL_malloc(sizeof(BUF_MEM));
        if (ret == NULL)
                {
                BUFerr(BUF_F_BUF_MEM_NEW,ERR_R_MALLOC_FAILURE);
@@ -84,9 +84,9 @@ void BUF_MEM_free(BUF_MEM *a)
        if (a->data != NULL)
                {
                memset(a->data,0,(unsigned int)a->max);
-               Free(a->data);
+               OPENSSL_free(a->data);
                }
-       Free(a);
+       OPENSSL_free(a);
        }
 
 int BUF_MEM_grow(BUF_MEM *str, int len)
@@ -107,9 +107,9 @@ int BUF_MEM_grow(BUF_MEM *str, int len)
                }
        n=(len+3)/3*4;
        if (str->data == NULL)
-               ret=Malloc(n);
+               ret=OPENSSL_malloc(n);
        else
-               ret=Realloc(str->data,n);
+               ret=OPENSSL_realloc(str->data,n);
        if (ret == NULL)
                {
                BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE);
@@ -132,7 +132,7 @@ char *BUF_strdup(const char *str)
        if (str == NULL) return(NULL);
 
        n=strlen(str);
-       ret=Malloc(n+1);
+       ret=OPENSSL_malloc(n+1);
        if (ret == NULL) 
                {
                BUFerr(BUF_F_BUF_STRDUP,ERR_R_MALLOC_FAILURE);
index a67ef23bc0fd2abc5dd931d714dd496ea1219741..beb98ce8ccc8c0ade57db19e96e9384a22904939 100644 (file)
@@ -8,7 +8,7 @@ COMP_CTX *COMP_CTX_new(COMP_METHOD *meth)
        {
        COMP_CTX *ret;
 
-       if ((ret=(COMP_CTX *)Malloc(sizeof(COMP_CTX))) == NULL)
+       if ((ret=(COMP_CTX *)OPENSSL_malloc(sizeof(COMP_CTX))) == NULL)
                {
                /* ZZZZZZZZZZZZZZZZ */
                return(NULL);
@@ -17,7 +17,7 @@ COMP_CTX *COMP_CTX_new(COMP_METHOD *meth)
        ret->meth=meth;
        if ((ret->meth->init != NULL) && !ret->meth->init(ret))
                {
-               Free(ret);
+               OPENSSL_free(ret);
                ret=NULL;
                }
 #if 0
@@ -37,7 +37,7 @@ void COMP_CTX_free(COMP_CTX *ctx)
        if (ctx->meth->finish != NULL)
                ctx->meth->finish(ctx);
 
-       Free(ctx);
+       OPENSSL_free(ctx);
        }
 
 int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
index 29989270ab2c5a7c777791a0050d6c8c38916d16..8b6bc9accb1692749464168ae9ff73050d3bdb92 100644 (file)
@@ -107,9 +107,9 @@ int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value)
        if (v != NULL)
                {
                sk_CONF_VALUE_delete_ptr(ts,v);
-               Free(v->name);
-               Free(v->value);
-               Free(v);
+               OPENSSL_free(v->name);
+               OPENSSL_free(v->value);
+               OPENSSL_free(v);
                }
        return 1;
        }
@@ -181,7 +181,7 @@ void _CONF_free_data(CONF *conf)
        {
        if (conf == NULL || conf->data == NULL) return;
 
-       conf->data->down_load=0; /* evil thing to make sure the 'Free()'
+       conf->data->down_load=0; /* evil thing to make sure the 'OPENSSL_free()'
                                  * works as expected */
        lh_doall_arg(conf->data,(void (*)())value_free_hash,conf->data);
 
@@ -212,13 +212,13 @@ static void value_free_stack(CONF_VALUE *a, LHASH *conf)
        for (i=sk_num(sk)-1; i>=0; i--)
                {
                vv=(CONF_VALUE *)sk_value(sk,i);
-               Free(vv->value);
-               Free(vv->name);
-               Free(vv);
+               OPENSSL_free(vv->value);
+               OPENSSL_free(vv->name);
+               OPENSSL_free(vv);
                }
        if (sk != NULL) sk_free(sk);
-       Free(a->section);
-       Free(a);
+       OPENSSL_free(a->section);
+       OPENSSL_free(a);
        }
 
 static unsigned long hash(CONF_VALUE *v)
@@ -256,10 +256,10 @@ CONF_VALUE *_CONF_new_section(CONF *conf, char *section)
 
        if ((sk=sk_new_null()) == NULL)
                goto err;
-       if ((v=(CONF_VALUE *)Malloc(sizeof(CONF_VALUE))) == NULL)
+       if ((v=(CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE))) == NULL)
                goto err;
        i=strlen(section)+1;
-       if ((v->section=(char *)Malloc(i)) == NULL)
+       if ((v->section=(char *)OPENSSL_malloc(i)) == NULL)
                goto err;
 
        memcpy(v->section,section,i);
@@ -279,7 +279,7 @@ err:
        if (!ok)
                {
                if (sk != NULL) sk_free(sk);
-               if (v != NULL) Free(v);
+               if (v != NULL) OPENSSL_free(v);
                v=NULL;
                }
        return(v);
index 368a31a92f070fd20f957c76bfbde67d315cb85c..f7d088db0f0aa47ca640b20fed6fea170e9f32d3 100644 (file)
@@ -124,11 +124,11 @@ static CONF *def_create(CONF_METHOD *meth)
        {
        CONF *ret;
 
-       ret = (CONF *)Malloc(sizeof(CONF) + sizeof(unsigned short *));
+       ret = (CONF *)OPENSSL_malloc(sizeof(CONF) + sizeof(unsigned short *));
        if (ret)
                if (meth->init(ret) == 0)
                        {
-                       Free(ret);
+                       OPENSSL_free(ret);
                        ret = NULL;
                        }
        return ret;
@@ -162,7 +162,7 @@ static int def_destroy(CONF *conf)
        {
        if (def_destroy_data(conf))
                {
-               Free(conf);
+               OPENSSL_free(conf);
                return 1;
                }
        return 0;
@@ -198,7 +198,7 @@ static int def_load(CONF *conf, BIO *in, long *line)
                goto err;
                }
 
-       section=(char *)Malloc(10);
+       section=(char *)OPENSSL_malloc(10);
        if (section == NULL)
                {
                CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_MALLOC_FAILURE);
@@ -345,14 +345,14 @@ again:
                        p++;
                        *p='\0';
 
-                       if (!(v=(CONF_VALUE *)Malloc(sizeof(CONF_VALUE))))
+                       if (!(v=(CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE))))
                                {
                                CONFerr(CONF_F_CONF_LOAD_BIO,
                                                        ERR_R_MALLOC_FAILURE);
                                goto err;
                                }
                        if (psection == NULL) psection=section;
-                       v->name=(char *)Malloc(strlen(pname)+1);
+                       v->name=(char *)OPENSSL_malloc(strlen(pname)+1);
                        v->value=NULL;
                        if (v->name == NULL)
                                {
@@ -400,29 +400,29 @@ again:
                        if (vv != NULL)
                                {
                                sk_CONF_VALUE_delete_ptr(ts,vv);
-                               Free(vv->name);
-                               Free(vv->value);
-                               Free(vv);
+                               OPENSSL_free(vv->name);
+                               OPENSSL_free(vv->value);
+                               OPENSSL_free(vv);
                                }
 #endif
                        v=NULL;
                        }
                }
        if (buff != NULL) BUF_MEM_free(buff);
-       if (section != NULL) Free(section);
+       if (section != NULL) OPENSSL_free(section);
        return(1);
 err:
        if (buff != NULL) BUF_MEM_free(buff);
-       if (section != NULL) Free(section);
+       if (section != NULL) OPENSSL_free(section);
        if (line != NULL) *line=eline;
        sprintf(btmp,"%ld",eline);
        ERR_add_error_data(2,"line ",btmp);
        if ((h != conf->data) && (conf->data != NULL)) CONF_free(conf->data);
        if (v != NULL)
                {
-               if (v->name != NULL) Free(v->name);
-               if (v->value != NULL) Free(v->value);
-               if (v != NULL) Free(v);
+               if (v->name != NULL) OPENSSL_free(v->name);
+               if (v->value != NULL) OPENSSL_free(v->value);
+               if (v != NULL) OPENSSL_free(v);
                }
        return(0);
        }
@@ -602,9 +602,9 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
                        buf->data[to++]= *(from++);
                }
        buf->data[to]='\0';
-       if (*pto != NULL) Free(*pto);
+       if (*pto != NULL) OPENSSL_free(*pto);
        *pto=buf->data;
-       Free(buf);
+       OPENSSL_free(buf);
        return(1);
 err:
        if (buf != NULL) BUF_MEM_free(buf);
index 40a30a0939f69a9b44496d5d32a5ec83b1d571c0..90156d0072bc8762710973a4a2d6d2f530ac91ab 100644 (file)
@@ -129,7 +129,7 @@ int CRYPTO_get_new_lockid(char *name)
                return(0);
        i=sk_push(app_locks,str);
        if (!i)
-               Free(str);
+               OPENSSL_free(str);
        else
                i+=CRYPTO_NUM_LOCKS; /* gap of one :-) */
        return(i);
index adb436f8621ef5deea4129a48c23e3b7d06a6565..20181a96a091de53d2294fb9ab79f45c9fb5d818 100644 (file)
@@ -281,16 +281,17 @@ int CRYPTO_is_mem_check_on(void);
 #define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)
 #define is_MemCheck_on() CRYPTO_is_mem_check_on()
 
-#define Malloc(num)    CRYPTO_malloc((int)num,__FILE__,__LINE__)
-#define Realloc(addr,num) \
+#define OPENSSL_malloc(num)    CRYPTO_malloc((int)num,__FILE__,__LINE__)
+#define OPENSSL_realloc(addr,num) \
        CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)
-#define Remalloc(addr,num) \
+#define OPENSSL_remalloc(addr,num) \
        CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__)
-#define FreeFunc       CRYPTO_free
-#define Free(addr)     CRYPTO_free(addr)
+#define OPENSSL_freeFunc       CRYPTO_free
+#define OPENSSL_free(addr)     CRYPTO_free(addr)
 
-#define Malloc_locked(num) CRYPTO_malloc_locked((int)num,__FILE__,__LINE__)
-#define Free_locked(addr) CRYPTO_free_locked(addr)
+#define OPENSSL_malloc_locked(num) \
+       CRYPTO_malloc_locked((int)num,__FILE__,__LINE__)
+#define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr)
 
 
 /* Case insensiteve linking causes problems.... */
index 0197489c9ed422f08ccc6de5a4895b7fd87f8402..215d7413c0766bd13ecbe7a02d02fe7a7cd0b5df 100644 (file)
@@ -374,8 +374,8 @@ void doencryption(void)
 
        if (buf == NULL)
                {
-               if (    (( buf=Malloc(BUFSIZE+8)) == NULL) ||
-                       ((obuf=Malloc(BUFSIZE+8)) == NULL))
+               if (    (( buf=OPENSSL_malloc(BUFSIZE+8)) == NULL) ||
+                       ((obuf=OPENSSL_malloc(BUFSIZE+8)) == NULL))
                        {
                        fputs("Not enough memory\n",stderr);
                        Exit=10;
index 7399ff7269837ebf756b0bf2dd3be1fce2203edf..af2d9177d2a21fe17a819de3c79494caeacca3e9 100644 (file)
@@ -103,17 +103,17 @@ int des_enc_read(int fd, void *buf, int len, des_key_schedule sched,
 
        if (tmpbuf == NULL)
                {
-               tmpbuf=Malloc(BSIZE);
+               tmpbuf=OPENSSL_malloc(BSIZE);
                if (tmpbuf == NULL) return(-1);
                }
        if (net == NULL)
                {
-               net=Malloc(BSIZE);
+               net=OPENSSL_malloc(BSIZE);
                if (net == NULL) return(-1);
                }
        if (unnet == NULL)
                {
-               unnet=Malloc(BSIZE);
+               unnet=OPENSSL_malloc(BSIZE);
                if (unnet == NULL) return(-1);
                }
        /* left over data from last decrypt */
index 4d3452724ecf7f396b64fe111f971bc25934e058..cc2b50fb509291d2bdfd195a82fecfde6eddfe61 100644 (file)
@@ -95,7 +95,7 @@ int des_enc_write(int fd, const void *_buf, int len,
 
        if (outbuf == NULL)
                {
-               outbuf=Malloc(BSIZE+HDRSIZE);
+               outbuf=OPENSSL_malloc(BSIZE+HDRSIZE);
                if (outbuf == NULL) return(-1);
                }
        /* If we are sending less than 8 bytes, the same char will look
index be00ceee2ff294ef39922d4c37b6671db491ca55..a8d5340bf4355995dfa76635d626b2169b5547b1 100644 (file)
@@ -96,7 +96,7 @@ DH *DH_new(void)
 DH *DH_new_method(DH_METHOD *meth)
        {
        DH *ret;
-       ret=(DH *)Malloc(sizeof(DH));
+       ret=(DH *)OPENSSL_malloc(sizeof(DH));
 
        if (ret == NULL)
                {
@@ -122,7 +122,7 @@ DH *DH_new_method(DH_METHOD *meth)
        ret->flags=ret->meth->flags;
        if ((ret->meth->init != NULL) && !ret->meth->init(ret))
                {
-               Free(ret);
+               OPENSSL_free(ret);
                ret=NULL;
                }
        else
@@ -155,11 +155,11 @@ void DH_free(DH *r)
        if (r->g != NULL) BN_clear_free(r->g);
        if (r->q != NULL) BN_clear_free(r->q);
        if (r->j != NULL) BN_clear_free(r->j);
-       if (r->seed) Free(r->seed);
+       if (r->seed) OPENSSL_free(r->seed);
        if (r->counter != NULL) BN_clear_free(r->counter);
        if (r->pub_key != NULL) BN_clear_free(r->pub_key);
        if (r->priv_key != NULL) BN_clear_free(r->priv_key);
-       Free(r);
+       OPENSSL_free(r);
        }
 
 int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
index d66c28455ec01211adf6b6b3af2eb400f361d0fc..f0151253d788ed28375468240f01cffe20e195d3 100644 (file)
@@ -140,7 +140,7 @@ int main(int argc, char *argv[])
        BIO_puts(out,"\n");
 
        alen=DH_size(a);
-       abuf=(unsigned char *)Malloc(alen);
+       abuf=(unsigned char *)OPENSSL_malloc(alen);
        aout=DH_compute_key(abuf,b->pub_key,a);
 
        BIO_puts(out,"key1 =");
@@ -152,7 +152,7 @@ int main(int argc, char *argv[])
        BIO_puts(out,"\n");
 
        blen=DH_size(b);
-       bbuf=(unsigned char *)Malloc(blen);
+       bbuf=(unsigned char *)OPENSSL_malloc(blen);
        bout=DH_compute_key(bbuf,a->pub_key,b);
 
        BIO_puts(out,"key2 =");
@@ -170,8 +170,8 @@ int main(int argc, char *argv[])
        else
                ret=0;
 err:
-       if (abuf != NULL) Free(abuf);
-       if (bbuf != NULL) Free(bbuf);
+       if (abuf != NULL) OPENSSL_free(abuf);
+       if (bbuf != NULL) OPENSSL_free(bbuf);
        if(b != NULL) DH_free(b);
        if(a != NULL) DH_free(a);
        BIO_free(out);
index c9b32b4db78c5acf4ed5320a7709ab4fca28e0e1..a76c8f7c7eb389e3d34a3bfb67b83dceda456f1e 100644 (file)
@@ -10,7 +10,7 @@ DSA_SIG *DSA_SIG_new(void)
 {
        DSA_SIG *ret;
 
-       ret = Malloc(sizeof(DSA_SIG));
+       ret = OPENSSL_malloc(sizeof(DSA_SIG));
        if (ret == NULL)
                {
                DSAerr(DSA_F_DSA_SIG_NEW,ERR_R_MALLOC_FAILURE);
@@ -26,7 +26,7 @@ void DSA_SIG_free(DSA_SIG *r)
        if (r == NULL) return;
        if (r->r) BN_clear_free(r->r);
        if (r->s) BN_clear_free(r->s);
-       Free(r);
+       OPENSSL_free(r);
 }
 
 int i2d_DSA_SIG(DSA_SIG *v, unsigned char **pp)
@@ -35,7 +35,7 @@ int i2d_DSA_SIG(DSA_SIG *v, unsigned char **pp)
        ASN1_INTEGER rbs,sbs;
        unsigned char *p;
 
-       rbs.data=Malloc(BN_num_bits(v->r)/8+1);
+       rbs.data=OPENSSL_malloc(BN_num_bits(v->r)/8+1);
        if (rbs.data == NULL)
                {
                DSAerr(DSA_F_I2D_DSA_SIG, ERR_R_MALLOC_FAILURE);
@@ -43,10 +43,10 @@ int i2d_DSA_SIG(DSA_SIG *v, unsigned char **pp)
                }
        rbs.type=V_ASN1_INTEGER;
        rbs.length=BN_bn2bin(v->r,rbs.data);
-       sbs.data=Malloc(BN_num_bits(v->s)/8+1);
+       sbs.data=OPENSSL_malloc(BN_num_bits(v->s)/8+1);
        if (sbs.data == NULL)
                {
-               Free(rbs.data);
+               OPENSSL_free(rbs.data);
                DSAerr(DSA_F_I2D_DSA_SIG, ERR_R_MALLOC_FAILURE);
                return(0);
                }
@@ -64,8 +64,8 @@ int i2d_DSA_SIG(DSA_SIG *v, unsigned char **pp)
                i2d_ASN1_INTEGER(&sbs,&p);
                }
        t=ASN1_object_size(1,len,V_ASN1_SEQUENCE);
-       Free(rbs.data);
-       Free(sbs.data);
+       OPENSSL_free(rbs.data);
+       OPENSSL_free(sbs.data);
        return(t);
 }
 
index 9c106b2b165fd850b6f76de5833c9f08d9deae7d..be30d18b8a05ee45c62295aab3909378befe05fe 100644 (file)
@@ -101,7 +101,7 @@ DSA *DSA_new_method(DSA_METHOD *meth)
        {
        DSA *ret;
 
-       ret=(DSA *)Malloc(sizeof(DSA));
+       ret=(DSA *)OPENSSL_malloc(sizeof(DSA));
        if (ret == NULL)
                {
                DSAerr(DSA_F_DSA_NEW,ERR_R_MALLOC_FAILURE);
@@ -127,7 +127,7 @@ DSA *DSA_new_method(DSA_METHOD *meth)
        ret->flags=ret->meth->flags;
        if ((ret->meth->init != NULL) && !ret->meth->init(ret))
                {
-               Free(ret);
+               OPENSSL_free(ret);
                ret=NULL;
                }
        else
@@ -166,7 +166,7 @@ void DSA_free(DSA *r)
        if (r->priv_key != NULL) BN_clear_free(r->priv_key);
        if (r->kinv != NULL) BN_clear_free(r->kinv);
        if (r->r != NULL) BN_clear_free(r->r);
-       Free(r);
+       OPENSSL_free(r);
        }
 
 int DSA_size(DSA *r)
index f41ebf1aa47924f0b336f2248d3f3c88a1d7a182..861f5fb84e906267c60cf6f00d304c55576ae1c5 100644 (file)
@@ -100,7 +100,7 @@ DSO *DSO_new_method(DSO_METHOD *meth)
                 * to stealing the "best available" method. Will fallback
                 * to DSO_METH_null() in the worst case. */
                default_DSO_meth = DSO_METHOD_openssl();
-       ret = (DSO *)Malloc(sizeof(DSO));
+       ret = (DSO *)OPENSSL_malloc(sizeof(DSO));
        if(ret == NULL)
                {
                DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE);
@@ -112,7 +112,7 @@ DSO *DSO_new_method(DSO_METHOD *meth)
                {
                /* sk_new doesn't generate any errors so we do */
                DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE);
-               Free(ret);
+               OPENSSL_free(ret);
                return(NULL);
                }
        if(meth == NULL)
@@ -122,7 +122,7 @@ DSO *DSO_new_method(DSO_METHOD *meth)
        ret->references = 1;
        if((ret->meth->init != NULL) && !ret->meth->init(ret))
                {
-               Free(ret);
+               OPENSSL_free(ret);
                ret=NULL;
                }
        return(ret);
@@ -165,7 +165,7 @@ int DSO_free(DSO *dso)
        
        sk_free(dso->meth_data);
  
-       Free(dso);
+       OPENSSL_free(dso);
        return(1);
        }
 
index 212a255b4b387a75a1afdbf05c4fad1985713290..e204b6b07bd916512d27aa6d8c51375ea9575459 100644 (file)
@@ -133,19 +133,19 @@ static int win32_load(DSO *dso, const char *filename)
                DSOerr(DSO_F_WIN32_LOAD,DSO_R_LOAD_FAILED);
                return(0);
                }
-       p = (HINSTANCE *)Malloc(sizeof(HINSTANCE));
+       p = (HINSTANCE *)OPENSSL_malloc(sizeof(HINSTANCE));
        if(p == NULL)
                {
                DSOerr(DSO_F_WIN32_LOAD,ERR_R_MALLOC_FAILURE);
-               FreeLibrary(h);
+               OPENSSL_freeLibrary(h);
                return(0);
                }
        *p = h;
        if(!sk_push(dso->meth_data, (char *)p))
                {
                DSOerr(DSO_F_WIN32_LOAD,DSO_R_STACK_ERROR);
-               FreeLibrary(h);
-               Free(p);
+               OPENSSL_freeLibrary(h);
+               OPENSSL_free(p);
                return(0);
                }
        return(1);
@@ -167,7 +167,7 @@ static int win32_unload(DSO *dso)
                DSOerr(DSO_F_WIN32_UNLOAD,DSO_R_NULL_HANDLE);
                return(0);
                }
-       if(!FreeLibrary(p))
+       if(!OPENSSL_freeLibrary(p))
                {
                DSOerr(DSO_F_WIN32_UNLOAD,DSO_R_UNLOAD_FAILED);
                /* We should push the value back onto the stack in
@@ -176,7 +176,7 @@ static int win32_unload(DSO *dso)
                return(0);
                }
        /* Cleanup */
-       Free(p);
+       OPENSSL_free(p);
        return(1);
        }
 
index b0ee24c3249c8ca36df076a5441c058f14f70df9..9557761f41458018e5d83d30c0beecdce2352ec9 100644 (file)
@@ -228,7 +228,7 @@ static ERR_STRING_DATA SYS_str_reasons[NUM_SYS_STR_REASONS + 1];
 
 static void build_SYS_str_reasons()
        {
-       /* Malloc cannot be used here, use static storage instead */
+       /* OPENSSL_malloc cannot be used here, use static storage instead */
        static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON];
        int i;
 
@@ -265,7 +265,7 @@ static void build_SYS_str_reasons()
        if (((p)->err_data[i] != NULL) && \
                (p)->err_data_flags[i] & ERR_TXT_MALLOCED) \
                {  \
-               Free((p)->err_data[i]); \
+               OPENSSL_free((p)->err_data[i]); \
                (p)->err_data[i]=NULL; \
                } \
        (p)->err_data_flags[i]=0;
@@ -281,7 +281,7 @@ static void ERR_STATE_free(ERR_STATE *s)
                {
                err_clear_data(s,i);
                }
-       Free(s);
+       OPENSSL_free(s);
        }
 
 void ERR_load_ERR_strings(void)
@@ -685,7 +685,7 @@ ERR_STATE *ERR_get_state(void)
        /* ret == the error state, if NULL, make a new one */
        if (ret == NULL)
                {
-               ret=(ERR_STATE *)Malloc(sizeof(ERR_STATE));
+               ret=(ERR_STATE *)OPENSSL_malloc(sizeof(ERR_STATE));
                if (ret == NULL) return(&fallback);
                ret->pid=pid;
                ret->top=0;
@@ -755,7 +755,7 @@ void ERR_add_error_data(int num, ...)
        char *str,*p,*a;
 
        s=64;
-       str=Malloc(s+1);
+       str=OPENSSL_malloc(s+1);
        if (str == NULL) return;
        str[0]='\0';
 
@@ -771,10 +771,10 @@ void ERR_add_error_data(int num, ...)
                        if (n > s)
                                {
                                s=n+20;
-                               p=Realloc(str,s+1);
+                               p=OPENSSL_realloc(str,s+1);
                                if (p == NULL)
                                        {
-                                       Free(str);
+                                       OPENSSL_free(str);
                                        return;
                                        }
                                else
index e76387eaece4d5f453b4554b152762d3a275d2db..a275ef4c7d0a1923b0ca6fe08651ccde6ec43473 100644 (file)
@@ -113,7 +113,7 @@ static int b64_new(BIO *bi)
        {
        BIO_B64_CTX *ctx;
 
-       ctx=(BIO_B64_CTX *)Malloc(sizeof(BIO_B64_CTX));
+       ctx=(BIO_B64_CTX *)OPENSSL_malloc(sizeof(BIO_B64_CTX));
        if (ctx == NULL) return(0);
 
        ctx->buf_len=0;
@@ -133,7 +133,7 @@ static int b64_new(BIO *bi)
 static int b64_free(BIO *a)
        {
        if (a == NULL) return(0);
-       Free(a->ptr);
+       OPENSSL_free(a->ptr);
        a->ptr=NULL;
        a->init=0;
        a->flags=0;
index 1b7a21010c62329054795266481d56eb80922903..129e2e30a4086efc95c80a1f8c9f24aff16985d0 100644 (file)
@@ -105,7 +105,7 @@ static int enc_new(BIO *bi)
        {
        BIO_ENC_CTX *ctx;
 
-       ctx=(BIO_ENC_CTX *)Malloc(sizeof(BIO_ENC_CTX));
+       ctx=(BIO_ENC_CTX *)OPENSSL_malloc(sizeof(BIO_ENC_CTX));
        EVP_CIPHER_CTX_init(&ctx->cipher);
        if (ctx == NULL) return(0);
 
@@ -129,7 +129,7 @@ static int enc_free(BIO *a)
        b=(BIO_ENC_CTX *)a->ptr;
        EVP_CIPHER_CTX_cleanup(&(b->cipher));
        memset(a->ptr,0,sizeof(BIO_ENC_CTX));
-       Free(a->ptr);
+       OPENSSL_free(a->ptr);
        a->ptr=NULL;
        a->init=0;
        a->flags=0;
index f21319c04edf7544af3b3a51d89492860dc5e8aa..194555be4e19d6ee2801349925752149cee405ab 100644 (file)
@@ -96,7 +96,7 @@ static int md_new(BIO *bi)
        {
        EVP_MD_CTX *ctx;
 
-       ctx=(EVP_MD_CTX *)Malloc(sizeof(EVP_MD_CTX));
+       ctx=(EVP_MD_CTX *)OPENSSL_malloc(sizeof(EVP_MD_CTX));
        if (ctx == NULL) return(0);
 
        bi->init=0;
@@ -108,7 +108,7 @@ static int md_new(BIO *bi)
 static int md_free(BIO *a)
        {
        if (a == NULL) return(0);
-       Free(a->ptr);
+       OPENSSL_free(a->ptr);
        a->ptr=NULL;
        a->init=0;
        a->flags=0;
index 4f9b703a36a65ff4404f91ac69a009feb9be8b83..a358aadbaf9d967391e4676fde1d423a2b1f3601 100644 (file)
@@ -187,7 +187,7 @@ static int ok_new(BIO *bi)
        {
        BIO_OK_CTX *ctx;
 
-       ctx=(BIO_OK_CTX *)Malloc(sizeof(BIO_OK_CTX));
+       ctx=(BIO_OK_CTX *)OPENSSL_malloc(sizeof(BIO_OK_CTX));
        if (ctx == NULL) return(0);
 
        ctx->buf_len=0;
@@ -209,7 +209,7 @@ static int ok_free(BIO *a)
        {
        if (a == NULL) return(0);
        memset(a->ptr,0,sizeof(BIO_OK_CTX));
-       Free(a->ptr);
+       OPENSSL_free(a->ptr);
        a->ptr=NULL;
        a->init=0;
        a->flags=0;
index 187521eb58d34db0735bb689ba55a490df16f112..229ac673a7beaa67df7d019a6583e6fb8cc32a9a 100644 (file)
@@ -116,7 +116,7 @@ int EVP_PBE_alg_add (int nid, EVP_CIPHER *cipher, EVP_MD *md,
 {
        EVP_PBE_CTL *pbe_tmp;
        if (!pbe_algs) pbe_algs = sk_new ((int (*)())pbe_cmp);
-       if (!(pbe_tmp = (EVP_PBE_CTL*) Malloc (sizeof(EVP_PBE_CTL)))) {
+       if (!(pbe_tmp = (EVP_PBE_CTL*) OPENSSL_malloc (sizeof(EVP_PBE_CTL)))) {
                EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE);
                return 0;
        }
@@ -130,6 +130,6 @@ int EVP_PBE_alg_add (int nid, EVP_CIPHER *cipher, EVP_MD *md,
 
 void EVP_PBE_cleanup(void)
 {
-       sk_pop_free(pbe_algs, FreeFunc);
+       sk_pop_free(pbe_algs, OPENSSL_freeFunc);
        pbe_algs = NULL;
 }
index 892d1e91daa6d1aff2c375823d3625616017f410..8df2874f3c564ac9318b2c035ffc21ea12530c87 100644 (file)
@@ -308,7 +308,7 @@ static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey)
 
        p8->pkeyalg->algorithm = OBJ_nid2obj(NID_dsa);
        len = i2d_DSAparams (pkey->pkey.dsa, NULL);
-       if (!(p = Malloc(len))) {
+       if (!(p = OPENSSL_malloc(len))) {
                EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
                PKCS8_PRIV_KEY_INFO_free (p8);
                return 0;
@@ -317,7 +317,7 @@ static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey)
        i2d_DSAparams (pkey->pkey.dsa, &q);
        params = ASN1_STRING_new();
        ASN1_STRING_set(params, p, len);
-       Free(p);
+       OPENSSL_free(p);
        /* Get private key into integer */
        if (!(prkey = BN_to_ASN1_INTEGER (pkey->pkey.dsa->priv_key, NULL))) {
                EVPerr(EVP_F_EVP_PKEY2PKCS8,EVP_R_ENCODE_ERROR);
index 4cb387f8de1d5abc21d86d87c457e86b18c77c88..62398ed74dcd9edabdccd4741b745440d278d261 100644 (file)
@@ -180,7 +180,7 @@ EVP_PKEY *EVP_PKEY_new(void)
        {
        EVP_PKEY *ret;
 
-       ret=(EVP_PKEY *)Malloc(sizeof(EVP_PKEY));
+       ret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY));
        if (ret == NULL)
                {
                EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);
@@ -302,7 +302,7 @@ void EVP_PKEY_free(EVP_PKEY *x)
                }
 #endif
        EVP_PKEY_free_it(x);
-       Free(x);
+       OPENSSL_free(x);
        }
 
 static void EVP_PKEY_free_it(EVP_PKEY *x)
index 6dbccceafa5ab0576cd38d4605ecf24f251ef770..85d5097644a51a1d0f5360c00c58fecf8975d953 100644 (file)
@@ -82,7 +82,7 @@ int EVP_OpenInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char *ek,
        }
 
        size=RSA_size(priv->pkey.rsa);
-       key=(unsigned char *)Malloc(size+2);
+       key=(unsigned char *)OPENSSL_malloc(size+2);
        if (key == NULL)
                {
                /* ERROR */
@@ -102,7 +102,7 @@ int EVP_OpenInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char *ek,
        ret=1;
 err:
        if (key != NULL) memset(key,0,size);
-       Free(key);
+       OPENSSL_free(key);
        return(ret);
        }
 
index a057dd3b686a9a086df55031cd7419d96e5507ce..1ee88da2a83b5d415187ab735c0f8c71ad544a64 100644 (file)
@@ -77,7 +77,7 @@ int CRYPTO_get_ex_new_index(int idx, STACK_OF(CRYPTO_EX_DATA_FUNCS) **skp, long
                CRYPTOerr(CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX,ERR_R_MALLOC_FAILURE);
                goto err;
                }
-       a=(CRYPTO_EX_DATA_FUNCS *)Malloc(sizeof(CRYPTO_EX_DATA_FUNCS));
+       a=(CRYPTO_EX_DATA_FUNCS *)OPENSSL_malloc(sizeof(CRYPTO_EX_DATA_FUNCS));
        if (a == NULL)
                {
                CRYPTOerr(CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX,ERR_R_MALLOC_FAILURE);
@@ -93,7 +93,7 @@ int CRYPTO_get_ex_new_index(int idx, STACK_OF(CRYPTO_EX_DATA_FUNCS) **skp, long
                if (!sk_CRYPTO_EX_DATA_FUNCS_push(*skp,NULL))
                        {
                        CRYPTOerr(CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX,ERR_R_MALLOC_FAILURE);
-                       Free(a);
+                       OPENSSL_free(a);
                        goto err;
                        }
                }
index 08138b52c3136af51073ae2b0e2d6930352a55ea..6008781e579907b2de23ffd43b2b307eacb07b09 100644 (file)
@@ -77,7 +77,7 @@ main()
                if (buf[0] == '\0') break;
                buf[256]='\0';
                i=strlen(buf);
-               p=Malloc(i+1);
+               p=OPENSSL_malloc(i+1);
                memcpy(p,buf,i+1);
                lh_insert(conf,p);
                }
index 7eb92a18bca2c81fe837c1a87fb2f0bf2a9b37d7..7da14620a478fd2074ca53d3c05c35b2fd8b658d 100644 (file)
@@ -116,9 +116,9 @@ LHASH *lh_new(unsigned long (*h)(), int (*c)())
        LHASH *ret;
        int i;
 
-       if ((ret=(LHASH *)Malloc(sizeof(LHASH))) == NULL)
+       if ((ret=(LHASH *)OPENSSL_malloc(sizeof(LHASH))) == NULL)
                goto err0;
-       if ((ret->b=(LHASH_NODE **)Malloc(sizeof(LHASH_NODE *)*MIN_NODES)) == NULL)
+       if ((ret->b=(LHASH_NODE **)OPENSSL_malloc(sizeof(LHASH_NODE *)*MIN_NODES)) == NULL)
                goto err1;
        for (i=0; i<MIN_NODES; i++)
                ret->b[i]=NULL;
@@ -149,7 +149,7 @@ LHASH *lh_new(unsigned long (*h)(), int (*c)())
        ret->error=0;
        return(ret);
 err1:
-       Free(ret);
+       OPENSSL_free(ret);
 err0:
        return(NULL);
        }
@@ -168,12 +168,12 @@ void lh_free(LHASH *lh)
                while (n != NULL)
                        {
                        nn=n->next;
-                       Free(n);
+                       OPENSSL_free(n);
                        n=nn;
                        }
                }
-       Free(lh->b);
-       Free(lh);
+       OPENSSL_free(lh->b);
+       OPENSSL_free(lh);
        }
 
 void *lh_insert(LHASH *lh, void *data)
@@ -190,7 +190,7 @@ void *lh_insert(LHASH *lh, void *data)
 
        if (*rn == NULL)
                {
-               if ((nn=(LHASH_NODE *)Malloc(sizeof(LHASH_NODE))) == NULL)
+               if ((nn=(LHASH_NODE *)OPENSSL_malloc(sizeof(LHASH_NODE))) == NULL)
                        {
                        lh->error++;
                        return(NULL);
@@ -233,7 +233,7 @@ void *lh_delete(LHASH *lh, void *data)
                nn= *rn;
                *rn=nn->next;
                ret=nn->data;
-               Free(nn);
+               OPENSSL_free(nn);
                lh->num_delete++;
                }
 
@@ -329,7 +329,7 @@ static void expand(LHASH *lh)
        if ((lh->p) >= lh->pmax)
                {
                j=(int)lh->num_alloc_nodes*2;
-               n=(LHASH_NODE **)Realloc(lh->b,
+               n=(LHASH_NODE **)OPENSSL_realloc(lh->b,
                        (unsigned int)sizeof(LHASH_NODE *)*j);
                if (n == NULL)
                        {
@@ -357,7 +357,7 @@ static void contract(LHASH *lh)
        lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */
        if (lh->p == 0)
                {
-               n=(LHASH_NODE **)Realloc(lh->b,
+               n=(LHASH_NODE **)OPENSSL_realloc(lh->b,
                        (unsigned int)(sizeof(LHASH_NODE *)*lh->pmax));
                if (n == NULL)
                        {
index 5890e5577406c0bf276e13bf16ad9f4c12c29f17..3b5b2bbc681452586e6426b59520a399e25be3a4 100644 (file)
@@ -252,8 +252,8 @@ void CRYPTO_free(void *str)
 
 void *CRYPTO_remalloc(void *a, int num, const char *file, int line)
        {
-       if (a != NULL) Free(a);
-       a=(char *)Malloc(num);
+       if (a != NULL) OPENSSL_free(a);
+       a=(char *)OPENSSL_malloc(num);
        return(a);
        }
 
index 53b65301135672228ec041d9b8900e179b1863b0..866c53e73a927e4fff3bdd381111bc80ef1c7f9c 100644 (file)
@@ -279,7 +279,7 @@ static APP_INFO *pop_info()
                                ret->next = NULL;
                                if (next != NULL)
                                        next->references--;
-                               Free(ret);
+                               OPENSSL_free(ret);
                                }
                        }
                }
@@ -295,7 +295,7 @@ int CRYPTO_push_info_(const char *info, const char *file, int line)
                {
                MemCheck_off(); /* obtains CRYPTO_LOCK_MALLOC2 */
 
-               if ((ami = (APP_INFO *)Malloc(sizeof(APP_INFO))) == NULL)
+               if ((ami = (APP_INFO *)OPENSSL_malloc(sizeof(APP_INFO))) == NULL)
                        {
                        ret=0;
                        goto err;
@@ -304,7 +304,7 @@ int CRYPTO_push_info_(const char *info, const char *file, int line)
                        {
                        if ((amih=lh_new(app_info_hash,app_info_cmp)) == NULL)
                                {
-                               Free(ami);
+                               OPENSSL_free(ami);
                                ret=0;
                                goto err;
                                }
@@ -386,9 +386,9 @@ void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line,
                if (is_MemCheck_on())
                        {
                        MemCheck_off(); /* obtains CRYPTO_LOCK_MALLOC2 */
-                       if ((m=(MEM *)Malloc(sizeof(MEM))) == NULL)
+                       if ((m=(MEM *)OPENSSL_malloc(sizeof(MEM))) == NULL)
                                {
-                               Free(addr);
+                               OPENSSL_free(addr);
                                MemCheck_on(); /* releases CRYPTO_LOCK_MALLOC2 */
                                return;
                                }
@@ -396,8 +396,8 @@ void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line,
                                {
                                if ((mh=lh_new(mem_hash,mem_cmp)) == NULL)
                                        {
-                                       Free(addr);
-                                       Free(m);
+                                       OPENSSL_free(addr);
+                                       OPENSSL_free(m);
                                        addr=NULL;
                                        goto err;
                                        }
@@ -445,7 +445,7 @@ void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line,
                                        {
                                        mm->app_info->references--;
                                        }
-                               Free(mm);
+                               OPENSSL_free(mm);
                                }
                err:
                        MemCheck_on(); /* releases CRYPTO_LOCK_MALLOC2 */
@@ -481,7 +481,7 @@ void CRYPTO_dbg_free(void *addr, int before_p)
                                        {
                                        mp->app_info->references--;
                                        }
-                               Free(mp);
+                               OPENSSL_free(mp);
                                }
 
                        MemCheck_on(); /* releases CRYPTO_LOCK_MALLOC2 */
index 67cb7f183759efb50764be825e28e4d90511efe1..aa82a8a07cc1364639aa6736141f9211c414115f 100644 (file)
@@ -90,7 +90,7 @@ int OBJ_NAME_new_index(unsigned long (*hash_func)(), int (*cmp_func)(),
        for (i=sk_NAME_FUNCS_num(name_funcs_stack); i<names_type_num; i++)
                {
                MemCheck_off();
-               name_funcs = Malloc(sizeof(NAME_FUNCS));
+               name_funcs = OPENSSL_malloc(sizeof(NAME_FUNCS));
                name_funcs->hash_func = lh_strhash;
                name_funcs->cmp_func = (int (*)())strcmp;
                name_funcs->free_func = 0; /* NULL is often declared to
@@ -187,7 +187,7 @@ int OBJ_NAME_add(const char *name, int type, const char *data)
        alias=type&OBJ_NAME_ALIAS;
        type&= ~OBJ_NAME_ALIAS;
 
-       onp=(OBJ_NAME *)Malloc(sizeof(OBJ_NAME));
+       onp=(OBJ_NAME *)OPENSSL_malloc(sizeof(OBJ_NAME));
        if (onp == NULL)
                {
                /* ERROR */
@@ -212,7 +212,7 @@ int OBJ_NAME_add(const char *name, int type, const char *data)
                        sk_NAME_FUNCS_value(name_funcs_stack,ret->type)
                                ->free_func(ret->name,ret->type,ret->data);
                        }
-               Free(ret);
+               OPENSSL_free(ret);
                }
        else
                {
@@ -247,7 +247,7 @@ int OBJ_NAME_remove(const char *name, int type)
                        sk_NAME_FUNCS_value(name_funcs_stack,ret->type)
                                ->free_func(ret->name,ret->type,ret->data);
                        }
-               Free(ret);
+               OPENSSL_free(ret);
                return(1);
                }
        else
@@ -269,7 +269,7 @@ static void names_lh_free(OBJ_NAME *onp, int type)
 
 static void name_funcs_free(NAME_FUNCS *ptr)
        {
-       Free(ptr);
+       OPENSSL_free(ptr);
        }
 
 void OBJ_NAME_cleanup(int type)
index da6df3762ad56e2a91b4a053a1f81dfde7654b32..018ad5ef979bf59d9b77210b0a1a9d9dca252fd2 100644 (file)
@@ -188,7 +188,7 @@ static void cleanup3(ADDED_OBJ *a)
        {
        if (--a->obj->nid == 0)
                ASN1_OBJECT_free(a->obj);
-       Free(a);
+       OPENSSL_free(a);
        }
 
 void OBJ_cleanup(void)
@@ -220,13 +220,13 @@ int OBJ_add_object(ASN1_OBJECT *obj)
        if (added == NULL)
                if (!init_added()) return(0);
        if ((o=OBJ_dup(obj)) == NULL) goto err;
-       ao[ADDED_NID]=(ADDED_OBJ *)Malloc(sizeof(ADDED_OBJ));
+       ao[ADDED_NID]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ));
        if ((o->length != 0) && (obj->data != NULL))
-               ao[ADDED_DATA]=(ADDED_OBJ *)Malloc(sizeof(ADDED_OBJ));
+               ao[ADDED_DATA]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ));
        if (o->sn != NULL)
-               ao[ADDED_SNAME]=(ADDED_OBJ *)Malloc(sizeof(ADDED_OBJ));
+               ao[ADDED_SNAME]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ));
        if (o->ln != NULL)
-               ao[ADDED_LNAME]=(ADDED_OBJ *)Malloc(sizeof(ADDED_OBJ));
+               ao[ADDED_LNAME]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ));
 
        for (i=ADDED_DATA; i<=ADDED_NID; i++)
                {
@@ -237,7 +237,7 @@ int OBJ_add_object(ASN1_OBJECT *obj)
                        aop=(ADDED_OBJ *)lh_insert(added,ao[i]);
                        /* memory leak, buit should not normally matter */
                        if (aop != NULL)
-                               Free(aop);
+                               OPENSSL_free(aop);
                        }
                }
        o->flags&= ~(ASN1_OBJECT_FLAG_DYNAMIC|ASN1_OBJECT_FLAG_DYNAMIC_STRINGS|
@@ -246,8 +246,8 @@ int OBJ_add_object(ASN1_OBJECT *obj)
        return(o->nid);
 err:
        for (i=ADDED_DATA; i<=ADDED_NID; i++)
-               if (ao[i] != NULL) Free(ao[i]);
-       if (o != NULL) Free(o);
+               if (ao[i] != NULL) OPENSSL_free(ao[i]);
+       if (o != NULL) OPENSSL_free(o);
        return(NID_undef);
        }
 
@@ -400,7 +400,7 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name)
        /* Work out total size */
        j = ASN1_object_size(0,i,V_ASN1_OBJECT);
 
-       if((buf=(unsigned char *)Malloc(j)) == NULL) return NULL;
+       if((buf=(unsigned char *)OPENSSL_malloc(j)) == NULL) return NULL;
 
        p = buf;
        /* Write out tag+length */
@@ -410,7 +410,7 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name)
        
        p=buf;
        op=d2i_ASN1_OBJECT(NULL,&p,i);
-       Free(buf);
+       OPENSSL_free(buf);
        return op;
        }
 
@@ -631,7 +631,7 @@ int OBJ_create(char *oid, char *sn, char *ln)
        i=a2d_ASN1_OBJECT(NULL,0,oid,-1);
        if (i <= 0) return(0);
 
-       if ((buf=(unsigned char *)Malloc(i)) == NULL)
+       if ((buf=(unsigned char *)OPENSSL_malloc(i)) == NULL)
                {
                OBJerr(OBJ_F_OBJ_CREATE,OBJ_R_MALLOC_FAILURE);
                return(0);
@@ -643,7 +643,7 @@ int OBJ_create(char *oid, char *sn, char *ln)
        ok=OBJ_add_object(op);
 err:
        ASN1_OBJECT_free(op);
-       Free(buf);
+       OPENSSL_free(buf);
        return(ok);
        }
 
index 1a1ba0fc063cf548d935c17cef95ece4cddb4c26..0c71639ebaff15eac6c1506dae9f76f83aeda899 100644 (file)
@@ -78,7 +78,7 @@ ASN1_OBJECT *OBJ_dup(ASN1_OBJECT *o)
                OBJerr(OBJ_F_OBJ_DUP,ERR_R_ASN1_LIB);
                return(NULL);
                }
-       r->data=Malloc(o->length);
+       r->data=OPENSSL_malloc(o->length);
        if (r->data == NULL)
                goto err;
        memcpy(r->data,o->data,o->length);
@@ -88,7 +88,7 @@ ASN1_OBJECT *OBJ_dup(ASN1_OBJECT *o)
        if (o->ln != NULL)
                {
                i=strlen(o->ln)+1;
-               r->ln=ln=Malloc(i);
+               r->ln=ln=OPENSSL_malloc(i);
                if (r->ln == NULL) goto err;
                memcpy(ln,o->ln,i);
                }
@@ -98,7 +98,7 @@ ASN1_OBJECT *OBJ_dup(ASN1_OBJECT *o)
                char *s;
 
                i=strlen(o->sn)+1;
-               r->sn=s=Malloc(i);
+               r->sn=s=OPENSSL_malloc(i);
                if (r->sn == NULL) goto err;
                memcpy(s,o->sn,i);
                }
@@ -109,9 +109,9 @@ err:
        OBJerr(OBJ_F_OBJ_DUP,ERR_R_MALLOC_FAILURE);
        if (r != NULL)
                {
-               if (ln != NULL) Free(ln);
-               if (r->data != NULL) Free(r->data);
-               Free(r);
+               if (ln != NULL) OPENSSL_free(ln);
+               if (r->data != NULL) OPENSSL_free(r->data);
+               OPENSSL_free(r);
                }
        return(NULL);
        }
index b65239a9200fce87cbb95ea8bc427346f1c5a63e..1c5c6dea000e14a2c912689b7a20fa12dd469ec1 100644 (file)
@@ -237,9 +237,9 @@ start:
                else    {
                        /* unknown */
                        }
-               if (name != NULL) Free(name);
-               if (header != NULL) Free(header);
-               if (data != NULL) Free(data);
+               if (name != NULL) OPENSSL_free(name);
+               if (header != NULL) OPENSSL_free(header);
+               if (data != NULL) OPENSSL_free(data);
                name=NULL;
                header=NULL;
                data=NULL;
@@ -268,9 +268,9 @@ err:
                ret=NULL;
                }
                
-       if (name != NULL) Free(name);
-       if (header != NULL) Free(header);
-       if (data != NULL) Free(data);
+       if (name != NULL) OPENSSL_free(name);
+       if (header != NULL) OPENSSL_free(header);
+       if (data != NULL) OPENSSL_free(data);
        return(ret);
        }
 
index b5e0a650f8ded59bb8c06c06e46dc8b73d942a62..a17c3ed57f11fd7d8ef1e15c8a6ae1c8f35ecf18 100644 (file)
@@ -242,9 +242,9 @@ char *PEM_ASN1_read_bio(char *(*d2i)(), const char *name, BIO *bp, char **x,
                        return(NULL);
                }
                if(check_pem(nm, name)) break;
-               Free(nm);
-               Free(header);
-               Free(data);
+               OPENSSL_free(nm);
+               OPENSSL_free(header);
+               OPENSSL_free(data);
                }
        if (!PEM_get_EVP_CIPHER_INFO(header,&cipher)) goto err;
        if (!PEM_do_header(&cipher,data,&len,cb,u)) goto err;
@@ -289,9 +289,9 @@ p8err:
        if (ret == NULL)
                PEMerr(PEM_F_PEM_ASN1_READ_BIO,ERR_R_ASN1_LIB);
 err:
-       Free(nm);
-       Free(header);
-       Free(data);
+       OPENSSL_free(nm);
+       OPENSSL_free(header);
+       OPENSSL_free(data);
        return(ret);
        }
 
@@ -344,7 +344,7 @@ int PEM_ASN1_write_bio(int (*i2d)(), const char *name, BIO *bp, char *x,
                goto err;
                }
        /* dzise + 8 bytes are needed */
-       data=(unsigned char *)Malloc((unsigned int)dsize+20);
+       data=(unsigned char *)OPENSSL_malloc((unsigned int)dsize+20);
        if (data == NULL)
                {
                PEMerr(PEM_F_PEM_ASN1_WRITE_BIO,ERR_R_MALLOC_FAILURE);
@@ -405,7 +405,7 @@ err:
        memset((char *)&ctx,0,sizeof(ctx));
        memset(buf,0,PEM_BUFSIZE);
        memset(data,0,(unsigned int)dsize);
-       Free(data);
+       OPENSSL_free(data);
        return(ret);
        }
 
@@ -583,7 +583,7 @@ int PEM_write_bio(BIO *bp, const char *name, char *header, unsigned char *data,
                        goto err;
                }
 
-       buf=(unsigned char *)Malloc(PEM_BUFSIZE*8);
+       buf=(unsigned char *)OPENSSL_malloc(PEM_BUFSIZE*8);
        if (buf == NULL)
                {
                reason=ERR_R_MALLOC_FAILURE;
@@ -603,7 +603,7 @@ int PEM_write_bio(BIO *bp, const char *name, char *header, unsigned char *data,
                }
        EVP_EncodeFinal(&ctx,buf,&outl);
        if ((outl > 0) && (BIO_write(bp,(char *)buf,outl) != outl)) goto err;
-       Free(buf);
+       OPENSSL_free(buf);
        if (    (BIO_write(bp,"-----END ",9) != 9) ||
                (BIO_write(bp,name,nlen) != nlen) ||
                (BIO_write(bp,"-----\n",6) != 6))
@@ -784,9 +784,9 @@ int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data,
        *header=headerB->data;
        *data=(unsigned char *)dataB->data;
        *len=bl;
-       Free(nameB);
-       Free(headerB);
-       Free(dataB);
+       OPENSSL_free(nameB);
+       OPENSSL_free(headerB);
+       OPENSSL_free(dataB);
        return(1);
 err:
        BUF_MEM_free(nameB);
index 126e29d375d0afe529769ae858c8381a7f37ce76..2a6c5133481afeea02762f983ace99ed1cb96bf1 100644 (file)
@@ -84,7 +84,7 @@ int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type,
                j=RSA_size(pubk[i]->pkey.rsa);
                if (j > max) max=j;
                }
-       s=(char *)Malloc(max*2);
+       s=(char *)OPENSSL_malloc(max*2);
        if (s == NULL)
                {
                PEMerr(PEM_F_PEM_SEALINIT,ERR_R_MALLOC_FAILURE);
@@ -108,7 +108,7 @@ int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type,
 
        ret=npubk;
 err:
-       if (s != NULL) Free(s);
+       if (s != NULL) OPENSSL_free(s);
        memset(key,0,EVP_MAX_KEY_LENGTH);
        return(ret);
        }
@@ -151,7 +151,7 @@ int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl,
                }
        i=RSA_size(priv->pkey.rsa);
        if (i < 100) i=100;
-       s=(unsigned char *)Malloc(i*2);
+       s=(unsigned char *)OPENSSL_malloc(i*2);
        if (s == NULL)
                {
                PEMerr(PEM_F_PEM_SEALFINAL,ERR_R_MALLOC_FAILURE);
@@ -172,7 +172,7 @@ int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl,
 err:
        memset((char *)&(ctx->md),0,sizeof(ctx->md));
        memset((char *)&(ctx->cipher),0,sizeof(ctx->cipher));
-       if (s != NULL) Free(s);
+       if (s != NULL) OPENSSL_free(s);
        return(ret);
        }
 #else /* !NO_RSA */
index aabafb702df03e7cc6f93d238fb410385e70fa4a..42d598dd78c316edba930e5f40fbf97c4a5ef50e 100644 (file)
@@ -82,7 +82,7 @@ int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen,
        int i,ret=0;
        unsigned int m_len;
 
-       m=(unsigned char *)Malloc(EVP_PKEY_size(pkey)+2);
+       m=(unsigned char *)OPENSSL_malloc(EVP_PKEY_size(pkey)+2);
        if (m == NULL)
                {
                PEMerr(PEM_F_PEM_SIGNFINAL,ERR_R_MALLOC_FAILURE);
@@ -96,7 +96,7 @@ int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen,
        ret=1;
 err:
        /* ctx has been zeroed by EVP_SignFinal() */
-       if (m != NULL) Free(m);
+       if (m != NULL) OPENSSL_free(m);
        return(ret);
        }
 
index f559351d1834a47f762af8c9b6c57dc8743f7512..b370c9cf3f3f12cce52c24ebf950ca5b68c05548 100644 (file)
@@ -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;
index c358b0673553abb327c3919a42b8daf9bdc867d5..56547ef933f3704d195c718ee2dd2286fddf3a1c 100644 (file)
@@ -188,5 +188,5 @@ void PKCS12_BAGS_free (PKCS12_BAGS *a)
        }
 
        ASN1_OBJECT_free (a->type);
-       Free (a);
+       OPENSSL_free (a);
 }
index 778954b99fe50585dfcfa99befe7dd86066a7e3c..9ba90bbbdfef4704ad41e1bd7b5462bb61cb1dd1 100644 (file)
@@ -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;
 }
 
index 743b5bd88df7ea7582883ff2315c56b1ac013c88..b042dcf05c95928386948181b73b19790562ab38 100644 (file)
@@ -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
index 7ca9c14908a234f569ca4c415dce3bf5bb3c9bc7..7d464e3a32b153a7e2bd59a15ef04164246db4f4 100644 (file)
@@ -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);
 }
index f5ab0d6464a0461467c6a8f0fc3725f8ea88c971..fbd1eca24ff7bc18a20e344944d0519f122c65db 100644 (file)
@@ -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);
 }
index a335a7b868a092659a9d1b9f8dfbe701febc5721..13d866da51290fca62cba9fef55e187b795e61ff 100644 (file)
@@ -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;
        }
index 6ae209693d7843b1868a9808e0317850a91e93d0..64ac32ee6fdb8698d13d8921f78e61f91095f438 100644 (file)
@@ -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)
index 2adcbc95e1a87f90eb00323522f157f982febcbb..17f41b45496b1af7f84b21fe05519274b4e07883 100644 (file)
@@ -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;
index 4803966fd2b1eb96cb0a0f2fdf445462298966dc..5447e69818619a1e0a4ec9954d95b5ac53d5250b 100644 (file)
@@ -128,7 +128,7 @@ static int ber_new(BIO *bi)
        {
        BIO_BER_CTX *ctx;
 
-       ctx=(BIO_BER_CTX *)Malloc(sizeof(BIO_BER_CTX));
+       ctx=(BIO_BER_CTX *)OPENSSL_malloc(sizeof(BIO_BER_CTX));
        if (ctx == NULL) return(0);
 
        memset((char *)ctx,0,sizeof(BIO_BER_CTX));
@@ -146,7 +146,7 @@ static int ber_free(BIO *a)
        if (a == NULL) return(0);
        b=(BIO_BER_CTX *)a->ptr;
        memset(a->ptr,0,sizeof(BIO_BER_CTX));
-       Free(a->ptr);
+       OPENSSL_free(a->ptr);
        a->ptr=NULL;
        a->init=0;
        a->flags=0;
index f22a708358d38c17b97d62654d3d946217f44071..6ae264cbf98e605b93a44de954159a492abd1bfc 100644 (file)
@@ -23,7 +23,7 @@ int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, STACK_OF(X509_ALGOR) *cap)
        len=i2d_ASN1_SET_OF_X509_ALGOR(cap,NULL,i2d_X509_ALGOR,
                                       V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL,
                                       IS_SEQUENCE);
-       if(!(pp=(unsigned char *)Malloc(len))) {
+       if(!(pp=(unsigned char *)OPENSSL_malloc(len))) {
                PKCS7err(PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP,ERR_R_MALLOC_FAILURE);
                return 0;
        }
@@ -38,7 +38,7 @@ int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, STACK_OF(X509_ALGOR) *cap)
                PKCS7err(PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP,ERR_R_MALLOC_FAILURE);
                return 0;
        }
-       Free (pp);
+       OPENSSL_free (pp);
         return PKCS7_add_signed_attribute(si, NID_SMIMECapabilities,
                                                        V_ASN1_SEQUENCE, seq);
 }
index d93b27e7376e6de61e1ae656e96b240f597e66fc..7acd11e057d78399fe5ff18740eb83a04b4aa6f9 100644 (file)
@@ -189,7 +189,7 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio)
                        EVP_PKEY_free(pkey);
                        if (max < jj) max=jj;
                        }
-               if ((tmp=(unsigned char *)Malloc(max)) == NULL)
+               if ((tmp=(unsigned char *)OPENSSL_malloc(max)) == NULL)
                        {
                        PKCS7err(PKCS7_F_PKCS7_DATAINIT,ERR_R_MALLOC_FAILURE);
                        goto err;
@@ -203,12 +203,12 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio)
                        if (jj <= 0)
                                {
                                PKCS7err(PKCS7_F_PKCS7_DATAINIT,ERR_R_EVP_LIB);
-                               Free(tmp);
+                               OPENSSL_free(tmp);
                                goto err;
                                }
                        M_ASN1_OCTET_STRING_set(ri->enc_key,tmp,jj);
                        }
-               Free(tmp);
+               OPENSSL_free(tmp);
                memset(key, 0, keylen);
 
                if (out == NULL)
@@ -374,7 +374,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
                }
 
                jj=EVP_PKEY_size(pkey);
-               tmp=(unsigned char *)Malloc(jj+10);
+               tmp=(unsigned char *)OPENSSL_malloc(jj+10);
                if (tmp == NULL)
                        {
                        PKCS7err(PKCS7_F_PKCS7_DATADECODE,ERR_R_MALLOC_FAILURE);
@@ -456,7 +456,7 @@ err:
                out=NULL;
                }
        if (tmp != NULL)
-               Free(tmp);
+               OPENSSL_free(tmp);
        return(out);
        }
 
@@ -578,13 +578,13 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
                                x=i2d_ASN1_SET_OF_X509_ATTRIBUTE(sk,NULL,
                                           i2d_X509_ATTRIBUTE,
                                           V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET);
-                               pp=(unsigned char *)Malloc(x);
+                               pp=(unsigned char *)OPENSSL_malloc(x);
                                p=pp;
                                i2d_ASN1_SET_OF_X509_ATTRIBUTE(sk,&p,
                                           i2d_X509_ATTRIBUTE,
                                           V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET);
                                EVP_SignUpdate(&ctx_tmp,pp,x);
-                               Free(pp);
+                               OPENSSL_free(pp);
                                pp=NULL;
                                }
 
@@ -627,7 +627,7 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
                        (unsigned char *)buf_mem->data,buf_mem->length);
 #endif
                }
-       if (pp != NULL) Free(pp);
+       if (pp != NULL) OPENSSL_free(pp);
        pp=NULL;
 
        ret=1;
@@ -772,13 +772,13 @@ for (ii=0; ii<md_len; ii++) printf("%02X",md_dat[ii]); printf(" calc\n");
                 */
                i=i2d_ASN1_SET_OF_X509_ATTRIBUTE(sk,NULL,i2d_X509_ATTRIBUTE,
                        V_ASN1_SET,V_ASN1_UNIVERSAL, IS_SEQUENCE);
-               pp=Malloc(i);
+               pp=OPENSSL_malloc(i);
                p=pp;
                i2d_ASN1_SET_OF_X509_ATTRIBUTE(sk,&p,i2d_X509_ATTRIBUTE,
                        V_ASN1_SET,V_ASN1_UNIVERSAL, IS_SEQUENCE);
                EVP_VerifyUpdate(&mdc_tmp,pp,i);
 
-               Free(pp);
+               OPENSSL_free(pp);
                }
 
        os=si->enc_digest;
index 0ba7d77462ab56417cd6e9a8c7c6cec07ef19d39..7c6649cc1475b72a9a54aa5fd5c9d0b8548fe613 100644 (file)
@@ -641,7 +641,7 @@ static MIME_HEADER *mime_hdr_new(char *name, char *value)
                        }
                }
        } else tmpval = NULL;
-       mhdr = (MIME_HEADER *) Malloc(sizeof(MIME_HEADER));
+       mhdr = (MIME_HEADER *) OPENSSL_malloc(sizeof(MIME_HEADER));
        if(!mhdr) return NULL;
        mhdr->name = tmpname;
        mhdr->value = tmpval;
@@ -670,7 +670,7 @@ static int mime_hdr_addparam(MIME_HEADER *mhdr, char *name, char *value)
                if(!tmpval) return 0;
        } else tmpval = NULL;
        /* Parameter values are case sensitive so leave as is */
-       mparam = (MIME_PARAM *) Malloc(sizeof(MIME_PARAM));
+       mparam = (MIME_PARAM *) OPENSSL_malloc(sizeof(MIME_PARAM));
        if(!mparam) return 0;
        mparam->param_name = tmpname;
        mparam->param_value = tmpval;
@@ -714,17 +714,17 @@ static MIME_PARAM *mime_param_find(MIME_HEADER *hdr, char *name)
 
 static void mime_hdr_free(MIME_HEADER *hdr)
 {
-       if(hdr->name) Free(hdr->name);
-       if(hdr->value) Free(hdr->value);
+       if(hdr->name) OPENSSL_free(hdr->name);
+       if(hdr->value) OPENSSL_free(hdr->value);
        if(hdr->params) sk_MIME_PARAM_pop_free(hdr->params, mime_param_free);
-       Free(hdr);
+       OPENSSL_free(hdr);
 }
 
 static void mime_param_free(MIME_PARAM *param)
 {
-       if(param->param_name) Free(param->param_name);
-       if(param->param_value) Free(param->param_value);
-       Free(param);
+       if(param->param_name) OPENSSL_free(param->param_name);
+       if(param->param_value) OPENSSL_free(param->param_value);
+       OPENSSL_free(param);
 }
 
 /* Check for a multipart boundary. Returns:
index 78a55f32d37cd3f415cca3e202084a369f6953d8..2ee4a48cc80c6b2572a1c493071fda8ac92a8fd6 100644 (file)
@@ -252,7 +252,7 @@ void RAND_screen(void)
   GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm);
   size = (unsigned int)bm.bmWidthBytes * bm.bmHeight * bm.bmPlanes;
 
-  bmbits = Malloc(size);
+  bmbits = OPENSSL_malloc(size);
   if (bmbits) {
     /* Now go through the whole screen, repeatedly grabbing n lines */
     for (y = 0; y < h-n; y += n)
@@ -272,7 +272,7 @@ void RAND_screen(void)
        RAND_seed(md, MD_DIGEST_LENGTH);
        }
 
-    Free(bmbits);
+    OPENSSL_free(bmbits);
   }
 
   /* Select old bitmap back into memory DC */
index d01b9852e9473c4a45bdbd7283caf0f60769bff3..830d6168e6e8275c936ffd695dbcd26c4e77fcbd 100644 (file)
@@ -172,7 +172,7 @@ int RAND_write_file(const char *file)
        {
        char *tmpf;
 
-       tmpf = Malloc(strlen(file) + 4);  /* to add ";-1" and a nul */
+       tmpf = OPENSSL_malloc(strlen(file) + 4);  /* to add ";-1" and a nul */
        if (tmpf)
                {
                strcpy(tmpf, file);
index b7d2460754e6225f3edd8f8dec7a0fd6c5757079..618b5bd59565ec819272aa8a8e9d88f42cfea1ba 100644 (file)
@@ -106,7 +106,7 @@ static int RSA_eay_public_encrypt(int flen, unsigned char *from,
        BN_init(&ret);
        if ((ctx=BN_CTX_new()) == NULL) goto err;
        num=BN_num_bytes(rsa->n);
-       if ((buf=(unsigned char *)Malloc(num)) == NULL)
+       if ((buf=(unsigned char *)OPENSSL_malloc(num)) == NULL)
                {
                RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT,ERR_R_MALLOC_FAILURE);
                goto err;
@@ -161,7 +161,7 @@ err:
        if (buf != NULL) 
                {
                memset(buf,0,num);
-               Free(buf);
+               OPENSSL_free(buf);
                }
        return(r);
        }
@@ -179,7 +179,7 @@ static int RSA_eay_private_encrypt(int flen, unsigned char *from,
 
        if ((ctx=BN_CTX_new()) == NULL) goto err;
        num=BN_num_bytes(rsa->n);
-       if ((buf=(unsigned char *)Malloc(num)) == NULL)
+       if ((buf=(unsigned char *)OPENSSL_malloc(num)) == NULL)
                {
                RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,ERR_R_MALLOC_FAILURE);
                goto err;
@@ -237,7 +237,7 @@ err:
        if (buf != NULL)
                {
                memset(buf,0,num);
-               Free(buf);
+               OPENSSL_free(buf);
                }
        return(r);
        }
@@ -258,7 +258,7 @@ static int RSA_eay_private_decrypt(int flen, unsigned char *from,
 
        num=BN_num_bytes(rsa->n);
 
-       if ((buf=(unsigned char *)Malloc(num)) == NULL)
+       if ((buf=(unsigned char *)OPENSSL_malloc(num)) == NULL)
                {
                RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,ERR_R_MALLOC_FAILURE);
                goto err;
@@ -330,7 +330,7 @@ err:
        if (buf != NULL)
                {
                memset(buf,0,num);
-               Free(buf);
+               OPENSSL_free(buf);
                }
        return(r);
        }
@@ -350,7 +350,7 @@ static int RSA_eay_public_decrypt(int flen, unsigned char *from,
        if (ctx == NULL) goto err;
 
        num=BN_num_bytes(rsa->n);
-       buf=(unsigned char *)Malloc(num);
+       buf=(unsigned char *)OPENSSL_malloc(num);
        if (buf == NULL)
                {
                RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,ERR_R_MALLOC_FAILURE);
@@ -402,7 +402,7 @@ err:
        if (buf != NULL)
                {
                memset(buf,0,num);
-               Free(buf);
+               OPENSSL_free(buf);
                }
        return(r);
        }
index 88d93a46ddbdca1f4d8bcce504b2cee762ca74c8..bbddd3f0f0bff74f8aa809aa67e7c135dfe96adb 100644 (file)
@@ -116,7 +116,7 @@ RSA *RSA_new_method(RSA_METHOD *meth)
        {
        RSA *ret;
 
-       ret=(RSA *)Malloc(sizeof(RSA));
+       ret=(RSA *)OPENSSL_malloc(sizeof(RSA));
        if (ret == NULL)
                {
                RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);
@@ -147,7 +147,7 @@ RSA *RSA_new_method(RSA_METHOD *meth)
        ret->flags=ret->meth->flags;
        if ((ret->meth->init != NULL) && !ret->meth->init(ret))
                {
-               Free(ret);
+               OPENSSL_free(ret);
                ret=NULL;
                }
        else
@@ -188,8 +188,8 @@ void RSA_free(RSA *r)
        if (r->dmq1 != NULL) BN_clear_free(r->dmq1);
        if (r->iqmp != NULL) BN_clear_free(r->iqmp);
        if (r->blinding != NULL) BN_BLINDING_free(r->blinding);
-       if (r->bignum_data != NULL) Free_locked(r->bignum_data);
-       Free(r);
+       if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data);
+       OPENSSL_free(r);
        }
 
 int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
@@ -306,7 +306,7 @@ int RSA_memory_lock(RSA *r)
        j=1;
        for (i=0; i<6; i++)
                j+= (*t[i])->top;
-       if ((p=Malloc_locked((off+j)*sizeof(BN_ULONG))) == NULL)
+       if ((p=OPENSSL_malloc_locked((off+j)*sizeof(BN_ULONG))) == NULL)
                {
                RSAerr(RSA_F_MEMORY_LOCK,ERR_R_MALLOC_FAILURE);
                return(0);
index 1465c01f4f44053c7912bb51bb6d75dedb92a379..fd0b7f361fbba41e833d4416ecb132811366414c 100644 (file)
@@ -34,7 +34,7 @@ int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,
        return (0);
        }
     
-    dbmask = Malloc(emlen - SHA_DIGEST_LENGTH);
+    dbmask = OPENSSL_malloc(emlen - SHA_DIGEST_LENGTH);
     if (dbmask == NULL)
        {
        RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP, ERR_R_MALLOC_FAILURE);
@@ -66,7 +66,7 @@ int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,
     for (i = 0; i < SHA_DIGEST_LENGTH; i++)
        seed[i] ^= seedmask[i];
 
-    Free(dbmask);
+    OPENSSL_free(dbmask);
     return (1);
     }
 
@@ -86,7 +86,7 @@ int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,
        }
 
     dblen = num - SHA_DIGEST_LENGTH;
-    db = Malloc(dblen);
+    db = OPENSSL_malloc(dblen);
     if (db == NULL)
        {
        RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP, ERR_R_MALLOC_FAILURE);
@@ -128,7 +128,7 @@ int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,
                memcpy(to, db + i, mlen);
            }
        }
-    Free(db);
+    OPENSSL_free(db);
     return (mlen);
     }
 
index 61efb0b00fd71153f5a16375333dd4a48a09a3cb..c77f4381ffb11a20c9c29bd8c01419a7438aceb0 100644 (file)
@@ -81,7 +81,7 @@ int RSA_sign_ASN1_OCTET_STRING(int type, unsigned char *m, unsigned int m_len,
                RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY);
                return(0);
                }
-       s=(unsigned char *)Malloc((unsigned int)j+1);
+       s=(unsigned char *)OPENSSL_malloc((unsigned int)j+1);
        if (s == NULL)
                {
                RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE);
@@ -96,7 +96,7 @@ int RSA_sign_ASN1_OCTET_STRING(int type, unsigned char *m, unsigned int m_len,
                *siglen=i;
 
        memset(s,0,(unsigned int)j+1);
-       Free(s);
+       OPENSSL_free(s);
        return(ret);
        }
 
@@ -114,7 +114,7 @@ int RSA_verify_ASN1_OCTET_STRING(int dtype, unsigned char *m,
                return(0);
                }
 
-       s=(unsigned char *)Malloc((unsigned int)siglen);
+       s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen);
        if (s == NULL)
                {
                RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE);
@@ -138,7 +138,7 @@ int RSA_verify_ASN1_OCTET_STRING(int dtype, unsigned char *m,
 err:
        if (sig != NULL) M_ASN1_OCTET_STRING_free(sig);
        memset(s,0,(unsigned int)siglen);
-       Free(s);
+       OPENSSL_free(s);
        return(ret);
        }
 
index 05bb7fb74afe9f2cb5a212e847cb49a26c62a5e7..31049b979194aad064003804436d7a98f0b7c7e8 100644 (file)
@@ -115,7 +115,7 @@ int RSA_sign(int type, unsigned char *m, unsigned int m_len,
                return(0);
                }
        if(type != NID_md5_sha1) {
-               s=(unsigned char *)Malloc((unsigned int)j+1);
+               s=(unsigned char *)OPENSSL_malloc((unsigned int)j+1);
                if (s == NULL)
                        {
                        RSAerr(RSA_F_RSA_SIGN,ERR_R_MALLOC_FAILURE);
@@ -132,7 +132,7 @@ int RSA_sign(int type, unsigned char *m, unsigned int m_len,
 
        if(type != NID_md5_sha1) {
                memset(s,0,(unsigned int)j+1);
-               Free(s);
+               OPENSSL_free(s);
        }
        return(ret);
        }
@@ -153,7 +153,7 @@ int RSA_verify(int dtype, unsigned char *m, unsigned int m_len,
        if(rsa->flags & RSA_FLAG_SIGN_VER)
            return rsa->meth->rsa_verify(dtype, m, m_len, sigbuf, siglen, rsa);
 
-       s=(unsigned char *)Malloc((unsigned int)siglen);
+       s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen);
        if (s == NULL)
                {
                RSAerr(RSA_F_RSA_VERIFY,ERR_R_MALLOC_FAILURE);
@@ -215,7 +215,7 @@ int RSA_verify(int dtype, unsigned char *m, unsigned int m_len,
 err:
        if (sig != NULL) X509_SIG_free(sig);
        memset(s,0,(unsigned int)siglen);
-       Free(s);
+       OPENSSL_free(s);
        return(ret);
        }
 
index 8f57daa6f4e4eb06f52ecfde4b5a15fc984fe39a..d2c640075b33f844482d87518f3435db5e98f234 100644 (file)
@@ -94,7 +94,7 @@ STACK *sk_dup(STACK *sk)
        char **s;
 
        if ((ret=sk_new(sk->comp)) == NULL) goto err;
-       s=(char **)Realloc((char *)ret->data,
+       s=(char **)OPENSSL_realloc((char *)ret->data,
                (unsigned int)sizeof(char *)*sk->num_alloc);
        if (s == NULL) goto err;
        ret->data=s;
@@ -114,9 +114,9 @@ STACK *sk_new(int (*c)(const char * const *, const char * const *))
        STACK *ret;
        int i;
 
-       if ((ret=(STACK *)Malloc(sizeof(STACK))) == NULL)
+       if ((ret=(STACK *)OPENSSL_malloc(sizeof(STACK))) == NULL)
                goto err0;
-       if ((ret->data=(char **)Malloc(sizeof(char *)*MIN_NODES)) == NULL)
+       if ((ret->data=(char **)OPENSSL_malloc(sizeof(char *)*MIN_NODES)) == NULL)
                goto err1;
        for (i=0; i<MIN_NODES; i++)
                ret->data[i]=NULL;
@@ -126,7 +126,7 @@ STACK *sk_new(int (*c)(const char * const *, const char * const *))
        ret->sorted=0;
        return(ret);
 err1:
-       Free(ret);
+       OPENSSL_free(ret);
 err0:
        return(NULL);
        }
@@ -138,7 +138,7 @@ int sk_insert(STACK *st, char *data, int loc)
        if(st == NULL) return 0;
        if (st->num_alloc <= st->num+1)
                {
-               s=(char **)Realloc((char *)st->data,
+               s=(char **)OPENSSL_realloc((char *)st->data,
                        (unsigned int)sizeof(char *)*st->num_alloc*2);
                if (s == NULL)
                        return(0);
@@ -287,8 +287,8 @@ void sk_pop_free(STACK *st, void (*func)(void *))
 void sk_free(STACK *st)
        {
        if (st == NULL) return;
-       if (st->data != NULL) Free(st->data);
-       Free(st);
+       if (st->data != NULL) OPENSSL_free(st->data);
+       OPENSSL_free(st);
        }
 
 int sk_num(const STACK *st)
index 24713a3157398c6a6d9e1eb5f796a9f44172786b..100165948c028f9ff4d3380368c4b8474ebee169 100644 (file)
@@ -699,7 +699,7 @@ void thread_setup(void)
        {
        int i;
 
-       lock_cs=Malloc(CRYPTO_num_locks() * sizeof(HANDLE));
+       lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(HANDLE));
        for (i=0; i<CRYPTO_num_locks(); i++)
                {
                lock_cs[i]=CreateMutex(NULL,FALSE,NULL);
@@ -716,7 +716,7 @@ void thread_cleanup(void)
        CRYPTO_set_locking_callback(NULL);
        for (i=0; i<CRYPTO_num_locks(); i++)
                CloseHandle(lock_cs[i]);
-       Free(lock_cs);
+       OPENSSL_free(lock_cs);
        }
 
 void win32_locking_callback(int mode, int type, char *file, int line)
@@ -794,8 +794,8 @@ void thread_setup(void)
        {
        int i;
 
-       lock_cs=Malloc(CRYPTO_num_locks() * sizeof(mutex_t));
-       lock_count=Malloc(CRYPTO_num_locks() * sizeof(long));
+       lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(mutex_t));
+       lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
        for (i=0; i<CRYPTO_num_locks(); i++)
                {
                lock_count[i]=0;
@@ -821,8 +821,8 @@ void thread_cleanup(void)
                mutex_destroy(&(lock_cs[i]));
                fprintf(stderr,"%8ld:%s\n",lock_count[i],CRYPTO_get_lock_name(i));
                }
-       Free(lock_cs);
-       Free(lock_count);
+       OPENSSL_free(lock_cs);
+       OPENSSL_free(lock_count);
 
        fprintf(stderr,"done cleanup\n");
 
@@ -919,7 +919,7 @@ void thread_setup(void)
        arena=usinit(filename);
        unlink(filename);
 
-       lock_cs=Malloc(CRYPTO_num_locks() * sizeof(usema_t *));
+       lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(usema_t *));
        for (i=0; i<CRYPTO_num_locks(); i++)
                {
                lock_cs[i]=usnewsema(arena,1);
@@ -942,7 +942,7 @@ void thread_cleanup(void)
                usdumpsema(lock_cs[i],stdout,buf);
                usfreesema(lock_cs[i],arena);
                }
-       Free(lock_cs);
+       OPENSSL_free(lock_cs);
        }
 
 void irix_locking_callback(int mode, int type, char *file, int line)
@@ -1002,8 +1002,8 @@ void thread_setup(void)
        {
        int i;
 
-       lock_cs=Malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t));
-       lock_count=Malloc(CRYPTO_num_locks() * sizeof(long));
+       lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t));
+       lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
        for (i=0; i<CRYPTO_num_locks(); i++)
                {
                lock_count[i]=0;
@@ -1026,8 +1026,8 @@ void thread_cleanup(void)
                fprintf(stderr,"%8ld:%s\n",lock_count[i],
                        CRYPTO_get_lock_name(i));
                }
-       Free(lock_cs);
-       Free(lock_count);
+       OPENSSL_free(lock_cs);
+       OPENSSL_free(lock_count);
 
        fprintf(stderr,"done cleanup\n");
        }
index 3ee978060c205244aff3a04b0cc8d41ce8ef13a3..553d2218de76ebec8bbf8c4441316a463bb3e804 100644 (file)
@@ -113,7 +113,7 @@ void CRYPTO_thread_setup(void)
        {
        int i;
 
-       lock_cs=Malloc(CRYPTO_num_locks() * sizeof(HANDLE));
+       lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(HANDLE));
        for (i=0; i<CRYPTO_num_locks(); i++)
                {
                lock_cs[i]=CreateMutex(NULL,FALSE,NULL);
@@ -131,7 +131,7 @@ static void CRYPTO_thread_cleanup(void)
        CRYPTO_set_locking_callback(NULL);
        for (i=0; i<CRYPTO_num_locks(); i++)
                CloseHandle(lock_cs[i]);
-       Free(lock_cs);
+       OPENSSL_free(lock_cs);
        }
 
 void win32_locking_callback(int mode, int type, char *file, int line)
@@ -164,11 +164,11 @@ void CRYPTO_thread_setup(void)
        int i;
 
 #ifdef USE_MUTEX
-       lock_cs=Malloc(CRYPTO_num_locks() * sizeof(mutex_t));
+       lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(mutex_t));
 #else
-       lock_cs=Malloc(CRYPTO_num_locks() * sizeof(rwlock_t));
+       lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(rwlock_t));
 #endif
-       lock_count=Malloc(CRYPTO_num_locks() * sizeof(long));
+       lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
        for (i=0; i<CRYPTO_num_locks(); i++)
                {
                lock_count[i]=0;
@@ -196,8 +196,8 @@ void CRYPTO_thread_cleanup(void)
                rwlock_destroy(&(lock_cs[i]));
 #endif
                }
-       Free(lock_cs);
-       Free(lock_count);
+       OPENSSL_free(lock_cs);
+       OPENSSL_free(lock_count);
        }
 
 void solaris_locking_callback(int mode, int type, char *file, int line)
@@ -267,7 +267,7 @@ void CRYPTO_thread_setup(void)
        arena=usinit(filename);
        unlink(filename);
 
-       lock_cs=Malloc(CRYPTO_num_locks() * sizeof(usema_t *));
+       lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(usema_t *));
        for (i=0; i<CRYPTO_num_locks(); i++)
                {
                lock_cs[i]=usnewsema(arena,1);
@@ -290,7 +290,7 @@ void CRYPTO_thread_cleanup(void)
                usdumpsema(lock_cs[i],stdout,buf);
                usfreesema(lock_cs[i],arena);
                }
-       Free(lock_cs);
+       OPENSSL_free(lock_cs);
        }
 
 void irix_locking_callback(int mode, int type, char *file, int line)
@@ -324,8 +324,8 @@ void CRYPTO_thread_setup(void)
        {
        int i;
 
-       lock_cs=Malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t));
-       lock_count=Malloc(CRYPTO_num_locks() * sizeof(long));
+       lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t));
+       lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
        for (i=0; i<CRYPTO_num_locks(); i++)
                {
                lock_count[i]=0;
@@ -345,8 +345,8 @@ void thread_cleanup(void)
                {
                pthread_mutex_destroy(&(lock_cs[i]));
                }
-       Free(lock_cs);
-       Free(lock_count);
+       OPENSSL_free(lock_cs);
+       OPENSSL_free(lock_count);
        }
 
 void pthreads_locking_callback(int mode, int type, char *file,
index 0ad8a9ed8d195b279abfadc87831c96e26dd7f1a..7773928666ae56309dfa45c1a586a9ed44e4c752 100644 (file)
@@ -134,7 +134,7 @@ char *ms_time_new(void)
        {
        MS_TM *ret;
 
-       ret=(MS_TM *)Malloc(sizeof(MS_TM));
+       ret=(MS_TM *)OPENSSL_malloc(sizeof(MS_TM));
        if (ret == NULL)
                return(NULL);
        memset(ret,0,sizeof(MS_TM));
@@ -147,7 +147,7 @@ char *ms_time_new(void)
 void ms_time_free(char *a)
        {
        if (a != NULL)
-               Free(a);
+               OPENSSL_free(a);
        }
 
 void ms_time_get(char *a)
index 33acc81f3fa7c0e82ca0041571f48508baf5560e..3b04fe280c37888c32e57895ebedfa6ec4b4d10f 100644 (file)
@@ -83,16 +83,16 @@ TXT_DB *TXT_DB_read(BIO *in, int num)
        if ((buf=BUF_MEM_new()) == NULL) goto err;
        if (!BUF_MEM_grow(buf,size)) goto err;
 
-       if ((ret=(TXT_DB *)Malloc(sizeof(TXT_DB))) == NULL)
+       if ((ret=(TXT_DB *)OPENSSL_malloc(sizeof(TXT_DB))) == NULL)
                goto err;
        ret->num_fields=num;
        ret->index=NULL;
        ret->qual=NULL;
        if ((ret->data=sk_new_null()) == NULL)
                goto err;
-       if ((ret->index=(LHASH **)Malloc(sizeof(LHASH *)*num)) == NULL)
+       if ((ret->index=(LHASH **)OPENSSL_malloc(sizeof(LHASH *)*num)) == NULL)
                goto err;
-       if ((ret->qual=(int (**)())Malloc(sizeof(int (**)())*num)) == NULL)
+       if ((ret->qual=(int (**)())OPENSSL_malloc(sizeof(int (**)())*num)) == NULL)
                goto err;
        for (i=0; i<num; i++)
                {
@@ -122,7 +122,7 @@ TXT_DB *TXT_DB_read(BIO *in, int num)
                else
                        {
                        buf->data[offset-1]='\0'; /* blat the '\n' */
-                       p=(char *)Malloc(add+offset);
+                       p=(char *)OPENSSL_malloc(add+offset);
                        offset=0;
                        }
                pp=(char **)p;
@@ -177,12 +177,12 @@ err:
        if (er)
                {
 #if !defined(NO_STDIO) && !defined(WIN16)
-               if (er == 1) fprintf(stderr,"Malloc failure\n");
+               if (er == 1) fprintf(stderr,"OPENSSL_malloc failure\n");
 #endif
                if (ret->data != NULL) sk_free(ret->data);
-               if (ret->index != NULL) Free(ret->index);
-               if (ret->qual != NULL) Free(ret->qual);
-               if (ret != NULL) Free(ret);
+               if (ret->index != NULL) OPENSSL_free(ret->index);
+               if (ret->qual != NULL) OPENSSL_free(ret->qual);
+               if (ret != NULL) OPENSSL_free(ret);
                return(NULL);
                }
        else
@@ -349,10 +349,10 @@ void TXT_DB_free(TXT_DB *db)
                {
                for (i=db->num_fields-1; i>=0; i--)
                        if (db->index[i] != NULL) lh_free(db->index[i]);
-               Free(db->index);
+               OPENSSL_free(db->index);
                }
        if (db->qual != NULL)
-               Free(db->qual);
+               OPENSSL_free(db->qual);
        if (db->data != NULL)
                {
                for (i=sk_num(db->data)-1; i>=0; i--)
@@ -364,7 +364,7 @@ void TXT_DB_free(TXT_DB *db)
                        if (max == NULL) /* new row */
                                {
                                for (n=0; n<db->num_fields; n++)
-                                       if (p[n] != NULL) Free(p[n]);
+                                       if (p[n] != NULL) OPENSSL_free(p[n]);
                                }
                        else
                                {
@@ -372,12 +372,12 @@ void TXT_DB_free(TXT_DB *db)
                                        {
                                        if (((p[n] < (char *)p) || (p[n] > max))
                                                && (p[n] != NULL))
-                                               Free(p[n]);
+                                               OPENSSL_free(p[n]);
                                        }
                                }
-                       Free(sk_value(db->data,i));
+                       OPENSSL_free(sk_value(db->data,i));
                        }
                sk_free(db->data);
                }
-       Free(db);
+       OPENSSL_free(db);
        }
index 14d12c56bd709e47198ecb8b73547624c7f08a3a..c5920cc7dd9e4c5b029ea8f05fe4e3bf47a093f5 100644 (file)
@@ -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';
index 0452b025b99c8a0b40fcd0011dc0142a1d7fd04d..b147d573d2f9613788a66f11ef2e3bd11d1eed0c 100644 (file)
@@ -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)
index a20006d67e2b3c2eedb205f7149d5d65eae6a74c..5e5458568fc093bc095a2dfe19042ef5a20c5b25 100644 (file)
@@ -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,
index 691b71f03158345539a6e0da95784d1770e80d7a..6a3ba8eb154322c11965af2ac8af49c4f91d9675 100644 (file)
@@ -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;
index baef8790eb94de82d194b53095c1f0b8f580a0a3..7eca1bd57a3df0ab162d632d0c9d8b8bc88b9933 100644 (file)
@@ -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;
index 8637e56d9c65309a6c81e016e1b4dc65fde40239..a7b1543461b9ee6790d0f36ef4865c84908cf72a 100644 (file)
@@ -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);
                }
        }
 
index 3ddb2303d3809a31eb5cf351d75891f00fb5d7ef..e9311d5ea8393466f9500a949d692232b2e56856 100644 (file)
@@ -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;
index b35c3f92e7f479ee5371e5b9f8a4785fa3735275..fd0a534d88e55c53f39914480a1bccebf22fa0bd 100644 (file)
@@ -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;
 }
index 96c04fe4f57c52017b07bef7e171cad7ec79f8dc..877ae7da7b14ab0dca9ce00eeb81031e8f5194af 100644 (file)
@@ -132,7 +132,7 @@ void AUTHORITY_KEYID_free(AUTHORITY_KEYID *a)
        M_ASN1_OCTET_STRING_free(a->keyid);
        sk_GENERAL_NAME_pop_free(a->issuer, GENERAL_NAME_free);
        M_ASN1_INTEGER_free (a->serial);
-       Free (a);
+       OPENSSL_free (a);
 }
 
 static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method,
@@ -142,7 +142,7 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method,
        if(akeyid->keyid) {
                tmp = hex_to_string(akeyid->keyid->data, akeyid->keyid->length);
                X509V3_add_value("keyid", tmp, &extlist);
-               Free(tmp);
+               OPENSSL_free(tmp);
        }
        if(akeyid->issuer) 
                extlist = i2v_GENERAL_NAMES(NULL, akeyid->issuer, extlist);
@@ -150,7 +150,7 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method,
                tmp = hex_to_string(akeyid->serial->data,
                                                 akeyid->serial->length);
                X509V3_add_value("serial", tmp, &extlist);
-               Free(tmp);
+               OPENSSL_free(tmp);
        }
        return extlist;
 }
index 1e3edc205f8dcdb278194e755b2279a5b6c88ceb..c576b8e955cdeb4eedd57c9713ae7e782deacf64 100644 (file)
@@ -123,7 +123,7 @@ void BASIC_CONSTRAINTS_free(BASIC_CONSTRAINTS *a)
 {
        if (a == NULL) return;
        M_ASN1_INTEGER_free (a->pathlen);
-       Free (a);
+       OPENSSL_free (a);
 }
 
 static STACK_OF(CONF_VALUE) *i2v_BASIC_CONSTRAINTS(X509V3_EXT_METHOD *method,
index b2f03010cce7f7bc7d3fa9d5e28693f099f3667c..bdc9c1cbc132866a8d6c208f6f7b7d70578f66f4 100644 (file)
@@ -167,7 +167,7 @@ static X509_EXTENSION *do_ext_i2d(X509V3_EXT_METHOD *method, int ext_nid,
        X509_EXTENSION *ext;
        /* Convert internal representation to DER */
        ext_len = method->i2d(ext_struc, NULL);
-       if(!(ext_der = Malloc(ext_len))) goto merr;
+       if(!(ext_der = OPENSSL_malloc(ext_len))) goto merr;
        p = ext_der;
        method->i2d(ext_struc, &p);
        if(!(ext_oct = M_ASN1_OCTET_STRING_new())) goto merr;
@@ -255,7 +255,7 @@ extension = X509_EXTENSION_create_by_OBJ(NULL, obj, crit, oct);
 err:
 ASN1_OBJECT_free(obj);
 M_ASN1_OCTET_STRING_free(oct);
-if(ext_der) Free(ext_der);
+if(ext_der) OPENSSL_free(ext_der);
 return extension;
 }
 
index da9dbe1c10c0a1a6419b7292a2b08f8804588e32..8203ed7571a77f8f2161826d08f934e7a325f77a 100644 (file)
@@ -401,7 +401,7 @@ void POLICYINFO_free(POLICYINFO *a)
        if (a == NULL) return;
        ASN1_OBJECT_free(a->policyid);
        sk_POLICYQUALINFO_pop_free(a->qualifiers, POLICYQUALINFO_free);
-       Free (a);
+       OPENSSL_free (a);
 }
 
 static void print_qualifiers(BIO *out, STACK_OF(POLICYQUALINFO) *quals,
@@ -451,7 +451,7 @@ static void print_notice(BIO *out, USERNOTICE *notice, int indent)
                        if(i) BIO_puts(out, ", ");
                        tmp = i2s_ASN1_INTEGER(NULL, num);
                        BIO_puts(out, tmp);
-                       Free(tmp);
+                       OPENSSL_free(tmp);
                }
                BIO_puts(out, "\n");
        }
@@ -553,7 +553,7 @@ void POLICYQUALINFO_free(POLICYQUALINFO *a)
        }
        
        ASN1_OBJECT_free(a->pqualid);
-       Free (a);
+       OPENSSL_free (a);
 }
 
 int i2d_USERNOTICE(USERNOTICE *a, unsigned char **pp)
@@ -599,7 +599,7 @@ void USERNOTICE_free(USERNOTICE *a)
        if (a == NULL) return;
        NOTICEREF_free(a->noticeref);
        M_DISPLAYTEXT_free(a->exptext);
-       Free (a);
+       OPENSSL_free (a);
 }
 
 int i2d_NOTICEREF(NOTICEREF *a, unsigned char **pp)
@@ -653,7 +653,7 @@ void NOTICEREF_free(NOTICEREF *a)
        if (a == NULL) return;
        M_DISPLAYTEXT_free(a->organization);
        sk_ASN1_INTEGER_pop_free(a->noticenos, ASN1_STRING_free);
-       Free (a);
+       OPENSSL_free (a);
 }
 
 IMPLEMENT_STACK_OF(POLICYQUALINFO)
index e459d2595ac5230a1eea2d621d923c8bdb13c049..4fd61f2cf39c799b464f1ecef2e3068248d4d944 100644 (file)
@@ -213,7 +213,7 @@ void DIST_POINT_free(DIST_POINT *a)
        DIST_POINT_NAME_free(a->distpoint);
        M_ASN1_BIT_STRING_free(a->reasons);
        sk_GENERAL_NAME_pop_free(a->CRLissuer, GENERAL_NAME_free);
-       Free (a);
+       OPENSSL_free (a);
 }
 
 int i2d_DIST_POINT_NAME(DIST_POINT_NAME *a, unsigned char **pp)
@@ -256,7 +256,7 @@ void DIST_POINT_NAME_free(DIST_POINT_NAME *a)
        if (a == NULL) return;
        sk_X509_NAME_ENTRY_pop_free(a->relativename, X509_NAME_ENTRY_free);
        sk_GENERAL_NAME_pop_free(a->fullname, GENERAL_NAME_free);
-       Free (a);
+       OPENSSL_free (a);
 }
 
 DIST_POINT_NAME *d2i_DIST_POINT_NAME(DIST_POINT_NAME **a, unsigned char **pp,
index 894afa7e036b4f585c630c3edea0d2043ef60849..2de1c4b42867ea524e9537033bd8b949b37d2408 100644 (file)
@@ -211,7 +211,7 @@ void GENERAL_NAME_free(GENERAL_NAME *a)
                break;
 
        }
-       Free (a);
+       OPENSSL_free (a);
 }
 
 /* Now the GeneralNames versions: a SEQUENCE OF GeneralName. These are needed as
@@ -286,6 +286,6 @@ void OTHERNAME_free(OTHERNAME *a)
        if (a == NULL) return;
        ASN1_OBJECT_free(a->type_id);
        ASN1_TYPE_free(a->value);
-       Free (a);
+       OPENSSL_free (a);
 }
 
index af3525f33e7213eed0fd81ffcdca36c600be5284..f3bba382693176d066656a7f95ad28f371f164ef 100644 (file)
@@ -82,7 +82,7 @@ static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method,
 {
        char *tmp;
        if(!ia5 || !ia5->length) return NULL;
-       tmp = Malloc(ia5->length + 1);
+       tmp = OPENSSL_malloc(ia5->length + 1);
        memcpy(tmp, ia5->data, ia5->length);
        tmp[ia5->length] = 0;
        return tmp;
index 78d2135046ec978574dfe6460e2d3e24c8afac17..9ada0b310b35368517a10a9e335a91a89ce85820 100644 (file)
@@ -94,7 +94,7 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD *method
                if(!ret) break;
                vtmp = sk_CONF_VALUE_value(ret, i);
                i2t_ASN1_OBJECT(objtmp, 80, desc->method);
-               ntmp = Malloc(strlen(objtmp) + strlen(vtmp->name) + 5);
+               ntmp = OPENSSL_malloc(strlen(objtmp) + strlen(vtmp->name) + 5);
                if(!ntmp) {
                        X509V3err(X509V3_F_I2V_AUTHORITY_INFO_ACCESS,
                                        ERR_R_MALLOC_FAILURE);
@@ -103,7 +103,7 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD *method
                strcpy(ntmp, objtmp);
                strcat(ntmp, " - ");
                strcat(ntmp, vtmp->name);
-               Free(vtmp->name);
+               OPENSSL_free(vtmp->name);
                vtmp->name = ntmp;
                
        }
@@ -140,7 +140,7 @@ static STACK_OF(ACCESS_DESCRIPTION) *v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD
                ctmp.value = cnf->value;
                if(!(acc->location = v2i_GENERAL_NAME(method, ctx, &ctmp)))
                                                                 goto err; 
-               if(!(objtmp = Malloc(objlen + 1))) {
+               if(!(objtmp = OPENSSL_malloc(objlen + 1))) {
                        X509V3err(X509V3_F_V2I_ACCESS_DESCRIPTION,ERR_R_MALLOC_FAILURE);
                        goto err;
                }
@@ -150,10 +150,10 @@ static STACK_OF(ACCESS_DESCRIPTION) *v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD
                if(!acc->method) {
                        X509V3err(X509V3_F_V2I_ACCESS_DESCRIPTION,X509V3_R_BAD_OBJECT);
                        ERR_add_error_data(2, "value=", objtmp);
-                       Free(objtmp);
+                       OPENSSL_free(objtmp);
                        goto err;
                }
-               Free(objtmp);
+               OPENSSL_free(objtmp);
 
        }
        return ainfo;
@@ -204,7 +204,7 @@ void ACCESS_DESCRIPTION_free(ACCESS_DESCRIPTION *a)
        if (a == NULL) return;
        ASN1_OBJECT_free(a->method);
        GENERAL_NAME_free(a->location);
-       Free (a);
+       OPENSSL_free (a);
 }
 
 STACK_OF(ACCESS_DESCRIPTION) *AUTHORITY_INFO_ACCESS_new(void)
index aa04fb24aa588ce049768434f3e298c636b59443..8f90970297e4b8d05a3e956f46845d2acacaec0d 100644 (file)
@@ -127,7 +127,7 @@ int X509V3_EXT_add_alias(int nid_to, int nid_from)
                X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,X509V3_R_EXTENSION_NOT_FOUND);
                return 0;
        }
-       if(!(tmpext = (X509V3_EXT_METHOD *)Malloc(sizeof(X509V3_EXT_METHOD)))) {
+       if(!(tmpext = (X509V3_EXT_METHOD *)OPENSSL_malloc(sizeof(X509V3_EXT_METHOD)))) {
                X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,ERR_R_MALLOC_FAILURE);
                return 0;
        }
@@ -145,7 +145,7 @@ void X509V3_EXT_cleanup(void)
 
 static void ext_list_free(X509V3_EXT_METHOD *ext)
 {
-       if(ext->ext_flags & X509V3_EXT_DYNAMIC) Free(ext);
+       if(ext->ext_flags & X509V3_EXT_DYNAMIC) OPENSSL_free(ext);
 }
 
 /* Legacy function: we don't need to add standard extensions
index 30a62c6090f7203a59245bfd7f28586deb523911..47f9e8f123a965f2613470dff039780b58cf2180 100644 (file)
@@ -121,7 +121,7 @@ void PKEY_USAGE_PERIOD_free(PKEY_USAGE_PERIOD *a)
        if (a == NULL) return;
        M_ASN1_GENERALIZEDTIME_free(a->notBefore);
        M_ASN1_GENERALIZEDTIME_free(a->notAfter);
-       Free (a);
+       OPENSSL_free (a);
 }
 
 static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method,
index bee624c6be9a1f3dd0e0f6b31e2bcdd64c27ce08..dbc4fb1f160009d575d919c689a40f9afac25c0b 100644 (file)
@@ -133,7 +133,7 @@ int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, int flag, int indent)
 
        err:
                sk_CONF_VALUE_pop_free(nval, X509V3_conf_free);
-               if(value) Free(value);
+               if(value) OPENSSL_free(value);
                method->ext_free(ext_str);
                return ok;
 }
index 488b97f02572a879c978df9b545565b16ab090f2..d84d0130aead67140951b0f4d38886eb6b89d2f8 100644 (file)
@@ -171,17 +171,17 @@ int X509_PURPOSE_add(int id, int trust, int flags,
        idx = X509_PURPOSE_get_by_id(id);
        /* Need a new entry */
        if(idx == -1) {
-               if(!(ptmp = Malloc(sizeof(X509_PURPOSE)))) {
+               if(!(ptmp = OPENSSL_malloc(sizeof(X509_PURPOSE)))) {
                        X509V3err(X509V3_F_X509_PURPOSE_ADD,ERR_R_MALLOC_FAILURE);
                        return 0;
                }
                ptmp->flags = X509_PURPOSE_DYNAMIC;
        } else ptmp = X509_PURPOSE_get0(idx);
 
-       /* Free existing name if dynamic */
+       /* OPENSSL_free existing name if dynamic */
        if(ptmp->flags & X509_PURPOSE_DYNAMIC_NAME) {
-               Free(ptmp->name);
-               Free(ptmp->sname);
+               OPENSSL_free(ptmp->name);
+               OPENSSL_free(ptmp->sname);
        }
        /* dup supplied name */
        ptmp->name = BUF_strdup(name);
@@ -220,10 +220,10 @@ static void xptable_free(X509_PURPOSE *p)
        if (p->flags & X509_PURPOSE_DYNAMIC) 
                {
                if (p->flags & X509_PURPOSE_DYNAMIC_NAME) {
-                       Free(p->name);
-                       Free(p->sname);
+                       OPENSSL_free(p->name);
+                       OPENSSL_free(p->sname);
                }
-               Free(p);
+               OPENSSL_free(p);
                }
        }
 
index 20ba8ac8d6bbca145008576bfe216bf4c858acee..bfecacd3367d4f49e6584765ab8bbd10caac4078 100644 (file)
@@ -132,7 +132,7 @@ void SXNET_free(SXNET *a)
        if (a == NULL) return;
        M_ASN1_INTEGER_free(a->version);
        sk_SXNETID_pop_free(a->ids, SXNETID_free);
-       Free (a);
+       OPENSSL_free (a);
 }
 
 int i2d_SXNETID(SXNETID *a, unsigned char **pp)
@@ -176,7 +176,7 @@ void SXNETID_free(SXNETID *a)
        if (a == NULL) return;
        M_ASN1_INTEGER_free(a->zone);
        M_ASN1_OCTET_STRING_free(a->user);
-       Free (a);
+       OPENSSL_free (a);
 }
 
 static int sxnet_i2r(X509V3_EXT_METHOD *method, SXNET *sx, BIO *out,
@@ -192,7 +192,7 @@ static int sxnet_i2r(X509V3_EXT_METHOD *method, SXNET *sx, BIO *out,
                id = sk_SXNETID_value(sx->ids, i);
                tmp = i2s_ASN1_INTEGER(NULL, id->zone);
                BIO_printf(out, "\n%*sZone: %s, User: ", indent, "", tmp);
-               Free(tmp);
+               OPENSSL_free(tmp);
                M_ASN1_OCTET_STRING_print(out, id->user);
        }
        return 1;
index 4c2c4a9483913aa01302b59f3c32add2f478b2b6..3f567180c597e2ca1f072267c309e773492f8ed1 100644 (file)
@@ -75,7 +75,7 @@ int X509V3_add_value(const char *name, const char *value,
        char *tname = NULL, *tvalue = NULL;
        if(name && !(tname = BUF_strdup(name))) goto err;
        if(value && !(tvalue = BUF_strdup(value))) goto err;;
-       if(!(vtmp = (CONF_VALUE *)Malloc(sizeof(CONF_VALUE)))) goto err;
+       if(!(vtmp = (CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE)))) goto err;
        if(!*extlist && !(*extlist = sk_CONF_VALUE_new(NULL))) goto err;
        vtmp->section = NULL;
        vtmp->name = tname;
@@ -84,9 +84,9 @@ int X509V3_add_value(const char *name, const char *value,
        return 1;
        err:
        X509V3err(X509V3_F_X509V3_ADD_VALUE,ERR_R_MALLOC_FAILURE);
-       if(vtmp) Free(vtmp);
-       if(tname) Free(tname);
-       if(tvalue) Free(tvalue);
+       if(vtmp) OPENSSL_free(vtmp);
+       if(tname) OPENSSL_free(tname);
+       if(tvalue) OPENSSL_free(tvalue);
        return 0;
 }
 
@@ -101,10 +101,10 @@ int X509V3_add_value_uchar(const char *name, const unsigned char *value,
 void X509V3_conf_free(CONF_VALUE *conf)
 {
        if(!conf) return;
-       if(conf->name) Free(conf->name);
-       if(conf->value) Free(conf->value);
-       if(conf->section) Free(conf->section);
-       Free(conf);
+       if(conf->name) OPENSSL_free(conf->name);
+       if(conf->value) OPENSSL_free(conf->value);
+       if(conf->section) OPENSSL_free(conf->section);
+       OPENSSL_free(conf);
 }
 
 int X509V3_add_value_bool(const char *name, int asn1_bool,
@@ -176,7 +176,7 @@ int X509V3_add_value_int(const char *name, ASN1_INTEGER *aint,
        if(!aint) return 1;
        if(!(strtmp = i2s_ASN1_INTEGER(NULL, aint))) return 0;
        ret = X509V3_add_value(name, strtmp, extlist);
-       Free(strtmp);
+       OPENSSL_free(strtmp);
        return ret;
 }
 
@@ -298,11 +298,11 @@ STACK_OF(CONF_VALUE) *X509V3_parse_list(char *line)
                }
                X509V3_add_value(ntmp, NULL, &values);
        }
-Free(linebuf);
+OPENSSL_free(linebuf);
 return values;
 
 err:
-Free(linebuf);
+OPENSSL_free(linebuf);
 sk_CONF_VALUE_pop_free(values, X509V3_conf_free);
 return NULL;
 
@@ -325,7 +325,7 @@ static char *strip_spaces(char *name)
 
 /* hex string utilities */
 
-/* Given a buffer of length 'len' return a Malloc'ed string with its
+/* Given a buffer of length 'len' return a OPENSSL_malloc'ed string with its
  * hex representation
  */
 
@@ -336,7 +336,7 @@ char *hex_to_string(unsigned char *buffer, long len)
        int i;
        static char hexdig[] = "0123456789ABCDEF";
        if(!buffer || !len) return NULL;
-       if(!(tmp = Malloc(len * 3 + 1))) {
+       if(!(tmp = OPENSSL_malloc(len * 3 + 1))) {
                X509V3err(X509V3_F_HEX_TO_STRING,ERR_R_MALLOC_FAILURE);
                return NULL;
        }
@@ -362,14 +362,14 @@ unsigned char *string_to_hex(char *str, long *len)
                X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_INVALID_NULL_ARGUMENT);
                return NULL;
        }
-       if(!(hexbuf = Malloc(strlen(str) >> 1))) goto err;
+       if(!(hexbuf = OPENSSL_malloc(strlen(str) >> 1))) goto err;
        for(p = (unsigned char *)str, q = hexbuf; *p;) {
                ch = *p++;
                if(ch == ':') continue;
                cl = *p++;
                if(!cl) {
                        X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ODD_NUMBER_OF_DIGITS);
-                       Free(hexbuf);
+                       OPENSSL_free(hexbuf);
                        return NULL;
                }
                if(isupper(ch)) ch = tolower(ch);
@@ -391,12 +391,12 @@ unsigned char *string_to_hex(char *str, long *len)
        return hexbuf;
 
        err:
-       if(hexbuf) Free(hexbuf);
+       if(hexbuf) OPENSSL_free(hexbuf);
        X509V3err(X509V3_F_STRING_TO_HEX,ERR_R_MALLOC_FAILURE);
        return NULL;
 
        badhex:
-       Free(hexbuf);
+       OPENSSL_free(hexbuf);
        X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ILLEGAL_HEX_DIGIT);
        return NULL;
 
index ad86bc9b49ad7aca3d7aacb2b68bf01388722176..8e248e7e728547c75e1659e80729fee39f6e6920 100644 (file)
@@ -177,11 +177,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\n");
+               BIO_printf(bio_err,"OPENSSL_malloc failure\n");
                goto end;
                }
 
@@ -259,8 +259,8 @@ bad:
                BIO_printf(bio_err,"bytes written:%8ld\n",BIO_number_written(out));
                }
 end:
-       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);
index ae99a6aceb0ab888ddba9b637feddb8abb697c6b..f6396db82edc12a378560cb01e4befd48e7cc447 100644 (file)
@@ -105,7 +105,7 @@ static int ssl_new(BIO *bi)
        {
        BIO_SSL *bs;
 
-       bs=(BIO_SSL *)Malloc(sizeof(BIO_SSL));
+       bs=(BIO_SSL *)OPENSSL_malloc(sizeof(BIO_SSL));
        if (bs == NULL)
                {
                BIOerr(BIO_F_SSL_NEW,ERR_R_MALLOC_FAILURE);
@@ -133,7 +133,7 @@ static int ssl_free(BIO *a)
                a->flags=0;
                }
        if (a->ptr != NULL)
-               Free(a->ptr);
+               OPENSSL_free(a->ptr);
        return(1);
        }
        
index 6a3bbb10b953a16b1a899a6c14d66a5356107d37..930769be0d1971637f92894eaf6b9f71eed39639 100644 (file)
@@ -297,7 +297,7 @@ int ssl23_get_client_hello(SSL *s)
                                        if (n <= 0) return(n);
                                        p=s->packet;
 
-                                       if ((buf=Malloc(n)) == NULL)
+                                       if ((buf=OPENSSL_malloc(n)) == NULL)
                                                {
                                                SSLerr(SSL_F_SSL23_GET_CLIENT_HELLO,ERR_R_MALLOC_FAILURE);
                                                goto err;
@@ -559,10 +559,10 @@ int ssl23_get_client_hello(SSL *s)
                }
        s->init_num=0;
 
-       if (buf != buf_space) Free(buf);
+       if (buf != buf_space) OPENSSL_free(buf);
        s->first_packet=1;
        return(SSL_accept(s));
 err:
-       if (buf != buf_space) Free(buf);
+       if (buf != buf_space) OPENSSL_free(buf);
        return(-1);
        }
index a9458e7fa7208f59bff980971a46c3fd4846457e..35acdf8276d218c53cb555b861b6692460ead259 100644 (file)
@@ -80,11 +80,11 @@ int ssl2_enc_init(SSL *s, int client)
 
        if ((s->enc_read_ctx == NULL) &&
                ((s->enc_read_ctx=(EVP_CIPHER_CTX *)
-               Malloc(sizeof(EVP_CIPHER_CTX))) == NULL))
+               OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL))
                goto err;
        if ((s->enc_write_ctx == NULL) &&
                ((s->enc_write_ctx=(EVP_CIPHER_CTX *)
-               Malloc(sizeof(EVP_CIPHER_CTX))) == NULL))
+               OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL))
                goto err;
 
        rs= s->enc_read_ctx;
index 5ddba23a066208011202b774beb0e2fe114d34ab..8c9d992541bdb6e2d8803a14de804999df01e43f 100644 (file)
@@ -267,12 +267,12 @@ int ssl2_new(SSL *s)
        {
        SSL2_STATE *s2;
 
-       if ((s2=Malloc(sizeof *s2)) == NULL) goto err;
+       if ((s2=OPENSSL_malloc(sizeof *s2)) == NULL) goto err;
        memset(s2,0,sizeof *s2);
 
-       if ((s2->rbuf=Malloc(
+       if ((s2->rbuf=OPENSSL_malloc(
                SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER+2)) == NULL) goto err;
-       if ((s2->wbuf=Malloc(
+       if ((s2->wbuf=OPENSSL_malloc(
                SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER+2)) == NULL) goto err;
        s->s2=s2;
 
@@ -281,9 +281,9 @@ int ssl2_new(SSL *s)
 err:
        if (s2 != NULL)
                {
-               if (s2->wbuf != NULL) Free(s2->wbuf);
-               if (s2->rbuf != NULL) Free(s2->rbuf);
-               Free(s2);
+               if (s2->wbuf != NULL) OPENSSL_free(s2->wbuf);
+               if (s2->rbuf != NULL) OPENSSL_free(s2->rbuf);
+               OPENSSL_free(s2);
                }
        return(0);
        }
@@ -296,10 +296,10 @@ void ssl2_free(SSL *s)
            return;
 
        s2=s->s2;
-       if (s2->rbuf != NULL) Free(s2->rbuf);
-       if (s2->wbuf != NULL) Free(s2->wbuf);
+       if (s2->rbuf != NULL) OPENSSL_free(s2->rbuf);
+       if (s2->wbuf != NULL) OPENSSL_free(s2->wbuf);
        memset(s2,0,sizeof *s2);
-       Free(s2);
+       OPENSSL_free(s2);
        s->s2=NULL;
        }
 
index 332e28445118091f2e7d9995ff308382d02f32cd..1ed02540aec4d7bdc6521c501801370fbf6a8bd3 100644 (file)
@@ -898,7 +898,7 @@ static int request_certificate(SSL *s)
                EVP_VerifyUpdate(&ctx,ccd,SSL2_MIN_CERT_CHALLENGE_LENGTH);
 
                i=i2d_X509(s->cert->pkeys[SSL_PKEY_RSA_ENC].x509,NULL);
-               buf2=Malloc((unsigned int)i);
+               buf2=OPENSSL_malloc((unsigned int)i);
                if (buf2 == NULL)
                        {
                        SSLerr(SSL_F_REQUEST_CERTIFICATE,ERR_R_MALLOC_FAILURE);
@@ -907,7 +907,7 @@ static int request_certificate(SSL *s)
                p2=buf2;
                i=i2d_X509(s->cert->pkeys[SSL_PKEY_RSA_ENC].x509,&p2);
                EVP_VerifyUpdate(&ctx,buf2,(unsigned int)i);
-               Free(buf2);
+               OPENSSL_free(buf2);
 
                pkey=X509_get_pubkey(x509);
                if (pkey == NULL) goto end;
index 03e0c38770b105bd3c20c8c58bf8db0620f483d6..d92c164b0fa911e4c2458a3cf4e9b04c25c61484 100644 (file)
@@ -567,7 +567,7 @@ int ssl3_setup_buffers(SSL *s)
                        extra=SSL3_RT_MAX_EXTRA;
                else
                        extra=0;
-               if ((p=Malloc(SSL3_RT_MAX_PACKET_SIZE+extra))
+               if ((p=OPENSSL_malloc(SSL3_RT_MAX_PACKET_SIZE+extra))
                        == NULL)
                        goto err;
                s->s3->rbuf.buf=p;
@@ -575,7 +575,7 @@ int ssl3_setup_buffers(SSL *s)
 
        if (s->s3->wbuf.buf == NULL)
                {
-               if ((p=Malloc(SSL3_RT_MAX_PACKET_SIZE))
+               if ((p=OPENSSL_malloc(SSL3_RT_MAX_PACKET_SIZE))
                        == NULL)
                        goto err;
                s->s3->wbuf.buf=p;
index df4acab3d02817bdf1d862628f37ab88050b596c..012a4b8740772e56241f03013cb97cc0e5a18503 100644 (file)
@@ -150,7 +150,7 @@ int ssl3_change_cipher_state(SSL *s, int which)
                {
                if ((s->enc_read_ctx == NULL) &&
                        ((s->enc_read_ctx=(EVP_CIPHER_CTX *)
-                       Malloc(sizeof(EVP_CIPHER_CTX))) == NULL))
+                       OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL))
                        goto err;
                dd= s->enc_read_ctx;
                s->read_hash=m;
@@ -170,7 +170,7 @@ int ssl3_change_cipher_state(SSL *s, int which)
                                }
                        if (s->s3->rrec.comp == NULL)
                                s->s3->rrec.comp=(unsigned char *)
-                                       Malloc(SSL3_RT_MAX_PLAIN_LENGTH);
+                                       OPENSSL_malloc(SSL3_RT_MAX_PLAIN_LENGTH);
                        if (s->s3->rrec.comp == NULL)
                                goto err;
                        }
@@ -181,7 +181,7 @@ int ssl3_change_cipher_state(SSL *s, int which)
                {
                if ((s->enc_write_ctx == NULL) &&
                        ((s->enc_write_ctx=(EVP_CIPHER_CTX *)
-                       Malloc(sizeof(EVP_CIPHER_CTX))) == NULL))
+                       OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL))
                        goto err;
                dd= s->enc_write_ctx;
                s->write_hash=m;
@@ -300,7 +300,7 @@ int ssl3_setup_key_block(SSL *s)
 
        ssl3_cleanup_key_block(s);
 
-       if ((p=Malloc(num)) == NULL)
+       if ((p=OPENSSL_malloc(num)) == NULL)
                goto err;
 
        s->s3->tmp.key_block_length=num;
@@ -320,7 +320,7 @@ void ssl3_cleanup_key_block(SSL *s)
                {
                memset(s->s3->tmp.key_block,0,
                        s->s3->tmp.key_block_length);
-               Free(s->s3->tmp.key_block);
+               OPENSSL_free(s->s3->tmp.key_block);
                s->s3->tmp.key_block=NULL;
                }
        s->s3->tmp.key_block_length=0;
index 7ada26cbb693b3a8f5807f06d5e27d3795689fb4..9b664ab4cb76df7916561fb289d7249959efa5b9 100644 (file)
@@ -648,7 +648,7 @@ int ssl3_new(SSL *s)
        {
        SSL3_STATE *s3;
 
-       if ((s3=Malloc(sizeof *s3)) == NULL) goto err;
+       if ((s3=OPENSSL_malloc(sizeof *s3)) == NULL) goto err;
        memset(s3,0,sizeof *s3);
 
        s->s3=s3;
@@ -666,11 +666,11 @@ void ssl3_free(SSL *s)
 
        ssl3_cleanup_key_block(s);
        if (s->s3->rbuf.buf != NULL)
-               Free(s->s3->rbuf.buf);
+               OPENSSL_free(s->s3->rbuf.buf);
        if (s->s3->wbuf.buf != NULL)
-               Free(s->s3->wbuf.buf);
+               OPENSSL_free(s->s3->wbuf.buf);
        if (s->s3->rrec.comp != NULL)
-               Free(s->s3->rrec.comp);
+               OPENSSL_free(s->s3->rrec.comp);
 #ifndef NO_DH
        if (s->s3->tmp.dh != NULL)
                DH_free(s->s3->tmp.dh);
@@ -678,7 +678,7 @@ void ssl3_free(SSL *s)
        if (s->s3->tmp.ca_names != NULL)
                sk_X509_NAME_pop_free(s->s3->tmp.ca_names,X509_NAME_free);
        memset(s->s3,0,sizeof *s->s3);
-       Free(s->s3);
+       OPENSSL_free(s->s3);
        s->s3=NULL;
        }
 
@@ -692,7 +692,7 @@ void ssl3_clear(SSL *s)
 
        if (s->s3->rrec.comp != NULL)
                {
-               Free(s->s3->rrec.comp);
+               OPENSSL_free(s->s3->rrec.comp);
                s->s3->rrec.comp=NULL;
                }
 #ifndef NO_DH
index e77cdddfd3f86d5da4e8fa04185a2b7380548610..fa6456e4f5e8915f4f4d616845e38adac2ba4052 100644 (file)
@@ -92,7 +92,7 @@ int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp)
 
        /* Note that I cheat in the following 2 assignments.  I know
         * that if the ASN1_INTEGER passed to ASN1_INTEGER_set
-        * is > sizeof(long)+1, the buffer will not be re-Malloc()ed.
+        * is > sizeof(long)+1, the buffer will not be re-OPENSSL_malloc()ed.
         * This is a bit evil but makes things simple, no dynamic allocation
         * to clean up :-) */
        a.version.length=LSIZE2;
@@ -223,13 +223,13 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp,
        ai.data=NULL; ai.length=0;
        M_ASN1_D2I_get(aip,d2i_ASN1_INTEGER);
        version=(int)ASN1_INTEGER_get(aip);
-       if (ai.data != NULL) { Free(ai.data); ai.data=NULL; ai.length=0; }
+       if (ai.data != NULL) { OPENSSL_free(ai.data); ai.data=NULL; ai.length=0; }
 
        /* we don't care about the version right now :-) */
        M_ASN1_D2I_get(aip,d2i_ASN1_INTEGER);
        ssl_version=(int)ASN1_INTEGER_get(aip);
        ret->ssl_version=ssl_version;
-       if (ai.data != NULL) { Free(ai.data); ai.data=NULL; ai.length=0; }
+       if (ai.data != NULL) { OPENSSL_free(ai.data); ai.data=NULL; ai.length=0; }
 
        os.data=NULL; os.length=0;
        M_ASN1_D2I_get(osp,d2i_ASN1_OCTET_STRING);
@@ -291,14 +291,14 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp,
        else
                ret->key_arg_length=os.length;
        memcpy(ret->key_arg,os.data,ret->key_arg_length);
-       if (os.data != NULL) Free(os.data);
+       if (os.data != NULL) OPENSSL_free(os.data);
 
        ai.length=0;
        M_ASN1_D2I_get_EXP_opt(aip,d2i_ASN1_INTEGER,1);
        if (ai.data != NULL)
                {
                ret->time=ASN1_INTEGER_get(aip);
-               Free(ai.data); ai.data=NULL; ai.length=0;
+               OPENSSL_free(ai.data); ai.data=NULL; ai.length=0;
                }
        else
                ret->time=time(NULL);
@@ -308,7 +308,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp,
        if (ai.data != NULL)
                {
                ret->timeout=ASN1_INTEGER_get(aip);
-               Free(ai.data); ai.data=NULL; ai.length=0;
+               OPENSSL_free(ai.data); ai.data=NULL; ai.length=0;
                }
        else
                ret->timeout=3;
@@ -330,7 +330,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp,
                SSLerr(SSL_F_D2I_SSL_SESSION,SSL_R_BAD_LENGTH);
            ret->sid_ctx_length=os.length;
            memcpy(ret->sid_ctx,os.data,os.length);
-           Free(os.data); os.data=NULL; os.length=0;
+           OPENSSL_free(os.data); os.data=NULL; os.length=0;
            }
        else
            ret->sid_ctx_length=0;
@@ -340,7 +340,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp,
        if (ai.data != NULL)
                {
                ret->verify_result=ASN1_INTEGER_get(aip);
-               Free(ai.data); ai.data=NULL; ai.length=0;
+               OPENSSL_free(ai.data); ai.data=NULL; ai.length=0;
                }
        else
                ret->verify_result=X509_V_OK;
index fc8b8a7a5347e5f84ad8831e5928268bb81045fa..7579a3432d92a13f60de98ddecb46db817216927 100644 (file)
@@ -143,7 +143,7 @@ CERT *ssl_cert_new(void)
        {
        CERT *ret;
 
-       ret=(CERT *)Malloc(sizeof(CERT));
+       ret=(CERT *)OPENSSL_malloc(sizeof(CERT));
        if (ret == NULL)
                {
                SSLerr(SSL_F_SSL_CERT_NEW,ERR_R_MALLOC_FAILURE);
@@ -162,7 +162,7 @@ CERT *ssl_cert_dup(CERT *cert)
        CERT *ret;
        int i;
 
-       ret = (CERT *)Malloc(sizeof(CERT));
+       ret = (CERT *)OPENSSL_malloc(sizeof(CERT));
        if (ret == NULL)
                {
                SSLerr(SSL_F_SSL_CERT_DUP, ERR_R_MALLOC_FAILURE);
@@ -331,7 +331,7 @@ void ssl_cert_free(CERT *c)
                        EVP_PKEY_free(c->pkeys[i].publickey);
 #endif
                }
-       Free(c);
+       OPENSSL_free(c);
        }
 
 int ssl_cert_inst(CERT **o)
@@ -367,7 +367,7 @@ SESS_CERT *ssl_sess_cert_new(void)
        {
        SESS_CERT *ret;
 
-       ret = Malloc(sizeof *ret);
+       ret = OPENSSL_malloc(sizeof *ret);
        if (ret == NULL)
                {
                SSLerr(SSL_F_SSL_SESS_CERT_NEW, ERR_R_MALLOC_FAILURE);
@@ -426,7 +426,7 @@ void ssl_sess_cert_free(SESS_CERT *sc)
                DH_free(sc->peer_dh_tmp);
 #endif
 
-       Free(sc);
+       OPENSSL_free(sc);
        }
 
 int ssl_set_peer_cert_type(SESS_CERT *sc,int type)
index 817b6b31f4be64510108815308dde706957889d3..ce73213b127f788f3117da9de461734a591e3895 100644 (file)
@@ -518,7 +518,7 @@ static int ssl_cipher_strength_sort(CIPHER_ORDER *list, CIPHER_ORDER **head_p,
                curr = curr->next;
                }
 
-       number_uses = Malloc((max_strength_bits + 1) * sizeof(int));
+       number_uses = OPENSSL_malloc((max_strength_bits + 1) * sizeof(int));
        if (!number_uses)
        {
                SSLerr(SSL_F_SSL_CIPHER_STRENGTH_SORT,ERR_R_MALLOC_FAILURE);
@@ -545,7 +545,7 @@ static int ssl_cipher_strength_sort(CIPHER_ORDER *list, CIPHER_ORDER **head_p,
                        ssl_cipher_apply_rule(0, 0, 0, 0, CIPHER_ORD, i,
                                        list, head_p, tail_p);
 
-       Free(number_uses);
+       OPENSSL_free(number_uses);
        return(1);
        }
 
@@ -738,7 +738,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
         * it is used for allocation.
         */
        num_of_ciphers = ssl_method->num_ciphers();
-       list = (CIPHER_ORDER *)Malloc(sizeof(CIPHER_ORDER) * num_of_ciphers);
+       list = (CIPHER_ORDER *)OPENSSL_malloc(sizeof(CIPHER_ORDER) * num_of_ciphers);
        if (list == NULL)
                {
                SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST,ERR_R_MALLOC_FAILURE);
@@ -759,10 +759,10 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
        num_of_group_aliases = sizeof(cipher_aliases) / sizeof(SSL_CIPHER);
        num_of_alias_max = num_of_ciphers + num_of_group_aliases + 1;
        ca_list =
-               (SSL_CIPHER **)Malloc(sizeof(SSL_CIPHER *) * num_of_alias_max);
+               (SSL_CIPHER **)OPENSSL_malloc(sizeof(SSL_CIPHER *) * num_of_alias_max);
        if (ca_list == NULL)
                {
-               Free(list);
+               OPENSSL_free(list);
                SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST,ERR_R_MALLOC_FAILURE);
                return(NULL);   /* Failure */
                }
@@ -788,11 +788,11 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
                ok = ssl_cipher_process_rulestr(rule_p, list, &head, &tail,
                                                ca_list);
 
-       Free(ca_list);  /* Not needed anymore */
+       OPENSSL_free(ca_list);  /* Not needed anymore */
 
        if (!ok)
                {       /* Rule processing failure */
-               Free(list);
+               OPENSSL_free(list);
                return(NULL);
                }
        /*
@@ -801,7 +801,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
         */
        if ((cipherstack = sk_SSL_CIPHER_new(NULL)) == NULL)
                {
-               Free(list);
+               OPENSSL_free(list);
                return(NULL);
                }
 
@@ -819,7 +819,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
 #endif
                        }
                }
-       Free(list);     /* Not needed any longer */
+       OPENSSL_free(list);     /* Not needed any longer */
 
        /*
         * The following passage is a little bit odd. If pointer variables
@@ -976,8 +976,8 @@ char *SSL_CIPHER_description(SSL_CIPHER *cipher, char *buf, int len)
        if (buf == NULL)
                {
                len=128;
-               buf=Malloc(len);
-               if (buf == NULL) return("Malloc Error");
+               buf=OPENSSL_malloc(len);
+               if (buf == NULL) return("OPENSSL_malloc Error");
                }
        else if (len < 128)
                return("Buffer too small");
@@ -1053,7 +1053,7 @@ int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
        SSL_COMP *comp;
        STACK_OF(SSL_COMP) *sk;
 
-       comp=(SSL_COMP *)Malloc(sizeof(SSL_COMP));
+       comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
        comp->id=id;
        comp->method=cm;
        if (ssl_comp_methods == NULL)
index f4eb35b15eeb8f2dc109777495a96fcc50b81677..ee840f09c593e9a01cdf154bf60a8e49d35afb26 100644 (file)
@@ -183,7 +183,7 @@ SSL *SSL_new(SSL_CTX *ctx)
                return(NULL);
                }
 
-       s=(SSL *)Malloc(sizeof(SSL));
+       s=(SSL *)OPENSSL_malloc(sizeof(SSL));
        if (s == NULL) goto err;
        memset(s,0,sizeof(SSL));
 
@@ -239,7 +239,7 @@ err:
                        ssl_cert_free(s->cert);
                if (s->ctx != NULL)
                        SSL_CTX_free(s->ctx); /* decrement reference count */
-               Free(s);
+               OPENSSL_free(s);
                }
        SSLerr(SSL_F_SSL_NEW,ERR_R_MALLOC_FAILURE);
        return(NULL);
@@ -375,7 +375,7 @@ void SSL_free(SSL *s)
 
        if (s->method != NULL) s->method->ssl_free(s);
 
-       Free(s);
+       OPENSSL_free(s);
        }
 
 void SSL_set_bio(SSL *s,BIO *rbio,BIO *wbio)
@@ -1100,7 +1100,7 @@ SSL_CTX *SSL_CTX_new(SSL_METHOD *meth)
                SSLerr(SSL_F_SSL_CTX_NEW,SSL_R_X509_VERIFICATION_SETUP_PROBLEMS);
                goto err;
                }
-       ret=(SSL_CTX *)Malloc(sizeof(SSL_CTX));
+       ret=(SSL_CTX *)OPENSSL_malloc(sizeof(SSL_CTX));
        if (ret == NULL)
                goto err;
 
@@ -1196,7 +1196,7 @@ err2:
        }
 
 static void SSL_COMP_free(SSL_COMP *comp)
-    { Free(comp); }
+    { OPENSSL_free(comp); }
 
 void SSL_CTX_free(SSL_CTX *a)
        {
@@ -1237,7 +1237,7 @@ void SSL_CTX_free(SSL_CTX *a)
                sk_X509_pop_free(a->extra_certs,X509_free);
        if (a->comp_methods != NULL)
                sk_SSL_COMP_pop_free(a->comp_methods,SSL_COMP_free);
-       Free(a);
+       OPENSSL_free(a);
        }
 
 void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb)
@@ -1760,13 +1760,13 @@ void ssl_clear_cipher_ctx(SSL *s)
        if (s->enc_read_ctx != NULL)
                {
                EVP_CIPHER_CTX_cleanup(s->enc_read_ctx);
-               Free(s->enc_read_ctx);
+               OPENSSL_free(s->enc_read_ctx);
                s->enc_read_ctx=NULL;
                }
        if (s->enc_write_ctx != NULL)
                {
                EVP_CIPHER_CTX_cleanup(s->enc_write_ctx);
-               Free(s->enc_write_ctx);
+               OPENSSL_free(s->enc_write_ctx);
                s->enc_write_ctx=NULL;
                }
        if (s->expand != NULL)
index 9e01f7275321326ac7e2e7e637beb88d901bec7b..416def8908e82ce213d6dbad5fc93ad1050d4769 100644 (file)
@@ -111,7 +111,7 @@ SSL_SESSION *SSL_SESSION_new(void)
        {
        SSL_SESSION *ss;
 
-       ss=(SSL_SESSION *)Malloc(sizeof(SSL_SESSION));
+       ss=(SSL_SESSION *)OPENSSL_malloc(sizeof(SSL_SESSION));
        if (ss == NULL)
                {
                SSLerr(SSL_F_SSL_SESSION_NEW,ERR_R_MALLOC_FAILURE);
@@ -310,7 +310,7 @@ int ssl_get_prev_session(SSL *s, unsigned char *session_id, int len)
 #if 0 /* This is way too late. */
 
        /* If a thread got the session, then 'swaped', and another got
-        * it and then due to a time-out decided to 'Free' it we could
+        * it and then due to a time-out decided to 'OPENSSL_free' it we could
         * be in trouble.  So I'll increment it now, then double decrement
         * later - am I speaking rubbish?. */
        CRYPTO_add(&ret->references,1,CRYPTO_LOCK_SSL_SESSION);
@@ -474,7 +474,7 @@ void SSL_SESSION_free(SSL_SESSION *ss)
        if (ss->peer != NULL) X509_free(ss->peer);
        if (ss->ciphers != NULL) sk_SSL_CIPHER_free(ss->ciphers);
        memset(ss,0,sizeof(*ss));
-       Free(ss);
+       OPENSSL_free(ss);
        }
 
 int SSL_set_session(SSL *s, SSL_SESSION *session)
index caf5876e5a2f3f1c58d92e21898e45af888459f5..2ef8a50785b77775f84e074349dc76e36b4e9940 100644 (file)
@@ -1193,7 +1193,7 @@ int doit(SSL *s_ssl, SSL *c_ssl, long count)
        ret=0;
 err:
        /* We have to set the BIO's to NULL otherwise they will be
-        * Free()ed twice.  Once when th s_ssl is SSL_free()ed and
+        * OPENSSL_free()ed twice.  Once when th s_ssl is SSL_free()ed and
         * again when c_ssl is SSL_free()ed.
         * This is a hack required because s_ssl and c_ssl are sharing the same
         * BIO structure and SSL_set_bio() and SSL_free() automatically
index 279e45db5dd59f50889a1255451169c9272897ad..0d34357eb474e58238c3c499aa61c4f3e6962527 100644 (file)
@@ -178,7 +178,7 @@ int tls1_change_cipher_state(SSL *s, int which)
                {
                if ((s->enc_read_ctx == NULL) &&
                        ((s->enc_read_ctx=(EVP_CIPHER_CTX *)
-                       Malloc(sizeof(EVP_CIPHER_CTX))) == NULL))
+                       OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL))
                        goto err;
                dd= s->enc_read_ctx;
                s->read_hash=m;
@@ -197,7 +197,7 @@ int tls1_change_cipher_state(SSL *s, int which)
                                }
                        if (s->s3->rrec.comp == NULL)
                                s->s3->rrec.comp=(unsigned char *)
-                                       Malloc(SSL3_RT_MAX_ENCRYPTED_LENGTH);
+                                       OPENSSL_malloc(SSL3_RT_MAX_ENCRYPTED_LENGTH);
                        if (s->s3->rrec.comp == NULL)
                                goto err;
                        }
@@ -208,7 +208,7 @@ int tls1_change_cipher_state(SSL *s, int which)
                {
                if ((s->enc_write_ctx == NULL) &&
                        ((s->enc_write_ctx=(EVP_CIPHER_CTX *)
-                       Malloc(sizeof(EVP_CIPHER_CTX))) == NULL))
+                       OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL))
                        goto err;
                dd= s->enc_write_ctx;
                s->write_hash=m;
@@ -355,9 +355,9 @@ int tls1_setup_key_block(SSL *s)
 
        ssl3_cleanup_key_block(s);
 
-       if ((p1=(unsigned char *)Malloc(num)) == NULL)
+       if ((p1=(unsigned char *)OPENSSL_malloc(num)) == NULL)
                goto err;
-       if ((p2=(unsigned char *)Malloc(num)) == NULL)
+       if ((p2=(unsigned char *)OPENSSL_malloc(num)) == NULL)
                goto err;
 
        s->s3->tmp.key_block_length=num;
@@ -374,7 +374,7 @@ printf("pre-master\n");
 #endif
        tls1_generate_key_block(s,p1,p2,num);
        memset(p2,0,num);
-       Free(p2);
+       OPENSSL_free(p2);
 #ifdef TLS_DEBUG
 printf("\nkey block\n");
 { int z; for (z=0; z<num; z++) printf("%02X%c",p1[z],((z+1)%16)?' ':'\n'); }