Merge in code from main trunk to BRANCH_engine.

This commit is contained in:
Richard Levitte 2000-06-08 11:00:37 +00:00
parent 5decfb7002
commit d44c7dcf00
280 changed files with 2808 additions and 2009 deletions

74
CHANGES
View file

@ -4,11 +4,66 @@
Changes between 0.9.5a and 0.9.6 [xx XXX 2000]
*) Remove lots of duplicated code from the EVP library. For example *every*
*) New function BN_mod_exp_mont_word for small bases (roughly 20%
faster than BN_mod_exp_mont even though it does not use
windowing).
[Bodo Moeller]
*) CygWin32 support.
[John Jarvie <jjarvie@newsguy.com>]
*) The type-safe stack code has been rejigged. It is now only compiled
in when OpenSSL is configured with the DEBUG_SAFESTACK option and
by default all type-specific stack functions are "#define"d back to
standard stack functions. This results in more streamlined output
but retains the type-safety checking possibilities of the original
approach.
[Geoff Thorpe]
*) The STACK code has been cleaned up, and certain type declarations
that didn't make a lot of sense have been brought in line. This has
also involved a cleanup of sorts in safestack.h to more correctly
map type-safe stack functions onto their plain stack counterparts.
This work has also resulted in a variety of "const"ifications of
lots of the code, especially "_cmp" operations which should normally
be prototyped with "const" parameters anyway.
[Geoff Thorpe]
*) When generating bytes for the first time in md_rand.c, 'stir the pool'
by seeding with STATE_SIZE dummy bytes (with zero entropy count).
(The PRNG state consists of two parts, the large pool 'state' and 'md',
where all of 'md' is used each time the PRNG is used, but 'state'
is used only indexed by a cyclic counter. As entropy may not be
well distributed from the beginning, 'md' is important as a
chaining variable. However, the output function chains only half
of 'md', i.e. 80 bits. ssleay_rand_add, on the other hand, chains
all of 'md', and seeding with STATE_SIZE dummy bytes will result
in all of 'state' being rewritten, with the new values depending
on virtually all of 'md'. This overcomes the 80 bit limitation.)
[Bodo Moeller]
*) In ssl/s2_clnt.c and ssl/s3_clnt.c, call ERR_clear_error() when
the handshake is continued after ssl_verify_cert_chain();
otherwise, if SSL_VERIFY_NONE is set, remaining error codes
can lead to 'unexplainable' connection aborts later.
[Bodo Moeller; problem tracked down by Lutz Jaenicke]
*) Major EVP API cipher revision.
Add hooks for extra EVP features. This allows various cipher
parameters to be set in the EVP interface. Support added for variable
key length ciphers via the EVP_CIPHER_CTX_set_key_length() function and
setting of RC2 and RC5 parameters.
Modify EVP_OpenInit() and EVP_SealInit() to cope with variable key length
ciphers.
Remove lots of duplicated code from the EVP library. For example *every*
cipher init() function handles the 'iv' in the same way according to the
cipher mode. They also all do nothing if the 'key' parameter is NULL and
for CFB and OFB modes they zero ctx->num.
New functionality allows removal of S/MIME code RC2 hack.
Most of the routines have the same form and so can be declared in terms
of macros.
@ -16,23 +71,6 @@
all individual ciphers. If the cipher wants to handle IVs or keys
differently it can set the EVP_CIPH_CUSTOM_IV or EVP_CIPH_ALWAYS_CALL_INIT
flags.
[Steve Henson]
*) In ssl/s2_clnt.c and ssl/s3_clnt.c, call ERR_clear_error() when
the handshake is continued after ssl_verify_cert_chain();
otherwise, if SSL_VERIFY_NONE is set, remaining error codes
can lead to 'unexplainable' connection aborts later.
[Bodo Moeller; problem tracked down by Lutz Jaenicke]
*) EVP cipher enhancement. Add hooks for extra EVP features. This will allow
various cipher parameters to be set in the EVP interface. Initially
support added for variable key length ciphers via the
EVP_CIPHER_CTX_set_key_length() function. Other cipher specific
parameters will be added later via the new catchall 'ctrl' function.
New functionality allows removal of S/MIME code RC2 hack.
Still needs support in other library functions, and allow parameter
setting for algorithms like RC2, RC5.
Change lots of functions like EVP_EncryptUpdate() to now return a
value: although software versions of the algorithms cannot fail

View file

