This commit is contained in:
Zhi Guan
2015-08-15 15:02:15 +08:00
parent 06df2fab54
commit 3bdc0ea895
2536 changed files with 417052 additions and 271997 deletions

View File

@@ -10,13 +10,18 @@ OpenSSL project.
We would like to identify and thank the following such sponsors for their past We would like to identify and thank the following such sponsors for their past
or current significant support of the OpenSSL project: or current significant support of the OpenSSL project:
Major support:
Qualys http://www.qualys.com/
Very significant support: Very significant support:
OpenGear: www.opengear.com OpenGear: http://www.opengear.com/
Significant support: Significant support:
PSW Group: www.psw.net PSW Group: http://www.psw.net/
Acano Ltd. http://acano.com/
Please note that we ask permission to identify sponsors and that some sponsors Please note that we ask permission to identify sponsors and that some sponsors
we consider eligible for inclusion here have requested to remain anonymous. we consider eligible for inclusion here have requested to remain anonymous.

1544
CHANGES

File diff suppressed because it is too large Load Diff

505
Configure
View File

@@ -10,7 +10,7 @@ use strict;
# see INSTALL for instructions. # see INSTALL for instructions.
my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimental-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]\n"; my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimental-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]\n";
# Options: # Options:
# #
@@ -56,6 +56,7 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimenta
# [no-]zlib [don't] compile support for zlib compression. # [no-]zlib [don't] compile support for zlib compression.
# zlib-dynamic Like "zlib", but the zlib library is expected to be a shared # zlib-dynamic Like "zlib", but the zlib library is expected to be a shared
# library and will be loaded in run-time by the OpenSSL library. # library and will be loaded in run-time by the OpenSSL library.
# sctp include SCTP support
# 386 generate 80386 code # 386 generate 80386 code
# no-sse2 disables IA-32 SSE2 code, above option implies no-sse2 # no-sse2 disables IA-32 SSE2 code, above option implies no-sse2
# no-<cipher> build without specified algorithm (rsa, idea, rc5, ...) # no-<cipher> build without specified algorithm (rsa, idea, rc5, ...)
@@ -104,6 +105,25 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimenta
my $gcc_devteam_warn = "-Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED"; my $gcc_devteam_warn = "-Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED";
# TODO(openssl-team): fix problems and investigate if (at least) the following
# warnings can also be enabled:
# -Wconditional-uninitialized, -Wswitch-enum, -Wunused-macros,
# -Wmissing-field-initializers, -Wmissing-variable-declarations,
# -Wincompatible-pointer-types-discards-qualifiers, -Wcast-align,
# -Wunreachable-code -Wunused-parameter -Wlanguage-extension-token
# -Wextended-offsetof
my $clang_disabled_warnings = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof";
# These are used in addition to $gcc_devteam_warn when the compiler is clang.
# TODO(openssl-team): fix problems and investigate if (at least) the
# following warnings can also be enabled: -Wconditional-uninitialized,
# -Wswitch-enum, -Wunused-macros, -Wmissing-field-initializers,
# -Wmissing-variable-declarations,
# -Wincompatible-pointer-types-discards-qualifiers, -Wcast-align,
# -Wunreachable-code -Wunused-parameter -Wlanguage-extension-token
# -Wextended-offsetof
my $clang_devteam_warn = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof -Qunused-arguments";
my $strict_warnings = 0; my $strict_warnings = 0;
my $x86_gcc_des="DES_PTR DES_RISC1 DES_UNROLL"; my $x86_gcc_des="DES_PTR DES_RISC1 DES_UNROLL";
@@ -123,21 +143,25 @@ my $tlib="-lnsl -lsocket";
my $bits1="THIRTY_TWO_BIT "; my $bits1="THIRTY_TWO_BIT ";
my $bits2="SIXTY_FOUR_BIT "; my $bits2="SIXTY_FOUR_BIT ";
my $x86_asm="x86cpuid.o:bn-586.o co-586.o x86-mont.o:des-586.o crypt586.o:aes-586.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o:cmll-x86.o"; my $x86_asm="x86cpuid.o:bn-586.o co-586.o x86-mont.o x86-gf2m.o::des-586.o crypt586.o:aes-586.o vpaes-x86.o aesni-x86.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o:cmll-x86.o:ghash-x86.o:";
my $x86_elf_asm="$x86_asm:elf"; my $x86_elf_asm="$x86_asm:elf";
my $x86_64_asm="x86_64cpuid.o:x86_64-gcc.o x86_64-mont.o::aes-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o::rc4-x86_64.o:::wp-x86_64.o:cmll-x86_64.o cmll_misc.o"; my $x86_64_asm="x86_64cpuid.o:x86_64-gcc.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o rsaz_exp.o rsaz-x86_64.o rsaz-avx2.o:ecp_nistz256.o ecp_nistz256-x86_64.o::aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o aesni-sha256-x86_64.o aesni-mb-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o sha1-mb-x86_64.o sha256-mb-x86_64.o::rc4-x86_64.o rc4-md5-x86_64.o:::wp-x86_64.o:cmll-x86_64.o cmll_misc.o:ghash-x86_64.o aesni-gcm-x86_64.o:";
my $ia64_asm="ia64cpuid.o:bn-ia64.o::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o::rc4-ia64.o rc4_skey.o:::::void"; my $ia64_asm="ia64cpuid.o:bn-ia64.o ia64-mont.o:::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o::rc4-ia64.o rc4_skey.o:::::ghash-ia64.o::void";
my $sparcv9_asm="sparcv9cap.o sparccpuid.o:bn-sparcv9.o sparcv9-mont.o sparcv9a-mont.o:des_enc-sparc.o fcrypt_b.o:aes_core.o aes_cbc.o aes-sparcv9.o:::sha1-sparcv9.o sha256-sparcv9.o sha512-sparcv9.o:::::::void"; my $sparcv9_asm="sparcv9cap.o sparccpuid.o:bn-sparcv9.o sparcv9-mont.o sparcv9a-mont.o vis3-mont.o sparct4-mont.o sparcv9-gf2m.o::des_enc-sparc.o fcrypt_b.o dest4-sparcv9.o:aes_core.o aes_cbc.o aes-sparcv9.o aest4-sparcv9.o::md5-sparcv9.o:sha1-sparcv9.o sha256-sparcv9.o sha512-sparcv9.o::::::camellia.o cmll_misc.o cmll_cbc.o cmllt4-sparcv9.o:ghash-sparcv9.o::void";
my $sparcv8_asm=":sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::::void"; my $sparcv8_asm=":sparcv8.o::des_enc-sparc.o fcrypt_b.o:::::::::::::void";
my $alpha_asm="alphacpuid.o:bn_asm.o alpha-mont.o::::::::::::void"; my $alpha_asm="alphacpuid.o:bn_asm.o alpha-mont.o::::::sha1-alpha.o:::::::ghash-alpha.o::void";
my $mips3_asm=":bn-mips3.o::::::::::::void"; my $mips64_asm=":bn-mips.o mips-mont.o:::aes_cbc.o aes-mips.o:::sha1-mips.o sha256-mips.o sha512-mips.o::::::::";
my $s390x_asm="s390xcap.o s390xcpuid.o:bn-s390x.o s390x-mont.o::aes-s390x.o:::sha1-s390x.o sha256-s390x.o sha512-s390x.o::rc4-s390x.o:::::void"; my $mips32_asm=$mips64_asm; $mips32_asm =~ s/\s*sha512\-mips\.o//;
my $armv4_asm=":bn_asm.o armv4-mont.o::aes_cbc.o aes-armv4.o:::sha1-armv4-large.o sha256-armv4.o sha512-armv4.o:::::::void"; my $s390x_asm="s390xcap.o s390xcpuid.o:bn-s390x.o s390x-mont.o s390x-gf2m.o:::aes-s390x.o aes-ctr.o aes-xts.o:::sha1-s390x.o sha256-s390x.o sha512-s390x.o::rc4-s390x.o:::::ghash-s390x.o:";
my $ppc32_asm="ppccpuid.o:bn-ppc.o::aes_core.o aes_cbc.o aes-ppc.o:::sha1-ppc.o sha256-ppc.o::::::"; my $armv4_asm="armcap.o armv4cpuid.o:bn_asm.o armv4-mont.o armv4-gf2m.o:::aes_cbc.o aes-armv4.o bsaes-armv7.o aesv8-armx.o:::sha1-armv4-large.o sha256-armv4.o sha512-armv4.o:::::::ghash-armv4.o ghashv8-armx.o::void";
my $ppc64_asm="ppccpuid.o:bn-ppc.o ppc-mont.o::aes_core.o aes_cbc.o aes-ppc.o:::sha1-ppc.o sha256-ppc.o sha512-ppc.o::::::"; my $aarch64_asm="armcap.o arm64cpuid.o mem_clr.o::::aes_core.o aes_cbc.o aesv8-armx.o:::sha1-armv8.o sha256-armv8.o sha512-armv8.o:::::::ghashv8-armx.o:";
my $no_asm=":::::::::::::void"; my $parisc11_asm="pariscid.o:bn_asm.o parisc-mont.o:::aes_core.o aes_cbc.o aes-parisc.o:::sha1-parisc.o sha256-parisc.o sha512-parisc.o::rc4-parisc.o:::::ghash-parisc.o::32";
my $parisc20_asm="pariscid.o:pa-risc2W.o parisc-mont.o:::aes_core.o aes_cbc.o aes-parisc.o:::sha1-parisc.o sha256-parisc.o sha512-parisc.o::rc4-parisc.o:::::ghash-parisc.o::64";
my $ppc64_asm="ppccpuid.o ppccap.o:bn-ppc.o ppc-mont.o ppc64-mont.o:::aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o:::sha1-ppc.o sha256-ppc.o sha512-ppc.o sha256p8-ppc.o sha512p8-ppc.o:::::::ghashp8-ppc.o:";
my $ppc32_asm=$ppc64_asm;
my $no_asm="::::::::::::::::void";
# As for $BSDthreads. Idea is to maintain "collective" set of flags, # As for $BSDthreads. Idea is to maintain "collective" set of flags,
# which would cover all BSD flavors. -pthread applies to them all, # which would cover all BSD flavors. -pthread applies to them all,
@@ -148,7 +172,7 @@ my $no_asm=":::::::::::::void";
# seems to be sufficient? # seems to be sufficient?
my $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT"; my $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT";
#config-string $cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags : $bn_ops : $cpuid_obj : $bn_obj : $des_obj : $aes_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $wp_obj : $cmll_obj : $dso_scheme : $shared_target : $shared_cflag : $shared_ldflag : $shared_extension : $ranlib : $arflags : $multilib #config-string $cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags : $bn_ops : $cpuid_obj : $bn_obj : $ec_obj : $des_obj : $aes_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $wp_obj : $cmll_obj : $modes_obj : $engines_obj : $dso_scheme : $shared_target : $shared_cflag : $shared_ldflag : $shared_extension : $ranlib : $arflags : $multilib
my %table=( my %table=(
# File 'TABLE' (created by 'make TABLE') contains the data from this list, # File 'TABLE' (created by 'make TABLE') contains the data from this list,
@@ -163,32 +187,36 @@ my %table=(
# Our development configs # Our development configs
"purify", "purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::", "purify", "purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::",
"debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror::(unknown)::-lefence::::", "debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror::(unknown)::-lefence::::",
"debug-ben", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DDEBUG_UNUSED -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown):::::bn86-elf.o co86-elf.o", "debug-ben", "gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DDEBUG_SAFESTACK -O2 -pipe::(unknown):::::",
"debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", "debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
"debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", "debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
"debug-ben-debug", "gcc44:$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O2 -pipe::(unknown)::::::", "debug-ben-debug", "gcc44:$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O2 -pipe::(unknown)::::::",
"debug-ben-debug-64", "gcc:$gcc_devteam_warn -Wno-error=overlength-strings -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O3 -pipe::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-ben-macos", "cc:$gcc_devteam_warn -arch i386 -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::-Wl,-search_paths_first::::",
"debug-ben-macos-gcc46", "gcc-mp-4.6:$gcc_devteam_warn -Wconversion -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::::::",
"debug-ben-darwin64","cc:$gcc_devteam_warn -g -Wno-language-extension-token -Wno-extended-offsetof -arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
"debug-ben-debug-64-clang", "clang:$gcc_devteam_warn -Wno-error=overlength-strings -Wno-error=extended-offsetof -Qunused-arguments -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O3 -pipe::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-ben-no-opt", "gcc: -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG -Werror -DL_ENDIAN -DTERMIOS -Wall -g3::(unknown)::::::", "debug-ben-no-opt", "gcc: -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG -Werror -DL_ENDIAN -DTERMIOS -Wall -g3::(unknown)::::::",
"debug-ben-strict", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe::(unknown)::::::", "debug-ben-strict", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -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-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:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -march=i486 -pedantic -Wshadow -Wall -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", "debug-bodo", "gcc:$gcc_devteam_warn -Wno-error=overlength-strings -DBN_DEBUG -DBN_DEBUG_RAND -DCONF_DEBUG -DBIO_PAIR_DEBUG -m64 -DL_ENDIAN -DTERMIO -g -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
"debug-ulf", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DBN_DEBUG_RAND -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations:::CYGWIN32:::${no_asm}:win32:cygwin-shared:::.dll", "debug-steve64", "gcc:$gcc_devteam_warn -m64 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -Wno-overlength-strings -g::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-steve64", "gcc:$gcc_devteam_warn -m64 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -g -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-steve32", "gcc:$gcc_devteam_warn -m32 -DL_ENDIAN -DCONF_DEBUG -DDEBUG_SAFESTACK -Wno-overlength-strings -g -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-steve32", "gcc:$gcc_devteam_warn -m32 -DL_ENDIAN -DCONF_DEBUG -DDEBUG_SAFESTACK -g -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-steve-opt", "gcc:$gcc_devteam_warn -m64 -O3 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -g::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-steve-opt", "gcc:$gcc_devteam_warn -m64 -O3 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -g -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -ggdb -g3 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -ggdb -g3 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-geoff32","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:BN_LLONG:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-geoff32","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -DMD32_REG_T=int -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:BN_LLONG:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-geoff64","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-geoff64","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -DMD32_REG_T=int -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
"debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn", "debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
"debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn", "debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -march=i486 -Wall::-D_REENTRANT::-lefence -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall::-D_REENTRANT::-lefence -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-linux-ia32-aes", "gcc:-DAES_EXPERIMENTAL -DL_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:x86cpuid.o:bn-586.o co-586.o x86-mont.o::des-586.o crypt586.o:aes_x86core.o aes_cbc.o aesni-x86.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o::ghash-x86.o::elf:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-linux-ia32-aes", "gcc:-DAES_EXPERIMENTAL -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:x86cpuid.o:bn-586.o co-586.o x86-mont.o:des-586.o crypt586.o:aes_x86core.o aes_cbc.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o::elf:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-linux-generic32","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -g -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-linux-generic32","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DTERMIO -g -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-linux-generic64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DTERMIO -g -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-linux-generic64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DTERMIO -g -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-linux-x86_64", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -m64 -DL_ENDIAN -DTERMIO -g -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", "debug-linux-x86_64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -m64 -DL_ENDIAN -g -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
"dist", "cc:-O::(unknown)::::::", "dist", "cc:-O::(unknown)::::::",
# Basic configs that should work on any (32 and less bit) box # Basic configs that should work on any (32 and less bit) box
@@ -196,8 +224,8 @@ my %table=(
"cc", "cc:-O::(unknown)::::::", "cc", "cc:-O::(unknown)::::::",
####VOS Configurations ####VOS Configurations
"vos-gcc","gcc:-O3 -Wall -D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:", "vos-gcc","gcc:-O3 -Wall -DOPENSSL_SYSNAME_VOS -D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:",
"debug-vos-gcc","gcc:-O0 -g -Wall -D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:", "debug-vos-gcc","gcc:-O0 -g -Wall -DOPENSSL_SYSNAME_VOS -D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:",
#### Solaris x86 with GNU C setups #### Solaris x86 with GNU C setups
# -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it # -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it
@@ -214,20 +242,20 @@ my %table=(
# actually recommend to consider using gcc shared build even with vendor # actually recommend to consider using gcc shared build even with vendor
# compiler:-) # compiler:-)
# <appro@fy.chalmers.se> # <appro@fy.chalmers.se>
"solaris64-x86_64-gcc","gcc:-m64 -O3 -Wall -DL_ENDIAN -DMD32_REG_T=int::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:solaris-shared:-fPIC:-m64 -shared -static-libgcc:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64", "solaris64-x86_64-gcc","gcc:-m64 -O3 -Wall -DL_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:solaris-shared:-fPIC:-m64 -shared -static-libgcc:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64",
#### Solaris x86 with Sun C setups #### Solaris x86 with Sun C setups
"solaris-x86-cc","cc:-fast -O -Xa::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "solaris-x86-cc","cc:-fast -xarch=generic -O -Xa::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"solaris64-x86_64-cc","cc:-fast -xarch=amd64 -xstrconst -Xa -DL_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:solaris-shared:-KPIC:-xarch=amd64 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64", "solaris64-x86_64-cc","cc:-fast -xarch=amd64 -xstrconst -Xa -DL_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:solaris-shared:-KPIC:-xarch=amd64 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64",
#### SPARC Solaris with GNU C setups #### SPARC Solaris with GNU C setups
"solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "solaris-sparcv8-gcc","gcc:-mcpu=v8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
# -m32 should be safe to add as long as driver recognizes -mcpu=ultrasparc # -m32 should be safe to add as long as driver recognizes -mcpu=ultrasparc
"solaris-sparcv9-gcc","gcc:-m32 -mcpu=ultrasparc -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "solaris-sparcv9-gcc","gcc:-m32 -mcpu=ultrasparc -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"solaris64-sparcv9-gcc","gcc:-m64 -mcpu=ultrasparc -O3 -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-m64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64", "solaris64-sparcv9-gcc","gcc:-m64 -mcpu=ultrasparc -O3 -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-m64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64",
#### ####
"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mcpu=v8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-solaris-sparcv9-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -DPEDANTIC -O -g -mcpu=ultrasparc -pedantic -ansi -Wall -Wshadow -Wno-long-long -D__EXTENSIONS__ -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-solaris-sparcv9-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -DPEDANTIC -O -g -mcpu=ultrasparc -pedantic -ansi -Wall -Wshadow -Wno-long-long -D__EXTENSIONS__ -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
#### SPARC Solaris with Sun C setups #### SPARC Solaris with Sun C setups
@@ -237,27 +265,27 @@ my %table=(
"solaris-sparcv7-cc","cc:-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "solaris-sparcv7-cc","cc:-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"solaris-sparcv8-cc","cc:-xarch=v8 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "solaris-sparcv8-cc","cc:-xarch=v8 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"solaris-sparcv9-cc","cc:-xtarget=ultra -xarch=v8plus -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "solaris-sparcv9-cc","cc:-xtarget=ultra -xarch=v8plus -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"solaris64-sparcv9-cc","cc:-xtarget=ultra -xarch=v9 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-xarch=v9 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):/usr/ccs/bin/ar rs::/64", "solaris64-sparcv9-cc","cc:-xtarget=ultra -xarch=v9 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-xarch=v9 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64",
#### ####
"debug-solaris-sparcv8-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xarch=v8 -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-solaris-sparcv8-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xarch=v8 -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-solaris-sparcv9-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xtarget=ultra -xarch=v8plus -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-solaris-sparcv9-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xtarget=ultra -xarch=v8plus -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
#### SunOS configs, assuming sparc for the gcc one. #### SunOS configs, assuming sparc for the gcc one.
#"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown):SUNOS::DES_UNROLL:${no_asm}::", #"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown):SUNOS::DES_UNROLL:${no_asm}::",
"sunos-gcc","gcc:-O3 -mv8 -Dssize_t=int::(unknown):SUNOS::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:${no_asm}::", "sunos-gcc","gcc:-O3 -mcpu=v8 -Dssize_t=int::(unknown):SUNOS::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:${no_asm}::",
#### IRIX 5.x configs #### IRIX 5.x configs
# -mips2 flag is added by ./config when appropriate. # -mips2 flag is added by ./config when appropriate.
"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:${no_asm}:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "irix-gcc","gcc:-O3 -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK DES_UNROLL DES_RISC2 DES_PTR BF_PTR:${mips32_asm}:o32:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"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:${no_asm}:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "irix-cc", "cc:-O2 -use_readonly_const -DB_ENDIAN::(unknown):::BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC2 DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
#### IRIX 6.x configs #### IRIX 6.x configs
# Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke # Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke
# './Configure irix-cc -o32' manually. # './Configure irix-cc -o32' manually.
"irix-mips3-gcc","gcc:-mabi=n32 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT:${mips3_asm}:dlfcn:irix-shared::-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32", "irix-mips3-gcc","gcc:-mabi=n32 -O3 -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT:${mips64_asm}:n32:dlfcn:irix-shared::-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
"irix-mips3-cc", "cc:-n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT:${mips3_asm}:dlfcn:irix-shared::-n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32", "irix-mips3-cc", "cc:-n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT:${mips64_asm}:n32:dlfcn:irix-shared::-n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
# N64 ABI builds. # N64 ABI builds.
"irix64-mips4-gcc","gcc:-mabi=64 -mips4 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips3_asm}:dlfcn:irix-shared::-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", "irix64-mips4-gcc","gcc:-mabi=64 -mips4 -O3 -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips64_asm}:64:dlfcn:irix-shared::-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips3_asm}:dlfcn:irix-shared::-64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", "irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -G0 -rdata_shared -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips64_asm}:64:dlfcn:irix-shared::-64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
#### Unified HP-UX ANSI C configs. #### Unified HP-UX ANSI C configs.
# Special notes: # Special notes:
@@ -290,17 +318,18 @@ my %table=(
# Since there is mention of this in shlib/hpux10-cc.sh # 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::-D_REENTRANT::-ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "hpux-parisc-cc-o4","cc:-Ae +O4 +ESlit -z -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT::-ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"hpux-parisc-gcc","gcc:-O3 -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "hpux-parisc-gcc","gcc:-O3 -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"hpux-parisc2-gcc","gcc:-march=2.0 -O3 -DB_ENDIAN -D_REENTRANT::::-Wl,+s -ldld:SIXTY_FOUR_BIT RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL DES_RISC1::pa-risc2.o::::::::::::void:dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "hpux-parisc1_1-gcc","gcc:-O3 -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${parisc11_asm}:dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa1.1",
"hpux64-parisc2-gcc","gcc:-O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2W.o::::::::::::void:dlfcn:hpux-shared:-fpic:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_64", "hpux-parisc2-gcc","gcc:-march=2.0 -O3 -DB_ENDIAN -D_REENTRANT::::-Wl,+s -ldld:SIXTY_FOUR_BIT RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL DES_RISC1:".eval{my $asm=$parisc20_asm;$asm=~s/2W\./2\./;$asm=~s/:64/:32/;$asm}.":dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_32",
"hpux64-parisc2-gcc","gcc:-O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2W.o:::::::::::::::void:dlfcn:hpux-shared:-fpic:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_64",
# More attempts at unified 10.X and 11.X targets for HP C compiler. # More attempts at unified 10.X and 11.X targets for HP C compiler.
# #
# Chris Ruemmler <ruemmler@cup.hp.com> # Chris Ruemmler <ruemmler@cup.hp.com>
# Kevin Steves <ks@hp.se> # Kevin Steves <ks@hp.se>
"hpux-parisc-cc","cc:+O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "hpux-parisc-cc","cc:+O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"hpux-parisc1_0-cc","cc:+DAportable +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "hpux-parisc1_1-cc","cc:+DA1.1 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:${parisc11_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa1.1",
"hpux-parisc2-cc","cc:+DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-Wl,+s -ldld:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2.o::::::::::::void:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "hpux-parisc2-cc","cc:+DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-Wl,+s -ldld:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:".eval{my $asm=$parisc20_asm;$asm=~s/2W\./2\./;$asm=~s/:64/:32/;$asm}.":dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_32",
"hpux64-parisc2-cc","cc:+DD64 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2W.o::::::::::::void:dlfcn:hpux-shared:+Z:+DD64 -b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_64", "hpux64-parisc2-cc","cc:+DD64 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:${parisc20_asm}:dlfcn:hpux-shared:+Z:+DD64 -b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_64",
# HP/UX IA-64 targets # HP/UX IA-64 targets
"hpux-ia64-cc","cc:-Ae +DD32 +O2 +Olit=all -z -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:+Z:+DD32 -b:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/hpux32", "hpux-ia64-cc","cc:-Ae +DD32 +O2 +Olit=all -z -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:+Z:+DD32 -b:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/hpux32",
@@ -336,32 +365,83 @@ my %table=(
#### ####
# *-generic* is endian-neutral target, but ./config is free to # *-generic* is endian-neutral target, but ./config is free to
# throw in -D[BL]_ENDIAN, whichever appropriate... # throw in -D[BL]_ENDIAN, whichever appropriate...
"linux-generic32","gcc:-DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-generic32","gcc:-O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"linux-ppc", "gcc:-DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc32_asm}:linux32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-ppc", "gcc:-DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc32_asm}:linux32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
# It's believed that majority of ARM toolchains predefine appropriate -march.
# If you compiler does not, do complement config command line with one! #######################################################################
"linux-armv4", "gcc:-DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", # Note that -march is not among compiler options in below linux-armv4
# target line. Not specifying one is intentional to give you choice to:
#
# a) rely on your compiler default by not specifying one;
# b) specify your target platform explicitly for optimal performance,
# e.g. -march=armv6 or -march=armv7-a;
# c) build "universal" binary that targets *range* of platforms by
# specifying minimum and maximum supported architecture;
#
# As for c) option. It actually makes no sense to specify maximum to be
# less than ARMv7, because it's the least requirement for run-time
# switch between platform-specific code paths. And without run-time
# switch performance would be equivalent to one for minimum. Secondly,
# there are some natural limitations that you'd have to accept and
# respect. Most notably you can *not* build "universal" binary for
# big-endian platform. This is because ARMv7 processor always picks
# instructions in little-endian order. Another similar limitation is
# that -mthumb can't "cross" -march=armv6t2 boundary, because that's
# where it became Thumb-2. Well, this limitation is a bit artificial,
# because it's not really impossible, but it's deemed too tricky to
# support. And of course you have to be sure that your binutils are
# actually up to the task of handling maximum target platform. With all
# this in mind here is an example of how to configure "universal" build:
#
# ./Configure linux-armv4 -march=armv6 -D__ARM_MAX_ARCH__=8
#
"linux-armv4", "gcc: -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"linux-aarch64","gcc: -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${aarch64_asm}:linux64:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
# Configure script adds minimally required -march for assembly support,
# if no -march was specified at command line. mips32 and mips64 below
# refer to contemporary MIPS Architecture specifications, MIPS32 and
# MIPS64, rather than to kernel bitness.
"linux-mips32", "gcc:-mabi=32 -O3 -Wall -DBN_DIV3W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"linux-mips64", "gcc:-mabi=n32 -O3 -Wall -DBN_DIV3W::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips64_asm}:n32:dlfcn:linux-shared:-fPIC:-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
"linux64-mips64", "gcc:-mabi=64 -O3 -Wall -DBN_DIV3W::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips64_asm}:64:dlfcn:linux-shared:-fPIC:-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
#### IA-32 targets... #### IA-32 targets...
"linux-ia32-icc", "icc:-DL_ENDIAN -DTERMIO -O2 -no_cpprt::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-ia32-icc", "icc:-DL_ENDIAN -O2::-D_REENTRANT::-ldl -no_cpprt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"linux-elf", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-elf", "gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"linux-aout", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -march=i486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out", "linux-aout", "gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -march=i486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out",
#### ####
"linux-generic64","gcc:-DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-generic64","gcc:-O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"linux-ppc64", "gcc:-m64 -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc64_asm}:linux64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", "linux-ppc64", "gcc:-m64 -DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc64_asm}:linux64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
"linux-ppc64le","gcc:-m64 -DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:$ppc64_asm:linux64le:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::",
"linux-ia64", "gcc:-DL_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-ia64", "gcc:-DL_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"linux-ia64-ecc","ecc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-ia64-icc","icc:-DL_ENDIAN -O2 -Wall::-D_REENTRANT::-ldl -no_cpprt:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"linux-ia64-icc","icc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-x86_64", "gcc:-m64 -DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
"linux-x86_64", "gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", "linux-x86_64-clang", "clang: -m64 -DL_ENDIAN -O3 -Wall -Wextra $clang_disabled_warnings -Qunused-arguments::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
"linux-s390x", "gcc:-m64 -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:${s390x_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", "linux-x86_64-icc", "icc:-DL_ENDIAN -O2::-D_REENTRANT::-ldl -no_cpprt:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
"linux-x32", "gcc:-mx32 -DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-mx32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::x32",
"linux64-s390x", "gcc:-m64 -DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:${s390x_asm}:64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
#### So called "highgprs" target for z/Architecture CPUs
# "Highgprs" is kernel feature first implemented in Linux 2.6.32, see
# /proc/cpuinfo. The idea is to preserve most significant bits of
# general purpose registers not only upon 32-bit process context
# switch, but even on asynchronous signal delivery to such process.
# This makes it possible to deploy 64-bit instructions even in legacy
# application context and achieve better [or should we say adequate]
# performance. The build is binary compatible with linux-generic32,
# and the idea is to be able to install the resulting libcrypto.so
# alongside generic one, e.g. as /lib/highgprs/libcrypto.so.x.y, for
# ldconfig and run-time linker to autodiscover. Unfortunately it
# doesn't work just yet, because of couple of bugs in glibc
# sysdeps/s390/dl-procinfo.c affecting ldconfig and ld.so.1...
"linux32-s390x", "gcc:-m31 -Wa,-mzarch -DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$s390x_asm;$asm=~s/bn\-s390x\.o/bn_asm.o/;$asm}.":31:dlfcn:linux-shared:-fPIC:-m31:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/highgprs",
#### SPARC Linux setups #### SPARC Linux setups
# Ray Miller <ray.miller@computing-services.oxford.ac.uk> has patiently # Ray Miller <ray.miller@computing-services.oxford.ac.uk> has patiently
# assisted with debugging of following two configs. # assisted with debugging of following two configs.
"linux-sparcv8","gcc:-mv8 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-sparcv8","gcc:-mcpu=v8 -DB_ENDIAN -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
# it's a real mess with -mcpu=ultrasparc option under Linux, but # it's a real mess with -mcpu=ultrasparc option under Linux, but
# -Wa,-Av8plus should do the trick no matter what. # -Wa,-Av8plus should do the trick no matter what.
"linux-sparcv9","gcc:-m32 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-sparcv9","gcc:-m32 -mcpu=ultrasparc -DB_ENDIAN -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
# GCC 3.1 is a requirement # GCC 3.1 is a requirement
"linux64-sparcv9","gcc:-m64 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", "linux64-sparcv9","gcc:-m64 -mcpu=ultrasparc -DB_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
#### Alpha Linux with GNU C and Compaq C setups #### Alpha Linux with GNU C and Compaq C setups
# Special notes: # Special notes:
# - linux-alpha+bwx-gcc is ment to be used from ./config only. If you # - linux-alpha+bwx-gcc is ment to be used from ./config only. If you
@@ -375,25 +455,31 @@ my %table=(
# #
# <appro@fy.chalmers.se> # <appro@fy.chalmers.se>
# #
"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-alpha-gcc","gcc:-O3 -DL_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}", "linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}",
"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}", "linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}",
# Android: linux-* but without pointers to headers and libs.
"android","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"android-x86","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:".eval{my $asm=${x86_elf_asm};$asm=~s/:elf/:android/;$asm}.":dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"android-armv7","gcc:-march=armv7-a -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"android-mips","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
#### *BSD [do see comment about ${BSDthreads} above!] #### *BSD [do see comment about ${BSDthreads} above!]
"BSD-generic32","gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "BSD-generic32","gcc:-O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"BSD-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "BSD-x86", "gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"BSD-x86-elf", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "BSD-x86-elf", "gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-BSD-x86-elf", "gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-BSD-x86-elf", "gcc:-DL_ENDIAN -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"BSD-sparcv8", "gcc:-DB_ENDIAN -DTERMIOS -O3 -mv8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${sparcv8_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "BSD-sparcv8", "gcc:-DB_ENDIAN -O3 -mcpu=v8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${sparcv8_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"BSD-generic64","gcc:-DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "BSD-generic64","gcc:-O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
# -DMD32_REG_T=int doesn't actually belong in sparc64 target, it # -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
# simply *happens* to work around a compiler bug in gcc 3.3.3, # simply *happens* to work around a compiler bug in gcc 3.3.3,
# triggered by RIPEMD160 code. # triggered by RIPEMD160 code.
"BSD-sparc64", "gcc:-DB_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:${sparcv9_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "BSD-sparc64", "gcc:-DB_ENDIAN -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:${sparcv9_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"BSD-ia64", "gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "BSD-ia64", "gcc:-DL_ENDIAN -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"BSD-x86_64", "gcc:-DL_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "BSD-x86_64", "cc:-DL_ENDIAN -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"bsdi-elf-gcc", "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "bsdi-elf-gcc", "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
@@ -405,8 +491,8 @@ my %table=(
# QNX # QNX
"qnx4", "cc:-DL_ENDIAN -DTERMIO::(unknown):::${x86_gcc_des} ${x86_gcc_opts}:", "qnx4", "cc:-DL_ENDIAN -DTERMIO::(unknown):::${x86_gcc_des} ${x86_gcc_opts}:",
"QNX6", "gcc:-DTERMIOS::::-lsocket::${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "QNX6", "gcc:::::-lsocket::${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"QNX6-i386", "gcc:-DL_ENDIAN -DTERMIOS -O2 -Wall::::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "QNX6-i386", "gcc:-DL_ENDIAN -O2 -Wall::::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
# BeOS # BeOS
"beos-x86-r5", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mcpu=pentium -Wall::-D_REENTRANT:BEOS:-lbe -lnet:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:beos:beos-shared:-fPIC -DPIC:-shared:.so", "beos-x86-r5", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mcpu=pentium -Wall::-D_REENTRANT:BEOS:-lbe -lnet:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:beos:beos-shared:-fPIC -DPIC:-shared:.so",
@@ -426,11 +512,11 @@ my %table=(
# UnixWare 2.0x fails destest with -O. # UnixWare 2.0x fails destest with -O.
"unixware-2.0","cc:-DFILIO_H -DNO_STRINGS_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::", "unixware-2.0","cc:-DFILIO_H -DNO_STRINGS_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
"unixware-2.1","cc:-O -DFILIO_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::", "unixware-2.1","cc:-O -DFILIO_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
"unixware-7","cc:-O -DFILIO_H -Kalloca::-Kthread::-lsocket -lnsl:BN_LLONG MD2_CHAR RC4_INDEX ${x86_gcc_des}:${x86_elf_asm}:dlfcn:svr5-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "unixware-7","cc:-O -DFILIO_H -Kalloca::-Kthread::-lsocket -lnsl:BN_LLONG MD2_CHAR RC4_INDEX ${x86_gcc_des}:${x86_elf_asm}-1:dlfcn:svr5-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"unixware-7-gcc","gcc:-DL_ENDIAN -DFILIO_H -O3 -fomit-frame-pointer -march=pentium -Wall::-D_REENTRANT::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:gnu-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "unixware-7-gcc","gcc:-DL_ENDIAN -DFILIO_H -O3 -fomit-frame-pointer -march=pentium -Wall::-D_REENTRANT::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}-1:dlfcn:gnu-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
# SCO 5 - Ben Laurie <ben@algroup.co.uk> says the -O breaks the SCO cc. # SCO 5 - Ben Laurie <ben@algroup.co.uk> says the -O breaks the SCO cc.
"sco5-cc", "cc:-belf::(unknown)::-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "sco5-cc", "cc:-belf::(unknown)::-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}-1:dlfcn:svr3-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"sco5-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown)::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "sco5-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown)::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}-1:dlfcn:svr3-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
#### IBM's AIX. #### IBM's AIX.
"aix3-cc", "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::", "aix3-cc", "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
@@ -438,8 +524,8 @@ my %table=(
"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-pthread:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-maix64 -shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64", "aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-pthread:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-maix64 -shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64",
# Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE # Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE
# at build time. $OBJECT_MODE is respected at ./config stage! # at build time. $OBJECT_MODE is respected at ./config stage!
"aix-cc", "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::BN_LLONG RC4_CHAR:${ppc32_asm}:aix32:dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32", "aix-cc", "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded -D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR:${ppc32_asm}:aix32:dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64", "aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded -D_THREAD_SAFE:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
# #
# Cray T90 and similar (SDSC) # Cray T90 and similar (SDSC)
@@ -479,7 +565,7 @@ my %table=(
"SINIX-N","/usr/ucb/cc:-O2 -misaligned::(unknown)::-lucb:RC4_INDEX RC4_CHAR:::", "SINIX-N","/usr/ucb/cc:-O2 -misaligned::(unknown)::-lucb:RC4_INDEX RC4_CHAR:::",
# SIEMENS BS2000/OSD: an EBCDIC-based mainframe # SIEMENS BS2000/OSD: an EBCDIC-based mainframe
"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:::", "BS2000-OSD","c89:-O -XLLML -XLLMK -XL -DB_ENDIAN -DCHARSET_EBCDIC::(unknown)::-lsocket -lnsl:THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
# OS/390 Unix an EBCDIC-based Unix system on IBM mainframe # OS/390 Unix an EBCDIC-based Unix system on IBM mainframe
# You need to compile using the c89.sh wrapper in the tools directory, because the # You need to compile using the c89.sh wrapper in the tools directory, because the
@@ -490,15 +576,15 @@ my %table=(
# Visual C targets # Visual C targets
# #
# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64 # Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64
"VC-WIN64I","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:ia64cpuid.o:ia64.o::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o:::::::ias:win32", "VC-WIN64I","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:ia64cpuid.o:ia64.o ia64-mont.o:::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o:::::::ghash-ia64.o::ias:win32",
"VC-WIN64A","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:x86_64cpuid.o:bn_asm.o x86_64-mont.o::aes-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o::rc4-x86_64.o:::wp-x86_64.o:cmll-x86_64.o cmll_misc.o:auto:win32", "VC-WIN64A","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:".eval{my $asm=$x86_64_asm;$asm=~s/x86_64-gcc\.o/bn_asm.o/;$asm}.":auto:win32",
"debug-VC-WIN64I","cl:-W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:ia64cpuid.o:ia64.o::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o:::::::ias:win32", "debug-VC-WIN64I","cl:-W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:ia64cpuid.o:ia64.o:::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o:::::::ghash-ia64.o::ias:win32",
"debug-VC-WIN64A","cl:-W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:x86_64cpuid.o:bn_asm.o x86_64-mont.o::aes-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o::rc4-x86_64.o:::wp-x86_64.o:cmll-x86_64.o cmll_misc.o:auto:win32", "debug-VC-WIN64A","cl:-W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:".eval{my $asm=$x86_64_asm;$asm=~s/x86_64-gcc\.o/bn_asm.o/;$asm}.":auto:win32",
# x86 Win32 target defaults to ANSI API, if you want UNICODE, complement # x86 Win32 target defaults to ANSI API, if you want UNICODE, complement
# 'perl Configure VC-WIN32' with '-DUNICODE -D_UNICODE' # 'perl Configure VC-WIN32' with '-DUNICODE -D_UNICODE'
"VC-WIN32","cl:-W3 -WX -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32", "VC-WIN32","cl:-W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32",
# Unified CE target # Unified CE target
"debug-VC-WIN32","cl:-W3 -WX -Gs0 -GF -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32", "debug-VC-WIN32","cl:-W3 -Gs0 -GF -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32",
"VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32", "VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
# Borland C++ 4.5 # Borland C++ 4.5
@@ -519,9 +605,8 @@ my %table=(
"UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32", "UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
# Cygwin # Cygwin
"Cygwin-pre1.3", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown):CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32", "Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:coff:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:coff:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a", "Cygwin-x86_64", "gcc:-DTERMIOS -DL_ENDIAN -O3 -Wall:::CYGWIN::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:mingw64:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
"debug-Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror:::CYGWIN32:::${no_asm}:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
# NetWare from David Ward (dsward@novell.com) # NetWare from David Ward (dsward@novell.com)
# requires either MetroWerks NLM development tools, or gcc / nlmconv # requires either MetroWerks NLM development tools, or gcc / nlmconv
@@ -539,7 +624,7 @@ my %table=(
"netware-libc-bsdsock-gcc", "i586-netware-gcc:-nostdinc -I/ndk/libc/include -DNETWARE_BSDSOCK -DL_ENDIAN -DNETWARE_LIBC -DOPENSSL_SYSNAME_NETWARE -DTERMIO -O2 -Wall:::::BN_LLONG ${x86_gcc_opts}::", "netware-libc-bsdsock-gcc", "i586-netware-gcc:-nostdinc -I/ndk/libc/include -DNETWARE_BSDSOCK -DL_ENDIAN -DNETWARE_LIBC -DOPENSSL_SYSNAME_NETWARE -DTERMIO -O2 -Wall:::::BN_LLONG ${x86_gcc_opts}::",
# DJGPP # DJGPP
"DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:", "DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIO -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:",
# Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at> # Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
"ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::", "ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::",
@@ -551,10 +636,13 @@ my %table=(
"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::", "rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::",
"darwin-ppc-cc","cc:-arch ppc -O3 -DB_ENDIAN -Wa,-force_cpusubtype_ALL::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", "darwin-ppc-cc","cc:-arch ppc -O3 -DB_ENDIAN -Wa,-force_cpusubtype_ALL::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", "darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", "darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:".eval{my $asm=$x86_asm;$asm=~s/cast\-586\.o//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
"debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", "debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -DMD32_REG_T=int -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", "darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
"debug-darwin64-x86_64-cc","cc:-arch x86_64 -ggdb -g2 -O0 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
"debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", "debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
# iPhoneOS/iOS
"iphoneos-cross","llvm-gcc:-O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fomit-frame-pointer -fno-common::-D_REENTRANT:iOS:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
##### A/UX ##### A/UX
"aux3-gcc","gcc:-O2 -DTERMIO::(unknown):AUX:-lbsd:RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::", "aux3-gcc","gcc:-O2 -DTERMIO::(unknown):AUX:-lbsd:RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
@@ -563,24 +651,27 @@ my %table=(
"newsos4-gcc","gcc:-O -DB_ENDIAN::(unknown):NEWS4:-lmld -liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::", "newsos4-gcc","gcc:-O -DB_ENDIAN::(unknown):NEWS4:-lmld -liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::",
##### GNU Hurd ##### GNU Hurd
"hurd-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC", "hurd-x86", "gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC",
##### OS/2 EMX ##### OS/2 EMX
"OS2-EMX", "gcc::::::::", "OS2-EMX", "gcc::::::::",
##### VxWorks for various targets ##### VxWorks for various targets
"vxworks-ppc60x","ccppc:-D_REENTRANT -mrtp -mhard-float -mstrict-align -fno-implicit-fp -DPPC32_fp60x -O2 -fstrength-reduce -fno-builtin -fno-strict-aliasing -Wall -DCPU=PPC32 -DTOOL_FAMILY=gnu -DTOOL=gnu -I\$(WIND_BASE)/target/usr/h -I\$(WIND_BASE)/target/usr/h/wrn/coreip:::VXWORKS:-Wl,--defsym,__wrs_rtp_base=0xe0000000 -L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/common:::::",
"vxworks-ppcgen","ccppc:-D_REENTRANT -mrtp -msoft-float -mstrict-align -O1 -fno-builtin -fno-strict-aliasing -Wall -DCPU=PPC32 -DTOOL_FAMILY=gnu -DTOOL=gnu -I\$(WIND_BASE)/target/usr/h -I\$(WIND_BASE)/target/usr/h/wrn/coreip:::VXWORKS:-Wl,--defsym,__wrs_rtp_base=0xe0000000 -L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/sfcommon:::::",
"vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DCPU=PPC405 -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::", "vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DCPU=PPC405 -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
"vxworks-ppc750","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h \$(DEBUG_FLAG):::VXWORKS:-r:::::", "vxworks-ppc750","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h \$(DEBUG_FLAG):::VXWORKS:-r:::::",
"vxworks-ppc750-debug","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DDEBUG -g:::VXWORKS:-r:::::", "vxworks-ppc750-debug","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DDEBUG -g:::VXWORKS:-r:::::",
"vxworks-ppc860","ccppc:-nostdinc -msoft-float -DCPU=PPC860 -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::", "vxworks-ppc860","ccppc:-nostdinc -msoft-float -DCPU=PPC860 -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
"vxworks-mipsle","ccmips:-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -DL_ENDIAN -EL -Wl,-EL -mips2 -mno-branch-likely -G 0 -fno-builtin -msoft-float -DCPU=MIPS32 -DMIPSEL -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r::${no_asm}::::::ranlibmips:", "vxworks-simlinux","ccpentium:-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\" -DL_ENDIAN -DCPU=SIMLINUX -DTOOL_FAMILY=gnu -DTOOL=gnu -fno-builtin -fno-defer-pop -DNO_STRINGS_H -I\$(WIND_BASE)/target/h -I\$(WIND_BASE)/target/h/wrn/coreip -DOPENSSL_NO_HW_PADLOCK:::VXWORKS:-r::${no_asm}::::::ranlibpentium:",
"vxworks-mips","ccmips:-mrtp -mips2 -O -G 0 -B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\" -DCPU=MIPS32 -msoft-float -mno-branch-likely -DTOOL_FAMILY=gnu -DTOOL=gnu -fno-builtin -fno-defer-pop -DNO_STRINGS_H -I\$(WIND_BASE)/target/usr/h -I\$(WIND_BASE)/target/h/wrn/coreip::-D_REENTRANT:VXWORKS:-Wl,--defsym,__wrs_rtp_base=0xe0000000 -L \$(WIND_BASE)/target/usr/lib/mips/MIPSI32/sfcommon::${mips32_asm}:o32::::::ranlibmips:",
##### Compaq Non-Stop Kernel (Tandem) ##### Compaq Non-Stop Kernel (Tandem)
"tandem-c89","c89:-Ww -D__TANDEM -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D_TANDEM_SOURCE -DB_ENDIAN::(unknown):::THIRTY_TWO_BIT:::", "tandem-c89","c89:-Ww -D__TANDEM -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D_TANDEM_SOURCE -DB_ENDIAN::(unknown):::THIRTY_TWO_BIT:::",
# uClinux # uClinux
"uClinux-dist","$ENV{'CC'}:\$(CFLAGS)::-D_REENTRANT::\$(LDFLAGS) \$(LDLIBS):BN_LLONG:::::::::::::::$ENV{'LIBSSL_dlfcn'}:linux-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):$ENV{'RANLIB'}::", "uClinux-dist","$ENV{'CC'}:\$(CFLAGS)::-D_REENTRANT::\$(LDFLAGS) \$(LDLIBS):BN_LLONG:${no_asm}:$ENV{'LIBSSL_dlfcn'}:linux-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):$ENV{'RANLIB'}::",
"uClinux-dist64","$ENV{'CC'}:\$(CFLAGS)::-D_REENTRANT::\$(LDFLAGS) \$(LDLIBS):SIXTY_FOUR_BIT_LONG:::::::::::::::$ENV{'LIBSSL_dlfcn'}:linux-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):$ENV{'RANLIB'}::", "uClinux-dist64","$ENV{'CC'}:\$(CFLAGS)::-D_REENTRANT::\$(LDFLAGS) \$(LDLIBS):SIXTY_FOUR_BIT_LONG:${no_asm}:$ENV{'LIBSSL_dlfcn'}:linux-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):$ENV{'RANLIB'}::",
); );
@@ -601,6 +692,7 @@ my $idx_lflags = $idx++;
my $idx_bn_ops = $idx++; my $idx_bn_ops = $idx++;
my $idx_cpuid_obj = $idx++; my $idx_cpuid_obj = $idx++;
my $idx_bn_obj = $idx++; my $idx_bn_obj = $idx++;
my $idx_ec_obj = $idx++;
my $idx_des_obj = $idx++; my $idx_des_obj = $idx++;
my $idx_aes_obj = $idx++; my $idx_aes_obj = $idx++;
my $idx_bf_obj = $idx++; my $idx_bf_obj = $idx++;
@@ -612,6 +704,8 @@ my $idx_rmd160_obj = $idx++;
my $idx_rc5_obj = $idx++; my $idx_rc5_obj = $idx++;
my $idx_wp_obj = $idx++; my $idx_wp_obj = $idx++;
my $idx_cmll_obj = $idx++; my $idx_cmll_obj = $idx++;
my $idx_modes_obj = $idx++;
my $idx_engines_obj = $idx++;
my $idx_perlasm_scheme = $idx++; my $idx_perlasm_scheme = $idx++;
my $idx_dso_scheme = $idx++; my $idx_dso_scheme = $idx++;
my $idx_shared_target = $idx++; my $idx_shared_target = $idx++;
@@ -628,6 +722,9 @@ my $openssldir="";
my $exe_ext=""; my $exe_ext="";
my $install_prefix= "$ENV{'INSTALL_PREFIX'}"; my $install_prefix= "$ENV{'INSTALL_PREFIX'}";
my $cross_compile_prefix=""; my $cross_compile_prefix="";
my $fipsdir="/usr/local/ssl/fips-2.0";
my $fipslibdir="";
my $baseaddr="0xFB00000";
my $no_threads=0; my $no_threads=0;
my $threads=0; my $threads=0;
my $no_shared=0; # but "no-shared" is default my $no_shared=0; # but "no-shared" is default
@@ -662,26 +759,37 @@ my $cmll_enc="camellia.o cmll_misc.o cmll_cbc.o";
my $processor=""; my $processor="";
my $default_ranlib; my $default_ranlib;
my $perl; my $perl;
my $fips=0;
if (exists $ENV{FIPSDIR})
{
$fipsdir = $ENV{FIPSDIR};
$fipsdir =~ s/\/$//;
}
# All of the following is disabled by default (RC5 was enabled before 0.9.8): # All of the following is disabled by default (RC5 was enabled before 0.9.8):
my %disabled = ( # "what" => "comment" [or special keyword "experimental"] my %disabled = ( # "what" => "comment" [or special keyword "experimental"]
"ec_nistp_64_gcc_128" => "default",
"gmp" => "default", "gmp" => "default",
"jpake" => "experimental", "jpake" => "experimental",
"md2" => "default", "libunbound" => "experimental",
"rc5" => "default", "md2" => "default",
"rc5" => "default",
"rfc3779" => "default", "rfc3779" => "default",
"shared" => "default", "sctp" => "default",
"shared" => "default",
"ssl-trace" => "default",
"store" => "experimental", "store" => "experimental",
"zlib" => "default", "unit-test" => "default",
"zlib-dynamic" => "default" "zlib" => "default",
); "zlib-dynamic" => "default"
);
my @experimental = (); my @experimental = ();
# This is what $depflags will look like with the above defaults # This is what $depflags will look like with the above defaults
# (we need this to see if we should advise the user to run "make depend"): # (we need this to see if we should advise the user to run "make depend"):
my $default_depflags = " -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_STORE"; my $default_depflags = " -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_LIBUNBOUND -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_SSL_TRACE -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST";
# Explicit "no-..." options will be collected in %disabled along with the defaults. # Explicit "no-..." options will be collected in %disabled along with the defaults.
# To remove something from %disabled, use "enable-foo" (unless it's experimental). # To remove something from %disabled, use "enable-foo" (unless it's experimental).
@@ -739,6 +847,7 @@ PROCESS_ARGS:
# rewrite some options in "enable-..." form # rewrite some options in "enable-..." form
s /^-?-?shared$/enable-shared/; s /^-?-?shared$/enable-shared/;
s /^sctp$/enable-sctp/;
s /^threads$/enable-threads/; s /^threads$/enable-threads/;
s /^zlib$/enable-zlib/; s /^zlib$/enable-zlib/;
s /^zlib-dynamic$/enable-zlib-dynamic/; s /^zlib-dynamic$/enable-zlib-dynamic/;
@@ -756,6 +865,11 @@ PROCESS_ARGS:
{ {
$disabled{"tls1"} = "option(tls)" $disabled{"tls1"} = "option(tls)"
} }
elsif ($1 eq "ssl3-method")
{
$disabled{"ssl3-method"} = "option(ssl)";
$disabled{"ssl3"} = "option(ssl)";
}
else else
{ {
$disabled{$1} = "option"; $disabled{$1} = "option";
@@ -808,6 +922,10 @@ PROCESS_ARGS:
} }
elsif (/^386$/) elsif (/^386$/)
{ $processor=386; } { $processor=386; }
elsif (/^fips$/)
{
$fips=1;
}
elsif (/^rsaref$/) elsif (/^rsaref$/)
{ {
# No RSAref support any more since it's not needed. # No RSAref support any more since it's not needed.
@@ -816,15 +934,7 @@ PROCESS_ARGS:
} }
elsif (/^[-+]/) elsif (/^[-+]/)
{ {
if (/^-[lL](.*)$/ or /^-Wl,/) if (/^--prefix=(.*)$/)
{
$libs.=$_." ";
}
elsif (/^-[^-]/ or /^\+/)
{
$flags.=$_." ";
}
elsif (/^--prefix=(.*)$/)
{ {
$prefix=$1; $prefix=$1;
} }
@@ -852,14 +962,30 @@ PROCESS_ARGS:
{ {
$withargs{"zlib-include"}="-I$1"; $withargs{"zlib-include"}="-I$1";
} }
elsif (/^--with-fipsdir=(.*)$/)
{
$fipsdir="$1";
}
elsif (/^--with-fipslibdir=(.*)$/)
{
$fipslibdir="$1";
}
elsif (/^--with-baseaddr=(.*)$/)
{
$baseaddr="$1";
}
elsif (/^--cross-compile-prefix=(.*)$/) elsif (/^--cross-compile-prefix=(.*)$/)
{ {
$cross_compile_prefix=$1; $cross_compile_prefix=$1;
} }
else elsif (/^-[lL](.*)$/ or /^-Wl,/)
{ {
print STDERR $usage; $libs.=$_." ";
exit(1); }
else # common if (/^[-+]/), just pass down...
{
$_ =~ s/%([0-9a-f]{1,2})/chr(hex($1))/gei;
$flags.=$_." ";
} }
} }
elsif ($_ =~ /^([^:]+):(.+)$/) elsif ($_ =~ /^([^:]+):(.+)$/)
@@ -926,6 +1052,17 @@ if (defined($disabled{"md5"}) || defined($disabled{"rsa"}))
$disabled{"ssl2"} = "forced"; $disabled{"ssl2"} = "forced";
} }
if ($fips && $fipslibdir eq "")
{
$fipslibdir = $fipsdir . "/lib/";
}
# RSAX ENGINE sets default non-FIPS RSA method.
if ($fips)
{
$disabled{"rsax"} = "forced";
}
# SSL 3.0 and TLS requires MD5 and SHA and either RSA or DSA+DH # SSL 3.0 and TLS requires MD5 and SHA and either RSA or DSA+DH
if (defined($disabled{"md5"}) || defined($disabled{"sha"}) if (defined($disabled{"md5"}) || defined($disabled{"sha"})
|| (defined($disabled{"rsa"}) || (defined($disabled{"rsa"})
@@ -946,6 +1083,13 @@ if (defined($disabled{"ec"}) || defined($disabled{"dsa"})
$disabled{"gost"} = "forced"; $disabled{"gost"} = "forced";
} }
# SRP and HEARTBEATS require TLSEXT
if (defined($disabled{"tlsext"}))
{
$disabled{"srp"} = "forced";
$disabled{"heartbeats"} = "forced";
}
if ($target eq "TABLE") { if ($target eq "TABLE") {
foreach $target (sort keys %table) { foreach $target (sort keys %table) {
print_table_entry($target); print_table_entry($target);
@@ -995,7 +1139,7 @@ foreach (sort (keys %disabled))
else else
{ {
my ($ALGO, $algo); my ($ALGO, $algo);
($ALGO = $algo = $_) =~ tr/[a-z]/[A-Z]/; ($ALGO = $algo = $_) =~ tr/[\-a-z]/[_A-Z]/;
if (/^asm$/ || /^err$/ || /^hw$/ || /^hw-/) if (/^asm$/ || /^err$/ || /^hw$/ || /^hw-/)
{ {
@@ -1015,6 +1159,8 @@ foreach (sort (keys %disabled))
else else
{ {
push @skip, $algo; push @skip, $algo;
# fix-up crypto/directory name(s)
@skip[$#skip]="whrlpool" if $algo eq "whirlpool";
print " (skip dir)"; print " (skip dir)";
$depflags .= " -DOPENSSL_NO_$ALGO"; $depflags .= " -DOPENSSL_NO_$ALGO";
@@ -1066,6 +1212,7 @@ my $cc = $fields[$idx_cc];
if($ENV{CC}) { if($ENV{CC}) {
$cc = $ENV{CC}; $cc = $ENV{CC};
} }
my $cflags = $fields[$idx_cflags]; my $cflags = $fields[$idx_cflags];
my $unistd = $fields[$idx_unistd]; my $unistd = $fields[$idx_unistd];
my $thread_cflag = $fields[$idx_thread_cflag]; my $thread_cflag = $fields[$idx_thread_cflag];
@@ -1074,6 +1221,7 @@ my $lflags = $fields[$idx_lflags];
my $bn_ops = $fields[$idx_bn_ops]; my $bn_ops = $fields[$idx_bn_ops];
my $cpuid_obj = $fields[$idx_cpuid_obj]; my $cpuid_obj = $fields[$idx_cpuid_obj];
my $bn_obj = $fields[$idx_bn_obj]; my $bn_obj = $fields[$idx_bn_obj];
my $ec_obj = $fields[$idx_ec_obj];
my $des_obj = $fields[$idx_des_obj]; my $des_obj = $fields[$idx_des_obj];
my $aes_obj = $fields[$idx_aes_obj]; my $aes_obj = $fields[$idx_aes_obj];
my $bf_obj = $fields[$idx_bf_obj]; my $bf_obj = $fields[$idx_bf_obj];
@@ -1085,6 +1233,8 @@ my $rmd160_obj = $fields[$idx_rmd160_obj];
my $rc5_obj = $fields[$idx_rc5_obj]; my $rc5_obj = $fields[$idx_rc5_obj];
my $wp_obj = $fields[$idx_wp_obj]; my $wp_obj = $fields[$idx_wp_obj];
my $cmll_obj = $fields[$idx_cmll_obj]; my $cmll_obj = $fields[$idx_cmll_obj];
my $modes_obj = $fields[$idx_modes_obj];
my $engines_obj = $fields[$idx_engines_obj];
my $perlasm_scheme = $fields[$idx_perlasm_scheme]; my $perlasm_scheme = $fields[$idx_perlasm_scheme];
my $dso_scheme = $fields[$idx_dso_scheme]; my $dso_scheme = $fields[$idx_dso_scheme];
my $shared_target = $fields[$idx_shared_target]; my $shared_target = $fields[$idx_shared_target];
@@ -1117,6 +1267,12 @@ if ($target =~ /^mingw/ && `$cc --target-help 2>&1` !~ m/\-mno\-cygwin/m)
$shared_ldflag =~ s/\-mno\-cygwin\s*//; $shared_ldflag =~ s/\-mno\-cygwin\s*//;
} }
if ($target =~ /linux.*\-mips/ && !$no_asm && $flags !~ /\-m(ips|arch=)/) {
# minimally required architecture flags for assembly modules
$cflags="-mips2 $cflags" if ($target =~ /mips32/);
$cflags="-mips3 $cflags" if ($target =~ /mips64/);
}
my $no_shared_warn=0; my $no_shared_warn=0;
my $no_user_cflags=0; my $no_user_cflags=0;
@@ -1243,9 +1399,9 @@ $lflags="$libs$lflags" if ($libs ne "");
if ($no_asm) if ($no_asm)
{ {
$cpuid_obj=$bn_obj= $cpuid_obj=$bn_obj=$ec_obj=
$des_obj=$aes_obj=$bf_obj=$cast_obj=$rc4_obj=$rc5_obj=$cmll_obj= $des_obj=$aes_obj=$bf_obj=$cast_obj=$rc4_obj=$rc5_obj=$cmll_obj=
$sha1_obj=$md5_obj=$rmd160_obj=$wp_obj=""; $modes_obj=$sha1_obj=$md5_obj=$rmd160_obj=$wp_obj=$engines_obj="";
} }
if (!$no_shared) if (!$no_shared)
@@ -1309,7 +1465,7 @@ if (!$IsMK1MF)
} }
} }
$cpuid_obj.=" uplink.o uplink-cof.o" if ($cflags =~ /\-DOPENSSL_USE_APPLINK/); $cpuid_obj.=" uplink.o uplink-x86.o" if ($cflags =~ /\-DOPENSSL_USE_APPLINK/);
# #
# Platform fix-ups # Platform fix-ups
@@ -1324,6 +1480,7 @@ if ($target =~ /\-icc$/) # Intel C compiler
} }
if ($iccver>=8) if ($iccver>=8)
{ {
$cflags=~s/\-KPIC/-fPIC/;
# Eliminate unnecessary dependency from libirc.a. This is # Eliminate unnecessary dependency from libirc.a. This is
# essential for shared library support, as otherwise # essential for shared library support, as otherwise
# apps/openssl can end up in endless loop upon startup... # apps/openssl can end up in endless loop upon startup...
@@ -1331,12 +1488,17 @@ if ($target =~ /\-icc$/) # Intel C compiler
} }
if ($iccver>=9) if ($iccver>=9)
{ {
$cflags.=" -i-static"; $lflags.=" -i-static";
$cflags=~s/\-no_cpprt/-no-cpprt/; $lflags=~s/\-no_cpprt/-no-cpprt/;
} }
if ($iccver>=10) if ($iccver>=10)
{ {
$cflags=~s/\-i\-static/-static-intel/; $lflags=~s/\-i\-static/-static-intel/;
}
if ($iccver>=11)
{
$cflags.=" -no-intel-extensions"; # disable Cilk
$lflags=~s/\-no\-cpprt/-no-cxxlib/;
} }
} }
@@ -1377,6 +1539,14 @@ $cflags.=" -DOPENSSL_BN_ASM_PART_WORDS" if ($bn_obj =~ /bn-586/);
$cflags.=" -DOPENSSL_IA32_SSE2" if (!$no_sse2 && $bn_obj =~ /86/); $cflags.=" -DOPENSSL_IA32_SSE2" if (!$no_sse2 && $bn_obj =~ /86/);
$cflags.=" -DOPENSSL_BN_ASM_MONT" if ($bn_obj =~ /-mont/); $cflags.=" -DOPENSSL_BN_ASM_MONT" if ($bn_obj =~ /-mont/);
$cflags.=" -DOPENSSL_BN_ASM_MONT5" if ($bn_obj =~ /-mont5/);
$cflags.=" -DOPENSSL_BN_ASM_GF2m" if ($bn_obj =~ /-gf2m/);
if ($fips)
{
$openssl_other_defines.="#define OPENSSL_FIPS\n";
$cflags .= " -I\$(FIPSDIR)/include";
}
$cpuid_obj="mem_clr.o" unless ($cpuid_obj =~ /\.o$/); $cpuid_obj="mem_clr.o" unless ($cpuid_obj =~ /\.o$/);
$des_obj=$des_enc unless ($des_obj =~ /\.o$/); $des_obj=$des_enc unless ($des_obj =~ /\.o$/);
@@ -1409,13 +1579,21 @@ if ($rmd160_obj =~ /\.o$/)
} }
if ($aes_obj =~ /\.o$/) if ($aes_obj =~ /\.o$/)
{ {
$cflags.=" -DAES_ASM"; $cflags.=" -DAES_ASM" if ($aes_obj =~ m/\baes\-/);;
# aes-ctr.o is not a real file, only indication that assembler
# module implements AES_ctr32_encrypt...
$cflags.=" -DAES_CTR_ASM" if ($aes_obj =~ s/\s*aes\-ctr\.o//);
# aes-xts.o indicates presense of AES_xts_[en|de]crypt...
$cflags.=" -DAES_XTS_ASM" if ($aes_obj =~ s/\s*aes\-xts\.o//);
$aes_obj =~ s/\s*(vpaes|aesni)\-x86\.o//g if ($no_sse2);
$cflags.=" -DVPAES_ASM" if ($aes_obj =~ m/vpaes/);
$cflags.=" -DBSAES_ASM" if ($aes_obj =~ m/bsaes/);
} }
else { else {
$aes_obj=$aes_enc; $aes_obj=$aes_enc;
} }
$wp_obj="" if ($wp_obj =~ /mmx/ && $processor eq "386"); $wp_obj="" if ($wp_obj =~ /mmx/ && $processor eq "386");
if ($wp_obj =~ /\.o$/) if ($wp_obj =~ /\.o$/ && !$disabled{"whirlpool"})
{ {
$cflags.=" -DWHIRLPOOL_ASM"; $cflags.=" -DWHIRLPOOL_ASM";
} }
@@ -1423,6 +1601,14 @@ else {
$wp_obj="wp_block.o"; $wp_obj="wp_block.o";
} }
$cmll_obj=$cmll_enc unless ($cmll_obj =~ /.o$/); $cmll_obj=$cmll_enc unless ($cmll_obj =~ /.o$/);
if ($modes_obj =~ /ghash\-/)
{
$cflags.=" -DGHASH_ASM";
}
if ($ec_obj =~ /ecp_nistz256/)
{
$cflags.=" -DECP_NISTZ256_ASM";
}
# "Stringify" the C flags string. This permits it to be made part of a string # "Stringify" the C flags string. This permits it to be made part of a string
# and works as well on command lines. # and works as well on command lines.
@@ -1462,12 +1648,21 @@ if ($shlib_version_number =~ /(^[0-9]*)\.([0-9\.]*)/)
if ($strict_warnings) if ($strict_warnings)
{ {
my $ecc = $cc;
$ecc = "clang" if `$cc --version 2>&1` =~ /clang/;
my $wopt; my $wopt;
die "ERROR --strict-warnings requires gcc" unless ($cc =~ /gcc$/); die "ERROR --strict-warnings requires gcc or clang" unless ($ecc =~ /gcc$/ or $ecc =~ /clang$/);
foreach $wopt (split /\s+/, $gcc_devteam_warn) foreach $wopt (split /\s+/, $gcc_devteam_warn)
{ {
$cflags .= " $wopt" unless ($cflags =~ /$wopt/) $cflags .= " $wopt" unless ($cflags =~ /$wopt/)
} }
if ($ecc eq "clang")
{
foreach $wopt (split /\s+/, $clang_devteam_warn)
{
$cflags .= " $wopt" unless ($cflags =~ /$wopt/)
}
}
} }
open(IN,'<Makefile.org') || die "unable to read Makefile.org:$!\n"; open(IN,'<Makefile.org') || die "unable to read Makefile.org:$!\n";
@@ -1526,6 +1721,7 @@ while (<IN>)
s/^EXE_EXT=.*$/EXE_EXT= $exe_ext/; s/^EXE_EXT=.*$/EXE_EXT= $exe_ext/;
s/^CPUID_OBJ=.*$/CPUID_OBJ= $cpuid_obj/; s/^CPUID_OBJ=.*$/CPUID_OBJ= $cpuid_obj/;
s/^BN_ASM=.*$/BN_ASM= $bn_obj/; s/^BN_ASM=.*$/BN_ASM= $bn_obj/;
s/^EC_ASM=.*$/EC_ASM= $ec_obj/;
s/^DES_ENC=.*$/DES_ENC= $des_obj/; s/^DES_ENC=.*$/DES_ENC= $des_obj/;
s/^AES_ENC=.*$/AES_ENC= $aes_obj/; s/^AES_ENC=.*$/AES_ENC= $aes_obj/;
s/^BF_ENC=.*$/BF_ENC= $bf_obj/; s/^BF_ENC=.*$/BF_ENC= $bf_obj/;
@@ -1537,6 +1733,8 @@ while (<IN>)
s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/; s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/;
s/^WP_ASM_OBJ=.*$/WP_ASM_OBJ= $wp_obj/; s/^WP_ASM_OBJ=.*$/WP_ASM_OBJ= $wp_obj/;
s/^CMLL_ENC=.*$/CMLL_ENC= $cmll_obj/; s/^CMLL_ENC=.*$/CMLL_ENC= $cmll_obj/;
s/^MODES_ASM_OBJ.=*$/MODES_ASM_OBJ= $modes_obj/;
s/^ENGINES_ASM_OBJ.=*$/ENGINES_ASM_OBJ= $engines_obj/;
s/^PERLASM_SCHEME=.*$/PERLASM_SCHEME= $perlasm_scheme/; s/^PERLASM_SCHEME=.*$/PERLASM_SCHEME= $perlasm_scheme/;
s/^PROCESSOR=.*/PROCESSOR= $processor/; s/^PROCESSOR=.*/PROCESSOR= $processor/;
s/^ARFLAGS=.*/ARFLAGS= $arflags/; s/^ARFLAGS=.*/ARFLAGS= $arflags/;
@@ -1545,6 +1743,12 @@ while (<IN>)
s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/; s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/;
s/^LIBZLIB=.*/LIBZLIB=$withargs{"zlib-lib"}/; s/^LIBZLIB=.*/LIBZLIB=$withargs{"zlib-lib"}/;
s/^ZLIB_INCLUDE=.*/ZLIB_INCLUDE=$withargs{"zlib-include"}/; s/^ZLIB_INCLUDE=.*/ZLIB_INCLUDE=$withargs{"zlib-include"}/;
s/^FIPSDIR=.*/FIPSDIR=$fipsdir/;
s/^FIPSLIBDIR=.*/FIPSLIBDIR=$fipslibdir/;
s/^FIPSCANLIB=.*/FIPSCANLIB=libcrypto/ if $fips;
s/^BASEADDR=.*/BASEADDR=$baseaddr/;
s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/; s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/;
s/^SHLIB_MARK=.*/SHLIB_MARK=$shared_mark/; s/^SHLIB_MARK=.*/SHLIB_MARK=$shared_mark/;
s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared); s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared);
@@ -1579,6 +1783,7 @@ print "CFLAG =$cflags\n";
print "EX_LIBS =$lflags\n"; print "EX_LIBS =$lflags\n";
print "CPUID_OBJ =$cpuid_obj\n"; print "CPUID_OBJ =$cpuid_obj\n";
print "BN_ASM =$bn_obj\n"; print "BN_ASM =$bn_obj\n";
print "EC_ASM =$ec_obj\n";
print "DES_ENC =$des_obj\n"; print "DES_ENC =$des_obj\n";
print "AES_ENC =$aes_obj\n"; print "AES_ENC =$aes_obj\n";
print "BF_ENC =$bf_obj\n"; print "BF_ENC =$bf_obj\n";
@@ -1588,7 +1793,9 @@ print "RC5_ENC =$rc5_obj\n";
print "MD5_OBJ_ASM =$md5_obj\n"; print "MD5_OBJ_ASM =$md5_obj\n";
print "SHA1_OBJ_ASM =$sha1_obj\n"; print "SHA1_OBJ_ASM =$sha1_obj\n";
print "RMD160_OBJ_ASM=$rmd160_obj\n"; print "RMD160_OBJ_ASM=$rmd160_obj\n";
print "CMLL_ENC= =$cmll_obj\n"; print "CMLL_ENC =$cmll_obj\n";
print "MODES_OBJ =$modes_obj\n";
print "ENGINES_OBJ =$engines_obj\n";
print "PROCESSOR =$processor\n"; print "PROCESSOR =$processor\n";
print "RANLIB =$ranlib\n"; print "RANLIB =$ranlib\n";
print "ARFLAGS =$arflags\n"; print "ARFLAGS =$arflags\n";
@@ -1650,6 +1857,9 @@ open(OUT,'>crypto/opensslconf.h.new') || die "unable to create crypto/opensslcon
print OUT "/* opensslconf.h */\n"; print OUT "/* opensslconf.h */\n";
print OUT "/* WARNING: Generated automatically from opensslconf.h.in by Configure. */\n\n"; print OUT "/* WARNING: Generated automatically from opensslconf.h.in by Configure. */\n\n";
print OUT "#ifdef __cplusplus\n";
print OUT "extern \"C\" {\n";
print OUT "#endif\n";
print OUT "/* OpenSSL was configured with the following options: */\n"; print OUT "/* OpenSSL was configured with the following options: */\n";
my $openssl_algorithm_defines_trans = $openssl_algorithm_defines; my $openssl_algorithm_defines_trans = $openssl_algorithm_defines;
$openssl_experimental_defines =~ s/^\s*#\s*define\s+OPENSSL_NO_(.*)/#ifndef OPENSSL_EXPERIMENTAL_$1\n# ifndef OPENSSL_NO_$1\n# define OPENSSL_NO_$1\n# endif\n#endif/mg; $openssl_experimental_defines =~ s/^\s*#\s*define\s+OPENSSL_NO_(.*)/#ifndef OPENSSL_EXPERIMENTAL_$1\n# ifndef OPENSSL_NO_$1\n# define OPENSSL_NO_$1\n# endif\n#endif/mg;
@@ -1754,6 +1964,9 @@ while (<IN>)
{ print OUT $_; } { print OUT $_; }
} }
close(IN); close(IN);
print OUT "#ifdef __cplusplus\n";
print OUT "}\n";
print OUT "#endif\n";
close(OUT); close(OUT);
rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h"; rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h";
rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n"; rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n";
@@ -1869,7 +2082,7 @@ BEGIN
VALUE "ProductVersion", "$version\\0" VALUE "ProductVersion", "$version\\0"
// Optional: // Optional:
//VALUE "Comments", "\\0" //VALUE "Comments", "\\0"
VALUE "LegalCopyright", "Copyright © 1998-2005 The OpenSSL Project. Copyright © 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0" VALUE "LegalCopyright", "Copyright © 1998-2005 The OpenSSL Project. Copyright © 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0"
//VALUE "LegalTrademarks", "\\0" //VALUE "LegalTrademarks", "\\0"
//VALUE "PrivateBuild", "\\0" //VALUE "PrivateBuild", "\\0"
//VALUE "SpecialBuild", "\\0" //VALUE "SpecialBuild", "\\0"
@@ -1978,11 +2191,12 @@ sub print_table_entry
{ {
my $target = shift; my $target = shift;
(my $cc,my $cflags,my $unistd,my $thread_cflag,my $sys_id,my $lflags, my ($cc, $cflags, $unistd, $thread_cflag, $sys_id, $lflags,
my $bn_ops,my $cpuid_obj,my $bn_obj,my $des_obj,my $aes_obj, my $bf_obj, $bn_ops, $cpuid_obj, $bn_obj, $ec_obj, $des_obj, $aes_obj, $bf_obj,
my $md5_obj,my $sha1_obj,my $cast_obj,my $rc4_obj,my $rmd160_obj, $md5_obj, $sha1_obj, $cast_obj, $rc4_obj, $rmd160_obj,
my $rc5_obj,my $wp_obj,my $cmll_obj,my $perlasm_scheme,my $dso_scheme,my $shared_target,my $shared_cflag, $rc5_obj, $wp_obj, $cmll_obj, $modes_obj, $engines_obj,
my $shared_ldflag,my $shared_extension,my $ranlib,my $arflags,my $multilib)= $perlasm_scheme, $dso_scheme, $shared_target, $shared_cflag,
$shared_ldflag, $shared_extension, $ranlib, $arflags, $multilib)=
split(/\s*:\s*/,$table{$target} . ":" x 30 , -1); split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
print <<EOF print <<EOF
@@ -1997,6 +2211,7 @@ sub print_table_entry
\$bn_ops = $bn_ops \$bn_ops = $bn_ops
\$cpuid_obj = $cpuid_obj \$cpuid_obj = $cpuid_obj
\$bn_obj = $bn_obj \$bn_obj = $bn_obj
\$ec_obj = $ec_obj
\$des_obj = $des_obj \$des_obj = $des_obj
\$aes_obj = $aes_obj \$aes_obj = $aes_obj
\$bf_obj = $bf_obj \$bf_obj = $bf_obj
@@ -2008,6 +2223,8 @@ sub print_table_entry
\$rc5_obj = $rc5_obj \$rc5_obj = $rc5_obj
\$wp_obj = $wp_obj \$wp_obj = $wp_obj
\$cmll_obj = $cmll_obj \$cmll_obj = $cmll_obj
\$modes_obj = $modes_obj
\$engines_obj = $engines_obj
\$perlasm_scheme = $perlasm_scheme \$perlasm_scheme = $perlasm_scheme
\$dso_scheme = $dso_scheme \$dso_scheme = $dso_scheme
\$shared_target= $shared_target \$shared_target= $shared_target

70
FAQ
View File

@@ -10,6 +10,7 @@ OpenSSL - Frequently Asked Questions
* Why aren't tools like 'autoconf' and 'libtool' used? * Why aren't tools like 'autoconf' and 'libtool' used?
* What is an 'engine' version? * What is an 'engine' version?
* How do I check the authenticity of the OpenSSL distribution? * How do I check the authenticity of the OpenSSL distribution?
* How does the versioning scheme work?
[LEGAL] Legal questions [LEGAL] Legal questions
@@ -82,11 +83,11 @@ OpenSSL - Frequently Asked Questions
* Which is the current version of OpenSSL? * Which is the current version of OpenSSL?
The current version is available from <URL: http://www.openssl.org>. The current version is available from <URL: http://www.openssl.org>.
OpenSSL 1.0.0d was released on Feb 8th, 2011. OpenSSL 1.0.1a was released on Apr 19th, 2012.
In addition to the current stable release, you can also access daily In addition to the current stable release, you can also access daily
snapshots of the OpenSSL development version at <URL: snapshots of the OpenSSL development version at <URL:
ftp://ftp.openssl.org/snapshot/>, or get it by anonymous CVS access. ftp://ftp.openssl.org/snapshot/>, or get it by anonymous Git access.
* Where is the documentation? * Where is the documentation?
@@ -108,12 +109,9 @@ In addition, you can read the most current versions at
<URL: http://www.openssl.org/docs/>. Note that the online documents refer <URL: http://www.openssl.org/docs/>. Note that the online documents refer
to the very latest development versions of OpenSSL and may include features to the very latest development versions of OpenSSL and may include features
not present in released versions. If in doubt refer to the documentation not present in released versions. If in doubt refer to the documentation
that came with the version of OpenSSL you are using. that came with the version of OpenSSL you are using. The pod format
documentation is included in each OpenSSL distribution under the docs
For information on parts of libcrypto that are not yet documented, you directory.
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 There is some documentation about certificate extensions and PKCS#12
in doc/openssl.txt in doc/openssl.txt
@@ -173,14 +171,31 @@ just do:
pgp TARBALL.asc pgp TARBALL.asc
* How does the versioning scheme work?
After the release of OpenSSL 1.0.0 the versioning scheme changed. Letter
releases (e.g. 1.0.1a) can only contain bug and security fixes and no
new features. Minor releases change the last number (e.g. 1.0.2) and
can contain new features that retain binary compatibility. Changes to
the middle number are considered major releases and neither source nor
binary compatibility is guaranteed.
Therefore the answer to the common question "when will feature X be
backported to OpenSSL 1.0.0/0.9.8?" is "never" but it could appear
in the next minor release.
* What happens when the letter release reaches z?
It was decided after the release of OpenSSL 0.9.8y the next version should
be 0.9.8za then 0.9.8zb and so on.
[LEGAL] ======================================================================= [LEGAL] =======================================================================
* Do I need patent licenses to use OpenSSL? * Do I need patent licenses to use OpenSSL?
The patents section of the README file lists patents that may apply to For information on intellectual property rights, please consult a lawyer.
you if you want to use OpenSSL. For information on intellectual The OpenSSL team does not offer legal advice.
property rights, please consult a lawyer. The OpenSSL team does not
offer legal advice.
You can configure OpenSSL so as not to use IDEA, MDC2 and RC5 by using You can configure OpenSSL so as not to use IDEA, MDC2 and RC5 by using
./config no-idea no-mdc2 no-rc5 ./config no-idea no-mdc2 no-rc5
@@ -284,7 +299,7 @@ current directory in this case, but this has changed with 0.9.6a.)
Check out the CA.pl(1) manual page. This provides a simple wrapper round 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 the 'req', 'verify', 'ca' and 'pkcs12' utilities. For finer control check
out the manual pages for the individual utilities and the certificate out the manual pages for the individual utilities and the certificate
extensions documentation (currently in doc/openssl.txt). extensions documentation (in ca(1), req(1), x509v3_config(5) )
* Why can't I create certificate requests? * Why can't I create certificate requests?
@@ -597,8 +612,8 @@ valid for the current DOS session.
* What is special about OpenSSL on Redhat? * What is special about OpenSSL on Redhat?
Red Hat Linux (release 7.0 and later) include a preinstalled limited Red Hat Linux (release 7.0 and later) include a preinstalled limited
version of OpenSSL. For patent reasons, support for IDEA, RC5 and MDC2 version of OpenSSL. Red Hat has chosen to disable support for IDEA, RC5 and
is disabled in this version. The same may apply to other Linux distributions. MDC2 in this version. The same may apply to other Linux distributions.
Users may therefore wish to install more or all of the features left out. Users may therefore wish to install more or all of the features left out.
To do this you MUST ensure that you do not overwrite the openssl that is in To do this you MUST ensure that you do not overwrite the openssl that is in
@@ -621,11 +636,6 @@ relevant updates in packages up to and including 0.9.6b.
A possible way around this is to persuade Red Hat to produce a non-US A possible way around this is to persuade Red Hat to produce a non-US
version of Red Hat Linux. version of Red Hat Linux.
FYI: Patent numbers and expiry dates of US patents:
MDC-2: 4,908,861 13/03/2007
IDEA: 5,214,703 25/05/2010
RC5: 5,724,428 03/03/2015
* Why does the OpenSSL compilation fail on MacOS X? * Why does the OpenSSL compilation fail on MacOS X?
@@ -752,6 +762,9 @@ openssl-security@openssl.org if you don't get a prompt reply at least
acknowledging receipt then resend or mail it directly to one of the acknowledging receipt then resend or mail it directly to one of the
more active team members (e.g. Steve). more active team members (e.g. Steve).
Note that bugs only present in the openssl utility are not in general
considered to be security issues.
[PROG] ======================================================================== [PROG] ========================================================================
* Is OpenSSL thread-safe? * Is OpenSSL thread-safe?
@@ -848,7 +861,7 @@ The opposite assumes we already have len bytes in buf:
p = buf; p = buf;
p7 = d2i_PKCS7(NULL, &p, len); p7 = d2i_PKCS7(NULL, &p, len);
At this point p7 contains a valid PKCS7 structure of NULL if an error At this point p7 contains a valid PKCS7 structure or NULL if an error
occurred. If an error occurred ERR_print_errors(bio) should give more occurred. If an error occurred ERR_print_errors(bio) should give more
information. information.
@@ -860,6 +873,21 @@ that has been read or written. This may well be uninitialized data
and attempts to free the buffer will have unpredictable results and attempts to free the buffer will have unpredictable results
because it no longer points to the same address. because it no longer points to the same address.
Memory allocation and encoding can also be combined in a single
operation by the ASN1 routines:
unsigned char *buf = NULL; /* mandatory */
int len;
len = i2d_PKCS7(p7, &buf);
if (len < 0)
/* Error */
/* Do some things with 'buf' */
/* Finished with buf: free it */
OPENSSL_free(buf);
In this special case the "buf" parameter is *not* incremented, it points
to the start of the encoding.
* OpenSSL uses DER but I need BER format: does OpenSSL support BER? * OpenSSL uses DER but I need BER format: does OpenSSL support BER?

8
GitConfigure Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
BRANCH=`git rev-parse --abbrev-ref HEAD`
./Configure $@ no-symlinks
make files
util/mk1mf.pl OUT=out.$BRANCH TMP=tmp.$BRANCH INC=inc.$BRANCH copy > makefile.$BRANCH
make -f makefile.$BRANCH init

5
GitMake Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
BRANCH=`git rev-parse --abbrev-ref HEAD`
make -f makefile.$BRANCH $@

View File

@@ -71,7 +71,7 @@ the top to understand how to use them. However, if you want to
compile all you can get, the simplest is to use MAKEVMS.COM in the top compile all you can get, the simplest is to use MAKEVMS.COM in the top
directory. The syntax is the following: directory. The syntax is the following:
@MAKEVMS <option> <rsaref-p> <debug-p> [<compiler>] @MAKEVMS <option> <bits> <debug-p> [<compiler>]
<option> must be one of the following: <option> must be one of the following:
@@ -87,24 +87,11 @@ directory. The syntax is the following:
TEST Just build the "[.xxx.EXE.TEST]" test programs for OpenSSL. TEST Just build the "[.xxx.EXE.TEST]" test programs for OpenSSL.
APPS Just build the "[.xxx.EXE.APPS]" application programs for OpenSSL. APPS Just build the "[.xxx.EXE.APPS]" application programs for OpenSSL.
<rsaref-p> must be one of the following: <bits> must be one of the following:
RSAREF compile using the RSAREF Library "" compile using default pointer size
NORSAREF compile without using RSAREF 32 compile using 32 bit pointer size
64 compile using 64 bit pointer size
Note 0: The RSAREF library IS NO LONGER NEEDED. The RSA patent
expires September 20, 2000, and RSA Security chose to make
the algorithm public domain two weeks before that.
Note 1: If you still want to use RSAREF, the library is NOT INCLUDED
and you have to download it. RSA Security doesn't carry it
any more, but there are a number of places where you can find
it. You have to get the ".tar-Z" file as the ".zip" file
doesn't have the directory structure stored. You have to
extract the file into the [.RSAREF] directory as that is where
the scripts will look for the files.
Note 2: I have never done this, so I've no idea if it works or not.
<debug-p> must be one of the following: <debug-p> must be one of the following:
@@ -117,12 +104,13 @@ Note 2: I have never done this, so I've no idea if it works or not.
GNUC For GNU C. GNUC For GNU C.
You will find the crypto library in [.xxx.EXE.CRYPTO], called LIBCRYPTO.OLB, You will find the crypto library in [.xxx.EXE.CRYPTO] (where xxx is VAX,
where xxx is VAX or AXP. You will find the SSL library in [.xxx.EXE.SSL], ALPHA or IA64), called SSL_LIBCRYPTO32.OLB or SSL_LIBCRYPTO.OLB depending
named LIBSSL.OLB, and you will find a bunch of useful programs in on how it was built. You will find the SSL library in [.xxx.EXE.SSL],
[.xxx.EXE.APPS]. However, these shouldn't be used right off unless it's named SSL_LIBSSL32.OLB or SSL_LIBSSL.OLB, and you will find a bunch of
just to test them. For production use, make sure you install first, see useful programs in [.xxx.EXE.APPS]. However, these shouldn't be used
Installation below. right off unless it's just to test them. For production use, make sure
you install first, see Installation below.
Note 1: Some programs in this package require a TCP/IP library. Note 1: Some programs in this package require a TCP/IP library.
@@ -144,7 +132,7 @@ Currently, the logical names supported are:
used. This is good to try if something doesn't work. used. This is good to try if something doesn't work.
OPENSSL_NO_'alg' with value YES, the corresponding crypto algorithm OPENSSL_NO_'alg' with value YES, the corresponding crypto algorithm
will not be implemented. Supported algorithms to will not be implemented. Supported algorithms to
do this with are: RSA, DSA, DH, MD2, MD4, MD5, RIPEMD, do this with are: RSA, DSA, DH, MD2, MD4, MD5, SM3, RIPEMD,
SHA, DES, MDC2, CR2, RC4, RC5, IDEA, BF, CAST, HMAC, SHA, DES, MDC2, CR2, RC4, RC5, IDEA, BF, CAST, HMAC,
SSL2. So, for example, having the logical name SSL2. So, for example, having the logical name
OPENSSL_NO_RSA with the value YES means that the OPENSSL_NO_RSA with the value YES means that the
@@ -170,12 +158,14 @@ Installation:
Installation is easy, just do the following: Installation is easy, just do the following:
@INSTALL <root> @INSTALL <root> <bits>
<root> is the directory in which everything will be installed, <root> is the directory in which everything will be installed,
subdirectories, libraries, header files, programs and startup command subdirectories, libraries, header files, programs and startup command
procedures. procedures.
<bits> works the same way as for MAKEVMS.COM
N.B.: INSTALL.COM builds a new directory structure, different from N.B.: INSTALL.COM builds a new directory structure, different from
the directory tree where you have now build OpenSSL. the directory tree where you have now build OpenSSL.
@@ -196,6 +186,10 @@ following command procedures:
sets up the symbols to the applications. Should be called sets up the symbols to the applications. Should be called
from for example SYS$MANAGER:SYLOGIN.COM from for example SYS$MANAGER:SYLOGIN.COM
OPENSSL_UNDO.COM
deassigns the logical names created with OPENSSL_STARTUP.COM.
The logical names that are set up are the following: The logical names that are set up are the following:
SSLROOT a dotted concealed logical name pointing at the SSLROOT a dotted concealed logical name pointing at the
@@ -203,7 +197,6 @@ The logical names that are set up are the following:
SSLCERTS Initially an empty directory, this is the default SSLCERTS Initially an empty directory, this is the default
location for certificate files. location for certificate files.
SSLMISC Various scripts.
SSLPRIVATE Initially an empty directory, this is the default SSLPRIVATE Initially an empty directory, this is the default
location for private key files. location for private key files.
@@ -211,8 +204,9 @@ The logical names that are set up are the following:
programs. programs.
SSLINCLUDE Contains the header files needed if you want to SSLINCLUDE Contains the header files needed if you want to
compile programs with libcrypto or libssl. compile programs with libcrypto or libssl.
SSLLIB Contains the OpenSSL library files (LIBCRYPTO.OLB SSLLIB Contains the OpenSSL library files themselves:
and LIBSSL.OLB) themselves. - SSL_LIBCRYPTO32.OLB and SSL_LIBSSL32.OLB or
- SSL_LIBCRYPTO.OLB and SSL_LIBSSL.OLB
OPENSSL Same as SSLINCLUDE. This is because the standard OPENSSL Same as SSLINCLUDE. This is because the standard
way to include OpenSSL header files from version way to include OpenSSL header files from version
@@ -296,4 +290,4 @@ have any ideas.
-- --
Richard Levitte <richard@levitte.org> Richard Levitte <richard@levitte.org>
2000-02-27 2000-02-27, 2011-03-18

View File

@@ -29,7 +29,7 @@
is required if you intend to utilize assembler modules. Note that NASM is required if you intend to utilize assembler modules. Note that NASM
is now the only supported assembler. is now the only supported assembler.
If you are compiling from a tarball or a CVS snapshot then the Win32 files If you are compiling from a tarball or a Git snapshot then the Win32 files
may well be not up to date. This may mean that some "tweaking" is required to may well be not up to date. This may mean that some "tweaking" is required to
get it all to work. See the trouble shooting section later on for if (when?) get it all to work. See the trouble shooting section later on for if (when?)
it goes wrong. it goes wrong.
@@ -257,7 +257,7 @@
then ms\do_XXX should not give a warning any more. However the numbers that then ms\do_XXX should not give a warning any more. However the numbers that
get assigned by this technique may not match those that eventually get get assigned by this technique may not match those that eventually get
assigned in the CVS tree: so anything linked against this version of the assigned in the Git tree: so anything linked against this version of the
library may need to be recompiled. library may need to be recompiled.
If you get errors about unresolved symbols there are several possible If you get errors about unresolved symbols there are several possible

View File

@@ -5,97 +5,98 @@
extern "C" { extern "C" {
#endif #endif
enum {
kMacSocket_TimeoutErr = -2
enum
{
kMacSocket_TimeoutErr = -2
}; };
// Since MacSocket does busy waiting, I do a callback while waiting
// Since MacSocket does busy waiting, I do a callback while waiting typedef OSErr(*MacSocket_IdleWaitCallback) (void *);
typedef OSErr (*MacSocket_IdleWaitCallback)(void *); // Call this before anything else!
// Call this before anything else!
OSErr MacSocket_Startup(void); OSErr MacSocket_Startup(void);
// Call this to cleanup before quitting
// Call this to cleanup before quitting
OSErr MacSocket_Shutdown(void); OSErr MacSocket_Shutdown(void);
// Call this to allocate a "socket" (reference number is returned in
// outSocketNum)
// Note that inDoThreadSwitching is pretty much irrelevant right now, since I
// ignore it
// The inTimeoutTicks parameter is applied during reads/writes of data
// The inIdleWaitCallback parameter specifies a callback which is called
// during busy-waiting periods
// The inUserRefPtr parameter is passed back to the idle-wait callback
// Call this to allocate a "socket" (reference number is returned in outSocketNum) OSErr MacSocket_socket(int *outSocketNum, const Boolean inDoThreadSwitching,
// Note that inDoThreadSwitching is pretty much irrelevant right now, since I ignore it const long inTimeoutTicks,
// The inTimeoutTicks parameter is applied during reads/writes of data MacSocket_IdleWaitCallback inIdleWaitCallback,
// The inIdleWaitCallback parameter specifies a callback which is called during busy-waiting periods void *inUserRefPtr);
// The inUserRefPtr parameter is passed back to the idle-wait callback
OSErr MacSocket_socket(int *outSocketNum,const Boolean inDoThreadSwitching,const long inTimeoutTicks,MacSocket_IdleWaitCallback inIdleWaitCallback,void *inUserRefPtr); // Call this to connect to an IP/DNS address
// Note that inTargetAddressAndPort is in "IP:port" format-- e.g.
// 10.1.1.1:123
OSErr MacSocket_connect(const int inSocketNum, char *inTargetAddressAndPort);
// Call this to connect to an IP/DNS address // Call this to listen on a port
// Note that inTargetAddressAndPort is in "IP:port" format-- e.g. 10.1.1.1:123 // Since this a low-performance implementation, I allow a maximum of 1 (one!)
// incoming request when I listen
OSErr MacSocket_connect(const int inSocketNum,char *inTargetAddressAndPort); OSErr MacSocket_listen(const int inSocketNum, const int inPortNum);
// Call this to close a socket
// Call this to listen on a port
// Since this a low-performance implementation, I allow a maximum of 1 (one!) incoming request when I listen
OSErr MacSocket_listen(const int inSocketNum,const int inPortNum);
// Call this to close a socket
OSErr MacSocket_close(const int inSocketNum); OSErr MacSocket_close(const int inSocketNum);
// Call this to receive data on a socket
// Most parameters' purpose are obvious-- except maybe "inBlock" which
// controls whether I wait for data or return immediately
// Call this to receive data on a socket int MacSocket_recv(const int inSocketNum, void *outBuff, int outBuffLength,
// Most parameters' purpose are obvious-- except maybe "inBlock" which controls whether I wait for data or return immediately const Boolean inBlock);
int MacSocket_recv(const int inSocketNum,void *outBuff,int outBuffLength,const Boolean inBlock); // Call this to send data on a socket
int MacSocket_send(const int inSocketNum, const void *inBuff,
int inBuffLength);
// Call this to send data on a socket // If zero bytes were read in a call to MacSocket_recv(), it may be that the
// remote end has done a half-close
int MacSocket_send(const int inSocketNum,const void *inBuff,int inBuffLength); // This function will let you check whether that's true or not
// If zero bytes were read in a call to MacSocket_recv(), it may be that the remote end has done a half-close
// This function will let you check whether that's true or not
Boolean MacSocket_RemoteEndIsClosing(const int inSocketNum); Boolean MacSocket_RemoteEndIsClosing(const int inSocketNum);
// Call this to see if the listen has completed after a call to
// Call this to see if the listen has completed after a call to MacSocket_listen() // MacSocket_listen()
Boolean MacSocket_ListenCompleted(const int inSocketNum); Boolean MacSocket_ListenCompleted(const int inSocketNum);
// These really aren't very useful anymore
// These really aren't very useful anymore
Boolean MacSocket_LocalEndIsOpen(const int inSocketNum); Boolean MacSocket_LocalEndIsOpen(const int inSocketNum);
Boolean MacSocket_RemoteEndIsOpen(const int inSocketNum); Boolean MacSocket_RemoteEndIsOpen(const int inSocketNum);
// You may wish to change the userRefPtr for a socket callback-- use this to
// do it
// You may wish to change the userRefPtr for a socket callback-- use this to do it void MacSocket_SetUserRefPtr(const int inSocketNum, void *inNewRefPtr);
void MacSocket_SetUserRefPtr(const int inSocketNum,void *inNewRefPtr); // Call these to get the socket's IP:port descriptor
void MacSocket_GetLocalIPAndPort(const int inSocketNum, char *outIPAndPort,
const int inIPAndPortLength);
void MacSocket_GetRemoteIPAndPort(const int inSocketNum, char *outIPAndPort,
const int inIPAndPortLength);
// Call these to get the socket's IP:port descriptor // Call this to get error info from a socket
void MacSocket_GetLocalIPAndPort(const int inSocketNum,char *outIPAndPort,const int inIPAndPortLength); void MacSocket_GetSocketErrorInfo(const int inSocketNum,
void MacSocket_GetRemoteIPAndPort(const int inSocketNum,char *outIPAndPort,const int inIPAndPortLength); int *outSocketErrCode,
char *outSocketErrString,
const int inSocketErrStringMaxLength);
// Call this to get error info from a socket
void MacSocket_GetSocketErrorInfo(const int inSocketNum,int *outSocketErrCode,char *outSocketErrString,const int inSocketErrStringMaxLength);
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -1,43 +1,42 @@
// Gathers unpredictable system data to be used for generating // Gathers unpredictable system data to be used for generating
// random bits // random bits
#include <MacTypes.h> #include <MacTypes.h>
class CRandomizer class CRandomizer {
{ public:
public: CRandomizer(void);
CRandomizer (void); void PeriodicAction(void);
void PeriodicAction (void);
private: private:
// Private calls // Private calls
void AddTimeSinceMachineStartup (void); void AddTimeSinceMachineStartup(void);
void AddAbsoluteSystemStartupTime (void); void AddAbsoluteSystemStartupTime(void);
void AddAppRunningTime (void); void AddAppRunningTime(void);
void AddStartupVolumeInfo (void); void AddStartupVolumeInfo(void);
void AddFiller (void); void AddFiller(void);
void AddCurrentMouse (void); void AddCurrentMouse(void);
void AddNow (double millisecondUncertainty); void AddNow(double millisecondUncertainty);
void AddBytes (void *data, long size, double entropy); void AddBytes(void *data, long size, double entropy);
void GetTimeBaseResolution (void); void GetTimeBaseResolution(void);
unsigned long SysTimer (void); unsigned long SysTimer(void);
// System Info // System Info
bool mSupportsLargeVolumes; bool mSupportsLargeVolumes;
bool mIsPowerPC; bool mIsPowerPC;
bool mIs601; bool mIs601;
// Time info // Time info
double mTimebaseTicksPerMillisec; double mTimebaseTicksPerMillisec;
unsigned long mLastPeriodicTicks; unsigned long mLastPeriodicTicks;
// Mouse info // Mouse info
long mSamplePeriod; long mSamplePeriod;
Point mLastMouse; Point mLastMouse;
long mMouseStill; long mMouseStill;
}; };

View File

@@ -1,9 +1,9 @@
#include <MacHeaders.h> #include <MacHeaders.h>
#define B_ENDIAN #define B_ENDIAN
#ifdef __POWERPC__ #ifdef __POWERPC__
#pragma longlong on # pragma longlong on
#endif #endif
#if 1 #if 1
#define MAC_OS_GUSI_SOURCE # define MAC_OS_GUSI_SOURCE
#endif #endif
#define MONOLITH #define MONOLITH

View File

@@ -1,9 +1,9 @@
#include <MacHeaders.h> #include <MacHeaders.h>
#define B_ENDIAN #define B_ENDIAN
#ifdef __POWERPC__ #ifdef __POWERPC__
#pragma longlong on # pragma longlong on
#endif #endif
#if 0 #if 0
#define MAC_OS_GUSI_SOURCE # define MAC_OS_GUSI_SOURCE
#endif #endif
#define MONOLITH #define MONOLITH

View File

@@ -1,5 +1,5 @@
#ifndef MK1MF_BUILD #ifndef MK1MF_BUILD
# define CFLAGS "-DB_ENDIAN" # define CFLAGS "-DB_ENDIAN"
# define PLATFORM "macos" # define PLATFORM "macos"
# define DATE "Sun Feb 27 19:44:16 MET 2000" # define DATE "Sun Feb 27 19:44:16 MET 2000"
#endif #endif

View File

@@ -1,116 +1,126 @@
/* MacOS/opensslconf.h */ /* MacOS/opensslconf.h */
#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ #if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) # if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
#define OPENSSLDIR "/usr/local/ssl" # define OPENSSLDIR "/usr/local/ssl"
#endif # endif
#endif #endif
#if defined(HEADER_IDEA_H) && !defined(IDEA_INT) #if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
#define IDEA_INT unsigned int # define IDEA_INT unsigned int
#endif #endif
#if defined(HEADER_MD2_H) && !defined(MD2_INT) #if defined(HEADER_MD2_H) && !defined(MD2_INT)
#define MD2_INT unsigned int # define MD2_INT unsigned int
#endif #endif
#if defined(HEADER_RC2_H) && !defined(RC2_INT) #if defined(HEADER_RC2_H) && !defined(RC2_INT)
/* I need to put in a mod for the alpha - eay */ /* I need to put in a mod for the alpha - eay */
#define RC2_INT unsigned int # define RC2_INT unsigned int
#endif #endif
#if defined(HEADER_RC4_H) #if defined(HEADER_RC4_H)
#if !defined(RC4_INT) # if !defined(RC4_INT)
/* using int types make the structure larger but make the code faster
* on most boxes I have tested - up to %20 faster. */
/* /*
* using int types make the structure larger but make the code faster on most
* boxes I have tested - up to %20 faster.
*/
/*-
* I don't know what does "most" mean, but declaring "int" is a must on: * I don't know what does "most" mean, but declaring "int" is a must on:
* - Intel P6 because partial register stalls are very expensive; * - Intel P6 because partial register stalls are very expensive;
* - elder Alpha because it lacks byte load/store instructions; * - elder Alpha because it lacks byte load/store instructions;
*/ */
#define RC4_INT unsigned char # define RC4_INT unsigned char
#endif # endif
#if !defined(RC4_CHUNK) # if !defined(RC4_CHUNK)
/* /*
* This enables code handling data aligned at natural CPU word * This enables code handling data aligned at natural CPU word
* boundary. See crypto/rc4/rc4_enc.c for further details. * boundary. See crypto/rc4/rc4_enc.c for further details.
*/ */
#define RC4_CHUNK unsigned long # define RC4_CHUNK unsigned long
#endif # endif
#endif #endif
#if defined(HEADER_DES_H) && !defined(DES_LONG) #if defined(HEADER_DES_H) && !defined(DES_LONG)
/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a /*
* %20 speed up (longs are 8 bytes, int's are 4). */ * If this is set to 'unsigned int' on a DEC Alpha, this gives about a %20
#ifndef DES_LONG * speed up (longs are 8 bytes, int's are 4).
#define DES_LONG unsigned long */
#endif # ifndef DES_LONG
# define DES_LONG unsigned long
# endif
#endif #endif
#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
#define CONFIG_HEADER_BN_H # define CONFIG_HEADER_BN_H
#if __option(longlong) # if __option(longlong)
# define BN_LLONG # define BN_LLONG
#else # else
# undef BN_LLONG # undef BN_LLONG
#endif # endif
/* Should we define BN_DIV2W here? */ /* Should we define BN_DIV2W here? */
/* Only one for the following should be defined */ /* Only one for the following should be defined */
/* The prime number generation stuff may not work when /*
* EIGHT_BIT but I don't care since I've only used this mode * The prime number generation stuff may not work when EIGHT_BIT but I don't
* for debuging the bignum libraries */ * care since I've only used this mode for debuging the bignum libraries
#undef SIXTY_FOUR_BIT_LONG */
#undef SIXTY_FOUR_BIT # undef SIXTY_FOUR_BIT_LONG
#define THIRTY_TWO_BIT # undef SIXTY_FOUR_BIT
#undef SIXTEEN_BIT # define THIRTY_TWO_BIT
#undef EIGHT_BIT # undef SIXTEEN_BIT
# undef EIGHT_BIT
#endif #endif
#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) #if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
#define CONFIG_HEADER_RC4_LOCL_H # define CONFIG_HEADER_RC4_LOCL_H
/* if this is defined data[i] is used instead of *data, this is a %20 /*
* speedup on x86 */ * if this is defined data[i] is used instead of *data, this is a %20 speedup
#undef RC4_INDEX * on x86
*/
# undef RC4_INDEX
#endif #endif
#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
#define CONFIG_HEADER_BF_LOCL_H # define CONFIG_HEADER_BF_LOCL_H
#define BF_PTR # define BF_PTR
#endif /* HEADER_BF_LOCL_H */ #endif /* HEADER_BF_LOCL_H */
#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
#define CONFIG_HEADER_DES_LOCL_H # define CONFIG_HEADER_DES_LOCL_H
/* the following is tweaked from a config script, that is why it is a /*
* protected undef/define */ * the following is tweaked from a config script, that is why it is a
#ifndef DES_PTR * protected undef/define
#define DES_PTR */
#endif # ifndef DES_PTR
# define DES_PTR
# endif
/* This helps C compiler generate the correct code for multiple functional /*
* This helps C compiler generate the correct code for multiple functional
* units. It reduces register dependancies at the expense of 2 more * units. It reduces register dependancies at the expense of 2 more
* registers */ * registers
#ifndef DES_RISC1 */
#define DES_RISC1 # ifndef DES_RISC1
#endif # define DES_RISC1
# endif
#ifndef DES_RISC2 # ifndef DES_RISC2
#undef DES_RISC2 # undef DES_RISC2
#endif # endif
#if defined(DES_RISC1) && defined(DES_RISC2)
YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
#endif
/* Unroll the inner loop, this sometimes helps, sometimes hinders.
* Very mucy CPU dependant */
#ifndef DES_UNROLL
#define DES_UNROLL
#endif
#endif /* HEADER_DES_LOCL_H */
# if defined(DES_RISC1) && defined(DES_RISC2)
YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED ! !!!!
# endif
/*
* Unroll the inner loop, this sometimes helps, sometimes hinders. Very mucy
* CPU dependant
*/
# ifndef DES_UNROLL
# define DES_UNROLL
# endif
#endif /* HEADER_DES_LOCL_H */
#ifndef __POWERPC__ #ifndef __POWERPC__
#define MD32_XARRAY # define MD32_XARRAY
#endif #endif

153
Makefile
View File

@@ -4,16 +4,16 @@
## Makefile for OpenSSL ## Makefile for OpenSSL
## ##
VERSION=1.0.0d VERSION=1.0.2d
MAJOR=1 MAJOR=1
MINOR=0.0 MINOR=0.2
SHLIB_VERSION_NUMBER=1.0.0 SHLIB_VERSION_NUMBER=1.0.0
SHLIB_VERSION_HISTORY= SHLIB_VERSION_HISTORY=
SHLIB_MAJOR=1 SHLIB_MAJOR=1
SHLIB_MINOR=0.0 SHLIB_MINOR=0.0
SHLIB_EXT=.$(SHLIB_MAJOR).$(SHLIB_MINOR).dylib SHLIB_EXT=.$(SHLIB_MAJOR).$(SHLIB_MINOR).dylib
PLATFORM=darwin-i386-cc PLATFORM=darwin-i386-cc
OPTIONS= no-gmp no-jpake no-krb5 no-md2 no-rc5 no-rfc3779 no-shared no-store no-zlib no-zlib-dynamic static-engine OPTIONS= no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-libunbound no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-ssl-trace no-store no-unit-test no-zlib no-zlib-dynamic static-engine
CONFIGURE_ARGS=darwin-i386-cc CONFIGURE_ARGS=darwin-i386-cc
SHLIB_TARGET=darwin-shared SHLIB_TARGET=darwin-shared
@@ -60,8 +60,8 @@ OPENSSLDIR=/usr/local/ssl
# PKCS1_CHECK - pkcs1 tests. # PKCS1_CHECK - pkcs1 tests.
CC= cc CC= cc
CFLAG= -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DWHIRLPOOL_ASM CFLAG= -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM
DEPFLAG= -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_STORE DEPFLAG= -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_LIBUNBOUND -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_SSL_TRACE -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST
PEX_LIBS= -Wl,-search_paths_first PEX_LIBS= -Wl,-search_paths_first
EX_LIBS= EX_LIBS=
EXE_EXT= EXE_EXT=
@@ -89,11 +89,12 @@ PROCESSOR=
# CPUID module collects small commonly used assembler snippets # CPUID module collects small commonly used assembler snippets
CPUID_OBJ= x86cpuid.o CPUID_OBJ= x86cpuid.o
BN_ASM= bn-586.o co-586.o x86-mont.o BN_ASM= bn-586.o co-586.o x86-mont.o x86-gf2m.o
EC_ASM=
DES_ENC= des-586.o crypt586.o DES_ENC= des-586.o crypt586.o
AES_ENC= aes-586.o AES_ENC= aes-586.o vpaes-x86.o aesni-x86.o
BF_ENC= bf-586.o BF_ENC= bf-586.o
CAST_ENC= cast-586.o CAST_ENC= c_enc.o
RC4_ENC= rc4-586.o RC4_ENC= rc4-586.o
RC5_ENC= rc5-586.o RC5_ENC= rc5-586.o
MD5_ASM_OBJ= md5-586.o MD5_ASM_OBJ= md5-586.o
@@ -101,6 +102,8 @@ SHA1_ASM_OBJ= sha1-586.o sha256-586.o sha512-586.o
RMD160_ASM_OBJ= rmd-586.o RMD160_ASM_OBJ= rmd-586.o
WP_ASM_OBJ= wp_block.o wp-mmx.o WP_ASM_OBJ= wp_block.o wp-mmx.o
CMLL_ENC= cmll-x86.o CMLL_ENC= cmll-x86.o
MODES_ASM_OBJ= ghash-x86.o
ENGINES_ASM_OBJ=
PERLASM_SCHEME= macosx PERLASM_SCHEME= macosx
# KRB5 stuff # KRB5 stuff
@@ -111,6 +114,30 @@ LIBKRB5=
ZLIB_INCLUDE= ZLIB_INCLUDE=
LIBZLIB= LIBZLIB=
# TOP level FIPS install directory.
FIPSDIR=/usr/local/ssl/fips-2.0
# This is the location of fipscanister.o and friends.
# The FIPS module build will place it $(INSTALLTOP)/lib
# but since $(INSTALLTOP) can only take the default value
# when the module is built it will be in /usr/local/ssl/lib
# $(INSTALLTOP) for this build may be different so hard
# code the path.
FIPSLIBDIR=
# The location of the library which contains fipscanister.o
# normally it will be libcrypto unless fipsdso is set in which
# case it will be libfips. If not compiling in FIPS mode at all
# this is empty making it a useful test for a FIPS compile.
FIPSCANLIB=
# Shared library base address. Currently only used on Windows.
#
BASEADDR=0xFB00000
DIRS= crypto ssl engines apps test tools DIRS= crypto ssl engines apps test tools
ENGDIRS= ccgost ENGDIRS= ccgost
SHLIBDIRS= crypto ssl SHLIBDIRS= crypto ssl
@@ -118,12 +145,12 @@ SHLIBDIRS= crypto ssl
# dirs in crypto to build # dirs in crypto to build
SDIRS= \ SDIRS= \
objects \ objects \
md4 md5 sha mdc2 hmac ripemd whrlpool \ md4 md5 sha mdc2 hmac sm3 sms4 ripemd whrlpool \
des aes rc2 rc4 idea bf cast camellia seed modes \ des aes rc2 rc4 idea bf cast camellia seed modes \
bn ec rsa dsa ecdsa dh ecdh dso engine \ bn ec rsa dsa ecdsa dh ecdh dso engine \
buffer bio stack lhash rand err \ buffer bio stack lhash rand err \
evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \ evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
cms pqueue ts cms pqueue ts srp cmac
# keep in mind that the above list is adjusted by ./Configure # keep in mind that the above list is adjusted by ./Configure
# according to no-xxx arguments... # according to no-xxx arguments...
@@ -160,7 +187,7 @@ WTARFILE= $(NAME)-win.tar
EXHEADER= e_os2.h EXHEADER= e_os2.h
HEADER= e_os.h HEADER= e_os.h
all: Makefile build_all openssl.pc libssl.pc libcrypto.pc all: Makefile build_all
# as we stick to -e, CLEARENV ensures that local variables in lower # as we stick to -e, CLEARENV ensures that local variables in lower
# Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn # Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn
@@ -174,7 +201,7 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS} \
$${EXHEADER+EXHEADER} $${HEADER+HEADER} \ $${EXHEADER+EXHEADER} $${HEADER+HEADER} \
$${GENERAL+GENERAL} $${CFLAGS+CFLAGS} \ $${GENERAL+GENERAL} $${CFLAGS+CFLAGS} \
$${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \ $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \
$${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} \ $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \
$${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \ $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \
$${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
@@ -197,8 +224,8 @@ BUILDENV= PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)' \ EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)' \
SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)' \ SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)' \
PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)' \ PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)' \
CPUID_OBJ='$(CPUID_OBJ)' \ CPUID_OBJ='$(CPUID_OBJ)' BN_ASM='$(BN_ASM)' \
BN_ASM='$(BN_ASM)' DES_ENC='$(DES_ENC)' \ EC_ASM='$(EC_ASM)' DES_ENC='$(DES_ENC)' \
AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)' \ AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)' \
BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)' \ BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)' \
RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)' \ RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)' \
@@ -206,7 +233,12 @@ BUILDENV= PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
MD5_ASM_OBJ='$(MD5_ASM_OBJ)' \ MD5_ASM_OBJ='$(MD5_ASM_OBJ)' \
RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)' \ RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)' \
WP_ASM_OBJ='$(WP_ASM_OBJ)' \ WP_ASM_OBJ='$(WP_ASM_OBJ)' \
MODES_ASM_OBJ='$(MODES_ASM_OBJ)' \
ENGINES_ASM_OBJ='$(ENGINES_ASM_OBJ)' \
PERLASM_SCHEME='$(PERLASM_SCHEME)' \ PERLASM_SCHEME='$(PERLASM_SCHEME)' \
FIPSLIBDIR='${FIPSLIBDIR}' \
FIPSDIR='${FIPSDIR}' \
FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}" \
THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES= THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
# MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors, # MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
# which in turn eliminates ambiguities in variable treatment with -e. # which in turn eliminates ambiguities in variable treatment with -e.
@@ -239,30 +271,46 @@ reflect:
@[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV) @[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
sub_all: build_all sub_all: build_all
build_all: build_libs build_apps build_tests build_tools build_all: build_libs build_apps build_tests build_tools
build_libs: build_crypto build_ssl build_engines build_libs: build_libcrypto build_libssl openssl.pc
build_libcrypto: build_crypto build_engines libcrypto.pc
build_libssl: build_ssl libssl.pc
build_crypto: build_crypto:
@dir=crypto; target=all; $(BUILD_ONE_CMD) @dir=crypto; target=all; $(BUILD_ONE_CMD)
build_ssl: build_ssl: build_crypto
@dir=ssl; target=all; $(BUILD_ONE_CMD) @dir=ssl; target=all; $(BUILD_ONE_CMD)
build_engines: build_engines: build_crypto
@dir=engines; target=all; $(BUILD_ONE_CMD) @dir=engines; target=all; $(BUILD_ONE_CMD)
build_apps: build_apps: build_libs
@dir=apps; target=all; $(BUILD_ONE_CMD) @dir=apps; target=all; $(BUILD_ONE_CMD)
build_tests: build_tests: build_libs
@dir=test; target=all; $(BUILD_ONE_CMD) @dir=test; target=all; $(BUILD_ONE_CMD)
build_tools: build_tools: build_libs
@dir=tools; target=all; $(BUILD_ONE_CMD) @dir=tools; target=all; $(BUILD_ONE_CMD)
all_testapps: build_libs build_testapps all_testapps: build_libs build_testapps
build_testapps: build_testapps:
@dir=crypto; target=testapps; $(BUILD_ONE_CMD) @dir=crypto; target=testapps; $(BUILD_ONE_CMD)
libcrypto$(SHLIB_EXT): libcrypto.a fips_premain_dso$(EXE_EXT): libcrypto.a
[ -z "$(FIPSCANLIB)" ] || $(CC) $(CFLAG) -Iinclude \
-DFINGERPRINT_PREMAIN_DSO_LOAD -o $@ \
$(FIPSLIBDIR)fips_premain.c $(FIPSLIBDIR)fipscanister.o \
libcrypto.a $(EX_LIBS)
libcrypto$(SHLIB_EXT): libcrypto.a fips_premain_dso$(EXE_EXT)
@if [ "$(SHLIB_TARGET)" != "" ]; then \ @if [ "$(SHLIB_TARGET)" != "" ]; then \
$(MAKE) SHLIBDIRS=crypto build-shared; \ if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
FIPSLD_LIBCRYPTO=libcrypto.a ; \
FIPSLD_CC="$(CC)"; CC=$(FIPSDIR)/bin/fipsld; \
export CC FIPSLD_CC FIPSLD_LIBCRYPTO; \
fi; \
$(MAKE) -e SHLIBDIRS=crypto CC="$${CC:-$(CC)}" build-shared && \
(touch -c fips_premain_dso$(EXE_EXT) || :); \
else \ else \
echo "There's no support for shared libraries on this platform" >&2; \ echo "There's no support for shared libraries on this platform" >&2; \
exit 1; \ exit 1; \
@@ -285,7 +333,7 @@ clean-shared:
done; \ done; \
fi; \ fi; \
( set -x; rm -f lib$$i$(SHLIB_EXT) ); \ ( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
if [ "$(PLATFORM)" = "Cygwin" ]; then \ if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \
( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \ ( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
fi; \ fi; \
done done
@@ -324,7 +372,8 @@ libcrypto.pc: Makefile
echo 'Description: OpenSSL cryptography library'; \ echo 'Description: OpenSSL cryptography library'; \
echo 'Version: '$(VERSION); \ echo 'Version: '$(VERSION); \
echo 'Requires: '; \ echo 'Requires: '; \
echo 'Libs: -L$${libdir} -lcrypto $(EX_LIBS)'; \ echo 'Libs: -L$${libdir} -lcrypto'; \
echo 'Libs.private: $(EX_LIBS)'; \
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc
libssl.pc: Makefile libssl.pc: Makefile
@@ -333,11 +382,12 @@ libssl.pc: Makefile
echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
echo 'includedir=$${prefix}/include'; \ echo 'includedir=$${prefix}/include'; \
echo ''; \ echo ''; \
echo 'Name: OpenSSL'; \ echo 'Name: OpenSSL-libssl'; \
echo 'Description: Secure Sockets Layer and cryptography libraries'; \ echo 'Description: Secure Sockets Layer and cryptography libraries'; \
echo 'Version: '$(VERSION); \ echo 'Version: '$(VERSION); \
echo 'Requires: '; \ echo 'Requires.private: libcrypto'; \
echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \ echo 'Libs: -L$${libdir} -lssl'; \
echo 'Libs.private: $(EX_LIBS)'; \
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc
openssl.pc: Makefile openssl.pc: Makefile
@@ -349,9 +399,7 @@ openssl.pc: Makefile
echo 'Name: OpenSSL'; \ echo 'Name: OpenSSL'; \
echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \ echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
echo 'Version: '$(VERSION); \ echo 'Version: '$(VERSION); \
echo 'Requires: '; \ echo 'Requires: libssl libcrypto' ) > openssl.pc
echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
Makefile: Makefile.org Configure config Makefile: Makefile.org Configure config
@echo "Makefile is older than Makefile.org, Configure or config." @echo "Makefile is older than Makefile.org, Configure or config."
@@ -359,7 +407,7 @@ Makefile: Makefile.org Configure config
@false @false
libclean: libclean:
rm -f *.map *.so *.so.* *.dll engines/*.so engines/*.dll *.a engines/*.a */lib */*/lib rm -f *.map *.so *.so.* *.dylib *.dll engines/*.so engines/*.dll engines/*.dylib *.a engines/*.a */lib */*/lib
clean: libclean clean: libclean
rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
@@ -401,7 +449,7 @@ rehash.time: certs apps
[ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \ [ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \
OPENSSL_DEBUG_MEMORY=on; \ OPENSSL_DEBUG_MEMORY=on; \
export OPENSSL OPENSSL_DEBUG_MEMORY; \ export OPENSSL OPENSSL_DEBUG_MEMORY; \
$(PERL) tools/c_rehash certs) && \ $(PERL) tools/c_rehash certs/demo) && \
touch rehash.time; \ touch rehash.time; \
else :; fi else :; fi
@@ -415,6 +463,9 @@ tests: rehash
report: report:
@$(PERL) util/selftest.pl @$(PERL) util/selftest.pl
update: errors stacks util/libeay.num util/ssleay.num TABLE
@set -e; target=update; $(RECURSIVE_BUILD_CMD)
depend: depend:
@set -e; target=depend; $(RECURSIVE_BUILD_CMD) @set -e; target=depend; $(RECURSIVE_BUILD_CMD)
@@ -426,9 +477,9 @@ tags:
find . -name '[^.]*.[ch]' | xargs etags -a find . -name '[^.]*.[ch]' | xargs etags -a
errors: errors:
$(PERL) util/ck_errf.pl -strict */*.c */*/*.c
$(PERL) util/mkerr.pl -recurse -write $(PERL) util/mkerr.pl -recurse -write
(cd engines; $(MAKE) PERL=$(PERL) errors) (cd engines; $(MAKE) PERL=$(PERL) errors)
$(PERL) util/ck_errf.pl */*.c */*/*.c
stacks: stacks:
$(PERL) util/mkstack.pl -write $(PERL) util/mkstack.pl -write
@@ -439,26 +490,10 @@ util/libeay.num::
util/ssleay.num:: util/ssleay.num::
$(PERL) util/mkdef.pl ssl update $(PERL) util/mkdef.pl ssl update
crypto/objects/obj_dat.h: crypto/objects/obj_dat.pl crypto/objects/obj_mac.h
$(PERL) crypto/objects/obj_dat.pl crypto/objects/obj_mac.h crypto/objects/obj_dat.h
crypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num
$(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num crypto/objects/obj_mac.h
crypto/objects/obj_xref.h: crypto/objects/objxref.pl crypto/objects/obj_xref.txt crypto/objects/obj_mac.num
$(PERL) crypto/objects/objxref.pl crypto/objects/obj_mac.num crypto/objects/obj_xref.txt >crypto/objects/obj_xref.h
apps/openssl-vms.cnf: apps/openssl.cnf
$(PERL) VMS/VMSify-conf.pl < apps/openssl.cnf > apps/openssl-vms.cnf
crypto/bn/bn_prime.h: crypto/bn/bn_prime.pl
$(PERL) crypto/bn/bn_prime.pl >crypto/bn/bn_prime.h
TABLE: Configure TABLE: Configure
(echo 'Output of `Configure TABLE'"':"; \ (echo 'Output of `Configure TABLE'"':"; \
$(PERL) Configure TABLE) > TABLE $(PERL) Configure TABLE) > TABLE
update: errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h crypto/objects/obj_xref.h apps/openssl-vms.cnf crypto/bn/bn_prime.h TABLE depend
# Build distribution tar-file. As the list of files returned by "find" is # Build distribution tar-file. As the list of files returned by "find" is
# pretty long, on several platforms a "too many arguments" error or similar # pretty long, on several platforms a "too many arguments" error or similar
# would occur. Therefore the list of files is temporarily stored into a file # would occur. Therefore the list of files is temporarily stored into a file
@@ -511,7 +546,7 @@ install_sw:
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
done; done;
@set -e; target=install; $(RECURSIVE_BUILD_CMD) @set -e; target=install; $(RECURSIVE_BUILD_CMD)
@set -e; for i in $(LIBS) ;\ @set -e; liblist="$(LIBS)"; for i in $$liblist ;\
do \ do \
if [ -f "$$i" ]; then \ if [ -f "$$i" ]; then \
( echo installing $$i; \ ( echo installing $$i; \
@@ -527,11 +562,7 @@ install_sw:
do \ do \
if [ -f "$$i" -o -f "$$i.a" ]; then \ if [ -f "$$i" -o -f "$$i.a" ]; then \
( echo installing $$i; \ ( echo installing $$i; \
if [ "$(PLATFORM)" != "Cygwin" ]; then \ if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
else \
c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \ c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \ cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \ chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
@@ -539,6 +570,10 @@ install_sw:
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \ cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \ chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \ mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
else \
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
fi ); \ fi ); \
if expr $(PLATFORM) : 'mingw' > /dev/null; then \ if expr $(PLATFORM) : 'mingw' > /dev/null; then \
( case $$i in \ ( case $$i in \
@@ -571,6 +606,10 @@ install_sw:
install_html_docs: install_html_docs:
here="`pwd`"; \ here="`pwd`"; \
filecase=; \
case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
filecase=-i; \
esac; \
for subdir in apps crypto ssl; do \ for subdir in apps crypto ssl; do \
mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \ mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
for i in doc/$$subdir/*.pod; do \ for i in doc/$$subdir/*.pod; do \
@@ -599,9 +638,9 @@ install_docs:
@pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \ @pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \
here="`pwd`"; \ here="`pwd`"; \
filecase=; \ filecase=; \
if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" -o "$(PLATFORM)" = "mingw" ]; then \ case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
filecase=-i; \ filecase=-i; \
fi; \ esac; \
set -e; for i in doc/apps/*.pod; do \ set -e; for i in doc/apps/*.pod; do \
fn=`basename $$i .pod`; \ fn=`basename $$i .pod`; \
sec=`$(PERL) util/extract-section.pl 1 < $$i`; \ sec=`$(PERL) util/extract-section.pl 1 < $$i`; \

View File

@@ -4,18 +4,18 @@
## Makefile for OpenSSL ## Makefile for OpenSSL
## ##
VERSION=1.0.0d VERSION=1.0.2d
MAJOR=1 MAJOR=1
MINOR=0.0 MINOR=0.2
SHLIB_VERSION_NUMBER=1.0.0 SHLIB_VERSION_NUMBER=1.0.0
SHLIB_VERSION_HISTORY= SHLIB_VERSION_HISTORY=
SHLIB_MAJOR=1 SHLIB_MAJOR=1
SHLIB_MINOR=0.0 SHLIB_MINOR=0.0
SHLIB_EXT=.so.$(SHLIB_MAJOR).$(SHLIB_MINOR) SHLIB_EXT=.$(SHLIB_MAJOR).$(SHLIB_MINOR).dylib
PLATFORM=linux-x86_64 PLATFORM=darwin-i386-cc
OPTIONS= no-gmp no-jpake no-krb5 no-md2 no-rc5 no-rfc3779 no-shared no-store no-zlib no-zlib-dynamic static-engine OPTIONS= no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-libunbound no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-ssl-trace no-store no-unit-test no-zlib no-zlib-dynamic static-engine
CONFIGURE_ARGS=linux-x86_64 CONFIGURE_ARGS=darwin-i386-cc
SHLIB_TARGET=linux-shared SHLIB_TARGET=darwin-shared
# HERE indicates where this Makefile lives. This can be used to indicate # HERE indicates where this Makefile lives. This can be used to indicate
# where sub-Makefiles are expected to be. Currently has very limited usage, # where sub-Makefiles are expected to be. Currently has very limited usage,
@@ -59,20 +59,20 @@ OPENSSLDIR=/usr/local/ssl
# equal 4. # equal 4.
# PKCS1_CHECK - pkcs1 tests. # PKCS1_CHECK - pkcs1 tests.
CC= gcc CC= cc
CFLAG= -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DWHIRLPOOL_ASM CFLAG= -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM
DEPFLAG= -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_STORE DEPFLAG= -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_LIBUNBOUND -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_SSL_TRACE -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST
PEX_LIBS= PEX_LIBS= -Wl,-search_paths_first
EX_LIBS= -ldl EX_LIBS=
EXE_EXT= EXE_EXT=
ARFLAGS= ARFLAGS=
AR= ar $(ARFLAGS) r AR= ar $(ARFLAGS) r
RANLIB= /usr/bin/ranlib RANLIB= /opt/local/bin/ranlib
NM= nm NM= nm
PERL= /usr/bin/perl PERL= /opt/local/bin/perl5
TAR= tar TAR= tar
TARFLAGS= --no-recursion TARFLAGS= --no-recursion
MAKEDEPPROG= gcc MAKEDEPPROG=makedepend
LIBDIR=lib LIBDIR=lib
# We let the C compiler driver to take care of .s files. This is done in # We let the C compiler driver to take care of .s files. This is done in
@@ -88,20 +88,23 @@ ASFLAG=$(CFLAG)
PROCESSOR= PROCESSOR=
# CPUID module collects small commonly used assembler snippets # CPUID module collects small commonly used assembler snippets
CPUID_OBJ= x86_64cpuid.o CPUID_OBJ= x86cpuid.o
BN_ASM= x86_64-gcc.o x86_64-mont.o BN_ASM= bn-586.o co-586.o x86-mont.o x86-gf2m.o
DES_ENC= des_enc.o fcrypt_b.o EC_ASM=
AES_ENC= aes-x86_64.o DES_ENC= des-586.o crypt586.o
BF_ENC= bf_enc.o AES_ENC= aes-586.o vpaes-x86.o aesni-x86.o
BF_ENC= bf-586.o
CAST_ENC= c_enc.o CAST_ENC= c_enc.o
RC4_ENC= rc4-x86_64.o RC4_ENC= rc4-586.o
RC5_ENC= rc5_enc.o RC5_ENC= rc5-586.o
MD5_ASM_OBJ= md5-x86_64.o MD5_ASM_OBJ= md5-586.o
SHA1_ASM_OBJ= sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o SHA1_ASM_OBJ= sha1-586.o sha256-586.o sha512-586.o
RMD160_ASM_OBJ= RMD160_ASM_OBJ= rmd-586.o
WP_ASM_OBJ= wp-x86_64.o WP_ASM_OBJ= wp_block.o wp-mmx.o
CMLL_ENC= cmll-x86_64.o cmll_misc.o CMLL_ENC= cmll-x86.o
PERLASM_SCHEME= elf MODES_ASM_OBJ= ghash-x86.o
ENGINES_ASM_OBJ=
PERLASM_SCHEME= macosx
# KRB5 stuff # KRB5 stuff
KRB5_INCLUDES= KRB5_INCLUDES=
@@ -111,6 +114,30 @@ LIBKRB5=
ZLIB_INCLUDE= ZLIB_INCLUDE=
LIBZLIB= LIBZLIB=
# TOP level FIPS install directory.
FIPSDIR=/usr/local/ssl/fips-2.0
# This is the location of fipscanister.o and friends.
# The FIPS module build will place it $(INSTALLTOP)/lib
# but since $(INSTALLTOP) can only take the default value
# when the module is built it will be in /usr/local/ssl/lib
# $(INSTALLTOP) for this build may be different so hard
# code the path.
FIPSLIBDIR=
# The location of the library which contains fipscanister.o
# normally it will be libcrypto unless fipsdso is set in which
# case it will be libfips. If not compiling in FIPS mode at all
# this is empty making it a useful test for a FIPS compile.
FIPSCANLIB=
# Shared library base address. Currently only used on Windows.
#
BASEADDR=0xFB00000
DIRS= crypto ssl engines apps test tools DIRS= crypto ssl engines apps test tools
ENGDIRS= ccgost ENGDIRS= ccgost
SHLIBDIRS= crypto ssl SHLIBDIRS= crypto ssl
@@ -118,12 +145,12 @@ SHLIBDIRS= crypto ssl
# dirs in crypto to build # dirs in crypto to build
SDIRS= \ SDIRS= \
objects \ objects \
md4 md5 sha mdc2 hmac ripemd whrlpool \ md4 md5 sha mdc2 hmac sm3 sms4 ripemd whrlpool \
des aes rc2 rc4 idea bf cast camellia seed modes \ des aes rc2 rc4 idea bf cast camellia seed modes \
bn ec rsa dsa ecdsa dh ecdh dso engine \ bn ec rsa dsa ecdsa dh ecdh dso engine \
buffer bio stack lhash rand err \ buffer bio stack lhash rand err \
evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \ evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
cms pqueue ts cms pqueue ts srp cmac
# keep in mind that the above list is adjusted by ./Configure # keep in mind that the above list is adjusted by ./Configure
# according to no-xxx arguments... # according to no-xxx arguments...
@@ -149,8 +176,8 @@ LIBS= libcrypto.a libssl.a
SHARED_CRYPTO=libcrypto$(SHLIB_EXT) SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
SHARED_SSL=libssl$(SHLIB_EXT) SHARED_SSL=libssl$(SHLIB_EXT)
SHARED_LIBS= SHARED_LIBS=
SHARED_LIBS_LINK_EXTS=.so.$(SHLIB_MAJOR) .so SHARED_LIBS_LINK_EXTS=.$(SHLIB_MAJOR).dylib .dylib
SHARED_LDFLAGS=-m64 SHARED_LDFLAGS=-arch i386 -dynamiclib
GENERAL= Makefile GENERAL= Makefile
BASENAME= openssl BASENAME= openssl
@@ -160,7 +187,7 @@ WTARFILE= $(NAME)-win.tar
EXHEADER= e_os2.h EXHEADER= e_os2.h
HEADER= e_os.h HEADER= e_os.h
all: Makefile build_all openssl.pc libssl.pc libcrypto.pc all: Makefile build_all
# as we stick to -e, CLEARENV ensures that local variables in lower # as we stick to -e, CLEARENV ensures that local variables in lower
# Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn # Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn
@@ -174,7 +201,7 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS} \
$${EXHEADER+EXHEADER} $${HEADER+HEADER} \ $${EXHEADER+EXHEADER} $${HEADER+HEADER} \
$${GENERAL+GENERAL} $${CFLAGS+CFLAGS} \ $${GENERAL+GENERAL} $${CFLAGS+CFLAGS} \
$${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \ $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \
$${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} \ $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \
$${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \ $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \
$${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
@@ -197,8 +224,8 @@ BUILDENV= PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)' \ EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)' \
SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)' \ SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)' \
PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)' \ PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)' \
CPUID_OBJ='$(CPUID_OBJ)' \ CPUID_OBJ='$(CPUID_OBJ)' BN_ASM='$(BN_ASM)' \
BN_ASM='$(BN_ASM)' DES_ENC='$(DES_ENC)' \ EC_ASM='$(EC_ASM)' DES_ENC='$(DES_ENC)' \
AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)' \ AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)' \
BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)' \ BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)' \
RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)' \ RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)' \
@@ -206,7 +233,12 @@ BUILDENV= PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
MD5_ASM_OBJ='$(MD5_ASM_OBJ)' \ MD5_ASM_OBJ='$(MD5_ASM_OBJ)' \
RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)' \ RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)' \
WP_ASM_OBJ='$(WP_ASM_OBJ)' \ WP_ASM_OBJ='$(WP_ASM_OBJ)' \
MODES_ASM_OBJ='$(MODES_ASM_OBJ)' \
ENGINES_ASM_OBJ='$(ENGINES_ASM_OBJ)' \
PERLASM_SCHEME='$(PERLASM_SCHEME)' \ PERLASM_SCHEME='$(PERLASM_SCHEME)' \
FIPSLIBDIR='${FIPSLIBDIR}' \
FIPSDIR='${FIPSDIR}' \
FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}" \
THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES= THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
# MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors, # MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
# which in turn eliminates ambiguities in variable treatment with -e. # which in turn eliminates ambiguities in variable treatment with -e.
@@ -239,30 +271,46 @@ reflect:
@[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV) @[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
sub_all: build_all sub_all: build_all
build_all: build_libs build_apps build_tests build_tools build_all: build_libs build_apps build_tests build_tools
build_libs: build_crypto build_ssl build_engines build_libs: build_libcrypto build_libssl openssl.pc
build_libcrypto: build_crypto build_engines libcrypto.pc
build_libssl: build_ssl libssl.pc
build_crypto: build_crypto:
@dir=crypto; target=all; $(BUILD_ONE_CMD) @dir=crypto; target=all; $(BUILD_ONE_CMD)
build_ssl: build_ssl: build_crypto
@dir=ssl; target=all; $(BUILD_ONE_CMD) @dir=ssl; target=all; $(BUILD_ONE_CMD)
build_engines: build_engines: build_crypto
@dir=engines; target=all; $(BUILD_ONE_CMD) @dir=engines; target=all; $(BUILD_ONE_CMD)
build_apps: build_apps: build_libs
@dir=apps; target=all; $(BUILD_ONE_CMD) @dir=apps; target=all; $(BUILD_ONE_CMD)
build_tests: build_tests: build_libs
@dir=test; target=all; $(BUILD_ONE_CMD) @dir=test; target=all; $(BUILD_ONE_CMD)
build_tools: build_tools: build_libs
@dir=tools; target=all; $(BUILD_ONE_CMD) @dir=tools; target=all; $(BUILD_ONE_CMD)
all_testapps: build_libs build_testapps all_testapps: build_libs build_testapps
build_testapps: build_testapps:
@dir=crypto; target=testapps; $(BUILD_ONE_CMD) @dir=crypto; target=testapps; $(BUILD_ONE_CMD)
libcrypto$(SHLIB_EXT): libcrypto.a fips_premain_dso$(EXE_EXT): libcrypto.a
[ -z "$(FIPSCANLIB)" ] || $(CC) $(CFLAG) -Iinclude \
-DFINGERPRINT_PREMAIN_DSO_LOAD -o $@ \
$(FIPSLIBDIR)fips_premain.c $(FIPSLIBDIR)fipscanister.o \
libcrypto.a $(EX_LIBS)
libcrypto$(SHLIB_EXT): libcrypto.a fips_premain_dso$(EXE_EXT)
@if [ "$(SHLIB_TARGET)" != "" ]; then \ @if [ "$(SHLIB_TARGET)" != "" ]; then \
$(MAKE) SHLIBDIRS=crypto build-shared; \ if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
FIPSLD_LIBCRYPTO=libcrypto.a ; \
FIPSLD_CC="$(CC)"; CC=$(FIPSDIR)/bin/fipsld; \
export CC FIPSLD_CC FIPSLD_LIBCRYPTO; \
fi; \
$(MAKE) -e SHLIBDIRS=crypto CC="$${CC:-$(CC)}" build-shared && \
(touch -c fips_premain_dso$(EXE_EXT) || :); \
else \ else \
echo "There's no support for shared libraries on this platform" >&2; \ echo "There's no support for shared libraries on this platform" >&2; \
exit 1; \ exit 1; \
@@ -285,7 +333,7 @@ clean-shared:
done; \ done; \
fi; \ fi; \
( set -x; rm -f lib$$i$(SHLIB_EXT) ); \ ( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
if [ "$(PLATFORM)" = "Cygwin" ]; then \ if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \
( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \ ( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
fi; \ fi; \
done done
@@ -324,7 +372,8 @@ libcrypto.pc: Makefile
echo 'Description: OpenSSL cryptography library'; \ echo 'Description: OpenSSL cryptography library'; \
echo 'Version: '$(VERSION); \ echo 'Version: '$(VERSION); \
echo 'Requires: '; \ echo 'Requires: '; \
echo 'Libs: -L$${libdir} -lcrypto $(EX_LIBS)'; \ echo 'Libs: -L$${libdir} -lcrypto'; \
echo 'Libs.private: $(EX_LIBS)'; \
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc
libssl.pc: Makefile libssl.pc: Makefile
@@ -333,11 +382,12 @@ libssl.pc: Makefile
echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
echo 'includedir=$${prefix}/include'; \ echo 'includedir=$${prefix}/include'; \
echo ''; \ echo ''; \
echo 'Name: OpenSSL'; \ echo 'Name: OpenSSL-libssl'; \
echo 'Description: Secure Sockets Layer and cryptography libraries'; \ echo 'Description: Secure Sockets Layer and cryptography libraries'; \
echo 'Version: '$(VERSION); \ echo 'Version: '$(VERSION); \
echo 'Requires: '; \ echo 'Requires.private: libcrypto'; \
echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \ echo 'Libs: -L$${libdir} -lssl'; \
echo 'Libs.private: $(EX_LIBS)'; \
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc
openssl.pc: Makefile openssl.pc: Makefile
@@ -349,9 +399,7 @@ openssl.pc: Makefile
echo 'Name: OpenSSL'; \ echo 'Name: OpenSSL'; \
echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \ echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
echo 'Version: '$(VERSION); \ echo 'Version: '$(VERSION); \
echo 'Requires: '; \ echo 'Requires: libssl libcrypto' ) > openssl.pc
echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
Makefile: Makefile.org Configure config Makefile: Makefile.org Configure config
@echo "Makefile is older than Makefile.org, Configure or config." @echo "Makefile is older than Makefile.org, Configure or config."
@@ -359,7 +407,7 @@ Makefile: Makefile.org Configure config
@false @false
libclean: libclean:
rm -f *.map *.so *.so.* *.dll engines/*.so engines/*.dll *.a engines/*.a */lib */*/lib rm -f *.map *.so *.so.* *.dylib *.dll engines/*.so engines/*.dll engines/*.dylib *.a engines/*.a */lib */*/lib
clean: libclean clean: libclean
rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
@@ -401,7 +449,7 @@ rehash.time: certs apps
[ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \ [ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \
OPENSSL_DEBUG_MEMORY=on; \ OPENSSL_DEBUG_MEMORY=on; \
export OPENSSL OPENSSL_DEBUG_MEMORY; \ export OPENSSL OPENSSL_DEBUG_MEMORY; \
$(PERL) tools/c_rehash certs) && \ $(PERL) tools/c_rehash certs/demo) && \
touch rehash.time; \ touch rehash.time; \
else :; fi else :; fi
@@ -415,6 +463,9 @@ tests: rehash
report: report:
@$(PERL) util/selftest.pl @$(PERL) util/selftest.pl
update: errors stacks util/libeay.num util/ssleay.num TABLE
@set -e; target=update; $(RECURSIVE_BUILD_CMD)
depend: depend:
@set -e; target=depend; $(RECURSIVE_BUILD_CMD) @set -e; target=depend; $(RECURSIVE_BUILD_CMD)
@@ -426,9 +477,9 @@ tags:
find . -name '[^.]*.[ch]' | xargs etags -a find . -name '[^.]*.[ch]' | xargs etags -a
errors: errors:
$(PERL) util/ck_errf.pl -strict */*.c */*/*.c
$(PERL) util/mkerr.pl -recurse -write $(PERL) util/mkerr.pl -recurse -write
(cd engines; $(MAKE) PERL=$(PERL) errors) (cd engines; $(MAKE) PERL=$(PERL) errors)
$(PERL) util/ck_errf.pl */*.c */*/*.c
stacks: stacks:
$(PERL) util/mkstack.pl -write $(PERL) util/mkstack.pl -write
@@ -439,26 +490,10 @@ util/libeay.num::
util/ssleay.num:: util/ssleay.num::
$(PERL) util/mkdef.pl ssl update $(PERL) util/mkdef.pl ssl update
crypto/objects/obj_dat.h: crypto/objects/obj_dat.pl crypto/objects/obj_mac.h
$(PERL) crypto/objects/obj_dat.pl crypto/objects/obj_mac.h crypto/objects/obj_dat.h
crypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num
$(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num crypto/objects/obj_mac.h
crypto/objects/obj_xref.h: crypto/objects/objxref.pl crypto/objects/obj_xref.txt crypto/objects/obj_mac.num
$(PERL) crypto/objects/objxref.pl crypto/objects/obj_mac.num crypto/objects/obj_xref.txt >crypto/objects/obj_xref.h
apps/openssl-vms.cnf: apps/openssl.cnf
$(PERL) VMS/VMSify-conf.pl < apps/openssl.cnf > apps/openssl-vms.cnf
crypto/bn/bn_prime.h: crypto/bn/bn_prime.pl
$(PERL) crypto/bn/bn_prime.pl >crypto/bn/bn_prime.h
TABLE: Configure TABLE: Configure
(echo 'Output of `Configure TABLE'"':"; \ (echo 'Output of `Configure TABLE'"':"; \
$(PERL) Configure TABLE) > TABLE $(PERL) Configure TABLE) > TABLE
update: errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h crypto/objects/obj_xref.h apps/openssl-vms.cnf crypto/bn/bn_prime.h TABLE depend
# Build distribution tar-file. As the list of files returned by "find" is # Build distribution tar-file. As the list of files returned by "find" is
# pretty long, on several platforms a "too many arguments" error or similar # pretty long, on several platforms a "too many arguments" error or similar
# would occur. Therefore the list of files is temporarily stored into a file # would occur. Therefore the list of files is temporarily stored into a file
@@ -511,7 +546,7 @@ install_sw:
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
done; done;
@set -e; target=install; $(RECURSIVE_BUILD_CMD) @set -e; target=install; $(RECURSIVE_BUILD_CMD)
@set -e; for i in $(LIBS) ;\ @set -e; liblist="$(LIBS)"; for i in $$liblist ;\
do \ do \
if [ -f "$$i" ]; then \ if [ -f "$$i" ]; then \
( echo installing $$i; \ ( echo installing $$i; \
@@ -527,11 +562,7 @@ install_sw:
do \ do \
if [ -f "$$i" -o -f "$$i.a" ]; then \ if [ -f "$$i" -o -f "$$i.a" ]; then \
( echo installing $$i; \ ( echo installing $$i; \
if [ "$(PLATFORM)" != "Cygwin" ]; then \ if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
else \
c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \ c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \ cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \ chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
@@ -539,6 +570,10 @@ install_sw:
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \ cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \ chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \ mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
else \
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
fi ); \ fi ); \
if expr $(PLATFORM) : 'mingw' > /dev/null; then \ if expr $(PLATFORM) : 'mingw' > /dev/null; then \
( case $$i in \ ( case $$i in \
@@ -571,6 +606,10 @@ install_sw:
install_html_docs: install_html_docs:
here="`pwd`"; \ here="`pwd`"; \
filecase=; \
case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
filecase=-i; \
esac; \
for subdir in apps crypto ssl; do \ for subdir in apps crypto ssl; do \
mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \ mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
for i in doc/$$subdir/*.pod; do \ for i in doc/$$subdir/*.pod; do \
@@ -599,9 +638,9 @@ install_docs:
@pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \ @pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \
here="`pwd`"; \ here="`pwd`"; \
filecase=; \ filecase=; \
if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" -o "$(PLATFORM)" = "mingw" ]; then \ case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
filecase=-i; \ filecase=-i; \
fi; \ esac; \
set -e; for i in doc/apps/*.pod; do \ set -e; for i in doc/apps/*.pod; do \
fn=`basename $$i .pod`; \ fn=`basename $$i .pod`; \
sec=`$(PERL) util/extract-section.pl 1 < $$i`; \ sec=`$(PERL) util/extract-section.pl 1 < $$i`; \

View File

@@ -88,6 +88,7 @@ PROCESSOR=
# CPUID module collects small commonly used assembler snippets # CPUID module collects small commonly used assembler snippets
CPUID_OBJ= CPUID_OBJ=
BN_ASM= bn_asm.o BN_ASM= bn_asm.o
EC_ASM=
DES_ENC= des_enc.o fcrypt_b.o DES_ENC= des_enc.o fcrypt_b.o
AES_ENC= aes_core.o aes_cbc.o AES_ENC= aes_core.o aes_cbc.o
BF_ENC= bf_enc.o BF_ENC= bf_enc.o
@@ -99,6 +100,8 @@ SHA1_ASM_OBJ=
RMD160_ASM_OBJ= RMD160_ASM_OBJ=
WP_ASM_OBJ= WP_ASM_OBJ=
CMLL_ENC= CMLL_ENC=
MODES_ASM_OBJ=
ENGINES_ASM_OBJ=
PERLASM_SCHEME= PERLASM_SCHEME=
# KRB5 stuff # KRB5 stuff
@@ -109,6 +112,30 @@ LIBKRB5=
ZLIB_INCLUDE= ZLIB_INCLUDE=
LIBZLIB= LIBZLIB=
# TOP level FIPS install directory.
FIPSDIR=
# This is the location of fipscanister.o and friends.
# The FIPS module build will place it $(INSTALLTOP)/lib
# but since $(INSTALLTOP) can only take the default value
# when the module is built it will be in /usr/local/ssl/lib
# $(INSTALLTOP) for this build may be different so hard
# code the path.
FIPSLIBDIR=
# The location of the library which contains fipscanister.o
# normally it will be libcrypto unless fipsdso is set in which
# case it will be libfips. If not compiling in FIPS mode at all
# this is empty making it a useful test for a FIPS compile.
FIPSCANLIB=
# Shared library base address. Currently only used on Windows.
#
BASEADDR=
DIRS= crypto ssl engines apps test tools DIRS= crypto ssl engines apps test tools
ENGDIRS= ccgost ENGDIRS= ccgost
SHLIBDIRS= crypto ssl SHLIBDIRS= crypto ssl
@@ -116,12 +143,12 @@ SHLIBDIRS= crypto ssl
# dirs in crypto to build # dirs in crypto to build
SDIRS= \ SDIRS= \
objects \ objects \
md2 md4 md5 sha mdc2 hmac ripemd whrlpool \ md2 md4 md5 sha mdc2 hmac sm3 sms4 ripemd whrlpool \
des aes rc2 rc4 rc5 idea bf cast camellia seed modes \ des aes rc2 rc4 rc5 idea bf cast camellia seed modes \
bn ec rsa dsa ecdsa dh ecdh dso engine \ bn ec rsa dsa ecdsa dh ecdh dso engine \
buffer bio stack lhash rand err \ buffer bio stack lhash rand err \
evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \ evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
cms pqueue ts jpake store cms pqueue ts jpake srp store cmac
# keep in mind that the above list is adjusted by ./Configure # keep in mind that the above list is adjusted by ./Configure
# according to no-xxx arguments... # according to no-xxx arguments...
@@ -158,7 +185,7 @@ WTARFILE= $(NAME)-win.tar
EXHEADER= e_os2.h EXHEADER= e_os2.h
HEADER= e_os.h HEADER= e_os.h
all: Makefile build_all openssl.pc libssl.pc libcrypto.pc all: Makefile build_all
# as we stick to -e, CLEARENV ensures that local variables in lower # as we stick to -e, CLEARENV ensures that local variables in lower
# Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn # Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn
@@ -172,7 +199,7 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS} \
$${EXHEADER+EXHEADER} $${HEADER+HEADER} \ $${EXHEADER+EXHEADER} $${HEADER+HEADER} \
$${GENERAL+GENERAL} $${CFLAGS+CFLAGS} \ $${GENERAL+GENERAL} $${CFLAGS+CFLAGS} \
$${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \ $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \
$${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} \ $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \
$${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \ $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \
$${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
@@ -195,8 +222,8 @@ BUILDENV= PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)' \ EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)' \
SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)' \ SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)' \
PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)' \ PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)' \
CPUID_OBJ='$(CPUID_OBJ)' \ CPUID_OBJ='$(CPUID_OBJ)' BN_ASM='$(BN_ASM)' \
BN_ASM='$(BN_ASM)' DES_ENC='$(DES_ENC)' \ EC_ASM='$(EC_ASM)' DES_ENC='$(DES_ENC)' \
AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)' \ AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)' \
BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)' \ BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)' \
RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)' \ RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)' \
@@ -204,7 +231,12 @@ BUILDENV= PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
MD5_ASM_OBJ='$(MD5_ASM_OBJ)' \ MD5_ASM_OBJ='$(MD5_ASM_OBJ)' \
RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)' \ RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)' \
WP_ASM_OBJ='$(WP_ASM_OBJ)' \ WP_ASM_OBJ='$(WP_ASM_OBJ)' \
MODES_ASM_OBJ='$(MODES_ASM_OBJ)' \
ENGINES_ASM_OBJ='$(ENGINES_ASM_OBJ)' \
PERLASM_SCHEME='$(PERLASM_SCHEME)' \ PERLASM_SCHEME='$(PERLASM_SCHEME)' \
FIPSLIBDIR='${FIPSLIBDIR}' \
FIPSDIR='${FIPSDIR}' \
FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}" \
THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES= THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
# MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors, # MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
# which in turn eliminates ambiguities in variable treatment with -e. # which in turn eliminates ambiguities in variable treatment with -e.
@@ -237,30 +269,46 @@ reflect:
@[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV) @[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
sub_all: build_all sub_all: build_all
build_all: build_libs build_apps build_tests build_tools build_all: build_libs build_apps build_tests build_tools
build_libs: build_crypto build_ssl build_engines build_libs: build_libcrypto build_libssl openssl.pc
build_libcrypto: build_crypto build_engines libcrypto.pc
build_libssl: build_ssl libssl.pc
build_crypto: build_crypto:
@dir=crypto; target=all; $(BUILD_ONE_CMD) @dir=crypto; target=all; $(BUILD_ONE_CMD)
build_ssl: build_ssl: build_crypto
@dir=ssl; target=all; $(BUILD_ONE_CMD) @dir=ssl; target=all; $(BUILD_ONE_CMD)
build_engines: build_engines: build_crypto
@dir=engines; target=all; $(BUILD_ONE_CMD) @dir=engines; target=all; $(BUILD_ONE_CMD)
build_apps: build_apps: build_libs
@dir=apps; target=all; $(BUILD_ONE_CMD) @dir=apps; target=all; $(BUILD_ONE_CMD)
build_tests: build_tests: build_libs
@dir=test; target=all; $(BUILD_ONE_CMD) @dir=test; target=all; $(BUILD_ONE_CMD)
build_tools: build_tools: build_libs
@dir=tools; target=all; $(BUILD_ONE_CMD) @dir=tools; target=all; $(BUILD_ONE_CMD)
all_testapps: build_libs build_testapps all_testapps: build_libs build_testapps
build_testapps: build_testapps:
@dir=crypto; target=testapps; $(BUILD_ONE_CMD) @dir=crypto; target=testapps; $(BUILD_ONE_CMD)
libcrypto$(SHLIB_EXT): libcrypto.a fips_premain_dso$(EXE_EXT): libcrypto.a
[ -z "$(FIPSCANLIB)" ] || $(CC) $(CFLAG) -Iinclude \
-DFINGERPRINT_PREMAIN_DSO_LOAD -o $@ \
$(FIPSLIBDIR)fips_premain.c $(FIPSLIBDIR)fipscanister.o \
libcrypto.a $(EX_LIBS)
libcrypto$(SHLIB_EXT): libcrypto.a fips_premain_dso$(EXE_EXT)
@if [ "$(SHLIB_TARGET)" != "" ]; then \ @if [ "$(SHLIB_TARGET)" != "" ]; then \
$(MAKE) SHLIBDIRS=crypto build-shared; \ if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
FIPSLD_LIBCRYPTO=libcrypto.a ; \
FIPSLD_CC="$(CC)"; CC=$(FIPSDIR)/bin/fipsld; \
export CC FIPSLD_CC FIPSLD_LIBCRYPTO; \
fi; \
$(MAKE) -e SHLIBDIRS=crypto CC="$${CC:-$(CC)}" build-shared && \
(touch -c fips_premain_dso$(EXE_EXT) || :); \
else \ else \
echo "There's no support for shared libraries on this platform" >&2; \ echo "There's no support for shared libraries on this platform" >&2; \
exit 1; \ exit 1; \
@@ -283,7 +331,7 @@ clean-shared:
done; \ done; \
fi; \ fi; \
( set -x; rm -f lib$$i$(SHLIB_EXT) ); \ ( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
if [ "$(PLATFORM)" = "Cygwin" ]; then \ if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \
( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \ ( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
fi; \ fi; \
done done
@@ -322,7 +370,8 @@ libcrypto.pc: Makefile
echo 'Description: OpenSSL cryptography library'; \ echo 'Description: OpenSSL cryptography library'; \
echo 'Version: '$(VERSION); \ echo 'Version: '$(VERSION); \
echo 'Requires: '; \ echo 'Requires: '; \
echo 'Libs: -L$${libdir} -lcrypto $(EX_LIBS)'; \ echo 'Libs: -L$${libdir} -lcrypto'; \
echo 'Libs.private: $(EX_LIBS)'; \
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc
libssl.pc: Makefile libssl.pc: Makefile
@@ -331,11 +380,12 @@ libssl.pc: Makefile
echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
echo 'includedir=$${prefix}/include'; \ echo 'includedir=$${prefix}/include'; \
echo ''; \ echo ''; \
echo 'Name: OpenSSL'; \ echo 'Name: OpenSSL-libssl'; \
echo 'Description: Secure Sockets Layer and cryptography libraries'; \ echo 'Description: Secure Sockets Layer and cryptography libraries'; \
echo 'Version: '$(VERSION); \ echo 'Version: '$(VERSION); \
echo 'Requires: '; \ echo 'Requires.private: libcrypto'; \
echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \ echo 'Libs: -L$${libdir} -lssl'; \
echo 'Libs.private: $(EX_LIBS)'; \
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc
openssl.pc: Makefile openssl.pc: Makefile
@@ -347,9 +397,7 @@ openssl.pc: Makefile
echo 'Name: OpenSSL'; \ echo 'Name: OpenSSL'; \
echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \ echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
echo 'Version: '$(VERSION); \ echo 'Version: '$(VERSION); \
echo 'Requires: '; \ echo 'Requires: libssl libcrypto' ) > openssl.pc
echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
Makefile: Makefile.org Configure config Makefile: Makefile.org Configure config
@echo "Makefile is older than Makefile.org, Configure or config." @echo "Makefile is older than Makefile.org, Configure or config."
@@ -357,7 +405,7 @@ Makefile: Makefile.org Configure config
@false @false
libclean: libclean:
rm -f *.map *.so *.so.* *.dll engines/*.so engines/*.dll *.a engines/*.a */lib */*/lib rm -f *.map *.so *.so.* *.dylib *.dll engines/*.so engines/*.dll engines/*.dylib *.a engines/*.a */lib */*/lib
clean: libclean clean: libclean
rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
@@ -399,7 +447,7 @@ rehash.time: certs apps
[ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \ [ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \
OPENSSL_DEBUG_MEMORY=on; \ OPENSSL_DEBUG_MEMORY=on; \
export OPENSSL OPENSSL_DEBUG_MEMORY; \ export OPENSSL OPENSSL_DEBUG_MEMORY; \
$(PERL) tools/c_rehash certs) && \ $(PERL) tools/c_rehash certs/demo) && \
touch rehash.time; \ touch rehash.time; \
else :; fi else :; fi
@@ -413,6 +461,9 @@ tests: rehash
report: report:
@$(PERL) util/selftest.pl @$(PERL) util/selftest.pl
update: errors stacks util/libeay.num util/ssleay.num TABLE
@set -e; target=update; $(RECURSIVE_BUILD_CMD)
depend: depend:
@set -e; target=depend; $(RECURSIVE_BUILD_CMD) @set -e; target=depend; $(RECURSIVE_BUILD_CMD)
@@ -424,9 +475,9 @@ tags:
find . -name '[^.]*.[ch]' | xargs etags -a find . -name '[^.]*.[ch]' | xargs etags -a
errors: errors:
$(PERL) util/ck_errf.pl -strict */*.c */*/*.c
$(PERL) util/mkerr.pl -recurse -write $(PERL) util/mkerr.pl -recurse -write
(cd engines; $(MAKE) PERL=$(PERL) errors) (cd engines; $(MAKE) PERL=$(PERL) errors)
$(PERL) util/ck_errf.pl */*.c */*/*.c
stacks: stacks:
$(PERL) util/mkstack.pl -write $(PERL) util/mkstack.pl -write
@@ -437,26 +488,10 @@ util/libeay.num::
util/ssleay.num:: util/ssleay.num::
$(PERL) util/mkdef.pl ssl update $(PERL) util/mkdef.pl ssl update
crypto/objects/obj_dat.h: crypto/objects/obj_dat.pl crypto/objects/obj_mac.h
$(PERL) crypto/objects/obj_dat.pl crypto/objects/obj_mac.h crypto/objects/obj_dat.h
crypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num
$(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num crypto/objects/obj_mac.h
crypto/objects/obj_xref.h: crypto/objects/objxref.pl crypto/objects/obj_xref.txt crypto/objects/obj_mac.num
$(PERL) crypto/objects/objxref.pl crypto/objects/obj_mac.num crypto/objects/obj_xref.txt >crypto/objects/obj_xref.h
apps/openssl-vms.cnf: apps/openssl.cnf
$(PERL) VMS/VMSify-conf.pl < apps/openssl.cnf > apps/openssl-vms.cnf
crypto/bn/bn_prime.h: crypto/bn/bn_prime.pl
$(PERL) crypto/bn/bn_prime.pl >crypto/bn/bn_prime.h
TABLE: Configure TABLE: Configure
(echo 'Output of `Configure TABLE'"':"; \ (echo 'Output of `Configure TABLE'"':"; \
$(PERL) Configure TABLE) > TABLE $(PERL) Configure TABLE) > TABLE
update: errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h crypto/objects/obj_xref.h apps/openssl-vms.cnf crypto/bn/bn_prime.h TABLE depend
# Build distribution tar-file. As the list of files returned by "find" is # Build distribution tar-file. As the list of files returned by "find" is
# pretty long, on several platforms a "too many arguments" error or similar # pretty long, on several platforms a "too many arguments" error or similar
# would occur. Therefore the list of files is temporarily stored into a file # would occur. Therefore the list of files is temporarily stored into a file
@@ -509,7 +544,7 @@ install_sw:
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
done; done;
@set -e; target=install; $(RECURSIVE_BUILD_CMD) @set -e; target=install; $(RECURSIVE_BUILD_CMD)
@set -e; for i in $(LIBS) ;\ @set -e; liblist="$(LIBS)"; for i in $$liblist ;\
do \ do \
if [ -f "$$i" ]; then \ if [ -f "$$i" ]; then \
( echo installing $$i; \ ( echo installing $$i; \
@@ -525,11 +560,7 @@ install_sw:
do \ do \
if [ -f "$$i" -o -f "$$i.a" ]; then \ if [ -f "$$i" -o -f "$$i.a" ]; then \
( echo installing $$i; \ ( echo installing $$i; \
if [ "$(PLATFORM)" != "Cygwin" ]; then \ if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
else \
c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \ c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \ cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \ chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
@@ -537,6 +568,10 @@ install_sw:
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \ cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \ chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \ mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
else \
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
fi ); \ fi ); \
if expr $(PLATFORM) : 'mingw' > /dev/null; then \ if expr $(PLATFORM) : 'mingw' > /dev/null; then \
( case $$i in \ ( case $$i in \
@@ -569,6 +604,10 @@ install_sw:
install_html_docs: install_html_docs:
here="`pwd`"; \ here="`pwd`"; \
filecase=; \
case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
filecase=-i; \
esac; \
for subdir in apps crypto ssl; do \ for subdir in apps crypto ssl; do \
mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \ mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
for i in doc/$$subdir/*.pod; do \ for i in doc/$$subdir/*.pod; do \
@@ -597,9 +636,9 @@ install_docs:
@pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \ @pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \
here="`pwd`"; \ here="`pwd`"; \
filecase=; \ filecase=; \
if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" -o "$(PLATFORM)" = "mingw" ]; then \ case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
filecase=-i; \ filecase=-i; \
fi; \ esac; \
set -e; for i in doc/apps/*.pod; do \ set -e; for i in doc/apps/*.pod; do \
fn=`basename $$i .pod`; \ fn=`basename $$i .pod`; \
sec=`$(PERL) util/extract-section.pl 1 < $$i`; \ sec=`$(PERL) util/extract-section.pl 1 < $$i`; \

290
NEWS
View File

@@ -5,11 +5,178 @@
This file gives a brief overview of the major changes between each OpenSSL This file gives a brief overview of the major changes between each OpenSSL
release. For more details please read the CHANGES file. release. For more details please read the CHANGES file.
Major changes between OpenSSL 1.0.0c and OpenSSL 1.0.0d: Major changes between OpenSSL 1.0.2c and OpenSSL 1.0.2d [9 Jul 2015]
o Alternate chains certificate forgery (CVE-2015-1793)
Major changes between OpenSSL 1.0.2b and OpenSSL 1.0.2c [12 Jun 2015]
o Fix HMAC ABI incompatibility
Major changes between OpenSSL 1.0.2a and OpenSSL 1.0.2b [11 Jun 2015]
o Malformed ECParameters causes infinite loop (CVE-2015-1788)
o Exploitable out-of-bounds read in X509_cmp_time (CVE-2015-1789)
o PKCS7 crash with missing EnvelopedContent (CVE-2015-1790)
o CMS verify infinite loop with unknown hash function (CVE-2015-1792)
o Race condition handling NewSessionTicket (CVE-2015-1791)
Major changes between OpenSSL 1.0.2 and OpenSSL 1.0.2a [19 Mar 2015]
o OpenSSL 1.0.2 ClientHello sigalgs DoS fix (CVE-2015-0291)
o Multiblock corrupted pointer fix (CVE-2015-0290)
o Segmentation fault in DTLSv1_listen fix (CVE-2015-0207)
o Segmentation fault in ASN1_TYPE_cmp fix (CVE-2015-0286)
o Segmentation fault for invalid PSS parameters fix (CVE-2015-0208)
o ASN.1 structure reuse memory corruption fix (CVE-2015-0287)
o PKCS7 NULL pointer dereferences fix (CVE-2015-0289)
o DoS via reachable assert in SSLv2 servers fix (CVE-2015-0293)
o Empty CKE with client auth and DHE fix (CVE-2015-1787)
o Handshake with unseeded PRNG fix (CVE-2015-0285)
o Use After Free following d2i_ECPrivatekey error fix (CVE-2015-0209)
o X509_to_X509_REQ NULL pointer deref fix (CVE-2015-0288)
o Removed the export ciphers from the DEFAULT ciphers
Major changes between OpenSSL 1.0.1l and OpenSSL 1.0.2 [22 Jan 2015]:
o Suite B support for TLS 1.2 and DTLS 1.2
o Support for DTLS 1.2
o TLS automatic EC curve selection.
o API to set TLS supported signature algorithms and curves
o SSL_CONF configuration API.
o TLS Brainpool support.
o ALPN support.
o CMS support for RSA-PSS, RSA-OAEP, ECDH and X9.42 DH.
Major changes between OpenSSL 1.0.1k and OpenSSL 1.0.1l [15 Jan 2015]
o Build fixes for the Windows and OpenVMS platforms
Major changes between OpenSSL 1.0.1j and OpenSSL 1.0.1k [8 Jan 2015]
o Fix for CVE-2014-3571
o Fix for CVE-2015-0206
o Fix for CVE-2014-3569
o Fix for CVE-2014-3572
o Fix for CVE-2015-0204
o Fix for CVE-2015-0205
o Fix for CVE-2014-8275
o Fix for CVE-2014-3570
Major changes between OpenSSL 1.0.1i and OpenSSL 1.0.1j [15 Oct 2014]
o Fix for CVE-2014-3513
o Fix for CVE-2014-3567
o Mitigation for CVE-2014-3566 (SSL protocol vulnerability)
o Fix for CVE-2014-3568
Major changes between OpenSSL 1.0.1h and OpenSSL 1.0.1i [6 Aug 2014]
o Fix for CVE-2014-3512
o Fix for CVE-2014-3511
o Fix for CVE-2014-3510
o Fix for CVE-2014-3507
o Fix for CVE-2014-3506
o Fix for CVE-2014-3505
o Fix for CVE-2014-3509
o Fix for CVE-2014-5139
o Fix for CVE-2014-3508
Major changes between OpenSSL 1.0.1g and OpenSSL 1.0.1h [5 Jun 2014]
o Fix for CVE-2014-0224
o Fix for CVE-2014-0221
o Fix for CVE-2014-0198
o Fix for CVE-2014-0195
o Fix for CVE-2014-3470
o Fix for CVE-2010-5298
Major changes between OpenSSL 1.0.1f and OpenSSL 1.0.1g [7 Apr 2014]
o Fix for CVE-2014-0160
o Add TLS padding extension workaround for broken servers.
o Fix for CVE-2014-0076
Major changes between OpenSSL 1.0.1e and OpenSSL 1.0.1f [6 Jan 2014]
o Don't include gmt_unix_time in TLS server and client random values
o Fix for TLS record tampering bug CVE-2013-4353
o Fix for TLS version checking bug CVE-2013-6449
o Fix for DTLS retransmission bug CVE-2013-6450
Major changes between OpenSSL 1.0.1d and OpenSSL 1.0.1e [11 Feb 2013]:
o Corrected fix for CVE-2013-0169
Major changes between OpenSSL 1.0.1c and OpenSSL 1.0.1d [4 Feb 2013]:
o Fix renegotiation in TLS 1.1, 1.2 by using the correct TLS version.
o Include the fips configuration module.
o Fix OCSP bad key DoS attack CVE-2013-0166
o Fix for SSL/TLS/DTLS CBC plaintext recovery attack CVE-2013-0169
o Fix for TLS AESNI record handling flaw CVE-2012-2686
Major changes between OpenSSL 1.0.1b and OpenSSL 1.0.1c [10 May 2012]:
o Fix TLS/DTLS record length checking bug CVE-2012-2333
o Don't attempt to use non-FIPS composite ciphers in FIPS mode.
Major changes between OpenSSL 1.0.1a and OpenSSL 1.0.1b [26 Apr 2012]:
o Fix compilation error on non-x86 platforms.
o Make FIPS capable OpenSSL ciphers work in non-FIPS mode.
o Fix SSL_OP_NO_TLSv1_1 clash with SSL_OP_ALL in OpenSSL 1.0.0
Major changes between OpenSSL 1.0.1 and OpenSSL 1.0.1a [19 Apr 2012]:
o Fix for ASN1 overflow bug CVE-2012-2110
o Workarounds for some servers that hang on long client hellos.
o Fix SEGV in AES code.
Major changes between OpenSSL 1.0.0h and OpenSSL 1.0.1 [14 Mar 2012]:
o TLS/DTLS heartbeat support.
o SCTP support.
o RFC 5705 TLS key material exporter.
o RFC 5764 DTLS-SRTP negotiation.
o Next Protocol Negotiation.
o PSS signatures in certificates, requests and CRLs.
o Support for password based recipient info for CMS.
o Support TLS v1.2 and TLS v1.1.
o Preliminary FIPS capability for unvalidated 2.0 FIPS module.
o SRP support.
Major changes between OpenSSL 1.0.0g and OpenSSL 1.0.0h [12 Mar 2012]:
o Fix for CMS/PKCS#7 MMA CVE-2012-0884
o Corrected fix for CVE-2011-4619
o Various DTLS fixes.
Major changes between OpenSSL 1.0.0f and OpenSSL 1.0.0g [18 Jan 2012]:
o Fix for DTLS DoS issue CVE-2012-0050
Major changes between OpenSSL 1.0.0e and OpenSSL 1.0.0f [4 Jan 2012]:
o Fix for DTLS plaintext recovery attack CVE-2011-4108
o Clear block padding bytes of SSL 3.0 records CVE-2011-4576
o Only allow one SGC handshake restart for SSL/TLS CVE-2011-4619
o Check parameters are not NULL in GOST ENGINE CVE-2012-0027
o Check for malformed RFC3779 data CVE-2011-4577
Major changes between OpenSSL 1.0.0d and OpenSSL 1.0.0e [6 Sep 2011]:
o Fix for CRL vulnerability issue CVE-2011-3207
o Fix for ECDH crashes CVE-2011-3210
o Protection against EC timing attacks.
o Support ECDH ciphersuites for certificates using SHA2 algorithms.
o Various DTLS fixes.
Major changes between OpenSSL 1.0.0c and OpenSSL 1.0.0d [8 Feb 2011]:
o Fix for security issue CVE-2011-0014 o Fix for security issue CVE-2011-0014
Major changes between OpenSSL 1.0.0b and OpenSSL 1.0.0c: Major changes between OpenSSL 1.0.0b and OpenSSL 1.0.0c [2 Dec 2010]:
o Fix for security issue CVE-2010-4180 o Fix for security issue CVE-2010-4180
o Fix for CVE-2010-4252 o Fix for CVE-2010-4252
@@ -17,18 +184,18 @@
o Fix various platform compilation issues. o Fix various platform compilation issues.
o Corrected fix for security issue CVE-2010-3864. o Corrected fix for security issue CVE-2010-3864.
Major changes between OpenSSL 1.0.0a and OpenSSL 1.0.0b: Major changes between OpenSSL 1.0.0a and OpenSSL 1.0.0b [16 Nov 2010]:
o Fix for security issue CVE-2010-3864. o Fix for security issue CVE-2010-3864.
o Fix for CVE-2010-2939 o Fix for CVE-2010-2939
o Fix WIN32 build system for GOST ENGINE. o Fix WIN32 build system for GOST ENGINE.
Major changes between OpenSSL 1.0.0 and OpenSSL 1.0.0a: Major changes between OpenSSL 1.0.0 and OpenSSL 1.0.0a [1 Jun 2010]:
o Fix for security issue CVE-2010-1633. o Fix for security issue CVE-2010-1633.
o GOST MAC and CFB fixes. o GOST MAC and CFB fixes.
Major changes between OpenSSL 0.9.8n and OpenSSL 1.0.0: Major changes between OpenSSL 0.9.8n and OpenSSL 1.0.0 [29 Mar 2010]:
o RFC3280 path validation: sufficient to process PKITS tests. o RFC3280 path validation: sufficient to process PKITS tests.
o Integrated support for PVK files and keyblobs. o Integrated support for PVK files and keyblobs.
@@ -51,33 +218,12 @@
o Opaque PRF Input TLS extension support. o Opaque PRF Input TLS extension support.
o Updated time routines to avoid OS limitations. o Updated time routines to avoid OS limitations.
Major changes between OpenSSL 0.9.8q and OpenSSL 0.9.8r: Major changes between OpenSSL 0.9.8m and OpenSSL 0.9.8n [24 Mar 2010]:
o Fix for security issue CVE-2011-0014
Major changes between OpenSSL 0.9.8p and OpenSSL 0.9.8q:
o Fix for security issue CVE-2010-4180
o Fix for CVE-2010-4252
Major changes between OpenSSL 0.9.8o and OpenSSL 0.9.8p:
o Fix for security issue CVE-2010-3864.
Major changes between OpenSSL 0.9.8n and OpenSSL 0.9.8o:
o Fix for security issue CVE-2010-0742.
o Various DTLS fixes.
o Recognise SHA2 certificates if only SSL algorithms added.
o Fix for no-rc4 compilation.
o Chil ENGINE unload workaround.
Major changes between OpenSSL 0.9.8m and OpenSSL 0.9.8n:
o CFB cipher definition fixes. o CFB cipher definition fixes.
o Fix security issues CVE-2010-0740 and CVE-2010-0433. o Fix security issues CVE-2010-0740 and CVE-2010-0433.
Major changes between OpenSSL 0.9.8l and OpenSSL 0.9.8m: Major changes between OpenSSL 0.9.8l and OpenSSL 0.9.8m [25 Feb 2010]:
o Cipher definition fixes. o Cipher definition fixes.
o Workaround for slow RAND_poll() on some WIN32 versions. o Workaround for slow RAND_poll() on some WIN32 versions.
@@ -89,33 +235,33 @@
o Ticket and SNI coexistence fixes. o Ticket and SNI coexistence fixes.
o Many fixes to DTLS handling. o Many fixes to DTLS handling.
Major changes between OpenSSL 0.9.8k and OpenSSL 0.9.8l: Major changes between OpenSSL 0.9.8k and OpenSSL 0.9.8l [5 Nov 2009]:
o Temporary work around for CVE-2009-3555: disable renegotiation. o Temporary work around for CVE-2009-3555: disable renegotiation.
Major changes between OpenSSL 0.9.8j and OpenSSL 0.9.8k: Major changes between OpenSSL 0.9.8j and OpenSSL 0.9.8k [25 Mar 2009]:
o Fix various build issues. o Fix various build issues.
o Fix security issues (CVE-2009-0590, CVE-2009-0591, CVE-2009-0789) o Fix security issues (CVE-2009-0590, CVE-2009-0591, CVE-2009-0789)
Major changes between OpenSSL 0.9.8i and OpenSSL 0.9.8j: Major changes between OpenSSL 0.9.8i and OpenSSL 0.9.8j [7 Jan 2009]:
o Fix security issue (CVE-2008-5077) o Fix security issue (CVE-2008-5077)
o Merge FIPS 140-2 branch code. o Merge FIPS 140-2 branch code.
Major changes between OpenSSL 0.9.8g and OpenSSL 0.9.8h: Major changes between OpenSSL 0.9.8g and OpenSSL 0.9.8h [28 May 2008]:
o CryptoAPI ENGINE support. o CryptoAPI ENGINE support.
o Various precautionary measures. o Various precautionary measures.
o Fix for bugs affecting certificate request creation. o Fix for bugs affecting certificate request creation.
o Support for local machine keyset attribute in PKCS#12 files. o Support for local machine keyset attribute in PKCS#12 files.
Major changes between OpenSSL 0.9.8f and OpenSSL 0.9.8g: Major changes between OpenSSL 0.9.8f and OpenSSL 0.9.8g [19 Oct 2007]:
o Backport of CMS functionality to 0.9.8. o Backport of CMS functionality to 0.9.8.
o Fixes for bugs introduced with 0.9.8f. o Fixes for bugs introduced with 0.9.8f.
Major changes between OpenSSL 0.9.8e and OpenSSL 0.9.8f: Major changes between OpenSSL 0.9.8e and OpenSSL 0.9.8f [11 Oct 2007]:
o Add gcc 4.2 support. o Add gcc 4.2 support.
o Add support for AES and SSE2 assembly lanugauge optimization o Add support for AES and SSE2 assembly lanugauge optimization
@@ -126,23 +272,23 @@
o RFC4507bis support. o RFC4507bis support.
o TLS Extensions support. o TLS Extensions support.
Major changes between OpenSSL 0.9.8d and OpenSSL 0.9.8e: Major changes between OpenSSL 0.9.8d and OpenSSL 0.9.8e [23 Feb 2007]:
o Various ciphersuite selection fixes. o Various ciphersuite selection fixes.
o RFC3779 support. o RFC3779 support.
Major changes between OpenSSL 0.9.8c and OpenSSL 0.9.8d: Major changes between OpenSSL 0.9.8c and OpenSSL 0.9.8d [28 Sep 2006]:
o Introduce limits to prevent malicious key DoS (CVE-2006-2940) o Introduce limits to prevent malicious key DoS (CVE-2006-2940)
o Fix security issues (CVE-2006-2937, CVE-2006-3737, CVE-2006-4343) o Fix security issues (CVE-2006-2937, CVE-2006-3737, CVE-2006-4343)
o Changes to ciphersuite selection algorithm o Changes to ciphersuite selection algorithm
Major changes between OpenSSL 0.9.8b and OpenSSL 0.9.8c: Major changes between OpenSSL 0.9.8b and OpenSSL 0.9.8c [5 Sep 2006]:
o Fix Daniel Bleichenbacher forged signature attack, CVE-2006-4339 o Fix Daniel Bleichenbacher forged signature attack, CVE-2006-4339
o New cipher Camellia o New cipher Camellia
Major changes between OpenSSL 0.9.8a and OpenSSL 0.9.8b: Major changes between OpenSSL 0.9.8a and OpenSSL 0.9.8b [4 May 2006]:
o Cipher string fixes. o Cipher string fixes.
o Fixes for VC++ 2005. o Fixes for VC++ 2005.
@@ -152,12 +298,12 @@
o Built in dynamic engine compilation support on Win32. o Built in dynamic engine compilation support on Win32.
o Fixes auto dynamic engine loading in Win32. o Fixes auto dynamic engine loading in Win32.
Major changes between OpenSSL 0.9.8 and OpenSSL 0.9.8a: Major changes between OpenSSL 0.9.8 and OpenSSL 0.9.8a [11 Oct 2005]:
o Fix potential SSL 2.0 rollback, CVE-2005-2969 o Fix potential SSL 2.0 rollback, CVE-2005-2969
o Extended Windows CE support o Extended Windows CE support
Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.8: Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.8 [5 Jul 2005]:
o Major work on the BIGNUM library for higher efficiency and to o Major work on the BIGNUM library for higher efficiency and to
make operations more streamlined and less contradictory. This make operations more streamlined and less contradictory. This
@@ -231,36 +377,36 @@
o Added initial support for Win64. o Added initial support for Win64.
o Added alternate pkg-config files. o Added alternate pkg-config files.
Major changes between OpenSSL 0.9.7l and OpenSSL 0.9.7m: Major changes between OpenSSL 0.9.7l and OpenSSL 0.9.7m [23 Feb 2007]:
o FIPS 1.1.1 module linking. o FIPS 1.1.1 module linking.
o Various ciphersuite selection fixes. o Various ciphersuite selection fixes.
Major changes between OpenSSL 0.9.7k and OpenSSL 0.9.7l: Major changes between OpenSSL 0.9.7k and OpenSSL 0.9.7l [28 Sep 2006]:
o Introduce limits to prevent malicious key DoS (CVE-2006-2940) o Introduce limits to prevent malicious key DoS (CVE-2006-2940)
o Fix security issues (CVE-2006-2937, CVE-2006-3737, CVE-2006-4343) o Fix security issues (CVE-2006-2937, CVE-2006-3737, CVE-2006-4343)
Major changes between OpenSSL 0.9.7j and OpenSSL 0.9.7k: Major changes between OpenSSL 0.9.7j and OpenSSL 0.9.7k [5 Sep 2006]:
o Fix Daniel Bleichenbacher forged signature attack, CVE-2006-4339 o Fix Daniel Bleichenbacher forged signature attack, CVE-2006-4339
Major changes between OpenSSL 0.9.7i and OpenSSL 0.9.7j: Major changes between OpenSSL 0.9.7i and OpenSSL 0.9.7j [4 May 2006]:
o Visual C++ 2005 fixes. o Visual C++ 2005 fixes.
o Update Windows build system for FIPS. o Update Windows build system for FIPS.
Major changes between OpenSSL 0.9.7h and OpenSSL 0.9.7i: Major changes between OpenSSL 0.9.7h and OpenSSL 0.9.7i [14 Oct 2005]:
o Give EVP_MAX_MD_SIZE it's old value, except for a FIPS build. o Give EVP_MAX_MD_SIZE it's old value, except for a FIPS build.
Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.7h: Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.7h [11 Oct 2005]:
o Fix SSL 2.0 Rollback, CVE-2005-2969 o Fix SSL 2.0 Rollback, CVE-2005-2969
o Allow use of fixed-length exponent on DSA signing o Allow use of fixed-length exponent on DSA signing
o Default fixed-window RSA, DSA, DH private-key operations o Default fixed-window RSA, DSA, DH private-key operations
Major changes between OpenSSL 0.9.7f and OpenSSL 0.9.7g: Major changes between OpenSSL 0.9.7f and OpenSSL 0.9.7g [11 Apr 2005]:
o More compilation issues fixed. o More compilation issues fixed.
o Adaptation to more modern Kerberos API. o Adaptation to more modern Kerberos API.
@@ -269,7 +415,7 @@
o More constification. o More constification.
o Added processing of proxy certificates (RFC 3820). o Added processing of proxy certificates (RFC 3820).
Major changes between OpenSSL 0.9.7e and OpenSSL 0.9.7f: Major changes between OpenSSL 0.9.7e and OpenSSL 0.9.7f [22 Mar 2005]:
o Several compilation issues fixed. o Several compilation issues fixed.
o Many memory allocation failure checks added. o Many memory allocation failure checks added.
@@ -277,12 +423,12 @@
o Mandatory basic checks on certificates. o Mandatory basic checks on certificates.
o Performance improvements. o Performance improvements.
Major changes between OpenSSL 0.9.7d and OpenSSL 0.9.7e: Major changes between OpenSSL 0.9.7d and OpenSSL 0.9.7e [25 Oct 2004]:
o Fix race condition in CRL checking code. o Fix race condition in CRL checking code.
o Fixes to PKCS#7 (S/MIME) code. o Fixes to PKCS#7 (S/MIME) code.
Major changes between OpenSSL 0.9.7c and OpenSSL 0.9.7d: Major changes between OpenSSL 0.9.7c and OpenSSL 0.9.7d [17 Mar 2004]:
o Security: Fix Kerberos ciphersuite SSL/TLS handshaking bug o Security: Fix Kerberos ciphersuite SSL/TLS handshaking bug
o Security: Fix null-pointer assignment in do_change_cipher_spec() o Security: Fix null-pointer assignment in do_change_cipher_spec()
@@ -290,14 +436,14 @@
o Multiple X509 verification fixes o Multiple X509 verification fixes
o Speed up HMAC and other operations o Speed up HMAC and other operations
Major changes between OpenSSL 0.9.7b and OpenSSL 0.9.7c: Major changes between OpenSSL 0.9.7b and OpenSSL 0.9.7c [30 Sep 2003]:
o Security: fix various ASN1 parsing bugs. o Security: fix various ASN1 parsing bugs.
o New -ignore_err option to OCSP utility. o New -ignore_err option to OCSP utility.
o Various interop and bug fixes in S/MIME code. o Various interop and bug fixes in S/MIME code.
o SSL/TLS protocol fix for unrequested client certificates. o SSL/TLS protocol fix for unrequested client certificates.
Major changes between OpenSSL 0.9.7a and OpenSSL 0.9.7b: Major changes between OpenSSL 0.9.7a and OpenSSL 0.9.7b [10 Apr 2003]:
o Security: counter the Klima-Pokorny-Rosa extension of o Security: counter the Klima-Pokorny-Rosa extension of
Bleichbacher's attack Bleichbacher's attack
@@ -308,7 +454,7 @@
o ASN.1: treat domainComponent correctly. o ASN.1: treat domainComponent correctly.
o Documentation: fixes and additions. o Documentation: fixes and additions.
Major changes between OpenSSL 0.9.7 and OpenSSL 0.9.7a: Major changes between OpenSSL 0.9.7 and OpenSSL 0.9.7a [19 Feb 2003]:
o Security: Important security related bugfixes. o Security: Important security related bugfixes.
o Enhanced compatibility with MIT Kerberos. o Enhanced compatibility with MIT Kerberos.
@@ -319,7 +465,7 @@
o SSL/TLS: now handles manual certificate chain building. o SSL/TLS: now handles manual certificate chain building.
o SSL/TLS: certain session ID malfunctions corrected. o SSL/TLS: certain session ID malfunctions corrected.
Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.7: Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.7 [30 Dec 2002]:
o New library section OCSP. o New library section OCSP.
o Complete rewrite of ASN1 code. o Complete rewrite of ASN1 code.
@@ -365,23 +511,23 @@
o SSL/TLS: add callback to retrieve SSL/TLS messages. o SSL/TLS: add callback to retrieve SSL/TLS messages.
o SSL/TLS: support AES cipher suites (RFC3268). o SSL/TLS: support AES cipher suites (RFC3268).
Major changes between OpenSSL 0.9.6j and OpenSSL 0.9.6k: Major changes between OpenSSL 0.9.6j and OpenSSL 0.9.6k [30 Sep 2003]:
o Security: fix various ASN1 parsing bugs. o Security: fix various ASN1 parsing bugs.
o SSL/TLS protocol fix for unrequested client certificates. o SSL/TLS protocol fix for unrequested client certificates.
Major changes between OpenSSL 0.9.6i and OpenSSL 0.9.6j: Major changes between OpenSSL 0.9.6i and OpenSSL 0.9.6j [10 Apr 2003]:
o Security: counter the Klima-Pokorny-Rosa extension of o Security: counter the Klima-Pokorny-Rosa extension of
Bleichbacher's attack Bleichbacher's attack
o Security: make RSA blinding default. o Security: make RSA blinding default.
o Build: shared library support fixes. o Build: shared library support fixes.
Major changes between OpenSSL 0.9.6h and OpenSSL 0.9.6i: Major changes between OpenSSL 0.9.6h and OpenSSL 0.9.6i [19 Feb 2003]:
o Important security related bugfixes. o Important security related bugfixes.
Major changes between OpenSSL 0.9.6g and OpenSSL 0.9.6h: Major changes between OpenSSL 0.9.6g and OpenSSL 0.9.6h [5 Dec 2002]:
o New configuration targets for Tandem OSS and A/UX. o New configuration targets for Tandem OSS and A/UX.
o New OIDs for Microsoft attributes. o New OIDs for Microsoft attributes.
@@ -395,25 +541,25 @@
o Fixes for smaller building problems. o Fixes for smaller building problems.
o Updates of manuals, FAQ and other instructive documents. o Updates of manuals, FAQ and other instructive documents.
Major changes between OpenSSL 0.9.6f and OpenSSL 0.9.6g: Major changes between OpenSSL 0.9.6f and OpenSSL 0.9.6g [9 Aug 2002]:
o Important building fixes on Unix. o Important building fixes on Unix.
Major changes between OpenSSL 0.9.6e and OpenSSL 0.9.6f: Major changes between OpenSSL 0.9.6e and OpenSSL 0.9.6f [8 Aug 2002]:
o Various important bugfixes. o Various important bugfixes.
Major changes between OpenSSL 0.9.6d and OpenSSL 0.9.6e: Major changes between OpenSSL 0.9.6d and OpenSSL 0.9.6e [30 Jul 2002]:
o Important security related bugfixes. o Important security related bugfixes.
o Various SSL/TLS library bugfixes. o Various SSL/TLS library bugfixes.
Major changes between OpenSSL 0.9.6c and OpenSSL 0.9.6d: Major changes between OpenSSL 0.9.6c and OpenSSL 0.9.6d [9 May 2002]:
o Various SSL/TLS library bugfixes. o Various SSL/TLS library bugfixes.
o Fix DH parameter generation for 'non-standard' generators. o Fix DH parameter generation for 'non-standard' generators.
Major changes between OpenSSL 0.9.6b and OpenSSL 0.9.6c: Major changes between OpenSSL 0.9.6b and OpenSSL 0.9.6c [21 Dec 2001]:
o Various SSL/TLS library bugfixes. o Various SSL/TLS library bugfixes.
o BIGNUM library fixes. o BIGNUM library fixes.
@@ -426,7 +572,7 @@
Broadcom and Cryptographic Appliance's keyserver Broadcom and Cryptographic Appliance's keyserver
[in 0.9.6c-engine release]. [in 0.9.6c-engine release].
Major changes between OpenSSL 0.9.6a and OpenSSL 0.9.6b: Major changes between OpenSSL 0.9.6a and OpenSSL 0.9.6b [9 Jul 2001]:
o Security fix: PRNG improvements. o Security fix: PRNG improvements.
o Security fix: RSA OAEP check. o Security fix: RSA OAEP check.
@@ -443,7 +589,7 @@
o Increase default size for BIO buffering filter. o Increase default size for BIO buffering filter.
o Compatibility fixes in some scripts. o Compatibility fixes in some scripts.
Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.6a: Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.6a [5 Apr 2001]:
o Security fix: change behavior of OpenSSL to avoid using o Security fix: change behavior of OpenSSL to avoid using
environment variables when running as root. environment variables when running as root.
@@ -468,7 +614,7 @@
o New function BN_rand_range(). o New function BN_rand_range().
o Add "-rand" option to openssl s_client and s_server. o Add "-rand" option to openssl s_client and s_server.
Major changes between OpenSSL 0.9.5a and OpenSSL 0.9.6: Major changes between OpenSSL 0.9.5a and OpenSSL 0.9.6 [10 Oct 2000]:
o Some documentation for BIO and SSL libraries. o Some documentation for BIO and SSL libraries.
o Enhanced chain verification using key identifiers. o Enhanced chain verification using key identifiers.
@@ -483,7 +629,7 @@
[1] The support for external crypto devices is currently a separate [1] The support for external crypto devices is currently a separate
distribution. See the file README.ENGINE. distribution. See the file README.ENGINE.
Major changes between OpenSSL 0.9.5 and OpenSSL 0.9.5a: Major changes between OpenSSL 0.9.5 and OpenSSL 0.9.5a [1 Apr 2000]:
o Bug fixes for Win32, SuSE Linux, NeXTSTEP and FreeBSD 2.2.8 o Bug fixes for Win32, SuSE Linux, NeXTSTEP and FreeBSD 2.2.8
o Shared library support for HPUX and Solaris-gcc o Shared library support for HPUX and Solaris-gcc
@@ -492,7 +638,7 @@
o New 'rand' application o New 'rand' application
o New way to check for existence of algorithms from scripts o New way to check for existence of algorithms from scripts
Major changes between OpenSSL 0.9.4 and OpenSSL 0.9.5: Major changes between OpenSSL 0.9.4 and OpenSSL 0.9.5 [25 May 2000]:
o S/MIME support in new 'smime' command o S/MIME support in new 'smime' command
o Documentation for the OpenSSL command line application o Documentation for the OpenSSL command line application
@@ -528,7 +674,7 @@
o Enhanced support for Alpha Linux o Enhanced support for Alpha Linux
o Experimental MacOS support o Experimental MacOS support
Major changes between OpenSSL 0.9.3 and OpenSSL 0.9.4: Major changes between OpenSSL 0.9.3 and OpenSSL 0.9.4 [9 Aug 1999]:
o Transparent support for PKCS#8 format private keys: these are used o Transparent support for PKCS#8 format private keys: these are used
by several software packages and are more secure than the standard by several software packages and are more secure than the standard
@@ -539,7 +685,7 @@
o New pipe-like BIO that allows using the SSL library when actual I/O o New pipe-like BIO that allows using the SSL library when actual I/O
must be handled by the application (BIO pair) must be handled by the application (BIO pair)
Major changes between OpenSSL 0.9.2b and OpenSSL 0.9.3: Major changes between OpenSSL 0.9.2b and OpenSSL 0.9.3 [24 May 1999]:
o Lots of enhancements and cleanups to the Configuration mechanism o Lots of enhancements and cleanups to the Configuration mechanism
o RSA OEAP related fixes o RSA OEAP related fixes
o Added `openssl ca -revoke' option for revoking a certificate o Added `openssl ca -revoke' option for revoking a certificate
@@ -553,7 +699,7 @@
o Sparc assembler bignum implementation, optimized hash functions o Sparc assembler bignum implementation, optimized hash functions
o Option to disable selected ciphers o Option to disable selected ciphers
Major changes between OpenSSL 0.9.1c and OpenSSL 0.9.2b: Major changes between OpenSSL 0.9.1c and OpenSSL 0.9.2b [22 Mar 1999]:
o Fixed a security hole related to session resumption o Fixed a security hole related to session resumption
o Fixed RSA encryption routines for the p < q case o Fixed RSA encryption routines for the p < q case
o "ALL" in cipher lists now means "everything except NULL ciphers" o "ALL" in cipher lists now means "everything except NULL ciphers"
@@ -575,7 +721,7 @@
o Lots of memory leak fixes. o Lots of memory leak fixes.
o Lots of bug fixes. o Lots of bug fixes.
Major changes between SSLeay 0.9.0b and OpenSSL 0.9.1c: Major changes between SSLeay 0.9.0b and OpenSSL 0.9.1c [23 Dec 1998]:
o Integration of the popular NO_RSA/NO_DSA patches o Integration of the popular NO_RSA/NO_DSA patches
o Initial support for compression inside the SSL record layer o Initial support for compression inside the SSL record layer
o Added BIO proxy and filtering functionality o Added BIO proxy and filtering functionality

View File

@@ -197,3 +197,17 @@ reconfigure with additional no-sse2 [or 386] option passed to ./config.
We don't have framework to associate -ldl with no-dso, therefore the only We don't have framework to associate -ldl with no-dso, therefore the only
way is to edit Makefile right after ./config no-dso and remove -ldl from way is to edit Makefile right after ./config no-dso and remove -ldl from
EX_LIBS line. EX_LIBS line.
* hpux-parisc2-cc no-asm build fails with SEGV in ECDSA/DH.
Compiler bug, presumably at particular patch level. Remaining
hpux*-parisc*-cc configurations can be affected too. Drop optimization
level to +O2 when compiling bn_nist.o.
* solaris64-sparcv9-cc link failure
Solaris 8 ar can fail to maintain symbol table in .a, which results in
link failures. Apply 109147-09 or later or modify Makefile generated
by ./Configure solaris64-sparcv9-cc and replace RANLIB assignment with
RANLIB= /usr/ccs/bin/ar rs

42
README
View File

@@ -1,5 +1,5 @@
OpenSSL 1.0.0d OpenSSL 1.0.2d 9 Jul 2015
Copyright (c) 1998-2011 The OpenSSL Project Copyright (c) 1998-2011 The OpenSSL Project
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
@@ -90,32 +90,6 @@
SSL/TLS Client and Server Tests SSL/TLS Client and Server Tests
Handling of S/MIME signed or encrypted mail Handling of S/MIME signed or encrypted mail
PATENTS
-------
Various companies hold various patents for various algorithms in various
locations around the world. _YOU_ are responsible for ensuring that your use
of any algorithms is legal by checking if there are any patents in your
country. The file contains some of the patents that we know about or are
rumored to exist. This is not a definitive list.
RSA Security holds software patents on the RC5 algorithm. If you
intend to use this cipher, you must contact RSA Security for
licensing conditions. Their web page is http://www.rsasecurity.com/.
RC4 is a trademark of RSA Security, so use of this label should perhaps
only be used with RSA Security's permission.
The IDEA algorithm is patented by Ascom in Austria, France, Germany, Italy,
Japan, the Netherlands, Spain, Sweden, Switzerland, UK and the USA. They
should be contacted if that algorithm is to be used; their web page is
http://www.ascom.ch/.
NTT and Mitsubishi have patents and pending patents on the Camellia
algorithm, but allow use at no charge without requiring an explicit
licensing agreement: http://info.isl.ntt.co.jp/crypt/eng/info/chiteki.html
INSTALLATION INSTALLATION
------------ ------------
@@ -161,8 +135,7 @@
- Problem Description (steps that will reproduce the problem, if known) - Problem Description (steps that will reproduce the problem, if known)
- Stack Traceback (if the application dumps core) - Stack Traceback (if the application dumps core)
Report the bug to the OpenSSL project via the Request Tracker Email the report to:
(http://www.openssl.org/support/rt.html) by mail to:
openssl-bugs@openssl.org openssl-bugs@openssl.org
@@ -170,10 +143,11 @@
or support queries. Just because something doesn't work the way you expect or support queries. Just because something doesn't work the way you expect
does not mean it is necessarily a bug in OpenSSL. does not mean it is necessarily a bug in OpenSSL.
Note that mail to openssl-bugs@openssl.org is recorded in the publicly Note that mail to openssl-bugs@openssl.org is recorded in the public
readable request tracker database and is forwarded to a public request tracker database (see https://www.openssl.org/support/rt.html
mailing list. Confidential mail may be sent to openssl-security@openssl.org for details) and also forwarded to a public mailing list. Confidential
(PGP key available from the key servers). mail may be sent to openssl-security@openssl.org (PGP key available from
the key servers).
HOW TO CONTRIBUTE TO OpenSSL HOW TO CONTRIBUTE TO OpenSSL
---------------------------- ----------------------------
@@ -190,7 +164,7 @@
reason as to why that feature isn't implemented. reason as to why that feature isn't implemented.
Patches should be as up to date as possible, preferably relative to the Patches should be as up to date as possible, preferably relative to the
current CVS or the last snapshot. They should follow the coding style of current Git or the last snapshot. They should follow the coding style of
OpenSSL and compile without warnings. Some of the core team developer targets OpenSSL and compile without warnings. Some of the core team developer targets
can be used for testing purposes, (debug-steve64, debug-geoff etc). OpenSSL can be used for testing purposes, (debug-steve64, debug-geoff etc). OpenSSL
compiles on many varied platforms: try to ensure you only use portable compiles on many varied platforms: try to ensure you only use portable

67
VMS/install-vms.com Executable file
View File

@@ -0,0 +1,67 @@
$! install-vms.com -- Installs the files in a given directory tree
$!
$! Author: Richard Levitte <richard@levitte.org>
$! Time of creation: 23-MAY-1998 19:22
$!
$! P1 root of the directory tree
$!
$!
$! Announce/identify.
$!
$ proc = f$environment( "procedure")
$ write sys$output "@@@ "+ -
f$parse( proc, , , "name")+ f$parse( proc, , , "type")
$!
$ on error then goto tidy
$ on control_c then goto tidy
$!
$ if p1 .eqs. ""
$ then
$ write sys$output "First argument missing."
$ write sys$output -
"Should be the directory where you want things installed."
$ exit
$ endif
$
$ if (f$getsyi( "cpu") .lt. 128)
$ then
$ arch = "VAX"
$ else
$ arch = f$edit( f$getsyi( "arch_name"), "upcase")
$ if (arch .eqs. "") then arch = "UNK"
$ endif
$
$ root = f$parse( P1, "[]A.;0", , , "SYNTAX_ONLY, NO_CONCEAL")- "A.;0"
$ root_dev = f$parse( root, , , "device", "syntax_only")
$ root_dir = f$parse( root, , , "directory", "syntax_only") - -
"[000000." - "][" - "[" - "]"
$ root = root_dev + "[" + root_dir
$
$ define /nolog wrk_sslroot 'root'.] /translation_attributes = concealed
$ define /nolog wrk_sslinclude wrk_sslroot:[include]
$
$ if f$parse( "wrk_sslroot:[000000]") .eqs. "" then -
create /directory /log wrk_sslroot:[000000]
$ if f$parse( "wrk_sslinclude:") .eqs. "" then -
create /directory /log wrk_sslinclude:
$ if f$parse( "wrk_sslroot:[vms]") .eqs. "" then -
create /directory /log wrk_sslroot:[vms]
$!
$ copy /log /protection = world:re openssl_startup.com wrk_sslroot:[vms]
$ copy /log /protection = world:re openssl_undo.com wrk_sslroot:[vms]
$ copy /log /protection = world:re openssl_utils.com wrk_sslroot:[vms]
$!
$ tidy:
$!
$ call deass wrk_sslroot
$ call deass wrk_sslinclude
$!
$ exit
$!
$ deass: subroutine
$ if (f$trnlnm( p1, "LNM$PROCESS") .nes. "")
$ then
$ deassign /process 'p1'
$ endif
$ endsubroutine
$!

View File

@@ -1,101 +1,163 @@
$! MKSHARED.COM -- script to created shareable images on VMS $! MKSHARED.COM -- Create shareable images.
$! $!
$! No command line parameters. This should be run at the start of the source $! P1: "64" for 64-bit pointers.
$! tree (the same directory where one finds INSTALL.VMS).
$! $!
$! Input: [.UTIL]LIBEAY.NUM,[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB $! P2: Zlib object library path (optional).
$! [.UTIL]SSLEAY.NUM,[.xxx.EXE.SSL]LIBSSL.OLB $!
$! Output: [.xxx.EXE.CRYPTO]LIBCRYPTO.OPT,.MAP,.EXE $! Input: [.UTIL]LIBEAY.NUM,[.xxx.EXE.CRYPTO]SSL_LIBCRYPTO[32].OLB
$! [.xxx.EXE.SSL]LIBSSL.OPT,.MAP,.EXE $! [.UTIL]SSLEAY.NUM,[.xxx.EXE.SSL]SSL_LIBSSL[32].OLB
$! [.CRYPTO.xxx]OPENSSLCONF.H
$! Output: [.xxx.EXE.CRYPTO]SSL_LIBCRYPTO_SHR[32].OPT,.MAP,.EXE
$! [.xxx.EXE.SSL]SSL_LIBSSL_SRH[32].OPT,.MAP,.EXE
$! $!
$! So far, tests have only been made on VMS for Alpha. VAX will come in time. $! So far, tests have only been made on VMS for Alpha. VAX will come in time.
$! =========================================================================== $! ===========================================================================
$ $!
$! Announce/identify.
$!
$ proc = f$environment( "procedure")
$ write sys$output "@@@ "+ -
f$parse( proc, , , "name")+ f$parse( proc, , , "type")
$!
$! Save the original default device:[directory].
$!
$ def_orig = f$environment( "default")
$ on error then goto tidy
$ on control_c then goto tidy
$!
$! SET DEFAULT to the main kit directory.
$!
$ proc = f$environment("procedure")
$ proc = f$parse( "A.;", proc)- "A.;"
$ set default 'proc'
$ set default [-]
$!
$! ----- Prepare info for processing: version number and file info $! ----- Prepare info for processing: version number and file info
$ gosub read_version_info $ gosub read_version_info
$ if libver .eqs. "" $ if libver .eqs. ""
$ then $ then
$ write sys$error "ERROR: Couldn't find any library version info..." $ write sys$error "ERROR: Couldn't find any library version info..."
$ exit $ go to tidy:
$ endif $ endif
$ $
$ if (f$getsyi("cpu").lt.128) $ if (f$getsyi("cpu") .lt. 128)
$ then $ then
$ arch := VAX
$ else
$ arch = f$edit( f$getsyi( "ARCH_NAME"), "UPCASE")
$ if (arch .eqs. "") then arch = "UNK"
$ endif
$
$ if arch .nes. "VAX"
$ then
$ arch_vax = 0
$ libid = "Crypto"
$ libnum = "[.UTIL]LIBEAY.NUM"
$ libdir = "[.''ARCH'.EXE.CRYPTO]"
$ libolb = "''libdir'LIBCRYPTO.OLB"
$ libopt = "''libdir'LIBCRYPTO.OPT"
$ libmap = "''libdir'LIBCRYPTO.MAP"
$ libgoal= "''libdir'LIBCRYPTO.EXE"
$ libref = ""
$ if f$search(libdir+libolb) .nes. "" then gosub create_nonvax_shr
$ libid = "SSL"
$ libnum = "[.UTIL]SSLEAY.NUM"
$ libdir = "[.''ARCH'.EXE.SSL]"
$ libolb = "''libdir'LIBSSL.OLB"
$ libopt = "''libdir'LIBSSL.OPT"
$ libmap = "''libdir'LIBSSL.MAP"
$ libgoal= "''libdir'LIBSSL.EXE"
$ libref = "[.''ARCH'.EXE.CRYPTO]LIBCRYPTO.EXE"
$ if f$search(libdir+libolb) .nes. "" then gosub create_nonvax_shr
$ arch_vax = 0
$ libid = "Crypto"
$ libnum = "[.UTIL]LIBEAY.NUM"
$ libdir = "[.''ARCH'.EXE.CRYPTO]"
$ libolb = "''libdir'LIBCRYPTO32.OLB"
$ libopt = "''libdir'LIBCRYPTO32.OPT"
$ libmap = "''libdir'LIBCRYPTO32.MAP"
$ libgoal= "''libdir'LIBCRYPTO32.EXE"
$ libref = ""
$ if f$search(libdir+libolb) .nes. "" then gosub create_nonvax_shr
$ libid = "SSL"
$ libnum = "[.UTIL]SSLEAY.NUM"
$ libdir = "[.''ARCH'.EXE.SSL]"
$ libolb = "''libdir'LIBSSL32.OLB"
$ libopt = "''libdir'LIBSSL32.OPT"
$ libmap = "''libdir'LIBSSL32.MAP"
$ libgoal= "''libdir'LIBSSL32.EXE"
$ libref = "[.''ARCH'.EXE.CRYPTO]LIBCRYPTO32.EXE"
$ if f$search(libdir+libolb) .nes. "" then gosub create_nonvax_shr
$ else
$ arch_vax = 1 $ arch_vax = 1
$ arch = "VAX"
$ else
$ arch_vax = 0
$ arch = f$edit( f$getsyi( "ARCH_NAME"), "UPCASE")
$ if (arch .eqs. "") then arch = "UNK"
$ endif
$!
$ archd = arch
$ lib32 = "32"
$ shr = "SHR32"
$!
$ if (p1 .nes. "")
$ then
$ if (p1 .eqs. "64")
$ then
$ archd = arch+ "_64"
$ lib32 = ""
$ shr = "SHR"
$ else
$ if (p1 .nes. "32")
$ then
$ write sys$output "Second argument invalid."
$ write sys$output "It should be "32", "64", or nothing."
$ exit
$ endif
$ endif
$ endif
$!
$! ----- Prepare info for processing: disabled algorithms info
$ gosub read_disabled_algorithms_info
$!
$ ZLIB = p2
$ zlib_lib = ""
$ if (ZLIB .nes. "")
$ then
$ file2 = f$parse( ZLIB, "libz.olb", , , "syntax_only")
$ if (f$search( file2) .eqs. "")
$ then
$ write sys$output ""
$ write sys$output "The Option ", ZLIB, " Is Invalid."
$ write sys$output " Can't find library: ''file2'"
$ write sys$output ""
$ goto tidy
$ endif
$ zlib_lib = ", ''file2' /library"
$ endif
$!
$ if (arch_vax)
$ then
$ libtit = "CRYPTO_TRANSFER_VECTOR" $ libtit = "CRYPTO_TRANSFER_VECTOR"
$ libid = "Crypto" $ libid = "Crypto"
$ libnum = "[.UTIL]LIBEAY.NUM" $ libnum = "[.UTIL]LIBEAY.NUM"
$ libdir = "[.''ARCH'.EXE.CRYPTO]" $ libdir = "[.''ARCHD'.EXE.CRYPTO]"
$ libmar = "''libdir'LIBCRYPTO.MAR" $ libmar = "''libdir'SSL_LIBCRYPTO_''shr'.MAR"
$ libolb = "''libdir'LIBCRYPTO.OLB" $ libolb = "''libdir'SSL_LIBCRYPTO''lib32'.OLB"
$ libopt = "''libdir'LIBCRYPTO.OPT" $ libopt = "''libdir'SSL_LIBCRYPTO_''shr'.OPT"
$ libobj = "''libdir'LIBCRYPTO.OBJ" $ libobj = "''libdir'SSL_LIBCRYPTO_''shr'.OBJ"
$ libmap = "''libdir'LIBCRYPTO.MAP" $ libmap = "''libdir'SSL_LIBCRYPTO_''shr'.MAP"
$ libgoal= "''libdir'LIBCRYPTO.EXE" $ libgoal= "''libdir'SSL_LIBCRYPTO_''shr'.EXE"
$ libref = "" $ libref = ""
$ libvec = "LIBCRYPTO" $ libvec = "LIBCRYPTO"
$ if f$search(libdir+libolb) .nes. "" then gosub create_vax_shr $ if f$search( libolb) .nes. "" then gosub create_vax_shr
$ libtit = "SSL_TRANSFER_VECTOR" $ libtit = "SSL_TRANSFER_VECTOR"
$ libid = "SSL" $ libid = "SSL"
$ libnum = "[.UTIL]SSLEAY.NUM" $ libnum = "[.UTIL]SSLEAY.NUM"
$ libdir = "[.''ARCH'.EXE.SSL]" $ libdir = "[.''ARCHD'.EXE.SSL]"
$ libmar = "''libdir'LIBSSL.MAR" $ libmar = "''libdir'SSL_LIBSSL_''shr'.MAR"
$ libolb = "''libdir'LIBSSL.OLB" $ libolb = "''libdir'SSL_LIBSSL''lib32'.OLB"
$ libopt = "''libdir'LIBSSL.OPT" $ libopt = "''libdir'SSL_LIBSSL_''shr'.OPT"
$ libobj = "''libdir'LIBSSL.OBJ" $ libobj = "''libdir'SSL_LIBSSL_''shr'.OBJ"
$ libmap = "''libdir'LIBSSL.MAP" $ libmap = "''libdir'SSL_LIBSSL_''shr'.MAP"
$ libgoal= "''libdir'LIBSSL.EXE" $ libgoal= "''libdir'SSL_LIBSSL_''shr'.EXE"
$ libref = "[.''ARCH'.EXE.CRYPTO]LIBCRYPTO.EXE" $ libref = "[.''ARCHD'.EXE.CRYPTO]SSL_LIBCRYPTO_''shr'.EXE"
$ libvec = "LIBSSL" $ libvec = "LIBSSL"
$ if f$search(libdir+libolb) .nes. "" then gosub create_vax_shr $ if f$search( libolb) .nes. "" then gosub create_vax_shr
$ else
$ libid = "Crypto"
$ libnum = "[.UTIL]LIBEAY.NUM"
$ libdir = "[.''ARCHD'.EXE.CRYPTO]"
$ libolb = "''libdir'SSL_LIBCRYPTO''lib32'.OLB"
$ libopt = "''libdir'SSL_LIBCRYPTO_''shr'.OPT"
$ libmap = "''libdir'SSL_LIBCRYPTO_''shr'.MAP"
$ libgoal= "''libdir'SSL_LIBCRYPTO_''shr'.EXE"
$ libref = ""
$ if f$search( libolb) .nes. "" then gosub create_nonvax_shr
$ libid = "SSL"
$ libnum = "[.UTIL]SSLEAY.NUM"
$ libdir = "[.''ARCHD'.EXE.SSL]"
$ libolb = "''libdir'SSL_LIBSSL''lib32'.OLB"
$ libopt = "''libdir'SSL_LIBSSL_''shr'.OPT"
$ libmap = "''libdir'SSL_LIBSSL_''shr'.MAP"
$ libgoal= "''libdir'SSL_LIBSSL_''shr'.EXE"
$ libref = "[.''ARCHD'.EXE.CRYPTO]SSL_LIBCRYPTO_''shr'.EXE"
$ if f$search( libolb) .nes. "" then gosub create_nonvax_shr
$ endif $ endif
$!
$ tidy:
$!
$! Close any open files.
$!
$ if (f$trnlnm( "libnum", "LNM$PROCESS", 0, "SUPERVISOR") .nes. "") then -
close libnum
$!
$ if (f$trnlnm( "mar", "LNM$PROCESS", 0, "SUPERVISOR") .nes. "") then -
close mar
$!
$ if (f$trnlnm( "opt", "LNM$PROCESS", 0, "SUPERVISOR") .nes. "") then -
close opt
$!
$ if (f$trnlnm( "vf", "LNM$PROCESS", 0, "SUPERVISOR") .nes. "") then -
close vf
$!
$! Restore the original default device:[directory].
$!
$ set default 'def_orig'
$ exit $ exit
$ $
$! ----- Subroutines to build the shareable libraries $! ----- Subroutines to build the shareable libraries
@@ -130,9 +192,9 @@ $! ----- Subroutines for non-VAX
$! ----- $! -----
$! The creator routine $! The creator routine
$ create_nonvax_shr: $ create_nonvax_shr:
$ open/write opt 'libopt' $ open /write opt 'libopt'
$ write opt "identification=""",libid," ",libverstr,"""" $ write opt "identification=""",libid," ",libverstr,""""
$ write opt libolb,"/lib" $ write opt libolb, " /library"
$ if libref .nes. "" then write opt libref,"/SHARE" $ if libref .nes. "" then write opt libref,"/SHARE"
$ write opt "SYMBOL_VECTOR=(-" $ write opt "SYMBOL_VECTOR=(-"
$ libfirstentry := true $ libfirstentry := true
@@ -143,7 +205,8 @@ $ gosub read_func_num
$ write opt ")" $ write opt ")"
$ write opt "GSMATCH=",libvmatch,",",libver $ write opt "GSMATCH=",libvmatch,",",libver
$ close opt $ close opt
$ link/map='libmap'/full/share='libgoal' 'libopt'/option $ link /map = 'libmap' /full /share = 'libgoal' 'libopt' /options -
'zlib_lib'
$ return $ return
$ $
$! The record writer routine $! The record writer routine
@@ -177,7 +240,7 @@ $! ----- Subroutines for VAX
$! ----- $! -----
$! The creator routine $! The creator routine
$ create_vax_shr: $ create_vax_shr:
$ open/write mar 'libmar' $ open /write mar 'libmar'
$ type sys$input:/out=mar: $ type sys$input:/out=mar:
; ;
; Transfer vector for VAX shareable image ; Transfer vector for VAX shareable image
@@ -212,10 +275,10 @@ $! libwriter := write_vax_vtransfer_entry
$! gosub read_func_num $! gosub read_func_num
$ write mar " .END" $ write mar " .END"
$ close mar $ close mar
$ open/write opt 'libopt' $ open /write opt 'libopt'
$ write opt "identification=""",libid," ",libverstr,"""" $ write opt "identification=""",libid," ",libverstr,""""
$ write opt libobj $ write opt libobj
$ write opt libolb,"/lib" $ write opt libolb, " /library"
$ if libref .nes. "" then write opt libref,"/SHARE" $ if libref .nes. "" then write opt libref,"/SHARE"
$ type sys$input:/out=opt: $ type sys$input:/out=opt:
! !
@@ -234,7 +297,8 @@ $ libwriter := write_vax_psect_attr
$ gosub read_func_num $ gosub read_func_num
$ close opt $ close opt
$ macro/obj='libobj' 'libmar' $ macro/obj='libobj' 'libmar'
$ link/map='libmap'/full/share='libgoal' 'libopt'/option $ link /map = 'libmap' /full /share = 'libgoal' 'libopt' /options -
'zlib_lib'
$ return $ return
$ $
$! The record writer routine for VAX functions $! The record writer routine for VAX functions
@@ -256,9 +320,9 @@ $ return
$ $
$! ----- Common subroutines $! ----- Common subroutines
$! ----- $! -----
$! The .num file reader. This one has great responsability. $! The .num file reader. This one has great responsibility.
$ read_func_num: $ read_func_num:
$ open libnum 'libnum' $ open /read libnum 'libnum'
$ goto read_nums $ goto read_nums
$ $
$ read_nums: $ read_nums:
@@ -266,27 +330,30 @@ $ libentrynum=0
$ liblastentry:=false $ liblastentry:=false
$ entrycount=0 $ entrycount=0
$ loop: $ loop:
$ read/end=loop_end/err=loop_end libnum line $ read /end=loop_end /err=loop_end libnum line
$ entrynum=f$int(f$element(1," ",f$edit(line,"COMPRESS,TRIM"))) $ lin = f$edit( line, "COMPRESS,TRIM")
$ entryinfo=f$element(2," ",f$edit(line,"COMPRESS,TRIM")) $! Skip a "#" comment line.
$ curentry=f$element(0," ",f$edit(line,"COMPRESS,TRIM")) $ if (f$extract( 0, 1, lin) .eqs. "#") then goto loop
$ info_exist=f$element(0,":",entryinfo) $ entrynum = f$int(f$element( 1, " ", lin))
$ info_platforms=","+f$element(1,":",entryinfo)+"," $ entryinfo = f$element( 2, " ", lin)
$ info_kind=f$element(2,":",entryinfo) $ curentry = f$element( 0, " ", lin)
$ info_algorithms=","+f$element(3,":",entryinfo)+"," $ info_exist = f$element( 0, ":", entryinfo)
$ info_platforms = ","+ f$element(1, ":", entryinfo)+ ","
$ info_kind = f$element( 2, ":", entryinfo)
$ info_algorithms = ","+ f$element( 3, ":", entryinfo)+ ","
$ if info_exist .eqs. "NOEXIST" then goto loop $ if info_exist .eqs. "NOEXIST" then goto loop
$ truesum = 0 $ truesum = 0
$ falsesum = 0 $ falsesum = 0
$ negatives = 1 $ negatives = 1
$ plat_i = 0 $ plat_i = 0
$ loop1: $ loop1:
$ plat_entry = f$element(plat_i,",",info_platforms) $ plat_entry = f$element( plat_i, ",", info_platforms)
$ plat_i = plat_i + 1 $ plat_i = plat_i + 1
$ if plat_entry .eqs. "" then goto loop1 $ if plat_entry .eqs. "" then goto loop1
$ if plat_entry .nes. "," $ if plat_entry .nes. ","
$ then $ then
$ if f$extract(0,1,plat_entry) .nes. "!" then negatives = 0 $ if f$extract(0,1,plat_entry) .nes. "!" then negatives = 0
$ if f$getsyi("CPU") .lt. 128 $ if (arch_vax)
$ then $ then
$ if plat_entry .eqs. "EXPORT_VAR_AS_FUNCTION" then - $ if plat_entry .eqs. "EXPORT_VAR_AS_FUNCTION" then -
$ truesum = truesum + 1 $ truesum = truesum + 1
@@ -295,6 +362,7 @@ $ falsesum = falsesum + 1
$ endif $ endif
$! $!
$ if ((plat_entry .eqs. "VMS") .or. - $ if ((plat_entry .eqs. "VMS") .or. -
((plat_entry .eqs. "ZLIB") .and. (ZLIB .nes. "")) .or. -
(arch_vax .and. (plat_entry .eqs. "VMSVAX"))) then - (arch_vax .and. (plat_entry .eqs. "VMSVAX"))) then -
truesum = truesum + 1 truesum = truesum + 1
$! $!
@@ -320,8 +388,7 @@ $ alg_i = alg_i + 1
$ if alg_entry .eqs. "" then goto loop2 $ if alg_entry .eqs. "" then goto loop2
$ if alg_entry .nes. "," $ if alg_entry .nes. ","
$ then $ then
$ if alg_entry .eqs. "KRB5" then goto loop ! Special for now $ if disabled_algorithms - ("," + alg_entry + ",") .nes disabled_algorithms then goto loop
$ if alg_entry .eqs. "STATIC_ENGINE" then goto loop ! Special for now
$ if f$trnlnm("OPENSSL_NO_"+alg_entry) .nes. "" then goto loop $ if f$trnlnm("OPENSSL_NO_"+alg_entry) .nes. "" then goto loop
$ goto loop2 $ goto loop2
$ endif $ endif
@@ -364,7 +431,7 @@ $
$! The version number reader $! The version number reader
$ read_version_info: $ read_version_info:
$ libver = "" $ libver = ""
$ open/read vf [.CRYPTO]OPENSSLV.H $ open /read vf [.CRYPTO]OPENSSLV.H
$ loop_rvi: $ loop_rvi:
$ read/err=endloop_rvi/end=endloop_rvi vf rvi_line $ read/err=endloop_rvi/end=endloop_rvi vf rvi_line
$ if rvi_line - "SHLIB_VERSION_NUMBER """ .eqs. rvi_line then - $ if rvi_line - "SHLIB_VERSION_NUMBER """ .eqs. rvi_line then -
@@ -388,3 +455,22 @@ $ endif
$ endloop_rvi: $ endloop_rvi:
$ close vf $ close vf
$ return $ return
$
$! The disabled algorithms reader
$ read_disabled_algorithms_info:
$ disabled_algorithms = ","
$ open /read cf [.CRYPTO.'ARCH']OPENSSLCONF.H
$ loop_rci:
$ read/err=endloop_rci/end=endloop_rci cf rci_line
$ rci_line = f$edit(rci_line,"TRIM,COMPRESS")
$ rci_ei = 0
$ if f$extract(0,9,rci_line) .eqs. "# define " then rci_ei = 2
$ if f$extract(0,8,rci_line) .eqs. "#define " then rci_ei = 1
$ if rci_ei .eq. 0 then goto loop_rci
$ rci_e = f$element(rci_ei," ",rci_line)
$ if f$extract(0,11,rci_e) .nes. "OPENSSL_NO_" then goto loop_rci
$ disabled_algorithms = disabled_algorithms + f$extract(11,999,rci_e) + ","
$ goto loop_rci
$ endloop_rci:
$ close cf
$ return

108
VMS/openssl_startup.com Executable file
View File

@@ -0,0 +1,108 @@
$!
$! Startup file for OpenSSL 1.x.
$!
$! 2011-03-05 SMS.
$!
$! This procedure must reside in the OpenSSL installation directory.
$! It will fail if it is copied to a different location.
$!
$! P1 qualifier(s) for DEFINE. For example, "/SYSTEM" to get the
$! logical names defined in the system logical name table.
$!
$! P2 "64", to use executables which were built with 64-bit pointers.
$!
$! Good (default) and bad status values.
$!
$ status = %x00010001 ! RMS$_NORMAL, normal successful completion.
$ rms_e_fnf = %x00018292 ! RMS$_FNF, file not found.
$!
$! Prepare for problems.
$!
$ orig_dev_dir = f$environment( "DEFAULT")
$ on control_y then goto clean_up
$ on error then goto clean_up
$!
$! Determine hardware architecture.
$!
$ if (f$getsyi( "cpu") .lt. 128)
$ then
$ arch_name = "VAX"
$ else
$ arch_name = f$edit( f$getsyi( "arch_name"), "upcase")
$ if (arch_name .eqs. "") then arch_name = "UNK"
$ endif
$!
$ if (p2 .eqs. "64")
$ then
$ arch_name_exe = arch_name+ "_64"
$ else
$ arch_name_exe = arch_name
$ endif
$!
$! Derive the OpenSSL installation device:[directory] from the location
$! of this command procedure.
$!
$ proc = f$environment( "procedure")
$ proc_dev_dir = f$parse( "A.;", proc, , , "no_conceal") - "A.;"
$ proc_dev = f$parse( proc_dev_dir, , , "device", "syntax_only")
$ proc_dir = f$parse( proc_dev_dir, , , "directory", "syntax_only") - -
".][000000"- "[000000."- "]["- "["- "]"
$ proc_dev_dir = proc_dev+ "["+ proc_dir+ "]"
$ set default 'proc_dev_dir'
$ set default [-]
$ ossl_dev_dir = f$environment( "default")
$!
$! Check existence of expected directories (to see if this procedure has
$! been moved away from its proper place).
$!
$ if ((f$search( "certs.dir;1") .eqs. "") .or. -
(f$search( "include.dir;1") .eqs. "") .or. -
(f$search( "private.dir;1") .eqs. "") .or. -
(f$search( "vms.dir;1") .eqs. ""))
$ then
$ write sys$output -
" Can't find expected common OpenSSL directories in:"
$ write sys$output " ''ossl_dev_dir'"
$ status = rms_e_fnf
$ goto clean_up
$ endif
$!
$ if ((f$search( "''arch_name_exe'_exe.dir;1") .eqs. "") .or. -
(f$search( "''arch_name'_lib.dir;1") .eqs. ""))
$ then
$ write sys$output -
" Can't find expected architecture-specific OpenSSL directories in:"
$ write sys$output " ''ossl_dev_dir'"
$ status = rms_e_fnf
$ goto clean_up
$ endif
$!
$! All seems well (enough). Define the OpenSSL logical names.
$!
$ ossl_root = ossl_dev_dir- "]"+ ".]"
$ define /translation_attributes = concealed /nolog'p1 SSLROOT 'ossl_root'
$ define /nolog 'p1' SSLCERTS sslroot:[certs]
$ define /nolog 'p1' SSLINCLUDE sslroot:[include]
$ define /nolog 'p1' SSLPRIVATE sslroot:[private]
$ define /nolog 'p1' SSLEXE sslroot:['arch_name_exe'_exe]
$ define /nolog 'p1' SSLLIB sslroot:['arch_name'_lib]
$!
$! Defining OPENSSL lets a C program use "#include <openssl/{foo}.h>":
$ define /nolog 'p1' OPENSSL SSLINCLUDE:
$!
$! Run a site-specific procedure, if it exists.
$!
$ if f$search( "sslroot:[vms]openssl_systartup.com") .nes."" then -
@ sslroot:[vms]openssl_systartup.com
$!
$! Restore the original default dev:[dir] (if known).
$!
$ clean_up:
$!
$ if (f$type( orig_dev_dir) .nes. "")
$ then
$ set default 'orig_dev_dir'
$ endif
$!
$ EXIT 'status'
$!

20
VMS/openssl_undo.com Executable file
View File

@@ -0,0 +1,20 @@
$!
$! Deassign OpenSSL logical names.
$!
$ call deass "OPENSSL" "''p1'"
$ call deass "SSLCERTS" "''p1'"
$ call deass "SSLEXE" "''p1'"
$ call deass "SSLINCLUDE" "''p1'"
$ call deass "SSLLIB" "''p1'"
$ call deass "SSLPRIVATE" "''p1'"
$ call deass "SSLROOT" "''p1'"
$!
$ exit
$!
$deass: subroutine
$ if (f$trnlnm( p1) .nes. "")
$ then
$ deassign 'p2' 'p1'
$ endif
$ endsubroutine
$!

20
a.txt Normal file
View File

@@ -0,0 +1,20 @@
libcrypto.a(md5_dgst.o):
U _md5_block_asm_data_order
libcrypto.a(md5_one.o):
libcrypto.a(md5-586.o):
00000000 T _md5_block_asm_data_order
libcrypto.a(m_md5.o):
00000000 T _EVP_md5
00000080 s _md5_md
U _EVP_rc4_hmac_md5
U _EVP_md5
libcrypto.a(e_rc4_hmac_md5.o):
00000000 T _EVP_rc4_hmac_md5
000004e0 d _r4_hmac_md5_cipher
00000080 t _rc4_hmac_md5_cipher
000002c0 t _rc4_hmac_md5_ctrl
00000010 t _rc4_hmac_md5_init_key
U _EVP_md5
U _EVP_md5
U _EVP_md5
U _EVP_md5

View File

@@ -37,14 +37,25 @@ $ VERIFY = openssl + " verify"
$ X509 = openssl + " x509" $ X509 = openssl + " x509"
$ PKCS12 = openssl + " pkcs12" $ PKCS12 = openssl + " pkcs12"
$ echo = "write sys$Output" $ echo = "write sys$Output"
$ RET = 1
$! $!
$ s = F$PARSE(F$ENVIRONMENT("DEFAULT"),"[]") - "].;" $! 2010-12-20 SMS.
$ CATOP := 's'.demoCA $! Use a concealed logical name to reduce command line lengths, to
$ CAKEY := ]cakey.pem $! avoid DCL errors on VAX:
$ CACERT := ]cacert.pem $! %DCL-W-TKNOVF, command element is too long - shorten
$! (Path segments like "openssl-1_0_1-stable-SNAP-20101217" accumulate
$! quickly.)
$!
$ CATOP = F$PARSE( F$ENVIRONMENT( "DEFAULT"), "[]")- "].;"+ ".demoCA.]"
$ define /translation_attributes = concealed CATOP 'CATOP'
$!
$ on error then goto clean_up
$ on control_y then goto clean_up
$!
$ CAKEY = "CATOP:[private]cakey.pem"
$ CACERT = "CATOP:[000000]cacert.pem"
$ $
$ __INPUT := SYS$COMMAND $ __INPUT := SYS$COMMAND
$ RET = 1
$! $!
$ i = 1 $ i = 1
$opt_loop: $opt_loop:
@@ -55,7 +66,7 @@ $
$ IF (prog_opt .EQS. "?" .OR. prog_opt .EQS. "-h" .OR. prog_opt .EQS. "-help") $ IF (prog_opt .EQS. "?" .OR. prog_opt .EQS. "-h" .OR. prog_opt .EQS. "-help")
$ THEN $ THEN
$ echo "usage: CA -newcert|-newreq|-newca|-sign|-verify" $ echo "usage: CA -newcert|-newreq|-newca|-sign|-verify"
$ exit $ goto clean_up
$ ENDIF $ ENDIF
$! $!
$ IF (prog_opt .EQS. "-input") $ IF (prog_opt .EQS. "-input")
@@ -69,7 +80,7 @@ $!
$ IF (prog_opt .EQS. "-newcert") $ IF (prog_opt .EQS. "-newcert")
$ THEN $ THEN
$ ! Create a certificate. $ ! Create a certificate.
$ DEFINE/USER SYS$INPUT '__INPUT' $ DEFINE /USER_MODE SYS$INPUT '__INPUT'
$ REQ -new -x509 -keyout newreq.pem -out newreq.pem 'DAYS' $ REQ -new -x509 -keyout newreq.pem -out newreq.pem 'DAYS'
$ RET=$STATUS $ RET=$STATUS
$ echo "Certificate (and private key) is in newreq.pem" $ echo "Certificate (and private key) is in newreq.pem"
@@ -79,7 +90,7 @@ $!
$ IF (prog_opt .EQS. "-newreq") $ IF (prog_opt .EQS. "-newreq")
$ THEN $ THEN
$ ! Create a certificate request $ ! Create a certificate request
$ DEFINE/USER SYS$INPUT '__INPUT' $ DEFINE /USER_MODE SYS$INPUT '__INPUT'
$ REQ -new -keyout newreq.pem -out newreq.pem 'DAYS' $ REQ -new -keyout newreq.pem -out newreq.pem 'DAYS'
$ RET=$STATUS $ RET=$STATUS
$ echo "Request (and private key) is in newreq.pem" $ echo "Request (and private key) is in newreq.pem"
@@ -90,41 +101,40 @@ $ IF (prog_opt .EQS. "-newca")
$ THEN $ THEN
$ ! If explicitly 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. $ ! structure that Eric likes to manage things.
$ IF F$SEARCH(CATOP+"]serial.") .EQS. "" $ IF F$SEARCH( "CATOP:[000000]serial.") .EQS. ""
$ THEN $ THEN
$ CREATE /DIR /PROTECTION=OWNER:RWED 'CATOP'] $ CREATE /DIRECTORY /PROTECTION=OWNER:RWED CATOP:[000000]
$ CREATE /DIR /PROTECTION=OWNER:RWED 'CATOP'.certs] $ CREATE /DIRECTORY /PROTECTION=OWNER:RWED CATOP:[certs]
$ CREATE /DIR /PROTECTION=OWNER:RWED 'CATOP'.crl] $ CREATE /DIRECTORY /PROTECTION=OWNER:RWED CATOP:[crl]
$ CREATE /DIR /PROTECTION=OWNER:RWED 'CATOP'.newcerts] $ CREATE /DIRECTORY /PROTECTION=OWNER:RWED CATOP:[newcerts]
$ CREATE /DIR /PROTECTION=OWNER:RWED 'CATOP'.private] $ CREATE /DIRECTORY /PROTECTION=OWNER:RWED CATOP:[private]
$ $
$ OPEN /WRITE ser_file 'CATOP']serial. $ OPEN /WRITE ser_file CATOP:[000000]serial.
$ WRITE ser_file "01" $ WRITE ser_file "01"
$ CLOSE ser_file $ CLOSE ser_file
$ APPEND/NEW NL: 'CATOP']index.txt $ APPEND /NEW_VERSION NL: CATOP:[000000]index.txt
$ $
$ ! The following is to make sure access() doesn't get confused. It $ ! The following is to make sure access() doesn't get confused. It
$ ! really needs one file in the directory to give correct answers... $ ! really needs one file in the directory to give correct answers...
$ COPY NLA0: 'CATOP'.certs].; $ COPY NLA0: CATOP:[certs].;
$ COPY NLA0: 'CATOP'.crl].; $ COPY NLA0: CATOP:[crl].;
$ COPY NLA0: 'CATOP'.newcerts].; $ COPY NLA0: CATOP:[newcerts].;
$ COPY NLA0: 'CATOP'.private].; $ COPY NLA0: CATOP:[private].;
$ ENDIF $ ENDIF
$! $!
$ IF F$SEARCH(CATOP+".private"+CAKEY) .EQS. "" $ IF F$SEARCH( CAKEY) .EQS. ""
$ THEN $ THEN
$ READ '__INPUT' FILE - $ READ '__INPUT' FILE -
/PROMPT="CA certificate filename (or enter to create)" /PROMPT="CA certificate filename (or enter to create): "
$ IF (FILE .NES. "") .AND. (F$SEARCH(FILE) .NES. "") $ IF (FILE .NES. "") .AND. (F$SEARCH(FILE) .NES. "")
$ THEN $ THEN
$ COPY 'FILE' 'CATOP'.private'CAKEY' $ COPY 'FILE' 'CAKEY'
$ RET=$STATUS $ RET=$STATUS
$ ELSE $ ELSE
$ echo "Making CA certificate ..." $ echo "Making CA certificate ..."
$ DEFINE/USER SYS$INPUT '__INPUT' $ DEFINE /USER_MODE SYS$INPUT '__INPUT'
$ REQ -new -x509 -keyout 'CATOP'.private'CAKEY' - $ REQ -new -x509 -keyout 'CAKEY' -out 'CACERT' 'DAYS'
-out 'CATOP''CACERT' 'DAYS' $ RET=$STATUS
$ RET=$STATUS
$ ENDIF $ ENDIF
$ ENDIF $ ENDIF
$ GOTO opt_loop_continue $ GOTO opt_loop_continue
@@ -135,16 +145,16 @@ $ THEN
$ i = i + 1 $ i = i + 1
$ cname = P'i' $ cname = P'i'
$ IF cname .EQS. "" THEN cname = "My certificate" $ IF cname .EQS. "" THEN cname = "My certificate"
$ PKCS12 -in newcert.pem -inkey newreq.pem -certfile 'CATOP''CACERT - $ PKCS12 -in newcert.pem -inkey newreq.pem -certfile 'CACERT' -
-out newcert.p12 -export -name "''cname'" -out newcert.p12 -export -name "''cname'"
$ RET=$STATUS $ RET=$STATUS
$ exit RET $ goto clean_up
$ ENDIF $ ENDIF
$! $!
$ IF (prog_opt .EQS. "-xsign") $ IF (prog_opt .EQS. "-xsign")
$ THEN $ THEN
$! $!
$ DEFINE/USER SYS$INPUT '__INPUT' $ DEFINE /USER_MODE SYS$INPUT '__INPUT'
$ CA -policy policy_anything -infiles newreq.pem $ CA -policy policy_anything -infiles newreq.pem
$ RET=$STATUS $ RET=$STATUS
$ GOTO opt_loop_continue $ GOTO opt_loop_continue
@@ -153,7 +163,7 @@ $!
$ IF ((prog_opt .EQS. "-sign") .OR. (prog_opt .EQS. "-signreq")) $ IF ((prog_opt .EQS. "-sign") .OR. (prog_opt .EQS. "-signreq"))
$ THEN $ THEN
$! $!
$ DEFINE/USER SYS$INPUT '__INPUT' $ DEFINE /USER_MODE SYS$INPUT '__INPUT'
$ CA -policy policy_anything -out newcert.pem -infiles newreq.pem $ CA -policy policy_anything -out newcert.pem -infiles newreq.pem
$ RET=$STATUS $ RET=$STATUS
$ type newcert.pem $ type newcert.pem
@@ -165,9 +175,9 @@ $ IF (prog_opt .EQS. "-signcert")
$ THEN $ THEN
$! $!
$ echo "Cert passphrase will be requested twice - bug?" $ echo "Cert passphrase will be requested twice - bug?"
$ DEFINE/USER SYS$INPUT '__INPUT' $ DEFINE /USER_MODE SYS$INPUT '__INPUT'
$ X509 -x509toreq -in newreq.pem -signkey newreq.pem -out tmp.pem $ X509 -x509toreq -in newreq.pem -signkey newreq.pem -out tmp.pem
$ DEFINE/USER SYS$INPUT '__INPUT' $ DEFINE /USER_MODE SYS$INPUT '__INPUT'
$ CA -policy policy_anything -out newcert.pem -infiles tmp.pem $ CA -policy policy_anything -out newcert.pem -infiles tmp.pem
y y
y y
@@ -182,17 +192,17 @@ $!
$ i = i + 1 $ i = i + 1
$ IF (p'i' .EQS. "") $ IF (p'i' .EQS. "")
$ THEN $ THEN
$ DEFINE/USER SYS$INPUT '__INPUT' $ DEFINE /USER_MODE SYS$INPUT '__INPUT'
$ VERIFY "-CAfile" 'CATOP''CACERT' newcert.pem $ VERIFY "-CAfile" 'CACERT' newcert.pem
$ ELSE $ ELSE
$ j = i $ j = i
$ verify_opt_loop: $ verify_opt_loop:
$ IF j .GT. 8 THEN GOTO verify_opt_loop_end $ IF j .GT. 8 THEN GOTO verify_opt_loop_end
$ IF p'j' .NES. "" $ IF p'j' .NES. ""
$ THEN $ THEN
$ DEFINE/USER SYS$INPUT '__INPUT' $ DEFINE /USER_MODE SYS$INPUT '__INPUT'
$ __tmp = p'j' $ __tmp = p'j'
$ VERIFY "-CAfile" 'CATOP''CACERT' '__tmp' $ VERIFY "-CAfile" 'CACERT' '__tmp'
$ tmp=$STATUS $ tmp=$STATUS
$ IF tmp .NE. 0 THEN RET=tmp $ IF tmp .NE. 0 THEN RET=tmp
$ ENDIF $ ENDIF
@@ -208,8 +218,8 @@ $ IF (prog_opt .NES. "")
$ THEN $ THEN
$! $!
$ echo "Unknown argument ''prog_opt'" $ echo "Unknown argument ''prog_opt'"
$ $ RET = 3
$ EXIT 3 $ goto clean_up
$ ENDIF $ ENDIF
$ $
$opt_loop_continue: $opt_loop_continue:
@@ -217,4 +227,10 @@ $ i = i + 1
$ GOTO opt_loop $ GOTO opt_loop
$ $
$opt_loop_end: $opt_loop_end:
$!
$clean_up:
$!
$ if f$trnlnm( "CATOP", "LNM$PROCESS") .nes. "" then -
deassign /process CATOP
$!
$ EXIT 'RET' $ EXIT 'RET'

View File

@@ -1,189 +0,0 @@
#!/usr/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[-nodes] ... 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
my $openssl;
if(defined $ENV{OPENSSL}) {
$openssl = $ENV{OPENSSL};
} else {
$openssl = "openssl";
$ENV{OPENSSL} = $openssl;
}
$SSLEAY_CONFIG=$ENV{"SSLEAY_CONFIG"};
$DAYS="-days 365"; # 1 year
$CADAYS="-days 1095"; # 3 years
$REQ="$openssl req $SSLEAY_CONFIG";
$CA="$openssl ca $SSLEAY_CONFIG";
$VERIFY="$openssl verify";
$X509="$openssl x509";
$PKCS12="$openssl pkcs12";
$CATOP="./demoCA";
$CAKEY="cakey.pem";
$CAREQ="careq.pem";
$CACERT="cacert.pem";
$DIRMODE = 0777;
$RET = 0;
foreach (@ARGV) {
if ( /^(-\?|-h|-help)$/ ) {
print STDERR "usage: CA -newcert|-newreq|-newreq-nodes|-newca|-sign|-verify\n";
exit 0;
} elsif (/^-newcert$/) {
# create a certificate
system ("$REQ -new -x509 -keyout newkey.pem -out newcert.pem $DAYS");
$RET=$?;
print "Certificate is in newcert.pem, private key is in newkey.pem\n"
} elsif (/^-newreq$/) {
# create a certificate request
system ("$REQ -new -keyout newkey.pem -out newreq.pem $DAYS");
$RET=$?;
print "Request is in newreq.pem, private key is in newkey.pem\n";
} elsif (/^-newreq-nodes$/) {
# create a certificate request
system ("$REQ -new -nodes -keyout newkey.pem -out newreq.pem $DAYS");
$RET=$?;
print "Request is in newreq.pem, private key is in newkey.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}/index.txt";
close OUT;
open OUT, ">${CATOP}/crlnumber";
print OUT "01\n";
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 -keyout " .
"${CATOP}/private/$CAKEY -out ${CATOP}/$CAREQ");
system ("$CA -create_serial " .
"-out ${CATOP}/$CACERT $CADAYS -batch " .
"-keyfile ${CATOP}/private/$CAKEY -selfsign " .
"-extensions v3_ca " .
"-infiles ${CATOP}/$CAREQ ");
$RET=$?;
}
}
} elsif (/^-pkcs12$/) {
my $cname = $ARGV[1];
$cname = "My Certificate" unless defined $cname;
system ("$PKCS12 -in newcert.pem -inkey newkey.pem " .
"-certfile ${CATOP}/$CACERT -out newcert.p12 " .
"-export -name \"$cname\"");
$RET=$?;
print "PKCS #12 file is in newcert.p12\n";
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 (/^(-signCA)$/) {
system ("$CA -policy policy_anything -out newcert.pem " .
"-extensions v3_ca -infiles newreq.pem");
$RET=$?;
print "Signed CA 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|-newreq-nodes|-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

@@ -39,7 +39,7 @@ E_EXE= verify asn1pars req dgst dh dhparam enc passwd gendh errstr \
ca crl rsa rsautl dsa dsaparam ec ecparam \ ca crl rsa rsautl dsa dsaparam ec ecparam \
x509 genrsa gendsa genpkey s_server s_client speed \ x509 genrsa gendsa genpkey s_server s_client speed \
s_time version pkcs7 cms crl2pkcs7 sess_id ciphers nseq pkcs12 \ s_time version pkcs7 cms crl2pkcs7 sess_id ciphers nseq pkcs12 \
pkcs8 pkey pkeyparam pkeyutl spkac smime rand engine ocsp prime ts pkcs8 pkey pkeyparam pkeyutl spkac smime rand engine ocsp prime ts srp
PROGS= $(PROGRAM).c PROGS= $(PROGRAM).c
@@ -56,7 +56,7 @@ E_OBJ= verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o er
x509.o genrsa.o gendsa.o genpkey.o s_server.o s_client.o speed.o \ x509.o genrsa.o gendsa.o genpkey.o s_server.o s_client.o speed.o \
s_time.o $(A_OBJ) $(S_OBJ) $(RAND_OBJ) version.o sess_id.o \ s_time.o $(A_OBJ) $(S_OBJ) $(RAND_OBJ) version.o sess_id.o \
ciphers.o nseq.o pkcs12.o pkcs8.o pkey.o pkeyparam.o pkeyutl.o \ ciphers.o nseq.o pkcs12.o pkcs8.o pkey.o pkeyparam.o pkeyutl.o \
spkac.o smime.o cms.o rand.o engine.o ocsp.o prime.o ts.o spkac.o smime.o cms.o rand.o engine.o ocsp.o prime.o ts.o srp.o
E_SRC= verify.c asn1pars.c req.c dgst.c dh.c enc.c passwd.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 \ pkcs7.c crl2p7.c crl.c \
@@ -64,7 +64,7 @@ E_SRC= verify.c asn1pars.c req.c dgst.c dh.c enc.c passwd.c gendh.c errstr.c ca.
x509.c genrsa.c gendsa.c genpkey.c s_server.c s_client.c speed.c \ x509.c genrsa.c gendsa.c genpkey.c s_server.c s_client.c speed.c \
s_time.c $(A_SRC) $(S_SRC) $(RAND_SRC) version.c sess_id.c \ s_time.c $(A_SRC) $(S_SRC) $(RAND_SRC) version.c sess_id.c \
ciphers.c nseq.c pkcs12.c pkcs8.c pkey.c pkeyparam.c pkeyutl.c \ ciphers.c nseq.c pkcs12.c pkcs8.c pkey.c pkeyparam.c pkeyutl.c \
spkac.c smime.c cms.c rand.c engine.c ocsp.c prime.c ts.c spkac.c smime.c cms.c rand.c engine.c ocsp.c prime.c ts.c srp.c
SRC=$(E_SRC) SRC=$(E_SRC)
@@ -94,6 +94,9 @@ req: sreq.o $(A_OBJ) $(DLIBCRYPTO)
sreq.o: req.c sreq.o: req.c
$(CC) -c $(INCLUDES) $(CFLAG) -o sreq.o req.c $(CC) -c $(INCLUDES) $(CFLAG) -o sreq.o req.c
openssl-vms.cnf: openssl.cnf
$(PERL) $(TOP)/VMS/VMSify-conf.pl < openssl.cnf > openssl-vms.cnf
files: files:
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
@@ -127,12 +130,12 @@ links:
lint: lint:
lint -DLINT $(INCLUDES) $(SRC)>fluff lint -DLINT $(INCLUDES) $(SRC)>fluff
depend: update: openssl-vms.cnf local_depend
@if [ -z "$(THIS)" ]; then \
$(MAKE) -f $(TOP)/Makefile reflect THIS=$@; \ depend: local_depend
else \ @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(SRC); \ local_depend:
fi @[ -z "$(THIS)" ] || $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(SRC); \
dclean: dclean:
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
@@ -144,15 +147,17 @@ clean:
rm -f req rm -f req
$(DLIBSSL): $(DLIBSSL):
(cd ..; $(MAKE) DIRS=ssl all) (cd ..; $(MAKE) build_libssl)
$(DLIBCRYPTO): $(DLIBCRYPTO):
(cd ..; $(MAKE) DIRS=crypto all) (cd ..; $(MAKE) build_libcrypto)
$(EXE): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL) $(EXE): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
$(RM) $(EXE) $(RM) $(EXE)
shlib_target=; if [ -n "$(SHARED_LIBS)" ]; then \ shlib_target=; if [ -n "$(SHARED_LIBS)" ]; then \
shlib_target="$(SHLIB_TARGET)"; \ shlib_target="$(SHLIB_TARGET)"; \
elif [ -n "$(FIPSCANLIB)" ]; then \
FIPSLD_CC="$(CC)"; CC=$(FIPSDIR)/bin/fipsld; export CC FIPSLD_CC; \
fi; \ fi; \
LIBRARIES="$(LIBSSL) $(LIBKRB5) $(LIBCRYPTO)" ; \ LIBRARIES="$(LIBSSL) $(LIBKRB5) $(LIBCRYPTO)" ; \
$(MAKE) -f $(TOP)/Makefile.shared -e \ $(MAKE) -f $(TOP)/Makefile.shared -e \
@@ -245,13 +250,13 @@ ciphers.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
ciphers.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h ciphers.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
ciphers.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h ciphers.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
ciphers.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h ciphers.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h
ciphers.o: ../include/openssl/sha.h ../include/openssl/ssl.h ciphers.o: ../include/openssl/sha.h ../include/openssl/srtp.h
ciphers.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h ciphers.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
ciphers.o: ../include/openssl/ssl3.h ../include/openssl/stack.h ciphers.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
ciphers.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h ciphers.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
ciphers.o: ../include/openssl/txt_db.h ../include/openssl/x509.h ciphers.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
ciphers.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h ciphers.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
ciphers.o: ciphers.c ciphers.o: ../include/openssl/x509v3.h apps.h ciphers.c
cms.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h cms.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
cms.o: ../include/openssl/buffer.h ../include/openssl/cms.h cms.o: ../include/openssl/buffer.h ../include/openssl/cms.h
cms.o: ../include/openssl/conf.h ../include/openssl/crypto.h cms.o: ../include/openssl/conf.h ../include/openssl/crypto.h
@@ -427,13 +432,13 @@ engine.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
engine.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h engine.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
engine.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h engine.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
engine.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h engine.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h
engine.o: ../include/openssl/sha.h ../include/openssl/ssl.h engine.o: ../include/openssl/sha.h ../include/openssl/srtp.h
engine.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h engine.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
engine.o: ../include/openssl/ssl3.h ../include/openssl/stack.h engine.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
engine.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h engine.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
engine.o: ../include/openssl/txt_db.h ../include/openssl/x509.h engine.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
engine.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h engine.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
engine.o: engine.c engine.o: ../include/openssl/x509v3.h apps.h engine.c
errstr.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h errstr.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
errstr.o: ../include/openssl/buffer.h ../include/openssl/comp.h errstr.o: ../include/openssl/buffer.h ../include/openssl/comp.h
errstr.o: ../include/openssl/conf.h ../include/openssl/crypto.h errstr.o: ../include/openssl/conf.h ../include/openssl/crypto.h
@@ -448,13 +453,13 @@ errstr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
errstr.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h errstr.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
errstr.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h errstr.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
errstr.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h errstr.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h
errstr.o: ../include/openssl/sha.h ../include/openssl/ssl.h errstr.o: ../include/openssl/sha.h ../include/openssl/srtp.h
errstr.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h errstr.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
errstr.o: ../include/openssl/ssl3.h ../include/openssl/stack.h errstr.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
errstr.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h errstr.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
errstr.o: ../include/openssl/txt_db.h ../include/openssl/x509.h errstr.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
errstr.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h errstr.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
errstr.o: errstr.c errstr.o: ../include/openssl/x509v3.h apps.h errstr.c
gendh.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h gendh.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
gendh.o: ../include/openssl/bn.h ../include/openssl/buffer.h gendh.o: ../include/openssl/bn.h ../include/openssl/buffer.h
gendh.o: ../include/openssl/conf.h ../include/openssl/crypto.h gendh.o: ../include/openssl/conf.h ../include/openssl/crypto.h
@@ -556,12 +561,12 @@ ocsp.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
ocsp.o: ../include/openssl/pem.h ../include/openssl/pem2.h ocsp.o: ../include/openssl/pem.h ../include/openssl/pem2.h
ocsp.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h ocsp.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
ocsp.o: ../include/openssl/safestack.h ../include/openssl/sha.h ocsp.o: ../include/openssl/safestack.h ../include/openssl/sha.h
ocsp.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h ocsp.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
ocsp.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h ocsp.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
ocsp.o: ../include/openssl/stack.h ../include/openssl/symhacks.h ocsp.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
ocsp.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h ocsp.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
ocsp.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ocsp.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
ocsp.o: ../include/openssl/x509v3.h apps.h ocsp.c ocsp.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h ocsp.c
openssl.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h openssl.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
openssl.o: ../include/openssl/buffer.h ../include/openssl/comp.h openssl.o: ../include/openssl/buffer.h ../include/openssl/comp.h
openssl.o: ../include/openssl/conf.h ../include/openssl/crypto.h openssl.o: ../include/openssl/conf.h ../include/openssl/crypto.h
@@ -575,8 +580,9 @@ openssl.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
openssl.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h openssl.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
openssl.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h openssl.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
openssl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h openssl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
openssl.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h openssl.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
openssl.o: ../include/openssl/sha.h ../include/openssl/ssl.h openssl.o: ../include/openssl/safestack.h ../include/openssl/sha.h
openssl.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
openssl.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.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/ssl3.h ../include/openssl/stack.h
openssl.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h openssl.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
@@ -791,12 +797,13 @@ s_cb.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s_cb.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s_cb.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
s_cb.o: ../include/openssl/pqueue.h ../include/openssl/rand.h s_cb.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
s_cb.o: ../include/openssl/safestack.h ../include/openssl/sha.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/srtp.h ../include/openssl/ssl.h
s_cb.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h s_cb.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
s_cb.o: ../include/openssl/stack.h ../include/openssl/symhacks.h s_cb.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
s_cb.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h s_cb.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
s_cb.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s_cb.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
s_cb.o: ../include/openssl/x509v3.h apps.h s_apps.h s_cb.c s_cb.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
s_cb.o: s_apps.h s_cb.c
s_client.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s_client.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
s_client.o: ../include/openssl/bn.h ../include/openssl/buffer.h s_client.o: ../include/openssl/bn.h ../include/openssl/buffer.h
s_client.o: ../include/openssl/comp.h ../include/openssl/conf.h s_client.o: ../include/openssl/comp.h ../include/openssl/conf.h
@@ -812,7 +819,8 @@ s_client.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
s_client.o: ../include/openssl/pem.h ../include/openssl/pem2.h s_client.o: ../include/openssl/pem.h ../include/openssl/pem2.h
s_client.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h s_client.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
s_client.o: ../include/openssl/rand.h ../include/openssl/safestack.h s_client.o: ../include/openssl/rand.h ../include/openssl/safestack.h
s_client.o: ../include/openssl/sha.h ../include/openssl/ssl.h s_client.o: ../include/openssl/sha.h ../include/openssl/srp.h
s_client.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
s_client.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h s_client.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
s_client.o: ../include/openssl/ssl3.h ../include/openssl/stack.h s_client.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
s_client.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h s_client.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
@@ -836,6 +844,7 @@ s_server.o: ../include/openssl/pem.h ../include/openssl/pem2.h
s_server.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h s_server.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
s_server.o: ../include/openssl/rand.h ../include/openssl/rsa.h s_server.o: ../include/openssl/rand.h ../include/openssl/rsa.h
s_server.o: ../include/openssl/safestack.h ../include/openssl/sha.h s_server.o: ../include/openssl/safestack.h ../include/openssl/sha.h
s_server.o: ../include/openssl/srp.h ../include/openssl/srtp.h
s_server.o: ../include/openssl/ssl.h ../include/openssl/ssl2.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/ssl23.h ../include/openssl/ssl3.h
s_server.o: ../include/openssl/stack.h ../include/openssl/symhacks.h s_server.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
@@ -857,13 +866,13 @@ s_socket.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s_socket.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s_socket.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s_socket.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s_socket.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
s_socket.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h s_socket.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h
s_socket.o: ../include/openssl/sha.h ../include/openssl/ssl.h s_socket.o: ../include/openssl/sha.h ../include/openssl/srtp.h
s_socket.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h s_socket.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s_socket.o: ../include/openssl/ssl3.h ../include/openssl/stack.h s_socket.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s_socket.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h s_socket.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
s_socket.o: ../include/openssl/txt_db.h ../include/openssl/x509.h s_socket.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
s_socket.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h s_socket.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
s_socket.o: s_apps.h s_socket.c s_socket.o: ../include/openssl/x509v3.h apps.h s_apps.h s_socket.c
s_time.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s_time.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
s_time.o: ../include/openssl/buffer.h ../include/openssl/comp.h s_time.o: ../include/openssl/buffer.h ../include/openssl/comp.h
s_time.o: ../include/openssl/conf.h ../include/openssl/crypto.h s_time.o: ../include/openssl/conf.h ../include/openssl/crypto.h
@@ -878,13 +887,13 @@ s_time.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
s_time.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s_time.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
s_time.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s_time.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
s_time.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h s_time.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h
s_time.o: ../include/openssl/sha.h ../include/openssl/ssl.h s_time.o: ../include/openssl/sha.h ../include/openssl/srtp.h
s_time.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h s_time.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
s_time.o: ../include/openssl/ssl3.h ../include/openssl/stack.h s_time.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
s_time.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h s_time.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
s_time.o: ../include/openssl/txt_db.h ../include/openssl/x509.h s_time.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
s_time.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h s_time.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
s_time.o: s_apps.h s_time.c s_time.o: ../include/openssl/x509v3.h apps.h s_apps.h s_time.c
sess_id.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h sess_id.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
sess_id.o: ../include/openssl/buffer.h ../include/openssl/comp.h sess_id.o: ../include/openssl/buffer.h ../include/openssl/comp.h
sess_id.o: ../include/openssl/conf.h ../include/openssl/crypto.h sess_id.o: ../include/openssl/conf.h ../include/openssl/crypto.h
@@ -899,13 +908,13 @@ sess_id.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
sess_id.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h sess_id.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
sess_id.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h sess_id.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
sess_id.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h sess_id.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h
sess_id.o: ../include/openssl/sha.h ../include/openssl/ssl.h sess_id.o: ../include/openssl/sha.h ../include/openssl/srtp.h
sess_id.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h sess_id.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
sess_id.o: ../include/openssl/ssl3.h ../include/openssl/stack.h sess_id.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
sess_id.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h sess_id.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
sess_id.o: ../include/openssl/txt_db.h ../include/openssl/x509.h sess_id.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
sess_id.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h sess_id.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
sess_id.o: sess_id.c sess_id.o: ../include/openssl/x509v3.h apps.h sess_id.c
smime.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h smime.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
smime.o: ../include/openssl/buffer.h ../include/openssl/conf.h smime.o: ../include/openssl/buffer.h ../include/openssl/conf.h
smime.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h smime.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
@@ -935,19 +944,20 @@ speed.o: ../include/openssl/err.h ../include/openssl/evp.h
speed.o: ../include/openssl/hmac.h ../include/openssl/idea.h speed.o: ../include/openssl/hmac.h ../include/openssl/idea.h
speed.o: ../include/openssl/lhash.h ../include/openssl/md4.h speed.o: ../include/openssl/lhash.h ../include/openssl/md4.h
speed.o: ../include/openssl/md5.h ../include/openssl/mdc2.h speed.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
speed.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h speed.o: ../include/openssl/sm3.h ../include/openssl/sms4.h
speed.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h speed.o: ../include/openssl/modes.h ../include/openssl/obj_mac.h
speed.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h speed.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
speed.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h speed.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
speed.o: ../include/openssl/rc2.h ../include/openssl/rc4.h speed.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
speed.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h speed.o: ../include/openssl/rand.h ../include/openssl/rc2.h
speed.o: ../include/openssl/safestack.h ../include/openssl/seed.h speed.o: ../include/openssl/rc4.h ../include/openssl/ripemd.h
speed.o: ../include/openssl/sha.h ../include/openssl/stack.h speed.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
speed.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h speed.o: ../include/openssl/seed.h ../include/openssl/sha.h
speed.o: ../include/openssl/ui.h ../include/openssl/ui_compat.h speed.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
speed.o: ../include/openssl/whrlpool.h ../include/openssl/x509.h speed.o: ../include/openssl/txt_db.h ../include/openssl/ui.h
speed.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h speed.o: ../include/openssl/ui_compat.h ../include/openssl/whrlpool.h
speed.o: speed.c testdsa.h testrsa.h speed.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
speed.o: ../include/openssl/x509v3.h apps.h speed.c testdsa.h testrsa.h
spkac.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h spkac.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
spkac.o: ../include/openssl/buffer.h ../include/openssl/conf.h spkac.o: ../include/openssl/buffer.h ../include/openssl/conf.h
spkac.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h spkac.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
@@ -964,6 +974,21 @@ spkac.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
spkac.o: ../include/openssl/txt_db.h ../include/openssl/x509.h spkac.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
spkac.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h spkac.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
spkac.o: spkac.c spkac.o: spkac.c
srp.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
srp.o: ../include/openssl/bn.h ../include/openssl/buffer.h
srp.o: ../include/openssl/conf.h ../include/openssl/crypto.h
srp.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
srp.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
srp.o: ../include/openssl/engine.h ../include/openssl/err.h
srp.o: ../include/openssl/evp.h ../include/openssl/lhash.h
srp.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
srp.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
srp.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
srp.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
srp.o: ../include/openssl/sha.h ../include/openssl/srp.h
srp.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
srp.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
srp.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h srp.c
ts.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h ts.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
ts.o: ../include/openssl/bn.h ../include/openssl/buffer.h ts.o: ../include/openssl/bn.h ../include/openssl/buffer.h
ts.o: ../include/openssl/conf.h ../include/openssl/crypto.h ts.o: ../include/openssl/conf.h ../include/openssl/crypto.h

View File

@@ -115,104 +115,106 @@
#include <openssl/bio.h> #include <openssl/bio.h>
#include <openssl/rand.h> #include <openssl/rand.h>
static int seeded = 0; static int seeded = 0;
static int egdsocket = 0; static int egdsocket = 0;
int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn) int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn)
{ {
int consider_randfile = (file == NULL); int consider_randfile = (file == NULL);
char buffer[200]; char buffer[200];
#ifdef OPENSSL_SYS_WINDOWS #ifdef OPENSSL_SYS_WINDOWS
BIO_printf(bio_e,"Loading 'screen' into random state -"); BIO_printf(bio_e, "Loading 'screen' into random state -");
BIO_flush(bio_e); BIO_flush(bio_e);
RAND_screen(); RAND_screen();
BIO_printf(bio_e," done\n"); BIO_printf(bio_e, " done\n");
#endif #endif
if (file == NULL) if (file == NULL)
file = RAND_file_name(buffer, sizeof buffer); file = RAND_file_name(buffer, sizeof buffer);
else if (RAND_egd(file) > 0) else if (RAND_egd(file) > 0) {
{ /*
/* we try if the given filename is an EGD socket. * we try if the given filename is an EGD socket. if it is, we don't
if it is, we don't write anything back to the file. */ * write anything back to the file.
egdsocket = 1; */
return 1; egdsocket = 1;
} return 1;
if (file == NULL || !RAND_load_file(file, -1)) }
{ if (file == NULL || !RAND_load_file(file, -1)) {
if (RAND_status() == 0) if (RAND_status() == 0) {
{ if (!dont_warn) {
if (!dont_warn) BIO_printf(bio_e, "unable to load 'random state'\n");
{ BIO_printf(bio_e,
BIO_printf(bio_e,"unable to load 'random state'\n"); "This means that the random number generator has not been seeded\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");
BIO_printf(bio_e,"with much random data.\n"); if (consider_randfile) { /* explanation does not apply when a
if (consider_randfile) /* explanation does not apply when a file is explicitly named */ * file is explicitly named */
{ BIO_printf(bio_e,
BIO_printf(bio_e,"Consider setting the RANDFILE environment variable to point at a file that\n"); "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"); BIO_printf(bio_e,
} "'random' data can be kept in (the file will be overwritten).\n");
} }
return 0; }
} return 0;
} }
seeded = 1; }
return 1; seeded = 1;
} return 1;
}
long app_RAND_load_files(char *name) long app_RAND_load_files(char *name)
{ {
char *p,*n; char *p, *n;
int last; int last;
long tot=0; long tot = 0;
int egd; int egd;
for (;;) for (;;) {
{ last = 0;
last=0; for (p = name; ((*p != '\0') && (*p != LIST_SEPARATOR_CHAR)); p++) ;
for (p=name; ((*p != '\0') && (*p != LIST_SEPARATOR_CHAR)); p++); if (*p == '\0')
if (*p == '\0') last=1; last = 1;
*p='\0'; *p = '\0';
n=name; n = name;
name=p+1; name = p + 1;
if (*n == '\0') break; if (*n == '\0')
break;
egd=RAND_egd(n); egd = RAND_egd(n);
if (egd > 0) if (egd > 0)
tot+=egd; tot += egd;
else else
tot+=RAND_load_file(n,-1); tot += RAND_load_file(n, -1);
if (last) break; if (last)
} break;
if (tot > 512) }
app_RAND_allow_write_file(); if (tot > 512)
return(tot); app_RAND_allow_write_file();
} return (tot);
}
int app_RAND_write_file(const char *file, BIO *bio_e) int app_RAND_write_file(const char *file, BIO *bio_e)
{ {
char buffer[200]; char buffer[200];
if (egdsocket || !seeded) if (egdsocket || !seeded)
/* If we did not manage to read the seed file, /*
* we should not write a low-entropy seed file back -- * If we did not manage to read the seed file, we should not write a
* it would suppress a crucial warning the next time * low-entropy seed file back -- it would suppress a crucial warning
* we want to use it. */ * the next time we want to use it.
return 0; */
return 0;
if (file == NULL) if (file == NULL)
file = RAND_file_name(buffer, sizeof buffer); file = RAND_file_name(buffer, sizeof buffer);
if (file == NULL || !RAND_write_file(file)) if (file == NULL || !RAND_write_file(file)) {
{ BIO_printf(bio_e, "unable to write 'random state'\n");
BIO_printf(bio_e,"unable to write 'random state'\n"); return 0;
return 0; }
} return 1;
return 1; }
}
void app_RAND_allow_write_file(void) void app_RAND_allow_write_file(void)
{ {
seeded = 1; seeded = 1;
} }

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -110,120 +110,119 @@
*/ */
#ifndef HEADER_APPS_H #ifndef HEADER_APPS_H
#define HEADER_APPS_H # define HEADER_APPS_H
#include "e_os.h" # include "e_os.h"
#include <openssl/bio.h> # include <openssl/bio.h>
#include <openssl/x509.h> # include <openssl/x509.h>
#include <openssl/lhash.h> # include <openssl/lhash.h>
#include <openssl/conf.h> # include <openssl/conf.h>
#include <openssl/txt_db.h> # include <openssl/txt_db.h>
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h> # include <openssl/engine.h>
#endif # endif
#ifndef OPENSSL_NO_OCSP # ifndef OPENSSL_NO_OCSP
#include <openssl/ocsp.h> # include <openssl/ocsp.h>
#endif # endif
#include <openssl/ossl_typ.h> # include <openssl/ossl_typ.h>
int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn); 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); int app_RAND_write_file(const char *file, BIO *bio_e);
/* When `file' is NULL, use defaults. /*
* `bio_e' is for error messages. */ * When `file' is NULL, use defaults. `bio_e' is for error messages.
*/
void app_RAND_allow_write_file(void); void app_RAND_allow_write_file(void);
long app_RAND_load_files(char *file); /* `file' is a list of files to read, long app_RAND_load_files(char *file); /* `file' is a list of files to read,
* separated by LIST_SEPARATOR_CHAR * separated by LIST_SEPARATOR_CHAR
* (see e_os.h). The string is * (see e_os.h). The string is
* destroyed! */ * destroyed! */
#ifndef MONOLITH # ifndef MONOLITH
#define MAIN(a,v) main(a,v) # define MAIN(a,v) main(a,v)
#ifndef NON_MAIN # ifndef NON_MAIN
CONF *config=NULL; CONF *config = NULL;
BIO *bio_err=NULL; BIO *bio_err = NULL;
#else # else
extern CONF *config; extern CONF *config;
extern BIO *bio_err; extern BIO *bio_err;
#endif # endif
#else # else
#define MAIN(a,v) PROG(a,v) # define MAIN(a,v) PROG(a,v)
extern CONF *config; extern CONF *config;
extern char *default_config_file; extern char *default_config_file;
extern BIO *bio_err; extern BIO *bio_err;
#endif # endif
#ifndef OPENSSL_SYS_NETWARE # ifndef OPENSSL_SYS_NETWARE
#include <signal.h> # include <signal.h>
#endif # endif
#ifdef SIGPIPE # ifdef SIGPIPE
#define do_pipe_sig() signal(SIGPIPE,SIG_IGN) # define do_pipe_sig() signal(SIGPIPE,SIG_IGN)
#else # else
#define do_pipe_sig() # define do_pipe_sig()
#endif # endif
#ifdef OPENSSL_NO_COMP # ifdef OPENSSL_NO_COMP
#define zlib_cleanup() # define zlib_cleanup()
#else # else
#define zlib_cleanup() COMP_zlib_cleanup() # define zlib_cleanup() COMP_zlib_cleanup()
#endif # endif
#if defined(MONOLITH) && !defined(OPENSSL_C) # if defined(MONOLITH) && !defined(OPENSSL_C)
# define apps_startup() \ # define apps_startup() \
do_pipe_sig() do_pipe_sig()
# define apps_shutdown() # define apps_shutdown()
#else # else
# ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
# define apps_startup() \ # define apps_startup() \
do { do_pipe_sig(); CRYPTO_malloc_init(); \ do { do_pipe_sig(); CRYPTO_malloc_init(); \
ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \ ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
ENGINE_load_builtin_engines(); setup_ui_method(); } while(0) ENGINE_load_builtin_engines(); setup_ui_method(); } while(0)
# define apps_shutdown() \ # define apps_shutdown() \
do { CONF_modules_unload(1); destroy_ui_method(); \ do { CONF_modules_unload(1); destroy_ui_method(); \
OBJ_cleanup(); EVP_cleanup(); ENGINE_cleanup(); \ OBJ_cleanup(); EVP_cleanup(); ENGINE_cleanup(); \
CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \ CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \
ERR_free_strings(); zlib_cleanup();} while(0) RAND_cleanup(); \
ERR_free_strings(); zlib_cleanup();} while(0)
# else # else
# define apps_startup() \ # define apps_startup() \
do { do_pipe_sig(); CRYPTO_malloc_init(); \ do { do_pipe_sig(); CRYPTO_malloc_init(); \
ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \ ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
setup_ui_method(); } while(0) setup_ui_method(); } while(0)
# define apps_shutdown() \ # define apps_shutdown() \
do { CONF_modules_unload(1); destroy_ui_method(); \ do { CONF_modules_unload(1); destroy_ui_method(); \
OBJ_cleanup(); EVP_cleanup(); \ OBJ_cleanup(); EVP_cleanup(); \
CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \ CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \
ERR_free_strings(); zlib_cleanup(); } while(0) RAND_cleanup(); \
ERR_free_strings(); zlib_cleanup(); } while(0)
# endif # endif
#endif # endif
#ifdef OPENSSL_SYSNAME_WIN32 # if defined(OPENSSL_SYSNAME_WIN32) || defined(OPENSSL_SYSNAME_WINCE)
# define openssl_fdset(a,b) FD_SET((unsigned int)a, b) # define openssl_fdset(a,b) FD_SET((unsigned int)a, b)
#else # else
# define openssl_fdset(a,b) FD_SET(a, b) # define openssl_fdset(a,b) FD_SET(a, b)
#endif # endif
typedef struct args_st {
char **data;
int count;
} ARGS;
typedef struct args_st # define PW_MIN_LENGTH 4
{ typedef struct pw_cb_data {
char **data; const void *password;
int count; const char *prompt_info;
} ARGS; } PW_CB_DATA;
#define PW_MIN_LENGTH 4 int password_callback(char *buf, int bufsiz, int verify, PW_CB_DATA *cb_data);
typedef struct pw_cb_data
{
const void *password;
const char *prompt_info;
} PW_CB_DATA;
int password_callback(char *buf, int bufsiz, int verify,
PW_CB_DATA *cb_data);
int setup_ui_method(void); int setup_ui_method(void);
void destroy_ui_method(void); void destroy_ui_method(void);
@@ -231,12 +230,13 @@ void destroy_ui_method(void);
int should_retry(int i); int should_retry(int i);
int args_from_file(char *file, int *argc, char **argv[]); int args_from_file(char *file, int *argc, char **argv[]);
int str2fmt(char *s); int str2fmt(char *s);
void program_name(char *in,char *out,int size); void program_name(char *in, char *out, int size);
int chopup_args(ARGS *arg,char *buf, int *argc, char **argv[]); int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[]);
#ifdef HEADER_X509_H # ifdef HEADER_X509_H
int dump_cert_text(BIO *out, X509 *x); int dump_cert_text(BIO *out, X509 *x);
void print_name(BIO *out, const char *title, X509_NAME *nm, unsigned long lflags); void print_name(BIO *out, const char *title, X509_NAME *nm,
#endif unsigned long lflags);
# endif
int set_cert_ex(unsigned long *flags, const char *arg); int set_cert_ex(unsigned long *flags, const char *arg);
int set_name_ex(unsigned long *flags, const char *arg); int set_name_ex(unsigned long *flags, const char *arg);
int set_ext_copy(int *copy_type, const char *arg); int set_ext_copy(int *copy_type, const char *arg);
@@ -244,117 +244,144 @@ int copy_extensions(X509 *x, X509_REQ *req, int copy_type);
int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2); int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2);
int add_oid_section(BIO *err, CONF *conf); int add_oid_section(BIO *err, CONF *conf);
X509 *load_cert(BIO *err, const char *file, int format, X509 *load_cert(BIO *err, const char *file, int format,
const char *pass, ENGINE *e, const char *cert_descrip); const char *pass, ENGINE *e, const char *cert_descrip);
X509_CRL *load_crl(const char *infile, int format);
int load_cert_crl_http(const char *url, BIO *err,
X509 **pcert, X509_CRL **pcrl);
EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin, EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin,
const char *pass, ENGINE *e, const char *key_descrip); const char *pass, ENGINE *e, const char *key_descrip);
EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin, EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
const char *pass, ENGINE *e, const char *key_descrip); const char *pass, ENGINE *e, const char *key_descrip);
STACK_OF(X509) *load_certs(BIO *err, const char *file, int format, STACK_OF(X509) *load_certs(BIO *err, const char *file, int format,
const char *pass, ENGINE *e, const char *cert_descrip); const char *pass, ENGINE *e,
const char *cert_descrip);
STACK_OF(X509_CRL) *load_crls(BIO *err, const char *file, int format, STACK_OF(X509_CRL) *load_crls(BIO *err, const char *file, int format,
const char *pass, ENGINE *e, const char *cert_descrip); const char *pass, ENGINE *e,
const char *cert_descrip);
X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath); X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath);
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
ENGINE *setup_engine(BIO *err, const char *engine, int debug); ENGINE *setup_engine(BIO *err, const char *engine, int debug);
#endif # endif
#ifndef OPENSSL_NO_OCSP # ifndef OPENSSL_NO_OCSP
OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req, OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req,
char *host, char *path, char *port, int use_ssl, const char *host, const char *path,
STACK_OF(CONF_VALUE) *headers, const char *port, int use_ssl,
int req_timeout); const STACK_OF(CONF_VALUE) *headers,
#endif int req_timeout);
# endif
int load_config(BIO *err, CONF *cnf); int load_config(BIO *err, CONF *cnf);
char *make_config_name(void); char *make_config_name(void);
/* Functions defined in ca.c and also used in ocsp.c */ /* Functions defined in ca.c and also used in ocsp.c */
int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
ASN1_GENERALIZEDTIME **pinvtm, const char *str); ASN1_GENERALIZEDTIME **pinvtm, const char *str);
#define DB_type 0 # define DB_type 0
#define DB_exp_date 1 # define DB_exp_date 1
#define DB_rev_date 2 # define DB_rev_date 2
#define DB_serial 3 /* index - unique */ # define DB_serial 3 /* index - unique */
#define DB_file 4 # define DB_file 4
#define DB_name 5 /* index - unique when active and not disabled */ # define DB_name 5 /* index - unique when active and not
#define DB_NUMBER 6 * disabled */
# define DB_NUMBER 6
#define DB_TYPE_REV 'R' # define DB_TYPE_REV 'R'
#define DB_TYPE_EXP 'E' # define DB_TYPE_EXP 'E'
#define DB_TYPE_VAL 'V' # define DB_TYPE_VAL 'V'
typedef struct db_attr_st typedef struct db_attr_st {
{ int unique_subject;
int unique_subject; } DB_ATTR;
} DB_ATTR; typedef struct ca_db_st {
typedef struct ca_db_st DB_ATTR attributes;
{ TXT_DB *db;
DB_ATTR attributes; } CA_DB;
TXT_DB *db;
} CA_DB;
BIGNUM *load_serial(char *serialfile, int create, ASN1_INTEGER **retai); BIGNUM *load_serial(char *serialfile, int create, ASN1_INTEGER **retai);
int save_serial(char *serialfile, char *suffix, BIGNUM *serial, ASN1_INTEGER **retai); int save_serial(char *serialfile, char *suffix, BIGNUM *serial,
ASN1_INTEGER **retai);
int rotate_serial(char *serialfile, char *new_suffix, char *old_suffix); int rotate_serial(char *serialfile, char *new_suffix, char *old_suffix);
int rand_serial(BIGNUM *b, ASN1_INTEGER *ai); int rand_serial(BIGNUM *b, ASN1_INTEGER *ai);
CA_DB *load_index(char *dbfile, DB_ATTR *dbattr); CA_DB *load_index(char *dbfile, DB_ATTR *dbattr);
int index_index(CA_DB *db); int index_index(CA_DB *db);
int save_index(const char *dbfile, const char *suffix, CA_DB *db); int save_index(const char *dbfile, const char *suffix, CA_DB *db);
int rotate_index(const char *dbfile, const char *new_suffix, const char *old_suffix); int rotate_index(const char *dbfile, const char *new_suffix,
const char *old_suffix);
void free_index(CA_DB *db); void free_index(CA_DB *db);
#define index_name_cmp_noconst(a, b) \ # define index_name_cmp_noconst(a, b) \
index_name_cmp((const OPENSSL_CSTRING *)CHECKED_PTR_OF(OPENSSL_STRING, a), \ index_name_cmp((const OPENSSL_CSTRING *)CHECKED_PTR_OF(OPENSSL_STRING, a), \
(const OPENSSL_CSTRING *)CHECKED_PTR_OF(OPENSSL_STRING, b)) (const OPENSSL_CSTRING *)CHECKED_PTR_OF(OPENSSL_STRING, b))
int index_name_cmp(const OPENSSL_CSTRING *a, const OPENSSL_CSTRING *b); int index_name_cmp(const OPENSSL_CSTRING *a, const OPENSSL_CSTRING *b);
int parse_yesno(const char *str, int def); int parse_yesno(const char *str, int def);
X509_NAME *parse_name(char *str, long chtype, int multirdn); X509_NAME *parse_name(char *str, long chtype, int multirdn);
int args_verify(char ***pargs, int *pargc, int args_verify(char ***pargs, int *pargc,
int *badarg, BIO *err, X509_VERIFY_PARAM **pm); int *badarg, BIO *err, X509_VERIFY_PARAM **pm);
void policies_print(BIO *out, X509_STORE_CTX *ctx); void policies_print(BIO *out, X509_STORE_CTX *ctx);
int bio_to_mem(unsigned char **out, int maxlen, BIO *in); int bio_to_mem(unsigned char **out, int maxlen, BIO *in);
int pkey_ctrl_string(EVP_PKEY_CTX *ctx, char *value); int pkey_ctrl_string(EVP_PKEY_CTX *ctx, char *value);
int init_gen_str(BIO *err, EVP_PKEY_CTX **pctx, int init_gen_str(BIO *err, EVP_PKEY_CTX **pctx,
const char *algname, ENGINE *e, int do_param); const char *algname, ENGINE *e, int do_param);
#ifndef OPENSSL_NO_PSK int do_X509_sign(BIO *err, X509 *x, EVP_PKEY *pkey, const EVP_MD *md,
STACK_OF(OPENSSL_STRING) *sigopts);
int do_X509_REQ_sign(BIO *err, X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md,
STACK_OF(OPENSSL_STRING) *sigopts);
int do_X509_CRL_sign(BIO *err, X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md,
STACK_OF(OPENSSL_STRING) *sigopts);
# ifndef OPENSSL_NO_PSK
extern char *psk_key; extern char *psk_key;
#endif # endif
#ifndef OPENSSL_NO_JPAKE # ifndef OPENSSL_NO_JPAKE
void jpake_client_auth(BIO *out, BIO *conn, const char *secret); void jpake_client_auth(BIO *out, BIO *conn, const char *secret);
void jpake_server_auth(BIO *out, BIO *conn, const char *secret); void jpake_server_auth(BIO *out, BIO *conn, const char *secret);
#endif # endif
#define FORMAT_UNDEF 0 # ifndef OPENSSL_NO_TLSEXT
#define FORMAT_ASN1 1 unsigned char *next_protos_parse(unsigned short *outlen, const char *in);
#define FORMAT_TEXT 2 # endif /* ndef OPENSSL_NO_TLSEXT */
#define FORMAT_PEM 3
#define FORMAT_NETSCAPE 4
#define FORMAT_PKCS12 5
#define FORMAT_SMIME 6
#define FORMAT_ENGINE 7
#define FORMAT_IISSGC 8 /* XXX this stupid macro helps us to avoid
* adding yet another param to load_*key() */
#define FORMAT_PEMRSA 9 /* PEM RSAPubicKey format */
#define FORMAT_ASN1RSA 10 /* DER RSAPubicKey format */
#define FORMAT_MSBLOB 11 /* MS Key blob format */
#define FORMAT_PVK 12 /* MS PVK file format */
#define EXT_COPY_NONE 0 void print_cert_checks(BIO *bio, X509 *x,
#define EXT_COPY_ADD 1 const char *checkhost,
#define EXT_COPY_ALL 2 const char *checkemail, const char *checkip);
#define NETSCAPE_CERT_HDR "certificate" void store_setup_crl_download(X509_STORE *st);
#define APP_PASS_LEN 1024 # define FORMAT_UNDEF 0
# define FORMAT_ASN1 1
# define FORMAT_TEXT 2
# define FORMAT_PEM 3
# define FORMAT_NETSCAPE 4
# define FORMAT_PKCS12 5
# define FORMAT_SMIME 6
# define FORMAT_ENGINE 7
# define FORMAT_IISSGC 8 /* XXX this stupid macro helps us to avoid
* adding yet another param to load_*key() */
# define FORMAT_PEMRSA 9 /* PEM RSAPubicKey format */
# define FORMAT_ASN1RSA 10 /* DER RSAPubicKey format */
# define FORMAT_MSBLOB 11 /* MS Key blob format */
# define FORMAT_PVK 12 /* MS PVK file format */
# define FORMAT_HTTP 13 /* Download using HTTP */
#define SERIAL_RAND_BITS 64 # define EXT_COPY_NONE 0
# define EXT_COPY_ADD 1
# define EXT_COPY_ALL 2
# define NETSCAPE_CERT_HDR "certificate"
# define APP_PASS_LEN 1024
# define SERIAL_RAND_BITS 64
int app_isdir(const char *); int app_isdir(const char *);
int raw_read_stdin(void *,int); int raw_read_stdin(void *, int);
int raw_write_stdout(const void *,int); int raw_write_stdout(const void *, int);
# define TM_START 0
# define TM_STOP 1
double app_tminterval(int stop, int usertime);
# define OPENSSL_NO_SSL_INTERN
#define TM_START 0
#define TM_STOP 1
double app_tminterval (int stop,int usertime);
#endif #endif

Binary file not shown.

View File

@@ -56,8 +56,9 @@
* [including the GNU Public Licence.] * [including the GNU Public Licence.]
*/ */
/* A nice addition from Dr Stephen Henson <steve@openssl.org> to /*
* add the -strparse option which parses nested binary structures * A nice addition from Dr Stephen Henson <steve@openssl.org> to add the
* -strparse option which parses nested binary structures
*/ */
#include <stdio.h> #include <stdio.h>
@@ -69,376 +70,361 @@
#include <openssl/x509.h> #include <openssl/x509.h>
#include <openssl/pem.h> #include <openssl/pem.h>
/* -inform arg - input format - default PEM (DER or PEM) /*-
* -in arg - input file - default stdin * -inform arg - input format - default PEM (DER or PEM)
* -i - indent the details by depth * -in arg - input file - default stdin
* -offset - where in the file to start * -i - indent the details by depth
* -length - how many bytes to use * -offset - where in the file to start
* -oid file - extra oid description file * -length - how many bytes to use
* -oid file - extra oid description file
*/ */
#undef PROG #undef PROG
#define PROG asn1parse_main #define PROG asn1parse_main
int MAIN(int, char **); int MAIN(int, char **);
static int do_generate(BIO *bio, char *genstr, char *genconf, BUF_MEM *buf); static int do_generate(BIO *bio, char *genstr, char *genconf, BUF_MEM *buf);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
int i,badops=0,offset=0,ret=1,j; int i, badops = 0, offset = 0, ret = 1, j;
unsigned int length=0; unsigned int length = 0;
long num,tmplen; long num, tmplen;
BIO *in=NULL,*out=NULL,*b64=NULL, *derout = NULL; BIO *in = NULL, *out = NULL, *b64 = NULL, *derout = NULL;
int informat,indent=0, noout = 0, dump = 0; int informat, indent = 0, noout = 0, dump = 0;
char *infile=NULL,*str=NULL,*prog,*oidfile=NULL, *derfile=NULL; char *infile = NULL, *str = NULL, *prog, *oidfile = NULL, *derfile = NULL;
char *genstr=NULL, *genconf=NULL; char *genstr = NULL, *genconf = NULL;
unsigned char *tmpbuf; unsigned char *tmpbuf;
const unsigned char *ctmpbuf; const unsigned char *ctmpbuf;
BUF_MEM *buf=NULL; BUF_MEM *buf = NULL;
STACK_OF(OPENSSL_STRING) *osk=NULL; STACK_OF(OPENSSL_STRING) *osk = NULL;
ASN1_TYPE *at=NULL; ASN1_TYPE *at = NULL;
informat=FORMAT_PEM; informat = FORMAT_PEM;
apps_startup(); apps_startup();
if (bio_err == NULL) if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL) if ((bio_err = BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
if (!load_config(bio_err, NULL)) if (!load_config(bio_err, NULL))
goto end; goto end;
prog=argv[0]; prog = argv[0];
argc--; argc--;
argv++; argv++;
if ((osk=sk_OPENSSL_STRING_new_null()) == NULL) if ((osk = sk_OPENSSL_STRING_new_null()) == NULL) {
{ BIO_printf(bio_err, "Memory allocation failure\n");
BIO_printf(bio_err,"Memory allocation failure\n"); goto end;
goto end; }
} while (argc >= 1) {
while (argc >= 1) if (strcmp(*argv, "-inform") == 0) {
{ if (--argc < 1)
if (strcmp(*argv,"-inform") == 0) goto bad;
{ informat = str2fmt(*(++argv));
if (--argc < 1) goto bad; } else if (strcmp(*argv, "-in") == 0) {
informat=str2fmt(*(++argv)); if (--argc < 1)
} goto bad;
else if (strcmp(*argv,"-in") == 0) infile = *(++argv);
{ } else if (strcmp(*argv, "-out") == 0) {
if (--argc < 1) goto bad; if (--argc < 1)
infile= *(++argv); goto bad;
} derfile = *(++argv);
else if (strcmp(*argv,"-out") == 0) } else if (strcmp(*argv, "-i") == 0) {
{ indent = 1;
if (--argc < 1) goto bad; } else if (strcmp(*argv, "-noout") == 0)
derfile= *(++argv); noout = 1;
} else if (strcmp(*argv, "-oid") == 0) {
else if (strcmp(*argv,"-i") == 0) if (--argc < 1)
{ goto bad;
indent=1; oidfile = *(++argv);
} } else if (strcmp(*argv, "-offset") == 0) {
else if (strcmp(*argv,"-noout") == 0) noout = 1; if (--argc < 1)
else if (strcmp(*argv,"-oid") == 0) goto bad;
{ offset = atoi(*(++argv));
if (--argc < 1) goto bad; } else if (strcmp(*argv, "-length") == 0) {
oidfile= *(++argv); if (--argc < 1)
} goto bad;
else if (strcmp(*argv,"-offset") == 0) length = atoi(*(++argv));
{ if (length == 0)
if (--argc < 1) goto bad; goto bad;
offset= atoi(*(++argv)); } else if (strcmp(*argv, "-dump") == 0) {
} dump = -1;
else if (strcmp(*argv,"-length") == 0) } else if (strcmp(*argv, "-dlimit") == 0) {
{ if (--argc < 1)
if (--argc < 1) goto bad; goto bad;
length= atoi(*(++argv)); dump = atoi(*(++argv));
if (length == 0) goto bad; if (dump <= 0)
} goto bad;
else if (strcmp(*argv,"-dump") == 0) } else if (strcmp(*argv, "-strparse") == 0) {
{ if (--argc < 1)
dump= -1; goto bad;
} sk_OPENSSL_STRING_push(osk, *(++argv));
else if (strcmp(*argv,"-dlimit") == 0) } else if (strcmp(*argv, "-genstr") == 0) {
{ if (--argc < 1)
if (--argc < 1) goto bad; goto bad;
dump= atoi(*(++argv)); genstr = *(++argv);
if (dump <= 0) goto bad; } else if (strcmp(*argv, "-genconf") == 0) {
} if (--argc < 1)
else if (strcmp(*argv,"-strparse") == 0) goto bad;
{ genconf = *(++argv);
if (--argc < 1) goto bad; } else {
sk_OPENSSL_STRING_push(osk,*(++argv)); BIO_printf(bio_err, "unknown option %s\n", *argv);
} badops = 1;
else if (strcmp(*argv,"-genstr") == 0) break;
{ }
if (--argc < 1) goto bad; argc--;
genstr= *(++argv); argv++;
} }
else if (strcmp(*argv,"-genconf") == 0)
{
if (--argc < 1) goto bad;
genconf= *(++argv);
}
else
{
BIO_printf(bio_err,"unknown option %s\n",*argv);
badops=1;
break;
}
argc--;
argv++;
}
if (badops) if (badops) {
{ bad:
bad: BIO_printf(bio_err, "%s [options] <infile\n", prog);
BIO_printf(bio_err,"%s [options] <infile\n",prog); BIO_printf(bio_err, "where options are\n");
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," -inform arg input format - one of DER PEM\n"); BIO_printf(bio_err, " -in arg input file\n");
BIO_printf(bio_err," -in arg input file\n"); BIO_printf(bio_err,
BIO_printf(bio_err," -out arg output file (output format is always DER\n"); " -out arg output file (output format is always DER\n");
BIO_printf(bio_err," -noout arg don't produce any output\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, " -offset arg offset into file\n");
BIO_printf(bio_err," -length arg length 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, " -i indent entries\n");
BIO_printf(bio_err," -dump dump unknown data in hex form\n"); BIO_printf(bio_err, " -dump dump unknown data in hex form\n");
BIO_printf(bio_err," -dlimit arg dump the first arg bytes of unknown data in hex form\n"); BIO_printf(bio_err,
BIO_printf(bio_err," -oid file file of extra oid definitions\n"); " -dlimit arg dump the first arg bytes of unknown data in hex form\n");
BIO_printf(bio_err," -strparse offset\n"); BIO_printf(bio_err, " -oid file file of extra oid definitions\n");
BIO_printf(bio_err," a series of these can be used to 'dig' into multiple\n"); BIO_printf(bio_err, " -strparse offset\n");
BIO_printf(bio_err," ASN1 blob wrappings\n"); BIO_printf(bio_err,
BIO_printf(bio_err," -genstr str string to generate ASN1 structure from\n"); " a series of these can be used to 'dig' into multiple\n");
BIO_printf(bio_err," -genconf file file to generate ASN1 structure from\n"); BIO_printf(bio_err, " ASN1 blob wrappings\n");
goto end; BIO_printf(bio_err,
} " -genstr str string to generate ASN1 structure from\n");
BIO_printf(bio_err,
" -genconf file file to generate ASN1 structure from\n");
goto end;
}
ERR_load_crypto_strings(); ERR_load_crypto_strings();
in=BIO_new(BIO_s_file()); in = BIO_new(BIO_s_file());
out=BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file());
if ((in == NULL) || (out == NULL)) if ((in == NULL) || (out == NULL)) {
{ ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
} BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT);
BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT);
#ifdef OPENSSL_SYS_VMS #ifdef OPENSSL_SYS_VMS
{ {
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); BIO *tmpbio = BIO_new(BIO_f_linebuffer());
out = BIO_push(tmpbio, out); out = BIO_push(tmpbio, out);
} }
#endif #endif
if (oidfile != NULL) if (oidfile != NULL) {
{ if (BIO_read_filename(in, oidfile) <= 0) {
if (BIO_read_filename(in,oidfile) <= 0) BIO_printf(bio_err, "problems opening %s\n", oidfile);
{ ERR_print_errors(bio_err);
BIO_printf(bio_err,"problems opening %s\n",oidfile); goto end;
ERR_print_errors(bio_err); }
goto end; OBJ_create_objects(in);
} }
OBJ_create_objects(in);
}
if (infile == NULL) if (infile == NULL)
BIO_set_fp(in,stdin,BIO_NOCLOSE); BIO_set_fp(in, stdin, BIO_NOCLOSE);
else else {
{ if (BIO_read_filename(in, infile) <= 0) {
if (BIO_read_filename(in,infile) <= 0) perror(infile);
{ goto end;
perror(infile); }
goto end; }
}
}
if (derfile) { if (derfile) {
if(!(derout = BIO_new_file(derfile, "wb"))) { if (!(derout = BIO_new_file(derfile, "wb"))) {
BIO_printf(bio_err,"problems opening %s\n",derfile); BIO_printf(bio_err, "problems opening %s\n", derfile);
ERR_print_errors(bio_err); ERR_print_errors(bio_err);
goto end; goto end;
} }
} }
if ((buf=BUF_MEM_new()) == NULL) goto end; if ((buf = BUF_MEM_new()) == NULL)
if (!BUF_MEM_grow(buf,BUFSIZ*8)) goto end; /* Pre-allocate :-) */ goto end;
if (!BUF_MEM_grow(buf, BUFSIZ * 8))
goto end; /* Pre-allocate :-) */
if (genstr || genconf) if (genstr || genconf) {
{ num = do_generate(bio_err, genstr, genconf, buf);
num = do_generate(bio_err, genstr, genconf, buf); if (num < 0) {
if (num < 0) ERR_print_errors(bio_err);
{ goto end;
ERR_print_errors(bio_err); }
goto end; }
}
}
else else {
{
if (informat == FORMAT_PEM) if (informat == FORMAT_PEM) {
{ BIO *tmp;
BIO *tmp;
if ((b64=BIO_new(BIO_f_base64())) == NULL) if ((b64 = BIO_new(BIO_f_base64())) == NULL)
goto end; goto end;
BIO_push(b64,in); BIO_push(b64, in);
tmp=in; tmp = in;
in=b64; in = b64;
b64=tmp; b64 = tmp;
} }
num=0; num = 0;
for (;;) for (;;) {
{ if (!BUF_MEM_grow(buf, (int)num + BUFSIZ))
if (!BUF_MEM_grow(buf,(int)num+BUFSIZ)) goto end; goto end;
i=BIO_read(in,&(buf->data[num]),BUFSIZ); i = BIO_read(in, &(buf->data[num]), BUFSIZ);
if (i <= 0) break; if (i <= 0)
num+=i; break;
} num += i;
} }
str=buf->data; }
str = buf->data;
/* If any structs to parse go through in sequence */ /* If any structs to parse go through in sequence */
if (sk_OPENSSL_STRING_num(osk)) if (sk_OPENSSL_STRING_num(osk)) {
{ tmpbuf = (unsigned char *)str;
tmpbuf=(unsigned char *)str; tmplen = num;
tmplen=num; for (i = 0; i < sk_OPENSSL_STRING_num(osk); i++) {
for (i=0; i<sk_OPENSSL_STRING_num(osk); i++) ASN1_TYPE *atmp;
{ int typ;
ASN1_TYPE *atmp; j = atoi(sk_OPENSSL_STRING_value(osk, i));
int typ; if (j == 0) {
j=atoi(sk_OPENSSL_STRING_value(osk,i)); BIO_printf(bio_err, "'%s' is an invalid number\n",
if (j == 0) sk_OPENSSL_STRING_value(osk, i));
{ continue;
BIO_printf(bio_err,"'%s' is an invalid number\n",sk_OPENSSL_STRING_value(osk,i)); }
continue; tmpbuf += j;
} tmplen -= j;
tmpbuf+=j; atmp = at;
tmplen-=j; ctmpbuf = tmpbuf;
atmp = at; at = d2i_ASN1_TYPE(NULL, &ctmpbuf, tmplen);
ctmpbuf = tmpbuf; ASN1_TYPE_free(atmp);
at = d2i_ASN1_TYPE(NULL,&ctmpbuf,tmplen); if (!at) {
ASN1_TYPE_free(atmp); BIO_printf(bio_err, "Error parsing structure\n");
if(!at) ERR_print_errors(bio_err);
{ goto end;
BIO_printf(bio_err,"Error parsing structure\n"); }
ERR_print_errors(bio_err); typ = ASN1_TYPE_get(at);
goto end; if ((typ == V_ASN1_OBJECT)
} || (typ == V_ASN1_NULL)) {
typ = ASN1_TYPE_get(at); BIO_printf(bio_err, "Can't parse %s type\n",
if ((typ == V_ASN1_OBJECT) typ == V_ASN1_NULL ? "NULL" : "OBJECT");
|| (typ == V_ASN1_NULL)) ERR_print_errors(bio_err);
{ goto end;
BIO_printf(bio_err, "Can't parse %s type\n", }
typ == V_ASN1_NULL ? "NULL" : "OBJECT"); /* hmm... this is a little evil but it works */
ERR_print_errors(bio_err); tmpbuf = at->value.asn1_string->data;
goto end; tmplen = at->value.asn1_string->length;
} }
/* hmm... this is a little evil but it works */ str = (char *)tmpbuf;
tmpbuf=at->value.asn1_string->data; num = tmplen;
tmplen=at->value.asn1_string->length; }
}
str=(char *)tmpbuf;
num=tmplen;
}
if (offset >= num) if (offset >= num) {
{ BIO_printf(bio_err, "Error: offset too large\n");
BIO_printf(bio_err, "Error: offset too large\n"); goto end;
goto end; }
}
num -= offset; num -= offset;
if ((length == 0) || ((long)length > num)) length=(unsigned int)num; if ((length == 0) || ((long)length > num))
if(derout) { length = (unsigned int)num;
if(BIO_write(derout, str + offset, length) != (int)length) { if (derout) {
BIO_printf(bio_err, "Error writing output\n"); if (BIO_write(derout, str + offset, length) != (int)length) {
ERR_print_errors(bio_err); BIO_printf(bio_err, "Error writing output\n");
goto end; ERR_print_errors(bio_err);
} goto end;
} }
if (!noout && }
!ASN1_parse_dump(out,(unsigned char *)&(str[offset]),length, if (!noout &&
indent,dump)) !ASN1_parse_dump(out, (unsigned char *)&(str[offset]), length,
{ indent, dump)) {
ERR_print_errors(bio_err); ERR_print_errors(bio_err);
goto end; goto end;
} }
ret=0; ret = 0;
end: end:
BIO_free(derout); BIO_free(derout);
if (in != NULL) BIO_free(in); if (in != NULL)
if (out != NULL) BIO_free_all(out); BIO_free(in);
if (b64 != NULL) BIO_free(b64); if (out != NULL)
if (ret != 0) BIO_free_all(out);
ERR_print_errors(bio_err); if (b64 != NULL)
if (buf != NULL) BUF_MEM_free(buf); BIO_free(b64);
if (at != NULL) ASN1_TYPE_free(at); if (ret != 0)
if (osk != NULL) sk_OPENSSL_STRING_free(osk); ERR_print_errors(bio_err);
OBJ_cleanup(); if (buf != NULL)
apps_shutdown(); BUF_MEM_free(buf);
OPENSSL_EXIT(ret); if (at != NULL)
} ASN1_TYPE_free(at);
if (osk != NULL)
sk_OPENSSL_STRING_free(osk);
OBJ_cleanup();
apps_shutdown();
OPENSSL_EXIT(ret);
}
static int do_generate(BIO *bio, char *genstr, char *genconf, BUF_MEM *buf) static int do_generate(BIO *bio, char *genstr, char *genconf, BUF_MEM *buf)
{ {
CONF *cnf = NULL; CONF *cnf = NULL;
int len; int len;
long errline; long errline = 0;
unsigned char *p; unsigned char *p;
ASN1_TYPE *atyp = NULL; ASN1_TYPE *atyp = NULL;
if (genconf) if (genconf) {
{ cnf = NCONF_new(NULL);
cnf = NCONF_new(NULL); if (!NCONF_load(cnf, genconf, &errline))
if (!NCONF_load(cnf, genconf, &errline)) goto conferr;
goto conferr; if (!genstr)
if (!genstr) genstr = NCONF_get_string(cnf, "default", "asn1");
genstr = NCONF_get_string(cnf, "default", "asn1"); if (!genstr) {
if (!genstr) BIO_printf(bio, "Can't find 'asn1' in '%s'\n", genconf);
{ goto err;
BIO_printf(bio, "Can't find 'asn1' in '%s'\n", genconf); }
goto err; }
}
}
atyp = ASN1_generate_nconf(genstr, cnf); atyp = ASN1_generate_nconf(genstr, cnf);
NCONF_free(cnf); NCONF_free(cnf);
cnf = NULL;
if (!atyp) if (!atyp)
return -1; return -1;
len = i2d_ASN1_TYPE(atyp, NULL); len = i2d_ASN1_TYPE(atyp, NULL);
if (len <= 0) if (len <= 0)
goto err; goto err;
if (!BUF_MEM_grow(buf,len)) if (!BUF_MEM_grow(buf, len))
goto err; goto err;
p=(unsigned char *)buf->data; p = (unsigned char *)buf->data;
i2d_ASN1_TYPE(atyp, &p); i2d_ASN1_TYPE(atyp, &p);
ASN1_TYPE_free(atyp); ASN1_TYPE_free(atyp);
return len; return len;
conferr: conferr:
if (errline > 0) if (errline > 0)
BIO_printf(bio, "Error on line %ld of config file '%s'\n", BIO_printf(bio, "Error on line %ld of config file '%s'\n",
errline, genconf); errline, genconf);
else else
BIO_printf(bio, "Error loading config file '%s'\n", genconf); BIO_printf(bio, "Error loading config file '%s'\n", genconf);
err: err:
NCONF_free(cnf); NCONF_free(cnf);
ASN1_TYPE_free(atyp); ASN1_TYPE_free(atyp);
return -1; return -1;
} }

Binary file not shown.

5001
apps/ca.c

File diff suppressed because it is too large Load Diff

BIN
apps/ca.o

Binary file not shown.

View File

@@ -60,172 +60,180 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifdef OPENSSL_NO_STDIO #ifdef OPENSSL_NO_STDIO
#define APPS_WIN16 # define APPS_WIN16
#endif #endif
#include "apps.h" #include "apps.h"
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/ssl.h> #include <openssl/ssl.h>
#undef PROG #undef PROG
#define PROG ciphers_main #define PROG ciphers_main
static const char *ciphers_usage[]={ static const char *ciphers_usage[] = {
"usage: ciphers args\n", "usage: ciphers args\n",
" -v - verbose mode, a textual listing of the SSL/TLS ciphers in OpenSSL\n", " -v - verbose mode, a textual listing of the SSL/TLS ciphers in OpenSSL\n",
" -V - even more verbose\n", " -V - even more verbose\n",
" -ssl2 - SSL2 mode\n", " -ssl2 - SSL2 mode\n",
" -ssl3 - SSL3 mode\n", " -ssl3 - SSL3 mode\n",
" -tls1 - TLS1 mode\n", " -tls1 - TLS1 mode\n",
NULL NULL
}; };
int MAIN(int, char **); int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
int ret=1,i; int ret = 1, i;
int verbose=0,Verbose=0; int verbose = 0, Verbose = 0;
const char **pp; #ifndef OPENSSL_NO_SSL_TRACE
const char *p; int stdname = 0;
int badops=0;
SSL_CTX *ctx=NULL;
SSL *ssl=NULL;
char *ciphers=NULL;
const SSL_METHOD *meth=NULL;
STACK_OF(SSL_CIPHER) *sk;
char buf[512];
BIO *STDout=NULL;
#if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3)
meth=SSLv23_server_method();
#elif !defined(OPENSSL_NO_SSL3)
meth=SSLv3_server_method();
#elif !defined(OPENSSL_NO_SSL2)
meth=SSLv2_server_method();
#endif #endif
const char **pp;
const char *p;
int badops = 0;
SSL_CTX *ctx = NULL;
SSL *ssl = NULL;
char *ciphers = NULL;
const SSL_METHOD *meth = NULL;
STACK_OF(SSL_CIPHER) *sk;
char buf[512];
BIO *STDout = NULL;
apps_startup(); meth = SSLv23_server_method();
if (bio_err == NULL) apps_startup();
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
STDout=BIO_new_fp(stdout,BIO_NOCLOSE); if (bio_err == NULL)
bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
STDout = BIO_new_fp(stdout, BIO_NOCLOSE);
#ifdef OPENSSL_SYS_VMS #ifdef OPENSSL_SYS_VMS
{ {
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); BIO *tmpbio = BIO_new(BIO_f_linebuffer());
STDout = BIO_push(tmpbio, STDout); STDout = BIO_push(tmpbio, STDout);
} }
#endif #endif
if (!load_config(bio_err, NULL)) if (!load_config(bio_err, NULL))
goto end; goto end;
argc--; argc--;
argv++; argv++;
while (argc >= 1) while (argc >= 1) {
{ if (strcmp(*argv, "-v") == 0)
if (strcmp(*argv,"-v") == 0) verbose = 1;
verbose=1; else if (strcmp(*argv, "-V") == 0)
else if (strcmp(*argv,"-V") == 0) verbose = Verbose = 1;
verbose=Verbose=1; #ifndef OPENSSL_NO_SSL_TRACE
else if (strcmp(*argv, "-stdname") == 0)
stdname = verbose = 1;
#endif
#ifndef OPENSSL_NO_SSL2 #ifndef OPENSSL_NO_SSL2
else if (strcmp(*argv,"-ssl2") == 0) else if (strcmp(*argv, "-ssl2") == 0)
meth=SSLv2_client_method(); meth = SSLv2_client_method();
#endif #endif
#ifndef OPENSSL_NO_SSL3 #ifndef OPENSSL_NO_SSL3
else if (strcmp(*argv,"-ssl3") == 0) else if (strcmp(*argv, "-ssl3") == 0)
meth=SSLv3_client_method(); meth = SSLv3_client_method();
#endif #endif
#ifndef OPENSSL_NO_TLS1 #ifndef OPENSSL_NO_TLS1
else if (strcmp(*argv,"-tls1") == 0) else if (strcmp(*argv, "-tls1") == 0)
meth=TLSv1_client_method(); meth = TLSv1_client_method();
#endif #endif
else if ((strncmp(*argv,"-h",2) == 0) || else if ((strncmp(*argv, "-h", 2) == 0) || (strcmp(*argv, "-?") == 0)) {
(strcmp(*argv,"-?") == 0)) badops = 1;
{ break;
badops=1; } else {
break; ciphers = *argv;
} }
else argc--;
{ argv++;
ciphers= *argv; }
}
argc--;
argv++;
}
if (badops) if (badops) {
{ for (pp = ciphers_usage; (*pp != NULL); pp++)
for (pp=ciphers_usage; (*pp != NULL); pp++) BIO_printf(bio_err, "%s", *pp);
BIO_printf(bio_err,"%s",*pp); goto end;
goto end; }
}
OpenSSL_add_ssl_algorithms(); OpenSSL_add_ssl_algorithms();
ctx=SSL_CTX_new(meth); ctx = SSL_CTX_new(meth);
if (ctx == NULL) goto err; if (ctx == NULL)
if (ciphers != NULL) { goto err;
if(!SSL_CTX_set_cipher_list(ctx,ciphers)) { if (ciphers != NULL) {
BIO_printf(bio_err, "Error in cipher list\n"); if (!SSL_CTX_set_cipher_list(ctx, ciphers)) {
goto err; BIO_printf(bio_err, "Error in cipher list\n");
} goto err;
} }
ssl=SSL_new(ctx); }
if (ssl == NULL) goto err; ssl = SSL_new(ctx);
if (ssl == NULL)
goto err;
if (!verbose) {
for (i = 0;; i++) {
p = SSL_get_cipher_list(ssl, i);
if (p == NULL)
break;
if (i != 0)
BIO_printf(STDout, ":");
BIO_printf(STDout, "%s", p);
}
BIO_printf(STDout, "\n");
} else { /* verbose */
if (!verbose) sk = SSL_get_ciphers(ssl);
{
for (i=0; ; i++)
{
p=SSL_get_cipher_list(ssl,i);
if (p == NULL) break;
if (i != 0) BIO_printf(STDout,":");
BIO_printf(STDout,"%s",p);
}
BIO_printf(STDout,"\n");
}
else /* verbose */
{
sk=SSL_get_ciphers(ssl);
for (i=0; i<sk_SSL_CIPHER_num(sk); i++) for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) {
{ SSL_CIPHER *c;
SSL_CIPHER *c;
c = sk_SSL_CIPHER_value(sk,i); c = sk_SSL_CIPHER_value(sk, i);
if (Verbose) if (Verbose) {
{ unsigned long id = SSL_CIPHER_get_id(c);
unsigned long id = c->id; int id0 = (int)(id >> 24);
int id0 = (int)(id >> 24); int id1 = (int)((id >> 16) & 0xffL);
int id1 = (int)((id >> 16) & 0xffL); int id2 = (int)((id >> 8) & 0xffL);
int id2 = (int)((id >> 8) & 0xffL); int id3 = (int)(id & 0xffL);
int id3 = (int)(id & 0xffL);
if ((id & 0xff000000L) == 0x02000000L) if ((id & 0xff000000L) == 0x02000000L) {
BIO_printf(STDout, " 0x%02X,0x%02X,0x%02X - ", id1, id2, id3); /* SSL2 cipher */ /* SSL2 cipher */
else if ((id & 0xff000000L) == 0x03000000L) BIO_printf(STDout, " 0x%02X,0x%02X,0x%02X - ", id1,
BIO_printf(STDout, " 0x%02X,0x%02X - ", id2, id3); /* SSL3 cipher */ id2, id3);
else } else if ((id & 0xff000000L) == 0x03000000L) {
BIO_printf(STDout, "0x%02X,0x%02X,0x%02X,0x%02X - ", id0, id1, id2, id3); /* whatever */ /* SSL3 cipher */
} BIO_printf(STDout, " 0x%02X,0x%02X - ", id2,
id3);
BIO_puts(STDout,SSL_CIPHER_description(c,buf,sizeof buf)); } else {
} /* whatever */
} BIO_printf(STDout, "0x%02X,0x%02X,0x%02X,0x%02X - ", id0,
id1, id2, id3);
ret=0; }
if (0) }
{ #ifndef OPENSSL_NO_SSL_TRACE
err: if (stdname) {
SSL_load_error_strings(); const char *nm = SSL_CIPHER_standard_name(c);
ERR_print_errors(bio_err); if (nm == NULL)
} nm = "UNKNOWN";
end: BIO_printf(STDout, "%s - ", nm);
if (ctx != NULL) SSL_CTX_free(ctx); }
if (ssl != NULL) SSL_free(ssl); #endif
if (STDout != NULL) BIO_free_all(STDout); BIO_puts(STDout, SSL_CIPHER_description(c, buf, sizeof buf));
apps_shutdown(); }
OPENSSL_EXIT(ret); }
}
ret = 0;
if (0) {
err:
SSL_load_error_strings();
ERR_print_errors(bio_err);
}
end:
if (ctx != NULL)
SSL_CTX_free(ctx);
if (ssl != NULL)
SSL_free(ssl);
if (STDout != NULL)
BIO_free_all(STDout);
apps_shutdown();
OPENSSL_EXIT(ret);
}

Binary file not shown.

View File

@@ -1,24 +1,52 @@
issuer= /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit) subject= C = UK, O = OpenSSL Group, OU = FOR TESTING PURPOSES ONLY, CN = Test Client Cert
subject=/C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Client test cert (512 bit) issuer= C = UK, O = OpenSSL Group, OU = FOR TESTING PURPOSES ONLY, CN = OpenSSL Test Intermediate CA
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIB6TCCAVICAQIwDQYJKoZIhvcNAQEEBQAwWzELMAkGA1UEBhMCQVUxEzARBgNV MIID5zCCAs+gAwIBAgIJALnu1NlVpZ6yMA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRswGQYD BAYTAlVLMRYwFAYDVQQKDA1PcGVuU1NMIEdyb3VwMSIwIAYDVQQLDBlGT1IgVEVT
VQQDExJUZXN0IENBICgxMDI0IGJpdCkwHhcNOTcwNjA5MTM1NzU2WhcNOTgwNjA5 VElORyBQVVJQT1NFUyBPTkxZMSUwIwYDVQQDDBxPcGVuU1NMIFRlc3QgSW50ZXJt
MTM1NzU2WjBjMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDEaMBgG ZWRpYXRlIENBMB4XDTExMTIwODE0MDE0OFoXDTIxMTAxNjE0MDE0OFowZDELMAkG
A1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxIzAhBgNVBAMTGkNsaWVudCB0ZXN0IGNl A1UEBhMCVUsxFjAUBgNVBAoMDU9wZW5TU0wgR3JvdXAxIjAgBgNVBAsMGUZPUiBU
cnQgKDUxMiBiaXQpMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALtv55QyzG6i2Plw RVNUSU5HIFBVUlBPU0VTIE9OTFkxGTAXBgNVBAMMEFRlc3QgQ2xpZW50IENlcnQw
Z1pah7++Gv8L5j6Hnyr/uTZE1NLG0ABDDexmq/R4KedLjFEIYjocDui+IXs62NNt ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC0ranbHRLcLVqN+0BzcZpY
XrT8odkCAwEAATANBgkqhkiG9w0BAQQFAAOBgQBwtMmI7oGUG8nKmftQssATViH5 +yOLqxzDWT1LD9eW1stC4NzXX9/DCtSIVyN7YIHdGLrIPr64IDdXXaMRzgZ2rOKs
NRRtoEw07DxJp/LfatHdrhqQB73eGdL5WILZJXk46Xz2e9WMSUjVCSYhdKxtflU3 lmHCAiFpO/ja99gGCJRxH0xwQatqAULfJVHeUhs7OEGOZc2nWifjqKvGfNTilP7D
UR2Ajv1Oo0sTNdfz0wDqJNirLNtzyhhsaq8qMTrLwXrCP31VxBiigFSQSUFnZyTE nwi69ipQFq9oS19FmhwVHk2wg7KZGHI1qDyG04UrfCZMRitvS9+UVhPpIPjuiBi2
9TKwhS4GlwbtCfxSKQ== x3/FZIpL5gXJvvFK6xHY63oq2asyzBATntBgnP4qJFWWcvRx24wF1PnZabxuVoL2
bPnQ/KvONDrw3IdqkKhYNTul7jEcu3OlcZIMw+7DiaKJLAzKb/bBF5gm/pwW6As9
AgMBAAGjgY8wgYwwDAYDVR0TAQH/BAIwADAOBgNVHQ8BAf8EBAMCBeAwLAYJYIZI
AYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQW
BBSZHKyLoTh7Mb409Zn/mK1ceSDAjDAfBgNVHSMEGDAWgBQ2w2yI55X+sL3szj49
hqshgYfa2jANBgkqhkiG9w0BAQUFAAOCAQEAD0mL7PtPYgCEuDyOQSbLpeND5hVS
curxQdGnrJ6Acrhodb7E9ccATokeb0PLx6HBLQUicxhTZIQ9FbO43YkQcOU6C3BB
IlwskqmtN6+VmrQzNolHCDzvxNZs9lYL2VbGPGqVRyjZeHpoAlf9cQr8PgDb4d4b
vUx2KAhHQvV2nkmYvKyXcgnRuHggumF87mkxidriGAEFwH4qfOqetUg64WyxP7P2
QLipm04SyQa7ONtIApfVXgHcE42Py4/f4arzCzMjKe3VyhGkS7nsT55X/fWgTaRm
CQPkO+H94P958WTvQDt77bQ+D3IvYaVvfil8n6HJMOJfFT0LJuSUbpSXJg==
-----END CERTIFICATE----- -----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY----- -----BEGIN RSA PRIVATE KEY-----
MIIBOwIBAAJBALtv55QyzG6i2PlwZ1pah7++Gv8L5j6Hnyr/uTZE1NLG0ABDDexm MIIEpQIBAAKCAQEAtK2p2x0S3C1ajftAc3GaWPsji6scw1k9Sw/XltbLQuDc11/f
q/R4KedLjFEIYjocDui+IXs62NNtXrT8odkCAwEAAQJAbwXq0vJ/+uyEvsNgxLko wwrUiFcje2CB3Ri6yD6+uCA3V12jEc4GdqzirJZhwgIhaTv42vfYBgiUcR9McEGr
/V86mGXQ/KrSkeKlL0r4ENxjcyeMAGoKu6J9yMY7+X9+Zm4nxShNfTsf/+Freoe1 agFC3yVR3lIbOzhBjmXNp1on46irxnzU4pT+w58IuvYqUBavaEtfRZocFR5NsIOy
HQIhAPOSm5Q1YI+KIsII2GeVJx1U69+wnd71OasIPakS1L1XAiEAxQAW+J3/JWE0 mRhyNag8htOFK3wmTEYrb0vflFYT6SD47ogYtsd/xWSKS+YFyb7xSusR2Ot6Ktmr
ftEYakbhUOKL8tD1OaFZS71/5GdG7E8CIQCefUMmySSvwd6kC0VlATSWbW+d+jp/ MswQE57QYJz+KiRVlnL0cduMBdT52Wm8blaC9mz50PyrzjQ68NyHapCoWDU7pe4x
nWmM1KvqnAo5uQIhALqEADu5U1Wvt8UN8UDGBRPQulHWNycuNV45d3nnskWPAiAw HLtzpXGSDMPuw4miiSwMym/2wReYJv6cFugLPQIDAQABAoIBAAZOyc9MhIwLSU4L
ueTyr6WsZ5+SD8g/Hy3xuvF3nPmJRH+rwvVihlcFOg== p4RgQvM4UVVe8/Id+3XTZ8NsXExJbWxXfIhiqGjaIfL8u4vsgRjcl+v1s/jo2/iT
KMab4o4D8gXD7UavQVDjtjb/ta79WL3SjRl2Uc9YjjMkyq6WmDNQeo2NKDdafCTB
1uzSJtLNipB8Z53ELPuHJhxX9QMHrMnuha49riQgXZ7buP9iQrHJFhImBjSzbxJx
L+TI6rkyLSf9Wi0Pd3L27Ob3QWNfNRYNSeTE+08eSRChkur5W0RuXAcuAICdQlCl
LBvWO/LmmvbzCqiDcgy/TliSb6CGGwgiNG7LJZmlkYNj8laGwalNlYZs3UrVv6NO
Br2loAECgYEA2kvCvPGj0Dg/6g7WhXDvAkEbcaL1tSeCxBbNH+6HS2UWMWvyTtCn
/bbD519QIdkvayy1QjEf32GV/UjUVmlULMLBcDy0DGjtL3+XpIhLKWDNxN1v1/ai
1oz23ZJCOgnk6K4qtFtlRS1XtynjA+rBetvYvLP9SKeFrnpzCgaA2r0CgYEA0+KX
1ACXDTNH5ySX3kMjSS9xdINf+OOw4CvPHFwbtc9aqk2HePlEsBTz5I/W3rKwXva3
NqZ/bRqVVeZB/hHKFywgdUQk2Uc5z/S7Lw70/w1HubNTXGU06Ngb6zOFAo/o/TwZ
zTP1BMIKSOB6PAZPS3l+aLO4FRIRotfFhgRHOoECgYEAmiZbqt8cJaJDB/5YYDzC
mp3tSk6gIb936Q6M5VqkMYp9pIKsxhk0N8aDCnTU+kIK6SzWBpr3/d9Ecmqmfyq7
5SvWO3KyVf0WWK9KH0abhOm2BKm2HBQvI0DB5u8sUx2/hsvOnjPYDISbZ11t0MtK
u35Zy89yMYcSsIYJjG/ROCUCgYEAgI2P9G5PNxEP5OtMwOsW84Y3Xat/hPAQFlI+
HES+AzbFGWJkeT8zL2nm95tVkFP1sggZ7Kxjz3w7cpx7GX0NkbWSE9O+T51pNASV
tN1sQ3p5M+/a+cnlqgfEGJVvc7iAcXQPa3LEi5h2yPR49QYXAgG6cifn3dDSpmwn
SUI7PQECgYEApGCIIpSRPLAEHTGmP87RBL1smurhwmy2s/pghkvUkWehtxg0sGHh
kuaqDWcskogv+QC0sVdytiLSz8G0DwcEcsHK1Fkyb8A+ayiw6jWJDo2m9+IF4Fww
1Te6jFPYDESnbhq7+TLGgHGhtwcu5cnb4vSuYXGXKupZGzoLOBbv1Zw=
-----END RSA PRIVATE KEY----- -----END RSA PRIVATE KEY-----

2431
apps/cms.c

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -67,380 +67,376 @@
#include <openssl/pem.h> #include <openssl/pem.h>
#undef PROG #undef PROG
#define PROG crl_main #define PROG crl_main
#undef POSTFIX #undef POSTFIX
#define POSTFIX ".rvk" #define POSTFIX ".rvk"
static const char *crl_usage[]={ static const char *crl_usage[] = {
"usage: crl args\n", "usage: crl args\n",
"\n", "\n",
" -inform arg - input format - default PEM (DER or PEM)\n", " -inform arg - input format - default PEM (DER or PEM)\n",
" -outform arg - output format - default PEM\n", " -outform arg - output format - default PEM\n",
" -text - print out a text format version\n", " -text - print out a text format version\n",
" -in arg - input file - default stdin\n", " -in arg - input file - default stdin\n",
" -out arg - output file - default stdout\n", " -out arg - output file - default stdout\n",
" -hash - print hash value\n", " -hash - print hash value\n",
" -fingerprint - print the crl fingerprint\n", #ifndef OPENSSL_NO_MD5
" -issuer - print issuer DN\n", " -hash_old - print old-style (MD5) hash value\n",
" -lastupdate - lastUpdate field\n", #endif
" -nextupdate - nextUpdate field\n", " -fingerprint - print the crl fingerprint\n",
" -crlnumber - print CRL number\n", " -issuer - print issuer DN\n",
" -noout - no CRL output\n", " -lastupdate - lastUpdate field\n",
" -CAfile name - verify CRL using certificates in file \"name\"\n", " -nextupdate - nextUpdate field\n",
" -CApath dir - verify CRL using certificates in \"dir\"\n", " -crlnumber - print CRL number\n",
" -nameopt arg - various certificate name options\n", " -noout - no CRL output\n",
NULL " -CAfile name - verify CRL using certificates in file \"name\"\n",
" -CApath dir - verify CRL using certificates in \"dir\"\n",
" -nameopt arg - various certificate name options\n",
NULL
}; };
static X509_CRL *load_crl(char *file, int format); static BIO *bio_out = NULL;
static BIO *bio_out=NULL;
int MAIN(int, char **); int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
unsigned long nmflag = 0; unsigned long nmflag = 0;
X509_CRL *x=NULL; X509_CRL *x = NULL;
char *CAfile = NULL, *CApath = NULL; char *CAfile = NULL, *CApath = NULL;
int ret=1,i,num,badops=0; int ret = 1, i, num, badops = 0, badsig = 0;
BIO *out=NULL; BIO *out = NULL;
int informat,outformat; int informat, outformat, keyformat;
char *infile=NULL,*outfile=NULL; char *infile = NULL, *outfile = NULL, *crldiff = NULL, *keyfile = NULL;
int hash=0,issuer=0,lastupdate=0,nextupdate=0,noout=0,text=0; int hash = 0, issuer = 0, lastupdate = 0, nextupdate = 0, noout =
int fingerprint = 0, crlnumber = 0; 0, text = 0;
const char **pp; #ifndef OPENSSL_NO_MD5
X509_STORE *store = NULL; int hash_old = 0;
X509_STORE_CTX ctx;
X509_LOOKUP *lookup = NULL;
X509_OBJECT xobj;
EVP_PKEY *pkey;
int do_ver = 0;
const EVP_MD *md_alg,*digest=EVP_sha1();
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);
if (!load_config(bio_err, NULL))
goto end;
if (bio_out == NULL)
if ((bio_out=BIO_new(BIO_s_file())) != NULL)
{
BIO_set_fp(bio_out,stdout,BIO_NOCLOSE);
#ifdef OPENSSL_SYS_VMS
{
BIO *tmpbio = BIO_new(BIO_f_linebuffer());
bio_out = BIO_push(tmpbio, bio_out);
}
#endif #endif
} int fingerprint = 0, crlnumber = 0;
const char **pp;
X509_STORE *store = NULL;
X509_STORE_CTX ctx;
X509_LOOKUP *lookup = NULL;
X509_OBJECT xobj;
EVP_PKEY *pkey;
int do_ver = 0;
const EVP_MD *md_alg, *digest = EVP_sha1();
informat=FORMAT_PEM; apps_startup();
outformat=FORMAT_PEM;
argc--; if (bio_err == NULL)
argv++; if ((bio_err = BIO_new(BIO_s_file())) != NULL)
num=0; BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
while (argc >= 1)
{ if (!load_config(bio_err, NULL))
goto end;
if (bio_out == NULL)
if ((bio_out = BIO_new(BIO_s_file())) != NULL) {
BIO_set_fp(bio_out, stdout, BIO_NOCLOSE);
#ifdef OPENSSL_SYS_VMS
{
BIO *tmpbio = BIO_new(BIO_f_linebuffer());
bio_out = BIO_push(tmpbio, bio_out);
}
#endif
}
informat = FORMAT_PEM;
outformat = FORMAT_PEM;
keyformat = FORMAT_PEM;
argc--;
argv++;
num = 0;
while (argc >= 1) {
#ifdef undef #ifdef undef
if (strcmp(*argv,"-p") == 0) if (strcmp(*argv, "-p") == 0) {
{ if (--argc < 1)
if (--argc < 1) goto bad; goto bad;
if (!args_from_file(++argv,Nargc,Nargv)) { goto end; }*/ if (!args_from_file(++argv, Nargc, Nargv)) {
} goto end;
}
*/}
#endif #endif
if (strcmp(*argv,"-inform") == 0) if (strcmp(*argv, "-inform") == 0) {
{ if (--argc < 1)
if (--argc < 1) goto bad; goto bad;
informat=str2fmt(*(++argv)); informat = str2fmt(*(++argv));
} } else if (strcmp(*argv, "-outform") == 0) {
else if (strcmp(*argv,"-outform") == 0) if (--argc < 1)
{ goto bad;
if (--argc < 1) goto bad; outformat = str2fmt(*(++argv));
outformat=str2fmt(*(++argv)); } else if (strcmp(*argv, "-in") == 0) {
} if (--argc < 1)
else if (strcmp(*argv,"-in") == 0) goto bad;
{ infile = *(++argv);
if (--argc < 1) goto bad; } else if (strcmp(*argv, "-gendelta") == 0) {
infile= *(++argv); if (--argc < 1)
} goto bad;
else if (strcmp(*argv,"-out") == 0) crldiff = *(++argv);
{ } else if (strcmp(*argv, "-key") == 0) {
if (--argc < 1) goto bad; if (--argc < 1)
outfile= *(++argv); goto bad;
} keyfile = *(++argv);
else if (strcmp(*argv,"-CApath") == 0) } else if (strcmp(*argv, "-keyform") == 0) {
{ if (--argc < 1)
if (--argc < 1) goto bad; goto bad;
CApath = *(++argv); keyformat = str2fmt(*(++argv));
do_ver = 1; } else if (strcmp(*argv, "-out") == 0) {
} if (--argc < 1)
else if (strcmp(*argv,"-CAfile") == 0) goto bad;
{ outfile = *(++argv);
if (--argc < 1) goto bad; } else if (strcmp(*argv, "-CApath") == 0) {
CAfile = *(++argv); if (--argc < 1)
do_ver = 1; goto bad;
} CApath = *(++argv);
else if (strcmp(*argv,"-verify") == 0) do_ver = 1;
do_ver = 1; } else if (strcmp(*argv, "-CAfile") == 0) {
else if (strcmp(*argv,"-text") == 0) if (--argc < 1)
text = 1; goto bad;
else if (strcmp(*argv,"-hash") == 0) CAfile = *(++argv);
hash= ++num; do_ver = 1;
else if (strcmp(*argv,"-nameopt") == 0) } else if (strcmp(*argv, "-verify") == 0)
{ do_ver = 1;
if (--argc < 1) goto bad; else if (strcmp(*argv, "-text") == 0)
if (!set_name_ex(&nmflag, *(++argv))) goto bad; text = 1;
} else if (strcmp(*argv, "-hash") == 0)
else if (strcmp(*argv,"-issuer") == 0) hash = ++num;
issuer= ++num; #ifndef OPENSSL_NO_MD5
else if (strcmp(*argv,"-lastupdate") == 0) else if (strcmp(*argv, "-hash_old") == 0)
lastupdate= ++num; hash_old = ++num;
else if (strcmp(*argv,"-nextupdate") == 0) #endif
nextupdate= ++num; else if (strcmp(*argv, "-nameopt") == 0) {
else if (strcmp(*argv,"-noout") == 0) if (--argc < 1)
noout= ++num; goto bad;
else if (strcmp(*argv,"-fingerprint") == 0) if (!set_name_ex(&nmflag, *(++argv)))
fingerprint= ++num; goto bad;
else if (strcmp(*argv,"-crlnumber") == 0) } else if (strcmp(*argv, "-issuer") == 0)
crlnumber= ++num; issuer = ++num;
else if ((md_alg=EVP_get_digestbyname(*argv + 1))) else if (strcmp(*argv, "-lastupdate") == 0)
{ lastupdate = ++num;
/* ok */ else if (strcmp(*argv, "-nextupdate") == 0)
digest=md_alg; nextupdate = ++num;
} else if (strcmp(*argv, "-noout") == 0)
else noout = ++num;
{ else if (strcmp(*argv, "-fingerprint") == 0)
BIO_printf(bio_err,"unknown option %s\n",*argv); fingerprint = ++num;
badops=1; else if (strcmp(*argv, "-crlnumber") == 0)
break; crlnumber = ++num;
} else if (strcmp(*argv, "-badsig") == 0)
argc--; badsig = 1;
argv++; else if ((md_alg = EVP_get_digestbyname(*argv + 1))) {
} /* ok */
digest = md_alg;
} else {
BIO_printf(bio_err, "unknown option %s\n", *argv);
badops = 1;
break;
}
argc--;
argv++;
}
if (badops) if (badops) {
{ bad:
bad: for (pp = crl_usage; (*pp != NULL); pp++)
for (pp=crl_usage; (*pp != NULL); pp++) BIO_printf(bio_err, "%s", *pp);
BIO_printf(bio_err,"%s",*pp); goto end;
goto end; }
}
ERR_load_crypto_strings(); ERR_load_crypto_strings();
x=load_crl(infile,informat); x = load_crl(infile, informat);
if (x == NULL) { goto end; } if (x == NULL) {
goto end;
}
if(do_ver) { if (do_ver) {
store = X509_STORE_new(); store = X509_STORE_new();
lookup=X509_STORE_add_lookup(store,X509_LOOKUP_file()); lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
if (lookup == NULL) goto end; if (lookup == NULL)
if (!X509_LOOKUP_load_file(lookup,CAfile,X509_FILETYPE_PEM)) goto end;
X509_LOOKUP_load_file(lookup,NULL,X509_FILETYPE_DEFAULT); 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()); lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir());
if (lookup == NULL) goto end; if (lookup == NULL)
if (!X509_LOOKUP_add_dir(lookup,CApath,X509_FILETYPE_PEM)) goto end;
X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT); if (!X509_LOOKUP_add_dir(lookup, CApath, X509_FILETYPE_PEM))
ERR_clear_error(); X509_LOOKUP_add_dir(lookup, NULL, X509_FILETYPE_DEFAULT);
ERR_clear_error();
if(!X509_STORE_CTX_init(&ctx, store, NULL, NULL)) { if (!X509_STORE_CTX_init(&ctx, store, NULL, NULL)) {
BIO_printf(bio_err, BIO_printf(bio_err, "Error initialising X509 store\n");
"Error initialising X509 store\n"); goto end;
goto end; }
}
i = X509_STORE_get_by_subject(&ctx, X509_LU_X509, i = X509_STORE_get_by_subject(&ctx, X509_LU_X509,
X509_CRL_get_issuer(x), &xobj); X509_CRL_get_issuer(x), &xobj);
if(i <= 0) { if (i <= 0) {
BIO_printf(bio_err, BIO_printf(bio_err, "Error getting CRL issuer certificate\n");
"Error getting CRL issuer certificate\n"); goto end;
goto end; }
} pkey = X509_get_pubkey(xobj.data.x509);
pkey = X509_get_pubkey(xobj.data.x509); X509_OBJECT_free_contents(&xobj);
X509_OBJECT_free_contents(&xobj); if (!pkey) {
if(!pkey) { BIO_printf(bio_err, "Error getting CRL issuer public key\n");
BIO_printf(bio_err, goto end;
"Error getting CRL issuer public key\n"); }
goto end; i = X509_CRL_verify(x, pkey);
} EVP_PKEY_free(pkey);
i = X509_CRL_verify(x, pkey); if (i < 0)
EVP_PKEY_free(pkey); goto end;
if(i < 0) goto end; if (i == 0)
if(i == 0) BIO_printf(bio_err, "verify failure\n"); BIO_printf(bio_err, "verify failure\n");
else BIO_printf(bio_err, "verify OK\n"); else
} BIO_printf(bio_err, "verify OK\n");
}
if (num) if (crldiff) {
{ X509_CRL *newcrl, *delta;
for (i=1; i<=num; i++) if (!keyfile) {
{ BIO_puts(bio_err, "Missing CRL signing key\n");
if (issuer == i) goto end;
{ }
print_name(bio_out, "issuer=", X509_CRL_get_issuer(x), nmflag); newcrl = load_crl(crldiff, informat);
} if (!newcrl)
if (crlnumber == i) goto end;
{ pkey = load_key(bio_err, keyfile, keyformat, 0, NULL, NULL,
ASN1_INTEGER *crlnum; "CRL signing key");
crlnum = X509_CRL_get_ext_d2i(x, NID_crl_number, if (!pkey) {
NULL, NULL); X509_CRL_free(newcrl);
BIO_printf(bio_out,"crlNumber="); goto end;
if (crlnum) }
{ delta = X509_CRL_diff(x, newcrl, pkey, digest, 0);
i2a_ASN1_INTEGER(bio_out, crlnum); X509_CRL_free(newcrl);
ASN1_INTEGER_free(crlnum); EVP_PKEY_free(pkey);
} if (delta) {
else X509_CRL_free(x);
BIO_puts(bio_out, "<NONE>"); x = delta;
BIO_printf(bio_out,"\n"); } else {
} BIO_puts(bio_err, "Error creating delta CRL\n");
if (hash == i) goto end;
{ }
BIO_printf(bio_out,"%08lx\n", }
X509_NAME_hash(X509_CRL_get_issuer(x)));
}
if (lastupdate == i)
{
BIO_printf(bio_out,"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 (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");
}
if (fingerprint == i)
{
int j;
unsigned int n;
unsigned char md[EVP_MAX_MD_SIZE];
if (!X509_CRL_digest(x,digest,md,&n)) if (num) {
{ for (i = 1; i <= num; i++) {
BIO_printf(bio_err,"out of memory\n"); if (issuer == i) {
goto end; print_name(bio_out, "issuer=", X509_CRL_get_issuer(x),
} nmflag);
BIO_printf(bio_out,"%s Fingerprint=", }
OBJ_nid2sn(EVP_MD_type(digest))); if (crlnumber == i) {
for (j=0; j<(int)n; j++) ASN1_INTEGER *crlnum;
{ crlnum = X509_CRL_get_ext_d2i(x, NID_crl_number, NULL, NULL);
BIO_printf(bio_out,"%02X%c",md[j], BIO_printf(bio_out, "crlNumber=");
(j+1 == (int)n) if (crlnum) {
?'\n':':'); i2a_ASN1_INTEGER(bio_out, crlnum);
} ASN1_INTEGER_free(crlnum);
} } else
} BIO_puts(bio_out, "<NONE>");
} BIO_printf(bio_out, "\n");
}
if (hash == i) {
BIO_printf(bio_out, "%08lx\n",
X509_NAME_hash(X509_CRL_get_issuer(x)));
}
#ifndef OPENSSL_NO_MD5
if (hash_old == i) {
BIO_printf(bio_out, "%08lx\n",
X509_NAME_hash_old(X509_CRL_get_issuer(x)));
}
#endif
if (lastupdate == i) {
BIO_printf(bio_out, "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 (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");
}
if (fingerprint == i) {
int j;
unsigned int n;
unsigned char md[EVP_MAX_MD_SIZE];
out=BIO_new(BIO_s_file()); if (!X509_CRL_digest(x, digest, md, &n)) {
if (out == NULL) BIO_printf(bio_err, "out of memory\n");
{ goto end;
ERR_print_errors(bio_err); }
goto end; BIO_printf(bio_out, "%s Fingerprint=",
} OBJ_nid2sn(EVP_MD_type(digest)));
for (j = 0; j < (int)n; j++) {
BIO_printf(bio_out, "%02X%c", md[j], (j + 1 == (int)n)
? '\n' : ':');
}
}
}
}
if (outfile == NULL) out = BIO_new(BIO_s_file());
{ if (out == NULL) {
BIO_set_fp(out,stdout,BIO_NOCLOSE); ERR_print_errors(bio_err);
goto end;
}
if (outfile == NULL) {
BIO_set_fp(out, stdout, BIO_NOCLOSE);
#ifdef OPENSSL_SYS_VMS #ifdef OPENSSL_SYS_VMS
{ {
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); BIO *tmpbio = BIO_new(BIO_f_linebuffer());
out = BIO_push(tmpbio, out); out = BIO_push(tmpbio, out);
} }
#endif #endif
} } else {
else if (BIO_write_filename(out, outfile) <= 0) {
{ perror(outfile);
if (BIO_write_filename(out,outfile) <= 0) goto end;
{ }
perror(outfile); }
goto end;
}
}
if (text) X509_CRL_print(out, x); if (text)
X509_CRL_print(out, x);
if (noout) if (noout) {
{ ret = 0;
ret = 0; goto end;
goto end; }
}
if (outformat == FORMAT_ASN1) if (badsig)
i=(int)i2d_X509_CRL_bio(out,x); x->signature->data[x->signature->length - 1] ^= 0x1;
else if (outformat == FORMAT_PEM)
i=PEM_write_bio_X509_CRL(out,x);
else
{
BIO_printf(bio_err,"bad output format specified for outfile\n");
goto end;
}
if (!i) { BIO_printf(bio_err,"unable to write CRL\n"); goto end; }
ret=0;
end:
BIO_free_all(out);
BIO_free_all(bio_out);
bio_out=NULL;
X509_CRL_free(x);
if(store) {
X509_STORE_CTX_cleanup(&ctx);
X509_STORE_free(store);
}
apps_shutdown();
OPENSSL_EXIT(ret);
}
static X509_CRL *load_crl(char *infile, int format)
{
X509_CRL *x=NULL;
BIO *in=NULL;
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 (format == FORMAT_ASN1)
x=d2i_X509_CRL_bio(in,NULL);
else if (format == FORMAT_PEM)
x=PEM_read_bio_X509_CRL(in,NULL,NULL,NULL);
else {
BIO_printf(bio_err,"bad input format specified for input crl\n");
goto end;
}
if (x == NULL)
{
BIO_printf(bio_err,"unable to load CRL\n");
ERR_print_errors(bio_err);
goto end;
}
end:
BIO_free(in);
return(x);
}
if (outformat == FORMAT_ASN1)
i = (int)i2d_X509_CRL_bio(out, x);
else if (outformat == FORMAT_PEM)
i = PEM_write_bio_X509_CRL(out, x);
else {
BIO_printf(bio_err, "bad output format specified for outfile\n");
goto end;
}
if (!i) {
BIO_printf(bio_err, "unable to write CRL\n");
goto end;
}
ret = 0;
end:
if (ret != 0)
ERR_print_errors(bio_err);
BIO_free_all(out);
BIO_free_all(bio_out);
bio_out = NULL;
X509_CRL_free(x);
if (store) {
X509_STORE_CTX_cleanup(&ctx);
X509_STORE_free(store);
}
apps_shutdown();
OPENSSL_EXIT(ret);
}

Binary file not shown.

View File

@@ -56,9 +56,11 @@
* [including the GNU Public Licence.] * [including the GNU Public Licence.]
*/ */
/* This was written by Gordon Chaffee <chaffee@plateau.cs.berkeley.edu> /*
* and donated 'to the cause' along with lots and lots of other fixes to * This was written by Gordon Chaffee <chaffee@plateau.cs.berkeley.edu> and
* the library. */ * donated 'to the cause' along with lots and lots of other fixes to the
* library.
*/
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -73,265 +75,260 @@
static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile); static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile);
#undef PROG #undef PROG
#define PROG crl2pkcs7_main #define PROG crl2pkcs7_main
/* -inform arg - input format - default PEM (DER or PEM) /*-
* -inform arg - input format - default PEM (DER or PEM)
* -outform arg - output format - default PEM * -outform arg - output format - default PEM
* -in arg - input file - default stdin * -in arg - input file - default stdin
* -out arg - output file - default stdout * -out arg - output file - default stdout
*/ */
int MAIN(int, char **); int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
int i,badops=0; int i, badops = 0;
BIO *in=NULL,*out=NULL; BIO *in = NULL, *out = NULL;
int informat,outformat; int informat, outformat;
char *infile,*outfile,*prog,*certfile; char *infile, *outfile, *prog, *certfile;
PKCS7 *p7 = NULL; PKCS7 *p7 = NULL;
PKCS7_SIGNED *p7s = NULL; PKCS7_SIGNED *p7s = NULL;
X509_CRL *crl=NULL; X509_CRL *crl = NULL;
STACK_OF(OPENSSL_STRING) *certflst=NULL; STACK_OF(OPENSSL_STRING) *certflst = NULL;
STACK_OF(X509_CRL) *crl_stack=NULL; STACK_OF(X509_CRL) *crl_stack = NULL;
STACK_OF(X509) *cert_stack=NULL; STACK_OF(X509) *cert_stack = NULL;
int ret=1,nocrl=0; int ret = 1, nocrl = 0;
apps_startup(); apps_startup();
if (bio_err == NULL) if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL) if ((bio_err = BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
infile=NULL; infile = NULL;
outfile=NULL; outfile = NULL;
informat=FORMAT_PEM; informat = FORMAT_PEM;
outformat=FORMAT_PEM; outformat = FORMAT_PEM;
prog=argv[0]; prog = argv[0];
argc--; argc--;
argv++; argv++;
while (argc >= 1) while (argc >= 1) {
{ if (strcmp(*argv, "-inform") == 0) {
if (strcmp(*argv,"-inform") == 0) if (--argc < 1)
{ goto bad;
if (--argc < 1) goto bad; informat = str2fmt(*(++argv));
informat=str2fmt(*(++argv)); } else if (strcmp(*argv, "-outform") == 0) {
} if (--argc < 1)
else if (strcmp(*argv,"-outform") == 0) goto bad;
{ outformat = str2fmt(*(++argv));
if (--argc < 1) goto bad; } else if (strcmp(*argv, "-in") == 0) {
outformat=str2fmt(*(++argv)); if (--argc < 1)
} goto bad;
else if (strcmp(*argv,"-in") == 0) infile = *(++argv);
{ } else if (strcmp(*argv, "-nocrl") == 0) {
if (--argc < 1) goto bad; nocrl = 1;
infile= *(++argv); } else if (strcmp(*argv, "-out") == 0) {
} if (--argc < 1)
else if (strcmp(*argv,"-nocrl") == 0) goto bad;
{ outfile = *(++argv);
nocrl=1; } else if (strcmp(*argv, "-certfile") == 0) {
} if (--argc < 1)
else if (strcmp(*argv,"-out") == 0) goto bad;
{ if (!certflst)
if (--argc < 1) goto bad; certflst = sk_OPENSSL_STRING_new_null();
outfile= *(++argv); if (!certflst)
} goto end;
else if (strcmp(*argv,"-certfile") == 0) if (!sk_OPENSSL_STRING_push(certflst, *(++argv))) {
{ sk_OPENSSL_STRING_free(certflst);
if (--argc < 1) goto bad; goto end;
if(!certflst) certflst = sk_OPENSSL_STRING_new_null(); }
sk_OPENSSL_STRING_push(certflst,*(++argv)); } else {
} BIO_printf(bio_err, "unknown option %s\n", *argv);
else badops = 1;
{ break;
BIO_printf(bio_err,"unknown option %s\n",*argv); }
badops=1; argc--;
break; argv++;
} }
argc--;
argv++;
}
if (badops) if (badops) {
{ bad:
bad: BIO_printf(bio_err, "%s [options] <infile >outfile\n", prog);
BIO_printf(bio_err,"%s [options] <infile >outfile\n",prog); BIO_printf(bio_err, "where options are\n");
BIO_printf(bio_err,"where options are\n"); BIO_printf(bio_err, " -inform arg input format - DER or 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," -outform arg output format - DER or PEM\n"); BIO_printf(bio_err, " -in arg input file\n");
BIO_printf(bio_err," -in arg input file\n"); BIO_printf(bio_err, " -out arg output file\n");
BIO_printf(bio_err," -out arg output file\n"); BIO_printf(bio_err,
BIO_printf(bio_err," -certfile arg certificates file of chain to a trusted CA\n"); " -certfile arg certificates file of chain to a trusted CA\n");
BIO_printf(bio_err," (can be used more than once)\n"); BIO_printf(bio_err, " (can be used more than once)\n");
BIO_printf(bio_err," -nocrl no crl to load, just certs from '-certfile'\n"); BIO_printf(bio_err,
ret = 1; " -nocrl no crl to load, just certs from '-certfile'\n");
goto end; ret = 1;
} goto end;
}
ERR_load_crypto_strings(); ERR_load_crypto_strings();
in=BIO_new(BIO_s_file()); in = BIO_new(BIO_s_file());
out=BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file());
if ((in == NULL) || (out == NULL)) if ((in == NULL) || (out == NULL)) {
{ ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
}
if (!nocrl) if (!nocrl) {
{ if (infile == NULL)
if (infile == NULL) BIO_set_fp(in, stdin, BIO_NOCLOSE);
BIO_set_fp(in,stdin,BIO_NOCLOSE); else {
else if (BIO_read_filename(in, infile) <= 0) {
{ perror(infile);
if (BIO_read_filename(in,infile) <= 0) goto end;
{ }
perror(infile); }
goto end;
}
}
if (informat == FORMAT_ASN1) if (informat == FORMAT_ASN1)
crl=d2i_X509_CRL_bio(in,NULL); crl = d2i_X509_CRL_bio(in, NULL);
else if (informat == FORMAT_PEM) else if (informat == FORMAT_PEM)
crl=PEM_read_bio_X509_CRL(in,NULL,NULL,NULL); crl = PEM_read_bio_X509_CRL(in, NULL, NULL, NULL);
else { else {
BIO_printf(bio_err,"bad input format specified for input crl\n"); BIO_printf(bio_err, "bad input format specified for input crl\n");
goto end; goto end;
} }
if (crl == NULL) if (crl == NULL) {
{ BIO_printf(bio_err, "unable to load CRL\n");
BIO_printf(bio_err,"unable to load CRL\n"); ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
} }
}
if ((p7=PKCS7_new()) == NULL) goto end; if ((p7 = PKCS7_new()) == NULL)
if ((p7s=PKCS7_SIGNED_new()) == NULL) goto end; goto end;
p7->type=OBJ_nid2obj(NID_pkcs7_signed); if ((p7s = PKCS7_SIGNED_new()) == NULL)
p7->d.sign=p7s; goto end;
p7s->contents->type=OBJ_nid2obj(NID_pkcs7_data); p7->type = OBJ_nid2obj(NID_pkcs7_signed);
p7->d.sign = p7s;
p7s->contents->type = OBJ_nid2obj(NID_pkcs7_data);
if (!ASN1_INTEGER_set(p7s->version,1)) goto end; if (!ASN1_INTEGER_set(p7s->version, 1))
if ((crl_stack=sk_X509_CRL_new_null()) == NULL) goto end; goto end;
p7s->crl=crl_stack; if ((crl_stack = sk_X509_CRL_new_null()) == NULL)
if (crl != NULL) goto end;
{ p7s->crl = crl_stack;
sk_X509_CRL_push(crl_stack,crl); if (crl != NULL) {
crl=NULL; /* now part of p7 for OPENSSL_freeing */ sk_X509_CRL_push(crl_stack, crl);
} crl = NULL; /* now part of p7 for OPENSSL_freeing */
}
if ((cert_stack=sk_X509_new_null()) == NULL) goto end; if ((cert_stack = sk_X509_new_null()) == NULL)
p7s->cert=cert_stack; goto end;
p7s->cert = cert_stack;
if(certflst) for(i = 0; i < sk_OPENSSL_STRING_num(certflst); i++) { if (certflst)
certfile = sk_OPENSSL_STRING_value(certflst, i); for (i = 0; i < sk_OPENSSL_STRING_num(certflst); i++) {
if (add_certs_from_file(cert_stack,certfile) < 0) certfile = sk_OPENSSL_STRING_value(certflst, i);
{ if (add_certs_from_file(cert_stack, certfile) < 0) {
BIO_printf(bio_err, "error loading certificates\n"); BIO_printf(bio_err, "error loading certificates\n");
ERR_print_errors(bio_err); ERR_print_errors(bio_err);
goto end; goto end;
} }
} }
sk_OPENSSL_STRING_free(certflst); sk_OPENSSL_STRING_free(certflst);
if (outfile == NULL) if (outfile == NULL) {
{ BIO_set_fp(out, stdout, BIO_NOCLOSE);
BIO_set_fp(out,stdout,BIO_NOCLOSE);
#ifdef OPENSSL_SYS_VMS #ifdef OPENSSL_SYS_VMS
{ {
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); BIO *tmpbio = BIO_new(BIO_f_linebuffer());
out = BIO_push(tmpbio, out); out = BIO_push(tmpbio, out);
} }
#endif #endif
} } else {
else if (BIO_write_filename(out, outfile) <= 0) {
{ perror(outfile);
if (BIO_write_filename(out,outfile) <= 0) goto end;
{ }
perror(outfile); }
goto end;
}
}
if (outformat == FORMAT_ASN1) if (outformat == FORMAT_ASN1)
i=i2d_PKCS7_bio(out,p7); i = i2d_PKCS7_bio(out, p7);
else if (outformat == FORMAT_PEM) else if (outformat == FORMAT_PEM)
i=PEM_write_bio_PKCS7(out,p7); i = PEM_write_bio_PKCS7(out, p7);
else { else {
BIO_printf(bio_err,"bad output format specified for outfile\n"); BIO_printf(bio_err, "bad output format specified for outfile\n");
goto end; goto end;
} }
if (!i) if (!i) {
{ BIO_printf(bio_err, "unable to write pkcs7 object\n");
BIO_printf(bio_err,"unable to write pkcs7 object\n"); ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
} ret = 0;
ret=0; end:
end: if (in != NULL)
if (in != NULL) BIO_free(in); BIO_free(in);
if (out != NULL) BIO_free_all(out); if (out != NULL)
if (p7 != NULL) PKCS7_free(p7); BIO_free_all(out);
if (crl != NULL) X509_CRL_free(crl); if (p7 != NULL)
PKCS7_free(p7);
if (crl != NULL)
X509_CRL_free(crl);
apps_shutdown(); apps_shutdown();
OPENSSL_EXIT(ret); OPENSSL_EXIT(ret);
} }
/* /*-
*---------------------------------------------------------------------- *----------------------------------------------------------------------
* int add_certs_from_file * int add_certs_from_file
* *
* Read a list of certificates to be checked from a file. * Read a list of certificates to be checked from a file.
* *
* Results: * Results:
* number of certs added if successful, -1 if not. * number of certs added if successful, -1 if not.
*---------------------------------------------------------------------- *----------------------------------------------------------------------
*/ */
static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile) static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile)
{ {
BIO *in=NULL; BIO *in = NULL;
int count=0; int count = 0;
int ret= -1; int ret = -1;
STACK_OF(X509_INFO) *sk=NULL; STACK_OF(X509_INFO) *sk = NULL;
X509_INFO *xi; X509_INFO *xi;
in=BIO_new(BIO_s_file()); in = BIO_new(BIO_s_file());
if ((in == NULL) || (BIO_read_filename(in,certfile) <= 0)) if ((in == NULL) || (BIO_read_filename(in, certfile) <= 0)) {
{ BIO_printf(bio_err, "error opening the file, %s\n", certfile);
BIO_printf(bio_err,"error opening the file, %s\n",certfile); goto end;
goto end; }
}
/* This loads from a file, a stack of x509/crl/pkey sets */ /* This loads from a file, a stack of x509/crl/pkey sets */
sk=PEM_X509_INFO_read_bio(in,NULL,NULL,NULL); sk = PEM_X509_INFO_read_bio(in, NULL, NULL, NULL);
if (sk == NULL) { if (sk == NULL) {
BIO_printf(bio_err,"error reading the file, %s\n",certfile); BIO_printf(bio_err, "error reading the file, %s\n", certfile);
goto end; goto end;
} }
/* scan over it and pull out the CRL's */ /* scan over it and pull out the CRL's */
while (sk_X509_INFO_num(sk)) while (sk_X509_INFO_num(sk)) {
{ xi = sk_X509_INFO_shift(sk);
xi=sk_X509_INFO_shift(sk); if (xi->x509 != NULL) {
if (xi->x509 != NULL) sk_X509_push(stack, xi->x509);
{ xi->x509 = NULL;
sk_X509_push(stack,xi->x509); count++;
xi->x509=NULL; }
count++; X509_INFO_free(xi);
} }
X509_INFO_free(xi);
}
ret=count;
end:
/* never need to OPENSSL_free x */
if (in != NULL) BIO_free(in);
if (sk != NULL) sk_X509_INFO_free(sk);
return(ret);
}
ret = count;
end:
/* never need to OPENSSL_free x */
if (in != NULL)
BIO_free(in);
if (sk != NULL)
sk_X509_INFO_free(sk);
return (ret);
}

Binary file not shown.

View File

@@ -0,0 +1,6 @@
# This is a file that will be filled by the openssl srp routine.
# You can initialize the file with additional groups, these are
# records starting with a I followed by the g and N values and the id.
# The exact values ... you have to dig this out from the source of srp.c
# or srp_vfy.c
# The last value of an I is used as the default group for new users.

View File

@@ -0,0 +1 @@
unique_subject = yes

File diff suppressed because it is too large Load Diff

Binary file not shown.

506
apps/dh.c
View File

@@ -57,28 +57,29 @@
* [including the GNU Public Licence.] * [including the GNU Public Licence.]
*/ */
#include <openssl/opensslconf.h> /* for OPENSSL_NO_DH */ #include <openssl/opensslconf.h> /* for OPENSSL_NO_DH */
#ifndef OPENSSL_NO_DH #ifndef OPENSSL_NO_DH
#include <stdio.h> # include <stdio.h>
#include <stdlib.h> # include <stdlib.h>
#include <time.h> # include <time.h>
#include <string.h> # include <string.h>
#include "apps.h" # include "apps.h"
#include <openssl/bio.h> # include <openssl/bio.h>
#include <openssl/err.h> # include <openssl/err.h>
#include <openssl/bn.h> # include <openssl/bn.h>
#include <openssl/dh.h> # include <openssl/dh.h>
#include <openssl/x509.h> # include <openssl/x509.h>
#include <openssl/pem.h> # include <openssl/pem.h>
#undef PROG # undef PROG
#define PROG dh_main # define PROG dh_main
/* -inform arg - input format - default PEM (DER or PEM) /*-
* -inform arg - input format - default PEM (DER or PEM)
* -outform arg - output format - default PEM * -outform arg - output format - default PEM
* -in arg - input file - default stdin * -in arg - input file - default stdin
* -out arg - output file - default stdout * -out arg - output file - default stdout
* -check - check the parameters are ok * -check - check the parameters are ok
* -noout * -noout
* -text * -text
* -C * -C
@@ -87,269 +88,250 @@
int MAIN(int, char **); int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
DH *dh=NULL; DH *dh = NULL;
int i,badops=0,text=0; int i, badops = 0, text = 0;
BIO *in=NULL,*out=NULL; BIO *in = NULL, *out = NULL;
int informat,outformat,check=0,noout=0,C=0,ret=1; int informat, outformat, check = 0, noout = 0, C = 0, ret = 1;
char *infile,*outfile,*prog; char *infile, *outfile, *prog;
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
char *engine; char *engine;
#endif # endif
apps_startup(); apps_startup();
if (bio_err == NULL) if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL) if ((bio_err = BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
if (!load_config(bio_err, NULL)) if (!load_config(bio_err, NULL))
goto end; goto end;
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
engine=NULL; engine = NULL;
#endif # endif
infile=NULL; infile = NULL;
outfile=NULL; outfile = NULL;
informat=FORMAT_PEM; informat = FORMAT_PEM;
outformat=FORMAT_PEM; outformat = FORMAT_PEM;
prog=argv[0]; prog = argv[0];
argc--; argc--;
argv++; argv++;
while (argc >= 1) while (argc >= 1) {
{ if (strcmp(*argv, "-inform") == 0) {
if (strcmp(*argv,"-inform") == 0) if (--argc < 1)
{ goto bad;
if (--argc < 1) goto bad; informat = str2fmt(*(++argv));
informat=str2fmt(*(++argv)); } else if (strcmp(*argv, "-outform") == 0) {
} if (--argc < 1)
else if (strcmp(*argv,"-outform") == 0) goto bad;
{ outformat = str2fmt(*(++argv));
if (--argc < 1) goto bad; } else if (strcmp(*argv, "-in") == 0) {
outformat=str2fmt(*(++argv)); if (--argc < 1)
} goto bad;
else if (strcmp(*argv,"-in") == 0) infile = *(++argv);
{ } else if (strcmp(*argv, "-out") == 0) {
if (--argc < 1) goto bad; if (--argc < 1)
infile= *(++argv); goto bad;
} outfile = *(++argv);
else if (strcmp(*argv,"-out") == 0) }
{ # ifndef OPENSSL_NO_ENGINE
if (--argc < 1) goto bad; else if (strcmp(*argv, "-engine") == 0) {
outfile= *(++argv); if (--argc < 1)
} goto bad;
#ifndef OPENSSL_NO_ENGINE engine = *(++argv);
else if (strcmp(*argv,"-engine") == 0) }
{ # endif
if (--argc < 1) goto bad; else if (strcmp(*argv, "-check") == 0)
engine= *(++argv); check = 1;
} else if (strcmp(*argv, "-text") == 0)
#endif text = 1;
else if (strcmp(*argv,"-check") == 0) else if (strcmp(*argv, "-C") == 0)
check=1; C = 1;
else if (strcmp(*argv,"-text") == 0) else if (strcmp(*argv, "-noout") == 0)
text=1; noout = 1;
else if (strcmp(*argv,"-C") == 0) else {
C=1; BIO_printf(bio_err, "unknown option %s\n", *argv);
else if (strcmp(*argv,"-noout") == 0) badops = 1;
noout=1; break;
else }
{ argc--;
BIO_printf(bio_err,"unknown option %s\n",*argv); argv++;
badops=1; }
break;
}
argc--;
argv++;
}
if (badops) if (badops) {
{ bad:
bad: BIO_printf(bio_err, "%s [options] <infile >outfile\n", prog);
BIO_printf(bio_err,"%s [options] <infile >outfile\n",prog); BIO_printf(bio_err, "where options are\n");
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," -inform arg input format - one of DER PEM\n"); BIO_printf(bio_err,
BIO_printf(bio_err," -outform arg output format - one of DER PEM\n"); " -outform arg output format - one of DER PEM\n");
BIO_printf(bio_err," -in arg input file\n"); BIO_printf(bio_err, " -in arg input file\n");
BIO_printf(bio_err," -out arg output file\n"); BIO_printf(bio_err, " -out arg output file\n");
BIO_printf(bio_err," -check check the DH parameters\n"); 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,
BIO_printf(bio_err," -C Output C code\n"); " -text print a text form of the DH parameters\n");
BIO_printf(bio_err," -noout no output\n"); BIO_printf(bio_err, " -C Output C code\n");
#ifndef OPENSSL_NO_ENGINE BIO_printf(bio_err, " -noout no output\n");
BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); # ifndef OPENSSL_NO_ENGINE
#endif BIO_printf(bio_err,
goto end; " -engine e use engine e, possibly a hardware device.\n");
} # endif
goto end;
}
ERR_load_crypto_strings(); ERR_load_crypto_strings();
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
setup_engine(bio_err, engine, 0); setup_engine(bio_err, engine, 0);
#endif # endif
in=BIO_new(BIO_s_file()); in = BIO_new(BIO_s_file());
out=BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file());
if ((in == NULL) || (out == NULL)) if ((in == NULL) || (out == NULL)) {
{ ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
}
if (infile == NULL) if (infile == NULL)
BIO_set_fp(in,stdin,BIO_NOCLOSE); BIO_set_fp(in, stdin, BIO_NOCLOSE);
else else {
{ if (BIO_read_filename(in, infile) <= 0) {
if (BIO_read_filename(in,infile) <= 0) perror(infile);
{ goto end;
perror(infile); }
goto end; }
} if (outfile == NULL) {
} BIO_set_fp(out, stdout, BIO_NOCLOSE);
if (outfile == NULL) # ifdef OPENSSL_SYS_VMS
{ {
BIO_set_fp(out,stdout,BIO_NOCLOSE); BIO *tmpbio = BIO_new(BIO_f_linebuffer());
#ifdef OPENSSL_SYS_VMS out = BIO_push(tmpbio, out);
{ }
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); # endif
out = BIO_push(tmpbio, out); } else {
} if (BIO_write_filename(out, outfile) <= 0) {
#endif perror(outfile);
} goto end;
else }
{ }
if (BIO_write_filename(out,outfile) <= 0)
{
perror(outfile);
goto end;
}
}
if (informat == FORMAT_ASN1) if (informat == FORMAT_ASN1)
dh=d2i_DHparams_bio(in,NULL); dh = d2i_DHparams_bio(in, NULL);
else if (informat == FORMAT_PEM) else if (informat == FORMAT_PEM)
dh=PEM_read_bio_DHparams(in,NULL,NULL,NULL); dh = PEM_read_bio_DHparams(in, NULL, NULL, NULL);
else else {
{ BIO_printf(bio_err, "bad input format specified\n");
BIO_printf(bio_err,"bad input format specified\n"); goto end;
goto end; }
} if (dh == NULL) {
if (dh == NULL) BIO_printf(bio_err, "unable to load DH parameters\n");
{ ERR_print_errors(bio_err);
BIO_printf(bio_err,"unable to load DH parameters\n"); goto end;
ERR_print_errors(bio_err); }
goto end;
}
if (text) {
DHparams_print(out, dh);
# ifdef undef
printf("p=");
BN_print(stdout, dh->p);
printf("\ng=");
BN_print(stdout, dh->g);
printf("\n");
if (dh->length != 0)
printf("recommended private length=%ld\n", dh->length);
# endif
}
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;
if (text) len = BN_num_bytes(dh->p);
{ bits = BN_num_bits(dh->p);
DHparams_print(out,dh); data = (unsigned char *)OPENSSL_malloc(len);
#ifdef undef if (data == NULL) {
printf("p="); perror("OPENSSL_malloc");
BN_print(stdout,dh->p); goto end;
printf("\ng="); }
BN_print(stdout,dh->g); l = BN_bn2bin(dh->p, data);
printf("\n"); printf("static unsigned char dh%d_p[]={", bits);
if (dh->length != 0) for (i = 0; i < l; i++) {
printf("recommended private length=%ld\n",dh->length); if ((i % 12) == 0)
#endif printf("\n\t");
} printf("0x%02X,", data[i]);
}
printf("\n\t};\n");
if (check) l = BN_bn2bin(dh->g, data);
{ printf("static unsigned char dh%d_g[]={", bits);
if (!DH_check(dh,&i)) for (i = 0; i < l; i++) {
{ if ((i % 12) == 0)
ERR_print_errors(bio_err); printf("\n\t");
goto end; printf("0x%02X,", data[i]);
} }
if (i & DH_CHECK_P_NOT_PRIME) printf("\n\t};\n\n");
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); printf("DH *get_dh%d()\n\t{\n", bits);
bits=BN_num_bits(dh->p); printf("\tDH *dh;\n\n");
data=(unsigned char *)OPENSSL_malloc(len); printf("\tif ((dh=DH_new()) == NULL) return(NULL);\n");
if (data == NULL) printf("\tdh->p=BN_bin2bn(dh%d_p,sizeof(dh%d_p),NULL);\n",
{ bits, bits);
perror("OPENSSL_malloc"); printf("\tdh->g=BN_bin2bn(dh%d_g,sizeof(dh%d_g),NULL);\n",
goto end; bits, bits);
} printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n");
l=BN_bn2bin(dh->p,data); printf("\t\treturn(NULL);\n");
printf("static unsigned char dh%d_p[]={",bits); printf("\treturn(dh);\n\t}\n");
for (i=0; i<l; i++) OPENSSL_free(data);
{ }
if ((i%12) == 0) printf("\n\t");
printf("0x%02X,",data[i]);
}
printf("\n\t};\n");
l=BN_bn2bin(dh->g,data); if (!noout) {
printf("static unsigned char dh%d_g[]={",bits); if (outformat == FORMAT_ASN1)
for (i=0; i<l; i++) i = i2d_DHparams_bio(out, dh);
{ else if (outformat == FORMAT_PEM)
if ((i%12) == 0) printf("\n\t"); i = PEM_write_bio_DHparams(out, dh);
printf("0x%02X,",data[i]); else {
} BIO_printf(bio_err, "bad output format specified for outfile\n");
printf("\n\t};\n\n"); goto end;
}
printf("DH *get_dh%d()\n\t{\n",bits); if (!i) {
printf("\tDH *dh;\n\n"); BIO_printf(bio_err, "unable to write DH parameters\n");
printf("\tif ((dh=DH_new()) == NULL) return(NULL);\n"); ERR_print_errors(bio_err);
printf("\tdh->p=BN_bin2bn(dh%d_p,sizeof(dh%d_p),NULL);\n", goto end;
bits,bits); }
printf("\tdh->g=BN_bin2bn(dh%d_g,sizeof(dh%d_g),NULL);\n", }
bits,bits); ret = 0;
printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n"); end:
printf("\t\treturn(NULL);\n"); if (in != NULL)
printf("\treturn(dh);\n\t}\n"); BIO_free(in);
OPENSSL_free(data); if (out != NULL)
} BIO_free_all(out);
if (dh != NULL)
DH_free(dh);
if (!noout) apps_shutdown();
{ OPENSSL_EXIT(ret);
if (outformat == FORMAT_ASN1) }
i=i2d_DHparams_bio(out,dh); #else /* !OPENSSL_NO_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_all(out);
if (dh != NULL) DH_free(dh);
apps_shutdown();
OPENSSL_EXIT(ret);
}
#else /* !OPENSSL_NO_DH */
# if PEDANTIC # if PEDANTIC
static void *dummy=&dummy; static void *dummy = &dummy;
# endif # endif
#endif #endif

BIN
apps/dh.o

Binary file not shown.

View File

@@ -109,35 +109,36 @@
* *
*/ */
#include <openssl/opensslconf.h> /* for OPENSSL_NO_DH */ #include <openssl/opensslconf.h> /* for OPENSSL_NO_DH */
#ifndef OPENSSL_NO_DH #ifndef OPENSSL_NO_DH
#include <stdio.h> # include <stdio.h>
#include <stdlib.h> # include <stdlib.h>
#include <time.h> # include <time.h>
#include <string.h> # include <string.h>
#include "apps.h" # include "apps.h"
#include <openssl/bio.h> # include <openssl/bio.h>
#include <openssl/err.h> # include <openssl/err.h>
#include <openssl/bn.h> # include <openssl/bn.h>
#include <openssl/dh.h> # include <openssl/dh.h>
#include <openssl/x509.h> # include <openssl/x509.h>
#include <openssl/pem.h> # include <openssl/pem.h>
#ifndef OPENSSL_NO_DSA # ifndef OPENSSL_NO_DSA
#include <openssl/dsa.h> # include <openssl/dsa.h>
#endif # endif
#undef PROG # undef PROG
#define PROG dhparam_main # define PROG dhparam_main
#define DEFBITS 512 # define DEFBITS 2048
/* -inform arg - input format - default PEM (DER or PEM) /*-
* -inform arg - input format - default PEM (DER or PEM)
* -outform arg - output format - default PEM * -outform arg - output format - default PEM
* -in arg - input file - default stdin * -in arg - input file - default stdin
* -out arg - output file - default stdout * -out arg - output file - default stdout
* -dsaparam - read or generate DSA parameters, convert to DH * -dsaparam - read or generate DSA parameters, convert to DH
* -check - check the parameters are ok * -check - check the parameters are ok
* -noout * -noout
* -text * -text
* -C * -C
@@ -148,413 +149,398 @@ static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb);
int MAIN(int, char **); int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
DH *dh=NULL; DH *dh = NULL;
int i,badops=0,text=0; int i, badops = 0, text = 0;
#ifndef OPENSSL_NO_DSA # ifndef OPENSSL_NO_DSA
int dsaparam=0; int dsaparam = 0;
#endif # endif
BIO *in=NULL,*out=NULL; BIO *in = NULL, *out = NULL;
int informat,outformat,check=0,noout=0,C=0,ret=1; int informat, outformat, check = 0, noout = 0, C = 0, ret = 1;
char *infile,*outfile,*prog; char *infile, *outfile, *prog;
char *inrand=NULL; char *inrand = NULL;
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
char *engine=NULL; char *engine = NULL;
#endif # endif
int num = 0, g = 0; int num = 0, g = 0;
apps_startup(); apps_startup();
if (bio_err == NULL) if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL) if ((bio_err = BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
if (!load_config(bio_err, NULL)) if (!load_config(bio_err, NULL))
goto end; goto end;
infile=NULL; infile = NULL;
outfile=NULL; outfile = NULL;
informat=FORMAT_PEM; informat = FORMAT_PEM;
outformat=FORMAT_PEM; outformat = FORMAT_PEM;
prog=argv[0]; prog = argv[0];
argc--; argc--;
argv++; argv++;
while (argc >= 1) while (argc >= 1) {
{ if (strcmp(*argv, "-inform") == 0) {
if (strcmp(*argv,"-inform") == 0) if (--argc < 1)
{ goto bad;
if (--argc < 1) goto bad; informat = str2fmt(*(++argv));
informat=str2fmt(*(++argv)); } else if (strcmp(*argv, "-outform") == 0) {
} if (--argc < 1)
else if (strcmp(*argv,"-outform") == 0) goto bad;
{ outformat = str2fmt(*(++argv));
if (--argc < 1) goto bad; } else if (strcmp(*argv, "-in") == 0) {
outformat=str2fmt(*(++argv)); if (--argc < 1)
} goto bad;
else if (strcmp(*argv,"-in") == 0) infile = *(++argv);
{ } else if (strcmp(*argv, "-out") == 0) {
if (--argc < 1) goto bad; if (--argc < 1)
infile= *(++argv); goto bad;
} outfile = *(++argv);
else if (strcmp(*argv,"-out") == 0) }
{ # ifndef OPENSSL_NO_ENGINE
if (--argc < 1) goto bad; else if (strcmp(*argv, "-engine") == 0) {
outfile= *(++argv); if (--argc < 1)
} goto bad;
#ifndef OPENSSL_NO_ENGINE engine = *(++argv);
else if (strcmp(*argv,"-engine") == 0) }
{ # endif
if (--argc < 1) goto bad; else if (strcmp(*argv, "-check") == 0)
engine= *(++argv); check = 1;
} else if (strcmp(*argv, "-text") == 0)
#endif text = 1;
else if (strcmp(*argv,"-check") == 0) # ifndef OPENSSL_NO_DSA
check=1; else if (strcmp(*argv, "-dsaparam") == 0)
else if (strcmp(*argv,"-text") == 0) dsaparam = 1;
text=1; # endif
#ifndef OPENSSL_NO_DSA else if (strcmp(*argv, "-C") == 0)
else if (strcmp(*argv,"-dsaparam") == 0) C = 1;
dsaparam=1; else if (strcmp(*argv, "-noout") == 0)
#endif noout = 1;
else if (strcmp(*argv,"-C") == 0) else if (strcmp(*argv, "-2") == 0)
C=1; g = 2;
else if (strcmp(*argv,"-noout") == 0) else if (strcmp(*argv, "-5") == 0)
noout=1; g = 5;
else if (strcmp(*argv,"-2") == 0) else if (strcmp(*argv, "-rand") == 0) {
g=2; if (--argc < 1)
else if (strcmp(*argv,"-5") == 0) goto bad;
g=5; inrand = *(++argv);
else if (strcmp(*argv,"-rand") == 0) } else if (((sscanf(*argv, "%d", &num) == 0) || (num <= 0)))
{ goto bad;
if (--argc < 1) goto bad; argv++;
inrand= *(++argv); argc--;
} }
else if (((sscanf(*argv,"%d",&num) == 0) || (num <= 0)))
goto bad;
argv++;
argc--;
}
if (badops) if (badops) {
{ bad:
bad: BIO_printf(bio_err, "%s [options] [numbits]\n", prog);
BIO_printf(bio_err,"%s [options] [numbits]\n",prog); BIO_printf(bio_err, "where options are\n");
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," -inform arg input format - one of DER PEM\n"); BIO_printf(bio_err,
BIO_printf(bio_err," -outform arg output format - one of DER PEM\n"); " -outform arg output format - one of DER PEM\n");
BIO_printf(bio_err," -in arg input file\n"); BIO_printf(bio_err, " -in arg input file\n");
BIO_printf(bio_err," -out arg output file\n"); BIO_printf(bio_err, " -out arg output file\n");
#ifndef OPENSSL_NO_DSA # ifndef OPENSSL_NO_DSA
BIO_printf(bio_err," -dsaparam read or generate DSA parameters, convert to DH\n"); BIO_printf(bio_err,
#endif " -dsaparam read or generate DSA parameters, convert to DH\n");
BIO_printf(bio_err," -check check the DH parameters\n"); # endif
BIO_printf(bio_err," -text print a text form of the DH parameters\n"); BIO_printf(bio_err, " -check check the DH parameters\n");
BIO_printf(bio_err," -C Output C code\n"); BIO_printf(bio_err,
BIO_printf(bio_err," -2 generate parameters using 2 as the generator value\n"); " -text print a text form of the DH parameters\n");
BIO_printf(bio_err," -5 generate parameters using 5 as the generator value\n"); BIO_printf(bio_err, " -C Output C code\n");
BIO_printf(bio_err," numbits number of bits in to generate (default 512)\n"); BIO_printf(bio_err,
#ifndef OPENSSL_NO_ENGINE " -2 generate parameters using 2 as the generator value\n");
BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); BIO_printf(bio_err,
#endif " -5 generate parameters using 5 as the generator value\n");
BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); BIO_printf(bio_err,
BIO_printf(bio_err," - load the file (or the files in the directory) into\n"); " numbits number of bits in to generate (default 2048)\n");
BIO_printf(bio_err," the random number generator\n"); # ifndef OPENSSL_NO_ENGINE
BIO_printf(bio_err," -noout no output\n"); BIO_printf(bio_err,
goto end; " -engine e use engine e, possibly a hardware device.\n");
} # endif
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(); ERR_load_crypto_strings();
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
setup_engine(bio_err, engine, 0); setup_engine(bio_err, engine, 0);
#endif # endif
if (g && !num) if (g && !num)
num = DEFBITS; num = DEFBITS;
#ifndef OPENSSL_NO_DSA # ifndef OPENSSL_NO_DSA
if (dsaparam) if (dsaparam) {
{ if (g) {
if (g) BIO_printf(bio_err,
{ "generator may not be chosen for DSA parameters\n");
BIO_printf(bio_err, "generator may not be chosen for DSA parameters\n"); goto end;
goto end; }
} } else
} # endif
else {
#endif /* DH parameters */
{ if (num && !g)
/* DH parameters */ g = 2;
if (num && !g) }
g = 2;
}
if(num) { if (num) {
BN_GENCB cb; BN_GENCB cb;
BN_GENCB_set(&cb, dh_cb, bio_err); BN_GENCB_set(&cb, dh_cb, bio_err);
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL) if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL) {
{ BIO_printf(bio_err,
BIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\n"); "warning, not much extra random data, consider using the -rand option\n");
} }
if (inrand != NULL) if (inrand != NULL)
BIO_printf(bio_err,"%ld semi-random bytes loaded\n", BIO_printf(bio_err, "%ld semi-random bytes loaded\n",
app_RAND_load_files(inrand)); app_RAND_load_files(inrand));
#ifndef OPENSSL_NO_DSA # ifndef OPENSSL_NO_DSA
if (dsaparam) if (dsaparam) {
{ DSA *dsa = DSA_new();
DSA *dsa = DSA_new();
BIO_printf(bio_err,"Generating DSA parameters, %d bit long prime\n",num); BIO_printf(bio_err,
if(!dsa || !DSA_generate_parameters_ex(dsa, num, "Generating DSA parameters, %d bit long prime\n", num);
NULL, 0, NULL, NULL, &cb)) if (!dsa
{ || !DSA_generate_parameters_ex(dsa, num, NULL, 0, NULL, NULL,
if(dsa) DSA_free(dsa); &cb)) {
ERR_print_errors(bio_err); if (dsa)
goto end; DSA_free(dsa);
} ERR_print_errors(bio_err);
goto end;
}
dh = DSA_dup_DH(dsa); dh = DSA_dup_DH(dsa);
DSA_free(dsa); DSA_free(dsa);
if (dh == NULL) if (dh == NULL) {
{ ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
} } else
} # endif
else {
#endif dh = DH_new();
{ BIO_printf(bio_err,
dh = DH_new(); "Generating DH parameters, %d bit long safe prime, generator %d\n",
BIO_printf(bio_err,"Generating DH parameters, %d bit long safe prime, generator %d\n",num,g); num, g);
BIO_printf(bio_err,"This is going to take a long time\n"); BIO_printf(bio_err, "This is going to take a long time\n");
if(!dh || !DH_generate_parameters_ex(dh, num, g, &cb)) if (!dh || !DH_generate_parameters_ex(dh, num, g, &cb)) {
{ ERR_print_errors(bio_err);
if(dh) DH_free(dh); goto end;
ERR_print_errors(bio_err); }
goto end; }
}
}
app_RAND_write_file(NULL, bio_err); app_RAND_write_file(NULL, bio_err);
} else { } else {
in=BIO_new(BIO_s_file()); in = BIO_new(BIO_s_file());
if (in == NULL) if (in == NULL) {
{ ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
} if (infile == NULL)
if (infile == NULL) BIO_set_fp(in, stdin, BIO_NOCLOSE);
BIO_set_fp(in,stdin,BIO_NOCLOSE); else {
else if (BIO_read_filename(in, infile) <= 0) {
{ perror(infile);
if (BIO_read_filename(in,infile) <= 0) goto end;
{ }
perror(infile); }
goto end;
}
}
if (informat != FORMAT_ASN1 && informat != FORMAT_PEM) if (informat != FORMAT_ASN1 && informat != FORMAT_PEM) {
{ BIO_printf(bio_err, "bad input format specified\n");
BIO_printf(bio_err,"bad input format specified\n"); goto end;
goto end; }
} # ifndef OPENSSL_NO_DSA
if (dsaparam) {
DSA *dsa;
#ifndef OPENSSL_NO_DSA if (informat == FORMAT_ASN1)
if (dsaparam) dsa = d2i_DSAparams_bio(in, NULL);
{ else /* informat == FORMAT_PEM */
DSA *dsa; dsa = PEM_read_bio_DSAparams(in, NULL, NULL, NULL);
if (informat == FORMAT_ASN1) if (dsa == NULL) {
dsa=d2i_DSAparams_bio(in,NULL); BIO_printf(bio_err, "unable to load DSA parameters\n");
else /* informat == FORMAT_PEM */ ERR_print_errors(bio_err);
dsa=PEM_read_bio_DSAparams(in,NULL,NULL,NULL); goto end;
}
if (dsa == NULL) dh = DSA_dup_DH(dsa);
{ DSA_free(dsa);
BIO_printf(bio_err,"unable to load DSA parameters\n"); if (dh == NULL) {
ERR_print_errors(bio_err); ERR_print_errors(bio_err);
goto end; 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);
dh = DSA_dup_DH(dsa); if (dh == NULL) {
DSA_free(dsa); BIO_printf(bio_err, "unable to load DH parameters\n");
if (dh == NULL) ERR_print_errors(bio_err);
{ goto end;
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) /* 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);
# ifdef OPENSSL_SYS_VMS
{
BIO *tmpbio = BIO_new(BIO_f_linebuffer());
out = BIO_push(tmpbio, out);
}
# endif
} else {
if (BIO_write_filename(out, outfile) <= 0) {
perror(outfile);
goto end;
}
}
out=BIO_new(BIO_s_file()); if (text) {
if (out == NULL) DHparams_print(out, dh);
{ }
ERR_print_errors(bio_err);
goto end;
}
if (outfile == NULL)
{
BIO_set_fp(out,stdout,BIO_NOCLOSE);
#ifdef OPENSSL_SYS_VMS
{
BIO *tmpbio = BIO_new(BIO_f_linebuffer());
out = BIO_push(tmpbio, out);
}
#endif
}
else
{
if (BIO_write_filename(out,outfile) <= 0)
{
perror(outfile);
goto end;
}
}
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;
if (text) len = BN_num_bytes(dh->p);
{ bits = BN_num_bits(dh->p);
DHparams_print(out,dh); data = (unsigned char *)OPENSSL_malloc(len);
} if (data == NULL) {
perror("OPENSSL_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);
if (check) l = BN_bn2bin(dh->p, data);
{ printf("\tstatic unsigned char dh%d_p[]={", bits);
if (!DH_check(dh,&i)) for (i = 0; i < l; i++) {
{ if ((i % 12) == 0)
ERR_print_errors(bio_err); printf("\n\t\t");
goto end; printf("0x%02X,", data[i]);
} }
if (i & DH_CHECK_P_NOT_PRIME) printf("\n\t\t};\n");
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); l = BN_bn2bin(dh->g, data);
bits=BN_num_bits(dh->p); printf("\tstatic unsigned char dh%d_g[]={", bits);
data=(unsigned char *)OPENSSL_malloc(len); for (i = 0; i < l; i++) {
if (data == NULL) if ((i % 12) == 0)
{ printf("\n\t\t");
perror("OPENSSL_malloc"); printf("0x%02X,", data[i]);
goto end; }
} printf("\n\t\t};\n");
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("\tDH *dh;\n\n");
printf("\tstatic unsigned char dh%d_p[]={",bits); printf("\tif ((dh=DH_new()) == NULL) return(NULL);\n");
for (i=0; i<l; i++) printf("\tdh->p=BN_bin2bn(dh%d_p,sizeof(dh%d_p),NULL);\n",
{ bits, bits);
if ((i%12) == 0) printf("\n\t\t"); printf("\tdh->g=BN_bin2bn(dh%d_g,sizeof(dh%d_g),NULL);\n",
printf("0x%02X,",data[i]); bits, bits);
} printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n");
printf("\n\t\t};\n"); printf("\t\t{ DH_free(dh); return(NULL); }\n");
if (dh->length)
printf("\tdh->length = %ld;\n", dh->length);
printf("\treturn(dh);\n\t}\n");
OPENSSL_free(data);
}
l=BN_bn2bin(dh->g,data); if (!noout) {
printf("\tstatic unsigned char dh%d_g[]={",bits); if (outformat == FORMAT_ASN1)
for (i=0; i<l; i++) i = i2d_DHparams_bio(out, dh);
{ else if (outformat == FORMAT_PEM) {
if ((i%12) == 0) printf("\n\t\t"); if (dh->q)
printf("0x%02X,",data[i]); i = PEM_write_bio_DHxparams(out, dh);
} else
printf("\n\t\t};\n"); i = PEM_write_bio_DHparams(out, dh);
} else {
printf("\tDH *dh;\n\n"); BIO_printf(bio_err, "bad output format specified for outfile\n");
printf("\tif ((dh=DH_new()) == NULL) return(NULL);\n"); goto end;
printf("\tdh->p=BN_bin2bn(dh%d_p,sizeof(dh%d_p),NULL);\n", }
bits,bits); if (!i) {
printf("\tdh->g=BN_bin2bn(dh%d_g,sizeof(dh%d_g),NULL);\n", BIO_printf(bio_err, "unable to write DH parameters\n");
bits,bits); ERR_print_errors(bio_err);
printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n"); goto end;
printf("\t\t{ DH_free(dh); return(NULL); }\n"); }
if (dh->length) }
printf("\tdh->length = %ld;\n", dh->length); ret = 0;
printf("\treturn(dh);\n\t}\n"); end:
OPENSSL_free(data); if (in != NULL)
} BIO_free(in);
if (out != NULL)
BIO_free_all(out);
if (!noout) if (dh != NULL)
{ DH_free(dh);
if (outformat == FORMAT_ASN1) apps_shutdown();
i=i2d_DHparams_bio(out,dh); OPENSSL_EXIT(ret);
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_all(out);
if (dh != NULL) DH_free(dh);
apps_shutdown();
OPENSSL_EXIT(ret);
}
/* dh_cb is identical to dsa_cb in apps/dsaparam.c */ /* dh_cb is identical to dsa_cb in apps/dsaparam.c */
static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb) static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb)
{ {
char c='*'; char c = '*';
if (p == 0) c='.'; if (p == 0)
if (p == 1) c='+'; c = '.';
if (p == 2) c='*'; if (p == 1)
if (p == 3) c='\n'; c = '+';
BIO_write(cb->arg,&c,1); if (p == 2)
(void)BIO_flush(cb->arg); c = '*';
#ifdef LINT if (p == 3)
p=n; c = '\n';
#endif BIO_write(cb->arg, &c, 1);
return 1; (void)BIO_flush(cb->arg);
} # ifdef LINT
p = n;
# endif
return 1;
}
#else /* !OPENSSL_NO_DH */ #else /* !OPENSSL_NO_DH */
# if PEDANTIC # if PEDANTIC
static void *dummy=&dummy; static void *dummy = &dummy;
# endif # endif
#endif #endif

Binary file not shown.

View File

@@ -56,321 +56,319 @@
* [including the GNU Public Licence.] * [including the GNU Public Licence.]
*/ */
#include <openssl/opensslconf.h> /* for OPENSSL_NO_DSA */ #include <openssl/opensslconf.h> /* for OPENSSL_NO_DSA */
#ifndef OPENSSL_NO_DSA #ifndef OPENSSL_NO_DSA
#include <stdio.h> # include <stdio.h>
#include <stdlib.h> # include <stdlib.h>
#include <string.h> # include <string.h>
#include <time.h> # include <time.h>
#include "apps.h" # include "apps.h"
#include <openssl/bio.h> # include <openssl/bio.h>
#include <openssl/err.h> # include <openssl/err.h>
#include <openssl/dsa.h> # include <openssl/dsa.h>
#include <openssl/evp.h> # include <openssl/evp.h>
#include <openssl/x509.h> # include <openssl/x509.h>
#include <openssl/pem.h> # include <openssl/pem.h>
#include <openssl/bn.h> # include <openssl/bn.h>
#undef PROG # undef PROG
#define PROG dsa_main # define PROG dsa_main
/* -inform arg - input format - default PEM (one of DER, NET or PEM) /*-
* -inform arg - input format - default PEM (one of DER, NET or PEM)
* -outform arg - output format - default PEM * -outform arg - output format - default PEM
* -in arg - input file - default stdin * -in arg - input file - default stdin
* -out arg - output file - default stdout * -out arg - output file - default stdout
* -des - encrypt output if PEM format with DES in cbc mode * -des - encrypt output if PEM format with DES in cbc mode
* -des3 - encrypt output if PEM format * -des3 - encrypt output if PEM format
* -idea - encrypt output if PEM format * -idea - encrypt output if PEM format
* -aes128 - encrypt output if PEM format * -aes128 - encrypt output if PEM format
* -aes192 - encrypt output if PEM format * -aes192 - encrypt output if PEM format
* -aes256 - encrypt output if PEM format * -aes256 - encrypt output if PEM format
* -camellia128 - encrypt output if PEM format * -camellia128 - encrypt output if PEM format
* -camellia192 - encrypt output if PEM format * -camellia192 - encrypt output if PEM format
* -camellia256 - encrypt output if PEM format * -camellia256 - encrypt output if PEM format
* -seed - encrypt output if PEM format * -seed - encrypt output if PEM format
* -text - print a text version * -text - print a text version
* -modulus - print the DSA public key * -modulus - print the DSA public key
*/ */
int MAIN(int, char **); int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
ENGINE *e = NULL; ENGINE *e = NULL;
int ret=1; int ret = 1;
DSA *dsa=NULL; DSA *dsa = NULL;
int i,badops=0; int i, badops = 0;
const EVP_CIPHER *enc=NULL; const EVP_CIPHER *enc = NULL;
BIO *in=NULL,*out=NULL; BIO *in = NULL, *out = NULL;
int informat,outformat,text=0,noout=0; int informat, outformat, text = 0, noout = 0;
int pubin = 0, pubout = 0; int pubin = 0, pubout = 0;
char *infile,*outfile,*prog; char *infile, *outfile, *prog;
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
char *engine; char *engine;
#endif # endif
char *passargin = NULL, *passargout = NULL; char *passargin = NULL, *passargout = NULL;
char *passin = NULL, *passout = NULL; char *passin = NULL, *passout = NULL;
int modulus=0; int modulus = 0;
int pvk_encr = 2; int pvk_encr = 2;
apps_startup(); apps_startup();
if (bio_err == NULL) if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL) if ((bio_err = BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
if (!load_config(bio_err, NULL)) if (!load_config(bio_err, NULL))
goto end; goto end;
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
engine=NULL; engine = NULL;
#endif # endif
infile=NULL; infile = NULL;
outfile=NULL; outfile = NULL;
informat=FORMAT_PEM; informat = FORMAT_PEM;
outformat=FORMAT_PEM; outformat = FORMAT_PEM;
prog=argv[0]; prog = argv[0];
argc--; argc--;
argv++; argv++;
while (argc >= 1) while (argc >= 1) {
{ if (strcmp(*argv, "-inform") == 0) {
if (strcmp(*argv,"-inform") == 0) if (--argc < 1)
{ goto bad;
if (--argc < 1) goto bad; informat = str2fmt(*(++argv));
informat=str2fmt(*(++argv)); } else if (strcmp(*argv, "-outform") == 0) {
} if (--argc < 1)
else if (strcmp(*argv,"-outform") == 0) goto bad;
{ outformat = str2fmt(*(++argv));
if (--argc < 1) goto bad; } else if (strcmp(*argv, "-in") == 0) {
outformat=str2fmt(*(++argv)); if (--argc < 1)
} goto bad;
else if (strcmp(*argv,"-in") == 0) infile = *(++argv);
{ } else if (strcmp(*argv, "-out") == 0) {
if (--argc < 1) goto bad; if (--argc < 1)
infile= *(++argv); goto bad;
} outfile = *(++argv);
else if (strcmp(*argv,"-out") == 0) } else if (strcmp(*argv, "-passin") == 0) {
{ if (--argc < 1)
if (--argc < 1) goto bad; goto bad;
outfile= *(++argv); passargin = *(++argv);
} } else if (strcmp(*argv, "-passout") == 0) {
else if (strcmp(*argv,"-passin") == 0) if (--argc < 1)
{ goto bad;
if (--argc < 1) goto bad; passargout = *(++argv);
passargin= *(++argv); }
} # ifndef OPENSSL_NO_ENGINE
else if (strcmp(*argv,"-passout") == 0) else if (strcmp(*argv, "-engine") == 0) {
{ if (--argc < 1)
if (--argc < 1) goto bad; goto bad;
passargout= *(++argv); engine = *(++argv);
} }
#ifndef OPENSSL_NO_ENGINE # endif
else if (strcmp(*argv,"-engine") == 0) else if (strcmp(*argv, "-pvk-strong") == 0)
{ pvk_encr = 2;
if (--argc < 1) goto bad; else if (strcmp(*argv, "-pvk-weak") == 0)
engine= *(++argv); pvk_encr = 1;
} else if (strcmp(*argv, "-pvk-none") == 0)
#endif pvk_encr = 0;
else if (strcmp(*argv,"-pvk-strong") == 0) else if (strcmp(*argv, "-noout") == 0)
pvk_encr=2; noout = 1;
else if (strcmp(*argv,"-pvk-weak") == 0) else if (strcmp(*argv, "-text") == 0)
pvk_encr=1; text = 1;
else if (strcmp(*argv,"-pvk-none") == 0) else if (strcmp(*argv, "-modulus") == 0)
pvk_encr=0; modulus = 1;
else if (strcmp(*argv,"-noout") == 0) else if (strcmp(*argv, "-pubin") == 0)
noout=1; pubin = 1;
else if (strcmp(*argv,"-text") == 0) else if (strcmp(*argv, "-pubout") == 0)
text=1; pubout = 1;
else if (strcmp(*argv,"-modulus") == 0) else if ((enc = EVP_get_cipherbyname(&(argv[0][1]))) == NULL) {
modulus=1; BIO_printf(bio_err, "unknown option %s\n", *argv);
else if (strcmp(*argv,"-pubin") == 0) badops = 1;
pubin=1; break;
else if (strcmp(*argv,"-pubout") == 0) }
pubout=1; argc--;
else if ((enc=EVP_get_cipherbyname(&(argv[0][1]))) == NULL) argv++;
{ }
BIO_printf(bio_err,"unknown option %s\n",*argv);
badops=1;
break;
}
argc--;
argv++;
}
if (badops) if (badops) {
{ bad:
bad: BIO_printf(bio_err, "%s [options] <infile >outfile\n", prog);
BIO_printf(bio_err,"%s [options] <infile >outfile\n",prog); BIO_printf(bio_err, "where options are\n");
BIO_printf(bio_err,"where options are\n"); BIO_printf(bio_err, " -inform arg input format - DER or 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," -outform arg output format - DER or PEM\n"); BIO_printf(bio_err, " -in arg input file\n");
BIO_printf(bio_err," -in arg input file\n"); BIO_printf(bio_err,
BIO_printf(bio_err," -passin arg input file pass phrase source\n"); " -passin arg input file pass phrase source\n");
BIO_printf(bio_err," -out arg output file\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,
#ifndef OPENSSL_NO_ENGINE " -passout arg output file pass phrase source\n");
BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); # ifndef OPENSSL_NO_ENGINE
#endif BIO_printf(bio_err,
BIO_printf(bio_err," -des encrypt PEM output with cbc des\n"); " -engine e use engine e, possibly a hardware device.\n");
BIO_printf(bio_err," -des3 encrypt PEM output with ede cbc des using 168 bit key\n"); # endif
#ifndef OPENSSL_NO_IDEA BIO_printf(bio_err,
BIO_printf(bio_err," -idea encrypt PEM output with cbc idea\n"); " -des encrypt PEM output with cbc des\n");
#endif BIO_printf(bio_err,
#ifndef OPENSSL_NO_AES " -des3 encrypt PEM output with ede cbc des using 168 bit key\n");
BIO_printf(bio_err," -aes128, -aes192, -aes256\n"); # ifndef OPENSSL_NO_IDEA
BIO_printf(bio_err," encrypt PEM output with cbc aes\n"); BIO_printf(bio_err,
#endif " -idea encrypt PEM output with cbc idea\n");
#ifndef OPENSSL_NO_CAMELLIA # endif
BIO_printf(bio_err," -camellia128, -camellia192, -camellia256\n"); # ifndef OPENSSL_NO_AES
BIO_printf(bio_err," encrypt PEM output with cbc camellia\n"); BIO_printf(bio_err, " -aes128, -aes192, -aes256\n");
#endif BIO_printf(bio_err,
#ifndef OPENSSL_NO_SEED " encrypt PEM output with cbc aes\n");
BIO_printf(bio_err," -seed encrypt PEM output with cbc seed\n"); # endif
#endif # ifndef OPENSSL_NO_CAMELLIA
BIO_printf(bio_err," -text print the key in text\n"); BIO_printf(bio_err, " -camellia128, -camellia192, -camellia256\n");
BIO_printf(bio_err," -noout don't print key out\n"); BIO_printf(bio_err,
BIO_printf(bio_err," -modulus print the DSA public value\n"); " encrypt PEM output with cbc camellia\n");
goto end; # endif
} # ifndef OPENSSL_NO_SEED
BIO_printf(bio_err,
" -seed encrypt PEM output with cbc seed\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");
goto end;
}
ERR_load_crypto_strings(); ERR_load_crypto_strings();
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
e = setup_engine(bio_err, engine, 0); e = setup_engine(bio_err, engine, 0);
#endif # endif
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
BIO_printf(bio_err, "Error getting passwords\n"); BIO_printf(bio_err, "Error getting passwords\n");
goto end; goto end;
} }
in=BIO_new(BIO_s_file()); in = BIO_new(BIO_s_file());
out=BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file());
if ((in == NULL) || (out == NULL)) if ((in == NULL) || (out == NULL)) {
{ ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
}
if (infile == NULL) if (infile == NULL)
BIO_set_fp(in,stdin,BIO_NOCLOSE); BIO_set_fp(in, stdin, BIO_NOCLOSE);
else else {
{ if (BIO_read_filename(in, infile) <= 0) {
if (BIO_read_filename(in,infile) <= 0) perror(infile);
{ goto end;
perror(infile); }
goto end; }
}
}
BIO_printf(bio_err,"read DSA key\n"); BIO_printf(bio_err, "read DSA key\n");
{ {
EVP_PKEY *pkey; EVP_PKEY *pkey;
if (pubin) if (pubin)
pkey = load_pubkey(bio_err, infile, informat, 1, pkey = load_pubkey(bio_err, infile, informat, 1,
passin, e, "Public Key"); passin, e, "Public Key");
else else
pkey = load_key(bio_err, infile, informat, 1, pkey = load_key(bio_err, infile, informat, 1,
passin, e, "Private Key"); passin, e, "Private Key");
if (pkey) if (pkey) {
{ dsa = EVP_PKEY_get1_DSA(pkey);
dsa = EVP_PKEY_get1_DSA(pkey); EVP_PKEY_free(pkey);
EVP_PKEY_free(pkey); }
} }
} if (dsa == NULL) {
if (dsa == NULL) BIO_printf(bio_err, "unable to load Key\n");
{ ERR_print_errors(bio_err);
BIO_printf(bio_err,"unable to load Key\n"); goto end;
ERR_print_errors(bio_err); }
goto end;
}
if (outfile == NULL) if (outfile == NULL) {
{ BIO_set_fp(out, stdout, BIO_NOCLOSE);
BIO_set_fp(out,stdout,BIO_NOCLOSE); # ifdef OPENSSL_SYS_VMS
#ifdef OPENSSL_SYS_VMS {
{ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); out = BIO_push(tmpbio, out);
out = BIO_push(tmpbio, out); }
} # endif
#endif } else {
} if (BIO_write_filename(out, outfile) <= 0) {
else perror(outfile);
{ goto end;
if (BIO_write_filename(out,outfile) <= 0) }
{ }
perror(outfile);
goto end;
}
}
if (text) if (text)
if (!DSA_print(out,dsa,0)) if (!DSA_print(out, dsa, 0)) {
{ perror(outfile);
perror(outfile); ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
}
if (modulus) if (modulus) {
{ fprintf(stdout, "Public Key=");
fprintf(stdout,"Public Key="); BN_print(out, dsa->pub_key);
BN_print(out,dsa->pub_key); fprintf(stdout, "\n");
fprintf(stdout,"\n"); }
}
if (noout) goto end; if (noout)
BIO_printf(bio_err,"writing DSA key\n"); goto end;
if (outformat == FORMAT_ASN1) { BIO_printf(bio_err, "writing DSA key\n");
if(pubin || pubout) i=i2d_DSA_PUBKEY_bio(out,dsa); if (outformat == FORMAT_ASN1) {
else i=i2d_DSAPrivateKey_bio(out,dsa); if (pubin || pubout)
} else if (outformat == FORMAT_PEM) { i = i2d_DSA_PUBKEY_bio(out, dsa);
if(pubin || pubout) else
i=PEM_write_bio_DSA_PUBKEY(out,dsa); i = i2d_DSAPrivateKey_bio(out, dsa);
else i=PEM_write_bio_DSAPrivateKey(out,dsa,enc, } else if (outformat == FORMAT_PEM) {
NULL,0,NULL, passout); if (pubin || pubout)
#if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_RC4) i = PEM_write_bio_DSA_PUBKEY(out, dsa);
} else if (outformat == FORMAT_MSBLOB || outformat == FORMAT_PVK) { else
EVP_PKEY *pk; i = PEM_write_bio_DSAPrivateKey(out, dsa, enc,
pk = EVP_PKEY_new(); NULL, 0, NULL, passout);
EVP_PKEY_set1_DSA(pk, dsa); # if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_RC4)
if (outformat == FORMAT_PVK) } else if (outformat == FORMAT_MSBLOB || outformat == FORMAT_PVK) {
i = i2b_PVK_bio(out, pk, pvk_encr, 0, passout); EVP_PKEY *pk;
else if (pubin || pubout) pk = EVP_PKEY_new();
i = i2b_PublicKey_bio(out, pk); EVP_PKEY_set1_DSA(pk, dsa);
else if (outformat == FORMAT_PVK)
i = i2b_PrivateKey_bio(out, pk); i = i2b_PVK_bio(out, pk, pvk_encr, 0, passout);
EVP_PKEY_free(pk); else if (pubin || pubout)
#endif i = i2b_PublicKey_bio(out, pk);
} else { else
BIO_printf(bio_err,"bad output format specified for outfile\n"); i = i2b_PrivateKey_bio(out, pk);
goto end; EVP_PKEY_free(pk);
} # endif
if (i <= 0) } else {
{ BIO_printf(bio_err, "bad output format specified for outfile\n");
BIO_printf(bio_err,"unable to write private key\n"); goto end;
ERR_print_errors(bio_err); }
} if (i <= 0) {
else BIO_printf(bio_err, "unable to write private key\n");
ret=0; ERR_print_errors(bio_err);
end: } else
if(in != NULL) BIO_free(in); ret = 0;
if(out != NULL) BIO_free_all(out); end:
if(dsa != NULL) DSA_free(dsa); if (in != NULL)
if(passin) OPENSSL_free(passin); BIO_free(in);
if(passout) OPENSSL_free(passout); if (out != NULL)
apps_shutdown(); BIO_free_all(out);
OPENSSL_EXIT(ret); if (dsa != NULL)
} DSA_free(dsa);
#else /* !OPENSSL_NO_DSA */ if (passin)
OPENSSL_free(passin);
if (passout)
OPENSSL_free(passout);
apps_shutdown();
OPENSSL_EXIT(ret);
}
#else /* !OPENSSL_NO_DSA */
# if PEDANTIC # if PEDANTIC
static void *dummy=&dummy; static void *dummy = &dummy;
# endif # endif
#endif #endif

Binary file not shown.

View File

@@ -56,34 +56,37 @@
* [including the GNU Public Licence.] * [including the GNU Public Licence.]
*/ */
#include <openssl/opensslconf.h> /* for OPENSSL_NO_DSA */ #include <openssl/opensslconf.h> /* for OPENSSL_NO_DSA */
/* Until the key-gen callbacks are modified to use newer prototypes, we allow /*
* deprecated functions for openssl-internal code */ * Until the key-gen callbacks are modified to use newer prototypes, we allow
* deprecated functions for openssl-internal code
*/
#ifdef OPENSSL_NO_DEPRECATED #ifdef OPENSSL_NO_DEPRECATED
#undef OPENSSL_NO_DEPRECATED # undef OPENSSL_NO_DEPRECATED
#endif #endif
#ifndef OPENSSL_NO_DSA #ifndef OPENSSL_NO_DSA
#include <assert.h> # include <assert.h>
#include <stdio.h> # include <stdio.h>
#include <stdlib.h> # include <stdlib.h>
#include <time.h> # include <time.h>
#include <string.h> # include <string.h>
#include "apps.h" # include "apps.h"
#include <openssl/bio.h> # include <openssl/bio.h>
#include <openssl/err.h> # include <openssl/err.h>
#include <openssl/bn.h> # include <openssl/bn.h>
#include <openssl/dsa.h> # include <openssl/dsa.h>
#include <openssl/x509.h> # include <openssl/x509.h>
#include <openssl/pem.h> # include <openssl/pem.h>
#undef PROG # undef PROG
#define PROG dsaparam_main # define PROG dsaparam_main
/* -inform arg - input format - default PEM (DER or PEM) /*-
* -inform arg - input format - default PEM (DER or PEM)
* -outform arg - output format - default PEM * -outform arg - output format - default PEM
* -in arg - input file - default stdin * -in arg - input file - default stdin
* -out arg - output file - default stdout * -out arg - output file - default stdout
* -noout * -noout
* -text * -text
* -C * -C
@@ -94,386 +97,373 @@
* #endif * #endif
*/ */
#ifdef GENCB_TEST # ifdef GENCB_TEST
static int stop_keygen_flag = 0; static int stop_keygen_flag = 0;
static void timebomb_sigalarm(int foo) static void timebomb_sigalarm(int foo)
{ {
stop_keygen_flag = 1; stop_keygen_flag = 1;
} }
#endif # endif
static int MS_CALLBACK dsa_cb(int p, int n, BN_GENCB *cb); static int MS_CALLBACK dsa_cb(int p, int n, BN_GENCB *cb);
int MAIN(int, char **); int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
DSA *dsa=NULL; DSA *dsa = NULL;
int i,badops=0,text=0; int i, badops = 0, text = 0;
BIO *in=NULL,*out=NULL; BIO *in = NULL, *out = NULL;
int informat,outformat,noout=0,C=0,ret=1; int informat, outformat, noout = 0, C = 0, ret = 1;
char *infile,*outfile,*prog,*inrand=NULL; char *infile, *outfile, *prog, *inrand = NULL;
int numbits= -1,num,genkey=0; int numbits = -1, num, genkey = 0;
int need_rand=0; int need_rand = 0;
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
char *engine=NULL; char *engine = NULL;
#endif # endif
#ifdef GENCB_TEST # ifdef GENCB_TEST
int timebomb=0; int timebomb = 0;
#endif # endif
apps_startup(); apps_startup();
if (bio_err == NULL) if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL) if ((bio_err = BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
if (!load_config(bio_err, NULL)) if (!load_config(bio_err, NULL))
goto end; goto end;
infile=NULL; infile = NULL;
outfile=NULL; outfile = NULL;
informat=FORMAT_PEM; informat = FORMAT_PEM;
outformat=FORMAT_PEM; outformat = FORMAT_PEM;
prog=argv[0]; prog = argv[0];
argc--; argc--;
argv++; argv++;
while (argc >= 1) while (argc >= 1) {
{ if (strcmp(*argv, "-inform") == 0) {
if (strcmp(*argv,"-inform") == 0) if (--argc < 1)
{ goto bad;
if (--argc < 1) goto bad; informat = str2fmt(*(++argv));
informat=str2fmt(*(++argv)); } else if (strcmp(*argv, "-outform") == 0) {
} if (--argc < 1)
else if (strcmp(*argv,"-outform") == 0) goto bad;
{ outformat = str2fmt(*(++argv));
if (--argc < 1) goto bad; } else if (strcmp(*argv, "-in") == 0) {
outformat=str2fmt(*(++argv)); if (--argc < 1)
} goto bad;
else if (strcmp(*argv,"-in") == 0) infile = *(++argv);
{ } else if (strcmp(*argv, "-out") == 0) {
if (--argc < 1) goto bad; if (--argc < 1)
infile= *(++argv); goto bad;
} outfile = *(++argv);
else if (strcmp(*argv,"-out") == 0) }
{ # ifndef OPENSSL_NO_ENGINE
if (--argc < 1) goto bad; else if (strcmp(*argv, "-engine") == 0) {
outfile= *(++argv); if (--argc < 1)
} goto bad;
#ifndef OPENSSL_NO_ENGINE engine = *(++argv);
else if(strcmp(*argv, "-engine") == 0) }
{ # endif
if (--argc < 1) goto bad; # ifdef GENCB_TEST
engine = *(++argv); else if (strcmp(*argv, "-timebomb") == 0) {
} if (--argc < 1)
#endif goto bad;
#ifdef GENCB_TEST timebomb = atoi(*(++argv));
else if(strcmp(*argv, "-timebomb") == 0) }
{ # endif
if (--argc < 1) goto bad; else if (strcmp(*argv, "-text") == 0)
timebomb = atoi(*(++argv)); text = 1;
} else if (strcmp(*argv, "-C") == 0)
#endif C = 1;
else if (strcmp(*argv,"-text") == 0) else if (strcmp(*argv, "-genkey") == 0) {
text=1; genkey = 1;
else if (strcmp(*argv,"-C") == 0) need_rand = 1;
C=1; } else if (strcmp(*argv, "-rand") == 0) {
else if (strcmp(*argv,"-genkey") == 0) if (--argc < 1)
{ goto bad;
genkey=1; inrand = *(++argv);
need_rand=1; need_rand = 1;
} } else if (strcmp(*argv, "-noout") == 0)
else if (strcmp(*argv,"-rand") == 0) noout = 1;
{ else if (sscanf(*argv, "%d", &num) == 1) {
if (--argc < 1) goto bad; /* generate a key */
inrand= *(++argv); numbits = num;
need_rand=1; need_rand = 1;
} } else {
else if (strcmp(*argv,"-noout") == 0) BIO_printf(bio_err, "unknown option %s\n", *argv);
noout=1; badops = 1;
else if (sscanf(*argv,"%d",&num) == 1) break;
{ }
/* generate a key */ argc--;
numbits=num; argv++;
need_rand=1; }
}
else
{
BIO_printf(bio_err,"unknown option %s\n",*argv);
badops=1;
break;
}
argc--;
argv++;
}
if (badops) if (badops) {
{ bad:
bad: BIO_printf(bio_err, "%s [options] [bits] <infile >outfile\n", prog);
BIO_printf(bio_err,"%s [options] [bits] <infile >outfile\n",prog); BIO_printf(bio_err, "where options are\n");
BIO_printf(bio_err,"where options are\n"); BIO_printf(bio_err, " -inform arg input format - DER or 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," -outform arg output format - DER or PEM\n"); BIO_printf(bio_err, " -in arg input file\n");
BIO_printf(bio_err," -in arg input file\n"); BIO_printf(bio_err, " -out arg output file\n");
BIO_printf(bio_err," -out arg output file\n"); BIO_printf(bio_err, " -text print as text\n");
BIO_printf(bio_err," -text print as text\n"); BIO_printf(bio_err, " -C Output C code\n");
BIO_printf(bio_err," -C Output C code\n"); BIO_printf(bio_err, " -noout no output\n");
BIO_printf(bio_err," -noout no output\n"); BIO_printf(bio_err, " -genkey generate a DSA key\n");
BIO_printf(bio_err," -genkey generate a DSA key\n"); BIO_printf(bio_err,
BIO_printf(bio_err," -rand files to use for random number input\n"); " -rand files to use for random number input\n");
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); BIO_printf(bio_err,
#endif " -engine e use engine e, possibly a hardware device.\n");
#ifdef GENCB_TEST # endif
BIO_printf(bio_err," -timebomb n interrupt keygen after <n> seconds\n"); # ifdef GENCB_TEST
#endif BIO_printf(bio_err,
BIO_printf(bio_err," number number of bits to use for generating private key\n"); " -timebomb n interrupt keygen after <n> seconds\n");
goto end; # endif
} BIO_printf(bio_err,
" number number of bits to use for generating private key\n");
goto end;
}
ERR_load_crypto_strings(); ERR_load_crypto_strings();
in=BIO_new(BIO_s_file()); in = BIO_new(BIO_s_file());
out=BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file());
if ((in == NULL) || (out == NULL)) if ((in == NULL) || (out == NULL)) {
{ ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
}
if (infile == NULL) if (infile == NULL)
BIO_set_fp(in,stdin,BIO_NOCLOSE); BIO_set_fp(in, stdin, BIO_NOCLOSE);
else else {
{ if (BIO_read_filename(in, infile) <= 0) {
if (BIO_read_filename(in,infile) <= 0) perror(infile);
{ goto end;
perror(infile); }
goto end; }
} if (outfile == NULL) {
} BIO_set_fp(out, stdout, BIO_NOCLOSE);
if (outfile == NULL) # ifdef OPENSSL_SYS_VMS
{ {
BIO_set_fp(out,stdout,BIO_NOCLOSE); BIO *tmpbio = BIO_new(BIO_f_linebuffer());
#ifdef OPENSSL_SYS_VMS out = BIO_push(tmpbio, out);
{ }
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); # endif
out = BIO_push(tmpbio, out); } else {
} if (BIO_write_filename(out, outfile) <= 0) {
#endif perror(outfile);
} goto end;
else }
{ }
if (BIO_write_filename(out,outfile) <= 0)
{
perror(outfile);
goto end;
}
}
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
setup_engine(bio_err, engine, 0); setup_engine(bio_err, engine, 0);
#endif # endif
if (need_rand) if (need_rand) {
{ app_RAND_load_file(NULL, bio_err, (inrand != NULL));
app_RAND_load_file(NULL, bio_err, (inrand != NULL)); if (inrand != NULL)
if (inrand != NULL) BIO_printf(bio_err, "%ld semi-random bytes loaded\n",
BIO_printf(bio_err,"%ld semi-random bytes loaded\n", app_RAND_load_files(inrand));
app_RAND_load_files(inrand)); }
}
if (numbits > 0) if (numbits > 0) {
{ BN_GENCB cb;
BN_GENCB cb; BN_GENCB_set(&cb, dsa_cb, bio_err);
BN_GENCB_set(&cb, dsa_cb, bio_err); assert(need_rand);
assert(need_rand); dsa = DSA_new();
dsa = DSA_new(); if (!dsa) {
if(!dsa) BIO_printf(bio_err, "Error allocating DSA object\n");
{ goto end;
BIO_printf(bio_err,"Error allocating DSA object\n"); }
goto end; BIO_printf(bio_err, "Generating DSA parameters, %d bit long prime\n",
} num);
BIO_printf(bio_err,"Generating DSA parameters, %d bit long prime\n",num); BIO_printf(bio_err, "This could take some time\n");
BIO_printf(bio_err,"This could take some time\n"); # ifdef GENCB_TEST
#ifdef GENCB_TEST if (timebomb > 0) {
if(timebomb > 0) struct sigaction act;
{ act.sa_handler = timebomb_sigalarm;
struct sigaction act; act.sa_flags = 0;
act.sa_handler = timebomb_sigalarm; BIO_printf(bio_err,
act.sa_flags = 0; "(though I'll stop it if not done within %d secs)\n",
BIO_printf(bio_err,"(though I'll stop it if not done within %d secs)\n", timebomb);
timebomb); if (sigaction(SIGALRM, &act, NULL) != 0) {
if(sigaction(SIGALRM, &act, NULL) != 0) BIO_printf(bio_err, "Error, couldn't set SIGALRM handler\n");
{ goto end;
BIO_printf(bio_err,"Error, couldn't set SIGALRM handler\n"); }
goto end; alarm(timebomb);
} }
alarm(timebomb); # endif
} if (!DSA_generate_parameters_ex(dsa, num, NULL, 0, NULL, NULL, &cb)) {
#endif # ifdef GENCB_TEST
if(!DSA_generate_parameters_ex(dsa,num,NULL,0,NULL,NULL, &cb)) if (stop_keygen_flag) {
{ BIO_printf(bio_err, "DSA key generation time-stopped\n");
#ifdef GENCB_TEST /* This is an asked-for behaviour! */
if(stop_keygen_flag) ret = 0;
{ goto end;
BIO_printf(bio_err,"DSA key generation time-stopped\n"); }
/* This is an asked-for behaviour! */ # endif
ret = 0; ERR_print_errors(bio_err);
goto end; BIO_printf(bio_err, "Error, DSA key generation failed\n");
} goto end;
#endif }
BIO_printf(bio_err,"Error, DSA key generation failed\n"); } else if (informat == FORMAT_ASN1)
goto end; dsa = d2i_DSAparams_bio(in, NULL);
} else if (informat == FORMAT_PEM)
} dsa = PEM_read_bio_DSAparams(in, NULL, NULL, NULL);
else if (informat == FORMAT_ASN1) else {
dsa=d2i_DSAparams_bio(in,NULL); BIO_printf(bio_err, "bad input format specified\n");
else if (informat == FORMAT_PEM) goto end;
dsa=PEM_read_bio_DSAparams(in,NULL,NULL,NULL); }
else if (dsa == NULL) {
{ BIO_printf(bio_err, "unable to load DSA parameters\n");
BIO_printf(bio_err,"bad input format specified\n"); ERR_print_errors(bio_err);
goto end; goto end;
} }
if (dsa == NULL)
{
BIO_printf(bio_err,"unable to load DSA parameters\n");
ERR_print_errors(bio_err);
goto end;
}
if (text) if (text) {
{ DSAparams_print(out, dsa);
DSAparams_print(out,dsa); }
}
if (C) if (C) {
{ unsigned char *data;
unsigned char *data; int l, len, bits_p;
int l,len,bits_p;
len=BN_num_bytes(dsa->p); len = BN_num_bytes(dsa->p);
bits_p=BN_num_bits(dsa->p); bits_p = BN_num_bits(dsa->p);
data=(unsigned char *)OPENSSL_malloc(len+20); data = (unsigned char *)OPENSSL_malloc(len + 20);
if (data == NULL) if (data == NULL) {
{ perror("OPENSSL_malloc");
perror("OPENSSL_malloc"); goto end;
goto end; }
} l = BN_bn2bin(dsa->p, data);
l=BN_bn2bin(dsa->p,data); printf("static unsigned char dsa%d_p[]={", bits_p);
printf("static unsigned char dsa%d_p[]={",bits_p); for (i = 0; i < l; i++) {
for (i=0; i<l; i++) if ((i % 12) == 0)
{ printf("\n\t");
if ((i%12) == 0) printf("\n\t"); printf("0x%02X,", data[i]);
printf("0x%02X,",data[i]); }
} printf("\n\t};\n");
printf("\n\t};\n");
l=BN_bn2bin(dsa->q,data); l = BN_bn2bin(dsa->q, data);
printf("static unsigned char dsa%d_q[]={",bits_p); printf("static unsigned char dsa%d_q[]={", bits_p);
for (i=0; i<l; i++) for (i = 0; i < l; i++) {
{ if ((i % 12) == 0)
if ((i%12) == 0) printf("\n\t"); printf("\n\t");
printf("0x%02X,",data[i]); printf("0x%02X,", data[i]);
} }
printf("\n\t};\n"); printf("\n\t};\n");
l=BN_bn2bin(dsa->g,data); l = BN_bn2bin(dsa->g, data);
printf("static unsigned char dsa%d_g[]={",bits_p); printf("static unsigned char dsa%d_g[]={", bits_p);
for (i=0; i<l; i++) for (i = 0; i < l; i++) {
{ if ((i % 12) == 0)
if ((i%12) == 0) printf("\n\t"); printf("\n\t");
printf("0x%02X,",data[i]); printf("0x%02X,", data[i]);
} }
printf("\n\t};\n\n"); printf("\n\t};\n\n");
printf("DSA *get_dsa%d()\n\t{\n",bits_p); printf("DSA *get_dsa%d()\n\t{\n", bits_p);
printf("\tDSA *dsa;\n\n"); printf("\tDSA *dsa;\n\n");
printf("\tif ((dsa=DSA_new()) == NULL) return(NULL);\n"); printf("\tif ((dsa=DSA_new()) == NULL) return(NULL);\n");
printf("\tdsa->p=BN_bin2bn(dsa%d_p,sizeof(dsa%d_p),NULL);\n", printf("\tdsa->p=BN_bin2bn(dsa%d_p,sizeof(dsa%d_p),NULL);\n",
bits_p,bits_p); bits_p, bits_p);
printf("\tdsa->q=BN_bin2bn(dsa%d_q,sizeof(dsa%d_q),NULL);\n", printf("\tdsa->q=BN_bin2bn(dsa%d_q,sizeof(dsa%d_q),NULL);\n",
bits_p,bits_p); bits_p, bits_p);
printf("\tdsa->g=BN_bin2bn(dsa%d_g,sizeof(dsa%d_g),NULL);\n", printf("\tdsa->g=BN_bin2bn(dsa%d_g,sizeof(dsa%d_g),NULL);\n",
bits_p,bits_p); bits_p, bits_p);
printf("\tif ((dsa->p == NULL) || (dsa->q == NULL) || (dsa->g == NULL))\n"); printf
printf("\t\t{ DSA_free(dsa); return(NULL); }\n"); ("\tif ((dsa->p == NULL) || (dsa->q == NULL) || (dsa->g == NULL))\n");
printf("\treturn(dsa);\n\t}\n"); printf("\t\t{ DSA_free(dsa); return(NULL); }\n");
} printf("\treturn(dsa);\n\t}\n");
}
if (!noout) {
if (outformat == FORMAT_ASN1)
i = i2d_DSAparams_bio(out, dsa);
else if (outformat == FORMAT_PEM)
i = PEM_write_bio_DSAparams(out, dsa);
else {
BIO_printf(bio_err, "bad output format specified for outfile\n");
goto end;
}
if (!i) {
BIO_printf(bio_err, "unable to write DSA parameters\n");
ERR_print_errors(bio_err);
goto end;
}
}
if (genkey) {
DSA *dsakey;
if (!noout) assert(need_rand);
{ if ((dsakey = DSAparams_dup(dsa)) == NULL)
if (outformat == FORMAT_ASN1) goto end;
i=i2d_DSAparams_bio(out,dsa); if (!DSA_generate_key(dsakey)) {
else if (outformat == FORMAT_PEM) ERR_print_errors(bio_err);
i=PEM_write_bio_DSAparams(out,dsa); DSA_free(dsakey);
else { goto end;
BIO_printf(bio_err,"bad output format specified for outfile\n"); }
goto end; if (outformat == FORMAT_ASN1)
} i = i2d_DSAPrivateKey_bio(out, dsakey);
if (!i) else if (outformat == FORMAT_PEM)
{ i = PEM_write_bio_DSAPrivateKey(out, dsakey, NULL, NULL, 0, NULL,
BIO_printf(bio_err,"unable to write DSA parameters\n"); NULL);
ERR_print_errors(bio_err); else {
goto end; BIO_printf(bio_err, "bad output format specified for outfile\n");
} DSA_free(dsakey);
} goto end;
if (genkey) }
{ DSA_free(dsakey);
DSA *dsakey; }
if (need_rand)
assert(need_rand); app_RAND_write_file(NULL, bio_err);
if ((dsakey=DSAparams_dup(dsa)) == NULL) goto end; ret = 0;
if (!DSA_generate_key(dsakey)) goto end; end:
if (outformat == FORMAT_ASN1) if (in != NULL)
i=i2d_DSAPrivateKey_bio(out,dsakey); BIO_free(in);
else if (outformat == FORMAT_PEM) if (out != NULL)
i=PEM_write_bio_DSAPrivateKey(out,dsakey,NULL,NULL,0,NULL,NULL); BIO_free_all(out);
else { if (dsa != NULL)
BIO_printf(bio_err,"bad output format specified for outfile\n"); DSA_free(dsa);
goto end; apps_shutdown();
} OPENSSL_EXIT(ret);
DSA_free(dsakey); }
}
if (need_rand)
app_RAND_write_file(NULL, bio_err);
ret=0;
end:
if (in != NULL) BIO_free(in);
if (out != NULL) BIO_free_all(out);
if (dsa != NULL) DSA_free(dsa);
apps_shutdown();
OPENSSL_EXIT(ret);
}
static int MS_CALLBACK dsa_cb(int p, int n, BN_GENCB *cb) static int MS_CALLBACK dsa_cb(int p, int n, BN_GENCB *cb)
{ {
char c='*'; char c = '*';
if (p == 0) c='.'; if (p == 0)
if (p == 1) c='+'; c = '.';
if (p == 2) c='*'; if (p == 1)
if (p == 3) c='\n'; c = '+';
BIO_write(cb->arg,&c,1); if (p == 2)
(void)BIO_flush(cb->arg); c = '*';
#ifdef LINT if (p == 3)
p=n; c = '\n';
#endif BIO_write(cb->arg, &c, 1);
#ifdef GENCB_TEST (void)BIO_flush(cb->arg);
if(stop_keygen_flag) # ifdef LINT
return 0; p = n;
#endif # endif
return 1; # ifdef GENCB_TEST
} if (stop_keygen_flag)
#else /* !OPENSSL_NO_DSA */ return 0;
# endif
return 1;
}
#else /* !OPENSSL_NO_DSA */
# if PEDANTIC # if PEDANTIC
static void *dummy=&dummy; static void *dummy = &dummy;
# endif # endif
#endif #endif

Binary file not shown.

567
apps/ec.c
View File

@@ -58,19 +58,20 @@
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#ifndef OPENSSL_NO_EC #ifndef OPENSSL_NO_EC
#include <stdio.h> # include <stdio.h>
#include <stdlib.h> # include <stdlib.h>
#include <string.h> # include <string.h>
#include "apps.h" # include "apps.h"
#include <openssl/bio.h> # include <openssl/bio.h>
#include <openssl/err.h> # include <openssl/err.h>
#include <openssl/evp.h> # include <openssl/evp.h>
#include <openssl/pem.h> # include <openssl/pem.h>
#undef PROG # undef PROG
#define PROG ec_main # define PROG ec_main
/* -inform arg - input format - default PEM (one of DER, NET or PEM) /*-
* -inform arg - input format - default PEM (one of DER, NET or PEM)
* -outform arg - output format - default PEM * -outform arg - output format - default PEM
* -in arg - input file - default stdin * -in arg - input file - default stdin
* -out arg - output file - default stdout * -out arg - output file - default stdout
@@ -85,322 +86,280 @@ int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
int ret = 1; int ret = 1;
EC_KEY *eckey = NULL; EC_KEY *eckey = NULL;
const EC_GROUP *group; const EC_GROUP *group;
int i, badops = 0; int i, badops = 0;
const EVP_CIPHER *enc = NULL; const EVP_CIPHER *enc = NULL;
BIO *in = NULL, *out = NULL; BIO *in = NULL, *out = NULL;
int informat, outformat, text=0, noout=0; int informat, outformat, text = 0, noout = 0;
int pubin = 0, pubout = 0, param_out = 0; int pubin = 0, pubout = 0, param_out = 0;
char *infile, *outfile, *prog, *engine; char *infile, *outfile, *prog, *engine;
char *passargin = NULL, *passargout = NULL; char *passargin = NULL, *passargout = NULL;
char *passin = NULL, *passout = NULL; char *passin = NULL, *passout = NULL;
point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED; point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED;
int new_form = 0; int new_form = 0;
int asn1_flag = OPENSSL_EC_NAMED_CURVE; int asn1_flag = OPENSSL_EC_NAMED_CURVE;
int new_asn1_flag = 0; int new_asn1_flag = 0;
apps_startup(); apps_startup();
if (bio_err == NULL) if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL) if ((bio_err = BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err, stderr, BIO_NOCLOSE|BIO_FP_TEXT); BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
if (!load_config(bio_err, NULL)) if (!load_config(bio_err, NULL))
goto end; goto end;
engine = NULL; engine = NULL;
infile = NULL; infile = NULL;
outfile = NULL; outfile = NULL;
informat = FORMAT_PEM; informat = FORMAT_PEM;
outformat = FORMAT_PEM; outformat = FORMAT_PEM;
prog = argv[0]; prog = argv[0];
argc--; argc--;
argv++; argv++;
while (argc >= 1) while (argc >= 1) {
{ if (strcmp(*argv, "-inform") == 0) {
if (strcmp(*argv,"-inform") == 0) if (--argc < 1)
{ goto bad;
if (--argc < 1) goto bad; informat = str2fmt(*(++argv));
informat=str2fmt(*(++argv)); } else if (strcmp(*argv, "-outform") == 0) {
} if (--argc < 1)
else if (strcmp(*argv,"-outform") == 0) goto bad;
{ outformat = str2fmt(*(++argv));
if (--argc < 1) goto bad; } else if (strcmp(*argv, "-in") == 0) {
outformat=str2fmt(*(++argv)); if (--argc < 1)
} goto bad;
else if (strcmp(*argv,"-in") == 0) infile = *(++argv);
{ } else if (strcmp(*argv, "-out") == 0) {
if (--argc < 1) goto bad; if (--argc < 1)
infile= *(++argv); goto bad;
} outfile = *(++argv);
else if (strcmp(*argv,"-out") == 0) } else if (strcmp(*argv, "-passin") == 0) {
{ if (--argc < 1)
if (--argc < 1) goto bad; goto bad;
outfile= *(++argv); passargin = *(++argv);
} } else if (strcmp(*argv, "-passout") == 0) {
else if (strcmp(*argv,"-passin") == 0) if (--argc < 1)
{ goto bad;
if (--argc < 1) goto bad; passargout = *(++argv);
passargin= *(++argv); } else if (strcmp(*argv, "-engine") == 0) {
} if (--argc < 1)
else if (strcmp(*argv,"-passout") == 0) goto bad;
{ engine = *(++argv);
if (--argc < 1) goto bad; } else if (strcmp(*argv, "-noout") == 0)
passargout= *(++argv); noout = 1;
} else if (strcmp(*argv, "-text") == 0)
else if (strcmp(*argv, "-engine") == 0) text = 1;
{ else if (strcmp(*argv, "-conv_form") == 0) {
if (--argc < 1) goto bad; if (--argc < 1)
engine= *(++argv); goto bad;
} ++argv;
else if (strcmp(*argv, "-noout") == 0) new_form = 1;
noout = 1; if (strcmp(*argv, "compressed") == 0)
else if (strcmp(*argv, "-text") == 0) form = POINT_CONVERSION_COMPRESSED;
text = 1; else if (strcmp(*argv, "uncompressed") == 0)
else if (strcmp(*argv, "-conv_form") == 0) form = POINT_CONVERSION_UNCOMPRESSED;
{ else if (strcmp(*argv, "hybrid") == 0)
if (--argc < 1) form = POINT_CONVERSION_HYBRID;
goto bad; else
++argv; goto bad;
new_form = 1; } else if (strcmp(*argv, "-param_enc") == 0) {
if (strcmp(*argv, "compressed") == 0) if (--argc < 1)
form = POINT_CONVERSION_COMPRESSED; goto bad;
else if (strcmp(*argv, "uncompressed") == 0) ++argv;
form = POINT_CONVERSION_UNCOMPRESSED; new_asn1_flag = 1;
else if (strcmp(*argv, "hybrid") == 0) if (strcmp(*argv, "named_curve") == 0)
form = POINT_CONVERSION_HYBRID; asn1_flag = OPENSSL_EC_NAMED_CURVE;
else else if (strcmp(*argv, "explicit") == 0)
goto bad; asn1_flag = 0;
} else
else if (strcmp(*argv, "-param_enc") == 0) goto bad;
{ } else if (strcmp(*argv, "-param_out") == 0)
if (--argc < 1) param_out = 1;
goto bad; else if (strcmp(*argv, "-pubin") == 0)
++argv; pubin = 1;
new_asn1_flag = 1; else if (strcmp(*argv, "-pubout") == 0)
if (strcmp(*argv, "named_curve") == 0) pubout = 1;
asn1_flag = OPENSSL_EC_NAMED_CURVE; else if ((enc = EVP_get_cipherbyname(&(argv[0][1]))) == NULL) {
else if (strcmp(*argv, "explicit") == 0) BIO_printf(bio_err, "unknown option %s\n", *argv);
asn1_flag = 0; badops = 1;
else break;
goto bad; }
} argc--;
else if (strcmp(*argv, "-param_out") == 0) argv++;
param_out = 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);
badops=1;
break;
}
argc--;
argv++;
}
if (badops) if (badops) {
{ bad:
bad: BIO_printf(bio_err, "%s [options] <infile >outfile\n", prog);
BIO_printf(bio_err, "%s [options] <infile >outfile\n", prog); BIO_printf(bio_err, "where options are\n");
BIO_printf(bio_err, "where options are\n"); BIO_printf(bio_err, " -inform arg input format - "
BIO_printf(bio_err, " -inform arg input format - " "DER or PEM\n");
"DER or PEM\n"); BIO_printf(bio_err, " -outform arg output format - "
BIO_printf(bio_err, " -outform arg output format - " "DER or PEM\n");
"DER or PEM\n"); BIO_printf(bio_err, " -in arg input file\n");
BIO_printf(bio_err, " -in arg input file\n"); BIO_printf(bio_err, " -passin arg input file pass "
BIO_printf(bio_err, " -passin arg input file pass " "phrase source\n");
"phrase source\n"); BIO_printf(bio_err, " -out arg output file\n");
BIO_printf(bio_err, " -out arg output file\n"); BIO_printf(bio_err, " -passout arg output file pass "
BIO_printf(bio_err, " -passout arg output file pass " "phrase source\n");
"phrase source\n"); BIO_printf(bio_err, " -engine e use engine e, "
BIO_printf(bio_err, " -engine e use engine e, " "possibly a hardware device.\n");
"possibly a hardware device.\n"); BIO_printf(bio_err, " -des encrypt PEM output, "
BIO_printf(bio_err, " -des encrypt PEM output, " "instead of 'des' every other \n"
"instead of 'des' every other \n" " cipher "
" cipher " "supported by OpenSSL can be used\n");
"supported by OpenSSL can be used\n"); BIO_printf(bio_err, " -text print the key\n");
BIO_printf(bio_err, " -text print the key\n"); BIO_printf(bio_err, " -noout don't print key out\n");
BIO_printf(bio_err, " -noout don't print key out\n"); BIO_printf(bio_err, " -param_out print the elliptic "
BIO_printf(bio_err, " -param_out print the elliptic " "curve parameters\n");
"curve parameters\n"); BIO_printf(bio_err, " -conv_form arg specifies the "
BIO_printf(bio_err, " -conv_form arg specifies the " "point conversion form \n");
"point conversion form \n"); BIO_printf(bio_err, " possible values:"
BIO_printf(bio_err, " possible values:" " compressed\n");
" compressed\n"); BIO_printf(bio_err, " "
BIO_printf(bio_err, " " " uncompressed (default)\n");
" uncompressed (default)\n"); BIO_printf(bio_err, " " " hybrid\n");
BIO_printf(bio_err, " " BIO_printf(bio_err, " -param_enc arg specifies the way"
" hybrid\n"); " the ec parameters are encoded\n");
BIO_printf(bio_err, " -param_enc arg specifies the way" BIO_printf(bio_err, " in the asn1 der " "encoding\n");
" the ec parameters are encoded\n"); BIO_printf(bio_err, " possible values:"
BIO_printf(bio_err, " in the asn1 der " " named_curve (default)\n");
"encoding\n"); BIO_printf(bio_err, " "
BIO_printf(bio_err, " possible values:" "explicit\n");
" named_curve (default)\n"); goto end;
BIO_printf(bio_err," " }
"explicit\n");
goto end;
}
ERR_load_crypto_strings(); ERR_load_crypto_strings();
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
setup_engine(bio_err, engine, 0); setup_engine(bio_err, engine, 0);
#endif # endif
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
{ BIO_printf(bio_err, "Error getting passwords\n");
BIO_printf(bio_err, "Error getting passwords\n"); goto end;
goto end; }
}
in = BIO_new(BIO_s_file()); in = BIO_new(BIO_s_file());
out = BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file());
if ((in == NULL) || (out == NULL)) if ((in == NULL) || (out == NULL)) {
{ ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
}
if (infile == NULL) if (infile == NULL)
BIO_set_fp(in, stdin, BIO_NOCLOSE); BIO_set_fp(in, stdin, BIO_NOCLOSE);
else else {
{ if (BIO_read_filename(in, infile) <= 0) {
if (BIO_read_filename(in, infile) <= 0) perror(infile);
{ goto end;
perror(infile); }
goto end; }
}
}
BIO_printf(bio_err, "read EC key\n"); BIO_printf(bio_err, "read EC key\n");
if (informat == FORMAT_ASN1) if (informat == FORMAT_ASN1) {
{ if (pubin)
if (pubin) eckey = d2i_EC_PUBKEY_bio(in, NULL);
eckey = d2i_EC_PUBKEY_bio(in, NULL); else
else eckey = d2i_ECPrivateKey_bio(in, NULL);
eckey = d2i_ECPrivateKey_bio(in, NULL); } else if (informat == FORMAT_PEM) {
} if (pubin)
else if (informat == FORMAT_PEM) eckey = PEM_read_bio_EC_PUBKEY(in, NULL, NULL, NULL);
{ else
if (pubin) eckey = PEM_read_bio_ECPrivateKey(in, NULL, NULL, passin);
eckey = PEM_read_bio_EC_PUBKEY(in, NULL, NULL, } else {
NULL); BIO_printf(bio_err, "bad input format specified for key\n");
else goto end;
eckey = PEM_read_bio_ECPrivateKey(in, NULL, NULL, }
passin); if (eckey == NULL) {
} BIO_printf(bio_err, "unable to load Key\n");
else ERR_print_errors(bio_err);
{ goto end;
BIO_printf(bio_err, "bad input format specified for key\n"); }
goto end;
}
if (eckey == NULL)
{
BIO_printf(bio_err,"unable to load Key\n");
ERR_print_errors(bio_err);
goto end;
}
if (outfile == NULL) if (outfile == NULL) {
{ BIO_set_fp(out, stdout, BIO_NOCLOSE);
BIO_set_fp(out, stdout, BIO_NOCLOSE); # ifdef OPENSSL_SYS_VMS
#ifdef OPENSSL_SYS_VMS {
{ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); out = BIO_push(tmpbio, out);
out = BIO_push(tmpbio, out); }
} # endif
#endif } else {
} if (BIO_write_filename(out, outfile) <= 0) {
else perror(outfile);
{ goto end;
if (BIO_write_filename(out, outfile) <= 0) }
{ }
perror(outfile);
goto end;
}
}
group = EC_KEY_get0_group(eckey); group = EC_KEY_get0_group(eckey);
if (new_form) if (new_form)
EC_KEY_set_conv_form(eckey, form); EC_KEY_set_conv_form(eckey, form);
if (new_asn1_flag) if (new_asn1_flag)
EC_KEY_set_asn1_flag(eckey, asn1_flag); EC_KEY_set_asn1_flag(eckey, asn1_flag);
if (text) if (text)
if (!EC_KEY_print(out, eckey, 0)) if (!EC_KEY_print(out, eckey, 0)) {
{ perror(outfile);
perror(outfile); ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
}
if (noout) if (noout) {
{ ret = 0;
ret = 0; goto end;
goto end; }
}
BIO_printf(bio_err, "writing EC key\n"); BIO_printf(bio_err, "writing EC key\n");
if (outformat == FORMAT_ASN1) if (outformat == FORMAT_ASN1) {
{ if (param_out)
if (param_out) i = i2d_ECPKParameters_bio(out, group);
i = i2d_ECPKParameters_bio(out, group); else if (pubin || pubout)
else if (pubin || pubout) i = i2d_EC_PUBKEY_bio(out, eckey);
i = i2d_EC_PUBKEY_bio(out, eckey); else
else i = i2d_ECPrivateKey_bio(out, eckey);
i = i2d_ECPrivateKey_bio(out, eckey); } else if (outformat == FORMAT_PEM) {
} if (param_out)
else if (outformat == FORMAT_PEM) i = PEM_write_bio_ECPKParameters(out, group);
{ else if (pubin || pubout)
if (param_out) i = PEM_write_bio_EC_PUBKEY(out, eckey);
i = PEM_write_bio_ECPKParameters(out, group); else
else if (pubin || pubout) i = PEM_write_bio_ECPrivateKey(out, eckey, enc,
i = PEM_write_bio_EC_PUBKEY(out, eckey); NULL, 0, NULL, passout);
else } else {
i = PEM_write_bio_ECPrivateKey(out, eckey, enc, BIO_printf(bio_err, "bad output format specified for " "outfile\n");
NULL, 0, NULL, passout); goto end;
} }
else
{
BIO_printf(bio_err, "bad output format specified for "
"outfile\n");
goto end;
}
if (!i) if (!i) {
{ BIO_printf(bio_err, "unable to write private key\n");
BIO_printf(bio_err, "unable to write private key\n"); ERR_print_errors(bio_err);
ERR_print_errors(bio_err); } else
} ret = 0;
else end:
ret=0; if (in)
end: BIO_free(in);
if (in) if (out)
BIO_free(in); BIO_free_all(out);
if (out) if (eckey)
BIO_free_all(out); EC_KEY_free(eckey);
if (eckey) if (passin)
EC_KEY_free(eckey); OPENSSL_free(passin);
if (passin) if (passout)
OPENSSL_free(passin); OPENSSL_free(passout);
if (passout) apps_shutdown();
OPENSSL_free(passout); OPENSSL_EXIT(ret);
apps_shutdown();
OPENSSL_EXIT(ret);
} }
#else /* !OPENSSL_NO_EC */ #else /* !OPENSSL_NO_EC */
# if PEDANTIC # if PEDANTIC
static void *dummy=&dummy; static void *dummy = &dummy;
# endif # endif
#endif #endif

BIN
apps/ec.o

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

1135
apps/enc.c

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -1,6 +1,7 @@
/* apps/engine.c -*- mode: C; c-file-style: "eay" -*- */ /* apps/engine.c -*- mode: C; c-file-style: "eay" -*- */
/* Written by Richard Levitte <richard@levitte.org> for the OpenSSL /*
* project 2000. * Written by Richard Levitte <richard@levitte.org> for the OpenSSL project
* 2000.
*/ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 2000 The OpenSSL Project. All rights reserved. * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
@@ -56,494 +57,461 @@
* *
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifdef OPENSSL_NO_STDIO #ifdef OPENSSL_NO_STDIO
#define APPS_WIN16 # define APPS_WIN16
#endif #endif
#include "apps.h" #include "apps.h"
#include <openssl/err.h> #include <openssl/err.h>
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h> # include <openssl/engine.h>
#include <openssl/ssl.h> # include <openssl/ssl.h>
#undef PROG # undef PROG
#define PROG engine_main # define PROG engine_main
static const char *engine_usage[]={ static const char *engine_usage[] = {
"usage: engine opts [engine ...]\n", "usage: engine opts [engine ...]\n",
" -v[v[v[v]]] - verbose mode, for each engine, list its 'control commands'\n", " -v[v[v[v]]] - verbose mode, for each engine, list its 'control commands'\n",
" -vv will additionally display each command's description\n", " -vv will additionally display each command's description\n",
" -vvv will also add the input flags for each command\n", " -vvv will also add the input flags for each command\n",
" -vvvv will also show internal input flags\n", " -vvvv will also show internal input flags\n",
" -c - for each engine, also list the capabilities\n", " -c - for each engine, also list the capabilities\n",
" -t[t] - for each engine, check that they are really available\n", " -t[t] - for each engine, check that they are really available\n",
" -tt will display error trace for unavailable engines\n", " -tt will display error trace for unavailable engines\n",
" -pre <cmd> - runs command 'cmd' against the ENGINE before any attempts\n", " -pre <cmd> - runs command 'cmd' against the ENGINE before any attempts\n",
" to load it (if -t is used)\n", " to load it (if -t is used)\n",
" -post <cmd> - runs command 'cmd' against the ENGINE after loading it\n", " -post <cmd> - runs command 'cmd' against the ENGINE after loading it\n",
" (only used if -t is also provided)\n", " (only used if -t is also provided)\n",
" NB: -pre and -post will be applied to all ENGINEs supplied on the command\n", " NB: -pre and -post will be applied to all ENGINEs supplied on the command\n",
" line, or all supported ENGINEs if none are specified.\n", " line, or all supported ENGINEs if none are specified.\n",
" Eg. '-pre \"SO_PATH:/lib/libdriver.so\"' calls command \"SO_PATH\" with\n", " Eg. '-pre \"SO_PATH:/lib/libdriver.so\"' calls command \"SO_PATH\" with\n",
" argument \"/lib/libdriver.so\".\n", " argument \"/lib/libdriver.so\".\n",
NULL NULL
}; };
static void identity(char *ptr) static void identity(char *ptr)
{ {
return; return;
} }
static int append_buf(char **buf, const char *s, int *size, int step) static int append_buf(char **buf, const char *s, int *size, int step)
{ {
int l = strlen(s); int l = strlen(s);
if (*buf == NULL) if (*buf == NULL) {
{ *size = step;
*size = step; *buf = OPENSSL_malloc(*size);
*buf = OPENSSL_malloc(*size); if (*buf == NULL)
if (*buf == NULL) return 0;
return 0; **buf = '\0';
**buf = '\0'; }
}
if (**buf != '\0') if (**buf != '\0')
l += 2; /* ", " */ l += 2; /* ", " */
if (strlen(*buf) + strlen(s) >= (unsigned int)*size) if (strlen(*buf) + strlen(s) >= (unsigned int)*size) {
{ *size += step;
*size += step; *buf = OPENSSL_realloc(*buf, *size);
*buf = OPENSSL_realloc(*buf, *size); }
}
if (*buf == NULL) if (*buf == NULL)
return 0; return 0;
if (**buf != '\0') if (**buf != '\0')
BUF_strlcat(*buf, ", ", *size); BUF_strlcat(*buf, ", ", *size);
BUF_strlcat(*buf, s, *size); BUF_strlcat(*buf, s, *size);
return 1; return 1;
} }
static int util_flags(BIO *bio_out, unsigned int flags, const char *indent) static int util_flags(BIO *bio_out, unsigned int flags, const char *indent)
{ {
int started = 0, err = 0; int started = 0, err = 0;
/* Indent before displaying input flags */ /* Indent before displaying input flags */
BIO_printf(bio_out, "%s%s(input flags): ", indent, indent); BIO_printf(bio_out, "%s%s(input flags): ", indent, indent);
if(flags == 0) if (flags == 0) {
{ BIO_printf(bio_out, "<no flags>\n");
BIO_printf(bio_out, "<no flags>\n"); return 1;
return 1; }
} /*
/* If the object is internal, mark it in a way that shows instead of * If the object is internal, mark it in a way that shows instead of
* having it part of all the other flags, even if it really is. */ * having it part of all the other flags, even if it really is.
if(flags & ENGINE_CMD_FLAG_INTERNAL) */
{ if (flags & ENGINE_CMD_FLAG_INTERNAL) {
BIO_printf(bio_out, "[Internal] "); BIO_printf(bio_out, "[Internal] ");
} }
if(flags & ENGINE_CMD_FLAG_NUMERIC) if (flags & ENGINE_CMD_FLAG_NUMERIC) {
{ BIO_printf(bio_out, "NUMERIC");
BIO_printf(bio_out, "NUMERIC"); started = 1;
started = 1; }
} /*
/* Now we check that no combinations of the mutually exclusive NUMERIC, * Now we check that no combinations of the mutually exclusive NUMERIC,
* STRING, and NO_INPUT flags have been used. Future flags that can be * STRING, and NO_INPUT flags have been used. Future flags that can be
* OR'd together with these would need to added after these to preserve * OR'd together with these would need to added after these to preserve
* the testing logic. */ * the testing logic.
if(flags & ENGINE_CMD_FLAG_STRING) */
{ if (flags & ENGINE_CMD_FLAG_STRING) {
if(started) if (started) {
{ BIO_printf(bio_out, "|");
BIO_printf(bio_out, "|"); err = 1;
err = 1; }
} BIO_printf(bio_out, "STRING");
BIO_printf(bio_out, "STRING"); started = 1;
started = 1; }
} if (flags & ENGINE_CMD_FLAG_NO_INPUT) {
if(flags & ENGINE_CMD_FLAG_NO_INPUT) if (started) {
{ BIO_printf(bio_out, "|");
if(started) err = 1;
{ }
BIO_printf(bio_out, "|"); BIO_printf(bio_out, "NO_INPUT");
err = 1; started = 1;
} }
BIO_printf(bio_out, "NO_INPUT"); /* Check for unknown flags */
started = 1; flags = flags & ~ENGINE_CMD_FLAG_NUMERIC &
} ~ENGINE_CMD_FLAG_STRING &
/* Check for unknown flags */ ~ENGINE_CMD_FLAG_NO_INPUT & ~ENGINE_CMD_FLAG_INTERNAL;
flags = flags & ~ENGINE_CMD_FLAG_NUMERIC & if (flags) {
~ENGINE_CMD_FLAG_STRING & if (started)
~ENGINE_CMD_FLAG_NO_INPUT & BIO_printf(bio_out, "|");
~ENGINE_CMD_FLAG_INTERNAL; BIO_printf(bio_out, "<0x%04X>", flags);
if(flags) }
{ if (err)
if(started) BIO_printf(bio_out, "|"); BIO_printf(bio_out, " <illegal flags!>");
BIO_printf(bio_out, "<0x%04X>", flags); BIO_printf(bio_out, "\n");
} return 1;
if(err) }
BIO_printf(bio_out, " <illegal flags!>");
BIO_printf(bio_out, "\n");
return 1;
}
static int util_verbose(ENGINE *e, int verbose, BIO *bio_out, const char *indent) static int util_verbose(ENGINE *e, int verbose, BIO *bio_out,
{ const char *indent)
static const int line_wrap = 78; {
int num; static const int line_wrap = 78;
int ret = 0; int num;
char *name = NULL; int ret = 0;
char *desc = NULL; char *name = NULL;
int flags; char *desc = NULL;
int xpos = 0; int flags;
STACK_OF(OPENSSL_STRING) *cmds = NULL; int xpos = 0;
if(!ENGINE_ctrl(e, ENGINE_CTRL_HAS_CTRL_FUNCTION, 0, NULL, NULL) || STACK_OF(OPENSSL_STRING) *cmds = NULL;
((num = ENGINE_ctrl(e, ENGINE_CTRL_GET_FIRST_CMD_TYPE, if (!ENGINE_ctrl(e, ENGINE_CTRL_HAS_CTRL_FUNCTION, 0, NULL, NULL) ||
0, NULL, NULL)) <= 0)) ((num = ENGINE_ctrl(e, ENGINE_CTRL_GET_FIRST_CMD_TYPE,
{ 0, NULL, NULL)) <= 0)) {
#if 0 # if 0
BIO_printf(bio_out, "%s<no control commands>\n", indent); BIO_printf(bio_out, "%s<no control commands>\n", indent);
#endif # endif
return 1; return 1;
} }
cmds = sk_OPENSSL_STRING_new_null(); cmds = sk_OPENSSL_STRING_new_null();
if(!cmds) if (!cmds)
goto err; goto err;
do { do {
int len; int len;
/* Get the command input flags */ /* Get the command input flags */
if((flags = ENGINE_ctrl(e, ENGINE_CTRL_GET_CMD_FLAGS, num, if ((flags = ENGINE_ctrl(e, ENGINE_CTRL_GET_CMD_FLAGS, num,
NULL, NULL)) < 0) NULL, NULL)) < 0)
goto err; goto err;
if (!(flags & ENGINE_CMD_FLAG_INTERNAL) || verbose >= 4) if (!(flags & ENGINE_CMD_FLAG_INTERNAL) || verbose >= 4) {
{ /* Get the command name */
/* Get the command name */ if ((len = ENGINE_ctrl(e, ENGINE_CTRL_GET_NAME_LEN_FROM_CMD, num,
if((len = ENGINE_ctrl(e, ENGINE_CTRL_GET_NAME_LEN_FROM_CMD, num, NULL, NULL)) <= 0)
NULL, NULL)) <= 0) goto err;
goto err; if ((name = OPENSSL_malloc(len + 1)) == NULL)
if((name = OPENSSL_malloc(len + 1)) == NULL) goto err;
goto err; if (ENGINE_ctrl(e, ENGINE_CTRL_GET_NAME_FROM_CMD, num, name,
if(ENGINE_ctrl(e, ENGINE_CTRL_GET_NAME_FROM_CMD, num, name, NULL) <= 0)
goto err;
/* Get the command description */
if ((len = ENGINE_ctrl(e, ENGINE_CTRL_GET_DESC_LEN_FROM_CMD, num,
NULL, NULL)) < 0)
goto err;
if (len > 0) {
if ((desc = OPENSSL_malloc(len + 1)) == NULL)
goto err;
if (ENGINE_ctrl(e, ENGINE_CTRL_GET_DESC_FROM_CMD, num, desc,
NULL) <= 0) NULL) <= 0)
goto err; goto err;
/* Get the command description */ }
if((len = ENGINE_ctrl(e, ENGINE_CTRL_GET_DESC_LEN_FROM_CMD, num, /* Now decide on the output */
NULL, NULL)) < 0) if (xpos == 0)
goto err; /* Do an indent */
if(len > 0) xpos = BIO_puts(bio_out, indent);
{ else
if((desc = OPENSSL_malloc(len + 1)) == NULL) /* Otherwise prepend a ", " */
goto err; xpos += BIO_printf(bio_out, ", ");
if(ENGINE_ctrl(e, ENGINE_CTRL_GET_DESC_FROM_CMD, num, desc, if (verbose == 1) {
NULL) <= 0) /*
goto err; * We're just listing names, comma-delimited
} */
/* Now decide on the output */ if ((xpos > (int)strlen(indent)) &&
if(xpos == 0) (xpos + (int)strlen(name) > line_wrap)) {
/* Do an indent */ BIO_printf(bio_out, "\n");
xpos = BIO_puts(bio_out, indent); xpos = BIO_puts(bio_out, indent);
else }
/* Otherwise prepend a ", " */ xpos += BIO_printf(bio_out, "%s", name);
xpos += BIO_printf(bio_out, ", "); } else {
if(verbose == 1) /* We're listing names plus descriptions */
{ BIO_printf(bio_out, "%s: %s\n", name,
/* We're just listing names, comma-delimited */ (desc == NULL) ? "<no description>" : desc);
if((xpos > (int)strlen(indent)) && /* ... and sometimes input flags */
(xpos + (int)strlen(name) > line_wrap)) if ((verbose >= 3) && !util_flags(bio_out, flags, indent))
{ goto err;
BIO_printf(bio_out, "\n"); xpos = 0;
xpos = BIO_puts(bio_out, indent); }
} }
xpos += BIO_printf(bio_out, "%s", name); OPENSSL_free(name);
} name = NULL;
else if (desc) {
{ OPENSSL_free(desc);
/* We're listing names plus descriptions */ desc = NULL;
BIO_printf(bio_out, "%s: %s\n", name, }
(desc == NULL) ? "<no description>" : desc); /* Move to the next command */
/* ... and sometimes input flags */ num = ENGINE_ctrl(e, ENGINE_CTRL_GET_NEXT_CMD_TYPE, num, NULL, NULL);
if((verbose >= 3) && !util_flags(bio_out, flags, } while (num > 0);
indent)) if (xpos > 0)
goto err; BIO_printf(bio_out, "\n");
xpos = 0; ret = 1;
} err:
} if (cmds)
OPENSSL_free(name); name = NULL; sk_OPENSSL_STRING_pop_free(cmds, identity);
if(desc) { OPENSSL_free(desc); desc = NULL; } if (name)
/* Move to the next command */ OPENSSL_free(name);
num = ENGINE_ctrl(e, ENGINE_CTRL_GET_NEXT_CMD_TYPE, if (desc)
num, NULL, NULL); OPENSSL_free(desc);
} while(num > 0); return ret;
if(xpos > 0) }
BIO_printf(bio_out, "\n");
ret = 1;
err:
if(cmds) sk_OPENSSL_STRING_pop_free(cmds, identity);
if(name) OPENSSL_free(name);
if(desc) OPENSSL_free(desc);
return ret;
}
static void util_do_cmds(ENGINE *e, STACK_OF(OPENSSL_STRING) *cmds, static void util_do_cmds(ENGINE *e, STACK_OF(OPENSSL_STRING) *cmds,
BIO *bio_out, const char *indent) BIO *bio_out, const char *indent)
{ {
int loop, res, num = sk_OPENSSL_STRING_num(cmds); int loop, res, num = sk_OPENSSL_STRING_num(cmds);
if(num < 0) if (num < 0) {
{ BIO_printf(bio_out, "[Error]: internal stack error\n");
BIO_printf(bio_out, "[Error]: internal stack error\n"); return;
return; }
} for (loop = 0; loop < num; loop++) {
for(loop = 0; loop < num; loop++) char buf[256];
{ const char *cmd, *arg;
char buf[256]; cmd = sk_OPENSSL_STRING_value(cmds, loop);
const char *cmd, *arg; res = 1; /* assume success */
cmd = sk_OPENSSL_STRING_value(cmds, loop); /* Check if this command has no ":arg" */
res = 1; /* assume success */ if ((arg = strstr(cmd, ":")) == NULL) {
/* Check if this command has no ":arg" */ if (!ENGINE_ctrl_cmd_string(e, cmd, NULL, 0))
if((arg = strstr(cmd, ":")) == NULL) res = 0;
{ } else {
if(!ENGINE_ctrl_cmd_string(e, cmd, NULL, 0)) if ((int)(arg - cmd) > 254) {
res = 0; BIO_printf(bio_out, "[Error]: command name too long\n");
} return;
else }
{ memcpy(buf, cmd, (int)(arg - cmd));
if((int)(arg - cmd) > 254) buf[arg - cmd] = '\0';
{ arg++; /* Move past the ":" */
BIO_printf(bio_out,"[Error]: command name too long\n"); /* Call the command with the argument */
return; if (!ENGINE_ctrl_cmd_string(e, buf, arg, 0))
} res = 0;
memcpy(buf, cmd, (int)(arg - cmd)); }
buf[arg-cmd] = '\0'; if (res)
arg++; /* Move past the ":" */ BIO_printf(bio_out, "[Success]: %s\n", cmd);
/* Call the command with the argument */ else {
if(!ENGINE_ctrl_cmd_string(e, buf, arg, 0)) BIO_printf(bio_out, "[Failure]: %s\n", cmd);
res = 0; ERR_print_errors(bio_out);
} }
if(res) }
BIO_printf(bio_out, "[Success]: %s\n", cmd); }
else
{
BIO_printf(bio_out, "[Failure]: %s\n", cmd);
ERR_print_errors(bio_out);
}
}
}
int MAIN(int, char **); int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
int ret=1,i; int ret = 1, i;
const char **pp; const char **pp;
int verbose=0, list_cap=0, test_avail=0, test_avail_noise = 0; int verbose = 0, list_cap = 0, test_avail = 0, test_avail_noise = 0;
ENGINE *e; ENGINE *e;
STACK_OF(OPENSSL_STRING) *engines = sk_OPENSSL_STRING_new_null(); STACK_OF(OPENSSL_STRING) *engines = sk_OPENSSL_STRING_new_null();
STACK_OF(OPENSSL_STRING) *pre_cmds = sk_OPENSSL_STRING_new_null(); STACK_OF(OPENSSL_STRING) *pre_cmds = sk_OPENSSL_STRING_new_null();
STACK_OF(OPENSSL_STRING) *post_cmds = sk_OPENSSL_STRING_new_null(); STACK_OF(OPENSSL_STRING) *post_cmds = sk_OPENSSL_STRING_new_null();
int badops=1; int badops = 1;
BIO *bio_out=NULL; BIO *bio_out = NULL;
const char *indent = " "; const char *indent = " ";
apps_startup(); apps_startup();
SSL_load_error_strings(); SSL_load_error_strings();
if (bio_err == NULL) if (bio_err == NULL)
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
if (!load_config(bio_err, NULL)) if (!load_config(bio_err, NULL))
goto end; goto end;
bio_out=BIO_new_fp(stdout,BIO_NOCLOSE); bio_out = BIO_new_fp(stdout, BIO_NOCLOSE);
#ifdef OPENSSL_SYS_VMS # ifdef OPENSSL_SYS_VMS
{ {
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); BIO *tmpbio = BIO_new(BIO_f_linebuffer());
bio_out = BIO_push(tmpbio, bio_out); bio_out = BIO_push(tmpbio, bio_out);
} }
#endif # endif
argc--; argc--;
argv++; argv++;
while (argc >= 1) while (argc >= 1) {
{ if (strncmp(*argv, "-v", 2) == 0) {
if (strncmp(*argv,"-v",2) == 0) if (strspn(*argv + 1, "v") < strlen(*argv + 1))
{ goto skip_arg_loop;
if(strspn(*argv + 1, "v") < strlen(*argv + 1)) if ((verbose = strlen(*argv + 1)) > 4)
goto skip_arg_loop; goto skip_arg_loop;
if((verbose=strlen(*argv + 1)) > 4) } else if (strcmp(*argv, "-c") == 0)
goto skip_arg_loop; list_cap = 1;
} else if (strncmp(*argv, "-t", 2) == 0) {
else if (strcmp(*argv,"-c") == 0) test_avail = 1;
list_cap=1; if (strspn(*argv + 1, "t") < strlen(*argv + 1))
else if (strncmp(*argv,"-t",2) == 0) goto skip_arg_loop;
{ if ((test_avail_noise = strlen(*argv + 1) - 1) > 1)
test_avail=1; goto skip_arg_loop;
if(strspn(*argv + 1, "t") < strlen(*argv + 1)) } else if (strcmp(*argv, "-pre") == 0) {
goto skip_arg_loop; argc--;
if((test_avail_noise = strlen(*argv + 1) - 1) > 1) argv++;
goto skip_arg_loop; if (argc == 0)
} goto skip_arg_loop;
else if (strcmp(*argv,"-pre") == 0) sk_OPENSSL_STRING_push(pre_cmds, *argv);
{ } else if (strcmp(*argv, "-post") == 0) {
argc--; argv++; argc--;
if (argc == 0) argv++;
goto skip_arg_loop; if (argc == 0)
sk_OPENSSL_STRING_push(pre_cmds,*argv); goto skip_arg_loop;
} sk_OPENSSL_STRING_push(post_cmds, *argv);
else if (strcmp(*argv,"-post") == 0) } else if ((strncmp(*argv, "-h", 2) == 0) ||
{ (strcmp(*argv, "-?") == 0))
argc--; argv++; goto skip_arg_loop;
if (argc == 0) else
goto skip_arg_loop; sk_OPENSSL_STRING_push(engines, *argv);
sk_OPENSSL_STRING_push(post_cmds,*argv); argc--;
} argv++;
else if ((strncmp(*argv,"-h",2) == 0) || }
(strcmp(*argv,"-?") == 0)) /* Looks like everything went OK */
goto skip_arg_loop; badops = 0;
else skip_arg_loop:
sk_OPENSSL_STRING_push(engines,*argv);
argc--;
argv++;
}
/* Looks like everything went OK */
badops = 0;
skip_arg_loop:
if (badops) if (badops) {
{ for (pp = engine_usage; (*pp != NULL); pp++)
for (pp=engine_usage; (*pp != NULL); pp++) BIO_printf(bio_err, "%s", *pp);
BIO_printf(bio_err,"%s",*pp); goto end;
goto end; }
}
if (sk_OPENSSL_STRING_num(engines) == 0) if (sk_OPENSSL_STRING_num(engines) == 0) {
{ for (e = ENGINE_get_first(); e != NULL; e = ENGINE_get_next(e)) {
for(e = ENGINE_get_first(); e != NULL; e = ENGINE_get_next(e)) sk_OPENSSL_STRING_push(engines, (char *)ENGINE_get_id(e));
{ }
sk_OPENSSL_STRING_push(engines,(char *)ENGINE_get_id(e)); }
}
}
for (i=0; i<sk_OPENSSL_STRING_num(engines); i++) for (i = 0; i < sk_OPENSSL_STRING_num(engines); i++) {
{ const char *id = sk_OPENSSL_STRING_value(engines, i);
const char *id = sk_OPENSSL_STRING_value(engines,i); if ((e = ENGINE_by_id(id)) != NULL) {
if ((e = ENGINE_by_id(id)) != NULL) const char *name = ENGINE_get_name(e);
{ /*
const char *name = ENGINE_get_name(e); * Do "id" first, then "name". Easier to auto-parse.
/* Do "id" first, then "name". Easier to auto-parse. */ */
BIO_printf(bio_out, "(%s) %s\n", id, name); BIO_printf(bio_out, "(%s) %s\n", id, name);
util_do_cmds(e, pre_cmds, bio_out, indent); util_do_cmds(e, pre_cmds, bio_out, indent);
if (strcmp(ENGINE_get_id(e), id) != 0) if (strcmp(ENGINE_get_id(e), id) != 0) {
{ BIO_printf(bio_out, "Loaded: (%s) %s\n",
BIO_printf(bio_out, "Loaded: (%s) %s\n", ENGINE_get_id(e), ENGINE_get_name(e));
ENGINE_get_id(e), ENGINE_get_name(e)); }
} if (list_cap) {
if (list_cap) int cap_size = 256;
{ char *cap_buf = NULL;
int cap_size = 256; int k, n;
char *cap_buf = NULL; const int *nids;
int k,n; ENGINE_CIPHERS_PTR fn_c;
const int *nids; ENGINE_DIGESTS_PTR fn_d;
ENGINE_CIPHERS_PTR fn_c; ENGINE_PKEY_METHS_PTR fn_pk;
ENGINE_DIGESTS_PTR fn_d;
ENGINE_PKEY_METHS_PTR fn_pk;
if (ENGINE_get_RSA(e) != NULL if (ENGINE_get_RSA(e) != NULL
&& !append_buf(&cap_buf, "RSA", && !append_buf(&cap_buf, "RSA", &cap_size, 256))
&cap_size, 256)) goto end;
goto end; if (ENGINE_get_DSA(e) != NULL
if (ENGINE_get_DSA(e) != NULL && !append_buf(&cap_buf, "DSA", &cap_size, 256))
&& !append_buf(&cap_buf, "DSA", goto end;
&cap_size, 256)) if (ENGINE_get_DH(e) != NULL
goto end; && !append_buf(&cap_buf, "DH", &cap_size, 256))
if (ENGINE_get_DH(e) != NULL goto end;
&& !append_buf(&cap_buf, "DH", if (ENGINE_get_RAND(e) != NULL
&cap_size, 256)) && !append_buf(&cap_buf, "RAND", &cap_size, 256))
goto end; goto end;
if (ENGINE_get_RAND(e) != NULL
&& !append_buf(&cap_buf, "RAND",
&cap_size, 256))
goto end;
fn_c = ENGINE_get_ciphers(e); fn_c = ENGINE_get_ciphers(e);
if(!fn_c) goto skip_ciphers; if (!fn_c)
n = fn_c(e, NULL, &nids, 0); goto skip_ciphers;
for(k=0 ; k < n ; ++k) n = fn_c(e, NULL, &nids, 0);
if(!append_buf(&cap_buf, for (k = 0; k < n; ++k)
OBJ_nid2sn(nids[k]), if (!append_buf(&cap_buf,
&cap_size, 256)) OBJ_nid2sn(nids[k]), &cap_size, 256))
goto end; goto end;
skip_ciphers: skip_ciphers:
fn_d = ENGINE_get_digests(e); fn_d = ENGINE_get_digests(e);
if(!fn_d) goto skip_digests; if (!fn_d)
n = fn_d(e, NULL, &nids, 0); goto skip_digests;
for(k=0 ; k < n ; ++k) n = fn_d(e, NULL, &nids, 0);
if(!append_buf(&cap_buf, for (k = 0; k < n; ++k)
OBJ_nid2sn(nids[k]), if (!append_buf(&cap_buf,
&cap_size, 256)) OBJ_nid2sn(nids[k]), &cap_size, 256))
goto end; goto end;
skip_digests: skip_digests:
fn_pk = ENGINE_get_pkey_meths(e); fn_pk = ENGINE_get_pkey_meths(e);
if(!fn_pk) goto skip_pmeths; if (!fn_pk)
n = fn_pk(e, NULL, &nids, 0); goto skip_pmeths;
for(k=0 ; k < n ; ++k) n = fn_pk(e, NULL, &nids, 0);
if(!append_buf(&cap_buf, for (k = 0; k < n; ++k)
OBJ_nid2sn(nids[k]), if (!append_buf(&cap_buf,
&cap_size, 256)) OBJ_nid2sn(nids[k]), &cap_size, 256))
goto end; goto end;
skip_pmeths: skip_pmeths:
if (cap_buf && (*cap_buf != '\0')) if (cap_buf && (*cap_buf != '\0'))
BIO_printf(bio_out, " [%s]\n", cap_buf); BIO_printf(bio_out, " [%s]\n", cap_buf);
OPENSSL_free(cap_buf); OPENSSL_free(cap_buf);
} }
if(test_avail) if (test_avail) {
{ BIO_printf(bio_out, "%s", indent);
BIO_printf(bio_out, "%s", indent); if (ENGINE_init(e)) {
if (ENGINE_init(e)) BIO_printf(bio_out, "[ available ]\n");
{ util_do_cmds(e, post_cmds, bio_out, indent);
BIO_printf(bio_out, "[ available ]\n"); ENGINE_finish(e);
util_do_cmds(e, post_cmds, bio_out, indent); } else {
ENGINE_finish(e); BIO_printf(bio_out, "[ unavailable ]\n");
} if (test_avail_noise)
else ERR_print_errors_fp(stdout);
{ ERR_clear_error();
BIO_printf(bio_out, "[ unavailable ]\n"); }
if(test_avail_noise) }
ERR_print_errors_fp(stdout); if ((verbose > 0) && !util_verbose(e, verbose, bio_out, indent))
ERR_clear_error(); goto end;
} ENGINE_free(e);
} } else
if((verbose > 0) && !util_verbose(e, verbose, bio_out, indent)) ERR_print_errors(bio_err);
goto end; }
ENGINE_free(e);
}
else
ERR_print_errors(bio_err);
}
ret=0; ret = 0;
end: end:
ERR_print_errors(bio_err); ERR_print_errors(bio_err);
sk_OPENSSL_STRING_pop_free(engines, identity); sk_OPENSSL_STRING_pop_free(engines, identity);
sk_OPENSSL_STRING_pop_free(pre_cmds, identity); sk_OPENSSL_STRING_pop_free(pre_cmds, identity);
sk_OPENSSL_STRING_pop_free(post_cmds, identity); sk_OPENSSL_STRING_pop_free(post_cmds, identity);
if (bio_out != NULL) BIO_free_all(bio_out); if (bio_out != NULL)
apps_shutdown(); BIO_free_all(bio_out);
OPENSSL_EXIT(ret); apps_shutdown();
} OPENSSL_EXIT(ret);
}
#else #else
# if PEDANTIC # if PEDANTIC
static void *dummy=&dummy; static void *dummy = &dummy;
# endif # endif
#endif #endif

Binary file not shown.

View File

@@ -66,63 +66,56 @@
#include <openssl/ssl.h> #include <openssl/ssl.h>
#undef PROG #undef PROG
#define PROG errstr_main #define PROG errstr_main
int MAIN(int, char **); int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
int i,ret=0; int i, ret = 0;
char buf[256]; char buf[256];
unsigned long l; unsigned long l;
apps_startup(); apps_startup();
if (bio_err == NULL) if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL) if ((bio_err = BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
SSL_load_error_strings(); SSL_load_error_strings();
if ((argc > 1) && (strcmp(argv[1],"-stats") == 0)) if ((argc > 1) && (strcmp(argv[1], "-stats") == 0)) {
{ BIO *out = NULL;
BIO *out=NULL;
out=BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file());
if ((out != NULL) && BIO_set_fp(out,stdout,BIO_NOCLOSE)) if ((out != NULL) && BIO_set_fp(out, stdout, BIO_NOCLOSE)) {
{
#ifdef OPENSSL_SYS_VMS #ifdef OPENSSL_SYS_VMS
{ {
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); BIO *tmpbio = BIO_new(BIO_f_linebuffer());
out = BIO_push(tmpbio, out); out = BIO_push(tmpbio, out);
} }
#endif #endif
lh_ERR_STRING_DATA_node_stats_bio( lh_ERR_STRING_DATA_node_stats_bio(ERR_get_string_table(), out);
ERR_get_string_table(), out); lh_ERR_STRING_DATA_stats_bio(ERR_get_string_table(), out);
lh_ERR_STRING_DATA_stats_bio(ERR_get_string_table(), lh_ERR_STRING_DATA_node_usage_stats_bio(ERR_get_string_table(),
out); out);
lh_ERR_STRING_DATA_node_usage_stats_bio( }
ERR_get_string_table(),out); if (out != NULL)
} BIO_free_all(out);
if (out != NULL) BIO_free_all(out); argc--;
argc--; argv++;
argv++; }
}
for (i=1; i<argc; i++) for (i = 1; i < argc; i++) {
{ if (sscanf(argv[i], "%lx", &l)) {
if (sscanf(argv[i],"%lx",&l)) ERR_error_string_n(l, buf, sizeof buf);
{ printf("%s\n", buf);
ERR_error_string_n(l, buf, sizeof buf); } else {
printf("%s\n",buf); printf("%s: bad error code\n", argv[i]);
} printf("usage: errstr [-stats] <errno> ...\n");
else ret++;
{ }
printf("%s: bad error code\n",argv[i]); }
printf("usage: errstr [-stats] <errno> ...\n"); apps_shutdown();
ret++; OPENSSL_EXIT(ret);
} }
}
apps_shutdown();
OPENSSL_EXIT(ret);
}

Binary file not shown.

View File

@@ -58,184 +58,191 @@
*/ */
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
/* Until the key-gen callbacks are modified to use newer prototypes, we allow /*
* deprecated functions for openssl-internal code */ * Until the key-gen callbacks are modified to use newer prototypes, we allow
* deprecated functions for openssl-internal code
*/
#ifdef OPENSSL_NO_DEPRECATED #ifdef OPENSSL_NO_DEPRECATED
#undef OPENSSL_NO_DEPRECATED # undef OPENSSL_NO_DEPRECATED
#endif #endif
#ifndef OPENSSL_NO_DH #ifndef OPENSSL_NO_DH
#include <stdio.h> # include <stdio.h>
#include <string.h> # include <string.h>
#include <sys/types.h> # include <sys/types.h>
#include <sys/stat.h> # include <sys/stat.h>
#include "apps.h" # include "apps.h"
#include <openssl/bio.h> # include <openssl/bio.h>
#include <openssl/rand.h> # include <openssl/rand.h>
#include <openssl/err.h> # include <openssl/err.h>
#include <openssl/bn.h> # include <openssl/bn.h>
#include <openssl/dh.h> # include <openssl/dh.h>
#include <openssl/x509.h> # include <openssl/x509.h>
#include <openssl/pem.h> # include <openssl/pem.h>
#define DEFBITS 512 # define DEFBITS 2048
#undef PROG # undef PROG
#define PROG gendh_main # define PROG gendh_main
static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb); static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb);
int MAIN(int, char **); int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
BN_GENCB cb; BN_GENCB cb;
DH *dh=NULL; DH *dh = NULL;
int ret=1,num=DEFBITS; int ret = 1, num = DEFBITS;
int g=2; int g = 2;
char *outfile=NULL; char *outfile = NULL;
char *inrand=NULL; char *inrand = NULL;
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
char *engine=NULL; char *engine = NULL;
#endif # endif
BIO *out=NULL; BIO *out = NULL;
apps_startup(); apps_startup();
BN_GENCB_set(&cb, dh_cb, bio_err); BN_GENCB_set(&cb, dh_cb, bio_err);
if (bio_err == NULL) if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL) if ((bio_err = BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
if (!load_config(bio_err, NULL)) if (!load_config(bio_err, NULL))
goto end; goto end;
argv++; argv++;
argc--; argc--;
for (;;) for (;;) {
{ if (argc <= 0)
if (argc <= 0) break; break;
if (strcmp(*argv,"-out") == 0) if (strcmp(*argv, "-out") == 0) {
{ if (--argc < 1)
if (--argc < 1) goto bad; goto bad;
outfile= *(++argv); outfile = *(++argv);
} } else if (strcmp(*argv, "-2") == 0)
else if (strcmp(*argv,"-2") == 0) g = 2;
g=2; /*- else if (strcmp(*argv,"-3") == 0)
/* else if (strcmp(*argv,"-3") == 0) g=3; */
g=3; */ else if (strcmp(*argv, "-5") == 0)
else if (strcmp(*argv,"-5") == 0) g = 5;
g=5; # ifndef OPENSSL_NO_ENGINE
#ifndef OPENSSL_NO_ENGINE else if (strcmp(*argv, "-engine") == 0) {
else if (strcmp(*argv,"-engine") == 0) if (--argc < 1)
{ goto bad;
if (--argc < 1) goto bad; engine = *(++argv);
engine= *(++argv); }
} # endif
#endif else if (strcmp(*argv, "-rand") == 0) {
else if (strcmp(*argv,"-rand") == 0) if (--argc < 1)
{ goto bad;
if (--argc < 1) goto bad; inrand = *(++argv);
inrand= *(++argv); } else
} break;
else argv++;
break; argc--;
argv++; }
argc--; if ((argc >= 1) && ((sscanf(*argv, "%d", &num) == 0) || (num < 0))) {
} bad:
if ((argc >= 1) && ((sscanf(*argv,"%d",&num) == 0) || (num < 0))) BIO_printf(bio_err, "usage: gendh [args] [numbits]\n");
{ BIO_printf(bio_err, " -out file - output the key to 'file\n");
bad: BIO_printf(bio_err, " -2 - use 2 as the generator value\n");
BIO_printf(bio_err,"usage: gendh [args] [numbits]\n"); /*
BIO_printf(bio_err," -out file - output the key to 'file\n"); * BIO_printf(bio_err," -3 - use 3 as the generator value\n");
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," -5 - use 5 as the generator value\n"); # ifndef OPENSSL_NO_ENGINE
#ifndef OPENSSL_NO_ENGINE BIO_printf(bio_err,
BIO_printf(bio_err," -engine e - use engine e, possibly a hardware device.\n"); " -engine e - use engine e, possibly a hardware device.\n");
#endif # endif
BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); BIO_printf(bio_err, " -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR,
BIO_printf(bio_err," - load the file (or the files in the directory) into\n"); LIST_SEPARATOR_CHAR);
BIO_printf(bio_err," the random number generator\n"); BIO_printf(bio_err,
goto end; " - load the file (or the files in the directory) into\n");
} BIO_printf(bio_err, " the random number generator\n");
goto end;
}
# ifndef OPENSSL_NO_ENGINE
setup_engine(bio_err, engine, 0);
# endif
#ifndef OPENSSL_NO_ENGINE out = BIO_new(BIO_s_file());
setup_engine(bio_err, engine, 0); if (out == NULL) {
#endif ERR_print_errors(bio_err);
goto end;
}
out=BIO_new(BIO_s_file()); if (outfile == NULL) {
if (out == NULL) BIO_set_fp(out, stdout, BIO_NOCLOSE);
{ # ifdef OPENSSL_SYS_VMS
ERR_print_errors(bio_err); {
goto end; BIO *tmpbio = BIO_new(BIO_f_linebuffer());
} out = BIO_push(tmpbio, out);
}
# endif
} else {
if (BIO_write_filename(out, outfile) <= 0) {
perror(outfile);
goto end;
}
}
if (outfile == NULL) if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL) {
{ BIO_printf(bio_err,
BIO_set_fp(out,stdout,BIO_NOCLOSE); "warning, not much extra random data, consider using the -rand option\n");
#ifdef OPENSSL_SYS_VMS }
{ if (inrand != NULL)
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); BIO_printf(bio_err, "%ld semi-random bytes loaded\n",
out = BIO_push(tmpbio, out); app_RAND_load_files(inrand));
}
#endif
}
else
{
if (BIO_write_filename(out,outfile) <= 0)
{
perror(outfile);
goto end;
}
}
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL) BIO_printf(bio_err,
{ "Generating DH parameters, %d bit long safe prime, generator %d\n",
BIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\n"); num, g);
} BIO_printf(bio_err, "This is going to take a long time\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 safe prime, generator %d\n",num,g); if (((dh = DH_new()) == NULL)
BIO_printf(bio_err,"This is going to take a long time\n"); || !DH_generate_parameters_ex(dh, num, g, &cb))
goto end;
if(((dh = DH_new()) == NULL) || !DH_generate_parameters_ex(dh, num, g, &cb)) app_RAND_write_file(NULL, bio_err);
goto end;
app_RAND_write_file(NULL, bio_err); if (!PEM_write_bio_DHparams(out, dh))
goto end;
if (!PEM_write_bio_DHparams(out,dh)) ret = 0;
goto end; end:
ret=0; if (ret != 0)
end: ERR_print_errors(bio_err);
if (ret != 0) if (out != NULL)
ERR_print_errors(bio_err); BIO_free_all(out);
if (out != NULL) BIO_free_all(out); if (dh != NULL)
if (dh != NULL) DH_free(dh); DH_free(dh);
apps_shutdown(); apps_shutdown();
OPENSSL_EXIT(ret); OPENSSL_EXIT(ret);
} }
static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb) static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb)
{ {
char c='*'; char c = '*';
if (p == 0) c='.'; if (p == 0)
if (p == 1) c='+'; c = '.';
if (p == 2) c='*'; if (p == 1)
if (p == 3) c='\n'; c = '+';
BIO_write(cb->arg,&c,1); if (p == 2)
(void)BIO_flush(cb->arg); c = '*';
#ifdef LINT if (p == 3)
p=n; c = '\n';
#endif BIO_write(cb->arg, &c, 1);
return 1; (void)BIO_flush(cb->arg);
} # ifdef LINT
#else /* !OPENSSL_NO_DH */ p = n;
# endif
return 1;
}
#else /* !OPENSSL_NO_DH */
# if PEDANTIC # if PEDANTIC
static void *dummy=&dummy; static void *dummy = &dummy;
# endif # endif
#endif #endif

Binary file not shown.

View File

@@ -56,230 +56,232 @@
* [including the GNU Public Licence.] * [including the GNU Public Licence.]
*/ */
#include <openssl/opensslconf.h> /* for OPENSSL_NO_DSA */ #include <openssl/opensslconf.h> /* for OPENSSL_NO_DSA */
#ifndef OPENSSL_NO_DSA #ifndef OPENSSL_NO_DSA
#include <stdio.h> # include <stdio.h>
#include <string.h> # include <string.h>
#include <sys/types.h> # include <sys/types.h>
#include <sys/stat.h> # include <sys/stat.h>
#include "apps.h" # include "apps.h"
#include <openssl/bio.h> # include <openssl/bio.h>
#include <openssl/err.h> # include <openssl/err.h>
#include <openssl/bn.h> # include <openssl/bn.h>
#include <openssl/dsa.h> # include <openssl/dsa.h>
#include <openssl/x509.h> # include <openssl/x509.h>
#include <openssl/pem.h> # include <openssl/pem.h>
#define DEFBITS 512 # define DEFBITS 512
#undef PROG # undef PROG
#define PROG gendsa_main # define PROG gendsa_main
int MAIN(int, char **); int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
DSA *dsa=NULL; DSA *dsa = NULL;
int ret=1; int ret = 1;
char *outfile=NULL; char *outfile = NULL;
char *inrand=NULL,*dsaparams=NULL; char *inrand = NULL, *dsaparams = NULL;
char *passargout = NULL, *passout = NULL; char *passargout = NULL, *passout = NULL;
BIO *out=NULL,*in=NULL; BIO *out = NULL, *in = NULL;
const EVP_CIPHER *enc=NULL; const EVP_CIPHER *enc = NULL;
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
char *engine=NULL; char *engine = NULL;
#endif # endif
apps_startup(); apps_startup();
if (bio_err == NULL) if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL) if ((bio_err = BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
if (!load_config(bio_err, NULL)) if (!load_config(bio_err, NULL))
goto end; goto end;
argv++; argv++;
argc--; argc--;
for (;;) for (;;) {
{ if (argc <= 0)
if (argc <= 0) break; break;
if (strcmp(*argv,"-out") == 0) if (strcmp(*argv, "-out") == 0) {
{ if (--argc < 1)
if (--argc < 1) goto bad; goto bad;
outfile= *(++argv); outfile = *(++argv);
} } else if (strcmp(*argv, "-passout") == 0) {
else if (strcmp(*argv,"-passout") == 0) if (--argc < 1)
{ goto bad;
if (--argc < 1) goto bad; passargout = *(++argv);
passargout= *(++argv); }
} # ifndef OPENSSL_NO_ENGINE
#ifndef OPENSSL_NO_ENGINE else if (strcmp(*argv, "-engine") == 0) {
else if (strcmp(*argv,"-engine") == 0) if (--argc < 1)
{ goto bad;
if (--argc < 1) goto bad; engine = *(++argv);
engine= *(++argv); }
} # endif
#endif else if (strcmp(*argv, "-rand") == 0) {
else if (strcmp(*argv,"-rand") == 0) if (--argc < 1)
{ goto bad;
if (--argc < 1) goto bad; inrand = *(++argv);
inrand= *(++argv); } else if (strcmp(*argv, "-") == 0)
} goto bad;
else if (strcmp(*argv,"-") == 0) # ifndef OPENSSL_NO_DES
goto bad; else if (strcmp(*argv, "-des") == 0)
#ifndef OPENSSL_NO_DES enc = EVP_des_cbc();
else if (strcmp(*argv,"-des") == 0) else if (strcmp(*argv, "-des3") == 0)
enc=EVP_des_cbc(); enc = EVP_des_ede3_cbc();
else if (strcmp(*argv,"-des3") == 0) # endif
enc=EVP_des_ede3_cbc(); # ifndef OPENSSL_NO_IDEA
#endif else if (strcmp(*argv, "-idea") == 0)
#ifndef OPENSSL_NO_IDEA enc = EVP_idea_cbc();
else if (strcmp(*argv,"-idea") == 0) # endif
enc=EVP_idea_cbc(); # ifndef OPENSSL_NO_SEED
#endif else if (strcmp(*argv, "-seed") == 0)
#ifndef OPENSSL_NO_SEED enc = EVP_seed_cbc();
else if (strcmp(*argv,"-seed") == 0) # endif
enc=EVP_seed_cbc(); # ifndef OPENSSL_NO_AES
#endif else if (strcmp(*argv, "-aes128") == 0)
#ifndef OPENSSL_NO_AES enc = EVP_aes_128_cbc();
else if (strcmp(*argv,"-aes128") == 0) else if (strcmp(*argv, "-aes192") == 0)
enc=EVP_aes_128_cbc(); enc = EVP_aes_192_cbc();
else if (strcmp(*argv,"-aes192") == 0) else if (strcmp(*argv, "-aes256") == 0)
enc=EVP_aes_192_cbc(); enc = EVP_aes_256_cbc();
else if (strcmp(*argv,"-aes256") == 0) # endif
enc=EVP_aes_256_cbc(); # ifndef OPENSSL_NO_CAMELLIA
#endif else if (strcmp(*argv, "-camellia128") == 0)
#ifndef OPENSSL_NO_CAMELLIA enc = EVP_camellia_128_cbc();
else if (strcmp(*argv,"-camellia128") == 0) else if (strcmp(*argv, "-camellia192") == 0)
enc=EVP_camellia_128_cbc(); enc = EVP_camellia_192_cbc();
else if (strcmp(*argv,"-camellia192") == 0) else if (strcmp(*argv, "-camellia256") == 0)
enc=EVP_camellia_192_cbc(); enc = EVP_camellia_256_cbc();
else if (strcmp(*argv,"-camellia256") == 0) # endif
enc=EVP_camellia_256_cbc(); else if (**argv != '-' && dsaparams == NULL) {
#endif dsaparams = *argv;
else if (**argv != '-' && dsaparams == NULL) } else
{ goto bad;
dsaparams = *argv; argv++;
} argc--;
else }
goto bad;
argv++;
argc--;
}
if (dsaparams == NULL) if (dsaparams == NULL) {
{ bad:
bad: BIO_printf(bio_err, "usage: gendsa [args] dsaparam-file\n");
BIO_printf(bio_err,"usage: gendsa [args] dsaparam-file\n"); BIO_printf(bio_err, " -out file - output the key to 'file'\n");
BIO_printf(bio_err," -out file - output the key to 'file'\n"); # ifndef OPENSSL_NO_DES
#ifndef OPENSSL_NO_DES BIO_printf(bio_err,
BIO_printf(bio_err," -des - encrypt the generated key with DES in cbc mode\n"); " -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,
#endif " -des3 - encrypt the generated key with DES in ede cbc mode (168 bit key)\n");
#ifndef OPENSSL_NO_IDEA # endif
BIO_printf(bio_err," -idea - encrypt the generated key with IDEA in cbc mode\n"); # ifndef OPENSSL_NO_IDEA
#endif BIO_printf(bio_err,
#ifndef OPENSSL_NO_SEED " -idea - encrypt the generated key with IDEA in cbc mode\n");
BIO_printf(bio_err," -seed\n"); # endif
BIO_printf(bio_err," encrypt PEM output with cbc seed\n"); # ifndef OPENSSL_NO_SEED
#endif BIO_printf(bio_err, " -seed\n");
#ifndef OPENSSL_NO_AES BIO_printf(bio_err,
BIO_printf(bio_err," -aes128, -aes192, -aes256\n"); " encrypt PEM output with cbc seed\n");
BIO_printf(bio_err," encrypt PEM output with cbc aes\n"); # endif
#endif # ifndef OPENSSL_NO_AES
#ifndef OPENSSL_NO_CAMELLIA BIO_printf(bio_err, " -aes128, -aes192, -aes256\n");
BIO_printf(bio_err," -camellia128, -camellia192, -camellia256\n"); BIO_printf(bio_err,
BIO_printf(bio_err," encrypt PEM output with cbc camellia\n"); " encrypt PEM output with cbc aes\n");
#endif # endif
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_CAMELLIA
BIO_printf(bio_err," -engine e - use engine e, possibly a hardware device.\n"); BIO_printf(bio_err, " -camellia128, -camellia192, -camellia256\n");
#endif BIO_printf(bio_err,
BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); " encrypt PEM output with cbc camellia\n");
BIO_printf(bio_err," - load the file (or the files in the directory) into\n"); # endif
BIO_printf(bio_err," the random number generator\n"); # ifndef OPENSSL_NO_ENGINE
BIO_printf(bio_err," dsaparam-file\n"); BIO_printf(bio_err,
BIO_printf(bio_err," - a DSA parameter file as generated by the dsaparam command\n"); " -engine e - use engine e, possibly a hardware device.\n");
goto end; # endif
} 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");
BIO_printf(bio_err,
" - a DSA parameter file as generated by the dsaparam command\n");
goto end;
}
# ifndef OPENSSL_NO_ENGINE
setup_engine(bio_err, engine, 0);
# endif
#ifndef OPENSSL_NO_ENGINE if (!app_passwd(bio_err, NULL, passargout, NULL, &passout)) {
setup_engine(bio_err, engine, 0); BIO_printf(bio_err, "Error getting password\n");
#endif goto end;
}
if(!app_passwd(bio_err, NULL, passargout, NULL, &passout)) { in = BIO_new(BIO_s_file());
BIO_printf(bio_err, "Error getting password\n"); if (!(BIO_read_filename(in, dsaparams))) {
goto end; perror(dsaparams);
} goto end;
}
if ((dsa = PEM_read_bio_DSAparams(in, NULL, NULL, NULL)) == NULL) {
BIO_printf(bio_err, "unable to load DSA parameter file\n");
goto end;
}
BIO_free(in);
in = NULL;
in=BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file());
if (!(BIO_read_filename(in,dsaparams))) if (out == NULL)
{ goto end;
perror(dsaparams);
goto end;
}
if ((dsa=PEM_read_bio_DSAparams(in,NULL,NULL,NULL)) == NULL) if (outfile == NULL) {
{ BIO_set_fp(out, stdout, BIO_NOCLOSE);
BIO_printf(bio_err,"unable to load DSA parameter file\n"); # ifdef OPENSSL_SYS_VMS
goto end; {
} BIO *tmpbio = BIO_new(BIO_f_linebuffer());
BIO_free(in); out = BIO_push(tmpbio, out);
in = NULL; }
# endif
} else {
if (BIO_write_filename(out, outfile) <= 0) {
perror(outfile);
goto end;
}
}
out=BIO_new(BIO_s_file()); if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL) {
if (out == NULL) goto end; 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));
if (outfile == NULL) BIO_printf(bio_err, "Generating DSA key, %d bits\n", BN_num_bits(dsa->p));
{ if (!DSA_generate_key(dsa))
BIO_set_fp(out,stdout,BIO_NOCLOSE); goto end;
#ifdef OPENSSL_SYS_VMS
{
BIO *tmpbio = BIO_new(BIO_f_linebuffer());
out = BIO_push(tmpbio, out);
}
#endif
}
else
{
if (BIO_write_filename(out,outfile) <= 0)
{
perror(outfile);
goto end;
}
}
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL) app_RAND_write_file(NULL, bio_err);
{
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", if (!PEM_write_bio_DSAPrivateKey(out, dsa, enc, NULL, 0, NULL, passout))
BN_num_bits(dsa->p)); goto end;
if (!DSA_generate_key(dsa)) goto end; ret = 0;
end:
app_RAND_write_file(NULL, bio_err); if (ret != 0)
ERR_print_errors(bio_err);
if (!PEM_write_bio_DSAPrivateKey(out,dsa,enc,NULL,0,NULL, passout)) if (in != NULL)
goto end; BIO_free(in);
ret=0; if (out != NULL)
end: BIO_free_all(out);
if (ret != 0) if (dsa != NULL)
ERR_print_errors(bio_err); DSA_free(dsa);
if (in != NULL) BIO_free(in); if (passout)
if (out != NULL) BIO_free_all(out); OPENSSL_free(passout);
if (dsa != NULL) DSA_free(dsa); apps_shutdown();
if(passout) OPENSSL_free(passout); OPENSSL_EXIT(ret);
apps_shutdown(); }
OPENSSL_EXIT(ret); #else /* !OPENSSL_NO_DSA */
}
#else /* !OPENSSL_NO_DSA */
# if PEDANTIC # if PEDANTIC
static void *dummy=&dummy; static void *dummy = &dummy;
# endif # endif
#endif #endif

Binary file not shown.

View File

@@ -1,6 +1,7 @@
/* apps/genpkey.c */ /* apps/genpkey.c */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL /*
* project 2006 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
* 2006
*/ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 2006 The OpenSSL Project. All rights reserved. * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
@@ -62,11 +63,11 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/evp.h> #include <openssl/evp.h>
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h> # include <openssl/engine.h>
#endif #endif
static int init_keygen_file(BIO *err, EVP_PKEY_CTX **pctx, static int init_keygen_file(BIO *err, EVP_PKEY_CTX **pctx,
const char *file, ENGINE *e); const char *file, ENGINE *e);
static int genpkey_cb(EVP_PKEY_CTX *ctx); static int genpkey_cb(EVP_PKEY_CTX *ctx);
#define PROG genpkey_main #define PROG genpkey_main
@@ -74,367 +75,331 @@ static int genpkey_cb(EVP_PKEY_CTX *ctx);
int MAIN(int, char **); int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
ENGINE *e = NULL; ENGINE *e = NULL;
char **args, *outfile = NULL; char **args, *outfile = NULL;
char *passarg = NULL; char *passarg = NULL;
BIO *in = NULL, *out = NULL; BIO *in = NULL, *out = NULL;
const EVP_CIPHER *cipher = NULL; const EVP_CIPHER *cipher = NULL;
int outformat; int outformat;
int text = 0; int text = 0;
EVP_PKEY *pkey=NULL; EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *ctx = NULL; EVP_PKEY_CTX *ctx = NULL;
char *pass = NULL; char *pass = NULL;
int badarg = 0; int badarg = 0;
int ret = 1, rv; int ret = 1, rv;
int do_param = 0; int do_param = 0;
if (bio_err == NULL) if (bio_err == NULL)
bio_err = BIO_new_fp (stderr, BIO_NOCLOSE); bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
if (!load_config(bio_err, NULL)) if (!load_config(bio_err, NULL))
goto end; goto end;
outformat=FORMAT_PEM; outformat = FORMAT_PEM;
ERR_load_crypto_strings(); ERR_load_crypto_strings();
OpenSSL_add_all_algorithms(); OpenSSL_add_all_algorithms();
args = argv + 1; args = argv + 1;
while (!badarg && *args && *args[0] == '-') while (!badarg && *args && *args[0] == '-') {
{ if (!strcmp(*args, "-outform")) {
if (!strcmp(*args,"-outform")) if (args[1]) {
{ args++;
if (args[1]) outformat = str2fmt(*args);
{ } else
args++; badarg = 1;
outformat=str2fmt(*args); } else if (!strcmp(*args, "-pass")) {
} if (!args[1])
else badarg = 1; goto bad;
} passarg = *(++args);
else if (!strcmp(*args,"-pass")) }
{
if (!args[1]) goto bad;
passarg= *(++args);
}
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
else if (strcmp(*args,"-engine") == 0) else if (strcmp(*args, "-engine") == 0) {
{ if (!args[1])
if (!args[1]) goto bad;
goto bad; e = setup_engine(bio_err, *(++args), 0);
e = setup_engine(bio_err, *(++args), 0); }
}
#endif #endif
else if (!strcmp (*args, "-paramfile")) else if (!strcmp(*args, "-paramfile")) {
{ if (!args[1])
if (!args[1]) goto bad;
goto bad; args++;
args++; if (do_param == 1)
if (do_param == 1) goto bad;
goto bad; if (!init_keygen_file(bio_err, &ctx, *args, e))
if (!init_keygen_file(bio_err, &ctx, *args, e)) goto end;
goto end; } else if (!strcmp(*args, "-out")) {
} if (args[1]) {
else if (!strcmp (*args, "-out")) args++;
{ outfile = *args;
if (args[1]) } else
{ badarg = 1;
args++; } else if (strcmp(*args, "-algorithm") == 0) {
outfile = *args; if (!args[1])
} goto bad;
else badarg = 1; if (!init_gen_str(bio_err, &ctx, *(++args), e, do_param))
} goto end;
else if (strcmp(*args,"-algorithm") == 0) } else if (strcmp(*args, "-pkeyopt") == 0) {
{ if (!args[1])
if (!args[1]) goto bad;
goto bad; if (!ctx) {
if (!init_gen_str(bio_err, &ctx, *(++args),e, do_param)) BIO_puts(bio_err, "No keytype specified\n");
goto end; goto bad;
} } else if (pkey_ctrl_string(ctx, *(++args)) <= 0) {
else if (strcmp(*args,"-pkeyopt") == 0) BIO_puts(bio_err, "parameter setting error\n");
{ ERR_print_errors(bio_err);
if (!args[1]) goto end;
goto bad; }
if (!ctx) } else if (strcmp(*args, "-genparam") == 0) {
{ if (ctx)
BIO_puts(bio_err, "No keytype specified\n"); goto bad;
goto bad; do_param = 1;
} } else if (strcmp(*args, "-text") == 0)
else if (pkey_ctrl_string(ctx, *(++args)) <= 0) text = 1;
{ else {
BIO_puts(bio_err, "parameter setting error\n"); cipher = EVP_get_cipherbyname(*args + 1);
ERR_print_errors(bio_err); if (!cipher) {
goto end; BIO_printf(bio_err, "Unknown cipher %s\n", *args + 1);
} badarg = 1;
} }
else if (strcmp(*args,"-genparam") == 0) if (do_param == 1)
{ badarg = 1;
if (ctx) }
goto bad; args++;
do_param = 1; }
}
else if (strcmp(*args,"-text") == 0)
text=1;
else
{
cipher = EVP_get_cipherbyname(*args + 1);
if (!cipher)
{
BIO_printf(bio_err, "Unknown cipher %s\n",
*args + 1);
badarg = 1;
}
if (do_param == 1)
badarg = 1;
}
args++;
}
if (!ctx) if (!ctx)
badarg = 1; badarg = 1;
if (badarg) if (badarg) {
{ bad:
bad: BIO_printf(bio_err, "Usage: genpkey [options]\n");
BIO_printf(bio_err, "Usage: genpkey [options]\n"); BIO_printf(bio_err, "where options may be\n");
BIO_printf(bio_err, "where options may be\n"); BIO_printf(bio_err, "-out file output file\n");
BIO_printf(bio_err, "-out file output file\n"); BIO_printf(bio_err,
BIO_printf(bio_err, "-outform X output format (DER or PEM)\n"); "-outform X output format (DER or PEM)\n");
BIO_printf(bio_err, "-pass arg output file pass phrase source\n"); BIO_printf(bio_err,
BIO_printf(bio_err, "-<cipher> use cipher <cipher> to encrypt the key\n"); "-pass arg output file pass phrase source\n");
BIO_printf(bio_err,
"-<cipher> use cipher <cipher> to encrypt the key\n");
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
BIO_printf(bio_err, "-engine e use engine e, possibly a hardware device.\n"); BIO_printf(bio_err,
"-engine e use engine e, possibly a hardware device.\n");
#endif #endif
BIO_printf(bio_err, "-paramfile file parameters file\n"); BIO_printf(bio_err, "-paramfile file parameters file\n");
BIO_printf(bio_err, "-algorithm alg the public key algorithm\n"); BIO_printf(bio_err, "-algorithm alg the public key algorithm\n");
BIO_printf(bio_err, "-pkeyopt opt:value set the public key algorithm option <opt>\n" BIO_printf(bio_err,
" to value <value>\n"); "-pkeyopt opt:value set the public key algorithm option <opt>\n"
BIO_printf(bio_err, "-genparam generate parameters, not key\n"); " to value <value>\n");
BIO_printf(bio_err, "-text print the in text\n"); BIO_printf(bio_err,
BIO_printf(bio_err, "NB: options order may be important! See the manual page.\n"); "-genparam generate parameters, not key\n");
goto end; BIO_printf(bio_err, "-text print the in text\n");
} BIO_printf(bio_err,
"NB: options order may be important! See the manual page.\n");
goto end;
}
if (!app_passwd(bio_err, passarg, NULL, &pass, NULL)) if (!app_passwd(bio_err, passarg, NULL, &pass, NULL)) {
{ BIO_puts(bio_err, "Error getting password\n");
BIO_puts(bio_err, "Error getting password\n"); goto end;
goto end; }
}
if (outfile) if (outfile) {
{ if (!(out = BIO_new_file(outfile, "wb"))) {
if (!(out = BIO_new_file (outfile, "wb"))) BIO_printf(bio_err, "Can't open output file %s\n", outfile);
{ goto end;
BIO_printf(bio_err, }
"Can't open output file %s\n", outfile); } else {
goto end; out = BIO_new_fp(stdout, BIO_NOCLOSE);
}
}
else
{
out = BIO_new_fp (stdout, BIO_NOCLOSE);
#ifdef OPENSSL_SYS_VMS #ifdef OPENSSL_SYS_VMS
{ {
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); BIO *tmpbio = BIO_new(BIO_f_linebuffer());
out = BIO_push(tmpbio, out); out = BIO_push(tmpbio, out);
} }
#endif #endif
} }
EVP_PKEY_CTX_set_cb(ctx, genpkey_cb); EVP_PKEY_CTX_set_cb(ctx, genpkey_cb);
EVP_PKEY_CTX_set_app_data(ctx, bio_err); EVP_PKEY_CTX_set_app_data(ctx, bio_err);
if (do_param) if (do_param) {
{ if (EVP_PKEY_paramgen(ctx, &pkey) <= 0) {
if (EVP_PKEY_paramgen(ctx, &pkey) <= 0) BIO_puts(bio_err, "Error generating parameters\n");
{ ERR_print_errors(bio_err);
BIO_puts(bio_err, "Error generating parameters\n"); goto end;
ERR_print_errors(bio_err); }
goto end; } else {
} if (EVP_PKEY_keygen(ctx, &pkey) <= 0) {
} BIO_puts(bio_err, "Error generating key\n");
else ERR_print_errors(bio_err);
{ goto end;
if (EVP_PKEY_keygen(ctx, &pkey) <= 0) }
{ }
BIO_puts(bio_err, "Error generating key\n");
ERR_print_errors(bio_err);
goto end;
}
}
if (do_param) if (do_param)
rv = PEM_write_bio_Parameters(out, pkey); rv = PEM_write_bio_Parameters(out, pkey);
else if (outformat == FORMAT_PEM) else if (outformat == FORMAT_PEM)
rv = PEM_write_bio_PrivateKey(out, pkey, cipher, NULL, 0, rv = PEM_write_bio_PrivateKey(out, pkey, cipher, NULL, 0, NULL, pass);
NULL, pass); else if (outformat == FORMAT_ASN1)
else if (outformat == FORMAT_ASN1) rv = i2d_PrivateKey_bio(out, pkey);
rv = i2d_PrivateKey_bio(out, pkey); else {
else BIO_printf(bio_err, "Bad format specified for key\n");
{ goto end;
BIO_printf(bio_err, "Bad format specified for key\n"); }
goto end;
}
if (rv <= 0) if (rv <= 0) {
{ BIO_puts(bio_err, "Error writing key\n");
BIO_puts(bio_err, "Error writing key\n"); ERR_print_errors(bio_err);
ERR_print_errors(bio_err); }
}
if (text) if (text) {
{ if (do_param)
if (do_param) rv = EVP_PKEY_print_params(out, pkey, 0, NULL);
rv = EVP_PKEY_print_params(out, pkey, 0, NULL); else
else rv = EVP_PKEY_print_private(out, pkey, 0, NULL);
rv = EVP_PKEY_print_private(out, pkey, 0, NULL);
if (rv <= 0) if (rv <= 0) {
{ BIO_puts(bio_err, "Error printing key\n");
BIO_puts(bio_err, "Error printing key\n"); ERR_print_errors(bio_err);
ERR_print_errors(bio_err); }
} }
}
ret = 0; ret = 0;
end: end:
if (pkey) if (pkey)
EVP_PKEY_free(pkey); EVP_PKEY_free(pkey);
if (ctx) if (ctx)
EVP_PKEY_CTX_free(ctx); EVP_PKEY_CTX_free(ctx);
if (out) if (out)
BIO_free_all(out); BIO_free_all(out);
BIO_free(in); BIO_free(in);
if (pass) if (pass)
OPENSSL_free(pass); OPENSSL_free(pass);
return ret; return ret;
} }
static int init_keygen_file(BIO *err, EVP_PKEY_CTX **pctx, static int init_keygen_file(BIO *err, EVP_PKEY_CTX **pctx,
const char *file, ENGINE *e) const char *file, ENGINE *e)
{ {
BIO *pbio; BIO *pbio;
EVP_PKEY *pkey = NULL; EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *ctx = NULL; EVP_PKEY_CTX *ctx = NULL;
if (*pctx) if (*pctx) {
{ BIO_puts(err, "Parameters already set!\n");
BIO_puts(err, "Parameters already set!\n"); return 0;
return 0; }
}
pbio = BIO_new_file(file, "r"); pbio = BIO_new_file(file, "r");
if (!pbio) if (!pbio) {
{ BIO_printf(err, "Can't open parameter file %s\n", file);
BIO_printf(err, "Can't open parameter file %s\n", file); return 0;
return 0; }
}
pkey = PEM_read_bio_Parameters(pbio, NULL); pkey = PEM_read_bio_Parameters(pbio, NULL);
BIO_free(pbio); BIO_free(pbio);
if (!pkey) if (!pkey) {
{ BIO_printf(bio_err, "Error reading parameter file %s\n", file);
BIO_printf(bio_err, "Error reading parameter file %s\n", file); return 0;
return 0; }
}
ctx = EVP_PKEY_CTX_new(pkey, e); ctx = EVP_PKEY_CTX_new(pkey, e);
if (!ctx) if (!ctx)
goto err; goto err;
if (EVP_PKEY_keygen_init(ctx) <= 0) if (EVP_PKEY_keygen_init(ctx) <= 0)
goto err; goto err;
EVP_PKEY_free(pkey); EVP_PKEY_free(pkey);
*pctx = ctx; *pctx = ctx;
return 1; return 1;
err: err:
BIO_puts(err, "Error initializing context\n"); BIO_puts(err, "Error initializing context\n");
ERR_print_errors(err); ERR_print_errors(err);
if (ctx) if (ctx)
EVP_PKEY_CTX_free(ctx); EVP_PKEY_CTX_free(ctx);
if (pkey) if (pkey)
EVP_PKEY_free(pkey); EVP_PKEY_free(pkey);
return 0; return 0;
} }
int init_gen_str(BIO *err, EVP_PKEY_CTX **pctx, int init_gen_str(BIO *err, EVP_PKEY_CTX **pctx,
const char *algname, ENGINE *e, int do_param) const char *algname, ENGINE *e, int do_param)
{ {
EVP_PKEY_CTX *ctx = NULL; EVP_PKEY_CTX *ctx = NULL;
const EVP_PKEY_ASN1_METHOD *ameth; const EVP_PKEY_ASN1_METHOD *ameth;
ENGINE *tmpeng = NULL; ENGINE *tmpeng = NULL;
int pkey_id; int pkey_id;
if (*pctx) if (*pctx) {
{ BIO_puts(err, "Algorithm already set!\n");
BIO_puts(err, "Algorithm already set!\n"); return 0;
return 0; }
}
ameth = EVP_PKEY_asn1_find_str(&tmpeng, algname, -1); ameth = EVP_PKEY_asn1_find_str(&tmpeng, algname, -1);
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
if (!ameth && e) if (!ameth && e)
ameth = ENGINE_get_pkey_asn1_meth_str(e, algname, -1); ameth = ENGINE_get_pkey_asn1_meth_str(e, algname, -1);
#endif #endif
if (!ameth) if (!ameth) {
{ BIO_printf(bio_err, "Algorithm %s not found\n", algname);
BIO_printf(bio_err, "Algorithm %s not found\n", algname); return 0;
return 0; }
}
ERR_clear_error(); ERR_clear_error();
EVP_PKEY_asn1_get0_info(&pkey_id, NULL, NULL, NULL, NULL, ameth); EVP_PKEY_asn1_get0_info(&pkey_id, NULL, NULL, NULL, NULL, ameth);
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
if (tmpeng) if (tmpeng)
ENGINE_finish(tmpeng); ENGINE_finish(tmpeng);
#endif #endif
ctx = EVP_PKEY_CTX_new_id(pkey_id, e); ctx = EVP_PKEY_CTX_new_id(pkey_id, e);
if (!ctx) if (!ctx)
goto err; goto err;
if (do_param) if (do_param) {
{ if (EVP_PKEY_paramgen_init(ctx) <= 0)
if (EVP_PKEY_paramgen_init(ctx) <= 0) goto err;
goto err; } else {
} if (EVP_PKEY_keygen_init(ctx) <= 0)
else goto err;
{ }
if (EVP_PKEY_keygen_init(ctx) <= 0)
goto err;
}
*pctx = ctx; *pctx = ctx;
return 1; return 1;
err: err:
BIO_printf(err, "Error initializing %s context\n", algname); BIO_printf(err, "Error initializing %s context\n", algname);
ERR_print_errors(err); ERR_print_errors(err);
if (ctx) if (ctx)
EVP_PKEY_CTX_free(ctx); EVP_PKEY_CTX_free(ctx);
return 0; return 0;
} }
static int genpkey_cb(EVP_PKEY_CTX *ctx) static int genpkey_cb(EVP_PKEY_CTX *ctx)
{ {
char c='*'; char c = '*';
BIO *b = EVP_PKEY_CTX_get_app_data(ctx); BIO *b = EVP_PKEY_CTX_get_app_data(ctx);
int p; int p;
p = EVP_PKEY_CTX_get_keygen_info(ctx, 0); p = EVP_PKEY_CTX_get_keygen_info(ctx, 0);
if (p == 0) c='.'; if (p == 0)
if (p == 1) c='+'; c = '.';
if (p == 2) c='*'; if (p == 1)
if (p == 3) c='\n'; c = '+';
BIO_write(b,&c,1); if (p == 2)
(void)BIO_flush(b); c = '*';
if (p == 3)
c = '\n';
BIO_write(b, &c, 1);
(void)BIO_flush(b);
#ifdef LINT #ifdef LINT
p=n; p = n;
#endif #endif
return 1; return 1;
} }

Binary file not shown.

View File

@@ -57,279 +57,294 @@
*/ */
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
/* Until the key-gen callbacks are modified to use newer prototypes, we allow /*
* deprecated functions for openssl-internal code */ * Until the key-gen callbacks are modified to use newer prototypes, we allow
* deprecated functions for openssl-internal code
*/
#ifdef OPENSSL_NO_DEPRECATED #ifdef OPENSSL_NO_DEPRECATED
#undef OPENSSL_NO_DEPRECATED # undef OPENSSL_NO_DEPRECATED
#endif #endif
#ifndef OPENSSL_NO_RSA #ifndef OPENSSL_NO_RSA
#include <stdio.h> # include <stdio.h>
#include <string.h> # include <string.h>
#include <sys/types.h> # include <sys/types.h>
#include <sys/stat.h> # include <sys/stat.h>
#include "apps.h" # include "apps.h"
#include <openssl/bio.h> # include <openssl/bio.h>
#include <openssl/err.h> # include <openssl/err.h>
#include <openssl/bn.h> # include <openssl/bn.h>
#include <openssl/rsa.h> # include <openssl/rsa.h>
#include <openssl/evp.h> # include <openssl/evp.h>
#include <openssl/x509.h> # include <openssl/x509.h>
#include <openssl/pem.h> # include <openssl/pem.h>
#include <openssl/rand.h> # include <openssl/rand.h>
#define DEFBITS 512 # define DEFBITS 2048
#undef PROG # undef PROG
#define PROG genrsa_main # define PROG genrsa_main
static int MS_CALLBACK genrsa_cb(int p, int n, BN_GENCB *cb); static int MS_CALLBACK genrsa_cb(int p, int n, BN_GENCB *cb);
int MAIN(int, char **); int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
BN_GENCB cb; BN_GENCB cb;
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
ENGINE *e = NULL; ENGINE *e = NULL;
#endif # endif
int ret=1; int ret = 1;
int i,num=DEFBITS; int i, num = DEFBITS;
long l; long l;
const EVP_CIPHER *enc=NULL; const EVP_CIPHER *enc = NULL;
unsigned long f4=RSA_F4; unsigned long f4 = RSA_F4;
char *outfile=NULL; char *outfile = NULL;
char *passargout = NULL, *passout = NULL; char *passargout = NULL, *passout = NULL;
#ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
char *engine=NULL; char *engine = NULL;
#endif # endif
char *inrand=NULL; char *inrand = NULL;
BIO *out=NULL; BIO *out = NULL;
BIGNUM *bn = BN_new(); BIGNUM *bn = BN_new();
RSA *rsa = NULL; RSA *rsa = NULL;
if(!bn) goto err; if (!bn)
goto err;
apps_startup(); apps_startup();
BN_GENCB_set(&cb, genrsa_cb, bio_err); BN_GENCB_set(&cb, genrsa_cb, bio_err);
if (bio_err == NULL) if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL) if ((bio_err = BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
if (!load_config(bio_err, NULL)) if (!load_config(bio_err, NULL))
goto err; goto err;
if ((out=BIO_new(BIO_s_file())) == NULL) if ((out = BIO_new(BIO_s_file())) == NULL) {
{ BIO_printf(bio_err, "unable to create BIO for output\n");
BIO_printf(bio_err,"unable to create BIO for output\n"); goto err;
goto err; }
}
argv++; argv++;
argc--; argc--;
for (;;) for (;;) {
{ if (argc <= 0)
if (argc <= 0) break; break;
if (strcmp(*argv,"-out") == 0) if (strcmp(*argv, "-out") == 0) {
{ if (--argc < 1)
if (--argc < 1) goto bad; goto bad;
outfile= *(++argv); outfile = *(++argv);
} } else if (strcmp(*argv, "-3") == 0)
else if (strcmp(*argv,"-3") == 0) f4 = 3;
f4=3; else if (strcmp(*argv, "-F4") == 0 || strcmp(*argv, "-f4") == 0)
else if (strcmp(*argv,"-F4") == 0 || strcmp(*argv,"-f4") == 0) f4 = RSA_F4;
f4=RSA_F4; # ifndef OPENSSL_NO_ENGINE
#ifndef OPENSSL_NO_ENGINE else if (strcmp(*argv, "-engine") == 0) {
else if (strcmp(*argv,"-engine") == 0) if (--argc < 1)
{ goto bad;
if (--argc < 1) goto bad; engine = *(++argv);
engine= *(++argv); }
} # endif
#endif else if (strcmp(*argv, "-rand") == 0) {
else if (strcmp(*argv,"-rand") == 0) if (--argc < 1)
{ goto bad;
if (--argc < 1) goto bad; inrand = *(++argv);
inrand= *(++argv); }
} # ifndef OPENSSL_NO_DES
#ifndef OPENSSL_NO_DES else if (strcmp(*argv, "-des") == 0)
else if (strcmp(*argv,"-des") == 0) enc = EVP_des_cbc();
enc=EVP_des_cbc(); else if (strcmp(*argv, "-des3") == 0)
else if (strcmp(*argv,"-des3") == 0) enc = EVP_des_ede3_cbc();
enc=EVP_des_ede3_cbc(); # endif
#endif # ifndef OPENSSL_NO_IDEA
#ifndef OPENSSL_NO_IDEA else if (strcmp(*argv, "-idea") == 0)
else if (strcmp(*argv,"-idea") == 0) enc = EVP_idea_cbc();
enc=EVP_idea_cbc(); # endif
#endif # ifndef OPENSSL_NO_SEED
#ifndef OPENSSL_NO_SEED else if (strcmp(*argv, "-seed") == 0)
else if (strcmp(*argv,"-seed") == 0) enc = EVP_seed_cbc();
enc=EVP_seed_cbc(); # endif
#endif # ifndef OPENSSL_NO_AES
#ifndef OPENSSL_NO_AES else if (strcmp(*argv, "-aes128") == 0)
else if (strcmp(*argv,"-aes128") == 0) enc = EVP_aes_128_cbc();
enc=EVP_aes_128_cbc(); else if (strcmp(*argv, "-aes192") == 0)
else if (strcmp(*argv,"-aes192") == 0) enc = EVP_aes_192_cbc();
enc=EVP_aes_192_cbc(); else if (strcmp(*argv, "-aes256") == 0)
else if (strcmp(*argv,"-aes256") == 0) enc = EVP_aes_256_cbc();
enc=EVP_aes_256_cbc(); # endif
#endif # ifndef OPENSSL_NO_CAMELLIA
#ifndef OPENSSL_NO_CAMELLIA else if (strcmp(*argv, "-camellia128") == 0)
else if (strcmp(*argv,"-camellia128") == 0) enc = EVP_camellia_128_cbc();
enc=EVP_camellia_128_cbc(); else if (strcmp(*argv, "-camellia192") == 0)
else if (strcmp(*argv,"-camellia192") == 0) enc = EVP_camellia_192_cbc();
enc=EVP_camellia_192_cbc(); else if (strcmp(*argv, "-camellia256") == 0)
else if (strcmp(*argv,"-camellia256") == 0) enc = EVP_camellia_256_cbc();
enc=EVP_camellia_256_cbc(); # endif
#endif else if (strcmp(*argv, "-passout") == 0) {
else if (strcmp(*argv,"-passout") == 0) if (--argc < 1)
{ goto bad;
if (--argc < 1) goto bad; passargout = *(++argv);
passargout= *(++argv); } else
} break;
else argv++;
break; argc--;
argv++; }
argc--; if ((argc >= 1) && ((sscanf(*argv, "%d", &num) == 0) || (num < 0))) {
} bad:
if ((argc >= 1) && ((sscanf(*argv,"%d",&num) == 0) || (num < 0))) BIO_printf(bio_err, "usage: genrsa [args] [numbits]\n");
{ BIO_printf(bio_err,
bad: " -des encrypt the generated key with DES in cbc mode\n");
BIO_printf(bio_err,"usage: genrsa [args] [numbits]\n"); BIO_printf(bio_err,
BIO_printf(bio_err," -des encrypt the generated key with DES in cbc mode\n"); " -des3 encrypt the generated key with DES in ede cbc mode (168 bit key)\n");
BIO_printf(bio_err," -des3 encrypt the generated key with DES in ede cbc mode (168 bit key)\n"); # ifndef OPENSSL_NO_IDEA
#ifndef OPENSSL_NO_IDEA BIO_printf(bio_err,
BIO_printf(bio_err," -idea encrypt the generated key with IDEA in cbc mode\n"); " -idea encrypt the generated key with IDEA in cbc mode\n");
#endif # endif
#ifndef OPENSSL_NO_SEED # ifndef OPENSSL_NO_SEED
BIO_printf(bio_err," -seed\n"); BIO_printf(bio_err, " -seed\n");
BIO_printf(bio_err," encrypt PEM output with cbc seed\n"); BIO_printf(bio_err,
#endif " encrypt PEM output with cbc seed\n");
#ifndef OPENSSL_NO_AES # endif
BIO_printf(bio_err," -aes128, -aes192, -aes256\n"); # ifndef OPENSSL_NO_AES
BIO_printf(bio_err," encrypt PEM output with cbc aes\n"); BIO_printf(bio_err, " -aes128, -aes192, -aes256\n");
#endif BIO_printf(bio_err,
#ifndef OPENSSL_NO_CAMELLIA " encrypt PEM output with cbc aes\n");
BIO_printf(bio_err," -camellia128, -camellia192, -camellia256\n"); # endif
BIO_printf(bio_err," encrypt PEM output with cbc camellia\n"); # ifndef OPENSSL_NO_CAMELLIA
#endif BIO_printf(bio_err, " -camellia128, -camellia192, -camellia256\n");
BIO_printf(bio_err," -out file output the key to 'file\n"); BIO_printf(bio_err,
BIO_printf(bio_err," -passout arg output file pass phrase source\n"); " encrypt PEM output with cbc camellia\n");
BIO_printf(bio_err," -f4 use F4 (0x10001) for the E value\n"); # endif
BIO_printf(bio_err," -3 use 3 for the E value\n"); BIO_printf(bio_err, " -out file output the key to 'file\n");
#ifndef OPENSSL_NO_ENGINE BIO_printf(bio_err,
BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); " -passout arg output file pass phrase source\n");
#endif BIO_printf(bio_err,
BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); " -f4 use F4 (0x10001) for the E value\n");
BIO_printf(bio_err," load the file (or the files in the directory) into\n"); BIO_printf(bio_err, " -3 use 3 for the E value\n");
BIO_printf(bio_err," the random number generator\n"); # ifndef OPENSSL_NO_ENGINE
goto err; BIO_printf(bio_err,
} " -engine e use engine e, possibly a hardware device.\n");
# endif
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(); ERR_load_crypto_strings();
if(!app_passwd(bio_err, NULL, passargout, NULL, &passout)) { if (!app_passwd(bio_err, NULL, passargout, NULL, &passout)) {
BIO_printf(bio_err, "Error getting password\n"); BIO_printf(bio_err, "Error getting password\n");
goto err; goto err;
} }
# ifndef OPENSSL_NO_ENGINE
e = setup_engine(bio_err, engine, 0);
# endif
#ifndef OPENSSL_NO_ENGINE if (outfile == NULL) {
e = setup_engine(bio_err, engine, 0); BIO_set_fp(out, stdout, BIO_NOCLOSE);
#endif # ifdef OPENSSL_SYS_VMS
{
BIO *tmpbio = BIO_new(BIO_f_linebuffer());
out = BIO_push(tmpbio, out);
}
# endif
} else {
if (BIO_write_filename(out, outfile) <= 0) {
perror(outfile);
goto err;
}
}
if (outfile == NULL) if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL
{ && !RAND_status()) {
BIO_set_fp(out,stdout,BIO_NOCLOSE); BIO_printf(bio_err,
#ifdef OPENSSL_SYS_VMS "warning, not much extra random data, consider using the -rand option\n");
{ }
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); if (inrand != NULL)
out = BIO_push(tmpbio, out); BIO_printf(bio_err, "%ld semi-random bytes loaded\n",
} app_RAND_load_files(inrand));
#endif
}
else
{
if (BIO_write_filename(out,outfile) <= 0)
{
perror(outfile);
goto err;
}
}
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL BIO_printf(bio_err, "Generating RSA private key, %d bit long modulus\n",
&& !RAND_status()) num);
{ # ifdef OPENSSL_NO_ENGINE
BIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\n"); rsa = RSA_new();
} # else
if (inrand != NULL) rsa = RSA_new_method(e);
BIO_printf(bio_err,"%ld semi-random bytes loaded\n", # endif
app_RAND_load_files(inrand)); if (!rsa)
goto err;
BIO_printf(bio_err,"Generating RSA private key, %d bit long modulus\n", if (!BN_set_word(bn, f4) || !RSA_generate_key_ex(rsa, num, bn, &cb))
num); goto err;
#ifdef OPENSSL_NO_ENGINE
rsa = RSA_new();
#else
rsa = RSA_new_method(e);
#endif
if (!rsa)
goto err;
if(!BN_set_word(bn, f4) || !RSA_generate_key_ex(rsa, num, bn, &cb)) app_RAND_write_file(NULL, bio_err);
goto err;
app_RAND_write_file(NULL, bio_err); /*
* 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++) {
# ifndef SIXTY_FOUR_BIT
l <<= BN_BITS4;
l <<= BN_BITS4;
# endif
l += rsa->e->d[i];
}
BIO_printf(bio_err, "e is %ld (0x%lX)\n", l, l);
{
PW_CB_DATA cb_data;
cb_data.password = passout;
cb_data.prompt_info = outfile;
if (!PEM_write_bio_RSAPrivateKey(out, rsa, enc, NULL, 0,
(pem_password_cb *)password_callback,
&cb_data))
goto err;
}
/* We need to do the following for when the base number size is < ret = 0;
* long, esp windows 3.1 :-(. */ err:
l=0L; if (bn)
for (i=0; i<rsa->e->top; i++) BN_free(bn);
{ if (rsa)
#ifndef SIXTY_FOUR_BIT RSA_free(rsa);
l<<=BN_BITS4; if (out)
l<<=BN_BITS4; BIO_free_all(out);
#endif if (passout)
l+=rsa->e->d[i]; OPENSSL_free(passout);
} if (ret != 0)
BIO_printf(bio_err,"e is %ld (0x%lX)\n",l,l); ERR_print_errors(bio_err);
{ apps_shutdown();
PW_CB_DATA cb_data; OPENSSL_EXIT(ret);
cb_data.password = passout; }
cb_data.prompt_info = outfile;
if (!PEM_write_bio_RSAPrivateKey(out,rsa,enc,NULL,0,
(pem_password_cb *)password_callback,&cb_data))
goto err;
}
ret=0;
err:
if (bn) BN_free(bn);
if (rsa) RSA_free(rsa);
if (out) BIO_free_all(out);
if(passout) OPENSSL_free(passout);
if (ret != 0)
ERR_print_errors(bio_err);
apps_shutdown();
OPENSSL_EXIT(ret);
}
static int MS_CALLBACK genrsa_cb(int p, int n, BN_GENCB *cb) static int MS_CALLBACK genrsa_cb(int p, int n, BN_GENCB *cb)
{ {
char c='*'; char c = '*';
if (p == 0) c='.'; if (p == 0)
if (p == 1) c='+'; c = '.';
if (p == 2) c='*'; if (p == 1)
if (p == 3) c='\n'; c = '+';
BIO_write(cb->arg,&c,1); if (p == 2)
(void)BIO_flush(cb->arg); c = '*';
#ifdef LINT if (p == 3)
p=n; c = '\n';
#endif BIO_write(cb->arg, &c, 1);
return 1; (void)BIO_flush(cb->arg);
} # ifdef LINT
#else /* !OPENSSL_NO_RSA */ p = n;
# endif
return 1;
}
#else /* !OPENSSL_NO_RSA */
# if PEDANTIC # if PEDANTIC
static void *dummy=&dummy; static void *dummy = &dummy;
# endif # endif
#endif #endif

Binary file not shown.

107
apps/install-apps.com Executable file
View File

@@ -0,0 +1,107 @@
$! INSTALL.COM -- Installs the files in a given directory tree
$!
$! Author: Richard Levitte <richard@levitte.org>
$! Time of creation: 22-MAY-1998 10:13
$!
$! P1 root of the directory tree
$! P2 "64" for 64-bit pointers.
$!
$!
$! Announce/identify.
$!
$ proc = f$environment( "procedure")
$ write sys$output "@@@ "+ -
f$parse( proc, , , "name")+ f$parse( proc, , , "type")
$!
$ on error then goto tidy
$ on control_c then goto tidy
$!
$ if (p1 .eqs. "")
$ then
$ write sys$output "First argument missing."
$ write sys$output -
"It should be the directory where you want things installed."
$ exit
$ endif
$!
$ if (f$getsyi("cpu") .lt. 128)
$ then
$ arch = "VAX"
$ else
$ arch = f$edit( f$getsyi( "arch_name"), "upcase")
$ if (arch .eqs. "") then arch = "UNK"
$ endif
$!
$ archd = arch
$!
$ if (p2 .nes. "")
$ then
$ if (p2 .eqs. "64")
$ then
$ archd = arch+ "_64"
$ else
$ if (p2 .nes. "32")
$ then
$ write sys$output "Second argument invalid."
$ write sys$output "It should be "32", "64", or nothing."
$ exit
$ endif
$ endif
$ endif
$!
$ root = f$parse( p1, "[]A.;0", , , "syntax_only, no_conceal") - "A.;0"
$ root_dev = f$parse(root,,,"device","syntax_only")
$ root_dir = f$parse(root,,,"directory","syntax_only") - -
"[000000." - "][" - "[" - "]"
$ root = root_dev + "[" + root_dir
$!
$ define /nolog wrk_sslroot 'root'.] /trans=conc
$ define /nolog wrk_sslxexe wrk_sslroot:['archd'_exe]
$!
$ if f$parse("wrk_sslroot:[000000]") .eqs. "" then -
create /directory /log wrk_sslroot:[000000]
$ if f$parse("wrk_sslxexe:") .eqs. "" then -
create /directory /log wrk_sslxexe:
$!
$ exe := openssl
$!
$ exe_dir := [-.'archd'.exe.apps]
$!
$! Executables.
$!
$ i = 0
$ loop_exe:
$ e = f$edit(f$element( i, ",", exe), "trim")
$ i = i + 1
$ if e .eqs. "," then goto loop_exe_end
$ set noon
$ file = exe_dir+ e+ ".exe"
$ if f$search( file) .nes. ""
$ then
$ copy /protection = w:re 'file' wrk_sslxexe: /log
$ endif
$ set on
$ goto loop_exe
$ loop_exe_end:
$!
$! Miscellaneous.
$!
$ set noon
$ copy /protection = w:re ca.com wrk_sslxexe:ca.com /log
$ copy /protection = w:re openssl-vms.cnf wrk_sslroot:[000000]openssl.cnf /log
$ set on
$!
$ tidy:
$!
$ call deass wrk_sslroot
$ call deass wrk_sslxexe
$!
$ exit
$!
$ deass: subroutine
$ if (f$trnlnm( p1, "LNM$PROCESS") .nes. "")
$ then
$ deassign /process 'p1'
$ endif
$ endsubroutine
$!

View File

@@ -39,18 +39,35 @@ $! P4, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
$! $!
$! P5, if defined, sets a choice of programs to compile. $! P5, if defined, sets a choice of programs to compile.
$! $!
$! For 64 bit architectures (Alpha and IA64), specify the pointer size as P6. $! P6, if defined, specifies the C pointer size. Ignored on VAX.
$! For 32 bit architectures (VAX), P6 is ignored. $! ("64=ARGV" gives more efficient code with HP C V7.3 or newer.)
$! Currently supported values are: $! Supported values are:
$! $!
$! 32 To ge a library compiled with /POINTER_SIZE=32 $! "" Compile with default (/NOPOINTER_SIZE)
$! 64 To ge a library compiled with /POINTER_SIZE=64 $! 32 Compile with /POINTER_SIZE=32 (SHORT)
$! 64 Compile with /POINTER_SIZE=64[=ARGV] (LONG[=ARGV])
$! (Automatically select ARGV if compiler supports it.)
$! 64= Compile with /POINTER_SIZE=64 (LONG).
$! 64=ARGV Compile with /POINTER_SIZE=64=ARGV (LONG=ARGV).
$! $!
$! P7, if defined, specifies a directory where ZLIB files (zlib.h,
$! libz.olb) may be found. Optionally, a non-default object library
$! name may be included ("dev:[dir]libz_64.olb", for example).
$!
$!
$! Announce/identify.
$!
$ proc = f$environment( "procedure")
$ write sys$output "@@@ "+ -
f$parse( proc, , , "name")+ f$parse( proc, , , "type")
$!
$ on control_c then goto exit
$! $!
$! Define A TCP/IP Library That We Will Need To Link To. $! Define A TCP/IP Library That We Will Need To Link To.
$! (That Is, If We Need To Link To One.) $! (That Is, If We Need To Link To One.)
$! $!
$ TCPIP_LIB = "" $ TCPIP_LIB = ""
$ ZLIB_LIB = ""
$! $!
$! Check What Architecture We Are Using. $! Check What Architecture We Are Using.
$! $!
@@ -74,37 +91,53 @@ $! End The Architecture Check.
$! $!
$ ENDIF $ ENDIF
$! $!
$ ARCHD = ARCH
$ LIB32 = "32"
$ OPT_FILE = ""
$ POINTER_SIZE = ""
$!
$! Define what programs should be compiled $! Define what programs should be compiled
$! $!
$ PROGRAMS := OPENSSL $ PROGRAMS := OPENSSL
$! $!
$! Define The CRYPTO Library.
$!
$ CRYPTO_LIB := SYS$DISK:[-.'ARCH'.EXE.CRYPTO]LIBCRYPTO'LIB32'.OLB
$!
$! Define The SSL Library.
$!
$ SSL_LIB := SYS$DISK:[-.'ARCH'.EXE.SSL]LIBSSL'LIB32'.OLB
$!
$! Define The OBJ Directory.
$!
$ OBJ_DIR := SYS$DISK:[-.'ARCH'.OBJ.APPS]
$!
$! Define The EXE Directory.
$!
$ EXE_DIR := SYS$DISK:[-.'ARCH'.EXE.APPS]
$!
$! Check To Make Sure We Have Valid Command Line Parameters. $! Check To Make Sure We Have Valid Command Line Parameters.
$! $!
$ GOSUB CHECK_OPTIONS $ GOSUB CHECK_OPTIONS
$! $!
$! Define The CRYPTO Library.
$!
$ CRYPTO_LIB := SYS$DISK:[-.'ARCHD'.EXE.CRYPTO]SSL_LIBCRYPTO'LIB32'.OLB
$!
$! Define The SSL Library.
$!
$ SSL_LIB := SYS$DISK:[-.'ARCHD'.EXE.SSL]SSL_LIBSSL'LIB32'.OLB
$!
$! Define The OBJ and EXE Directories.
$!
$ OBJ_DIR := SYS$DISK:[-.'ARCHD'.OBJ.APPS]
$ EXE_DIR := SYS$DISK:[-.'ARCHD'.EXE.APPS]
$!
$! Specify the destination directory in any /MAP option.
$!
$ if (LINKMAP .eqs. "MAP")
$ then
$ LINKMAP = LINKMAP+ "=''EXE_DIR'"
$ endif
$!
$! Add the location prefix to the linker options file name.
$!
$ if (OPT_FILE .nes. "")
$ then
$ OPT_FILE = EXE_DIR+ OPT_FILE
$ endif
$!
$! Initialise logical names and such $! Initialise logical names and such
$! $!
$ GOSUB INITIALISE $ GOSUB INITIALISE
$! $!
$! Tell The User What Kind of Machine We Run On. $! Tell The User What Kind of Machine We Run On.
$! $!
$ WRITE SYS$OUTPUT "Compiling On A ",ARCH," Machine." $ WRITE SYS$OUTPUT "Host system architecture: ''ARCHD'"
$! $!
$! Check To See If The OBJ Directory Exists. $! Check To See If The OBJ Directory Exists.
$! $!
@@ -151,7 +184,10 @@ $ LIB_OPENSSL = "VERIFY,ASN1PARS,REQ,DGST,DH,DHPARAM,ENC,PASSWD,GENDH,ERRSTR,"+-
"X509,GENRSA,GENDSA,GENPKEY,S_SERVER,S_CLIENT,SPEED,"+- "X509,GENRSA,GENDSA,GENPKEY,S_SERVER,S_CLIENT,SPEED,"+-
"S_TIME,APPS,S_CB,S_SOCKET,APP_RAND,VERSION,SESS_ID,"+- "S_TIME,APPS,S_CB,S_SOCKET,APP_RAND,VERSION,SESS_ID,"+-
"CIPHERS,NSEQ,PKCS12,PKCS8,PKEY,PKEYPARAM,PKEYUTL,"+ - "CIPHERS,NSEQ,PKCS12,PKCS8,PKEY,PKEYPARAM,PKEYUTL,"+ -
"SPKAC,SMIME,CMS,RAND,ENGINE,OCSP,PRIME,TS" "SPKAC,SMIME,CMS,RAND,ENGINE,OCSP,PRIME,TS,SRP"
$!
$ LIB_OPENSSL = LIB_OPENSSL+ ",VMS_DECC_INIT"
$!
$ TCPIP_PROGRAMS = ",," $ TCPIP_PROGRAMS = ",,"
$ IF COMPILER .EQS. "VAXC" THEN - $ IF COMPILER .EQS. "VAXC" THEN -
TCPIP_PROGRAMS = ",OPENSSL," TCPIP_PROGRAMS = ",OPENSSL,"
@@ -209,7 +245,7 @@ $ LIB_COUNTER = -1
$! $!
$! Create a .OPT file for the object files $! Create a .OPT file for the object files
$! $!
$ OPEN/WRITE OBJECTS 'EXE_DIR''CURRENT_APP'.OPT $ OPEN /WRITE OBJECTS 'EXE_DIR''CURRENT_APP'.OPT
$! $!
$! Top Of The File Loop. $! Top Of The File Loop.
$! $!
@@ -296,34 +332,18 @@ $ GOTO NEXT_APP
$ ENDIF $ ENDIF
$! $!
$! Link The Program. $! Link The Program.
$! Check To See If We Are To Link With A Specific TCP/IP Library.
$! $!
$ ON WARNING THEN GOTO NEXT_APP $ ON WARNING THEN GOTO NEXT_APP
$! $!
$ IF (TCPIP_LIB.NES."")
$ THEN
$!
$! Don't Link With The RSAREF Routines And TCP/IP Library. $! Don't Link With The RSAREF Routines And TCP/IP Library.
$! $!
$ LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' - $ LINK /'DEBUGGER' /'LINKMAP' /'TRACEBACK' /EXE='EXE_FILE' -
'EXE_DIR''CURRENT_APP'.OPT/OPTION, - 'EXE_DIR''CURRENT_APP'.OPT /OPTIONS, -
'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY, - 'SSL_LIB' /LIBRARY, -
'TCPIP_LIB','OPT_FILE'/OPTION 'CRYPTO_LIB' /LIBRARY -
$! 'TCPIP_LIB' -
$! Else... 'ZLIB_LIB' -
$! ,'OPT_FILE' /OPTIONS
$ ELSE
$!
$! Don't Link With The RSAREF Routines And Link With A TCP/IP Library.
$!
$ LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' -
'EXE_DIR''CURRENT_APP'.OPT/OPTION, -
'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY, -
'OPT_FILE'/OPTION
$!
$! End The TCP/IP Library Check.
$!
$ ENDIF
$! $!
$! Go Back And Do It Again. $! Go Back And Do It Again.
$! $!
@@ -358,7 +378,7 @@ $!
$ CREATE 'OPT_FILE' $ CREATE 'OPT_FILE'
$DECK $DECK
! !
! Default System Options File To Link Agianst ! Default System Options File To Link Against
! The Sharable VAX C Runtime Library. ! The Sharable VAX C Runtime Library.
! !
SYS$SHARE:VAXCRTL.EXE/SHARE SYS$SHARE:VAXCRTL.EXE/SHARE
@@ -387,7 +407,7 @@ $!
$ CREATE 'OPT_FILE' $ CREATE 'OPT_FILE'
$DECK $DECK
! !
! Default System Options File To Link Agianst ! Default System Options File To Link Against
! The Sharable C Runtime Library. ! The Sharable C Runtime Library.
! !
GNU_CC:[000000]GCCLIB/LIBRARY GNU_CC:[000000]GCCLIB/LIBRARY
@@ -422,7 +442,7 @@ $!
$ CREATE 'OPT_FILE' $ CREATE 'OPT_FILE'
$DECK $DECK
! !
! Default System Options File To Link Agianst ! Default System Options File To Link Against
! The Sharable DEC C Runtime Library. ! The Sharable DEC C Runtime Library.
! !
SYS$SHARE:DECC$SHR.EXE/SHARE SYS$SHARE:DECC$SHR.EXE/SHARE
@@ -437,7 +457,7 @@ $!
$ CREATE 'OPT_FILE' $ CREATE 'OPT_FILE'
$DECK $DECK
! !
! Default System Options File For non-VAX To Link Agianst ! Default System Options File For non-VAX To Link Against
! The Sharable C Runtime Library. ! The Sharable C Runtime Library.
! !
SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE
@@ -521,14 +541,15 @@ $!
$ IF (P1.EQS."NODEBUG") $ IF (P1.EQS."NODEBUG")
$ THEN $ THEN
$! $!
$! P1 Is NODEBUG, So Compile Without Debugger Information. $! P1 Is NODEBUG, So Compile Without Debugger Information.
$! $!
$ DEBUGGER = "NODEBUG" $ DEBUGGER = "NODEBUG"
$ TRACEBACK = "NOTRACEBACK" $ LINKMAP = "NOMAP"
$ GCC_OPTIMIZE = "OPTIMIZE" $ TRACEBACK = "NOTRACEBACK"
$ CC_OPTIMIZE = "OPTIMIZE" $ GCC_OPTIMIZE = "OPTIMIZE"
$ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile." $ CC_OPTIMIZE = "OPTIMIZE"
$ WRITE SYS$OUTPUT "Compiling With Compiler Optimization." $ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile."
$ WRITE SYS$OUTPUT "Compiling With Compiler Optimization."
$! $!
$! Else... $! Else...
$! $!
@@ -542,6 +563,7 @@ $!
$! Compile With Debugger Information. $! Compile With Debugger Information.
$! $!
$ DEBUGGER = "DEBUG" $ DEBUGGER = "DEBUG"
$ LINKMAP = "MAP"
$ TRACEBACK = "TRACEBACK" $ TRACEBACK = "TRACEBACK"
$ GCC_OPTIMIZE = "NOOPTIMIZE" $ GCC_OPTIMIZE = "NOOPTIMIZE"
$ CC_OPTIMIZE = "NOOPTIMIZE" $ CC_OPTIMIZE = "NOOPTIMIZE"
@@ -549,7 +571,7 @@ $ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile."
$ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization." $ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization."
$ ELSE $ ELSE
$! $!
$! Tell The User Entered An Invalid Option.. $! Tell The User Entered An Invalid Option.
$! $!
$ WRITE SYS$OUTPUT "" $ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:" $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:"
@@ -570,58 +592,87 @@ $! End The P1 Check.
$! $!
$ ENDIF $ ENDIF
$! $!
$! Check To See If P6 Is Blank. $! Check P6 (POINTER_SIZE).
$! $!
$ IF (P6.EQS."") $ IF (P6 .NES. "") .AND. (ARCH .NES. "VAX")
$ THEN $ THEN
$ POINTER_SIZE = ""
$ ELSE
$! $!
$! Check is P6 Is Valid $ IF (P6 .EQS. "32")
$!
$ IF (P6.EQS."32")
$ THEN $ THEN
$ POINTER_SIZE = "/POINTER_SIZE=32" $ POINTER_SIZE = " /POINTER_SIZE=32"
$ IF ARCH .EQS. "VAX"
$ THEN
$ LIB32 = ""
$ ELSE
$ LIB32 = "32"
$ ENDIF
$ ELSE $ ELSE
$ IF (P6.EQS."64") $ POINTER_SIZE = F$EDIT( P6, "COLLAPSE, UPCASE")
$ IF ((POINTER_SIZE .EQS. "64") .OR. -
(POINTER_SIZE .EQS. "64=") .OR. -
(POINTER_SIZE .EQS. "64=ARGV"))
$ THEN $ THEN
$ ARCHD = ARCH+ "_64"
$ LIB32 = "" $ LIB32 = ""
$ IF ARCH .EQS. "VAX" $ IF (F$EXTRACT( 2, 1, POINTER_SIZE) .EQS. "=")
$ THEN $ THEN
$ POINTER_SIZE = "/POINTER_SIZE=32" $! Explicit user choice: "64" or "64=ARGV".
$ IF (POINTER_SIZE .EQS. "64=") THEN POINTER_SIZE = "64"
$ ELSE $ ELSE
$ POINTER_SIZE = "/POINTER_SIZE=64" $ SET NOON
$ DEFINE /USER_MODE SYS$OUTPUT NL:
$ DEFINE /USER_MODE SYS$ERROR NL:
$ CC /NOLIST /NOOBJECT /POINTER_SIZE=64=ARGV NL:
$ IF ($STATUS .AND. %X0FFF0000) .EQ. %X00030000
$ THEN
$ ! If we got here, it means DCL complained like this:
$ ! %DCL-W-NOVALU, value not allowed - remove value specification
$ ! \64=\
$ !
$ ! If the compiler was run, logicals defined in /USER would
$ ! have been deassigned automatically. However, when DCL
$ ! complains, they aren't, so we do it here (it might be
$ ! unnecessary, but just in case there will be another error
$ ! message further on that we don't want to miss)
$ DEASSIGN /USER_MODE SYS$ERROR
$ DEASSIGN /USER_MODE SYS$OUTPUT
$ ELSE
$ POINTER_SIZE = POINTER_SIZE + "=ARGV"
$ ENDIF
$ SET ON
$ ENDIF $ ENDIF
$ POINTER_SIZE = " /POINTER_SIZE=''POINTER_SIZE'"
$!
$ ELSE $ ELSE
$! $!
$! Tell The User Entered An Invalid Option.. $! Tell The User Entered An Invalid Option.
$! $!
$ WRITE SYS$OUTPUT "" $ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "The Option ",P6," Is Invalid. The Valid Options Are:" $ WRITE SYS$OUTPUT "The Option ", P6, -
" Is Invalid. The Valid Options Are:"
$ WRITE SYS$OUTPUT "" $ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT " 32 : Compile with 32 bit pointer size" $ WRITE SYS$OUTPUT -
$ WRITE SYS$OUTPUT " 64 : Compile with 64 bit pointer size" " """" : Compile with default (short) pointers."
$ WRITE SYS$OUTPUT -
" 32 : Compile with 32-bit (short) pointers."
$ WRITE SYS$OUTPUT -
" 64 : Compile with 64-bit (long) pointers (auto ARGV)."
$ WRITE SYS$OUTPUT -
" 64= : Compile with 64-bit (long) pointers (no ARGV)."
$ WRITE SYS$OUTPUT -
" 64=ARGV : Compile with 64-bit (long) pointers (ARGV)."
$ WRITE SYS$OUTPUT "" $ WRITE SYS$OUTPUT ""
$! $!
$! Time To EXIT. $! Time To EXIT.
$! $!
$ GOTO TIDY $ EXIT
$!
$! End The Valid Arguement Check.
$! $!
$ ENDIF $ ENDIF
$!
$ ENDIF $ ENDIF
$! $!
$! End The P6 Check. $! End The P6 (POINTER_SIZE) Check.
$! $!
$ ENDIF $ ENDIF
$! $!
$! Set basic C compiler /INCLUDE directories.
$!
$ CC_INCLUDES = "SYS$DISK:[-],SYS$DISK:[-.CRYPTO]"
$!
$! Check To See If P2 Is Blank. $! Check To See If P2 Is Blank.
$! $!
$ IF (P2.EQS."") $ IF (P2.EQS."")
@@ -722,11 +773,67 @@ $ CCDEFS = "MONOLITH"
$ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS
$ CCEXTRAFLAGS = "" $ CCEXTRAFLAGS = ""
$ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS
$ CCDISABLEWARNINGS = "LONGLONGTYPE,LONGLONGSUFX,FOUNDCR" $ CCDISABLEWARNINGS = "" !!! "MAYLOSEDATA3" !!! "LONGLONGTYPE,LONGLONGSUFX,FOUNDCR"
$ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN - $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. ""
CCDISABLEWARNINGS = CCDISABLEWARNINGS + "," + USER_CCDISABLEWARNINGS $ THEN
$ IF CCDISABLEWARNINGS .NES. THEN CCDISABLEWARNINGS = CCDISABLEWARNINGS + ","
$ CCDISABLEWARNINGS = CCDISABLEWARNINGS + USER_CCDISABLEWARNINGS
$ ENDIF
$! $!
$! Check To See If The User Entered A Valid Paramter. $! Check To See If We Have A ZLIB Option.
$!
$ ZLIB = P7
$ IF (ZLIB .NES. "")
$ THEN
$!
$! Check for expected ZLIB files.
$!
$ err = 0
$ file1 = f$parse( "zlib.h", ZLIB, , , "SYNTAX_ONLY")
$ if (f$search( file1) .eqs. "")
$ then
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "The Option ", ZLIB, " Is Invalid."
$ WRITE SYS$OUTPUT " Can't find header: ''file1'"
$ err = 1
$ endif
$ file1 = f$parse( "A.;", ZLIB)- "A.;"
$!
$ file2 = f$parse( ZLIB, "libz.olb", , , "SYNTAX_ONLY")
$ if (f$search( file2) .eqs. "")
$ then
$ if (err .eq. 0)
$ then
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "The Option ", ZLIB, " Is Invalid."
$ endif
$ WRITE SYS$OUTPUT " Can't find library: ''file2'"
$ WRITE SYS$OUTPUT ""
$ err = err+ 2
$ endif
$ if (err .eq. 1)
$ then
$ WRITE SYS$OUTPUT ""
$ endif
$!
$ if (err .ne. 0)
$ then
$ EXIT
$ endif
$!
$ CCDEFS = """ZLIB=1"", "+ CCDEFS
$ CC_INCLUDES = CC_INCLUDES+ ", "+ file1
$ ZLIB_LIB = ", ''file2' /library"
$!
$! Print info
$!
$ WRITE SYS$OUTPUT "ZLIB library spec: ", file2
$!
$! End The ZLIB Check.
$!
$ ENDIF
$!
$! Check To See If The User Entered A Valid Parameter.
$! $!
$ IF (P2.EQS."VAXC").OR.(P2.EQS."DECC").OR.(P2.EQS."GNUC") $ IF (P2.EQS."VAXC").OR.(P2.EQS."DECC").OR.(P2.EQS."GNUC")
$ THEN $ THEN
@@ -749,13 +856,13 @@ $!
$ CC = "CC" $ CC = "CC"
$ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" - $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
THEN CC = "CC/DECC" THEN CC = "CC/DECC"
$ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89''POINTER_SIZE'" + - $ CC = CC + " /''CC_OPTIMIZE' /''DEBUGGER' /STANDARD=RELAXED"+ -
"/NOLIST/PREFIX=ALL" + - "''POINTER_SIZE' /NOLIST /PREFIX=ALL" + -
"/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS " /INCLUDE=(''CC_INCLUDES') " + CCEXTRAFLAGS
$! $!
$! Define The Linker Options File Name. $! Define The Linker Options File Name.
$! $!
$ OPT_FILE = "''EXE_DIR'VAX_DECC_OPTIONS.OPT" $ OPT_FILE = "VAX_DECC_OPTIONS.OPT"
$! $!
$! End DECC Check. $! End DECC Check.
$! $!
@@ -783,7 +890,7 @@ $ EXIT
$ ENDIF $ ENDIF
$ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC" $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC"
$ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
"/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS "/INCLUDE=(''CC_INCLUDES')" + CCEXTRAFLAGS
$ CCDEFS = CCDEFS + ",""VAXC""" $ CCDEFS = CCDEFS + ",""VAXC"""
$! $!
$! Define <sys> As SYS$COMMON:[SYSLIB] $! Define <sys> As SYS$COMMON:[SYSLIB]
@@ -792,7 +899,7 @@ $ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB]
$! $!
$! Define The Linker Options File Name. $! Define The Linker Options File Name.
$! $!
$ OPT_FILE = "''EXE_DIR'VAX_VAXC_OPTIONS.OPT" $ OPT_FILE = "VAX_VAXC_OPTIONS.OPT"
$! $!
$! End VAXC Check $! End VAXC Check
$! $!
@@ -815,11 +922,11 @@ $! Use GNU C...
$! $!
$ IF F$TYPE(GCC) .EQS. "" THEN GCC := GCC $ IF F$TYPE(GCC) .EQS. "" THEN GCC := GCC
$ CC = GCC+"/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - $ CC = GCC+"/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
"/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS "/INCLUDE=(''CC_INCLUDES')" + CCEXTRAFLAGS
$! $!
$! Define The Linker Options File Name. $! Define The Linker Options File Name.
$! $!
$ OPT_FILE = "''EXE_DIR'VAX_GNUC_OPTIONS.OPT" $ OPT_FILE = "VAX_GNUC_OPTIONS.OPT"
$! $!
$! End The GNU C Check. $! End The GNU C Check.
$! $!
@@ -861,7 +968,7 @@ $ THEN
$! $!
$! Set the library to use SOCKETSHR $! Set the library to use SOCKETSHR
$! $!
$ TCPIP_LIB = "SYS$DISK:[-.VMS]SOCKETSHR_SHR.OPT/OPT" $ TCPIP_LIB = ",SYS$DISK:[-.VMS]SOCKETSHR_SHR.OPT /OPTIONS"
$! $!
$! Done with SOCKETSHR $! Done with SOCKETSHR
$! $!
@@ -887,13 +994,13 @@ $ THEN
$! $!
$! Set the library to use UCX. $! Set the library to use UCX.
$! $!
$ TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_DECC.OPT/OPT" $ TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_DECC.OPT /OPTIONS"
$ IF F$TRNLNM("UCX$IPC_SHR") .NES. "" $ IF F$TRNLNM("UCX$IPC_SHR") .NES. ""
$ THEN $ THEN
$ TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_DECC_LOG.OPT/OPT" $ TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_DECC_LOG.OPT /OPTIONS"
$ ELSE $ ELSE
$ IF COMPILER .NES. "DECC" .AND. ARCH .EQS. "VAX" THEN - $ IF COMPILER .NES. "DECC" .AND. ARCH .EQS. "VAX" THEN -
TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_VAXC.OPT/OPT" TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_VAXC.OPT /OPTIONS"
$ ENDIF $ ENDIF
$! $!
$! Done with UCX $! Done with UCX
@@ -907,7 +1014,7 @@ $ THEN
$! $!
$! Set the library to use TCPIP. $! Set the library to use TCPIP.
$! $!
$ TCPIP_LIB = "SYS$DISK:[-.VMS]TCPIP_SHR_DECC.OPT/OPT" $ TCPIP_LIB = ",SYS$DISK:[-.VMS]TCPIP_SHR_DECC.OPT /OPTIONS"
$! $!
$! Done with TCPIP $! Done with TCPIP
$! $!
@@ -932,7 +1039,7 @@ $ CCDEFS = CCDEFS + ",TCPIP_TYPE_''P3'"
$! $!
$! Print info $! Print info
$! $!
$ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB $ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB- ","
$! $!
$! Else The User Entered An Invalid Argument. $! Else The User Entered An Invalid Argument.
$! $!
@@ -960,15 +1067,27 @@ $! Finish up the definition of CC.
$! $!
$ IF COMPILER .EQS. "DECC" $ IF COMPILER .EQS. "DECC"
$ THEN $ THEN
$! Not all compiler versions support MAYLOSEDATA3.
$ OPT_TEST = "MAYLOSEDATA3"
$ DEFINE /USER_MODE SYS$ERROR NL:
$ DEFINE /USER_MODE SYS$OUTPUT NL:
$ 'CC' /NOCROSS_REFERENCE /NOLIST /NOOBJECT -
/WARNINGS = DISABLE = ('OPT_TEST', EMPTYFILE) NL:
$ IF ($SEVERITY)
$ THEN
$ IF CCDISABLEWARNINGS .NES. "" THEN -
CCDISABLEWARNINGS = CCDISABLEWARNINGS+ ","
$ CCDISABLEWARNINGS = CCDISABLEWARNINGS+ OPT_TEST
$ ENDIF
$ IF CCDISABLEWARNINGS .NES. "" $ IF CCDISABLEWARNINGS .NES. ""
$ THEN $ THEN
$ CCDISABLEWARNINGS = "/WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))" $ CCDISABLEWARNINGS = " /WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))"
$ ENDIF $ ENDIF
$ ELSE $ ELSE
$ CCDISABLEWARNINGS = "" $ CCDISABLEWARNINGS = ""
$ ENDIF $ ENDIF
$ CC2 = CC + "/DEFINE=(" + CCDEFS + ",_POSIX_C_SOURCE)" + CCDISABLEWARNINGS $ CC2 = CC + " /DEFINE=(" + CCDEFS + ",_POSIX_C_SOURCE)" + CCDISABLEWARNINGS
$ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS $ CC = CC + " /DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS
$! $!
$! Show user the result $! Show user the result
$! $!
@@ -1034,7 +1153,7 @@ $ __INCLUDE = __TOP + "INCLUDE.OPENSSL]"
$! $!
$! Set up the logical name OPENSSL to point at the include directory $! Set up the logical name OPENSSL to point at the include directory
$! $!
$ DEFINE OPENSSL/NOLOG '__INCLUDE' $ DEFINE OPENSSL /NOLOG '__INCLUDE'
$! $!
$! Done $! Done
$! $!
@@ -1042,15 +1161,24 @@ $ RETURN
$! $!
$ CLEANUP: $ CLEANUP:
$! $!
$! Restore the logical name OPENSSL if it had a value $! Restore the saved logical name OPENSSL, if it had a value.
$! $!
$ IF __SAVE_OPENSSL .EQS. "" $ if (f$type( __SAVE_OPENSSL) .nes. "")
$ THEN $ then
$ DEASSIGN OPENSSL $ IF __SAVE_OPENSSL .EQS. ""
$ ELSE $ THEN
$ DEFINE/NOLOG OPENSSL '__SAVE_OPENSSL' $ DEASSIGN OPENSSL
$ ENDIF $ ELSE
$ DEFINE /NOLOG OPENSSL '__SAVE_OPENSSL'
$ ENDIF
$ endif
$!
$! Close any open files.
$!
$ if (f$trnlnm( "objects", "LNM$PROCESS", 0, "SUPERVISOR") .nes. "") then -
close objects
$! $!
$! Done $! Done
$! $!
$ RETURN $ RETURN
$!

View File

@@ -1,6 +1,7 @@
/* nseq.c */ /* nseq.c */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL /*
* project 1999. * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
* 1999.
*/ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved. * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
@@ -69,99 +70,101 @@ int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
char **args, *infile = NULL, *outfile = NULL; char **args, *infile = NULL, *outfile = NULL;
BIO *in = NULL, *out = NULL; BIO *in = NULL, *out = NULL;
int toseq = 0; int toseq = 0;
X509 *x509 = NULL; X509 *x509 = NULL;
NETSCAPE_CERT_SEQUENCE *seq = NULL; NETSCAPE_CERT_SEQUENCE *seq = NULL;
int i, ret = 1; int i, ret = 1;
int badarg = 0; int badarg = 0;
if (bio_err == NULL) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE); if (bio_err == NULL)
ERR_load_crypto_strings(); bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
args = argv + 1; ERR_load_crypto_strings();
while (!badarg && *args && *args[0] == '-') { args = argv + 1;
if (!strcmp (*args, "-toseq")) toseq = 1; while (!badarg && *args && *args[0] == '-') {
else if (!strcmp (*args, "-in")) { if (!strcmp(*args, "-toseq"))
if (args[1]) { toseq = 1;
args++; else if (!strcmp(*args, "-in")) {
infile = *args; if (args[1]) {
} else badarg = 1; args++;
} else if (!strcmp (*args, "-out")) { infile = *args;
if (args[1]) { } else
args++; badarg = 1;
outfile = *args; } else if (!strcmp(*args, "-out")) {
} else badarg = 1; if (args[1]) {
} else badarg = 1; args++;
args++; outfile = *args;
} } else
badarg = 1;
} else
badarg = 1;
args++;
}
if (badarg) { if (badarg) {
BIO_printf (bio_err, "Netscape certificate sequence utility\n"); BIO_printf(bio_err, "Netscape certificate sequence utility\n");
BIO_printf (bio_err, "Usage nseq [options]\n"); BIO_printf(bio_err, "Usage nseq [options]\n");
BIO_printf (bio_err, "where options are\n"); BIO_printf(bio_err, "where options are\n");
BIO_printf (bio_err, "-in file input file\n"); BIO_printf(bio_err, "-in file input file\n");
BIO_printf (bio_err, "-out file output file\n"); BIO_printf(bio_err, "-out file output file\n");
BIO_printf (bio_err, "-toseq output NS Sequence file\n"); BIO_printf(bio_err, "-toseq output NS Sequence file\n");
OPENSSL_EXIT(1); OPENSSL_EXIT(1);
} }
if (infile) { if (infile) {
if (!(in = BIO_new_file (infile, "r"))) { if (!(in = BIO_new_file(infile, "r"))) {
BIO_printf (bio_err, BIO_printf(bio_err, "Can't open input file %s\n", infile);
"Can't open input file %s\n", infile); goto end;
goto end; }
} } else
} else in = BIO_new_fp(stdin, BIO_NOCLOSE); in = BIO_new_fp(stdin, BIO_NOCLOSE);
if (outfile) { if (outfile) {
if (!(out = BIO_new_file (outfile, "w"))) { if (!(out = BIO_new_file(outfile, "w"))) {
BIO_printf (bio_err, BIO_printf(bio_err, "Can't open output file %s\n", outfile);
"Can't open output file %s\n", outfile); goto end;
goto end; }
} } else {
} else { out = BIO_new_fp(stdout, BIO_NOCLOSE);
out = BIO_new_fp(stdout, BIO_NOCLOSE);
#ifdef OPENSSL_SYS_VMS #ifdef OPENSSL_SYS_VMS
{ {
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); BIO *tmpbio = BIO_new(BIO_f_linebuffer());
out = BIO_push(tmpbio, out); out = BIO_push(tmpbio, out);
} }
#endif #endif
} }
if (toseq) { if (toseq) {
seq = NETSCAPE_CERT_SEQUENCE_new(); seq = NETSCAPE_CERT_SEQUENCE_new();
seq->certs = sk_X509_new_null(); seq->certs = sk_X509_new_null();
while((x509 = PEM_read_bio_X509(in, NULL, NULL, NULL))) while ((x509 = PEM_read_bio_X509(in, NULL, NULL, NULL)))
sk_X509_push(seq->certs,x509); sk_X509_push(seq->certs, x509);
if(!sk_X509_num(seq->certs)) if (!sk_X509_num(seq->certs)) {
{ BIO_printf(bio_err, "Error reading certs file %s\n", infile);
BIO_printf (bio_err, "Error reading certs file %s\n", infile); ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
} PEM_write_bio_NETSCAPE_CERT_SEQUENCE(out, seq);
PEM_write_bio_NETSCAPE_CERT_SEQUENCE(out, seq); ret = 0;
ret = 0; goto end;
goto end; }
}
if (!(seq = PEM_read_bio_NETSCAPE_CERT_SEQUENCE(in, NULL, NULL, NULL))) { if (!(seq = PEM_read_bio_NETSCAPE_CERT_SEQUENCE(in, NULL, NULL, NULL))) {
BIO_printf (bio_err, "Error reading sequence file %s\n", infile); BIO_printf(bio_err, "Error reading sequence file %s\n", infile);
ERR_print_errors(bio_err); ERR_print_errors(bio_err);
goto end; goto end;
} }
for(i = 0; i < sk_X509_num(seq->certs); i++) { for (i = 0; i < sk_X509_num(seq->certs); i++) {
x509 = sk_X509_value(seq->certs, i); x509 = sk_X509_value(seq->certs, i);
dump_cert_text(out, x509); dump_cert_text(out, x509);
PEM_write_bio_X509(out, x509); PEM_write_bio_X509(out, x509);
} }
ret = 0; ret = 0;
end: end:
BIO_free(in); BIO_free(in);
BIO_free_all(out); BIO_free_all(out);
NETSCAPE_CERT_SEQUENCE_free(seq); NETSCAPE_CERT_SEQUENCE_free(seq);
OPENSSL_EXIT(ret); OPENSSL_EXIT(ret);
} }

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@@ -103,7 +103,7 @@ emailAddress = optional
#################################################################### ####################################################################
[ req ] [ req ]
default_bits = 1024 default_bits = 2048
default_keyfile = privkey.pem default_keyfile = privkey.pem
distinguished_name = req_distinguished_name distinguished_name = req_distinguished_name
attributes = req_attributes attributes = req_attributes
@@ -145,7 +145,7 @@ localityName = Locality Name (eg, city)
organizationalUnitName = Organizational Unit Name (eg, section) organizationalUnitName = Organizational Unit Name (eg, section)
#organizationalUnitName_default = #organizationalUnitName_default =
commonName = Common Name (eg, YOUR name) commonName = Common Name (e.g. server FQDN or YOUR name)
commonName_max = 64 commonName_max = 64
emailAddress = Email Address emailAddress = Email Address

File diff suppressed because it is too large Load Diff

View File

@@ -103,7 +103,7 @@ emailAddress = optional
#################################################################### ####################################################################
[ req ] [ req ]
default_bits = 1024 default_bits = 2048
default_keyfile = privkey.pem default_keyfile = privkey.pem
distinguished_name = req_distinguished_name distinguished_name = req_distinguished_name
attributes = req_attributes attributes = req_attributes
@@ -145,7 +145,7 @@ localityName = Locality Name (eg, city)
organizationalUnitName = Organizational Unit Name (eg, section) organizationalUnitName = Organizational Unit Name (eg, section)
#organizationalUnitName_default = #organizationalUnitName_default =
commonName = Common Name (eg, YOUR name) commonName = Common Name (e.g. server FQDN or YOUR name)
commonName_max = 64 commonName_max = 64
emailAddress = Email Address emailAddress = Email Address

Binary file not shown.

View File

@@ -6,44 +6,44 @@
#if !defined(OPENSSL_NO_DES) || !defined(NO_MD5CRYPT_1) #if !defined(OPENSSL_NO_DES) || !defined(NO_MD5CRYPT_1)
#include <assert.h> # include <assert.h>
#include <string.h> # include <string.h>
#include "apps.h" # include "apps.h"
#include <openssl/bio.h> # include <openssl/bio.h>
#include <openssl/err.h> # include <openssl/err.h>
#include <openssl/evp.h> # include <openssl/evp.h>
#include <openssl/rand.h> # include <openssl/rand.h>
#ifndef OPENSSL_NO_DES # ifndef OPENSSL_NO_DES
# include <openssl/des.h> # include <openssl/des.h>
#endif # endif
#ifndef NO_MD5CRYPT_1 # ifndef NO_MD5CRYPT_1
# include <openssl/md5.h> # include <openssl/md5.h>
#endif # endif
# undef PROG
# define PROG passwd_main
#undef PROG static unsigned const char cov_2char[64] = {
#define PROG passwd_main /* from crypto/des/fcrypt.c */
0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35,
0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44,
static unsigned const char cov_2char[64]={ 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C,
/* from crypto/des/fcrypt.c */ 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54,
0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x61, 0x62,
0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A,
0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72,
0x4D,0x4E,0x4F,0x50,0x51,0x52,0x53,0x54, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A
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, static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
char *passwd, BIO *out, int quiet, int table, int reverse, char *passwd, BIO *out, int quiet, int table,
size_t pw_maxlen, int usecrypt, int use1, int useapr1); int reverse, size_t pw_maxlen, int usecrypt, int use1,
int useapr1);
/* -crypt - standard Unix password algorithm (default) /*-
* -crypt - standard Unix password algorithm (default)
* -1 - MD5-based password algorithm * -1 - MD5-based password algorithm
* -apr1 - MD5-based password algorithm, Apache variant * -apr1 - MD5-based password algorithm, Apache variant
* -salt string - salt * -salt string - salt
@@ -58,455 +58,437 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
int MAIN(int, char **); int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
int ret = 1; int ret = 1;
char *infile = NULL; char *infile = NULL;
int in_stdin = 0; int in_stdin = 0;
int in_noverify = 0; int in_noverify = 0;
char *salt = NULL, *passwd = NULL, **passwds = NULL; char *salt = NULL, *passwd = NULL, **passwds = NULL;
char *salt_malloc = NULL, *passwd_malloc = NULL; char *salt_malloc = NULL, *passwd_malloc = NULL;
size_t passwd_malloc_size = 0; size_t passwd_malloc_size = 0;
int pw_source_defined = 0; int pw_source_defined = 0;
BIO *in = NULL, *out = NULL; BIO *in = NULL, *out = NULL;
int i, badopt, opt_done; int i, badopt, opt_done;
int passed_salt = 0, quiet = 0, table = 0, reverse = 0; int passed_salt = 0, quiet = 0, table = 0, reverse = 0;
int usecrypt = 0, use1 = 0, useapr1 = 0; int usecrypt = 0, use1 = 0, useapr1 = 0;
size_t pw_maxlen = 0; size_t pw_maxlen = 0;
apps_startup(); apps_startup();
if (bio_err == NULL) if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL) if ((bio_err = BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
if (!load_config(bio_err, NULL)) if (!load_config(bio_err, NULL))
goto err; goto err;
out = BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file());
if (out == NULL) if (out == NULL)
goto err; goto err;
BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT); BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT);
#ifdef OPENSSL_SYS_VMS # ifdef OPENSSL_SYS_VMS
{ {
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); BIO *tmpbio = BIO_new(BIO_f_linebuffer());
out = BIO_push(tmpbio, out); out = BIO_push(tmpbio, out);
} }
#endif # endif
badopt = 0, opt_done = 0; badopt = 0, opt_done = 0;
i = 0; i = 0;
while (!badopt && !opt_done && argv[++i] != NULL) while (!badopt && !opt_done && argv[++i] != NULL) {
{ if (strcmp(argv[i], "-crypt") == 0)
if (strcmp(argv[i], "-crypt") == 0) usecrypt = 1;
usecrypt = 1; else if (strcmp(argv[i], "-1") == 0)
else if (strcmp(argv[i], "-1") == 0) use1 = 1;
use1 = 1; else if (strcmp(argv[i], "-apr1") == 0)
else if (strcmp(argv[i], "-apr1") == 0) useapr1 = 1;
useapr1 = 1; else if (strcmp(argv[i], "-salt") == 0) {
else if (strcmp(argv[i], "-salt") == 0) if ((argv[i + 1] != NULL) && (salt == NULL)) {
{ passed_salt = 1;
if ((argv[i+1] != NULL) && (salt == NULL)) salt = argv[++i];
{ } else
passed_salt = 1; badopt = 1;
salt = argv[++i]; } else if (strcmp(argv[i], "-in") == 0) {
} if ((argv[i + 1] != NULL) && !pw_source_defined) {
else pw_source_defined = 1;
badopt = 1; infile = argv[++i];
} } else
else if (strcmp(argv[i], "-in") == 0) badopt = 1;
{ } else if (strcmp(argv[i], "-stdin") == 0) {
if ((argv[i+1] != NULL) && !pw_source_defined) if (!pw_source_defined) {
{ pw_source_defined = 1;
pw_source_defined = 1; in_stdin = 1;
infile = argv[++i]; } else
} badopt = 1;
else } else if (strcmp(argv[i], "-noverify") == 0)
badopt = 1; in_noverify = 1;
} else if (strcmp(argv[i], "-quiet") == 0)
else if (strcmp(argv[i], "-stdin") == 0) quiet = 1;
{ else if (strcmp(argv[i], "-table") == 0)
if (!pw_source_defined) table = 1;
{ else if (strcmp(argv[i], "-reverse") == 0)
pw_source_defined = 1; reverse = 1;
in_stdin = 1; else if (argv[i][0] == '-')
} badopt = 1;
else else if (!pw_source_defined)
badopt = 1; /* non-option arguments, use as passwords */
} {
else if (strcmp(argv[i], "-noverify") == 0) pw_source_defined = 1;
in_noverify = 1; passwds = &argv[i];
else if (strcmp(argv[i], "-quiet") == 0) opt_done = 1;
quiet = 1; } else
else if (strcmp(argv[i], "-table") == 0) badopt = 1;
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 && !use1 && !useapr1) /* use default */ if (!usecrypt && !use1 && !useapr1) /* use default */
usecrypt = 1; usecrypt = 1;
if (usecrypt + use1 + useapr1 > 1) /* conflict */ if (usecrypt + use1 + useapr1 > 1) /* conflict */
badopt = 1; badopt = 1;
/* reject unsupported algorithms */ /* reject unsupported algorithms */
#ifdef OPENSSL_NO_DES # ifdef OPENSSL_NO_DES
if (usecrypt) badopt = 1; if (usecrypt)
#endif badopt = 1;
#ifdef NO_MD5CRYPT_1 # endif
if (use1 || useapr1) badopt = 1; # ifdef NO_MD5CRYPT_1
#endif if (use1 || useapr1)
badopt = 1;
# endif
if (badopt) if (badopt) {
{ BIO_printf(bio_err, "Usage: passwd [options] [passwords]\n");
BIO_printf(bio_err, "Usage: passwd [options] [passwords]\n"); BIO_printf(bio_err, "where options are\n");
BIO_printf(bio_err, "where options are\n"); # ifndef OPENSSL_NO_DES
#ifndef OPENSSL_NO_DES BIO_printf(bio_err,
BIO_printf(bio_err, "-crypt standard Unix password algorithm (default)\n"); "-crypt standard Unix password algorithm (default)\n");
#endif # endif
#ifndef NO_MD5CRYPT_1 # ifndef NO_MD5CRYPT_1
BIO_printf(bio_err, "-1 MD5-based password algorithm\n"); BIO_printf(bio_err,
BIO_printf(bio_err, "-apr1 MD5-based password algorithm, Apache variant\n"); "-1 MD5-based password algorithm\n");
#endif BIO_printf(bio_err,
BIO_printf(bio_err, "-salt string use provided salt\n"); "-apr1 MD5-based password algorithm, Apache variant\n");
BIO_printf(bio_err, "-in file read passwords from file\n"); # endif
BIO_printf(bio_err, "-stdin read passwords from stdin\n"); BIO_printf(bio_err, "-salt string use provided salt\n");
BIO_printf(bio_err, "-noverify never verify when reading password from terminal\n"); BIO_printf(bio_err, "-in file read passwords from file\n");
BIO_printf(bio_err, "-quiet no warnings\n"); BIO_printf(bio_err, "-stdin read passwords from stdin\n");
BIO_printf(bio_err, "-table format output as table\n"); BIO_printf(bio_err,
BIO_printf(bio_err, "-reverse switch table columns\n"); "-noverify never verify when reading password from terminal\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; goto err;
} }
if ((infile != NULL) || in_stdin) if ((infile != NULL) || in_stdin) {
{ in = BIO_new(BIO_s_file());
in = BIO_new(BIO_s_file()); if (in == NULL)
if (in == NULL) goto err;
goto err; if (infile != NULL) {
if (infile != NULL) assert(in_stdin == 0);
{ if (BIO_read_filename(in, infile) <= 0)
assert(in_stdin == 0); goto err;
if (BIO_read_filename(in, infile) <= 0) } else {
goto err; assert(in_stdin);
} BIO_set_fp(in, stdin, BIO_NOCLOSE);
else }
{ }
assert(in_stdin);
BIO_set_fp(in, stdin, BIO_NOCLOSE);
}
}
if (usecrypt) if (usecrypt)
pw_maxlen = 8; pw_maxlen = 8;
else if (use1 || useapr1) else if (use1 || useapr1)
pw_maxlen = 256; /* arbitrary limit, should be enough for most passwords */ pw_maxlen = 256; /* arbitrary limit, should be enough for most
* passwords */
if (passwds == NULL) if (passwds == NULL) {
{ /* no passwords on the command line */
/* no passwords on the command line */
passwd_malloc_size = pw_maxlen + 2; passwd_malloc_size = pw_maxlen + 2;
/* longer than necessary so that we can warn about truncation */ /*
passwd = passwd_malloc = OPENSSL_malloc(passwd_malloc_size); * longer than necessary so that we can warn about truncation
if (passwd_malloc == NULL) */
goto err; passwd = passwd_malloc = OPENSSL_malloc(passwd_malloc_size);
} if (passwd_malloc == NULL)
goto err;
}
if ((in == NULL) && (passwds == NULL)) if ((in == NULL) && (passwds == NULL)) {
{ /* build a null-terminated list */
/* build a null-terminated list */ static char *passwds_static[2] = { NULL, NULL };
static char *passwds_static[2] = {NULL, NULL};
passwds = passwds_static; passwds = passwds_static;
if (in == NULL) if (in == NULL)
if (EVP_read_pw_string(passwd_malloc, passwd_malloc_size, "Password: ", !(passed_salt || in_noverify)) != 0) if (EVP_read_pw_string
goto err; (passwd_malloc, passwd_malloc_size, "Password: ",
passwds[0] = passwd_malloc; !(passed_salt || in_noverify)) != 0)
} goto err;
passwds[0] = passwd_malloc;
}
if (in == NULL) if (in == NULL) {
{ assert(passwds != NULL);
assert(passwds != NULL); assert(*passwds != NULL);
assert(*passwds != NULL);
do /* loop over list of passwords */ do { /* loop over list of passwords */
{ passwd = *passwds++;
passwd = *passwds++; if (!do_passwd(passed_salt, &salt, &salt_malloc, passwd, out,
if (!do_passwd(passed_salt, &salt, &salt_malloc, passwd, out, quiet, table, reverse, pw_maxlen, usecrypt, use1,
quiet, table, reverse, pw_maxlen, usecrypt, use1, useapr1)) useapr1))
goto err; goto err;
} }
while (*passwds != NULL); while (*passwds != NULL);
} } else
else /* in != NULL */
/* in != NULL */ {
{ int done;
int done;
assert (passwd != NULL); assert(passwd != NULL);
do do {
{ int r = BIO_gets(in, passwd, pw_maxlen + 1);
int r = BIO_gets(in, passwd, pw_maxlen + 1); if (r > 0) {
if (r > 0) char *c = (strchr(passwd, '\n'));
{ if (c != NULL)
char *c = (strchr(passwd, '\n')) ; *c = 0; /* truncate at newline */
if (c != NULL) else {
*c = 0; /* truncate at newline */ /* ignore rest of line */
else char trash[BUFSIZ];
{ do
/* ignore rest of line */ r = BIO_gets(in, trash, sizeof trash);
char trash[BUFSIZ]; while ((r > 0) && (!strchr(trash, '\n')));
do }
r = BIO_gets(in, trash, sizeof trash);
while ((r > 0) && (!strchr(trash, '\n')));
}
if (!do_passwd(passed_salt, &salt, &salt_malloc, passwd, out, if (!do_passwd(passed_salt, &salt, &salt_malloc, passwd, out,
quiet, table, reverse, pw_maxlen, usecrypt, use1, useapr1)) quiet, table, reverse, pw_maxlen, usecrypt,
goto err; use1, useapr1))
} goto err;
done = (r <= 0); }
} done = (r <= 0);
while (!done); }
} while (!done);
ret = 0; }
ret = 0;
err: err:
ERR_print_errors(bio_err); ERR_print_errors(bio_err);
if (salt_malloc) if (salt_malloc)
OPENSSL_free(salt_malloc); OPENSSL_free(salt_malloc);
if (passwd_malloc) if (passwd_malloc)
OPENSSL_free(passwd_malloc); OPENSSL_free(passwd_malloc);
if (in) if (in)
BIO_free(in); BIO_free(in);
if (out) if (out)
BIO_free_all(out); BIO_free_all(out);
apps_shutdown(); apps_shutdown();
OPENSSL_EXIT(ret); OPENSSL_EXIT(ret);
} }
# ifndef NO_MD5CRYPT_1
#ifndef NO_MD5CRYPT_1 /*
/* MD5-based password algorithm (should probably be available as a library * MD5-based password algorithm (should probably be available as a library
* function; then the static buffer would not be acceptable). * function; then the static buffer would not be acceptable). For magic
* For magic string "1", this should be compatible to the MD5-based BSD * string "1", this should be compatible to the MD5-based BSD password
* password algorithm. * algorithm. For 'magic' string "apr1", this is compatible to the MD5-based
* For 'magic' string "apr1", this is compatible to the MD5-based Apache * Apache password algorithm. (Apparently, the Apache password algorithm is
* password algorithm. * identical except that the 'magic' string was changed -- the laziest
* (Apparently, the Apache password algorithm is identical except that the * application of the NIH principle I've ever encountered.)
* 'magic' string was changed -- the laziest application of the NIH principle
* I've ever encountered.)
*/ */
static char *md5crypt(const char *passwd, const char *magic, const char *salt) static char *md5crypt(const char *passwd, const char *magic, const char *salt)
{ {
static char out_buf[6 + 9 + 24 + 2]; /* "$apr1$..salt..$.......md5hash..........\0" */ /* "$apr1$..salt..$.......md5hash..........\0" */
unsigned char buf[MD5_DIGEST_LENGTH]; static char out_buf[6 + 9 + 24 + 2];
char *salt_out; unsigned char buf[MD5_DIGEST_LENGTH];
int n; char *salt_out;
unsigned int i; int n;
EVP_MD_CTX md,md2; unsigned int i;
size_t passwd_len, salt_len; EVP_MD_CTX md, md2;
size_t passwd_len, salt_len;
passwd_len = strlen(passwd); passwd_len = strlen(passwd);
out_buf[0] = '$'; out_buf[0] = '$';
out_buf[1] = 0; out_buf[1] = 0;
assert(strlen(magic) <= 4); /* "1" or "apr1" */ assert(strlen(magic) <= 4); /* "1" or "apr1" */
strncat(out_buf, magic, 4); strncat(out_buf, magic, 4);
strncat(out_buf, "$", 1); strncat(out_buf, "$", 1);
strncat(out_buf, salt, 8); strncat(out_buf, salt, 8);
assert(strlen(out_buf) <= 6 + 8); /* "$apr1$..salt.." */ assert(strlen(out_buf) <= 6 + 8); /* "$apr1$..salt.." */
salt_out = out_buf + 2 + strlen(magic); salt_out = out_buf + 2 + strlen(magic);
salt_len = strlen(salt_out); salt_len = strlen(salt_out);
assert(salt_len <= 8); assert(salt_len <= 8);
EVP_MD_CTX_init(&md); EVP_MD_CTX_init(&md);
EVP_DigestInit_ex(&md,EVP_md5(), NULL); EVP_DigestInit_ex(&md, EVP_md5(), NULL);
EVP_DigestUpdate(&md, passwd, passwd_len); EVP_DigestUpdate(&md, passwd, passwd_len);
EVP_DigestUpdate(&md, "$", 1); EVP_DigestUpdate(&md, "$", 1);
EVP_DigestUpdate(&md, magic, strlen(magic)); EVP_DigestUpdate(&md, magic, strlen(magic));
EVP_DigestUpdate(&md, "$", 1); EVP_DigestUpdate(&md, "$", 1);
EVP_DigestUpdate(&md, salt_out, salt_len); EVP_DigestUpdate(&md, salt_out, salt_len);
EVP_MD_CTX_init(&md2); EVP_MD_CTX_init(&md2);
EVP_DigestInit_ex(&md2,EVP_md5(), NULL); EVP_DigestInit_ex(&md2, EVP_md5(), NULL);
EVP_DigestUpdate(&md2, passwd, passwd_len); EVP_DigestUpdate(&md2, passwd, passwd_len);
EVP_DigestUpdate(&md2, salt_out, salt_len); EVP_DigestUpdate(&md2, salt_out, salt_len);
EVP_DigestUpdate(&md2, passwd, passwd_len); EVP_DigestUpdate(&md2, passwd, passwd_len);
EVP_DigestFinal_ex(&md2, buf, NULL); EVP_DigestFinal_ex(&md2, buf, NULL);
for (i = passwd_len; i > sizeof buf; i -= sizeof buf) for (i = passwd_len; i > sizeof buf; i -= sizeof buf)
EVP_DigestUpdate(&md, buf, sizeof buf); EVP_DigestUpdate(&md, buf, sizeof buf);
EVP_DigestUpdate(&md, buf, i); EVP_DigestUpdate(&md, buf, i);
n = passwd_len; n = passwd_len;
while (n) while (n) {
{ EVP_DigestUpdate(&md, (n & 1) ? "\0" : passwd, 1);
EVP_DigestUpdate(&md, (n & 1) ? "\0" : passwd, 1); n >>= 1;
n >>= 1; }
} EVP_DigestFinal_ex(&md, buf, NULL);
EVP_DigestFinal_ex(&md, buf, NULL);
for (i = 0; i < 1000; i++) for (i = 0; i < 1000; i++) {
{ EVP_DigestInit_ex(&md2, EVP_md5(), NULL);
EVP_DigestInit_ex(&md2,EVP_md5(), NULL); EVP_DigestUpdate(&md2, (i & 1) ? (unsigned const char *)passwd : buf,
EVP_DigestUpdate(&md2, (i & 1) ? (unsigned const char *) passwd : buf, (i & 1) ? passwd_len : sizeof buf);
(i & 1) ? passwd_len : sizeof buf); if (i % 3)
if (i % 3) EVP_DigestUpdate(&md2, salt_out, salt_len);
EVP_DigestUpdate(&md2, salt_out, salt_len); if (i % 7)
if (i % 7) EVP_DigestUpdate(&md2, passwd, passwd_len);
EVP_DigestUpdate(&md2, passwd, passwd_len); EVP_DigestUpdate(&md2, (i & 1) ? buf : (unsigned const char *)passwd,
EVP_DigestUpdate(&md2, (i & 1) ? buf : (unsigned const char *) passwd, (i & 1) ? sizeof buf : passwd_len);
(i & 1) ? sizeof buf : passwd_len); EVP_DigestFinal_ex(&md2, buf, NULL);
EVP_DigestFinal_ex(&md2, buf, NULL); }
} EVP_MD_CTX_cleanup(&md2);
EVP_MD_CTX_cleanup(&md2);
{ {
/* transform buf into output string */ /* transform buf into output string */
unsigned char buf_perm[sizeof buf]; unsigned char buf_perm[sizeof buf];
int dest, source; int dest, source;
char *output; char *output;
/* silly output permutation */ /* silly output permutation */
for (dest = 0, source = 0; dest < 14; dest++, source = (source + 6) % 17) for (dest = 0, source = 0; dest < 14;
buf_perm[dest] = buf[source]; dest++, source = (source + 6) % 17)
buf_perm[14] = buf[5]; buf_perm[dest] = buf[source];
buf_perm[15] = buf[11]; buf_perm[14] = buf[5];
#ifndef PEDANTIC /* Unfortunately, this generates a "no effect" warning */ buf_perm[15] = buf[11];
assert(16 == sizeof buf_perm); # ifndef PEDANTIC /* Unfortunately, this generates a "no
#endif * effect" warning */
assert(16 == sizeof buf_perm);
# endif
output = salt_out + salt_len; output = salt_out + salt_len;
assert(output == out_buf + strlen(out_buf)); assert(output == out_buf + strlen(out_buf));
*output++ = '$'; *output++ = '$';
for (i = 0; i < 15; i += 3) for (i = 0; i < 15; i += 3) {
{ *output++ = cov_2char[buf_perm[i + 2] & 0x3f];
*output++ = cov_2char[buf_perm[i+2] & 0x3f]; *output++ = cov_2char[((buf_perm[i + 1] & 0xf) << 2) |
*output++ = cov_2char[((buf_perm[i+1] & 0xf) << 2) | (buf_perm[i + 2] >> 6)];
(buf_perm[i+2] >> 6)]; *output++ = cov_2char[((buf_perm[i] & 3) << 4) |
*output++ = cov_2char[((buf_perm[i] & 3) << 4) | (buf_perm[i + 1] >> 4)];
(buf_perm[i+1] >> 4)]; *output++ = cov_2char[buf_perm[i] >> 2];
*output++ = cov_2char[buf_perm[i] >> 2]; }
} assert(i == 15);
assert(i == 15); *output++ = cov_2char[buf_perm[i] & 0x3f];
*output++ = cov_2char[buf_perm[i] & 0x3f]; *output++ = cov_2char[buf_perm[i] >> 6];
*output++ = cov_2char[buf_perm[i] >> 6]; *output = 0;
*output = 0; assert(strlen(out_buf) < sizeof(out_buf));
assert(strlen(out_buf) < sizeof(out_buf)); }
} EVP_MD_CTX_cleanup(&md);
EVP_MD_CTX_cleanup(&md);
return out_buf;
}
#endif
return out_buf;
}
# endif
static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p, static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
char *passwd, BIO *out, int quiet, int table, int reverse, char *passwd, BIO *out, int quiet, int table,
size_t pw_maxlen, int usecrypt, int use1, int useapr1) int reverse, size_t pw_maxlen, int usecrypt, int use1,
{ int useapr1)
char *hash = NULL; {
char *hash = NULL;
assert(salt_p != NULL); assert(salt_p != NULL);
assert(salt_malloc_p != NULL); assert(salt_malloc_p != NULL);
/* first make sure we have a salt */ /* first make sure we have a salt */
if (!passed_salt) if (!passed_salt) {
{ # ifndef OPENSSL_NO_DES
#ifndef OPENSSL_NO_DES if (usecrypt) {
if (usecrypt) if (*salt_malloc_p == NULL) {
{ *salt_p = *salt_malloc_p = OPENSSL_malloc(3);
if (*salt_malloc_p == NULL) if (*salt_malloc_p == NULL)
{ goto err;
*salt_p = *salt_malloc_p = OPENSSL_malloc(3); }
if (*salt_malloc_p == NULL) if (RAND_pseudo_bytes((unsigned char *)*salt_p, 2) < 0)
goto err; goto err;
} (*salt_p)[0] = cov_2char[(*salt_p)[0] & 0x3f]; /* 6 bits */
if (RAND_pseudo_bytes((unsigned char *)*salt_p, 2) < 0) (*salt_p)[1] = cov_2char[(*salt_p)[1] & 0x3f]; /* 6 bits */
goto err; (*salt_p)[2] = 0;
(*salt_p)[0] = cov_2char[(*salt_p)[0] & 0x3f]; /* 6 bits */ # ifdef CHARSET_EBCDIC
(*salt_p)[1] = cov_2char[(*salt_p)[1] & 0x3f]; /* 6 bits */ ascii2ebcdic(*salt_p, *salt_p, 2); /* des_crypt will convert back
(*salt_p)[2] = 0; * to ASCII */
#ifdef CHARSET_EBCDIC # endif
ascii2ebcdic(*salt_p, *salt_p, 2); /* des_crypt will convert }
* back to ASCII */ # endif /* !OPENSSL_NO_DES */
#endif
}
#endif /* !OPENSSL_NO_DES */
#ifndef NO_MD5CRYPT_1 # ifndef NO_MD5CRYPT_1
if (use1 || useapr1) if (use1 || useapr1) {
{ int i;
int i;
if (*salt_malloc_p == NULL) if (*salt_malloc_p == NULL) {
{ *salt_p = *salt_malloc_p = OPENSSL_malloc(9);
*salt_p = *salt_malloc_p = OPENSSL_malloc(9); if (*salt_malloc_p == NULL)
if (*salt_malloc_p == NULL) goto err;
goto err; }
} if (RAND_pseudo_bytes((unsigned char *)*salt_p, 8) < 0)
if (RAND_pseudo_bytes((unsigned char *)*salt_p, 8) < 0) goto err;
goto err;
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
(*salt_p)[i] = cov_2char[(*salt_p)[i] & 0x3f]; /* 6 bits */ (*salt_p)[i] = cov_2char[(*salt_p)[i] & 0x3f]; /* 6 bits */
(*salt_p)[8] = 0; (*salt_p)[8] = 0;
} }
#endif /* !NO_MD5CRYPT_1 */ # endif /* !NO_MD5CRYPT_1 */
} }
assert(*salt_p != NULL); assert(*salt_p != NULL);
/* truncate password if necessary */ /* truncate password if necessary */
if ((strlen(passwd) > pw_maxlen)) if ((strlen(passwd) > pw_maxlen)) {
{ if (!quiet)
if (!quiet) /*
/* XXX: really we should know how to print a size_t, not cast it */ * XXX: really we should know how to print a size_t, not cast it
BIO_printf(bio_err, "Warning: truncating password to %u characters\n", (unsigned)pw_maxlen); */
passwd[pw_maxlen] = 0; BIO_printf(bio_err,
} "Warning: truncating password to %u characters\n",
assert(strlen(passwd) <= pw_maxlen); (unsigned)pw_maxlen);
passwd[pw_maxlen] = 0;
}
assert(strlen(passwd) <= pw_maxlen);
/* now compute password hash */ /* now compute password hash */
#ifndef OPENSSL_NO_DES # ifndef OPENSSL_NO_DES
if (usecrypt) if (usecrypt)
hash = DES_crypt(passwd, *salt_p); hash = DES_crypt(passwd, *salt_p);
#endif # endif
#ifndef NO_MD5CRYPT_1 # ifndef NO_MD5CRYPT_1
if (use1 || useapr1) if (use1 || useapr1)
hash = md5crypt(passwd, (use1 ? "1" : "apr1"), *salt_p); hash = md5crypt(passwd, (use1 ? "1" : "apr1"), *salt_p);
#endif # endif
assert(hash != NULL); assert(hash != NULL);
if (table && !reverse) if (table && !reverse)
BIO_printf(out, "%s\t%s\n", passwd, hash); BIO_printf(out, "%s\t%s\n", passwd, hash);
else if (table && reverse) else if (table && reverse)
BIO_printf(out, "%s\t%s\n", hash, passwd); BIO_printf(out, "%s\t%s\n", hash, passwd);
else else
BIO_printf(out, "%s\n", hash); BIO_printf(out, "%s\n", hash);
return 1; return 1;
err: err:
return 0; return 0;
} }
#else #else
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
fputs("Program not available.\n", stderr) fputs("Program not available.\n", stderr)
OPENSSL_EXIT(1); OPENSSL_EXIT(1);
} }
#endif #endif

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -69,252 +69,240 @@
#include <openssl/pem.h> #include <openssl/pem.h>
#undef PROG #undef PROG
#define PROG pkcs7_main #define PROG pkcs7_main
/* -inform arg - input format - default PEM (DER or PEM) /*-
* -inform arg - input format - default PEM (DER or PEM)
* -outform arg - output format - default PEM * -outform arg - output format - default PEM
* -in arg - input file - default stdin * -in arg - input file - default stdin
* -out arg - output file - default stdout * -out arg - output file - default stdout
* -print_certs * -print_certs
*/ */
int MAIN(int, char **); int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
PKCS7 *p7=NULL; PKCS7 *p7 = NULL;
int i,badops=0; int i, badops = 0;
BIO *in=NULL,*out=NULL; BIO *in = NULL, *out = NULL;
int informat,outformat; int informat, outformat;
char *infile,*outfile,*prog; char *infile, *outfile, *prog;
int print_certs=0,text=0,noout=0,p7_print=0; int print_certs = 0, text = 0, noout = 0, p7_print = 0;
int ret=1; int ret = 1;
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
char *engine=NULL; char *engine = NULL;
#endif #endif
apps_startup(); apps_startup();
if (bio_err == NULL) if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL) if ((bio_err = BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
if (!load_config(bio_err, NULL)) if (!load_config(bio_err, NULL))
goto end; goto end;
infile=NULL; infile = NULL;
outfile=NULL; outfile = NULL;
informat=FORMAT_PEM; informat = FORMAT_PEM;
outformat=FORMAT_PEM; outformat = FORMAT_PEM;
prog=argv[0]; prog = argv[0];
argc--; argc--;
argv++; argv++;
while (argc >= 1) while (argc >= 1) {
{ if (strcmp(*argv, "-inform") == 0) {
if (strcmp(*argv,"-inform") == 0) if (--argc < 1)
{ goto bad;
if (--argc < 1) goto bad; informat = str2fmt(*(++argv));
informat=str2fmt(*(++argv)); } else if (strcmp(*argv, "-outform") == 0) {
} if (--argc < 1)
else if (strcmp(*argv,"-outform") == 0) goto bad;
{ outformat = str2fmt(*(++argv));
if (--argc < 1) goto bad; } else if (strcmp(*argv, "-in") == 0) {
outformat=str2fmt(*(++argv)); if (--argc < 1)
} goto bad;
else if (strcmp(*argv,"-in") == 0) infile = *(++argv);
{ } else if (strcmp(*argv, "-out") == 0) {
if (--argc < 1) goto bad; if (--argc < 1)
infile= *(++argv); goto bad;
} outfile = *(++argv);
else if (strcmp(*argv,"-out") == 0) } else if (strcmp(*argv, "-noout") == 0)
{ noout = 1;
if (--argc < 1) goto bad; else if (strcmp(*argv, "-text") == 0)
outfile= *(++argv); text = 1;
} else if (strcmp(*argv, "-print") == 0)
else if (strcmp(*argv,"-noout") == 0) p7_print = 1;
noout=1; else if (strcmp(*argv, "-print_certs") == 0)
else if (strcmp(*argv,"-text") == 0) print_certs = 1;
text=1;
else if (strcmp(*argv,"-print") == 0)
p7_print=1;
else if (strcmp(*argv,"-print_certs") == 0)
print_certs=1;
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
else if (strcmp(*argv,"-engine") == 0) else if (strcmp(*argv, "-engine") == 0) {
{ if (--argc < 1)
if (--argc < 1) goto bad; goto bad;
engine= *(++argv); engine = *(++argv);
} }
#endif #endif
else else {
{ BIO_printf(bio_err, "unknown option %s\n", *argv);
BIO_printf(bio_err,"unknown option %s\n",*argv); badops = 1;
badops=1; break;
break; }
} argc--;
argc--; argv++;
argv++; }
}
if (badops) if (badops) {
{ bad:
bad: BIO_printf(bio_err, "%s [options] <infile >outfile\n", prog);
BIO_printf(bio_err,"%s [options] <infile >outfile\n",prog); BIO_printf(bio_err, "where options are\n");
BIO_printf(bio_err,"where options are\n"); BIO_printf(bio_err, " -inform arg input format - DER or 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," -outform arg output format - DER or PEM\n"); BIO_printf(bio_err, " -in arg input file\n");
BIO_printf(bio_err," -in arg input file\n"); BIO_printf(bio_err, " -out arg output file\n");
BIO_printf(bio_err," -out arg output file\n"); BIO_printf(bio_err,
BIO_printf(bio_err," -print_certs print any certs or crl in the input\n"); " -print_certs print any certs or crl in the input\n");
BIO_printf(bio_err," -text print full details of certificates\n"); BIO_printf(bio_err,
BIO_printf(bio_err," -noout don't output encoded data\n"); " -text print full details of certificates\n");
BIO_printf(bio_err, " -noout don't output encoded data\n");
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); BIO_printf(bio_err,
" -engine e use engine e, possibly a hardware device.\n");
#endif #endif
ret = 1; ret = 1;
goto end; goto end;
} }
ERR_load_crypto_strings(); ERR_load_crypto_strings();
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
setup_engine(bio_err, engine, 0); setup_engine(bio_err, engine, 0);
#endif #endif
in=BIO_new(BIO_s_file()); in = BIO_new(BIO_s_file());
out=BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file());
if ((in == NULL) || (out == NULL)) if ((in == NULL) || (out == NULL)) {
{ ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
}
if (infile == NULL) if (infile == NULL)
BIO_set_fp(in,stdin,BIO_NOCLOSE); BIO_set_fp(in, stdin, BIO_NOCLOSE);
else else {
{ if (BIO_read_filename(in, infile) <= 0) {
if (BIO_read_filename(in,infile) <= 0) BIO_printf(bio_err, "unable to load input file\n");
if (in == NULL) ERR_print_errors(bio_err);
{ goto end;
perror(infile); }
goto end; }
}
}
if (informat == FORMAT_ASN1) if (informat == FORMAT_ASN1)
p7=d2i_PKCS7_bio(in,NULL); p7 = d2i_PKCS7_bio(in, NULL);
else if (informat == FORMAT_PEM) else if (informat == FORMAT_PEM)
p7=PEM_read_bio_PKCS7(in,NULL,NULL,NULL); p7 = PEM_read_bio_PKCS7(in, NULL, NULL, NULL);
else else {
{ BIO_printf(bio_err, "bad input format specified for pkcs7 object\n");
BIO_printf(bio_err,"bad input format specified for pkcs7 object\n"); goto end;
goto end; }
} if (p7 == NULL) {
if (p7 == NULL) BIO_printf(bio_err, "unable to load PKCS7 object\n");
{ ERR_print_errors(bio_err);
BIO_printf(bio_err,"unable to load PKCS7 object\n"); goto end;
ERR_print_errors(bio_err); }
goto end;
}
if (outfile == NULL) if (outfile == NULL) {
{ BIO_set_fp(out, stdout, BIO_NOCLOSE);
BIO_set_fp(out,stdout,BIO_NOCLOSE);
#ifdef OPENSSL_SYS_VMS #ifdef OPENSSL_SYS_VMS
{ {
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); BIO *tmpbio = BIO_new(BIO_f_linebuffer());
out = BIO_push(tmpbio, out); out = BIO_push(tmpbio, out);
} }
#endif #endif
} } else {
else if (BIO_write_filename(out, outfile) <= 0) {
{ perror(outfile);
if (BIO_write_filename(out,outfile) <= 0) goto end;
{ }
perror(outfile); }
goto end;
}
}
if (p7_print) if (p7_print)
PKCS7_print_ctx(out, p7, 0, NULL); PKCS7_print_ctx(out, p7, 0, NULL);
if (print_certs) if (print_certs) {
{ STACK_OF(X509) *certs = NULL;
STACK_OF(X509) *certs=NULL; STACK_OF(X509_CRL) *crls = NULL;
STACK_OF(X509_CRL) *crls=NULL;
i=OBJ_obj2nid(p7->type); i = OBJ_obj2nid(p7->type);
switch (i) switch (i) {
{ case NID_pkcs7_signed:
case NID_pkcs7_signed: certs = p7->d.sign->cert;
certs=p7->d.sign->cert; crls = p7->d.sign->crl;
crls=p7->d.sign->crl; break;
break; case NID_pkcs7_signedAndEnveloped:
case NID_pkcs7_signedAndEnveloped: certs = p7->d.signed_and_enveloped->cert;
certs=p7->d.signed_and_enveloped->cert; crls = p7->d.signed_and_enveloped->crl;
crls=p7->d.signed_and_enveloped->crl; break;
break; default:
default: break;
break; }
}
if (certs != NULL) if (certs != NULL) {
{ X509 *x;
X509 *x;
for (i=0; i<sk_X509_num(certs); i++) for (i = 0; i < sk_X509_num(certs); i++) {
{ x = sk_X509_value(certs, i);
x=sk_X509_value(certs,i); if (text)
if(text) X509_print(out, x); X509_print(out, x);
else dump_cert_text(out, x); else
dump_cert_text(out, x);
if(!noout) PEM_write_bio_X509(out,x); if (!noout)
BIO_puts(out,"\n"); PEM_write_bio_X509(out, x);
} BIO_puts(out, "\n");
} }
if (crls != NULL) }
{ if (crls != NULL) {
X509_CRL *crl; X509_CRL *crl;
for (i=0; i<sk_X509_CRL_num(crls); i++) for (i = 0; i < sk_X509_CRL_num(crls); i++) {
{ crl = sk_X509_CRL_value(crls, i);
crl=sk_X509_CRL_value(crls,i);
X509_CRL_print(out, crl); X509_CRL_print(out, crl);
if(!noout)PEM_write_bio_X509_CRL(out,crl); if (!noout)
BIO_puts(out,"\n"); PEM_write_bio_X509_CRL(out, crl);
} BIO_puts(out, "\n");
} }
}
ret=0; ret = 0;
goto end; goto end;
} }
if(!noout) { if (!noout) {
if (outformat == FORMAT_ASN1) if (outformat == FORMAT_ASN1)
i=i2d_PKCS7_bio(out,p7); i = i2d_PKCS7_bio(out, p7);
else if (outformat == FORMAT_PEM) else if (outformat == FORMAT_PEM)
i=PEM_write_bio_PKCS7(out,p7); i = PEM_write_bio_PKCS7(out, p7);
else { else {
BIO_printf(bio_err,"bad output format specified for outfile\n"); BIO_printf(bio_err, "bad output format specified for outfile\n");
goto end; goto end;
} }
if (!i) if (!i) {
{ BIO_printf(bio_err, "unable to write pkcs7 object\n");
BIO_printf(bio_err,"unable to write pkcs7 object\n"); ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
} }
} ret = 0;
ret=0; end:
end: if (p7 != NULL)
if (p7 != NULL) PKCS7_free(p7); PKCS7_free(p7);
if (in != NULL) BIO_free(in); if (in != NULL)
if (out != NULL) BIO_free_all(out); BIO_free(in);
apps_shutdown(); if (out != NULL)
OPENSSL_EXIT(ret); BIO_free_all(out);
} apps_shutdown();
OPENSSL_EXIT(ret);
}

Binary file not shown.

View File

@@ -1,6 +1,7 @@
/* pkcs8.c */ /* pkcs8.c */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL /*
* project 1999-2004. * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
* 1999-2004.
*/ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved. * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
@@ -68,372 +69,334 @@
int MAIN(int, char **); int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
ENGINE *e = NULL; ENGINE *e = NULL;
char **args, *infile = NULL, *outfile = NULL; char **args, *infile = NULL, *outfile = NULL;
char *passargin = NULL, *passargout = NULL; char *passargin = NULL, *passargout = NULL;
BIO *in = NULL, *out = NULL; BIO *in = NULL, *out = NULL;
int topk8 = 0; int topk8 = 0;
int pbe_nid = -1; int pbe_nid = -1;
const EVP_CIPHER *cipher = NULL; const EVP_CIPHER *cipher = NULL;
int iter = PKCS12_DEFAULT_ITER; int iter = PKCS12_DEFAULT_ITER;
int informat, outformat; int informat, outformat;
int p8_broken = PKCS8_OK; int p8_broken = PKCS8_OK;
int nocrypt = 0; int nocrypt = 0;
X509_SIG *p8 = NULL; X509_SIG *p8 = NULL;
PKCS8_PRIV_KEY_INFO *p8inf = NULL; PKCS8_PRIV_KEY_INFO *p8inf = NULL;
EVP_PKEY *pkey=NULL; EVP_PKEY *pkey = NULL;
char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL; char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL;
int badarg = 0; int badarg = 0;
int ret = 1; int ret = 1;
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
char *engine=NULL; char *engine = NULL;
#endif #endif
if (bio_err == NULL) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE); if (bio_err == NULL)
bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
if (!load_config(bio_err, NULL)) if (!load_config(bio_err, NULL))
goto end; goto end;
informat=FORMAT_PEM; informat = FORMAT_PEM;
outformat=FORMAT_PEM; outformat = FORMAT_PEM;
ERR_load_crypto_strings(); ERR_load_crypto_strings();
OpenSSL_add_all_algorithms(); OpenSSL_add_all_algorithms();
args = argv + 1; args = argv + 1;
while (!badarg && *args && *args[0] == '-') while (!badarg && *args && *args[0] == '-') {
{ if (!strcmp(*args, "-v2")) {
if (!strcmp(*args,"-v2")) if (args[1]) {
{ args++;
if (args[1]) cipher = EVP_get_cipherbyname(*args);
{ if (!cipher) {
args++; BIO_printf(bio_err, "Unknown cipher %s\n", *args);
cipher=EVP_get_cipherbyname(*args); badarg = 1;
if (!cipher) }
{ } else
BIO_printf(bio_err, badarg = 1;
"Unknown cipher %s\n", *args); } else if (!strcmp(*args, "-v1")) {
badarg = 1; if (args[1]) {
} args++;
} pbe_nid = OBJ_txt2nid(*args);
else if (pbe_nid == NID_undef) {
badarg = 1; BIO_printf(bio_err, "Unknown PBE algorithm %s\n", *args);
} badarg = 1;
else if (!strcmp(*args,"-v1")) }
{ } else
if (args[1]) badarg = 1;
{ } else if (!strcmp(*args, "-v2prf")) {
args++; if (args[1]) {
pbe_nid=OBJ_txt2nid(*args); args++;
if (pbe_nid == NID_undef) pbe_nid = OBJ_txt2nid(*args);
{ if (!EVP_PBE_find(EVP_PBE_TYPE_PRF, pbe_nid, NULL, NULL, 0)) {
BIO_printf(bio_err, BIO_printf(bio_err, "Unknown PRF algorithm %s\n", *args);
"Unknown PBE algorithm %s\n", *args); badarg = 1;
badarg = 1; }
} } else
} badarg = 1;
else } else if (!strcmp(*args, "-inform")) {
badarg = 1; if (args[1]) {
} args++;
else if (!strcmp(*args,"-inform")) informat = str2fmt(*args);
{ } else
if (args[1]) badarg = 1;
{ } else if (!strcmp(*args, "-outform")) {
args++; if (args[1]) {
informat=str2fmt(*args); args++;
} outformat = str2fmt(*args);
else badarg = 1; } else
} badarg = 1;
else if (!strcmp(*args,"-outform")) } else if (!strcmp(*args, "-topk8"))
{ topk8 = 1;
if (args[1]) else if (!strcmp(*args, "-noiter"))
{ iter = 1;
args++; else if (!strcmp(*args, "-nocrypt"))
outformat=str2fmt(*args); nocrypt = 1;
} else if (!strcmp(*args, "-nooct"))
else badarg = 1; p8_broken = PKCS8_NO_OCTET;
} else if (!strcmp(*args, "-nsdb"))
else if (!strcmp (*args, "-topk8")) p8_broken = PKCS8_NS_DB;
topk8 = 1; else if (!strcmp(*args, "-embed"))
else if (!strcmp (*args, "-noiter")) p8_broken = PKCS8_EMBEDDED_PARAM;
iter = 1; else if (!strcmp(*args, "-passin")) {
else if (!strcmp (*args, "-nocrypt")) if (!args[1])
nocrypt = 1; goto bad;
else if (!strcmp (*args, "-nooct")) passargin = *(++args);
p8_broken = PKCS8_NO_OCTET; } else if (!strcmp(*args, "-passout")) {
else if (!strcmp (*args, "-nsdb")) if (!args[1])
p8_broken = PKCS8_NS_DB; goto bad;
else if (!strcmp (*args, "-embed")) passargout = *(++args);
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);
}
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
else if (strcmp(*args,"-engine") == 0) else if (strcmp(*args, "-engine") == 0) {
{ if (!args[1])
if (!args[1]) goto bad; goto bad;
engine= *(++args); engine = *(++args);
} }
#endif #endif
else if (!strcmp (*args, "-in")) else if (!strcmp(*args, "-in")) {
{ if (args[1]) {
if (args[1]) args++;
{ infile = *args;
args++; } else
infile = *args; badarg = 1;
} } else if (!strcmp(*args, "-out")) {
else badarg = 1; if (args[1]) {
} args++;
else if (!strcmp (*args, "-out")) outfile = *args;
{ } else
if (args[1]) badarg = 1;
{ } else
args++; badarg = 1;
outfile = *args; args++;
} }
else badarg = 1;
}
else badarg = 1;
args++;
}
if (badarg) if (badarg) {
{ bad:
bad: BIO_printf(bio_err, "Usage pkcs8 [options]\n");
BIO_printf(bio_err, "Usage pkcs8 [options]\n"); BIO_printf(bio_err, "where options are\n");
BIO_printf(bio_err, "where options are\n"); BIO_printf(bio_err, "-in file input file\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, "-inform X input format (DER or PEM)\n"); BIO_printf(bio_err,
BIO_printf(bio_err, "-passin arg input file pass phrase source\n"); "-passin arg input file pass phrase source\n");
BIO_printf(bio_err, "-outform X output 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, "-out file output file\n");
BIO_printf(bio_err, "-passout arg output file pass phrase source\n"); BIO_printf(bio_err,
BIO_printf(bio_err, "-topk8 output PKCS8 file\n"); "-passout arg output file pass phrase source\n");
BIO_printf(bio_err, "-nooct use (nonstandard) no octet format\n"); BIO_printf(bio_err, "-topk8 output PKCS8 file\n");
BIO_printf(bio_err, "-embed use (nonstandard) embedded DSA parameters format\n"); BIO_printf(bio_err,
BIO_printf(bio_err, "-nsdb use (nonstandard) DSA Netscape DB format\n"); "-nooct use (nonstandard) no octet format\n");
BIO_printf(bio_err, "-noiter use 1 as iteration count\n"); BIO_printf(bio_err,
BIO_printf(bio_err, "-nocrypt use or expect unencrypted private key\n"); "-embed use (nonstandard) embedded DSA parameters format\n");
BIO_printf(bio_err, "-v2 alg use PKCS#5 v2.0 and cipher \"alg\"\n"); BIO_printf(bio_err,
BIO_printf(bio_err, "-v1 obj use PKCS#5 v1.5 and cipher \"alg\"\n"); "-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");
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); BIO_printf(bio_err,
" -engine e use engine e, possibly a hardware device.\n");
#endif #endif
goto end; goto end;
} }
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
e = setup_engine(bio_err, engine, 0); e = setup_engine(bio_err, engine, 0);
#endif #endif
if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
{ BIO_printf(bio_err, "Error getting passwords\n");
BIO_printf(bio_err, "Error getting passwords\n"); goto end;
goto end; }
}
if ((pbe_nid == -1) && !cipher) if ((pbe_nid == -1) && !cipher)
pbe_nid = NID_pbeWithMD5AndDES_CBC; pbe_nid = NID_pbeWithMD5AndDES_CBC;
if (infile) if (infile) {
{ if (!(in = BIO_new_file(infile, "rb"))) {
if (!(in = BIO_new_file(infile, "rb"))) BIO_printf(bio_err, "Can't open input file %s\n", infile);
{ goto end;
BIO_printf(bio_err, }
"Can't open input file %s\n", infile); } else
goto end; in = BIO_new_fp(stdin, BIO_NOCLOSE);
}
}
else
in = BIO_new_fp (stdin, BIO_NOCLOSE);
if (outfile) if (outfile) {
{ if (!(out = BIO_new_file(outfile, "wb"))) {
if (!(out = BIO_new_file (outfile, "wb"))) BIO_printf(bio_err, "Can't open output file %s\n", outfile);
{ goto end;
BIO_printf(bio_err, }
"Can't open output file %s\n", outfile); } else {
goto end; out = BIO_new_fp(stdout, BIO_NOCLOSE);
}
}
else
{
out = BIO_new_fp (stdout, BIO_NOCLOSE);
#ifdef OPENSSL_SYS_VMS #ifdef OPENSSL_SYS_VMS
{ {
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); BIO *tmpbio = BIO_new(BIO_f_linebuffer());
out = BIO_push(tmpbio, out); out = BIO_push(tmpbio, out);
} }
#endif #endif
} }
if (topk8) if (topk8) {
{ pkey = load_key(bio_err, infile, informat, 1, passin, e, "key");
pkey = load_key(bio_err, infile, informat, 1, if (!pkey)
passin, e, "key"); goto end;
if (!pkey) if (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken))) {
goto end; BIO_printf(bio_err, "Error converting key\n");
if (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken))) ERR_print_errors(bio_err);
{ goto end;
BIO_printf(bio_err, "Error converting key\n"); }
ERR_print_errors(bio_err); if (nocrypt) {
goto end; if (outformat == FORMAT_PEM)
} PEM_write_bio_PKCS8_PRIV_KEY_INFO(out, p8inf);
if (nocrypt) else if (outformat == FORMAT_ASN1)
{ i2d_PKCS8_PRIV_KEY_INFO_bio(out, p8inf);
if (outformat == FORMAT_PEM) else {
PEM_write_bio_PKCS8_PRIV_KEY_INFO(out, p8inf); BIO_printf(bio_err, "Bad format specified for key\n");
else if (outformat == FORMAT_ASN1) goto end;
i2d_PKCS8_PRIV_KEY_INFO_bio(out, p8inf); }
else } else {
{ if (passout)
BIO_printf(bio_err, "Bad format specified for key\n"); p8pass = passout;
goto end; else {
} p8pass = pass;
} if (EVP_read_pw_string
else (pass, sizeof pass, "Enter Encryption Password:", 1))
{ goto end;
if (passout) }
p8pass = passout; app_RAND_load_file(NULL, bio_err, 0);
else if (!(p8 = PKCS8_encrypt(pbe_nid, cipher,
{ p8pass, strlen(p8pass),
p8pass = pass; NULL, 0, iter, p8inf))) {
if (EVP_read_pw_string(pass, sizeof pass, "Enter Encryption Password:", 1)) BIO_printf(bio_err, "Error encrypting key\n");
goto end; ERR_print_errors(bio_err);
} goto end;
app_RAND_load_file(NULL, bio_err, 0); }
if (!(p8 = PKCS8_encrypt(pbe_nid, cipher, app_RAND_write_file(NULL, bio_err);
p8pass, strlen(p8pass), if (outformat == FORMAT_PEM)
NULL, 0, iter, p8inf))) PEM_write_bio_PKCS8(out, p8);
{ else if (outformat == FORMAT_ASN1)
BIO_printf(bio_err, "Error encrypting key\n"); i2d_PKCS8_bio(out, p8);
ERR_print_errors(bio_err); else {
goto end; BIO_printf(bio_err, "Bad format specified for key\n");
} goto end;
app_RAND_write_file(NULL, bio_err); }
if (outformat == FORMAT_PEM) }
PEM_write_bio_PKCS8(out, p8);
else if (outformat == FORMAT_ASN1)
i2d_PKCS8_bio(out, p8);
else
{
BIO_printf(bio_err, "Bad format specified for key\n");
goto end;
}
}
ret = 0; ret = 0;
goto end; goto end;
} }
if (nocrypt) if (nocrypt) {
{ if (informat == FORMAT_PEM)
if (informat == FORMAT_PEM) p8inf = PEM_read_bio_PKCS8_PRIV_KEY_INFO(in, NULL, NULL, NULL);
p8inf = PEM_read_bio_PKCS8_PRIV_KEY_INFO(in,NULL,NULL, NULL); else if (informat == FORMAT_ASN1)
else if (informat == FORMAT_ASN1) p8inf = d2i_PKCS8_PRIV_KEY_INFO_bio(in, NULL);
p8inf = d2i_PKCS8_PRIV_KEY_INFO_bio(in, NULL); else {
else BIO_printf(bio_err, "Bad format specified for key\n");
{ goto end;
BIO_printf(bio_err, "Bad format specified for key\n"); }
goto end; } else {
} if (informat == FORMAT_PEM)
} p8 = PEM_read_bio_PKCS8(in, NULL, NULL, NULL);
else else if (informat == FORMAT_ASN1)
{ p8 = d2i_PKCS8_bio(in, NULL);
if (informat == FORMAT_PEM) else {
p8 = PEM_read_bio_PKCS8(in, NULL, NULL, NULL); BIO_printf(bio_err, "Bad format specified for key\n");
else if (informat == FORMAT_ASN1) goto end;
p8 = d2i_PKCS8_bio(in, NULL); }
else
{
BIO_printf(bio_err, "Bad format specified for key\n");
goto end;
}
if (!p8) if (!p8) {
{ BIO_printf(bio_err, "Error reading key\n");
BIO_printf (bio_err, "Error reading key\n"); ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
} if (passin)
if (passin) p8pass = passin;
p8pass = passin; else {
else p8pass = pass;
{ EVP_read_pw_string(pass, sizeof pass, "Enter Password:", 0);
p8pass = pass; }
EVP_read_pw_string(pass, sizeof pass, "Enter Password:", 0); p8inf = PKCS8_decrypt(p8, p8pass, strlen(p8pass));
} }
p8inf = PKCS8_decrypt(p8, p8pass, strlen(p8pass));
}
if (!p8inf) if (!p8inf) {
{ BIO_printf(bio_err, "Error decrypting key\n");
BIO_printf(bio_err, "Error decrypting key\n"); ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
}
if (!(pkey = EVP_PKCS82PKEY(p8inf))) if (!(pkey = EVP_PKCS82PKEY(p8inf))) {
{ BIO_printf(bio_err, "Error converting key\n");
BIO_printf(bio_err, "Error converting key\n"); ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
}
if (p8inf->broken) if (p8inf->broken) {
{ BIO_printf(bio_err, "Warning: broken key encoding: ");
BIO_printf(bio_err, "Warning: broken key encoding: "); switch (p8inf->broken) {
switch (p8inf->broken) case PKCS8_NO_OCTET:
{ BIO_printf(bio_err, "No Octet String in PrivateKey\n");
case PKCS8_NO_OCTET: break;
BIO_printf(bio_err, "No Octet String in PrivateKey\n");
break;
case PKCS8_EMBEDDED_PARAM: case PKCS8_EMBEDDED_PARAM:
BIO_printf(bio_err, "DSA parameters included in PrivateKey\n"); BIO_printf(bio_err, "DSA parameters included in PrivateKey\n");
break; break;
case PKCS8_NS_DB: case PKCS8_NS_DB:
BIO_printf(bio_err, "DSA public key include in PrivateKey\n"); BIO_printf(bio_err, "DSA public key include in PrivateKey\n");
break; break;
case PKCS8_NEG_PRIVKEY: case PKCS8_NEG_PRIVKEY:
BIO_printf(bio_err, "DSA private key value is negative\n"); BIO_printf(bio_err, "DSA private key value is negative\n");
break; break;
default: default:
BIO_printf(bio_err, "Unknown broken type\n"); BIO_printf(bio_err, "Unknown broken type\n");
break; break;
} }
} }
if (outformat == FORMAT_PEM) if (outformat == FORMAT_PEM)
PEM_write_bio_PrivateKey(out, pkey, NULL, NULL, 0, NULL, passout); PEM_write_bio_PrivateKey(out, pkey, NULL, NULL, 0, NULL, passout);
else if (outformat == FORMAT_ASN1) else if (outformat == FORMAT_ASN1)
i2d_PrivateKey_bio(out, pkey); i2d_PrivateKey_bio(out, pkey);
else else {
{ BIO_printf(bio_err, "Bad format specified for key\n");
BIO_printf(bio_err, "Bad format specified for key\n"); goto end;
goto end; }
} ret = 0;
ret = 0;
end: end:
X509_SIG_free(p8); X509_SIG_free(p8);
PKCS8_PRIV_KEY_INFO_free(p8inf); PKCS8_PRIV_KEY_INFO_free(p8inf);
EVP_PKEY_free(pkey); EVP_PKEY_free(pkey);
BIO_free_all(out); BIO_free_all(out);
BIO_free(in); BIO_free(in);
if (passin) if (passin)
OPENSSL_free(passin); OPENSSL_free(passin);
if (passout) if (passout)
OPENSSL_free(passout); OPENSSL_free(passout);
return ret; return ret;
} }

Binary file not shown.

View File

@@ -1,6 +1,7 @@
/* apps/pkey.c */ /* apps/pkey.c */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL /*
* project 2006 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
* 2006
*/ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 2006 The OpenSSL Project. All rights reserved. * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
@@ -67,218 +68,184 @@
int MAIN(int, char **); int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
ENGINE *e = NULL; ENGINE *e = NULL;
char **args, *infile = NULL, *outfile = NULL; char **args, *infile = NULL, *outfile = NULL;
char *passargin = NULL, *passargout = NULL; char *passargin = NULL, *passargout = NULL;
BIO *in = NULL, *out = NULL; BIO *in = NULL, *out = NULL;
const EVP_CIPHER *cipher = NULL; const EVP_CIPHER *cipher = NULL;
int informat, outformat; int informat, outformat;
int pubin = 0, pubout = 0, pubtext = 0, text = 0, noout = 0; int pubin = 0, pubout = 0, pubtext = 0, text = 0, noout = 0;
EVP_PKEY *pkey=NULL; EVP_PKEY *pkey = NULL;
char *passin = NULL, *passout = NULL; char *passin = NULL, *passout = NULL;
int badarg = 0; int badarg = 0;
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
char *engine=NULL; char *engine = NULL;
#endif #endif
int ret = 1; int ret = 1;
if (bio_err == NULL) if (bio_err == NULL)
bio_err = BIO_new_fp (stderr, BIO_NOCLOSE); bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
if (!load_config(bio_err, NULL)) if (!load_config(bio_err, NULL))
goto end; goto end;
informat=FORMAT_PEM; informat = FORMAT_PEM;
outformat=FORMAT_PEM; outformat = FORMAT_PEM;
ERR_load_crypto_strings(); ERR_load_crypto_strings();
OpenSSL_add_all_algorithms(); OpenSSL_add_all_algorithms();
args = argv + 1; args = argv + 1;
while (!badarg && *args && *args[0] == '-') while (!badarg && *args && *args[0] == '-') {
{ if (!strcmp(*args, "-inform")) {
if (!strcmp(*args,"-inform")) if (args[1]) {
{ args++;
if (args[1]) informat = str2fmt(*args);
{ } else
args++; badarg = 1;
informat=str2fmt(*args); } else if (!strcmp(*args, "-outform")) {
} if (args[1]) {
else badarg = 1; args++;
} outformat = str2fmt(*args);
else if (!strcmp(*args,"-outform")) } else
{ badarg = 1;
if (args[1]) } else if (!strcmp(*args, "-passin")) {
{ if (!args[1])
args++; goto bad;
outformat=str2fmt(*args); passargin = *(++args);
} } else if (!strcmp(*args, "-passout")) {
else badarg = 1; if (!args[1])
} goto bad;
else if (!strcmp(*args,"-passin")) passargout = *(++args);
{ }
if (!args[1]) goto bad;
passargin= *(++args);
}
else if (!strcmp(*args,"-passout"))
{
if (!args[1]) goto bad;
passargout= *(++args);
}
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
else if (strcmp(*args,"-engine") == 0) else if (strcmp(*args, "-engine") == 0) {
{ if (!args[1])
if (!args[1]) goto bad; goto bad;
engine= *(++args); engine = *(++args);
} }
#endif #endif
else if (!strcmp (*args, "-in")) else if (!strcmp(*args, "-in")) {
{ if (args[1]) {
if (args[1]) args++;
{ infile = *args;
args++; } else
infile = *args; badarg = 1;
} } else if (!strcmp(*args, "-out")) {
else badarg = 1; if (args[1]) {
} args++;
else if (!strcmp (*args, "-out")) outfile = *args;
{ } else
if (args[1]) badarg = 1;
{ } else if (strcmp(*args, "-pubin") == 0) {
args++; pubin = 1;
outfile = *args; pubout = 1;
} pubtext = 1;
else badarg = 1; } else if (strcmp(*args, "-pubout") == 0)
} pubout = 1;
else if (strcmp(*args,"-pubin") == 0) else if (strcmp(*args, "-text_pub") == 0) {
{ pubtext = 1;
pubin=1; text = 1;
pubout=1; } else if (strcmp(*args, "-text") == 0)
pubtext=1; text = 1;
} else if (strcmp(*args, "-noout") == 0)
else if (strcmp(*args,"-pubout") == 0) noout = 1;
pubout=1; else {
else if (strcmp(*args,"-text_pub") == 0) cipher = EVP_get_cipherbyname(*args + 1);
{ if (!cipher) {
pubtext=1; BIO_printf(bio_err, "Unknown cipher %s\n", *args + 1);
text=1; badarg = 1;
} }
else if (strcmp(*args,"-text") == 0) }
text=1; args++;
else if (strcmp(*args,"-noout") == 0) }
noout=1;
else
{
cipher = EVP_get_cipherbyname(*args + 1);
if (!cipher)
{
BIO_printf(bio_err, "Unknown cipher %s\n",
*args + 1);
badarg = 1;
}
}
args++;
}
if (badarg) if (badarg) {
{ bad:
bad: BIO_printf(bio_err, "Usage pkey [options]\n");
BIO_printf(bio_err, "Usage pkey [options]\n"); BIO_printf(bio_err, "where options are\n");
BIO_printf(bio_err, "where options are\n"); BIO_printf(bio_err, "-in file input file\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, "-inform X input format (DER or PEM)\n"); BIO_printf(bio_err,
BIO_printf(bio_err, "-passin arg input file pass phrase source\n"); "-passin arg input file pass phrase source\n");
BIO_printf(bio_err, "-outform X output 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, "-out file output file\n");
BIO_printf(bio_err, "-passout arg output file pass phrase source\n"); BIO_printf(bio_err,
"-passout arg output file pass phrase source\n");
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
BIO_printf(bio_err, "-engine e use engine e, possibly a hardware device.\n"); BIO_printf(bio_err,
"-engine e use engine e, possibly a hardware device.\n");
#endif #endif
return 1; return 1;
} }
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
e = setup_engine(bio_err, engine, 0); e = setup_engine(bio_err, engine, 0);
#endif #endif
if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
{ BIO_printf(bio_err, "Error getting passwords\n");
BIO_printf(bio_err, "Error getting passwords\n"); goto end;
goto end; }
}
if (outfile) if (outfile) {
{ if (!(out = BIO_new_file(outfile, "wb"))) {
if (!(out = BIO_new_file (outfile, "wb"))) BIO_printf(bio_err, "Can't open output file %s\n", outfile);
{ goto end;
BIO_printf(bio_err, }
"Can't open output file %s\n", outfile); } else {
goto end; out = BIO_new_fp(stdout, BIO_NOCLOSE);
}
}
else
{
out = BIO_new_fp (stdout, BIO_NOCLOSE);
#ifdef OPENSSL_SYS_VMS #ifdef OPENSSL_SYS_VMS
{ {
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); BIO *tmpbio = BIO_new(BIO_f_linebuffer());
out = BIO_push(tmpbio, out); out = BIO_push(tmpbio, out);
} }
#endif #endif
} }
if (pubin) if (pubin)
pkey = load_pubkey(bio_err, infile, informat, 1, pkey = load_pubkey(bio_err, infile, informat, 1,
passin, e, "Public Key"); passin, e, "Public Key");
else else
pkey = load_key(bio_err, infile, informat, 1, pkey = load_key(bio_err, infile, informat, 1, passin, e, "key");
passin, e, "key"); if (!pkey)
if (!pkey) goto end;
goto end;
if (!noout) if (!noout) {
{ if (outformat == FORMAT_PEM) {
if (outformat == FORMAT_PEM) if (pubout)
{ PEM_write_bio_PUBKEY(out, pkey);
if (pubout) else
PEM_write_bio_PUBKEY(out,pkey); PEM_write_bio_PrivateKey(out, pkey, cipher,
else NULL, 0, NULL, passout);
PEM_write_bio_PrivateKey(out, pkey, cipher, } else if (outformat == FORMAT_ASN1) {
NULL, 0, NULL, passout); if (pubout)
} i2d_PUBKEY_bio(out, pkey);
else if (outformat == FORMAT_ASN1) else
{ i2d_PrivateKey_bio(out, pkey);
if (pubout) } else {
i2d_PUBKEY_bio(out, pkey); BIO_printf(bio_err, "Bad format specified for key\n");
else goto end;
i2d_PrivateKey_bio(out, pkey); }
}
else
{
BIO_printf(bio_err, "Bad format specified for key\n");
goto end;
}
} }
if (text) if (text) {
{ if (pubtext)
if (pubtext) EVP_PKEY_print_public(out, pkey, 0, NULL);
EVP_PKEY_print_public(out, pkey, 0, NULL); else
else EVP_PKEY_print_private(out, pkey, 0, NULL);
EVP_PKEY_print_private(out, pkey, 0, NULL); }
}
ret = 0; ret = 0;
end: end:
EVP_PKEY_free(pkey); EVP_PKEY_free(pkey);
BIO_free_all(out); BIO_free_all(out);
BIO_free(in); BIO_free(in);
if (passin) if (passin)
OPENSSL_free(passin); OPENSSL_free(passin);
if (passout) if (passout)
OPENSSL_free(passout); OPENSSL_free(passout);
return ret; return ret;
} }

Binary file not shown.

View File

@@ -1,6 +1,7 @@
/* apps/pkeyparam.c */ /* apps/pkeyparam.c */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL /*
* project 2006 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
* 2006
*/ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 2006 The OpenSSL Project. All rights reserved. * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
@@ -67,134 +68,118 @@
int MAIN(int, char **); int MAIN(int, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
char **args, *infile = NULL, *outfile = NULL; char **args, *infile = NULL, *outfile = NULL;
BIO *in = NULL, *out = NULL; BIO *in = NULL, *out = NULL;
int text = 0, noout = 0; int text = 0, noout = 0;
EVP_PKEY *pkey=NULL; EVP_PKEY *pkey = NULL;
int badarg = 0; int badarg = 0;
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
char *engine=NULL; char *engine = NULL;
#endif #endif
int ret = 1; int ret = 1;
if (bio_err == NULL) if (bio_err == NULL)
bio_err = BIO_new_fp (stderr, BIO_NOCLOSE); bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
if (!load_config(bio_err, NULL)) if (!load_config(bio_err, NULL))
goto end; goto end;
ERR_load_crypto_strings(); ERR_load_crypto_strings();
OpenSSL_add_all_algorithms(); OpenSSL_add_all_algorithms();
args = argv + 1; args = argv + 1;
while (!badarg && *args && *args[0] == '-') while (!badarg && *args && *args[0] == '-') {
{ if (!strcmp(*args, "-in")) {
if (!strcmp (*args, "-in")) if (args[1]) {
{ args++;
if (args[1]) infile = *args;
{ } else
args++; badarg = 1;
infile = *args; } else if (!strcmp(*args, "-out")) {
} if (args[1]) {
else badarg = 1; args++;
} outfile = *args;
else if (!strcmp (*args, "-out")) } else
{ badarg = 1;
if (args[1]) }
{
args++;
outfile = *args;
}
else badarg = 1;
}
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
else if (strcmp(*args,"-engine") == 0) else if (strcmp(*args, "-engine") == 0) {
{ if (!args[1])
if (!args[1]) goto bad; goto bad;
engine= *(++args); engine = *(++args);
} }
#endif #endif
else if (strcmp(*args,"-text") == 0) else if (strcmp(*args, "-text") == 0)
text=1; text = 1;
else if (strcmp(*args,"-noout") == 0) else if (strcmp(*args, "-noout") == 0)
noout=1; noout = 1;
args++; args++;
} }
if (badarg) if (badarg) {
{
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
bad: bad:
#endif #endif
BIO_printf(bio_err, "Usage pkeyparam [options]\n"); BIO_printf(bio_err, "Usage pkeyparam [options]\n");
BIO_printf(bio_err, "where options are\n"); BIO_printf(bio_err, "where options are\n");
BIO_printf(bio_err, "-in file input file\n"); BIO_printf(bio_err, "-in file input file\n");
BIO_printf(bio_err, "-out file output file\n"); BIO_printf(bio_err, "-out file output file\n");
BIO_printf(bio_err, "-text print parameters as text\n"); BIO_printf(bio_err, "-text print parameters as text\n");
BIO_printf(bio_err, "-noout don't output encoded parameters\n"); BIO_printf(bio_err,
"-noout don't output encoded parameters\n");
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
BIO_printf(bio_err, "-engine e use engine e, possibly a hardware device.\n"); BIO_printf(bio_err,
"-engine e use engine e, possibly a hardware device.\n");
#endif #endif
return 1; return 1;
} }
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
setup_engine(bio_err, engine, 0); setup_engine(bio_err, engine, 0);
#endif #endif
if (infile) if (infile) {
{ if (!(in = BIO_new_file(infile, "r"))) {
if (!(in = BIO_new_file (infile, "r"))) BIO_printf(bio_err, "Can't open input file %s\n", infile);
{ goto end;
BIO_printf(bio_err, }
"Can't open input file %s\n", infile); } else
goto end; in = BIO_new_fp(stdin, BIO_NOCLOSE);
}
}
else
in = BIO_new_fp (stdin, BIO_NOCLOSE);
if (outfile) if (outfile) {
{ if (!(out = BIO_new_file(outfile, "w"))) {
if (!(out = BIO_new_file (outfile, "w"))) BIO_printf(bio_err, "Can't open output file %s\n", outfile);
{ goto end;
BIO_printf(bio_err, }
"Can't open output file %s\n", outfile); } else {
goto end; out = BIO_new_fp(stdout, BIO_NOCLOSE);
}
}
else
{
out = BIO_new_fp (stdout, BIO_NOCLOSE);
#ifdef OPENSSL_SYS_VMS #ifdef OPENSSL_SYS_VMS
{ {
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); BIO *tmpbio = BIO_new(BIO_f_linebuffer());
out = BIO_push(tmpbio, out); out = BIO_push(tmpbio, out);
} }
#endif #endif
} }
pkey = PEM_read_bio_Parameters(in, NULL); pkey = PEM_read_bio_Parameters(in, NULL);
if (!pkey) if (!pkey) {
{ BIO_printf(bio_err, "Error reading parameters\n");
BIO_printf(bio_err, "Error reading parameters\n"); ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
}
if (!noout) if (!noout)
PEM_write_bio_Parameters(out,pkey); PEM_write_bio_Parameters(out, pkey);
if (text) if (text)
EVP_PKEY_print_params(out, pkey, 0, NULL); EVP_PKEY_print_params(out, pkey, 0, NULL);
ret = 0; ret = 0;
end: end:
EVP_PKEY_free(pkey); EVP_PKEY_free(pkey);
BIO_free_all(out); BIO_free_all(out);
BIO_free(in); BIO_free(in);
return ret; return ret;
} }

Binary file not shown.

View File

@@ -1,5 +1,6 @@
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL /*
* project 2006. * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
* 2006.
*/ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 2006 The OpenSSL Project. All rights reserved. * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
@@ -55,16 +56,15 @@
* *
*/ */
#include "apps.h" #include "apps.h"
#include <string.h> #include <string.h>
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/pem.h> #include <openssl/pem.h>
#include <openssl/evp.h> #include <openssl/evp.h>
#define KEY_PRIVKEY 1 #define KEY_PRIVKEY 1
#define KEY_PUBKEY 2 #define KEY_PUBKEY 2
#define KEY_CERT 3 #define KEY_CERT 3
static void usage(void); static void usage(void);
@@ -73,498 +73,451 @@ static void usage(void);
#define PROG pkeyutl_main #define PROG pkeyutl_main
static EVP_PKEY_CTX *init_ctx(int *pkeysize, static EVP_PKEY_CTX *init_ctx(int *pkeysize,
char *keyfile, int keyform, int key_type, char *keyfile, int keyform, int key_type,
char *passargin, int pkey_op, ENGINE *e); char *passargin, int pkey_op, ENGINE *e);
static int setup_peer(BIO *err, EVP_PKEY_CTX *ctx, int peerform, static int setup_peer(BIO *err, EVP_PKEY_CTX *ctx, int peerform,
const char *file); const char *file);
static int do_keyop(EVP_PKEY_CTX *ctx, int pkey_op, static int do_keyop(EVP_PKEY_CTX *ctx, int pkey_op,
unsigned char *out, size_t *poutlen, unsigned char *out, size_t *poutlen,
unsigned char *in, size_t inlen); unsigned char *in, size_t inlen);
int MAIN(int argc, char **); int MAIN(int argc, char **);
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
BIO *in = NULL, *out = NULL; BIO *in = NULL, *out = NULL;
char *infile = NULL, *outfile = NULL, *sigfile = NULL; char *infile = NULL, *outfile = NULL, *sigfile = NULL;
ENGINE *e = NULL; ENGINE *e = NULL;
int pkey_op = EVP_PKEY_OP_SIGN, key_type = KEY_PRIVKEY; int pkey_op = EVP_PKEY_OP_SIGN, key_type = KEY_PRIVKEY;
int keyform = FORMAT_PEM, peerform = FORMAT_PEM; int keyform = FORMAT_PEM, peerform = FORMAT_PEM;
char badarg = 0, rev = 0; char badarg = 0, rev = 0;
char hexdump = 0, asn1parse = 0; char hexdump = 0, asn1parse = 0;
EVP_PKEY_CTX *ctx = NULL; EVP_PKEY_CTX *ctx = NULL;
char *passargin = NULL; char *passargin = NULL;
int keysize = -1; int keysize = -1;
unsigned char *buf_in = NULL, *buf_out = NULL, *sig = NULL; unsigned char *buf_in = NULL, *buf_out = NULL, *sig = NULL;
size_t buf_outlen; size_t buf_outlen;
int buf_inlen = 0, siglen = -1; int buf_inlen = 0, siglen = -1;
int ret = 1, rv = -1; int ret = 1, rv = -1;
argc--; argc--;
argv++; argv++;
if(!bio_err) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE); if (!bio_err)
bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
if (!load_config(bio_err, NULL)) if (!load_config(bio_err, NULL))
goto end; goto end;
ERR_load_crypto_strings(); ERR_load_crypto_strings();
OpenSSL_add_all_algorithms(); OpenSSL_add_all_algorithms();
while(argc >= 1) while (argc >= 1) {
{ if (!strcmp(*argv, "-in")) {
if (!strcmp(*argv,"-in")) if (--argc < 1)
{ badarg = 1;
if (--argc < 1) badarg = 1; else
else infile= *(++argv); infile = *(++argv);
} } else if (!strcmp(*argv, "-out")) {
else if (!strcmp(*argv,"-out")) if (--argc < 1)
{ badarg = 1;
if (--argc < 1) badarg = 1; else
else outfile= *(++argv); outfile = *(++argv);
} } else if (!strcmp(*argv, "-sigfile")) {
else if (!strcmp(*argv,"-sigfile")) if (--argc < 1)
{ badarg = 1;
if (--argc < 1) badarg = 1; else
else sigfile= *(++argv); sigfile = *(++argv);
} } else if (!strcmp(*argv, "-inkey")) {
else if(!strcmp(*argv, "-inkey")) if (--argc < 1)
{ badarg = 1;
if (--argc < 1) else {
badarg = 1; ctx = init_ctx(&keysize,
else *(++argv), keyform, key_type,
{ passargin, pkey_op, e);
ctx = init_ctx(&keysize, if (!ctx) {
*(++argv), keyform, key_type, BIO_puts(bio_err, "Error initializing context\n");
passargin, pkey_op, e); ERR_print_errors(bio_err);
if (!ctx) badarg = 1;
{ }
BIO_puts(bio_err, }
"Error initializing context\n"); } else if (!strcmp(*argv, "-peerkey")) {
ERR_print_errors(bio_err); if (--argc < 1)
badarg = 1; badarg = 1;
} else if (!setup_peer(bio_err, ctx, peerform, *(++argv)))
} badarg = 1;
} } else if (!strcmp(*argv, "-passin")) {
else if (!strcmp(*argv,"-peerkey")) if (--argc < 1)
{ badarg = 1;
if (--argc < 1) else
badarg = 1; passargin = *(++argv);
else if (!setup_peer(bio_err, ctx, peerform, *(++argv))) } else if (strcmp(*argv, "-peerform") == 0) {
badarg = 1; if (--argc < 1)
} badarg = 1;
else if (!strcmp(*argv,"-passin")) else
{ peerform = str2fmt(*(++argv));
if (--argc < 1) badarg = 1; } else if (strcmp(*argv, "-keyform") == 0) {
else passargin= *(++argv); if (--argc < 1)
} badarg = 1;
else if (strcmp(*argv,"-peerform") == 0) else
{ keyform = str2fmt(*(++argv));
if (--argc < 1) badarg = 1; }
else peerform=str2fmt(*(++argv));
}
else if (strcmp(*argv,"-keyform") == 0)
{
if (--argc < 1) badarg = 1;
else keyform=str2fmt(*(++argv));
}
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
else if(!strcmp(*argv, "-engine")) else if (!strcmp(*argv, "-engine")) {
{ if (--argc < 1)
if (--argc < 1) badarg = 1;
badarg = 1; else
else e = setup_engine(bio_err, *(++argv), 0);
e = setup_engine(bio_err, *(++argv), 0); }
}
#endif #endif
else if(!strcmp(*argv, "-pubin")) else if (!strcmp(*argv, "-pubin"))
key_type = KEY_PUBKEY; key_type = KEY_PUBKEY;
else if(!strcmp(*argv, "-certin")) else if (!strcmp(*argv, "-certin"))
key_type = KEY_CERT; key_type = KEY_CERT;
else if(!strcmp(*argv, "-asn1parse")) else if (!strcmp(*argv, "-asn1parse"))
asn1parse = 1; asn1parse = 1;
else if(!strcmp(*argv, "-hexdump")) else if (!strcmp(*argv, "-hexdump"))
hexdump = 1; hexdump = 1;
else if(!strcmp(*argv, "-sign")) else if (!strcmp(*argv, "-sign"))
pkey_op = EVP_PKEY_OP_SIGN; pkey_op = EVP_PKEY_OP_SIGN;
else if(!strcmp(*argv, "-verify")) else if (!strcmp(*argv, "-verify"))
pkey_op = EVP_PKEY_OP_VERIFY; pkey_op = EVP_PKEY_OP_VERIFY;
else if(!strcmp(*argv, "-verifyrecover")) else if (!strcmp(*argv, "-verifyrecover"))
pkey_op = EVP_PKEY_OP_VERIFYRECOVER; pkey_op = EVP_PKEY_OP_VERIFYRECOVER;
else if(!strcmp(*argv, "-rev")) else if (!strcmp(*argv, "-rev"))
rev = 1; rev = 1;
else if(!strcmp(*argv, "-encrypt")) else if (!strcmp(*argv, "-encrypt"))
pkey_op = EVP_PKEY_OP_ENCRYPT; pkey_op = EVP_PKEY_OP_ENCRYPT;
else if(!strcmp(*argv, "-decrypt")) else if (!strcmp(*argv, "-decrypt"))
pkey_op = EVP_PKEY_OP_DECRYPT; pkey_op = EVP_PKEY_OP_DECRYPT;
else if(!strcmp(*argv, "-derive")) else if (!strcmp(*argv, "-derive"))
pkey_op = EVP_PKEY_OP_DERIVE; pkey_op = EVP_PKEY_OP_DERIVE;
else if (strcmp(*argv,"-pkeyopt") == 0) else if (strcmp(*argv, "-pkeyopt") == 0) {
{ if (--argc < 1)
if (--argc < 1) badarg = 1;
badarg = 1; else if (!ctx) {
else if (!ctx) BIO_puts(bio_err, "-pkeyopt command before -inkey\n");
{ badarg = 1;
BIO_puts(bio_err, } else if (pkey_ctrl_string(ctx, *(++argv)) <= 0) {
"-pkeyopt command before -inkey\n"); BIO_puts(bio_err, "parameter setting error\n");
badarg = 1; ERR_print_errors(bio_err);
} goto end;
else if (pkey_ctrl_string(ctx, *(++argv)) <= 0) }
{ } else
BIO_puts(bio_err, "parameter setting error\n"); badarg = 1;
ERR_print_errors(bio_err); if (badarg) {
goto end; usage();
} goto end;
} }
else badarg = 1; argc--;
if(badarg) argv++;
{ }
usage();
goto end;
}
argc--;
argv++;
}
if (!ctx) if (!ctx) {
{ usage();
usage(); goto end;
goto end; }
}
if (sigfile && (pkey_op != EVP_PKEY_OP_VERIFY)) if (sigfile && (pkey_op != EVP_PKEY_OP_VERIFY)) {
{ BIO_puts(bio_err, "Signature file specified for non verify\n");
BIO_puts(bio_err, "Signature file specified for non verify\n"); goto end;
goto end; }
}
if (!sigfile && (pkey_op == EVP_PKEY_OP_VERIFY)) if (!sigfile && (pkey_op == EVP_PKEY_OP_VERIFY)) {
{ BIO_puts(bio_err, "No signature file specified for verify\n");
BIO_puts(bio_err, "No signature file specified for verify\n"); goto end;
goto end; }
}
/* FIXME: seed PRNG only if needed */ /* FIXME: seed PRNG only if needed */
app_RAND_load_file(NULL, bio_err, 0); app_RAND_load_file(NULL, bio_err, 0);
if (pkey_op != EVP_PKEY_OP_DERIVE) if (pkey_op != EVP_PKEY_OP_DERIVE) {
{ if (infile) {
if(infile) if (!(in = BIO_new_file(infile, "rb"))) {
{ BIO_puts(bio_err, "Error Opening Input File\n");
if(!(in = BIO_new_file(infile, "rb"))) ERR_print_errors(bio_err);
{ goto end;
BIO_puts(bio_err, }
"Error Opening Input File\n"); } else
ERR_print_errors(bio_err); in = BIO_new_fp(stdin, BIO_NOCLOSE);
goto end; }
}
}
else
in = BIO_new_fp(stdin, BIO_NOCLOSE);
}
if(outfile) if (outfile) {
{ if (!(out = BIO_new_file(outfile, "wb"))) {
if(!(out = BIO_new_file(outfile, "wb"))) BIO_printf(bio_err, "Error Creating Output File\n");
{ ERR_print_errors(bio_err);
BIO_printf(bio_err, "Error Creating Output File\n"); goto end;
ERR_print_errors(bio_err); }
goto end; } else {
} out = BIO_new_fp(stdout, BIO_NOCLOSE);
}
else
{
out = BIO_new_fp(stdout, BIO_NOCLOSE);
#ifdef OPENSSL_SYS_VMS #ifdef OPENSSL_SYS_VMS
{ {
BIO *tmpbio = BIO_new(BIO_f_linebuffer()); BIO *tmpbio = BIO_new(BIO_f_linebuffer());
out = BIO_push(tmpbio, out); out = BIO_push(tmpbio, out);
} }
#endif #endif
} }
if (sigfile) if (sigfile) {
{ BIO *sigbio = BIO_new_file(sigfile, "rb");
BIO *sigbio = BIO_new_file(sigfile, "rb"); if (!sigbio) {
if (!sigbio) BIO_printf(bio_err, "Can't open signature file %s\n", sigfile);
{ goto end;
BIO_printf(bio_err, "Can't open signature file %s\n", }
sigfile); siglen = bio_to_mem(&sig, keysize * 10, sigbio);
goto end; BIO_free(sigbio);
} if (siglen <= 0) {
siglen = bio_to_mem(&sig, keysize * 10, sigbio); BIO_printf(bio_err, "Error reading signature data\n");
BIO_free(sigbio); goto end;
if (siglen <= 0) }
{ }
BIO_printf(bio_err, "Error reading signature data\n");
goto end;
}
}
if (in) if (in) {
{ /* Read the input data */
/* Read the input data */ buf_inlen = bio_to_mem(&buf_in, keysize * 10, in);
buf_inlen = bio_to_mem(&buf_in, keysize * 10, in); if (buf_inlen <= 0) {
if(buf_inlen <= 0) BIO_printf(bio_err, "Error reading input Data\n");
{ exit(1);
BIO_printf(bio_err, "Error reading input Data\n"); }
exit(1); if (rev) {
} size_t i;
if(rev) unsigned char ctmp;
{ size_t l = (size_t)buf_inlen;
size_t i; for (i = 0; i < l / 2; i++) {
unsigned char ctmp; ctmp = buf_in[i];
size_t l = (size_t)buf_inlen; buf_in[i] = buf_in[l - 1 - i];
for(i = 0; i < l/2; i++) buf_in[l - 1 - i] = ctmp;
{ }
ctmp = buf_in[i]; }
buf_in[i] = buf_in[l - 1 - i]; }
buf_in[l - 1 - i] = ctmp;
}
}
}
if(pkey_op == EVP_PKEY_OP_VERIFY) if (pkey_op == EVP_PKEY_OP_VERIFY) {
{ rv = EVP_PKEY_verify(ctx, sig, (size_t)siglen,
rv = EVP_PKEY_verify(ctx, sig, (size_t)siglen, buf_in, (size_t)buf_inlen);
buf_in, (size_t)buf_inlen); if (rv == 0)
if (rv == 0) BIO_puts(out, "Signature Verification Failure\n");
BIO_puts(out, "Signature Verification Failure\n"); else if (rv == 1)
else if (rv == 1) BIO_puts(out, "Signature Verified Successfully\n");
BIO_puts(out, "Signature Verified Successfully\n"); if (rv >= 0)
if (rv >= 0) goto end;
goto end; } else {
} rv = do_keyop(ctx, pkey_op, NULL, (size_t *)&buf_outlen,
else buf_in, (size_t)buf_inlen);
{ if (rv > 0) {
rv = do_keyop(ctx, pkey_op, NULL, (size_t *)&buf_outlen, buf_out = OPENSSL_malloc(buf_outlen);
buf_in, (size_t)buf_inlen); if (!buf_out)
if (rv > 0) rv = -1;
{ else
buf_out = OPENSSL_malloc(buf_outlen); rv = do_keyop(ctx, pkey_op,
if (!buf_out) buf_out, (size_t *)&buf_outlen,
rv = -1; buf_in, (size_t)buf_inlen);
else }
rv = do_keyop(ctx, pkey_op, }
buf_out, (size_t *)&buf_outlen,
buf_in, (size_t)buf_inlen);
}
}
if(rv <= 0) if (rv <= 0) {
{ BIO_printf(bio_err, "Public Key operation error\n");
BIO_printf(bio_err, "Public Key operation error\n"); ERR_print_errors(bio_err);
ERR_print_errors(bio_err); goto end;
goto end; }
} ret = 0;
ret = 0; if (asn1parse) {
if(asn1parse) if (!ASN1_parse_dump(out, buf_out, buf_outlen, 1, -1))
{ ERR_print_errors(bio_err);
if(!ASN1_parse_dump(out, buf_out, buf_outlen, 1, -1)) } else if (hexdump)
ERR_print_errors(bio_err); BIO_dump(out, (char *)buf_out, buf_outlen);
} else
else if(hexdump) BIO_write(out, buf_out, buf_outlen);
BIO_dump(out, (char *)buf_out, buf_outlen);
else
BIO_write(out, buf_out, buf_outlen);
end: end:
if (ctx) if (ctx)
EVP_PKEY_CTX_free(ctx); EVP_PKEY_CTX_free(ctx);
BIO_free(in); BIO_free(in);
BIO_free_all(out); BIO_free_all(out);
if (buf_in) if (buf_in)
OPENSSL_free(buf_in); OPENSSL_free(buf_in);
if (buf_out) if (buf_out)
OPENSSL_free(buf_out); OPENSSL_free(buf_out);
if (sig) if (sig)
OPENSSL_free(sig); OPENSSL_free(sig);
return ret; return ret;
} }
static void usage() static void usage()
{ {
BIO_printf(bio_err, "Usage: pkeyutl [options]\n"); BIO_printf(bio_err, "Usage: pkeyutl [options]\n");
BIO_printf(bio_err, "-in file input file\n"); BIO_printf(bio_err, "-in file input file\n");
BIO_printf(bio_err, "-out file output file\n"); BIO_printf(bio_err, "-out file output file\n");
BIO_printf(bio_err, "-sigfile file signature file (verify operation only)\n"); BIO_printf(bio_err,
BIO_printf(bio_err, "-inkey file input key\n"); "-sigfile file signature file (verify operation only)\n");
BIO_printf(bio_err, "-keyform arg private key format - default PEM\n"); BIO_printf(bio_err, "-inkey file input key\n");
BIO_printf(bio_err, "-pubin input is a public key\n"); BIO_printf(bio_err, "-keyform arg private key format - default PEM\n");
BIO_printf(bio_err, "-certin input is a certificate carrying a public key\n"); BIO_printf(bio_err, "-pubin input is a public key\n");
BIO_printf(bio_err, "-pkeyopt X:Y public key options\n"); BIO_printf(bio_err,
BIO_printf(bio_err, "-sign sign with private key\n"); "-certin input is a certificate carrying a public key\n");
BIO_printf(bio_err, "-verify verify with public key\n"); BIO_printf(bio_err, "-pkeyopt X:Y public key options\n");
BIO_printf(bio_err, "-verifyrecover verify with public key, recover original data\n"); BIO_printf(bio_err, "-sign sign with private key\n");
BIO_printf(bio_err, "-encrypt encrypt with public key\n"); BIO_printf(bio_err, "-verify verify with public key\n");
BIO_printf(bio_err, "-decrypt decrypt with private key\n"); BIO_printf(bio_err,
BIO_printf(bio_err, "-derive derive shared secret\n"); "-verifyrecover verify with public key, recover original data\n");
BIO_printf(bio_err, "-hexdump hex dump output\n"); BIO_printf(bio_err, "-encrypt encrypt with public key\n");
BIO_printf(bio_err, "-decrypt decrypt with private key\n");
BIO_printf(bio_err, "-derive derive shared secret\n");
BIO_printf(bio_err, "-hexdump hex dump output\n");
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
BIO_printf(bio_err, "-engine e use engine e, possibly a hardware device.\n"); BIO_printf(bio_err,
"-engine e use engine e, possibly a hardware device.\n");
#endif #endif
BIO_printf(bio_err, "-passin arg pass phrase source\n"); BIO_printf(bio_err, "-passin arg pass phrase source\n");
} }
static EVP_PKEY_CTX *init_ctx(int *pkeysize, static EVP_PKEY_CTX *init_ctx(int *pkeysize,
char *keyfile, int keyform, int key_type, char *keyfile, int keyform, int key_type,
char *passargin, int pkey_op, ENGINE *e) char *passargin, int pkey_op, ENGINE *e)
{ {
EVP_PKEY *pkey = NULL; EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *ctx = NULL; EVP_PKEY_CTX *ctx = NULL;
char *passin = NULL; char *passin = NULL;
int rv = -1; int rv = -1;
X509 *x; X509 *x;
if(((pkey_op == EVP_PKEY_OP_SIGN) || (pkey_op == EVP_PKEY_OP_DECRYPT) if (((pkey_op == EVP_PKEY_OP_SIGN) || (pkey_op == EVP_PKEY_OP_DECRYPT)
|| (pkey_op == EVP_PKEY_OP_DERIVE)) || (pkey_op == EVP_PKEY_OP_DERIVE))
&& (key_type != KEY_PRIVKEY)) && (key_type != KEY_PRIVKEY)) {
{ BIO_printf(bio_err, "A private key is needed for this operation\n");
BIO_printf(bio_err, "A private key is needed for this operation\n"); goto end;
goto end; }
} if (!app_passwd(bio_err, passargin, NULL, &passin, NULL)) {
if(!app_passwd(bio_err, passargin, NULL, &passin, NULL)) BIO_printf(bio_err, "Error getting password\n");
{ goto end;
BIO_printf(bio_err, "Error getting password\n"); }
goto end; switch (key_type) {
} case KEY_PRIVKEY:
switch(key_type) pkey = load_key(bio_err, keyfile, keyform, 0,
{ passin, e, "Private Key");
case KEY_PRIVKEY: break;
pkey = load_key(bio_err, keyfile, keyform, 0,
passin, e, "Private Key");
break;
case KEY_PUBKEY: case KEY_PUBKEY:
pkey = load_pubkey(bio_err, keyfile, keyform, 0, pkey = load_pubkey(bio_err, keyfile, keyform, 0,
NULL, e, "Public Key"); NULL, e, "Public Key");
break; break;
case KEY_CERT: case KEY_CERT:
x = load_cert(bio_err, keyfile, keyform, x = load_cert(bio_err, keyfile, keyform, NULL, e, "Certificate");
NULL, e, "Certificate"); if (x) {
if(x) pkey = X509_get_pubkey(x);
{ X509_free(x);
pkey = X509_get_pubkey(x); }
X509_free(x); break;
}
break;
} }
*pkeysize = EVP_PKEY_size(pkey); *pkeysize = EVP_PKEY_size(pkey);
if (!pkey) if (!pkey)
goto end; goto end;
ctx = EVP_PKEY_CTX_new(pkey, e); ctx = EVP_PKEY_CTX_new(pkey, e);
EVP_PKEY_free(pkey); EVP_PKEY_free(pkey);
if (!ctx) if (!ctx)
goto end; goto end;
switch(pkey_op) switch (pkey_op) {
{ case EVP_PKEY_OP_SIGN:
case EVP_PKEY_OP_SIGN: rv = EVP_PKEY_sign_init(ctx);
rv = EVP_PKEY_sign_init(ctx); break;
break;
case EVP_PKEY_OP_VERIFY: case EVP_PKEY_OP_VERIFY:
rv = EVP_PKEY_verify_init(ctx); rv = EVP_PKEY_verify_init(ctx);
break; break;
case EVP_PKEY_OP_VERIFYRECOVER: case EVP_PKEY_OP_VERIFYRECOVER:
rv = EVP_PKEY_verify_recover_init(ctx); rv = EVP_PKEY_verify_recover_init(ctx);
break; break;
case EVP_PKEY_OP_ENCRYPT: case EVP_PKEY_OP_ENCRYPT:
rv = EVP_PKEY_encrypt_init(ctx); rv = EVP_PKEY_encrypt_init(ctx);
break; break;
case EVP_PKEY_OP_DECRYPT: case EVP_PKEY_OP_DECRYPT:
rv = EVP_PKEY_decrypt_init(ctx); rv = EVP_PKEY_decrypt_init(ctx);
break; break;
case EVP_PKEY_OP_DERIVE: case EVP_PKEY_OP_DERIVE:
rv = EVP_PKEY_derive_init(ctx); rv = EVP_PKEY_derive_init(ctx);
break; break;
} }
if (rv <= 0) if (rv <= 0) {
{ EVP_PKEY_CTX_free(ctx);
EVP_PKEY_CTX_free(ctx); ctx = NULL;
ctx = NULL; }
}
end: end:
if (passin) if (passin)
OPENSSL_free(passin); OPENSSL_free(passin);
return ctx; return ctx;
}
}
static int setup_peer(BIO *err, EVP_PKEY_CTX *ctx, int peerform, static int setup_peer(BIO *err, EVP_PKEY_CTX *ctx, int peerform,
const char *file) const char *file)
{ {
EVP_PKEY *peer = NULL; EVP_PKEY *peer = NULL;
int ret; int ret;
if (!ctx) if (!ctx) {
{ BIO_puts(err, "-peerkey command before -inkey\n");
BIO_puts(err, "-peerkey command before -inkey\n"); return 0;
return 0; }
}
peer = load_pubkey(bio_err, file, peerform, 0, NULL, NULL, "Peer Key"); peer = load_pubkey(bio_err, file, peerform, 0, NULL, NULL, "Peer Key");
if (!peer) if (!peer) {
{ BIO_printf(bio_err, "Error reading peer key %s\n", file);
BIO_printf(bio_err, "Error reading peer key %s\n", file); ERR_print_errors(err);
ERR_print_errors(err); return 0;
return 0; }
}
ret = EVP_PKEY_derive_set_peer(ctx, peer); ret = EVP_PKEY_derive_set_peer(ctx, peer);
EVP_PKEY_free(peer); EVP_PKEY_free(peer);
if (ret <= 0) if (ret <= 0)
ERR_print_errors(err); ERR_print_errors(err);
return ret; return ret;
} }
static int do_keyop(EVP_PKEY_CTX *ctx, int pkey_op, static int do_keyop(EVP_PKEY_CTX *ctx, int pkey_op,
unsigned char *out, size_t *poutlen, unsigned char *out, size_t *poutlen,
unsigned char *in, size_t inlen) unsigned char *in, size_t inlen)
{ {
int rv = 0; int rv = 0;
switch(pkey_op) switch (pkey_op) {
{ case EVP_PKEY_OP_VERIFYRECOVER:
case EVP_PKEY_OP_VERIFYRECOVER: rv = EVP_PKEY_verify_recover(ctx, out, poutlen, in, inlen);
rv = EVP_PKEY_verify_recover(ctx, out, poutlen, in, inlen); break;
break;
case EVP_PKEY_OP_SIGN: case EVP_PKEY_OP_SIGN:
rv = EVP_PKEY_sign(ctx, out, poutlen, in, inlen); rv = EVP_PKEY_sign(ctx, out, poutlen, in, inlen);
break; break;
case EVP_PKEY_OP_ENCRYPT: case EVP_PKEY_OP_ENCRYPT:
rv = EVP_PKEY_encrypt(ctx, out, poutlen, in, inlen); rv = EVP_PKEY_encrypt(ctx, out, poutlen, in, inlen);
break; break;
case EVP_PKEY_OP_DECRYPT: case EVP_PKEY_OP_DECRYPT:
rv = EVP_PKEY_decrypt(ctx, out, poutlen, in, inlen); rv = EVP_PKEY_decrypt(ctx, out, poutlen, in, inlen);
break; break;
case EVP_PKEY_OP_DERIVE: case EVP_PKEY_OP_DERIVE:
rv = EVP_PKEY_derive(ctx, out, poutlen); rv = EVP_PKEY_derive(ctx, out, poutlen);
break; break;
} }
return rv; return rv;
} }

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