Initial import of OpenSSL 0.9.5a

This commit is contained in:
Kris Kennaway 2000-04-13 06:33:22 +00:00
parent 97b2ed56f8
commit f579bf8ec7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor-crypto/openssl/dist/; revision=59191
713 changed files with 56351 additions and 9694 deletions

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,7 @@ use strict;
# see INSTALL for instructions.
my $usage="Usage: Configure [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [rsaref] [no-threads] [no-asm] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] os/compiler[:flags]\n";
my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [rsaref] [no-threads] [no-asm] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] os/compiler[:flags]\n";
# Options:
#
@ -51,6 +51,10 @@ my $usage="Usage: Configure [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [rsaref] [no
# RC4_LONG use 'long' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
# RC4_INDEX define RC4_INDEX in crypto/rc4/rc4_locl.h. This turns on
# array lookups instead of pointer use.
# RC4_CHUNK enables code that handles data aligned at long (natural CPU
# word) boundary.
# RC4_CHUNK_LL enables code that handles data aligned at long long boundary
# (intended for 64-bit CPUs running 32-bit OS).
# BF_PTR use 'pointer arithmatic' for Blowfish (unsafe on Alpha).
# BF_PTR2 intel specific version (generic version is more efficient).
# MD5_ASM use some extra md5 assember,
@ -82,90 +86,135 @@ my $x86_bsdi_asm="asm/bn86bsdi.o asm/co86bsdi.o:asm/dx86bsdi.o asm/yx86bsdi.o:as
# -DB_ENDIAN slows things down on a sparc for md5, but helps sha1.
# So the md5_locl.h file has an undef B_ENDIAN if sun is defined
#config-string CC : CFLAGS : LDFLAGS : special header file mods:bn_asm \
# des_asm:bf_asm
#config-string $cc : $cflags : $unistd : $thread_cflag : $lflags : $bn_ops : $bn_obj : $des_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj
my %table=(
#"b", "$tcc:$tflags::$tlib:$bits1:$tbn_mul::",
#"bl-4c-2c", "$tcc:$tflags::$tlib:${bits1}BN_LLONG RC4_CHAR MD2_CHAR:$tbn_mul::",
#"bl-4c-ri", "$tcc:$tflags::$tlib:${bits1}BN_LLONG RC4_CHAR RC4_INDEX:$tbn_mul::",
#"b2-is-ri-dp", "$tcc:$tflags::$tlib:${bits2}IDEA_SHORT RC4_INDEX DES_PTR:$tbn_mul::",
#"b", "${tcc}:${tflags}::${tlib}:${bits1}:${tbn_mul}::",
#"bl-4c-2c", "${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR MD2_CHAR:${tbn_mul}::",
#"bl-4c-ri", "${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR RC4_INDEX:${tbn_mul}::",
#"b2-is-ri-dp", "${tcc}:${tflags}::${tlib}:${bits2}IDEA_SHORT RC4_INDEX DES_PTR:${tbn_mul}::",
# Our development configs
"purify", "purify gcc:-g -DPURIFY -Wall::(unknown):-lsocket -lnsl::::",
"debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCRYPTO_MDEBUG -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror::(unknown):-lefence::::",
"debug-ben", "gcc:-DBN_DEBUG -DREF_CHECK -DCRYPTO_MDEBUG -DPEDANTIC -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown):::::",
"debug-ben-debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCRYPTO_MDEBUG -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown):::::",
"debug-ben-strict", "gcc:-DBN_DEBUG -DREF_CHECK -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 -DCRYPTO_MDEBUG_ALL -g -m486 -Wall::-D_REENTRANT::BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_elf_asm",
"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-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}",
"debug-ulf", "gcc:-DL_ENDIAN -DREF_CHECK -DBN_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -g -O2 -m486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT::${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
"debug-steve", "gcc:-DL_ENDIAN -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -O2 -m486 -pedantic -Wall -Werror -Wshadow -pipe::-D_REENTRANT::${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
"debug-levitte-linux-elf","gcc:-DUSE_ALLOCATING_PRINT -DRL_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DNO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -ggdb -g3 -m486 -pedantic -ansi -Wall -Wshadow -Wid-clash-31 -pipe::-D_REENTRANT:::",
"dist", "cc:-O::(unknown):::::",
# Basic configs that should work on any box
# Basic configs that should work on any (32 and less bit) box
"gcc", "gcc:-O3::(unknown)::BN_LLONG:::",
"cc", "cc:-O::(unknown):::::",
#### Solaris x86 setups
"solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -m486 -Wall -DL_ENDIAN::-D_REENTRANT:-lsocket -lnsl:BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_sol_asm",
# -DNO_INLINE_ASM switches off inline assembler. We have to do it
# here because whenever GNU C instantiates an assembler template it
# surrounds it with #APP #NO_APP comment pair which (at least Solaris
# 7_x86) /usr/ccs/bin/as fails to assemble with "Illegal mnemonic"
# error message.
"solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -m486 -Wall -DL_ENDIAN -DNO_INLINE_ASM::-D_REENTRANT:-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_sol_asm}",
#### SPARC Solaris with GNU C setups
"solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR DES_UNROLL BF_PTR:::",
"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR DES_UNROLL BF_PTR:asm/sparcv8.o::",
"solaris-sparcv9-gcc","gcc:-mcpu=ultrasparc -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W -DULTRASPARC::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o:",
"solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o::",
"solaris-sparcv9-gcc","gcc:-mcpu=ultrasparc -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W -DULTRASPARC::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o:",
# gcc pre-2.8 doesn't understand -mcpu=ultrasparc, so fall down to -mv8
# but keep the assembler modules.
"solaris-sparcv9-gcc27","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W -DULTRASPARC::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR DES_UNROLL BF_PTR:asm/sparcv8plus-gcc27.o:::asm/md5-sparcv8plus-gcc27.o:",
"solaris-sparcv9-gcc27","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W -DULTRASPARC::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus-gcc27.o:::asm/md5-sparcv8plus-gcc27.o:",
####
"debug-solaris-sparcv8-gcc","gcc:-DREF_CHECK -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR DES_UNROLL BF_PTR:::",
"debug-solaris-sparcv9-gcc","gcc:-DREF_CHECK -DCRYPTO_MDEBUG_ALL -O -g -mcpu=ultrasparc -Wall -DB_ENDIAN::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR DES_UNROLL BF_PTR:asm/sparcv8plus.o::",
"debug-solaris-sparcv8-gcc","gcc:-DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o::",
"debug-solaris-sparcv9-gcc","gcc:-DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mcpu=ultrasparc -Wall -DB_ENDIAN::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o::",
#### SPARC Solaris with Sun C setups
# DO NOT use /xO[34] on sparc with SC3.0. It is broken, and will not pass the tests
"solaris-sparc-sc3","cc:-fast -O -Xa -DB_ENDIAN::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR DES_PTR DES_UNROLL BF_PTR:::",
"solaris-sparc-sc3","cc:-fast -O -Xa -DB_ENDIAN::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR:::",
# SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2.
# SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8
# SC5.0 note: Compiler common patch 107357-01 or later is required!
"solaris-sparcv7-cc","cc:-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR DES_PTR DES_RISC1 DES_UNROLL BF_PTR:::",
"solaris-sparcv8-cc","cc:-xarch=v8 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8.o::",
"solaris-sparcv9-cc","cc:-xtarget=ultra -xarch=v8plus -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W -DULTRASPARC::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o:",
"solaris64-sparcv9-cc","cc:-xtarget=ultra -xarch=v9 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DULTRASPARC::-D_REENTRANT:-lsocket -lnsl:SIXTY_FOUR_BIT_LONG RC4_CHAR DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::asm/md5-sparcv9.o:",
"solaris-sparcv7-cc","cc:-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:::",
"solaris-sparcv8-cc","cc:-xarch=v8 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8.o::",
"solaris-sparcv9-cc","cc:-xtarget=ultra -xarch=v8plus -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W -DULTRASPARC::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o:",
"solaris64-sparcv9-cc","cc:-xtarget=ultra -xarch=v9 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DULTRASPARC::-D_REENTRANT:-lsocket -lnsl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::asm/md5-sparcv9.o:",
####
"debug-solaris-sparcv8-cc","cc:-DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xarch=v8 -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8.o::",
"debug-solaris-sparcv9-cc","cc:-DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xtarget=ultra -xarch=v8plus -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W -DULTRASPARC::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o:",
#### SPARC Linux setups
"linux-sparcv7","gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::BN_LLONG RC4_CHAR DES_UNROLL BF_PTR::",
"linux-sparcv7","gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::",
# Ray Miller <ray.miller@computing-services.oxford.ac.uk> has patiently
# assisted with debugging of following two configs.
"linux-sparcv8","gcc:-mv8 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::BN_LLONG RC4_CHAR DES_UNROLL BF_PTR:asm/sparcv8.o::::",
"linux-sparcv8","gcc:-mv8 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o::::",
# it's a real mess with -mcpu=ultrasparc option under Linux, but
# -Wa,-Av8plus should do the trick no matter what.
"linux-sparcv9","gcc:-mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DULTRASPARC -DBN_DIV2W::-D_REENTRANT::BN_LLONG RC4_CHAR DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o:",
"linux-sparcv9","gcc:-mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DULTRASPARC -DBN_DIV2W::-D_REENTRANT::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o:",
# !!!Folowing can't be even tested yet!!!
# We have to wait till 64-bit glibc for SPARC is operational!!!
#"linux64-sparcv9","sparc64-linux-gcc:-m64 -mcpu=v9 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DULTRASPARC -DBN_DIV2W::-D_REENTRANT::BN_LLONG RC4_CHAR DES_UNROLL BF_PTR::::asm/md5-sparcv9.o:",
#"linux64-sparcv9","sparc64-linux-gcc:-m64 -mcpu=v9 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DULTRASPARC -DBN_DIV2W::-D_REENTRANT::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::asm/md5-sparcv9.o:",
# Sunos configs, assuming sparc for the gcc one.
##"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown)::DES_UNROLL:::",
"sunos-gcc","gcc:-O3 -mv8::(unknown)::BN_LLONG RC4_CHAR DES_UNROLL DES_PTR DES_RISC1:::",
"sunos-gcc","gcc:-O3 -mv8 -Dssize_t=int::(unknown)::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:::",
#### IRIX 5.x configs
# -mips2 flag is added by ./config when appropriate.
"irix-gcc","gcc:-O3 -DTERMIOS -DB_ENDIAN::(unknown)::BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC2 DES_PTR BF_PTR:::",
"irix-cc", "cc:-O2 -use_readonly_const -DTERMIOS -DB_ENDIAN::(unknown)::BN_LLONG DES_PTR DES_RISC2 DES_UNROLL BF_PTR:::",
"irix-gcc","gcc:-O3 -DTERMIOS -DB_ENDIAN::(unknown)::BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK DES_UNROLL DES_RISC2 DES_PTR BF_PTR:::",
"irix-cc", "cc:-O2 -use_readonly_const -DTERMIOS -DB_ENDIAN::(unknown)::BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC2 DES_UNROLL BF_PTR:::",
#### IRIX 6.x configs
# 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::(unknown)::MD2_CHAR RC4_INDEX RC4_CHAR 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::(unknown)::DES_PTR 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::(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::",
# N64 ABI builds.
"irix64-mips4-gcc","gcc:-mabi=64 -mips4 -mmips-as -O3 -DTERMIOS -DB_ENDIAN::(unknown)::DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:asm/mips3.o::",
"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN::(unknown)::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::(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::",
#### Unified HP-UX ANSI C configs.
# Special notes:
# - Originally we were optimizing at +O4 level. It should be noted
# that the only difference between +O3 and +O4 is global inter-
# procedural analysis. As it has to be performed during the link
# stage the compiler leaves behind certain pseudo-code in lib*.a
# which might be release or even patch level specific. Generating
# the machine code for and analyzing the *whole* program appears
# to be *extremely* memory demanding while the performance gain is
# actually questionable. The situation is intensified by the default
# HP-UX data set size limit (infamous 'maxdsiz' tunable) of 64MB
# which is way too low for +O4. In other words, doesn't +O3 make
# more sense?
# - Keep in mind that the HP compiler by default generates code
# suitable for execution on the host you're currently compiling at.
# If the toolkit is ment to be used on various PA-RISC processors
# consider './config +Dportable'.
# - +DD64 is chosen in favour of +DA2.0W because it's ment to be
# compatible with *future* releases.
# - If you run ./Configure hpux-parisc-[g]cc manually don't forget to
# pass -D_REENTRANT on HP-UX 10 and later.
# - -DMD32_XARRAY triggers workaround for compiler bug we ran into in
# 32-bit message digests. (For the moment of this writing) HP C
# doesn't seem to "digest" too many local variables (they make "him"
# chew forever:-). For more details look-up MD32_XARRAY comment in
# crypto/sha/sha_lcl.h.
# <appro@fy.chalmers.se>
#
"hpux-parisc-cc","cc:-Ae +O3 +ESlit -z -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::::BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
# Since there is mention of this in shlib/hpux10-cc.sh
"hpux-parisc-cc-o4","cc:-Ae +O4 +ESlit -z -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::::BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
"hpux-parisc-gcc","gcc:-O3 -DB_ENDIAN -DBN_DIV2W::::BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
"hpux64-parisc-cc","cc:-Ae +DD64 +O3 +ESlit -z -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:::",
# HPUX 9.X config.
# Don't use the bundled cc. It is broken. Use HP ANSI C if possible, or
# egcs. gcc 2.8.1 is also broken.
"hpux-cc", "cc:-DB_ENDIAN -DBN_DIV2W -Ae +ESlit +O4 -z::(unknown)::BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
"hpux-cc", "cc:-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY -Ae +ESlit +O3 -z::(unknown)::BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
# If hpux-cc fails (e.g. during "make test"), try the next one; otherwise,
# please report your OS and compiler version to the bugs@openssl.org
# please report your OS and compiler version to the openssl-bugs@openssl.org
# mailing list.
"hpux-brokencc", "cc:-DB_ENDIAN -DBN_DIV2W -Ae +ESlit +O2 -z::(unknown)::DES_PTR DES_UNROLL DES_RISC1:::",
@ -174,7 +223,7 @@ my %table=(
"hpux-brokengcc", "gcc:-DB_ENDIAN -DBN_DIV2W -O3::(unknown)::DES_PTR DES_UNROLL DES_RISC1:::",
# HPUX 10.X config. Supports threads.
"hpux10-cc", "cc:-DB_ENDIAN -DBN_DIV2W -Ae +ESlit +O4 -z::-D_REENTRANT::BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
"hpux10-cc", "cc:-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY -Ae +ESlit +O3 -z::-D_REENTRANT::BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
# If hpux10-cc fails, try this one (if still fails, try deleting BN_LLONG):
"hpux10-brokencc", "cc:-DB_ENDIAN -DBN_DIV2W -Ae +ESlit +O2 -z::-D_REENTRANT::BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
@ -184,46 +233,66 @@ my %table=(
# HPUX 11.X from www.globus.org.
# Only works on PA-RISC 2.0 cpus, and not optimized. Why?
"hpux11-32bit-cc","cc:+DA2.0 -DB_ENDIAN -D_HPUX_SOURCE -Aa -Ae +ESlit::-D_REENTRANT::DES_PTR DES_UNROLL DES_RISC1:::",
"hpux11-64bit-cc","cc:+DA2.0W -g -D_HPUX_SOURCE -Aa -Ae +ESlit::-D_REENTRANT::SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT :::",
#"hpux11-32bit-cc","cc:+DA2.0 -DB_ENDIAN -D_HPUX_SOURCE -Aa -Ae +ESlit::-D_REENTRANT::DES_PTR DES_UNROLL DES_RISC1:::",
#"hpux11-64bit-cc","cc:+DA2.0W -g -D_HPUX_SOURCE -Aa -Ae +ESlit::-D_REENTRANT::SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT :::",
# Use unified settings above instead.
# Dec Alpha, OSF/1 - the alpha164-cc is the flags for a 21164A with
# the new compiler
# For gcc, the following gave a %50 speedup on a 164 over the 'DES_INT' version
"alpha-gcc","gcc:-O3::(unknown)::SIXTY_FOUR_BIT_LONG DES_UNROLL DES_RISC1:::",
"alpha-cc", "cc:-std1 -tune host -O4 -readonly_strings::(unknown)::SIXTY_FOUR_BIT_LONG:::",
"alpha164-cc", "cc:-std1 -tune host -fast -readonly_strings::(unknown)::SIXTY_FOUR_BIT_LONG:::",
"FreeBSD-alpha","gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown)::SIXTY_FOUR_BIT_LONG DES_INT DES_PTR DES_RISC2:::",
"alpha-gcc","gcc:-O3::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_RISC1:asm/alpha.o::",
"alpha-cc", "cc:-std1 -tune host -O4 -readonly_strings::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK:asm/alpha.o::",
"alpha164-cc", "cc:-std1 -tune host -fast -readonly_strings::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK:asm/alpha.o::",
"FreeBSD-alpha","gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC2:::",
#### Alpha Linux with GNU C and Compaq C setups
# Special notes:
# - linux-alpha+bwx-gcc is ment to be used from ./config only. If you
# ought to run './Configure linux-alpha+bwx-gcc' manually, do
# complement the command line with -mcpu=ev56, -mcpu=ev6 or whatever
# which is appropriate.
# - If you use ccc keep in mind that -fast implies -arch host and the
# compiler is free to issue instructions which gonna make elder CPU
# choke. If you wish to build "blended" toolkit, add -arch generic
# *after* -fast and invoke './Configure linux-alpha-ccc' manually.
#
# <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::",
# assembler versions -- currently defunct:
##"alpha-gcc","gcc:-O3::(unknown)::SIXTY_FOUR_BIT_LONG DES_UNROLL DES_RISC1:asm/alpha.o::",
##"alpha-cc", "cc:-tune host -O4 -readonly_strings::(unknown)::SIXTY_FOUR_BIT_LONG:asm/alpha.o::",
##"alpha164-cc", "cc:-tune host -fast -readonly_strings::(unknown)::SIXTY_FOUR_BIT_LONG:asm/alpha.o::",
##"OpenBSD-alpha","gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown):SIXTY_FOUR_BIT_LONG DES_INT DES_PTR DES_RISC2:asm/alpha.o::",
# The intel boxes :-), It would be worth seeing if bsdi-gcc can use the
# bn86-elf.o file file since it is hand tweaked assembler.
"linux-elf", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::-D_REENTRANT::BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_elf_asm",
"debug-linux-elf","gcc:-DREF_CHECK -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall::-D_REENTRANT:-lefence:BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_elf_asm",
"linux-aout", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::(unknown)::BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_out_asm",
"linux-elf", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::-D_REENTRANT::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
"debug-linux-elf","gcc:-DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall::-D_REENTRANT:-lefence:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
"linux-aout", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}",
"linux-mips", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::(unknown)::BN_LLONG:::",
"linux-ppc", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::(unknown)::::",
"linux-ppc", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::BN_LLONG::",
"linux-ia64", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::(unknown)::SIXTY_FOUR_BIT_LONG::",
"NetBSD-sparc", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -mv8 -Wall -DB_ENDIAN::(unknown)::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL:::",
"NetBSD-m68", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall -DB_ENDIAN::(unknown)::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL:::",
"NetBSD-x86", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall::(unknown)::BN_LLONG $x86_gcc_des $x86_gcc_opts:",
"FreeBSD-elf", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown)::BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_elf_asm",
"FreeBSD", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown)::BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_out_asm",
"bsdi-gcc", "gcc:-O3 -ffast-math -DL_ENDIAN -DPERL5 -m486::(unknown)::RSA_LLONG $x86_gcc_des $x86_gcc_opts:$x86_bsdi_asm",
"bsdi-elf-gcc", "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown)::BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_elf_asm",
"nextstep", "cc:-O -Wall:<libc.h>:(unknown)::BN_LLONG $x86_gcc_des ${x86_gcc_opts}:::",
"nextstep3.3", "cc:-O3 -Wall:<libc.h>:(unknown)::BN_LLONG $x86_gcc_des ${x86_gcc_opts}:::",
"NetBSD-x86", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall::(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:",
"FreeBSD-elf", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
"FreeBSD", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}",
"bsdi-gcc", "gcc:-O3 -ffast-math -DL_ENDIAN -DPERL5 -m486::(unknown)::RSA_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_bsdi_asm}",
"bsdi-elf-gcc", "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
"nextstep", "cc:-O -Wall:<libc.h>:(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
"nextstep3.3", "cc:-O3 -Wall:<libc.h>:(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
# NCR MP-RAS UNIX ver 02.03.01
"ncr-scde","cc:-O6 -Xa -Hoff=BEHAVED -686 -Hwide -Hiw::(unknown):-lsocket -lnsl:$x86_gcc_des ${x86_gcc_opts}:::",
"ncr-scde","cc:-O6 -Xa -Hoff=BEHAVED -686 -Hwide -Hiw::(unknown):-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:::",
# UnixWare 2.0
"unixware-2.0","cc:-O -DFILIO_H::(unknown):-lsocket -lnsl:$x86_gcc_des ${x86_gcc_opts}:::",
"unixware-2.0","cc:-O -DFILIO_H::(unknown):-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:::",
"unixware-2.0-pentium","cc:-O -DFILIO_H -Kpentium -Kthread::(unknown):-lsocket -lnsl:MD2_CHAR RC4_INDEX ${x86_gcc_des}::",
# UnixWare 7
"unixware-7","cc:-O -DFILIO_H -Kalloca::-Kthread:-lsocket -lnsl:MD2_CHAR RC4_INDEX ${x86_gcc_des}::",
# IBM's AIX.
"aix-cc", "cc:-O -DAIX -DB_ENDIAN::(unknown)::BN_LLONG RC4_CHAR:::",
"aix-gcc", "gcc:-O3 -DAIX -DB_ENDIAN::(unknown)::BN_LLONG RC4_CHAR:::",
@ -249,17 +318,17 @@ my %table=(
# for some st_addr stuff, and then sizeof and address-of fails
# I could not use the ams/alpha.o option because the Cray assembler, 'cam'
# did not like it.
"cray-t3e", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown)::SIXTY_FOUR_BIT_LONG DES_INT:::",
"cray-t3e", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT:::",
# DGUX, 88100.
"dgux-R3-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown)::RC4_INDEX DES_UNROLL:::",
"dgux-R4-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown):-lnsl -lsocket:RC4_INDEX:RC4_INDEX DES_UNROLL:::",
"dgux-R4-x86-gcc", "gcc:-O3 -fomit-frame-pointer -DL_ENDIAN::(unknown):-lnsl -lsocket:BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_elf_asm",
"dgux-R4-x86-gcc", "gcc:-O3 -fomit-frame-pointer -DL_ENDIAN::(unknown):-lnsl -lsocket:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
# SCO 5 - Ben Laurie <ben@algroup.co.uk> says the -O breaks the
# SCO cc.
"sco5-cc", "cc:::(unknown):-lsocket:$x86_gcc_des ${x86_gcc_opts}:::", # des options?
"sco5-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown):-lsocket:BN_LLONG $x86_gcc_des ${x86_gcc_opts}:::", # the SCO assembler doesn't seem to like our assembler files ...
"sco5-cc", "cc:::(unknown):-lsocket:${x86_gcc_des} ${x86_gcc_opts}:::", # des options?
"sco5-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown):-lsocket:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::", # the SCO assembler doesn't seem to like our assembler files ...
# Sinix/ReliantUNIX RM400
# NOTE: The CDS++ Compiler up to V2.0Bsomething has the IRIX_CC_BUG optimizer problem. Better use -g */
@ -268,7 +337,7 @@ my %table=(
"SINIX-N","/usr/ucb/cc:-O2 -misaligned::(unknown):-lucb:RC4_INDEX RC4_CHAR:::",
# SIEMENS BS2000/OSD: an EBCDIC-based mainframe
"BS2000-OSD","c89:-XLLML -XLLMK -XL -DB_ENDIAN -DTERMIOS -DCHARSET_EBCDIC::(unknown):-lsocket -lnsl:THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
"BS2000-OSD","c89:-O -XLLML -XLLMK -XL -DB_ENDIAN -DTERMIOS -DCHARSET_EBCDIC::(unknown):-lsocket -lnsl:THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
# Windows NT, Microsoft Visual C++ 4.0
@ -286,8 +355,8 @@ my %table=(
# CygWin32
# (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", "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}:",
# Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
"ultrix-cc","cc:-std1 -O -Olimit 1000 -DL_ENDIAN::(unknown)::::::",
@ -297,10 +366,13 @@ my %table=(
# Some OpenBSD from Bob Beck <beck@obtuse.com>
"OpenBSD-alpha","gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown)::SIXTY_FOUR_BIT_LONG DES_INT DES_PTR DES_RISC2:::",
"OpenBSD-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -m486::(unknown)::BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_out_asm",
"OpenBSD-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -m486::(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}",
"OpenBSD", "gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown)::BN_LLONG RC2_CHAR RC4_INDEX DES_UNROLL:::",
"OpenBSD-mips","gcc:-O2 -DL_ENDIAN::(unknown):BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC2 DES_PTR BF_PTR::::",
##### MacOS X (a.k.a. Rhapsody) setup
"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown)::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
);
my @WinTargets=qw(VC-NT VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS BC-32
@ -337,21 +409,27 @@ my $ranlib;
my $perl;
$ranlib=&which("ranlib") or $ranlib="true";
$perl=&which("perl5") or $perl=&which("perl") or $perl="perl";
$perl=$ENV{'PERL'} or $perl=&which("perl5") or $perl=&which("perl")
or $perl="perl";
&usage if ($#ARGV < 0);
my $flags="";
my $depflags="";
my $openssl_algorithm_defines="";
my $openssl_thread_defines="";
my $openssl_other_defines="";
my $libs="";
my $target="";
my $options="";
foreach (@ARGV)
{
s /^-no-/no-/; # some people just can't read the instructions
if (/^no-asm$/)
{
$no_asm=1;
$flags .= "-DNO_ASM ";
$openssl_other_defines .= "#define NO_ASM\n";
}
elsif (/^no-threads$/)
{ $no_threads=1; }
@ -364,11 +442,14 @@ foreach (@ARGV)
$algo =~ tr/[a-z]/[A-Z]/;
$flags .= "-DNO_$algo ";
$depflags .= "-DNO_$algo ";
$openssl_algorithm_defines .= "#define NO_$algo\n";
if ($algo eq "DES")
{
push @skip, "mdc2";
$options .= " no-mdc2";
$flags .= "-DNO_MDC2 ";
$depflags .= "-DNO_MDC2 ";
$openssl_algorithm_defines .= "#define NO_MDC2\n";
}
}
elsif (/^386$/)
@ -377,6 +458,7 @@ foreach (@ARGV)
{
$libs.= "-lRSAglue -lrsaref ";
$flags.= "-DRSAref ";
$openssl_other_defines .= "#define RSAref\n";
}
elsif (/^[-+]/)
{
@ -432,6 +514,14 @@ if ($target eq "TABLE") {
exit 0;
}
if ($target eq "LIST") {
foreach (sort keys %table) {
print;
print "\n";
}
exit 0;
}
&usage if (!defined($table{$target}));
my $IsWindows=scalar grep /^$target$/,@WinTargets;
@ -454,6 +544,7 @@ print "IsWindows=$IsWindows\n";
$cflags="$flags$cflags" if ($flags ne "");
my $thread_cflags;
my $thread_defines;
if ($thread_cflag ne "(unknown)" && !$no_threads)
{
# If we know how to do it, support threads by default.
@ -463,11 +554,21 @@ if ($thread_cflag eq "(unknown)")
{
# If the user asked for "threads", hopefully they also provided
# any system-dependent compiler options that are necessary.
$thread_cflags="-DTHREADS $cflags"
$thread_cflags="-DTHREADS $cflags" ;
$thread_defines .= "#define THREADS\n";
}
else
{
$thread_cflags="-DTHREADS $thread_cflag $cflags"
$thread_cflags="-DTHREADS $thread_cflag $cflags";
$thread_defines .= "#define THREADS\n";
# my $def;
# foreach $def (split ' ',$thread_cflag)
# {
# if ($def =~ s/^-D// && $def !~ /^_/)
# {
# $thread_defines .= "#define $def\n";
# }
# }
}
$lflags="$libs$lflags"if ($libs ne "");
@ -481,6 +582,7 @@ if ($no_asm)
if ($threads)
{
$cflags=$thread_cflags;
$openssl_thread_defines .= $thread_defines;
}
#my ($bn1)=split(/\s+/,$bn_obj);
@ -530,6 +632,7 @@ if ($version =~ /(^[0-9]*)\.([0-9\.]*)/)
open(IN,'<Makefile.org') || die "unable to read Makefile.org:$!\n";
open(OUT,">$Makefile") || die "unable to create $Makefile:$!\n";
print OUT "### Generated automatically from Makefile.org by Configure.\n\n";
my $sdirs=0;
while (<IN>)
{
@ -598,6 +701,7 @@ my $md2_int=$def_int;
my $idea_int=$def_int;
my $rc2_int=$def_int;
my $rc4_idx=0;
my $rc4_chunk=0;
my $bf_ptr=0;
my @type=("char","short","int","long");
my ($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0);
@ -615,6 +719,8 @@ foreach (sort split(/\s+/,$bn_ops))
$rc4_int=0 if /RC4_CHAR/;
$rc4_int=3 if /RC4_LONG/;
$rc4_idx=1 if /RC4_INDEX/;
$rc4_chunk=1 if /RC4_CHUNK/;
$rc4_chunk=2 if /RC4_CHUNK_LL/;
$md2_int=0 if /MD2_CHAR/;
$md2_int=3 if /MD2_LONG/;
$idea_int=1 if /IDEA_SHORT/;
@ -632,6 +738,18 @@ foreach (sort split(/\s+/,$bn_ops))
open(IN,'<crypto/opensslconf.h.in') || die "unable to read crypto/opensslconf.h.in:$!\n";
open(OUT,'>crypto/opensslconf.h') || die "unable to create crypto/opensslconf.h:$!\n";
print OUT "/* opensslconf.h */\n";
print OUT "/* WARNING: Generated automatically from opensslconf.h.in by Configure. */\n\n";
print OUT "/* OpenSSL was configured with the following options: */\n";
$openssl_algorithm_defines =~ s/^\s*#\s*define\s+(.*)/# ifndef $1\n# define $1\n# endif/mg;
$openssl_algorithm_defines = " /* no ciphers excluded */\n" if $openssl_algorithm_defines eq "";
$openssl_thread_defines =~ s/^\s*#\s*define\s+(.*)/# ifndef $1\n# define $1\n# endif/mg;
$openssl_other_defines =~ s/^\s*#\s*define\s+(.*)/# ifndef $1\n# define $1\n# endif/mg;
print OUT "#ifdef OPENSSL_ALGORITHM_DEFINES\n$openssl_algorithm_defines#endif\n";
print OUT "#ifdef OPENSSL_THREAD_DEFINES\n$openssl_thread_defines#endif\n";
print OUT "#ifdef OPENSSL_OTHER_DEFINES\n$openssl_other_defines#endif\n\n";
while (<IN>)
{
if (/^#define\s+OPENSSLDIR/)
@ -666,6 +784,12 @@ while (<IN>)
{ printf OUT "#%s DES_UNROLL\n",($des_unroll)?'define':'undef'; }
elsif (/^#define\s+RC4_INT\s/)
{ printf OUT "#define RC4_INT unsigned %s\n",$type[$rc4_int]; }
elsif (/^#undef\s+RC4_CHUNK/)
{
printf OUT "#undef RC4_CHUNK\n" if $rc4_chunk==0;
printf OUT "#define RC4_CHUNK unsigned long\n" if $rc4_chunk==1;
printf OUT "#define RC4_CHUNK unsigned long long\n" if $rc4_chunk==2;
}
elsif (/^#((define)|(undef))\s+RC4_INDEX/)
{ printf OUT "#%s RC4_INDEX\n",($rc4_idx)?"define":"undef"; }
elsif (/^#(define|undef)\s+I386_ONLY/)
@ -705,6 +829,9 @@ print "DES_INT used\n" if $des_int;
print "BN_LLONG mode\n" if $bn_ll;
print "RC4 uses u$type[$rc4_int]\n" if $rc4_int != $def_int;
print "RC4_INDEX mode\n" if $rc4_idx;
print "RC4_CHUNK is undefined\n" if $rc4_chunk==0;
print "RC4_CHUNK is unsigned long\n" if $rc4_chunk==1;
print "RC4_CHUNK is unsigned long long\n" if $rc4_chunk==2;
print "MD2 uses u$type[$md2_int]\n" if $md2_int != $def_int;
print "IDEA uses u$type[$idea_int]\n" if $idea_int != $def_int;
print "RC2 uses u$type[$rc2_int]\n" if $rc2_int != $def_int;
@ -723,8 +850,6 @@ if($IsWindows) {
#endif
EOF
close(OUT);
system "perl crypto/objects/obj_dat.pl <crypto\\objects\\objects.h >crypto\\objects\\obj_dat.h";
} else {
(system "make -f Makefile.ssl PERL=\'$perl\' links") == 0 or exit $?;
### (system 'make depend') == 0 or exit $? if $depflags ne "";
@ -733,43 +858,17 @@ EOF
&dofile("tools/c_rehash",$openssldir,'^DIR=', 'DIR=%s',);
if ( $perl =~ m@^/@) {
&dofile("apps/der_chop",$perl,'^#!/', '#!%s');
&dofile("apps/CA.pl",$perl,'^#!/', '#!%s');
} else {
# No path for Perl known ...
&dofile("apps/der_chop",'/usr/local/bin/perl','^#!/', '#!%s');
&dofile("apps/CA.pl",'/usr/local/bin/perl','^#!/', '#!%s');
}
}
my $pwd;
if($IsWindows) {
$pwd="(current directory)";
} else {
$pwd =`pwd`;
chop($pwd);
}
print <<EOF;
NOTE: The OpenSSL header files have been moved from include/*.h
to include/openssl/*.h. To include OpenSSL header files, now
directives of the form
#include <openssl/foo.h>
should be used instead of #include <foo.h>.
These new file locations allow installing the OpenSSL header
files in /usr/local/include/openssl/ and should help avoid
conflicts with other libraries.
To compile programs that use the old form <foo.h>,
usually an additional compiler option will suffice: E.g., add
-I$prefix/include/openssl
or
-I$pwd/include/openssl
to the CFLAGS in the Makefile of the program that you want to compile
(and leave all the original -I...'s in place!).
Please make sure that no old OpenSSL header files are around:
The include directory should now be empty except for the openssl
subdirectory.
Configured for $target.
EOF
print <<\EOF if (!$no_threads && !$threads);
@ -777,7 +876,6 @@ print <<\EOF if (!$no_threads && !$threads);
The library could not be configured for supporting multi-threaded
applications as the compiler options required on this system are not known.
See file INSTALL for details if you need multi-threading.
EOF
exit(0);
@ -785,22 +883,33 @@ exit(0);
sub usage
{
print STDERR $usage;
print STDERR "pick os/compiler from:";
print STDERR "\npick os/compiler from:\n";
my $j=0;
my $i;
my $k=0;
foreach $i (sort keys %table)
{
next if $i =~ /^debug/;
print STDERR "\n" if ($j++ % 4) == 0;
printf(STDERR "%-18s ",$i);
$k += length($i) + 1;
if ($k > 78)
{
print STDERR "\n";
$k=length($i);
}
print STDERR $i . " ";
}
foreach $i (sort keys %table)
{
next if $i !~ /^debug/;
print STDERR "\n" if ($j++ % 4) == 0;
printf(STDERR "%-18s ",$i);
$k += length($i) + 1;
if ($k > 78)
{
print STDERR "\n";
$k=length($i);
}
print STDERR $i . " ";
}
print STDERR "\n";
print STDERR "\n\nNOTE: If in doubt, on Unix-ish systems use './config'.\n";
exit(1);
}
@ -830,12 +939,11 @@ sub dofile
{
grep(/$k/ && ($_=sprintf($m{$k}."\n",$p)),@a);
}
($ff=$f) =~ s/\..*$//;
open(OUT,">$ff.new") || die "unable to open $f:$!\n";
open(OUT,">$f.new") || die "unable to open $f.new:$!\n";
print OUT @a;
close(OUT);
rename($f,"$ff.bak") || die "unable to rename $f\n" if -e $f;
rename("$ff.new",$f) || die "unable to rename $ff.new\n";
rename($f,"$f.bak") || die "unable to rename $f\n" if -e $f;
rename("$f.new",$f) || die "unable to rename $f.new\n";
}
sub print_table_entry

287
crypto/openssl/FAQ Normal file
View File

@ -0,0 +1,287 @@
OpenSSL - Frequently Asked Questions
--------------------------------------
* Which is the current version of OpenSSL?
* Where is the documentation?
* How can I contact the OpenSSL developers?
* Do I need patent licenses to use OpenSSL?
* Is OpenSSL thread-safe?
* Why do I get a "PRNG not seeded" error message?
* Why does the linker complain about undefined symbols?
* Where can I get a compiled version of OpenSSL?
* I've compiled a program under Windows and it crashes: why?
* I've called <some function> and it fails, why?
* I just get a load of numbers for the error output, what do they mean?
* Why do I get errors about unknown algorithms?
* How do I create certificates or certificate requests?
* Why can't I create certificate requests?
* Why does <SSL program> fail with a certificate verify error?
* How can I create DSA certificates?
* Why can't I make an SSL connection using a DSA certificate?
* Why can't the OpenSSH configure script detect OpenSSL?
* Which is the current version of OpenSSL?
The current version is available from <URL: http://www.openssl.org>.
OpenSSL 0.9.5a was released on April 1st, 2000.
In addition to the current stable release, you can also access daily
snapshots of the OpenSSL development version at <URL:
ftp://ftp.openssl.org/snapshot/>, or get it by anonymous CVS access.
* Where is the documentation?
OpenSSL is a library that provides cryptographic functionality to
applications such as secure web servers. Be sure to read the
documentation of the application you want to use. The INSTALL file
explains how to install this library.
OpenSSL includes a command line utility that can be used to perform a
variety of cryptographic functions. It is described in the openssl(1)
manpage. Documentation for developers is currently being written. A
few manual pages already are available; overviews over libcrypto and
libssl are given in the crypto(3) and ssl(3) manpages.
The OpenSSL manpages are installed in /usr/local/ssl/man/ (or a
different directory if you specified one as described in INSTALL).
In addition, you can read the most current versions at
<URL: http://www.openssl.org/docs/>.
For information on parts of libcrypto that are not yet documented, you
might want to read Ariel Glenn's documentation on SSLeay 0.9, OpenSSL's
predecessor, at <URL: http://www.columbia.edu/~ariel/ssleay/>. Much
of this still applies to OpenSSL.
There is some documentation about certificate extensions and PKCS#12
in doc/openssl.txt
The original SSLeay documentation is included in OpenSSL as
doc/ssleay.txt. It may be useful when none of the other resources
help, but please note that it reflects the obsolete version SSLeay
0.6.6.
* How can I contact the OpenSSL developers?
The README file describes how to submit bug reports and patches to
OpenSSL. Information on the OpenSSL mailing lists is available from
<URL: http://www.openssl.org>.
* Do I need patent licenses to use OpenSSL?
The patents section of the README file lists patents that may apply to
you if you want to use OpenSSL. For information on intellectual
property rights, please consult a lawyer. The OpenSSL team does not
offer legal advice.
You can configure OpenSSL so as not to use RC5 and IDEA by using
./config no-rc5 no-idea
Until the RSA patent expires, U.S. users may want to use
./config no-rc5 no-idea no-rsa
Please note that you will *not* be able to communicate with most of
the popular web browsers without RSA support.
* Is OpenSSL thread-safe?
Yes (with limitations: an SSL connection may not concurrently be used
by multiple threads). On Windows and many Unix systems, OpenSSL
automatically uses the multi-threaded versions of the standard
libraries. If your platform is not one of these, consult the INSTALL
file.
Multi-threaded applications must provide two callback functions to
OpenSSL. This is described in the threads(3) manpage.
* Why do I get a "PRNG not seeded" error message?
Cryptographic software needs a source of unpredictable data to work
correctly. Many open source operating systems provide a "randomness
device" that serves this purpose. On other systems, applications have
to call the RAND_add() or RAND_seed() function with appropriate data
before generating keys or performing public key encryption.
Some broken applications do not do this. As of version 0.9.5, the
OpenSSL functions that need randomness report an error if the random
number generator has not been seeded with at least 128 bits of
randomness. If this error occurs, please contact the author of the
application you are using. It is likely that it never worked
correctly. OpenSSL 0.9.5 and later make the error visible by refusing
to perform potentially insecure encryption.
On systems without /dev/urandom, it is a good idea to use the Entropy
Gathering Demon; see the RAND_egd() manpage for details.
Most components of the openssl command line tool try to use the
file $HOME/.rnd (or $RANDFILE, if this environment variable is set)
for seeding the PRNG. If this file does not exist or is too short,
the "PRNG not seeded" error message may occur.
[Note to OpenSSL 0.9.5 users: The command "openssl rsa" in version
0.9.5 does not do this and will fail on systems without /dev/urandom
when trying to password-encrypt an RSA key! This is a bug in the
library; try a later version instead.]
* Why does the linker complain about undefined symbols?
Maybe the compilation was interrupted, and make doesn't notice that
something is missing. Run "make clean; make".
If you used ./Configure instead of ./config, make sure that you
selected the right target. File formats may differ slightly between
OS versions (for example sparcv8/sparcv9, or a.out/elf).
In case you get errors about the following symbols, use the config
option "no-asm", as described in INSTALL:
BF_cbc_encrypt, BF_decrypt, BF_encrypt, CAST_cbc_encrypt,
CAST_decrypt, CAST_encrypt, RC4, RC5_32_cbc_encrypt, RC5_32_decrypt,
RC5_32_encrypt, bn_add_words, bn_div_words, bn_mul_add_words,
bn_mul_comba4, bn_mul_comba8, bn_mul_words, bn_sqr_comba4,
bn_sqr_comba8, bn_sqr_words, bn_sub_words, des_decrypt3,
des_ede3_cbc_encrypt, des_encrypt, des_encrypt2, des_encrypt3,
des_ncbc_encrypt, md5_block_asm_host_order, sha1_block_asm_data_order
If none of these helps, you may want to try using the current snapshot.
If the problem persists, please submit a bug report.
* Where can I get a compiled version of OpenSSL?
Some applications that use OpenSSL are distributed in binary form.
When using such an application, you don't need to install OpenSSL
yourself; the application will include the required parts (e.g. DLLs).
If you want to install OpenSSL on a Windows system and you don't have
a C compiler, read the "Mingw32" section of INSTALL.W32 for information
on how to obtain and install the free GNU C compiler.
A number of Linux and *BSD distributions include OpenSSL.
* I've compiled a program under Windows and it crashes: why?
This is usually because you've missed the comment in INSTALL.W32. You
must link with the multithreaded DLL version of the VC++ runtime library
otherwise the conflict will cause a program to crash: typically on the
first BIO related read or write operation.
* I've called <some function> and it fails, why?
Before submitting a report or asking in one of the mailing lists you
should try to determine the cause. In particular you should call
ERR_print_errors() or ERR_print_errors_fp() after the failed call
and see if the message helps.
* I just get a load of numbers for the error output, what do they mean?
The actual format is described in the ERR_print_errors() manual page.
You should call the function ERR_load_crypto_strings() before hand and
the message will be output in text form. If you can't do this (for example
it is a pre-compiled binary) you can use the errstr utility on the error
code itself (the hex digits after the second colon).
* Why do I get errors about unknown algorithms?
This can happen under several circumstances such as reading in an
encrypted private key or attempting to decrypt a PKCS#12 file. The cause
is forgetting to load OpenSSL's table of algorithms with
OpenSSL_add_all_algorithms(). See the manual page for more information.
* How do I create certificates or certificate requests?
Check out the CA.pl(1) manual page. This provides a simple wrapper round
the 'req', 'verify', 'ca' and 'pkcs12' utilities. For finer control check
out the manual pages for the individual utilities and the certificate
extensions documentation (currently in doc/openssl.txt).
* Why can't I create certificate requests?
You typically get the error:
unable to find 'distinguished_name' in config
problems making Certificate Request
This is because it can't find the configuration file. Check out the
DIAGNOSTICS section of req(1) for more information.
* Why does <SSL program> fail with a certificate verify error?
This problem is usually indicated by log messages saying something like
"unable to get local issuer certificate" or "self signed certificate".
When a certificate is verified its root CA must be "trusted" by OpenSSL
this typically means that the CA certificate must be placed in a directory
or file and the relevant program configured to read it. The OpenSSL program
'verify' behaves in a similar way and issues similar error messages: check
the verify(1) program manual page for more information.
* How can I create DSA certificates?
Check the CA.pl(1) manual page for a DSA certificate example.
* Why can't I make an SSL connection to a server using a DSA certificate?
Typically you'll see a message saying there are no shared ciphers when
the same setup works fine with an RSA certificate. There are two possible
causes. The client may not support connections to DSA servers most web
browsers only support connections to servers supporting RSA cipher suites.
The other cause is that a set of DH parameters has not been supplied to
the server. DH parameters can be created with the dhparam(1) command and
loaded using the SSL_CTX_set_tmp_dh() for example: check the source to
s_server in apps/s_server.c for an example.
* Why can't the OpenSSH configure script detect OpenSSL?
There is a problem with OpenSSH 1.2.2p1, in that the configure script
can't find the installed OpenSSL libraries. The problem is actually
a small glitch that is easily solved with the following patch to be
applied to the OpenSSH distribution:
----- snip:start -----
--- openssh-1.2.2p1/configure.in.orig Thu Mar 23 18:56:58 2000
+++ openssh-1.2.2p1/configure.in Thu Mar 23 18:55:05 2000
@@ -152,10 +152,10 @@
AC_MSG_CHECKING([for OpenSSL/SSLeay directory])
for ssldir in "" $tryssldir /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
if test ! -z "$ssldir" ; then
- LIBS="$saved_LIBS -L$ssldir"
+ LIBS="$saved_LIBS -L$ssldir/lib"
CFLAGS="$CFLAGS -I$ssldir/include"
if test "x$need_dash_r" = "x1" ; then
- LIBS="$LIBS -R$ssldir"
+ LIBS="$LIBS -R$ssldir/lib"
fi
fi
LIBS="$LIBS -lcrypto"
--- openssh-1.2.2p1/configure.orig Thu Mar 23 18:55:02 2000
+++ openssh-1.2.2p1/configure Thu Mar 23 18:57:08 2000
@@ -1890,10 +1890,10 @@
echo "configure:1891: checking for OpenSSL/SSLeay directory" >&5
for ssldir in "" $tryssldir /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
if test ! -z "$ssldir" ; then
- LIBS="$saved_LIBS -L$ssldir"
+ LIBS="$saved_LIBS -L$ssldir/lib"
CFLAGS="$CFLAGS -I$ssldir/include"
if test "x$need_dash_r" = "x1" ; then
- LIBS="$LIBS -R$ssldir"
+ LIBS="$LIBS -R$ssldir/lib"
fi
fi
LIBS="$LIBS -lcrypto"
----- snip:end -----

View File

@ -2,8 +2,8 @@
INSTALLATION ON THE UNIX PLATFORM
---------------------------------
[See INSTALL.W32 for instructions for compiling OpenSSL on Windows systems,
and INSTALL.VMS for installing on OpenVMS systems.]
[Installation on Windows, OpenVMS and MacOS (before MacOS X) is described
in INSTALL.W32, INSTALL.VMS and INSTALL.MacOS.]
To install OpenSSL, you will need:
@ -33,7 +33,8 @@
Configuration Options
---------------------
There are several options to ./config to customize the build:
There are several options to ./config (or ./Configure) to customize
the build:
--prefix=DIR Install in DIR/bin, DIR/lib, DIR/include/openssl.
Configuration files used by OpenSSL will be in DIR/ssl
@ -77,8 +78,9 @@
This guesses at your operating system (and compiler, if necessary) and
configures OpenSSL based on this guess. Run ./config -t to see
if it guessed correctly. If it did not get it correct or you want to
use a different compiler then go to step 1b. Otherwise go to step 2.
if it guessed correctly. If you want to use a different compiler, you
are cross-compiling for another platform, or the ./config guess was
wrong for other reasons, go to step 1b. Otherwise go to step 2.
On some systems, you can include debugging information as follows:
@ -101,7 +103,8 @@
If your system is not available, you will have to edit the Configure
program and add the correct configuration for your system. The
generic configurations "cc" or "gcc" should usually work.
generic configurations "cc" or "gcc" should usually work on 32 bit
systems.
Configure creates the file Makefile.ssl from Makefile.org and
defines various macros in crypto/opensslconf.h (generated from
@ -115,14 +118,12 @@
OpenSSL binary ("openssl"). The libraries will be built in the top-level
directory, and the binary will be in the "apps" directory.
If "make" fails, please report the problem to <openssl-bugs@openssl.org>.
Include the output of "./config -t" and the OpenSSL version
number in your message.
If "make" fails, please report the problem to <openssl-bugs@openssl.org>
(note that your message will be forwarded to a public mailing list).
Include the output of "make report" in your message.
[If you encounter assembler error messages, try the "no-asm"
configuration option as an immediate fix. Note that on Solaris x86
(not on Sparcs!) you may have to install the GNU assembler to use
OpenSSL assembler code -- /usr/ccs/bin/as won't do.]
configuration option as an immediate fix.]
Compiling parts of OpenSSL with gcc and others with the system
compiler will result in unresolved symbols on some systems.
@ -134,7 +135,7 @@
If a test fails, try removing any compiler optimization flags from
the CFLAGS line in Makefile.ssl and run "make clean; make". Please
send a bug report to <openssl-bugs@openssl.org>, including the
output of "openssl version -a" and of the failed test.
output of "make report".
4. If everything tests ok, install OpenSSL with
@ -145,11 +146,13 @@
certs Initially empty, this is the default location
for certificate files.
man/man1 Manual pages for the 'openssl' command line tool
man/man3 Manual pages for the libraries (very incomplete)
misc Various scripts.
private Initially empty, this is the default location
for private key files.
If you didn't chose a different installation prefix, the
If you didn't choose a different installation prefix, the
following additional subdirectories will be created:
bin Contains the openssl binary and a few other
@ -250,138 +253,3 @@
you can still use "no-threads" to suppress an annoying warning message
from the Configure script.)
--------------------------------------------------------------------------------
The orignal Unix build instructions from SSLeay follow.
Note: some of this may be out of date and no longer applicable
--------------------------------------------------------------------------------
# When bringing the SSLeay distribution back from the evil intel world
# of Windows NT, do the following to make it nice again under unix :-)
# You don't normally need to run this.
sh util/fixNT.sh # This only works for NT now - eay - 21-Jun-1996
# If you have perl, and it is not in /usr/local/bin, you can run
perl util/perlpath.pl /new/path
# and this will fix the paths in all the scripts. DO NOT put
# /new/path/perl, just /new/path. The build
# environment always run scripts as 'perl perlscript.pl' but some of the
# 'applications' are easier to usr with the path fixed.
# Edit crypto/cryptlib.h, tools/c_rehash, and Makefile.ssl
# to set the install locations if you don't like
# the default location of /usr/local/ssl
# Do this by running
perl util/ssldir.pl /new/ssl/home
# if you have perl, or by hand if not.
# If things have been stuffed up with the sym links, run
make -f Makefile.ssl links
# This will re-populate lib/include with symlinks and for each
# directory, link Makefile to Makefile.ssl
# Setup the machine dependent stuff for the top level makefile
# and some select .h files
# If you don't have perl, this will bomb, in which case just edit the
# top level Makefile.ssl
./Configure 'system type'
# The 'Configure' command contains default configuration parameters
# for lots of machines. Configure edits 5 lines in the top level Makefile
# It modifies the following values in the following files
Makefile.ssl CC CFLAG EX_LIBS BN_MULW
crypto/des/des.h DES_LONG
crypto/des/des_locl.h DES_PTR
crypto/md2/md2.h MD2_INT
crypto/rc4/rc4.h RC4_INT
crypto/rc4/rc4_enc.c RC4_INDEX
crypto/rc2/rc2.h RC2_INT
crypto/bf/bf_locl.h BF_INT
crypto/idea/idea.h IDEA_INT
crypto/bn/bn.h BN_LLONG (and defines one of SIXTY_FOUR_BIT,
SIXTY_FOUR_BIT_LONG, THIRTY_TWO_BIT,
SIXTEEN_BIT or EIGHT_BIT)
Please remember that all these files are actually copies of the file with
a .org extention. So if you change crypto/des/des.h, the next time
you run Configure, it will be runover by a 'configured' version of
crypto/des/des.org. So to make the changer the default, change the .org
files. The reason these files have to be edited is because most of
these modifications change the size of fundamental data types.
While in theory this stuff is optional, it often makes a big
difference in performance and when using assember, it is importaint
for the 'Bignum bits' match those required by the assember code.
A warning for people using gcc with sparc cpu's. Gcc needs the -mv8
flag to use the hardware multiply instruction which was not present in
earlier versions of the sparc CPU. I define it by default. If you
have an old sparc, and it crashes, try rebuilding with this flag
removed. I am leaving this flag on by default because it makes
things run 4 times faster :-)
# clean out all the old stuff
make clean
# Do a make depend only if you have the makedepend command installed
# This is not needed but it does make things nice when developing.
make depend
# make should build everything
make
# fix up the demo certificate hash directory if it has been stuffed up.
make rehash
# test everything
make test
# install the lot
make install
# It is worth noting that all the applications are built into the one
# program, ssleay, which is then has links from the other programs
# names to it.
# The applicatons can be built by themselves, just don't define the
# 'MONOLITH' flag. So to build the 'enc' program stand alone,
gcc -O2 -Iinclude apps/enc.c apps/apps.c libcrypto.a
# Other useful make options are
make makefile.one
# which generate a 'makefile.one' file which will build the complete
# SSLeay distribution with temp. files in './tmp' and 'installable' files
# in './out'
# Have a look at running
perl util/mk1mf.pl help
# this can be used to generate a single makefile and is about the only
# way to generate makefiles for windows.
# There is actually a final way of building SSLeay.
gcc -O2 -c -Icrypto -Iinclude crypto/crypto.c
gcc -O2 -c -Issl -Iinclude ssl/ssl.c
# and you now have the 2 libraries as single object files :-).
# If you want to use the assember code for your particular platform
# (DEC alpha/x86 are the main ones, the other assember is just the
# output from gcc) you will need to link the assember with the above generated
# object file and also do the above compile as
gcc -O2 -DBN_ASM -c -Icrypto -Iinclude crypto/crypto.c
This last option is probably the best way to go when porting to another
platform or building shared libraries. It is not good for development so
I don't normally use it.
To build shared libararies under unix, have a look in shlib, basically
you are on your own, but it is quite easy and all you have to do
is compile 2 (or 3) files.
For mult-threading, have a read of doc/threads.doc. Again it is quite
easy and normally only requires some extra callbacks to be defined
by the application.
The examples for solaris and windows NT/95 are in the mt directory.
have fun
eric 25-Jun-1997
IRIX 5.x will build as a 32 bit system with mips1 assember.
IRIX 6.x will build as a 64 bit system with mips3 assember. It conforms
to n32 standards. In theory you can compile the 64 bit assember under
IRIX 5.x but you will have to have the correct system software installed.

View File

@ -12,7 +12,7 @@
---------------
/* ====================================================================
* Copyright (c) 1998-1999 The OpenSSL Project. All rights reserved.
* Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions

View File

@ -28,8 +28,6 @@ OPENSSLDIR=/usr/local/ssl
# DEVRANDOM - Give this the value of the 'random device' if your OS supports
# one. 32 bytes will be read from this when the random
# number generator is initalised.
# SSL_ALLOW_ADH - define if you want the server to be able to use the
# SSLv3 anon-DH ciphers.
# SSL_FORBID_ENULL - define if you want the server to be not able to use the
# NULL encryption ciphers.
#
@ -56,6 +54,8 @@ EX_LIBS=
AR=ar r
RANLIB= ranlib
PERL= perl
TAR= tar
TARFLAGS= --norecurse
# Set BN_ASM to bn_asm.o if you want to use the C version
BN_ASM= bn_asm.o
@ -156,6 +156,7 @@ SDIRS= \
MAKEFILE= Makefile.ssl
MAKE= make -f Makefile.ssl
MANDIR=$(OPENSSLDIR)/man
MAN1=1
MAN3=3
SHELL=/bin/sh
@ -180,6 +181,7 @@ all: Makefile.ssl
(cd $$i && echo "making all in $$i..." && \
$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' SDIRS='${SDIRS}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' all ) || exit 1; \
done
-@# cd crypto; $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' SDIRS='${SDIRS}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' testapps
-@# cd perl; $(PERL) Makefile.PL; make
sub_all:
@ -215,7 +217,7 @@ libclean:
rm -f *.a */lib */*/lib
clean:
rm -f shlib/*.o *.o core a.out fluff *.map
rm -f shlib/*.o *.o core a.out fluff *.map rehash.time testlog make.log cctest cctest.c
@for i in $(DIRS) ;\
do \
(cd $$i && echo "making clean in $$i..." && \
@ -258,8 +260,10 @@ dclean:
$(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' dclean ) || exit 1; \
done;
rehash:
rehash: rehash.time
rehash.time: certs
@(OPENSSL="`pwd`/apps/openssl"; export OPENSSL; sh tools/c_rehash certs)
touch rehash.time
test: tests
@ -268,6 +272,9 @@ tests: rehash
$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SDIRS='${SDIRS}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' tests );
@apps/openssl version -a
report:
@$(PERL) util/selftest.pl
depend:
@for i in $(DIRS) ;\
do \
@ -298,14 +305,17 @@ util/libeay.num::
util/ssleay.num::
perl util/mkdef.pl ssl update
crypto/objects/obj_dat.h: crypto/objects/objects.h crypto/objects/obj_dat.pl
perl crypto/objects/obj_dat.pl crypto/objects/objects.h crypto/objects/obj_dat.h
TABLE: Configure
(echo 'Output of `Configure TABLE'"':"; \
perl Configure TABLE) > TABLE
update: depend errors util/libeay.num util/ssleay.num TABLE
update: depend errors util/libeay.num util/ssleay.num crypto/objects/obj_dat.h TABLE
tar:
@tar --norecurse -cvf - \
@$(TAR) $(TARFLAGS) -cvf - \
`find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE | sort` |\
tardy --user_number=0 --user_name=openssl \
--group_number=0 --group_name=openssl \
@ -322,7 +332,7 @@ dist:
dist_pem_h:
(cd crypto/pem; $(MAKE) CC='${CC}' SDIRS='${SDIRS}' CFLAG='${CFLAG}' pem.h; $(MAKE) clean)
install: all
install: all install_docs
@$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
$(INSTALL_PREFIX)$(INSTALLTOP)/lib \
$(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
@ -338,7 +348,7 @@ install: all
@for i in $(DIRS) ;\
do \
(cd $$i; echo "installing $$i..."; \
$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' install ); \
$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' RANLIB='${RANLIB}' install ); \
done
@for i in $(LIBS) ;\
do \
@ -348,4 +358,36 @@ install: all
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
done
install_docs:
@$(PERL) $(TOP)/util/mkdir-p.pl \
$(INSTALL_PREFIX)$(MANDIR)/man1 \
$(INSTALL_PREFIX)$(MANDIR)/man3 \
$(INSTALL_PREFIX)$(MANDIR)/man5 \
$(INSTALL_PREFIX)$(MANDIR)/man7
@echo installing man 1 and man 5
@for i in doc/apps/*.pod; do \
fn=`basename $$i .pod`; \
sec=`[ "$$fn" = "config" ] && echo 5 || echo 1`; \
(cd `dirname $$i`; \
$(PERL) ../../util/pod2man.pl --section=$$sec --center=OpenSSL \
--release=$(VERSION) `basename $$i`) \
> $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
done
@echo installing man 3 and man 7
@for i in doc/crypto/*.pod doc/ssl/*.pod; do \
fn=`basename $$i .pod`; \
sec=`[ "$$fn" = "des_modes" ] && echo 7 || echo 3`; \
(cd `dirname $$i`; \
$(PERL) ../../util/pod2man.pl --section=$$sec --center=OpenSSL \
--release=$(VERSION) `basename $$i`) \
> $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
done
shlib: all
if [ ! -d shlib_dir ] ; then mkdir shlib_dir ; else rm -f shlib_dir/* ; fi
cd shlib_dir ; ar -x ../libcrypto.a && $(CC) -shared ./*.o -Wl,-soname -Wl,libcrypto.so.0.9 \
-o ./libcrypto.so.0.9.4 && rm *.o
cd shlib_dir ; ar -x ../libssl.a && $(CC) -shared ./*.o -Wl,-soname -Wl,libssl.so.0.9 \
-o ./libssl.so.0.9.4 && rm *.o
# DO NOT DELETE THIS LINE -- make depend depends on it.

View File

@ -1,10 +1,12 @@
### Generated automatically from Makefile.org by Configure.
##
## Makefile for OpenSSL
##
VERSION=0.9.4
VERSION=0.9.5a
MAJOR=0
MINOR=9.4
MINOR=9.5
PLATFORM=dist
OPTIONS=
# INSTALL_PREFIX is for package builders so that they can configure
@ -28,8 +30,6 @@ OPENSSLDIR=/usr/local/ssl
# DEVRANDOM - Give this the value of the 'random device' if your OS supports
# one. 32 bytes will be read from this when the random
# number generator is initalised.
# SSL_ALLOW_ADH - define if you want the server to be able to use the
# SSLv3 anon-DH ciphers.
# SSL_FORBID_ENULL - define if you want the server to be not able to use the
# NULL encryption ciphers.
#
@ -55,7 +55,9 @@ PEX_LIBS= -L. -L.. -L../.. -L../../..
EX_LIBS=
AR=ar r
RANLIB= /usr/bin/ranlib
PERL= /usr/local/bin/perl5
PERL= /usr/local/bin/perl
TAR= tar
TARFLAGS= --norecurse
# Set BN_ASM to bn_asm.o if you want to use the C version
BN_ASM= bn_asm.o
@ -156,6 +158,7 @@ SDIRS= \
MAKEFILE= Makefile.ssl
MAKE= make -f Makefile.ssl
MANDIR=$(OPENSSLDIR)/man
MAN1=1
MAN3=3
SHELL=/bin/sh
@ -180,6 +183,7 @@ all: Makefile.ssl
(cd $$i && echo "making all in $$i..." && \
$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' SDIRS='${SDIRS}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' all ) || exit 1; \
done
-@# cd crypto; $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' SDIRS='${SDIRS}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' testapps
-@# cd perl; $(PERL) Makefile.PL; make
sub_all:
@ -215,7 +219,7 @@ libclean:
rm -f *.a */lib */*/lib
clean:
rm -f shlib/*.o *.o core a.out fluff *.map
rm -f shlib/*.o *.o core a.out fluff *.map rehash.time testlog make.log cctest cctest.c
@for i in $(DIRS) ;\
do \
(cd $$i && echo "making clean in $$i..." && \
@ -258,8 +262,10 @@ dclean:
$(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' dclean ) || exit 1; \
done;
rehash:
rehash: rehash.time
rehash.time: certs
@(OPENSSL="`pwd`/apps/openssl"; export OPENSSL; sh tools/c_rehash certs)
touch rehash.time
test: tests
@ -268,6 +274,9 @@ tests: rehash
$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SDIRS='${SDIRS}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' tests );
@apps/openssl version -a
report:
@$(PERL) util/selftest.pl
depend:
@for i in $(DIRS) ;\
do \
@ -298,14 +307,17 @@ util/libeay.num::
util/ssleay.num::
perl util/mkdef.pl ssl update
crypto/objects/obj_dat.h: crypto/objects/objects.h crypto/objects/obj_dat.pl
perl crypto/objects/obj_dat.pl crypto/objects/objects.h crypto/objects/obj_dat.h
TABLE: Configure
(echo 'Output of `Configure TABLE'"':"; \
perl Configure TABLE) > TABLE
update: depend errors util/libeay.num util/ssleay.num TABLE
update: depend errors util/libeay.num util/ssleay.num crypto/objects/obj_dat.h TABLE
tar:
@tar --norecurse -cvf - \
@$(TAR) $(TARFLAGS) -cvf - \
`find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE | sort` |\
tardy --user_number=0 --user_name=openssl \
--group_number=0 --group_name=openssl \
@ -322,7 +334,7 @@ dist:
dist_pem_h:
(cd crypto/pem; $(MAKE) CC='${CC}' SDIRS='${SDIRS}' CFLAG='${CFLAG}' pem.h; $(MAKE) clean)
install: all
install: all install_docs
@$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
$(INSTALL_PREFIX)$(INSTALLTOP)/lib \
$(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
@ -338,7 +350,7 @@ install: all
@for i in $(DIRS) ;\
do \
(cd $$i; echo "installing $$i..."; \
$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' install ); \
$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' RANLIB='${RANLIB}' install ); \
done
@for i in $(LIBS) ;\
do \
@ -348,4 +360,36 @@ install: all
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
done
install_docs:
@$(PERL) $(TOP)/util/mkdir-p.pl \
$(INSTALL_PREFIX)$(MANDIR)/man1 \
$(INSTALL_PREFIX)$(MANDIR)/man3 \
$(INSTALL_PREFIX)$(MANDIR)/man5 \
$(INSTALL_PREFIX)$(MANDIR)/man7
@echo installing man 1 and man 5
@for i in doc/apps/*.pod; do \
fn=`basename $$i .pod`; \
sec=`[ "$$fn" = "config" ] && echo 5 || echo 1`; \
(cd `dirname $$i`; \
$(PERL) ../../util/pod2man.pl --section=$$sec --center=OpenSSL \
--release=$(VERSION) `basename $$i`) \
> $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
done
@echo installing man 3 and man 7
@for i in doc/crypto/*.pod doc/ssl/*.pod; do \
fn=`basename $$i .pod`; \
sec=`[ "$$fn" = "des_modes" ] && echo 7 || echo 3`; \
(cd `dirname $$i`; \
$(PERL) ../../util/pod2man.pl --section=$$sec --center=OpenSSL \
--release=$(VERSION) `basename $$i`) \
> $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
done
shlib: all
if [ ! -d shlib_dir ] ; then mkdir shlib_dir ; else rm -f shlib_dir/* ; fi
cd shlib_dir ; ar -x ../libcrypto.a && $(CC) -shared ./*.o -Wl,-soname -Wl,libcrypto.so.0.9 \
-o ./libcrypto.so.0.9.4 && rm *.o
cd shlib_dir ; ar -x ../libssl.a && $(CC) -shared ./*.o -Wl,-soname -Wl,libssl.so.0.9 \
-o ./libssl.so.0.9.4 && rm *.o
# DO NOT DELETE THIS LINE -- make depend depends on it.

View File

@ -5,6 +5,51 @@
This file gives a brief overview of the major changes between each OpenSSL
release. For more details please read the CHANGES file.
Major changes between OpenSSL 0.9.5 and OpenSSL 0.9.5a:
o Bug fixes for Win32, SuSE Linux, NeXTSTEP and FreeBSD 2.2.8
o Shared library support for HPUX and Solaris-gcc
o Support of Linux/IA64
o Assembler support for Mingw32
o New 'rand' application
o New way to check for existence of algorithms from scripts
Major changes between OpenSSL 0.9.4 and OpenSSL 0.9.5:
o S/MIME support in new 'smime' command
o Documentation for the OpenSSL command line application
o Automation of 'req' application
o Fixes to make s_client, s_server work under Windows
o Support for multiple fieldnames in SPKACs
o New SPKAC command line utilty and associated library functions
o Options to allow passwords to be obtained from various sources
o New public key PEM format and options to handle it
o Many other fixes and enhancements to command line utilities
o Usable certificate chain verification
o Certificate purpose checking
o Certificate trust settings
o Support of authority information access extension
o Extensions in certificate requests
o Simplified X509 name and attribute routines
o Initial (incomplete) support for international character sets
o New DH_METHOD, DSA_METHOD and enhanced RSA_METHOD
o Read only memory BIOs and simplified creation function
o TLS/SSL protocol bugfixes: Accept TLS 'client hello' in SSL 3.0
record; allow fragmentation and interleaving of handshake and other
data
o TLS/SSL code now "tolerates" MS SGC
o Work around for Netscape client certificate hang bug
o RSA_NULL option that removes RSA patent code but keeps other
RSA functionality
o Memory leak detection now allows applications to add extra information
via a per-thread stack
o PRNG robustness improved
o EGD support
o BIGNUM library bug fixes
o Faster DSA parameter generation
o Enhanced support for Alpha Linux
o Experimental MacOS support
Major changes between OpenSSL 0.9.3 and OpenSSL 0.9.4:
o Transparent support for PKCS#8 format private keys: these are used

View File

@ -1,7 +1,7 @@
OpenSSL 0.9.4 09 Aug 1999
OpenSSL 0.9.5a 1 Apr 2000
Copyright (c) 1998-1999 The OpenSSL Project
Copyright (c) 1998-2000 The OpenSSL Project
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
All rights reserved.
@ -11,9 +11,10 @@
The OpenSSL Project is a collaborative effort to develop a robust,
commercial-grade, fully featured, and Open Source toolkit implementing the
Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1)
protocols with full-strength cryptography world-wide. The project is managed
by a worldwide community of volunteers that use the Internet to communicate,
plan, and develop the OpenSSL toolkit and its related documentation.
protocols as well as a full-strength general purpose cryptography library.
The project is managed by a worldwide community of volunteers that use the
Internet to communicate, plan, and develop the OpenSSL toolkit and its
related documentation.
OpenSSL is based on the excellent SSLeay library developed from Eric A. Young
and Tim J. Hudson. The OpenSSL toolkit is licensed under a dual-license (the
@ -80,40 +81,14 @@
A Configuration loader that uses a format similar to MS .ini files.
openssl:
A command line tool which provides the following functions:
A command line tool that can be used for:
Creation of RSA, DH and DSA key parameters
Creation of X.509 certificates, CSRs and CRLs
Calculation of Message Digests
Encryption and Decryption with Ciphers
SSL/TLS Client and Server Tests
Handling of S/MIME signed or encrypted mail
enc - a general encryption program that can encrypt/decrypt using
one of 17 different cipher/mode combinations. The
input/output can also be converted to/from base64
ascii encoding.
dgst - a generate message digesting program that will generate
message digests for any of md2, md5, sha (sha-0 or sha-1)
or mdc2.
asn1parse - parse and display the structure of an asn1 encoded
binary file.
rsa - Manipulate RSA private keys.
dsa - Manipulate DSA private keys.
dh - Manipulate Diffie-Hellman parameter files.
dsaparam- Manipulate and generate DSA parameter files.
crl - Manipulate certificate revocation lists.
crt2pkcs7- Generate a pkcs7 object containing a crl and a certificate.
x509 - Manipulate x509 certificates, self-sign certificates.
req - Manipulate PKCS#10 certificate requests and also
generate certificate requests.
genrsa - Generates an arbitrary sized RSA private key.
gendsa - Generates DSA parameters.
gendh - Generates a set of Diffie-Hellman parameters, the prime
will be a strong prime.
ca - Create certificates from PKCS#10 certificate requests.
This program also maintains a database of certificates
issued.
verify - Check x509 certificate signatures.
speed - Benchmark OpenSSL's ciphers.
s_server- A test SSL server.
s_client- A test SSL client.
s_time - Benchmark SSL performance of SSL server programs.
errstr - Convert from OpenSSL hex error codes to a readable form.
nseq - Netscape certificate sequence utility
PATENTS
-------
@ -157,43 +132,40 @@
If you have any problems with OpenSSL then please take the following steps
first:
- Download the current snapshot from ftp://ftp.openssl.org/snapshot/
to see if the problem has already been addressed
- Remove ASM versions of libraries
- Remove compiler optimisation flags
- Add compiler debug flags (if using gcc then remove -fomit-frame-pointer
before you try to debug things)
If you wish to report a bug then please include the following information in
any bug report:
OpenSSL Details
- Version, most of these details can be got from the
'openssl version -a' command.
Operating System Details
- On Unix systems: Output of './config -t'
- OS Name, Version
- Hardware platform
Compiler Details
- Name
- Version
Application Details
- Name
- Version
Problem Description
- include steps that will reproduce the problem (if known)
Stack Traceback (if the application dumps core)
- On Unix systems:
Self-test report generated by 'make report'
- On other systems:
OpenSSL version: output of 'openssl version -a'
OS Name, Version, Hardware platform
Compiler Details (name, version)
- Application Details (name, version)
- Problem Description (steps that will reproduce the problem, if known)
- Stack Traceback (if the application dumps core)
Report the bug to the OpenSSL project at:
openssl-bugs@openssl.org
Note that mail to openssl-bugs@openssl.org is forwarded to a public
mailing list. Confidential mail may be sent to openssl-security@openssl.org
(PGP key available from the key servers).
HOW TO CONTRIBUTE TO OpenSSL
----------------------------
Development is coordinated on the openssl-dev mailing list (see
http://www.openssl.org for information on subscribing). If you
would like to submit a patch, send it to openssl-dev@openssl.org.
Please be sure to include a textual explanation of what your patch
does.
would like to submit a patch, send it to openssl-dev@openssl.org with
the string "[PATCH]" in the subject. Please be sure to include a
textual explanation of what your patch does.
The preferred format for changes is "diff -u" output. You might
generate it like this:

View File

@ -41,6 +41,7 @@ $REQ="openssl req $SSLEAY_CONFIG";
$CA="openssl ca $SSLEAY_CONFIG";
$VERIFY="openssl verify";
$X509="openssl x509";
$PKCS12="openssl pkcs12";
$CATOP="./demoCA";
$CAKEY="cakey.pem";
@ -65,7 +66,7 @@ foreach (@ARGV) {
$RET=$?;
print "Request (and private key) is in newreq.pem\n";
} elsif (/^-newca$/) {
# if explictly asked for or it doesn't exist then setup the
# if explicitly asked for or it doesn't exist then setup the
# directory structure that Eric likes to manage things
$NEW="1";
if ( "$NEW" || ! -f "${CATOP}/serial" ) {
@ -99,6 +100,14 @@ foreach (@ARGV) {
$RET=$?;
}
}
} elsif (/^-pkcs12$/) {
my $cname = $ARGV[1];
$cname = "My Certificate" unless defined $cname;
system ("$PKCS12 -in newcert.pem -inkey newreq.pem " .
"-certfile ${CATOP}/$CACERT -out newcert.p12 " .
"-export -name \"$cname\"");
$RET=$?;
exit $RET;
} elsif (/^-xsign$/) {
system ("$CA -policy policy_anything -infiles newreq.pem");
$RET=$?;

View File

@ -0,0 +1,162 @@
#!/usr/local/bin/perl
#
# CA - wrapper around ca to make it easier to use ... basically ca requires
# some setup stuff to be done before you can use it and this makes
# things easier between now and when Eric is convinced to fix it :-)
#
# CA -newca ... will setup the right stuff
# CA -newreq ... will generate a certificate request
# CA -sign ... will sign the generated request and output
#
# At the end of that grab newreq.pem and newcert.pem (one has the key
# and the other the certificate) and cat them together and that is what
# you want/need ... I'll make even this a little cleaner later.
#
#
# 12-Jan-96 tjh Added more things ... including CA -signcert which
# converts a certificate to a request and then signs it.
# 10-Jan-96 eay Fixed a few more bugs and added the SSLEAY_CONFIG
# environment variable so this can be driven from
# a script.
# 25-Jul-96 eay Cleaned up filenames some more.
# 11-Jun-96 eay Fixed a few filename missmatches.
# 03-May-96 eay Modified to use 'ssleay cmd' instead of 'cmd'.
# 18-Apr-96 tjh Original hacking
#
# Tim Hudson
# tjh@cryptsoft.com
#
# 27-Apr-98 snh Translation into perl, fix existing CA bug.
#
#
# Steve Henson
# shenson@bigfoot.com
# default openssl.cnf file has setup as per the following
# demoCA ... where everything is stored
$DAYS="-days 365";
$REQ="openssl req $SSLEAY_CONFIG";
$CA="openssl ca $SSLEAY_CONFIG";
$VERIFY="openssl verify";
$X509="openssl x509";
$PKCS12="openssl pkcs12";
$CATOP="./demoCA";
$CAKEY="cakey.pem";
$CACERT="cacert.pem";
$DIRMODE = 0777;
$RET = 0;
foreach (@ARGV) {
if ( /^(-\?|-h|-help)$/ ) {
print STDERR "usage: CA -newcert|-newreq|-newca|-sign|-verify\n";
exit 0;
} elsif (/^-newcert$/) {
# create a certificate
system ("$REQ -new -x509 -keyout newreq.pem -out newreq.pem $DAYS");
$RET=$?;
print "Certificate (and private key) is in newreq.pem\n"
} elsif (/^-newreq$/) {
# create a certificate request
system ("$REQ -new -keyout newreq.pem -out newreq.pem $DAYS");
$RET=$?;
print "Request (and private key) is in newreq.pem\n";
} elsif (/^-newca$/) {
# if explicitly asked for or it doesn't exist then setup the
# directory structure that Eric likes to manage things
$NEW="1";
if ( "$NEW" || ! -f "${CATOP}/serial" ) {
# create the directory hierarchy
mkdir $CATOP, $DIRMODE;
mkdir "${CATOP}/certs", $DIRMODE;
mkdir "${CATOP}/crl", $DIRMODE ;
mkdir "${CATOP}/newcerts", $DIRMODE;
mkdir "${CATOP}/private", $DIRMODE;
open OUT, ">${CATOP}/serial";
print OUT "01\n";
close OUT;
open OUT, ">${CATOP}/index.txt";
close OUT;
}
if ( ! -f "${CATOP}/private/$CAKEY" ) {
print "CA certificate filename (or enter to create)\n";
$FILE = <STDIN>;
chop $FILE;
# ask user for existing CA certificate
if ($FILE) {
cp_pem($FILE,"${CATOP}/private/$CAKEY", "PRIVATE");
cp_pem($FILE,"${CATOP}/$CACERT", "CERTIFICATE");
$RET=$?;
} else {
print "Making CA certificate ...\n";
system ("$REQ -new -x509 -keyout " .
"${CATOP}/private/$CAKEY -out ${CATOP}/$CACERT $DAYS");
$RET=$?;
}
}
} elsif (/^-pkcs12$/) {
my $cname = $ARGV[1];
$cname = "My Certificate" unless defined $cname;
system ("$PKCS12 -in newcert.pem -inkey newreq.pem " .
"-certfile ${CATOP}/$CACERT -out newcert.p12 " .
"-export -name \"$cname\"");
$RET=$?;
exit $RET;
} elsif (/^-xsign$/) {
system ("$CA -policy policy_anything -infiles newreq.pem");
$RET=$?;
} elsif (/^(-sign|-signreq)$/) {
system ("$CA -policy policy_anything -out newcert.pem " .
"-infiles newreq.pem");
$RET=$?;
print "Signed certificate is in newcert.pem\n";
} elsif (/^-signcert$/) {
system ("$X509 -x509toreq -in newreq.pem -signkey newreq.pem " .
"-out tmp.pem");
system ("$CA -policy policy_anything -out newcert.pem " .
"-infiles tmp.pem");
$RET = $?;
print "Signed certificate is in newcert.pem\n";
} elsif (/^-verify$/) {
if (shift) {
foreach $j (@ARGV) {
system ("$VERIFY -CAfile $CATOP/$CACERT $j");
$RET=$? if ($? != 0);
}
exit $RET;
} else {
system ("$VERIFY -CAfile $CATOP/$CACERT newcert.pem");
$RET=$?;
exit 0;
}
} else {
print STDERR "Unknown arg $_\n";
print STDERR "usage: CA -newcert|-newreq|-newca|-sign|-verify\n";
exit 1;
}
}
exit $RET;
sub cp_pem {
my ($infile, $outfile, $bound) = @_;
open IN, $infile;
open OUT, ">$outfile";
my $flag = 0;
while (<IN>) {
$flag = 1 if (/^-----BEGIN.*$bound/) ;
print OUT $_ if ($flag);
if (/^-----END.*$bound/) {
close IN;
close OUT;
return;
}
}
}

View File

@ -60,7 +60,7 @@ case $i in
echo "Request (and private key) is in newreq.pem"
;;
-newca)
# if explictly asked for or it doesn't exist then setup the directory
# if explicitly asked for or it doesn't exist then setup the directory
# structure that Eric likes to manage things
NEW="1"
if [ "$NEW" -o ! -f ${CATOP}/serial ]; then

View File

@ -0,0 +1,818 @@
#
# apps/Makefile.ssl
#
DIR= apps
TOP= ..
CC= cc
INCLUDES= -I../include
CFLAG= -g -static
INSTALL_PREFIX=
INSTALLTOP= /usr/local/ssl
OPENSSLDIR= /usr/local/ssl
MAKE= make -f Makefile.ssl
MAKEDEPEND= $(TOP)/util/domd $(TOP)
MAKEFILE= Makefile.ssl
PERL=/usr/local/bin/perl
RM= rm -f
PEX_LIBS=
EX_LIBS=
CFLAGS= -DMONOLITH $(INCLUDES) $(CFLAG)
GENERAL=Makefile makeapps.com install.com
DLIBCRYPTO=../libcrypto.a
DLIBSSL=../libssl.a
LIBCRYPTO=-L.. -lcrypto
LIBSSL=-L.. -lssl
PROGRAM= openssl
SCRIPTS=CA.sh CA.pl der_chop
EXE= $(PROGRAM)
E_EXE= verify asn1pars req dgst dh dhparam enc passwd gendh errstr \
ca crl rsa dsa dsaparam \
x509 genrsa gendsa s_server s_client speed \
s_time version pkcs7 crl2pkcs7 sess_id ciphers nseq pkcs12 \
pkcs8 spkac smime rand
PROGS= $(PROGRAM).c
A_OBJ=apps.o
A_SRC=apps.c
S_OBJ= s_cb.o s_socket.o
S_SRC= s_cb.c s_socket.c
RAND_OBJ=app_rand.o
RAND_SRC=app_rand.c
E_OBJ= verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o \
ca.o pkcs7.o crl2p7.o crl.o \
rsa.o dsa.o dsaparam.o \
x509.o genrsa.o gendsa.o s_server.o s_client.o speed.o \
s_time.o $(A_OBJ) $(S_OBJ) $(RAND_OBJ) version.o sess_id.o \
ciphers.o nseq.o pkcs12.o pkcs8.o spkac.o smime.o rand.o
E_SRC= verify.c asn1pars.c req.c dgst.c dh.c enc.c passwd.c gendh.c errstr.c ca.c \
pkcs7.c crl2p7.c crl.c \
rsa.c dsa.c dsaparam.c \
x509.c genrsa.c gendsa.c s_server.c s_client.c speed.c \
s_time.c $(A_SRC) $(S_SRC) $(RAND_SRC) version.c sess_id.c \
ciphers.c nseq.c pkcs12.c pkcs8.c spkac.c smime.c rand.c
SRC=$(E_SRC)
EXHEADER=
HEADER= apps.h progs.h s_apps.h \
testdsa.h testrsa.h \
$(EXHEADER)
ALL= $(GENERAL) $(SRC) $(HEADER)
top:
@(cd ..; $(MAKE) DIRS=$(DIR) all)
all: exe
exe: $(EXE)
req: sreq.o $(A_OBJ) $(DLIBCRYPTO)
$(CC) -o req $(CFLAG) sreq.o $(A_OBJ) $(RAND_OBJ) $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
sreq.o: req.c
$(CC) -c $(INCLUDES) $(CFLAG) -o sreq.o req.c
files:
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
install:
@for i in $(EXE); \
do \
(echo installing $$i; \
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i; \
chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
done;
@for i in $(SCRIPTS); \
do \
(echo installing $$i; \
cp $$i $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i; \
chmod 755 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i ); \
done
@cp openssl.cnf $(INSTALL_PREFIX)$(OPENSSLDIR); \
chmod 644 $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf
tags:
ctags $(SRC)
tests:
links:
@$(TOP)/util/point.sh Makefile.ssl Makefile
lint:
lint -DLINT $(INCLUDES) $(SRC)>fluff
depend:
$(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(SRC)
dclean:
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
mv -f Makefile.new $(MAKEFILE)
clean:
rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff $(EXE)
rm -f req
$(DLIBSSL):
(cd ../ssl; $(MAKE))
$(DLIBCRYPTO):
(cd ../crypto; $(MAKE))
$(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; sh tools/c_rehash certs)
progs.h: progs.pl
$(PERL) progs.pl $(E_EXE) >progs.h
$(RM) $(PROGRAM).o
# DO NOT DELETE THIS LINE -- make depend depends on it.
app_rand.o: ../include/openssl/asn1.h ../include/openssl/bio.h
app_rand.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
app_rand.o: ../include/openssl/buffer.h ../include/openssl/cast.h
app_rand.o: ../include/openssl/crypto.h ../include/openssl/des.h
app_rand.o: ../include/openssl/dh.h ../include/openssl/dsa.h
app_rand.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
app_rand.o: ../include/openssl/evp.h ../include/openssl/idea.h
app_rand.o: ../include/openssl/md2.h ../include/openssl/md5.h
app_rand.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
app_rand.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
app_rand.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
app_rand.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
app_rand.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
app_rand.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
app_rand.o: ../include/openssl/sha.h ../include/openssl/stack.h
app_rand.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
apps.o: ../include/openssl/asn1.h ../include/openssl/bio.h
apps.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
apps.o: ../include/openssl/buffer.h ../include/openssl/cast.h
apps.o: ../include/openssl/crypto.h ../include/openssl/des.h
apps.o: ../include/openssl/dh.h ../include/openssl/dsa.h
apps.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
apps.o: ../include/openssl/evp.h ../include/openssl/idea.h
apps.o: ../include/openssl/md2.h ../include/openssl/md5.h
apps.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
apps.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
apps.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
apps.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
apps.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
apps.o: ../include/openssl/safestack.h ../include/openssl/sha.h
apps.o: ../include/openssl/stack.h ../include/openssl/x509.h
apps.o: ../include/openssl/x509_vfy.h apps.h
asn1pars.o: ../include/openssl/asn1.h ../include/openssl/bio.h
asn1pars.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
asn1pars.o: ../include/openssl/buffer.h ../include/openssl/cast.h
asn1pars.o: ../include/openssl/crypto.h ../include/openssl/des.h
asn1pars.o: ../include/openssl/dh.h ../include/openssl/dsa.h
asn1pars.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
asn1pars.o: ../include/openssl/err.h ../include/openssl/evp.h
asn1pars.o: ../include/openssl/idea.h ../include/openssl/md2.h
asn1pars.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
asn1pars.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
asn1pars.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
asn1pars.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
asn1pars.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
asn1pars.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
asn1pars.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
asn1pars.o: ../include/openssl/sha.h ../include/openssl/stack.h
asn1pars.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
ca.o: ../include/openssl/asn1.h ../include/openssl/bio.h
ca.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
ca.o: ../include/openssl/buffer.h ../include/openssl/cast.h
ca.o: ../include/openssl/conf.h ../include/openssl/crypto.h
ca.o: ../include/openssl/des.h ../include/openssl/dh.h ../include/openssl/dsa.h
ca.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
ca.o: ../include/openssl/err.h ../include/openssl/evp.h
ca.o: ../include/openssl/idea.h ../include/openssl/lhash.h
ca.o: ../include/openssl/md2.h ../include/openssl/md5.h
ca.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
ca.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
ca.o: ../include/openssl/pem.h ../include/openssl/pem2.h
ca.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
ca.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
ca.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
ca.o: ../include/openssl/safestack.h ../include/openssl/sha.h
ca.o: ../include/openssl/stack.h ../include/openssl/txt_db.h
ca.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
ca.o: ../include/openssl/x509v3.h apps.h
ciphers.o: ../include/openssl/asn1.h ../include/openssl/bio.h
ciphers.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
ciphers.o: ../include/openssl/buffer.h ../include/openssl/cast.h
ciphers.o: ../include/openssl/crypto.h ../include/openssl/des.h
ciphers.o: ../include/openssl/dh.h ../include/openssl/dsa.h
ciphers.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
ciphers.o: ../include/openssl/err.h ../include/openssl/evp.h
ciphers.o: ../include/openssl/idea.h ../include/openssl/lhash.h
ciphers.o: ../include/openssl/md2.h ../include/openssl/md5.h
ciphers.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
ciphers.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
ciphers.o: ../include/openssl/pem.h ../include/openssl/pem2.h
ciphers.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
ciphers.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
ciphers.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
ciphers.o: ../include/openssl/safestack.h ../include/openssl/sha.h
ciphers.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
ciphers.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
ciphers.o: ../include/openssl/stack.h ../include/openssl/tls1.h
ciphers.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
crl.o: ../include/openssl/asn1.h ../include/openssl/bio.h
crl.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
crl.o: ../include/openssl/buffer.h ../include/openssl/cast.h
crl.o: ../include/openssl/conf.h ../include/openssl/crypto.h
crl.o: ../include/openssl/des.h ../include/openssl/dh.h
crl.o: ../include/openssl/dsa.h ../include/openssl/e_os.h
crl.o: ../include/openssl/e_os2.h ../include/openssl/err.h
crl.o: ../include/openssl/evp.h ../include/openssl/idea.h
crl.o: ../include/openssl/lhash.h ../include/openssl/md2.h
crl.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
crl.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
crl.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
crl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
crl.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
crl.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
crl.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
crl.o: ../include/openssl/sha.h ../include/openssl/stack.h
crl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
crl.o: ../include/openssl/x509v3.h apps.h
crl2p7.o: ../include/openssl/asn1.h ../include/openssl/bio.h
crl2p7.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
crl2p7.o: ../include/openssl/buffer.h ../include/openssl/cast.h
crl2p7.o: ../include/openssl/crypto.h ../include/openssl/des.h
crl2p7.o: ../include/openssl/dh.h ../include/openssl/dsa.h
crl2p7.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
crl2p7.o: ../include/openssl/err.h ../include/openssl/evp.h
crl2p7.o: ../include/openssl/idea.h ../include/openssl/md2.h
crl2p7.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
crl2p7.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
crl2p7.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
crl2p7.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
crl2p7.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
crl2p7.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
crl2p7.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
crl2p7.o: ../include/openssl/sha.h ../include/openssl/stack.h
crl2p7.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
dgst.o: ../include/openssl/asn1.h ../include/openssl/bio.h
dgst.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
dgst.o: ../include/openssl/buffer.h ../include/openssl/cast.h
dgst.o: ../include/openssl/crypto.h ../include/openssl/des.h
dgst.o: ../include/openssl/dh.h ../include/openssl/dsa.h
dgst.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
dgst.o: ../include/openssl/err.h ../include/openssl/evp.h
dgst.o: ../include/openssl/idea.h ../include/openssl/md2.h
dgst.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
dgst.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
dgst.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
dgst.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
dgst.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
dgst.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
dgst.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
dgst.o: ../include/openssl/sha.h ../include/openssl/stack.h
dgst.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
dh.o: ../include/openssl/asn1.h ../include/openssl/bio.h
dh.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
dh.o: ../include/openssl/buffer.h ../include/openssl/cast.h
dh.o: ../include/openssl/crypto.h ../include/openssl/des.h
dh.o: ../include/openssl/dh.h ../include/openssl/dsa.h
dh.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
dh.o: ../include/openssl/err.h ../include/openssl/evp.h
dh.o: ../include/openssl/idea.h ../include/openssl/md2.h
dh.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
dh.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
dh.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
dh.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
dh.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
dh.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
dh.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
dh.o: ../include/openssl/sha.h ../include/openssl/stack.h
dh.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
dsa.o: ../include/openssl/asn1.h ../include/openssl/bio.h
dsa.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
dsa.o: ../include/openssl/buffer.h ../include/openssl/cast.h
dsa.o: ../include/openssl/crypto.h ../include/openssl/des.h
dsa.o: ../include/openssl/dh.h ../include/openssl/dsa.h
dsa.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
dsa.o: ../include/openssl/err.h ../include/openssl/evp.h
dsa.o: ../include/openssl/idea.h ../include/openssl/md2.h
dsa.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
dsa.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
dsa.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
dsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
dsa.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
dsa.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
dsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
dsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
dsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
dsaparam.o: ../include/openssl/asn1.h ../include/openssl/bio.h
dsaparam.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
dsaparam.o: ../include/openssl/buffer.h ../include/openssl/cast.h
dsaparam.o: ../include/openssl/crypto.h ../include/openssl/des.h
dsaparam.o: ../include/openssl/dh.h ../include/openssl/dsa.h
dsaparam.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
dsaparam.o: ../include/openssl/err.h ../include/openssl/evp.h
dsaparam.o: ../include/openssl/idea.h ../include/openssl/md2.h
dsaparam.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
dsaparam.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
dsaparam.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
dsaparam.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
dsaparam.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
dsaparam.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
dsaparam.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
dsaparam.o: ../include/openssl/sha.h ../include/openssl/stack.h
dsaparam.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
enc.o: ../include/openssl/asn1.h ../include/openssl/bio.h
enc.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
enc.o: ../include/openssl/buffer.h ../include/openssl/cast.h
enc.o: ../include/openssl/crypto.h ../include/openssl/des.h
enc.o: ../include/openssl/dh.h ../include/openssl/dsa.h
enc.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
enc.o: ../include/openssl/err.h ../include/openssl/evp.h
enc.o: ../include/openssl/idea.h ../include/openssl/md2.h
enc.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
enc.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
enc.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
enc.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
enc.o: ../include/openssl/rand.h ../include/openssl/rc2.h
enc.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
enc.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
enc.o: ../include/openssl/safestack.h ../include/openssl/sha.h
enc.o: ../include/openssl/stack.h ../include/openssl/x509.h
enc.o: ../include/openssl/x509_vfy.h apps.h
errstr.o: ../include/openssl/asn1.h ../include/openssl/bio.h
errstr.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
errstr.o: ../include/openssl/buffer.h ../include/openssl/cast.h
errstr.o: ../include/openssl/crypto.h ../include/openssl/des.h
errstr.o: ../include/openssl/dh.h ../include/openssl/dsa.h
errstr.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
errstr.o: ../include/openssl/err.h ../include/openssl/evp.h
errstr.o: ../include/openssl/idea.h ../include/openssl/lhash.h
errstr.o: ../include/openssl/md2.h ../include/openssl/md5.h
errstr.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
errstr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
errstr.o: ../include/openssl/pem.h ../include/openssl/pem2.h
errstr.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
errstr.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
errstr.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
errstr.o: ../include/openssl/safestack.h ../include/openssl/sha.h
errstr.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
errstr.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
errstr.o: ../include/openssl/stack.h ../include/openssl/tls1.h
errstr.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
gendh.o: ../include/openssl/asn1.h ../include/openssl/bio.h
gendh.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
gendh.o: ../include/openssl/buffer.h ../include/openssl/cast.h
gendh.o: ../include/openssl/crypto.h ../include/openssl/des.h
gendh.o: ../include/openssl/dh.h ../include/openssl/dsa.h
gendh.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
gendh.o: ../include/openssl/err.h ../include/openssl/evp.h
gendh.o: ../include/openssl/idea.h ../include/openssl/md2.h
gendh.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
gendh.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
gendh.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
gendh.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
gendh.o: ../include/openssl/rand.h ../include/openssl/rc2.h
gendh.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
gendh.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
gendh.o: ../include/openssl/safestack.h ../include/openssl/sha.h
gendh.o: ../include/openssl/stack.h ../include/openssl/x509.h
gendh.o: ../include/openssl/x509_vfy.h apps.h
gendsa.o: ../include/openssl/asn1.h ../include/openssl/bio.h
gendsa.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
gendsa.o: ../include/openssl/buffer.h ../include/openssl/cast.h
gendsa.o: ../include/openssl/crypto.h ../include/openssl/des.h
gendsa.o: ../include/openssl/dh.h ../include/openssl/dsa.h
gendsa.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
gendsa.o: ../include/openssl/err.h ../include/openssl/evp.h
gendsa.o: ../include/openssl/idea.h ../include/openssl/md2.h
gendsa.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
gendsa.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
gendsa.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
gendsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
gendsa.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
gendsa.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
gendsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
gendsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
gendsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
genrsa.o: ../include/openssl/asn1.h ../include/openssl/bio.h
genrsa.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
genrsa.o: ../include/openssl/buffer.h ../include/openssl/cast.h
genrsa.o: ../include/openssl/crypto.h ../include/openssl/des.h
genrsa.o: ../include/openssl/dh.h ../include/openssl/dsa.h
genrsa.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
genrsa.o: ../include/openssl/err.h ../include/openssl/evp.h
genrsa.o: ../include/openssl/idea.h ../include/openssl/md2.h
genrsa.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
genrsa.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
genrsa.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
genrsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
genrsa.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
genrsa.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
genrsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
genrsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
genrsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
nseq.o: ../include/openssl/asn1.h ../include/openssl/bio.h
nseq.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
nseq.o: ../include/openssl/buffer.h ../include/openssl/cast.h
nseq.o: ../include/openssl/crypto.h ../include/openssl/des.h
nseq.o: ../include/openssl/dh.h ../include/openssl/dsa.h
nseq.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
nseq.o: ../include/openssl/err.h ../include/openssl/evp.h
nseq.o: ../include/openssl/idea.h ../include/openssl/md2.h
nseq.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
nseq.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
nseq.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
nseq.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
nseq.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
nseq.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
nseq.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
nseq.o: ../include/openssl/sha.h ../include/openssl/stack.h
nseq.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
openssl.o: ../include/openssl/asn1.h ../include/openssl/bio.h
openssl.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
openssl.o: ../include/openssl/buffer.h ../include/openssl/cast.h
openssl.o: ../include/openssl/conf.h ../include/openssl/crypto.h
openssl.o: ../include/openssl/des.h ../include/openssl/dh.h
openssl.o: ../include/openssl/dsa.h ../include/openssl/e_os.h
openssl.o: ../include/openssl/e_os2.h ../include/openssl/err.h
openssl.o: ../include/openssl/evp.h ../include/openssl/idea.h
openssl.o: ../include/openssl/lhash.h ../include/openssl/md2.h
openssl.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
openssl.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
openssl.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
openssl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
openssl.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
openssl.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
openssl.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
openssl.o: ../include/openssl/sha.h ../include/openssl/ssl.h
openssl.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
openssl.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
openssl.o: ../include/openssl/tls1.h ../include/openssl/x509.h
openssl.o: ../include/openssl/x509_vfy.h apps.h progs.h s_apps.h
passwd.o: ../include/openssl/asn1.h ../include/openssl/bio.h
passwd.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
passwd.o: ../include/openssl/buffer.h ../include/openssl/cast.h
passwd.o: ../include/openssl/crypto.h ../include/openssl/des.h
passwd.o: ../include/openssl/dh.h ../include/openssl/dsa.h
passwd.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
passwd.o: ../include/openssl/err.h ../include/openssl/evp.h
passwd.o: ../include/openssl/idea.h ../include/openssl/md2.h
passwd.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
passwd.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
passwd.o: ../include/openssl/opensslv.h ../include/openssl/pkcs7.h
passwd.o: ../include/openssl/rand.h ../include/openssl/rc2.h
passwd.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
passwd.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
passwd.o: ../include/openssl/safestack.h ../include/openssl/sha.h
passwd.o: ../include/openssl/stack.h ../include/openssl/x509.h
passwd.o: ../include/openssl/x509_vfy.h apps.h
pkcs12.o: ../include/openssl/asn1.h ../include/openssl/bio.h
pkcs12.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
pkcs12.o: ../include/openssl/buffer.h ../include/openssl/cast.h
pkcs12.o: ../include/openssl/crypto.h ../include/openssl/des.h
pkcs12.o: ../include/openssl/dh.h ../include/openssl/dsa.h
pkcs12.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
pkcs12.o: ../include/openssl/err.h ../include/openssl/evp.h
pkcs12.o: ../include/openssl/idea.h ../include/openssl/md2.h
pkcs12.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
pkcs12.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
pkcs12.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
pkcs12.o: ../include/openssl/pem2.h ../include/openssl/pkcs12.h
pkcs12.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
pkcs12.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
pkcs12.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
pkcs12.o: ../include/openssl/safestack.h ../include/openssl/sha.h
pkcs12.o: ../include/openssl/stack.h ../include/openssl/x509.h
pkcs12.o: ../include/openssl/x509_vfy.h apps.h
pkcs7.o: ../include/openssl/asn1.h ../include/openssl/bio.h
pkcs7.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
pkcs7.o: ../include/openssl/buffer.h ../include/openssl/cast.h
pkcs7.o: ../include/openssl/crypto.h ../include/openssl/des.h
pkcs7.o: ../include/openssl/dh.h ../include/openssl/dsa.h
pkcs7.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
pkcs7.o: ../include/openssl/err.h ../include/openssl/evp.h
pkcs7.o: ../include/openssl/idea.h ../include/openssl/md2.h
pkcs7.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
pkcs7.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
pkcs7.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
pkcs7.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
pkcs7.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
pkcs7.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
pkcs7.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
pkcs7.o: ../include/openssl/sha.h ../include/openssl/stack.h
pkcs7.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
pkcs8.o: ../include/openssl/asn1.h ../include/openssl/bio.h
pkcs8.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
pkcs8.o: ../include/openssl/buffer.h ../include/openssl/cast.h
pkcs8.o: ../include/openssl/crypto.h ../include/openssl/des.h
pkcs8.o: ../include/openssl/dh.h ../include/openssl/dsa.h
pkcs8.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
pkcs8.o: ../include/openssl/err.h ../include/openssl/evp.h
pkcs8.o: ../include/openssl/idea.h ../include/openssl/md2.h
pkcs8.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
pkcs8.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
pkcs8.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
pkcs8.o: ../include/openssl/pem2.h ../include/openssl/pkcs12.h
pkcs8.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
pkcs8.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
pkcs8.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
pkcs8.o: ../include/openssl/safestack.h ../include/openssl/sha.h
pkcs8.o: ../include/openssl/stack.h ../include/openssl/x509.h
pkcs8.o: ../include/openssl/x509_vfy.h apps.h
rand.o: ../include/openssl/asn1.h ../include/openssl/bio.h
rand.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
rand.o: ../include/openssl/buffer.h ../include/openssl/cast.h
rand.o: ../include/openssl/crypto.h ../include/openssl/des.h
rand.o: ../include/openssl/dh.h ../include/openssl/dsa.h
rand.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
rand.o: ../include/openssl/err.h ../include/openssl/evp.h
rand.o: ../include/openssl/idea.h ../include/openssl/md2.h
rand.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
rand.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
rand.o: ../include/openssl/opensslv.h ../include/openssl/pkcs7.h
rand.o: ../include/openssl/rand.h ../include/openssl/rc2.h
rand.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
rand.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
rand.o: ../include/openssl/safestack.h ../include/openssl/sha.h
rand.o: ../include/openssl/stack.h ../include/openssl/x509.h
rand.o: ../include/openssl/x509_vfy.h apps.h
req.o: ../include/openssl/asn1.h ../include/openssl/bio.h
req.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
req.o: ../include/openssl/buffer.h ../include/openssl/cast.h
req.o: ../include/openssl/conf.h ../include/openssl/crypto.h
req.o: ../include/openssl/des.h ../include/openssl/dh.h
req.o: ../include/openssl/dsa.h ../include/openssl/e_os.h
req.o: ../include/openssl/e_os2.h ../include/openssl/err.h
req.o: ../include/openssl/evp.h ../include/openssl/idea.h
req.o: ../include/openssl/lhash.h ../include/openssl/md2.h
req.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
req.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
req.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
req.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
req.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
req.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
req.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
req.o: ../include/openssl/sha.h ../include/openssl/stack.h
req.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
req.o: ../include/openssl/x509v3.h apps.h
rsa.o: ../include/openssl/asn1.h ../include/openssl/bio.h
rsa.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
rsa.o: ../include/openssl/buffer.h ../include/openssl/cast.h
rsa.o: ../include/openssl/crypto.h ../include/openssl/des.h
rsa.o: ../include/openssl/dh.h ../include/openssl/dsa.h
rsa.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
rsa.o: ../include/openssl/err.h ../include/openssl/evp.h
rsa.o: ../include/openssl/idea.h ../include/openssl/md2.h
rsa.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
rsa.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
rsa.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
rsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
rsa.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
rsa.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
rsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
rsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
rsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
s_cb.o: ../include/openssl/asn1.h ../include/openssl/bio.h
s_cb.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
s_cb.o: ../include/openssl/buffer.h ../include/openssl/cast.h
s_cb.o: ../include/openssl/crypto.h ../include/openssl/des.h
s_cb.o: ../include/openssl/dh.h ../include/openssl/dsa.h
s_cb.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
s_cb.o: ../include/openssl/err.h ../include/openssl/evp.h
s_cb.o: ../include/openssl/idea.h ../include/openssl/lhash.h
s_cb.o: ../include/openssl/md2.h ../include/openssl/md5.h
s_cb.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
s_cb.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s_cb.o: ../include/openssl/pem.h ../include/openssl/pem2.h
s_cb.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
s_cb.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
s_cb.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
s_cb.o: ../include/openssl/safestack.h ../include/openssl/sha.h
s_cb.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s_cb.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s_cb.o: ../include/openssl/stack.h ../include/openssl/tls1.h
s_cb.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h s_apps.h
s_client.o: ../include/openssl/asn1.h ../include/openssl/bio.h
s_client.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
s_client.o: ../include/openssl/buffer.h ../include/openssl/cast.h
s_client.o: ../include/openssl/crypto.h ../include/openssl/des.h
s_client.o: ../include/openssl/dh.h ../include/openssl/dsa.h
s_client.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
s_client.o: ../include/openssl/err.h ../include/openssl/evp.h
s_client.o: ../include/openssl/idea.h ../include/openssl/lhash.h
s_client.o: ../include/openssl/md2.h ../include/openssl/md5.h
s_client.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
s_client.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s_client.o: ../include/openssl/pem.h ../include/openssl/pem2.h
s_client.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
s_client.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
s_client.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
s_client.o: ../include/openssl/safestack.h ../include/openssl/sha.h
s_client.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s_client.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s_client.o: ../include/openssl/stack.h ../include/openssl/tls1.h
s_client.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
s_client.o: s_apps.h
s_server.o: ../include/openssl/asn1.h ../include/openssl/bio.h
s_server.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
s_server.o: ../include/openssl/buffer.h ../include/openssl/cast.h
s_server.o: ../include/openssl/crypto.h ../include/openssl/des.h
s_server.o: ../include/openssl/dh.h ../include/openssl/dsa.h
s_server.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
s_server.o: ../include/openssl/err.h ../include/openssl/evp.h
s_server.o: ../include/openssl/idea.h ../include/openssl/lhash.h
s_server.o: ../include/openssl/md2.h ../include/openssl/md5.h
s_server.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
s_server.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s_server.o: ../include/openssl/pem.h ../include/openssl/pem2.h
s_server.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
s_server.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
s_server.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
s_server.o: ../include/openssl/safestack.h ../include/openssl/sha.h
s_server.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s_server.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s_server.o: ../include/openssl/stack.h ../include/openssl/tls1.h
s_server.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
s_server.o: s_apps.h
s_socket.o: ../include/openssl/asn1.h ../include/openssl/bio.h
s_socket.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
s_socket.o: ../include/openssl/buffer.h ../include/openssl/cast.h
s_socket.o: ../include/openssl/crypto.h ../include/openssl/des.h
s_socket.o: ../include/openssl/dh.h ../include/openssl/dsa.h
s_socket.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
s_socket.o: ../include/openssl/evp.h ../include/openssl/idea.h
s_socket.o: ../include/openssl/lhash.h ../include/openssl/md2.h
s_socket.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
s_socket.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
s_socket.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
s_socket.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
s_socket.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
s_socket.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
s_socket.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
s_socket.o: ../include/openssl/sha.h ../include/openssl/ssl.h
s_socket.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
s_socket.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
s_socket.o: ../include/openssl/tls1.h ../include/openssl/x509.h
s_socket.o: ../include/openssl/x509_vfy.h apps.h s_apps.h
s_time.o: ../include/openssl/asn1.h ../include/openssl/bio.h
s_time.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
s_time.o: ../include/openssl/buffer.h ../include/openssl/cast.h
s_time.o: ../include/openssl/crypto.h ../include/openssl/des.h
s_time.o: ../include/openssl/dh.h ../include/openssl/dsa.h
s_time.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
s_time.o: ../include/openssl/err.h ../include/openssl/evp.h
s_time.o: ../include/openssl/idea.h ../include/openssl/lhash.h
s_time.o: ../include/openssl/md2.h ../include/openssl/md5.h
s_time.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
s_time.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s_time.o: ../include/openssl/pem.h ../include/openssl/pem2.h
s_time.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
s_time.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
s_time.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
s_time.o: ../include/openssl/safestack.h ../include/openssl/sha.h
s_time.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s_time.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s_time.o: ../include/openssl/stack.h ../include/openssl/tls1.h
s_time.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
s_time.o: s_apps.h
sess_id.o: ../include/openssl/asn1.h ../include/openssl/bio.h
sess_id.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
sess_id.o: ../include/openssl/buffer.h ../include/openssl/cast.h
sess_id.o: ../include/openssl/crypto.h ../include/openssl/des.h
sess_id.o: ../include/openssl/dh.h ../include/openssl/dsa.h
sess_id.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
sess_id.o: ../include/openssl/err.h ../include/openssl/evp.h
sess_id.o: ../include/openssl/idea.h ../include/openssl/lhash.h
sess_id.o: ../include/openssl/md2.h ../include/openssl/md5.h
sess_id.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
sess_id.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
sess_id.o: ../include/openssl/pem.h ../include/openssl/pem2.h
sess_id.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
sess_id.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
sess_id.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
sess_id.o: ../include/openssl/safestack.h ../include/openssl/sha.h
sess_id.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
sess_id.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
sess_id.o: ../include/openssl/stack.h ../include/openssl/tls1.h
sess_id.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
smime.o: ../include/openssl/asn1.h ../include/openssl/bio.h
smime.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
smime.o: ../include/openssl/buffer.h ../include/openssl/cast.h
smime.o: ../include/openssl/crypto.h ../include/openssl/des.h
smime.o: ../include/openssl/dh.h ../include/openssl/dsa.h
smime.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
smime.o: ../include/openssl/err.h ../include/openssl/evp.h
smime.o: ../include/openssl/idea.h ../include/openssl/md2.h
smime.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
smime.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
smime.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
smime.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
smime.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
smime.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
smime.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
smime.o: ../include/openssl/sha.h ../include/openssl/stack.h
smime.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
speed.o: ../include/openssl/asn1.h ../include/openssl/bio.h
speed.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
speed.o: ../include/openssl/buffer.h ../include/openssl/cast.h
speed.o: ../include/openssl/crypto.h ../include/openssl/des.h
speed.o: ../include/openssl/dh.h ../include/openssl/dsa.h
speed.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
speed.o: ../include/openssl/err.h ../include/openssl/evp.h
speed.o: ../include/openssl/hmac.h ../include/openssl/idea.h
speed.o: ../include/openssl/md2.h ../include/openssl/md5.h
speed.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
speed.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
speed.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
speed.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
speed.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
speed.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
speed.o: ../include/openssl/sha.h ../include/openssl/stack.h
speed.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ./testdsa.h
speed.o: ./testrsa.h apps.h
spkac.o: ../include/openssl/asn1.h ../include/openssl/bio.h
spkac.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
spkac.o: ../include/openssl/buffer.h ../include/openssl/cast.h
spkac.o: ../include/openssl/conf.h ../include/openssl/crypto.h
spkac.o: ../include/openssl/des.h ../include/openssl/dh.h
spkac.o: ../include/openssl/dsa.h ../include/openssl/e_os.h
spkac.o: ../include/openssl/e_os2.h ../include/openssl/err.h
spkac.o: ../include/openssl/evp.h ../include/openssl/idea.h
spkac.o: ../include/openssl/lhash.h ../include/openssl/md2.h
spkac.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
spkac.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
spkac.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
spkac.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
spkac.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
spkac.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
spkac.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
spkac.o: ../include/openssl/sha.h ../include/openssl/stack.h
spkac.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
verify.o: ../include/openssl/asn1.h ../include/openssl/bio.h
verify.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
verify.o: ../include/openssl/buffer.h ../include/openssl/cast.h
verify.o: ../include/openssl/conf.h ../include/openssl/crypto.h
verify.o: ../include/openssl/des.h ../include/openssl/dh.h
verify.o: ../include/openssl/dsa.h ../include/openssl/e_os.h
verify.o: ../include/openssl/e_os2.h ../include/openssl/err.h
verify.o: ../include/openssl/evp.h ../include/openssl/idea.h
verify.o: ../include/openssl/lhash.h ../include/openssl/md2.h
verify.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
verify.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
verify.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
verify.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
verify.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
verify.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
verify.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
verify.o: ../include/openssl/sha.h ../include/openssl/stack.h
verify.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
verify.o: ../include/openssl/x509v3.h apps.h
version.o: ../include/openssl/asn1.h ../include/openssl/bio.h
version.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
version.o: ../include/openssl/buffer.h ../include/openssl/cast.h
version.o: ../include/openssl/crypto.h ../include/openssl/des.h
version.o: ../include/openssl/dh.h ../include/openssl/dsa.h
version.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
version.o: ../include/openssl/evp.h ../include/openssl/idea.h
version.o: ../include/openssl/md2.h ../include/openssl/md5.h
version.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
version.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
version.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
version.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
version.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
version.o: ../include/openssl/safestack.h ../include/openssl/sha.h
version.o: ../include/openssl/stack.h ../include/openssl/x509.h
version.o: ../include/openssl/x509_vfy.h apps.h
x509.o: ../include/openssl/asn1.h ../include/openssl/bio.h
x509.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
x509.o: ../include/openssl/buffer.h ../include/openssl/cast.h
x509.o: ../include/openssl/conf.h ../include/openssl/crypto.h
x509.o: ../include/openssl/des.h ../include/openssl/dh.h
x509.o: ../include/openssl/dsa.h ../include/openssl/e_os.h
x509.o: ../include/openssl/e_os2.h ../include/openssl/err.h
x509.o: ../include/openssl/evp.h ../include/openssl/idea.h
x509.o: ../include/openssl/lhash.h ../include/openssl/md2.h
x509.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
x509.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
x509.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
x509.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
x509.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
x509.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
x509.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
x509.o: ../include/openssl/sha.h ../include/openssl/stack.h
x509.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
x509.o: ../include/openssl/x509v3.h apps.h

View File

@ -13,6 +13,7 @@ OPENSSLDIR= /usr/local/ssl
MAKE= make -f Makefile.ssl
MAKEDEPEND= $(TOP)/util/domd $(TOP)
MAKEFILE= Makefile.ssl
PERL=/usr/local/bin/perl
RM= rm -f
PEX_LIBS=
@ -33,11 +34,11 @@ SCRIPTS=CA.sh CA.pl der_chop
EXE= $(PROGRAM)
E_EXE= verify asn1pars req dgst dh enc gendh errstr ca crl \
rsa dsa dsaparam \
E_EXE= verify asn1pars req dgst dh dhparam enc passwd gendh errstr \
ca crl rsa dsa dsaparam \
x509 genrsa gendsa s_server s_client speed \
s_time version pkcs7 crl2pkcs7 sess_id ciphers nseq pkcs12 \
pkcs8
pkcs8 spkac smime rand
PROGS= $(PROGRAM).c
@ -45,24 +46,22 @@ A_OBJ=apps.o
A_SRC=apps.c
S_OBJ= s_cb.o s_socket.o
S_SRC= s_cb.c s_socket.c
RAND_OBJ=app_rand.o
RAND_SRC=app_rand.c
E_OBJ= verify.o asn1pars.o req.o dgst.o dh.o enc.o gendh.o errstr.o ca.o \
pkcs7.o crl2p7.o crl.o \
E_OBJ= verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o \
ca.o pkcs7.o crl2p7.o crl.o \
rsa.o dsa.o dsaparam.o \
x509.o genrsa.o gendsa.o s_server.o s_client.o speed.o \
s_time.o $(A_OBJ) $(S_OBJ) version.o sess_id.o \
ciphers.o nseq.o pkcs12.o pkcs8.o
s_time.o $(A_OBJ) $(S_OBJ) $(RAND_OBJ) version.o sess_id.o \
ciphers.o nseq.o pkcs12.o pkcs8.o spkac.o smime.o rand.o
# pem_mail.o
E_SRC= verify.c asn1pars.c req.c dgst.c dh.c enc.c gendh.c errstr.c ca.c \
E_SRC= verify.c asn1pars.c req.c dgst.c dh.c enc.c passwd.c gendh.c errstr.c ca.c \
pkcs7.c crl2p7.c crl.c \
rsa.c dsa.c dsaparam.c \
x509.c genrsa.c gendsa.c s_server.c s_client.c speed.c \
s_time.c $(A_SRC) $(S_SRC) version.c sess_id.c \
ciphers.c nseq.c pkcs12.c pkcs8.c
# pem_mail.c
s_time.c $(A_SRC) $(S_SRC) $(RAND_SRC) version.c sess_id.c \
ciphers.c nseq.c pkcs12.c pkcs8.c spkac.c smime.c rand.c
SRC=$(E_SRC)
@ -81,7 +80,7 @@ all: exe
exe: $(EXE)
req: sreq.o $(A_OBJ) $(DLIBCRYPTO)
$(CC) -o req $(CFLAG) sreq.o $(A_OBJ) $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(CC) -o req $(CFLAG) sreq.o $(A_OBJ) $(RAND_OBJ) $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
sreq.o: req.c
$(CC) -c $(INCLUDES) $(CFLAG) -o sreq.o req.c
@ -138,16 +137,44 @@ $(PROGRAM): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
$(CC) -o $(PROGRAM) $(CFLAGS) $(PROGRAM).o $(E_OBJ) $(PEX_LIBS) $(LIBSSL) $(LIBCRYPTO) $(EX_LIBS)
@(cd ..; OPENSSL="`pwd`/apps/openssl"; export OPENSSL; sh tools/c_rehash certs)
progs.h:
$(PERL) ./progs.pl $(E_EXE) >progs.h
progs.h: progs.pl
$(PERL) progs.pl $(E_EXE) >progs.h
$(RM) $(PROGRAM).o
# DO NOT DELETE THIS LINE -- make depend depends on it.
apps.o: ../include/openssl/bio.h ../include/openssl/buffer.h
apps.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
apps.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
apps.o: ../include/openssl/opensslv.h ../include/openssl/stack.h apps.h progs.h
app_rand.o: ../include/openssl/asn1.h ../include/openssl/bio.h
app_rand.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
app_rand.o: ../include/openssl/buffer.h ../include/openssl/cast.h
app_rand.o: ../include/openssl/crypto.h ../include/openssl/des.h
app_rand.o: ../include/openssl/dh.h ../include/openssl/dsa.h
app_rand.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
app_rand.o: ../include/openssl/evp.h ../include/openssl/idea.h
app_rand.o: ../include/openssl/md2.h ../include/openssl/md5.h
app_rand.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
app_rand.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
app_rand.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
app_rand.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
app_rand.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
app_rand.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
app_rand.o: ../include/openssl/sha.h ../include/openssl/stack.h
app_rand.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
apps.o: ../include/openssl/asn1.h ../include/openssl/bio.h
apps.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
apps.o: ../include/openssl/buffer.h ../include/openssl/cast.h
apps.o: ../include/openssl/crypto.h ../include/openssl/des.h
apps.o: ../include/openssl/dh.h ../include/openssl/dsa.h
apps.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
apps.o: ../include/openssl/evp.h ../include/openssl/idea.h
apps.o: ../include/openssl/md2.h ../include/openssl/md5.h
apps.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
apps.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
apps.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
apps.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
apps.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
apps.o: ../include/openssl/safestack.h ../include/openssl/sha.h
apps.o: ../include/openssl/stack.h ../include/openssl/x509.h
apps.o: ../include/openssl/x509_vfy.h apps.h
asn1pars.o: ../include/openssl/asn1.h ../include/openssl/bio.h
asn1pars.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
asn1pars.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -165,7 +192,6 @@ asn1pars.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
asn1pars.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
asn1pars.o: ../include/openssl/sha.h ../include/openssl/stack.h
asn1pars.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
asn1pars.o: progs.h
ca.o: ../include/openssl/asn1.h ../include/openssl/bio.h
ca.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
ca.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -184,7 +210,7 @@ ca.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
ca.o: ../include/openssl/safestack.h ../include/openssl/sha.h
ca.o: ../include/openssl/stack.h ../include/openssl/txt_db.h
ca.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
ca.o: ../include/openssl/x509v3.h apps.h progs.h
ca.o: ../include/openssl/x509v3.h apps.h
ciphers.o: ../include/openssl/asn1.h ../include/openssl/bio.h
ciphers.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
ciphers.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -205,7 +231,6 @@ ciphers.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
ciphers.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
ciphers.o: ../include/openssl/stack.h ../include/openssl/tls1.h
ciphers.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
ciphers.o: progs.h
crl.o: ../include/openssl/asn1.h ../include/openssl/bio.h
crl.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
crl.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -224,7 +249,7 @@ crl.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
crl.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
crl.o: ../include/openssl/sha.h ../include/openssl/stack.h
crl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
crl.o: ../include/openssl/x509v3.h apps.h progs.h
crl.o: ../include/openssl/x509v3.h apps.h
crl2p7.o: ../include/openssl/asn1.h ../include/openssl/bio.h
crl2p7.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
crl2p7.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -242,7 +267,6 @@ crl2p7.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
crl2p7.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
crl2p7.o: ../include/openssl/sha.h ../include/openssl/stack.h
crl2p7.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
crl2p7.o: progs.h
dgst.o: ../include/openssl/asn1.h ../include/openssl/bio.h
dgst.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
dgst.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -259,7 +283,7 @@ dgst.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
dgst.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
dgst.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
dgst.o: ../include/openssl/sha.h ../include/openssl/stack.h
dgst.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h progs.h
dgst.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
dh.o: ../include/openssl/asn1.h ../include/openssl/bio.h
dh.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
dh.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -276,7 +300,7 @@ dh.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
dh.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
dh.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
dh.o: ../include/openssl/sha.h ../include/openssl/stack.h
dh.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h progs.h
dh.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
dsa.o: ../include/openssl/asn1.h ../include/openssl/bio.h
dsa.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
dsa.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -293,7 +317,7 @@ dsa.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
dsa.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
dsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
dsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
dsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h progs.h
dsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
dsaparam.o: ../include/openssl/asn1.h ../include/openssl/bio.h
dsaparam.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
dsaparam.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -306,12 +330,11 @@ dsaparam.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
dsaparam.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
dsaparam.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
dsaparam.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
dsaparam.o: ../include/openssl/rand.h ../include/openssl/rc2.h
dsaparam.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
dsaparam.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
dsaparam.o: ../include/openssl/safestack.h ../include/openssl/sha.h
dsaparam.o: ../include/openssl/stack.h ../include/openssl/x509.h
dsaparam.o: ../include/openssl/x509_vfy.h apps.h progs.h
dsaparam.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
dsaparam.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
dsaparam.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
dsaparam.o: ../include/openssl/sha.h ../include/openssl/stack.h
dsaparam.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
enc.o: ../include/openssl/asn1.h ../include/openssl/bio.h
enc.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
enc.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -324,11 +347,12 @@ enc.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
enc.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
enc.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
enc.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
enc.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
enc.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
enc.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
enc.o: ../include/openssl/sha.h ../include/openssl/stack.h
enc.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h progs.h
enc.o: ../include/openssl/rand.h ../include/openssl/rc2.h
enc.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
enc.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
enc.o: ../include/openssl/safestack.h ../include/openssl/sha.h
enc.o: ../include/openssl/stack.h ../include/openssl/x509.h
enc.o: ../include/openssl/x509_vfy.h apps.h
errstr.o: ../include/openssl/asn1.h ../include/openssl/bio.h
errstr.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
errstr.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -349,7 +373,6 @@ errstr.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
errstr.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
errstr.o: ../include/openssl/stack.h ../include/openssl/tls1.h
errstr.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
errstr.o: progs.h
gendh.o: ../include/openssl/asn1.h ../include/openssl/bio.h
gendh.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
gendh.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -367,7 +390,7 @@ gendh.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
gendh.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
gendh.o: ../include/openssl/safestack.h ../include/openssl/sha.h
gendh.o: ../include/openssl/stack.h ../include/openssl/x509.h
gendh.o: ../include/openssl/x509_vfy.h apps.h progs.h
gendh.o: ../include/openssl/x509_vfy.h apps.h
gendsa.o: ../include/openssl/asn1.h ../include/openssl/bio.h
gendsa.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
gendsa.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -380,12 +403,11 @@ gendsa.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
gendsa.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
gendsa.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
gendsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
gendsa.o: ../include/openssl/rand.h ../include/openssl/rc2.h
gendsa.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
gendsa.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
gendsa.o: ../include/openssl/safestack.h ../include/openssl/sha.h
gendsa.o: ../include/openssl/stack.h ../include/openssl/x509.h
gendsa.o: ../include/openssl/x509_vfy.h apps.h progs.h
gendsa.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
gendsa.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
gendsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
gendsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
gendsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
genrsa.o: ../include/openssl/asn1.h ../include/openssl/bio.h
genrsa.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
genrsa.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -398,12 +420,11 @@ genrsa.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
genrsa.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
genrsa.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
genrsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
genrsa.o: ../include/openssl/rand.h ../include/openssl/rc2.h
genrsa.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
genrsa.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
genrsa.o: ../include/openssl/safestack.h ../include/openssl/sha.h
genrsa.o: ../include/openssl/stack.h ../include/openssl/x509.h
genrsa.o: ../include/openssl/x509_vfy.h apps.h progs.h
genrsa.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
genrsa.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
genrsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
genrsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
genrsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
nseq.o: ../include/openssl/asn1.h ../include/openssl/bio.h
nseq.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
nseq.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -420,7 +441,7 @@ nseq.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
nseq.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
nseq.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
nseq.o: ../include/openssl/sha.h ../include/openssl/stack.h
nseq.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h progs.h
nseq.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
openssl.o: ../include/openssl/asn1.h ../include/openssl/bio.h
openssl.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
openssl.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -442,6 +463,23 @@ openssl.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
openssl.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
openssl.o: ../include/openssl/tls1.h ../include/openssl/x509.h
openssl.o: ../include/openssl/x509_vfy.h apps.h progs.h s_apps.h
passwd.o: ../include/openssl/asn1.h ../include/openssl/bio.h
passwd.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
passwd.o: ../include/openssl/buffer.h ../include/openssl/cast.h
passwd.o: ../include/openssl/crypto.h ../include/openssl/des.h
passwd.o: ../include/openssl/dh.h ../include/openssl/dsa.h
passwd.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
passwd.o: ../include/openssl/err.h ../include/openssl/evp.h
passwd.o: ../include/openssl/idea.h ../include/openssl/md2.h
passwd.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
passwd.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
passwd.o: ../include/openssl/opensslv.h ../include/openssl/pkcs7.h
passwd.o: ../include/openssl/rand.h ../include/openssl/rc2.h
passwd.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
passwd.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
passwd.o: ../include/openssl/safestack.h ../include/openssl/sha.h
passwd.o: ../include/openssl/stack.h ../include/openssl/x509.h
passwd.o: ../include/openssl/x509_vfy.h apps.h
pkcs12.o: ../include/openssl/asn1.h ../include/openssl/bio.h
pkcs12.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
pkcs12.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -459,7 +497,7 @@ pkcs12.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
pkcs12.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
pkcs12.o: ../include/openssl/safestack.h ../include/openssl/sha.h
pkcs12.o: ../include/openssl/stack.h ../include/openssl/x509.h
pkcs12.o: ../include/openssl/x509_vfy.h apps.h progs.h
pkcs12.o: ../include/openssl/x509_vfy.h apps.h
pkcs7.o: ../include/openssl/asn1.h ../include/openssl/bio.h
pkcs7.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
pkcs7.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -476,7 +514,7 @@ pkcs7.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
pkcs7.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
pkcs7.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
pkcs7.o: ../include/openssl/sha.h ../include/openssl/stack.h
pkcs7.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h progs.h
pkcs7.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
pkcs8.o: ../include/openssl/asn1.h ../include/openssl/bio.h
pkcs8.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
pkcs8.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -494,7 +532,24 @@ pkcs8.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
pkcs8.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
pkcs8.o: ../include/openssl/safestack.h ../include/openssl/sha.h
pkcs8.o: ../include/openssl/stack.h ../include/openssl/x509.h
pkcs8.o: ../include/openssl/x509_vfy.h apps.h progs.h
pkcs8.o: ../include/openssl/x509_vfy.h apps.h
rand.o: ../include/openssl/asn1.h ../include/openssl/bio.h
rand.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
rand.o: ../include/openssl/buffer.h ../include/openssl/cast.h
rand.o: ../include/openssl/crypto.h ../include/openssl/des.h
rand.o: ../include/openssl/dh.h ../include/openssl/dsa.h
rand.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
rand.o: ../include/openssl/err.h ../include/openssl/evp.h
rand.o: ../include/openssl/idea.h ../include/openssl/md2.h
rand.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
rand.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
rand.o: ../include/openssl/opensslv.h ../include/openssl/pkcs7.h
rand.o: ../include/openssl/rand.h ../include/openssl/rc2.h
rand.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
rand.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
rand.o: ../include/openssl/safestack.h ../include/openssl/sha.h
rand.o: ../include/openssl/stack.h ../include/openssl/x509.h
rand.o: ../include/openssl/x509_vfy.h apps.h
req.o: ../include/openssl/asn1.h ../include/openssl/bio.h
req.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
req.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -508,12 +563,12 @@ req.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
req.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
req.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
req.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
req.o: ../include/openssl/rand.h ../include/openssl/rc2.h
req.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
req.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
req.o: ../include/openssl/safestack.h ../include/openssl/sha.h
req.o: ../include/openssl/stack.h ../include/openssl/x509.h
req.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h progs.h
req.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
req.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
req.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
req.o: ../include/openssl/sha.h ../include/openssl/stack.h
req.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
req.o: ../include/openssl/x509v3.h apps.h
rsa.o: ../include/openssl/asn1.h ../include/openssl/bio.h
rsa.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
rsa.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -530,7 +585,7 @@ rsa.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
rsa.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
rsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
rsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
rsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h progs.h
rsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
s_cb.o: ../include/openssl/asn1.h ../include/openssl/bio.h
s_cb.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
s_cb.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -550,8 +605,7 @@ s_cb.o: ../include/openssl/safestack.h ../include/openssl/sha.h
s_cb.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s_cb.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s_cb.o: ../include/openssl/stack.h ../include/openssl/tls1.h
s_cb.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h progs.h
s_cb.o: s_apps.h
s_cb.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h s_apps.h
s_client.o: ../include/openssl/asn1.h ../include/openssl/bio.h
s_client.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
s_client.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -572,7 +626,7 @@ s_client.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s_client.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s_client.o: ../include/openssl/stack.h ../include/openssl/tls1.h
s_client.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
s_client.o: progs.h s_apps.h
s_client.o: s_apps.h
s_server.o: ../include/openssl/asn1.h ../include/openssl/bio.h
s_server.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
s_server.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -593,7 +647,7 @@ s_server.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s_server.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s_server.o: ../include/openssl/stack.h ../include/openssl/tls1.h
s_server.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
s_server.o: progs.h s_apps.h
s_server.o: s_apps.h
s_socket.o: ../include/openssl/asn1.h ../include/openssl/bio.h
s_socket.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
s_socket.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -613,7 +667,7 @@ s_socket.o: ../include/openssl/sha.h ../include/openssl/ssl.h
s_socket.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
s_socket.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
s_socket.o: ../include/openssl/tls1.h ../include/openssl/x509.h
s_socket.o: ../include/openssl/x509_vfy.h apps.h progs.h s_apps.h
s_socket.o: ../include/openssl/x509_vfy.h apps.h s_apps.h
s_time.o: ../include/openssl/asn1.h ../include/openssl/bio.h
s_time.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
s_time.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -634,7 +688,7 @@ s_time.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s_time.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s_time.o: ../include/openssl/stack.h ../include/openssl/tls1.h
s_time.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
s_time.o: progs.h s_apps.h
s_time.o: s_apps.h
sess_id.o: ../include/openssl/asn1.h ../include/openssl/bio.h
sess_id.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
sess_id.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -655,7 +709,23 @@ sess_id.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
sess_id.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
sess_id.o: ../include/openssl/stack.h ../include/openssl/tls1.h
sess_id.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
sess_id.o: progs.h
smime.o: ../include/openssl/asn1.h ../include/openssl/bio.h
smime.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
smime.o: ../include/openssl/buffer.h ../include/openssl/cast.h
smime.o: ../include/openssl/crypto.h ../include/openssl/des.h
smime.o: ../include/openssl/dh.h ../include/openssl/dsa.h
smime.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
smime.o: ../include/openssl/err.h ../include/openssl/evp.h
smime.o: ../include/openssl/idea.h ../include/openssl/md2.h
smime.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
smime.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
smime.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
smime.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
smime.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
smime.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
smime.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
smime.o: ../include/openssl/sha.h ../include/openssl/stack.h
smime.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
speed.o: ../include/openssl/asn1.h ../include/openssl/bio.h
speed.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
speed.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -673,15 +743,34 @@ speed.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
speed.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
speed.o: ../include/openssl/sha.h ../include/openssl/stack.h
speed.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ./testdsa.h
speed.o: ./testrsa.h apps.h progs.h
speed.o: ./testrsa.h apps.h
spkac.o: ../include/openssl/asn1.h ../include/openssl/bio.h
spkac.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
spkac.o: ../include/openssl/buffer.h ../include/openssl/cast.h
spkac.o: ../include/openssl/conf.h ../include/openssl/crypto.h
spkac.o: ../include/openssl/des.h ../include/openssl/dh.h
spkac.o: ../include/openssl/dsa.h ../include/openssl/e_os.h
spkac.o: ../include/openssl/e_os2.h ../include/openssl/err.h
spkac.o: ../include/openssl/evp.h ../include/openssl/idea.h
spkac.o: ../include/openssl/lhash.h ../include/openssl/md2.h
spkac.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
spkac.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
spkac.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
spkac.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
spkac.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
spkac.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
spkac.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
spkac.o: ../include/openssl/sha.h ../include/openssl/stack.h
spkac.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
verify.o: ../include/openssl/asn1.h ../include/openssl/bio.h
verify.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
verify.o: ../include/openssl/buffer.h ../include/openssl/cast.h
verify.o: ../include/openssl/crypto.h ../include/openssl/des.h
verify.o: ../include/openssl/dh.h ../include/openssl/dsa.h
verify.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
verify.o: ../include/openssl/err.h ../include/openssl/evp.h
verify.o: ../include/openssl/idea.h ../include/openssl/md2.h
verify.o: ../include/openssl/conf.h ../include/openssl/crypto.h
verify.o: ../include/openssl/des.h ../include/openssl/dh.h
verify.o: ../include/openssl/dsa.h ../include/openssl/e_os.h
verify.o: ../include/openssl/e_os2.h ../include/openssl/err.h
verify.o: ../include/openssl/evp.h ../include/openssl/idea.h
verify.o: ../include/openssl/lhash.h ../include/openssl/md2.h
verify.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
verify.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
verify.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
@ -690,8 +779,8 @@ verify.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
verify.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
verify.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
verify.o: ../include/openssl/sha.h ../include/openssl/stack.h
verify.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
verify.o: progs.h
verify.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
verify.o: ../include/openssl/x509v3.h apps.h
version.o: ../include/openssl/asn1.h ../include/openssl/bio.h
version.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
version.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -702,10 +791,12 @@ version.o: ../include/openssl/evp.h ../include/openssl/idea.h
version.o: ../include/openssl/md2.h ../include/openssl/md5.h
version.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
version.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
version.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
version.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
version.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
version.o: ../include/openssl/sha.h ../include/openssl/stack.h apps.h progs.h
version.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
version.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
version.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
version.o: ../include/openssl/safestack.h ../include/openssl/sha.h
version.o: ../include/openssl/stack.h ../include/openssl/x509.h
version.o: ../include/openssl/x509_vfy.h apps.h
x509.o: ../include/openssl/asn1.h ../include/openssl/bio.h
x509.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
x509.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@ -724,4 +815,4 @@ x509.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
x509.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
x509.o: ../include/openssl/sha.h ../include/openssl/stack.h
x509.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
x509.o: ../include/openssl/x509v3.h apps.h progs.h
x509.o: ../include/openssl/x509v3.h apps.h

View File

@ -0,0 +1,213 @@
/* apps/app_rand.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
/* ====================================================================
* Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core@openssl.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#define NON_MAIN
#include "apps.h"
#undef NON_MAIN
#include <openssl/bio.h>
#include <openssl/rand.h>
static int seeded = 0;
static int egdsocket = 0;
int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn)
{
int consider_randfile = (file == NULL);
char buffer[200];
#ifdef WINDOWS
BIO_printf(bio_e,"Loading 'screen' into random state -");
BIO_flush(bio_e);
RAND_screen();
BIO_printf(bio_e," done\n");
#endif
if (file == NULL)
file = RAND_file_name(buffer, sizeof buffer);
else if (RAND_egd(file) > 0)
{
/* we try if the given filename is an EGD socket.
if it is, we don't write anything back to the file. */
egdsocket = 1;
return 1;
}
if (file == NULL || !RAND_load_file(file, -1))
{
if (RAND_status() == 0 && !dont_warn)
{
BIO_printf(bio_e,"unable to load 'random state'\n");
BIO_printf(bio_e,"This means that the random number generator has not been seeded\n");
BIO_printf(bio_e,"with much random data.\n");
if (consider_randfile) /* explanation does not apply when a file is explicitly named */
{
BIO_printf(bio_e,"Consider setting the RANDFILE environment variable to point at a file that\n");
BIO_printf(bio_e,"'random' data can be kept in (the file will be overwritten).\n");
}
}
return 0;
}
seeded = 1;
return 1;
}
long app_RAND_load_files(char *name)
{
char *p,*n;
int last;
long tot=0;
int egd;
for (;;)
{
last=0;
for (p=name; ((*p != '\0') && (*p != LIST_SEPARATOR_CHAR)); p++);
if (*p == '\0') last=1;
*p='\0';
n=name;
name=p+1;
if (*n == '\0') break;
egd=RAND_egd(n);
if (egd > 0) tot+=egd;
tot+=RAND_load_file(n,-1);
if (last) break;
}
if (tot > 512)
app_RAND_allow_write_file();
return(tot);
}
int app_RAND_write_file(const char *file, BIO *bio_e)
{
char buffer[200];
if (egdsocket || !seeded)
/* If we did not manage to read the seed file,
* we should not write a low-entropy seed file back --
* it would suppress a crucial warning the next time
* we want to use it. */
return 0;
if (file == NULL)
file = RAND_file_name(buffer, sizeof buffer);
if (file == NULL || !RAND_write_file(file))
{
BIO_printf(bio_e,"unable to write 'random state'\n");
return 0;
}
return 1;
}
void app_RAND_allow_write_file(void)
{
seeded = 1;
}

View File

@ -324,3 +324,93 @@ int app_init(long mesgwin)
return(1);
}
#endif
int dump_cert_text (BIO *out, X509 *x)
{
char buf[256];
X509_NAME_oneline(X509_get_subject_name(x),buf,256);
BIO_puts(out,"subject=");
BIO_puts(out,buf);
X509_NAME_oneline(X509_get_issuer_name(x),buf,256);
BIO_puts(out,"\nissuer= ");
BIO_puts(out,buf);
BIO_puts(out,"\n");
return 0;
}
static char *app_get_pass(BIO *err, char *arg, int keepbio);
int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2)
{
int same;
if(!arg2 || !arg1 || strcmp(arg1, arg2)) same = 0;
else same = 1;
if(arg1) {
*pass1 = app_get_pass(err, arg1, same);
if(!*pass1) return 0;
} else if(pass1) *pass1 = NULL;
if(arg2) {
*pass2 = app_get_pass(err, arg2, same ? 2 : 0);
if(!*pass2) return 0;
} else if(pass2) *pass2 = NULL;
return 1;
}
static char *app_get_pass(BIO *err, char *arg, int keepbio)
{
char *tmp, tpass[APP_PASS_LEN];
static BIO *pwdbio = NULL;
int i;
if(!strncmp(arg, "pass:", 5)) return BUF_strdup(arg + 5);
if(!strncmp(arg, "env:", 4)) {
tmp = getenv(arg + 4);
if(!tmp) {
BIO_printf(err, "Can't read environment variable %s\n", arg + 4);
return NULL;
}
return BUF_strdup(tmp);
}
if(!keepbio || !pwdbio) {
if(!strncmp(arg, "file:", 5)) {
pwdbio = BIO_new_file(arg + 5, "r");
if(!pwdbio) {
BIO_printf(err, "Can't open file %s\n", arg + 5);
return NULL;
}
} else if(!strncmp(arg, "fd:", 3)) {
BIO *btmp;
i = atoi(arg + 3);
if(i >= 0) pwdbio = BIO_new_fd(i, BIO_NOCLOSE);
if((i < 0) || !pwdbio) {
BIO_printf(err, "Can't access file descriptor %s\n", arg + 3);
return NULL;
}
/* Can't do BIO_gets on an fd BIO so add a buffering BIO */
btmp = BIO_new(BIO_f_buffer());
pwdbio = BIO_push(btmp, pwdbio);
} else if(!strcmp(arg, "stdin")) {
pwdbio = BIO_new_fp(stdin, BIO_NOCLOSE);
if(!pwdbio) {
BIO_printf(err, "Can't open BIO for stdin\n");
return NULL;
}
} else {
BIO_printf(err, "Invalid password argument \"%s\"\n", arg);
return NULL;
}
}
i = BIO_gets(pwdbio, tpass, APP_PASS_LEN);
if(keepbio != 1) {
BIO_free_all(pwdbio);
pwdbio = NULL;
}
if(i <= 0) {
BIO_printf(err, "Error reading password from BIO\n");
return NULL;
}
tmp = strchr(tpass, '\n');
if(tmp) *tmp = 0;
return BUF_strdup(tpass);
}

View File

@ -64,7 +64,17 @@
#include <openssl/buffer.h>
#include <openssl/bio.h>
#include <openssl/crypto.h>
#include "progs.h"
#include <openssl/x509.h>
int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn);
int app_RAND_write_file(const char *file, BIO *bio_e);
/* When `file' is NULL, use defaults.
* `bio_e' is for error messages. */
void app_RAND_allow_write_file(void);
long app_RAND_load_files(char *file); /* `file' is a list of files to read,
* separated by LIST_SEPARATOR_CHAR
* (see e_os.h). The string is
* destroyed! */
#ifdef NO_STDIO
BIO_METHOD *BIO_s_file();
@ -103,7 +113,7 @@ extern BIO *bio_err;
#define do_pipe_sig()
#endif
#if defined(MONOLITH) && !defined(SSLEAY)
#if defined(MONOLITH) && !defined(OPENSSL_C)
# define apps_startup() do_pipe_sig()
#else
# if defined(MSDOS) || defined(WIN16) || defined(WIN32)
@ -132,10 +142,16 @@ int args_from_file(char *file, int *argc, char **argv[]);
int str2fmt(char *s);
void program_name(char *in,char *out,int size);
int chopup_args(ARGS *arg,char *buf, int *argc, char **argv[]);
#ifdef HEADER_X509_H
int dump_cert_text(BIO *out, X509 *x);
#endif
int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2);
#define FORMAT_UNDEF 0
#define FORMAT_ASN1 1
#define FORMAT_TEXT 2
#define FORMAT_PEM 3
#define FORMAT_NETSCAPE 4
#define APP_PASS_LEN 1024
#endif

View File

@ -74,19 +74,21 @@
* -i - indent the details by depth
* -offset - where in the file to start
* -length - how many bytes to use
* -oid file - extra oid decription file
* -oid file - extra oid description file
*/
#undef PROG
#define PROG asn1parse_main
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
int i,badops=0,offset=0,ret=1,j;
unsigned int length=0;
long num,tmplen;
BIO *in=NULL,*out=NULL,*b64=NULL, *derout = NULL;
int informat,indent=0;
int informat,indent=0, noout = 0;
char *infile=NULL,*str=NULL,*prog,*oidfile=NULL, *derfile=NULL;
unsigned char *tmpbuf;
BUF_MEM *buf=NULL;
@ -130,6 +132,7 @@ int MAIN(int argc, char **argv)
{
indent=1;
}
else if (strcmp(*argv,"-noout") == 0) noout = 1;
else if (strcmp(*argv,"-oid") == 0)
{
if (--argc < 1) goto bad;
@ -168,8 +171,10 @@ int MAIN(int argc, char **argv)
BIO_printf(bio_err,"where options are\n");
BIO_printf(bio_err," -inform arg input format - one of DER TXT PEM\n");
BIO_printf(bio_err," -in arg input file\n");
BIO_printf(bio_err," -out arg output file\n");
BIO_printf(bio_err," -noout arg don't produce any output\n");
BIO_printf(bio_err," -offset arg offset into file\n");
BIO_printf(bio_err," -length arg lenth of section in file\n");
BIO_printf(bio_err," -length arg length of section in file\n");
BIO_printf(bio_err," -i indent entries\n");
BIO_printf(bio_err," -oid file file of extra oid definitions\n");
BIO_printf(bio_err," -strparse offset\n");
@ -287,7 +292,8 @@ int MAIN(int argc, char **argv)
goto end;
}
}
if (!ASN1_parse(out,(unsigned char *)&(str[offset]),length,indent))
if (!noout &&
!ASN1_parse(out,(unsigned char *)&(str[offset]),length,indent))
{
ERR_print_errors(bio_err);
goto end;

View File

@ -147,6 +147,8 @@ static char *ca_usage[]={
" -gencrl - Generate a new CRL\n",
" -crldays days - Days is when the next CRL is due\n",
" -crlhours hours - Hours is when the next CRL is due\n",
" -startdate YYMMDDHHMMSSZ - certificate validity notBefore\n",
" -enddate YYMMDDHHMMSSZ - certificate validity notAfter (overrides -days)\n",
" -days arg - number of days to certify the certificate for\n",
" -md arg - md to use, one of md2, md5, sha or sha1\n",
" -policy arg - The CA 'policy' to support\n",
@ -163,6 +165,8 @@ static char *ca_usage[]={
" -batch - Don't ask questions\n",
" -msie_hack - msie modifications to handle all those universal strings\n",
" -revoke file - Revoke a certificate (given in file)\n",
" -extensions .. - Extension section (override value in config file)\n",
" -crlexts .. - CRL extension section (override value in config file)\n",
NULL
};
@ -174,7 +178,6 @@ extern int EF_ALIGNMENT;
static int add_oid_section(LHASH *conf);
static void lookup_fail(char *name,char *tag);
static int MS_CALLBACK key_callback(char *buf,int len,int verify,void *u);
static unsigned long index_serial_hash(char **a);
static int index_serial_cmp(char **a, char **b);
static unsigned long index_name_hash(char **a);
@ -197,22 +200,24 @@ static int certify_spkac(X509 **xret, char *infile,EVP_PKEY *pkey,X509 *x509,
char *enddate, int days, char *ext_sect,LHASH *conf,
int verbose);
static int fix_data(int nid, int *type);
static void write_new_certificate(BIO *bp, X509 *x, int output_der);
static void write_new_certificate(BIO *bp, X509 *x, int output_der, int notext);
static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
STACK_OF(CONF_VALUE) *policy, TXT_DB *db, BIGNUM *serial,
char *startdate, char *enddate, int days, int batch, int verbose,
X509_REQ *req, char *ext_sect, LHASH *conf);
static int do_revoke(X509 *x509, TXT_DB *db);
static int check_time_format(char *str);
static LHASH *conf;
static char *key=NULL;
static LHASH *conf=NULL;
static char *section=NULL;
static int preserve=0;
static int msie_hack=0;
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
char *key=NULL;
int total=0;
int total_done=0;
int badops=0;
@ -244,6 +249,7 @@ int MAIN(int argc, char **argv)
char *enddate=NULL;
int days=0;
int batch=0;
int notext=0;
X509 *x509=NULL;
X509 *x=NULL;
BIO *in=NULL,*out=NULL,*Sout=NULL,*Cout=NULL;
@ -262,6 +268,7 @@ int MAIN(int argc, char **argv)
#undef BSIZE
#define BSIZE 256
MS_STATIC char buf[3][BSIZE];
char *randfile=NULL;
#ifdef EFENCE
EF_PROTECT_FREE=1;
@ -271,9 +278,12 @@ EF_ALIGNMENT=0;
apps_startup();
X509V3_add_standard_extensions();
conf = NULL;
key = NULL;
section = NULL;
preserve=0;
msie_hack=0;
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
@ -350,6 +360,8 @@ EF_ALIGNMENT=0;
if (--argc < 1) goto bad;
outdir= *(++argv);
}
else if (strcmp(*argv,"-notext") == 0)
notext=1;
else if (strcmp(*argv,"-batch") == 0)
batch=1;
else if (strcmp(*argv,"-preserveDN") == 0)
@ -393,6 +405,16 @@ EF_ALIGNMENT=0;
infile= *(++argv);
dorevoke=1;
}
else if (strcmp(*argv,"-extensions") == 0)
{
if (--argc < 1) goto bad;
extensions= *(++argv);
}
else if (strcmp(*argv,"-crlexts") == 0)
{
if (--argc < 1) goto bad;
crl_ext= *(++argv);
}
else
{
bad:
@ -476,12 +498,16 @@ EF_ALIGNMENT=0;
BIO_free(oid_bio);
}
}
}
if(!add_oid_section(conf)) {
if(!add_oid_section(conf))
{
ERR_print_errors(bio_err);
goto err;
}
}
randfile = CONF_get_string(conf, BASE_SECTION, "RANDFILE");
app_RAND_load_file(randfile, bio_err, 0);
in=BIO_new(BIO_s_file());
out=BIO_new(BIO_s_file());
Sout=BIO_new(BIO_s_file());
@ -493,7 +519,7 @@ EF_ALIGNMENT=0;
}
/*****************************************************************/
/* we definitly need an public key, so lets get it */
/* we definitely need an public key, so lets get it */
if ((keyfile == NULL) && ((keyfile=CONF_get_string(conf,
section,ENV_PRIVATE_KEY)) == NULL))
@ -507,13 +533,8 @@ EF_ALIGNMENT=0;
BIO_printf(bio_err,"trying to load CA private key\n");
goto err;
}
if (key == NULL)
pkey=PEM_read_bio_PrivateKey(in,NULL,NULL,NULL);
else
{
pkey=PEM_read_bio_PrivateKey(in,NULL,key_callback,NULL);
memset(key,0,strlen(key));
}
pkey=PEM_read_bio_PrivateKey(in,NULL,NULL,key);
if(key) memset(key,0,strlen(key));
if (pkey == NULL)
{
BIO_printf(bio_err,"unable to load CA private key\n");
@ -566,14 +587,19 @@ EF_ALIGNMENT=0;
BIO_printf(bio_err,"there needs to be defined a directory for new certificate to be placed in\n");
goto err;
}
#ifdef VMS
/* For technical reasons, VMS misbehaves with X_OK */
if (access(outdir,R_OK|W_OK) != 0)
#else
#ifndef VMS /* outdir is a directory spec, but access() for VMS demands a
filename. In any case, stat(), below, will catch the problem
if outdir is not a directory spec, and the fopen() or open()
will catch an error if there is no write access.
Presumably, this problem could also be solved by using the DEC
C routines to convert the directory syntax to Unixly, and give
that to access(). However, time's too short to do that just
now.
*/
if (access(outdir,R_OK|W_OK|X_OK) != 0)
#endif
{
BIO_printf(bio_err,"I am unable to acces the %s directory\n",outdir);
BIO_printf(bio_err,"I am unable to access the %s directory\n",outdir);
perror(outdir);
goto err;
}
@ -584,12 +610,15 @@ EF_ALIGNMENT=0;
perror(outdir);
goto err;
}
#ifdef S_IFDIR
if (!(sb.st_mode & S_IFDIR))
{
BIO_printf(bio_err,"%s need to be a directory\n",outdir);
perror(outdir);
goto err;
}
#endif
#endif
}
/*****************************************************************/
@ -655,7 +684,7 @@ EF_ALIGNMENT=0;
TXT_DB_write(out,db);
BIO_printf(bio_err,"%d entries loaded from the database\n",
db->data->num);
BIO_printf(bio_err,"generating indexs\n");
BIO_printf(bio_err,"generating index\n");
}
if (!TXT_DB_create_index(db,DB_serial,NULL,index_serial_hash,
@ -720,8 +749,8 @@ EF_ALIGNMENT=0;
lookup_fail(section,ENV_SERIAL);
goto err;
}
extensions=CONF_get_string(conf,section,ENV_EXTENSIONS);
if(!extensions)
extensions=CONF_get_string(conf,section,ENV_EXTENSIONS);
if(extensions) {
/* Check syntax of file */
X509V3_CTX ctx;
@ -966,8 +995,8 @@ EF_ALIGNMENT=0;
perror(buf[2]);
goto err;
}
write_new_certificate(Cout,x, 0);
write_new_certificate(Sout,x, output_der);
write_new_certificate(Cout,x, 0, notext);
write_new_certificate(Sout,x, output_der, notext);
}
if (sk_num(cert_sk))
@ -987,14 +1016,14 @@ EF_ALIGNMENT=0;
out=NULL;
if (rename(serialfile,buf[2]) < 0)
{
BIO_printf(bio_err,"unabel to rename %s to %s\n",
BIO_printf(bio_err,"unable to rename %s to %s\n",
serialfile,buf[2]);
perror("reason");
goto err;
}
if (rename(buf[0],serialfile) < 0)
{
BIO_printf(bio_err,"unabel to rename %s to %s\n",
BIO_printf(bio_err,"unable to rename %s to %s\n",
buf[0],serialfile);
perror("reason");
rename(buf[2],serialfile);
@ -1011,14 +1040,14 @@ EF_ALIGNMENT=0;
if (rename(dbfile,buf[2]) < 0)
{
BIO_printf(bio_err,"unabel to rename %s to %s\n",
BIO_printf(bio_err,"unable to rename %s to %s\n",
dbfile,buf[2]);
perror("reason");
goto err;
}
if (rename(buf[1],dbfile) < 0)
{
BIO_printf(bio_err,"unabel to rename %s to %s\n",
BIO_printf(bio_err,"unable to rename %s to %s\n",
buf[1],dbfile);
perror("reason");
rename(buf[2],dbfile);
@ -1031,7 +1060,7 @@ EF_ALIGNMENT=0;
/*****************************************************************/
if (gencrl)
{
crl_ext=CONF_get_string(conf,section,ENV_CRLEXT);
if(!crl_ext) crl_ext=CONF_get_string(conf,section,ENV_CRLEXT);
if(crl_ext) {
/* Check syntax of file */
X509V3_CTX ctx;
@ -1143,13 +1172,6 @@ EF_ALIGNMENT=0;
/*****************************************************************/
if (dorevoke)
{
in=BIO_new(BIO_s_file());
out=BIO_new(BIO_s_file());
if ((in == NULL) || (out == NULL))
{
ERR_print_errors(bio_err);
goto err;
}
if (infile == NULL)
{
BIO_printf(bio_err,"no input files\n");
@ -1157,19 +1179,22 @@ EF_ALIGNMENT=0;
}
else
{
X509 *revcert;
if (BIO_read_filename(in,infile) <= 0)
{
perror(infile);
BIO_printf(bio_err,"error trying to load '%s' certificate\n",infile);
goto err;
}
x509=PEM_read_bio_X509(in,NULL,NULL,NULL);
if (x509 == NULL)
revcert=PEM_read_bio_X509(in,NULL,NULL,NULL);
if (revcert == NULL)
{
BIO_printf(bio_err,"unable to load '%s' certificate\n",infile);
goto err;
}
j=do_revoke(x509,db);
j=do_revoke(revcert,db);
if (j <= 0) goto err;
X509_free(revcert);
strncpy(buf[0],dbfile,BSIZE-4);
strcat(buf[0],".new");
@ -1181,10 +1206,6 @@ EF_ALIGNMENT=0;
}
j=TXT_DB_write(out,db);
if (j <= 0) goto err;
BIO_free(in);
BIO_free(out);
in=NULL;
out=NULL;
strncpy(buf[1],dbfile,BSIZE-4);
strcat(buf[1],".old");
if (rename(dbfile,buf[1]) < 0)
@ -1215,13 +1236,13 @@ EF_ALIGNMENT=0;
sk_pop_free(cert_sk,X509_free);
if (ret) ERR_print_errors(bio_err);
app_RAND_write_file(randfile, bio_err);
BN_free(serial);
TXT_DB_free(db);
EVP_PKEY_free(pkey);
X509_free(x509);
X509_CRL_free(crl);
CONF_free(conf);
X509V3_EXT_cleanup();
OBJ_cleanup();
EXIT(ret);
}
@ -1231,17 +1252,6 @@ static void lookup_fail(char *name, char *tag)
BIO_printf(bio_err,"variable lookup failed for %s::%s\n",name,tag);
}
static int MS_CALLBACK key_callback(char *buf, int len, int verify, void *u)
{
int i;
if (key == NULL) return(0);
i=strlen(key);
i=(i > len)?len:i;
memcpy(buf,key,i);
return(i);
}
static unsigned long index_serial_hash(char **a)
{
char *n;
@ -1652,7 +1662,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
}
if (j < 0)
{
BIO_printf(bio_err,"The %s field needed to be the same in the\nCA certificate (%s) and the request (%s)\n",cv->name,((str == NULL)?"NULL":(char *)str->data),((str2 == NULL)?"NULL":(char *)str2->data));
BIO_printf(bio_err,"The %s field needed to be the same in the\nCA certificate (%s) and the request (%s)\n",cv->name,((str2 == NULL)?"NULL":(char *)str2->data),((str == NULL)?"NULL":(char *)str->data));
goto err;
}
}
@ -1664,8 +1674,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
if (push != NULL)
{
if (!X509_NAME_add_entry(subject,push,
X509_NAME_entry_count(subject),0))
if (!X509_NAME_add_entry(subject,push, -1, 0))
{
if (push != NULL)
X509_NAME_ENTRY_free(push);
@ -1685,7 +1694,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
}
if (verbose)
BIO_printf(bio_err,"The subject name apears to be ok, checking data base for clashes\n");
BIO_printf(bio_err,"The subject name appears to be ok, checking data base for clashes\n");
row[DB_name]=X509_NAME_oneline(subject,NULL,0);
row[DB_serial]=BN_bn2hex(serial);
@ -1742,7 +1751,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
goto err;
}
/* We are now totaly happy, lets make and sign the certificate */
/* We are now totally happy, lets make and sign the certificate */
if (verbose)
BIO_printf(bio_err,"Everything appears to be ok, creating and signing the certificate\n");
@ -1789,7 +1798,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
ASN1_INTEGER_set(ci->version,2); /* version 3 certificate */
/* Free the current entries if any, there should not
* be any I belive */
* be any I believe */
if (ci->extensions != NULL)
sk_X509_EXTENSION_pop_free(ci->extensions,
X509_EXTENSION_free);
@ -1883,6 +1892,8 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
X509_NAME_free(CAname);
if (subject != NULL)
X509_NAME_free(subject);
if (tmptm != NULL)
ASN1_UTCTIME_free(tmptm);
if (ok <= 0)
{
if (ret != NULL) X509_free(ret);
@ -1893,17 +1904,16 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
return(ok);
}
static void write_new_certificate(BIO *bp, X509 *x, int output_der)
static void write_new_certificate(BIO *bp, X509 *x, int output_der, int notext)
{
char *f;
char buf[256];
if (output_der)
{
(void)i2d_X509_bio(bp,x);
return;
}
#if 0
/* ??? Not needed since X509_print prints all this stuff anyway */
f=X509_NAME_oneline(X509_get_issuer_name(x),buf,256);
BIO_printf(bp,"issuer :%s\n",f);
@ -1913,10 +1923,9 @@ static void write_new_certificate(BIO *bp, X509 *x, int output_der)
BIO_puts(bp,"serial :");
i2a_ASN1_INTEGER(bp,x->cert_info->serialNumber);
BIO_puts(bp,"\n\n");
X509_print(bp,x);
BIO_puts(bp,"\n");
#endif
if(!notext)X509_print(bp,x);
PEM_write_bio_X509(bp,x);
BIO_puts(bp,"\n");
}
static int certify_spkac(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
@ -1929,7 +1938,6 @@ static int certify_spkac(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
X509_REQ *req=NULL;
CONF_VALUE *cv=NULL;
NETSCAPE_SPKI *spki = NULL;
unsigned char *spki_der = NULL,*p;
X509_REQ_INFO *ri;
char *type,*buf;
EVP_PKEY *pktmp=NULL;
@ -1986,31 +1994,22 @@ static int certify_spkac(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
cv=sk_CONF_VALUE_value(sk,i);
type=cv->name;
buf=cv->value;
/* Skip past any leading X. X: X, etc to allow for
* multiple instances
*/
for(buf = cv->name; *buf ; buf++)
if ((*buf == ':') || (*buf == ',') || (*buf == '.')) {
buf++;
if(*buf) type = buf;
break;
}
buf=cv->value;
if ((nid=OBJ_txt2nid(type)) == NID_undef)
{
if (strcmp(type, "SPKAC") == 0)
{
spki_der=(unsigned char *)Malloc(
strlen(cv->value)+1);
if (spki_der == NULL)
{
BIO_printf(bio_err,"Malloc failure\n");
goto err;
}
j = EVP_DecodeBlock(spki_der, (unsigned char *)cv->value,
strlen(cv->value));
if (j <= 0)
{
BIO_printf(bio_err, "Can't b64 decode SPKAC structure\n");
goto err;
}
p=spki_der;
spki = d2i_NETSCAPE_SPKI(&spki, &p, j);
Free(spki_der);
spki_der = NULL;
spki = NETSCAPE_SPKI_b64_decode(cv->value, -1);
if (spki == NULL)
{
BIO_printf(bio_err,"unable to load Netscape SPKAC structure\n");
@ -2034,8 +2033,7 @@ static int certify_spkac(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
strlen(buf))) == NULL)
goto err;
if (!X509_NAME_add_entry(n,ne,X509_NAME_entry_count(n),0))
goto err;
if (!X509_NAME_add_entry(n,ne,-1, 0)) goto err;
}
if (spki == NULL)
{
@ -2050,7 +2048,7 @@ static int certify_spkac(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
BIO_printf(bio_err,"Check that the SPKAC request matches the signature\n");
if ((pktmp=X509_PUBKEY_get(spki->spkac->pubkey)) == NULL)
if ((pktmp=NETSCAPE_SPKI_get_pubkey(spki)) == NULL)
{
BIO_printf(bio_err,"error unpacking SPKAC public key\n");
goto err;
@ -2071,7 +2069,6 @@ static int certify_spkac(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
err:
if (req != NULL) X509_REQ_free(req);
if (parms != NULL) CONF_free(parms);
if (spki_der != NULL) Free(spki_der);
if (spki != NULL) NETSCAPE_SPKI_free(spki);
if (ne != NULL) X509_NAME_ENTRY_free(ne);
@ -2127,20 +2124,26 @@ static int add_oid_section(LHASH *hconf)
static int do_revoke(X509 *x509, TXT_DB *db)
{
ASN1_UTCTIME *tm=NULL;
ASN1_UTCTIME *tm=NULL, *revtm=NULL;
char *row[DB_NUMBER],**rrow,**irow;
BIGNUM *bn = NULL;
int ok=-1,i;
for (i=0; i<DB_NUMBER; i++)
row[i]=NULL;
row[DB_name]=X509_NAME_oneline(x509->cert_info->subject,NULL,0);
row[DB_serial]=BN_bn2hex(ASN1_INTEGER_to_BN(x509->cert_info->serialNumber,NULL));
row[DB_name]=X509_NAME_oneline(X509_get_subject_name(x509),NULL,0);
bn = ASN1_INTEGER_to_BN(X509_get_serialNumber(x509),NULL);
row[DB_serial]=BN_bn2hex(bn);
BN_free(bn);
if ((row[DB_name] == NULL) || (row[DB_serial] == NULL))
{
BIO_printf(bio_err,"Malloc failure\n");
goto err;
}
rrow=TXT_DB_get_by_index(db,DB_name,row);
/* We have to lookup by serial number because name lookup
* skips revoked certs
*/
rrow=TXT_DB_get_by_index(db,DB_serial,row);
if (rrow == NULL)
{
BIO_printf(bio_err,"Adding Entry to DB for %s\n", row[DB_name]);
@ -2191,16 +2194,15 @@ static int do_revoke(X509 *x509, TXT_DB *db)
}
/* Revoke Certificate */
do_revoke(x509,db);
ok = do_revoke(x509,db);
ok=1;
goto err;
}
else if (index_serial_cmp(row,rrow))
else if (index_name_cmp(row,rrow))
{
BIO_printf(bio_err,"ERROR:no same serial number %s\n",
row[DB_serial]);
BIO_printf(bio_err,"ERROR:name does not match %s\n",
row[DB_name]);
goto err;
}
else if (rrow[DB_type][0]=='R')
@ -2212,12 +2214,14 @@ static int do_revoke(X509 *x509, TXT_DB *db)
else
{
BIO_printf(bio_err,"Revoking Certificate %s.\n", rrow[DB_serial]);
tm=X509_gmtime_adj(tm,0);
revtm = ASN1_UTCTIME_new();
revtm=X509_gmtime_adj(revtm,0);
rrow[DB_type][0]='R';
rrow[DB_type][1]='\0';
rrow[DB_rev_date]=(char *)Malloc(tm->length+1);
memcpy(rrow[DB_rev_date],tm->data,tm->length);
rrow[DB_rev_date][tm->length]='\0';
rrow[DB_rev_date]=(char *)Malloc(revtm->length+1);
memcpy(rrow[DB_rev_date],revtm->data,revtm->length);
rrow[DB_rev_date][revtm->length]='\0';
ASN1_UTCTIME_free(revtm);
}
ok=1;
err:
@ -2226,7 +2230,6 @@ static int do_revoke(X509 *x509, TXT_DB *db)
if (row[i] != NULL)
Free(row[i]);
}
ASN1_UTCTIME_free(tm);
return(ok);
}

View File

@ -66,10 +66,6 @@
#include <openssl/err.h>
#include <openssl/ssl.h>
#if defined(NO_RSA) && !defined(NO_SSL2)
#define NO_SSL2
#endif
#undef PROG
#define PROG ciphers_main
@ -81,6 +77,8 @@ static char *ciphers_usage[]={
NULL
};
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
int ret=1,i;
@ -145,12 +143,16 @@ int MAIN(int argc, char **argv)
goto end;
}
SSLeay_add_ssl_algorithms();
OpenSSL_add_ssl_algorithms();
ctx=SSL_CTX_new(meth);
if (ctx == NULL) goto err;
if (ciphers != NULL)
SSL_CTX_set_cipher_list(ctx,ciphers);
if (ciphers != NULL) {
if(!SSL_CTX_set_cipher_list(ctx,ciphers)) {
BIO_printf(bio_err, "Error in cipher list\n");
goto err;
}
}
ssl=SSL_new(ctx);
if (ssl == NULL) goto err;

View File

@ -75,7 +75,7 @@
static char *crl_usage[]={
"usage: crl args\n",
"\n",
" -inform arg - input format - default PEM (one of DER, TXT or PEM)\n",
" -inform arg - input format - default PEM (DER or PEM)\n",
" -outform arg - output format - default PEM\n",
" -text - print out a text format version\n",
" -in arg - input file - default stdin\n",
@ -85,21 +85,32 @@ static char *crl_usage[]={
" -lastupdate - lastUpdate field\n",
" -nextupdate - nextUpdate field\n",
" -noout - no CRL output\n",
" -CAfile name - verify CRL using certificates in file \"name\"\n",
" -CApath dir - verify CRL using certificates in \"dir\"\n",
NULL
};
static X509_CRL *load_crl(char *file, int format);
static BIO *bio_out=NULL;
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
X509_CRL *x=NULL;
char *CAfile = NULL, *CApath = NULL;
int ret=1,i,num,badops=0;
BIO *out=NULL;
int informat,outformat;
char *infile=NULL,*outfile=NULL;
int hash=0,issuer=0,lastupdate=0,nextupdate=0,noout=0,text=0;
char **pp,buf[256];
X509_STORE *store = NULL;
X509_STORE_CTX ctx;
X509_LOOKUP *lookup = NULL;
X509_OBJECT xobj;
EVP_PKEY *pkey;
int do_ver = 0;
apps_startup();
@ -146,6 +157,20 @@ int MAIN(int argc, char **argv)
if (--argc < 1) goto bad;
outfile= *(++argv);
}
else if (strcmp(*argv,"-CApath") == 0)
{
if (--argc < 1) goto bad;
CApath = *(++argv);
do_ver = 1;
}
else if (strcmp(*argv,"-CAfile") == 0)
{
if (--argc < 1) goto bad;
CAfile = *(++argv);
do_ver = 1;
}
else if (strcmp(*argv,"-verify") == 0)
do_ver = 1;
else if (strcmp(*argv,"-text") == 0)
text = 1;
else if (strcmp(*argv,"-hash") == 0)
@ -177,36 +202,74 @@ int MAIN(int argc, char **argv)
}
ERR_load_crypto_strings();
X509V3_add_standard_extensions();
x=load_crl(infile,informat);
if (x == NULL) { goto end; }
if(do_ver) {
store = X509_STORE_new();
lookup=X509_STORE_add_lookup(store,X509_LOOKUP_file());
if (lookup == NULL) goto end;
if (!X509_LOOKUP_load_file(lookup,CAfile,X509_FILETYPE_PEM))
X509_LOOKUP_load_file(lookup,NULL,X509_FILETYPE_DEFAULT);
lookup=X509_STORE_add_lookup(store,X509_LOOKUP_hash_dir());
if (lookup == NULL) goto end;
if (!X509_LOOKUP_add_dir(lookup,CApath,X509_FILETYPE_PEM))
X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT);
ERR_clear_error();
X509_STORE_CTX_init(&ctx, store, NULL, NULL);
i = X509_STORE_get_by_subject(&ctx, X509_LU_X509,
X509_CRL_get_issuer(x), &xobj);
if(i <= 0) {
BIO_printf(bio_err,
"Error getting CRL issuer certificate\n");
goto end;
}
pkey = X509_get_pubkey(xobj.data.x509);
X509_OBJECT_free_contents(&xobj);
if(!pkey) {
BIO_printf(bio_err,
"Error getting CRL issuer public key\n");
goto end;
}
i = X509_CRL_verify(x, pkey);
EVP_PKEY_free(pkey);
if(i < 0) goto end;
if(i == 0) BIO_printf(bio_err, "verify failure\n");
else BIO_printf(bio_err, "verify OK\n");
}
if (num)
{
for (i=1; i<=num; i++)
{
if (issuer == i)
{
X509_NAME_oneline(x->crl->issuer,buf,256);
X509_NAME_oneline(X509_CRL_get_issuer(x),
buf,256);
BIO_printf(bio_out,"issuer= %s\n",buf);
}
if (hash == i)
{
BIO_printf(bio_out,"%08lx\n",
X509_NAME_hash(x->crl->issuer));
X509_NAME_hash(X509_CRL_get_issuer(x)));
}
if (lastupdate == i)
{
BIO_printf(bio_out,"lastUpdate=");
ASN1_TIME_print(bio_out,x->crl->lastUpdate);
ASN1_TIME_print(bio_out,
X509_CRL_get_lastUpdate(x));
BIO_printf(bio_out,"\n");
}
if (nextupdate == i)
{
BIO_printf(bio_out,"nextUpdate=");
if (x->crl->nextUpdate != NULL)
ASN1_TIME_print(bio_out,x->crl->nextUpdate);
if (X509_CRL_get_nextUpdate(x))
ASN1_TIME_print(bio_out,
X509_CRL_get_nextUpdate(x));
else
BIO_printf(bio_out,"NONE");
BIO_printf(bio_out,"\n");
@ -250,8 +313,12 @@ int MAIN(int argc, char **argv)
end:
BIO_free(out);
BIO_free(bio_out);
bio_out=NULL;
X509_CRL_free(x);
X509V3_EXT_cleanup();
if(store) {
X509_STORE_CTX_cleanup(&ctx);
X509_STORE_free(store);
}
EXIT(ret);
}

View File

@ -76,12 +76,14 @@ static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile);
#undef PROG
#define PROG crl2pkcs7_main
/* -inform arg - input format - default PEM (one of DER, TXT or PEM)
/* -inform arg - input format - default PEM (DER or PEM)
* -outform arg - output format - default PEM
* -in arg - input file - default stdin
* -out arg - output file - default stdout
*/
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
int i,badops=0;
@ -157,8 +159,8 @@ int MAIN(int argc, char **argv)
bad:
BIO_printf(bio_err,"%s [options] <infile >outfile\n",prog);
BIO_printf(bio_err,"where options are\n");
BIO_printf(bio_err," -inform arg input format - one of DER TXT PEM\n");
BIO_printf(bio_err," -outform arg output format - one of DER TXT PEM\n");
BIO_printf(bio_err," -inform arg input format - DER or PEM\n");
BIO_printf(bio_err," -outform arg output format - DER or PEM\n");
BIO_printf(bio_err," -in arg input file\n");
BIO_printf(bio_err," -out arg output file\n");
BIO_printf(bio_err," -certfile arg certificates file of chain to a trusted CA\n");

View File

@ -1,4 +1,4 @@
#!/usr/local/bin/perl5
#!/usr/local/bin/perl
#
# der_chop ... this is one total hack that Eric is really not proud of
# so don't look at it and don't ask for support

View File

@ -74,6 +74,9 @@
#define PROG dgst_main
void do_fp(unsigned char *buf,BIO *f,int sep);
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
unsigned char *buf=NULL;

View File

@ -1,4 +1,5 @@
/* apps/dh.c */
/* obsoleted by dhparam.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -72,7 +73,7 @@
#undef PROG
#define PROG dh_main
/* -inform arg - input format - default PEM (one of DER, TXT or PEM)
/* -inform arg - input format - default PEM (DER or PEM)
* -outform arg - output format - default PEM
* -in arg - input file - default stdin
* -out arg - output file - default stdout
@ -82,6 +83,8 @@
* -C
*/
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
DH *dh=NULL;
@ -149,8 +152,8 @@ int MAIN(int argc, char **argv)
bad:
BIO_printf(bio_err,"%s [options] <infile >outfile\n",prog);
BIO_printf(bio_err,"where options are\n");
BIO_printf(bio_err," -inform arg input format - one of DER TXT PEM\n");
BIO_printf(bio_err," -outform arg output format - one of DER TXT PEM\n");
BIO_printf(bio_err," -inform arg input format - one of DER PEM\n");
BIO_printf(bio_err," -outform arg output format - one of DER PEM\n");
BIO_printf(bio_err," -in arg input file\n");
BIO_printf(bio_err," -out arg output file\n");
BIO_printf(bio_err," -check check the DH parameters\n");
@ -219,7 +222,7 @@ int MAIN(int argc, char **argv)
BN_print(stdout,dh->g);
printf("\n");
if (dh->length != 0)
printf("recomented private length=%ld\n",dh->length);
printf("recommended private length=%ld\n",dh->length);
#endif
}
@ -232,8 +235,8 @@ int MAIN(int argc, char **argv)
}
if (i & DH_CHECK_P_NOT_PRIME)
printf("p value is not prime\n");
if (i & DH_CHECK_P_NOT_STRONG_PRIME)
printf("p value is not a strong prime\n");
if (i & DH_CHECK_P_NOT_SAFE_PRIME)
printf("p value is not a safe prime\n");
if (i & DH_UNABLE_TO_CHECK_GENERATOR)
printf("unable to check the generator value\n");
if (i & DH_NOT_SUITABLE_GENERATOR)
@ -282,6 +285,7 @@ int MAIN(int argc, char **argv)
printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n");
printf("\t\treturn(NULL);\n");
printf("\treturn(dh);\n\t}\n");
Free(data);
}
@ -297,7 +301,7 @@ int MAIN(int argc, char **argv)
}
if (!i)
{
BIO_printf(bio_err,"unable to write DH paramaters\n");
BIO_printf(bio_err,"unable to write DH parameters\n");
ERR_print_errors(bio_err);
goto end;
}

View File

@ -0,0 +1,520 @@
/* apps/dhparam.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
/* ====================================================================
* Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core@openssl.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#ifndef NO_DH
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include "apps.h"
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/bn.h>
#include <openssl/dh.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#ifndef NO_DSA
#include <openssl/dsa.h>
#endif
#undef PROG
#define PROG dhparam_main
#define DEFBITS 512
/* -inform arg - input format - default PEM (DER or PEM)
* -outform arg - output format - default PEM
* -in arg - input file - default stdin
* -out arg - output file - default stdout
* -dsaparam - read or generate DSA parameters, convert to DH
* -check - check the parameters are ok
* -noout
* -text
* -C
*/
static void MS_CALLBACK dh_cb(int p, int n, void *arg);
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
DH *dh=NULL;
int i,badops=0,text=0;
#ifndef NO_DSA
int dsaparam=0;
#endif
BIO *in=NULL,*out=NULL;
int informat,outformat,check=0,noout=0,C=0,ret=1;
char *infile,*outfile,*prog;
char *inrand=NULL;
int num = 0, g = 0;
apps_startup();
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
infile=NULL;
outfile=NULL;
informat=FORMAT_PEM;
outformat=FORMAT_PEM;
prog=argv[0];
argc--;
argv++;
while (argc >= 1)
{
if (strcmp(*argv,"-inform") == 0)
{
if (--argc < 1) goto bad;
informat=str2fmt(*(++argv));
}
else if (strcmp(*argv,"-outform") == 0)
{
if (--argc < 1) goto bad;
outformat=str2fmt(*(++argv));
}
else if (strcmp(*argv,"-in") == 0)
{
if (--argc < 1) goto bad;
infile= *(++argv);
}
else if (strcmp(*argv,"-out") == 0)
{
if (--argc < 1) goto bad;
outfile= *(++argv);
}
else if (strcmp(*argv,"-check") == 0)
check=1;
else if (strcmp(*argv,"-text") == 0)
text=1;
#ifndef NO_DSA
else if (strcmp(*argv,"-dsaparam") == 0)
dsaparam=1;
#endif
else if (strcmp(*argv,"-C") == 0)
C=1;
else if (strcmp(*argv,"-noout") == 0)
noout=1;
else if (strcmp(*argv,"-2") == 0)
g=2;
else if (strcmp(*argv,"-5") == 0)
g=5;
else if (strcmp(*argv,"-rand") == 0)
{
if (--argc < 1) goto bad;
inrand= *(++argv);
}
else if (((sscanf(*argv,"%d",&num) == 0) || (num <= 0)))
goto bad;
argv++;
argc--;
}
if (badops)
{
bad:
BIO_printf(bio_err,"%s [options] [numbits]\n",prog);
BIO_printf(bio_err,"where options are\n");
BIO_printf(bio_err," -inform arg input format - one of DER PEM\n");
BIO_printf(bio_err," -outform arg output format - one of DER PEM\n");
BIO_printf(bio_err," -in arg input file\n");
BIO_printf(bio_err," -out arg output file\n");
#ifndef NO_DSA
BIO_printf(bio_err," -dsaparam read or generate DSA parameters, convert to DH\n");
#endif
BIO_printf(bio_err," -check check the DH parameters\n");
BIO_printf(bio_err," -text print a text form of the DH parameters\n");
BIO_printf(bio_err," -C Output C code\n");
BIO_printf(bio_err," -2 generate parameters using 2 as the generator value\n");
BIO_printf(bio_err," -5 generate parameters using 5 as the generator value\n");
BIO_printf(bio_err," numbits number of bits in to generate (default 512)\n");
BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
BIO_printf(bio_err," - load the file (or the files in the directory) into\n");
BIO_printf(bio_err," the random number generator\n");
BIO_printf(bio_err," -noout no output\n");
goto end;
}
ERR_load_crypto_strings();
if (g && !num)
num = DEFBITS;
#ifndef NO_DSA
if (dsaparam)
{
if (g)
{
BIO_printf(bio_err, "generator may not be chosen for DSA parameters\n");
goto end;
}
}
else
#endif
{
/* DH parameters */
if (num && !g)
g = 2;
}
if(num) {
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL)
{
BIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\n");
}
if (inrand != NULL)
BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
app_RAND_load_files(inrand));
#ifndef NO_DSA
if (dsaparam)
{
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);
if (dsa == NULL)
{
ERR_print_errors(bio_err);
goto end;
}
dh = DSA_dup_DH(dsa);
DSA_free(dsa);
if (dh == NULL)
{
ERR_print_errors(bio_err);
goto end;
}
}
else
#endif
{
BIO_printf(bio_err,"Generating DH parameters, %d bit long safe prime, generator %d\n",num,g);
BIO_printf(bio_err,"This is going to take a long time\n");
dh=DH_generate_parameters(num,g,dh_cb,bio_err);
if (dh == NULL)
{
ERR_print_errors(bio_err);
goto end;
}
}
app_RAND_write_file(NULL, bio_err);
} else {
in=BIO_new(BIO_s_file());
if (in == NULL)
{
ERR_print_errors(bio_err);
goto end;
}
if (infile == NULL)
BIO_set_fp(in,stdin,BIO_NOCLOSE);
else
{
if (BIO_read_filename(in,infile) <= 0)
{
perror(infile);
goto end;
}
}
if (informat != FORMAT_ASN1 && informat != FORMAT_PEM)
{
BIO_printf(bio_err,"bad input format specified\n");
goto end;
}
#ifndef NO_DSA
if (dsaparam)
{
DSA *dsa;
if (informat == FORMAT_ASN1)
dsa=d2i_DSAparams_bio(in,NULL);
else /* informat == FORMAT_PEM */
dsa=PEM_read_bio_DSAparams(in,NULL,NULL,NULL);
if (dsa == NULL)
{
BIO_printf(bio_err,"unable to load DSA parameters\n");
ERR_print_errors(bio_err);
goto end;
}
dh = DSA_dup_DH(dsa);
DSA_free(dsa);
if (dh == NULL)
{
ERR_print_errors(bio_err);
goto end;
}
}
else
#endif
{
if (informat == FORMAT_ASN1)
dh=d2i_DHparams_bio(in,NULL);
else /* informat == FORMAT_PEM */
dh=PEM_read_bio_DHparams(in,NULL,NULL,NULL);
if (dh == NULL)
{
BIO_printf(bio_err,"unable to load DH parameters\n");
ERR_print_errors(bio_err);
goto end;
}
}
/* dh != NULL */
}
out=BIO_new(BIO_s_file());
if (out == NULL)
{
ERR_print_errors(bio_err);
goto end;
}
if (outfile == NULL)
BIO_set_fp(out,stdout,BIO_NOCLOSE);
else
{
if (BIO_write_filename(out,outfile) <= 0)
{
perror(outfile);
goto end;
}
}
if (text)
{
DHparams_print(out,dh);
}
if (check)
{
if (!DH_check(dh,&i))
{
ERR_print_errors(bio_err);
goto end;
}
if (i & DH_CHECK_P_NOT_PRIME)
printf("p value is not prime\n");
if (i & DH_CHECK_P_NOT_SAFE_PRIME)
printf("p value is not a safe prime\n");
if (i & DH_UNABLE_TO_CHECK_GENERATOR)
printf("unable to check the generator value\n");
if (i & DH_NOT_SUITABLE_GENERATOR)
printf("the g value is not a generator\n");
if (i == 0)
printf("DH parameters appear to be ok.\n");
}
if (C)
{
unsigned char *data;
int len,l,bits;
len=BN_num_bytes(dh->p);
bits=BN_num_bits(dh->p);
data=(unsigned char *)Malloc(len);
if (data == NULL)
{
perror("Malloc");
goto end;
}
printf("#ifndef HEADER_DH_H\n"
"#include <openssl/dh.h>\n"
"#endif\n");
printf("DH *get_dh%d()\n\t{\n",bits);
l=BN_bn2bin(dh->p,data);
printf("\tstatic unsigned char dh%d_p[]={",bits);
for (i=0; i<l; i++)
{
if ((i%12) == 0) printf("\n\t\t");
printf("0x%02X,",data[i]);
}
printf("\n\t\t};\n");
l=BN_bn2bin(dh->g,data);
printf("\tstatic unsigned char dh%d_g[]={",bits);
for (i=0; i<l; i++)
{
if ((i%12) == 0) printf("\n\t\t");
printf("0x%02X,",data[i]);
}
printf("\n\t\t};\n");
printf("\tDH *dh;\n\n");
printf("\tif ((dh=DH_new()) == NULL) return(NULL);\n");
printf("\tdh->p=BN_bin2bn(dh%d_p,sizeof(dh%d_p),NULL);\n",
bits,bits);
printf("\tdh->g=BN_bin2bn(dh%d_g,sizeof(dh%d_g),NULL);\n",
bits,bits);
printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n");
printf("\t\t{ DH_free(dh); return(NULL); }\n");
if (dh->length)
printf("\tdh->length = %d;\n", dh->length);
printf("\treturn(dh);\n\t}\n");
Free(data);
}
if (!noout)
{
if (outformat == FORMAT_ASN1)
i=i2d_DHparams_bio(out,dh);
else if (outformat == FORMAT_PEM)
i=PEM_write_bio_DHparams(out,dh);
else {
BIO_printf(bio_err,"bad output format specified for outfile\n");
goto end;
}
if (!i)
{
BIO_printf(bio_err,"unable to write DH parameters\n");
ERR_print_errors(bio_err);
goto end;
}
}
ret=0;
end:
if (in != NULL) BIO_free(in);
if (out != NULL) BIO_free(out);
if (dh != NULL) DH_free(dh);
EXIT(ret);
}
/* dh_cb is identical to dsa_cb in apps/dsaparam.c */
static void MS_CALLBACK dh_cb(int p, int n, void *arg)
{
char c='*';
if (p == 0) c='.';
if (p == 1) c='+';
if (p == 2) c='*';
if (p == 3) c='\n';
BIO_write((BIO *)arg,&c,1);
(void)BIO_flush((BIO *)arg);
#ifdef LINT
p=n;
#endif
}
#endif

View File

@ -83,6 +83,8 @@
* -modulus - print the DSA public key
*/
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
int ret=1;
@ -91,7 +93,10 @@ int MAIN(int argc, char **argv)
const EVP_CIPHER *enc=NULL;
BIO *in=NULL,*out=NULL;
int informat,outformat,text=0,noout=0;
int pubin = 0, pubout = 0;
char *infile,*outfile,*prog;
char *passargin = NULL, *passargout = NULL;
char *passin = NULL, *passout = NULL;
int modulus=0;
apps_startup();
@ -130,12 +135,26 @@ int MAIN(int argc, char **argv)
if (--argc < 1) goto bad;
outfile= *(++argv);
}
else if (strcmp(*argv,"-passin") == 0)
{
if (--argc < 1) goto bad;
passargin= *(++argv);
}
else if (strcmp(*argv,"-passout") == 0)
{
if (--argc < 1) goto bad;
passargout= *(++argv);
}
else if (strcmp(*argv,"-noout") == 0)
noout=1;
else if (strcmp(*argv,"-text") == 0)
text=1;
else if (strcmp(*argv,"-modulus") == 0)
modulus=1;
else if (strcmp(*argv,"-pubin") == 0)
pubin=1;
else if (strcmp(*argv,"-pubout") == 0)
pubout=1;
else if ((enc=EVP_get_cipherbyname(&(argv[0][1]))) == NULL)
{
BIO_printf(bio_err,"unknown option %s\n",*argv);
@ -151,23 +170,30 @@ int MAIN(int argc, char **argv)
bad:
BIO_printf(bio_err,"%s [options] <infile >outfile\n",prog);
BIO_printf(bio_err,"where options are\n");
BIO_printf(bio_err," -inform arg input format - one of DER NET PEM\n");
BIO_printf(bio_err," -outform arg output format - one of DER NET PEM\n");
BIO_printf(bio_err," -in arg input file\n");
BIO_printf(bio_err," -out arg output file\n");
BIO_printf(bio_err," -des encrypt PEM output with cbc des\n");
BIO_printf(bio_err," -des3 encrypt PEM output with ede cbc des using 168 bit key\n");
BIO_printf(bio_err," -inform arg input format - DER or PEM\n");
BIO_printf(bio_err," -outform arg output format - DER or PEM\n");
BIO_printf(bio_err," -in arg input file\n");
BIO_printf(bio_err," -passin arg input file pass phrase source\n");
BIO_printf(bio_err," -out arg output file\n");
BIO_printf(bio_err," -passout arg output file pass phrase source\n");
BIO_printf(bio_err," -des encrypt PEM output with cbc des\n");
BIO_printf(bio_err," -des3 encrypt PEM output with ede cbc des using 168 bit key\n");
#ifndef NO_IDEA
BIO_printf(bio_err," -idea encrypt PEM output with cbc idea\n");
BIO_printf(bio_err," -idea encrypt PEM output with cbc idea\n");
#endif
BIO_printf(bio_err," -text print the key in text\n");
BIO_printf(bio_err," -noout don't print key out\n");
BIO_printf(bio_err," -modulus print the DSA public value\n");
BIO_printf(bio_err," -text print the key in text\n");
BIO_printf(bio_err," -noout don't print key out\n");
BIO_printf(bio_err," -modulus print the DSA public value\n");
goto end;
}
ERR_load_crypto_strings();
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
BIO_printf(bio_err, "Error getting passwords\n");
goto end;
}
in=BIO_new(BIO_s_file());
out=BIO_new(BIO_s_file());
if ((in == NULL) || (out == NULL))
@ -187,19 +213,21 @@ int MAIN(int argc, char **argv)
}
}
BIO_printf(bio_err,"read DSA private key\n");
if (informat == FORMAT_ASN1)
dsa=d2i_DSAPrivateKey_bio(in,NULL);
else if (informat == FORMAT_PEM)
dsa=PEM_read_bio_DSAPrivateKey(in,NULL,NULL,NULL);
else
BIO_printf(bio_err,"read DSA key\n");
if (informat == FORMAT_ASN1) {
if(pubin) dsa=d2i_DSA_PUBKEY_bio(in,NULL);
else dsa=d2i_DSAPrivateKey_bio(in,NULL);
} else if (informat == FORMAT_PEM) {
if(pubin) dsa=PEM_read_bio_DSA_PUBKEY(in,NULL, NULL, NULL);
else dsa=PEM_read_bio_DSAPrivateKey(in,NULL,NULL,passin);
} else
{
BIO_printf(bio_err,"bad input format specified for key\n");
goto end;
}
if (dsa == NULL)
{
BIO_printf(bio_err,"unable to load Private Key\n");
BIO_printf(bio_err,"unable to load Key\n");
ERR_print_errors(bio_err);
goto end;
}
@ -231,12 +259,16 @@ int MAIN(int argc, char **argv)
}
if (noout) goto end;
BIO_printf(bio_err,"writing DSA private key\n");
if (outformat == FORMAT_ASN1)
i=i2d_DSAPrivateKey_bio(out,dsa);
else if (outformat == FORMAT_PEM)
i=PEM_write_bio_DSAPrivateKey(out,dsa,enc,NULL,0,NULL,NULL);
else {
BIO_printf(bio_err,"writing DSA key\n");
if (outformat == FORMAT_ASN1) {
if(pubin || pubout) i=i2d_DSA_PUBKEY_bio(out,dsa);
else i=i2d_DSAPrivateKey_bio(out,dsa);
} else if (outformat == FORMAT_PEM) {
if(pubin || pubout)
i=PEM_write_bio_DSA_PUBKEY(out,dsa);
else i=PEM_write_bio_DSAPrivateKey(out,dsa,enc,
NULL,0,NULL, passout);
} else {
BIO_printf(bio_err,"bad output format specified for outfile\n");
goto end;
}
@ -248,9 +280,11 @@ int MAIN(int argc, char **argv)
else
ret=0;
end:
if (in != NULL) BIO_free(in);
if (out != NULL) BIO_free(out);
if (dsa != NULL) DSA_free(dsa);
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);
EXIT(ret);
}
#endif

View File

@ -57,6 +57,7 @@
*/
#ifndef NO_DSA
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
@ -65,7 +66,6 @@
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/bn.h>
#include <openssl/rand.h>
#include <openssl/dsa.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
@ -73,7 +73,7 @@
#undef PROG
#define PROG dsaparam_main
/* -inform arg - input format - default PEM (one of DER, TXT or PEM)
/* -inform arg - input format - default PEM (DER or PEM)
* -outform arg - output format - default PEM
* -in arg - input file - default stdin
* -out arg - output file - default stdout
@ -84,7 +84,10 @@
* -genkey
*/
static void MS_CALLBACK dsa_cb(int p, int n, char *arg);
static void MS_CALLBACK dsa_cb(int p, int n, void *arg);
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
DSA *dsa=NULL;
@ -93,7 +96,7 @@ int MAIN(int argc, char **argv)
int informat,outformat,noout=0,C=0,ret=1;
char *infile,*outfile,*prog,*inrand=NULL;
int numbits= -1,num,genkey=0;
char buffer[200],*randfile=NULL;
int need_rand=0;
apps_startup();
@ -136,11 +139,15 @@ int MAIN(int argc, char **argv)
else if (strcmp(*argv,"-C") == 0)
C=1;
else if (strcmp(*argv,"-genkey") == 0)
{
genkey=1;
need_rand=1;
}
else if (strcmp(*argv,"-rand") == 0)
{
if (--argc < 1) goto bad;
inrand= *(++argv);
need_rand=1;
}
else if (strcmp(*argv,"-noout") == 0)
noout=1;
@ -148,6 +155,7 @@ int MAIN(int argc, char **argv)
{
/* generate a key */
numbits=num;
need_rand=1;
}
else
{
@ -164,11 +172,11 @@ int MAIN(int argc, char **argv)
bad:
BIO_printf(bio_err,"%s [options] [bits] <infile >outfile\n",prog);
BIO_printf(bio_err,"where options are\n");
BIO_printf(bio_err," -inform arg input format - one of DER TXT PEM\n");
BIO_printf(bio_err," -outform arg output format - one of DER TXT PEM\n");
BIO_printf(bio_err," -inform arg input format - DER or PEM\n");
BIO_printf(bio_err," -outform arg output format - DER or PEM\n");
BIO_printf(bio_err," -in arg input file\n");
BIO_printf(bio_err," -out arg output file\n");
BIO_printf(bio_err," -text check the DSA parameters\n");
BIO_printf(bio_err," -text print the key in text\n");
BIO_printf(bio_err," -C Output C code\n");
BIO_printf(bio_err," -noout no output\n");
BIO_printf(bio_err," -rand files to use for random number input\n");
@ -207,15 +215,20 @@ int MAIN(int argc, char **argv)
}
}
if (need_rand)
{
app_RAND_load_file(NULL, bio_err, (inrand != NULL));
if (inrand != NULL)
BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
app_RAND_load_files(inrand));
}
if (numbits > 0)
{
randfile=RAND_file_name(buffer,200);
RAND_load_file(randfile,1024L*1024L);
assert(need_rand);
BIO_printf(bio_err,"Generating DSA parameters, %d bit long prime\n",num);
BIO_printf(bio_err,"This could take some time\n");
dsa=DSA_generate_parameters(num,NULL,0,NULL,NULL,
dsa_cb,(char *)bio_err);
dsa=DSA_generate_parameters(num,NULL,0,NULL,NULL, dsa_cb,bio_err);
}
else if (informat == FORMAT_ASN1)
dsa=d2i_DSAparams_bio(in,NULL);
@ -307,7 +320,7 @@ int MAIN(int argc, char **argv)
}
if (!i)
{
BIO_printf(bio_err,"unable to write DSA paramaters\n");
BIO_printf(bio_err,"unable to write DSA parameters\n");
ERR_print_errors(bio_err);
goto end;
}
@ -316,6 +329,7 @@ int MAIN(int argc, char **argv)
{
DSA *dsakey;
assert(need_rand);
if ((dsakey=DSAparams_dup(dsa)) == NULL) goto end;
if (!DSA_generate_key(dsakey)) goto end;
if (outformat == FORMAT_ASN1)
@ -328,6 +342,8 @@ int MAIN(int argc, char **argv)
}
DSA_free(dsakey);
}
if (need_rand)
app_RAND_write_file(NULL, bio_err);
ret=0;
end:
if (in != NULL) BIO_free(in);
@ -336,7 +352,7 @@ int MAIN(int argc, char **argv)
EXIT(ret);
}
static void MS_CALLBACK dsa_cb(int p, int n, char *arg)
static void MS_CALLBACK dsa_cb(int p, int n, void *arg)
{
char c='*';
@ -344,8 +360,8 @@ static void MS_CALLBACK dsa_cb(int p, int n, char *arg)
if (p == 1) c='+';
if (p == 2) c='*';
if (p == 3) c='\n';
BIO_write((BIO *)arg,&c,1);
(void)BIO_flush((BIO *)arg);
BIO_write(arg,&c,1);
(void)BIO_flush(arg);
#ifdef LINT
p=n;
#endif

View File

@ -65,6 +65,7 @@
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/x509.h>
#include <openssl/rand.h>
#ifndef NO_MD5
#include <openssl/md5.h>
#endif
@ -79,17 +80,22 @@ int set_hex(char *in,unsigned char *out,int size);
#define BSIZE (8*1024)
#define PROG enc_main
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
static const char magic[]="Salted__";
char mbuf[8]; /* should be 1 smaller than magic */
char *strbuf=NULL;
unsigned char *buff=NULL,*bufsize=NULL;
int bsize=BSIZE,verbose=0;
int ret=1,inl;
unsigned char key[24],iv[MD5_DIGEST_LENGTH];
char *str=NULL;
char *hkey=NULL,*hiv=NULL;
unsigned char salt[PKCS5_SALT_LEN];
char *str=NULL, *passarg = NULL, *pass = NULL;
char *hkey=NULL,*hiv=NULL,*hsalt = NULL;
int enc=1,printkey=0,i,base64=0;
int debug=0,olb64=0;
int debug=0,olb64=0,nosalt=0;
const EVP_CIPHER *cipher=NULL,*c;
char *inf=NULL,*outf=NULL;
BIO *in=NULL,*out=NULL,*b64=NULL,*benc=NULL,*rbio=NULL,*wbio=NULL;
@ -130,14 +136,22 @@ int MAIN(int argc, char **argv)
if (--argc < 1) goto bad;
outf= *(++argv);
}
else if (strcmp(*argv,"-pass") == 0)
{
if (--argc < 1) goto bad;
passarg= *(++argv);
}
else if (strcmp(*argv,"-d") == 0)
enc=0;
else if (strcmp(*argv,"-p") == 0)
printkey=1;
else if (strcmp(*argv,"-v") == 0)
verbose=1;
else if ((strcmp(*argv,"-debug") == 0) ||
(strcmp(*argv,"-d") == 0))
else if (strcmp(*argv,"-salt") == 0)
nosalt=0;
else if (strcmp(*argv,"-nosalt") == 0)
nosalt=1;
else if (strcmp(*argv,"-debug") == 0)
debug=1;
else if (strcmp(*argv,"-P") == 0)
printkey=2;
@ -194,6 +208,11 @@ int MAIN(int argc, char **argv)
if (--argc < 1) goto bad;
hkey= *(++argv);
}
else if (strcmp(*argv,"-S") == 0)
{
if (--argc < 1) goto bad;
hsalt= *(++argv);
}
else if (strcmp(*argv,"-iv") == 0)
{
if (--argc < 1) goto bad;
@ -212,7 +231,8 @@ int MAIN(int argc, char **argv)
bad:
BIO_printf(bio_err,"options are\n");
BIO_printf(bio_err,"%-14s input file\n","-in <file>");
BIO_printf(bio_err,"%-14s output fileencrypt\n","-out <file>");
BIO_printf(bio_err,"%-14s output file\n","-out <file>");
BIO_printf(bio_err,"%-14s pass phrase source\n","-pass <arg>");
BIO_printf(bio_err,"%-14s encrypt\n","-e");
BIO_printf(bio_err,"%-14s decrypt\n","-d");
BIO_printf(bio_err,"%-14s base64 encode/decode, depending on encryption flag\n","-a/-base64");
@ -233,7 +253,7 @@ int MAIN(int argc, char **argv)
BIO_printf(bio_err,"rc2 :128 bit key RC2 encryption\n");
#endif
#ifndef NO_BF
BIO_printf(bio_err,"bf :128 bit key BlowFish encryption\n");
BIO_printf(bio_err,"bf :128 bit key Blowfish encryption\n");
#endif
#ifndef NO_RC4
BIO_printf(bio_err," -%-5s :128 bit key RC4 encryption\n",
@ -357,6 +377,14 @@ int MAIN(int argc, char **argv)
}
}
if(!str && passarg) {
if(!app_passwd(bio_err, passarg, NULL, &pass, NULL)) {
BIO_printf(bio_err, "Error getting password\n");
goto end;
}
str = pass;
}
if ((str == NULL) && (cipher != NULL) && (hkey == NULL))
{
for (;;)
@ -386,66 +414,6 @@ int MAIN(int argc, char **argv)
}
}
if (cipher != NULL)
{
if (str != NULL)
{
EVP_BytesToKey(cipher,EVP_md5(),NULL,
(unsigned char *)str,
strlen(str),1,key,iv);
/* zero the complete buffer or the string
* passed from the command line
* bug picked up by
* Larry J. Hughes Jr. <hughes@indiana.edu> */
if (str == strbuf)
memset(str,0,SIZE);
else
memset(str,0,strlen(str));
}
if ((hiv != NULL) && !set_hex(hiv,iv,8))
{
BIO_printf(bio_err,"invalid hex iv value\n");
goto end;
}
if ((hkey != NULL) && !set_hex(hkey,key,24))
{
BIO_printf(bio_err,"invalid hex key value\n");
goto end;
}
if ((benc=BIO_new(BIO_f_cipher())) == NULL)
goto end;
BIO_set_cipher(benc,cipher,key,iv,enc);
if (debug)
{
BIO_set_callback(benc,BIO_debug_callback);
BIO_set_callback_arg(benc,bio_err);
}
if (printkey)
{
if (cipher->key_len > 0)
{
printf("key=");
for (i=0; i<cipher->key_len; i++)
printf("%02X",key[i]);
printf("\n");
}
if (cipher->iv_len > 0)
{
printf("iv =");
for (i=0; i<cipher->iv_len; i++)
printf("%02X",iv[i]);
printf("\n");
}
if (printkey == 2)
{
ret=0;
goto end;
}
}
}
if (outf == NULL)
BIO_set_fp(out,stdout,BIO_NOCLOSE);
@ -478,6 +446,113 @@ int MAIN(int argc, char **argv)
rbio=BIO_push(b64,rbio);
}
if (cipher != NULL)
{
if (str != NULL)
{
/* Salt handling: if encrypting generate a salt and
* write to output BIO. If decrypting read salt from
* input BIO.
*/
unsigned char *sptr;
if(nosalt) sptr = NULL;
else {
if(enc) {
if(hsalt) {
if(!set_hex(hsalt,salt,PKCS5_SALT_LEN)) {
BIO_printf(bio_err,
"invalid hex salt value\n");
goto end;
}
} else if (RAND_pseudo_bytes(salt, PKCS5_SALT_LEN) < 0)
goto end;
/* If -P option then don't bother writing */
if((printkey != 2)
&& (BIO_write(wbio,magic,
sizeof magic-1) != sizeof magic-1
|| BIO_write(wbio,
(char *)salt,
PKCS5_SALT_LEN) != PKCS5_SALT_LEN)) {
BIO_printf(bio_err,"error writing output file\n");
goto end;
}
} else if(BIO_read(rbio,mbuf,sizeof mbuf) != sizeof mbuf
|| BIO_read(rbio,
(unsigned char *)salt,
PKCS5_SALT_LEN) != PKCS5_SALT_LEN) {
BIO_printf(bio_err,"error reading input file\n");
goto end;
} else if(memcmp(mbuf,magic,sizeof magic-1)) {
BIO_printf(bio_err,"bad magic number\n");
goto end;
}
sptr = salt;
}
EVP_BytesToKey(cipher,EVP_md5(),sptr,
(unsigned char *)str,
strlen(str),1,key,iv);
/* zero the complete buffer or the string
* passed from the command line
* bug picked up by
* Larry J. Hughes Jr. <hughes@indiana.edu> */
if (str == strbuf)
memset(str,0,SIZE);
else
memset(str,0,strlen(str));
}
if ((hiv != NULL) && !set_hex(hiv,iv,8))
{
BIO_printf(bio_err,"invalid hex iv value\n");
goto end;
}
if ((hkey != NULL) && !set_hex(hkey,key,24))
{
BIO_printf(bio_err,"invalid hex key value\n");
goto end;
}
if ((benc=BIO_new(BIO_f_cipher())) == NULL)
goto end;
BIO_set_cipher(benc,cipher,key,iv,enc);
if (debug)
{
BIO_set_callback(benc,BIO_debug_callback);
BIO_set_callback_arg(benc,bio_err);
}
if (printkey)
{
if (!nosalt)
{
printf("salt=");
for (i=0; i<PKCS5_SALT_LEN; i++)
printf("%02X",salt[i]);
printf("\n");
}
if (cipher->key_len > 0)
{
printf("key=");
for (i=0; i<cipher->key_len; i++)
printf("%02X",key[i]);
printf("\n");
}
if (cipher->iv_len > 0)
{
printf("iv =");
for (i=0; i<cipher->iv_len; i++)
printf("%02X",iv[i]);
printf("\n");
}
if (printkey == 2)
{
ret=0;
goto end;
}
}
}
/* Only encrypt/decrypt as we write the file */
if (benc != NULL)
wbio=BIO_push(benc,wbio);
@ -505,12 +580,14 @@ int MAIN(int argc, char **argv)
BIO_printf(bio_err,"bytes written:%8ld\n",BIO_number_written(out));
}
end:
ERR_print_errors(bio_err);
if (strbuf != NULL) Free(strbuf);
if (buff != NULL) 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);
EXIT(ret);
}

View File

@ -68,6 +68,8 @@
#undef PROG
#define PROG errstr_main
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
int i,ret=0;

View File

@ -1,4 +1,5 @@
/* apps/gendh.c */
/* obsoleted by dhparam.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -75,15 +76,16 @@
#define PROG gendh_main
static void MS_CALLBACK dh_cb(int p, int n, void *arg);
static long dh_load_rand(char *names);
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
char buffer[200];
DH *dh=NULL;
int ret=1,num=DEFBITS;
int g=2;
char *outfile=NULL;
char *inrand=NULL,*randfile;
char *inrand=NULL;
BIO *out=NULL;
apps_startup();
@ -126,7 +128,7 @@ int MAIN(int argc, char **argv)
BIO_printf(bio_err," -2 use 2 as the generator value\n");
/* BIO_printf(bio_err," -3 use 3 as the generator value\n"); */
BIO_printf(bio_err," -5 use 5 as the generator value\n");
BIO_printf(bio_err," -rand file:file:...\n");
BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
BIO_printf(bio_err," - load the file (or the files in the directory) into\n");
BIO_printf(bio_err," the random number generator\n");
goto end;
@ -150,28 +152,21 @@ int MAIN(int argc, char **argv)
}
}
randfile=RAND_file_name(buffer,200);
if ((randfile == NULL)|| !RAND_load_file(randfile,1024L*1024L))
BIO_printf(bio_err,"unable to load 'random state'\n");
if (inrand == NULL)
BIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\n");
else
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL)
{
BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
dh_load_rand(inrand));
BIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\n");
}
if (inrand != NULL)
BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
app_RAND_load_files(inrand));
BIO_printf(bio_err,"Generating DH parameters, %d bit long strong prime, generator of %d\n",num,g);
BIO_printf(bio_err,"Generating DH parameters, %d bit long safe prime, generator %d\n",num,g);
BIO_printf(bio_err,"This is going to take a long time\n");
dh=DH_generate_parameters(num,g,dh_cb,bio_err);
if (dh == NULL) goto end;
if (randfile == NULL)
BIO_printf(bio_err,"unable to write 'random state'\n");
else
RAND_write_file(randfile);
app_RAND_write_file(NULL, bio_err);
if (!PEM_write_bio_DHparams(out,dh))
goto end;
@ -198,26 +193,4 @@ static void MS_CALLBACK dh_cb(int p, int n, void *arg)
p=n;
#endif
}
static long dh_load_rand(char *name)
{
char *p,*n;
int last;
long tot=0;
for (;;)
{
last=0;
for (p=name; ((*p != '\0') && (*p != LIST_SEPARATOR_CHAR)); p++);
if (*p == '\0') last=1;
*p='\0';
n=name;
name=p+1;
if (*n == '\0') break;
tot+=RAND_load_file(n,1);
if (last) break;
}
return(tot);
}
#endif

View File

@ -63,7 +63,6 @@
#include <sys/stat.h>
#include "apps.h"
#include <openssl/bio.h>
#include <openssl/rand.h>
#include <openssl/err.h>
#include <openssl/bn.h>
#include <openssl/dsa.h>
@ -74,14 +73,15 @@
#undef PROG
#define PROG gendsa_main
static long dsa_load_rand(char *names);
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
char buffer[200];
DSA *dsa=NULL;
int ret=1;
char *outfile=NULL;
char *inrand=NULL,*randfile,*dsaparams=NULL;
char *inrand=NULL,*dsaparams=NULL;
char *passargout = NULL, *passout = NULL;
BIO *out=NULL,*in=NULL;
EVP_CIPHER *enc=NULL;
@ -101,6 +101,11 @@ int MAIN(int argc, char **argv)
if (--argc < 1) goto bad;
outfile= *(++argv);
}
else if (strcmp(*argv,"-passout") == 0)
{
if (--argc < 1) goto bad;
passargout= *(++argv);
}
else if (strcmp(*argv,"-rand") == 0)
{
if (--argc < 1) goto bad;
@ -140,7 +145,7 @@ int MAIN(int argc, char **argv)
#ifndef NO_IDEA
BIO_printf(bio_err," -idea - encrypt the generated key with IDEA in cbc mode\n");
#endif
BIO_printf(bio_err," -rand file:file:...\n");
BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
BIO_printf(bio_err," - load the file (or the files in the directory) into\n");
BIO_printf(bio_err," the random number generator\n");
BIO_printf(bio_err," dsaparam-file\n");
@ -148,6 +153,12 @@ int MAIN(int argc, char **argv)
goto end;
}
if(!app_passwd(bio_err, NULL, passargout, NULL, &passout)) {
BIO_printf(bio_err, "Error getting password\n");
goto end;
}
in=BIO_new(BIO_s_file());
if (!(BIO_read_filename(in,dsaparams)))
{
@ -161,6 +172,7 @@ int MAIN(int argc, char **argv)
goto end;
}
BIO_free(in);
in = NULL;
out=BIO_new(BIO_s_file());
if (out == NULL) goto end;
@ -176,57 +188,30 @@ int MAIN(int argc, char **argv)
}
}
randfile=RAND_file_name(buffer,200);
if ((randfile == NULL)|| !RAND_load_file(randfile,1024L*1024L))
BIO_printf(bio_err,"unable to load 'random state'\n");
if (inrand == NULL)
BIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\n");
else
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL)
{
BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
dsa_load_rand(inrand));
BIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\n");
}
if (inrand != NULL)
BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
app_RAND_load_files(inrand));
BIO_printf(bio_err,"Generating DSA key, %d bits\n",
BN_num_bits(dsa->p));
if (!DSA_generate_key(dsa)) goto end;
if (randfile == NULL)
BIO_printf(bio_err,"unable to write 'random state'\n");
else
RAND_write_file(randfile);
app_RAND_write_file(NULL, bio_err);
if (!PEM_write_bio_DSAPrivateKey(out,dsa,enc,NULL,0,NULL,NULL))
if (!PEM_write_bio_DSAPrivateKey(out,dsa,enc,NULL,0,NULL, passout))
goto end;
ret=0;
end:
if (ret != 0)
ERR_print_errors(bio_err);
if (in != NULL) BIO_free(in);
if (out != NULL) BIO_free(out);
if (dsa != NULL) DSA_free(dsa);
if(passout) Free(passout);
EXIT(ret);
}
static long dsa_load_rand(char *name)
{
char *p,*n;
int last;
long tot=0;
for (;;)
{
last=0;
for (p=name; ((*p != '\0') && (*p != LIST_SEPARATOR_CHAR)); p++);
if (*p == '\0') last=1;
*p='\0';
n=name;
name=p+1;
if (*n == '\0') break;
tot+=RAND_load_file(n,1);
if (last) break;
}
return(tot);
}
#endif

View File

@ -63,7 +63,6 @@
#include <sys/stat.h>
#include "apps.h"
#include <openssl/bio.h>
#include <openssl/rand.h>
#include <openssl/err.h>
#include <openssl/bn.h>
#include <openssl/rsa.h>
@ -76,18 +75,20 @@
#define PROG genrsa_main
static void MS_CALLBACK genrsa_cb(int p, int n, void *arg);
static long gr_load_rand(char *names);
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
int ret=1;
char buffer[200];
RSA *rsa=NULL;
int i,num=DEFBITS;
long rnum=0,l;
long l;
EVP_CIPHER *enc=NULL;
unsigned long f4=RSA_F4;
char *outfile=NULL;
char *inrand=NULL,*randfile;
char *passargout = NULL, *passout = NULL;
char *inrand=NULL;
BIO *out=NULL;
apps_startup();
@ -97,7 +98,7 @@ int MAIN(int argc, char **argv)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
if ((out=BIO_new(BIO_s_file())) == NULL)
{
BIO_printf(bio_err,"unable to creat BIO for output\n");
BIO_printf(bio_err,"unable to create BIO for output\n");
goto err;
}
@ -130,6 +131,11 @@ int MAIN(int argc, char **argv)
else if (strcmp(*argv,"-idea") == 0)
enc=EVP_idea_cbc();
#endif
else if (strcmp(*argv,"-passout") == 0)
{
if (--argc < 1) goto bad;
passargout= *(++argv);
}
else
break;
argv++;
@ -139,21 +145,28 @@ int MAIN(int argc, char **argv)
{
bad:
BIO_printf(bio_err,"usage: genrsa [args] [numbits]\n");
BIO_printf(bio_err," -des - encrypt the generated key with DES in cbc mode\n");
BIO_printf(bio_err," -des3 - encrypt the generated key with DES in ede cbc mode (168 bit key)\n");
BIO_printf(bio_err," -des encrypt the generated key with DES in cbc mode\n");
BIO_printf(bio_err," -des3 encrypt the generated key with DES in ede cbc mode (168 bit key)\n");
#ifndef NO_IDEA
BIO_printf(bio_err," -idea - encrypt the generated key with IDEA in cbc mode\n");
BIO_printf(bio_err," -idea encrypt the generated key with IDEA in cbc mode\n");
#endif
BIO_printf(bio_err," -out file - output the key to 'file\n");
BIO_printf(bio_err," -f4 - use F4 (0x10001) for the E value\n");
BIO_printf(bio_err," -3 - use 3 for the E value\n");
BIO_printf(bio_err," -rand file:file:...\n");
BIO_printf(bio_err," - load the file (or the files in the directory) into\n");
BIO_printf(bio_err," the random number generator\n");
BIO_printf(bio_err," -out file output the key to 'file\n");
BIO_printf(bio_err," -passout arg output file pass phrase source\n");
BIO_printf(bio_err," -f4 use F4 (0x10001) for the E value\n");
BIO_printf(bio_err," -3 use 3 for the E value\n");
BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
BIO_printf(bio_err," load the file (or the files in the directory) into\n");
BIO_printf(bio_err," the random number generator\n");
goto err;
}
ERR_load_crypto_strings();
if(!app_passwd(bio_err, NULL, passargout, NULL, &passout)) {
BIO_printf(bio_err, "Error getting password\n");
goto err;
}
if (outfile == NULL)
BIO_set_fp(out,stdout,BIO_NOCLOSE);
else
@ -165,45 +178,23 @@ int MAIN(int argc, char **argv)
}
}
#ifdef WINDOWS
BIO_printf(bio_err,"Loading 'screen' into random state -");
BIO_flush(bio_err);
RAND_screen();
BIO_printf(bio_err," done\n");
#endif
randfile=RAND_file_name(buffer,200);
if ((randfile == NULL) ||
!(rnum=(long)RAND_load_file(randfile,1024L*1024L)))
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL)
{
BIO_printf(bio_err,"unable to load 'random state'\n");
BIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\n");
}
if (inrand == NULL)
{
if (rnum == 0)
{
BIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\n");
}
}
else
{
rnum+=gr_load_rand(inrand);
}
if (rnum != 0)
BIO_printf(bio_err,"%ld semi-random bytes loaded\n",rnum);
if (inrand != NULL)
BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
app_RAND_load_files(inrand));
BIO_printf(bio_err,"Generating RSA private key, %d bit long modulus\n",
num);
rsa=RSA_generate_key(num,f4,genrsa_cb,bio_err);
if (randfile == NULL)
BIO_printf(bio_err,"unable to write 'random state'\n");
else
RAND_write_file(randfile);
app_RAND_write_file(NULL, bio_err);
if (rsa == NULL) goto err;
/* We need to do the folloing for when the base number size is <
/* We need to do the following for when the base number size is <
* long, esp windows 3.1 :-(. */
l=0L;
for (i=0; i<rsa->e->top; i++)
@ -215,13 +206,14 @@ int MAIN(int argc, char **argv)
l+=rsa->e->d[i];
}
BIO_printf(bio_err,"e is %ld (0x%lX)\n",l,l);
if (!PEM_write_bio_RSAPrivateKey(out,rsa,enc,NULL,0,NULL,NULL))
if (!PEM_write_bio_RSAPrivateKey(out,rsa,enc,NULL,0,NULL, passout))
goto err;
ret=0;
err:
if (rsa != NULL) RSA_free(rsa);
if (out != NULL) BIO_free(out);
if(passout) Free(passout);
if (ret != 0)
ERR_print_errors(bio_err);
EXIT(ret);
@ -241,26 +233,10 @@ static void MS_CALLBACK genrsa_cb(int p, int n, void *arg)
p=n;
#endif
}
#else /* !NO_RSA */
static long gr_load_rand(char *name)
{
char *p,*n;
int last;
long tot=0;
# if PEDANTIC
static void *dummy=&dummy;
# endif
for (;;)
{
last=0;
for (p=name; ((*p != '\0') && (*p != LIST_SEPARATOR_CHAR)); p++);
if (*p == '\0') last=1;
*p='\0';
n=name;
name=p+1;
if (*n == '\0') break;
tot+=RAND_load_file(n,1024L*1024L);
if (last) break;
}
return(tot);
}
#endif

View File

@ -65,7 +65,7 @@
#undef PROG
#define PROG nseq_main
static int dump_cert_text(BIO *out, X509 *x);
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
@ -158,17 +158,3 @@ int MAIN(int argc, char **argv)
EXIT(ret);
}
static int dump_cert_text(BIO *out, X509 *x)
{
char buf[256];
X509_NAME_oneline(X509_get_subject_name(x),buf,256);
BIO_puts(out,"subject=");
BIO_puts(out,buf);
X509_NAME_oneline(X509_get_issuer_name(x),buf,256);
BIO_puts(out,"\nissuer= ");
BIO_puts(out,buf);
BIO_puts(out,"\n");
return 0;
}

View File

@ -56,13 +56,10 @@
* [including the GNU Public Licence.]
*/
#ifndef DEBUG
#undef DEBUG
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define OPENSSL_C /* tells apps.h to use complete apps_startup() */
#include <openssl/bio.h>
#include <openssl/crypto.h>
#include <openssl/lhash.h>
@ -70,19 +67,12 @@
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>
#define SSLEAY /* turn off a few special case MONOLITH macros */
#define USE_SOCKETS /* needed for the _O_BINARY defs in the MS world */
#define SSLEAY_SRC
#include "apps.h"
#include "progs.h"
#include "s_apps.h"
#include <openssl/err.h>
/*
#ifdef WINDOWS
#include "bss_file.c"
#endif
*/
static unsigned long MS_CALLBACK hash(FUNCTION *a);
static int MS_CALLBACK cmp(FUNCTION *a,FUNCTION *b);
static LHASH *prog_init(void );
@ -90,15 +80,6 @@ static int do_cmd(LHASH *prog,int argc,char *argv[]);
LHASH *config=NULL;
char *default_config_file=NULL;
#ifdef DEBUG
static void sig_stop(int i)
{
char *a=NULL;
*a='\0';
}
#endif
/* Make sure there is only one when MONOLITH is defined */
#ifdef MONOLITH
BIO *bio_err=NULL;
@ -120,24 +101,14 @@ int main(int Argc, char *Argv[])
arg.data=NULL;
arg.count=0;
/* SSLeay_add_ssl_algorithms(); is called in apps_startup() */
apps_startup();
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
#if defined(DEBUG) && !defined(WINDOWS) && !defined(MSDOS)
#ifdef SIGBUS
signal(SIGBUS,sig_stop);
#endif
#ifdef SIGSEGV
signal(SIGSEGV,sig_stop);
#endif
#endif
apps_startup();
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
ERR_load_crypto_strings();
/* Lets load up our environment a little */
@ -165,7 +136,7 @@ int main(int Argc, char *Argv[])
program_name(Argv[0],pname,PROG_NAME_SIZE);
f.name=pname;
fp=(FUNCTION *)lh_retrieve(prog,(char *)&f);
fp=(FUNCTION *)lh_retrieve(prog,&f);
if (fp != NULL)
{
Argv[0]=pname;
@ -235,7 +206,7 @@ int main(int Argc, char *Argv[])
EVP_cleanup();
ERR_free_strings();
CRYPTO_mem_leaks(bio_err);
if (bio_err != NULL)
{
@ -257,11 +228,23 @@ static int do_cmd(LHASH *prog, int argc, char *argv[])
if ((argc <= 0) || (argv[0] == NULL))
{ ret=0; goto end; }
f.name=argv[0];
fp=(FUNCTION *)lh_retrieve(prog,(char *)&f);
fp=(FUNCTION *)lh_retrieve(prog,&f);
if (fp != NULL)
{
ret=fp->func(argc,argv);
}
else if ((strncmp(argv[0],"no-",3)) == 0)
{
BIO *bio_stdout = BIO_new_fp(stdout,BIO_NOCLOSE);
f.name=argv[0]+3;
ret = (lh_retrieve(prog,&f) != NULL);
if (!ret)
BIO_printf(bio_stdout, "%s\n", argv[0]);
else
BIO_printf(bio_stdout, "%s\n", argv[0]+3);
BIO_free(bio_stdout);
goto end;
}
else if ((strcmp(argv[0],"quit") == 0) ||
(strcmp(argv[0],"q") == 0) ||
(strcmp(argv[0],"exit") == 0) ||
@ -356,7 +339,7 @@ static LHASH *prog_init(void)
if ((ret=lh_new(hash,cmp)) == NULL) return(NULL);
for (f=functions; f->name != NULL; f++)
lh_insert(ret,(char *)f);
lh_insert(ret,f);
return(ret);
}
@ -369,5 +352,3 @@ static unsigned long MS_CALLBACK hash(FUNCTION *a)
{
return(lh_strhash(a->name));
}
#undef SSLEAY

View File

@ -3,8 +3,13 @@
# This is mostly being used for generation of certificate requests.
#
# This definition stops the following lines choking if HOME isn't
# defined.
HOME = .
RANDFILE = $ENV::HOME/.rnd
oid_file = $ENV::HOME/.oid
# Extra OBJECT IDENTIFIER info:
#oid_file = $ENV::HOME/.oid
oid_section = new_oids
# To use this configuration file with the "-extfile" option of the
@ -86,6 +91,22 @@ distinguished_name = req_distinguished_name
attributes = req_attributes
x509_extensions = v3_ca # The extentions to add to the self signed cert
# Passwords for private keys if not present they will be prompted for
# input_password = secret
# output_password = secret
# This sets a mask for permitted string types. There are several options.
# default: PrintableString, T61String, BMPString.
# pkix : PrintableString, BMPString.
# utf8only: only UTF8Strings.
# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
# MASK:XXXX a literal mask value.
# WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings
# so use this option with caution!
string_mask = nombstr
# req_extensions = v3_req # The extensions to add to a certificate request
[ req_distinguished_name ]
countryName = Country Name (2 letter code)
countryName_default = AU
@ -170,8 +191,16 @@ authorityKeyIdentifier=keyid,issuer:always
#nsCaPolicyUrl
#nsSslServerName
[ v3_req ]
# Extensions to add to a certificate request
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
[ v3_ca ]
# Extensions for a typical CA
@ -200,10 +229,11 @@ basicConstraints = CA:true
# Copy issuer details
# issuerAltName=issuer:copy
# RAW DER hex encoding of an extension: beware experts only!
# 1.2.3.5=RAW:02:03
# DER hex encoding of an extension: beware experts only!
# obj=DER:02:03
# Where 'obj' is a standard or added object
# You can even override a supported extension:
# basicConstraints= critical, RAW:30:03:01:01:FF
# basicConstraints= critical, DER:30:03:01:01:FF
[ crl_ext ]

View File

@ -0,0 +1,475 @@
/* apps/passwd.c */
#if defined NO_MD5 || defined CHARSET_EBCDIC
# define NO_APR1
#endif
#if !defined(NO_DES) || !defined(NO_APR1)
#include <assert.h>
#include <string.h>
#include "apps.h"
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
#ifndef NO_DES
# include <openssl/des.h>
#endif
#ifndef NO_APR1
# include <openssl/md5.h>
#endif
#undef PROG
#define PROG passwd_main
static unsigned const char cov_2char[64]={
/* from crypto/des/fcrypt.c */
0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,
0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,
0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,
0x4D,0x4E,0x4F,0x50,0x51,0x52,0x53,0x54,
0x55,0x56,0x57,0x58,0x59,0x5A,0x61,0x62,
0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,
0x6B,0x6C,0x6D,0x6E,0x6F,0x70,0x71,0x72,
0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A
};
static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
char *passwd, BIO *out, int quiet, int table, int reverse,
size_t pw_maxlen, int usecrypt, int useapr1);
/* -crypt - standard Unix password algorithm (default, only choice)
* -apr1 - MD5-based password algorithm
* -salt string - salt
* -in file - read passwords from file
* -stdin - read passwords from stdin
* -quiet - no warnings
* -table - format output as table
* -reverse - switch table columns
*/
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
int ret = 1;
char *infile = NULL;
int in_stdin = 0;
char *salt = NULL, *passwd = NULL, **passwds = NULL;
char *salt_malloc = NULL, *passwd_malloc = NULL;
int pw_source_defined = 0;
BIO *in = NULL, *out = NULL;
int i, badopt, opt_done;
int passed_salt = 0, quiet = 0, table = 0, reverse = 0;
int usecrypt = 0, useapr1 = 0;
size_t pw_maxlen = 0;
apps_startup();
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
out = BIO_new(BIO_s_file());
if (out == NULL)
goto err;
BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT);
badopt = 0, opt_done = 0;
i = 0;
while (!badopt && !opt_done && argv[++i] != NULL)
{
if (strcmp(argv[i], "-crypt") == 0)
usecrypt = 1;
else if (strcmp(argv[i], "-apr1") == 0)
useapr1 = 1;
else if (strcmp(argv[i], "-salt") == 0)
{
if ((argv[i+1] != NULL) && (salt == NULL))
{
passed_salt = 1;
salt = argv[++i];
}
else
badopt = 1;
}
else if (strcmp(argv[i], "-in") == 0)
{
if ((argv[i+1] != NULL) && !pw_source_defined)
{
pw_source_defined = 1;
infile = argv[++i];
}
else
badopt = 1;
}
else if (strcmp(argv[i], "-stdin") == 0)
{
if (!pw_source_defined)
{
pw_source_defined = 1;
in_stdin = 1;
}
else
badopt = 1;
}
else if (strcmp(argv[i], "-quiet") == 0)
quiet = 1;
else if (strcmp(argv[i], "-table") == 0)
table = 1;
else if (strcmp(argv[i], "-reverse") == 0)
reverse = 1;
else if (argv[i][0] == '-')
badopt = 1;
else if (!pw_source_defined)
/* non-option arguments, use as passwords */
{
pw_source_defined = 1;
passwds = &argv[i];
opt_done = 1;
}
else
badopt = 1;
}
if (!usecrypt && !useapr1) /* use default */
usecrypt = 1;
if (usecrypt + useapr1 > 1) /* conflict */
badopt = 1;
/* reject unsupported algorithms */
#ifdef NO_DES
if (usecrypt) badopt = 1;
#endif
#ifdef NO_APR1
if (useapr1) badopt = 1;
#endif
if (badopt)
{
BIO_printf(bio_err, "Usage: passwd [options] [passwords]\n");
BIO_printf(bio_err, "where options are\n");
#ifndef NO_DES
BIO_printf(bio_err, "-crypt standard Unix password algorithm (default)\n");
#endif
#ifndef NO_APR1
BIO_printf(bio_err, "-apr1 MD5-based password algorithm\n");
#endif
BIO_printf(bio_err, "-salt string use provided salt\n");
BIO_printf(bio_err, "-in file read passwords from file\n");
BIO_printf(bio_err, "-stdin read passwords from stdin\n");
BIO_printf(bio_err, "-quiet no warnings\n");
BIO_printf(bio_err, "-table format output as table\n");
BIO_printf(bio_err, "-reverse switch table columns\n");
goto err;
}
if ((infile != NULL) || in_stdin)
{
in = BIO_new(BIO_s_file());
if (in == NULL)
goto err;
if (infile != NULL)
{
assert(in_stdin == 0);
if (BIO_read_filename(in, infile) <= 0)
goto err;
}
else
{
assert(in_stdin);
BIO_set_fp(in, stdin, BIO_NOCLOSE);
}
}
if (usecrypt)
pw_maxlen = 8;
else if (useapr1)
pw_maxlen = 256; /* arbitrary limit, should be enough for most passwords */
if (passwds == NULL)
{
/* no passwords on the command line */
passwd = passwd_malloc = Malloc(pw_maxlen + 1);
if (passwd_malloc == NULL)
goto err;
}
if ((in == NULL) && (passwds == NULL))
{
/* build a null-terminated list */
static char *passwds_static[2] = {NULL, NULL};
passwds = passwds_static;
if (in == NULL)
if (EVP_read_pw_string(passwd_malloc, pw_maxlen + 1, "Password: ", 0) != 0)
goto err;
passwds[0] = passwd_malloc;
}
if (in == NULL)
{
assert(passwds != NULL);
assert(*passwds != NULL);
do /* loop over list of passwords */
{
passwd = *passwds++;
if (!do_passwd(passed_salt, &salt, &salt_malloc, passwd, out,
quiet, table, reverse, pw_maxlen, usecrypt, useapr1))
goto err;
}
while (*passwds != NULL);
}
else
/* in != NULL */
{
int done;
assert (passwd != NULL);
do
{
int r = BIO_gets(in, passwd, pw_maxlen + 1);
if (r > 0)
{
char *c = (strchr(passwd, '\n')) ;
if (c != NULL)
*c = 0; /* truncate at newline */
else
{
/* ignore rest of line */
char trash[BUFSIZ];
do
r = BIO_gets(in, trash, sizeof trash);
while ((r > 0) && (!strchr(trash, '\n')));
}
if (!do_passwd(passed_salt, &salt, &salt_malloc, passwd, out,
quiet, table, reverse, pw_maxlen, usecrypt, useapr1))
goto err;
}
done = (r <= 0);
}
while (!done);
}
err:
ERR_print_errors(bio_err);
if (salt_malloc)
Free(salt_malloc);
if (passwd_malloc)
Free(passwd_malloc);
if (in)
BIO_free(in);
if (out)
BIO_free(out);
EXIT(ret);
}
#ifndef NO_APR1
/* MD5-based password algorithm compatible to the one found in Apache
* (should probably be available as a library function;
* then the static buffer would not be acceptable) */
static char *apr1_crypt(const char *passwd, const char *salt)
{
static char out_buf[6 + 9 + 24 + 2]; /* "$apr1$..salt..$.......md5hash..........\0" */
unsigned char buf[MD5_DIGEST_LENGTH];
char *salt_out;
int n, i;
MD5_CTX md;
size_t passwd_len, salt_len;
passwd_len = strlen(passwd);
strcpy(out_buf, "$apr1$");
strncat(out_buf, salt, 8);
assert(strlen(out_buf) <= 6 + 8); /* "$apr1$..salt.." */
salt_out = out_buf + 6;
salt_len = strlen(salt_out);
assert(salt_len <= 8);
MD5_Init(&md);
MD5_Update(&md, passwd, passwd_len);
MD5_Update(&md, "$apr1$", 6);
MD5_Update(&md, salt_out, salt_len);
{
MD5_CTX md2;
MD5_Init(&md2);
MD5_Update(&md2, passwd, passwd_len);
MD5_Update(&md2, salt_out, salt_len);
MD5_Update(&md2, passwd, passwd_len);
MD5_Final(buf, &md2);
}
for (i = passwd_len; i > sizeof buf; i -= sizeof buf)
MD5_Update(&md, buf, sizeof buf);
MD5_Update(&md, buf, i);
n = passwd_len;
while (n)
{
MD5_Update(&md, (n & 1) ? "\0" : passwd, 1);
n >>= 1;
}
MD5_Final(buf, &md);
for (i = 0; i < 1000; i++)
{
MD5_CTX md2;
MD5_Init(&md2);
MD5_Update(&md2, (i & 1) ? (unsigned char *) passwd : buf,
(i & 1) ? passwd_len : sizeof buf);
if (i % 3)
MD5_Update(&md2, salt_out, salt_len);
if (i % 7)
MD5_Update(&md2, passwd, passwd_len);
MD5_Update(&md2, (i & 1) ? buf : (unsigned char *) passwd,
(i & 1) ? sizeof buf : passwd_len);
MD5_Final(buf, &md2);
}
{
/* transform buf into output string */
unsigned char buf_perm[sizeof buf];
int dest, source;
char *output;
/* silly output permutation */
for (dest = 0, source = 0; dest < 14; dest++, source = (source + 6) % 17)
buf_perm[dest] = buf[source];
buf_perm[14] = buf[5];
buf_perm[15] = buf[11];
#ifndef PEDANTIC /* Unfortunately, this generates a "no effect" warning */
assert(16 == sizeof buf_perm);
#endif
output = salt_out + salt_len;
assert(output == out_buf + strlen(out_buf));
*output++ = '$';
for (i = 0; i < 15; i += 3)
{
*output++ = cov_2char[buf_perm[i+2] & 0x3f];
*output++ = cov_2char[((buf_perm[i+1] & 0xf) << 2) |
(buf_perm[i+2] >> 6)];
*output++ = cov_2char[((buf_perm[i] & 3) << 4) |
(buf_perm[i+1] >> 4)];
*output++ = cov_2char[buf_perm[i] >> 2];
}
assert(i == 15);
*output++ = cov_2char[buf_perm[i] & 0x3f];
*output++ = cov_2char[buf_perm[i] >> 6];
*output = 0;
assert(strlen(out_buf) < sizeof(out_buf));
}
return out_buf;
}
#endif
static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
char *passwd, BIO *out, int quiet, int table, int reverse,
size_t pw_maxlen, int usecrypt, int useapr1)
{
char *hash = NULL;
assert(salt_p != NULL);
assert(salt_malloc_p != NULL);
/* first make sure we have a salt */
if (!passed_salt)
{
#ifndef NO_DES
if (usecrypt)
{
if (*salt_malloc_p == NULL)
{
*salt_p = *salt_malloc_p = Malloc(3);
if (*salt_malloc_p == NULL)
goto err;
}
if (RAND_pseudo_bytes((unsigned char *)*salt_p, 2) < 0)
goto err;
(*salt_p)[0] = cov_2char[(*salt_p)[0] & 0x3f]; /* 6 bits */
(*salt_p)[1] = cov_2char[(*salt_p)[1] & 0x3f]; /* 6 bits */
(*salt_p)[2] = 0;
#ifdef CHARSET_EBCDIC
ascii2ebcdic(*salt_p, *salt_p, 2); /* des_crypt will convert
* back to ASCII */
#endif
}
#endif /* !NO_DES */
#ifndef NO_APR1
if (useapr1)
{
int i;
if (*salt_malloc_p == NULL)
{
*salt_p = *salt_malloc_p = Malloc(9);
if (*salt_malloc_p == NULL)
goto err;
}
if (RAND_pseudo_bytes((unsigned char *)*salt_p, 8) < 0)
goto err;
for (i = 0; i < 8; i++)
(*salt_p)[i] = cov_2char[(*salt_p)[i] & 0x3f]; /* 6 bits */
(*salt_p)[8] = 0;
}
#endif /* !NO_APR1 */
}
assert(*salt_p != NULL);
/* truncate password if necessary */
if ((strlen(passwd) > pw_maxlen))
{
if (!quiet)
BIO_printf(bio_err, "Warning: truncating password to %u characters\n", pw_maxlen);
passwd[pw_maxlen] = 0;
}
assert(strlen(passwd) <= pw_maxlen);
/* now compute password hash */
#ifndef NO_DES
if (usecrypt)
hash = des_crypt(passwd, *salt_p);
#endif
#ifndef NO_APR1
if (useapr1)
hash = apr1_crypt(passwd, *salt_p);
#endif
assert(hash != NULL);
if (table && !reverse)
BIO_printf(out, "%s\t%s\n", passwd, hash);
else if (table && reverse)
BIO_printf(out, "%s\t%s\n", hash, passwd);
else
BIO_printf(out, "%s\n", hash);
return 1;
err:
return 0;
}
#else
int MAIN(int argc, char **argv)
{
fputs("Program not available.\n", stderr)
EXIT(1);
}
#endif

View File

@ -61,12 +61,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/des.h>
#include <openssl/pem.h>
#include "apps.h"
#include <openssl/crypto.h>
#include <openssl/err.h>
#include <openssl/pem.h>
#include <openssl/pkcs12.h>
#include "apps.h"
#define PROG pkcs12_main
EVP_CIPHER *enc;
@ -79,14 +79,16 @@ EVP_CIPHER *enc;
#define CACERTS 0x10
int get_cert_chain(X509 *cert, STACK_OF(X509) **chain);
int dump_cert_text (BIO *out, X509 *x);
int dump_certs_keys_p12(BIO *out, PKCS12 *p12, char *pass, int passlen, int options);
int dump_certs_pkeys_bags(BIO *out, STACK *bags, char *pass, int passlen, int options);
int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bags, char *pass, int passlen, int options);
int dump_certs_keys_p12(BIO *out, PKCS12 *p12, char *pass, int passlen, int options, char *pempass);
int dump_certs_pkeys_bags(BIO *out, STACK *bags, char *pass, int passlen, int options, char *pempass);
int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bags, char *pass, int passlen, int options, char *pempass);
int print_attribs(BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst, char *name);
void hex_prin(BIO *out, unsigned char *buf, int len);
int alg_print(BIO *x, X509_ALGOR *alg);
int cert_load(BIO *in, STACK_OF(X509) *sk);
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
char *infile=NULL, *outfile=NULL, *keyname = NULL;
@ -101,15 +103,19 @@ int MAIN(int argc, char **argv)
int chain = 0;
int badarg = 0;
int iter = PKCS12_DEFAULT_ITER;
int maciter = 1;
int maciter = PKCS12_DEFAULT_ITER;
int twopass = 0;
int keytype = 0;
int cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC;
int key_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
int ret = 1;
int macver = 1;
int noprompt = 0;
STACK *canames = NULL;
char *cpass = NULL, *mpass = NULL;
char *passargin = NULL, *passargout = NULL, *passarg = NULL;
char *passin = NULL, *passout = NULL;
char *inrand = NULL;
apps_startup();
@ -143,8 +149,35 @@ int MAIN(int argc, char **argv)
else if (!strcmp (*args, "-noiter")) iter = 1;
else if (!strcmp (*args, "-maciter"))
maciter = PKCS12_DEFAULT_ITER;
else if (!strcmp (*args, "-nomaciter"))
maciter = 1;
else if (!strcmp (*args, "-nodes")) enc=NULL;
else if (!strcmp (*args, "-inkey")) {
else if (!strcmp (*args, "-certpbe")) {
if (args[1]) {
args++;
cert_pbe=OBJ_txt2nid(*args);
if(cert_pbe == NID_undef) {
BIO_printf(bio_err,
"Unknown PBE algorithm %s\n", *args);
badarg = 1;
}
} else badarg = 1;
} else if (!strcmp (*args, "-keypbe")) {
if (args[1]) {
args++;
key_pbe=OBJ_txt2nid(*args);
if(key_pbe == NID_undef) {
BIO_printf(bio_err,
"Unknown PBE algorithm %s\n", *args);
badarg = 1;
}
} else badarg = 1;
} else if (!strcmp (*args, "-rand")) {
if (args[1]) {
args++;
inrand = *args;
} else badarg = 1;
} else if (!strcmp (*args, "-inkey")) {
if (args[1]) {
args++;
keyname = *args;
@ -175,20 +208,20 @@ int MAIN(int argc, char **argv)
args++;
outfile = *args;
} else badarg = 1;
} else if (!strcmp (*args, "-envpass")) {
} else if (!strcmp(*args,"-passin")) {
if (args[1]) {
args++;
if(!(cpass = getenv(*args))) {
BIO_printf(bio_err,
"Can't read environment variable %s\n", *args);
goto end;
}
noprompt = 1;
passargin = *args;
} else badarg = 1;
} else if (!strcmp(*args,"-passout")) {
if (args[1]) {
args++;
passargout = *args;
} else badarg = 1;
} else if (!strcmp (*args, "-password")) {
if (args[1]) {
args++;
cpass = *args;
passarg = *args;
noprompt = 1;
} else badarg = 1;
} else badarg = 1;
@ -225,21 +258,54 @@ int MAIN(int argc, char **argv)
BIO_printf (bio_err, "-maciter use MAC iteration\n");
BIO_printf (bio_err, "-twopass separate MAC, encryption passwords\n");
BIO_printf (bio_err, "-descert encrypt PKCS#12 certificates with triple DES (default RC2-40)\n");
BIO_printf (bio_err, "-certpbe alg specify certificate PBE algorithm (default RC2-40)\n");
BIO_printf (bio_err, "-keypbe alg specify private key PBE algorithm (default 3DES)\n");
BIO_printf (bio_err, "-keyex set MS key exchange type\n");
BIO_printf (bio_err, "-keysig set MS key signature type\n");
BIO_printf (bio_err, "-password p set import/export password (NOT RECOMMENDED)\n");
BIO_printf (bio_err, "-envpass p set import/export password from environment\n");
BIO_printf (bio_err, "-password p set import/export password source\n");
BIO_printf (bio_err, "-passin p input file pass phrase source\n");
BIO_printf (bio_err, "-passout p output file pass phrase source\n");
BIO_printf(bio_err, "-rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
BIO_printf(bio_err, " load the file (or the files in the directory) into\n");
BIO_printf(bio_err, " the random number generator\n");
goto end;
}
if(cpass) mpass = cpass;
else {
if(passarg) {
if(export_cert) passargout = passarg;
else passargin = passarg;
}
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
BIO_printf(bio_err, "Error getting passwords\n");
goto end;
}
if(!cpass) {
if(export_cert) cpass = passout;
else cpass = passin;
}
if(cpass) {
mpass = cpass;
noprompt = 1;
} else {
cpass = pass;
mpass = macpass;
}
if(export_cert || inrand) {
app_RAND_load_file(NULL, bio_err, (inrand != NULL));
if (inrand != NULL)
BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
app_RAND_load_files(inrand));
}
ERR_load_crypto_strings();
#ifdef CRYPTO_MDEBUG
CRYPTO_push_info("read files");
#endif
if (!infile) in = BIO_new_fp(stdin, BIO_NOCLOSE);
else in = BIO_new_file(infile, "rb");
if (!in) {
@ -265,6 +331,11 @@ int MAIN(int argc, char **argv)
}
}
#ifdef CRYPTO_MDEBUG
CRYPTO_pop_info();
CRYPTO_push_info("write files");
#endif
if (!outfile) out = BIO_new_fp(stdout, BIO_NOCLOSE);
else out = BIO_new_file(outfile, "wb");
if (!out) {
@ -274,27 +345,38 @@ int MAIN(int argc, char **argv)
goto end;
}
if (twopass) {
#ifdef CRYPTO_MDEBUG
CRYPTO_push_info("read MAC password");
#endif
if(EVP_read_pw_string (macpass, 50, "Enter MAC Password:", export_cert))
{
BIO_printf (bio_err, "Can't read Password\n");
goto end;
}
#ifdef CRYPTO_MDEBUG
CRYPTO_pop_info();
#endif
}
if (export_cert) {
if (export_cert) {
EVP_PKEY *key;
STACK *bags, *safes;
PKCS12_SAFEBAG *bag;
PKCS8_PRIV_KEY_INFO *p8;
PKCS7 *authsafe;
X509 *cert = NULL, *ucert = NULL;
STACK_OF(X509) *certs;
X509 *ucert = NULL;
STACK_OF(X509) *certs=NULL;
char *catmp;
int i;
unsigned char keyid[EVP_MAX_MD_SIZE];
unsigned int keyidlen = 0;
key = PEM_read_bio_PrivateKey(inkey ? inkey : in, NULL, NULL, NULL);
#ifdef CRYPTO_MDEBUG
CRYPTO_push_info("process -export_cert");
#endif
key = PEM_read_bio_PrivateKey(inkey ? inkey : in, NULL, NULL, passin);
if (!inkey) (void) BIO_reset(in);
else BIO_free(inkey);
if (!key) {
BIO_printf (bio_err, "Error loading private key\n");
ERR_print_errors(bio_err);
@ -313,7 +395,7 @@ if (export_cert) {
for(i = 0; i < sk_X509_num(certs); i++) {
ucert = sk_X509_value(certs, i);
if(X509_check_private_key(ucert, key)) {
X509_digest(cert, EVP_sha1(), keyid, &keyidlen);
X509_digest(ucert, EVP_sha1(), keyid, &keyidlen);
break;
}
}
@ -354,6 +436,7 @@ if (export_cert) {
/* We now have loads of certificates: include them all */
for(i = 0; i < sk_X509_num(certs); i++) {
X509 *cert = NULL;
cert = sk_X509_value(certs, i);
bag = M_PKCS12_x5092certbag(cert);
/* If it matches private key set id */
@ -364,7 +447,7 @@ if (export_cert) {
PKCS12_add_friendlyname(bag, catmp, -1);
sk_push(bags, (char *)bag);
}
sk_X509_pop_free(certs, X509_free);
if (canames) sk_free(canames);
if(!noprompt &&
@ -390,8 +473,7 @@ if (export_cert) {
p8 = EVP_PKEY2PKCS8 (key);
EVP_PKEY_free(key);
if(keytype) PKCS8_add_keyusage(p8, keytype);
bag = PKCS12_MAKE_SHKEYBAG(NID_pbe_WithSHA1And3_Key_TripleDES_CBC,
cpass, -1, NULL, 0, iter, p8);
bag = PKCS12_MAKE_SHKEYBAG(key_pbe, cpass, -1, NULL, 0, iter, p8);
PKCS8_PRIV_KEY_INFO_free(p8);
if (name) PKCS12_add_friendlyname (bag, name, -1);
PKCS12_add_localkeyid (bag, keyid, keyidlen);
@ -415,6 +497,10 @@ if (export_cert) {
PKCS12_free(p12);
ret = 0;
#ifdef CRYPTO_MDEBUG
CRYPTO_pop_info();
#endif
goto end;
}
@ -424,50 +510,61 @@ if (export_cert) {
goto end;
}
#ifdef CRYPTO_MDEBUG
CRYPTO_push_info("read import password");
#endif
if(!noprompt && EVP_read_pw_string(pass, 50, "Enter Import Password:", 0)) {
BIO_printf (bio_err, "Can't read Password\n");
goto end;
}
#ifdef CRYPTO_MDEBUG
CRYPTO_pop_info();
#endif
if (!twopass) strcpy(macpass, pass);
if (options & INFO) BIO_printf (bio_err, "MAC Iteration %ld\n", p12->mac->iter ? ASN1_INTEGER_get (p12->mac->iter) : 1);
if(macver) {
#ifdef CRYPTO_MDEBUG
CRYPTO_push_info("verify MAC");
#endif
if (!PKCS12_verify_mac (p12, mpass, -1)) {
BIO_printf (bio_err, "Mac verify errror: invalid password?\n");
BIO_printf (bio_err, "Mac verify error: invalid password?\n");
ERR_print_errors (bio_err);
goto end;
} else BIO_printf (bio_err, "MAC verified OK\n");
#ifdef CRYPTO_MDEBUG
CRYPTO_pop_info();
#endif
}
if (!dump_certs_keys_p12 (out, p12, cpass, -1, options)) {
#ifdef CRYPTO_MDEBUG
CRYPTO_push_info("output keys and certificates");
#endif
if (!dump_certs_keys_p12 (out, p12, cpass, -1, options, passout)) {
BIO_printf(bio_err, "Error outputting keys and certificates\n");
ERR_print_errors (bio_err);
goto end;
}
#ifdef CRYPTO_MDEBUG
CRYPTO_pop_info();
#endif
PKCS12_free(p12);
ret = 0;
end:
if(export_cert || inrand) app_RAND_write_file(NULL, bio_err);
#ifdef CRYPTO_MDEBUG
CRYPTO_remove_all_info();
#endif
BIO_free(in);
BIO_free(out);
if(passin) Free(passin);
if(passout) Free(passout);
EXIT(ret);
}
int dump_cert_text (BIO *out, X509 *x)
{
char buf[256];
X509_NAME_oneline(X509_get_subject_name(x),buf,256);
BIO_puts(out,"subject=");
BIO_puts(out,buf);
X509_NAME_oneline(X509_get_issuer_name(x),buf,256);
BIO_puts(out,"\nissuer= ");
BIO_puts(out,buf);
BIO_puts(out,"\n");
return 0;
}
int dump_certs_keys_p12 (BIO *out, PKCS12 *p12, char *pass,
int passlen, int options)
int passlen, int options, char *pempass)
{
STACK *asafes, *bags;
int i, bagnid;
@ -489,7 +586,7 @@ int dump_certs_keys_p12 (BIO *out, PKCS12 *p12, char *pass,
} else continue;
if (!bags) return 0;
if (!dump_certs_pkeys_bags (out, bags, pass, passlen,
options)) {
options, pempass)) {
sk_pop_free (bags, PKCS12_SAFEBAG_free);
return 0;
}
@ -500,19 +597,19 @@ int dump_certs_keys_p12 (BIO *out, PKCS12 *p12, char *pass,
}
int dump_certs_pkeys_bags (BIO *out, STACK *bags, char *pass,
int passlen, int options)
int passlen, int options, char *pempass)
{
int i;
for (i = 0; i < sk_num (bags); i++) {
if (!dump_certs_pkeys_bag (out,
(PKCS12_SAFEBAG *)sk_value (bags, i), pass, passlen,
options)) return 0;
options, pempass)) return 0;
}
return 1;
}
int dump_certs_pkeys_bag (BIO *out, PKCS12_SAFEBAG *bag, char *pass,
int passlen, int options)
int passlen, int options, char *pempass)
{
EVP_PKEY *pkey;
PKCS8_PRIV_KEY_INFO *p8;
@ -527,7 +624,7 @@ int dump_certs_pkeys_bag (BIO *out, PKCS12_SAFEBAG *bag, char *pass,
p8 = bag->value.keybag;
if (!(pkey = EVP_PKCS82PKEY (p8))) return 0;
print_attribs (out, p8->attributes, "Key Attributes");
PEM_write_bio_PrivateKey (out, pkey, enc, NULL, 0, NULL, NULL);
PEM_write_bio_PrivateKey (out, pkey, enc, NULL, 0, NULL, pempass);
EVP_PKEY_free(pkey);
break;
@ -543,7 +640,7 @@ int dump_certs_pkeys_bag (BIO *out, PKCS12_SAFEBAG *bag, char *pass,
if (!(pkey = EVP_PKCS82PKEY (p8))) return 0;
print_attribs (out, p8->attributes, "Key Attributes");
PKCS8_PRIV_KEY_INFO_free(p8);
PEM_write_bio_PrivateKey (out, pkey, enc, NULL, 0, NULL, NULL);
PEM_write_bio_PrivateKey (out, pkey, enc, NULL, 0, NULL, pempass);
EVP_PKEY_free(pkey);
break;
@ -566,7 +663,7 @@ int dump_certs_pkeys_bag (BIO *out, PKCS12_SAFEBAG *bag, char *pass,
if (options & INFO) BIO_printf (bio_err, "Safe Contents bag\n");
print_attribs (out, bag->attrib, "Bag Attributes");
return dump_certs_pkeys_bags (out, bag->value.safes, pass,
passlen, options);
passlen, options, pempass);
default:
BIO_printf (bio_err, "Warning unsupported bag type: ");
@ -588,7 +685,7 @@ int get_cert_chain (X509 *cert, STACK_OF(X509) **chain)
X509_STORE_CTX store_ctx;
STACK_OF(X509) *chn;
int i;
X509 *x;
store = X509_STORE_new ();
X509_STORE_set_default_paths (store);
X509_STORE_CTX_init(&store_ctx, store, cert, NULL);
@ -596,11 +693,7 @@ int get_cert_chain (X509 *cert, STACK_OF(X509) **chain)
i = X509_STORE_CTX_get_error (&store_ctx);
goto err;
}
chn = sk_X509_dup(X509_STORE_CTX_get_chain (&store_ctx));
for (i = 0; i < sk_X509_num(chn); i++) {
x = sk_X509_value(chn, i);
CRYPTO_add(&x->references,1,CRYPTO_LOCK_X509);
}
chn = X509_STORE_CTX_get1_chain(&store_ctx);
i = 0;
*chain = chn;
err:

View File

@ -71,27 +71,23 @@
#undef PROG
#define PROG pkcs7_main
/* -inform arg - input format - default PEM (one of DER, TXT or PEM)
/* -inform arg - input format - default PEM (DER or PEM)
* -outform arg - output format - default PEM
* -in arg - input file - default stdin
* -out arg - output file - default stdout
* -des - encrypt output if PEM format with DES in cbc mode
* -des3 - encrypt output if PEM format
* -idea - encrypt output if PEM format
* -print_certs
*/
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
PKCS7 *p7=NULL;
int i,badops=0;
#if !defined(NO_DES) || !defined(NO_IDEA)
EVP_CIPHER *enc=NULL;
#endif
BIO *in=NULL,*out=NULL;
int informat,outformat;
char *infile,*outfile,*prog,buf[256];
int print_certs=0;
char *infile,*outfile,*prog;
int print_certs=0,text=0,noout=0;
int ret=0;
apps_startup();
@ -130,18 +126,12 @@ int MAIN(int argc, char **argv)
if (--argc < 1) goto bad;
outfile= *(++argv);
}
else if (strcmp(*argv,"-noout") == 0)
noout=1;
else if (strcmp(*argv,"-text") == 0)
text=1;
else if (strcmp(*argv,"-print_certs") == 0)
print_certs=1;
#ifndef NO_DES
else if (strcmp(*argv,"-des") == 0)
enc=EVP_des_cbc();
else if (strcmp(*argv,"-des3") == 0)
enc=EVP_des_ede3_cbc();
#endif
#ifndef NO_IDEA
else if (strcmp(*argv,"-idea") == 0)
enc=EVP_idea_cbc();
#endif
else
{
BIO_printf(bio_err,"unknown option %s\n",*argv);
@ -157,16 +147,13 @@ int MAIN(int argc, char **argv)
bad:
BIO_printf(bio_err,"%s [options] <infile >outfile\n",prog);
BIO_printf(bio_err,"where options are\n");
BIO_printf(bio_err," -inform arg input format - one of DER TXT PEM\n");
BIO_printf(bio_err," -outform arg output format - one of DER TXT PEM\n");
BIO_printf(bio_err," -inform arg input format - DER or PEM\n");
BIO_printf(bio_err," -outform arg output format - DER or PEM\n");
BIO_printf(bio_err," -in arg input file\n");
BIO_printf(bio_err," -out arg output file\n");
BIO_printf(bio_err," -print_certs print any certs or crl in the input\n");
BIO_printf(bio_err," -des encrypt PEM output with cbc des\n");
BIO_printf(bio_err," -des3 encrypt PEM output with ede cbc des using 168 bit key\n");
#ifndef NO_IDEA
BIO_printf(bio_err," -idea encrypt PEM output with cbc idea\n");
#endif
BIO_printf(bio_err," -text print full details of certificates\n");
BIO_printf(bio_err," -noout don't output encoded data\n");
EXIT(1);
}
@ -246,19 +233,10 @@ int MAIN(int argc, char **argv)
for (i=0; i<sk_X509_num(certs); i++)
{
x=sk_X509_value(certs,i);
if(text) X509_print(out, x);
else dump_cert_text(out, x);
X509_NAME_oneline(X509_get_subject_name(x),
buf,256);
BIO_puts(out,"subject=");
BIO_puts(out,buf);
X509_NAME_oneline(X509_get_issuer_name(x),
buf,256);
BIO_puts(out,"\nissuer= ");
BIO_puts(out,buf);
BIO_puts(out,"\n");
PEM_write_bio_X509(out,x);
if(!noout) PEM_write_bio_X509(out,x);
BIO_puts(out,"\n");
}
}
@ -270,17 +248,9 @@ int MAIN(int argc, char **argv)
{
crl=sk_X509_CRL_value(crls,i);
X509_NAME_oneline(crl->crl->issuer,buf,256);
BIO_puts(out,"issuer= ");
BIO_puts(out,buf);
X509_CRL_print(out, crl);
BIO_puts(out,"\nlast update=");
ASN1_TIME_print(out,crl->crl->lastUpdate);
BIO_puts(out,"\nnext update=");
ASN1_TIME_print(out,crl->crl->nextUpdate);
BIO_puts(out,"\n");
PEM_write_bio_X509_CRL(out,crl);
if(!noout)PEM_write_bio_X509_CRL(out,crl);
BIO_puts(out,"\n");
}
}
@ -289,21 +259,23 @@ int MAIN(int argc, char **argv)
goto end;
}
if (outformat == FORMAT_ASN1)
i=i2d_PKCS7_bio(out,p7);
else if (outformat == FORMAT_PEM)
i=PEM_write_bio_PKCS7(out,p7);
else {
BIO_printf(bio_err,"bad output format specified for outfile\n");
goto end;
}
if(!noout) {
if (outformat == FORMAT_ASN1)
i=i2d_PKCS7_bio(out,p7);
else if (outformat == FORMAT_PEM)
i=PEM_write_bio_PKCS7(out,p7);
else {
BIO_printf(bio_err,"bad output format specified for outfile\n");
goto end;
}
if (!i)
{
BIO_printf(bio_err,"unable to write pkcs7 object\n");
ERR_print_errors(bio_err);
goto end;
}
if (!i)
{
BIO_printf(bio_err,"unable to write pkcs7 object\n");
ERR_print_errors(bio_err);
goto end;
}
}
ret=0;
end:
if (p7 != NULL) PKCS7_free(p7);

View File

@ -57,6 +57,7 @@
*/
#include <stdio.h>
#include <string.h>
#include "apps.h"
#include <openssl/pem.h>
#include <openssl/err.h>
#include <openssl/evp.h>
@ -65,10 +66,12 @@
#include "apps.h"
#define PROG pkcs8_main
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
char **args, *infile = NULL, *outfile = NULL;
char *passargin = NULL, *passargout = NULL;
BIO *in = NULL, *out = NULL;
int topk8 = 0;
int pbe_nid = -1;
@ -80,13 +83,13 @@ int MAIN(int argc, char **argv)
X509_SIG *p8;
PKCS8_PRIV_KEY_INFO *p8inf;
EVP_PKEY *pkey;
char pass[50];
char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL;
int badarg = 0;
if (bio_err == NULL) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);
informat=FORMAT_PEM;
outformat=FORMAT_PEM;
ERR_load_crypto_strings();
SSLeay_add_all_algorithms();
OpenSSL_add_all_algorithms();
args = argv + 1;
while (!badarg && *args && *args[0] == '-') {
if (!strcmp(*args,"-v2")) {
@ -99,6 +102,16 @@ int MAIN(int argc, char **argv)
badarg = 1;
}
} else badarg = 1;
} else if (!strcmp(*args,"-v1")) {
if (args[1]) {
args++;
pbe_nid=OBJ_txt2nid(*args);
if(pbe_nid == NID_undef) {
BIO_printf(bio_err,
"Unknown PBE algorithm %s\n", *args);
badarg = 1;
}
} else badarg = 1;
} else if (!strcmp(*args,"-inform")) {
if (args[1]) {
args++;
@ -113,6 +126,18 @@ int MAIN(int argc, char **argv)
else if (!strcmp (*args, "-noiter")) iter = 1;
else if (!strcmp (*args, "-nocrypt")) nocrypt = 1;
else if (!strcmp (*args, "-nooct")) p8_broken = PKCS8_NO_OCTET;
else if (!strcmp (*args, "-nsdb")) p8_broken = PKCS8_NS_DB;
else if (!strcmp (*args, "-embed")) p8_broken = PKCS8_EMBEDDED_PARAM;
else if (!strcmp(*args,"-passin"))
{
if (!args[1]) goto bad;
passargin= *(++args);
}
else if (!strcmp(*args,"-passout"))
{
if (!args[1]) goto bad;
passargout= *(++args);
}
else if (!strcmp (*args, "-in")) {
if (args[1]) {
args++;
@ -128,25 +153,36 @@ int MAIN(int argc, char **argv)
}
if (badarg) {
BIO_printf (bio_err, "Usage pkcs8 [options]\n");
BIO_printf (bio_err, "where options are\n");
BIO_printf (bio_err, "-in file input file\n");
BIO_printf (bio_err, "-inform X input format (DER or PEM)\n");
BIO_printf (bio_err, "-outform X output format (DER or PEM)\n");
BIO_printf (bio_err, "-out file output file\n");
BIO_printf (bio_err, "-topk8 output PKCS8 file\n");
BIO_printf (bio_err, "-nooct use (broken) no octet form\n");
BIO_printf (bio_err, "-noiter use 1 as iteration count\n");
BIO_printf (bio_err, "-nocrypt use or expect unencrypted private key\n");
BIO_printf (bio_err, "-v2 alg use PKCS#5 v2.0 and cipher \"alg\"\n");
bad:
BIO_printf(bio_err, "Usage pkcs8 [options]\n");
BIO_printf(bio_err, "where options are\n");
BIO_printf(bio_err, "-in file input file\n");
BIO_printf(bio_err, "-inform X input format (DER or PEM)\n");
BIO_printf(bio_err, "-passin arg input file pass phrase source\n");
BIO_printf(bio_err, "-outform X output format (DER or PEM)\n");
BIO_printf(bio_err, "-out file output file\n");
BIO_printf(bio_err, "-passout arg output file pass phrase source\n");
BIO_printf(bio_err, "-topk8 output PKCS8 file\n");
BIO_printf(bio_err, "-nooct use (nonstandard) no octet format\n");
BIO_printf(bio_err, "-embed use (nonstandard) embedded DSA parameters format\n");
BIO_printf(bio_err, "-nsdb use (nonstandard) DSA Netscape DB format\n");
BIO_printf(bio_err, "-noiter use 1 as iteration count\n");
BIO_printf(bio_err, "-nocrypt use or expect unencrypted private key\n");
BIO_printf(bio_err, "-v2 alg use PKCS#5 v2.0 and cipher \"alg\"\n");
BIO_printf(bio_err, "-v1 obj use PKCS#5 v1.5 and cipher \"alg\"\n");
return (1);
}
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
BIO_printf(bio_err, "Error getting passwords\n");
return (1);
}
if ((pbe_nid == -1) && !cipher) pbe_nid = NID_pbeWithMD5AndDES_CBC;
if (infile) {
if (!(in = BIO_new_file (infile, "rb"))) {
BIO_printf (bio_err,
if (!(in = BIO_new_file(infile, "rb"))) {
BIO_printf(bio_err,
"Can't open input file %s\n", infile);
return (1);
}
@ -154,25 +190,32 @@ int MAIN(int argc, char **argv)
if (outfile) {
if (!(out = BIO_new_file (outfile, "wb"))) {
BIO_printf (bio_err,
BIO_printf(bio_err,
"Can't open output file %s\n", outfile);
return (1);
}
} else out = BIO_new_fp (stdout, BIO_NOCLOSE);
if (topk8) {
if (!(pkey = PEM_read_bio_PrivateKey(in, NULL, NULL, NULL))) {
BIO_printf (bio_err, "Error reading key\n", outfile);
if(informat == FORMAT_PEM)
pkey = PEM_read_bio_PrivateKey(in, NULL, NULL, passin);
else if(informat == FORMAT_ASN1)
pkey = d2i_PrivateKey_bio(in, NULL);
else {
BIO_printf(bio_err, "Bad format specified for key\n");
return (1);
}
if (!pkey) {
BIO_printf(bio_err, "Error reading key\n", outfile);
ERR_print_errors(bio_err);
return (1);
}
BIO_free(in);
if (!(p8inf = EVP_PKEY2PKCS8(pkey))) {
BIO_printf (bio_err, "Error converting key\n", outfile);
if (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken))) {
BIO_printf(bio_err, "Error converting key\n", outfile);
ERR_print_errors(bio_err);
return (1);
}
PKCS8_set_broken(p8inf, p8_broken);
if(nocrypt) {
if(outformat == FORMAT_PEM)
PEM_write_bio_PKCS8_PRIV_KEY_INFO(out, p8inf);
@ -183,17 +226,23 @@ int MAIN(int argc, char **argv)
return (1);
}
} else {
EVP_read_pw_string(pass, 50, "Enter Encryption Password:", 1);
if(passout) p8pass = passout;
else {
p8pass = pass;
EVP_read_pw_string(pass, 50, "Enter Encryption Password:", 1);
}
app_RAND_load_file(NULL, bio_err, 0);
if (!(p8 = PKCS8_encrypt(pbe_nid, cipher,
pass, strlen(pass),
p8pass, strlen(p8pass),
NULL, 0, iter, p8inf))) {
BIO_printf (bio_err, "Error encrypting key\n",
BIO_printf(bio_err, "Error encrypting key\n",
outfile);
ERR_print_errors(bio_err);
return (1);
}
app_RAND_write_file(NULL, bio_err);
if(outformat == FORMAT_PEM)
PEM_write_bio_PKCS8 (out, p8);
PEM_write_bio_PKCS8(out, p8);
else if(outformat == FORMAT_ASN1)
i2d_PKCS8_bio(out, p8);
else {
@ -205,6 +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);
return (0);
}
@ -232,8 +283,12 @@ int MAIN(int argc, char **argv)
ERR_print_errors(bio_err);
return (1);
}
EVP_read_pw_string(pass, 50, "Enter Password:", 0);
p8inf = M_PKCS8_decrypt(p8, pass, strlen(pass));
if(passin) p8pass = passin;
else {
p8pass = pass;
EVP_read_pw_string(pass, 50, "Enter Password:", 0);
}
p8inf = M_PKCS8_decrypt(p8, p8pass, strlen(p8pass));
X509_SIG_free(p8);
}
@ -253,7 +308,15 @@ int MAIN(int argc, char **argv)
BIO_printf(bio_err, "Warning: broken key encoding: ");
switch (p8inf->broken) {
case PKCS8_NO_OCTET:
BIO_printf(bio_err, "No Octet String\n");
BIO_printf(bio_err, "No Octet String in PrivateKey\n");
break;
case PKCS8_EMBEDDED_PARAM:
BIO_printf(bio_err, "DSA parameters included in PrivateKey\n");
break;
case PKCS8_NS_DB:
BIO_printf(bio_err, "DSA public key include in PrivateKey\n");
break;
default:
@ -263,12 +326,20 @@ int MAIN(int argc, char **argv)
}
PKCS8_PRIV_KEY_INFO_free(p8inf);
PEM_write_bio_PrivateKey(out, pkey, NULL, NULL, 0, NULL, NULL);
if(outformat == FORMAT_PEM)
PEM_write_bio_PrivateKey(out, pkey, NULL, NULL, 0, NULL, passout);
else if(outformat == FORMAT_ASN1)
i2d_PrivateKey_bio(out, pkey);
else {
BIO_printf(bio_err, "Bad format specified for key\n");
return (1);
}
EVP_PKEY_free(pkey);
BIO_free(out);
BIO_free(in);
if(passin) Free(passin);
if(passout) Free(passout);
return (0);
}

View File

@ -1,11 +1,14 @@
/* This file was generated by progs.pl. */
/* apps/progs.h */
/* automatically generated by progs.pl for openssl.c */
extern int verify_main(int argc,char *argv[]);
extern int asn1parse_main(int argc,char *argv[]);
extern int req_main(int argc,char *argv[]);
extern int dgst_main(int argc,char *argv[]);
extern int dh_main(int argc,char *argv[]);
extern int dhparam_main(int argc,char *argv[]);
extern int enc_main(int argc,char *argv[]);
extern int passwd_main(int argc,char *argv[]);
extern int gendh_main(int argc,char *argv[]);
extern int errstr_main(int argc,char *argv[]);
extern int ca_main(int argc,char *argv[]);
@ -28,8 +31,9 @@ extern int ciphers_main(int argc,char *argv[]);
extern int nseq_main(int argc,char *argv[]);
extern int pkcs12_main(int argc,char *argv[]);
extern int pkcs8_main(int argc,char *argv[]);
#ifdef SSLEAY_SRC /* Defined only in openssl.c. */
extern int spkac_main(int argc,char *argv[]);
extern int smime_main(int argc,char *argv[]);
extern int rand_main(int argc,char *argv[]);
#define FUNC_TYPE_GENERAL 1
#define FUNC_TYPE_MD 2
@ -48,8 +52,12 @@ FUNCTION functions[] = {
{FUNC_TYPE_GENERAL,"dgst",dgst_main},
#ifndef NO_DH
{FUNC_TYPE_GENERAL,"dh",dh_main},
#endif
#ifndef NO_DH
{FUNC_TYPE_GENERAL,"dhparam",dhparam_main},
#endif
{FUNC_TYPE_GENERAL,"enc",enc_main},
{FUNC_TYPE_GENERAL,"passwd",passwd_main},
#ifndef NO_DH
{FUNC_TYPE_GENERAL,"gendh",gendh_main},
#endif
@ -72,14 +80,14 @@ FUNCTION functions[] = {
#ifndef NO_DSA
{FUNC_TYPE_GENERAL,"gendsa",gendsa_main},
#endif
#if !defined(NO_SOCK) && !(defined(NO_SSL2) && defined(O_SSL3))
#if !defined(NO_SOCK) && !(defined(NO_SSL2) && defined(NO_SSL3))
{FUNC_TYPE_GENERAL,"s_server",s_server_main},
#endif
#if !defined(NO_SOCK) && !(defined(NO_SSL2) && defined(O_SSL3))
#if !defined(NO_SOCK) && !(defined(NO_SSL2) && defined(NO_SSL3))
{FUNC_TYPE_GENERAL,"s_client",s_client_main},
#endif
{FUNC_TYPE_GENERAL,"speed",speed_main},
#if !defined(NO_SOCK) && !(defined(NO_SSL2) && defined(O_SSL3))
#if !defined(NO_SOCK) && !(defined(NO_SSL2) && defined(NO_SSL3))
{FUNC_TYPE_GENERAL,"s_time",s_time_main},
#endif
{FUNC_TYPE_GENERAL,"version",version_main},
@ -94,6 +102,9 @@ FUNCTION functions[] = {
{FUNC_TYPE_GENERAL,"pkcs12",pkcs12_main},
#endif
{FUNC_TYPE_GENERAL,"pkcs8",pkcs8_main},
{FUNC_TYPE_GENERAL,"spkac",spkac_main},
{FUNC_TYPE_GENERAL,"smime",smime_main},
{FUNC_TYPE_GENERAL,"rand",rand_main},
{FUNC_TYPE_MD,"md2",dgst_main},
{FUNC_TYPE_MD,"md5",dgst_main},
{FUNC_TYPE_MD,"sha",dgst_main},
@ -116,6 +127,9 @@ FUNCTION functions[] = {
#ifndef NO_RC4
{FUNC_TYPE_CIPHER,"rc4",enc_main},
#endif
#ifndef NO_RC4
{FUNC_TYPE_CIPHER,"rc4-40",enc_main},
#endif
#ifndef NO_RC2
{FUNC_TYPE_CIPHER,"rc2",enc_main},
#endif
@ -188,6 +202,12 @@ FUNCTION functions[] = {
#ifndef NO_RC2
{FUNC_TYPE_CIPHER,"rc2-ofb",enc_main},
#endif
#ifndef NO_RC2
{FUNC_TYPE_CIPHER,"rc2-64-cbc",enc_main},
#endif
#ifndef NO_RC2
{FUNC_TYPE_CIPHER,"rc2-40-cbc",enc_main},
#endif
#ifndef NO_BF
{FUNC_TYPE_CIPHER,"bf-cbc",enc_main},
#endif
@ -229,5 +249,3 @@ FUNCTION functions[] = {
#endif
{0,NULL,NULL}
};
#endif

View File

@ -1,6 +1,7 @@
#!/usr/local/bin/perl
print "/* This file was generated by progs.pl. */\n\n";
print "/* apps/progs.h */\n";
print "/* automatically generated by progs.pl for openssl.c */\n\n";
grep(s/^asn1pars$/asn1parse/,@ARGV);
@ -9,8 +10,6 @@ foreach (@ARGV)
print <<'EOF';
#ifdef SSLEAY_SRC /* Defined only in openssl.c. */
#define FUNC_TYPE_GENERAL 1
#define FUNC_TYPE_MD 2
#define FUNC_TYPE_CIPHER 3
@ -29,13 +28,15 @@ foreach (@ARGV)
push(@files,$_);
$str="\t{FUNC_TYPE_GENERAL,\"$_\",${_}_main},\n";
if (($_ =~ /^s_/) || ($_ =~ /^ciphers$/))
{ print "#if !defined(NO_SOCK) && !(defined(NO_SSL2) && defined(O_SSL3))\n${str}#endif\n"; }
{ print "#if !defined(NO_SOCK) && !(defined(NO_SSL2) && defined(NO_SSL3))\n${str}#endif\n"; }
elsif ( ($_ =~ /^rsa$/) || ($_ =~ /^genrsa$/) )
{ print "#ifndef NO_RSA\n${str}#endif\n"; }
elsif ( ($_ =~ /^dsa$/) || ($_ =~ /^gendsa$/) || ($_ =~ /^dsaparam$/))
{ print "#ifndef NO_DSA\n${str}#endif\n"; }
elsif ( ($_ =~ /^dh$/) || ($_ =~ /^gendh$/))
elsif ( ($_ =~ /^dh$/) || ($_ =~ /^gendh$/) || ($_ =~ /^dhparam$/))
{ print "#ifndef NO_DH\n${str}#endif\n"; }
elsif ( ($_ =~ /^pkcs12$/))
{ print "#if !defined(NO_DES) && !defined(NO_SHA1)\n${str}#endif\n"; }
else
{ print $str; }
}
@ -48,13 +49,14 @@ foreach ("md2","md5","sha","sha1","mdc2","rmd160")
foreach (
"base64",
"des", "des3", "desx", "idea", "rc4", "rc2","bf","cast","rc5",
"des", "des3", "desx", "idea", "rc4", "rc4-40",
"rc2", "bf", "cast", "rc5",
"des-ecb", "des-ede", "des-ede3",
"des-cbc", "des-ede-cbc","des-ede3-cbc",
"des-cfb", "des-ede-cfb","des-ede3-cfb",
"des-ofb", "des-ede-ofb","des-ede3-ofb",
"idea-cbc","idea-ecb", "idea-cfb", "idea-ofb",
"rc2-cbc", "rc2-ecb", "rc2-cfb", "rc2-ofb",
"rc2-cbc", "rc2-ecb", "rc2-cfb","rc2-ofb", "rc2-64-cbc", "rc2-40-cbc",
"bf-cbc", "bf-ecb", "bf-cfb", "bf-ofb",
"cast5-cbc","cast5-ecb", "cast5-cfb","cast5-ofb",
"cast-cbc", "rc5-cbc", "rc5-ecb", "rc5-cfb", "rc5-ofb")
@ -73,5 +75,3 @@ foreach (
}
print "\t{0,NULL,NULL}\n\t};\n";
print "#endif\n\n";

140
crypto/openssl/apps/rand.c Normal file
View File

@ -0,0 +1,140 @@
/* apps/rand.c */
#include "apps.h"
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#undef PROG
#define PROG rand_main
/* -out file - write to file
* -rand file:file - PRNG seed files
* -base64 - encode output
* num - write 'num' bytes
*/
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
int i, r, ret = 1;
int badopt;
char *outfile = NULL;
char *inrand = NULL;
int base64 = 0;
BIO *out = NULL;
int num = -1;
apps_startup();
if (bio_err == NULL)
if ((bio_err = BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err, stderr, BIO_NOCLOSE|BIO_FP_TEXT);
badopt = 0;
i = 0;
while (!badopt && argv[++i] != NULL)
{
if (strcmp(argv[i], "-out") == 0)
{
if ((argv[i+1] != NULL) && (outfile == NULL))
outfile = argv[++i];
else
badopt = 1;
}
else if (strcmp(argv[i], "-rand") == 0)
{
if ((argv[i+1] != NULL) && (inrand == NULL))
inrand = argv[++i];
else
badopt = 1;
}
else if (strcmp(argv[i], "-base64") == 0)
{
if (!base64)
base64 = 1;
else
badopt = 1;
}
else if (isdigit(argv[i][0]))
{
if (num < 0)
{
r = sscanf(argv[i], "%d", &num);
if (r == 0 || num < 0)
badopt = 1;
}
else
badopt = 1;
}
else
badopt = 1;
}
if (num < 0)
badopt = 1;
if (badopt)
{
BIO_printf(bio_err, "Usage: rand [options] num\n");
BIO_printf(bio_err, "where options are\n");
BIO_printf(bio_err, "-out file - write to file\n");
BIO_printf(bio_err, "-rand file%cfile%c... - seed PRNG from files\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
BIO_printf(bio_err, "-base64 - encode output\n");
goto err;
}
app_RAND_load_file(NULL, bio_err, (inrand != NULL));
if (inrand != NULL)
BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
app_RAND_load_files(inrand));
out = BIO_new(BIO_s_file());
if (out == NULL)
goto err;
if (outfile != NULL)
r = BIO_write_filename(out, outfile);
else
r = BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT);
if (r <= 0)
goto err;
if (base64)
{
BIO *b64 = BIO_new(BIO_f_base64());
if (b64 == NULL)
goto err;
out = BIO_push(b64, out);
}
while (num > 0)
{
unsigned char buf[4096];
int chunk;
chunk = num;
if (chunk > sizeof buf)
chunk = sizeof buf;
r = RAND_bytes(buf, chunk);
if (r <= 0)
goto err;
BIO_write(out, buf, chunk);
num -= chunk;
}
BIO_flush(out);
app_RAND_write_file(NULL, bio_err);
ret = 0;
err:
ERR_print_errors(bio_err);
if (out)
BIO_free_all(out);
EXIT(ret);
}

View File

@ -66,7 +66,6 @@
#include "apps.h"
#include <openssl/bio.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
#include <openssl/conf.h>
#include <openssl/err.h>
#include <openssl/asn1.h>
@ -79,9 +78,12 @@
#define BITS "default_bits"
#define KEYFILE "default_keyfile"
#define PROMPT "prompt"
#define DISTINGUISHED_NAME "distinguished_name"
#define ATTRIBUTES "attributes"
#define V3_EXTENSIONS "x509_extensions"
#define REQ_EXTENSIONS "req_extensions"
#define STRING_MASK "string_mask"
#define DEFAULT_KEY_LENGTH 512
#define MIN_KEY_LENGTH 384
@ -89,7 +91,7 @@
#undef PROG
#define PROG req_main
/* -inform arg - input format - default PEM (one of DER, TXT or PEM)
/* -inform arg - input format - default PEM (DER or PEM)
* -outform arg - output format - default PEM
* -in arg - input file - default stdin
* -out arg - output file - default stdout
@ -108,13 +110,20 @@
*/
static int make_REQ(X509_REQ *req,EVP_PKEY *pkey,int attribs);
static int add_attribute_object(STACK_OF(X509_ATTRIBUTE) *n, char *text,
static int prompt_info(X509_REQ *req,
STACK_OF(CONF_VALUE) *dn_sk, char *dn_sect,
STACK_OF(CONF_VALUE) *attr_sk, char *attr_sect, int attribs);
static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *sk,
STACK_OF(CONF_VALUE) *attr, int attribs);
static int add_attribute_object(X509_REQ *req, char *text,
char *def, char *value, int nid, int min,
int max);
static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,
int nid,int min,int max);
#ifndef NO_RSA
static void MS_CALLBACK req_cb(int p,int n,void *arg);
static int req_fix_data(int nid,int *type,int len,int min,int max);
#endif
static int req_check_len(int len,int min,int max);
static int check_end(char *str, char *end);
static int add_oid_section(LHASH *conf);
#ifndef MONOLITH
@ -127,6 +136,8 @@ static LHASH *req_conf=NULL;
#define TYPE_DSA 2
#define TYPE_DH 3
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
#ifndef NO_DSA
@ -139,17 +150,21 @@ int MAIN(int argc, char **argv)
int i,badops=0,newreq=0,newkey= -1,pkey_type=0;
BIO *in=NULL,*out=NULL;
int informat,outformat,verify=0,noout=0,text=0,keyform=FORMAT_PEM;
int nodes=0,kludge=0;
int nodes=0,kludge=0,newhdr=0;
char *infile,*outfile,*prog,*keyfile=NULL,*template=NULL,*keyout=NULL;
char *extensions = NULL;
char *req_exts = NULL;
EVP_CIPHER *cipher=NULL;
int modulus=0;
char *passargin = NULL, *passargout = NULL;
char *passin = NULL, *passout = NULL;
char *p;
const EVP_MD *md_alg=NULL,*digest=EVP_md5();
#ifndef MONOLITH
MS_STATIC char config_name[256];
#endif
req_conf = NULL;
#ifndef NO_DES
cipher=EVP_des_ede3_cbc();
#endif
@ -214,6 +229,16 @@ int MAIN(int argc, char **argv)
if (--argc < 1) goto bad;
keyout= *(++argv);
}
else if (strcmp(*argv,"-passin") == 0)
{
if (--argc < 1) goto bad;
passargin= *(++argv);
}
else if (strcmp(*argv,"-passout") == 0)
{
if (--argc < 1) goto bad;
passargout= *(++argv);
}
else if (strcmp(*argv,"-newkey") == 0)
{
int is_numeric;
@ -281,6 +306,8 @@ int MAIN(int argc, char **argv)
newreq=1;
}
else if (strcmp(*argv,"-newhdr") == 0)
newhdr=1;
else if (strcmp(*argv,"-modulus") == 0)
modulus=1;
else if (strcmp(*argv,"-verify") == 0)
@ -308,8 +335,17 @@ int MAIN(int argc, char **argv)
/* ok */
digest=md_alg;
}
else if (strcmp(*argv,"-extensions") == 0)
{
if (--argc < 1) goto bad;
extensions = *(++argv);
}
else if (strcmp(*argv,"-reqexts") == 0)
{
if (--argc < 1) goto bad;
req_exts = *(++argv);
}
else
{
BIO_printf(bio_err,"unknown option %s\n",*argv);
badops=1;
@ -324,8 +360,8 @@ int MAIN(int argc, char **argv)
bad:
BIO_printf(bio_err,"%s [options] <infile >outfile\n",prog);
BIO_printf(bio_err,"where options are\n");
BIO_printf(bio_err," -inform arg input format - one of DER TXT PEM\n");
BIO_printf(bio_err," -outform arg output format - one of DER TXT PEM\n");
BIO_printf(bio_err," -inform arg input format - DER or PEM\n");
BIO_printf(bio_err," -outform arg output format - DER or PEM\n");
BIO_printf(bio_err," -in arg input file\n");
BIO_printf(bio_err," -out arg output file\n");
BIO_printf(bio_err," -text text form of request\n");
@ -344,16 +380,21 @@ int MAIN(int argc, char **argv)
BIO_printf(bio_err," -new new request.\n");
BIO_printf(bio_err," -x509 output a x509 structure instead of a cert. req.\n");
BIO_printf(bio_err," -days number of days a x509 generated by -x509 is valid for.\n");
BIO_printf(bio_err," -newhdr output \"NEW\" in the header lines\n");
BIO_printf(bio_err," -asn1-kludge Output the 'request' in a format that is wrong but some CA's\n");
BIO_printf(bio_err," have been reported as requiring\n");
BIO_printf(bio_err," [ It is now always turned on but can be turned off with -no-asn1-kludge ]\n");
BIO_printf(bio_err," -extensions .. specify certificate extension section (override value in config file)\n");
BIO_printf(bio_err," -reqexts .. specify request extension section (override value in config file)\n");
goto end;
}
ERR_load_crypto_strings();
X509V3_add_standard_extensions();
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
BIO_printf(bio_err, "Error getting passwords\n");
goto end;
}
#ifndef MONOLITH
#ifndef MONOLITH /* else this has happened in openssl.c (global `config') */
/* Lets load up our environment a little */
p=getenv("OPENSSL_CONF");
if (p == NULL)
@ -367,7 +408,7 @@ int MAIN(int argc, char **argv)
strcat(config_name,OPENSSL_CONF);
p=config_name;
}
default_config_file=p;
default_config_file=p;
config=CONF_load(config,p,NULL);
#endif
@ -425,7 +466,8 @@ int MAIN(int argc, char **argv)
digest=md_alg;
}
extensions = CONF_get_string(req_conf, SECTION, V3_EXTENSIONS);
if(!extensions)
extensions = CONF_get_string(req_conf, SECTION, V3_EXTENSIONS);
if(extensions) {
/* Check syntax of file */
X509V3_CTX ctx;
@ -438,6 +480,34 @@ int MAIN(int argc, char **argv)
}
}
if(!passin)
passin = CONF_get_string(req_conf, SECTION, "input_password");
if(!passout)
passout = CONF_get_string(req_conf, SECTION, "output_password");
p = CONF_get_string(req_conf, SECTION, STRING_MASK);
if(p && !ASN1_STRING_set_default_mask_asc(p)) {
BIO_printf(bio_err, "Invalid global string mask setting %s\n", p);
goto end;
}
if(!req_exts)
req_exts = CONF_get_string(req_conf, SECTION, REQ_EXTENSIONS);
if(req_exts) {
/* Check syntax of file */
X509V3_CTX ctx;
X509V3_set_ctx_test(&ctx);
X509V3_set_conf_lhash(&ctx, req_conf);
if(!X509V3_EXT_add_conf(req_conf, &ctx, req_exts, NULL)) {
BIO_printf(bio_err,
"Error Loading request extension section %s\n",
req_exts);
goto end;
}
}
in=BIO_new(BIO_s_file());
out=BIO_new(BIO_s_file());
if ((in == NULL) || (out == NULL))
@ -451,11 +521,12 @@ int MAIN(int argc, char **argv)
goto end;
}
/* if (keyform == FORMAT_ASN1)
rsa=d2i_RSAPrivateKey_bio(in,NULL);
else */
if (keyform == FORMAT_PEM)
pkey=PEM_read_bio_PrivateKey(in,NULL,NULL,NULL);
if (keyform == FORMAT_ASN1)
pkey=d2i_PrivateKey_bio(in,NULL);
else if (keyform == FORMAT_PEM)
{
pkey=PEM_read_bio_PrivateKey(in,NULL,NULL,passin);
}
else
{
BIO_printf(bio_err,"bad input format specified for X509 request\n");
@ -471,25 +542,9 @@ int MAIN(int argc, char **argv)
if (newreq && (pkey == NULL))
{
char *randfile;
char buffer[200];
if ((randfile=CONF_get_string(req_conf,SECTION,"RANDFILE")) == NULL)
randfile=RAND_file_name(buffer,200);
#ifdef WINDOWS
BIO_printf(bio_err,"Loading 'screen' into random state -");
BIO_flush(bio_err);
RAND_screen();
BIO_printf(bio_err," done\n");
#endif
if ((randfile == NULL) || !RAND_load_file(randfile,1024L*1024L))
{
BIO_printf(bio_err,"unable to load 'random state'\n");
BIO_printf(bio_err,"What this means is that the random number generator has not been seeded\n");
BIO_printf(bio_err,"with much random data.\n");
BIO_printf(bio_err,"Consider setting the RANDFILE environment variable to point at a file that\n");
BIO_printf(bio_err,"'random' data can be kept in.\n");
}
char *randfile = CONF_get_string(req_conf,SECTION,"RANDFILE");
app_RAND_load_file(randfile, bio_err, 0);
if (newkey <= 0)
{
newkey=(int)CONF_get_number(req_conf,SECTION,BITS);
@ -527,8 +582,7 @@ int MAIN(int argc, char **argv)
}
#endif
if ((randfile == NULL) || (RAND_write_file(randfile) == 0))
BIO_printf(bio_err,"unable to write 'random state'\n");
app_RAND_write_file(randfile, bio_err);
if (pkey == NULL) goto end;
@ -560,7 +614,7 @@ int MAIN(int argc, char **argv)
i=0;
loop:
if (!PEM_write_bio_PrivateKey(out,pkey,cipher,
NULL,0,NULL,NULL))
NULL,0,NULL,passout))
{
if ((ERR_GET_REASON(ERR_peek_error()) ==
PEM_R_PROBLEMS_GETTING_PASSWORD) && (i < 3))
@ -677,6 +731,22 @@ int MAIN(int argc, char **argv)
}
else
{
X509V3_CTX ext_ctx;
/* Set up V3 context struct */
X509V3_set_ctx(&ext_ctx, NULL, NULL, req, NULL, 0);
X509V3_set_conf_lhash(&ext_ctx, req_conf);
/* Add extensions */
if(req_exts && !X509V3_EXT_REQ_add_conf(req_conf,
&ext_ctx, req_exts, req))
{
BIO_printf(bio_err,
"Error Loading extension section %s\n",
req_exts);
goto end;
}
if (!(i=X509_REQ_sign(req,pkey,digest)))
goto end;
}
@ -767,9 +837,10 @@ int MAIN(int argc, char **argv)
{
if (outformat == FORMAT_ASN1)
i=i2d_X509_REQ_bio(out,req);
else if (outformat == FORMAT_PEM)
i=PEM_write_bio_X509_REQ(out,req);
else {
else if (outformat == FORMAT_PEM) {
if(newhdr) i=PEM_write_bio_X509_REQ_NEW(out,req);
else i=PEM_write_bio_X509_REQ(out,req);
} else {
BIO_printf(bio_err,"bad output format specified for outfile\n");
goto end;
}
@ -807,7 +878,8 @@ int MAIN(int argc, char **argv)
EVP_PKEY_free(pkey);
X509_REQ_free(req);
X509_free(x509ss);
X509V3_EXT_cleanup();
if(passargin && passin) Free(passin);
if(passargout && passout) Free(passout);
OBJ_cleanup();
#ifndef NO_DSA
if (dsa_params != NULL) DSA_free(dsa_params);
@ -818,43 +890,67 @@ int MAIN(int argc, char **argv)
static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, int attribs)
{
int ret=0,i;
char *p,*q;
X509_REQ_INFO *ri;
char buf[100];
int nid,min,max;
char *type,*def,*tmp,*value,*tmp_attr;
STACK_OF(CONF_VALUE) *sk, *attr=NULL;
CONF_VALUE *v;
tmp=CONF_get_string(req_conf,SECTION,DISTINGUISHED_NAME);
if (tmp == NULL)
char no_prompt = 0;
STACK_OF(CONF_VALUE) *dn_sk, *attr_sk = NULL;
char *tmp, *dn_sect,*attr_sect;
tmp=CONF_get_string(req_conf,SECTION,PROMPT);
if((tmp != NULL) && !strcmp(tmp, "no")) no_prompt = 1;
dn_sect=CONF_get_string(req_conf,SECTION,DISTINGUISHED_NAME);
if (dn_sect == NULL)
{
BIO_printf(bio_err,"unable to find '%s' in config\n",
DISTINGUISHED_NAME);
goto err;
}
sk=CONF_get_section(req_conf,tmp);
if (sk == NULL)
dn_sk=CONF_get_section(req_conf,dn_sect);
if (dn_sk == NULL)
{
BIO_printf(bio_err,"unable to get '%s' section\n",tmp);
BIO_printf(bio_err,"unable to get '%s' section\n",dn_sect);
goto err;
}
tmp_attr=CONF_get_string(req_conf,SECTION,ATTRIBUTES);
if (tmp_attr == NULL)
attr=NULL;
attr_sect=CONF_get_string(req_conf,SECTION,ATTRIBUTES);
if (attr_sect == NULL)
attr_sk=NULL;
else
{
attr=CONF_get_section(req_conf,tmp_attr);
if (attr == NULL)
attr_sk=CONF_get_section(req_conf,attr_sect);
if (attr_sk == NULL)
{
BIO_printf(bio_err,"unable to get '%s' section\n",tmp_attr);
BIO_printf(bio_err,"unable to get '%s' section\n",attr_sect);
goto err;
}
}
ri=req->req_info;
/* setup version number */
if (!X509_REQ_set_version(req,0L)) goto err; /* version 1 */
if(no_prompt) i = auto_info(req, dn_sk, attr_sk, attribs);
else i = prompt_info(req, dn_sk, dn_sect, attr_sk, attr_sect, attribs);
if(!i) goto err;
X509_REQ_set_pubkey(req,pkey);
ret=1;
err:
return(ret);
}
static int prompt_info(X509_REQ *req,
STACK_OF(CONF_VALUE) *dn_sk, char *dn_sect,
STACK_OF(CONF_VALUE) *attr_sk, char *attr_sect, int attribs)
{
int i;
char *p,*q;
char buf[100];
int nid,min,max;
char *type,*def,*value;
CONF_VALUE *v;
X509_NAME *subj;
subj = X509_REQ_get_subject_name(req);
BIO_printf(bio_err,"You are about to be asked to enter information that will be incorporated\n");
BIO_printf(bio_err,"into your certificate request.\n");
BIO_printf(bio_err,"What you are about to enter is what is called a Distinguished Name or a DN.\n");
@ -863,18 +959,16 @@ static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, int attribs)
BIO_printf(bio_err,"If you enter '.', the field will be left blank.\n");
BIO_printf(bio_err,"-----\n");
/* setup version number */
if (!ASN1_INTEGER_set(ri->version,0L)) goto err; /* version 1 */
if (sk_CONF_VALUE_num(sk))
if (sk_CONF_VALUE_num(dn_sk))
{
i= -1;
start: for (;;)
{
i++;
if (sk_CONF_VALUE_num(sk) <= i) break;
if (sk_CONF_VALUE_num(dn_sk) <= i) break;
v=sk_CONF_VALUE_value(sk,i);
v=sk_CONF_VALUE_value(dn_sk,i);
p=q=NULL;
type=v->name;
if(!check_end(type,"_min") || !check_end(type,"_max") ||
@ -893,32 +987,32 @@ start: for (;;)
/* If OBJ not recognised ignore it */
if ((nid=OBJ_txt2nid(type)) == NID_undef) goto start;
sprintf(buf,"%s_default",v->name);
if ((def=CONF_get_string(req_conf,tmp,buf)) == NULL)
if ((def=CONF_get_string(req_conf,dn_sect,buf)) == NULL)
def="";
sprintf(buf,"%s_value",v->name);
if ((value=CONF_get_string(req_conf,tmp,buf)) == NULL)
if ((value=CONF_get_string(req_conf,dn_sect,buf)) == NULL)
value=NULL;
sprintf(buf,"%s_min",v->name);
min=(int)CONF_get_number(req_conf,tmp,buf);
min=(int)CONF_get_number(req_conf,dn_sect,buf);
sprintf(buf,"%s_max",v->name);
max=(int)CONF_get_number(req_conf,tmp,buf);
max=(int)CONF_get_number(req_conf,dn_sect,buf);
if (!add_DN_object(ri->subject,v->value,def,value,nid,
if (!add_DN_object(subj,v->value,def,value,nid,
min,max))
goto err;
return 0;
}
if (sk_X509_NAME_ENTRY_num(ri->subject->entries) == 0)
if (X509_NAME_entry_count(subj) == 0)
{
BIO_printf(bio_err,"error, no objects specified in config file\n");
goto err;
return 0;
}
if (attribs)
{
if ((attr != NULL) && (sk_CONF_VALUE_num(attr) > 0))
if ((attr_sk != NULL) && (sk_CONF_VALUE_num(attr_sk) > 0))
{
BIO_printf(bio_err,"\nPlease enter the following 'extra' attributes\n");
BIO_printf(bio_err,"to be sent with your certificate request\n");
@ -928,117 +1022,100 @@ start: for (;;)
start2: for (;;)
{
i++;
if ((attr == NULL) ||
(sk_CONF_VALUE_num(attr) <= i))
if ((attr_sk == NULL) ||
(sk_CONF_VALUE_num(attr_sk) <= i))
break;
v=sk_CONF_VALUE_value(attr,i);
v=sk_CONF_VALUE_value(attr_sk,i);
type=v->name;
if ((nid=OBJ_txt2nid(type)) == NID_undef)
goto start2;
sprintf(buf,"%s_default",type);
if ((def=CONF_get_string(req_conf,tmp_attr,buf))
if ((def=CONF_get_string(req_conf,attr_sect,buf))
== NULL)
def="";
sprintf(buf,"%s_value",type);
if ((value=CONF_get_string(req_conf,tmp_attr,buf))
if ((value=CONF_get_string(req_conf,attr_sect,buf))
== NULL)
value=NULL;
sprintf(buf,"%s_min",type);
min=(int)CONF_get_number(req_conf,tmp_attr,buf);
min=(int)CONF_get_number(req_conf,attr_sect,buf);
sprintf(buf,"%s_max",type);
max=(int)CONF_get_number(req_conf,tmp_attr,buf);
max=(int)CONF_get_number(req_conf,attr_sect,buf);
if (!add_attribute_object(ri->attributes,
if (!add_attribute_object(req,
v->value,def,value,nid,min,max))
goto err;
return 0;
}
}
}
else
{
BIO_printf(bio_err,"No template, please set one up.\n");
goto err;
return 0;
}
X509_REQ_set_pubkey(req,pkey);
return 1;
ret=1;
err:
return(ret);
}
static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *dn_sk,
STACK_OF(CONF_VALUE) *attr_sk, int attribs)
{
int i;
char *p,*q;
char *type;
CONF_VALUE *v;
X509_NAME *subj;
subj = X509_REQ_get_subject_name(req);
for (i = 0; i < sk_CONF_VALUE_num(dn_sk); i++)
{
v=sk_CONF_VALUE_value(dn_sk,i);
p=q=NULL;
type=v->name;
/* Skip past any leading X. X: X, etc to allow for
* multiple instances
*/
for(p = v->name; *p ; p++)
if ((*p == ':') || (*p == ',') || (*p == '.')) {
p++;
if(*p) type = p;
break;
}
if (!X509_NAME_add_entry_by_txt(subj,type, MBSTRING_ASC,
(unsigned char *) v->value,-1,-1,0)) return 0;
}
if (!X509_NAME_entry_count(subj))
{
BIO_printf(bio_err,"error, no objects specified in config file\n");
return 0;
}
if (attribs)
{
for (i = 0; i < sk_CONF_VALUE_num(attr_sk); i++)
{
v=sk_CONF_VALUE_value(attr_sk,i);
if(!X509_REQ_add1_attr_by_txt(req, v->name, MBSTRING_ASC,
(unsigned char *)v->value, -1)) return 0;
}
}
return 1;
}
static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,
int nid, int min, int max)
{
int i,j,ret=0;
X509_NAME_ENTRY *ne=NULL;
int i,ret=0;
MS_STATIC char buf[1024];
BIO_printf(bio_err,"%s [%s]:",text,def);
(void)BIO_flush(bio_err);
if (value != NULL)
{
strcpy(buf,value);
strcat(buf,"\n");
BIO_printf(bio_err,"%s\n",value);
}
else
{
buf[0]='\0';
fgets(buf,1024,stdin);
}
if (buf[0] == '\0') return(0);
else if (buf[0] == '\n')
{
if ((def == NULL) || (def[0] == '\0'))
return(1);
strcpy(buf,def);
strcat(buf,"\n");
}
else if ((buf[0] == '.') && (buf[1] == '\n')) return(1);
i=strlen(buf);
if (buf[i-1] != '\n')
{
BIO_printf(bio_err,"weird input :-(\n");
return(0);
}
buf[--i]='\0';
j=ASN1_PRINTABLE_type((unsigned char *)buf,-1);
if (req_fix_data(nid,&j,i,min,max) == 0)
goto err;
#ifdef CHARSET_EBCDIC
ebcdic2ascii(buf, buf, i);
#endif
if ((ne=X509_NAME_ENTRY_create_by_NID(NULL,nid,j,(unsigned char *)buf,
strlen(buf)))
== NULL) goto err;
if (!X509_NAME_add_entry(n,ne,X509_NAME_entry_count(n),0))
goto err;
ret=1;
err:
if (ne != NULL) X509_NAME_ENTRY_free(ne);
return(ret);
}
static int add_attribute_object(STACK_OF(X509_ATTRIBUTE) *n, char *text,
char *def, char *value, int nid, int min,
int max)
{
int i,z;
X509_ATTRIBUTE *xa=NULL;
static char buf[1024];
ASN1_BIT_STRING *bs=NULL;
ASN1_TYPE *at=NULL;
start:
BIO_printf(bio_err,"%s [%s]:",text,def);
(void)BIO_flush(bio_err);
@ -1072,49 +1149,71 @@ static int add_attribute_object(STACK_OF(X509_ATTRIBUTE) *n, char *text,
}
buf[--i]='\0';
/* add object plus value */
if ((xa=X509_ATTRIBUTE_new()) == NULL)
goto err;
if ((xa->value.set=sk_ASN1_TYPE_new_null()) == NULL)
goto err;
xa->set=1;
#ifdef CHARSET_EBCDIC
ebcdic2ascii(buf, buf, i);
#endif
if(!req_check_len(i, min, max)) goto start;
if (!X509_NAME_add_entry_by_NID(n,nid, MBSTRING_ASC,
(unsigned char *) buf, -1,-1,0)) goto err;
ret=1;
err:
return(ret);
}
if (xa->object != NULL) ASN1_OBJECT_free(xa->object);
xa->object=OBJ_nid2obj(nid);
static int add_attribute_object(X509_REQ *req, char *text,
char *def, char *value, int nid, int min,
int max)
{
int i;
static char buf[1024];
if ((bs=ASN1_BIT_STRING_new()) == NULL) goto err;
bs->type=ASN1_PRINTABLE_type((unsigned char *)buf,-1);
z=req_fix_data(nid,&bs->type,i,min,max);
if (z == 0)
start:
BIO_printf(bio_err,"%s [%s]:",text,def);
(void)BIO_flush(bio_err);
if (value != NULL)
{
if (value == NULL)
goto start;
else goto err;
strcpy(buf,value);
strcat(buf,"\n");
BIO_printf(bio_err,"%s\n",value);
}
else
{
buf[0]='\0';
fgets(buf,1024,stdin);
}
if (!ASN1_STRING_set(bs,(unsigned char *)buf,i+1))
{ BIO_printf(bio_err,"Malloc failure\n"); goto err; }
if (buf[0] == '\0') return(0);
else if (buf[0] == '\n')
{
if ((def == NULL) || (def[0] == '\0'))
return(1);
strcpy(buf,def);
strcat(buf,"\n");
}
else if ((buf[0] == '.') && (buf[1] == '\n')) return(1);
if ((at=ASN1_TYPE_new()) == NULL)
{ BIO_printf(bio_err,"Malloc failure\n"); goto err; }
i=strlen(buf);
if (buf[i-1] != '\n')
{
BIO_printf(bio_err,"weird input :-(\n");
return(0);
}
buf[--i]='\0';
if(!req_check_len(i, min, max)) goto start;
ASN1_TYPE_set(at,bs->type,(char *)bs);
sk_ASN1_TYPE_push(xa->value.set,at);
bs=NULL;
at=NULL;
/* only one item per attribute */
if(!X509_REQ_add1_attr_by_NID(req, nid, MBSTRING_ASC,
(unsigned char *)buf, -1)) {
BIO_printf(bio_err, "Error adding attribute\n");
ERR_print_errors(bio_err);
goto err;
}
if (!sk_X509_ATTRIBUTE_push(n,xa)) goto err;
return(1);
err:
if (xa != NULL) X509_ATTRIBUTE_free(xa);
if (at != NULL) ASN1_TYPE_free(at);
if (bs != NULL) ASN1_BIT_STRING_free(bs);
return(0);
}
#ifndef NO_RSA
static void MS_CALLBACK req_cb(int p, int n, void *arg)
{
char c='*';
@ -1129,26 +1228,10 @@ static void MS_CALLBACK req_cb(int p, int n, void *arg)
p=n;
#endif
}
#endif
static int req_fix_data(int nid, int *type, int len, int min, int max)
static int req_check_len(int len, int min, int max)
{
if (nid == NID_pkcs9_emailAddress)
*type=V_ASN1_IA5STRING;
if ((nid == NID_commonName) && (*type == V_ASN1_IA5STRING))
*type=V_ASN1_T61STRING;
if ((nid == NID_pkcs9_challengePassword) &&
(*type == V_ASN1_IA5STRING))
*type=V_ASN1_T61STRING;
if ((nid == NID_pkcs9_unstructuredName) &&
(*type == V_ASN1_T61STRING))
{
BIO_printf(bio_err,"invalid characters in string, please re-enter the string\n");
return(0);
}
if (nid == NID_pkcs9_unstructuredName)
*type=V_ASN1_IA5STRING;
if (len < min)
{
BIO_printf(bio_err,"string is too short, it needs to be at least %d bytes long\n",min);

View File

@ -82,8 +82,12 @@
* -text - print a text version
* -modulus - print the RSA key modulus
* -check - verify key consistency
* -pubin - Expect a public key in input file.
* -pubout - Output a public key.
*/
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
int ret=1;
@ -92,7 +96,10 @@ int MAIN(int argc, char **argv)
const EVP_CIPHER *enc=NULL;
BIO *in=NULL,*out=NULL;
int informat,outformat,text=0,check=0,noout=0;
int pubin = 0, pubout = 0;
char *infile,*outfile,*prog;
char *passargin = NULL, *passargout = NULL;
char *passin = NULL, *passout = NULL;
int modulus=0;
apps_startup();
@ -131,6 +138,20 @@ int MAIN(int argc, char **argv)
if (--argc < 1) goto bad;
outfile= *(++argv);
}
else if (strcmp(*argv,"-passin") == 0)
{
if (--argc < 1) goto bad;
passargin= *(++argv);
}
else if (strcmp(*argv,"-passout") == 0)
{
if (--argc < 1) goto bad;
passargout= *(++argv);
}
else if (strcmp(*argv,"-pubin") == 0)
pubin=1;
else if (strcmp(*argv,"-pubout") == 0)
pubout=1;
else if (strcmp(*argv,"-noout") == 0)
noout=1;
else if (strcmp(*argv,"-text") == 0)
@ -154,24 +175,38 @@ int MAIN(int argc, char **argv)
bad:
BIO_printf(bio_err,"%s [options] <infile >outfile\n",prog);
BIO_printf(bio_err,"where options are\n");
BIO_printf(bio_err," -inform arg input format - one of DER NET PEM\n");
BIO_printf(bio_err," -outform arg output format - one of DER NET PEM\n");
BIO_printf(bio_err," -in arg input file\n");
BIO_printf(bio_err," -out arg output file\n");
BIO_printf(bio_err," -des encrypt PEM output with cbc des\n");
BIO_printf(bio_err," -des3 encrypt PEM output with ede cbc des using 168 bit key\n");
BIO_printf(bio_err," -inform arg input format - one of DER NET PEM\n");
BIO_printf(bio_err," -outform arg output format - one of DER NET PEM\n");
BIO_printf(bio_err," -in arg input file\n");
BIO_printf(bio_err," -passin arg input file pass phrase source\n");
BIO_printf(bio_err," -out arg output file\n");
BIO_printf(bio_err," -passout arg output file pass phrase source\n");
BIO_printf(bio_err," -des encrypt PEM output with cbc des\n");
BIO_printf(bio_err," -des3 encrypt PEM output with ede cbc des using 168 bit key\n");
#ifndef NO_IDEA
BIO_printf(bio_err," -idea encrypt PEM output with cbc idea\n");
BIO_printf(bio_err," -idea encrypt PEM output with cbc idea\n");
#endif
BIO_printf(bio_err," -text print the key in text\n");
BIO_printf(bio_err," -noout don't print key out\n");
BIO_printf(bio_err," -modulus print the RSA key modulus\n");
BIO_printf(bio_err," -check verify key consistency\n");
BIO_printf(bio_err," -text print the key in text\n");
BIO_printf(bio_err," -noout don't print key out\n");
BIO_printf(bio_err," -modulus print the RSA key modulus\n");
BIO_printf(bio_err," -check verify key consistency\n");
BIO_printf(bio_err," -pubin expect a public key in input file\n");
BIO_printf(bio_err," -pubout output a public key\n");
goto end;
}
ERR_load_crypto_strings();
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
BIO_printf(bio_err, "Error getting passwords\n");
goto end;
}
if(check && pubin) {
BIO_printf(bio_err, "Only private keys can be checked\n");
goto end;
}
in=BIO_new(BIO_s_file());
out=BIO_new(BIO_s_file());
if ((in == NULL) || (out == NULL))
@ -191,9 +226,11 @@ int MAIN(int argc, char **argv)
}
}
BIO_printf(bio_err,"read RSA private key\n");
if (informat == FORMAT_ASN1)
rsa=d2i_RSAPrivateKey_bio(in,NULL);
BIO_printf(bio_err,"read RSA key\n");
if (informat == FORMAT_ASN1) {
if (pubin) rsa=d2i_RSA_PUBKEY_bio(in,NULL);
else rsa=d2i_RSAPrivateKey_bio(in,NULL);
}
#ifndef NO_RC4
else if (informat == FORMAT_NETSCAPE)
{
@ -217,12 +254,14 @@ int MAIN(int argc, char **argv)
}
}
p=(unsigned char *)buf->data;
rsa=(RSA *)d2i_Netscape_RSA(NULL,&p,(long)size,NULL);
rsa=d2i_Netscape_RSA(NULL,&p,(long)size,NULL);
BUF_MEM_free(buf);
}
#endif
else if (informat == FORMAT_PEM)
rsa=PEM_read_bio_RSAPrivateKey(in,NULL,NULL,NULL);
else if (informat == FORMAT_PEM) {
if(pubin) rsa=PEM_read_bio_RSA_PUBKEY(in,NULL,NULL,NULL);
else rsa=PEM_read_bio_RSAPrivateKey(in,NULL, NULL,passin);
}
else
{
BIO_printf(bio_err,"bad input format specified for key\n");
@ -230,7 +269,7 @@ int MAIN(int argc, char **argv)
}
if (rsa == NULL)
{
BIO_printf(bio_err,"unable to load Private Key\n");
BIO_printf(bio_err,"unable to load key\n");
ERR_print_errors(bio_err);
goto end;
}
@ -256,9 +295,9 @@ int MAIN(int argc, char **argv)
if (modulus)
{
fprintf(stdout,"Modulus=");
BIO_printf(out,"Modulus=");
BN_print(out,rsa->n);
fprintf(stdout,"\n");
BIO_printf(out,"\n");
}
if (check)
@ -288,10 +327,16 @@ int MAIN(int argc, char **argv)
}
}
if (noout) goto end;
BIO_printf(bio_err,"writing RSA private key\n");
if (outformat == FORMAT_ASN1)
i=i2d_RSAPrivateKey_bio(out,rsa);
if (noout)
{
ret = 0;
goto end;
}
BIO_printf(bio_err,"writing RSA key\n");
if (outformat == FORMAT_ASN1) {
if(pubout || pubin) i=i2d_RSA_PUBKEY_bio(out,rsa);
else i=i2d_RSAPrivateKey_bio(out,rsa);
}
#ifndef NO_RC4
else if (outformat == FORMAT_NETSCAPE)
{
@ -311,23 +356,34 @@ int MAIN(int argc, char **argv)
Free(pp);
}
#endif
else if (outformat == FORMAT_PEM)
i=PEM_write_bio_RSAPrivateKey(out,rsa,enc,NULL,0,NULL,NULL);
else {
else if (outformat == FORMAT_PEM) {
if(pubout || pubin)
i=PEM_write_bio_RSA_PUBKEY(out,rsa);
else i=PEM_write_bio_RSAPrivateKey(out,rsa,
enc,NULL,0,NULL,passout);
} else {
BIO_printf(bio_err,"bad output format specified for outfile\n");
goto end;
}
if (!i)
{
BIO_printf(bio_err,"unable to write private key\n");
BIO_printf(bio_err,"unable to write key\n");
ERR_print_errors(bio_err);
}
else
ret=0;
end:
if (in != NULL) BIO_free(in);
if (out != NULL) BIO_free(out);
if (rsa != NULL) RSA_free(rsa);
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);
EXIT(ret);
}
#else /* !NO_RSA */
# if PEDANTIC
static void *dummy=&dummy;
# endif
#endif

View File

@ -84,7 +84,6 @@ typedef fd_mask fd_set;
#define PORT_STR "4433"
#define PROTOCOL "tcp"
int do_accept(int acc_sock, int *sock, char **host);
int do_server(int port, int *ret, int (*cb) (), char *context);
#ifdef HEADER_X509_H
int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx);
@ -97,17 +96,9 @@ int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file);
int set_cert_stuff(char *ctx, char *cert_file, char *key_file);
#endif
int init_client(int *sock, char *server, int port);
int init_client_ip(int *sock,unsigned char ip[4], int port);
int nbio_init_client_ip(int *sock,unsigned char ip[4], int port);
int nbio_sock_error(int sock);
int spawn(int argc, char **argv, int *in, int *out);
int init_server(int *sock, int port);
int init_server_long(int *sock, int port,char *ip);
int should_retry(int i);
void sock_cleanup(void );
int extract_port(char *str, short *port_ptr);
int extract_host_port(char *str,char **host_ptr,unsigned char *ip,short *p);
int host_ip(char *str, unsigned char ip[4]);
long MS_CALLBACK bio_dump_cb(BIO *bio, int cmd, const char *argp,
int argi, long argl, long ret);

View File

@ -1,4 +1,4 @@
/* apps/s_cb.c */
/* apps/s_cb.c - callback functions used by s_client, s_server, and s_time */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*

View File

@ -56,9 +56,7 @@
* [including the GNU Public Licence.]
*/
#ifdef APPS_CRLF
# include <assert.h>
#endif
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -83,15 +81,16 @@ typedef unsigned int u_int;
#include <openssl/pem.h>
#include "s_apps.h"
#ifdef WINDOWS
#include <conio.h>
#endif
#if (defined(VMS) && __VMS_VER < 70000000)
/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
#undef FIONBIO
#endif
#if defined(NO_RSA) && !defined(NO_SSL2)
#define NO_SSL2
#endif
#undef PROG
#define PROG s_client_main
@ -118,6 +117,7 @@ static void sc_usage(void);
static void print_stuff(BIO *berr,SSL *con,int full);
static BIO *bio_c_out=NULL;
static int c_quiet=0;
static int c_ign_eof=0;
static void sc_usage(void)
{
@ -142,20 +142,21 @@ static void sc_usage(void)
#ifdef FIONBIO
BIO_printf(bio_err," -nbio - Run with non-blocking IO\n");
#endif
#ifdef APPS_CRLF /* won't be #ifdef'd in next release */
BIO_printf(bio_err," -crlf - convert LF from terminal into CRLF\n");
#endif
BIO_printf(bio_err," -quiet - no s_client output\n");
BIO_printf(bio_err," -ign_eof - ignore input eof (default when -quiet)\n");
BIO_printf(bio_err," -ssl2 - just use SSLv2\n");
BIO_printf(bio_err," -ssl3 - just use SSLv3\n");
BIO_printf(bio_err," -tls1 - just use TLSv1\n");
BIO_printf(bio_err," -no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\n");
BIO_printf(bio_err," -bugs - Switch on all SSL implementation bug workarounds\n");
BIO_printf(bio_err," -cipher - prefered cipher to use, use the 'openssl ciphers'\n");
BIO_printf(bio_err," -cipher - preferred cipher to use, use the 'openssl ciphers'\n");
BIO_printf(bio_err," command to see what is available\n");
}
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
int off=0;
@ -171,15 +172,16 @@ int MAIN(int argc, char **argv)
char *cert_file=NULL,*key_file=NULL;
char *CApath=NULL,*CAfile=NULL,*cipher=NULL;
int reconnect=0,badop=0,verify=SSL_VERIFY_NONE,bugs=0;
#ifdef APPS_CRLF
int crlf=0;
#endif
int write_tty,read_tty,write_ssl,read_ssl,tty_on,ssl_pending;
SSL_CTX *ctx=NULL;
int ret=1,in_init=1,i,nbio_test=0;
int prexit = 0;
SSL_METHOD *meth=NULL;
BIO *sbio;
/*static struct timeval timeout={10,0};*/
#ifdef WINDOWS
struct timeval tv;
#endif
#if !defined(NO_SSL2) && !defined(NO_SSL3)
meth=SSLv23_client_method();
@ -192,6 +194,7 @@ int MAIN(int argc, char **argv)
apps_startup();
c_Pause=0;
c_quiet=0;
c_ign_eof=0;
c_debug=0;
c_showcerts=0;
@ -244,12 +247,17 @@ int MAIN(int argc, char **argv)
if (--argc < 1) goto bad;
cert_file= *(++argv);
}
#ifdef APPS_CRLF
else if (strcmp(*argv,"-prexit") == 0)
prexit=1;
else if (strcmp(*argv,"-crlf") == 0)
crlf=1;
#endif
else if (strcmp(*argv,"-quiet") == 0)
{
c_quiet=1;
c_ign_eof=1;
}
else if (strcmp(*argv,"-ign_eof") == 0)
c_ign_eof=1;
else if (strcmp(*argv,"-pause") == 0)
c_Pause=1;
else if (strcmp(*argv,"-debug") == 0)
@ -324,6 +332,8 @@ int MAIN(int argc, char **argv)
goto end;
}
app_RAND_load_file(NULL, bio_err, 0);
if (bio_c_out == NULL)
{
if (c_quiet)
@ -337,7 +347,8 @@ int MAIN(int argc, char **argv)
}
}
SSLeay_add_ssl_algorithms();
OpenSSL_add_ssl_algorithms();
SSL_load_error_strings();
ctx=SSL_CTX_new(meth);
if (ctx == NULL)
{
@ -352,7 +363,11 @@ int MAIN(int argc, char **argv)
if (state) SSL_CTX_set_info_callback(ctx,apps_ssl_info_callback);
if (cipher != NULL)
SSL_CTX_set_cipher_list(ctx,cipher);
if(!SSL_CTX_set_cipher_list(ctx,cipher)) {
BIO_printf(bio_err,"error setting cipher list\n");
ERR_print_errors(bio_err);
goto end;
}
#if 0
else
SSL_CTX_set_cipher_list(ctx,getenv("SSL_CIPHER"));
@ -365,14 +380,13 @@ int MAIN(int argc, char **argv)
if ((!SSL_CTX_load_verify_locations(ctx,CAfile,CApath)) ||
(!SSL_CTX_set_default_verify_paths(ctx)))
{
/* BIO_printf(bio_err,"error seting default verify locations\n"); */
/* BIO_printf(bio_err,"error setting default verify locations\n"); */
ERR_print_errors(bio_err);
/* goto end; */
}
SSL_load_error_strings();
con=(SSL *)SSL_new(ctx);
con=SSL_new(ctx);
/* SSL_set_cipher_list(con,"RC4-MD5"); */
re_start:
@ -473,12 +487,18 @@ int MAIN(int argc, char **argv)
if (read_tty) FD_SET(fileno(stdin),&readfds);
if (write_tty) FD_SET(fileno(stdout),&writefds);
}
#endif
if (read_ssl)
FD_SET(SSL_get_fd(con),&readfds);
if (write_ssl)
FD_SET(SSL_get_fd(con),&writefds);
#else
if(!tty_on || !write_tty) {
if (read_ssl)
FD_SET(SSL_get_fd(con),&readfds);
if (write_ssl)
FD_SET(SSL_get_fd(con),&writefds);
}
#endif
/* printf("mode tty(%d %d%d) ssl(%d%d)\n",
tty_on,read_tty,write_tty,read_ssl,write_ssl);*/
@ -488,8 +508,29 @@ int MAIN(int argc, char **argv)
* will choke the compiler: if you do have a cast then
* you can either go for (int *) or (void *).
*/
#ifdef WINDOWS
/* Under Windows we make the assumption that we can
* always write to the tty: therefore if we need to
* write to the tty we just fall through. Otherwise
* we timeout the select every second and see if there
* are any keypresses. Note: this is a hack, in a proper
* Windows application we wouldn't do this.
*/
i=0;
if(!write_tty) {
if(read_tty) {
tv.tv_sec = 1;
tv.tv_usec = 0;
i=select(width,(void *)&readfds,(void *)&writefds,
NULL,&tv);
if(!i && (!_kbhit() || !read_tty) ) continue;
} else i=select(width,(void *)&readfds,(void *)&writefds,
NULL,NULL);
}
#else
i=select(width,(void *)&readfds,(void *)&writefds,
NULL,NULL);
#endif
if ( i < 0)
{
BIO_printf(bio_err,"bad select %d\n",
@ -566,8 +607,12 @@ int MAIN(int argc, char **argv)
goto shut;
}
}
#ifndef WINDOWS
#ifdef WINDOWS
/* Assume Windows can always write */
else if (!ssl_pending && write_tty)
#else
else if (!ssl_pending && FD_ISSET(fileno(stdout),&writefds))
#endif
{
#ifdef CHARSET_EBCDIC
ascii2ebcdic(&(sbuf[sbuf_off]),&(sbuf[sbuf_off]),sbuf_len);
@ -589,7 +634,6 @@ int MAIN(int argc, char **argv)
write_tty=0;
}
}
#endif
else if (ssl_pending || FD_ISSET(SSL_get_fd(con),&readfds))
{
#ifdef RENEG
@ -644,10 +688,12 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
}
}
#ifndef WINDOWS
#ifdef WINDOWS
else if (_kbhit())
#else
else if (FD_ISSET(fileno(stdin),&readfds))
#endif
{
#ifdef APPS_CRLF
if (crlf)
{
int j, lf_num;
@ -671,16 +717,15 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
assert(lf_num == 0);
}
else
#endif
i=read(fileno(stdin),cbuf,BUFSIZZ);
if ((!c_quiet) && ((i <= 0) || (cbuf[0] == 'Q')))
if ((!c_ign_eof) && ((i <= 0) || (cbuf[0] == 'Q')))
{
BIO_printf(bio_err,"DONE\n");
goto shut;
}
if ((!c_quiet) && (cbuf[0] == 'R'))
if ((!c_ign_eof) && (cbuf[0] == 'R'))
{
BIO_printf(bio_err,"RENEGOTIATING\n");
SSL_renegotiate(con);
@ -698,13 +743,13 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
write_ssl=1;
read_tty=0;
}
#endif
}
shut:
SSL_shutdown(con);
SHUTDOWN(SSL_get_fd(con));
ret=0;
end:
if(prexit) print_stuff(bio_c_out,con,1);
if (con != NULL) SSL_free(con);
if (con2 != NULL) SSL_free(con2);
if (ctx != NULL) SSL_CTX_free(ctx);

View File

@ -56,9 +56,7 @@
* [including the GNU Public Licence.]
*/
#ifdef APPS_CRLF
# include <assert.h>
#endif
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -87,15 +85,15 @@ typedef unsigned int u_int;
#include <openssl/ssl.h>
#include "s_apps.h"
#ifdef WINDOWS
#include <conio.h>
#endif
#if (defined(VMS) && __VMS_VER < 70000000)
/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
#undef FIONBIO
#endif
#if defined(NO_RSA) && !defined(NO_SSL2)
#define NO_SSL2
#endif
#ifndef NO_RSA
static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int is_export, int keylength);
#endif
@ -106,10 +104,12 @@ static void sv_usage(void);
static int init_ssl_connection(SSL *s);
static void print_stats(BIO *bp,SSL_CTX *ctx);
#ifndef NO_DH
static DH *load_dh_param(void );
static DH *load_dh_param(char *dhfile);
static DH *get_dh512(void);
#endif
/* static void s_server_init(void);*/
#ifdef MONOLITH
static void s_server_init(void);
#endif
#ifndef S_ISDIR
# if defined(_S_IFMT) && defined(_S_IFDIR)
@ -149,15 +149,13 @@ static DH *get_dh512(void)
#undef BUFSIZZ
#define BUFSIZZ 16*1024
static int bufsize=32;
static int bufsize=BUFSIZZ;
static int accept_socket= -1;
#define TEST_CERT "server.pem"
#undef PROG
#define PROG s_server_main
#define DH_PARAM "server.pem"
extern int verify_depth;
static char *cipher=NULL;
@ -169,9 +167,7 @@ static char *s_dcert_file=NULL,*s_dkey_file=NULL;
static int s_nbio=0;
#endif
static int s_nbio_test=0;
#ifdef APPS_CRLF /* won't be #ifdef'd in next release */
int s_crlf=0;
#endif
static SSL_CTX *ctx=NULL;
static int www=0;
@ -179,9 +175,12 @@ static BIO *bio_s_out=NULL;
static int s_debug=0;
static int s_quiet=0;
#if 0
static int hack=0;
#ifdef MONOLITH
static void s_server_init(void)
{
accept_socket=-1;
cipher=NULL;
s_server_verify=SSL_VERIFY_NONE;
s_dcert_file=NULL;
@ -198,6 +197,7 @@ static void s_server_init(void)
bio_s_out=NULL;
s_debug=0;
s_quiet=0;
hack=0;
}
#endif
@ -211,17 +211,17 @@ static void sv_usage(void)
BIO_printf(bio_err," -Verify arg - turn on peer certificate verification, must have a cert.\n");
BIO_printf(bio_err," -cert arg - certificate file to use, PEM format assumed\n");
BIO_printf(bio_err," (default is %s)\n",TEST_CERT);
BIO_printf(bio_err," -key arg - RSA file to use, PEM format assumed, in cert file if\n");
BIO_printf(bio_err," -key arg - Private Key file to use, PEM format assumed, in cert file if\n");
BIO_printf(bio_err," not specified (default is %s)\n",TEST_CERT);
BIO_printf(bio_err," -dcert arg - second certificate file to use (usually for DSA)\n");
BIO_printf(bio_err," -dkey arg - second private key file to use (usually for DSA)\n");
BIO_printf(bio_err," -dhparam arg - DH parameter file to use, in cert file if not specified\n");
BIO_printf(bio_err," or a default set of parameters is used\n");
#ifdef FIONBIO
BIO_printf(bio_err," -nbio - Run with non-blocking IO\n");
#endif
BIO_printf(bio_err," -nbio_test - test with the non-blocking test bio\n");
#ifdef APPS_CRLF
BIO_printf(bio_err," -crlf - convert LF from terminal into CRLF\n");
#endif
BIO_printf(bio_err," -debug - Print more output\n");
BIO_printf(bio_err," -state - Print the SSL states\n");
BIO_printf(bio_err," -CApath arg - PEM format directory of CA's\n");
@ -239,14 +239,13 @@ static void sv_usage(void)
#ifndef NO_DH
BIO_printf(bio_err," -no_dhe - Disable ephemeral DH\n");
#endif
BIO_printf(bio_err," -bugs - Turn on SSL bug compatability\n");
BIO_printf(bio_err," -bugs - Turn on SSL bug compatibility\n");
BIO_printf(bio_err," -www - Respond to a 'GET /' with a status page\n");
BIO_printf(bio_err," -WWW - Respond to a 'GET /<path> HTTP/1.0' with file ./<path>\n");
}
static int local_argc=0;
static char **local_argv;
static int hack=0;
#ifdef CHARSET_EBCDIC
static int ebcdic_new(BIO *bi);
@ -337,7 +336,7 @@ static int ebcdic_write(BIO *b, char *in, int inl)
num = num + num; /* double the size */
if (num < inl)
num = inl;
Free((char*)wbuf);
Free(wbuf);
wbuf=(EBCDIC_OUTBUFF *)Malloc(sizeof(EBCDIC_OUTBUFF) + num);
wbuf->alloced = num;
@ -398,11 +397,14 @@ static int ebcdic_puts(BIO *bp, char *str)
}
#endif
int MAIN(int, char **);
int MAIN(int argc, char *argv[])
{
short port=PORT;
char *CApath=NULL,*CAfile=NULL;
char *context = NULL;
char *dhfile = NULL;
int badop=0,bugs=0;
int ret=1;
int off=0;
@ -425,8 +427,9 @@ int MAIN(int argc, char *argv[])
local_argv=argv;
apps_startup();
s_quiet=0;
s_debug=0;
#ifdef MONOLITH
s_server_init();
#endif
if (bio_err == NULL)
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
@ -479,6 +482,11 @@ int MAIN(int argc, char *argv[])
if (--argc < 1) goto bad;
s_key_file= *(++argv);
}
else if (strcmp(*argv,"-dhparam") == 0)
{
if (--argc < 1) goto bad;
dhfile = *(++argv);
}
else if (strcmp(*argv,"-dcert") == 0)
{
if (--argc < 1) goto bad;
@ -525,10 +533,8 @@ int MAIN(int argc, char *argv[])
{ hack=1; }
else if (strcmp(*argv,"-state") == 0)
{ state=1; }
#ifdef APPS_CRLF
else if (strcmp(*argv,"-crlf") == 0)
{ s_crlf=1; }
#endif
else if (strcmp(*argv,"-quiet") == 0)
{ s_quiet=1; }
else if (strcmp(*argv,"-bugs") == 0)
@ -575,6 +581,8 @@ int MAIN(int argc, char *argv[])
goto end;
}
app_RAND_load_file(NULL, bio_err, 0);
if (bio_s_out == NULL)
{
if (s_quiet && !s_debug)
@ -599,7 +607,7 @@ int MAIN(int argc, char *argv[])
}
SSL_load_error_strings();
SSLeay_add_ssl_algorithms();
OpenSSL_add_ssl_algorithms();
ctx=SSL_CTX_new(meth);
if (ctx == NULL)
@ -641,8 +649,7 @@ int MAIN(int argc, char *argv[])
#ifndef NO_DH
if (!no_dhe)
{
/* EAY EAY EAY evil hack */
dh=load_dh_param();
dh=load_dh_param(dhfile ? dhfile : s_cert_file);
if (dh != NULL)
{
BIO_printf(bio_s_out,"Setting temp DH parameters\n");
@ -692,12 +699,17 @@ int MAIN(int argc, char *argv[])
#endif
if (cipher != NULL)
SSL_CTX_set_cipher_list(ctx,cipher);
if(!SSL_CTX_set_cipher_list(ctx,cipher)) {
BIO_printf(bio_err,"error setting cipher list\n");
ERR_print_errors(bio_err);
goto end;
}
SSL_CTX_set_verify(ctx,s_server_verify,verify_callback);
SSL_CTX_set_session_id_context(ctx,(void*)&s_server_session_id_context,
sizeof s_server_session_id_context);
SSL_CTX_set_client_CA_list(ctx,SSL_load_client_CA_file(CAfile));
if (CAfile != NULL)
SSL_CTX_set_client_CA_list(ctx,SSL_load_client_CA_file(CAfile));
BIO_printf(bio_s_out,"ACCEPT\n");
if (www)
@ -750,6 +762,9 @@ static int sv_body(char *hostname, int s, unsigned char *context)
unsigned long l;
SSL *con=NULL;
BIO *sbio;
#ifdef WINDOWS
struct timeval tv;
#endif
if ((buf=Malloc(bufsize)) == NULL)
{
@ -769,7 +784,7 @@ static int sv_body(char *hostname, int s, unsigned char *context)
#endif
if (con == NULL) {
con=(SSL *)SSL_new(ctx);
con=SSL_new(ctx);
if(context)
SSL_set_session_id_context(con, context,
strlen((char *)context));
@ -798,22 +813,48 @@ static int sv_body(char *hostname, int s, unsigned char *context)
width=s+1;
for (;;)
{
FD_ZERO(&readfds);
#ifndef WINDOWS
FD_SET(fileno(stdin),&readfds);
#endif
FD_SET(s,&readfds);
/* Note: under VMS with SOCKETSHR the second parameter is
* currently of type (int *) whereas under other systems
* it is (void *) if you don't have a cast it will choke
* the compiler: if you do have a cast then you can either
* go for (int *) or (void *).
*/
i=select(width,(void *)&readfds,NULL,NULL,NULL);
if (i <= 0) continue;
if (FD_ISSET(fileno(stdin),&readfds))
int read_from_terminal;
int read_from_sslcon;
read_from_terminal = 0;
read_from_sslcon = SSL_pending(con);
if (!read_from_sslcon)
{
FD_ZERO(&readfds);
#ifndef WINDOWS
FD_SET(fileno(stdin),&readfds);
#endif
FD_SET(s,&readfds);
/* Note: under VMS with SOCKETSHR the second parameter is
* currently of type (int *) whereas under other systems
* it is (void *) if you don't have a cast it will choke
* the compiler: if you do have a cast then you can either
* go for (int *) or (void *).
*/
#ifdef WINDOWS
/* Under Windows we can't select on stdin: only
* on sockets. As a workaround we timeout the select every
* second and check for any keypress. In a proper Windows
* application we wouldn't do this because it is inefficient.
*/
tv.tv_sec = 1;
tv.tv_usec = 0;
i=select(width,(void *)&readfds,NULL,NULL,&tv);
if((i < 0) || (!i && !_kbhit() ) )continue;
if(_kbhit())
read_from_terminal = 1;
#else
i=select(width,(void *)&readfds,NULL,NULL,NULL);
if (i <= 0) continue;
if (FD_ISSET(fileno(stdin),&readfds))
read_from_terminal = 1;
#endif
if (FD_ISSET(s,&readfds))
read_from_sslcon = 1;
}
if (read_from_terminal)
{
#ifdef APPS_CRLF
if (s_crlf)
{
int j, lf_num;
@ -837,7 +878,6 @@ static int sv_body(char *hostname, int s, unsigned char *context)
assert(lf_num == 0);
}
else
#endif
i=read(fileno(stdin),buf,bufsize);
if (!s_quiet)
{
@ -926,7 +966,7 @@ static int sv_body(char *hostname, int s, unsigned char *context)
if (i <= 0) break;
}
}
if (FD_ISSET(s,&readfds))
if (read_from_sslcon)
{
if (!SSL_is_init_finished(con))
{
@ -1059,12 +1099,12 @@ static int init_ssl_connection(SSL *con)
}
#ifndef NO_DH
static DH *load_dh_param(void)
static DH *load_dh_param(char *dhfile)
{
DH *ret=NULL;
BIO *bio;
if ((bio=BIO_new_file(DH_PARAM,"r")) == NULL)
if ((bio=BIO_new_file(dhfile,"r")) == NULL)
goto err;
ret=PEM_read_bio_DHparams(bio,NULL,NULL,NULL);
err:
@ -1126,7 +1166,7 @@ static int www_body(char *hostname, int s, unsigned char *context)
/* lets make the output buffer a reasonable size */
if (!BIO_set_write_buffer_size(io,bufsize)) goto err;
if ((con=(SSL *)SSL_new(ctx)) == NULL) goto err;
if ((con=SSL_new(ctx)) == NULL) goto err;
if(context) SSL_set_session_id_context(con, context,
strlen((char *)context));
@ -1424,7 +1464,7 @@ static int www_body(char *hostname, int s, unsigned char *context)
/* make sure we re-use sessions */
SSL_set_shutdown(con,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
#else
/* This kills performace */
/* This kills performance */
/* SSL_shutdown(con); A shutdown gets sent in the
* BIO_free_all(io) procession */
#endif

View File

@ -1,4 +1,4 @@
/* apps/s_socket.c */
/* apps/s_socket.c - socket-related functions used by s_client and s_server */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -79,16 +79,17 @@ typedef unsigned int u_int;
#include "s_apps.h"
#include <openssl/ssl.h>
#ifdef VMS
#if (__VMS_VER < 70000000) /* FIONBIO used as a switch to enable ioctl,
and that isn't in VMS < 7.0 */
#undef FIONBIO
#endif
#include <processes.h> /* for vfork() */
#endif
static struct hostent *GetHostByName(char *name);
int sock_init(void );
#ifdef WINDOWS
static void sock_cleanup(void);
#endif
static int sock_init(void);
static int init_client_ip(int *sock,unsigned char ip[4], int port);
static int init_server(int *sock, int port);
static int init_server_long(int *sock, int port,char *ip);
static int do_accept(int acc_sock, int *sock, char **host);
static int host_ip(char *str, unsigned char ip[4]);
#ifdef WIN16
#define SOCKET_PROTOCOL 0 /* more microsoft stupidity */
#else
@ -131,19 +132,19 @@ static BOOL CALLBACK enumproc(HWND hwnd,LPARAM lParam)
#endif /* WIN32 */
#endif /* WINDOWS */
void sock_cleanup(void)
{
#ifdef WINDOWS
static void sock_cleanup(void)
{
if (wsa_init_done)
{
wsa_init_done=0;
WSACancelBlockingCall();
WSACleanup();
}
#endif
}
#endif
int sock_init(void)
static int sock_init(void)
{
#ifdef WINDOWS
if (!wsa_init_done)
@ -187,7 +188,7 @@ int init_client(int *sock, char *host, int port)
return(init_client_ip(sock,ip,port));
}
int init_client_ip(int *sock, unsigned char ip[4], int port)
static int init_client_ip(int *sock, unsigned char ip[4], int port)
{
unsigned long addr;
struct sockaddr_in them;
@ -218,75 +219,6 @@ int init_client_ip(int *sock, unsigned char ip[4], int port)
return(1);
}
int nbio_sock_error(int sock)
{
int j,i;
int size;
size=sizeof(int);
/* Note: under VMS with SOCKETSHR the third parameter is currently
* of type (int *) whereas under other systems it is (void *) if
* you don't have a cast it will choke the compiler: if you do
* have a cast then you can either go for (int *) or (void *).
*/
i=getsockopt(sock,SOL_SOCKET,SO_ERROR,(char *)&j,(void *)&size);
if (i < 0)
return(1);
else
return(j);
}
int nbio_init_client_ip(int *sock, unsigned char ip[4], int port)
{
unsigned long addr;
struct sockaddr_in them;
int s,i;
if (!sock_init()) return(0);
memset((char *)&them,0,sizeof(them));
them.sin_family=AF_INET;
them.sin_port=htons((unsigned short)port);
addr= (unsigned long)
((unsigned long)ip[0]<<24L)|
((unsigned long)ip[1]<<16L)|
((unsigned long)ip[2]<< 8L)|
((unsigned long)ip[3]);
them.sin_addr.s_addr=htonl(addr);
if (*sock <= 0)
{
#ifdef FIONBIO
unsigned long l=1;
#endif
s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
if (s == INVALID_SOCKET) { perror("socket"); return(0); }
i=0;
i=setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i));
if (i < 0) { perror("keepalive"); return(0); }
*sock=s;
#ifdef FIONBIO
BIO_socket_ioctl(s,FIONBIO,&l);
#endif
}
else
s= *sock;
i=connect(s,(struct sockaddr *)&them,sizeof(them));
if (i == INVALID_SOCKET)
{
if (BIO_sock_should_retry(i))
return(-1);
else
return(0);
}
else
return(1);
}
int do_server(int port, int *ret, int (*cb)(), char *context)
{
int sock;
@ -319,7 +251,7 @@ int do_server(int port, int *ret, int (*cb)(), char *context)
}
}
int init_server_long(int *sock, int port, char *ip)
static int init_server_long(int *sock, int port, char *ip)
{
int ret=0;
struct sockaddr_in server;
@ -369,12 +301,12 @@ int init_server_long(int *sock, int port, char *ip)
return(ret);
}
int init_server(int *sock, int port)
static int init_server(int *sock, int port)
{
return(init_server_long(sock, port, NULL));
}
int do_accept(int acc_sock, int *sock, char **host)
static int do_accept(int acc_sock, int *sock, char **host)
{
int ret,i;
struct hostent *h1,*h2;
@ -490,7 +422,7 @@ int extract_host_port(char *str, char **host_ptr, unsigned char *ip,
return(0);
}
int host_ip(char *str, unsigned char ip[4])
static int host_ip(char *str, unsigned char ip[4])
{
unsigned int in[4];
int i;
@ -606,69 +538,3 @@ static struct hostent *GetHostByName(char *name)
return(ret);
}
}
#ifndef MSDOS
int spawn(int argc, char **argv, int *in, int *out)
{
int pid;
#define CHILD_READ p1[0]
#define CHILD_WRITE p2[1]
#define PARENT_READ p2[0]
#define PARENT_WRITE p1[1]
int p1[2],p2[2];
if ((pipe(p1) < 0) || (pipe(p2) < 0)) return(-1);
#ifdef VMS
if ((pid=vfork()) == 0)
#else
if ((pid=fork()) == 0)
#endif
{ /* child */
if (dup2(CHILD_WRITE,fileno(stdout)) < 0)
perror("dup2");
if (dup2(CHILD_WRITE,fileno(stderr)) < 0)
perror("dup2");
if (dup2(CHILD_READ,fileno(stdin)) < 0)
perror("dup2");
close(CHILD_READ);
close(CHILD_WRITE);
close(PARENT_READ);
close(PARENT_WRITE);
execvp(argv[0],argv);
perror("child");
exit(1);
}
/* parent */
*in= PARENT_READ;
*out=PARENT_WRITE;
close(CHILD_READ);
close(CHILD_WRITE);
return(pid);
}
#endif /* MSDOS */
#ifdef undef
/* Turn on synchronous sockets so that we can do a WaitForMultipleObjects
* on sockets */
{
SOCKET s;
int optionValue = SO_SYNCHRONOUS_NONALERT;
int err;
err = setsockopt(
INVALID_SOCKET,
SOL_SOCKET,
SO_OPENTYPE,
(char *)&optionValue,
sizeof(optionValue));
if (err != NO_ERROR) {
/* failed for some reason... */
BIO_printf(bio_err, "failed to setsockopt(SO_OPENTYPE, SO_SYNCHRONOUS_ALERT) - %d\n",
WSAGetLastError());
}
}
#endif

View File

@ -67,10 +67,6 @@
#include <stdlib.h>
#include <string.h>
#if defined(NO_RSA) && !defined(NO_SSL2)
#define NO_SSL2
#endif
#ifdef NO_STDIO
#define APPS_WIN16
#endif
@ -220,7 +216,7 @@ static void s_time_usage(void)
file if not specified by this option\n\
-CApath arg - PEM format directory of CA's\n\
-CAfile arg - PEM format file of CA's\n\
-cipher - prefered cipher to use, play with 'openssl ciphers'\n\n";
-cipher - preferred cipher to use, play with 'openssl ciphers'\n\n";
printf( "usage: s_time <args>\n\n" );
@ -229,7 +225,7 @@ static void s_time_usage(void)
printf("-nbio - Run with non-blocking IO\n");
printf("-ssl2 - Just use SSLv2\n");
printf("-ssl3 - Just use SSLv3\n");
printf("-bugs - Turn on SSL bug compatability\n");
printf("-bugs - Turn on SSL bug compatibility\n");
printf("-new - Just time new connections\n");
printf("-reuse - Just time connection reuse\n");
printf("-www page - Retrieve 'page' from the site\n");
@ -248,15 +244,6 @@ static int parseArgs(int argc, char **argv)
verify_depth=0;
verify_error=X509_V_OK;
#ifdef FIONBIO
t_nbio=0;
#endif
apps_startup();
s_time_init();
if (bio_err == NULL)
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
argc--;
argv++;
@ -401,6 +388,8 @@ static double tm_Time_F(int s)
* MAIN - main processing area for client
* real name depends on MONOLITH
*/
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
double totalTime = 0.0;
@ -411,6 +400,12 @@ int MAIN(int argc, char **argv)
MS_STATIC char buf[1024*8];
int ver;
apps_startup();
s_time_init();
if (bio_err == NULL)
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
#if !defined(NO_SSL2) && !defined(NO_SSL3)
s_time_meth=SSLv23_client_method();
#elif !defined(NO_SSL3)
@ -423,7 +418,7 @@ int MAIN(int argc, char **argv)
if( parseArgs( argc, argv ) < 0 )
goto end;
SSLeay_add_ssl_algorithms();
OpenSSL_add_ssl_algorithms();
if ((tm_ctx=SSL_CTX_new(s_time_meth)) == NULL) return(1);
SSL_CTX_set_quiet_shutdown(tm_ctx,1);
@ -438,7 +433,7 @@ int MAIN(int argc, char **argv)
if ((!SSL_CTX_load_verify_locations(tm_ctx,CAfile,CApath)) ||
(!SSL_CTX_set_default_verify_paths(tm_ctx)))
{
/* BIO_printf(bio_err,"error seting default verify locations\n"); */
/* BIO_printf(bio_err,"error setting default verify locations\n"); */
ERR_print_errors(bio_err);
/* goto end; */
}
@ -639,7 +634,7 @@ static SSL *doConnection(SSL *scon)
BIO_set_conn_hostname(conn,host);
if (scon == NULL)
serverCon=(SSL *)SSL_new(tm_ctx);
serverCon=SSL_new(tm_ctx);
else
{
serverCon=scon;

View File

@ -72,7 +72,7 @@
static char *sess_id_usage[]={
"usage: sess_id args\n",
"\n",
" -inform arg - input format - default PEM (one of DER, TXT or PEM)\n",
" -inform arg - input format - default PEM (DER or PEM)\n",
" -outform arg - output format - default PEM\n",
" -in arg - input file - default stdin\n",
" -out arg - output file - default stdout\n",
@ -84,6 +84,9 @@ NULL
};
static SSL_SESSION *load_sess_id(char *file, int format);
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
SSL_SESSION *x=NULL;

535
crypto/openssl/apps/smime.c Normal file
View File

@ -0,0 +1,535 @@
/* smime.c */
/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
* project 1999.
*/
/* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* licensing@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
/* S/MIME utility function */
#include <stdio.h>
#include <string.h>
#include "apps.h"
#include <openssl/crypto.h>
#include <openssl/pem.h>
#include <openssl/err.h>
#undef PROG
#define PROG smime_main
static X509 *load_cert(char *file);
static EVP_PKEY *load_key(char *file, char *pass);
static STACK_OF(X509) *load_certs(char *file);
static X509_STORE *setup_verify(char *CAfile, char *CApath);
static int save_certs(char *signerfile, STACK_OF(X509) *signers);
#define SMIME_OP 0x10
#define SMIME_ENCRYPT (1 | SMIME_OP)
#define SMIME_DECRYPT 2
#define SMIME_SIGN (3 | SMIME_OP)
#define SMIME_VERIFY 4
#define SMIME_PK7OUT 5
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
int operation = 0;
int ret = 0;
char **args;
char *inmode = "r", *outmode = "w";
char *infile = NULL, *outfile = NULL;
char *signerfile = NULL, *recipfile = NULL;
char *certfile = NULL, *keyfile = NULL;
EVP_CIPHER *cipher = NULL;
PKCS7 *p7 = NULL;
X509_STORE *store = NULL;
X509 *cert = NULL, *recip = NULL, *signer = NULL;
EVP_PKEY *key = NULL;
STACK_OF(X509) *encerts = NULL, *other = NULL;
BIO *in = NULL, *out = NULL, *indata = NULL;
int badarg = 0;
int flags = PKCS7_DETACHED;
char *to = NULL, *from = NULL, *subject = NULL;
char *CAfile = NULL, *CApath = NULL;
char *passargin = NULL, *passin = NULL;
char *inrand = NULL;
int need_rand = 0;
args = argv + 1;
ret = 1;
while (!badarg && *args && *args[0] == '-') {
if (!strcmp (*args, "-encrypt")) operation = SMIME_ENCRYPT;
else if (!strcmp (*args, "-decrypt")) operation = SMIME_DECRYPT;
else if (!strcmp (*args, "-sign")) operation = SMIME_SIGN;
else if (!strcmp (*args, "-verify")) operation = SMIME_VERIFY;
else if (!strcmp (*args, "-pk7out")) operation = SMIME_PK7OUT;
#ifndef NO_DES
else if (!strcmp (*args, "-des3"))
cipher = EVP_des_ede3_cbc();
else if (!strcmp (*args, "-des"))
cipher = EVP_des_cbc();
#endif
#ifndef NO_RC2
else if (!strcmp (*args, "-rc2-40"))
cipher = EVP_rc2_40_cbc();
else if (!strcmp (*args, "-rc2-128"))
cipher = EVP_rc2_cbc();
else if (!strcmp (*args, "-rc2-64"))
cipher = EVP_rc2_64_cbc();
#endif
else if (!strcmp (*args, "-text"))
flags |= PKCS7_TEXT;
else if (!strcmp (*args, "-nointern"))
flags |= PKCS7_NOINTERN;
else if (!strcmp (*args, "-noverify"))
flags |= PKCS7_NOVERIFY;
else if (!strcmp (*args, "-nochain"))
flags |= PKCS7_NOCHAIN;
else if (!strcmp (*args, "-nocerts"))
flags |= PKCS7_NOCERTS;
else if (!strcmp (*args, "-noattr"))
flags |= PKCS7_NOATTR;
else if (!strcmp (*args, "-nodetach"))
flags &= ~PKCS7_DETACHED;
else if (!strcmp (*args, "-binary"))
flags |= PKCS7_BINARY;
else if (!strcmp (*args, "-nosigs"))
flags |= PKCS7_NOSIGS;
else if (!strcmp(*args,"-rand")) {
if (args[1]) {
args++;
inrand = *args;
} else badarg = 1;
need_rand = 1;
} else if (!strcmp(*args,"-passin")) {
if (args[1]) {
args++;
passargin = *args;
} else badarg = 1;
} else if (!strcmp (*args, "-to")) {
if (args[1]) {
args++;
to = *args;
} else badarg = 1;
} else if (!strcmp (*args, "-from")) {
if (args[1]) {
args++;
from = *args;
} else badarg = 1;
} else if (!strcmp (*args, "-subject")) {
if (args[1]) {
args++;
subject = *args;
} else badarg = 1;
} else if (!strcmp (*args, "-signer")) {
if (args[1]) {
args++;
signerfile = *args;
} else badarg = 1;
} else if (!strcmp (*args, "-recip")) {
if (args[1]) {
args++;
recipfile = *args;
} else badarg = 1;
} else if (!strcmp (*args, "-inkey")) {
if (args[1]) {
args++;
keyfile = *args;
} else badarg = 1;
} else if (!strcmp (*args, "-certfile")) {
if (args[1]) {
args++;
certfile = *args;
} else badarg = 1;
} else if (!strcmp (*args, "-CAfile")) {
if (args[1]) {
args++;
CAfile = *args;
} else badarg = 1;
} else if (!strcmp (*args, "-CApath")) {
if (args[1]) {
args++;
CApath = *args;
} else badarg = 1;
} else if (!strcmp (*args, "-in")) {
if (args[1]) {
args++;
infile = *args;
} else badarg = 1;
} else if (!strcmp (*args, "-out")) {
if (args[1]) {
args++;
outfile = *args;
} else badarg = 1;
} else badarg = 1;
args++;
}
if(operation == SMIME_SIGN) {
if(!signerfile) {
BIO_printf(bio_err, "No signer certificate specified\n");
badarg = 1;
}
need_rand = 1;
} else if(operation == SMIME_DECRYPT) {
if(!recipfile) {
BIO_printf(bio_err, "No recipient certificate and key specified\n");
badarg = 1;
}
} else if(operation == SMIME_ENCRYPT) {
if(!*args) {
BIO_printf(bio_err, "No recipient(s) certificate(s) specified\n");
badarg = 1;
}
need_rand = 1;
} else if(!operation) badarg = 1;
if (badarg) {
BIO_printf (bio_err, "Usage smime [options] cert.pem ...\n");
BIO_printf (bio_err, "where options are\n");
BIO_printf (bio_err, "-encrypt encrypt message\n");
BIO_printf (bio_err, "-decrypt decrypt encrypted message\n");
BIO_printf (bio_err, "-sign sign message\n");
BIO_printf (bio_err, "-verify verify signed message\n");
BIO_printf (bio_err, "-pk7out output PKCS#7 structure\n");
#ifndef NO_DES
BIO_printf (bio_err, "-des3 encrypt with triple DES\n");
BIO_printf (bio_err, "-des encrypt with DES\n");
#endif
#ifndef NO_RC2
BIO_printf (bio_err, "-rc2-40 encrypt with RC2-40 (default)\n");
BIO_printf (bio_err, "-rc2-64 encrypt with RC2-64\n");
BIO_printf (bio_err, "-rc2-128 encrypt with RC2-128\n");
#endif
BIO_printf (bio_err, "-nointern don't search certificates in message for signer\n");
BIO_printf (bio_err, "-nosigs don't verify message signature\n");
BIO_printf (bio_err, "-noverify don't verify signers certificate\n");
BIO_printf (bio_err, "-nocerts don't include signers certificate when signing\n");
BIO_printf (bio_err, "-nodetach use opaque signing\n");
BIO_printf (bio_err, "-noattr don't include any signed attributes\n");
BIO_printf (bio_err, "-binary don't translate message to text\n");
BIO_printf (bio_err, "-certfile file other certificates file\n");
BIO_printf (bio_err, "-signer file signer certificate file\n");
BIO_printf (bio_err, "-recip file recipient certificate file for decryption\n");
BIO_printf (bio_err, "-in file input file\n");
BIO_printf (bio_err, "-inkey file input private key (if not signer or recipient)\n");
BIO_printf (bio_err, "-out file output file\n");
BIO_printf (bio_err, "-to addr to address\n");
BIO_printf (bio_err, "-from ad from address\n");
BIO_printf (bio_err, "-subject s subject\n");
BIO_printf (bio_err, "-text include or delete text MIME headers\n");
BIO_printf (bio_err, "-CApath dir trusted certificates directory\n");
BIO_printf (bio_err, "-CAfile file trusted certificates file\n");
BIO_printf(bio_err, "-rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
BIO_printf(bio_err, " load the file (or the files in the directory) into\n");
BIO_printf(bio_err, " the random number generator\n");
BIO_printf (bio_err, "cert.pem recipient certificate(s) for encryption\n");
goto end;
}
if(!app_passwd(bio_err, passargin, NULL, &passin, NULL)) {
BIO_printf(bio_err, "Error getting password\n");
goto end;
}
if (need_rand) {
app_RAND_load_file(NULL, bio_err, (inrand != NULL));
if (inrand != NULL)
BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
app_RAND_load_files(inrand));
}
ret = 2;
if(operation != SMIME_SIGN) flags &= ~PKCS7_DETACHED;
if(flags & PKCS7_BINARY) {
if(operation & SMIME_OP) inmode = "rb";
else outmode = "rb";
}
if(operation == SMIME_ENCRYPT) {
if (!cipher) {
#ifndef NO_RC2
cipher = EVP_rc2_40_cbc();
#else
BIO_printf(bio_err, "No cipher selected\n");
goto end;
#endif
}
encerts = sk_X509_new_null();
while (*args) {
if(!(cert = load_cert(*args))) {
BIO_printf(bio_err, "Can't read recipient certificate file %s\n", *args);
goto end;
}
sk_X509_push(encerts, cert);
cert = NULL;
args++;
}
}
if(signerfile && (operation == SMIME_SIGN)) {
if(!(signer = load_cert(signerfile))) {
BIO_printf(bio_err, "Can't read signer certificate file %s\n", signerfile);
goto end;
}
}
if(certfile) {
if(!(other = load_certs(certfile))) {
BIO_printf(bio_err, "Can't read certificate file %s\n", certfile);
ERR_print_errors(bio_err);
goto end;
}
}
if(recipfile && (operation == SMIME_DECRYPT)) {
if(!(recip = load_cert(recipfile))) {
BIO_printf(bio_err, "Can't read recipient certificate file %s\n", recipfile);
ERR_print_errors(bio_err);
goto end;
}
}
if(operation == SMIME_DECRYPT) {
if(!keyfile) keyfile = recipfile;
} else if(operation == SMIME_SIGN) {
if(!keyfile) keyfile = signerfile;
} else keyfile = NULL;
if(keyfile) {
if(!(key = load_key(keyfile, passin))) {
BIO_printf(bio_err, "Can't read recipient certificate file %s\n", keyfile);
ERR_print_errors(bio_err);
goto end;
}
}
if (infile) {
if (!(in = BIO_new_file(infile, inmode))) {
BIO_printf (bio_err,
"Can't open input file %s\n", infile);
goto end;
}
} else in = BIO_new_fp(stdin, BIO_NOCLOSE);
if (outfile) {
if (!(out = BIO_new_file(outfile, outmode))) {
BIO_printf (bio_err,
"Can't open output file %s\n", outfile);
goto end;
}
} else out = BIO_new_fp(stdout, BIO_NOCLOSE);
if(operation == SMIME_VERIFY) {
if(!(store = setup_verify(CAfile, CApath))) goto end;
}
ret = 3;
if(operation == SMIME_ENCRYPT) {
p7 = PKCS7_encrypt(encerts, in, cipher, flags);
} else if(operation == SMIME_SIGN) {
p7 = PKCS7_sign(signer, key, other, in, flags);
BIO_reset(in);
} else {
if(!(p7 = SMIME_read_PKCS7(in, &indata))) {
BIO_printf(bio_err, "Error reading S/MIME message\n");
goto end;
}
}
if(!p7) {
BIO_printf(bio_err, "Error creating PKCS#7 structure\n");
goto end;
}
ret = 4;
if(operation == SMIME_DECRYPT) {
if(!PKCS7_decrypt(p7, key, recip, out, flags)) {
BIO_printf(bio_err, "Error decrypting PKCS#7 structure\n");
goto end;
}
} else if(operation == SMIME_VERIFY) {
STACK_OF(X509) *signers;
if(PKCS7_verify(p7, other, store, indata, out, flags)) {
BIO_printf(bio_err, "Verification Successful\n");
} else {
BIO_printf(bio_err, "Verification Failure\n");
goto end;
}
signers = PKCS7_get0_signers(p7, other, flags);
if(!save_certs(signerfile, signers)) {
BIO_printf(bio_err, "Error writing signers to %s\n",
signerfile);
ret = 5;
goto end;
}
sk_X509_free(signers);
} else if(operation == SMIME_PK7OUT) {
PEM_write_bio_PKCS7(out, p7);
} else {
if(to) BIO_printf(out, "To: %s\n", to);
if(from) BIO_printf(out, "From: %s\n", from);
if(subject) BIO_printf(out, "Subject: %s\n", subject);
SMIME_write_PKCS7(out, p7, in, flags);
}
ret = 0;
end:
if (need_rand)
app_RAND_write_file(NULL, bio_err);
if(ret) ERR_print_errors(bio_err);
sk_X509_pop_free(encerts, X509_free);
sk_X509_pop_free(other, X509_free);
X509_STORE_free(store);
X509_free(cert);
X509_free(recip);
X509_free(signer);
EVP_PKEY_free(key);
PKCS7_free(p7);
BIO_free(in);
BIO_free(indata);
BIO_free(out);
if(passin) Free(passin);
return (ret);
}
static X509 *load_cert(char *file)
{
BIO *in;
X509 *cert;
if(!(in = BIO_new_file(file, "r"))) return NULL;
cert = PEM_read_bio_X509(in, NULL, NULL,NULL);
BIO_free(in);
return cert;
}
static EVP_PKEY *load_key(char *file, char *pass)
{
BIO *in;
EVP_PKEY *key;
if(!(in = BIO_new_file(file, "r"))) return NULL;
key = PEM_read_bio_PrivateKey(in, NULL,NULL,pass);
BIO_free(in);
return key;
}
static STACK_OF(X509) *load_certs(char *file)
{
BIO *in;
int i;
STACK_OF(X509) *othercerts;
STACK_OF(X509_INFO) *allcerts;
X509_INFO *xi;
if(!(in = BIO_new_file(file, "r"))) return NULL;
othercerts = sk_X509_new(NULL);
if(!othercerts) return NULL;
allcerts = PEM_X509_INFO_read_bio(in, NULL, NULL, NULL);
for(i = 0; i < sk_X509_INFO_num(allcerts); i++) {
xi = sk_X509_INFO_value (allcerts, i);
if (xi->x509) {
sk_X509_push(othercerts, xi->x509);
xi->x509 = NULL;
}
}
sk_X509_INFO_pop_free(allcerts, X509_INFO_free);
BIO_free(in);
return othercerts;
}
static X509_STORE *setup_verify(char *CAfile, char *CApath)
{
X509_STORE *store;
X509_LOOKUP *lookup;
if(!(store = X509_STORE_new())) goto end;
lookup=X509_STORE_add_lookup(store,X509_LOOKUP_file());
if (lookup == NULL) goto end;
if (CAfile) {
if(!X509_LOOKUP_load_file(lookup,CAfile,X509_FILETYPE_PEM)) {
BIO_printf(bio_err, "Error loading file %s\n", CAfile);
goto end;
}
} else X509_LOOKUP_load_file(lookup,NULL,X509_FILETYPE_DEFAULT);
lookup=X509_STORE_add_lookup(store,X509_LOOKUP_hash_dir());
if (lookup == NULL) goto end;
if (CApath) {
if(!X509_LOOKUP_add_dir(lookup,CApath,X509_FILETYPE_PEM)) {
BIO_printf(bio_err, "Error loading directory %s\n", CApath);
goto end;
}
} else X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT);
ERR_clear_error();
return store;
end:
X509_STORE_free(store);
return NULL;
}
static int save_certs(char *signerfile, STACK_OF(X509) *signers)
{
int i;
BIO *tmp;
if(!signerfile) return 1;
tmp = BIO_new_file(signerfile, "w");
if(!tmp) return 0;
for(i = 0; i < sk_X509_num(signers); i++)
PEM_write_bio_X509(tmp, sk_X509_value(signers, i));
BIO_free(tmp);
return 1;
}

View File

@ -238,16 +238,19 @@ static double Time_F(int s)
#endif
}
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
unsigned char *buf=NULL,*buf2=NULL;
int ret=1;
int mret=1;
#define ALGOR_NUM 14
#define SIZE_NUM 5
#define RSA_NUM 4
#define DSA_NUM 3
long count,rsa_count;
int i,j,k,rsa_num,rsa_num2;
int i,j,k;
unsigned rsa_num,rsa_num2;
#ifndef NO_MD2
unsigned char md2[MD2_DIGEST_LENGTH];
#endif
@ -344,6 +347,7 @@ int MAIN(int argc, char **argv)
int pr_header=0;
apps_startup();
memset(results, 0, sizeof(results));
#ifndef NO_DSA
memset(dsa_key,0,sizeof(dsa_key));
#endif
@ -421,7 +425,7 @@ int MAIN(int argc, char **argv)
if (strcmp(*argv,"rc4") == 0) doit[D_RC4]=1;
else
#endif
#ifndef NO_DEF
#ifndef NO_DES
if (strcmp(*argv,"des-cbc") == 0) doit[D_CBC_DES]=1;
else if (strcmp(*argv,"des-ede3") == 0) doit[D_EDE3_DES]=1;
else
@ -435,12 +439,14 @@ int MAIN(int argc, char **argv)
}
else
#endif
#ifndef RSA_NULL
if (strcmp(*argv,"openssl") == 0)
{
RSA_set_default_method(RSA_PKCS1_SSLeay());
j--;
}
else
#endif
#endif /* !NO_RSA */
if (strcmp(*argv,"dsa512") == 0) dsa_doit[R_DSA_512]=2;
else if (strcmp(*argv,"dsa1024") == 0) dsa_doit[R_DSA_1024]=2;
@ -586,9 +592,9 @@ int MAIN(int argc, char **argv)
#endif
#ifndef NO_DES
des_set_key(&key,sch);
des_set_key(&key2,sch2);
des_set_key(&key3,sch3);
des_set_key_unchecked(&key,sch);
des_set_key_unchecked(&key2,sch2);
des_set_key_unchecked(&key3,sch3);
#endif
#ifndef NO_IDEA
idea_set_encrypt_key(key16,&idea_ks);
@ -612,6 +618,7 @@ int MAIN(int argc, char **argv)
memset(rsa_c,0,sizeof(rsa_c));
#endif
#ifndef SIGALRM
#ifndef NO_DES
BIO_printf(bio_err,"First we calculate the approximate speed ...\n");
count=10;
do {
@ -703,10 +710,14 @@ int MAIN(int argc, char **argv)
#define COND(d) (count < (d))
#define COUNT(d) (d)
#else
/* not worth fixing */
# error "You cannot disable DES on systems without SIGALRM."
#endif /* NO_DES */
#else
#define COND(c) (run)
#define COUNT(d) (count)
signal(SIGALRM,sig_done);
#endif
#endif /* SIGALRM */
#ifndef NO_MD2
if (doit[D_MD2])
@ -956,22 +967,22 @@ int MAIN(int argc, char **argv)
}
#endif
RAND_bytes(buf,30);
RAND_pseudo_bytes(buf,36);
#ifndef NO_RSA
for (j=0; j<RSA_NUM; j++)
{
int ret;
if (!rsa_doit[j]) continue;
rsa_num=RSA_private_encrypt(30,buf,buf2,rsa_key[j],
RSA_PKCS1_PADDING);
ret=RSA_sign(NID_md5_sha1, buf,36, buf2, &rsa_num, rsa_key[j]);
pkey_print_message("private","rsa",rsa_c[j][0],rsa_bits[j],
RSA_SECONDS);
/* RSA_blinding_on(rsa_key[j],NULL); */
Time_F(START);
for (count=0,run=1; COND(rsa_c[j][0]); count++)
{
rsa_num=RSA_private_encrypt(30,buf,buf2,rsa_key[j],
RSA_PKCS1_PADDING);
if (rsa_num <= 0)
ret=RSA_sign(NID_md5_sha1, buf,36, buf2, &rsa_num,
rsa_key[j]);
if (ret <= 0)
{
BIO_printf(bio_err,"RSA private encrypt failure\n");
ERR_print_errors(bio_err);
@ -986,18 +997,17 @@ int MAIN(int argc, char **argv)
rsa_count=count;
#if 1
rsa_num2=RSA_public_decrypt(rsa_num,buf2,buf,rsa_key[j],
RSA_PKCS1_PADDING);
ret=RSA_verify(NID_md5_sha1, buf,36, buf2, rsa_num, rsa_key[j]);
pkey_print_message("public","rsa",rsa_c[j][1],rsa_bits[j],
RSA_SECONDS);
Time_F(START);
for (count=0,run=1; COND(rsa_c[j][1]); count++)
{
rsa_num2=RSA_public_decrypt(rsa_num,buf2,buf,rsa_key[j],
RSA_PKCS1_PADDING);
if (rsa_num2 <= 0)
ret=RSA_verify(NID_md5_sha1, buf,36, buf2, rsa_num,
rsa_key[j]);
if (ret <= 0)
{
BIO_printf(bio_err,"RSA public encrypt failure\n");
BIO_printf(bio_err,"RSA verify failure\n");
ERR_print_errors(bio_err);
count=1;
break;
@ -1018,8 +1028,13 @@ int MAIN(int argc, char **argv)
}
#endif
RAND_bytes(buf,20);
RAND_pseudo_bytes(buf,20);
#ifndef NO_DSA
if (RAND_status() != 1)
{
RAND_seed(rnd_seed, sizeof rnd_seed);
rnd_fake = 1;
}
for (j=0; j<DSA_NUM; j++)
{
unsigned int kk;
@ -1036,7 +1051,7 @@ int MAIN(int argc, char **argv)
{
rsa_num=DSA_sign(EVP_PKEY_DSA,buf,20,buf2,
&kk,dsa_key[j]);
if (rsa_num <= 0)
if (rsa_num == 0)
{
BIO_printf(bio_err,"DSA sign failure\n");
ERR_print_errors(bio_err);
@ -1059,7 +1074,7 @@ int MAIN(int argc, char **argv)
{
rsa_num2=DSA_verify(EVP_PKEY_DSA,buf,20,buf2,
kk,dsa_key[j]);
if (rsa_num2 <= 0)
if (rsa_num2 == 0)
{
BIO_printf(bio_err,"DSA verify failure\n");
ERR_print_errors(bio_err);
@ -1079,6 +1094,7 @@ int MAIN(int argc, char **argv)
dsa_doit[j]=0;
}
}
if (rnd_fake) RAND_cleanup();
#endif
fprintf(stdout,"%s\n",SSLeay_version(SSLEAY_VERSION));
@ -1155,7 +1171,7 @@ int MAIN(int argc, char **argv)
fprintf(stdout,"\n");
}
#endif
ret=0;
mret=0;
end:
if (buf != NULL) Free(buf);
if (buf2 != NULL) Free(buf2);
@ -1169,7 +1185,7 @@ int MAIN(int argc, char **argv)
if (dsa_key[i] != NULL)
DSA_free(dsa_key[i]);
#endif
EXIT(ret);
EXIT(mret);
}
static void print_message(char *s, long num, int length)

276
crypto/openssl/apps/spkac.c Normal file
View File

@ -0,0 +1,276 @@
/* apps/spkac.c */
/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
* project 1999. Based on an original idea by Massimiliano Pala
* (madwolf@openca.org).
*/
/* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* licensing@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "apps.h"
#include <openssl/bio.h>
#include <openssl/conf.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/lhash.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#undef PROG
#define PROG spkac_main
/* -in arg - input file - default stdin
* -out arg - output file - default stdout
*/
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
int i,badops=0, ret = 1;
BIO *in = NULL,*out = NULL, *key = NULL;
int verify=0,noout=0,pubkey=0;
char *infile = NULL,*outfile = NULL,*prog;
char *passargin = NULL, *passin = NULL;
char *spkac = "SPKAC", *spksect = "default", *spkstr = NULL;
char *challenge = NULL, *keyfile = NULL;
LHASH *conf = NULL;
NETSCAPE_SPKI *spki = NULL;
EVP_PKEY *pkey = NULL;
apps_startup();
if (!bio_err) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
prog=argv[0];
argc--;
argv++;
while (argc >= 1)
{
if (strcmp(*argv,"-in") == 0)
{
if (--argc < 1) goto bad;
infile= *(++argv);
}
else if (strcmp(*argv,"-out") == 0)
{
if (--argc < 1) goto bad;
outfile= *(++argv);
}
else if (strcmp(*argv,"-passin") == 0)
{
if (--argc < 1) goto bad;
passargin= *(++argv);
}
else if (strcmp(*argv,"-key") == 0)
{
if (--argc < 1) goto bad;
keyfile= *(++argv);
}
else if (strcmp(*argv,"-challenge") == 0)
{
if (--argc < 1) goto bad;
challenge= *(++argv);
}
else if (strcmp(*argv,"-spkac") == 0)
{
if (--argc < 1) goto bad;
spkac= *(++argv);
}
else if (strcmp(*argv,"-spksect") == 0)
{
if (--argc < 1) goto bad;
spksect= *(++argv);
}
else if (strcmp(*argv,"-noout") == 0)
noout=1;
else if (strcmp(*argv,"-pubkey") == 0)
pubkey=1;
else if (strcmp(*argv,"-verify") == 0)
verify=1;
else badops = 1;
argc--;
argv++;
}
if (badops)
{
bad:
BIO_printf(bio_err,"%s [options]\n",prog);
BIO_printf(bio_err,"where options are\n");
BIO_printf(bio_err," -in arg input file\n");
BIO_printf(bio_err," -out arg output file\n");
BIO_printf(bio_err," -key arg create SPKAC using private key\n");
BIO_printf(bio_err," -passin arg input file pass phrase source\n");
BIO_printf(bio_err," -challenge arg challenge string\n");
BIO_printf(bio_err," -spkac arg alternative SPKAC name\n");
BIO_printf(bio_err," -noout don't print SPKAC\n");
BIO_printf(bio_err," -pubkey output public key\n");
BIO_printf(bio_err," -verify verify SPKAC signature\n");
goto end;
}
ERR_load_crypto_strings();
if(!app_passwd(bio_err, passargin, NULL, &passin, NULL)) {
BIO_printf(bio_err, "Error getting password\n");
goto end;
}
if(keyfile) {
if(strcmp(keyfile, "-")) key = BIO_new_file(keyfile, "r");
else key = BIO_new_fp(stdin, BIO_NOCLOSE);
if(!key) {
BIO_printf(bio_err, "Error opening key file\n");
ERR_print_errors(bio_err);
goto end;
}
pkey = PEM_read_bio_PrivateKey(key, NULL, NULL, passin);
if(!pkey) {
BIO_printf(bio_err, "Error reading private key\n");
ERR_print_errors(bio_err);
goto end;
}
spki = NETSCAPE_SPKI_new();
if(challenge) ASN1_STRING_set(spki->spkac->challenge,
challenge, strlen(challenge));
NETSCAPE_SPKI_set_pubkey(spki, pkey);
NETSCAPE_SPKI_sign(spki, pkey, EVP_md5());
spkstr = NETSCAPE_SPKI_b64_encode(spki);
if (outfile) out = BIO_new_file(outfile, "w");
else out = BIO_new_fp(stdout, BIO_NOCLOSE);
if(!out) {
BIO_printf(bio_err, "Error opening output file\n");
ERR_print_errors(bio_err);
goto end;
}
BIO_printf(out, "SPKAC=%s\n", spkstr);
Free(spkstr);
ret = 0;
goto end;
}
if (infile) in = BIO_new_file(infile, "r");
else in = BIO_new_fp(stdin, BIO_NOCLOSE);
if(!in) {
BIO_printf(bio_err, "Error opening input file\n");
ERR_print_errors(bio_err);
goto end;
}
conf = CONF_load_bio(NULL, in, NULL);
if(!conf) {
BIO_printf(bio_err, "Error parsing config file\n");
ERR_print_errors(bio_err);
goto end;
}
spkstr = CONF_get_string(conf, spksect, spkac);
if(!spkstr) {
BIO_printf(bio_err, "Can't find SPKAC called \"%s\"\n", spkac);
ERR_print_errors(bio_err);
goto end;
}
spki = NETSCAPE_SPKI_b64_decode(spkstr, -1);
if(!spki) {
BIO_printf(bio_err, "Error loading SPKAC\n");
ERR_print_errors(bio_err);
goto end;
}
if (outfile) out = BIO_new_file(outfile, "w");
else out = BIO_new_fp(stdout, BIO_NOCLOSE);
if(!out) {
BIO_printf(bio_err, "Error opening output file\n");
ERR_print_errors(bio_err);
goto end;
}
if(!noout) NETSCAPE_SPKI_print(out, spki);
pkey = NETSCAPE_SPKI_get_pubkey(spki);
if(verify) {
i = NETSCAPE_SPKI_verify(spki, pkey);
if(i) BIO_printf(bio_err, "Signature OK\n");
else {
BIO_printf(bio_err, "Signature Failure\n");
ERR_print_errors(bio_err);
goto end;
}
}
if(pubkey) PEM_write_bio_PUBKEY(out, pkey);
ret = 0;
end:
CONF_free(conf);
NETSCAPE_SPKI_free(spki);
BIO_free(in);
BIO_free(out);
BIO_free(key);
EVP_PKEY_free(pkey);
if(passin) Free(passin);
EXIT(ret);
}

View File

@ -1,4 +1,5 @@
/* NOCW */
/* used by apps/speed.c */
DSA *get_dsa512(void );
DSA *get_dsa1024(void );
DSA *get_dsa2048(void );
@ -146,3 +147,5 @@ DSA *get_dsa2048()
return(dsa);
}
static const char rnd_seed[] = "string to make the random number generator think it has entropy";
static int rnd_fake = 0;

View File

@ -1,4 +1,5 @@
/* apps/testrsa.h */
/* used by apps/speed.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*

View File

@ -63,19 +63,26 @@
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <openssl/pem.h>
#undef PROG
#define PROG verify_main
static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx);
static int check(X509_STORE *ctx,char *file);
static int check(X509_STORE *ctx,char *file, STACK_OF(X509)*other, int purpose);
static STACK_OF(X509) *load_untrusted(char *file);
static int v_verbose=0;
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
int i,ret=1;
int purpose = -1;
char *CApath=NULL,*CAfile=NULL;
char *untfile = NULL;
STACK_OF(X509) *untrusted = NULL;
X509_STORE *cert_ctx=NULL;
X509_LOOKUP *lookup=NULL;
@ -107,6 +114,24 @@ int MAIN(int argc, char **argv)
if (argc-- < 1) goto end;
CAfile= *(++argv);
}
else if (strcmp(*argv,"-purpose") == 0)
{
X509_PURPOSE *xptmp;
if (argc-- < 1) goto end;
i = X509_PURPOSE_get_by_sname(*(++argv));
if(i < 0)
{
BIO_printf(bio_err, "unrecognized purpose\n");
goto end;
}
xptmp = X509_PURPOSE_get0(i);
purpose = X509_PURPOSE_get_id(xptmp);
}
else if (strcmp(*argv,"-untrusted") == 0)
{
if (argc-- < 1) goto end;
untfile= *(++argv);
}
else if (strcmp(*argv,"-help") == 0)
goto end;
else if (strcmp(*argv,"-verbose") == 0)
@ -124,34 +149,63 @@ int MAIN(int argc, char **argv)
lookup=X509_STORE_add_lookup(cert_ctx,X509_LOOKUP_file());
if (lookup == NULL) abort();
if (!X509_LOOKUP_load_file(lookup,CAfile,X509_FILETYPE_PEM))
X509_LOOKUP_load_file(lookup,NULL,X509_FILETYPE_DEFAULT);
if (CAfile) {
i=X509_LOOKUP_load_file(lookup,CAfile,X509_FILETYPE_PEM);
if(!i) {
BIO_printf(bio_err, "Error loading file %s\n", CAfile);
ERR_print_errors(bio_err);
goto end;
}
} else X509_LOOKUP_load_file(lookup,NULL,X509_FILETYPE_DEFAULT);
lookup=X509_STORE_add_lookup(cert_ctx,X509_LOOKUP_hash_dir());
if (lookup == NULL) abort();
if (!X509_LOOKUP_add_dir(lookup,CApath,X509_FILETYPE_PEM))
X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT);
if (CApath) {
i=X509_LOOKUP_add_dir(lookup,CApath,X509_FILETYPE_PEM);
if(!i) {
BIO_printf(bio_err, "Error loading directory %s\n", CApath);
ERR_print_errors(bio_err);
goto end;
}
} else X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT);
ERR_clear_error();
if (argc < 1) check(cert_ctx,NULL);
if(untfile) {
if(!(untrusted = load_untrusted(untfile))) {
BIO_printf(bio_err, "Error loading untrusted file %s\n", untfile);
ERR_print_errors(bio_err);
goto end;
}
}
if (argc < 1) check(cert_ctx, NULL, untrusted, purpose);
else
for (i=0; i<argc; i++)
check(cert_ctx,argv[i]);
check(cert_ctx,argv[i], untrusted, purpose);
ret=0;
end:
if (ret == 1)
if (ret == 1) {
BIO_printf(bio_err,"usage: verify [-verbose] [-CApath path] [-CAfile file] cert1 cert2 ...\n");
BIO_printf(bio_err,"recognized usages:\n");
for(i = 0; i < X509_PURPOSE_get_count(); i++) {
X509_PURPOSE *ptmp;
ptmp = X509_PURPOSE_get0(i);
BIO_printf(bio_err, "\t%-10s\t%s\n", X509_PURPOSE_get0_sname(ptmp),
X509_PURPOSE_get0_name(ptmp));
}
}
if (cert_ctx != NULL) X509_STORE_free(cert_ctx);
sk_X509_pop_free(untrusted, X509_free);
EXIT(ret);
}
static int check(X509_STORE *ctx, char *file)
static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, int purpose)
{
X509 *x=NULL;
BIO *in=NULL;
int i=0,ret=0;
X509_STORE_CTX csc;
X509_STORE_CTX *csc;
in=BIO_new(BIO_s_file());
if (in == NULL)
@ -181,9 +235,16 @@ static int check(X509_STORE *ctx, char *file)
}
fprintf(stdout,"%s: ",(file == NULL)?"stdin":file);
X509_STORE_CTX_init(&csc,ctx,x,NULL);
i=X509_verify_cert(&csc);
X509_STORE_CTX_cleanup(&csc);
csc = X509_STORE_CTX_new();
if (csc == NULL)
{
ERR_print_errors(bio_err);
goto end;
}
X509_STORE_CTX_init(csc,ctx,x,uchain);
if(purpose >= 0) X509_STORE_CTX_set_purpose(csc, purpose);
i=X509_verify_cert(csc);
X509_STORE_CTX_free(csc);
ret=0;
end:
@ -200,27 +261,75 @@ static int check(X509_STORE *ctx, char *file)
return(ret);
}
static STACK_OF(X509) *load_untrusted(char *certfile)
{
STACK_OF(X509_INFO) *sk=NULL;
STACK_OF(X509) *stack=NULL, *ret=NULL;
BIO *in=NULL;
X509_INFO *xi;
if(!(stack = sk_X509_new_null())) {
BIO_printf(bio_err,"memory allocation failure\n");
goto end;
}
if(!(in=BIO_new_file(certfile, "r"))) {
BIO_printf(bio_err,"error opening the file, %s\n",certfile);
goto end;
}
/* This loads from a file, a stack of x509/crl/pkey sets */
if(!(sk=PEM_X509_INFO_read_bio(in,NULL,NULL,NULL))) {
BIO_printf(bio_err,"error reading the file, %s\n",certfile);
goto end;
}
/* scan over it and pull out the certs */
while (sk_X509_INFO_num(sk))
{
xi=sk_X509_INFO_shift(sk);
if (xi->x509 != NULL)
{
sk_X509_push(stack,xi->x509);
xi->x509=NULL;
}
X509_INFO_free(xi);
}
if(!sk_X509_num(stack)) {
BIO_printf(bio_err,"no certificates in file, %s\n",certfile);
sk_X509_free(stack);
goto end;
}
ret=stack;
end:
BIO_free(in);
sk_X509_INFO_free(sk);
return(ret);
}
static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx)
{
char buf[256];
if (!ok)
{
/* since we are just checking the certificates, it is
* ok if they are self signed. */
if (ctx->error == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT)
ok=1;
else
{
X509_NAME_oneline(
X509_NAME_oneline(
X509_get_subject_name(ctx->current_cert),buf,256);
printf("%s\n",buf);
printf("error %d at %d depth lookup:%s\n",ctx->error,
ctx->error_depth,
X509_verify_cert_error_string(ctx->error));
if (ctx->error == X509_V_ERR_CERT_HAS_EXPIRED)
ok=1;
}
printf("%s\n",buf);
printf("error %d at %d depth lookup:%s\n",ctx->error,
ctx->error_depth,
X509_verify_cert_error_string(ctx->error));
if (ctx->error == X509_V_ERR_CERT_HAS_EXPIRED) ok=1;
/* since we are just checking the certificates, it is
* ok if they are self signed. But we should still warn
* the user.
*/
if (ctx->error == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) ok=1;
/* Continue after extension errors too */
if (ctx->error == X509_V_ERR_INVALID_CA) ok=1;
if (ctx->error == X509_V_ERR_PATH_LENGTH_EXCEEDED) ok=1;
if (ctx->error == X509_V_ERR_INVALID_PURPOSE) ok=1;
if (ctx->error == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) ok=1;
}
if (!v_verbose)
ERR_clear_error();

View File

@ -66,6 +66,8 @@
#undef PROG
#define PROG version_main
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
int i,ret=0;

View File

@ -0,0 +1,149 @@
/* apps/winrand.c */
/* ====================================================================
* Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core@openssl.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
/* Usage: winrand [filename]
*
* Collects entropy from mouse movements and other events and writes
* random data to filename or .rnd
*/
#include <windows.h>
#include <openssl/opensslv.h>
#include <openssl/rand.h>
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
const char *filename;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR cmdline, int iCmdShow)
{
static char appname[] = "OpenSSL";
HWND hwnd;
MSG msg;
WNDCLASSEX wndclass;
char buffer[200];
if (cmdline[0] == '\0')
filename = RAND_file_name(buffer, sizeof buffer);
else
filename = cmdline;
RAND_load_file(filename, -1);
wndclass.cbSize = sizeof(wndclass);
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = appname;
wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
RegisterClassEx(&wndclass);
hwnd = CreateWindow(appname, OPENSSL_VERSION_TEXT,
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
ShowWindow(hwnd, iCmdShow);
UpdateWindow(hwnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
RECT rect;
char buffer[200];
static int seeded = 0;
switch (iMsg)
{
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
DrawText(hdc, "Seeding the PRNG. Please move the mouse!", -1,
&rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
EndPaint(hwnd, &ps);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
if (RAND_event(iMsg, wParam, lParam) == 1 && seeded == 0)
{
seeded = 1;
if (RAND_write_file(filename) <= 0)
MessageBox(hwnd, "Couldn't write random file!",
"OpenSSL", MB_OK | MB_ICONERROR);
PostQuitMessage(0);
}
return DefWindowProc(hwnd, iMsg, wParam, lParam);
}

View File

@ -56,6 +56,7 @@
* [including the GNU Public Licence.]
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -91,59 +92,78 @@ static char *x509_usage[]={
" -CAkeyform arg - CA key format - default PEM\n",
" -in arg - input file - default stdin\n",
" -out arg - output file - default stdout\n",
" -passin arg - private key password source\n",
" -serial - print serial number value\n",
" -hash - print hash value\n",
" -subject - print subject DN\n",
" -issuer - print issuer DN\n",
" -startdate - notBefore field\n",
" -enddate - notAfter field\n",
" -purpose - print out certificate purposes\n",
" -dates - both Before and After dates\n",
" -modulus - print the RSA key modulus\n",
" -pubkey - output the public key\n",
" -fingerprint - print the certificate fingerprint\n",
" -alias - output certificate alias\n",
" -noout - no certificate output\n",
" -trustout - output a \"trusted\" certificate\n",
" -clrtrust - clear all trusted purposes\n",
" -clrreject - clear all rejected purposes\n",
" -addtrust arg - trust certificate for a given purpose\n",
" -addreject arg - reject certificate for a given purpose\n",
" -setalias arg - set certificate alias\n",
" -days arg - How long till expiry of a signed certificate - def 30 days\n",
" -signkey arg - self sign cert with arg\n",
" -x509toreq - output a certification request object\n",
" -req - input is a certificate request, sign and output.\n",
" -CA arg - set the CA certificate, must be PEM format.\n",
" -CAkey arg - set the CA key, must be PEM format\n",
" missing, it is asssumed to be in the CA file.\n",
" missing, it is assumed to be in the CA file.\n",
" -CAcreateserial - create serial number file if it does not exist\n",
" -CAserial - serial file\n",
" -text - print the certificate in text form\n",
" -C - print out C code forms\n",
" -md2/-md5/-sha1/-mdc2 - digest to do an RSA sign with\n",
" -md2/-md5/-sha1/-mdc2 - digest to use\n",
" -extfile - configuration file with X509V3 extensions to add\n",
" -extensions - section from config file with X509V3 extensions to add\n",
" -clrext - delete extensions before signing and input certificate\n",
NULL
};
static int MS_CALLBACK callb(int ok, X509_STORE_CTX *ctx);
static EVP_PKEY *load_key(char *file, int format);
static EVP_PKEY *load_key(char *file, int format, char *passin);
static X509 *load_cert(char *file, int format);
static int sign (X509 *x, EVP_PKEY *pkey,int days,const EVP_MD *digest,
static int sign (X509 *x, EVP_PKEY *pkey,int days,int clrext, const EVP_MD *digest,
LHASH *conf, char *section);
static int x509_certify (X509_STORE *ctx,char *CAfile,const EVP_MD *digest,
X509 *x,X509 *xca,EVP_PKEY *pkey,char *serial,
int create,int days, LHASH *conf, char *section);
int create,int days, int clrext, LHASH *conf, char *section);
static int purpose_print(BIO *bio, X509 *cert, X509_PURPOSE *pt);
static int reqfile=0;
int MAIN(int, char **);
int MAIN(int argc, char **argv)
{
int ret=1;
X509_REQ *req=NULL;
X509 *x=NULL,*xca=NULL;
ASN1_OBJECT *objtmp;
EVP_PKEY *Upkey=NULL,*CApkey=NULL;
int i,num,badops=0;
BIO *out=NULL;
BIO *STDout=NULL;
STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL;
int informat,outformat,keyformat,CAformat,CAkeyformat;
char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL;
char *CAkeyfile=NULL,*CAserial=NULL;
char *alias=NULL;
int text=0,serial=0,hash=0,subject=0,issuer=0,startdate=0,enddate=0;
int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0;
int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0;
int C=0;
int x509req=0,days=DEF_DAYS,modulus=0;
int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0;
int pprint = 0;
char **pp;
X509_STORE *ctx=NULL;
X509_REQ *rq=NULL;
@ -151,7 +171,8 @@ int MAIN(int argc, char **argv)
char buf[256];
const EVP_MD *md_alg,*digest=EVP_md5();
LHASH *extconf = NULL;
char *extsect = NULL, *extfile = NULL;
char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;
int need_rand = 0;
reqfile=0;
@ -192,7 +213,10 @@ int MAIN(int argc, char **argv)
keyformat=str2fmt(*(++argv));
}
else if (strcmp(*argv,"-req") == 0)
{
reqfile=1;
need_rand = 1;
}
else if (strcmp(*argv,"-CAform") == 0)
{
if (--argc < 1) goto bad;
@ -213,11 +237,21 @@ int MAIN(int argc, char **argv)
goto bad;
}
}
else if (strcmp(*argv,"-passin") == 0)
{
if (--argc < 1) goto bad;
passargin= *(++argv);
}
else if (strcmp(*argv,"-extfile") == 0)
{
if (--argc < 1) goto bad;
extfile= *(++argv);
}
else if (strcmp(*argv,"-extensions") == 0)
{
if (--argc < 1) goto bad;
extsect= *(++argv);
}
else if (strcmp(*argv,"-in") == 0)
{
if (--argc < 1) goto bad;
@ -233,12 +267,14 @@ int MAIN(int argc, char **argv)
if (--argc < 1) goto bad;
keyfile= *(++argv);
sign_flag= ++num;
need_rand = 1;
}
else if (strcmp(*argv,"-CA") == 0)
{
if (--argc < 1) goto bad;
CAfile= *(++argv);
CA_flag= ++num;
need_rand = 1;
}
else if (strcmp(*argv,"-CAkey") == 0)
{
@ -250,12 +286,50 @@ int MAIN(int argc, char **argv)
if (--argc < 1) goto bad;
CAserial= *(++argv);
}
else if (strcmp(*argv,"-addtrust") == 0)
{
if (--argc < 1) goto bad;
if(!(objtmp = OBJ_txt2obj(*(++argv), 0))) {
BIO_printf(bio_err,
"Invalid trust object value %s\n", *argv);
goto bad;
}
if(!trust) trust = sk_ASN1_OBJECT_new_null();
sk_ASN1_OBJECT_push(trust, objtmp);
trustout = 1;
}
else if (strcmp(*argv,"-addreject") == 0)
{
if (--argc < 1) goto bad;
if(!(objtmp = OBJ_txt2obj(*(++argv), 0))) {
BIO_printf(bio_err,
"Invalid reject object value %s\n", *argv);
goto bad;
}
if(!reject) reject = sk_ASN1_OBJECT_new_null();
sk_ASN1_OBJECT_push(reject, objtmp);
trustout = 1;
}
else if (strcmp(*argv,"-setalias") == 0)
{
if (--argc < 1) goto bad;
alias= *(++argv);
trustout = 1;
}
else if (strcmp(*argv,"-setalias") == 0)
{
if (--argc < 1) goto bad;
alias= *(++argv);
trustout = 1;
}
else if (strcmp(*argv,"-C") == 0)
C= ++num;
else if (strcmp(*argv,"-serial") == 0)
serial= ++num;
else if (strcmp(*argv,"-modulus") == 0)
modulus= ++num;
else if (strcmp(*argv,"-pubkey") == 0)
pubkey= ++num;
else if (strcmp(*argv,"-x509toreq") == 0)
x509req= ++num;
else if (strcmp(*argv,"-text") == 0)
@ -273,15 +347,34 @@ int MAIN(int argc, char **argv)
startdate= ++num;
enddate= ++num;
}
else if (strcmp(*argv,"-purpose") == 0)
pprint= ++num;
else if (strcmp(*argv,"-startdate") == 0)
startdate= ++num;
else if (strcmp(*argv,"-enddate") == 0)
enddate= ++num;
else if (strcmp(*argv,"-noout") == 0)
noout= ++num;
else if (strcmp(*argv,"-trustout") == 0)
trustout= 1;
else if (strcmp(*argv,"-clrtrust") == 0)
clrtrust= ++num;
else if (strcmp(*argv,"-clrreject") == 0)
clrreject= ++num;
else if (strcmp(*argv,"-alias") == 0)
aliasout= ++num;
else if (strcmp(*argv,"-CAcreateserial") == 0)
CA_createserial= ++num;
else if ((md_alg=EVP_get_digestbyname(&((*argv)[1]))) != NULL)
else if (strcmp(*argv,"-clrext") == 0)
clrext = 1;
#if 1 /* stay backwards-compatible with 0.9.5; this should go away soon */
else if (strcmp(*argv,"-crlext") == 0)
{
BIO_printf(bio_err,"use -clrext instead of -crlext\n");
clrext = 1;
}
#endif
else if ((md_alg=EVP_get_digestbyname(*argv + 1)))
{
/* ok */
digest=md_alg;
@ -304,8 +397,15 @@ int MAIN(int argc, char **argv)
goto end;
}
if (need_rand)
app_RAND_load_file(NULL, bio_err, 0);
ERR_load_crypto_strings();
X509V3_add_standard_extensions();
if(!app_passwd(bio_err, passargin, NULL, &passin, NULL)) {
BIO_printf(bio_err, "Error getting password\n");
goto end;
}
if (!X509_STORE_set_default_paths(ctx))
{
@ -335,7 +435,7 @@ int MAIN(int argc, char **argv)
,errorline,extfile);
goto end;
}
if(!(extsect = CONF_get_string(extconf, "default",
if(!extsect && !(extsect = CONF_get_string(extconf, "default",
"extensions"))) extsect = "default";
X509V3_set_ctx_test(&ctx2);
X509V3_set_conf_lhash(&ctx2, extconf);
@ -425,15 +525,9 @@ int MAIN(int argc, char **argv)
X509_gmtime_adj(X509_get_notBefore(x),0);
X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days);
#if 0
X509_PUBKEY_free(ci->key);
ci->key=req->req_info->pubkey;
req->req_info->pubkey=NULL;
#else
pkey = X509_REQ_get_pubkey(req);
X509_set_pubkey(x,pkey);
EVP_PKEY_free(pkey);
#endif
}
else
x=load_cert(infile,informat);
@ -468,6 +562,25 @@ int MAIN(int argc, char **argv)
}
}
if(alias) X509_alias_set1(x, (unsigned char *)alias, -1);
if(clrtrust) X509_trust_clear(x);
if(clrreject) X509_reject_clear(x);
if(trust) {
for(i = 0; i < sk_ASN1_OBJECT_num(trust); i++) {
objtmp = sk_ASN1_OBJECT_value(trust, i);
X509_add1_trust_object(x, objtmp);
}
}
if(reject) {
for(i = 0; i < sk_ASN1_OBJECT_num(reject); i++) {
objtmp = sk_ASN1_OBJECT_value(reject, i);
X509_add1_reject_object(x, objtmp);
}
}
if (num)
{
for (i=1; i<=num; i++)
@ -490,10 +603,28 @@ int MAIN(int argc, char **argv)
i2a_ASN1_INTEGER(STDout,x->cert_info->serialNumber);
BIO_printf(STDout,"\n");
}
else if (aliasout == i)
{
unsigned char *alstr;
alstr = X509_alias_get0(x, NULL);
if(alstr) BIO_printf(STDout,"%s\n", alstr);
else BIO_puts(STDout,"<No Alias>\n");
}
else if (hash == i)
{
BIO_printf(STDout,"%08lx\n",X509_subject_name_hash(x));
}
else if (pprint == i)
{
X509_PURPOSE *ptmp;
int j;
BIO_printf(STDout, "Certificate purposes:\n");
for(j = 0; j < X509_PURPOSE_get_count(); j++)
{
ptmp = X509_PURPOSE_get0(j);
purpose_print(STDout, x, ptmp);
}
}
else
if (modulus == i)
{
@ -521,6 +652,21 @@ int MAIN(int argc, char **argv)
BIO_printf(STDout,"\n");
EVP_PKEY_free(pkey);
}
else
if (pubkey == i)
{
EVP_PKEY *pkey;
pkey=X509_get_pubkey(x);
if (pkey == NULL)
{
BIO_printf(bio_err,"Error getting public key\n");
ERR_print_errors(bio_err);
goto end;
}
PEM_write_bio_PUBKEY(STDout, pkey);
EVP_PKEY_free(pkey);
}
else
if (C == i)
{
@ -598,12 +744,13 @@ int MAIN(int argc, char **argv)
unsigned int n;
unsigned char md[EVP_MAX_MD_SIZE];
if (!X509_digest(x,EVP_md5(),md,&n))
if (!X509_digest(x,digest,md,&n))
{
BIO_printf(bio_err,"out of memory\n");
goto end;
}
BIO_printf(STDout,"MD5 Fingerprint=");
BIO_printf(STDout,"%s Fingerprint=",
OBJ_nid2sn(EVP_MD_type(digest)));
for (j=0; j<(int)n; j++)
{
BIO_printf(STDout,"%02X%c",md[j],
@ -618,7 +765,7 @@ int MAIN(int argc, char **argv)
BIO_printf(bio_err,"Getting Private key\n");
if (Upkey == NULL)
{
Upkey=load_key(keyfile,keyformat);
Upkey=load_key(keyfile,keyformat, passin);
if (Upkey == NULL) goto end;
}
#ifndef NO_DSA
@ -626,7 +773,8 @@ int MAIN(int argc, char **argv)
digest=EVP_dss1();
#endif
if (!sign(x,Upkey,days,digest,
assert(need_rand);
if (!sign(x,Upkey,days,clrext,digest,
extconf, extsect)) goto end;
}
else if (CA_flag == i)
@ -634,7 +782,7 @@ int MAIN(int argc, char **argv)
BIO_printf(bio_err,"Getting CA Private Key\n");
if (CAkeyfile != NULL)
{
CApkey=load_key(CAkeyfile,CAkeyformat);
CApkey=load_key(CAkeyfile,CAkeyformat, passin);
if (CApkey == NULL) goto end;
}
#ifndef NO_DSA
@ -642,8 +790,9 @@ int MAIN(int argc, char **argv)
digest=EVP_dss1();
#endif
assert(need_rand);
if (!x509_certify(ctx,CAfile,digest,x,xca,
CApkey, CAserial,CA_createserial,days,
CApkey, CAserial,CA_createserial,days, clrext,
extconf, extsect))
goto end;
}
@ -659,13 +808,16 @@ int MAIN(int argc, char **argv)
}
else
{
pk=load_key(keyfile,FORMAT_PEM);
pk=load_key(keyfile,FORMAT_PEM, passin);
if (pk == NULL) goto end;
}
BIO_printf(bio_err,"Generating certificate request\n");
rq=X509_to_X509_REQ(x,pk,EVP_md5());
if (pk->type == EVP_PKEY_DSA)
digest=EVP_dss1();
rq=X509_to_X509_REQ(x,pk,digest);
EVP_PKEY_free(pk);
if (rq == NULL)
{
@ -690,9 +842,10 @@ int MAIN(int argc, char **argv)
if (outformat == FORMAT_ASN1)
i=i2d_X509_bio(out,x);
else if (outformat == FORMAT_PEM)
i=PEM_write_bio_X509(out,x);
else if (outformat == FORMAT_NETSCAPE)
else if (outformat == FORMAT_PEM) {
if(trustout) i=PEM_write_bio_X509_AUX(out,x);
else i=PEM_write_bio_X509(out,x);
} else if (outformat == FORMAT_NETSCAPE)
{
ASN1_HEADER ah;
ASN1_OCTET_STRING os;
@ -717,6 +870,8 @@ int MAIN(int argc, char **argv)
}
ret=0;
end:
if (need_rand)
app_RAND_write_file(NULL, bio_err);
OBJ_cleanup();
CONF_free(extconf);
BIO_free(out);
@ -728,13 +883,15 @@ int MAIN(int argc, char **argv)
EVP_PKEY_free(Upkey);
EVP_PKEY_free(CApkey);
X509_REQ_free(rq);
X509V3_EXT_cleanup();
sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free);
sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free);
if(passin) Free(passin);
EXIT(ret);
}
static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
X509 *x, X509 *xca, EVP_PKEY *pkey, char *serialfile, int create,
int days, LHASH *conf, char *section)
int days, int clrext, LHASH *conf, char *section)
{
int ret=0;
BIO *io=NULL;
@ -750,7 +907,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=(char *)Malloc(EVP_PKEY_size(pkey)*2+
buf=Malloc(EVP_PKEY_size(pkey)*2+
((serialfile == NULL)
?(strlen(CAfile)+strlen(POSTFIX)+1)
:(strlen(serialfile)))+1);
@ -792,8 +949,8 @@ static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
}
else
{
ASN1_INTEGER_set(bs,0);
BN_zero(serial);
ASN1_INTEGER_set(bs,1);
BN_one(serial);
}
}
else
@ -855,6 +1012,10 @@ static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
if (X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days) == NULL)
goto end;
if(clrext) {
while(X509_get_ext_count(x) > 0) X509_delete_ext(x, 0);
}
if(conf) {
X509V3_CTX ctx2;
X509_set_version(x,2); /* version 3 certificate */
@ -909,7 +1070,7 @@ static int MS_CALLBACK callb(int ok, X509_STORE_CTX *ctx)
}
}
static EVP_PKEY *load_key(char *file, int format)
static EVP_PKEY *load_key(char *file, int format, char *passin)
{
BIO *key=NULL;
EVP_PKEY *pkey=NULL;
@ -930,25 +1091,13 @@ static EVP_PKEY *load_key(char *file, int format)
perror(file);
goto end;
}
#ifndef NO_RSA
if (format == FORMAT_ASN1)
if (format == FORMAT_ASN1)
{
RSA *rsa;
rsa=d2i_RSAPrivateKey_bio(key,NULL);
if (rsa != NULL)
{
if ((pkey=EVP_PKEY_new()) != NULL)
EVP_PKEY_assign_RSA(pkey,rsa);
else
RSA_free(rsa);
}
pkey=d2i_PrivateKey_bio(key, NULL);
}
else
#endif
if (format == FORMAT_PEM)
else if (format == FORMAT_PEM)
{
pkey=PEM_read_bio_PrivateKey(key,NULL,NULL,NULL);
pkey=PEM_read_bio_PrivateKey(key,NULL,NULL,passin);
}
else
{
@ -1031,7 +1180,7 @@ static X509 *load_cert(char *file, int format)
ah->data=NULL;
}
else if (format == FORMAT_PEM)
x=PEM_read_bio_X509(cert,NULL,NULL,NULL);
x=PEM_read_bio_X509_AUX(cert,NULL,NULL,NULL);
else {
BIO_printf(bio_err,"bad input format specified for input cert\n");
goto end;
@ -1049,7 +1198,7 @@ static X509 *load_cert(char *file, int format)
}
/* self sign */
static int sign(X509 *x, EVP_PKEY *pkey, int days, const EVP_MD *digest,
static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, const EVP_MD *digest,
LHASH *conf, char *section)
{
@ -1071,6 +1220,9 @@ static int sign(X509 *x, EVP_PKEY *pkey, int days, const EVP_MD *digest,
goto err;
if (!X509_set_pubkey(x,pkey)) goto err;
if(clrext) {
while(X509_get_ext_count(x) > 0) X509_delete_ext(x, 0);
}
if(conf) {
X509V3_CTX ctx;
X509_set_version(x,2); /* version 3 certificate */
@ -1084,3 +1236,22 @@ static int sign(X509 *x, EVP_PKEY *pkey, int days, const EVP_MD *digest,
ERR_print_errors(bio_err);
return(0);
}
static int purpose_print(BIO *bio, X509 *cert, X509_PURPOSE *pt)
{
int id, i, idret;
char *pname;
id = X509_PURPOSE_get_id(pt);
pname = X509_PURPOSE_get0_name(pt);
for(i = 0; i < 2; i++) {
idret = X509_check_purpose(cert, id, i);
BIO_printf(bio, "%s%s : ", pname, i ? " CA" : "");
if(idret == 1) BIO_printf(bio, "Yes\n");
else if (idret == 0) BIO_printf(bio, "No\n");
else BIO_printf(bio, "Yes (WARNING code=%d)\n", idret);
}
return 1;
}

View File

@ -39,3 +39,11 @@ SSL_shutdown() and still sharing the socket with its parent).
Netscape, when using export ciphers, will accept a 1024 bit temporary
RSA key. It is supposed to only accept 512.
If Netscape connects to a server which requests a client certificate
it will frequently hang after the user has selected one and never
complete the connection. Hitting "Stop" and reload fixes this and
all subsequent connections work fine. This appears to be because
Netscape wont read any new records in when it is awaiting a server
done message at this point. The fix is to send the certificate request
and server done messages in one record.

View File

@ -1,18 +1,20 @@
issuer= /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test PCA (1024 bit)
subject=/C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit)
-----BEGIN CERTIFICATE-----
MIICJjCCAY8CAQAwDQYJKoZIhvcNAQEEBQAwXDELMAkGA1UEBhMCQVUxEzARBgNV
BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYD
VQQDExNUZXN0IFBDQSAoMTAyNCBiaXQpMB4XDTk3MDYwOTEzNTc0M1oXDTAxMDYw
OTEzNTc0M1owWzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY
BgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRswGQYDVQQDExJUZXN0IENBICgxMDI0
IGJpdCkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKO7o8t116VP6cgybTsZ
DCZhr95nYlZuya3aCi1IKoztqwWnjbmDFIriOqGFPrZQ+moMETC9D59iRW/dFXSv
1F65ka/XY2hLh9exCCo7XuUcDs53Qp3bI3AmMqHjgzE8oO3ajyJAzJkTTOUecQU2
mw/gI4tMM0LqWMQS7luTy4+xAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAM7achv3v
hLQJcv/65eGEpBXM40ZDVoFQFFJWaY5p883HTqLB1x4FdzsXHH0QKBTcKpWwqyu4
YDm3fb8oDugw72bCzfyZK/zVZPR/hVlqI/fvU109Qoc+7oPvIXWky71HfcK6ZBCA
q30KIqGM/uoM60INq97qjDmCJapagcNBGQs=
MIIC5TCCAk6gAwIBAgIBATANBgkqhkiG9w0BAQQFADBcMQswCQYDVQQGEwJBVTET
MBEGA1UECBMKUXVlZW5zbGFuZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQx
HDAaBgNVBAMTE1Rlc3QgUENBICgxMDI0IGJpdCkwHhcNOTkxMjAyMjEzODUxWhcN
MDUwNzEwMjEzODUxWjBbMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFu
ZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxGzAZBgNVBAMTElRlc3QgQ0Eg
KDEwMjQgYml0KTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAo7ujy3XXpU/p
yDJtOxkMJmGv3mdiVm7JrdoKLUgqjO2rBaeNuYMUiuI6oYU+tlD6agwRML0Pn2JF
b90VdK/UXrmRr9djaEuH17EIKjte5RwOzndCndsjcCYyoeODMTyg7dqPIkDMmRNM
5R5xBTabD+Aji0wzQupYxBLuW5PLj7ECAwEAAaOBtzCBtDAdBgNVHQ4EFgQU1WWA
U42mkhi3ecgey1dsJjU61+UwgYQGA1UdIwR9MHuAFE0RaEcrj18q1dw+G6nJbsTW
R213oWCkXjBcMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDEaMBgG
A1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxHDAaBgNVBAMTE1Rlc3QgUENBICgxMDI0
IGJpdCmCAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQBb39BRphHL
6aRAQyymsvBvPSCiG9+kR0R1L23aTpNbhXp2BebyFjbEQYZc2kWGiKKcHkNECA35
3d4LoqUlVey8DFyafOIJd9hxdZfg+rxlHMxnL7uCJRmx9+xB411Jtsol9/wg1uCK
sleGpgB4j8cG2SVCz7V2MNZNK+d5QCnR7A==
-----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQCju6PLddelT+nIMm07GQwmYa/eZ2JWbsmt2gotSCqM7asFp425

View File

@ -1,18 +1,20 @@
issuer= /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test PCA (1024 bit)
subject=/C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test PCA (1024 bit)
-----BEGIN CERTIFICATE-----
MIICJzCCAZACAQAwDQYJKoZIhvcNAQEEBQAwXDELMAkGA1UEBhMCQVUxEzARBgNV
BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYD
VQQDExNUZXN0IFBDQSAoMTAyNCBiaXQpMB4XDTk3MDYwOTEzNTczN1oXDTAxMDYw
OTEzNTczN1owXDELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY
MIIC5jCCAk+gAwIBAgIBADANBgkqhkiG9w0BAQQFADBcMQswCQYDVQQGEwJBVTET
MBEGA1UECBMKUXVlZW5zbGFuZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQx
HDAaBgNVBAMTE1Rlc3QgUENBICgxMDI0IGJpdCkwHhcNOTkxMjAyMjEzNTQ4WhcN
MDUwNzExMjEzNTQ4WjBcMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFu
ZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxHDAaBgNVBAMTE1Rlc3QgUENB
ICgxMDI0IGJpdCkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJ2haT/f5Zwy
V+MiuSDjSR62adBoSiBB7Usty44lXqsp9RICw+DCCxpsn/CfxPEDXLLd4olsWXc6
JRcxGynbYmnzk+Z6aIPPJQhK3CTvaqGnWKZsA1m+WaUIUqJCuNTK4N+7hMAGaf6S
S3e9HVgEQ4a34gXJ7VQFVIBNV1EnZRWHAgMBAAGjgbcwgbQwHQYDVR0OBBYEFE0R
aEcrj18q1dw+G6nJbsTWR213MIGEBgNVHSMEfTB7gBRNEWhHK49fKtXcPhupyW7E
1kdtd6FgpF4wXDELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY
BgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYDVQQDExNUZXN0IFBDQSAoMTAy
NCBiaXQpMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCdoWk/3+WcMlfjIrkg
40ketmnQaEogQe1LLcuOJV6rKfUSAsPgwgsabJ/wn8TxA1yy3eKJbFl3OiUXMRsp
22Jp85PmemiDzyUIStwk72qhp1imbANZvlmlCFKiQrjUyuDfu4TABmn+kkt3vR1Y
BEOGt+IFye1UBVSATVdRJ2UVhwIDAQABMA0GCSqGSIb3DQEBBAUAA4GBABNA1u/S
Cg/LJZWb7GliiKJsvuhxlE4E5JxQF2zMub/CSNbF97//tYSyj96sxeFQxZXbcjm9
xt6mr/xNLA4szNQMJ4P+L7b5e/jC5DSqlwS+CUYJgaFs/SP+qJoCSu1bR3IM9XWO
cRBpDmcBbYLkSyB92WURvsZ1LtjEcn+cdQVI
NCBiaXQpggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAUa8B3pho
+Mvxeq9HsEzJxHIFQla05S5J/e/V+DQTYoKiRFchKPrDAdrzYSEvP3h4QJEtsNqQ
JfOxg5M42uLFq7aPGWkF6ZZqZsYS+zA9IVT14g7gNA6Ne+5QtJqQtH9HA24st0T0
Tga/lZ9M2ovImovaxSL/kRHbpCWcqWVxpOw=
-----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQCdoWk/3+WcMlfjIrkg40ketmnQaEogQe1LLcuOJV6rKfUSAsPg

View File

@ -27,6 +27,7 @@ RELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown"
SYSTEM=`(uname -s) 2>/dev/null` || SYSTEM="unknown"
VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown"
# Now test for ISC and SCO, since it is has a braindamaged uname.
#
# We need to work around FreeBSD 1.1.5.1
@ -50,6 +51,8 @@ if [ "x$XREL" != "x" ]; then
4.2MP)
if [ "x$VERSION" = "x2.1.1" ]; then
echo "${MACHINE}-whatever-unixware211"; exit 0
elif [ "x$VERSION" = "x2.1.2" ]; then
echo "${MACHINE}-whatever-unixware212"; exit 0
else
echo "${MACHINE}-whatever-unixware2"; exit 0
fi
@ -57,6 +60,11 @@ if [ "x$XREL" != "x" ]; then
4.2)
echo "whatever-whatever-unixware1"; exit 0
;;
5)
if [ "`echo x$VERSION | sed -e 's/\..*//'`" = "x7" ]; then
echo "${MACHINE}-sco-unixware7"; exit 0
fi
;;
esac
fi
fi
@ -187,6 +195,10 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
echo "i860-intel-osf1"; exit 0
;;
Rhapsody:*)
echo "ppc-apple-rhapsody"; exit 0
;;
SunOS:5.*)
echo "${MACHINE}-sun-solaris2"; exit 0
;;
@ -280,6 +292,8 @@ TEST="false"
for i
do
case "$i" in
# shared library support (behnke@trustcenter.de)
-shared) SHARED=true;;
-d*) PREFIX="debug-";;
-t*) TEST="true";;
-h*) TEST="true"; cat <<EOF
@ -311,7 +325,7 @@ else
fi
if [ "$SYSTEM" = "SunOS" ]; then
# assume output is "blah-blah C x.x"
# check for WorkShop C, expected output is "cc: blah-blah C x.x"
CCVER=`(cc -V 2>&1) 2>/dev/null | \
egrep -e '^cc: .* C [0-9]\.[0-9]' | \
sed 's/.* C \([0-9]\)\.\([0-9]\).*/\1\2/'`
@ -328,6 +342,19 @@ if [ "$SYSTEM" = "SunOS" ]; then
fi
fi
if [ "${SYSTEM}-${MACHINE}" = "Linux-alpha" ]; then
# check for Compaq C, expected output is "blah-blah C Vx.x"
CCCVER=`(ccc -V 2>&1) 2>/dev/null | \
egrep -e '.* C V[0-9]\.[0-9]' | \
sed 's/.* C V\([0-9]\)\.\([0-9]\).*/\1\2/'`
CCCVER=${CCCVER:-0}
if [ $CCCVER -gt 60 ]; then
CC=ccc # overrides gcc!!! well, ccc outperforms inoticeably
# only on hash routines and des, otherwise gcc (2.95)
# keeps along rather tight...
fi
fi
GCCVER=${GCCVER:-0}
CCVER=${CCVER:-0}
@ -340,9 +367,6 @@ echo Operating system: $GUESSOS
# script above so we end up with values in vars but that would take
# more time that I want to waste at the moment
case "$GUESSOS" in
alpha-*-linux2) OUT="alpha-gcc" ;;
ppc-*-linux2) OUT="linux-ppc" ;;
mips-*-linux?) OUT="linux-mips" ;;
mips2-sgi-irix)
CPU=`(hinv -t cpu) 2>/dev/null | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
CPU=${CPU:-0}
@ -369,6 +393,24 @@ case "$GUESSOS" in
options="$options -mips4"
OUT="irix-mips3-$CC"
;;
alpha-*-linux2)
ISA=`awk '/cpu model/{print$4}' /proc/cpuinfo`
case ${ISA:-generic} in
*[67]) OUT="linux-alpha+bwx-$CC" ;;
*) OUT="linux-alpha-$CC" ;;
esac
if [ "$CC" = "gcc" ]; then
case ${ISA:-generic} in
EV5|EV45) options="$options -mcpu=ev5";;
EV56|PCA56) options="$options -mcpu=ev56";;
EV6|EV67|PCA57) options="$options -mcpu=ev6";;
esac
fi
;;
mips-*-linux?) OUT="linux-mips" ;;
ppc-*-linux2) OUT="linux-ppc" ;;
ia64-*-linux?) OUT="linux-ia64" ;;
ppc-apple-rhapsody) OUT="rhapsody-ppc-cc" ;;
sparc64-*-linux2)
#Before we can uncomment following lines we have to wait at least
#till 64-bit glibc for SPARC is operational:-(
@ -413,17 +455,40 @@ case "$GUESSOS" in
*-*-openbsd) OUT="OpenBSD" ;;
*86*-*-bsdi4) OUT="bsdi-elf-gcc" ;;
*-*-osf) OUT="alpha-cc" ;;
*-*-unixware*) OUT="unixware-2.0" ;;
*-*-unixware7) OUT="unixware-7" ;;
*-*-UnixWare7) OUT="unixware-7" ;;
*-*-Unixware7) OUT="unixware-7" ;;
*-*-unixware[1-2]*) OUT="unixware-2.0" ;;
*-*-UnixWare[1-2]*) OUT="unixware-2.0" ;;
*-*-Unixware[1-2]*) OUT="unixware-2.0" ;;
BS2000-siemens-sysv4) OUT="BS2000-OSD" ;;
RM*-siemens-sysv4) OUT="ReliantUNIX" ;;
*-siemens-sysv4) OUT="SINIX" ;;
*-hpux1*) OUT="hpux-parisc-$CC"
options="$options -D_REENTRANT" ;;
*-hpux) OUT="hpux-parisc-$CC" ;;
# these are all covered by the catchall below
# *-hpux*) OUT="hpux-$CC" ;;
# *-aix) OUT="aix-$CC" ;;
# *-dgux) OUT="dgux" ;;
*) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
esac
# See whether we can compile Atalla support
if [ -f /usr/include/atasi.h ]
then
options="$options -DATALLA"
fi
#get some basic shared lib support (behnke@trustcenter.de)
case "$OUT" in
solaris-*-gcc)
if [ "$SHARED" = "true" ]
then
options="$options -DPIC -fPIC"
fi
;;
esac
# gcc < 2.8 does not support -mcpu=ultrasparc
if [ "$OUT" = solaris-sparcv9-gcc -a $GCCVER -lt 28 ]
then
@ -438,6 +503,17 @@ then
sleep 5
OUT=linux-sparcv8
fi
# To start with $OUT is never i86pc-sun-solaris2. Secondly why
# ban *all* assembler implementation if it can't stand only one,
# SHA-0 implementation.
#if [ "$OUT" = "i86pc-sun-solaris2" ]
#then
# ASM=`as -V /dev/null 2>&1`
# case "$ASM" in
# GNU*) ;;
# *) options="$options no-asm" ; echo "WARNING: You need the GNU assembler to use OpenSSL assembler code." ; echo "Sun as is not supported on Solaris x86." ;;
# esac
#fi
case "$GUESSOS" in
i386-*) options="$options 386" ;;
@ -484,14 +560,14 @@ fi
# compiler for the platform ... in which case we add it on
# the end ... otherwise we leave it off
$PERL ./Configure 2>&1 | grep "$OUT-$CC" > /dev/null
$PERL ./Configure LIST | grep "$OUT-$CC" > /dev/null
if [ $? = "0" ]; then
OUT="$OUT-$CC"
fi
OUT="$PREFIX$OUT"
$PERL ./Configure 2>&1 | grep "$OUT" > /dev/null
$PERL ./Configure LIST | grep "$OUT" > /dev/null
if [ $? = "0" ]; then
echo Configuring for $OUT

View File

@ -0,0 +1,195 @@
#
# SSLeay/crypto/Makefile
#
DIR= crypto
TOP= ..
CC= cc
INCLUDE= -I. -I../include
INCLUDES= -I.. -I../../include
CFLAG= -g
INSTALL_PREFIX=
OPENSSLDIR= /usr/local/ssl
INSTALLTOP= /usr/local/ssl
MAKE= make -f Makefile.ssl
MAKEDEPEND= $(TOP)/util/domd $(TOP)
MAKEFILE= Makefile.ssl
RM= rm -f
AR= ar r
PEX_LIBS=
EX_LIBS=
CFLAGS= $(INCLUDE) $(CFLAG)
LIBS=
SDIRS= md2 md5 sha mdc2 hmac ripemd \
des rc2 rc4 rc5 idea bf cast \
bn rsa dsa dh \
buffer bio stack lhash rand err objects \
evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp
GENERAL=Makefile README crypto-lib.com install.com
LIB= $(TOP)/libcrypto.a
LIBSRC= cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c
LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o
SRC= $(LIBSRC)
EXHEADER= crypto.h tmdiff.h opensslv.h opensslconf.h ebcdic.h
HEADER= cryptlib.h buildinf.h $(EXHEADER)
ALL= $(GENERAL) $(SRC) $(HEADER)
top:
@(cd ..; $(MAKE) DIRS=$(DIR) all)
all: buildinf.h lib subdirs
buildinf.h: ../Makefile.ssl
( echo "#ifndef MK1MF_BUILD"; \
echo " /* auto-generated by crypto/Makefile.ssl for crypto/cversion.c */"; \
echo " #define CFLAGS \"$(CC) $(CFLAG)\""; \
echo " #define PLATFORM \"$(PLATFORM)\""; \
echo " #define DATE \"`date`\""; \
echo "#endif" ) >buildinf.h
testapps:
if echo ${SDIRS} | fgrep ' des '; \
then cd des && $(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' des; fi
cd pkcs7 && $(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' testapps
subdirs:
@for i in $(SDIRS) ;\
do \
(cd $$i && echo "making all in crypto/$$i..." && \
$(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' all ) || exit 1; \
done;
files:
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
@for i in $(SDIRS) ;\
do \
(cd $$i; echo "making 'files' in crypto/$$i..."; \
$(MAKE) PERL='${PERL}' files ); \
done;
links:
@$(TOP)/util/point.sh Makefile.ssl Makefile
@$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER)
@$(PERL) $(TOP)/util/mklink.pl ../test $(TEST)
@$(PERL) $(TOP)/util/mklink.pl ../apps $(APPS)
@$(TOP)/util/point.sh Makefile.ssl Makefile
@for i in $(SDIRS); do \
(cd $$i; echo "making links in crypto/$$i..."; \
$(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PERL='${PERL}' links ); \
done;
lib: $(LIBOBJ)
$(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB)
@touch lib
libs:
@for i in $(SDIRS) ;\
do \
(cd $$i; echo "making libs in crypto/$$i..."; \
$(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' AR='${AR}' lib ); \
done;
tests:
@for i in $(SDIRS) ;\
do \
(cd $$i; echo "making tests in crypto/$$i..."; \
$(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' AR='${AR}' tests ); \
done;
install:
@for i in $(EXHEADER) ;\
do \
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
done;
@for i in $(SDIRS) ;\
do \
(cd $$i; echo "making install in crypto/$$i..."; \
$(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' install ); \
done;
lint:
@for i in $(SDIRS) ;\
do \
(cd $$i; echo "making lint in crypto/$$i..."; \
$(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' lint ); \
done;
depend:
if [ ! -f buildinf.h ]; then touch buildinf.h; fi # fake buildinf.h if it does not exist
$(MAKEDEPEND) $(INCLUDE) $(DEPFLAG) $(PROGS) $(LIBSRC)
if [ ! -s buildinf.h ]; then rm buildinf.h; fi
@for i in $(SDIRS) ;\
do \
(cd $$i; echo "making depend in crypto/$$i..."; \
$(MAKE) MAKEFILE='${MAKEFILE}' INCLUDES='${INCLUDES}' DEPFLAG='${DEPFLAG}' depend ); \
done;
clean:
rm -f buildinf.h *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
@for i in $(SDIRS) ;\
do \
(cd $$i; echo "making clean in crypto/$$i..."; \
$(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' clean ); \
done;
dclean:
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
mv -f Makefile.new $(MAKEFILE)
@for i in $(SDIRS) ;\
do \
(cd $$i; echo "making dclean in crypto/$$i..."; \
$(MAKE) PERL='${PERL}' CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' dclean ); \
done;
# DO NOT DELETE THIS LINE -- make depend depends on it.
cpt_err.o: ../include/openssl/crypto.h ../include/openssl/err.h
cpt_err.o: ../include/openssl/opensslv.h ../include/openssl/safestack.h
cpt_err.o: ../include/openssl/stack.h
cryptlib.o: ../include/openssl/bio.h ../include/openssl/buffer.h
cryptlib.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
cryptlib.o: ../include/openssl/e_os2.h ../include/openssl/err.h
cryptlib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
cryptlib.o: ../include/openssl/safestack.h ../include/openssl/stack.h
cryptlib.o: cryptlib.h
cversion.o: ../include/openssl/bio.h ../include/openssl/buffer.h
cversion.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
cversion.o: ../include/openssl/e_os2.h ../include/openssl/err.h
cversion.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
cversion.o: ../include/openssl/safestack.h ../include/openssl/stack.h
cversion.o: buildinf.h cryptlib.h
ex_data.o: ../include/openssl/bio.h ../include/openssl/buffer.h
ex_data.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
ex_data.o: ../include/openssl/e_os2.h ../include/openssl/err.h
ex_data.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
ex_data.o: ../include/openssl/opensslv.h ../include/openssl/safestack.h
ex_data.o: ../include/openssl/stack.h cryptlib.h
mem.o: ../include/openssl/bio.h ../include/openssl/buffer.h
mem.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
mem.o: ../include/openssl/e_os2.h ../include/openssl/err.h
mem.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
mem.o: ../include/openssl/safestack.h ../include/openssl/stack.h cryptlib.h
mem_dbg.o: ../include/openssl/bio.h ../include/openssl/buffer.h
mem_dbg.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
mem_dbg.o: ../include/openssl/e_os2.h ../include/openssl/err.h
mem_dbg.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
mem_dbg.o: ../include/openssl/opensslv.h ../include/openssl/safestack.h
mem_dbg.o: ../include/openssl/stack.h cryptlib.h
tmdiff.o: ../include/openssl/bio.h ../include/openssl/buffer.h
tmdiff.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
tmdiff.o: ../include/openssl/e_os2.h ../include/openssl/err.h
tmdiff.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
tmdiff.o: ../include/openssl/safestack.h ../include/openssl/stack.h
tmdiff.o: ../include/openssl/tmdiff.h cryptlib.h

View File

@ -34,13 +34,13 @@ SDIRS= md2 md5 sha mdc2 hmac ripemd \
GENERAL=Makefile README crypto-lib.com install.com
LIB= $(TOP)/libcrypto.a
LIBSRC= cryptlib.c mem.c cversion.c ex_data.c tmdiff.c cpt_err.c
LIBOBJ= cryptlib.o mem.o cversion.o ex_data.o tmdiff.o cpt_err.o
LIBSRC= cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c
LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o
SRC= $(LIBSRC)
EXHEADER= crypto.h tmdiff.h opensslv.h opensslconf.h ebcdic.h
HEADER= cryptlib.h buildinf.h $(EXHEADER)
HEADER= cryptlib.h buildinf.h md32_common.h $(EXHEADER)
ALL= $(GENERAL) $(SRC) $(HEADER)
@ -57,6 +57,11 @@ buildinf.h: ../Makefile.ssl
echo " #define DATE \"`date`\""; \
echo "#endif" ) >buildinf.h
testapps:
if echo ${SDIRS} | fgrep ' des '; \
then cd des && $(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' des; fi
cd pkcs7 && $(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' testapps
subdirs:
@for i in $(SDIRS) ;\
do \
@ -122,7 +127,7 @@ lint:
done;
depend:
if [ ! -e buildinf.h ]; then touch buildinf.h; fi # fake buildinf.h if it does not exist
if [ ! -f buildinf.h ]; then touch buildinf.h; fi # fake buildinf.h if it does not exist
$(MAKEDEPEND) $(INCLUDE) $(DEPFLAG) $(PROGS) $(LIBSRC)
if [ ! -s buildinf.h ]; then rm buildinf.h; fi
@for i in $(SDIRS) ;\
@ -151,29 +156,40 @@ dclean:
# DO NOT DELETE THIS LINE -- make depend depends on it.
cpt_err.o: ../include/openssl/crypto.h ../include/openssl/err.h
cpt_err.o: ../include/openssl/opensslv.h ../include/openssl/stack.h
cpt_err.o: ../include/openssl/opensslv.h ../include/openssl/safestack.h
cpt_err.o: ../include/openssl/stack.h
cryptlib.o: ../include/openssl/bio.h ../include/openssl/buffer.h
cryptlib.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
cryptlib.o: ../include/openssl/e_os2.h ../include/openssl/err.h
cryptlib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
cryptlib.o: ../include/openssl/stack.h cryptlib.h
cryptlib.o: ../include/openssl/safestack.h ../include/openssl/stack.h
cryptlib.o: cryptlib.h
cversion.o: ../include/openssl/bio.h ../include/openssl/buffer.h
cversion.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
cversion.o: ../include/openssl/e_os2.h ../include/openssl/err.h
cversion.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
cversion.o: ../include/openssl/stack.h buildinf.h cryptlib.h
cversion.o: ../include/openssl/safestack.h ../include/openssl/stack.h
cversion.o: buildinf.h cryptlib.h
ex_data.o: ../include/openssl/bio.h ../include/openssl/buffer.h
ex_data.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
ex_data.o: ../include/openssl/e_os2.h ../include/openssl/err.h
ex_data.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
ex_data.o: ../include/openssl/opensslv.h ../include/openssl/stack.h cryptlib.h
ex_data.o: ../include/openssl/opensslv.h ../include/openssl/safestack.h
ex_data.o: ../include/openssl/stack.h cryptlib.h
mem.o: ../include/openssl/bio.h ../include/openssl/buffer.h
mem.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
mem.o: ../include/openssl/e_os2.h ../include/openssl/err.h
mem.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
mem.o: ../include/openssl/opensslv.h ../include/openssl/stack.h cryptlib.h
mem.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
mem.o: ../include/openssl/safestack.h ../include/openssl/stack.h cryptlib.h
mem_dbg.o: ../include/openssl/bio.h ../include/openssl/buffer.h
mem_dbg.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
mem_dbg.o: ../include/openssl/e_os2.h ../include/openssl/err.h
mem_dbg.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
mem_dbg.o: ../include/openssl/opensslv.h ../include/openssl/safestack.h
mem_dbg.o: ../include/openssl/stack.h cryptlib.h
tmdiff.o: ../include/openssl/bio.h ../include/openssl/buffer.h
tmdiff.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
tmdiff.o: ../include/openssl/e_os2.h ../include/openssl/err.h
tmdiff.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
tmdiff.o: ../include/openssl/stack.h ../include/openssl/tmdiff.h cryptlib.h
tmdiff.o: ../include/openssl/safestack.h ../include/openssl/stack.h
tmdiff.o: ../include/openssl/tmdiff.h cryptlib.h

File diff suppressed because it is too large Load Diff

View File

@ -23,34 +23,34 @@ APPS=
LIB=$(TOP)/libcrypto.a
LIBSRC= a_object.c a_bitstr.c a_utctm.c a_gentm.c a_time.c a_int.c a_octet.c \
a_print.c a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c a_bmp.c \
a_enum.c a_vis.c a_utf8.c a_sign.c a_digest.c a_verify.c \
a_null.c a_print.c a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c a_bmp.c \
a_enum.c a_vis.c a_utf8.c a_sign.c a_digest.c a_verify.c a_mbstr.c \
x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c \
x_name.c x_cinf.c x_x509.c x_crl.c x_info.c x_spki.c nsseq.c \
x_name.c x_cinf.c x_x509.c x_x509a.c x_crl.c x_info.c x_spki.c nsseq.c \
d2i_r_pr.c i2d_r_pr.c d2i_r_pu.c i2d_r_pu.c \
d2i_s_pr.c i2d_s_pr.c d2i_s_pu.c i2d_s_pu.c \
d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c\
t_req.c t_x509.c t_crl.c t_pkey.c \
t_req.c t_x509.c t_x509a.c t_crl.c t_pkey.c t_spki.c t_bitst.c \
p7_i_s.c p7_signi.c p7_signd.c p7_recip.c p7_enc_c.c p7_evp.c \
p7_dgst.c p7_s_e.c p7_enc.c p7_lib.c \
f_int.c f_string.c i2d_dhp.c i2d_dsap.c d2i_dhp.c d2i_dsap.c n_pkey.c \
f_enum.c a_hdr.c x_pkey.c a_bool.c x_exten.c \
asn1_par.c asn1_lib.c asn1_err.c a_meth.c a_bytes.c \
asn1_par.c asn1_lib.c asn1_err.c a_meth.c a_bytes.c a_strnid.c \
evp_asn1.c asn_pack.c p5_pbe.c p5_pbev2.c p8_pkey.c
LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_gentm.o a_time.o a_int.o a_octet.o \
a_print.o a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o a_bmp.o \
a_enum.o a_vis.o a_utf8.o a_sign.o a_digest.o a_verify.o \
a_null.o a_print.o a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o a_bmp.o \
a_enum.o a_vis.o a_utf8.o a_sign.o a_digest.o a_verify.o a_mbstr.o \
x_algor.o x_val.o x_pubkey.o x_sig.o x_req.o x_attrib.o \
x_name.o x_cinf.o x_x509.o x_crl.o x_info.o x_spki.o nsseq.o \
x_name.o x_cinf.o x_x509.o x_x509a.o x_crl.o x_info.o x_spki.o nsseq.o \
d2i_r_pr.o i2d_r_pr.o d2i_r_pu.o i2d_r_pu.o \
d2i_s_pr.o i2d_s_pr.o d2i_s_pu.o i2d_s_pu.o \
d2i_pu.o d2i_pr.o i2d_pu.o i2d_pr.o \
t_req.o t_x509.o t_crl.o t_pkey.o \
t_req.o t_x509.o t_x509a.o t_crl.o t_pkey.o t_spki.o t_bitst.o \
p7_i_s.o p7_signi.o p7_signd.o p7_recip.o p7_enc_c.o p7_evp.o \
p7_dgst.o p7_s_e.o p7_enc.o p7_lib.o \
f_int.o f_string.o i2d_dhp.o i2d_dsap.o d2i_dhp.o d2i_dsap.o n_pkey.o \
f_enum.o a_hdr.o x_pkey.o a_bool.o x_exten.o \
asn1_par.o asn1_lib.o asn1_err.o a_meth.o a_bytes.o \
asn1_par.o asn1_lib.o asn1_err.o a_meth.o a_bytes.o a_strnid.o \
evp_asn1.o asn_pack.o p5_pbe.o p5_pbev2.o p8_pkey.o
SRC= $(LIBSRC)
@ -160,11 +160,13 @@ a_digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h
a_digest.o: ../../include/openssl/idea.h ../../include/openssl/md2.h
a_digest.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
a_digest.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
a_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h
a_digest.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
a_digest.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
a_digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
a_digest.o: ../../include/openssl/stack.h ../cryptlib.h
a_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
a_digest.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
a_digest.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
a_digest.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
a_digest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
a_digest.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
a_digest.o: ../cryptlib.h
a_dup.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
a_dup.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
a_dup.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
@ -207,6 +209,13 @@ a_int.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
a_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
a_int.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
a_int.o: ../cryptlib.h
a_mbstr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
a_mbstr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
a_mbstr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
a_mbstr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
a_mbstr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
a_mbstr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
a_mbstr.o: ../cryptlib.h
a_meth.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
a_meth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
a_meth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
@ -214,6 +223,13 @@ a_meth.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
a_meth.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
a_meth.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
a_meth.o: ../cryptlib.h
a_null.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
a_null.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
a_null.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
a_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
a_null.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
a_null.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
a_null.o: ../cryptlib.h
a_object.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
a_object.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
a_object.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
@ -259,6 +275,13 @@ a_sign.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
a_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
a_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
a_sign.o: ../cryptlib.h
a_strnid.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
a_strnid.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
a_strnid.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
a_strnid.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
a_strnid.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
a_strnid.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
a_strnid.o: ../../include/openssl/stack.h ../cryptlib.h
a_time.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
a_time.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
a_time.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
@ -788,6 +811,24 @@ p8_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
p8_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
p8_pkey.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
p8_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
t_bitst.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
t_bitst.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
t_bitst.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
t_bitst.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
t_bitst.o: ../../include/openssl/des.h ../../include/openssl/dh.h
t_bitst.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
t_bitst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
t_bitst.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
t_bitst.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
t_bitst.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
t_bitst.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
t_bitst.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
t_bitst.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
t_bitst.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
t_bitst.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
t_bitst.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
t_bitst.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
t_bitst.o: ../../include/openssl/x509v3.h ../cryptlib.h
t_crl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
t_crl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
t_crl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
@ -812,15 +853,17 @@ t_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
t_pkey.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
t_pkey.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
t_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/rsa.h
t_pkey.o: ../../include/openssl/stack.h ../cryptlib.h
t_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
t_pkey.o: ../cryptlib.h
t_req.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
t_req.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
t_req.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
t_req.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
t_req.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
t_req.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
t_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
t_req.o: ../../include/openssl/idea.h ../../include/openssl/md2.h
t_req.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
t_req.o: ../../include/openssl/des.h ../../include/openssl/dh.h
t_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
t_req.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
t_req.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
t_req.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
t_req.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
t_req.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
t_req.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
@ -829,7 +872,24 @@ t_req.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
t_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
t_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
t_req.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
t_req.o: ../cryptlib.h
t_req.o: ../../include/openssl/x509v3.h ../cryptlib.h
t_spki.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
t_spki.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
t_spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
t_spki.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
t_spki.o: ../../include/openssl/des.h ../../include/openssl/dh.h
t_spki.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
t_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
t_spki.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
t_spki.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
t_spki.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
t_spki.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
t_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
t_spki.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
t_spki.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
t_spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
t_spki.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
t_spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
t_x509.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
t_x509.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
t_x509.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
@ -848,6 +908,23 @@ t_x509.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
t_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
t_x509.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
t_x509.o: ../../include/openssl/x509v3.h ../cryptlib.h
t_x509a.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
t_x509a.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
t_x509a.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
t_x509a.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
t_x509a.o: ../../include/openssl/des.h ../../include/openssl/dh.h
t_x509a.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
t_x509a.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
t_x509a.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
t_x509a.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
t_x509a.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
t_x509a.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
t_x509a.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
t_x509a.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
t_x509a.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
t_x509a.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
t_x509a.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
t_x509a.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
x_algor.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
x_algor.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
x_algor.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
@ -1088,3 +1165,20 @@ x_x509.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
x_x509.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
x_x509.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
x_x509.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
x_x509a.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
x_x509a.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
x_x509a.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
x_x509a.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
x_x509a.o: ../../include/openssl/des.h ../../include/openssl/dh.h
x_x509a.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
x_x509a.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
x_x509a.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
x_x509a.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
x_x509a.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
x_x509a.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
x_x509a.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
x_x509a.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
x_x509a.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
x_x509a.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
x_x509a.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
x_x509a.o: ../../include/openssl/x509_vfy.h ../cryptlib.h

View File

@ -60,6 +60,15 @@
#include "cryptlib.h"
#include <openssl/asn1.h>
ASN1_BIT_STRING *ASN1_BIT_STRING_new(void)
{ return M_ASN1_BIT_STRING_new(); }
void ASN1_BIT_STRING_free(ASN1_BIT_STRING *x)
{ M_ASN1_BIT_STRING_free(x); }
int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len)
{ return M_ASN1_BIT_STRING_set(x, d, len); }
int i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
{
int ret,j,r,bits,len;
@ -121,7 +130,7 @@ ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp,
if ((a == NULL) || ((*a) == NULL))
{
if ((ret=ASN1_BIT_STRING_new()) == NULL) return(NULL);
if ((ret=M_ASN1_BIT_STRING_new()) == NULL) return(NULL);
}
else
ret=(*a);
@ -164,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((char *)ret->data);
if (ret->data != NULL) Free(ret->data);
ret->data=s;
ret->type=V_ASN1_BIT_STRING;
if (a != NULL) (*a)=ret;
@ -173,7 +182,7 @@ ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp,
err:
ASN1err(ASN1_F_D2I_ASN1_BIT_STRING,i);
if ((ret != NULL) && ((a == NULL) || (*a != ret)))
ASN1_BIT_STRING_free(ret);
M_ASN1_BIT_STRING_free(ret);
return(NULL);
}

View File

@ -60,6 +60,12 @@
#include "cryptlib.h"
#include <openssl/asn1.h>
ASN1_BMPSTRING *ASN1_BMPSTRING_new(void)
{ return M_ASN1_BMPSTRING_new(); }
void ASN1_BMPSTRING_free(ASN1_BMPSTRING *x)
{ M_ASN1_BMPSTRING_free(x); }
int i2d_ASN1_BMPSTRING(ASN1_BMPSTRING *a, unsigned char **pp)
{
return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,

View File

@ -71,7 +71,7 @@ B_ASN1_T61STRING,B_ASN1_VIDEOTEXSTRING,B_ASN1_IA5STRING,0,
B_ASN1_UNIVERSALSTRING,B_ASN1_UNKNOWN,B_ASN1_BMPSTRING,B_ASN1_UNKNOWN,
};
static int asn1_collate_primative(ASN1_STRING *a, ASN1_CTX *c);
static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c);
/* type is a 'bitmap' of acceptable string types.
*/
ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, unsigned char **pp,
@ -124,7 +124,7 @@ ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, unsigned char **pp,
else
s=NULL;
if (ret->data != NULL) Free((char *)ret->data);
if (ret->data != NULL) Free(ret->data);
ret->length=(int)len;
ret->data=s;
ret->type=tag;
@ -205,7 +205,7 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, long length,
c.tag=Ptag;
c.xclass=Pclass;
c.max=(length == 0)?0:(p+length);
if (!asn1_collate_primative(ret,&c))
if (!asn1_collate_primitive(ret,&c))
goto err;
else
{
@ -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((char *)ret->data);
s=(unsigned char *)Malloc((int)len);
if (ret->data != NULL) Free(ret->data);
s=(unsigned char *)Malloc((int)len + 1);
if (s == NULL)
{
i=ERR_R_MALLOC_FAILURE;
@ -229,12 +229,13 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, long length,
else
s=ret->data;
memcpy(s,p,(int)len);
s[len] = '\0';
p+=len;
}
else
{
s=NULL;
if (ret->data != NULL) Free((char *)ret->data);
if (ret->data != NULL) Free(ret->data);
}
ret->length=(int)len;
@ -253,11 +254,11 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, long length,
}
/* We are about to parse 0..n d2i_ASN1_bytes objects, we are to collapes
* them into the one struture that is then returned */
/* We are about to parse 0..n d2i_ASN1_bytes objects, we are to collapse
* them into the one structure that is then returned */
/* There have been a few bug fixes for this function from
* Paul Keogh <paul.keogh@sse.ie>, many thanks to him */
static int asn1_collate_primative(ASN1_STRING *a, ASN1_CTX *c)
static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c)
{
ASN1_STRING *os=NULL;
BUF_MEM b;

View File

@ -58,16 +58,19 @@
#include <stdio.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "cryptlib.h"
#ifndef NO_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <openssl/evp.h>
#include <openssl/buffer.h>
#include <openssl/x509.h>
int ASN1_digest(int (*i2d)(), EVP_MD *type, char *data, unsigned char *md,
unsigned int *len)
int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data,
unsigned char *md, unsigned int *len)
{
EVP_MD_CTX ctx;
int i;

View File

@ -78,6 +78,6 @@ char *ASN1_dup(int (*i2d)(), char *(*d2i)(), char *x)
i=i2d(x,&p);
p= b;
ret=d2i(NULL,&p,i);
Free((char *)b);
Free(b);
return(ret);
}

View File

@ -65,6 +65,12 @@
* for comments on encoding see a_int.c
*/
ASN1_ENUMERATED *ASN1_ENUMERATED_new(void)
{ return M_ASN1_ENUMERATED_new(); }
void ASN1_ENUMERATED_free(ASN1_ENUMERATED *x)
{ M_ASN1_ENUMERATED_free(x); }
int i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **pp)
{
int pad=0,ret,r,i,t;
@ -142,7 +148,7 @@ ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, unsigned char **pp,
if ((a == NULL) || ((*a) == NULL))
{
if ((ret=ASN1_ENUMERATED_new()) == NULL) return(NULL);
if ((ret=M_ASN1_ENUMERATED_new()) == NULL) return(NULL);
ret->type=V_ASN1_ENUMERATED;
}
else
@ -171,7 +177,12 @@ ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, unsigned char **pp,
goto err;
}
to=s;
if (*p & 0x80) /* a negative number */
if(!len) {
/* Strictly speaking this is an illegal ENUMERATED but we
* tolerate it.
*/
ret->type=V_ASN1_ENUMERATED;
} else if (*p & 0x80) /* a negative number */
{
ret->type=V_ASN1_NEG_ENUMERATED;
if ((*p == 0xff) && (len != 1)) {
@ -208,7 +219,7 @@ ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, unsigned char **pp,
p+=len;
}
if (ret->data != NULL) Free((char *)ret->data);
if (ret->data != NULL) Free(ret->data);
ret->data=s;
ret->length=(int)len;
if (a != NULL) (*a)=ret;
@ -217,7 +228,7 @@ ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, unsigned char **pp,
err:
ASN1err(ASN1_F_D2I_ASN1_ENUMERATED,i);
if ((ret != NULL) && ((a == NULL) || (*a != ret)))
ASN1_ENUMERATED_free(ret);
M_ASN1_ENUMERATED_free(ret);
return(NULL);
}
@ -231,7 +242,7 @@ int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v)
if (a->length < (sizeof(long)+1))
{
if (a->data != NULL)
Free((char *)a->data);
Free(a->data);
if ((a->data=(unsigned char *)Malloc(sizeof(long)+1)) != NULL)
memset((char *)a->data,0,sizeof(long)+1);
}
@ -295,7 +306,7 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai)
int len,j;
if (ai == NULL)
ret=ASN1_ENUMERATED_new();
ret=M_ASN1_ENUMERATED_new();
else
ret=ai;
if (ret == NULL)
@ -311,7 +322,7 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai)
ret->length=BN_bn2bin(bn,ret->data);
return(ret);
err:
if (ret != ai) ASN1_ENUMERATED_free(ret);
if (ret != ai) M_ASN1_ENUMERATED_free(ret);
return(NULL);
}

View File

@ -63,6 +63,12 @@
#include "cryptlib.h"
#include <openssl/asn1.h>
ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_new(void)
{ return M_ASN1_GENERALIZEDTIME_new(); }
void ASN1_GENERALIZEDTIME_free(ASN1_GENERALIZEDTIME *x)
{ M_ASN1_GENERALIZEDTIME_free(x); }
int i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a, unsigned char **pp)
{
#ifdef CHARSET_EBCDIC
@ -106,7 +112,7 @@ ASN1_GENERALIZEDTIME *d2i_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME **a,
return(ret);
err:
if ((ret != NULL) && ((a == NULL) || (*a != ret)))
ASN1_GENERALIZEDTIME_free(ret);
M_ASN1_GENERALIZEDTIME_free(ret);
return(NULL);
}
@ -193,7 +199,7 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
#endif
if (s == NULL)
s=ASN1_GENERALIZEDTIME_new();
s=M_ASN1_GENERALIZEDTIME_new();
if (s == NULL)
return(NULL);

View File

@ -102,7 +102,7 @@ ASN1_HEADER *ASN1_HEADER_new(void)
ASN1_CTX c;
M_ASN1_New_Malloc(ret,ASN1_HEADER);
M_ASN1_New(ret->header,ASN1_OCTET_STRING_new);
M_ASN1_New(ret->header,M_ASN1_OCTET_STRING_new);
ret->meth=NULL;
ret->data=NULL;
return(ret);
@ -112,8 +112,8 @@ ASN1_HEADER *ASN1_HEADER_new(void)
void ASN1_HEADER_free(ASN1_HEADER *a)
{
if (a == NULL) return;
ASN1_OCTET_STRING_free(a->header);
M_ASN1_OCTET_STRING_free(a->header);
if (a->meth != NULL)
a->meth->destroy(a->data);
Free((char *)a);
Free(a);
}

View File

@ -108,6 +108,6 @@ int ASN1_i2d_bio(int (*i2d)(), BIO *out, unsigned char *x)
j+=i;
n-=i;
}
Free((char *)b);
Free(b);
return(ret);
}

View File

@ -60,6 +60,18 @@
#include "cryptlib.h"
#include <openssl/asn1.h>
ASN1_INTEGER *ASN1_INTEGER_new(void)
{ return M_ASN1_INTEGER_new();}
void ASN1_INTEGER_free(ASN1_INTEGER *x)
{ M_ASN1_INTEGER_free(x);}
ASN1_INTEGER *ASN1_INTEGER_dup(ASN1_INTEGER *x)
{ return M_ASN1_INTEGER_dup(x);}
int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y)
{ return M_ASN1_INTEGER_cmp(x,y);}
/*
* This converts an ASN1 INTEGER into its DER encoding.
* The internal representation is an ASN1_STRING whose data is a big endian
@ -160,7 +172,7 @@ ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, unsigned char **pp,
if ((a == NULL) || ((*a) == NULL))
{
if ((ret=ASN1_INTEGER_new()) == NULL) return(NULL);
if ((ret=M_ASN1_INTEGER_new()) == NULL) return(NULL);
ret->type=V_ASN1_INTEGER;
}
else
@ -190,7 +202,12 @@ ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, unsigned char **pp,
goto err;
}
to=s;
if (*p & 0x80) /* a negative number */
if(!len) {
/* Strictly speaking this is an illegal INTEGER but we
* tolerate it.
*/
ret->type=V_ASN1_INTEGER;
} else if (*p & 0x80) /* a negative number */
{
ret->type=V_ASN1_NEG_INTEGER;
if ((*p == 0xff) && (len != 1)) {
@ -231,7 +248,7 @@ ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, unsigned char **pp,
memcpy(s,p,(int)len);
}
if (ret->data != NULL) Free((char *)ret->data);
if (ret->data != NULL) Free(ret->data);
ret->data=s;
ret->length=(int)len;
if (a != NULL) (*a)=ret;
@ -240,7 +257,7 @@ ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, unsigned char **pp,
err:
ASN1err(ASN1_F_D2I_ASN1_INTEGER,i);
if ((ret != NULL) && ((a == NULL) || (*a != ret)))
ASN1_INTEGER_free(ret);
M_ASN1_INTEGER_free(ret);
return(NULL);
}
@ -260,7 +277,7 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, unsigned char **pp,
if ((a == NULL) || ((*a) == NULL))
{
if ((ret=ASN1_INTEGER_new()) == NULL) return(NULL);
if ((ret=M_ASN1_INTEGER_new()) == NULL) return(NULL);
ret->type=V_ASN1_INTEGER;
}
else
@ -289,7 +306,8 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, unsigned char **pp,
goto err;
}
to=s;
ret->type=V_ASN1_INTEGER;
ret->type=V_ASN1_INTEGER;
if(len) {
if ((*p == 0) && (len != 1))
{
p++;
@ -297,8 +315,9 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, unsigned char **pp,
}
memcpy(s,p,(int)len);
p+=len;
}
if (ret->data != NULL) Free((char *)ret->data);
if (ret->data != NULL) Free(ret->data);
ret->data=s;
ret->length=(int)len;
if (a != NULL) (*a)=ret;
@ -307,7 +326,7 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, unsigned char **pp,
err:
ASN1err(ASN1_F_D2I_ASN1_UINTEGER,i);
if ((ret != NULL) && ((a == NULL) || (*a != ret)))
ASN1_INTEGER_free(ret);
M_ASN1_INTEGER_free(ret);
return(NULL);
}
@ -321,7 +340,7 @@ int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
if (a->length < (sizeof(long)+1))
{
if (a->data != NULL)
Free((char *)a->data);
Free(a->data);
if ((a->data=(unsigned char *)Malloc(sizeof(long)+1)) != NULL)
memset((char *)a->data,0,sizeof(long)+1);
}
@ -385,7 +404,7 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai)
int len,j;
if (ai == NULL)
ret=ASN1_INTEGER_new();
ret=M_ASN1_INTEGER_new();
else
ret=ai;
if (ret == NULL)
@ -401,7 +420,7 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai)
ret->length=BN_bn2bin(bn,ret->data);
return(ret);
err:
if (ret != ai) ASN1_INTEGER_free(ret);
if (ret != ai) M_ASN1_INTEGER_free(ret);
return(NULL);
}

View File

@ -0,0 +1,390 @@
/* a_mbstr.c */
/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
* project 1999.
*/
/* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* licensing@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#include <stdio.h>
#include <ctype.h>
#include "cryptlib.h"
#include <openssl/asn1.h>
static int traverse_string(const unsigned char *p, int len, int inform,
int (*rfunc)(unsigned long value, void *in), void *arg);
static int in_utf8(unsigned long value, void *arg);
static int out_utf8(unsigned long value, void *arg);
static int type_str(unsigned long value, void *arg);
static int cpy_asc(unsigned long value, void *arg);
static int cpy_bmp(unsigned long value, void *arg);
static int cpy_univ(unsigned long value, void *arg);
static int cpy_utf8(unsigned long value, void *arg);
static int is_printable(unsigned long value);
/* These functions take a string in UTF8, ASCII or multibyte form and
* a mask of permissible ASN1 string types. It then works out the minimal
* type (using the order Printable < IA5 < T61 < BMP < Universal < UTF8)
* and creates a string of the correct type with the supplied data.
* Yes this is horrible: it has to be :-(
* The 'ncopy' form checks minimum and maximum size limits too.
*/
int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
int inform, unsigned long mask)
{
return ASN1_mbstring_ncopy(out, in, len, inform, mask, 0, 0);
}
int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
int inform, unsigned long mask,
long minsize, long maxsize)
{
int str_type;
int ret;
int outform, outlen;
ASN1_STRING *dest;
unsigned char *p;
int nchar;
char strbuf[32];
int (*cpyfunc)(unsigned long,void *) = NULL;
if(len == -1) len = strlen((const char *)in);
if(!mask) mask = DIRSTRING_TYPE;
/* First do a string check and work out the number of characters */
switch(inform) {
case MBSTRING_BMP:
if(len & 1) {
ASN1err(ASN1_F_ASN1_MBSTRING_COPY,
ASN1_R_INVALID_BMPSTRING_LENGTH);
return -1;
}
nchar = len >> 1;
break;
case MBSTRING_UNIV:
if(len & 3) {
ASN1err(ASN1_F_ASN1_MBSTRING_COPY,
ASN1_R_INVALID_UNIVERSALSTRING_LENGTH);
return -1;
}
nchar = len >> 2;
break;
case MBSTRING_UTF8:
nchar = 0;
/* This counts the characters and does utf8 syntax checking */
ret = traverse_string(in, len, MBSTRING_UTF8, in_utf8, &nchar);
if(ret < 0) {
ASN1err(ASN1_F_ASN1_MBSTRING_COPY,
ASN1_R_INVALID_UTF8STRING);
return -1;
}
break;
case MBSTRING_ASC:
nchar = len;
break;
default:
ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_UNKNOWN_FORMAT);
return -1;
}
if((minsize > 0) && (nchar < minsize)) {
ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_SHORT);
sprintf(strbuf, "%ld", minsize);
ERR_add_error_data(2, "minsize=", strbuf);
return -1;
}
if((maxsize > 0) && (nchar > maxsize)) {
ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_LONG);
sprintf(strbuf, "%ld", maxsize);
ERR_add_error_data(2, "maxsize=", strbuf);
return -1;
}
/* Now work out minimal type (if any) */
if(traverse_string(in, len, inform, type_str, &mask) < 0) {
ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_ILLEGAL_CHARACTERS);
return -1;
}
/* Now work out output format and string type */
outform = MBSTRING_ASC;
if(mask & B_ASN1_PRINTABLESTRING) str_type = V_ASN1_PRINTABLESTRING;
else if(mask & B_ASN1_IA5STRING) str_type = V_ASN1_IA5STRING;
else if(mask & B_ASN1_T61STRING) str_type = V_ASN1_T61STRING;
else if(mask & B_ASN1_BMPSTRING) {
str_type = V_ASN1_BMPSTRING;
outform = MBSTRING_BMP;
} else if(mask & B_ASN1_UNIVERSALSTRING) {
str_type = V_ASN1_UNIVERSALSTRING;
outform = MBSTRING_UNIV;
} else {
str_type = V_ASN1_UTF8STRING;
outform = MBSTRING_UTF8;
}
if(!out) return str_type;
if(*out) {
dest = *out;
if(dest->data) {
dest->length = 0;
Free(dest->data);
dest->data = NULL;
}
dest->type = str_type;
} else {
dest = ASN1_STRING_type_new(str_type);
if(!dest) {
ASN1err(ASN1_F_ASN1_MBSTRING_COPY,
ERR_R_MALLOC_FAILURE);
return -1;
}
*out = dest;
}
/* If both the same type just copy across */
if(inform == outform) {
if(!ASN1_STRING_set(dest, in, len)) {
ASN1err(ASN1_F_ASN1_MBSTRING_COPY,ERR_R_MALLOC_FAILURE);
return -1;
}
return str_type;
}
/* Work out how much space the destination will need */
switch(outform) {
case MBSTRING_ASC:
outlen = nchar;
cpyfunc = cpy_asc;
break;
case MBSTRING_BMP:
outlen = nchar << 1;
cpyfunc = cpy_bmp;
break;
case MBSTRING_UNIV:
outlen = nchar << 2;
cpyfunc = cpy_univ;
break;
case MBSTRING_UTF8:
outlen = 0;
traverse_string(in, len, inform, out_utf8, &outlen);
cpyfunc = cpy_utf8;
break;
}
if(!(p = Malloc(outlen + 1))) {
ASN1_STRING_free(dest);
ASN1err(ASN1_F_ASN1_MBSTRING_COPY,ERR_R_MALLOC_FAILURE);
return -1;
}
dest->length = outlen;
dest->data = p;
p[outlen] = 0;
traverse_string(in, len, inform, cpyfunc, &p);
return str_type;
}
/* This function traverses a string and passes the value of each character
* to an optional function along with a void * argument.
*/
static int traverse_string(const unsigned char *p, int len, int inform,
int (*rfunc)(unsigned long value, void *in), void *arg)
{
unsigned long value;
int ret;
while(len) {
if(inform == MBSTRING_ASC) {
value = *p++;
len--;
} else if(inform == MBSTRING_BMP) {
value = *p++ << 8;
value |= *p++;
len -= 2;
} else if(inform == MBSTRING_UNIV) {
value = *p++ << 24;
value |= *p++ << 16;
value |= *p++ << 8;
value |= *p++;
len -= 4;
} else {
ret = UTF8_getc(p, len, &value);
if(ret < 0) return -1;
len -= ret;
p += ret;
}
if(rfunc) {
ret = rfunc(value, arg);
if(ret <= 0) return ret;
}
}
return 1;
}
/* Various utility functions for traverse_string */
/* Just count number of characters */
static int in_utf8(unsigned long value, void *arg)
{
int *nchar;
nchar = arg;
(*nchar)++;
return 1;
}
/* Determine size of output as a UTF8 String */
static int out_utf8(unsigned long value, void *arg)
{
long *outlen;
outlen = arg;
*outlen += UTF8_putc(NULL, -1, value);
return 1;
}
/* Determine the "type" of a string: check each character against a
* supplied "mask".
*/
static int type_str(unsigned long value, void *arg)
{
unsigned long types;
types = *((unsigned long *)arg);
if((types & B_ASN1_PRINTABLESTRING) && !is_printable(value))
types &= ~B_ASN1_PRINTABLESTRING;
if((types & B_ASN1_IA5STRING) && (value > 127))
types &= ~B_ASN1_IA5STRING;
if((types & B_ASN1_T61STRING) && (value > 0xff))
types &= ~B_ASN1_T61STRING;
if((types & B_ASN1_BMPSTRING) && (value > 0xffff))
types &= ~B_ASN1_BMPSTRING;
if(!types) return -1;
*((unsigned long *)arg) = types;
return 1;
}
/* Copy one byte per character ASCII like strings */
static int cpy_asc(unsigned long value, void *arg)
{
unsigned char **p, *q;
p = arg;
q = *p;
*q = (unsigned char) value;
(*p)++;
return 1;
}
/* Copy two byte per character BMPStrings */
static int cpy_bmp(unsigned long value, void *arg)
{
unsigned char **p, *q;
p = arg;
q = *p;
*q++ = (unsigned char) ((value >> 8) & 0xff);
*q = (unsigned char) (value & 0xff);
*p += 2;
return 1;
}
/* Copy four byte per character UniversalStrings */
static int cpy_univ(unsigned long value, void *arg)
{
unsigned char **p, *q;
p = arg;
q = *p;
*q++ = (unsigned char) ((value >> 24) & 0xff);
*q++ = (unsigned char) ((value >> 16) & 0xff);
*q++ = (unsigned char) ((value >> 8) & 0xff);
*q = (unsigned char) (value & 0xff);
*p += 4;
return 1;
}
/* Copy to a UTF8String */
static int cpy_utf8(unsigned long value, void *arg)
{
unsigned char **p;
int ret;
p = arg;
/* We already know there is enough room so pass 0xff as the length */
ret = UTF8_putc(*p, 0xff, value);
*p += ret;
return 1;
}
/* Return 1 if the character is permitted in a PrintableString */
static int is_printable(unsigned long value)
{
int ch;
if(value > 0x7f) return 0;
ch = (int) value;
/* Note: we can't use 'isalnum' because certain accented
* characters may count as alphanumeric in some environments.
*/
if((ch >= 'a') && (ch <= 'z')) return 1;
if((ch >= 'A') && (ch <= 'Z')) return 1;
if((ch >= '0') && (ch <= '9')) return 1;
if ((ch == ' ') || strchr("'()+,-./:=?", ch)) return 1;
return 0;
}

View File

@ -0,0 +1,119 @@
/* a_null.c */
/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
* project 1999.
*/
/* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* licensing@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#include <stdio.h>
#include "cryptlib.h"
#include <openssl/asn1.h>
/* ASN1 functions for NULL type. For compatibility with other ASN1 code
* it returns a pointer to an "ASN1_NULL" structure. The new/free functions
* don't need to do any allocating because nothing is stored in a NULL.
*/
int i2d_ASN1_NULL(ASN1_NULL *a, unsigned char **pp)
{
if(!a) return 0;
if (pp) ASN1_put_object(pp,0,0,V_ASN1_NULL,V_ASN1_UNIVERSAL);
return 2;
}
ASN1_NULL *d2i_ASN1_NULL(ASN1_NULL **a, unsigned char **pp, long length)
{
ASN1_NULL *ret = NULL;
unsigned char *p;
long len;
int inf,tag,xclass;
int i=0;
p= *pp;
inf=ASN1_get_object(&p,&len,&tag,&xclass,length);
if (inf & 0x80)
{
i=ASN1_R_BAD_OBJECT_HEADER;
goto err;
}
if (tag != V_ASN1_NULL)
{
i=ASN1_R_EXPECTING_A_NULL;
goto err;
}
if (len != 0)
{
i=ASN1_R_NULL_IS_WRONG_LENGTH;
goto err;
}
ret=(ASN1_NULL *)1;
if (a != NULL) (*a)=ret;
*pp=p;
return(ret);
err:
ASN1err(ASN1_F_D2I_ASN1_NULL,i);
return(ret);
}
ASN1_NULL *ASN1_NULL_new(void)
{
return (ASN1_NULL *)1;
}
void ASN1_NULL_free(ASN1_NULL *a)
{
return;
}

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((char *)ret->data);
ret->data=(unsigned char *)Malloc((int)len);
if (ret->data != NULL) Free(ret->data);
ret->data=(unsigned char *)Malloc(len ? (int)len : 1);
ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA;
if (ret->data == NULL)
{ i=ERR_R_MALLOC_FAILURE; goto err; }
@ -269,7 +269,7 @@ void ASN1_OBJECT_free(ASN1_OBJECT *a)
if (a == NULL) return;
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 mempory leaks */
#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);
#endif

View File

@ -60,11 +60,23 @@
#include "cryptlib.h"
#include <openssl/asn1.h>
ASN1_OCTET_STRING *ASN1_OCTET_STRING_new(void)
{ return M_ASN1_OCTET_STRING_new(); }
void ASN1_OCTET_STRING_free(ASN1_OCTET_STRING *x)
{ M_ASN1_OCTET_STRING_free(x); }
ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *x)
{ return M_ASN1_OCTET_STRING_dup(x); }
int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b)
{ return M_ASN1_OCTET_STRING_cmp(a, b); }
int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, unsigned char *d, int len)
{ return M_ASN1_OCTET_STRING_set(x, d, len); }
int i2d_ASN1_OCTET_STRING(ASN1_OCTET_STRING *a, unsigned char **pp)
{
return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
V_ASN1_OCTET_STRING,V_ASN1_UNIVERSAL));
}
{ return M_i2d_ASN1_OCTET_STRING(a, pp); }
ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **a,
unsigned char **pp, long length)

View File

@ -60,6 +60,12 @@
#include "cryptlib.h"
#include <openssl/asn1.h>
ASN1_IA5STRING *ASN1_IA5STRING_new(void)
{ return M_ASN1_IA5STRING_new();}
void ASN1_IA5STRING_free(ASN1_IA5STRING *x)
{ M_ASN1_IA5STRING_free(x);}
int i2d_ASN1_IA5STRING(ASN1_IA5STRING *a, unsigned char **pp)
{ return(M_i2d_ASN1_IA5STRING(a,pp)); }
@ -67,15 +73,30 @@ ASN1_IA5STRING *d2i_ASN1_IA5STRING(ASN1_IA5STRING **a, unsigned char **pp,
long l)
{ return(M_d2i_ASN1_IA5STRING(a,pp,l)); }
ASN1_T61STRING *ASN1_T61STRING_new(void)
{ return M_ASN1_T61STRING_new();}
void ASN1_T61STRING_free(ASN1_T61STRING *x)
{ M_ASN1_T61STRING_free(x);}
ASN1_T61STRING *d2i_ASN1_T61STRING(ASN1_T61STRING **a, unsigned char **pp,
long l)
{ return(M_d2i_ASN1_T61STRING(a,pp,l)); }
ASN1_PRINTABLESTRING *ASN1_PRINTABLESTRING_new(void)
{ return M_ASN1_PRINTABLESTRING_new();}
void ASN1_PRINTABLESTRING_free(ASN1_PRINTABLESTRING *x)
{ M_ASN1_PRINTABLESTRING_free(x);}
ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING **a,
unsigned char **pp, long l)
{ return(M_d2i_ASN1_PRINTABLESTRING(a,pp,
l)); }
int i2d_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING *a, unsigned char **pp)
{ return(M_i2d_ASN1_PRINTABLESTRING(a,pp)); }
int i2d_ASN1_PRINTABLE(ASN1_STRING *a, unsigned char **pp)
{ return(M_i2d_ASN1_PRINTABLE(a,pp)); }
@ -149,6 +170,11 @@ int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s)
return(1);
}
ASN1_STRING *DIRECTORYSTRING_new(void)
{ return M_DIRECTORYSTRING_new();}
void DIRECTORYSTRING_free(ASN1_STRING *x)
{ M_DIRECTORYSTRING_free(x);}
int i2d_DIRECTORYSTRING(ASN1_STRING *a, unsigned char **pp)
{ return(M_i2d_DIRECTORYSTRING(a,pp)); }
@ -157,6 +183,12 @@ ASN1_STRING *d2i_DIRECTORYSTRING(ASN1_STRING **a, unsigned char **pp,
long l)
{ return(M_d2i_DIRECTORYSTRING(a,pp,l)); }
ASN1_STRING *DISPLAYTEXT_new(void)
{ return M_DISPLAYTEXT_new();}
void DISPLAYTEXT_free(ASN1_STRING *x)
{ M_DISPLAYTEXT_free(x);}
int i2d_DISPLAYTEXT(ASN1_STRING *a, unsigned char **pp)
{ return(M_i2d_DISPLAYTEXT(a,pp)); }

View File

@ -58,10 +58,13 @@
#include <stdio.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "cryptlib.h"
#ifndef NO_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <openssl/bn.h>
#include <openssl/evp.h>
#include <openssl/x509.h>
@ -126,11 +129,11 @@ 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((char *)signature->data);
if (signature->data != NULL) Free(signature->data);
signature->data=buf_out;
buf_out=NULL;
signature->length=outl;
/* In the interests of compatability, I'll make sure that
/* In the interests of compatibility, I'll make sure that
* the bit string has a 'not-used bits' value of 0
*/
signature->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
@ -138,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((char *)buf_in); }
{ memset((char *)buf_in,0,(unsigned int)inl); Free(buf_in); }
if (buf_out != NULL)
{ memset((char *)buf_out,0,outll); Free((char *)buf_out); }
{ memset((char *)buf_out,0,outll); Free(buf_out); }
return(outl);
}

View File

@ -0,0 +1,247 @@
/* a_strnid.c */
/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
* project 1999.
*/
/* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* licensing@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#include <stdio.h>
#include <ctype.h>
#include "cryptlib.h"
#include <openssl/asn1.h>
#include <openssl/objects.h>
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 table_cmp(ASN1_STRING_TABLE *a, ASN1_STRING_TABLE *b);
/* This is the global mask for the mbstring functions: this is use to
* mask out certain types (such as BMPString and UTF8String) because
* certain software (e.g. Netscape) has problems with them.
*/
static unsigned long global_mask = 0xFFFFFFFFL;
void ASN1_STRING_set_default_mask(unsigned long mask)
{
global_mask = mask;
}
unsigned long ASN1_STRING_get_default_mask(void)
{
return global_mask;
}
/* This function sets the default to various "flavours" of configuration.
* based on an ASCII string. Currently this is:
* MASK:XXXX : a numerical mask value.
* nobmp : Don't use BMPStrings (just Printable, T61).
* pkix : PKIX recommendation in RFC2459.
* utf8only : only use UTF8Strings (RFC2459 recommendation for 2004).
* default: the default value, Printable, T61, BMP.
*/
int ASN1_STRING_set_default_mask_asc(char *p)
{
unsigned long mask;
char *end;
if(!strncmp(p, "MASK:", 5)) {
if(!p[5]) return 0;
mask = strtoul(p + 5, &end, 0);
if(*end) return 0;
} else if(!strcmp(p, "nombstr"))
mask = ~(B_ASN1_BMPSTRING|B_ASN1_UTF8STRING);
else if(!strcmp(p, "pkix"))
mask = ~B_ASN1_T61STRING;
else if(!strcmp(p, "utf8only")) mask = B_ASN1_UTF8STRING;
else if(!strcmp(p, "default"))
mask = 0xFFFFFFFFL;
else return 0;
ASN1_STRING_set_default_mask(mask);
return 1;
}
/* The following function generates an ASN1_STRING based on limits in a table.
* Frequently the types and length of an ASN1_STRING are restricted by a
* corresponding OID. For example certificates and certificate requests.
*/
ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, const unsigned char *in,
int inlen, int inform, int nid)
{
ASN1_STRING_TABLE *tbl;
ASN1_STRING *str = NULL;
unsigned long mask;
int ret;
if(!out) out = &str;
tbl = ASN1_STRING_TABLE_get(nid);
if(tbl) {
mask = tbl->mask;
if(!(tbl->flags & STABLE_NO_MASK)) mask &= global_mask;
ret = ASN1_mbstring_ncopy(out, in, inlen, inform, tbl->mask,
tbl->minsize, tbl->maxsize);
} else ret = ASN1_mbstring_copy(out, in, inlen, inform, DIRSTRING_TYPE & global_mask);
if(ret <= 0) return NULL;
return *out;
}
/* Now the tables and helper functions for the string table:
*/
/* size limits: this stuff is taken straight from RFC2459 */
#define ub_name 32768
#define ub_common_name 64
#define ub_locality_name 128
#define ub_state_name 128
#define ub_organization_name 64
#define ub_organization_unit_name 64
#define ub_title 64
#define ub_email_address 128
/* This table must be kept in NID order */
static ASN1_STRING_TABLE tbl_standard[] = {
{NID_commonName, 1, ub_common_name, DIRSTRING_TYPE, 0},
{NID_countryName, 2, 2, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK},
{NID_localityName, 1, ub_locality_name, DIRSTRING_TYPE, 0},
{NID_stateOrProvinceName, 1, ub_state_name, DIRSTRING_TYPE, 0},
{NID_organizationName, 1, ub_organization_name, DIRSTRING_TYPE, 0},
{NID_organizationalUnitName, 1, ub_organization_unit_name, DIRSTRING_TYPE, 0},
{NID_pkcs9_emailAddress, 1, ub_email_address, B_ASN1_IA5STRING, STABLE_NO_MASK},
{NID_pkcs9_unstructuredName, 1, -1, PKCS9STRING_TYPE, 0},
{NID_pkcs9_challengePassword, 1, -1, PKCS9STRING_TYPE, 0},
{NID_pkcs9_unstructuredAddress, 1, -1, DIRSTRING_TYPE, 0},
{NID_givenName, 1, ub_name, DIRSTRING_TYPE, 0},
{NID_surname, 1, ub_name, DIRSTRING_TYPE, 0},
{NID_initials, 1, ub_name, DIRSTRING_TYPE, 0},
{NID_name, 1, ub_name, DIRSTRING_TYPE, 0},
{NID_dnQualifier, -1, -1, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK}
};
static int sk_table_cmp(ASN1_STRING_TABLE **a, ASN1_STRING_TABLE **b)
{
return (*a)->nid - (*b)->nid;
}
static int table_cmp(ASN1_STRING_TABLE *a, ASN1_STRING_TABLE *b)
{
return a->nid - b->nid;
}
ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid)
{
int idx;
ASN1_STRING_TABLE *ttmp;
ASN1_STRING_TABLE fnd;
fnd.nid = nid;
ttmp = (ASN1_STRING_TABLE *) OBJ_bsearch((char *)&fnd,
(char *)tbl_standard,
sizeof(tbl_standard)/sizeof(ASN1_STRING_TABLE),
sizeof(ASN1_STRING_TABLE), (int(*)())table_cmp);
if(ttmp) return ttmp;
if(!stable) return NULL;
idx = sk_ASN1_STRING_TABLE_find(stable, &fnd);
if(idx < 0) return NULL;
return sk_ASN1_STRING_TABLE_value(stable, idx);
}
int ASN1_STRING_TABLE_add(int nid,
long minsize, long maxsize, unsigned long mask,
unsigned long flags)
{
ASN1_STRING_TABLE *tmp;
char new_nid = 0;
flags &= ~STABLE_FLAGS_MALLOC;
if(!stable) stable = sk_ASN1_STRING_TABLE_new(sk_table_cmp);
if(!stable) {
ASN1err(ASN1_F_ASN1_STRING_TABLE_ADD, ERR_R_MALLOC_FAILURE);
return 0;
}
if(!(tmp = ASN1_STRING_TABLE_get(nid))) {
tmp = Malloc(sizeof(ASN1_STRING_TABLE));
if(!tmp) {
ASN1err(ASN1_F_ASN1_STRING_TABLE_ADD,
ERR_R_MALLOC_FAILURE);
return 0;
}
tmp->flags = flags | STABLE_FLAGS_MALLOC;
tmp->nid = nid;
new_nid = 1;
} else tmp->flags = (tmp->flags & STABLE_FLAGS_MALLOC) | flags;
if(minsize != -1) tmp->minsize = minsize;
if(maxsize != -1) tmp->maxsize = maxsize;
tmp->mask = mask;
if(new_nid) sk_ASN1_STRING_TABLE_push(stable, tmp);
return 1;
}
void ASN1_STRING_TABLE_cleanup(void)
{
STACK_OF(ASN1_STRING_TABLE) *tmp;
tmp = stable;
if(!tmp) return;
stable = NULL;
sk_ASN1_STRING_TABLE_pop_free(tmp, st_free);
}
static void st_free(ASN1_STRING_TABLE *tbl)
{
if(tbl->flags & STABLE_FLAGS_MALLOC) Free(tbl);
}
IMPLEMENT_STACK_OF(ASN1_STRING_TABLE)

View File

@ -66,6 +66,12 @@
#include "cryptlib.h"
#include <openssl/asn1.h>
ASN1_TIME *ASN1_TIME_new(void)
{ return M_ASN1_TIME_new(); }
void ASN1_TIME_free(ASN1_TIME *x)
{ M_ASN1_TIME_free(x); }
int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **pp)
{
#ifdef CHARSET_EBCDIC

View File

@ -282,7 +282,7 @@ void ASN1_TYPE_free(ASN1_TYPE *a)
{
if (a == NULL) return;
ASN1_TYPE_component_free(a);
Free((char *)(char *)a);
Free(a);
}
int ASN1_TYPE_get(ASN1_TYPE *a)

View File

@ -66,6 +66,12 @@
#include "cryptlib.h"
#include <openssl/asn1.h>
ASN1_UTCTIME *ASN1_UTCTIME_new(void)
{ return M_ASN1_UTCTIME_new(); }
void ASN1_UTCTIME_free(ASN1_UTCTIME *x)
{ M_ASN1_UTCTIME_free(x); }
int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **pp)
{
#ifndef CHARSET_EBCDIC
@ -109,7 +115,7 @@ ASN1_UTCTIME *d2i_ASN1_UTCTIME(ASN1_UTCTIME **a, unsigned char **pp,
return(ret);
err:
if ((ret != NULL) && ((a == NULL) || (*a != ret)))
ASN1_UTCTIME_free(ret);
M_ASN1_UTCTIME_free(ret);
return(NULL);
}
@ -192,7 +198,7 @@ ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
#endif
if (s == NULL)
s=ASN1_UTCTIME_new();
s=M_ASN1_UTCTIME_new();
if (s == NULL)
return(NULL);

View File

@ -60,6 +60,12 @@
#include "cryptlib.h"
#include <openssl/asn1.h>
ASN1_UTF8STRING *ASN1_UTF8STRING_new(void)
{ return M_ASN1_UTF8STRING_new();}
void ASN1_UTF8STRING_free(ASN1_UTF8STRING *x)
{ M_ASN1_UTF8STRING_free(x);}
int i2d_ASN1_UTF8STRING(ASN1_UTF8STRING *a, unsigned char **pp)
{
return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
@ -81,3 +87,152 @@ ASN1_UTF8STRING *d2i_ASN1_UTF8STRING(ASN1_UTF8STRING **a, unsigned char **pp,
return(ret);
}
/* UTF8 utilities */
/* This parses a UTF8 string one character at a time. It is passed a pointer
* to the string and the length of the string. It sets 'value' to the value of
* the current character. It returns the number of characters read or a
* negative error code:
* -1 = string too short
* -2 = illegal character
* -3 = subsequent characters not of the form 10xxxxxx
* -4 = character encoded incorrectly (not minimal length).
*/
int UTF8_getc(const unsigned char *str, int len, unsigned long *val)
{
const unsigned char *p;
unsigned long value;
int ret;
if(len <= 0) return 0;
p = str;
/* Check syntax and work out the encoded value (if correct) */
if((*p & 0x80) == 0) {
value = *p++ & 0x7f;
ret = 1;
} else if((*p & 0xe0) == 0xc0) {
if(len < 2) return -1;
if((p[1] & 0xc0) != 0x80) return -3;
value = (*p++ & 0x1f) << 6;
value |= *p++ & 0x3f;
if(value < 0x80) return -4;
ret = 2;
} else if((*p & 0xf0) == 0xe0) {
if(len < 3) return -1;
if( ((p[1] & 0xc0) != 0x80)
|| ((p[2] & 0xc0) != 0x80) ) return -3;
value = (*p++ & 0xf) << 12;
value |= (*p++ & 0x3f) << 6;
value |= *p++ & 0x3f;
if(value < 0x800) return -4;
ret = 3;
} else if((*p & 0xf8) == 0xf0) {
if(len < 4) return -1;
if( ((p[1] & 0xc0) != 0x80)
|| ((p[2] & 0xc0) != 0x80)
|| ((p[3] & 0xc0) != 0x80) ) return -3;
value = (*p++ & 0x7) << 18;
value |= (*p++ & 0x3f) << 12;
value |= (*p++ & 0x3f) << 6;
value |= *p++ & 0x3f;
if(value < 0x10000) return -4;
ret = 4;
} else if((*p & 0xfc) == 0xf8) {
if(len < 5) return -1;
if( ((p[1] & 0xc0) != 0x80)
|| ((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 |= (*p++ & 0x3f) << 6;
value |= *p++ & 0x3f;
if(value < 0x200000) return -4;
ret = 5;
} else if((*p & 0xfe) == 0xfc) {
if(len < 6) return -1;
if( ((p[1] & 0xc0) != 0x80)
|| ((p[2] & 0xc0) != 0x80)
|| ((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 |= (*p++ & 0x3f) << 6;
value |= *p++ & 0x3f;
if(value < 0x4000000) return -4;
ret = 6;
} else return -2;
*val = value;
return ret;
}
/* This takes a character 'value' and writes the UTF8 encoded value in
* 'str' where 'str' is a buffer containing 'len' characters. Returns
* the number of characters written or -1 if 'len' is too small. 'str' can
* be set to NULL in which case it just returns the number of characters.
* It will need at most 6 characters.
*/
int UTF8_putc(unsigned char *str, int len, unsigned long value)
{
if(!str) len = 6; /* Maximum we will need */
else if(len <= 0) return -1;
if(value < 0x80) {
if(str) *str = (unsigned char)value;
return 1;
}
if(value < 0x800) {
if(len < 2) return -1;
if(str) {
*str++ = (unsigned char)(((value >> 6) & 0x1f) | 0xc0);
*str = (unsigned char)((value & 0x3f) | 0x80);
}
return 2;
}
if(value < 0x10000) {
if(len < 3) return -1;
if(str) {
*str++ = (unsigned char)(((value >> 12) & 0xf) | 0xe0);
*str++ = (unsigned char)(((value >> 6) & 0x3f) | 0x80);
*str = (unsigned char)((value & 0x3f) | 0x80);
}
return 3;
}
if(value < 0x200000) {
if(len < 4) return -1;
if(str) {
*str++ = (unsigned char)(((value >> 18) & 0x7) | 0xf0);
*str++ = (unsigned char)(((value >> 12) & 0x3f) | 0x80);
*str++ = (unsigned char)(((value >> 6) & 0x3f) | 0x80);
*str = (unsigned char)((value & 0x3f) | 0x80);
}
return 4;
}
if(value < 0x4000000) {
if(len < 5) return -1;
if(str) {
*str++ = (unsigned char)(((value >> 24) & 0x3) | 0xf8);
*str++ = (unsigned char)(((value >> 18) & 0x3f) | 0x80);
*str++ = (unsigned char)(((value >> 12) & 0x3f) | 0x80);
*str++ = (unsigned char)(((value >> 6) & 0x3f) | 0x80);
*str = (unsigned char)((value & 0x3f) | 0x80);
}
return 5;
}
if(len < 6) return -1;
if(str) {
*str++ = (unsigned char)(((value >> 30) & 0x1) | 0xfc);
*str++ = (unsigned char)(((value >> 24) & 0x3f) | 0x80);
*str++ = (unsigned char)(((value >> 18) & 0x3f) | 0x80);
*str++ = (unsigned char)(((value >> 12) & 0x3f) | 0x80);
*str++ = (unsigned char)(((value >> 6) & 0x3f) | 0x80);
*str = (unsigned char)((value & 0x3f) | 0x80);
}
return 6;
}

View File

@ -58,10 +58,13 @@
#include <stdio.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "cryptlib.h"
#ifndef NO_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <openssl/bn.h>
#include <openssl/x509.h>
#include <openssl/objects.h>
@ -98,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((char *)buf_in);
Free(buf_in);
if (EVP_VerifyFinal(&ctx,(unsigned char *)signature->data,
(unsigned int)signature->length,pkey) <= 0)

View File

@ -60,6 +60,12 @@
#include "cryptlib.h"
#include <openssl/asn1.h>
ASN1_VISIBLESTRING *ASN1_VISIBLESTRING_new(void)
{ return M_ASN1_VISIBLESTRING_new(); }
void ASN1_VISIBLESTRING_free(ASN1_VISIBLESTRING *x)
{ M_ASN1_VISIBLESTRING_free(x); }
int i2d_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING *a, unsigned char **pp)
{
return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,

View File

@ -68,6 +68,10 @@ extern "C" {
#include <openssl/stack.h>
#include <openssl/safestack.h>
#ifdef VMS
#include <openssl/vms_idhacks.h>
#endif
#define V_ASN1_UNIVERSAL 0x00
#define V_ASN1_APPLICATION 0x40
#define V_ASN1_CONTEXT_SPECIFIC 0x80
@ -77,7 +81,7 @@ extern "C" {
#define V_ASN1_PRIMITIVE_TAG 0x1f
#define V_ASN1_PRIMATIVE_TAG 0x1f
#define V_ASN1_APP_CHOOSE -2 /* let the recipent choose */
#define V_ASN1_APP_CHOOSE -2 /* let the recipient choose */
#define V_ASN1_UNDEF -1
#define V_ASN1_EOC 0
@ -129,6 +133,13 @@ extern "C" {
#define B_ASN1_UNKNOWN 0x1000
#define B_ASN1_UTF8STRING 0x2000
/* For use with ASN1_mbstring_copy() */
#define MBSTRING_FLAG 0x1000
#define MBSTRING_ASC (MBSTRING_FLAG|1)
#define MBSTRING_BMP (MBSTRING_FLAG|2)
#define MBSTRING_UNIV (MBSTRING_FLAG|3)
#define MBSTRING_UTF8 (MBSTRING_FLAG|4)
#define DECLARE_ASN1_SET_OF(type) \
int i2d_ASN1_SET_OF_##type(STACK_OF(type) *a,unsigned char **pp, \
int (*func)(type *,unsigned char **), int ex_tag, \
@ -165,7 +176,7 @@ typedef struct asn1_ctx_st
int tag; /* tag from last 'get object' */
int xclass; /* class from last 'get object' */
long slen; /* length of last 'get object' */
unsigned char *max; /* largest value of p alowed */
unsigned char *max; /* largest value of p allowed */
unsigned char *q;/* temporary variable */
unsigned char **pp;/* variable */
int line; /* used in error processing */
@ -200,7 +211,34 @@ typedef struct asn1_string_st
long flags;
} ASN1_STRING;
#ifndef DEBUG
#define STABLE_FLAGS_MALLOC 0x01
#define STABLE_NO_MASK 0x02
#define DIRSTRING_TYPE \
(B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING)
#define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING)
typedef struct asn1_string_table_st {
int nid;
long minsize;
long maxsize;
unsigned long mask;
unsigned long flags;
} ASN1_STRING_TABLE;
DECLARE_STACK_OF(ASN1_STRING_TABLE)
/* size limits: this stuff is taken straight from RFC2459 */
#define ub_name 32768
#define ub_common_name 64
#define ub_locality_name 128
#define ub_state_name 128
#define ub_organization_name 64
#define ub_organization_unit_name 64
#define ub_title 64
#define ub_email_address 128
#ifdef NO_ASN1_TYPEDEFS
#define ASN1_INTEGER ASN1_STRING
#define ASN1_ENUMERATED ASN1_STRING
#define ASN1_BIT_STRING ASN1_STRING
@ -234,6 +272,8 @@ typedef struct asn1_string_st ASN1_VISIBLESTRING;
typedef struct asn1_string_st ASN1_UTF8STRING;
#endif
typedef int ASN1_NULL;
typedef struct asn1_type_st
{
int type;
@ -281,60 +321,58 @@ typedef struct asn1_header_st
ASN1_METHOD *meth;
} ASN1_HEADER;
#define ASN1_STRING_length(x) ((x)->length)
#define ASN1_STRING_type(x) ((x)->type)
#define ASN1_STRING_data(x) ((x)->data)
/* This is used to contain a list of bit names */
typedef struct BIT_STRING_BITNAME_st {
int bitnum;
const char *lname;
const char *sname;
} BIT_STRING_BITNAME;
#define M_ASN1_STRING_length(x) ((x)->length)
#define M_ASN1_STRING_length_set(x, n) ((x)->length = (n))
#define M_ASN1_STRING_type(x) ((x)->type)
#define M_ASN1_STRING_data(x) ((x)->data)
/* Macros for string operations */
#define ASN1_BIT_STRING_new() (ASN1_BIT_STRING *)\
#define M_ASN1_BIT_STRING_new() (ASN1_BIT_STRING *)\
ASN1_STRING_type_new(V_ASN1_BIT_STRING)
#define ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\
#define M_ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\
ASN1_STRING_dup((ASN1_STRING *)a)
#define ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\
#define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\
(ASN1_STRING *)a,(ASN1_STRING *)b)
#define ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)
/* i2d_ASN1_BIT_STRING() is a function */
/* d2i_ASN1_BIT_STRING() is a function */
#define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)
#define ASN1_INTEGER_new() (ASN1_INTEGER *)\
#define M_ASN1_INTEGER_new() (ASN1_INTEGER *)\
ASN1_STRING_type_new(V_ASN1_INTEGER)
#define ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define ASN1_INTEGER_dup(a) (ASN1_INTEGER *)ASN1_STRING_dup((ASN1_STRING *)a)
#define ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\
#define M_ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)ASN1_STRING_dup((ASN1_STRING *)a)
#define M_ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\
(ASN1_STRING *)a,(ASN1_STRING *)b)
/* ASN1_INTEGER_set() is a function, also see BN_to_ASN1_INTEGER() */
/* ASN1_INTEGER_get() is a function, also see ASN1_INTEGER_to_BN() */
/* i2d_ASN1_INTEGER() is a function */
/* d2i_ASN1_INTEGER() is a function */
#define ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\
#define M_ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\
ASN1_STRING_type_new(V_ASN1_ENUMERATED)
#define ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)ASN1_STRING_dup((ASN1_STRING *)a)
#define ASN1_ENUMERATED_cmp(a,b) ASN1_STRING_cmp(\
#define M_ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)ASN1_STRING_dup((ASN1_STRING *)a)
#define M_ASN1_ENUMERATED_cmp(a,b) ASN1_STRING_cmp(\
(ASN1_STRING *)a,(ASN1_STRING *)b)
/* ASN1_ENUMERATED_set() is a function, also see BN_to_ASN1_ENUMERATED() */
/* ASN1_ENUMERATED_get() is a function, also see ASN1_ENUMERATED_to_BN() */
/* i2d_ASN1_ENUMERATED() is a function */
/* d2i_ASN1_ENUMERATED() is a function */
#define ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\
#define M_ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\
ASN1_STRING_type_new(V_ASN1_OCTET_STRING)
#define ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\
#define M_ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\
ASN1_STRING_dup((ASN1_STRING *)a)
#define ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\
#define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\
(ASN1_STRING *)a,(ASN1_STRING *)b)
#define ASN1_OCTET_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)
#define ASN1_OCTET_STRING_print(a,b) ASN1_STRING_print(a,(ASN1_STRING *)b)
#define M_ASN1_OCTET_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)
#define M_ASN1_OCTET_STRING_print(a,b) ASN1_STRING_print(a,(ASN1_STRING *)b)
#define M_i2d_ASN1_OCTET_STRING(a,pp) \
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\
V_ASN1_OCTET_STRING)
/* d2i_ASN1_OCTET_STRING() is a function */
V_ASN1_UNIVERSAL)
#define ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING)
#define ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING)
#define M_ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
pp,a->type,V_ASN1_UNIVERSAL)
#define M_d2i_ASN1_PRINTABLE(a,pp,l) \
@ -345,10 +383,11 @@ typedef struct asn1_header_st
B_ASN1_BIT_STRING| \
B_ASN1_UNIVERSALSTRING|\
B_ASN1_BMPSTRING|\
B_ASN1_UTF8STRING|\
B_ASN1_UNKNOWN)
#define DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
#define DIRECTORYSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
#define M_DIRECTORYSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_i2d_DIRECTORYSTRING(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
pp,a->type,V_ASN1_UNIVERSAL)
#define M_d2i_DIRECTORYSTRING(a,pp,l) \
@ -359,8 +398,8 @@ typedef struct asn1_header_st
B_ASN1_UNIVERSALSTRING|\
B_ASN1_UTF8STRING)
#define DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)
#define DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)
#define M_DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_i2d_DISPLAYTEXT(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
pp,a->type,V_ASN1_UNIVERSAL)
#define M_d2i_DISPLAYTEXT(a,pp,l) \
@ -369,9 +408,9 @@ typedef struct asn1_header_st
B_ASN1_BMPSTRING|\
B_ASN1_UTF8STRING)
#define ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\
#define M_ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\
ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
#define ASN1_PRINTABLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_PRINTABLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_i2d_ASN1_PRINTABLESTRING(a,pp) \
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_PRINTABLESTRING,\
V_ASN1_UNIVERSAL)
@ -379,9 +418,9 @@ typedef struct asn1_header_st
(ASN1_PRINTABLESTRING *)d2i_ASN1_type_bytes\
((ASN1_STRING **)a,pp,l,B_ASN1_PRINTABLESTRING)
#define ASN1_T61STRING_new() (ASN1_T61STRING_STRING *)\
#define M_ASN1_T61STRING_new() (ASN1_T61STRING *)\
ASN1_STRING_type_new(V_ASN1_T61STRING)
#define ASN1_T61STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_T61STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_i2d_ASN1_T61STRING(a,pp) \
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_T61STRING,\
V_ASN1_UNIVERSAL)
@ -389,10 +428,10 @@ typedef struct asn1_header_st
(ASN1_T61STRING *)d2i_ASN1_type_bytes\
((ASN1_STRING **)a,pp,l,B_ASN1_T61STRING)
#define ASN1_IA5STRING_new() (ASN1_IA5STRING *)\
#define M_ASN1_IA5STRING_new() (ASN1_IA5STRING *)\
ASN1_STRING_type_new(V_ASN1_IA5STRING)
#define ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define ASN1_IA5STRING_dup(a) \
#define M_ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_IA5STRING_dup(a) \
(ASN1_IA5STRING *)ASN1_STRING_dup((ASN1_STRING *)a)
#define M_i2d_ASN1_IA5STRING(a,pp) \
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\
@ -401,38 +440,25 @@ typedef struct asn1_header_st
(ASN1_IA5STRING *)d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l,\
B_ASN1_IA5STRING)
#define ASN1_UTCTIME_new() (ASN1_UTCTIME *)\
#define M_ASN1_UTCTIME_new() (ASN1_UTCTIME *)\
ASN1_STRING_type_new(V_ASN1_UTCTIME)
#define ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup((ASN1_STRING *)a)
/* i2d_ASN1_UTCTIME() is a function */
/* d2i_ASN1_UTCTIME() is a function */
/* ASN1_UTCTIME_set() is a function */
/* ASN1_UTCTIME_check() is a function */
#define M_ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup((ASN1_STRING *)a)
#define ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\
#define M_ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\
ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME)
#define ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\
#define M_ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\
(ASN1_STRING *)a)
/* i2d_ASN1_GENERALIZEDTIME() is a function */
/* d2i_ASN1_GENERALIZEDTIME() is a function */
/* ASN1_GENERALIZEDTIME_set() is a function */
/* ASN1_GENERALIZEDTIME_check() is a function */
#define ASN1_TIME_new() (ASN1_TIME *)\
#define M_ASN1_TIME_new() (ASN1_TIME *)\
ASN1_STRING_type_new(V_ASN1_UTCTIME)
#define ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define ASN1_TIME_dup(a) (ASN1_TIME *)ASN1_STRING_dup((ASN1_STRING *)a)
#define M_ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_TIME_dup(a) (ASN1_TIME *)ASN1_STRING_dup((ASN1_STRING *)a)
/* i2d_ASN1_TIME() is a function */
/* d2i_ASN1_TIME() is a function */
/* ASN1_TIME_set() is a function */
/* ASN1_TIME_check() is a function */
#define ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\
#define M_ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\
ASN1_STRING_type_new(V_ASN1_GENERALSTRING)
#define ASN1_GENERALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_GENERALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_i2d_ASN1_GENERALSTRING(a,pp) \
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_GENERALSTRING,\
V_ASN1_UNIVERSAL)
@ -440,9 +466,9 @@ typedef struct asn1_header_st
(ASN1_GENERALSTRING *)d2i_ASN1_type_bytes\
((ASN1_STRING **)a,pp,l,B_ASN1_GENERALSTRING)
#define ASN1_UNIVERSALSTRING_new() (ASN1_UNIVERSALSTRING *)\
#define M_ASN1_UNIVERSALSTRING_new() (ASN1_UNIVERSALSTRING *)\
ASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING)
#define ASN1_UNIVERSALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_UNIVERSALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_i2d_ASN1_UNIVERSALSTRING(a,pp) \
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UNIVERSALSTRING,\
V_ASN1_UNIVERSAL)
@ -450,9 +476,9 @@ typedef struct asn1_header_st
(ASN1_UNIVERSALSTRING *)d2i_ASN1_type_bytes\
((ASN1_STRING **)a,pp,l,B_ASN1_UNIVERSALSTRING)
#define ASN1_BMPSTRING_new() (ASN1_BMPSTRING *)\
#define M_ASN1_BMPSTRING_new() (ASN1_BMPSTRING *)\
ASN1_STRING_type_new(V_ASN1_BMPSTRING)
#define ASN1_BMPSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_BMPSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_i2d_ASN1_BMPSTRING(a,pp) \
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_BMPSTRING,\
V_ASN1_UNIVERSAL)
@ -460,9 +486,9 @@ typedef struct asn1_header_st
(ASN1_BMPSTRING *)d2i_ASN1_type_bytes\
((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING)
#define ASN1_VISIBLESTRING_new() (ASN1_VISIBLESTRING *)\
#define M_ASN1_VISIBLESTRING_new() (ASN1_VISIBLESTRING *)\
ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)
#define ASN1_VISIBLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_VISIBLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_i2d_ASN1_VISIBLESTRING(a,pp) \
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_VISIBLESTRING,\
V_ASN1_UNIVERSAL)
@ -470,9 +496,9 @@ typedef struct asn1_header_st
(ASN1_VISIBLESTRING *)d2i_ASN1_type_bytes\
((ASN1_STRING **)a,pp,l,B_ASN1_VISIBLESTRING)
#define ASN1_UTF8STRING_new() (ASN1_UTF8STRING *)\
#define M_ASN1_UTF8STRING_new() (ASN1_UTF8STRING *)\
ASN1_STRING_type_new(V_ASN1_UTF8STRING)
#define ASN1_UTF8STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_ASN1_UTF8STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
#define M_i2d_ASN1_UTF8STRING(a,pp) \
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UTF8STRING,\
V_ASN1_UNIVERSAL)
@ -500,7 +526,7 @@ ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp,
DECLARE_STACK_OF(ASN1_OBJECT)
DECLARE_ASN1_SET_OF(ASN1_OBJECT)
ASN1_STRING * ASN1_STRING_new(void );
ASN1_STRING * ASN1_STRING_new(void);
void ASN1_STRING_free(ASN1_STRING *a);
ASN1_STRING * ASN1_STRING_dup(ASN1_STRING *a);
ASN1_STRING * ASN1_STRING_type_new(int type );
@ -508,23 +534,44 @@ int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b);
/* Since this is used to store all sorts of things, via macros, for now, make
its data void * */
int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
int ASN1_STRING_length(ASN1_STRING *x);
void ASN1_STRING_length_set(ASN1_STRING *x, int n);
int ASN1_STRING_type(ASN1_STRING *x);
unsigned char * ASN1_STRING_data(ASN1_STRING *x);
ASN1_BIT_STRING * ASN1_BIT_STRING_new(void);
void ASN1_BIT_STRING_free(ASN1_BIT_STRING *a);
int i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp);
ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,unsigned char **pp,
long length);
int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
int length );
int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
#ifdef HEADER_BIO_H
int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
BIT_STRING_BITNAME *tbl, int indent);
#endif
int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl);
int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
BIT_STRING_BITNAME *tbl);
int i2d_ASN1_BOOLEAN(int a,unsigned char **pp);
int d2i_ASN1_BOOLEAN(int *a,unsigned char **pp,long length);
ASN1_INTEGER * ASN1_INTEGER_new(void);
void ASN1_INTEGER_free(ASN1_INTEGER *a);
int i2d_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp);
ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp,
long length);
ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,unsigned char **pp,
long length);
ASN1_INTEGER * ASN1_INTEGER_dup(ASN1_INTEGER *x);
int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y);
ASN1_ENUMERATED * ASN1_ENUMERATED_new(void);
void ASN1_ENUMERATED_free(ASN1_ENUMERATED *a);
int i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a,unsigned char **pp);
ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a,unsigned char **pp,
long length);
@ -537,49 +584,88 @@ int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a);
ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t);
int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str);
ASN1_OCTET_STRING * ASN1_OCTET_STRING_new(void);
void ASN1_OCTET_STRING_free(ASN1_OCTET_STRING *a);
int i2d_ASN1_OCTET_STRING(ASN1_OCTET_STRING *a,unsigned char **pp);
ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **a,
unsigned char **pp,long length);
ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a);
int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b);
int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, unsigned char *data, int len);
ASN1_VISIBLESTRING * ASN1_VISIBLESTRING_new(void);
void ASN1_VISIBLESTRING_free(ASN1_VISIBLESTRING *a);
int i2d_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING *a,unsigned char **pp);
ASN1_VISIBLESTRING *d2i_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING **a,
unsigned char **pp,long length);
ASN1_UTF8STRING * ASN1_UTF8STRING_new(void);
void ASN1_UTF8STRING_free(ASN1_UTF8STRING *a);
int i2d_ASN1_UTF8STRING(ASN1_UTF8STRING *a,unsigned char **pp);
ASN1_UTF8STRING *d2i_ASN1_UTF8STRING(ASN1_UTF8STRING **a,
unsigned char **pp,long length);
ASN1_NULL * ASN1_NULL_new(void);
void ASN1_NULL_free(ASN1_NULL *a);
int i2d_ASN1_NULL(ASN1_NULL *a,unsigned char **pp);
ASN1_NULL *d2i_ASN1_NULL(ASN1_NULL **a, unsigned char **pp,long length);
ASN1_BMPSTRING * ASN1_BMPSTRING_new(void);
void ASN1_BMPSTRING_free(ASN1_BMPSTRING *a);
int i2d_ASN1_BMPSTRING(ASN1_BMPSTRING *a, unsigned char **pp);
ASN1_BMPSTRING *d2i_ASN1_BMPSTRING(ASN1_BMPSTRING **a, unsigned char **pp,
long length);
int UTF8_getc(const unsigned char *str, int len, unsigned long *val);
int UTF8_putc(unsigned char *str, int len, unsigned long value);
int i2d_ASN1_PRINTABLE(ASN1_STRING *a,unsigned char **pp);
ASN1_STRING *d2i_ASN1_PRINTABLE(ASN1_STRING **a,
unsigned char **pp, long l);
ASN1_PRINTABLESTRING * ASN1_PRINTABLESTRING_new(void);
void ASN1_PRINTABLESTRING_free(ASN1_PRINTABLESTRING *a);
ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING **a,
unsigned char **pp, long l);
int i2d_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING *a, unsigned char **pp);
ASN1_STRING * DIRECTORYSTRING_new(void);
void DIRECTORYSTRING_free(ASN1_STRING *a);
int i2d_DIRECTORYSTRING(ASN1_STRING *a,unsigned char **pp);
ASN1_STRING *d2i_DIRECTORYSTRING(ASN1_STRING **a, unsigned char **pp,
long length);
ASN1_STRING * DISPLAYTEXT_new(void);
void DISPLAYTEXT_free(ASN1_STRING *a);
int i2d_DISPLAYTEXT(ASN1_STRING *a,unsigned char **pp);
ASN1_STRING *d2i_DISPLAYTEXT(ASN1_STRING **a, unsigned char **pp, long length);
ASN1_T61STRING * ASN1_T61STRING_new(void);
void ASN1_T61STRING_free(ASN1_IA5STRING *a);
ASN1_T61STRING *d2i_ASN1_T61STRING(ASN1_T61STRING **a,
unsigned char **pp, long l);
ASN1_IA5STRING * ASN1_IA5STRING_new(void);
void ASN1_IA5STRING_free(ASN1_IA5STRING *a);
int i2d_ASN1_IA5STRING(ASN1_IA5STRING *a,unsigned char **pp);
ASN1_IA5STRING *d2i_ASN1_IA5STRING(ASN1_IA5STRING **a,
unsigned char **pp, long l);
ASN1_UTCTIME * ASN1_UTCTIME_new(void);
void ASN1_UTCTIME_free(ASN1_UTCTIME *a);
int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a,unsigned char **pp);
ASN1_UTCTIME * d2i_ASN1_UTCTIME(ASN1_UTCTIME **a,unsigned char **pp,
long length);
ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_new(void);
void ASN1_GENERALIZEDTIME_free(ASN1_GENERALIZEDTIME *a);
int i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a,unsigned char **pp);
ASN1_GENERALIZEDTIME * d2i_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME **a,unsigned char **pp,
long length);
ASN1_TIME * ASN1_TIME_new(void);
void ASN1_TIME_free(ASN1_TIME *a);
int i2d_ASN1_TIME(ASN1_TIME *a,unsigned char **pp);
ASN1_TIME * d2i_ASN1_TIME(ASN1_TIME **a,unsigned char **pp, long length);
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t);
@ -654,6 +740,7 @@ int ASN1_TIME_print(BIO *fp,ASN1_TIME *a);
int ASN1_STRING_print(BIO *bp,ASN1_STRING *v);
int ASN1_parse(BIO *bp,unsigned char *pp,long len,int indent);
#endif
const char *ASN1_tag2str(int tag);
/* Used to load and write netscape format cert/key */
int i2d_ASN1_HEADER(ASN1_HEADER *a,unsigned char **pp);
@ -687,6 +774,21 @@ unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(), unsigned char **buf,
void *ASN1_unpack_string(ASN1_STRING *oct, char *(*d2i)());
ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
void ASN1_STRING_set_default_mask(unsigned long mask);
int ASN1_STRING_set_default_mask_asc(char *p);
unsigned long ASN1_STRING_get_default_mask(void);
int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
int inform, unsigned long mask);
int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
int inform, unsigned long mask,
long minsize, long maxsize);
ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out,
const unsigned char *in, int inlen, int inform, int nid);
ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);
int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long);
void ASN1_STRING_TABLE_cleanup(void);
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
* made after this point may be overwritten when the script is next run.
@ -699,6 +801,7 @@ ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
#define ASN1_F_A2I_ASN1_ENUMERATED 236
#define ASN1_F_A2I_ASN1_INTEGER 101
#define ASN1_F_A2I_ASN1_STRING 102
#define ASN1_F_ACCESS_DESCRIPTION_NEW 291
#define ASN1_F_ASN1_COLLATE_PRIMITIVE 103
#define ASN1_F_ASN1_D2I_BIO 104
#define ASN1_F_ASN1_D2I_FP 105
@ -712,6 +815,7 @@ ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
#define ASN1_F_ASN1_I2D_FP 110
#define ASN1_F_ASN1_INTEGER_SET 111
#define ASN1_F_ASN1_INTEGER_TO_BN 112
#define ASN1_F_ASN1_MBSTRING_COPY 282
#define ASN1_F_ASN1_OBJECT_NEW 113
#define ASN1_F_ASN1_PACK_STRING 245
#define ASN1_F_ASN1_PBE_SET 253
@ -719,6 +823,7 @@ ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
#define ASN1_F_ASN1_SEQ_UNPACK 247
#define ASN1_F_ASN1_SIGN 114
#define ASN1_F_ASN1_STRING_NEW 115
#define ASN1_F_ASN1_STRING_TABLE_ADD 283
#define ASN1_F_ASN1_STRING_TYPE_NEW 116
#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 117
#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 118
@ -730,6 +835,7 @@ ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
#define ASN1_F_BASIC_CONSTRAINTS_NEW 226
#define ASN1_F_BN_TO_ASN1_ENUMERATED 234
#define ASN1_F_BN_TO_ASN1_INTEGER 122
#define ASN1_F_D2I_ACCESS_DESCRIPTION 284
#define ASN1_F_D2I_ASN1_BIT_STRING 123
#define ASN1_F_D2I_ASN1_BMPSTRING 124
#define ASN1_F_D2I_ASN1_BOOLEAN 125
@ -738,6 +844,7 @@ ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
#define ASN1_F_D2I_ASN1_GENERALIZEDTIME 223
#define ASN1_F_D2I_ASN1_HEADER 127
#define ASN1_F_D2I_ASN1_INTEGER 128
#define ASN1_F_D2I_ASN1_NULL 292
#define ASN1_F_D2I_ASN1_OBJECT 129
#define ASN1_F_D2I_ASN1_OCTET_STRING 130
#define ASN1_F_D2I_ASN1_PRINT_TYPE 131
@ -765,6 +872,7 @@ ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
#define ASN1_F_D2I_NETSCAPE_SPKAC 143
#define ASN1_F_D2I_NETSCAPE_SPKI 144
#define ASN1_F_D2I_NOTICEREF 268
#define ASN1_F_D2I_OTHERNAME 287
#define ASN1_F_D2I_PBE2PARAM 262
#define ASN1_F_D2I_PBEPARAM 249
#define ASN1_F_D2I_PBKDF2PARAM 263
@ -796,6 +904,7 @@ ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
#define ASN1_F_D2I_X509 159
#define ASN1_F_D2I_X509_ALGOR 160
#define ASN1_F_D2I_X509_ATTRIBUTE 161
#define ASN1_F_D2I_X509_CERT_AUX 285
#define ASN1_F_D2I_X509_CINF 162
#define ASN1_F_D2I_X509_CRL 163
#define ASN1_F_D2I_X509_CRL_INFO 164
@ -819,12 +928,14 @@ ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
#define ASN1_F_I2D_DSAPARAMS 178
#define ASN1_F_I2D_DSAPRIVATEKEY 179
#define ASN1_F_I2D_DSAPUBLICKEY 180
#define ASN1_F_I2D_DSA_PUBKEY 290
#define ASN1_F_I2D_NETSCAPE_RSA 181
#define ASN1_F_I2D_PKCS7 182
#define ASN1_F_I2D_PRIVATEKEY 183
#define ASN1_F_I2D_PUBLICKEY 184
#define ASN1_F_I2D_RSAPRIVATEKEY 185
#define ASN1_F_I2D_RSAPUBLICKEY 186
#define ASN1_F_I2D_RSA_PUBKEY 289
#define ASN1_F_I2D_X509_ATTRIBUTE 187
#define ASN1_F_I2T_ASN1_OBJECT 188
#define ASN1_F_NETSCAPE_CERT_SEQUENCE_NEW 229
@ -832,6 +943,7 @@ ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
#define ASN1_F_NETSCAPE_SPKAC_NEW 190
#define ASN1_F_NETSCAPE_SPKI_NEW 191
#define ASN1_F_NOTICEREF_NEW 272
#define ASN1_F_OTHERNAME_NEW 288
#define ASN1_F_PBE2PARAM_NEW 264
#define ASN1_F_PBEPARAM_NEW 251
#define ASN1_F_PBKDF2PARAM_NEW 265
@ -859,6 +971,7 @@ ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
#define ASN1_F_USERNOTICE_NEW 275
#define ASN1_F_X509_ALGOR_NEW 202
#define ASN1_F_X509_ATTRIBUTE_NEW 203
#define ASN1_F_X509_CERT_AUX_NEW 286
#define ASN1_F_X509_CINF_NEW 204
#define ASN1_F_X509_CRL_INFO_NEW 205
#define ASN1_F_X509_CRL_NEW 206
@ -889,6 +1002,7 @@ ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
#define ASN1_R_BN_LIB 107
#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 108
#define ASN1_R_BUFFER_TOO_SMALL 109
#define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 166
#define ASN1_R_DATA_IS_WRONG 110
#define ASN1_R_DECODE_ERROR 155
#define ASN1_R_DECODING_ERROR 111
@ -902,24 +1016,31 @@ ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
#define ASN1_R_EXPECTING_A_BIT_STRING 116
#define ASN1_R_EXPECTING_A_BOOLEAN 117
#define ASN1_R_EXPECTING_A_GENERALIZEDTIME 151
#define ASN1_R_EXPECTING_A_NULL 164
#define ASN1_R_EXPECTING_A_TIME 152
#define ASN1_R_EXPECTING_A_UTCTIME 118
#define ASN1_R_FIRST_NUM_TOO_LARGE 119
#define ASN1_R_GENERALIZEDTIME_TOO_LONG 153
#define ASN1_R_HEADER_TOO_LONG 120
#define ASN1_R_ILLEGAL_CHARACTERS 158
#define ASN1_R_INVALID_BMPSTRING_LENGTH 159
#define ASN1_R_INVALID_DIGIT 121
#define ASN1_R_INVALID_SEPARATOR 122
#define ASN1_R_INVALID_TIME_FORMAT 123
#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 160
#define ASN1_R_INVALID_UTF8STRING 161
#define ASN1_R_IV_TOO_LARGE 124
#define ASN1_R_LENGTH_ERROR 125
#define ASN1_R_MISSING_SECOND_NUMBER 126
#define ASN1_R_NON_HEX_CHARACTERS 127
#define ASN1_R_NOT_ENOUGH_DATA 128
#define ASN1_R_NULL_IS_WRONG_LENGTH 165
#define ASN1_R_ODD_NUMBER_OF_CHARS 129
#define ASN1_R_PARSING 130
#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 131
#define ASN1_R_SECOND_NUMBER_TOO_LARGE 132
#define ASN1_R_SHORT_LINE 133
#define ASN1_R_STRING_TOO_LONG 163
#define ASN1_R_STRING_TOO_SHORT 134
#define ASN1_R_TAG_VALUE_TOO_HIGH 135
#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 136
@ -927,6 +1048,7 @@ ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 138
#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 139
#define ASN1_R_UNKNOWN_ATTRIBUTE_TYPE 140
#define ASN1_R_UNKNOWN_FORMAT 162
#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 141
#define ASN1_R_UNKNOWN_OBJECT_TYPE 142
#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 143

View File

@ -54,7 +54,8 @@
*/
/* NOTE: this file was auto generated by the mkerr.pl script: any changes
* made to it will be overwritten when the script next updates this file.
* made to it will be overwritten when the script next updates this file,
* only reason strings will be preserved.
*/
#include <stdio.h>
@ -69,19 +70,21 @@ static ERR_STRING_DATA ASN1_str_functs[]=
{ERR_PACK(0,ASN1_F_A2I_ASN1_ENUMERATED,0), "a2i_ASN1_ENUMERATED"},
{ERR_PACK(0,ASN1_F_A2I_ASN1_INTEGER,0), "a2i_ASN1_INTEGER"},
{ERR_PACK(0,ASN1_F_A2I_ASN1_STRING,0), "a2i_ASN1_STRING"},
{ERR_PACK(0,ASN1_F_ACCESS_DESCRIPTION_NEW,0), "ACCESS_DESCRIPTION_new"},
{ERR_PACK(0,ASN1_F_ASN1_COLLATE_PRIMITIVE,0), "ASN1_COLLATE_PRIMITIVE"},
{ERR_PACK(0,ASN1_F_ASN1_D2I_BIO,0), "ASN1_d2i_bio"},
{ERR_PACK(0,ASN1_F_ASN1_D2I_FP,0), "ASN1_d2i_fp"},
{ERR_PACK(0,ASN1_F_ASN1_DUP,0), "ASN1_dup"},
{ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_SET,0), "ASN1_ENUMERATED_set"},
{ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_TO_BN,0), "ASN1_ENUMERATED_to_BN"},
{ERR_PACK(0,ASN1_F_ASN1_GENERALIZEDTIME_NEW,0), "ASN1_GENERALIZEDTIME_NEW"},
{ERR_PACK(0,ASN1_F_ASN1_GENERALIZEDTIME_NEW,0), "ASN1_GENERALIZEDTIME_new"},
{ERR_PACK(0,ASN1_F_ASN1_GET_OBJECT,0), "ASN1_get_object"},
{ERR_PACK(0,ASN1_F_ASN1_HEADER_NEW,0), "ASN1_HEADER_new"},
{ERR_PACK(0,ASN1_F_ASN1_I2D_BIO,0), "ASN1_i2d_bio"},
{ERR_PACK(0,ASN1_F_ASN1_I2D_FP,0), "ASN1_i2d_fp"},
{ERR_PACK(0,ASN1_F_ASN1_INTEGER_SET,0), "ASN1_INTEGER_set"},
{ERR_PACK(0,ASN1_F_ASN1_INTEGER_TO_BN,0), "ASN1_INTEGER_to_BN"},
{ERR_PACK(0,ASN1_F_ASN1_MBSTRING_COPY,0), "ASN1_mbstring_copy"},
{ERR_PACK(0,ASN1_F_ASN1_OBJECT_NEW,0), "ASN1_OBJECT_new"},
{ERR_PACK(0,ASN1_F_ASN1_PACK_STRING,0), "ASN1_pack_string"},
{ERR_PACK(0,ASN1_F_ASN1_PBE_SET,0), "ASN1_PBE_SET"},
@ -89,17 +92,19 @@ static ERR_STRING_DATA ASN1_str_functs[]=
{ERR_PACK(0,ASN1_F_ASN1_SEQ_UNPACK,0), "ASN1_seq_unpack"},
{ERR_PACK(0,ASN1_F_ASN1_SIGN,0), "ASN1_sign"},
{ERR_PACK(0,ASN1_F_ASN1_STRING_NEW,0), "ASN1_STRING_new"},
{ERR_PACK(0,ASN1_F_ASN1_STRING_TABLE_ADD,0), "ASN1_STRING_TABLE_add"},
{ERR_PACK(0,ASN1_F_ASN1_STRING_TYPE_NEW,0), "ASN1_STRING_type_new"},
{ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,0), "ASN1_TYPE_get_int_octetstring"},
{ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_OCTETSTRING,0), "ASN1_TYPE_get_octetstring"},
{ERR_PACK(0,ASN1_F_ASN1_TYPE_NEW,0), "ASN1_TYPE_new"},
{ERR_PACK(0,ASN1_F_ASN1_UNPACK_STRING,0), "ASN1_unpack_string"},
{ERR_PACK(0,ASN1_F_ASN1_UTCTIME_NEW,0), "ASN1_UTCTIME_NEW"},
{ERR_PACK(0,ASN1_F_ASN1_UTCTIME_NEW,0), "ASN1_UTCTIME_new"},
{ERR_PACK(0,ASN1_F_ASN1_VERIFY,0), "ASN1_verify"},
{ERR_PACK(0,ASN1_F_AUTHORITY_KEYID_NEW,0), "AUTHORITY_KEYID_new"},
{ERR_PACK(0,ASN1_F_BASIC_CONSTRAINTS_NEW,0), "BASIC_CONSTRAINTS_new"},
{ERR_PACK(0,ASN1_F_BN_TO_ASN1_ENUMERATED,0), "BN_to_ASN1_ENUMERATED"},
{ERR_PACK(0,ASN1_F_BN_TO_ASN1_INTEGER,0), "BN_to_ASN1_INTEGER"},
{ERR_PACK(0,ASN1_F_D2I_ACCESS_DESCRIPTION,0), "d2i_ACCESS_DESCRIPTION"},
{ERR_PACK(0,ASN1_F_D2I_ASN1_BIT_STRING,0), "d2i_ASN1_BIT_STRING"},
{ERR_PACK(0,ASN1_F_D2I_ASN1_BMPSTRING,0), "d2i_ASN1_BMPSTRING"},
{ERR_PACK(0,ASN1_F_D2I_ASN1_BOOLEAN,0), "d2i_ASN1_BOOLEAN"},
@ -108,6 +113,7 @@ static ERR_STRING_DATA ASN1_str_functs[]=
{ERR_PACK(0,ASN1_F_D2I_ASN1_GENERALIZEDTIME,0), "d2i_ASN1_GENERALIZEDTIME"},
{ERR_PACK(0,ASN1_F_D2I_ASN1_HEADER,0), "d2i_ASN1_HEADER"},
{ERR_PACK(0,ASN1_F_D2I_ASN1_INTEGER,0), "d2i_ASN1_INTEGER"},
{ERR_PACK(0,ASN1_F_D2I_ASN1_NULL,0), "d2i_ASN1_NULL"},
{ERR_PACK(0,ASN1_F_D2I_ASN1_OBJECT,0), "d2i_ASN1_OBJECT"},
{ERR_PACK(0,ASN1_F_D2I_ASN1_OCTET_STRING,0), "d2i_ASN1_OCTET_STRING"},
{ERR_PACK(0,ASN1_F_D2I_ASN1_PRINT_TYPE,0), "D2I_ASN1_PRINT_TYPE"},
@ -135,6 +141,7 @@ static ERR_STRING_DATA ASN1_str_functs[]=
{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_SPKAC,0), "d2i_NETSCAPE_SPKAC"},
{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_SPKI,0), "d2i_NETSCAPE_SPKI"},
{ERR_PACK(0,ASN1_F_D2I_NOTICEREF,0), "d2i_NOTICEREF"},
{ERR_PACK(0,ASN1_F_D2I_OTHERNAME,0), "d2i_OTHERNAME"},
{ERR_PACK(0,ASN1_F_D2I_PBE2PARAM,0), "d2i_PBE2PARAM"},
{ERR_PACK(0,ASN1_F_D2I_PBEPARAM,0), "d2i_PBEPARAM"},
{ERR_PACK(0,ASN1_F_D2I_PBKDF2PARAM,0), "d2i_PBKDF2PARAM"},
@ -166,6 +173,7 @@ static ERR_STRING_DATA ASN1_str_functs[]=
{ERR_PACK(0,ASN1_F_D2I_X509,0), "d2i_X509"},
{ERR_PACK(0,ASN1_F_D2I_X509_ALGOR,0), "d2i_X509_ALGOR"},
{ERR_PACK(0,ASN1_F_D2I_X509_ATTRIBUTE,0), "d2i_X509_ATTRIBUTE"},
{ERR_PACK(0,ASN1_F_D2I_X509_CERT_AUX,0), "d2i_X509_CERT_AUX"},
{ERR_PACK(0,ASN1_F_D2I_X509_CINF,0), "d2i_X509_CINF"},
{ERR_PACK(0,ASN1_F_D2I_X509_CRL,0), "d2i_X509_CRL"},
{ERR_PACK(0,ASN1_F_D2I_X509_CRL_INFO,0), "d2i_X509_CRL_INFO"},
@ -189,12 +197,14 @@ static ERR_STRING_DATA ASN1_str_functs[]=
{ERR_PACK(0,ASN1_F_I2D_DSAPARAMS,0), "i2d_DSAparams"},
{ERR_PACK(0,ASN1_F_I2D_DSAPRIVATEKEY,0), "i2d_DSAPrivateKey"},
{ERR_PACK(0,ASN1_F_I2D_DSAPUBLICKEY,0), "i2d_DSAPublicKey"},
{ERR_PACK(0,ASN1_F_I2D_DSA_PUBKEY,0), "i2d_DSA_PUBKEY"},
{ERR_PACK(0,ASN1_F_I2D_NETSCAPE_RSA,0), "i2d_Netscape_RSA"},
{ERR_PACK(0,ASN1_F_I2D_PKCS7,0), "i2d_PKCS7"},
{ERR_PACK(0,ASN1_F_I2D_PRIVATEKEY,0), "i2d_PrivateKey"},
{ERR_PACK(0,ASN1_F_I2D_PUBLICKEY,0), "i2d_PublicKey"},
{ERR_PACK(0,ASN1_F_I2D_RSAPRIVATEKEY,0), "i2d_RSAPrivateKey"},
{ERR_PACK(0,ASN1_F_I2D_RSAPUBLICKEY,0), "i2d_RSAPublicKey"},
{ERR_PACK(0,ASN1_F_I2D_RSA_PUBKEY,0), "i2d_RSA_PUBKEY"},
{ERR_PACK(0,ASN1_F_I2D_X509_ATTRIBUTE,0), "i2d_X509_ATTRIBUTE"},
{ERR_PACK(0,ASN1_F_I2T_ASN1_OBJECT,0), "i2t_ASN1_OBJECT"},
{ERR_PACK(0,ASN1_F_NETSCAPE_CERT_SEQUENCE_NEW,0), "NETSCAPE_CERT_SEQUENCE_new"},
@ -202,6 +212,7 @@ static ERR_STRING_DATA ASN1_str_functs[]=
{ERR_PACK(0,ASN1_F_NETSCAPE_SPKAC_NEW,0), "NETSCAPE_SPKAC_new"},
{ERR_PACK(0,ASN1_F_NETSCAPE_SPKI_NEW,0), "NETSCAPE_SPKI_new"},
{ERR_PACK(0,ASN1_F_NOTICEREF_NEW,0), "NOTICEREF_new"},
{ERR_PACK(0,ASN1_F_OTHERNAME_NEW,0), "OTHERNAME_new"},
{ERR_PACK(0,ASN1_F_PBE2PARAM_NEW,0), "PBE2PARAM_new"},
{ERR_PACK(0,ASN1_F_PBEPARAM_NEW,0), "PBEPARAM_new"},
{ERR_PACK(0,ASN1_F_PBKDF2PARAM_NEW,0), "PBKDF2PARAM_new"},
@ -229,6 +240,7 @@ static ERR_STRING_DATA ASN1_str_functs[]=
{ERR_PACK(0,ASN1_F_USERNOTICE_NEW,0), "USERNOTICE_new"},
{ERR_PACK(0,ASN1_F_X509_ALGOR_NEW,0), "X509_ALGOR_new"},
{ERR_PACK(0,ASN1_F_X509_ATTRIBUTE_NEW,0), "X509_ATTRIBUTE_new"},
{ERR_PACK(0,ASN1_F_X509_CERT_AUX_NEW,0), "X509_CERT_AUX_new"},
{ERR_PACK(0,ASN1_F_X509_CINF_NEW,0), "X509_CINF_new"},
{ERR_PACK(0,ASN1_F_X509_CRL_INFO_NEW,0), "X509_CRL_INFO_new"},
{ERR_PACK(0,ASN1_F_X509_CRL_NEW,0), "X509_CRL_new"},
@ -262,6 +274,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
{ASN1_R_BN_LIB ,"bn lib"},
{ASN1_R_BOOLEAN_IS_WRONG_LENGTH ,"boolean is wrong length"},
{ASN1_R_BUFFER_TOO_SMALL ,"buffer too small"},
{ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER ,"cipher has no object identifier"},
{ASN1_R_DATA_IS_WRONG ,"data is wrong"},
{ASN1_R_DECODE_ERROR ,"decode error"},
{ASN1_R_DECODING_ERROR ,"decoding error"},
@ -275,24 +288,31 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
{ASN1_R_EXPECTING_A_BIT_STRING ,"expecting a bit string"},
{ASN1_R_EXPECTING_A_BOOLEAN ,"expecting a boolean"},
{ASN1_R_EXPECTING_A_GENERALIZEDTIME ,"expecting a generalizedtime"},
{ASN1_R_EXPECTING_A_NULL ,"expecting a null"},
{ASN1_R_EXPECTING_A_TIME ,"expecting a time"},
{ASN1_R_EXPECTING_A_UTCTIME ,"expecting a utctime"},
{ASN1_R_FIRST_NUM_TOO_LARGE ,"first num too large"},
{ASN1_R_GENERALIZEDTIME_TOO_LONG ,"generalizedtime too long"},
{ASN1_R_HEADER_TOO_LONG ,"header too long"},
{ASN1_R_ILLEGAL_CHARACTERS ,"illegal characters"},
{ASN1_R_INVALID_BMPSTRING_LENGTH ,"invalid bmpstring length"},
{ASN1_R_INVALID_DIGIT ,"invalid digit"},
{ASN1_R_INVALID_SEPARATOR ,"invalid separator"},
{ASN1_R_INVALID_TIME_FORMAT ,"invalid time format"},
{ASN1_R_INVALID_UNIVERSALSTRING_LENGTH ,"invalid universalstring length"},
{ASN1_R_INVALID_UTF8STRING ,"invalid utf8string"},
{ASN1_R_IV_TOO_LARGE ,"iv too large"},
{ASN1_R_LENGTH_ERROR ,"length error"},
{ASN1_R_MISSING_SECOND_NUMBER ,"missing second number"},
{ASN1_R_NON_HEX_CHARACTERS ,"non hex characters"},
{ASN1_R_NOT_ENOUGH_DATA ,"not enough data"},
{ASN1_R_NULL_IS_WRONG_LENGTH ,"null is wrong length"},
{ASN1_R_ODD_NUMBER_OF_CHARS ,"odd number of chars"},
{ASN1_R_PARSING ,"parsing"},
{ASN1_R_PRIVATE_KEY_HEADER_MISSING ,"private key header missing"},
{ASN1_R_SECOND_NUMBER_TOO_LARGE ,"second number too large"},
{ASN1_R_SHORT_LINE ,"short line"},
{ASN1_R_STRING_TOO_LONG ,"string too long"},
{ASN1_R_STRING_TOO_SHORT ,"string too short"},
{ASN1_R_TAG_VALUE_TOO_HIGH ,"tag value too high"},
{ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD,"the asn1 object identifier is not known for this md"},
@ -300,6 +320,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
{ASN1_R_UNABLE_TO_DECODE_RSA_KEY ,"unable to decode rsa key"},
{ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY ,"unable to decode rsa private key"},
{ASN1_R_UNKNOWN_ATTRIBUTE_TYPE ,"unknown attribute type"},
{ASN1_R_UNKNOWN_FORMAT ,"unknown format"},
{ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM ,"unknown message digest algorithm"},
{ASN1_R_UNKNOWN_OBJECT_TYPE ,"unknown object type"},
{ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE ,"unknown public key type"},

View File

@ -176,7 +176,7 @@ static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max)
}
/* class 0 is constructed
* constructed == 2 for indefinitle length constructed */
* constructed == 2 for indefinite length constructed */
void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag,
int xclass)
{
@ -349,7 +349,7 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
if (data != NULL)
{
memcpy(str->data,data,len);
/* an alowance for strings :-) */
/* an allowance for strings :-) */
str->data[len]='\0';
}
return(1);
@ -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((char *)a->data);
Free((char *)a);
if (a->data != NULL) Free(a->data);
Free(a);
}
int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b)
@ -411,3 +411,14 @@ void asn1_add_error(unsigned char *address, int offset)
ERR_add_error_data(4,"address=",buf1," offset=",buf2);
}
int ASN1_STRING_length(ASN1_STRING *x)
{ return M_ASN1_STRING_length(x); }
void ASN1_STRING_length_set(ASN1_STRING *x, int len)
{ M_ASN1_STRING_length_set(x, len); return; }
int ASN1_STRING_type(ASN1_STRING *x)
{ return M_ASN1_STRING_type(x); }
unsigned char * ASN1_STRING_data(ASN1_STRING *x)
{ return M_ASN1_STRING_data(x); }

View File

@ -106,6 +106,20 @@ err:\
#define M_ASN1_D2I_start_sequence() \
if (!asn1_GetSequence(&c,&length)) \
{ c.line=__LINE__; goto err; }
/* Begin reading ASN1 without a surrounding sequence */
#define M_ASN1_D2I_begin() \
c.slen = length;
/* End reading ASN1 with no check on length */
#define M_ASN1_D2I_Finish_nolen(a, func, e) \
*pp=c.p; \
if (a != NULL) (*a)=ret; \
return(ret); \
err:\
ASN1_MAC_H_err((e),c.error,c.line); \
asn1_add_error(*pp,(int)(c.q- *pp)); \
if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \
return(NULL)
#define M_ASN1_D2I_end_sequence() \
(((c.inf&1) == 0)?(c.slen <= 0): \

View File

@ -93,55 +93,8 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
sprintf(str,"cont [ %d ]",tag);
else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION)
sprintf(str,"appl [ %d ]",tag);
else if ((tag == V_ASN1_EOC) /* && (xclass == V_ASN1_UNIVERSAL) */)
p="EOC";
else if (tag == V_ASN1_BOOLEAN)
p="BOOLEAN";
else if (tag == V_ASN1_INTEGER)
p="INTEGER";
else if (tag == V_ASN1_ENUMERATED)
p="ENUMERATED";
else if (tag == V_ASN1_BIT_STRING)
p="BIT STRING";
else if (tag == V_ASN1_OCTET_STRING)
p="OCTET STRING";
else if (tag == V_ASN1_NULL)
p="NULL";
else if (tag == V_ASN1_OBJECT)
p="OBJECT";
else if (tag == V_ASN1_SEQUENCE)
p="SEQUENCE";
else if (tag == V_ASN1_SET)
p="SET";
else if (tag == V_ASN1_PRINTABLESTRING)
p="PRINTABLESTRING";
else if (tag == V_ASN1_T61STRING)
p="T61STRING";
else if (tag == V_ASN1_IA5STRING)
p="IA5STRING";
else if (tag == V_ASN1_UTCTIME)
p="UTCTIME";
else p = ASN1_tag2str(tag);
/* extras */
else if (tag == V_ASN1_NUMERICSTRING)
p="NUMERICSTRING";
else if (tag == V_ASN1_VIDEOTEXSTRING)
p="VIDEOTEXSTRING";
else if (tag == V_ASN1_GENERALIZEDTIME)
p="GENERALIZEDTIME";
else if (tag == V_ASN1_GRAPHICSTRING)
p="GRAPHICSTRING";
else if (tag == V_ASN1_VISIBLESTRING)
p="VISIBLESTRING";
else if (tag == V_ASN1_GENERALSTRING)
p="GENERALSTRING";
else if (tag == V_ASN1_UNIVERSALSTRING)
p="UNIVERSALSTRING";
else if (tag == V_ASN1_BMPSTRING)
p="BMPSTRING";
else
p2="(unknown)";
if (p2 != NULL)
{
if (BIO_printf(bp,fmt2,tag,p2) <= 0) goto err;
@ -320,7 +273,7 @@ static int asn1_parse2(BIO *bp, unsigned char **pp, long length, int offset,
os->length) <= 0)
goto end;
}
ASN1_OCTET_STRING_free(os);
M_ASN1_OCTET_STRING_free(os);
os=NULL;
}
}
@ -354,7 +307,7 @@ static int asn1_parse2(BIO *bp, unsigned char **pp, long length, int offset,
if (BIO_write(bp,"BAD INTEGER",11) <= 0)
goto end;
}
ASN1_INTEGER_free(bs);
M_ASN1_INTEGER_free(bs);
}
else if (tag == V_ASN1_ENUMERATED)
{
@ -386,7 +339,7 @@ static int asn1_parse2(BIO *bp, unsigned char **pp, long length, int offset,
if (BIO_write(bp,"BAD ENUMERATED",11) <= 0)
goto end;
}
ASN1_ENUMERATED_free(bs);
M_ASN1_ENUMERATED_free(bs);
}
if (!nl)
@ -405,7 +358,28 @@ static int asn1_parse2(BIO *bp, unsigned char **pp, long length, int offset,
ret=1;
end:
if (o != NULL) ASN1_OBJECT_free(o);
if (os != NULL) ASN1_OCTET_STRING_free(os);
if (os != NULL) M_ASN1_OCTET_STRING_free(os);
*pp=p;
return(ret);
}
const char *ASN1_tag2str(int tag)
{
const static char *tag2str[] = {
"EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING", /* 0-4 */
"NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL", /* 5-9 */
"ENUMERATED", "<ASN1 11>", "UTF8STRING", "<ASN1 13>", /* 10-13 */
"<ASN1 14>", "<ASN1 15>", "SEQUENCE", "SET", /* 15-17 */
"NUMERICSTRING", "PRINTABLESTRING", "T61STRING", /* 18-20 */
"VIDEOTEXSTRING", "IA5STRING", "UTCTIME","GENERALIZEDTIME", /* 21-24 */
"GRAPHICSTRING", "VISIBLESTRING", "GENERALSTRING", /* 25-27 */
"UNIVERSALSTRING", "<ASN1 29>", "BMPSTRING" /* 28-30 */
};
if((tag == V_ASN1_NEG_INTEGER) || (tag == V_ASN1_NEG_ENUMERATED))
tag &= ~0x100;
if(tag < 0 || tag > 30) return "(unknown)";
return tag2str[tag];
}

View File

@ -86,7 +86,7 @@ DH *d2i_DHparams(DH **a, unsigned char **pp, long length)
ret->length=(int)v;
}
ASN1_BIT_STRING_free(bs);
M_ASN1_BIT_STRING_free(bs);
M_ASN1_D2I_Finish_2(a);
@ -95,7 +95,7 @@ DH *d2i_DHparams(DH **a, unsigned char **pp, long length)
err:
ASN1err(ASN1_F_D2I_DHPARAMS,i);
if ((ret != NULL) && ((a == NULL) || (*a != ret))) DH_free(ret);
if (bs != NULL) ASN1_BIT_STRING_free(bs);
if (bs != NULL) M_ASN1_BIT_STRING_free(bs);
return(NULL);
}
#endif

View File

@ -83,7 +83,7 @@ DSA *d2i_DSAparams(DSA **a, unsigned char **pp, long length)
M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
if ((ret->g=BN_bin2bn(bs->data,bs->length,ret->g)) == NULL) goto err_bn;
ASN1_BIT_STRING_free(bs);
M_ASN1_BIT_STRING_free(bs);
M_ASN1_D2I_Finish_2(a);
@ -92,7 +92,7 @@ DSA *d2i_DSAparams(DSA **a, unsigned char **pp, long length)
err:
ASN1err(ASN1_F_D2I_DSAPARAMS,i);
if ((ret != NULL) && ((a == NULL) || (*a != ret))) DSA_free(ret);
if (bs != NULL) ASN1_BIT_STRING_free(bs);
if (bs != NULL) M_ASN1_BIT_STRING_free(bs);
return(NULL);
}
#endif

View File

@ -112,3 +112,26 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, unsigned char **pp,
return(NULL);
}
/* This works like d2i_PrivateKey() except it automatically works out the type */
EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, unsigned char **pp,
long length)
{
STACK_OF(ASN1_TYPE) *inkey;
unsigned char *p;
int keytype;
p = *pp;
/* Dirty trick: read in the ASN1 data into a STACK_OF(ASN1_TYPE):
* by analyzing it we can determine the passed structure: this
* assumes the input is surrounded by an ASN1 SEQUENCE.
*/
inkey = d2i_ASN1_SET_OF_ASN1_TYPE(NULL, &p, length, d2i_ASN1_TYPE,
ASN1_TYPE_free, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL);
/* Since we only need to discern "traditional format" RSA and DSA
* keys we can just count the elements.
*/
if(sk_ASN1_TYPE_num(inkey) == 6) keytype = EVP_PKEY_DSA;
else keytype = EVP_PKEY_RSA;
sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
return d2i_PrivateKey(keytype, a, pp, length);
}

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