@ -38,7 +38,10 @@ my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-
# 386 generate 80386 code
# no-<cipher> build without specified algorithm (rsa, idea, rc5, ...)
# -<xxx> +<xxx> compiler options are passed through
#
#
# DEBUG_SAFESTACK use type-safe stacks to enforce type-safety on stack items
# provided to stack calls. Generates unique stack functions for
# each possible stack type.
# DES_PTR use pointer lookup vs arrays in the DES in crypto/des/des_locl.h
# DES_RISC1 use different DES_ENCRYPT macro that helps reduce register
# dependancies but needs to more registers, good for RISC CPU's
@ -104,8 +107,8 @@ my %table=(
# Our development configs
"purify", "purify gcc:-g -DPURIFY -Wall::(unknown):-lsocket -lnsl::::",
"debug", "gcc:-DBN_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror::(unknown):-lefence::::",
"debug-ben", "gcc:-DBN_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown):::::",
"debug-ben-debug", "gcc:-DBN_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown):::::",
"debug-ben", "gcc:-DBN_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown):::::",
"debug-ben-debug", "gcc:-DBN_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown):::::",
"debug-ben-strict", "gcc:-DBN_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe::(unknown):::::",
"debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
"debug-bodo", "gcc:-DBIO_PAIR_DEBUG -DL_ENDIAN -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -g -m486 -pedantic -Wshadow -Wall::-D_REENTRANT::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
@ -165,7 +168,7 @@ my %table=(
# Sunos configs, assuming sparc for the gcc one.
##"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown)::DES_UNROLL:::",
"sunos-gcc","gcc:-O3 -mv8 -Dssize_t=int::(unknown)::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:::",
"sunos-gcc","gcc:-O3 -mv8 -Dssize_t=int::(unknown):-liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:::",
#### IRIX 5.x configs
# -mips2 flag is added by ./config when appropriate.
@ -175,11 +178,11 @@ my %table=(
# Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke
# './Configure irix-[g]cc' manually.
# -mips4 flag is added by ./config when appropriate.
"irix-mips3-gcc","gcc:-mabi=n32 -mmips-as -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::(unknown)::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT:asm/mips3.o::",
"irix-mips3-cc", "cc:-n32 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN -DBN_DIV3W::(unknown)::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT:asm/mips3.o::",
"irix-mips3-gcc","gcc:-mabi=n32 -mmips-as -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT:asm/mips3.o::",
"irix-mips3-cc", "cc:-n32 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT:asm/mips3.o::",
# N64 ABI builds.
"irix64-mips4-gcc","gcc:-mabi=64 -mips4 -mmips-as -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::(unknown)::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:asm/mips3.o::",
"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN -DBN_DIV3W::(unknown)::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:asm/mips3.o::",
"irix64-mips4-gcc","gcc:-mabi=64 -mips4 -mmips-as -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:asm/mips3.o::",
"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:asm/mips3.o::",
#### Unified HP-UX ANSI C configs.
# Special notes:
@ -265,10 +268,10 @@ my %table=(
#
# <appro@fy.chalmers.se>
#
"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:asm/alpha.o::",
"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:asm/alpha.o::",
"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:asm/alpha.o::",
"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:asm/alpha.o::",
"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:asm/alpha.o::",
"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:asm/alpha.o::",
"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:asm/alpha.o::",
"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:asm/alpha.o::",
# assembler versions -- currently defunct:
##"OpenBSD-alpha","gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown):SIXTY_FOUR_BIT_LONG DES_INT DES_PTR DES_RISC2:asm/alpha.o::",
@ -296,7 +299,7 @@ my %table=(
"ncr-scde","cc:-O6 -Xa -Hoff=BEHAVED -686 -Hwide -Hiw::(unknown):-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:::",
# Linux on ARM
"linux-elf-arm","gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::BN_LLONG::dlfcn",
"linux-elf-arm","gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::BN_LLONG::::::::::dlfcn",
# UnixWare 2.0
"unixware-2.0","cc:-O -DFILIO_H::(unknown):-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:::",
@ -364,12 +367,14 @@ my %table=(
"BC-32","bcc32:::::BN_LLONG DES_PTR RC4_INDEX:::",
"BC-16","bcc:::(unknown)::BN_LLONG DES_PTR RC4_INDEX SIXTEEN_BIT:::",
# CygWin32
# Mingw32
# (Note: the real CFLAGS for Windows builds are defined by util/mk1mf.pl
# and its library files in util/pl/*)
"CygWin32", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:",
"Mingw32", "gcc:-DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:",
# CygWin32
"CygWin32", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:",
# Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
"ultrix-cc","cc:-std1 -O -Olimit 1000 -DL_ENDIAN::(unknown)::::::",
"ultrix-gcc","gcc:-O3 -DL_ENDIAN::(unknown)::::::",
@ -388,7 +393,7 @@ my %table=(
);
my @WinTargets=qw(VC-NT VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS BC-32
BC-16 CygWin32 Mingw32);
BC-16 Mingw32);
my $prefix="";
my $openssldir="";
@ -435,6 +440,7 @@ my $openssl_other_defines="";
my $libs="";
my $target="";
my $options="";
my $symlink=1;
foreach (@ARGV)
{
s /^-no-/no-/; # some people just can't read the instructions
@ -450,6 +456,8 @@ foreach (@ARGV)
{ $no_threads=1; }
elsif (/^threads$/)
{ $threads=1; }
elsif (/^no-symlinks$/)
{ $symlink=0; }
elsif (/^no-(.+)$/)
{
my $algo=$1;
@ -902,7 +910,8 @@ if($IsWindows) {
EOF
close(OUT);
} else {
(system "make -f Makefile.ssl PERL=\'$perl\' links") == 0 or exit $?;
(system "make -f Makefile.ssl PERL=\'$perl\' links") == 0 or exit $?
if $symlink;
### (system 'make depend') == 0 or exit $? if $depflags ne "";
# Run "make depend" manually if you want to be able to delete
# the source code files of ciphers you left out.

18
FAQ
View file

@ -21,6 +21,8 @@ OpenSSL - Frequently Asked Questions
* Why can't I make an SSL connection using a DSA certificate?
* How can I remove the passphrase on a private key?
* Why can't the OpenSSH configure script detect OpenSSL?
* Why does the OpenSSL test fail with "bc: command not found"?
* Why does the OpenSSL test fail with "bc: 1 no implemented"?
* Which is the current version of OpenSSL?
@ -305,3 +307,19 @@ applied to the OpenSSH distribution:
fi
LIBS="$LIBS -lcrypto"
----- snip:end -----
* Why does the OpenSSL test fail with "bc: command not found"?
You didn't install "bc", the Unix calculator. If you want to run the
tests, get GNU bc from ftp://ftp.gnu.org or from your OS distributor.
* Why does the OpenSSL test fail with "bc: 1 no implemented"?
On some SCO installations or versions, bc has a bug that gets triggered when
you run the test suite (using "make test"). The message returned is "bc:
1 not implemented". The best way to deal with this is to find another
implementation of bc and compile/install it. For example, GNU bc (see
http://www.gnu.org/software/software.html for download instructions) can
be safely used.

View file

@ -134,6 +134,52 @@
> cd out
> ..\ms\test
GNU C (CygWin32)
---------------
CygWin32 provides a bash shell and GNU tools environment running on
NT 4.0, Windows 9x and Windows 2000. Consequently, a make of OpenSSL
with CygWin is closer to a GNU bash environment such as Linux rather
than other W32 makes that are based on a single makefile approach.
CygWin32 implements Posix/Unix calls through cygwin1.dll, and is
contrasted to Mingw32 which links dynamically to msvcrt.dll or
crtdll.dll.
To build OpenSSL using CygWin32:
* Install CygWin32 (see http://sourceware.cygnus.com/cygwin)
* Install Perl and ensure it is in the path
* Run the CygWin bash shell
* $ tar zxvf openssl-x.x.x.tar.gz
$ cd openssl-x.x.x
$ ./Configure no-threads CygWin32
[...]
$ make
[...]
$ make test
$ make install
This will create a default install in /usr/local/ssl.
CygWin32 Notes:
"make test" and normal file operations may fail in directories
mounted as text (i.e. mount -t c:\somewhere /home) due to CygWin
stripping of carriage returns. To avoid this ensure that a binary
mount is used, e.g. mount -b c:\somewhere /home.
As of version 1.1.1 CygWin32 is relatively unstable in its handling
of cr/lf issues. These make procedures succeeded with versions 1.1 and
the snapshot 20000524 (Slow!).
"bc" is not provided in the CygWin32 distribution. This causes a
non-fatal error in "make test" but is otherwise harmless. If
desired, GNU bc can be built with CygWin32 without change.
Troubleshooting
---------------

View file

@ -299,6 +299,9 @@ tags:
errors:
perl util/mkerr.pl -recurse -write
stacks:
perl util/mkstack.pl -recurse
util/libeay.num::
perl util/mkdef.pl crypto update
@ -312,7 +315,7 @@ TABLE: Configure
(echo 'Output of `Configure TABLE'"':"; \
perl Configure TABLE) > TABLE
update: depend errors util/libeay.num util/ssleay.num crypto/objects/obj_dat.h TABLE
update: depend errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h TABLE
tar:
@$(TAR) $(TARFLAGS) -cvf - \

18
TABLE
View file

@ -1404,6 +1404,24 @@ $rmd160_obj = asm/rm86-elf.o
$rc5_obj = asm/r586-elf.o
$dso_scheme = dlfcn
*** linux-elf-arm
$cc = gcc
$cflags = -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall
$unistd =
$thread_cflag = -D_REENTRANT
$lflags =
$bn_ops = BN_LLONG
$bn_obj =
$des_obj =
$bf_obj =
$md5_obj =
$sha1_obj =
$cast_obj =
$rc4_obj =
$rmd160_obj =
$rc5_obj =
$dso_scheme = dlfcn
*** linux-ia64
$cc = gcc
$cflags = -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall

View file

@ -135,7 +135,7 @@ $(DLIBCRYPTO):
$(PROGRAM): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
$(RM) $(PROGRAM)
$(CC) -o $(PROGRAM) $(CFLAGS) $(PROGRAM).o $(E_OBJ) $(PEX_LIBS) $(LIBSSL) $(LIBCRYPTO) $(EX_LIBS)
@(cd ..; OPENSSL="`pwd`/apps/openssl"; export OPENSSL; $(PERL) tools/c_rehash certs)
-(cd ..; OPENSSL="`pwd`/apps/openssl"; export OPENSSL; $(PERL) tools/c_rehash certs)
progs.h: progs.pl
$(PERL) progs.pl $(E_EXE) >progs.h

View 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);
}

View 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)

View file

@ -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);
}

View 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);

View 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);

View file

@ -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);
}

View file

@ -285,7 +285,7 @@ bad:
DSA *dsa;
BIO_printf(bio_err,"Generating DSA parameters, %d bit long prime\n",num);
dsa = DSA_generate_parameters(num, NULL, 0, NULL, NULL, dh_cb, bio_err);
dsa = DSA_generate_parameters(num, NULL, 0, NULL, NULL, dh_cb, bio_err);
if (dsa == NULL)
{
ERR_print_errors(bio_err);
@ -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);
}

View 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

View 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);

View 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);
}

View 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

View 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);

View 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();

View 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;
}

View 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:

View 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);
}

View 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);

View 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 */

View file

@ -205,8 +205,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;
@ -551,7 +551,7 @@ re_start:
tv.tv_usec = 0;
i=select(width,(void *)&readfds,(void *)&writefds,
NULL,&tv);
if(!i && (!_kbhit() || !read_tty) ) continue;
if(!i && (!((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0))) || !read_tty) ) continue;
} else i=select(width,(void *)&readfds,(void *)&writefds,
NULL,NULL);
}
@ -717,7 +717,7 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
}
#ifdef WINDOWS
else if (_kbhit())
else if ((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0)))
#else
else if (FD_ISSET(fileno(stdin),&readfds))
#endif
@ -781,8 +781,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);

View file

@ -289,7 +289,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';
@ -303,7 +303,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;
@ -340,8 +340,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';
@ -794,7 +794,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;
@ -1056,7 +1056,7 @@ err:
if (buf != NULL)
{
memset(buf,0,bufsize);
Free(buf);
OPENSSL_free(buf);
}
if (ret >= 0)
BIO_printf(bio_s_out,"ACCEPT\n");
@ -1173,7 +1173,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());
@ -1502,7 +1502,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);

View 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);

View 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);
}

View file

@ -364,7 +364,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;
@ -372,7 +372,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;
@ -1196,8 +1196,8 @@ int MAIN(int argc, char **argv)
mret=0;
end:
ERR_print_errors(bio_err);
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)

View 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);
}

View 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);

1
config
View file

@ -428,6 +428,7 @@ case "$GUESSOS" in
sun4d) OUT="linux-sparcv8" ;;
*) OUT="linux-sparcv7" ;;
esac ;;
arm*-*-linux2) OUT="linux-elf-arm" ;;
*-*-linux2) OUT="linux-elf" ;;
*-*-linux1) OUT="linux-aout" ;;
sun4u*-sun-solaris2)

View 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;

View 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);
}

View 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);
}

View 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);
}

View 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:

View 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;
}

View 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);
}

View 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);
}

View 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:

View 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;
@ -258,8 +258,8 @@ static int traverse_string(const unsigned char *p, int len, int inform,
value |= *p++;
len -= 2;
} else if(inform == MBSTRING_UNIV) {
value = *p++ << 24;
value |= *p++ << 16;
value = ((unsigned long)*p++) << 24;
value |= ((unsigned long)*p++) << 16;
value |= *p++ << 8;
value |= *p++;
len -= 4;

View 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,

View 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);
}

View 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);
}

View file

@ -65,7 +65,8 @@
static STACK_OF(ASN1_STRING_TABLE) *stable = NULL;
static void st_free(ASN1_STRING_TABLE *tbl);
static int sk_table_cmp(ASN1_STRING_TABLE **a, ASN1_STRING_TABLE **b);
static int sk_table_cmp(const ASN1_STRING_TABLE * const *a,
const ASN1_STRING_TABLE * const *b);
static int table_cmp(ASN1_STRING_TABLE *a, ASN1_STRING_TABLE *b);
@ -173,7 +174,8 @@ static ASN1_STRING_TABLE tbl_standard[] = {
{NID_dnQualifier, -1, -1, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK}
};
static int sk_table_cmp(ASN1_STRING_TABLE **a, ASN1_STRING_TABLE **b)
static int sk_table_cmp(const ASN1_STRING_TABLE * const *a,
const ASN1_STRING_TABLE * const *b)
{
return (*a)->nid - (*b)->nid;
}
@ -213,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);
@ -241,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)

View 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)

View 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;
}
@ -291,5 +291,12 @@ time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s)
}
#undef g2
return mktime(&tm)-offset*60;
return mktime(&tm)-offset*60; /* FIXME: mktime assumes the current timezone
* instead of UTC, and unless we rewrite OpenSSL
* in Lisp we cannot locally change the timezone
* without possibly interfering with other parts
* of the program. timegm, which uses UTC, is
* non-standard.
* Also time_t is inappropriate for general
* UTC times because it may a 32 bit type. */
}

View file

@ -133,7 +133,7 @@ int UTF8_getc(const unsigned char *str, int len, unsigned long *val)
if( ((p[1] & 0xc0) != 0x80)
|| ((p[2] & 0xc0) != 0x80)
|| ((p[3] & 0xc0) != 0x80) ) return -3;
value = (*p++ & 0x7) << 18;
value = ((unsigned long)(*p++ & 0x7)) << 18;
value |= (*p++ & 0x3f) << 12;
value |= (*p++ & 0x3f) << 6;
value |= *p++ & 0x3f;
@ -145,9 +145,9 @@ int UTF8_getc(const unsigned char *str, int len, unsigned long *val)
|| ((p[2] & 0xc0) != 0x80)
|| ((p[3] & 0xc0) != 0x80)
|| ((p[4] & 0xc0) != 0x80) ) return -3;
value = (*p++ & 0x3) << 24;
value |= (*p++ & 0x3f) << 18;
value |= (*p++ & 0x3f) << 12;
value = ((unsigned long)(*p++ & 0x3)) << 24;
value |= ((unsigned long)(*p++ & 0x3f)) << 18;
value |= ((unsigned long)(*p++ & 0x3f)) << 12;
value |= (*p++ & 0x3f) << 6;
value |= *p++ & 0x3f;
if(value < 0x200000) return -4;
@ -159,10 +159,10 @@ int UTF8_getc(const unsigned char *str, int len, unsigned long *val)
|| ((p[3] & 0xc0) != 0x80)
|| ((p[4] & 0xc0) != 0x80)
|| ((p[5] & 0xc0) != 0x80) ) return -3;
value = (*p++ & 0x1) << 30;
value |= (*p++ & 0x3f) << 24;
value |= (*p++ & 0x3f) << 18;
value |= (*p++ & 0x3f) << 12;
value = ((unsigned long)(*p++ & 0x1)) << 30;
value |= ((unsigned long)(*p++ & 0x3f)) << 24;
value |= ((unsigned long)(*p++ & 0x3f)) << 18;
value |= ((unsigned long)(*p++ & 0x3f)) << 12;
value |= (*p++ & 0x3f) << 6;
value |= *p++ & 0x3f;
if(value < 0x4000000) return -4;

View 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)

View file

@ -245,6 +245,37 @@ typedef struct asn1_string_table_st {
} ASN1_STRING_TABLE;
DECLARE_STACK_OF(ASN1_STRING_TABLE)
/* This block of defines is updated by a perl script, please do not touch! */
#ifndef DEBUG_SAFESTACK
#define sk_ASN1_STRING_TABLE_new(a) sk_new((int (*) \
(const char * const *, const char * const *))(a))
#define sk_ASN1_STRING_TABLE_new_null() sk_new_null()
#define sk_ASN1_STRING_TABLE_free(a) sk_free(a)
#define sk_ASN1_STRING_TABLE_num(a) sk_num(a)
#define sk_ASN1_STRING_TABLE_value(a,b) ((ASN1_STRING_TABLE *) \
sk_value((a),(b)))
#define sk_ASN1_STRING_TABLE_set(a,b,c) ((ASN1_STRING_TABLE *) \
sk_set((a),(b),(char *)(c)))
#define sk_ASN1_STRING_TABLE_zero(a) sk_zero(a)
#define sk_ASN1_STRING_TABLE_push(a,b) sk_push((a),(char *)(b))
#define sk_ASN1_STRING_TABLE_unshift(a,b) sk_unshift((a),(b))
#define sk_ASN1_STRING_TABLE_find(a,b) sk_find((a), (char *)(b))
#define sk_ASN1_STRING_TABLE_delete(a,b) ((ASN1_STRING_TABLE *) \
sk_delete((a),(b)))
#define sk_ASN1_STRING_TABLE_delete_ptr(a,b) ((ASN1_STRING_TABLE *) \
sk_delete_ptr((a),(char *)(b)))
#define sk_ASN1_STRING_TABLE_insert(a,b,c) sk_insert((a),(char *)(b),(c))
#define sk_ASN1_STRING_TABLE_set_cmp_func(a,b) ((int (*) \
(const ASN1_STRING_TABLE * const *,const ASN1_STRING_TABLE * const *)) \
sk_set_cmp_func((a),(int (*) \
(const char * const *, const char * const *))(b)))
#define sk_ASN1_STRING_TABLE_dup(a) sk_dup(a)
#define sk_ASN1_STRING_TABLE_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b))
#define sk_ASN1_STRING_TABLE_shift(a) ((ASN1_STRING_TABLE *)sk_shift(a))
#define sk_ASN1_STRING_TABLE_pop(a) ((ASN1_STRING_TABLE *)sk_pop(a))
#define sk_ASN1_STRING_TABLE_sort(a) sk_sort(a)
#endif /* !DEBUG_SAFESTACK */
/* End of perl script block, you may now edit :-) */
/* size limits: this stuff is taken straight from RFC2459 */
@ -294,6 +325,37 @@ typedef struct asn1_string_st ASN1_UTF8STRING;
typedef int ASN1_NULL;
DECLARE_STACK_OF(ASN1_INTEGER)
/* This block of defines is updated by a perl script, please do not touch! */
#ifndef DEBUG_SAFESTACK
#define sk_ASN1_INTEGER_new(a) sk_new((int (*) \
(const char * const *, const char * const *))(a))
#define sk_ASN1_INTEGER_new_null() sk_new_null()
#define sk_ASN1_INTEGER_free(a) sk_free(a)
#define sk_ASN1_INTEGER_num(a) sk_num(a)
#define sk_ASN1_INTEGER_value(a,b) ((ASN1_INTEGER *) \
sk_value((a),(b)))
#define sk_ASN1_INTEGER_set(a,b,c) ((ASN1_INTEGER *) \
sk_set((a),(b),(char *)(c)))
#define sk_ASN1_INTEGER_zero(a) sk_zero(a)
#define sk_ASN1_INTEGER_push(a,b) sk_push((a),(char *)(b))
#define sk_ASN1_INTEGER_unshift(a,b) sk_unshift((a),(b))
#define sk_ASN1_INTEGER_find(a,b) sk_find((a), (char *)(b))
#define sk_ASN1_INTEGER_delete(a,b) ((ASN1_INTEGER *) \
sk_delete((a),(b)))
#define sk_ASN1_INTEGER_delete_ptr(a,b) ((ASN1_INTEGER *) \
sk_delete_ptr((a),(char *)(b)))
#define sk_ASN1_INTEGER_insert(a,b,c) sk_insert((a),(char *)(b),(c))
#define sk_ASN1_INTEGER_set_cmp_func(a,b) ((int (*) \
(const ASN1_INTEGER * const *,const ASN1_INTEGER * const *)) \
sk_set_cmp_func((a),(int (*) \
(const char * const *, const char * const *))(b)))
#define sk_ASN1_INTEGER_dup(a) sk_dup(a)
#define sk_ASN1_INTEGER_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b))
#define sk_ASN1_INTEGER_shift(a) ((ASN1_INTEGER *)sk_shift(a))
#define sk_ASN1_INTEGER_pop(a) ((ASN1_INTEGER *)sk_pop(a))
#define sk_ASN1_INTEGER_sort(a) sk_sort(a)
#endif /* !DEBUG_SAFESTACK */
/* End of perl script block, you may now edit :-) */
DECLARE_ASN1_SET_OF(ASN1_INTEGER)
typedef struct asn1_type_st
@ -325,6 +387,37 @@ typedef struct asn1_type_st
} ASN1_TYPE;
DECLARE_STACK_OF(ASN1_TYPE)
/* This block of defines is updated by a perl script, please do not touch! */
#ifndef DEBUG_SAFESTACK
#define sk_ASN1_TYPE_new(a) sk_new((int (*) \
(const char * const *, const char * const *))(a))
#define sk_ASN1_TYPE_new_null() sk_new_null()
#define sk_ASN1_TYPE_free(a) sk_free(a)
#define sk_ASN1_TYPE_num(a) sk_num(a)
#define sk_ASN1_TYPE_value(a,b) ((ASN1_TYPE *) \
sk_value((a),(b)))
#define sk_ASN1_TYPE_set(a,b,c) ((ASN1_TYPE *) \
sk_set((a),(b),(char *)(c)))
#define sk_ASN1_TYPE_zero(a) sk_zero(a)
#define sk_ASN1_TYPE_push(a,b) sk_push((a),(char *)(b))
#define sk_ASN1_TYPE_unshift(a,b) sk_unshift((a),(b))
#define sk_ASN1_TYPE_find(a,b) sk_find((a), (char *)(b))
#define sk_ASN1_TYPE_delete(a,b) ((ASN1_TYPE *) \
sk_delete((a),(b)))
#define sk_ASN1_TYPE_delete_ptr(a,b) ((ASN1_TYPE *) \
sk_delete_ptr((a),(char *)(b)))
#define sk_ASN1_TYPE_insert(a,b,c) sk_insert((a),(char *)(b),(c))
#define sk_ASN1_TYPE_set_cmp_func(a,b) ((int (*) \
(const ASN1_TYPE * const *,const ASN1_TYPE * const *)) \
sk_set_cmp_func((a),(int (*) \
(const char * const *, const char * const *))(b)))
#define sk_ASN1_TYPE_dup(a) sk_dup(a)
#define sk_ASN1_TYPE_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b))
#define sk_ASN1_TYPE_shift(a) ((ASN1_TYPE *)sk_shift(a))
#define sk_ASN1_TYPE_pop(a) ((ASN1_TYPE *)sk_pop(a))
#define sk_ASN1_TYPE_sort(a) sk_sort(a)
#endif /* !DEBUG_SAFESTACK */
/* End of perl script block, you may now edit :-) */
DECLARE_ASN1_SET_OF(ASN1_TYPE)
typedef struct asn1_method_st
@ -546,6 +639,37 @@ ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp,
long length);
DECLARE_STACK_OF(ASN1_OBJECT)
/* This block of defines is updated by a perl script, please do not touch! */
#ifndef DEBUG_SAFESTACK
#define sk_ASN1_OBJECT_new(a) sk_new((int (*) \
(const char * const *, const char * const *))(a))
#define sk_ASN1_OBJECT_new_null() sk_new_null()
#define sk_ASN1_OBJECT_free(a) sk_free(a)
#define sk_ASN1_OBJECT_num(a) sk_num(a)
#define sk_ASN1_OBJECT_value(a,b) ((ASN1_OBJECT *) \
sk_value((a),(b)))
#define sk_ASN1_OBJECT_set(a,b,c) ((ASN1_OBJECT *) \
sk_set((a),(b),(char *)(c)))
#define sk_ASN1_OBJECT_zero(a) sk_zero(a)
#define sk_ASN1_OBJECT_push(a,b) sk_push((a),(char *)(b))
#define sk_ASN1_OBJECT_unshift(a,b) sk_unshift((a),(b))
#define sk_ASN1_OBJECT_find(a,b) sk_find((a), (char *)(b))
#define sk_ASN1_OBJECT_delete(a,b) ((ASN1_OBJECT *) \
sk_delete((a),(b)))
#define sk_ASN1_OBJECT_delete_ptr(a,b) ((ASN1_OBJECT *) \
sk_delete_ptr((a),(char *)(b)))
#define sk_ASN1_OBJECT_insert(a,b,c) sk_insert((a),(char *)(b),(c))
#define sk_ASN1_OBJECT_set_cmp_func(a,b) ((int (*) \
(const ASN1_OBJECT * const *,const ASN1_OBJECT * const *)) \
sk_set_cmp_func((a),(int (*) \
(const char * const *, const char * const *))(b)))
#define sk_ASN1_OBJECT_dup(a) sk_dup(a)
#define sk_ASN1_OBJECT_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b))
#define sk_ASN1_OBJECT_shift(a) ((ASN1_OBJECT *)sk_shift(a))
#define sk_ASN1_OBJECT_pop(a) ((ASN1_OBJECT *)sk_pop(a))
#define sk_ASN1_OBJECT_sort(a) sk_sort(a)
#endif /* !DEBUG_SAFESTACK */
/* End of perl script block, you may now edit :-) */
DECLARE_ASN1_SET_OF(ASN1_OBJECT)
ASN1_STRING * ASN1_STRING_new(void);

View 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)

View 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) \

View 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;
}

View 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;

View 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;

View 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;

View 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]);

View 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;

View 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);
}

View 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);
}

View 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);
}

View 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);

View 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 */

View 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);
}

View 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;
}

View 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;

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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)
{

View 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)

View 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);
}

View 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);
}

View 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)

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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)

View 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);
}

View 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);
}

View file

@ -61,8 +61,10 @@
#include <openssl/asn1_mac.h>
#include <openssl/x509.h>
static int X509_REVOKED_cmp(X509_REVOKED **a,X509_REVOKED **b);
static int X509_REVOKED_seq_cmp(X509_REVOKED **a,X509_REVOKED **b);
static int X509_REVOKED_cmp(const X509_REVOKED * const *a,
const X509_REVOKED * const *b);
static int X509_REVOKED_seq_cmp(const X509_REVOKED * const *a,
const X509_REVOKED * const *b);
int i2d_X509_REVOKED(X509_REVOKED *a, unsigned char **pp)
{
M_ASN1_I2D_vars(a);
@ -100,7 +102,8 @@ int i2d_X509_CRL_INFO(X509_CRL_INFO *a, unsigned char **pp)
{
int v1=0;
long l=0;
int (*old_cmp)(X509_REVOKED **,X509_REVOKED **);
int (*old_cmp)(const X509_REVOKED * const *,
const X509_REVOKED * const *);
M_ASN1_I2D_vars(a);
old_cmp=sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_seq_cmp);
@ -283,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)
@ -297,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)
@ -322,17 +325,19 @@ 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(X509_REVOKED **a, X509_REVOKED **b)
static int X509_REVOKED_cmp(const X509_REVOKED * const *a,
const X509_REVOKED * const *b)
{
return(ASN1_STRING_cmp(
(ASN1_STRING *)(*a)->serialNumber,
(ASN1_STRING *)(*b)->serialNumber));
}
static int X509_REVOKED_seq_cmp(X509_REVOKED **a, X509_REVOKED **b)
static int X509_REVOKED_seq_cmp(const X509_REVOKED * const *a,
const X509_REVOKED * const *b)
{
return((*a)->sequence-(*b)->sequence);
}

View 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);
}

View 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)

View file

@ -217,7 +217,7 @@ X509_NAME *X509_NAME_new(void)
ASN1_CTX c;
M_ASN1_New_Malloc(ret,X509_NAME);
if ((ret->entries=sk_X509_NAME_ENTRY_new(NULL)) == NULL)
if ((ret->entries=sk_X509_NAME_ENTRY_new_null()) == NULL)
{ c.line=__LINE__; goto err2; }
M_ASN1_New(ret->bytes,BUF_MEM_new);
ret->modified=1;
@ -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)

View 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);
}

View 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);

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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,

View 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)

View file

@ -442,7 +442,8 @@ static int test(void)
{
BF_set_key(&key,n,key_test);
BF_ecb_encrypt(key_data,out,&key,BF_ENCRYPT);
if (memcmp(out,&(key_out[n-1][0]),8) != 0)
/* mips-sgi-irix6.5-gcc vv -mabi=64 bug workaround */
if (memcmp(out,&(key_out[i=n-1][0]),8) != 0)
{
printf("blowfish setkey error\n");
err=1;

View 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

View 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;

Some files were not shown because too many files have changed in this diff Show more