Merge OpenSSL 1.0.1c.
Approved by: benl (maintainer)
This commit is contained in:
commit
1f13597d10
@ -38,6 +38,22 @@
|
||||
# xargs -n1 | sort | uniq -d;
|
||||
# done
|
||||
|
||||
# 20120712: OpenSSL 1.0.1c import
|
||||
OLD_FILES+=lib/libcrypto.so.6
|
||||
OLD_FILES+=usr/include/openssl/aes_locl.h
|
||||
OLD_FILES+=usr/include/openssl/bio_lcl.h
|
||||
OLD_FILES+=usr/include/openssl/e_os.h
|
||||
OLD_FILES+=usr/include/openssl/fips.h
|
||||
OLD_FILES+=usr/include/openssl/fips_rand.h
|
||||
OLD_FILES+=usr/include/openssl/md2.h
|
||||
OLD_FILES+=usr/include/openssl/pq_compat.h
|
||||
OLD_FILES+=usr/include/openssl/store.h
|
||||
OLD_FILES+=usr/include/openssl/tmdiff.h
|
||||
OLD_FILES+=usr/include/openssl/ui_locl.h
|
||||
OLD_FILES+=usr/lib/libssl.so.6
|
||||
OLD_FILES+=usr/lib32/libcrypto.so.6
|
||||
OLD_FILES+=usr/lib32/libssl.so.6
|
||||
OLD_FILES+=usr/share/openssl/man/man3/CRYPTO_set_id_callback.3.gz
|
||||
# 20120621: remove old man page
|
||||
OLD_FILES+=usr/share/man/man8/vnconfig.8.gz
|
||||
# 20120613: auth.conf removed
|
||||
|
5
UPDATING
5
UPDATING
@ -24,6 +24,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW:
|
||||
disable the most expensive debugging functionality run
|
||||
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
|
||||
|
||||
20120712:
|
||||
The OpenSSL has been upgraded to 1.0.1c. Any binaries requiring
|
||||
libcrypto.so.6 or libssl.so.6 must be recompiled. Also, there are
|
||||
configuration changes. Make sure to merge /etc/ssl/openssl.cnf.
|
||||
|
||||
20120712:
|
||||
The following sysctls and tunables have been renamed for consistency
|
||||
with other variables:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -148,7 +148,7 @@ eric (about to go bushwalking for the 4 day easter break :-)
|
||||
This would tend to cause memory overwrites since SSLv3 has
|
||||
a maximum packet size of 16k. If your program uses
|
||||
buffers <= 16k, you would probably never see this problem.
|
||||
- Fixed a new errors that were cause by malloc() not returning
|
||||
- Fixed a few errors that were cause by malloc() not returning
|
||||
0 initialised memory..
|
||||
- SSL_OP_NETSCAPE_CA_DN_BUG was being switched on when using
|
||||
SSL_CTX_set_options(ssl_ctx,SSL_OP_ALL); which was a bad thing
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -98,11 +98,17 @@
|
||||
The crypto/<cipher> directory can be removed after running
|
||||
"make depend".
|
||||
|
||||
-Dxxx, -lxxx, -Lxxx, -fxxx, -mxxx, -Kxxx These system specific options will
|
||||
-Dxxx, -lxxx, -Lxxx, -fxxx, -mXXX, -Kxxx These system specific options will
|
||||
be passed through to the compiler to allow you to
|
||||
define preprocessor symbols, specify additional libraries,
|
||||
library directories or other compiler options.
|
||||
|
||||
-DHAVE_CRYPTODEV Enable the BSD cryptodev engine even if we are not using
|
||||
BSD. Useful if you are running ocf-linux or something
|
||||
similar. Once enabled you can also enable the use of
|
||||
cryptodev digests, which is usually slower unless you have
|
||||
large amounts data. Use -DUSE_CRYPTODEV_DIGESTS to force
|
||||
it.
|
||||
|
||||
Installation in Detail
|
||||
----------------------
|
||||
@ -206,6 +212,10 @@
|
||||
compile programs with libcrypto or libssl.
|
||||
lib Contains the OpenSSL library files themselves.
|
||||
|
||||
Use "make install_sw" to install the software without documentation,
|
||||
and "install_docs_html" to install HTML renditions of the manual
|
||||
pages.
|
||||
|
||||
Package builders who want to configure the library for standard
|
||||
locations, but have the package installed somewhere else so that
|
||||
it can easily be packaged, can use
|
||||
|
@ -4,16 +4,16 @@
|
||||
## Makefile for OpenSSL
|
||||
##
|
||||
|
||||
VERSION=0.9.8x
|
||||
MAJOR=0
|
||||
MINOR=9.8
|
||||
SHLIB_VERSION_NUMBER=0.9.8
|
||||
VERSION=1.0.1c
|
||||
MAJOR=1
|
||||
MINOR=0.1
|
||||
SHLIB_VERSION_NUMBER=1.0.0
|
||||
SHLIB_VERSION_HISTORY=
|
||||
SHLIB_MAJOR=0
|
||||
SHLIB_MINOR=9.8
|
||||
SHLIB_MAJOR=1
|
||||
SHLIB_MINOR=0.0
|
||||
SHLIB_EXT=
|
||||
PLATFORM=dist
|
||||
OPTIONS= no-camellia no-capieng no-cms no-gmp no-jpake no-krb5 no-mdc2 no-montasm no-rc5 no-rfc3779 no-seed no-shared no-zlib no-zlib-dynamic
|
||||
OPTIONS= no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-store no-zlib no-zlib-dynamic static-engine
|
||||
CONFIGURE_ARGS=dist
|
||||
SHLIB_TARGET=
|
||||
|
||||
@ -61,14 +61,14 @@ OPENSSLDIR=/usr/local/ssl
|
||||
|
||||
CC= cc
|
||||
CFLAG= -O
|
||||
DEPFLAG= -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_CAPIENG -DOPENSSL_NO_CMS -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SEED
|
||||
DEPFLAG= -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_STORE
|
||||
PEX_LIBS=
|
||||
EX_LIBS=
|
||||
EXE_EXT=
|
||||
ARFLAGS=
|
||||
AR= ar $(ARFLAGS) r
|
||||
ARD=ar $(ARFLAGS) d
|
||||
RANLIB= /usr/bin/ranlib
|
||||
NM= nm
|
||||
PERL= /usr/bin/perl
|
||||
TAR= tar
|
||||
TARFLAGS= --no-recursion
|
||||
@ -88,10 +88,10 @@ ASFLAG=$(CFLAG)
|
||||
PROCESSOR=
|
||||
|
||||
# CPUID module collects small commonly used assembler snippets
|
||||
CPUID_OBJ=
|
||||
CPUID_OBJ= mem_clr.o
|
||||
BN_ASM= bn_asm.o
|
||||
DES_ENC= des_enc.o fcrypt_b.o
|
||||
AES_ASM_OBJ= aes_core.o aes_cbc.o
|
||||
AES_ENC= aes_core.o aes_cbc.o
|
||||
BF_ENC= bf_enc.o
|
||||
CAST_ENC= c_enc.o
|
||||
RC4_ENC= rc4_enc.o rc4_skey.o
|
||||
@ -99,6 +99,11 @@ RC5_ENC= rc5_enc.o
|
||||
MD5_ASM_OBJ=
|
||||
SHA1_ASM_OBJ=
|
||||
RMD160_ASM_OBJ=
|
||||
WP_ASM_OBJ= wp_block.o
|
||||
CMLL_ENC= camellia.o cmll_misc.o cmll_cbc.o
|
||||
MODES_ASM_OBJ=
|
||||
ENGINES_ASM_OBJ=
|
||||
PERLASM_SCHEME=
|
||||
|
||||
# KRB5 stuff
|
||||
KRB5_INCLUDES=
|
||||
@ -108,19 +113,17 @@ LIBKRB5=
|
||||
ZLIB_INCLUDE=
|
||||
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 make be different so hard
|
||||
# $(INSTALLTOP) for this build may be different so hard
|
||||
# code the path.
|
||||
|
||||
FIPSLIBDIR=/usr/local/ssl/fips-1.0/lib/
|
||||
|
||||
# This is set to "y" if fipscanister.o is compiled internally as
|
||||
# opposed to coming from an external validated location.
|
||||
|
||||
FIPSCANISTERINTERNAL=n
|
||||
FIPSLIBDIR=
|
||||
|
||||
# The location of the library which contains fipscanister.o
|
||||
# normally it will be libcrypto unless fipsdso is set in which
|
||||
@ -135,17 +138,18 @@ FIPSCANLIB=
|
||||
BASEADDR=0xFB00000
|
||||
|
||||
DIRS= crypto ssl engines apps test tools
|
||||
ENGDIRS= ccgost
|
||||
SHLIBDIRS= crypto ssl
|
||||
|
||||
# dirs in crypto to build
|
||||
SDIRS= \
|
||||
objects \
|
||||
md2 md4 md5 sha hmac ripemd \
|
||||
des aes rc2 rc4 idea bf cast \
|
||||
md4 md5 sha mdc2 hmac ripemd whrlpool \
|
||||
des aes rc2 rc4 idea bf cast camellia seed modes \
|
||||
bn ec rsa dsa ecdsa dh ecdh dso engine \
|
||||
buffer bio stack lhash rand err \
|
||||
evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
|
||||
store pqueue
|
||||
cms pqueue ts srp cmac
|
||||
# keep in mind that the above list is adjusted by ./Configure
|
||||
# according to no-xxx arguments...
|
||||
|
||||
@ -159,6 +163,8 @@ MANDIR=$(OPENSSLDIR)/man
|
||||
MAN1=1
|
||||
MAN3=3
|
||||
MANSUFFIX=
|
||||
HTMLSUFFIX=html
|
||||
HTMLDIR=$(OPENSSLDIR)/html
|
||||
SHELL=/bin/sh
|
||||
|
||||
TOP= .
|
||||
@ -168,7 +174,6 @@ WDIRS= windows
|
||||
LIBS= libcrypto.a libssl.a
|
||||
SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
|
||||
SHARED_SSL=libssl$(SHLIB_EXT)
|
||||
SHARED_FIPS=
|
||||
SHARED_LIBS=
|
||||
SHARED_LIBS_LINK_EXTS=
|
||||
SHARED_LDFLAGS=
|
||||
@ -195,38 +200,44 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS} \
|
||||
$${EXHEADER+EXHEADER} $${HEADER+HEADER} \
|
||||
$${GENERAL+GENERAL} $${CFLAGS+CFLAGS} \
|
||||
$${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \
|
||||
$${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} \
|
||||
$${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \
|
||||
$${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \
|
||||
$${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
|
||||
|
||||
BUILDENV= PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \
|
||||
CC='${CC}' CFLAG='${CFLAG}' \
|
||||
AS='${CC}' ASFLAG='${CFLAG} -c' \
|
||||
AR='${AR}' PERL='${PERL}' RANLIB='${RANLIB}' \
|
||||
SDIRS='${SDIRS}' LIBRPATH='${INSTALLTOP}/$(LIBDIR)' \
|
||||
INSTALL_PREFIX='${INSTALL_PREFIX}' \
|
||||
INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' \
|
||||
LIBDIR='${LIBDIR}' \
|
||||
MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD ${MAKEDEPPROG}' \
|
||||
DEPFLAG='-DOPENSSL_NO_DEPRECATED ${DEPFLAG}' \
|
||||
MAKEDEPPROG='${MAKEDEPPROG}' \
|
||||
SHARED_LDFLAGS='${SHARED_LDFLAGS}' \
|
||||
KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' \
|
||||
EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' \
|
||||
SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' \
|
||||
PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' \
|
||||
CPUID_OBJ='${CPUID_OBJ}' \
|
||||
BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' \
|
||||
AES_ASM_OBJ='${AES_ASM_OBJ}' \
|
||||
BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' \
|
||||
RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' \
|
||||
SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' \
|
||||
MD5_ASM_OBJ='${MD5_ASM_OBJ}' \
|
||||
RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' \
|
||||
BUILDENV= PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
|
||||
CC='$(CC)' CFLAG='$(CFLAG)' \
|
||||
AS='$(CC)' ASFLAG='$(CFLAG) -c' \
|
||||
AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)' \
|
||||
CROSS_COMPILE='$(CROSS_COMPILE)' \
|
||||
PERL='$(PERL)' ENGDIRS='$(ENGDIRS)' \
|
||||
SDIRS='$(SDIRS)' LIBRPATH='$(INSTALLTOP)/$(LIBDIR)' \
|
||||
INSTALL_PREFIX='$(INSTALL_PREFIX)' \
|
||||
INSTALLTOP='$(INSTALLTOP)' OPENSSLDIR='$(OPENSSLDIR)' \
|
||||
LIBDIR='$(LIBDIR)' \
|
||||
MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD $(MAKEDEPPROG)' \
|
||||
DEPFLAG='-DOPENSSL_NO_DEPRECATED $(DEPFLAG)' \
|
||||
MAKEDEPPROG='$(MAKEDEPPROG)' \
|
||||
SHARED_LDFLAGS='$(SHARED_LDFLAGS)' \
|
||||
KRB5_INCLUDES='$(KRB5_INCLUDES)' LIBKRB5='$(LIBKRB5)' \
|
||||
ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)' \
|
||||
EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)' \
|
||||
SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)' \
|
||||
PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)' \
|
||||
CPUID_OBJ='$(CPUID_OBJ)' \
|
||||
BN_ASM='$(BN_ASM)' DES_ENC='$(DES_ENC)' \
|
||||
AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)' \
|
||||
BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)' \
|
||||
RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)' \
|
||||
SHA1_ASM_OBJ='$(SHA1_ASM_OBJ)' \
|
||||
MD5_ASM_OBJ='$(MD5_ASM_OBJ)' \
|
||||
RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)' \
|
||||
WP_ASM_OBJ='$(WP_ASM_OBJ)' \
|
||||
MODES_ASM_OBJ='$(MODES_ASM_OBJ)' \
|
||||
ENGINES_ASM_OBJ='$(ENGINES_ASM_OBJ)' \
|
||||
PERLASM_SCHEME='$(PERLASM_SCHEME)' \
|
||||
FIPSLIBDIR='${FIPSLIBDIR}' \
|
||||
FIPSDIR='${FIPSDIR}' \
|
||||
FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}" \
|
||||
FIPSCANISTERINTERNAL='${FIPSCANISTERINTERNAL}' \
|
||||
FIPS_EX_OBJ='${FIPS_EX_OBJ}' \
|
||||
THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
|
||||
# MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
|
||||
# which in turn eliminates ambiguities in variable treatment with -e.
|
||||
@ -245,127 +256,55 @@ BUILDENV= PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \
|
||||
# subdirectories defined in $(DIRS). It requires that the target
|
||||
# is given through the shell variable `target'.
|
||||
BUILD_CMD= if [ -d "$$dir" ]; then \
|
||||
( [ $$target != all -a -z "$(FIPSCANLIB)" ] && FIPSCANLIB=/dev/null; \
|
||||
cd $$dir && echo "making $$target in $$dir..." && \
|
||||
( cd $$dir && echo "making $$target in $$dir..." && \
|
||||
$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \
|
||||
) || exit 1; \
|
||||
fi
|
||||
RECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done
|
||||
BUILD_ONE_CMD=\
|
||||
if echo " $(DIRS) " | grep " $$dir " >/dev/null 2>/dev/null; then \
|
||||
if expr " $(DIRS) " : ".* $$dir " >/dev/null 2>&1; then \
|
||||
$(BUILD_CMD); \
|
||||
fi
|
||||
|
||||
reflect:
|
||||
@[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
|
||||
|
||||
FIPS_EX_OBJ= ../crypto/aes/aes_cfb.o \
|
||||
../crypto/aes/aes_ecb.o \
|
||||
../crypto/aes/aes_ofb.o \
|
||||
../crypto/bn/bn_add.o \
|
||||
../crypto/bn/bn_blind.o \
|
||||
../crypto/bn/bn_ctx.o \
|
||||
../crypto/bn/bn_div.o \
|
||||
../crypto/bn/bn_exp2.o \
|
||||
../crypto/bn/bn_exp.o \
|
||||
../crypto/bn/bn_gcd.o \
|
||||
../crypto/bn/bn_lib.o \
|
||||
../crypto/bn/bn_mod.o \
|
||||
../crypto/bn/bn_mont.o \
|
||||
../crypto/bn/bn_mul.o \
|
||||
../crypto/bn/bn_prime.o \
|
||||
../crypto/bn/bn_rand.o \
|
||||
../crypto/bn/bn_recp.o \
|
||||
../crypto/bn/bn_shift.o \
|
||||
../crypto/bn/bn_sqr.o \
|
||||
../crypto/bn/bn_word.o \
|
||||
../crypto/bn/bn_x931p.o \
|
||||
../crypto/buffer/buf_str.o \
|
||||
../crypto/cryptlib.o \
|
||||
../crypto/des/cfb64ede.o \
|
||||
../crypto/des/cfb64enc.o \
|
||||
../crypto/des/cfb_enc.o \
|
||||
../crypto/des/ecb3_enc.o \
|
||||
../crypto/des/ecb_enc.o \
|
||||
../crypto/des/ofb64ede.o \
|
||||
../crypto/des/ofb64enc.o \
|
||||
../crypto/des/fcrypt.o \
|
||||
../crypto/des/set_key.o \
|
||||
../crypto/dsa/dsa_utl.o \
|
||||
../crypto/dsa/dsa_sign.o \
|
||||
../crypto/dsa/dsa_vrf.o \
|
||||
../crypto/err/err.o \
|
||||
../crypto/evp/digest.o \
|
||||
../crypto/evp/enc_min.o \
|
||||
../crypto/evp/e_aes.o \
|
||||
../crypto/evp/e_des3.o \
|
||||
../crypto/evp/p_sign.o \
|
||||
../crypto/evp/p_verify.o \
|
||||
../crypto/mem_clr.o \
|
||||
../crypto/mem.o \
|
||||
../crypto/rand/md_rand.o \
|
||||
../crypto/rand/rand_egd.o \
|
||||
../crypto/rand/randfile.o \
|
||||
../crypto/rand/rand_lib.o \
|
||||
../crypto/rand/rand_os2.o \
|
||||
../crypto/rand/rand_unix.o \
|
||||
../crypto/rand/rand_win.o \
|
||||
../crypto/rsa/rsa_lib.o \
|
||||
../crypto/rsa/rsa_none.o \
|
||||
../crypto/rsa/rsa_oaep.o \
|
||||
../crypto/rsa/rsa_pk1.o \
|
||||
../crypto/rsa/rsa_pss.o \
|
||||
../crypto/rsa/rsa_ssl.o \
|
||||
../crypto/rsa/rsa_x931.o \
|
||||
../crypto/sha/sha1dgst.o \
|
||||
../crypto/sha/sha256.o \
|
||||
../crypto/sha/sha512.o \
|
||||
../crypto/uid.o
|
||||
|
||||
sub_all: build_all
|
||||
build_all: build_libs build_apps build_tests build_tools
|
||||
|
||||
build_libs: build_crypto build_fips build_ssl build_shared build_engines
|
||||
build_libs: build_crypto build_ssl build_engines
|
||||
|
||||
build_crypto:
|
||||
if [ -n "$(FIPSCANLIB)" ]; then \
|
||||
EXCL_OBJ='$(AES_ASM_OBJ) $(BN_ASM) $(DES_ENC) $(CPUID_OBJ) $(SHA1_ASM_OBJ) $(FIPS_EX_OBJ)' ; export EXCL_OBJ ; \
|
||||
ARX='$(PERL) $${TOP}/util/arx.pl $(AR)' ; \
|
||||
else \
|
||||
ARX='${AR}' ; \
|
||||
fi ; export ARX ; \
|
||||
dir=crypto; target=all; $(BUILD_ONE_CMD)
|
||||
build_fips:
|
||||
@dir=fips; target=all; [ -z "$(FIPSCANLIB)" ] || $(BUILD_ONE_CMD)
|
||||
build_ssl: build_crypto
|
||||
@dir=crypto; target=all; $(BUILD_ONE_CMD)
|
||||
build_ssl:
|
||||
@dir=ssl; target=all; $(BUILD_ONE_CMD)
|
||||
build_engines: build_crypto
|
||||
build_engines:
|
||||
@dir=engines; target=all; $(BUILD_ONE_CMD)
|
||||
build_apps: build_libs
|
||||
build_apps:
|
||||
@dir=apps; target=all; $(BUILD_ONE_CMD)
|
||||
build_tests: build_libs
|
||||
build_tests:
|
||||
@dir=test; target=all; $(BUILD_ONE_CMD)
|
||||
build_tools: build_libs
|
||||
build_tools:
|
||||
@dir=tools; target=all; $(BUILD_ONE_CMD)
|
||||
|
||||
all_testapps: build_libs build_testapps
|
||||
build_testapps:
|
||||
@dir=crypto; target=testapps; $(BUILD_ONE_CMD)
|
||||
|
||||
build_shared: $(SHARED_LIBS)
|
||||
libcrypto$(SHLIB_EXT): libcrypto.a $(SHARED_FIPS)
|
||||
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 [ "$(FIPSCANLIB)" = "libfips" ]; then \
|
||||
$(ARD) libcrypto.a fipscanister.o ; \
|
||||
$(MAKE) SHLIBDIRS='crypto' SHLIBDEPS='-lfips' build-shared; \
|
||||
$(AR) libcrypto.a fips/fipscanister.o ; \
|
||||
else \
|
||||
if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
|
||||
FIPSLD_CC="$(CC)"; CC=fips/fipsld; \
|
||||
export CC FIPSLD_CC; \
|
||||
fi; \
|
||||
$(MAKE) -e SHLIBDIRS='crypto' build-shared; \
|
||||
fi \
|
||||
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 build-shared; \
|
||||
else \
|
||||
echo "There's no support for shared libraries on this platform" >&2; \
|
||||
exit 1; \
|
||||
@ -373,32 +312,12 @@ libcrypto$(SHLIB_EXT): libcrypto.a $(SHARED_FIPS)
|
||||
|
||||
libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
|
||||
@if [ "$(SHLIB_TARGET)" != "" ]; then \
|
||||
shlibdeps=-lcrypto; \
|
||||
[ "$(FIPSCANLIB)" = "libfips" ] && shlibdeps="$$shlibdeps -lfips"; \
|
||||
$(MAKE) SHLIBDIRS=ssl SHLIBDEPS="$$shlibdeps" build-shared; \
|
||||
else \
|
||||
echo "There's no support for shared libraries on this platform" >&2 ; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
fips/fipscanister.o: build_fips
|
||||
libfips$(SHLIB_EXT): fips/fipscanister.o
|
||||
@if [ "$(SHLIB_TARGET)" != "" ]; then \
|
||||
FIPSLD_CC="$(CC)"; CC=fips/fipsld; export CC FIPSLD_CC; \
|
||||
$(MAKE) -f Makefile.shared -e $(BUILDENV) \
|
||||
CC=$${CC} LIBNAME=fips THIS=$@ \
|
||||
LIBEXTRAS=fips/fipscanister.o \
|
||||
LIBDEPS="$(EX_LIBS)" \
|
||||
LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||
link_o.$(SHLIB_TARGET) || { rm -f $@; exit 1; } \
|
||||
$(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
|
||||
else \
|
||||
echo "There's no support for shared libraries on this platform" >&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
libfips.a:
|
||||
dir=fips; target=all; $(BUILD_ONE_CMD)
|
||||
|
||||
clean-shared:
|
||||
@set -e; for i in $(SHLIBDIRS); do \
|
||||
if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
|
||||
@ -414,10 +333,10 @@ clean-shared:
|
||||
done
|
||||
|
||||
link-shared:
|
||||
@ set -e; for i in ${SHLIBDIRS}; do \
|
||||
@ set -e; for i in $(SHLIBDIRS); do \
|
||||
$(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
|
||||
LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||
LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
|
||||
LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
|
||||
LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
|
||||
symlink.$(SHLIB_TARGET); \
|
||||
libs="$$libs -l$$i"; \
|
||||
done
|
||||
@ -425,13 +344,13 @@ link-shared:
|
||||
build-shared: do_$(SHLIB_TARGET) link-shared
|
||||
|
||||
do_$(SHLIB_TARGET):
|
||||
@ set -e; libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
||||
if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \
|
||||
@ set -e; libs='-L. $(SHLIBDEPS)'; for i in $(SHLIBDIRS); do \
|
||||
if [ "$$i" = "ssl" -a -n "$(LIBKRB5)" ]; then \
|
||||
libs="$(LIBKRB5) $$libs"; \
|
||||
fi; \
|
||||
$(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
|
||||
LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||
LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
|
||||
LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
|
||||
LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
|
||||
LIBDEPS="$$libs $(EX_LIBS)" \
|
||||
link_a.$(SHLIB_TARGET); \
|
||||
libs="-l$$i $$libs"; \
|
||||
@ -447,7 +366,8 @@ libcrypto.pc: Makefile
|
||||
echo 'Description: OpenSSL cryptography library'; \
|
||||
echo 'Version: '$(VERSION); \
|
||||
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
|
||||
|
||||
libssl.pc: Makefile
|
||||
@ -460,7 +380,8 @@ libssl.pc: Makefile
|
||||
echo 'Description: Secure Sockets Layer and cryptography libraries'; \
|
||||
echo 'Version: '$(VERSION); \
|
||||
echo 'Requires: '; \
|
||||
echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
|
||||
echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
|
||||
echo 'Libs.private: $(EX_LIBS)'; \
|
||||
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc
|
||||
|
||||
openssl.pc: Makefile
|
||||
@ -473,7 +394,8 @@ openssl.pc: Makefile
|
||||
echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
|
||||
echo 'Version: '$(VERSION); \
|
||||
echo 'Requires: '; \
|
||||
echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
|
||||
echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
|
||||
echo 'Libs.private: $(EX_LIBS)'; \
|
||||
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
|
||||
|
||||
Makefile: Makefile.org Configure config
|
||||
@ -482,7 +404,7 @@ Makefile: Makefile.org Configure config
|
||||
@false
|
||||
|
||||
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
|
||||
rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
|
||||
@ -508,34 +430,32 @@ links:
|
||||
@$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
|
||||
@$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
|
||||
@set -e; target=links; $(RECURSIVE_BUILD_CMD)
|
||||
@if [ -z "$(FIPSCANLIB)" ]; then \
|
||||
set -e; target=links; dir=fips ; $(BUILD_CMD) ; \
|
||||
fi
|
||||
|
||||
gentests:
|
||||
@(cd test && echo "generating dummy tests (if needed)..." && \
|
||||
$(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on generate );
|
||||
$(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on generate );
|
||||
|
||||
dclean:
|
||||
rm -f *.bak
|
||||
rm -rf *.bak include/openssl certs/.0
|
||||
@set -e; target=dclean; $(RECURSIVE_BUILD_CMD)
|
||||
|
||||
rehash: rehash.time
|
||||
rehash.time: certs apps
|
||||
@if [ -z "$(CROSS_COMPILE)" ]; then \
|
||||
(OPENSSL="`pwd`/util/opensslwrap.sh"; \
|
||||
[ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \
|
||||
OPENSSL_DEBUG_MEMORY=on; \
|
||||
export OPENSSL OPENSSL_DEBUG_MEMORY; \
|
||||
$(PERL) tools/c_rehash certs) && \
|
||||
touch rehash.time; \
|
||||
fi
|
||||
else :; fi
|
||||
|
||||
test: tests
|
||||
|
||||
tests: rehash
|
||||
@(cd test && echo "testing..." && \
|
||||
$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests );
|
||||
util/opensslwrap.sh version -a
|
||||
$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on OPENSSL_CONF=../apps/openssl.cnf tests );
|
||||
OPENSSL_CONF=apps/openssl.cnf util/opensslwrap.sh version -a
|
||||
|
||||
report:
|
||||
@$(PERL) util/selftest.pl
|
||||
@ -551,9 +471,9 @@ tags:
|
||||
find . -name '[^.]*.[ch]' | xargs etags -a
|
||||
|
||||
errors:
|
||||
$(PERL) util/ck_errf.pl -strict */*.c */*/*.c
|
||||
$(PERL) util/mkerr.pl -recurse -write
|
||||
(cd engines; $(MAKE) PERL=$(PERL) errors)
|
||||
$(PERL) util/ck_errf.pl */*.c */*/*.c
|
||||
|
||||
stacks:
|
||||
$(PERL) util/mkstack.pl -write
|
||||
@ -568,6 +488,8 @@ 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
|
||||
@ -580,7 +502,7 @@ TABLE: Configure
|
||||
(echo 'Output of `Configure TABLE'"':"; \
|
||||
$(PERL) Configure TABLE) > TABLE
|
||||
|
||||
update: errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h apps/openssl-vms.cnf crypto/bn/bn_prime.h TABLE depend
|
||||
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
|
||||
# pretty long, on several platforms a "too many arguments" error or similar
|
||||
@ -611,8 +533,8 @@ tar-snap:
|
||||
dist:
|
||||
$(PERL) Configure dist
|
||||
@$(MAKE) dist_pem_h
|
||||
@$(MAKE) SDIRS='${SDIRS}' clean
|
||||
@$(MAKE) TAR='${TAR}' TARFLAGS='${TARFLAGS}' tar
|
||||
@$(MAKE) SDIRS='$(SDIRS)' clean
|
||||
@$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' tar
|
||||
|
||||
dist_pem_h:
|
||||
(cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean)
|
||||
@ -634,7 +556,7 @@ install_sw:
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
@set -e; target=install; $(RECURSIVE_BUILD_CMD)
|
||||
@set -e; for i in $(LIBS) ;\
|
||||
@set -e; liblist="$(LIBS)"; for i in $$liblist ;\
|
||||
do \
|
||||
if [ -f "$$i" ]; then \
|
||||
( echo installing $$i; \
|
||||
@ -663,6 +585,16 @@ install_sw:
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
|
||||
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
|
||||
fi ); \
|
||||
if expr $(PLATFORM) : 'mingw' > /dev/null; then \
|
||||
( case $$i in \
|
||||
*crypto*) i=libeay32.dll;; \
|
||||
*ssl*) i=ssleay32.dll;; \
|
||||
esac; \
|
||||
echo installing $$i; \
|
||||
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
|
||||
chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
|
||||
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
|
||||
fi; \
|
||||
fi; \
|
||||
done; \
|
||||
( here="`pwd`"; \
|
||||
@ -682,6 +614,27 @@ install_sw:
|
||||
cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
|
||||
|
||||
install_html_docs:
|
||||
here="`pwd`"; \
|
||||
for subdir in apps crypto ssl; do \
|
||||
mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
|
||||
for i in doc/$$subdir/*.pod; do \
|
||||
fn=`basename $$i .pod`; \
|
||||
echo "installing html/$$fn.$(HTMLSUFFIX)"; \
|
||||
cat $$i \
|
||||
| sed -r 's/L<([^)]*)(\([0-9]\))?\|([^)]*)(\([0-9]\))?>/L<\1|\3>/g' \
|
||||
| pod2html --podroot=doc --htmlroot=.. --podpath=apps:crypto:ssl \
|
||||
| sed -r 's/<!DOCTYPE.*//g' \
|
||||
> $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
|
||||
$(PERL) util/extract-names.pl < $$i | \
|
||||
grep -v $$filecase "^$$fn\$$" | \
|
||||
(cd $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
|
||||
while read n; do \
|
||||
PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$(HTMLSUFFIX) "$$n".$(HTMLSUFFIX); \
|
||||
done); \
|
||||
done; \
|
||||
done
|
||||
|
||||
install_docs:
|
||||
@$(PERL) $(TOP)/util/mkdir-p.pl \
|
||||
$(INSTALL_PREFIX)$(MANDIR)/man1 \
|
||||
@ -708,7 +661,7 @@ install_docs:
|
||||
(grep -v "[ ]"; true) | \
|
||||
(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
|
||||
while read n; do \
|
||||
$$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
|
||||
PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
|
||||
done); \
|
||||
done; \
|
||||
set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
|
||||
@ -725,7 +678,7 @@ install_docs:
|
||||
(grep -v "[ ]"; true) | \
|
||||
(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
|
||||
while read n; do \
|
||||
$$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
|
||||
PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
|
||||
done); \
|
||||
done
|
||||
|
||||
|
@ -65,8 +65,8 @@ EX_LIBS=
|
||||
EXE_EXT=
|
||||
ARFLAGS=
|
||||
AR=ar $(ARFLAGS) r
|
||||
ARD=ar $(ARFLAGS) d
|
||||
RANLIB= ranlib
|
||||
NM= nm
|
||||
PERL= perl
|
||||
TAR= tar
|
||||
TARFLAGS= --no-recursion
|
||||
@ -89,7 +89,7 @@ PROCESSOR=
|
||||
CPUID_OBJ=
|
||||
BN_ASM= bn_asm.o
|
||||
DES_ENC= des_enc.o fcrypt_b.o
|
||||
AES_ASM_OBJ=aes_core.o aes_cbc.o
|
||||
AES_ENC= aes_core.o aes_cbc.o
|
||||
BF_ENC= bf_enc.o
|
||||
CAST_ENC= c_enc.o
|
||||
RC4_ENC= rc4_enc.o
|
||||
@ -97,6 +97,11 @@ RC5_ENC= rc5_enc.o
|
||||
MD5_ASM_OBJ=
|
||||
SHA1_ASM_OBJ=
|
||||
RMD160_ASM_OBJ=
|
||||
WP_ASM_OBJ=
|
||||
CMLL_ENC=
|
||||
MODES_ASM_OBJ=
|
||||
ENGINES_ASM_OBJ=
|
||||
PERLASM_SCHEME=
|
||||
|
||||
# KRB5 stuff
|
||||
KRB5_INCLUDES=
|
||||
@ -106,19 +111,17 @@ LIBKRB5=
|
||||
ZLIB_INCLUDE=
|
||||
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 make be different so hard
|
||||
# $(INSTALLTOP) for this build may be different so hard
|
||||
# code the path.
|
||||
|
||||
FIPSLIBDIR=/usr/local/ssl/$(LIBDIR)/
|
||||
|
||||
# This is set to "y" if fipscanister.o is compiled internally as
|
||||
# opposed to coming from an external validated location.
|
||||
|
||||
FIPSCANISTERINTERNAL=n
|
||||
FIPSLIBDIR=
|
||||
|
||||
# The location of the library which contains fipscanister.o
|
||||
# normally it will be libcrypto unless fipsdso is set in which
|
||||
@ -132,18 +135,19 @@ FIPSCANLIB=
|
||||
|
||||
BASEADDR=
|
||||
|
||||
DIRS= crypto fips ssl engines apps test tools
|
||||
SHLIBDIRS= crypto ssl fips
|
||||
DIRS= crypto ssl engines apps test tools
|
||||
ENGDIRS= ccgost
|
||||
SHLIBDIRS= crypto ssl
|
||||
|
||||
# dirs in crypto to build
|
||||
SDIRS= \
|
||||
objects \
|
||||
md2 md4 md5 sha mdc2 hmac ripemd \
|
||||
des aes rc2 rc4 rc5 idea bf cast camellia seed \
|
||||
md2 md4 md5 sha mdc2 hmac ripemd whrlpool \
|
||||
des aes rc2 rc4 rc5 idea bf cast camellia seed modes \
|
||||
bn ec rsa dsa ecdsa dh ecdh dso engine \
|
||||
buffer bio stack lhash rand err \
|
||||
evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
|
||||
store cms pqueue jpake
|
||||
cms pqueue ts jpake srp store cmac
|
||||
# keep in mind that the above list is adjusted by ./Configure
|
||||
# according to no-xxx arguments...
|
||||
|
||||
@ -157,6 +161,8 @@ MANDIR=$(OPENSSLDIR)/man
|
||||
MAN1=1
|
||||
MAN3=3
|
||||
MANSUFFIX=
|
||||
HTMLSUFFIX=html
|
||||
HTMLDIR=$(OPENSSLDIR)/html
|
||||
SHELL=/bin/sh
|
||||
|
||||
TOP= .
|
||||
@ -166,7 +172,6 @@ WDIRS= windows
|
||||
LIBS= libcrypto.a libssl.a
|
||||
SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
|
||||
SHARED_SSL=libssl$(SHLIB_EXT)
|
||||
SHARED_FIPS=
|
||||
SHARED_LIBS=
|
||||
SHARED_LIBS_LINK_EXTS=
|
||||
SHARED_LDFLAGS=
|
||||
@ -193,38 +198,44 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS} \
|
||||
$${EXHEADER+EXHEADER} $${HEADER+HEADER} \
|
||||
$${GENERAL+GENERAL} $${CFLAGS+CFLAGS} \
|
||||
$${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \
|
||||
$${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} \
|
||||
$${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \
|
||||
$${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \
|
||||
$${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
|
||||
|
||||
BUILDENV= PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \
|
||||
CC='${CC}' CFLAG='${CFLAG}' \
|
||||
AS='${CC}' ASFLAG='${CFLAG} -c' \
|
||||
AR='${AR}' PERL='${PERL}' RANLIB='${RANLIB}' \
|
||||
SDIRS='${SDIRS}' LIBRPATH='${INSTALLTOP}/$(LIBDIR)' \
|
||||
INSTALL_PREFIX='${INSTALL_PREFIX}' \
|
||||
INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' \
|
||||
LIBDIR='${LIBDIR}' \
|
||||
MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD ${MAKEDEPPROG}' \
|
||||
DEPFLAG='-DOPENSSL_NO_DEPRECATED ${DEPFLAG}' \
|
||||
MAKEDEPPROG='${MAKEDEPPROG}' \
|
||||
SHARED_LDFLAGS='${SHARED_LDFLAGS}' \
|
||||
KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' \
|
||||
EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' \
|
||||
SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' \
|
||||
PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' \
|
||||
CPUID_OBJ='${CPUID_OBJ}' \
|
||||
BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' \
|
||||
AES_ASM_OBJ='${AES_ASM_OBJ}' \
|
||||
BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' \
|
||||
RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' \
|
||||
SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' \
|
||||
MD5_ASM_OBJ='${MD5_ASM_OBJ}' \
|
||||
RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' \
|
||||
BUILDENV= PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
|
||||
CC='$(CC)' CFLAG='$(CFLAG)' \
|
||||
AS='$(CC)' ASFLAG='$(CFLAG) -c' \
|
||||
AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)' \
|
||||
CROSS_COMPILE='$(CROSS_COMPILE)' \
|
||||
PERL='$(PERL)' ENGDIRS='$(ENGDIRS)' \
|
||||
SDIRS='$(SDIRS)' LIBRPATH='$(INSTALLTOP)/$(LIBDIR)' \
|
||||
INSTALL_PREFIX='$(INSTALL_PREFIX)' \
|
||||
INSTALLTOP='$(INSTALLTOP)' OPENSSLDIR='$(OPENSSLDIR)' \
|
||||
LIBDIR='$(LIBDIR)' \
|
||||
MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD $(MAKEDEPPROG)' \
|
||||
DEPFLAG='-DOPENSSL_NO_DEPRECATED $(DEPFLAG)' \
|
||||
MAKEDEPPROG='$(MAKEDEPPROG)' \
|
||||
SHARED_LDFLAGS='$(SHARED_LDFLAGS)' \
|
||||
KRB5_INCLUDES='$(KRB5_INCLUDES)' LIBKRB5='$(LIBKRB5)' \
|
||||
ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)' \
|
||||
EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)' \
|
||||
SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)' \
|
||||
PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)' \
|
||||
CPUID_OBJ='$(CPUID_OBJ)' \
|
||||
BN_ASM='$(BN_ASM)' DES_ENC='$(DES_ENC)' \
|
||||
AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)' \
|
||||
BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)' \
|
||||
RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)' \
|
||||
SHA1_ASM_OBJ='$(SHA1_ASM_OBJ)' \
|
||||
MD5_ASM_OBJ='$(MD5_ASM_OBJ)' \
|
||||
RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)' \
|
||||
WP_ASM_OBJ='$(WP_ASM_OBJ)' \
|
||||
MODES_ASM_OBJ='$(MODES_ASM_OBJ)' \
|
||||
ENGINES_ASM_OBJ='$(ENGINES_ASM_OBJ)' \
|
||||
PERLASM_SCHEME='$(PERLASM_SCHEME)' \
|
||||
FIPSLIBDIR='${FIPSLIBDIR}' \
|
||||
FIPSDIR='${FIPSDIR}' \
|
||||
FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}" \
|
||||
FIPSCANISTERINTERNAL='${FIPSCANISTERINTERNAL}' \
|
||||
FIPS_EX_OBJ='${FIPS_EX_OBJ}' \
|
||||
THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
|
||||
# MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
|
||||
# which in turn eliminates ambiguities in variable treatment with -e.
|
||||
@ -243,127 +254,55 @@ BUILDENV= PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \
|
||||
# subdirectories defined in $(DIRS). It requires that the target
|
||||
# is given through the shell variable `target'.
|
||||
BUILD_CMD= if [ -d "$$dir" ]; then \
|
||||
( [ $$target != all -a -z "$(FIPSCANLIB)" ] && FIPSCANLIB=/dev/null; \
|
||||
cd $$dir && echo "making $$target in $$dir..." && \
|
||||
( cd $$dir && echo "making $$target in $$dir..." && \
|
||||
$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \
|
||||
) || exit 1; \
|
||||
fi
|
||||
RECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done
|
||||
BUILD_ONE_CMD=\
|
||||
if echo " $(DIRS) " | grep " $$dir " >/dev/null 2>/dev/null; then \
|
||||
if expr " $(DIRS) " : ".* $$dir " >/dev/null 2>&1; then \
|
||||
$(BUILD_CMD); \
|
||||
fi
|
||||
|
||||
reflect:
|
||||
@[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
|
||||
|
||||
FIPS_EX_OBJ= ../crypto/aes/aes_cfb.o \
|
||||
../crypto/aes/aes_ecb.o \
|
||||
../crypto/aes/aes_ofb.o \
|
||||
../crypto/bn/bn_add.o \
|
||||
../crypto/bn/bn_blind.o \
|
||||
../crypto/bn/bn_ctx.o \
|
||||
../crypto/bn/bn_div.o \
|
||||
../crypto/bn/bn_exp2.o \
|
||||
../crypto/bn/bn_exp.o \
|
||||
../crypto/bn/bn_gcd.o \
|
||||
../crypto/bn/bn_lib.o \
|
||||
../crypto/bn/bn_mod.o \
|
||||
../crypto/bn/bn_mont.o \
|
||||
../crypto/bn/bn_mul.o \
|
||||
../crypto/bn/bn_prime.o \
|
||||
../crypto/bn/bn_rand.o \
|
||||
../crypto/bn/bn_recp.o \
|
||||
../crypto/bn/bn_shift.o \
|
||||
../crypto/bn/bn_sqr.o \
|
||||
../crypto/bn/bn_word.o \
|
||||
../crypto/bn/bn_x931p.o \
|
||||
../crypto/buffer/buf_str.o \
|
||||
../crypto/cryptlib.o \
|
||||
../crypto/des/cfb64ede.o \
|
||||
../crypto/des/cfb64enc.o \
|
||||
../crypto/des/cfb_enc.o \
|
||||
../crypto/des/ecb3_enc.o \
|
||||
../crypto/des/ecb_enc.o \
|
||||
../crypto/des/ofb64ede.o \
|
||||
../crypto/des/ofb64enc.o \
|
||||
../crypto/des/fcrypt.o \
|
||||
../crypto/des/set_key.o \
|
||||
../crypto/dsa/dsa_utl.o \
|
||||
../crypto/dsa/dsa_sign.o \
|
||||
../crypto/dsa/dsa_vrf.o \
|
||||
../crypto/err/err.o \
|
||||
../crypto/evp/digest.o \
|
||||
../crypto/evp/enc_min.o \
|
||||
../crypto/evp/e_aes.o \
|
||||
../crypto/evp/e_des3.o \
|
||||
../crypto/evp/p_sign.o \
|
||||
../crypto/evp/p_verify.o \
|
||||
../crypto/mem_clr.o \
|
||||
../crypto/mem.o \
|
||||
../crypto/rand/md_rand.o \
|
||||
../crypto/rand/rand_egd.o \
|
||||
../crypto/rand/randfile.o \
|
||||
../crypto/rand/rand_lib.o \
|
||||
../crypto/rand/rand_os2.o \
|
||||
../crypto/rand/rand_unix.o \
|
||||
../crypto/rand/rand_win.o \
|
||||
../crypto/rsa/rsa_lib.o \
|
||||
../crypto/rsa/rsa_none.o \
|
||||
../crypto/rsa/rsa_oaep.o \
|
||||
../crypto/rsa/rsa_pk1.o \
|
||||
../crypto/rsa/rsa_pss.o \
|
||||
../crypto/rsa/rsa_ssl.o \
|
||||
../crypto/rsa/rsa_x931.o \
|
||||
../crypto/sha/sha1dgst.o \
|
||||
../crypto/sha/sha256.o \
|
||||
../crypto/sha/sha512.o \
|
||||
../crypto/uid.o
|
||||
|
||||
sub_all: build_all
|
||||
build_all: build_libs build_apps build_tests build_tools
|
||||
|
||||
build_libs: build_crypto build_fips build_ssl build_shared build_engines
|
||||
build_libs: build_crypto build_ssl build_engines
|
||||
|
||||
build_crypto:
|
||||
if [ -n "$(FIPSCANLIB)" ]; then \
|
||||
EXCL_OBJ='$(AES_ASM_OBJ) $(BN_ASM) $(DES_ENC) $(CPUID_OBJ) $(SHA1_ASM_OBJ) $(FIPS_EX_OBJ)' ; export EXCL_OBJ ; \
|
||||
ARX='$(PERL) $${TOP}/util/arx.pl $(AR)' ; \
|
||||
else \
|
||||
ARX='${AR}' ; \
|
||||
fi ; export ARX ; \
|
||||
dir=crypto; target=all; $(BUILD_ONE_CMD)
|
||||
build_fips:
|
||||
@dir=fips; target=all; [ -z "$(FIPSCANLIB)" ] || $(BUILD_ONE_CMD)
|
||||
build_ssl: build_crypto
|
||||
@dir=crypto; target=all; $(BUILD_ONE_CMD)
|
||||
build_ssl:
|
||||
@dir=ssl; target=all; $(BUILD_ONE_CMD)
|
||||
build_engines: build_crypto
|
||||
build_engines:
|
||||
@dir=engines; target=all; $(BUILD_ONE_CMD)
|
||||
build_apps: build_libs
|
||||
build_apps:
|
||||
@dir=apps; target=all; $(BUILD_ONE_CMD)
|
||||
build_tests: build_libs
|
||||
build_tests:
|
||||
@dir=test; target=all; $(BUILD_ONE_CMD)
|
||||
build_tools: build_libs
|
||||
build_tools:
|
||||
@dir=tools; target=all; $(BUILD_ONE_CMD)
|
||||
|
||||
all_testapps: build_libs build_testapps
|
||||
build_testapps:
|
||||
@dir=crypto; target=testapps; $(BUILD_ONE_CMD)
|
||||
|
||||
build_shared: $(SHARED_LIBS)
|
||||
libcrypto$(SHLIB_EXT): libcrypto.a $(SHARED_FIPS)
|
||||
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 [ "$(FIPSCANLIB)" = "libfips" ]; then \
|
||||
$(ARD) libcrypto.a fipscanister.o ; \
|
||||
$(MAKE) SHLIBDIRS='crypto' SHLIBDEPS='-lfips' build-shared; \
|
||||
$(AR) libcrypto.a fips/fipscanister.o ; \
|
||||
else \
|
||||
if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
|
||||
FIPSLD_CC="$(CC)"; CC=fips/fipsld; \
|
||||
export CC FIPSLD_CC; \
|
||||
fi; \
|
||||
$(MAKE) -e SHLIBDIRS='crypto' build-shared; \
|
||||
fi \
|
||||
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 build-shared; \
|
||||
else \
|
||||
echo "There's no support for shared libraries on this platform" >&2; \
|
||||
exit 1; \
|
||||
@ -371,32 +310,12 @@ libcrypto$(SHLIB_EXT): libcrypto.a $(SHARED_FIPS)
|
||||
|
||||
libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
|
||||
@if [ "$(SHLIB_TARGET)" != "" ]; then \
|
||||
shlibdeps=-lcrypto; \
|
||||
[ "$(FIPSCANLIB)" = "libfips" ] && shlibdeps="$$shlibdeps -lfips"; \
|
||||
$(MAKE) SHLIBDIRS=ssl SHLIBDEPS="$$shlibdeps" build-shared; \
|
||||
else \
|
||||
echo "There's no support for shared libraries on this platform" >&2 ; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
fips/fipscanister.o: build_fips
|
||||
libfips$(SHLIB_EXT): fips/fipscanister.o
|
||||
@if [ "$(SHLIB_TARGET)" != "" ]; then \
|
||||
FIPSLD_CC="$(CC)"; CC=fips/fipsld; export CC FIPSLD_CC; \
|
||||
$(MAKE) -f Makefile.shared -e $(BUILDENV) \
|
||||
CC=$${CC} LIBNAME=fips THIS=$@ \
|
||||
LIBEXTRAS=fips/fipscanister.o \
|
||||
LIBDEPS="$(EX_LIBS)" \
|
||||
LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||
link_o.$(SHLIB_TARGET) || { rm -f $@; exit 1; } \
|
||||
$(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
|
||||
else \
|
||||
echo "There's no support for shared libraries on this platform" >&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
libfips.a:
|
||||
dir=fips; target=all; $(BUILD_ONE_CMD)
|
||||
|
||||
clean-shared:
|
||||
@set -e; for i in $(SHLIBDIRS); do \
|
||||
if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
|
||||
@ -412,10 +331,10 @@ clean-shared:
|
||||
done
|
||||
|
||||
link-shared:
|
||||
@ set -e; for i in ${SHLIBDIRS}; do \
|
||||
@ set -e; for i in $(SHLIBDIRS); do \
|
||||
$(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
|
||||
LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||
LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
|
||||
LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
|
||||
LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
|
||||
symlink.$(SHLIB_TARGET); \
|
||||
libs="$$libs -l$$i"; \
|
||||
done
|
||||
@ -423,13 +342,13 @@ link-shared:
|
||||
build-shared: do_$(SHLIB_TARGET) link-shared
|
||||
|
||||
do_$(SHLIB_TARGET):
|
||||
@ set -e; libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
||||
if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \
|
||||
@ set -e; libs='-L. $(SHLIBDEPS)'; for i in $(SHLIBDIRS); do \
|
||||
if [ "$$i" = "ssl" -a -n "$(LIBKRB5)" ]; then \
|
||||
libs="$(LIBKRB5) $$libs"; \
|
||||
fi; \
|
||||
$(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
|
||||
LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||
LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
|
||||
LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
|
||||
LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
|
||||
LIBDEPS="$$libs $(EX_LIBS)" \
|
||||
link_a.$(SHLIB_TARGET); \
|
||||
libs="-l$$i $$libs"; \
|
||||
@ -445,7 +364,8 @@ libcrypto.pc: Makefile
|
||||
echo 'Description: OpenSSL cryptography library'; \
|
||||
echo 'Version: '$(VERSION); \
|
||||
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
|
||||
|
||||
libssl.pc: Makefile
|
||||
@ -458,7 +378,8 @@ libssl.pc: Makefile
|
||||
echo 'Description: Secure Sockets Layer and cryptography libraries'; \
|
||||
echo 'Version: '$(VERSION); \
|
||||
echo 'Requires: '; \
|
||||
echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
|
||||
echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
|
||||
echo 'Libs.private: $(EX_LIBS)'; \
|
||||
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc
|
||||
|
||||
openssl.pc: Makefile
|
||||
@ -471,7 +392,8 @@ openssl.pc: Makefile
|
||||
echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
|
||||
echo 'Version: '$(VERSION); \
|
||||
echo 'Requires: '; \
|
||||
echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
|
||||
echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
|
||||
echo 'Libs.private: $(EX_LIBS)'; \
|
||||
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
|
||||
|
||||
Makefile: Makefile.org Configure config
|
||||
@ -480,7 +402,7 @@ Makefile: Makefile.org Configure config
|
||||
@false
|
||||
|
||||
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
|
||||
rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
|
||||
@ -506,34 +428,32 @@ links:
|
||||
@$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
|
||||
@$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
|
||||
@set -e; target=links; $(RECURSIVE_BUILD_CMD)
|
||||
@if [ -z "$(FIPSCANLIB)" ]; then \
|
||||
set -e; target=links; dir=fips ; $(BUILD_CMD) ; \
|
||||
fi
|
||||
|
||||
gentests:
|
||||
@(cd test && echo "generating dummy tests (if needed)..." && \
|
||||
$(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on generate );
|
||||
$(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on generate );
|
||||
|
||||
dclean:
|
||||
rm -f *.bak
|
||||
rm -rf *.bak include/openssl certs/.0
|
||||
@set -e; target=dclean; $(RECURSIVE_BUILD_CMD)
|
||||
|
||||
rehash: rehash.time
|
||||
rehash.time: certs apps
|
||||
@if [ -z "$(CROSS_COMPILE)" ]; then \
|
||||
(OPENSSL="`pwd`/util/opensslwrap.sh"; \
|
||||
[ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \
|
||||
OPENSSL_DEBUG_MEMORY=on; \
|
||||
export OPENSSL OPENSSL_DEBUG_MEMORY; \
|
||||
$(PERL) tools/c_rehash certs) && \
|
||||
touch rehash.time; \
|
||||
fi
|
||||
else :; fi
|
||||
|
||||
test: tests
|
||||
|
||||
tests: rehash
|
||||
@(cd test && echo "testing..." && \
|
||||
$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests );
|
||||
util/opensslwrap.sh version -a
|
||||
$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on OPENSSL_CONF=../apps/openssl.cnf tests );
|
||||
OPENSSL_CONF=apps/openssl.cnf util/opensslwrap.sh version -a
|
||||
|
||||
report:
|
||||
@$(PERL) util/selftest.pl
|
||||
@ -549,9 +469,9 @@ tags:
|
||||
find . -name '[^.]*.[ch]' | xargs etags -a
|
||||
|
||||
errors:
|
||||
$(PERL) util/ck_errf.pl -strict */*.c */*/*.c
|
||||
$(PERL) util/mkerr.pl -recurse -write
|
||||
(cd engines; $(MAKE) PERL=$(PERL) errors)
|
||||
$(PERL) util/ck_errf.pl */*.c */*/*.c
|
||||
|
||||
stacks:
|
||||
$(PERL) util/mkstack.pl -write
|
||||
@ -566,6 +486,8 @@ 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
|
||||
@ -578,7 +500,7 @@ TABLE: Configure
|
||||
(echo 'Output of `Configure TABLE'"':"; \
|
||||
$(PERL) Configure TABLE) > TABLE
|
||||
|
||||
update: errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h apps/openssl-vms.cnf crypto/bn/bn_prime.h TABLE depend
|
||||
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
|
||||
# pretty long, on several platforms a "too many arguments" error or similar
|
||||
@ -609,8 +531,8 @@ tar-snap:
|
||||
dist:
|
||||
$(PERL) Configure dist
|
||||
@$(MAKE) dist_pem_h
|
||||
@$(MAKE) SDIRS='${SDIRS}' clean
|
||||
@$(MAKE) TAR='${TAR}' TARFLAGS='${TARFLAGS}' tar
|
||||
@$(MAKE) SDIRS='$(SDIRS)' clean
|
||||
@$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' tar
|
||||
|
||||
dist_pem_h:
|
||||
(cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean)
|
||||
@ -632,7 +554,7 @@ install_sw:
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
@set -e; target=install; $(RECURSIVE_BUILD_CMD)
|
||||
@set -e; for i in $(LIBS) ;\
|
||||
@set -e; liblist="$(LIBS)"; for i in $$liblist ;\
|
||||
do \
|
||||
if [ -f "$$i" ]; then \
|
||||
( echo installing $$i; \
|
||||
@ -661,6 +583,16 @@ install_sw:
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
|
||||
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
|
||||
fi ); \
|
||||
if expr $(PLATFORM) : 'mingw' > /dev/null; then \
|
||||
( case $$i in \
|
||||
*crypto*) i=libeay32.dll;; \
|
||||
*ssl*) i=ssleay32.dll;; \
|
||||
esac; \
|
||||
echo installing $$i; \
|
||||
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
|
||||
chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
|
||||
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
|
||||
fi; \
|
||||
fi; \
|
||||
done; \
|
||||
( here="`pwd`"; \
|
||||
@ -680,6 +612,27 @@ install_sw:
|
||||
cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
|
||||
|
||||
install_html_docs:
|
||||
here="`pwd`"; \
|
||||
for subdir in apps crypto ssl; do \
|
||||
mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
|
||||
for i in doc/$$subdir/*.pod; do \
|
||||
fn=`basename $$i .pod`; \
|
||||
echo "installing html/$$fn.$(HTMLSUFFIX)"; \
|
||||
cat $$i \
|
||||
| sed -r 's/L<([^)]*)(\([0-9]\))?\|([^)]*)(\([0-9]\))?>/L<\1|\3>/g' \
|
||||
| pod2html --podroot=doc --htmlroot=.. --podpath=apps:crypto:ssl \
|
||||
| sed -r 's/<!DOCTYPE.*//g' \
|
||||
> $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
|
||||
$(PERL) util/extract-names.pl < $$i | \
|
||||
grep -v $$filecase "^$$fn\$$" | \
|
||||
(cd $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
|
||||
while read n; do \
|
||||
PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$(HTMLSUFFIX) "$$n".$(HTMLSUFFIX); \
|
||||
done); \
|
||||
done; \
|
||||
done
|
||||
|
||||
install_docs:
|
||||
@$(PERL) $(TOP)/util/mkdir-p.pl \
|
||||
$(INSTALL_PREFIX)$(MANDIR)/man1 \
|
||||
@ -706,7 +659,7 @@ install_docs:
|
||||
(grep -v "[ ]"; true) | \
|
||||
(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
|
||||
while read n; do \
|
||||
$$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
|
||||
PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
|
||||
done); \
|
||||
done; \
|
||||
set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
|
||||
@ -723,7 +676,7 @@ install_docs:
|
||||
(grep -v "[ ]"; true) | \
|
||||
(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
|
||||
while read n; do \
|
||||
$$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
|
||||
PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
|
||||
done); \
|
||||
done
|
||||
|
||||
|
@ -14,6 +14,8 @@ CFLAGS=$(CFLAG)
|
||||
LDFLAGS=
|
||||
SHARED_LDFLAGS=
|
||||
|
||||
NM=nm
|
||||
|
||||
# LIBNAME contains just the name of the library, without prefix ("lib"
|
||||
# on Unix, "cyg" for certain forms under Cygwin...) or suffix (.a, .so,
|
||||
# .dll, ...). This one MUST have a value when using this makefile to
|
||||
@ -91,7 +93,7 @@ LINK_APP= \
|
||||
( $(SET_X); \
|
||||
LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
|
||||
LDCMD="$${LDCMD:-$(CC)}"; LDFLAGS="$${LDFLAGS:-$(CFLAGS)}"; \
|
||||
LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \
|
||||
LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
|
||||
LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
|
||||
LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
|
||||
$${LDCMD} $${LDFLAGS} -o $${APPNAME:=$(APPNAME)} $(OBJECTS) $${LIBDEPS} )
|
||||
@ -101,7 +103,7 @@ LINK_SO= \
|
||||
LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
|
||||
SHAREDCMD="$${SHAREDCMD:-$(CC)}"; \
|
||||
SHAREDFLAGS="$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \
|
||||
LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \
|
||||
LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
|
||||
LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
|
||||
LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
|
||||
$${SHAREDCMD} $${SHAREDFLAGS} \
|
||||
@ -133,7 +135,7 @@ LINK_SO_A_VIA_O= \
|
||||
ALL=$$ALLSYMSFLAGS; ALLSYMSFLAGS=; NOALLSYMSFLAGS=; \
|
||||
( $(SET_X); \
|
||||
ld $(LDFLAGS) -r -o lib$(LIBNAME).o $$ALL lib$(LIBNAME).a $(LIBEXTRAS) ); \
|
||||
$(LINK_SO) && rm -f $(LIBNAME).o
|
||||
$(LINK_SO) && rm -f lib$(LIBNAME).o
|
||||
|
||||
LINK_SO_A_UNPACKED= \
|
||||
UNPACKDIR=link_tmp.$$$$; rm -rf $$UNPACKDIR; mkdir $$UNPACKDIR; \
|
||||
@ -142,7 +144,7 @@ LINK_SO_A_UNPACKED= \
|
||||
SHOBJECTS=$$UNPACKDIR/*.o; \
|
||||
$(LINK_SO) && rm -rf $$UNPACKDIR
|
||||
|
||||
DETECT_GNU_LD=(${CC} -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
|
||||
DETECT_GNU_LD=($(CC) -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
|
||||
|
||||
DO_GNU_SO=$(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).so; \
|
||||
@ -168,8 +170,19 @@ link_a.gnu:
|
||||
link_app.gnu:
|
||||
@ $(DO_GNU_APP); $(LINK_APP)
|
||||
|
||||
DO_BEOS_SO= SHLIB=lib$(LIBNAME).so; \
|
||||
SHLIB_SUFFIX=; \
|
||||
ALLSYMSFLAGS='-Wl,--whole-archive'; \
|
||||
NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
|
||||
SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SUFFIX"
|
||||
|
||||
link_o.beos:
|
||||
@ $(DO_BEOS_SO); $(LINK_SO_O)
|
||||
link_a.beos:
|
||||
@ $(DO_BEOS_SO); $(LINK_SO_A)
|
||||
|
||||
link_o.bsd:
|
||||
@if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
|
||||
@if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
|
||||
$(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).so; \
|
||||
SHLIB_SUFFIX=; \
|
||||
@ -179,7 +192,7 @@ link_o.bsd:
|
||||
SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
|
||||
fi; $(LINK_SO_O)
|
||||
link_a.bsd:
|
||||
@if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
|
||||
@if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
|
||||
$(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).so; \
|
||||
SHLIB_SUFFIX=; \
|
||||
@ -189,24 +202,34 @@ link_a.bsd:
|
||||
SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
|
||||
fi; $(LINK_SO_A)
|
||||
link_app.bsd:
|
||||
@if ${DETECT_GNU_LD}; then $(DO_GNU_APP); else \
|
||||
@if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
|
||||
LDFLAGS="$(CFLAGS) -Wl,-rpath,$(LIBPATH)"; \
|
||||
fi; $(LINK_APP)
|
||||
|
||||
# For Darwin AKA Mac OS/X (dyld)
|
||||
# link_o.darwin produces .so, because we let it use dso_dlfcn module,
|
||||
# which has .so extension hard-coded. One can argue that one should
|
||||
# develop special dso module for MacOS X. At least manual encourages
|
||||
# to use native NSModule(3) API and refers to dlfcn as termporary hack.
|
||||
# Originally link_o.darwin produced .so, because it was hard-coded
|
||||
# in dso_dlfcn module. At later point dso_dlfcn switched to .dylib
|
||||
# extension in order to allow for run-time linking with vendor-
|
||||
# supplied shared libraries such as libz, so that link_o.darwin had
|
||||
# to be harmonized with it. This caused minor controversy, because
|
||||
# it was believed that dlopen can't be used to dynamically load
|
||||
# .dylib-s, only so called bundle modules (ones linked with -bundle
|
||||
# flag). The belief seems to be originating from pre-10.4 release,
|
||||
# where dlfcn functionality was emulated by dlcompat add-on. In
|
||||
# 10.4 dlopen was rewritten as native part of dyld and is documented
|
||||
# to be capable of loading both dynamic libraries and bundles. In
|
||||
# order to provide compatibility with pre-10.4 dlopen, modules are
|
||||
# linked with -bundle flag, which makes .dylib extension misleading.
|
||||
# It works, because dlopen is [and always was] extension-agnostic.
|
||||
# Alternative to this heuristic approach is to develop specific
|
||||
# MacOS X dso module relying on whichever "native" dyld interface.
|
||||
link_o.darwin:
|
||||
@ $(CALC_VERSIONS); \
|
||||
SHLIB=`expr "$$THIS" : '.*/\([^/\.]*\)\.'`; \
|
||||
SHLIB=$${SHLIB:-lib$(LIBNAME)}; \
|
||||
SHLIB_SUFFIX=`expr "$$THIS" : '.*\(\.[^\.]*\)$$'`; \
|
||||
SHLIB_SUFFIX=$${SHLIB_SUFFIX:-.so}; \
|
||||
SHLIB=lib$(LIBNAME); \
|
||||
SHLIB_SUFFIX=.dylib; \
|
||||
ALLSYMSFLAGS='-all_load'; \
|
||||
NOALLSYMSFLAGS=''; \
|
||||
SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS)"; \
|
||||
SHAREDFLAGS="$(CFLAGS) `echo $(SHARED_LDFLAGS) | sed s/dynamiclib/bundle/`"; \
|
||||
if [ -n "$(LIBVERSION)" ]; then \
|
||||
SHAREDFLAGS="$$SHAREDFLAGS -current_version $(LIBVERSION)"; \
|
||||
fi; \
|
||||
@ -227,7 +250,7 @@ link_a.darwin:
|
||||
if [ -n "$$SHLIB_SOVER_NODOT" ]; then \
|
||||
SHAREDFLAGS="$$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
|
||||
fi; \
|
||||
SHAREDFLAGS="$$SHAREDFLAGS -install_name ${INSTALLTOP}/lib/$$SHLIB${SHLIB_EXT}"; \
|
||||
SHAREDFLAGS="$$SHAREDFLAGS -install_name $(INSTALLTOP)/$(LIBDIR)/$$SHLIB$(SHLIB_EXT)"; \
|
||||
$(LINK_SO_A)
|
||||
link_app.darwin: # is there run-path on darwin?
|
||||
$(LINK_APP)
|
||||
@ -237,40 +260,59 @@ link_o.cygwin:
|
||||
INHIBIT_SYMLINKS=yes; \
|
||||
SHLIB=cyg$(LIBNAME); \
|
||||
base=-Wl,--enable-auto-image-base; \
|
||||
deffile=; \
|
||||
if expr $(PLATFORM) : 'mingw' > /dev/null; then \
|
||||
SHLIB=$(LIBNAME)eay32; base=; \
|
||||
if test -f $(LIBNAME)eay32.def; then \
|
||||
deffile=$(LIBNAME)eay32.def; \
|
||||
fi; \
|
||||
fi; \
|
||||
SHLIB_SUFFIX=.dll; \
|
||||
LIBVERSION="$(LIBVERSION)"; \
|
||||
SHLIB_SOVER=${LIBVERSION:+"-$(LIBVERSION)"}; \
|
||||
ALLSYMSFLAGS='-Wl,--whole-archive'; \
|
||||
NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
|
||||
SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a"; \
|
||||
SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base $$deffile -Wl,-s,-Bsymbolic"; \
|
||||
$(LINK_SO_O)
|
||||
#for mingw target if def-file is in use dll-name should match library-name
|
||||
link_a.cygwin:
|
||||
@ $(CALC_VERSIONS); \
|
||||
INHIBIT_SYMLINKS=yes; \
|
||||
SHLIB=cyg$(LIBNAME); \
|
||||
SHLIB=cyg$(LIBNAME); SHLIB_SOVER=-$(LIBVERSION); SHLIB_SUFFIX=.dll; \
|
||||
dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; extras=; \
|
||||
base=-Wl,--enable-auto-image-base; \
|
||||
if expr $(PLATFORM) : 'mingw' > /dev/null; then \
|
||||
SHLIB=$(LIBNAME)eay32; \
|
||||
base=; [ $(LIBNAME) = "crypto" ] && base=-Wl,--image-base,0x63000000; \
|
||||
case $(LIBNAME) in \
|
||||
crypto) SHLIB=libeay;; \
|
||||
ssl) SHLIB=ssleay;; \
|
||||
esac; \
|
||||
SHLIB_SOVER=32; \
|
||||
extras="$(LIBNAME).def"; \
|
||||
$(PERL) util/mkdef.pl 32 $$SHLIB > $$extras; \
|
||||
base=; [ $(LIBNAME) = "crypto" ] && base=-Wl,--image-base,0x63000000; \
|
||||
fi; \
|
||||
SHLIB_SUFFIX=.dll; \
|
||||
SHLIB_SOVER=-$(LIBVERSION); \
|
||||
dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
|
||||
$(PERL) util/mkrc.pl $$dll_name | \
|
||||
$(CROSS_COMPILE)windres -o rc.o; \
|
||||
extras="$$extras rc.o"; \
|
||||
ALLSYMSFLAGS='-Wl,--whole-archive'; \
|
||||
NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
|
||||
SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a"; \
|
||||
[ -f apps/$$SHLIB$$SHLIB_SUFFIX ] && rm apps/$$SHLIB$$SHLIB_SUFFIX; \
|
||||
[ -f test/$$SHLIB$$SHLIB_SUFFIX ] && rm test/$$SHLIB$$SHLIB_SUFFIX; \
|
||||
SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-s,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a $$extras"; \
|
||||
[ -f apps/$$dll_name ] && rm apps/$$dll_name; \
|
||||
[ -f test/$$dll_name ] && rm test/$$dll_name; \
|
||||
$(LINK_SO_A) || exit 1; \
|
||||
cp -p $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX apps/; \
|
||||
cp -p $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX test/
|
||||
rm $$extras; \
|
||||
cp -p $$dll_name apps/; \
|
||||
cp -p $$dll_name test/
|
||||
link_app.cygwin:
|
||||
@if expr "$(CFLAGS)" : '.*OPENSSL_USE_APPLINK' > /dev/null; then \
|
||||
LIBDEPS="$(TOP)/crypto/applink.o $${LIBDEPS:-$(LIBDEPS)}"; \
|
||||
export LIBDEPS; \
|
||||
fi; \
|
||||
$(LINK_APP)
|
||||
|
||||
link_o.alpha-osf1:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
@ if $(DETECT_GNU_LD); then \
|
||||
$(DO_GNU_SO); \
|
||||
else \
|
||||
SHLIB=lib$(LIBNAME).so; \
|
||||
@ -291,7 +333,7 @@ link_o.alpha-osf1:
|
||||
fi; \
|
||||
$(LINK_SO_O)
|
||||
link_a.alpha-osf1:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
@ if $(DETECT_GNU_LD); then \
|
||||
$(DO_GNU_SO); \
|
||||
else \
|
||||
SHLIB=lib$(LIBNAME).so; \
|
||||
@ -312,7 +354,7 @@ link_a.alpha-osf1:
|
||||
fi; \
|
||||
$(LINK_SO_A)
|
||||
link_app.alpha-osf1:
|
||||
@if ${DETECT_GNU_LD}; then \
|
||||
@if $(DETECT_GNU_LD); then \
|
||||
$(DO_GNU_APP); \
|
||||
else \
|
||||
LDFLAGS="$(CFLAGS) -rpath $(LIBRPATH)"; \
|
||||
@ -320,7 +362,7 @@ link_app.alpha-osf1:
|
||||
$(LINK_APP)
|
||||
|
||||
link_o.solaris:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
@ if $(DETECT_GNU_LD); then \
|
||||
$(DO_GNU_SO); \
|
||||
else \
|
||||
$(CALC_VERSIONS); \
|
||||
@ -334,12 +376,12 @@ link_o.solaris:
|
||||
fi; \
|
||||
$(LINK_SO_O)
|
||||
link_a.solaris:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
@ if $(DETECT_GNU_LD); then \
|
||||
$(DO_GNU_SO); \
|
||||
else \
|
||||
$(CALC_VERSIONS); \
|
||||
MINUSZ='-z '; \
|
||||
(${CC} -v 2>&1 | grep gcc) > /dev/null && MINUSZ='-Wl,-z,'; \
|
||||
($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSZ='-Wl,-z,'; \
|
||||
SHLIB=lib$(LIBNAME).so; \
|
||||
SHLIB_SUFFIX=;\
|
||||
ALLSYMSFLAGS="$${MINUSZ}allextract"; \
|
||||
@ -348,7 +390,7 @@ link_a.solaris:
|
||||
fi; \
|
||||
$(LINK_SO_A)
|
||||
link_app.solaris:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
@ if $(DETECT_GNU_LD); then \
|
||||
$(DO_GNU_APP); \
|
||||
else \
|
||||
LDFLAGS="$(CFLAGS) -R $(LIBRPATH)"; \
|
||||
@ -357,7 +399,7 @@ link_app.solaris:
|
||||
|
||||
# OpenServer 5 native compilers used
|
||||
link_o.svr3:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
@ if $(DETECT_GNU_LD); then \
|
||||
$(DO_GNU_SO); \
|
||||
else \
|
||||
$(CALC_VERSIONS); \
|
||||
@ -369,7 +411,7 @@ link_o.svr3:
|
||||
fi; \
|
||||
$(LINK_SO_O)
|
||||
link_a.svr3:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
@ if $(DETECT_GNU_LD); then \
|
||||
$(DO_GNU_SO); \
|
||||
else \
|
||||
$(CALC_VERSIONS); \
|
||||
@ -381,12 +423,12 @@ link_a.svr3:
|
||||
fi; \
|
||||
$(LINK_SO_A_UNPACKED)
|
||||
link_app.svr3:
|
||||
@${DETECT_GNU_LD} && $(DO_GNU_APP); \
|
||||
@$(DETECT_GNU_LD) && $(DO_GNU_APP); \
|
||||
$(LINK_APP)
|
||||
|
||||
# UnixWare 7 and OpenUNIX 8 native compilers used
|
||||
link_o.svr5:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
@ if $(DETECT_GNU_LD); then \
|
||||
$(DO_GNU_SO); \
|
||||
else \
|
||||
$(CALC_VERSIONS); \
|
||||
@ -400,12 +442,12 @@ link_o.svr5:
|
||||
fi; \
|
||||
$(LINK_SO_O)
|
||||
link_a.svr5:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
@ if $(DETECT_GNU_LD); then \
|
||||
$(DO_GNU_SO); \
|
||||
else \
|
||||
$(CALC_VERSIONS); \
|
||||
SHARE_FLAG='-G'; \
|
||||
(${CC} -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
|
||||
($(CC) -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
|
||||
SHLIB=lib$(LIBNAME).so; \
|
||||
SHLIB_SUFFIX=; \
|
||||
ALLSYMSFLAGS=''; \
|
||||
@ -414,11 +456,11 @@ link_a.svr5:
|
||||
fi; \
|
||||
$(LINK_SO_A_UNPACKED)
|
||||
link_app.svr5:
|
||||
@${DETECT_GNU_LD} && $(DO_GNU_APP); \
|
||||
@$(DETECT_GNU_LD) && $(DO_GNU_APP); \
|
||||
$(LINK_APP)
|
||||
|
||||
link_o.irix:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
@ if $(DETECT_GNU_LD); then \
|
||||
$(DO_GNU_SO); \
|
||||
else \
|
||||
$(CALC_VERSIONS); \
|
||||
@ -432,7 +474,7 @@ link_o.irix:
|
||||
fi; \
|
||||
$(LINK_SO_O)
|
||||
link_a.irix:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
@ if $(DETECT_GNU_LD); then \
|
||||
$(DO_GNU_SO); \
|
||||
else \
|
||||
$(CALC_VERSIONS); \
|
||||
@ -458,7 +500,7 @@ link_app.irix:
|
||||
# ELFs by the way].
|
||||
#
|
||||
link_o.hpux:
|
||||
@if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
|
||||
@if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
|
||||
$(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).sl; \
|
||||
expr "$(CFLAGS)" : '.*DSO_DLFCN' > /dev/null && SHLIB=lib$(LIBNAME).so; \
|
||||
@ -471,7 +513,7 @@ link_o.hpux:
|
||||
rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
|
||||
$(LINK_SO_O) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
|
||||
link_a.hpux:
|
||||
@if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
|
||||
@if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
|
||||
$(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).sl; \
|
||||
expr $(PLATFORM) : '.*ia64' > /dev/null && SHLIB=lib$(LIBNAME).so; \
|
||||
@ -484,7 +526,7 @@ link_a.hpux:
|
||||
rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
|
||||
$(LINK_SO_A) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
|
||||
link_app.hpux:
|
||||
@if ${DETECT_GNU_LD}; then $(DO_GNU_APP); else \
|
||||
@if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
|
||||
LDFLAGS="$(CFLAGS) -Wl,+s,+cdp,../:,+cdp,./:,+b,$(LIBRPATH)"; \
|
||||
fi; \
|
||||
$(LINK_APP)
|
||||
@ -549,7 +591,7 @@ symlink.hpux:
|
||||
expr $(PLATFORM) : '.*ia64' > /dev/null && SHLIB=lib$(LIBNAME).so; \
|
||||
$(SYMLINK_SO)
|
||||
# The following lines means those specific architectures do no symlinks
|
||||
symlink.cygwin symlink.alpha-osf1 symlink.tru64 symlink.tru64-rpath:
|
||||
symlink.cygwin symlink.alpha-osf1 symlink.tru64 symlink.tru64-rpath symlink.beos:
|
||||
|
||||
# Compatibility targets
|
||||
link_o.bsd-gcc-shared link_o.linux-shared link_o.gnu-shared: link_o.gnu
|
||||
@ -607,3 +649,7 @@ link_o.reliantunix-shared: link_o.reliantunix
|
||||
link_a.reliantunix-shared: link_a.reliantunix
|
||||
link_app.reliantunix-shared: link_app.reliantunix
|
||||
symlink.reliantunix-shared: symlink.reliantunix
|
||||
link_o.beos-shared: link_o.beos
|
||||
link_a.beos-shared: link_a.beos
|
||||
link_app.beos-shared: link_app.gnu
|
||||
symlink.beos-shared: symlink.beos
|
||||
|
@ -5,36 +5,108 @@
|
||||
This file gives a brief overview of the major changes between each OpenSSL
|
||||
release. For more details please read the CHANGES file.
|
||||
|
||||
Major changes between OpenSSL 0.9.8w and OpenSSL 0.9.8x:
|
||||
Major changes between OpenSSL 1.0.1b and OpenSSL 1.0.1c:
|
||||
|
||||
o Fix DTLS record length checking bug CVE-2012-2333
|
||||
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 0.9.8v and OpenSSL 0.9.8w:
|
||||
Major changes between OpenSSL 1.0.1a and OpenSSL 1.0.1b:
|
||||
|
||||
o Fix for CVE-2012-2131 (corrected fix for 0.9.8 and CVE-2012-2110)
|
||||
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 0.9.8u and OpenSSL 0.9.8v:
|
||||
Major changes between OpenSSL 1.0.1 and OpenSSL 1.0.1a:
|
||||
|
||||
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 0.9.8t and OpenSSL 0.9.8u:
|
||||
Major changes between OpenSSL 1.0.0h and OpenSSL 1.0.1:
|
||||
|
||||
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:
|
||||
|
||||
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 0.9.8s and OpenSSL 0.9.8t:
|
||||
Major changes between OpenSSL 1.0.0f and OpenSSL 1.0.0g:
|
||||
|
||||
o Fix for DTLS DoS issue CVE-2012-0050
|
||||
|
||||
Major changes between OpenSSL 0.9.8r and OpenSSL 0.9.8s:
|
||||
Major changes between OpenSSL 1.0.0e and OpenSSL 1.0.0f:
|
||||
|
||||
o Fix for DTLS plaintext recovery attack CVE-2011-4108
|
||||
o Fix policy check double free error CVE-2011-4109
|
||||
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:
|
||||
|
||||
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:
|
||||
|
||||
o Fix for security issue CVE-2011-0014
|
||||
|
||||
Major changes between OpenSSL 1.0.0b and OpenSSL 1.0.0c:
|
||||
|
||||
o Fix for security issue CVE-2010-4180
|
||||
o Fix for CVE-2010-4252
|
||||
o Fix mishandling of absent EC point format extension.
|
||||
o Fix various platform compilation issues.
|
||||
o Corrected fix for security issue CVE-2010-3864.
|
||||
|
||||
Major changes between OpenSSL 1.0.0a and OpenSSL 1.0.0b:
|
||||
|
||||
o Fix for security issue CVE-2010-3864.
|
||||
o Fix for CVE-2010-2939
|
||||
o Fix WIN32 build system for GOST ENGINE.
|
||||
|
||||
Major changes between OpenSSL 1.0.0 and OpenSSL 1.0.0a:
|
||||
|
||||
o Fix for security issue CVE-2010-1633.
|
||||
o GOST MAC and CFB fixes.
|
||||
|
||||
Major changes between OpenSSL 0.9.8n and OpenSSL 1.0.0:
|
||||
|
||||
o RFC3280 path validation: sufficient to process PKITS tests.
|
||||
o Integrated support for PVK files and keyblobs.
|
||||
o Change default private key format to PKCS#8.
|
||||
o CMS support: able to process all examples in RFC4134
|
||||
o Streaming ASN1 encode support for PKCS#7 and CMS.
|
||||
o Multiple signer and signer add support for PKCS#7 and CMS.
|
||||
o ASN1 printing support.
|
||||
o Whirlpool hash algorithm added.
|
||||
o RFC3161 time stamp support.
|
||||
o New generalised public key API supporting ENGINE based algorithms.
|
||||
o New generalised public key API utilities.
|
||||
o New ENGINE supporting GOST algorithms.
|
||||
o SSL/TLS GOST ciphersuite support.
|
||||
o PKCS#7 and CMS GOST support.
|
||||
o RFC4279 PSK ciphersuite support.
|
||||
o Supported points format extension for ECC ciphersuites.
|
||||
o ecdsa-with-SHA224/256/384/512 signature types.
|
||||
o dsa-with-SHA224 and dsa-with-SHA256 signature types.
|
||||
o Opaque PRF Input TLS extension support.
|
||||
o Updated time routines to avoid OS limitations.
|
||||
|
||||
Major changes between OpenSSL 0.9.8q and OpenSSL 0.9.8r:
|
||||
|
||||
o Fix for security issue CVE-2011-0014
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
OpenSSL 0.9.8x 10 May 2012
|
||||
OpenSSL 1.0.1c 10 May 2012
|
||||
|
||||
Copyright (c) 1998-2011 The OpenSSL Project
|
||||
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -137,11 +137,6 @@ long app_RAND_load_files(char *file); /* `file' is a list of files to read,
|
||||
* (see e_os.h). The string is
|
||||
* destroyed! */
|
||||
|
||||
#ifdef OPENSSL_SYS_WIN32
|
||||
#define rename(from,to) WIN32_rename((from),(to))
|
||||
int WIN32_rename(const char *oldname,const char *newname);
|
||||
#endif
|
||||
|
||||
#ifndef MONOLITH
|
||||
|
||||
#define MAIN(a,v) main(a,v)
|
||||
@ -149,11 +144,9 @@ int WIN32_rename(const char *oldname,const char *newname);
|
||||
#ifndef NON_MAIN
|
||||
CONF *config=NULL;
|
||||
BIO *bio_err=NULL;
|
||||
int in_FIPS_mode=0;
|
||||
#else
|
||||
extern CONF *config;
|
||||
extern BIO *bio_err;
|
||||
extern int in_FIPS_mode;
|
||||
#endif
|
||||
|
||||
#else
|
||||
@ -162,7 +155,6 @@ extern int in_FIPS_mode;
|
||||
extern CONF *config;
|
||||
extern char *default_config_file;
|
||||
extern BIO *bio_err;
|
||||
extern int in_FIPS_mode;
|
||||
|
||||
#endif
|
||||
|
||||
@ -176,61 +168,37 @@ extern int in_FIPS_mode;
|
||||
#define do_pipe_sig()
|
||||
#endif
|
||||
|
||||
#ifdef OPENSSL_NO_COMP
|
||||
#define zlib_cleanup()
|
||||
#else
|
||||
#define zlib_cleanup() COMP_zlib_cleanup()
|
||||
#endif
|
||||
|
||||
#if defined(MONOLITH) && !defined(OPENSSL_C)
|
||||
# define apps_startup() \
|
||||
do_pipe_sig()
|
||||
# define apps_shutdown()
|
||||
#else
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
# if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN16) || \
|
||||
defined(OPENSSL_SYS_WIN32)
|
||||
# ifdef _O_BINARY
|
||||
# define apps_startup() \
|
||||
do { _fmode=_O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
|
||||
# define apps_startup() \
|
||||
do { do_pipe_sig(); CRYPTO_malloc_init(); \
|
||||
ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
|
||||
ENGINE_load_builtin_engines(); setup_ui_method(); } while(0)
|
||||
# else
|
||||
# define apps_startup() \
|
||||
do { _fmode=O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
|
||||
ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
|
||||
ENGINE_load_builtin_engines(); setup_ui_method(); } while(0)
|
||||
# endif
|
||||
# else
|
||||
# define apps_startup() \
|
||||
do { do_pipe_sig(); OpenSSL_add_all_algorithms(); \
|
||||
ERR_load_crypto_strings(); ENGINE_load_builtin_engines(); \
|
||||
setup_ui_method(); } while(0)
|
||||
# endif
|
||||
# define apps_shutdown() \
|
||||
do { CONF_modules_unload(1); destroy_ui_method(); \
|
||||
EVP_cleanup(); ENGINE_cleanup(); \
|
||||
CRYPTO_cleanup_all_ex_data(); ERR_remove_state(0); \
|
||||
ERR_free_strings(); } while(0)
|
||||
OBJ_cleanup(); EVP_cleanup(); ENGINE_cleanup(); \
|
||||
CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \
|
||||
ERR_free_strings(); zlib_cleanup();} while(0)
|
||||
# else
|
||||
# if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN16) || \
|
||||
defined(OPENSSL_SYS_WIN32)
|
||||
# ifdef _O_BINARY
|
||||
# define apps_startup() \
|
||||
do { _fmode=_O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
|
||||
# define apps_startup() \
|
||||
do { do_pipe_sig(); CRYPTO_malloc_init(); \
|
||||
ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
|
||||
setup_ui_method(); } while(0)
|
||||
# else
|
||||
# define apps_startup() \
|
||||
do { _fmode=O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
|
||||
ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
|
||||
setup_ui_method(); } while(0)
|
||||
# endif
|
||||
# else
|
||||
# define apps_startup() \
|
||||
do { do_pipe_sig(); OpenSSL_add_all_algorithms(); \
|
||||
ERR_load_crypto_strings(); \
|
||||
setup_ui_method(); } while(0)
|
||||
# endif
|
||||
# define apps_shutdown() \
|
||||
do { CONF_modules_unload(1); destroy_ui_method(); \
|
||||
EVP_cleanup(); \
|
||||
CRYPTO_cleanup_all_ex_data(); ERR_remove_state(0); \
|
||||
ERR_free_strings(); } while(0)
|
||||
OBJ_cleanup(); EVP_cleanup(); \
|
||||
CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \
|
||||
ERR_free_strings(); zlib_cleanup(); } while(0)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -240,6 +208,7 @@ extern int in_FIPS_mode;
|
||||
# define openssl_fdset(a,b) FD_SET(a, b)
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct args_st
|
||||
{
|
||||
char **data;
|
||||
@ -282,6 +251,8 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
|
||||
const char *pass, ENGINE *e, const char *key_descrip);
|
||||
STACK_OF(X509) *load_certs(BIO *err, const char *file, int format,
|
||||
const char *pass, ENGINE *e, const char *cert_descrip);
|
||||
STACK_OF(X509_CRL) *load_crls(BIO *err, const char *file, int format,
|
||||
const char *pass, ENGINE *e, const char *cert_descrip);
|
||||
X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath);
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
ENGINE *setup_engine(BIO *err, const char *engine, int debug);
|
||||
@ -290,6 +261,7 @@ ENGINE *setup_engine(BIO *err, const char *engine, int debug);
|
||||
#ifndef OPENSSL_NO_OCSP
|
||||
OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req,
|
||||
char *host, char *path, char *port, int use_ssl,
|
||||
STACK_OF(CONF_VALUE) *headers,
|
||||
int req_timeout);
|
||||
#endif
|
||||
|
||||
@ -331,18 +303,38 @@ int index_index(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);
|
||||
void free_index(CA_DB *db);
|
||||
int index_name_cmp(const char **a, const char **b);
|
||||
#define index_name_cmp_noconst(a, b) \
|
||||
index_name_cmp((const OPENSSL_CSTRING *)CHECKED_PTR_OF(OPENSSL_STRING, a), \
|
||||
(const OPENSSL_CSTRING *)CHECKED_PTR_OF(OPENSSL_STRING, b))
|
||||
int index_name_cmp(const OPENSSL_CSTRING *a, const OPENSSL_CSTRING *b);
|
||||
int parse_yesno(const char *str, int def);
|
||||
|
||||
X509_NAME *parse_name(char *str, long chtype, int multirdn);
|
||||
int args_verify(char ***pargs, int *pargc,
|
||||
int *badarg, BIO *err, X509_VERIFY_PARAM **pm);
|
||||
void policies_print(BIO *out, X509_STORE_CTX *ctx);
|
||||
int bio_to_mem(unsigned char **out, int maxlen, BIO *in);
|
||||
int pkey_ctrl_string(EVP_PKEY_CTX *ctx, char *value);
|
||||
int init_gen_str(BIO *err, EVP_PKEY_CTX **pctx,
|
||||
const char *algname, ENGINE *e, int do_param);
|
||||
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;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_JPAKE
|
||||
void jpake_client_auth(BIO *out, BIO *conn, const char *secret);
|
||||
void jpake_server_auth(BIO *out, BIO *conn, const char *secret);
|
||||
#endif
|
||||
|
||||
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
|
||||
unsigned char *next_protos_parse(unsigned short *outlen, const char *in);
|
||||
#endif /* !OPENSSL_NO_TLSEXT && !OPENSSL_NO_NEXTPROTONEG */
|
||||
|
||||
#define FORMAT_UNDEF 0
|
||||
#define FORMAT_ASN1 1
|
||||
#define FORMAT_TEXT 2
|
||||
@ -353,6 +345,10 @@ void jpake_server_auth(BIO *out, BIO *conn, const char *secret);
|
||||
#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
|
||||
#define EXT_COPY_ADD 1
|
||||
@ -364,4 +360,14 @@ void jpake_server_auth(BIO *out, BIO *conn, const char *secret);
|
||||
|
||||
#define SERIAL_RAND_BITS 64
|
||||
|
||||
int app_isdir(const char *);
|
||||
int raw_read_stdin(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
|
||||
|
||||
#endif
|
||||
|
@ -96,7 +96,7 @@ int MAIN(int argc, char **argv)
|
||||
unsigned char *tmpbuf;
|
||||
const unsigned char *ctmpbuf;
|
||||
BUF_MEM *buf=NULL;
|
||||
STACK *osk=NULL;
|
||||
STACK_OF(OPENSSL_STRING) *osk=NULL;
|
||||
ASN1_TYPE *at=NULL;
|
||||
|
||||
informat=FORMAT_PEM;
|
||||
@ -113,7 +113,7 @@ int MAIN(int argc, char **argv)
|
||||
prog=argv[0];
|
||||
argc--;
|
||||
argv++;
|
||||
if ((osk=sk_new_null()) == NULL)
|
||||
if ((osk=sk_OPENSSL_STRING_new_null()) == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
goto end;
|
||||
@ -169,7 +169,7 @@ int MAIN(int argc, char **argv)
|
||||
else if (strcmp(*argv,"-strparse") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
sk_push(osk,*(++argv));
|
||||
sk_OPENSSL_STRING_push(osk,*(++argv));
|
||||
}
|
||||
else if (strcmp(*argv,"-genstr") == 0)
|
||||
{
|
||||
@ -302,18 +302,18 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
/* If any structs to parse go through in sequence */
|
||||
|
||||
if (sk_num(osk))
|
||||
if (sk_OPENSSL_STRING_num(osk))
|
||||
{
|
||||
tmpbuf=(unsigned char *)str;
|
||||
tmplen=num;
|
||||
for (i=0; i<sk_num(osk); i++)
|
||||
for (i=0; i<sk_OPENSSL_STRING_num(osk); i++)
|
||||
{
|
||||
ASN1_TYPE *atmp;
|
||||
int typ;
|
||||
j=atoi(sk_value(osk,i));
|
||||
j=atoi(sk_OPENSSL_STRING_value(osk,i));
|
||||
if (j == 0)
|
||||
{
|
||||
BIO_printf(bio_err,"'%s' is an invalid number\n",sk_value(osk,i));
|
||||
BIO_printf(bio_err,"'%s' is an invalid number\n",sk_OPENSSL_STRING_value(osk,i));
|
||||
continue;
|
||||
}
|
||||
tmpbuf+=j;
|
||||
@ -378,7 +378,7 @@ int MAIN(int argc, char **argv)
|
||||
ERR_print_errors(bio_err);
|
||||
if (buf != NULL) BUF_MEM_free(buf);
|
||||
if (at != NULL) ASN1_TYPE_free(at);
|
||||
if (osk != NULL) sk_free(osk);
|
||||
if (osk != NULL) sk_OPENSSL_STRING_free(osk);
|
||||
OBJ_cleanup();
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
|
@ -63,7 +63,6 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
@ -83,7 +82,7 @@
|
||||
# else
|
||||
# include <unixlib.h>
|
||||
# endif
|
||||
# elif !defined(OPENSSL_SYS_VXWORKS) && !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_NETWARE) && !defined(__TANDEM)
|
||||
# elif !defined(OPENSSL_SYS_VXWORKS) && !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_NETWARE)
|
||||
# include <sys/file.h>
|
||||
# endif
|
||||
#endif
|
||||
@ -198,26 +197,30 @@ extern int EF_ALIGNMENT;
|
||||
|
||||
static void lookup_fail(const char *name, const char *tag);
|
||||
static int certify(X509 **xret, char *infile,EVP_PKEY *pkey,X509 *x509,
|
||||
const EVP_MD *dgst,STACK_OF(CONF_VALUE) *policy,CA_DB *db,
|
||||
const EVP_MD *dgst,STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
STACK_OF(CONF_VALUE) *policy,CA_DB *db,
|
||||
BIGNUM *serial, char *subj,unsigned long chtype, int multirdn, int email_dn, char *startdate,
|
||||
char *enddate, long days, int batch, char *ext_sect, CONF *conf,
|
||||
int verbose, unsigned long certopt, unsigned long nameopt,
|
||||
int default_op, int ext_copy, int selfsign);
|
||||
static int certify_cert(X509 **xret, char *infile,EVP_PKEY *pkey,X509 *x509,
|
||||
const EVP_MD *dgst,STACK_OF(CONF_VALUE) *policy,
|
||||
const EVP_MD *dgst,STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
STACK_OF(CONF_VALUE) *policy,
|
||||
CA_DB *db, BIGNUM *serial, char *subj,unsigned long chtype, int multirdn, int email_dn,
|
||||
char *startdate, char *enddate, long days, int batch,
|
||||
char *ext_sect, CONF *conf,int verbose, unsigned long certopt,
|
||||
unsigned long nameopt, int default_op, int ext_copy,
|
||||
ENGINE *e);
|
||||
static int certify_spkac(X509 **xret, char *infile,EVP_PKEY *pkey,X509 *x509,
|
||||
const EVP_MD *dgst,STACK_OF(CONF_VALUE) *policy,
|
||||
const EVP_MD *dgst,STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
STACK_OF(CONF_VALUE) *policy,
|
||||
CA_DB *db, BIGNUM *serial,char *subj,unsigned long chtype, int multirdn, int email_dn,
|
||||
char *startdate, char *enddate, long days, char *ext_sect,
|
||||
CONF *conf, int verbose, unsigned long certopt,
|
||||
unsigned long nameopt, int default_op, int ext_copy);
|
||||
static void write_new_certificate(BIO *bp, X509 *x, int output_der, int notext);
|
||||
static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
STACK_OF(CONF_VALUE) *policy, CA_DB *db, BIGNUM *serial,char *subj,unsigned long chtype, int multirdn,
|
||||
int email_dn, char *startdate, char *enddate, long days, int batch,
|
||||
int verbose, X509_REQ *req, char *ext_sect, CONF *conf,
|
||||
@ -258,6 +261,7 @@ int MAIN(int argc, char **argv)
|
||||
int doupdatedb=0;
|
||||
long crldays=0;
|
||||
long crlhours=0;
|
||||
long crlsec=0;
|
||||
long errorline= -1;
|
||||
char *configfile=NULL;
|
||||
char *md=NULL;
|
||||
@ -305,11 +309,13 @@ int MAIN(int argc, char **argv)
|
||||
ASN1_TIME *tmptm;
|
||||
ASN1_INTEGER *tmpser;
|
||||
char *f;
|
||||
const char *p, **pp;
|
||||
const char *p;
|
||||
char * const *pp;
|
||||
int i,j;
|
||||
const EVP_MD *dgst=NULL;
|
||||
STACK_OF(CONF_VALUE) *attribs=NULL;
|
||||
STACK_OF(X509) *cert_sk=NULL;
|
||||
STACK_OF(OPENSSL_STRING) *sigopts = NULL;
|
||||
#undef BSIZE
|
||||
#define BSIZE 256
|
||||
MS_STATIC char buf[3][BSIZE];
|
||||
@ -434,6 +440,15 @@ EF_ALIGNMENT=0;
|
||||
if (--argc < 1) goto bad;
|
||||
outdir= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-sigopt") == 0)
|
||||
{
|
||||
if (--argc < 1)
|
||||
goto bad;
|
||||
if (!sigopts)
|
||||
sigopts = sk_OPENSSL_STRING_new_null();
|
||||
if (!sigopts || !sk_OPENSSL_STRING_push(sigopts, *(++argv)))
|
||||
goto bad;
|
||||
}
|
||||
else if (strcmp(*argv,"-notext") == 0)
|
||||
notext=1;
|
||||
else if (strcmp(*argv,"-batch") == 0)
|
||||
@ -456,6 +471,11 @@ EF_ALIGNMENT=0;
|
||||
if (--argc < 1) goto bad;
|
||||
crlhours= atol(*(++argv));
|
||||
}
|
||||
else if (strcmp(*argv,"-crlsec") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
crlsec = atol(*(++argv));
|
||||
}
|
||||
else if (strcmp(*argv,"-infiles") == 0)
|
||||
{
|
||||
argc--;
|
||||
@ -549,8 +569,10 @@ EF_ALIGNMENT=0;
|
||||
|
||||
if (badops)
|
||||
{
|
||||
for (pp=ca_usage; (*pp != NULL); pp++)
|
||||
BIO_printf(bio_err,"%s",*pp);
|
||||
const char **pp2;
|
||||
|
||||
for (pp2=ca_usage; (*pp2 != NULL); pp2++)
|
||||
BIO_printf(bio_err,"%s",*pp2);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@ -825,7 +847,6 @@ EF_ALIGNMENT=0;
|
||||
/* lookup where to write new certificates */
|
||||
if ((outdir == NULL) && (req))
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
if ((outdir=NCONF_get_string(conf,section,ENV_NEW_CERTS_DIR))
|
||||
== NULL)
|
||||
@ -844,27 +865,23 @@ EF_ALIGNMENT=0;
|
||||
that to access(). However, time's too short to do that just
|
||||
now.
|
||||
*/
|
||||
#ifndef _WIN32
|
||||
if (access(outdir,R_OK|W_OK|X_OK) != 0)
|
||||
#else
|
||||
if (_access(outdir,R_OK|W_OK|X_OK) != 0)
|
||||
#endif
|
||||
{
|
||||
BIO_printf(bio_err,"I am unable to access the %s directory\n",outdir);
|
||||
perror(outdir);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (stat(outdir,&sb) != 0)
|
||||
{
|
||||
BIO_printf(bio_err,"unable to stat(%s)\n",outdir);
|
||||
perror(outdir);
|
||||
goto err;
|
||||
}
|
||||
#ifdef S_ISDIR
|
||||
if (!S_ISDIR(sb.st_mode))
|
||||
if (app_isdir(outdir)<=0)
|
||||
{
|
||||
BIO_printf(bio_err,"%s need to be a directory\n",outdir);
|
||||
perror(outdir);
|
||||
goto err;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -879,9 +896,9 @@ EF_ALIGNMENT=0;
|
||||
if (db == NULL) goto err;
|
||||
|
||||
/* Lets check some fields */
|
||||
for (i=0; i<sk_num(db->db->data); i++)
|
||||
for (i=0; i<sk_OPENSSL_PSTRING_num(db->db->data); i++)
|
||||
{
|
||||
pp=(const char **)sk_value(db->db->data,i);
|
||||
pp=sk_OPENSSL_PSTRING_value(db->db->data,i);
|
||||
if ((pp[DB_type][0] != DB_TYPE_REV) &&
|
||||
(pp[DB_rev_date][0] != '\0'))
|
||||
{
|
||||
@ -894,7 +911,7 @@ EF_ALIGNMENT=0;
|
||||
BIO_printf(bio_err," in entry %d\n", i+1);
|
||||
goto err;
|
||||
}
|
||||
if (!check_time_format(pp[DB_exp_date]))
|
||||
if (!check_time_format((char *)pp[DB_exp_date]))
|
||||
{
|
||||
BIO_printf(bio_err,"entry %d: invalid expiry date\n",i+1);
|
||||
goto err;
|
||||
@ -934,7 +951,7 @@ EF_ALIGNMENT=0;
|
||||
#endif
|
||||
TXT_DB_write(out,db->db);
|
||||
BIO_printf(bio_err,"%d entries loaded from the database\n",
|
||||
db->db->data->num);
|
||||
sk_OPENSSL_PSTRING_num(db->db->data));
|
||||
BIO_printf(bio_err,"generating index\n");
|
||||
}
|
||||
|
||||
@ -1025,6 +1042,17 @@ EF_ALIGNMENT=0;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!strcmp(md, "default"))
|
||||
{
|
||||
int def_nid;
|
||||
if (EVP_PKEY_get_default_digest_nid(pkey, &def_nid) <= 0)
|
||||
{
|
||||
BIO_puts(bio_err,"no default digest\n");
|
||||
goto err;
|
||||
}
|
||||
md = (char *)OBJ_nid2sn(def_nid);
|
||||
}
|
||||
|
||||
if ((dgst=EVP_get_digestbyname(md)) == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"%s is an unsupported message digest type\n",md);
|
||||
@ -1094,9 +1122,9 @@ EF_ALIGNMENT=0;
|
||||
if (startdate == NULL)
|
||||
ERR_clear_error();
|
||||
}
|
||||
if (startdate && !ASN1_UTCTIME_set_string(NULL,startdate))
|
||||
if (startdate && !ASN1_TIME_set_string(NULL, startdate))
|
||||
{
|
||||
BIO_printf(bio_err,"start date is invalid, it should be YYMMDDHHMMSSZ\n");
|
||||
BIO_printf(bio_err,"start date is invalid, it should be YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ\n");
|
||||
goto err;
|
||||
}
|
||||
if (startdate == NULL) startdate="today";
|
||||
@ -1108,9 +1136,9 @@ EF_ALIGNMENT=0;
|
||||
if (enddate == NULL)
|
||||
ERR_clear_error();
|
||||
}
|
||||
if (enddate && !ASN1_UTCTIME_set_string(NULL,enddate))
|
||||
if (enddate && !ASN1_TIME_set_string(NULL, enddate))
|
||||
{
|
||||
BIO_printf(bio_err,"end date is invalid, it should be YYMMDDHHMMSSZ\n");
|
||||
BIO_printf(bio_err,"end date is invalid, it should be YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
@ -1156,8 +1184,9 @@ EF_ALIGNMENT=0;
|
||||
if (spkac_file != NULL)
|
||||
{
|
||||
total++;
|
||||
j=certify_spkac(&x,spkac_file,pkey,x509,dgst,attribs,db,
|
||||
serial,subj,chtype,multirdn,email_dn,startdate,enddate,days,extensions,
|
||||
j=certify_spkac(&x,spkac_file,pkey,x509,dgst,sigopts,
|
||||
attribs,db, serial,subj,chtype,multirdn,
|
||||
email_dn,startdate,enddate,days,extensions,
|
||||
conf,verbose,certopt,nameopt,default_op,ext_copy);
|
||||
if (j < 0) goto err;
|
||||
if (j > 0)
|
||||
@ -1180,7 +1209,8 @@ EF_ALIGNMENT=0;
|
||||
if (ss_cert_file != NULL)
|
||||
{
|
||||
total++;
|
||||
j=certify_cert(&x,ss_cert_file,pkey,x509,dgst,attribs,
|
||||
j=certify_cert(&x,ss_cert_file,pkey,x509,dgst,sigopts,
|
||||
attribs,
|
||||
db,serial,subj,chtype,multirdn,email_dn,startdate,enddate,days,batch,
|
||||
extensions,conf,verbose, certopt, nameopt,
|
||||
default_op, ext_copy, e);
|
||||
@ -1200,7 +1230,7 @@ EF_ALIGNMENT=0;
|
||||
if (infile != NULL)
|
||||
{
|
||||
total++;
|
||||
j=certify(&x,infile,pkey,x509p,dgst,attribs,db,
|
||||
j=certify(&x,infile,pkey,x509p,dgst,sigopts, attribs,db,
|
||||
serial,subj,chtype,multirdn,email_dn,startdate,enddate,days,batch,
|
||||
extensions,conf,verbose, certopt, nameopt,
|
||||
default_op, ext_copy, selfsign);
|
||||
@ -1220,7 +1250,7 @@ EF_ALIGNMENT=0;
|
||||
for (i=0; i<argc; i++)
|
||||
{
|
||||
total++;
|
||||
j=certify(&x,argv[i],pkey,x509p,dgst,attribs,db,
|
||||
j=certify(&x,argv[i],pkey,x509p,dgst,sigopts,attribs,db,
|
||||
serial,subj,chtype,multirdn,email_dn,startdate,enddate,days,batch,
|
||||
extensions,conf,verbose, certopt, nameopt,
|
||||
default_op, ext_copy, selfsign);
|
||||
@ -1370,7 +1400,7 @@ EF_ALIGNMENT=0;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!crldays && !crlhours)
|
||||
if (!crldays && !crlhours && !crlsec)
|
||||
{
|
||||
if (!NCONF_get_number(conf,section,
|
||||
ENV_DEFAULT_CRL_DAYS, &crldays))
|
||||
@ -1379,7 +1409,7 @@ EF_ALIGNMENT=0;
|
||||
ENV_DEFAULT_CRL_HOURS, &crlhours))
|
||||
crlhours = 0;
|
||||
}
|
||||
if ((crldays == 0) && (crlhours == 0))
|
||||
if ((crldays == 0) && (crlhours == 0) && (crlsec == 0))
|
||||
{
|
||||
BIO_printf(bio_err,"cannot lookup how long until the next CRL is issued\n");
|
||||
goto err;
|
||||
@ -1393,14 +1423,19 @@ EF_ALIGNMENT=0;
|
||||
if (!tmptm) goto err;
|
||||
X509_gmtime_adj(tmptm,0);
|
||||
X509_CRL_set_lastUpdate(crl, tmptm);
|
||||
X509_gmtime_adj(tmptm,(crldays*24+crlhours)*60*60);
|
||||
if (!X509_time_adj_ex(tmptm, crldays, crlhours*60*60 + crlsec,
|
||||
NULL))
|
||||
{
|
||||
BIO_puts(bio_err, "error setting CRL nextUpdate\n");
|
||||
goto err;
|
||||
}
|
||||
X509_CRL_set_nextUpdate(crl, tmptm);
|
||||
|
||||
ASN1_TIME_free(tmptm);
|
||||
|
||||
for (i=0; i<sk_num(db->db->data); i++)
|
||||
for (i=0; i<sk_OPENSSL_PSTRING_num(db->db->data); i++)
|
||||
{
|
||||
pp=(const char **)sk_value(db->db->data,i);
|
||||
pp=sk_OPENSSL_PSTRING_value(db->db->data,i);
|
||||
if (pp[DB_type][0] == DB_TYPE_REV)
|
||||
{
|
||||
if ((r=X509_REVOKED_new()) == NULL) goto err;
|
||||
@ -1426,15 +1461,6 @@ EF_ALIGNMENT=0;
|
||||
|
||||
/* we now have a CRL */
|
||||
if (verbose) BIO_printf(bio_err,"signing CRL\n");
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
if (pkey->type == EVP_PKEY_DSA)
|
||||
dgst=EVP_dss1();
|
||||
else
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (pkey->type == EVP_PKEY_EC)
|
||||
dgst=EVP_ecdsa();
|
||||
#endif
|
||||
|
||||
/* Add any extensions asked for */
|
||||
|
||||
@ -1467,7 +1493,13 @@ EF_ALIGNMENT=0;
|
||||
if (crlnumberfile != NULL) /* we have a CRL number that need updating */
|
||||
if (!save_serial(crlnumberfile,"new",crlnumber,NULL)) goto err;
|
||||
|
||||
if (!X509_CRL_sign(crl,pkey,dgst)) goto err;
|
||||
if (crlnumber)
|
||||
{
|
||||
BN_free(crlnumber);
|
||||
crlnumber = NULL;
|
||||
}
|
||||
|
||||
if (!do_X509_CRL_sign(bio_err,crl,pkey,dgst,sigopts)) goto err;
|
||||
|
||||
PEM_write_bio_X509_CRL(Sout,crl);
|
||||
|
||||
@ -1519,7 +1551,10 @@ EF_ALIGNMENT=0;
|
||||
if (free_key && key)
|
||||
OPENSSL_free(key);
|
||||
BN_free(serial);
|
||||
BN_free(crlnumber);
|
||||
free_index(db);
|
||||
if (sigopts)
|
||||
sk_OPENSSL_STRING_free(sigopts);
|
||||
EVP_PKEY_free(pkey);
|
||||
if (x509) X509_free(x509);
|
||||
X509_CRL_free(crl);
|
||||
@ -1536,8 +1571,10 @@ static void lookup_fail(const char *name, const char *tag)
|
||||
}
|
||||
|
||||
static int certify(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
|
||||
const EVP_MD *dgst, STACK_OF(CONF_VALUE) *policy, CA_DB *db,
|
||||
BIGNUM *serial, char *subj,unsigned long chtype, int multirdn, int email_dn, char *startdate, char *enddate,
|
||||
const EVP_MD *dgst, STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
STACK_OF(CONF_VALUE) *policy, CA_DB *db,
|
||||
BIGNUM *serial, char *subj,unsigned long chtype, int multirdn,
|
||||
int email_dn, char *startdate, char *enddate,
|
||||
long days, int batch, char *ext_sect, CONF *lconf, int verbose,
|
||||
unsigned long certopt, unsigned long nameopt, int default_op,
|
||||
int ext_copy, int selfsign)
|
||||
@ -1593,7 +1630,8 @@ static int certify(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
|
||||
else
|
||||
BIO_printf(bio_err,"Signature ok\n");
|
||||
|
||||
ok=do_body(xret,pkey,x509,dgst,policy,db,serial,subj,chtype,multirdn, email_dn,
|
||||
ok=do_body(xret,pkey,x509,dgst,sigopts, policy,db,serial,subj,chtype,
|
||||
multirdn, email_dn,
|
||||
startdate,enddate,days,batch,verbose,req,ext_sect,lconf,
|
||||
certopt, nameopt, default_op, ext_copy, selfsign);
|
||||
|
||||
@ -1604,7 +1642,8 @@ static int certify(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
|
||||
}
|
||||
|
||||
static int certify_cert(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
|
||||
const EVP_MD *dgst, STACK_OF(CONF_VALUE) *policy, CA_DB *db,
|
||||
const EVP_MD *dgst, STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
STACK_OF(CONF_VALUE) *policy, CA_DB *db,
|
||||
BIGNUM *serial, char *subj, unsigned long chtype, int multirdn, int email_dn, char *startdate, char *enddate,
|
||||
long days, int batch, char *ext_sect, CONF *lconf, int verbose,
|
||||
unsigned long certopt, unsigned long nameopt, int default_op,
|
||||
@ -1647,7 +1686,7 @@ static int certify_cert(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
|
||||
if ((rreq=X509_to_X509_REQ(req,NULL,EVP_md5())) == NULL)
|
||||
goto err;
|
||||
|
||||
ok=do_body(xret,pkey,x509,dgst,policy,db,serial,subj,chtype,multirdn,email_dn,startdate,enddate,
|
||||
ok=do_body(xret,pkey,x509,dgst,sigopts,policy,db,serial,subj,chtype,multirdn,email_dn,startdate,enddate,
|
||||
days,batch,verbose,rreq,ext_sect,lconf, certopt, nameopt, default_op,
|
||||
ext_copy, 0);
|
||||
|
||||
@ -1658,7 +1697,8 @@ static int certify_cert(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
|
||||
}
|
||||
|
||||
static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
|
||||
STACK_OF(CONF_VALUE) *policy, CA_DB *db, BIGNUM *serial, char *subj,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts, STACK_OF(CONF_VALUE) *policy,
|
||||
CA_DB *db, BIGNUM *serial, char *subj,
|
||||
unsigned long chtype, int multirdn,
|
||||
int email_dn, char *startdate, char *enddate, long days, int batch,
|
||||
int verbose, X509_REQ *req, char *ext_sect, CONF *lconf,
|
||||
@ -1677,7 +1717,9 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
|
||||
int ok= -1,i,j,last,nid;
|
||||
const char *p;
|
||||
CONF_VALUE *cv;
|
||||
char *row[DB_NUMBER],**rrow=NULL,**irow=NULL;
|
||||
OPENSSL_STRING row[DB_NUMBER];
|
||||
OPENSSL_STRING *irow=NULL;
|
||||
OPENSSL_STRING *rrow=NULL;
|
||||
char buf[25];
|
||||
|
||||
tmptm=ASN1_UTCTIME_new();
|
||||
@ -1919,7 +1961,9 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
|
||||
|
||||
if (db->attributes.unique_subject)
|
||||
{
|
||||
rrow=TXT_DB_get_by_index(db->db,DB_name,row);
|
||||
OPENSSL_STRING *crow=row;
|
||||
|
||||
rrow=TXT_DB_get_by_index(db->db,DB_name,crow);
|
||||
if (rrow != NULL)
|
||||
{
|
||||
BIO_printf(bio_err,
|
||||
@ -1995,11 +2039,11 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
|
||||
|
||||
if (strcmp(startdate,"today") == 0)
|
||||
X509_gmtime_adj(X509_get_notBefore(ret),0);
|
||||
else ASN1_UTCTIME_set_string(X509_get_notBefore(ret),startdate);
|
||||
else ASN1_TIME_set_string(X509_get_notBefore(ret),startdate);
|
||||
|
||||
if (enddate == NULL)
|
||||
X509_gmtime_adj(X509_get_notAfter(ret),(long)60*60*24*days);
|
||||
else ASN1_UTCTIME_set_string(X509_get_notAfter(ret),enddate);
|
||||
X509_time_adj_ex(X509_get_notAfter(ret),days, 0, NULL);
|
||||
else ASN1_TIME_set_string(X509_get_notAfter(ret),enddate);
|
||||
|
||||
if (!X509_set_subject_name(ret,subject)) goto err;
|
||||
|
||||
@ -2119,27 +2163,13 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
if (pkey->type == EVP_PKEY_DSA) dgst=EVP_dss1();
|
||||
pktmp=X509_get_pubkey(ret);
|
||||
if (EVP_PKEY_missing_parameters(pktmp) &&
|
||||
!EVP_PKEY_missing_parameters(pkey))
|
||||
EVP_PKEY_copy_parameters(pktmp,pkey);
|
||||
EVP_PKEY_free(pktmp);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (pkey->type == EVP_PKEY_EC)
|
||||
dgst = EVP_ecdsa();
|
||||
pktmp = X509_get_pubkey(ret);
|
||||
if (EVP_PKEY_missing_parameters(pktmp) &&
|
||||
!EVP_PKEY_missing_parameters(pkey))
|
||||
EVP_PKEY_copy_parameters(pktmp, pkey);
|
||||
EVP_PKEY_free(pktmp);
|
||||
#endif
|
||||
|
||||
|
||||
if (!X509_sign(ret,pkey,dgst))
|
||||
if (!do_X509_sign(bio_err, ret,pkey,dgst, sigopts))
|
||||
goto err;
|
||||
|
||||
/* We now just add it to the database */
|
||||
@ -2233,13 +2263,14 @@ static void write_new_certificate(BIO *bp, X509 *x, int output_der, int notext)
|
||||
}
|
||||
|
||||
static int certify_spkac(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
|
||||
const EVP_MD *dgst, STACK_OF(CONF_VALUE) *policy, CA_DB *db,
|
||||
const EVP_MD *dgst, STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
STACK_OF(CONF_VALUE) *policy, CA_DB *db,
|
||||
BIGNUM *serial, char *subj,unsigned long chtype, int multirdn, int email_dn, char *startdate, char *enddate,
|
||||
long days, char *ext_sect, CONF *lconf, int verbose, unsigned long certopt,
|
||||
unsigned long nameopt, int default_op, int ext_copy)
|
||||
{
|
||||
STACK_OF(CONF_VALUE) *sk=NULL;
|
||||
LHASH *parms=NULL;
|
||||
LHASH_OF(CONF_VALUE) *parms=NULL;
|
||||
X509_REQ *req=NULL;
|
||||
CONF_VALUE *cv=NULL;
|
||||
NETSCAPE_SPKI *spki = NULL;
|
||||
@ -2359,9 +2390,9 @@ static int certify_spkac(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
|
||||
|
||||
X509_REQ_set_pubkey(req,pktmp);
|
||||
EVP_PKEY_free(pktmp);
|
||||
ok=do_body(xret,pkey,x509,dgst,policy,db,serial,subj,chtype,multirdn,email_dn,startdate,enddate,
|
||||
days,1,verbose,req,ext_sect,lconf, certopt, nameopt, default_op,
|
||||
ext_copy, 0);
|
||||
ok=do_body(xret,pkey,x509,dgst,sigopts,policy,db,serial,subj,chtype,
|
||||
multirdn,email_dn,startdate,enddate, days,1,verbose,req,
|
||||
ext_sect,lconf, certopt, nameopt, default_op, ext_copy, 0);
|
||||
err:
|
||||
if (req != NULL) X509_REQ_free(req);
|
||||
if (parms != NULL) CONF_free(parms);
|
||||
@ -2373,15 +2404,7 @@ static int certify_spkac(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
|
||||
|
||||
static int check_time_format(const char *str)
|
||||
{
|
||||
ASN1_TIME tm;
|
||||
|
||||
tm.data=(unsigned char *)str;
|
||||
tm.length=strlen(str);
|
||||
tm.type=V_ASN1_UTCTIME;
|
||||
if (ASN1_TIME_check(&tm))
|
||||
return 1;
|
||||
tm.type=V_ASN1_GENERALIZEDTIME;
|
||||
return ASN1_TIME_check(&tm);
|
||||
return ASN1_TIME_set_string(NULL, str);
|
||||
}
|
||||
|
||||
static int do_revoke(X509 *x509, CA_DB *db, int type, char *value)
|
||||
@ -2396,6 +2419,8 @@ static int do_revoke(X509 *x509, CA_DB *db, int type, char *value)
|
||||
row[i]=NULL;
|
||||
row[DB_name]=X509_NAME_oneline(X509_get_subject_name(x509),NULL,0);
|
||||
bn = ASN1_INTEGER_to_BN(X509_get_serialNumber(x509),NULL);
|
||||
if (!bn)
|
||||
goto err;
|
||||
if (BN_is_zero(bn))
|
||||
row[DB_serial]=BUF_strdup("00");
|
||||
else
|
||||
@ -2465,7 +2490,7 @@ static int do_revoke(X509 *x509, CA_DB *db, int type, char *value)
|
||||
goto err;
|
||||
|
||||
}
|
||||
else if (index_name_cmp((const char **)row,(const char **)rrow))
|
||||
else if (index_name_cmp_noconst(row, rrow))
|
||||
{
|
||||
BIO_printf(bio_err,"ERROR:name does not match %s\n",
|
||||
row[DB_name]);
|
||||
@ -2535,7 +2560,7 @@ static int get_certificate_status(const char *serial, CA_DB *db)
|
||||
|
||||
/* Make it Upper Case */
|
||||
for (i=0; row[DB_serial][i] != '\0'; i++)
|
||||
row[DB_serial][i] = toupper(row[DB_serial][i]);
|
||||
row[DB_serial][i] = toupper((unsigned char)row[DB_serial][i]);
|
||||
|
||||
|
||||
ok=1;
|
||||
@ -2614,9 +2639,9 @@ static int do_updatedb (CA_DB *db)
|
||||
else
|
||||
a_y2k = 0;
|
||||
|
||||
for (i = 0; i < sk_num(db->db->data); i++)
|
||||
for (i = 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++)
|
||||
{
|
||||
rrow = (char **) sk_value(db->db->data, i);
|
||||
rrow = sk_OPENSSL_PSTRING_value(db->db->data, i);
|
||||
|
||||
if (rrow[DB_type][0] == 'V')
|
||||
{
|
||||
@ -2863,22 +2888,13 @@ int old_entry_print(BIO *bp, ASN1_OBJECT *obj, ASN1_STRING *str)
|
||||
p=(char *)str->data;
|
||||
for (j=str->length; j>0; j--)
|
||||
{
|
||||
#ifdef CHARSET_EBCDIC
|
||||
if ((*p >= 0x20) && (*p <= 0x7e))
|
||||
BIO_printf(bp,"%c",os_toebcdic[*p]);
|
||||
#else
|
||||
if ((*p >= ' ') && (*p <= '~'))
|
||||
BIO_printf(bp,"%c",*p);
|
||||
#endif
|
||||
else if (*p & 0x80)
|
||||
BIO_printf(bp,"\\0x%02X",*p);
|
||||
else if ((unsigned char)*p == 0xf7)
|
||||
BIO_printf(bp,"^?");
|
||||
#ifdef CHARSET_EBCDIC
|
||||
else BIO_printf(bp,"^%c",os_toebcdic[*p+0x40]);
|
||||
#else
|
||||
else BIO_printf(bp,"^%c",*p+'@');
|
||||
#endif
|
||||
p++;
|
||||
}
|
||||
BIO_printf(bp,"'\n");
|
||||
|
@ -71,7 +71,8 @@
|
||||
|
||||
static const char *ciphers_usage[]={
|
||||
"usage: ciphers args\n",
|
||||
" -v - verbose mode, a textual listing of the ciphers in SSLeay\n",
|
||||
" -v - verbose mode, a textual listing of the SSL/TLS ciphers in OpenSSL\n",
|
||||
" -V - even more verbose\n",
|
||||
" -ssl2 - SSL2 mode\n",
|
||||
" -ssl3 - SSL3 mode\n",
|
||||
" -tls1 - TLS1 mode\n",
|
||||
@ -83,14 +84,14 @@ int MAIN(int, char **);
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
int ret=1,i;
|
||||
int verbose=0;
|
||||
int verbose=0,Verbose=0;
|
||||
const char **pp;
|
||||
const char *p;
|
||||
int badops=0;
|
||||
SSL_CTX *ctx=NULL;
|
||||
SSL *ssl=NULL;
|
||||
char *ciphers=NULL;
|
||||
SSL_METHOD *meth=NULL;
|
||||
const SSL_METHOD *meth=NULL;
|
||||
STACK_OF(SSL_CIPHER) *sk;
|
||||
char buf[512];
|
||||
BIO *STDout=NULL;
|
||||
@ -114,6 +115,8 @@ int MAIN(int argc, char **argv)
|
||||
STDout = BIO_push(tmpbio, STDout);
|
||||
}
|
||||
#endif
|
||||
if (!load_config(bio_err, NULL))
|
||||
goto end;
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
@ -121,6 +124,8 @@ int MAIN(int argc, char **argv)
|
||||
{
|
||||
if (strcmp(*argv,"-v") == 0)
|
||||
verbose=1;
|
||||
else if (strcmp(*argv,"-V") == 0)
|
||||
verbose=Verbose=1;
|
||||
#ifndef OPENSSL_NO_SSL2
|
||||
else if (strcmp(*argv,"-ssl2") == 0)
|
||||
meth=SSLv2_client_method();
|
||||
@ -179,15 +184,33 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
BIO_printf(STDout,"\n");
|
||||
}
|
||||
else
|
||||
else /* verbose */
|
||||
{
|
||||
sk=SSL_get_ciphers(ssl);
|
||||
|
||||
for (i=0; i<sk_SSL_CIPHER_num(sk); i++)
|
||||
{
|
||||
BIO_puts(STDout,SSL_CIPHER_description(
|
||||
sk_SSL_CIPHER_value(sk,i),
|
||||
buf,sizeof buf));
|
||||
SSL_CIPHER *c;
|
||||
|
||||
c = sk_SSL_CIPHER_value(sk,i);
|
||||
|
||||
if (Verbose)
|
||||
{
|
||||
unsigned long id = SSL_CIPHER_get_id(c);
|
||||
int id0 = (int)(id >> 24);
|
||||
int id1 = (int)((id >> 16) & 0xffL);
|
||||
int id2 = (int)((id >> 8) & 0xffL);
|
||||
int id3 = (int)(id & 0xffL);
|
||||
|
||||
if ((id & 0xff000000L) == 0x02000000L)
|
||||
BIO_printf(STDout, " 0x%02X,0x%02X,0x%02X - ", id1, id2, id3); /* SSL2 cipher */
|
||||
else if ((id & 0xff000000L) == 0x03000000L)
|
||||
BIO_printf(STDout, " 0x%02X,0x%02X - ", id2, id3); /* SSL3 cipher */
|
||||
else
|
||||
BIO_printf(STDout, "0x%02X,0x%02X,0x%02X,0x%02X - ", id0, id1, id2, id3); /* whatever */
|
||||
}
|
||||
|
||||
BIO_puts(STDout,SSL_CIPHER_description(c,buf,sizeof buf));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,24 +1,52 @@
|
||||
issuer= /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit)
|
||||
subject=/C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Client test cert (512 bit)
|
||||
subject= C = UK, O = OpenSSL Group, OU = FOR TESTING PURPOSES ONLY, CN = Test Client Cert
|
||||
issuer= C = UK, O = OpenSSL Group, OU = FOR TESTING PURPOSES ONLY, CN = OpenSSL Test Intermediate CA
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIB6TCCAVICAQIwDQYJKoZIhvcNAQEEBQAwWzELMAkGA1UEBhMCQVUxEzARBgNV
|
||||
BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRswGQYD
|
||||
VQQDExJUZXN0IENBICgxMDI0IGJpdCkwHhcNOTcwNjA5MTM1NzU2WhcNOTgwNjA5
|
||||
MTM1NzU2WjBjMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDEaMBgG
|
||||
A1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxIzAhBgNVBAMTGkNsaWVudCB0ZXN0IGNl
|
||||
cnQgKDUxMiBiaXQpMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALtv55QyzG6i2Plw
|
||||
Z1pah7++Gv8L5j6Hnyr/uTZE1NLG0ABDDexmq/R4KedLjFEIYjocDui+IXs62NNt
|
||||
XrT8odkCAwEAATANBgkqhkiG9w0BAQQFAAOBgQBwtMmI7oGUG8nKmftQssATViH5
|
||||
NRRtoEw07DxJp/LfatHdrhqQB73eGdL5WILZJXk46Xz2e9WMSUjVCSYhdKxtflU3
|
||||
UR2Ajv1Oo0sTNdfz0wDqJNirLNtzyhhsaq8qMTrLwXrCP31VxBiigFSQSUFnZyTE
|
||||
9TKwhS4GlwbtCfxSKQ==
|
||||
MIID5zCCAs+gAwIBAgIJALnu1NlVpZ6yMA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
|
||||
BAYTAlVLMRYwFAYDVQQKDA1PcGVuU1NMIEdyb3VwMSIwIAYDVQQLDBlGT1IgVEVT
|
||||
VElORyBQVVJQT1NFUyBPTkxZMSUwIwYDVQQDDBxPcGVuU1NMIFRlc3QgSW50ZXJt
|
||||
ZWRpYXRlIENBMB4XDTExMTIwODE0MDE0OFoXDTIxMTAxNjE0MDE0OFowZDELMAkG
|
||||
A1UEBhMCVUsxFjAUBgNVBAoMDU9wZW5TU0wgR3JvdXAxIjAgBgNVBAsMGUZPUiBU
|
||||
RVNUSU5HIFBVUlBPU0VTIE9OTFkxGTAXBgNVBAMMEFRlc3QgQ2xpZW50IENlcnQw
|
||||
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC0ranbHRLcLVqN+0BzcZpY
|
||||
+yOLqxzDWT1LD9eW1stC4NzXX9/DCtSIVyN7YIHdGLrIPr64IDdXXaMRzgZ2rOKs
|
||||
lmHCAiFpO/ja99gGCJRxH0xwQatqAULfJVHeUhs7OEGOZc2nWifjqKvGfNTilP7D
|
||||
nwi69ipQFq9oS19FmhwVHk2wg7KZGHI1qDyG04UrfCZMRitvS9+UVhPpIPjuiBi2
|
||||
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-----
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIBOwIBAAJBALtv55QyzG6i2PlwZ1pah7++Gv8L5j6Hnyr/uTZE1NLG0ABDDexm
|
||||
q/R4KedLjFEIYjocDui+IXs62NNtXrT8odkCAwEAAQJAbwXq0vJ/+uyEvsNgxLko
|
||||
/V86mGXQ/KrSkeKlL0r4ENxjcyeMAGoKu6J9yMY7+X9+Zm4nxShNfTsf/+Freoe1
|
||||
HQIhAPOSm5Q1YI+KIsII2GeVJx1U69+wnd71OasIPakS1L1XAiEAxQAW+J3/JWE0
|
||||
ftEYakbhUOKL8tD1OaFZS71/5GdG7E8CIQCefUMmySSvwd6kC0VlATSWbW+d+jp/
|
||||
nWmM1KvqnAo5uQIhALqEADu5U1Wvt8UN8UDGBRPQulHWNycuNV45d3nnskWPAiAw
|
||||
ueTyr6WsZ5+SD8g/Hy3xuvF3nPmJRH+rwvVihlcFOg==
|
||||
MIIEpQIBAAKCAQEAtK2p2x0S3C1ajftAc3GaWPsji6scw1k9Sw/XltbLQuDc11/f
|
||||
wwrUiFcje2CB3Ri6yD6+uCA3V12jEc4GdqzirJZhwgIhaTv42vfYBgiUcR9McEGr
|
||||
agFC3yVR3lIbOzhBjmXNp1on46irxnzU4pT+w58IuvYqUBavaEtfRZocFR5NsIOy
|
||||
mRhyNag8htOFK3wmTEYrb0vflFYT6SD47ogYtsd/xWSKS+YFyb7xSusR2Ot6Ktmr
|
||||
MswQE57QYJz+KiRVlnL0cduMBdT52Wm8blaC9mz50PyrzjQ68NyHapCoWDU7pe4x
|
||||
HLtzpXGSDMPuw4miiSwMym/2wReYJv6cFugLPQIDAQABAoIBAAZOyc9MhIwLSU4L
|
||||
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-----
|
||||
|
@ -71,8 +71,9 @@
|
||||
static int save_certs(char *signerfile, STACK_OF(X509) *signers);
|
||||
static int cms_cb(int ok, X509_STORE_CTX *ctx);
|
||||
static void receipt_request_print(BIO *out, CMS_ContentInfo *cms);
|
||||
static CMS_ReceiptRequest *make_receipt_request(STACK *rr_to, int rr_allorfirst,
|
||||
STACK *rr_from);
|
||||
static CMS_ReceiptRequest *make_receipt_request(STACK_OF(OPENSSL_STRING) *rr_to,
|
||||
int rr_allorfirst,
|
||||
STACK_OF(OPENSSL_STRING) *rr_from);
|
||||
|
||||
#define SMIME_OP 0x10
|
||||
#define SMIME_IP 0x20
|
||||
@ -94,6 +95,8 @@ static CMS_ReceiptRequest *make_receipt_request(STACK *rr_to, int rr_allorfirst,
|
||||
#define SMIME_SIGN_RECEIPT (15 | SMIME_IP | SMIME_OP)
|
||||
#define SMIME_VERIFY_RECEIPT (16 | SMIME_IP)
|
||||
|
||||
int verify_err = 0;
|
||||
|
||||
int MAIN(int, char **);
|
||||
|
||||
int MAIN(int argc, char **argv)
|
||||
@ -105,7 +108,7 @@ int MAIN(int argc, char **argv)
|
||||
const char *inmode = "r", *outmode = "w";
|
||||
char *infile = NULL, *outfile = NULL, *rctfile = NULL;
|
||||
char *signerfile = NULL, *recipfile = NULL;
|
||||
STACK *sksigners = NULL, *skkeys = NULL;
|
||||
STACK_OF(OPENSSL_STRING) *sksigners = NULL, *skkeys = NULL;
|
||||
char *certfile = NULL, *keyfile = NULL, *contfile=NULL;
|
||||
char *certsoutfile = NULL;
|
||||
const EVP_CIPHER *cipher = NULL;
|
||||
@ -116,9 +119,10 @@ int MAIN(int argc, char **argv)
|
||||
STACK_OF(X509) *encerts = NULL, *other = NULL;
|
||||
BIO *in = NULL, *out = NULL, *indata = NULL, *rctin = NULL;
|
||||
int badarg = 0;
|
||||
int flags = CMS_DETACHED;
|
||||
int flags = CMS_DETACHED, noout = 0, print = 0;
|
||||
int verify_retcode = 0;
|
||||
int rr_print = 0, rr_allorfirst = -1;
|
||||
STACK *rr_to = NULL, *rr_from = NULL;
|
||||
STACK_OF(OPENSSL_STRING) *rr_to = NULL, *rr_from = NULL;
|
||||
CMS_ReceiptRequest *rr = NULL;
|
||||
char *to = NULL, *from = NULL, *subject = NULL;
|
||||
char *CAfile = NULL, *CApath = NULL;
|
||||
@ -132,6 +136,7 @@ int MAIN(int argc, char **argv)
|
||||
char *engine=NULL;
|
||||
#endif
|
||||
unsigned char *secret_key = NULL, *secret_keyid = NULL;
|
||||
unsigned char *pwri_pass = NULL, *pwri_tmp = NULL;
|
||||
size_t secret_keylen = 0, secret_keyidlen = 0;
|
||||
|
||||
ASN1_OBJECT *econtent_type = NULL;
|
||||
@ -166,6 +171,8 @@ int MAIN(int argc, char **argv)
|
||||
operation = SMIME_RESIGN;
|
||||
else if (!strcmp (*args, "-verify"))
|
||||
operation = SMIME_VERIFY;
|
||||
else if (!strcmp (*args, "-verify_retcode"))
|
||||
verify_retcode = 1;
|
||||
else if (!strcmp(*args,"-verify_receipt"))
|
||||
{
|
||||
operation = SMIME_VERIFY_RECEIPT;
|
||||
@ -226,8 +233,6 @@ int MAIN(int argc, char **argv)
|
||||
else if (!strcmp(*args,"-camellia256"))
|
||||
cipher = EVP_camellia_256_cbc();
|
||||
#endif
|
||||
else if (!strcmp (*args, "-debug_decrypt"))
|
||||
flags |= CMS_DEBUG_DECRYPT;
|
||||
else if (!strcmp (*args, "-text"))
|
||||
flags |= CMS_TEXT;
|
||||
else if (!strcmp (*args, "-nointern"))
|
||||
@ -254,21 +259,17 @@ int MAIN(int argc, char **argv)
|
||||
else if (!strcmp (*args, "-no_attr_verify"))
|
||||
flags |= CMS_NO_ATTR_VERIFY;
|
||||
else if (!strcmp (*args, "-stream"))
|
||||
{
|
||||
args++;
|
||||
continue;
|
||||
}
|
||||
flags |= CMS_STREAM;
|
||||
else if (!strcmp (*args, "-indef"))
|
||||
{
|
||||
args++;
|
||||
continue;
|
||||
}
|
||||
flags |= CMS_STREAM;
|
||||
else if (!strcmp (*args, "-noindef"))
|
||||
flags &= ~CMS_STREAM;
|
||||
else if (!strcmp (*args, "-nooldmime"))
|
||||
flags |= CMS_NOOLDMIMETYPE;
|
||||
else if (!strcmp (*args, "-crlfeol"))
|
||||
flags |= CMS_CRLFEOL;
|
||||
else if (!strcmp (*args, "-noout"))
|
||||
noout = 1;
|
||||
else if (!strcmp (*args, "-receipt_request_print"))
|
||||
rr_print = 1;
|
||||
else if (!strcmp (*args, "-receipt_request_all"))
|
||||
@ -281,8 +282,8 @@ int MAIN(int argc, char **argv)
|
||||
goto argerr;
|
||||
args++;
|
||||
if (!rr_from)
|
||||
rr_from = sk_new_null();
|
||||
sk_push(rr_from, *args);
|
||||
rr_from = sk_OPENSSL_STRING_new_null();
|
||||
sk_OPENSSL_STRING_push(rr_from, *args);
|
||||
}
|
||||
else if (!strcmp(*args,"-receipt_request_to"))
|
||||
{
|
||||
@ -290,9 +291,14 @@ int MAIN(int argc, char **argv)
|
||||
goto argerr;
|
||||
args++;
|
||||
if (!rr_to)
|
||||
rr_to = sk_new_null();
|
||||
sk_push(rr_to, *args);
|
||||
rr_to = sk_OPENSSL_STRING_new_null();
|
||||
sk_OPENSSL_STRING_push(rr_to, *args);
|
||||
}
|
||||
else if (!strcmp (*args, "-print"))
|
||||
{
|
||||
noout = 1;
|
||||
print = 1;
|
||||
}
|
||||
else if (!strcmp(*args,"-secretkey"))
|
||||
{
|
||||
long ltmp;
|
||||
@ -321,6 +327,13 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
secret_keyidlen = (size_t)ltmp;
|
||||
}
|
||||
else if (!strcmp(*args,"-pwri_password"))
|
||||
{
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
args++;
|
||||
pwri_pass = (unsigned char *)*args;
|
||||
}
|
||||
else if (!strcmp(*args,"-econtent_type"))
|
||||
{
|
||||
if (!args[1])
|
||||
@ -382,13 +395,13 @@ int MAIN(int argc, char **argv)
|
||||
if (signerfile)
|
||||
{
|
||||
if (!sksigners)
|
||||
sksigners = sk_new_null();
|
||||
sk_push(sksigners, signerfile);
|
||||
sksigners = sk_OPENSSL_STRING_new_null();
|
||||
sk_OPENSSL_STRING_push(sksigners, signerfile);
|
||||
if (!keyfile)
|
||||
keyfile = signerfile;
|
||||
if (!skkeys)
|
||||
skkeys = sk_new_null();
|
||||
sk_push(skkeys, keyfile);
|
||||
skkeys = sk_OPENSSL_STRING_new_null();
|
||||
sk_OPENSSL_STRING_push(skkeys, keyfile);
|
||||
keyfile = NULL;
|
||||
}
|
||||
signerfile = *++args;
|
||||
@ -430,12 +443,12 @@ int MAIN(int argc, char **argv)
|
||||
goto argerr;
|
||||
}
|
||||
if (!sksigners)
|
||||
sksigners = sk_new_null();
|
||||
sk_push(sksigners, signerfile);
|
||||
sksigners = sk_OPENSSL_STRING_new_null();
|
||||
sk_OPENSSL_STRING_push(sksigners, signerfile);
|
||||
signerfile = NULL;
|
||||
if (!skkeys)
|
||||
skkeys = sk_new_null();
|
||||
sk_push(skkeys, keyfile);
|
||||
skkeys = sk_OPENSSL_STRING_new_null();
|
||||
sk_OPENSSL_STRING_push(skkeys, keyfile);
|
||||
}
|
||||
keyfile = *++args;
|
||||
}
|
||||
@ -534,13 +547,13 @@ int MAIN(int argc, char **argv)
|
||||
if (signerfile)
|
||||
{
|
||||
if (!sksigners)
|
||||
sksigners = sk_new_null();
|
||||
sk_push(sksigners, signerfile);
|
||||
sksigners = sk_OPENSSL_STRING_new_null();
|
||||
sk_OPENSSL_STRING_push(sksigners, signerfile);
|
||||
if (!skkeys)
|
||||
skkeys = sk_new_null();
|
||||
skkeys = sk_OPENSSL_STRING_new_null();
|
||||
if (!keyfile)
|
||||
keyfile = signerfile;
|
||||
sk_push(skkeys, keyfile);
|
||||
sk_OPENSSL_STRING_push(skkeys, keyfile);
|
||||
}
|
||||
if (!sksigners)
|
||||
{
|
||||
@ -554,7 +567,7 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
else if (operation == SMIME_DECRYPT)
|
||||
{
|
||||
if (!recipfile && !keyfile && !secret_key)
|
||||
if (!recipfile && !keyfile && !secret_key && !pwri_pass)
|
||||
{
|
||||
BIO_printf(bio_err, "No recipient certificate or key specified\n");
|
||||
badarg = 1;
|
||||
@ -562,7 +575,7 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
else if (operation == SMIME_ENCRYPT)
|
||||
{
|
||||
if (!*args && !secret_key)
|
||||
if (!*args && !secret_key && !pwri_pass)
|
||||
{
|
||||
BIO_printf(bio_err, "No recipient(s) certificate(s) specified\n");
|
||||
badarg = 1;
|
||||
@ -699,7 +712,7 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
if (secret_key && !secret_keyid)
|
||||
{
|
||||
BIO_printf(bio_err, "No sectre key id\n");
|
||||
BIO_printf(bio_err, "No secret key id\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -875,7 +888,7 @@ int MAIN(int argc, char **argv)
|
||||
{
|
||||
if (!(store = setup_verify(bio_err, CAfile, CApath)))
|
||||
goto end;
|
||||
X509_STORE_set_verify_cb_func(store, cms_cb);
|
||||
X509_STORE_set_verify_cb(store, cms_cb);
|
||||
if (vpm)
|
||||
X509_STORE_set1_param(store, vpm);
|
||||
}
|
||||
@ -912,6 +925,17 @@ int MAIN(int argc, char **argv)
|
||||
secret_key = NULL;
|
||||
secret_keyid = NULL;
|
||||
}
|
||||
if (pwri_pass)
|
||||
{
|
||||
pwri_tmp = (unsigned char *)BUF_strdup((char *)pwri_pass);
|
||||
if (!pwri_tmp)
|
||||
goto end;
|
||||
if (!CMS_add0_recipient_password(cms,
|
||||
-1, NID_undef, NID_undef,
|
||||
pwri_tmp, -1, NULL))
|
||||
goto end;
|
||||
pwri_tmp = NULL;
|
||||
}
|
||||
if (!(flags & CMS_STREAM))
|
||||
{
|
||||
if (!CMS_final(cms, in, NULL, flags))
|
||||
@ -975,11 +999,11 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
else
|
||||
flags |= CMS_REUSE_DIGEST;
|
||||
for (i = 0; i < sk_num(sksigners); i++)
|
||||
for (i = 0; i < sk_OPENSSL_STRING_num(sksigners); i++)
|
||||
{
|
||||
CMS_SignerInfo *si;
|
||||
signerfile = sk_value(sksigners, i);
|
||||
keyfile = sk_value(skkeys, i);
|
||||
signerfile = sk_OPENSSL_STRING_value(sksigners, i);
|
||||
keyfile = sk_OPENSSL_STRING_value(skkeys, i);
|
||||
signer = load_cert(bio_err, signerfile,FORMAT_PEM, NULL,
|
||||
e, "signer certificate");
|
||||
if (!signer)
|
||||
@ -1015,8 +1039,6 @@ int MAIN(int argc, char **argv)
|
||||
ret = 4;
|
||||
if (operation == SMIME_DECRYPT)
|
||||
{
|
||||
if (flags & CMS_DEBUG_DECRYPT)
|
||||
CMS_decrypt(cms, NULL, NULL, NULL, NULL, flags);
|
||||
|
||||
if (secret_key)
|
||||
{
|
||||
@ -1040,6 +1062,16 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (pwri_pass)
|
||||
{
|
||||
if (!CMS_decrypt_set1_password(cms, pwri_pass, -1))
|
||||
{
|
||||
BIO_puts(bio_err,
|
||||
"Error decrypting CMS using password\n");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (!CMS_decrypt(cms, NULL, NULL, indata, out, flags))
|
||||
{
|
||||
BIO_printf(bio_err, "Error decrypting CMS structure\n");
|
||||
@ -1079,6 +1111,8 @@ int MAIN(int argc, char **argv)
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_err, "Verification failure\n");
|
||||
if (verify_retcode)
|
||||
ret = verify_err + 32;
|
||||
goto end;
|
||||
}
|
||||
if (signerfile)
|
||||
@ -1111,7 +1145,12 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (outformat == FORMAT_SMIME)
|
||||
if (noout)
|
||||
{
|
||||
if (print)
|
||||
CMS_ContentInfo_print_ctx(out, cms, 0, NULL);
|
||||
}
|
||||
else if (outformat == FORMAT_SMIME)
|
||||
{
|
||||
if (to)
|
||||
BIO_printf(out, "To: %s\n", to);
|
||||
@ -1125,9 +1164,9 @@ int MAIN(int argc, char **argv)
|
||||
ret = SMIME_write_CMS(out, cms, in, flags);
|
||||
}
|
||||
else if (outformat == FORMAT_PEM)
|
||||
ret = PEM_write_bio_CMS(out, cms);
|
||||
ret = PEM_write_bio_CMS_stream(out, cms, in, flags);
|
||||
else if (outformat == FORMAT_ASN1)
|
||||
ret = i2d_CMS_bio(out,cms);
|
||||
ret = i2d_CMS_bio_stream(out,cms, in, flags);
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_err, "Bad output format for CMS file\n");
|
||||
@ -1150,21 +1189,23 @@ int MAIN(int argc, char **argv)
|
||||
if (vpm)
|
||||
X509_VERIFY_PARAM_free(vpm);
|
||||
if (sksigners)
|
||||
sk_free(sksigners);
|
||||
sk_OPENSSL_STRING_free(sksigners);
|
||||
if (skkeys)
|
||||
sk_free(skkeys);
|
||||
sk_OPENSSL_STRING_free(skkeys);
|
||||
if (secret_key)
|
||||
OPENSSL_free(secret_key);
|
||||
if (secret_keyid)
|
||||
OPENSSL_free(secret_keyid);
|
||||
if (pwri_tmp)
|
||||
OPENSSL_free(pwri_tmp);
|
||||
if (econtent_type)
|
||||
ASN1_OBJECT_free(econtent_type);
|
||||
if (rr)
|
||||
CMS_ReceiptRequest_free(rr);
|
||||
if (rr_to)
|
||||
sk_free(rr_to);
|
||||
sk_OPENSSL_STRING_free(rr_to);
|
||||
if (rr_from)
|
||||
sk_free(rr_from);
|
||||
sk_OPENSSL_STRING_free(rr_from);
|
||||
X509_STORE_free(store);
|
||||
X509_free(cert);
|
||||
X509_free(recip);
|
||||
@ -1203,6 +1244,8 @@ static int cms_cb(int ok, X509_STORE_CTX *ctx)
|
||||
|
||||
error = X509_STORE_CTX_get_error(ctx);
|
||||
|
||||
verify_err = error;
|
||||
|
||||
if ((error != X509_V_ERR_NO_EXPLICIT_POLICY)
|
||||
&& ((error != X509_V_OK) || (ok != 2)))
|
||||
return ok;
|
||||
@ -1284,7 +1327,7 @@ static void receipt_request_print(BIO *out, CMS_ContentInfo *cms)
|
||||
}
|
||||
}
|
||||
|
||||
static STACK_OF(GENERAL_NAMES) *make_names_stack(STACK *ns)
|
||||
static STACK_OF(GENERAL_NAMES) *make_names_stack(STACK_OF(OPENSSL_STRING) *ns)
|
||||
{
|
||||
int i;
|
||||
STACK_OF(GENERAL_NAMES) *ret;
|
||||
@ -1293,12 +1336,10 @@ static STACK_OF(GENERAL_NAMES) *make_names_stack(STACK *ns)
|
||||
ret = sk_GENERAL_NAMES_new_null();
|
||||
if (!ret)
|
||||
goto err;
|
||||
for (i = 0; i < sk_num(ns); i++)
|
||||
for (i = 0; i < sk_OPENSSL_STRING_num(ns); i++)
|
||||
{
|
||||
CONF_VALUE cnf;
|
||||
cnf.name = "email";
|
||||
cnf.value = sk_value(ns, i);
|
||||
gen = v2i_GENERAL_NAME(NULL, NULL, &cnf);
|
||||
char *str = sk_OPENSSL_STRING_value(ns, i);
|
||||
gen = a2i_GENERAL_NAME(NULL, NULL, NULL, GEN_EMAIL, str, 0);
|
||||
if (!gen)
|
||||
goto err;
|
||||
gens = GENERAL_NAMES_new();
|
||||
@ -1325,8 +1366,9 @@ static STACK_OF(GENERAL_NAMES) *make_names_stack(STACK *ns)
|
||||
}
|
||||
|
||||
|
||||
static CMS_ReceiptRequest *make_receipt_request(STACK *rr_to, int rr_allorfirst,
|
||||
STACK *rr_from)
|
||||
static CMS_ReceiptRequest *make_receipt_request(STACK_OF(OPENSSL_STRING) *rr_to,
|
||||
int rr_allorfirst,
|
||||
STACK_OF(OPENSSL_STRING) *rr_from)
|
||||
{
|
||||
STACK_OF(GENERAL_NAMES) *rct_to, *rct_from;
|
||||
CMS_ReceiptRequest *rr;
|
||||
|
@ -63,7 +63,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "apps.h"
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/evp.h>
|
||||
@ -93,7 +92,7 @@ int MAIN(int argc, char **argv)
|
||||
PKCS7 *p7 = NULL;
|
||||
PKCS7_SIGNED *p7s = NULL;
|
||||
X509_CRL *crl=NULL;
|
||||
STACK *certflst=NULL;
|
||||
STACK_OF(OPENSSL_STRING) *certflst=NULL;
|
||||
STACK_OF(X509_CRL) *crl_stack=NULL;
|
||||
STACK_OF(X509) *cert_stack=NULL;
|
||||
int ret=1,nocrl=0;
|
||||
@ -141,8 +140,8 @@ int MAIN(int argc, char **argv)
|
||||
else if (strcmp(*argv,"-certfile") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
if(!certflst) certflst = sk_new_null();
|
||||
sk_push(certflst,*(++argv));
|
||||
if(!certflst) certflst = sk_OPENSSL_STRING_new_null();
|
||||
sk_OPENSSL_STRING_push(certflst,*(++argv));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -227,8 +226,8 @@ int MAIN(int argc, char **argv)
|
||||
if ((cert_stack=sk_X509_new_null()) == NULL) goto end;
|
||||
p7s->cert=cert_stack;
|
||||
|
||||
if(certflst) for(i = 0; i < sk_num(certflst); i++) {
|
||||
certfile = sk_value(certflst, i);
|
||||
if(certflst) for(i = 0; i < sk_OPENSSL_STRING_num(certflst); i++) {
|
||||
certfile = sk_OPENSSL_STRING_value(certflst, i);
|
||||
if (add_certs_from_file(cert_stack,certfile) < 0)
|
||||
{
|
||||
BIO_printf(bio_err, "error loading certificates\n");
|
||||
@ -237,7 +236,7 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
sk_free(certflst);
|
||||
sk_OPENSSL_STRING_free(certflst);
|
||||
|
||||
if (outfile == NULL)
|
||||
{
|
||||
@ -295,19 +294,12 @@ int MAIN(int argc, char **argv)
|
||||
*/
|
||||
static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile)
|
||||
{
|
||||
struct stat st;
|
||||
BIO *in=NULL;
|
||||
int count=0;
|
||||
int ret= -1;
|
||||
STACK_OF(X509_INFO) *sk=NULL;
|
||||
X509_INFO *xi;
|
||||
|
||||
if ((stat(certfile,&st) != 0))
|
||||
{
|
||||
BIO_printf(bio_err,"unable to load the file, %s\n",certfile);
|
||||
goto end;
|
||||
}
|
||||
|
||||
in=BIO_new(BIO_s_file());
|
||||
if ((in == NULL) || (BIO_read_filename(in,certfile) <= 0))
|
||||
{
|
||||
|
@ -1,14 +0,0 @@
|
||||
subject=/C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server
|
||||
issuer= /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA
|
||||
-----BEGIN X509 CERTIFICATE-----
|
||||
|
||||
MIIBgjCCASwCAQQwDQYJKoZIhvcNAQEEBQAwODELMAkGA1UEBhMCQVUxDDAKBgNV
|
||||
BAgTA1FMRDEbMBkGA1UEAxMSU1NMZWF5L3JzYSB0ZXN0IENBMB4XDTk1MTAwOTIz
|
||||
MzIwNVoXDTk4MDcwNTIzMzIwNVowYDELMAkGA1UEBhMCQVUxDDAKBgNVBAgTA1FM
|
||||
RDEZMBcGA1UEChMQTWluY29tIFB0eS4gTHRkLjELMAkGA1UECxMCQ1MxGzAZBgNV
|
||||
BAMTElNTTGVheSBkZW1vIHNlcnZlcjBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC3
|
||||
LCXcScWua0PFLkHBLm2VejqpA1F4RQ8q0VjRiPafjx/Z/aWH3ipdMVvuJGa/wFXb
|
||||
/nDFLDlfWp+oCPwhBtVPAgMBAAEwDQYJKoZIhvcNAQEEBQADQQArNFsihWIjBzb0
|
||||
DCsU0BvL2bvSwJrPEqFlkDq3F4M6EGutL9axEcANWgbbEdAvNJD1dmEmoWny27Pn
|
||||
IMs6ZOZB
|
||||
-----END X509 CERTIFICATE-----
|
@ -1,39 +0,0 @@
|
||||
R 980705233205Z 951009233205Z 01 certs/00000001 /CN=Eric Young
|
||||
E 951009233205Z 02 certs/00000002 /CN=Duncan Young
|
||||
R 980705233205Z 951201010000Z 03 certs/00000003 /CN=Tim Hudson
|
||||
V 980705233205Z 04 certs/00000004 /CN=Eric Young4
|
||||
V 980705233205Z 05 certs/00000004 /CN=Eric Young5
|
||||
V 980705233205Z 06 certs/00000004 /CN=Eric Young6
|
||||
V 980705233205Z 07 certs/00000004 /CN=Eric Young7
|
||||
V 980705233205Z 08 certs/00000004 /CN=Eric Young8
|
||||
V 980705233205Z 09 certs/00000004 /CN=Eric Young9
|
||||
V 980705233205Z 0A certs/00000004 /CN=Eric YoungA
|
||||
V 980705233205Z 0B certs/00000004 /CN=Eric YoungB
|
||||
V 980705233205Z 0C certs/00000004 /CN=Eric YoungC
|
||||
V 980705233205Z 0D certs/00000004 /CN=Eric YoungD
|
||||
V 980705233205Z 0E certs/00000004 /CN=Eric YoungE
|
||||
V 980705233205Z 0F certs/00000004 /CN=Eric YoungF
|
||||
V 980705233205Z 10 certs/00000004 /CN=Eric Young10
|
||||
V 980705233205Z 11 certs/00000004 /CN=Eric Young11
|
||||
V 980705233205Z 12 certs/00000004 /CN=Eric Young12
|
||||
V 980705233205Z 13 certs/00000004 /CN=Eric Young13
|
||||
V 980705233205Z 14 certs/00000004 /CN=Eric Young14
|
||||
V 980705233205Z 15 certs/00000004 /CN=Eric Young15
|
||||
V 980705233205Z 16 certs/00000004 /CN=Eric Young16
|
||||
V 980705233205Z 17 certs/00000004 /CN=Eric Young17
|
||||
V 961206150305Z 010C unknown /C=AU/SP=QLD/O=Mincom Pty. Ltd./OU=MTR/CN=Eric Young/Email=eay@mincom.oz.au
|
||||
V 961206153245Z 010D unknown /C=AU/SP=Queensland/O=Mincom Pty Ltd/OU=MTR/CN=Eric Young/Email=eay@mincom.oz.au
|
||||
V 970322074816Z 010E unknown /CN=Eric Young/Email=eay@mincom.oz.au
|
||||
V 970322075152Z 010F unknown /CN=Eric Young
|
||||
V 970322075906Z 0110 unknown /CN=Eric Youngg
|
||||
V 970324092238Z 0111 unknown /C=AU/SP=Queensland/CN=Eric Young
|
||||
V 970324221931Z 0112 unknown /CN=Fred
|
||||
V 970324224934Z 0113 unknown /C=AU/CN=eay
|
||||
V 971001005237Z 0114 unknown /C=AU/SP=QLD/O=Mincom Pty Ltd/OU=MTR/CN=x509v3 test
|
||||
V 971001010331Z 0115 unknown /C=AU/SP=Queensland/O=Mincom Pty Ltd/OU=MTR/CN=test again - x509v3
|
||||
V 971001013945Z 0117 unknown /C=AU/SP=Queensland/O=Mincom Pty Ltd/OU=MTR/CN=x509v3 test
|
||||
V 971014225415Z 0118 unknown /C=AU/SP=Queensland/CN=test
|
||||
V 971015004448Z 0119 unknown /C=AU/SP=Queensland/O=Mincom Pty Ltd/OU=MTR/CN=test2
|
||||
V 971016035001Z 011A unknown /C=AU/SP=Queensland/O=Mincom Pty Ltd/OU=MTR/CN=test64
|
||||
V 971016080129Z 011B unknown /C=FR/O=ALCATEL/OU=Alcatel Mobile Phones/CN=bourque/Email=bourque@art.alcatel.fr
|
||||
V 971016224000Z 011D unknown /L=Bedford/O=Cranfield University/OU=Computer Centre/CN=Peter R Lister/Email=P.Lister@cranfield.ac.uk
|
@ -1,24 +0,0 @@
|
||||
issuer= /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA
|
||||
subject=/C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server
|
||||
-----BEGIN X509 CERTIFICATE-----
|
||||
|
||||
MIIBgjCCASwCAQQwDQYJKoZIhvcNAQEEBQAwODELMAkGA1UEBhMCQVUxDDAKBgNV
|
||||
BAgTA1FMRDEbMBkGA1UEAxMSU1NMZWF5L3JzYSB0ZXN0IENBMB4XDTk1MTAwOTIz
|
||||
MzIwNVoXDTk4MDcwNTIzMzIwNVowYDELMAkGA1UEBhMCQVUxDDAKBgNVBAgTA1FM
|
||||
RDEZMBcGA1UEChMQTWluY29tIFB0eS4gTHRkLjELMAkGA1UECxMCQ1MxGzAZBgNV
|
||||
BAMTElNTTGVheSBkZW1vIHNlcnZlcjBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC3
|
||||
LCXcScWua0PFLkHBLm2VejqpA1F4RQ8q0VjRiPafjx/Z/aWH3ipdMVvuJGa/wFXb
|
||||
/nDFLDlfWp+oCPwhBtVPAgMBAAEwDQYJKoZIhvcNAQEEBQADQQArNFsihWIjBzb0
|
||||
DCsU0BvL2bvSwJrPEqFlkDq3F4M6EGutL9axEcANWgbbEdAvNJD1dmEmoWny27Pn
|
||||
IMs6ZOZB
|
||||
-----END X509 CERTIFICATE-----
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
|
||||
MIIBPAIBAAJBALcsJdxJxa5rQ8UuQcEubZV6OqkDUXhFDyrRWNGI9p+PH9n9pYfe
|
||||
Kl0xW+4kZr/AVdv+cMUsOV9an6gI/CEG1U8CAwEAAQJAXJMBZ34ZXHd1vtgL/3hZ
|
||||
hexKbVTx/djZO4imXO/dxPGRzG2ylYZpHmG32/T1kaHpZlCHoEPgHoSzmxYXfxjG
|
||||
sQIhAPmZ/bQOjmRUHM/VM2X5zrjjM6z18R1P6l3ObFwt9FGdAiEAu943Yh9SqMRw
|
||||
tL0xHGxKmM/YJueUw1gB6sLkETN71NsCIQCeT3RhoqXfrpXDoEcEU+gwzjI1bpxq
|
||||
agiNTOLfqGoA5QIhAIQFYjgzONxex7FLrsKBm16N2SFl5pXsN9SpRqqL2n63AiEA
|
||||
g9VNIQ3xwpw7og3IbONifeku+J9qGMGQJMKwSTwrFtI=
|
||||
-----END RSA PRIVATE KEY-----
|
@ -1 +0,0 @@
|
||||
011E
|
@ -75,8 +75,29 @@
|
||||
#define PROG dgst_main
|
||||
|
||||
int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
|
||||
EVP_PKEY *key, unsigned char *sigin, int siglen, const char *title,
|
||||
const char *file,BIO *bmd,const char *hmac_key, int non_fips_allow);
|
||||
EVP_PKEY *key, unsigned char *sigin, int siglen,
|
||||
const char *sig_name, const char *md_name,
|
||||
const char *file,BIO *bmd);
|
||||
|
||||
static void list_md_fn(const EVP_MD *m,
|
||||
const char *from, const char *to, void *arg)
|
||||
{
|
||||
const char *mname;
|
||||
/* Skip aliases */
|
||||
if (!m)
|
||||
return;
|
||||
mname = OBJ_nid2ln(EVP_MD_type(m));
|
||||
/* Skip shortnames */
|
||||
if (strcmp(from, mname))
|
||||
return;
|
||||
/* Skip clones */
|
||||
if (EVP_MD_flags(m) & EVP_MD_FLAG_PKEY_DIGEST)
|
||||
return;
|
||||
if (strchr(mname, ' '))
|
||||
mname= EVP_MD_name(m);
|
||||
BIO_printf(arg, "-%-14s to use the %s message digest algorithm\n",
|
||||
mname, mname);
|
||||
}
|
||||
|
||||
int MAIN(int, char **);
|
||||
|
||||
@ -89,7 +110,6 @@ int MAIN(int argc, char **argv)
|
||||
BIO *in=NULL,*inp;
|
||||
BIO *bmd=NULL;
|
||||
BIO *out = NULL;
|
||||
const char *name;
|
||||
#define PROG_NAME_SIZE 39
|
||||
char pname[PROG_NAME_SIZE+1];
|
||||
int separator=0;
|
||||
@ -101,16 +121,17 @@ int MAIN(int argc, char **argv)
|
||||
EVP_PKEY *sigkey = NULL;
|
||||
unsigned char *sigbuf = NULL;
|
||||
int siglen = 0;
|
||||
unsigned int sig_flags = 0;
|
||||
char *passargin = NULL, *passin = NULL;
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
char *engine=NULL;
|
||||
#endif
|
||||
char *hmac_key=NULL;
|
||||
char *mac_name=NULL;
|
||||
int non_fips_allow = 0;
|
||||
STACK_OF(OPENSSL_STRING) *sigopts = NULL, *macopts = NULL;
|
||||
|
||||
apps_startup();
|
||||
ERR_load_crypto_strings();
|
||||
|
||||
if ((buf=(unsigned char *)OPENSSL_malloc(BUFSIZE)) == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"out of memory\n");
|
||||
@ -135,6 +156,8 @@ ERR_load_crypto_strings();
|
||||
if ((*argv)[0] != '-') break;
|
||||
if (strcmp(*argv,"-c") == 0)
|
||||
separator=1;
|
||||
else if (strcmp(*argv,"-r") == 0)
|
||||
separator=2;
|
||||
else if (strcmp(*argv,"-rand") == 0)
|
||||
{
|
||||
if (--argc < 1) break;
|
||||
@ -169,27 +192,6 @@ ERR_load_crypto_strings();
|
||||
keyfile=*(++argv);
|
||||
do_verify = 1;
|
||||
}
|
||||
else if (strcmp(*argv,"-x931") == 0)
|
||||
sig_flags = EVP_MD_CTX_FLAG_PAD_X931;
|
||||
else if (strcmp(*argv,"-pss_saltlen") == 0)
|
||||
{
|
||||
int saltlen;
|
||||
if (--argc < 1) break;
|
||||
saltlen=atoi(*(++argv));
|
||||
if (saltlen == -1)
|
||||
sig_flags = EVP_MD_CTX_FLAG_PSS_MREC;
|
||||
else if (saltlen == -2)
|
||||
sig_flags = EVP_MD_CTX_FLAG_PSS_MDLEN;
|
||||
else if (saltlen < -2 || saltlen >= 0xFFFE)
|
||||
{
|
||||
BIO_printf(bio_err, "Invalid PSS salt length %d\n", saltlen);
|
||||
goto end;
|
||||
}
|
||||
else
|
||||
sig_flags = saltlen;
|
||||
sig_flags <<= 16;
|
||||
sig_flags |= EVP_MD_CTX_FLAG_PAD_PSS;
|
||||
}
|
||||
else if (strcmp(*argv,"-signature") == 0)
|
||||
{
|
||||
if (--argc < 1) break;
|
||||
@ -205,6 +207,7 @@ ERR_load_crypto_strings();
|
||||
{
|
||||
if (--argc < 1) break;
|
||||
engine= *(++argv);
|
||||
e = setup_engine(bio_err, engine, 0);
|
||||
}
|
||||
#endif
|
||||
else if (strcmp(*argv,"-hex") == 0)
|
||||
@ -223,6 +226,30 @@ ERR_load_crypto_strings();
|
||||
break;
|
||||
hmac_key=*++argv;
|
||||
}
|
||||
else if (!strcmp(*argv,"-mac"))
|
||||
{
|
||||
if (--argc < 1)
|
||||
break;
|
||||
mac_name=*++argv;
|
||||
}
|
||||
else if (strcmp(*argv,"-sigopt") == 0)
|
||||
{
|
||||
if (--argc < 1)
|
||||
break;
|
||||
if (!sigopts)
|
||||
sigopts = sk_OPENSSL_STRING_new_null();
|
||||
if (!sigopts || !sk_OPENSSL_STRING_push(sigopts, *(++argv)))
|
||||
break;
|
||||
}
|
||||
else if (strcmp(*argv,"-macopt") == 0)
|
||||
{
|
||||
if (--argc < 1)
|
||||
break;
|
||||
if (!macopts)
|
||||
macopts = sk_OPENSSL_STRING_new_null();
|
||||
if (!macopts || !sk_OPENSSL_STRING_push(macopts, *(++argv)))
|
||||
break;
|
||||
}
|
||||
else if ((m=EVP_get_digestbyname(&((*argv)[1]))) != NULL)
|
||||
md=m;
|
||||
else
|
||||
@ -231,12 +258,9 @@ ERR_load_crypto_strings();
|
||||
argv++;
|
||||
}
|
||||
|
||||
if (md == NULL)
|
||||
md=EVP_md5();
|
||||
|
||||
if(do_verify && !sigfile) {
|
||||
BIO_printf(bio_err, "No signature to verify: use the -signature option\n");
|
||||
err = 1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -245,6 +269,7 @@ ERR_load_crypto_strings();
|
||||
BIO_printf(bio_err,"unknown option '%s'\n",*argv);
|
||||
BIO_printf(bio_err,"options are\n");
|
||||
BIO_printf(bio_err,"-c to output the digest with separating colons\n");
|
||||
BIO_printf(bio_err,"-r to output the digest in coreutils format\n");
|
||||
BIO_printf(bio_err,"-d to output debug info\n");
|
||||
BIO_printf(bio_err,"-hex output as hex dump\n");
|
||||
BIO_printf(bio_err,"-binary output in binary form\n");
|
||||
@ -252,49 +277,20 @@ ERR_load_crypto_strings();
|
||||
BIO_printf(bio_err,"-verify file verify a signature using public key in file\n");
|
||||
BIO_printf(bio_err,"-prverify file verify a signature using private key in file\n");
|
||||
BIO_printf(bio_err,"-keyform arg key file format (PEM or ENGINE)\n");
|
||||
BIO_printf(bio_err,"-out filename output to filename rather than stdout\n");
|
||||
BIO_printf(bio_err,"-signature file signature to verify\n");
|
||||
BIO_printf(bio_err,"-binary output in binary form\n");
|
||||
BIO_printf(bio_err,"-sigopt nm:v signature parameter\n");
|
||||
BIO_printf(bio_err,"-hmac key create hashed MAC with key\n");
|
||||
BIO_printf(bio_err,"-mac algorithm create MAC (not neccessarily HMAC)\n");
|
||||
BIO_printf(bio_err,"-macopt nm:v MAC algorithm parameters or key\n");
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
BIO_printf(bio_err,"-engine e use engine e, possibly a hardware device.\n");
|
||||
#endif
|
||||
|
||||
BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm (default)\n",
|
||||
LN_md5,LN_md5);
|
||||
BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
|
||||
LN_md4,LN_md4);
|
||||
BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
|
||||
LN_md2,LN_md2);
|
||||
#ifndef OPENSSL_NO_SHA
|
||||
BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
|
||||
LN_sha1,LN_sha1);
|
||||
BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
|
||||
LN_sha,LN_sha);
|
||||
#ifndef OPENSSL_NO_SHA256
|
||||
BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
|
||||
LN_sha224,LN_sha224);
|
||||
BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
|
||||
LN_sha256,LN_sha256);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SHA512
|
||||
BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
|
||||
LN_sha384,LN_sha384);
|
||||
BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
|
||||
LN_sha512,LN_sha512);
|
||||
#endif
|
||||
#endif
|
||||
BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
|
||||
LN_mdc2,LN_mdc2);
|
||||
BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
|
||||
LN_ripemd160,LN_ripemd160);
|
||||
err=1;
|
||||
EVP_MD_do_all_sorted(list_md_fn, bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
e = setup_engine(bio_err, engine, 0);
|
||||
#endif
|
||||
|
||||
in=BIO_new(BIO_s_file());
|
||||
bmd=BIO_new(BIO_f_md());
|
||||
if (debug)
|
||||
@ -317,8 +313,10 @@ ERR_load_crypto_strings();
|
||||
}
|
||||
|
||||
if(out_bin == -1) {
|
||||
if(keyfile) out_bin = 1;
|
||||
else out_bin = 0;
|
||||
if(keyfile)
|
||||
out_bin = 1;
|
||||
else
|
||||
out_bin = 0;
|
||||
}
|
||||
|
||||
if(randfile)
|
||||
@ -344,6 +342,11 @@ ERR_load_crypto_strings();
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
if ((!!mac_name + !!keyfile + !!hmac_key) > 1)
|
||||
{
|
||||
BIO_printf(bio_err, "MAC and Signing key cannot both be specified\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if(keyfile)
|
||||
{
|
||||
@ -361,6 +364,108 @@ ERR_load_crypto_strings();
|
||||
}
|
||||
}
|
||||
|
||||
if (mac_name)
|
||||
{
|
||||
EVP_PKEY_CTX *mac_ctx = NULL;
|
||||
int r = 0;
|
||||
if (!init_gen_str(bio_err, &mac_ctx, mac_name,e, 0))
|
||||
goto mac_end;
|
||||
if (macopts)
|
||||
{
|
||||
char *macopt;
|
||||
for (i = 0; i < sk_OPENSSL_STRING_num(macopts); i++)
|
||||
{
|
||||
macopt = sk_OPENSSL_STRING_value(macopts, i);
|
||||
if (pkey_ctrl_string(mac_ctx, macopt) <= 0)
|
||||
{
|
||||
BIO_printf(bio_err,
|
||||
"MAC parameter error \"%s\"\n",
|
||||
macopt);
|
||||
ERR_print_errors(bio_err);
|
||||
goto mac_end;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (EVP_PKEY_keygen(mac_ctx, &sigkey) <= 0)
|
||||
{
|
||||
BIO_puts(bio_err, "Error generating key\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto mac_end;
|
||||
}
|
||||
r = 1;
|
||||
mac_end:
|
||||
if (mac_ctx)
|
||||
EVP_PKEY_CTX_free(mac_ctx);
|
||||
if (r == 0)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (non_fips_allow)
|
||||
{
|
||||
EVP_MD_CTX *md_ctx;
|
||||
BIO_get_md_ctx(bmd,&md_ctx);
|
||||
EVP_MD_CTX_set_flags(md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
|
||||
}
|
||||
|
||||
if (hmac_key)
|
||||
{
|
||||
sigkey = EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, e,
|
||||
(unsigned char *)hmac_key, -1);
|
||||
if (!sigkey)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (sigkey)
|
||||
{
|
||||
EVP_MD_CTX *mctx = NULL;
|
||||
EVP_PKEY_CTX *pctx = NULL;
|
||||
int r;
|
||||
if (!BIO_get_md_ctx(bmd, &mctx))
|
||||
{
|
||||
BIO_printf(bio_err, "Error getting context\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
if (do_verify)
|
||||
r = EVP_DigestVerifyInit(mctx, &pctx, md, e, sigkey);
|
||||
else
|
||||
r = EVP_DigestSignInit(mctx, &pctx, md, e, sigkey);
|
||||
if (!r)
|
||||
{
|
||||
BIO_printf(bio_err, "Error setting context\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
if (sigopts)
|
||||
{
|
||||
char *sigopt;
|
||||
for (i = 0; i < sk_OPENSSL_STRING_num(sigopts); i++)
|
||||
{
|
||||
sigopt = sk_OPENSSL_STRING_value(sigopts, i);
|
||||
if (pkey_ctrl_string(pctx, sigopt) <= 0)
|
||||
{
|
||||
BIO_printf(bio_err,
|
||||
"parameter error \"%s\"\n",
|
||||
sigopt);
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* we use md as a filter, reading from 'in' */
|
||||
else
|
||||
{
|
||||
if (md == NULL)
|
||||
md = EVP_md5();
|
||||
if (!BIO_set_md(bmd,md))
|
||||
{
|
||||
BIO_printf(bio_err, "Error setting digest %s\n", pname);
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if(sigfile && sigkey) {
|
||||
BIO *sigbio;
|
||||
sigbio = BIO_new_file(sigfile, "rb");
|
||||
@ -381,67 +486,51 @@ ERR_load_crypto_strings();
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (non_fips_allow)
|
||||
{
|
||||
EVP_MD_CTX *md_ctx;
|
||||
BIO_get_md_ctx(bmd,&md_ctx);
|
||||
EVP_MD_CTX_set_flags(md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
|
||||
}
|
||||
|
||||
if (sig_flags)
|
||||
{
|
||||
EVP_MD_CTX *md_ctx;
|
||||
BIO_get_md_ctx(bmd,&md_ctx);
|
||||
EVP_MD_CTX_set_flags(md_ctx, sig_flags);
|
||||
}
|
||||
|
||||
/* we use md as a filter, reading from 'in' */
|
||||
if (!BIO_set_md(bmd,md))
|
||||
{
|
||||
BIO_printf(bio_err, "Error setting digest %s\n", pname);
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
inp=BIO_push(bmd,in);
|
||||
|
||||
if (md == NULL)
|
||||
{
|
||||
EVP_MD_CTX *tctx;
|
||||
BIO_get_md_ctx(bmd, &tctx);
|
||||
md = EVP_MD_CTX_md(tctx);
|
||||
}
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
BIO_set_fp(in,stdin,BIO_NOCLOSE);
|
||||
err=do_fp(out, buf,inp,separator, out_bin, sigkey, sigbuf,
|
||||
siglen,"","(stdin)",bmd,hmac_key,non_fips_allow);
|
||||
siglen,NULL,NULL,"stdin",bmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
name=OBJ_nid2sn(md->type);
|
||||
const char *md_name = NULL, *sig_name = NULL;
|
||||
if(!out_bin)
|
||||
{
|
||||
if (sigkey)
|
||||
{
|
||||
const EVP_PKEY_ASN1_METHOD *ameth;
|
||||
ameth = EVP_PKEY_get0_asn1(sigkey);
|
||||
if (ameth)
|
||||
EVP_PKEY_asn1_get0_info(NULL, NULL,
|
||||
NULL, NULL, &sig_name, ameth);
|
||||
}
|
||||
md_name = EVP_MD_name(md);
|
||||
}
|
||||
err = 0;
|
||||
for (i=0; i<argc; i++)
|
||||
{
|
||||
char *tmp,*tofree=NULL;
|
||||
int r;
|
||||
|
||||
if (BIO_read_filename(in,argv[i]) <= 0)
|
||||
{
|
||||
perror(argv[i]);
|
||||
err++;
|
||||
continue;
|
||||
}
|
||||
if(!out_bin)
|
||||
{
|
||||
size_t len = strlen(name)+strlen(argv[i])+(hmac_key ? 5 : 0)+5;
|
||||
tmp=tofree=OPENSSL_malloc(len);
|
||||
BIO_snprintf(tmp,len,"%s%s(%s)= ",
|
||||
hmac_key ? "HMAC-" : "",name,argv[i]);
|
||||
}
|
||||
else
|
||||
tmp="";
|
||||
r=do_fp(out,buf,inp,separator,out_bin,sigkey,sigbuf,
|
||||
siglen,tmp,argv[i],bmd,hmac_key,non_fips_allow);
|
||||
siglen,sig_name,md_name, argv[i],bmd);
|
||||
if(r)
|
||||
err=r;
|
||||
if(tofree)
|
||||
OPENSSL_free(tofree);
|
||||
(void)BIO_reset(bmd);
|
||||
}
|
||||
}
|
||||
@ -456,6 +545,10 @@ ERR_load_crypto_strings();
|
||||
OPENSSL_free(passin);
|
||||
BIO_free_all(out);
|
||||
EVP_PKEY_free(sigkey);
|
||||
if (sigopts)
|
||||
sk_OPENSSL_STRING_free(sigopts);
|
||||
if (macopts)
|
||||
sk_OPENSSL_STRING_free(macopts);
|
||||
if(sigbuf) OPENSSL_free(sigbuf);
|
||||
if (bmd != NULL) BIO_free(bmd);
|
||||
apps_shutdown();
|
||||
@ -463,24 +556,13 @@ ERR_load_crypto_strings();
|
||||
}
|
||||
|
||||
int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
|
||||
EVP_PKEY *key, unsigned char *sigin, int siglen, const char *title,
|
||||
const char *file,BIO *bmd,const char *hmac_key,int non_fips_allow)
|
||||
EVP_PKEY *key, unsigned char *sigin, int siglen,
|
||||
const char *sig_name, const char *md_name,
|
||||
const char *file,BIO *bmd)
|
||||
{
|
||||
unsigned int len;
|
||||
size_t len;
|
||||
int i;
|
||||
EVP_MD_CTX *md_ctx;
|
||||
HMAC_CTX hmac_ctx;
|
||||
|
||||
if (hmac_key)
|
||||
{
|
||||
EVP_MD *md;
|
||||
|
||||
BIO_get_md(bmd,&md);
|
||||
HMAC_CTX_init(&hmac_ctx);
|
||||
HMAC_Init_ex(&hmac_ctx,hmac_key,strlen(hmac_key),md, NULL);
|
||||
BIO_get_md_ctx(bmd,&md_ctx);
|
||||
BIO_set_md_ctx(bmd,&hmac_ctx.md_ctx);
|
||||
}
|
||||
for (;;)
|
||||
{
|
||||
i=BIO_read(bp,(char *)buf,BUFSIZE);
|
||||
@ -496,7 +578,7 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
|
||||
{
|
||||
EVP_MD_CTX *ctx;
|
||||
BIO_get_md_ctx(bp, &ctx);
|
||||
i = EVP_VerifyFinal(ctx, sigin, (unsigned int)siglen, key);
|
||||
i = EVP_DigestVerifyFinal(ctx, sigin, (unsigned int)siglen);
|
||||
if(i > 0)
|
||||
BIO_printf(out, "Verified OK\n");
|
||||
else if(i == 0)
|
||||
@ -516,25 +598,39 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
|
||||
{
|
||||
EVP_MD_CTX *ctx;
|
||||
BIO_get_md_ctx(bp, &ctx);
|
||||
if(!EVP_SignFinal(ctx, buf, (unsigned int *)&len, key))
|
||||
len = BUFSIZE;
|
||||
if(!EVP_DigestSignFinal(ctx, buf, &len))
|
||||
{
|
||||
BIO_printf(bio_err, "Error Signing Data\n");
|
||||
ERR_print_errors(bio_err);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if(hmac_key)
|
||||
{
|
||||
HMAC_Final(&hmac_ctx,buf,&len);
|
||||
HMAC_CTX_cleanup(&hmac_ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
len=BIO_gets(bp,(char *)buf,BUFSIZE);
|
||||
if ((int)len <0)
|
||||
{
|
||||
ERR_print_errors(bio_err);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(binout) BIO_write(out, buf, len);
|
||||
else if (sep == 2)
|
||||
{
|
||||
for (i=0; i<(int)len; i++)
|
||||
BIO_printf(out, "%02x",buf[i]);
|
||||
BIO_printf(out, " *%s\n", file);
|
||||
}
|
||||
else
|
||||
{
|
||||
BIO_write(out,title,strlen(title));
|
||||
if (sig_name)
|
||||
BIO_printf(out, "%s-%s(%s)= ", sig_name, md_name, file);
|
||||
else if (md_name)
|
||||
BIO_printf(out, "%s(%s)= ", md_name, file);
|
||||
else
|
||||
BIO_printf(out, "(%s)= ", file);
|
||||
for (i=0; i<(int)len; i++)
|
||||
{
|
||||
if (sep && (i != 0))
|
||||
@ -543,10 +639,6 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
|
||||
}
|
||||
BIO_printf(out, "\n");
|
||||
}
|
||||
if (hmac_key)
|
||||
{
|
||||
BIO_set_md_ctx(bmd,md_ctx);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -346,4 +346,10 @@ int MAIN(int argc, char **argv)
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
#else /* !OPENSSL_NO_DH */
|
||||
|
||||
# if PEDANTIC
|
||||
static void *dummy=&dummy;
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
@ -551,4 +551,10 @@ static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else /* !OPENSSL_NO_DH */
|
||||
|
||||
# if PEDANTIC
|
||||
static void *dummy=&dummy;
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
@ -65,11 +65,11 @@
|
||||
#include "apps.h"
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/dsa.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/dsa.h>
|
||||
|
||||
#undef PROG
|
||||
#define PROG dsa_main
|
||||
@ -112,6 +112,8 @@ int MAIN(int argc, char **argv)
|
||||
char *passin = NULL, *passout = NULL;
|
||||
int modulus=0;
|
||||
|
||||
int pvk_encr = 2;
|
||||
|
||||
apps_startup();
|
||||
|
||||
if (bio_err == NULL)
|
||||
@ -171,6 +173,12 @@ int MAIN(int argc, char **argv)
|
||||
engine= *(++argv);
|
||||
}
|
||||
#endif
|
||||
else if (strcmp(*argv,"-pvk-strong") == 0)
|
||||
pvk_encr=2;
|
||||
else if (strcmp(*argv,"-pvk-weak") == 0)
|
||||
pvk_encr=1;
|
||||
else if (strcmp(*argv,"-pvk-none") == 0)
|
||||
pvk_encr=0;
|
||||
else if (strcmp(*argv,"-noout") == 0)
|
||||
noout=1;
|
||||
else if (strcmp(*argv,"-text") == 0)
|
||||
@ -238,16 +246,30 @@ int MAIN(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
in=BIO_new(BIO_s_file());
|
||||
out=BIO_new(BIO_s_file());
|
||||
if (out == NULL)
|
||||
if ((in == NULL) || (out == 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;
|
||||
}
|
||||
}
|
||||
|
||||
BIO_printf(bio_err,"read DSA key\n");
|
||||
{
|
||||
|
||||
{
|
||||
EVP_PKEY *pkey;
|
||||
|
||||
if (pubin)
|
||||
pkey = load_pubkey(bio_err, infile, informat, 1,
|
||||
passin, e, "Public Key");
|
||||
@ -255,10 +277,12 @@ int MAIN(int argc, char **argv)
|
||||
pkey = load_key(bio_err, infile, informat, 1,
|
||||
passin, e, "Private Key");
|
||||
|
||||
if (pkey != NULL)
|
||||
dsa = pkey == NULL ? NULL : EVP_PKEY_get1_DSA(pkey);
|
||||
EVP_PKEY_free(pkey);
|
||||
}
|
||||
if (pkey)
|
||||
{
|
||||
dsa = EVP_PKEY_get1_DSA(pkey);
|
||||
EVP_PKEY_free(pkey);
|
||||
}
|
||||
}
|
||||
if (dsa == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"unable to load Key\n");
|
||||
@ -310,11 +334,24 @@ int MAIN(int argc, char **argv)
|
||||
i=PEM_write_bio_DSA_PUBKEY(out,dsa);
|
||||
else i=PEM_write_bio_DSAPrivateKey(out,dsa,enc,
|
||||
NULL,0,NULL, passout);
|
||||
#if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_RC4)
|
||||
} else if (outformat == FORMAT_MSBLOB || outformat == FORMAT_PVK) {
|
||||
EVP_PKEY *pk;
|
||||
pk = EVP_PKEY_new();
|
||||
EVP_PKEY_set1_DSA(pk, dsa);
|
||||
if (outformat == FORMAT_PVK)
|
||||
i = i2b_PVK_bio(out, pk, pvk_encr, 0, passout);
|
||||
else if (pubin || pubout)
|
||||
i = i2b_PublicKey_bio(out, pk);
|
||||
else
|
||||
i = i2b_PrivateKey_bio(out, pk);
|
||||
EVP_PKEY_free(pk);
|
||||
#endif
|
||||
} else {
|
||||
BIO_printf(bio_err,"bad output format specified for outfile\n");
|
||||
goto end;
|
||||
}
|
||||
if (!i)
|
||||
if (i <= 0)
|
||||
{
|
||||
BIO_printf(bio_err,"unable to write private key\n");
|
||||
ERR_print_errors(bio_err);
|
||||
@ -330,4 +367,10 @@ int MAIN(int argc, char **argv)
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
#else /* !OPENSSL_NO_DSA */
|
||||
|
||||
# if PEDANTIC
|
||||
static void *dummy=&dummy;
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
@ -397,4 +397,10 @@ int MAIN(int argc, char **argv)
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
#else /* !OPENSSL_NO_EC */
|
||||
|
||||
# if PEDANTIC
|
||||
static void *dummy=&dummy;
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
@ -722,4 +722,10 @@ static int ecparam_print_var(BIO *out, BIGNUM *in, const char *var,
|
||||
BIO_printf(out, "\n\t};\n\n");
|
||||
return 1;
|
||||
}
|
||||
#else /* !OPENSSL_NO_EC */
|
||||
|
||||
# if PEDANTIC
|
||||
static void *dummy=&dummy;
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
@ -67,6 +67,7 @@
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/comp.h>
|
||||
#include <ctype.h>
|
||||
|
||||
int set_hex(char *in,unsigned char *out,int size);
|
||||
@ -113,6 +114,10 @@ int MAIN(int argc, char **argv)
|
||||
char *hkey=NULL,*hiv=NULL,*hsalt = NULL;
|
||||
char *md=NULL;
|
||||
int enc=1,printkey=0,i,base64=0;
|
||||
#ifdef ZLIB
|
||||
int do_zlib=0;
|
||||
BIO *bzl = NULL;
|
||||
#endif
|
||||
int debug=0,olb64=0,nosalt=0;
|
||||
const EVP_CIPHER *cipher=NULL,*c;
|
||||
EVP_CIPHER_CTX *ctx = NULL;
|
||||
@ -139,9 +144,18 @@ int MAIN(int argc, char **argv)
|
||||
program_name(argv[0],pname,sizeof pname);
|
||||
if (strcmp(pname,"base64") == 0)
|
||||
base64=1;
|
||||
#ifdef ZLIB
|
||||
if (strcmp(pname,"zlib") == 0)
|
||||
do_zlib=1;
|
||||
#endif
|
||||
|
||||
cipher=EVP_get_cipherbyname(pname);
|
||||
#ifdef ZLIB
|
||||
if (!do_zlib && !base64 && (cipher == NULL)
|
||||
&& (strcmp(pname,"enc") != 0))
|
||||
#else
|
||||
if (!base64 && (cipher == NULL) && (strcmp(pname,"enc") != 0))
|
||||
#endif
|
||||
{
|
||||
BIO_printf(bio_err,"%s is an unknown cipher\n",pname);
|
||||
goto bad;
|
||||
@ -197,6 +211,10 @@ int MAIN(int argc, char **argv)
|
||||
base64=1;
|
||||
else if (strcmp(*argv,"-base64") == 0)
|
||||
base64=1;
|
||||
#ifdef ZLIB
|
||||
else if (strcmp(*argv,"-z") == 0)
|
||||
do_zlib=1;
|
||||
#endif
|
||||
else if (strcmp(*argv,"-bufsize") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
@ -288,9 +306,11 @@ int MAIN(int argc, char **argv)
|
||||
BIO_printf(bio_err,"%-14s passphrase is the first line of the file argument\n","-kfile");
|
||||
BIO_printf(bio_err,"%-14s the next argument is the md to use to create a key\n","-md");
|
||||
BIO_printf(bio_err,"%-14s from a passphrase. One of md2, md5, sha or sha1\n","");
|
||||
BIO_printf(bio_err,"%-14s salt in hex is the next argument\n","-S");
|
||||
BIO_printf(bio_err,"%-14s key/iv in hex is the next argument\n","-K/-iv");
|
||||
BIO_printf(bio_err,"%-14s print the iv/key (then exit if -P)\n","-[pP]");
|
||||
BIO_printf(bio_err,"%-14s buffer size\n","-bufsize <n>");
|
||||
BIO_printf(bio_err,"%-14s disable standard block padding\n","-nopad");
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
BIO_printf(bio_err,"%-14s use engine e, possibly a hardware device.\n","-engine e");
|
||||
#endif
|
||||
@ -319,10 +339,7 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
if (dgst == NULL)
|
||||
{
|
||||
if (in_FIPS_mode)
|
||||
dgst = EVP_sha1();
|
||||
else
|
||||
dgst = EVP_md5();
|
||||
dgst = EVP_md5();
|
||||
}
|
||||
|
||||
if (bufsize != NULL)
|
||||
@ -379,8 +396,10 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
if (inf == NULL)
|
||||
{
|
||||
#ifndef OPENSSL_NO_SETVBUF_IONBF
|
||||
if (bufsize != NULL)
|
||||
setvbuf(stdin, (char *)NULL, _IONBF, 0);
|
||||
#endif /* ndef OPENSSL_NO_SETVBUF_IONBF */
|
||||
BIO_set_fp(in,stdin,BIO_NOCLOSE);
|
||||
}
|
||||
else
|
||||
@ -433,8 +452,10 @@ int MAIN(int argc, char **argv)
|
||||
if (outf == NULL)
|
||||
{
|
||||
BIO_set_fp(out,stdout,BIO_NOCLOSE);
|
||||
#ifndef OPENSSL_NO_SETVBUF_IONBF
|
||||
if (bufsize != NULL)
|
||||
setvbuf(stdout, (char *)NULL, _IONBF, 0);
|
||||
#endif /* ndef OPENSSL_NO_SETVBUF_IONBF */
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
{
|
||||
BIO *tmpbio = BIO_new(BIO_f_linebuffer());
|
||||
@ -454,6 +475,19 @@ int MAIN(int argc, char **argv)
|
||||
rbio=in;
|
||||
wbio=out;
|
||||
|
||||
#ifdef ZLIB
|
||||
|
||||
if (do_zlib)
|
||||
{
|
||||
if ((bzl=BIO_new(BIO_f_zlib())) == NULL)
|
||||
goto end;
|
||||
if (enc)
|
||||
wbio=BIO_push(bzl,wbio);
|
||||
else
|
||||
rbio=BIO_push(bzl,rbio);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (base64)
|
||||
{
|
||||
if ((b64=BIO_new(BIO_f_base64())) == NULL)
|
||||
@ -653,6 +687,9 @@ int MAIN(int argc, char **argv)
|
||||
if (out != NULL) BIO_free_all(out);
|
||||
if (benc != NULL) BIO_free(benc);
|
||||
if (b64 != NULL) BIO_free(b64);
|
||||
#ifdef ZLIB
|
||||
if (bzl != NULL) BIO_free(bzl);
|
||||
#endif
|
||||
if(pass) OPENSSL_free(pass);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
|
@ -92,7 +92,7 @@ static const char *engine_usage[]={
|
||||
NULL
|
||||
};
|
||||
|
||||
static void identity(void *ptr)
|
||||
static void identity(char *ptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -148,11 +148,6 @@ static int util_flags(BIO *bio_out, unsigned int flags, const char *indent)
|
||||
|
||||
if(flags & ENGINE_CMD_FLAG_NUMERIC)
|
||||
{
|
||||
if(started)
|
||||
{
|
||||
BIO_printf(bio_out, "|");
|
||||
err = 1;
|
||||
}
|
||||
BIO_printf(bio_out, "NUMERIC");
|
||||
started = 1;
|
||||
}
|
||||
@ -205,7 +200,7 @@ static int util_verbose(ENGINE *e, int verbose, BIO *bio_out, const char *indent
|
||||
char *desc = NULL;
|
||||
int flags;
|
||||
int xpos = 0;
|
||||
STACK *cmds = NULL;
|
||||
STACK_OF(OPENSSL_STRING) *cmds = NULL;
|
||||
if(!ENGINE_ctrl(e, ENGINE_CTRL_HAS_CTRL_FUNCTION, 0, NULL, NULL) ||
|
||||
((num = ENGINE_ctrl(e, ENGINE_CTRL_GET_FIRST_CMD_TYPE,
|
||||
0, NULL, NULL)) <= 0))
|
||||
@ -216,7 +211,7 @@ static int util_verbose(ENGINE *e, int verbose, BIO *bio_out, const char *indent
|
||||
return 1;
|
||||
}
|
||||
|
||||
cmds = sk_new_null();
|
||||
cmds = sk_OPENSSL_STRING_new_null();
|
||||
|
||||
if(!cmds)
|
||||
goto err;
|
||||
@ -289,15 +284,17 @@ static int util_verbose(ENGINE *e, int verbose, BIO *bio_out, const char *indent
|
||||
BIO_printf(bio_out, "\n");
|
||||
ret = 1;
|
||||
err:
|
||||
if(cmds) sk_pop_free(cmds, identity);
|
||||
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 *cmds, BIO *bio_out, const char *indent)
|
||||
static void util_do_cmds(ENGINE *e, STACK_OF(OPENSSL_STRING) *cmds,
|
||||
BIO *bio_out, const char *indent)
|
||||
{
|
||||
int loop, res, num = sk_num(cmds);
|
||||
int loop, res, num = sk_OPENSSL_STRING_num(cmds);
|
||||
|
||||
if(num < 0)
|
||||
{
|
||||
BIO_printf(bio_out, "[Error]: internal stack error\n");
|
||||
@ -307,7 +304,7 @@ static void util_do_cmds(ENGINE *e, STACK *cmds, BIO *bio_out, const char *inden
|
||||
{
|
||||
char buf[256];
|
||||
const char *cmd, *arg;
|
||||
cmd = sk_value(cmds, loop);
|
||||
cmd = sk_OPENSSL_STRING_value(cmds, loop);
|
||||
res = 1; /* assume success */
|
||||
/* Check if this command has no ":arg" */
|
||||
if((arg = strstr(cmd, ":")) == NULL)
|
||||
@ -347,9 +344,9 @@ int MAIN(int argc, char **argv)
|
||||
const char **pp;
|
||||
int verbose=0, list_cap=0, test_avail=0, test_avail_noise = 0;
|
||||
ENGINE *e;
|
||||
STACK *engines = sk_new_null();
|
||||
STACK *pre_cmds = sk_new_null();
|
||||
STACK *post_cmds = sk_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) *post_cmds = sk_OPENSSL_STRING_new_null();
|
||||
int badops=1;
|
||||
BIO *bio_out=NULL;
|
||||
const char *indent = " ";
|
||||
@ -396,20 +393,20 @@ int MAIN(int argc, char **argv)
|
||||
argc--; argv++;
|
||||
if (argc == 0)
|
||||
goto skip_arg_loop;
|
||||
sk_push(pre_cmds,*argv);
|
||||
sk_OPENSSL_STRING_push(pre_cmds,*argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-post") == 0)
|
||||
{
|
||||
argc--; argv++;
|
||||
if (argc == 0)
|
||||
goto skip_arg_loop;
|
||||
sk_push(post_cmds,*argv);
|
||||
sk_OPENSSL_STRING_push(post_cmds,*argv);
|
||||
}
|
||||
else if ((strncmp(*argv,"-h",2) == 0) ||
|
||||
(strcmp(*argv,"-?") == 0))
|
||||
goto skip_arg_loop;
|
||||
else
|
||||
sk_push(engines,*argv);
|
||||
sk_OPENSSL_STRING_push(engines,*argv);
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
@ -424,17 +421,17 @@ int MAIN(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (sk_num(engines) == 0)
|
||||
if (sk_OPENSSL_STRING_num(engines) == 0)
|
||||
{
|
||||
for(e = ENGINE_get_first(); e != NULL; e = ENGINE_get_next(e))
|
||||
{
|
||||
sk_push(engines,(char *)ENGINE_get_id(e));
|
||||
sk_OPENSSL_STRING_push(engines,(char *)ENGINE_get_id(e));
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<sk_num(engines); i++)
|
||||
for (i=0; i<sk_OPENSSL_STRING_num(engines); i++)
|
||||
{
|
||||
const char *id = sk_value(engines,i);
|
||||
const char *id = sk_OPENSSL_STRING_value(engines,i);
|
||||
if ((e = ENGINE_by_id(id)) != NULL)
|
||||
{
|
||||
const char *name = ENGINE_get_name(e);
|
||||
@ -454,6 +451,7 @@ int MAIN(int argc, char **argv)
|
||||
const int *nids;
|
||||
ENGINE_CIPHERS_PTR fn_c;
|
||||
ENGINE_DIGESTS_PTR fn_d;
|
||||
ENGINE_PKEY_METHS_PTR fn_pk;
|
||||
|
||||
if (ENGINE_get_RSA(e) != NULL
|
||||
&& !append_buf(&cap_buf, "RSA",
|
||||
@ -492,6 +490,15 @@ int MAIN(int argc, char **argv)
|
||||
goto end;
|
||||
|
||||
skip_digests:
|
||||
fn_pk = ENGINE_get_pkey_meths(e);
|
||||
if(!fn_pk) goto skip_pmeths;
|
||||
n = fn_pk(e, NULL, &nids, 0);
|
||||
for(k=0 ; k < n ; ++k)
|
||||
if(!append_buf(&cap_buf,
|
||||
OBJ_nid2sn(nids[k]),
|
||||
&cap_size, 256))
|
||||
goto end;
|
||||
skip_pmeths:
|
||||
if (cap_buf && (*cap_buf != '\0'))
|
||||
BIO_printf(bio_out, " [%s]\n", cap_buf);
|
||||
|
||||
@ -526,9 +533,9 @@ int MAIN(int argc, char **argv)
|
||||
end:
|
||||
|
||||
ERR_print_errors(bio_err);
|
||||
sk_pop_free(engines, identity);
|
||||
sk_pop_free(pre_cmds, identity);
|
||||
sk_pop_free(post_cmds, identity);
|
||||
sk_OPENSSL_STRING_pop_free(engines, identity);
|
||||
sk_OPENSSL_STRING_pop_free(pre_cmds, identity);
|
||||
sk_OPENSSL_STRING_pop_free(post_cmds, identity);
|
||||
if (bio_out != NULL) BIO_free_all(bio_out);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
|
@ -97,10 +97,12 @@ int MAIN(int argc, char **argv)
|
||||
out = BIO_push(tmpbio, out);
|
||||
}
|
||||
#endif
|
||||
lh_node_stats_bio((LHASH *)ERR_get_string_table(),out);
|
||||
lh_stats_bio((LHASH *)ERR_get_string_table(),out);
|
||||
lh_node_usage_stats_bio((LHASH *)
|
||||
ERR_get_string_table(),out);
|
||||
lh_ERR_STRING_DATA_node_stats_bio(
|
||||
ERR_get_string_table(), out);
|
||||
lh_ERR_STRING_DATA_stats_bio(ERR_get_string_table(),
|
||||
out);
|
||||
lh_ERR_STRING_DATA_node_usage_stats_bio(
|
||||
ERR_get_string_table(),out);
|
||||
}
|
||||
if (out != NULL) BIO_free_all(out);
|
||||
argc--;
|
||||
|
@ -232,4 +232,10 @@ static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb)
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
#else /* !OPENSSL_NO_DH */
|
||||
|
||||
# if PEDANTIC
|
||||
static void *dummy=&dummy;
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
440
crypto/openssl/apps/genpkey.c
Normal file
440
crypto/openssl/apps/genpkey.c
Normal file
@ -0,0 +1,440 @@
|
||||
/* apps/genpkey.c */
|
||||
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
|
||||
* project 2006
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2006 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* licensing@OpenSSL.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "apps.h"
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/evp.h>
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
#include <openssl/engine.h>
|
||||
#endif
|
||||
|
||||
static int init_keygen_file(BIO *err, EVP_PKEY_CTX **pctx,
|
||||
const char *file, ENGINE *e);
|
||||
static int genpkey_cb(EVP_PKEY_CTX *ctx);
|
||||
|
||||
#define PROG genpkey_main
|
||||
|
||||
int MAIN(int, char **);
|
||||
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
char **args, *outfile = NULL;
|
||||
char *passarg = NULL;
|
||||
BIO *in = NULL, *out = NULL;
|
||||
const EVP_CIPHER *cipher = NULL;
|
||||
int outformat;
|
||||
int text = 0;
|
||||
EVP_PKEY *pkey=NULL;
|
||||
EVP_PKEY_CTX *ctx = NULL;
|
||||
char *pass = NULL;
|
||||
int badarg = 0;
|
||||
int ret = 1, rv;
|
||||
|
||||
int do_param = 0;
|
||||
|
||||
if (bio_err == NULL)
|
||||
bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);
|
||||
|
||||
if (!load_config(bio_err, NULL))
|
||||
goto end;
|
||||
|
||||
outformat=FORMAT_PEM;
|
||||
|
||||
ERR_load_crypto_strings();
|
||||
OpenSSL_add_all_algorithms();
|
||||
args = argv + 1;
|
||||
while (!badarg && *args && *args[0] == '-')
|
||||
{
|
||||
if (!strcmp(*args,"-outform"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
outformat=str2fmt(*args);
|
||||
}
|
||||
else badarg = 1;
|
||||
}
|
||||
else if (!strcmp(*args,"-pass"))
|
||||
{
|
||||
if (!args[1]) goto bad;
|
||||
passarg= *(++args);
|
||||
}
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
else if (strcmp(*args,"-engine") == 0)
|
||||
{
|
||||
if (!args[1])
|
||||
goto bad;
|
||||
e = setup_engine(bio_err, *(++args), 0);
|
||||
}
|
||||
#endif
|
||||
else if (!strcmp (*args, "-paramfile"))
|
||||
{
|
||||
if (!args[1])
|
||||
goto bad;
|
||||
args++;
|
||||
if (do_param == 1)
|
||||
goto bad;
|
||||
if (!init_keygen_file(bio_err, &ctx, *args, e))
|
||||
goto end;
|
||||
}
|
||||
else if (!strcmp (*args, "-out"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
outfile = *args;
|
||||
}
|
||||
else badarg = 1;
|
||||
}
|
||||
else if (strcmp(*args,"-algorithm") == 0)
|
||||
{
|
||||
if (!args[1])
|
||||
goto bad;
|
||||
if (!init_gen_str(bio_err, &ctx, *(++args),e, do_param))
|
||||
goto end;
|
||||
}
|
||||
else if (strcmp(*args,"-pkeyopt") == 0)
|
||||
{
|
||||
if (!args[1])
|
||||
goto bad;
|
||||
if (!ctx)
|
||||
{
|
||||
BIO_puts(bio_err, "No keytype specified\n");
|
||||
goto bad;
|
||||
}
|
||||
else if (pkey_ctrl_string(ctx, *(++args)) <= 0)
|
||||
{
|
||||
BIO_puts(bio_err, "parameter setting error\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else if (strcmp(*args,"-genparam") == 0)
|
||||
{
|
||||
if (ctx)
|
||||
goto bad;
|
||||
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)
|
||||
badarg = 1;
|
||||
|
||||
if (badarg)
|
||||
{
|
||||
bad:
|
||||
BIO_printf(bio_err, "Usage: genpkey [options]\n");
|
||||
BIO_printf(bio_err, "where options may be\n");
|
||||
BIO_printf(bio_err, "-out file output file\n");
|
||||
BIO_printf(bio_err, "-outform X output format (DER or PEM)\n");
|
||||
BIO_printf(bio_err, "-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
|
||||
BIO_printf(bio_err, "-engine e use engine e, possibly a hardware device.\n");
|
||||
#endif
|
||||
BIO_printf(bio_err, "-paramfile file parameters file\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"
|
||||
" to value <value>\n");
|
||||
BIO_printf(bio_err, "-genparam generate parameters, not key\n");
|
||||
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))
|
||||
{
|
||||
BIO_puts(bio_err, "Error getting password\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (outfile)
|
||||
{
|
||||
if (!(out = BIO_new_file (outfile, "wb")))
|
||||
{
|
||||
BIO_printf(bio_err,
|
||||
"Can't open output file %s\n", outfile);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
out = BIO_new_fp (stdout, BIO_NOCLOSE);
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
{
|
||||
BIO *tmpbio = BIO_new(BIO_f_linebuffer());
|
||||
out = BIO_push(tmpbio, out);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
EVP_PKEY_CTX_set_cb(ctx, genpkey_cb);
|
||||
EVP_PKEY_CTX_set_app_data(ctx, bio_err);
|
||||
|
||||
if (do_param)
|
||||
{
|
||||
if (EVP_PKEY_paramgen(ctx, &pkey) <= 0)
|
||||
{
|
||||
BIO_puts(bio_err, "Error generating parameters\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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)
|
||||
rv = PEM_write_bio_Parameters(out, pkey);
|
||||
else if (outformat == FORMAT_PEM)
|
||||
rv = PEM_write_bio_PrivateKey(out, pkey, cipher, NULL, 0,
|
||||
NULL, pass);
|
||||
else if (outformat == FORMAT_ASN1)
|
||||
rv = i2d_PrivateKey_bio(out, pkey);
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_err, "Bad format specified for key\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (rv <= 0)
|
||||
{
|
||||
BIO_puts(bio_err, "Error writing key\n");
|
||||
ERR_print_errors(bio_err);
|
||||
}
|
||||
|
||||
if (text)
|
||||
{
|
||||
if (do_param)
|
||||
rv = EVP_PKEY_print_params(out, pkey, 0, NULL);
|
||||
else
|
||||
rv = EVP_PKEY_print_private(out, pkey, 0, NULL);
|
||||
|
||||
if (rv <= 0)
|
||||
{
|
||||
BIO_puts(bio_err, "Error printing key\n");
|
||||
ERR_print_errors(bio_err);
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
end:
|
||||
if (pkey)
|
||||
EVP_PKEY_free(pkey);
|
||||
if (ctx)
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
if (out)
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
if (pass)
|
||||
OPENSSL_free(pass);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int init_keygen_file(BIO *err, EVP_PKEY_CTX **pctx,
|
||||
const char *file, ENGINE *e)
|
||||
{
|
||||
BIO *pbio;
|
||||
EVP_PKEY *pkey = NULL;
|
||||
EVP_PKEY_CTX *ctx = NULL;
|
||||
if (*pctx)
|
||||
{
|
||||
BIO_puts(err, "Parameters already set!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
pbio = BIO_new_file(file, "r");
|
||||
if (!pbio)
|
||||
{
|
||||
BIO_printf(err, "Can't open parameter file %s\n", file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pkey = PEM_read_bio_Parameters(pbio, NULL);
|
||||
BIO_free(pbio);
|
||||
|
||||
if (!pkey)
|
||||
{
|
||||
BIO_printf(bio_err, "Error reading parameter file %s\n", file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ctx = EVP_PKEY_CTX_new(pkey, e);
|
||||
if (!ctx)
|
||||
goto err;
|
||||
if (EVP_PKEY_keygen_init(ctx) <= 0)
|
||||
goto err;
|
||||
EVP_PKEY_free(pkey);
|
||||
*pctx = ctx;
|
||||
return 1;
|
||||
|
||||
err:
|
||||
BIO_puts(err, "Error initializing context\n");
|
||||
ERR_print_errors(err);
|
||||
if (ctx)
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
if (pkey)
|
||||
EVP_PKEY_free(pkey);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int init_gen_str(BIO *err, EVP_PKEY_CTX **pctx,
|
||||
const char *algname, ENGINE *e, int do_param)
|
||||
{
|
||||
EVP_PKEY_CTX *ctx = NULL;
|
||||
const EVP_PKEY_ASN1_METHOD *ameth;
|
||||
ENGINE *tmpeng = NULL;
|
||||
int pkey_id;
|
||||
|
||||
if (*pctx)
|
||||
{
|
||||
BIO_puts(err, "Algorithm already set!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ameth = EVP_PKEY_asn1_find_str(&tmpeng, algname, -1);
|
||||
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
if (!ameth && e)
|
||||
ameth = ENGINE_get_pkey_asn1_meth_str(e, algname, -1);
|
||||
#endif
|
||||
|
||||
if (!ameth)
|
||||
{
|
||||
BIO_printf(bio_err, "Algorithm %s not found\n", algname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ERR_clear_error();
|
||||
|
||||
EVP_PKEY_asn1_get0_info(&pkey_id, NULL, NULL, NULL, NULL, ameth);
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
if (tmpeng)
|
||||
ENGINE_finish(tmpeng);
|
||||
#endif
|
||||
ctx = EVP_PKEY_CTX_new_id(pkey_id, e);
|
||||
|
||||
if (!ctx)
|
||||
goto err;
|
||||
if (do_param)
|
||||
{
|
||||
if (EVP_PKEY_paramgen_init(ctx) <= 0)
|
||||
goto err;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (EVP_PKEY_keygen_init(ctx) <= 0)
|
||||
goto err;
|
||||
}
|
||||
|
||||
*pctx = ctx;
|
||||
return 1;
|
||||
|
||||
err:
|
||||
BIO_printf(err, "Error initializing %s context\n", algname);
|
||||
ERR_print_errors(err);
|
||||
if (ctx)
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
static int genpkey_cb(EVP_PKEY_CTX *ctx)
|
||||
{
|
||||
char c='*';
|
||||
BIO *b = EVP_PKEY_CTX_get_app_data(ctx);
|
||||
int p;
|
||||
p = EVP_PKEY_CTX_get_keygen_info(ctx, 0);
|
||||
if (p == 0) c='.';
|
||||
if (p == 1) c='+';
|
||||
if (p == 2) c='*';
|
||||
if (p == 3) c='\n';
|
||||
BIO_write(b,&c,1);
|
||||
(void)BIO_flush(b);
|
||||
#ifdef LINT
|
||||
p=n;
|
||||
#endif
|
||||
return 1;
|
||||
}
|
@ -89,10 +89,12 @@ int MAIN(int, char **);
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
BN_GENCB cb;
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
ENGINE *e = NULL;
|
||||
#endif
|
||||
int ret=1;
|
||||
int i,num=DEFBITS;
|
||||
long l;
|
||||
int use_x931 = 0;
|
||||
const EVP_CIPHER *enc=NULL;
|
||||
unsigned long f4=RSA_F4;
|
||||
char *outfile=NULL;
|
||||
@ -136,8 +138,6 @@ int MAIN(int argc, char **argv)
|
||||
f4=3;
|
||||
else if (strcmp(*argv,"-F4") == 0 || strcmp(*argv,"-f4") == 0)
|
||||
f4=RSA_F4;
|
||||
else if (strcmp(*argv,"-x931") == 0)
|
||||
use_x931 = 1;
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
else if (strcmp(*argv,"-engine") == 0)
|
||||
{
|
||||
@ -232,7 +232,7 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
setup_engine(bio_err, engine, 0);
|
||||
e = setup_engine(bio_err, engine, 0);
|
||||
#endif
|
||||
|
||||
if (outfile == NULL)
|
||||
@ -265,22 +265,15 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
BIO_printf(bio_err,"Generating RSA private key, %d bit long modulus\n",
|
||||
num);
|
||||
|
||||
#ifdef OPENSSL_NO_ENGINE
|
||||
rsa = RSA_new();
|
||||
#else
|
||||
rsa = RSA_new_method(e);
|
||||
#endif
|
||||
if (!rsa)
|
||||
goto err;
|
||||
|
||||
if (use_x931)
|
||||
{
|
||||
BIGNUM *pubexp;
|
||||
pubexp = BN_new();
|
||||
if (!BN_set_word(pubexp, f4))
|
||||
goto err;
|
||||
if (!RSA_X931_generate_key_ex(rsa, num, pubexp, &cb))
|
||||
goto err;
|
||||
BN_free(pubexp);
|
||||
}
|
||||
else if(!BN_set_word(bn, f4) || !RSA_generate_key_ex(rsa, num, bn, &cb))
|
||||
if(!BN_set_word(bn, f4) || !RSA_generate_key_ex(rsa, num, bn, &cb))
|
||||
goto err;
|
||||
|
||||
app_RAND_write_file(NULL, bio_err);
|
||||
|
@ -56,25 +56,53 @@
|
||||
*
|
||||
*/
|
||||
#ifndef OPENSSL_NO_OCSP
|
||||
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
#define _XOPEN_SOURCE_EXTENDED /* So fd_set and friends get properly defined
|
||||
on OpenVMS */
|
||||
#endif
|
||||
|
||||
#define USE_SOCKETS
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "apps.h" /* needs to be included before the openssl headers! */
|
||||
#include <openssl/e_os2.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/x509v3.h>
|
||||
|
||||
#if defined(NETWARE_CLIB)
|
||||
# ifdef NETWARE_BSDSOCK
|
||||
# include <sys/socket.h>
|
||||
# include <sys/bsdskt.h>
|
||||
# else
|
||||
# include <novsock2.h>
|
||||
# endif
|
||||
#elif defined(NETWARE_LIBC)
|
||||
# ifdef NETWARE_BSDSOCK
|
||||
# include <sys/select.h>
|
||||
# else
|
||||
# include <novsock2.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Maximum leeway in validity period: default 5 minutes */
|
||||
#define MAX_VALIDITY_PERIOD (5 * 60)
|
||||
|
||||
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer,
|
||||
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, const EVP_MD *cert_id_md, X509 *issuer,
|
||||
STACK_OF(OCSP_CERTID) *ids);
|
||||
static int add_ocsp_serial(OCSP_REQUEST **req, char *serial, X509 *issuer,
|
||||
static int add_ocsp_serial(OCSP_REQUEST **req, char *serial, const EVP_MD * cert_id_md, X509 *issuer,
|
||||
STACK_OF(OCSP_CERTID) *ids);
|
||||
static int print_ocsp_summary(BIO *out, OCSP_BASICRESP *bs, OCSP_REQUEST *req,
|
||||
STACK *names, STACK_OF(OCSP_CERTID) *ids,
|
||||
long nsec, long maxage);
|
||||
STACK_OF(OPENSSL_STRING) *names,
|
||||
STACK_OF(OCSP_CERTID) *ids, long nsec,
|
||||
long maxage);
|
||||
|
||||
static int make_ocsp_response(OCSP_RESPONSE **resp, OCSP_REQUEST *req, CA_DB *db,
|
||||
X509 *ca, X509 *rcert, EVP_PKEY *rkey,
|
||||
@ -86,6 +114,7 @@ static BIO *init_responder(char *port);
|
||||
static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio, char *port);
|
||||
static int send_ocsp_response(BIO *cbio, OCSP_RESPONSE *resp);
|
||||
static OCSP_RESPONSE *query_responder(BIO *err, BIO *cbio, char *path,
|
||||
STACK_OF(CONF_VALUE) *headers,
|
||||
OCSP_REQUEST *req, int req_timeout);
|
||||
|
||||
#undef PROG
|
||||
@ -104,6 +133,7 @@ int MAIN(int argc, char **argv)
|
||||
char *rsignfile = NULL, *rkeyfile = NULL;
|
||||
char *outfile = NULL;
|
||||
int add_nonce = 1, noverify = 0, use_ssl = -1;
|
||||
STACK_OF(CONF_VALUE) *headers = NULL;
|
||||
OCSP_REQUEST *req = NULL;
|
||||
OCSP_RESPONSE *resp = NULL;
|
||||
OCSP_BASICRESP *bs = NULL;
|
||||
@ -126,7 +156,7 @@ int MAIN(int argc, char **argv)
|
||||
int badarg = 0;
|
||||
int i;
|
||||
int ignore_err = 0;
|
||||
STACK *reqnames = NULL;
|
||||
STACK_OF(OPENSSL_STRING) *reqnames = NULL;
|
||||
STACK_OF(OCSP_CERTID) *ids = NULL;
|
||||
|
||||
X509 *rca_cert = NULL;
|
||||
@ -134,6 +164,7 @@ int MAIN(int argc, char **argv)
|
||||
char *rca_filename = NULL;
|
||||
CA_DB *rdb = NULL;
|
||||
int nmin = 0, ndays = -1;
|
||||
const EVP_MD *cert_id_md = NULL;
|
||||
|
||||
if (bio_err == NULL) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
|
||||
|
||||
@ -142,7 +173,7 @@ int MAIN(int argc, char **argv)
|
||||
SSL_load_error_strings();
|
||||
OpenSSL_add_ssl_algorithms();
|
||||
args = argv + 1;
|
||||
reqnames = sk_new_null();
|
||||
reqnames = sk_OPENSSL_STRING_new_null();
|
||||
ids = sk_OCSP_CERTID_new_null();
|
||||
while (!badarg && *args && *args[0] == '-')
|
||||
{
|
||||
@ -202,6 +233,16 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
else badarg = 1;
|
||||
}
|
||||
else if (!strcmp(*args, "-header"))
|
||||
{
|
||||
if (args[1] && args[2])
|
||||
{
|
||||
if (!X509V3_add_value(args[1], args[2], &headers))
|
||||
goto end;
|
||||
args += 2;
|
||||
}
|
||||
else badarg = 1;
|
||||
}
|
||||
else if (!strcmp(*args, "-ignore_err"))
|
||||
ignore_err = 1;
|
||||
else if (!strcmp(*args, "-noverify"))
|
||||
@ -401,9 +442,10 @@ int MAIN(int argc, char **argv)
|
||||
cert = load_cert(bio_err, *args, FORMAT_PEM,
|
||||
NULL, e, "certificate");
|
||||
if(!cert) goto end;
|
||||
if(!add_ocsp_cert(&req, cert, issuer, ids))
|
||||
if (!cert_id_md) cert_id_md = EVP_sha1();
|
||||
if(!add_ocsp_cert(&req, cert, cert_id_md, issuer, ids))
|
||||
goto end;
|
||||
if(!sk_push(reqnames, *args))
|
||||
if(!sk_OPENSSL_STRING_push(reqnames, *args))
|
||||
goto end;
|
||||
}
|
||||
else badarg = 1;
|
||||
@ -413,9 +455,10 @@ int MAIN(int argc, char **argv)
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
if(!add_ocsp_serial(&req, *args, issuer, ids))
|
||||
if (!cert_id_md) cert_id_md = EVP_sha1();
|
||||
if(!add_ocsp_serial(&req, *args, cert_id_md, issuer, ids))
|
||||
goto end;
|
||||
if(!sk_push(reqnames, *args))
|
||||
if(!sk_OPENSSL_STRING_push(reqnames, *args))
|
||||
goto end;
|
||||
}
|
||||
else badarg = 1;
|
||||
@ -515,7 +558,10 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
else badarg = 1;
|
||||
}
|
||||
else badarg = 1;
|
||||
else if ((cert_id_md = EVP_get_digestbyname((*args)+1))==NULL)
|
||||
{
|
||||
badarg = 1;
|
||||
}
|
||||
args++;
|
||||
}
|
||||
|
||||
@ -571,6 +617,7 @@ int MAIN(int argc, char **argv)
|
||||
BIO_printf (bio_err, "-ndays n number of days before next update\n");
|
||||
BIO_printf (bio_err, "-resp_key_id identify reponse by signing certificate key ID\n");
|
||||
BIO_printf (bio_err, "-nrequest n number of requests to accept (default unlimited)\n");
|
||||
BIO_printf (bio_err, "-<dgst alg> use specified digest in the request");
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -677,7 +724,8 @@ int MAIN(int argc, char **argv)
|
||||
"signer private key");
|
||||
if (!key)
|
||||
goto end;
|
||||
if (!OCSP_request_sign(req, signer, key, EVP_sha1(), sign_other, sign_flags))
|
||||
|
||||
if (!OCSP_request_sign(req, signer, key, NULL, sign_other, sign_flags))
|
||||
{
|
||||
BIO_printf(bio_err, "Error signing OCSP request\n");
|
||||
goto end;
|
||||
@ -721,7 +769,7 @@ int MAIN(int argc, char **argv)
|
||||
{
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
resp = process_responder(bio_err, req, host, path,
|
||||
port, use_ssl, req_timeout);
|
||||
port, use_ssl, headers, req_timeout);
|
||||
if (!resp)
|
||||
goto end;
|
||||
#else
|
||||
@ -866,10 +914,11 @@ int MAIN(int argc, char **argv)
|
||||
OCSP_REQUEST_free(req);
|
||||
OCSP_RESPONSE_free(resp);
|
||||
OCSP_BASICRESP_free(bs);
|
||||
sk_free(reqnames);
|
||||
sk_OPENSSL_STRING_free(reqnames);
|
||||
sk_OCSP_CERTID_free(ids);
|
||||
sk_X509_pop_free(sign_other, X509_free);
|
||||
sk_X509_pop_free(verify_other, X509_free);
|
||||
sk_CONF_VALUE_pop_free(headers, X509V3_conf_free);
|
||||
|
||||
if (use_ssl != -1)
|
||||
{
|
||||
@ -881,7 +930,7 @@ int MAIN(int argc, char **argv)
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer,
|
||||
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, const EVP_MD *cert_id_md,X509 *issuer,
|
||||
STACK_OF(OCSP_CERTID) *ids)
|
||||
{
|
||||
OCSP_CERTID *id;
|
||||
@ -892,7 +941,7 @@ static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer,
|
||||
}
|
||||
if(!*req) *req = OCSP_REQUEST_new();
|
||||
if(!*req) goto err;
|
||||
id = OCSP_cert_to_id(NULL, cert, issuer);
|
||||
id = OCSP_cert_to_id(cert_id_md, cert, issuer);
|
||||
if(!id || !sk_OCSP_CERTID_push(ids, id)) goto err;
|
||||
if(!OCSP_request_add0_id(*req, id)) goto err;
|
||||
return 1;
|
||||
@ -902,7 +951,7 @@ static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int add_ocsp_serial(OCSP_REQUEST **req, char *serial, X509 *issuer,
|
||||
static int add_ocsp_serial(OCSP_REQUEST **req, char *serial,const EVP_MD *cert_id_md, X509 *issuer,
|
||||
STACK_OF(OCSP_CERTID) *ids)
|
||||
{
|
||||
OCSP_CERTID *id;
|
||||
@ -924,7 +973,7 @@ static int add_ocsp_serial(OCSP_REQUEST **req, char *serial, X509 *issuer,
|
||||
BIO_printf(bio_err, "Error converting serial number %s\n", serial);
|
||||
return 0;
|
||||
}
|
||||
id = OCSP_cert_id_new(EVP_sha1(), iname, ikey, sno);
|
||||
id = OCSP_cert_id_new(cert_id_md, iname, ikey, sno);
|
||||
ASN1_INTEGER_free(sno);
|
||||
if(!id || !sk_OCSP_CERTID_push(ids, id)) goto err;
|
||||
if(!OCSP_request_add0_id(*req, id)) goto err;
|
||||
@ -936,8 +985,9 @@ static int add_ocsp_serial(OCSP_REQUEST **req, char *serial, X509 *issuer,
|
||||
}
|
||||
|
||||
static int print_ocsp_summary(BIO *out, OCSP_BASICRESP *bs, OCSP_REQUEST *req,
|
||||
STACK *names, STACK_OF(OCSP_CERTID) *ids,
|
||||
long nsec, long maxage)
|
||||
STACK_OF(OPENSSL_STRING) *names,
|
||||
STACK_OF(OCSP_CERTID) *ids, long nsec,
|
||||
long maxage)
|
||||
{
|
||||
OCSP_CERTID *id;
|
||||
char *name;
|
||||
@ -947,13 +997,13 @@ static int print_ocsp_summary(BIO *out, OCSP_BASICRESP *bs, OCSP_REQUEST *req,
|
||||
|
||||
ASN1_GENERALIZEDTIME *rev, *thisupd, *nextupd;
|
||||
|
||||
if (!bs || !req || !sk_num(names) || !sk_OCSP_CERTID_num(ids))
|
||||
if (!bs || !req || !sk_OPENSSL_STRING_num(names) || !sk_OCSP_CERTID_num(ids))
|
||||
return 1;
|
||||
|
||||
for (i = 0; i < sk_OCSP_CERTID_num(ids); i++)
|
||||
{
|
||||
id = sk_OCSP_CERTID_value(ids, i);
|
||||
name = sk_value(names, i);
|
||||
name = sk_OPENSSL_STRING_value(names, i);
|
||||
BIO_printf(out, "%s: ", name);
|
||||
|
||||
if(!OCSP_resp_find_status(bs, id, &status, &reason,
|
||||
@ -1010,7 +1060,6 @@ static int make_ocsp_response(OCSP_RESPONSE **resp, OCSP_REQUEST *req, CA_DB *db
|
||||
OCSP_BASICRESP *bs = NULL;
|
||||
int i, id_count, ret = 1;
|
||||
|
||||
|
||||
id_count = OCSP_request_onereq_count(req);
|
||||
|
||||
if (id_count <= 0)
|
||||
@ -1019,7 +1068,6 @@ static int make_ocsp_response(OCSP_RESPONSE **resp, OCSP_REQUEST *req, CA_DB *db
|
||||
goto end;
|
||||
}
|
||||
|
||||
ca_id = OCSP_cert_to_id(EVP_sha1(), NULL, ca);
|
||||
|
||||
bs = OCSP_BASICRESP_new();
|
||||
thisupd = X509_gmtime_adj(NULL, 0);
|
||||
@ -1032,8 +1080,23 @@ static int make_ocsp_response(OCSP_RESPONSE **resp, OCSP_REQUEST *req, CA_DB *db
|
||||
OCSP_ONEREQ *one;
|
||||
ASN1_INTEGER *serial;
|
||||
char **inf;
|
||||
ASN1_OBJECT *cert_id_md_oid;
|
||||
const EVP_MD *cert_id_md;
|
||||
one = OCSP_request_onereq_get0(req, i);
|
||||
cid = OCSP_onereq_get0_id(one);
|
||||
|
||||
OCSP_id_get0_info(NULL,&cert_id_md_oid, NULL,NULL, cid);
|
||||
|
||||
cert_id_md = EVP_get_digestbyobj(cert_id_md_oid);
|
||||
if (! cert_id_md)
|
||||
{
|
||||
*resp = OCSP_response_create(OCSP_RESPONSE_STATUS_INTERNALERROR,
|
||||
NULL);
|
||||
goto end;
|
||||
}
|
||||
if (ca_id) OCSP_CERTID_free(ca_id);
|
||||
ca_id = OCSP_cert_to_id(cert_id_md, NULL, ca);
|
||||
|
||||
/* Is this request about our CA? */
|
||||
if (OCSP_id_issuer_cmp(ca_id, cid))
|
||||
{
|
||||
@ -1078,8 +1141,8 @@ static int make_ocsp_response(OCSP_RESPONSE **resp, OCSP_REQUEST *req, CA_DB *db
|
||||
}
|
||||
|
||||
OCSP_copy_nonce(bs, req);
|
||||
|
||||
OCSP_basic_sign(bs, rcert, rkey, EVP_sha1(), rother, flags);
|
||||
|
||||
OCSP_basic_sign(bs, rcert, rkey, NULL, rother, flags);
|
||||
|
||||
*resp = OCSP_response_create(OCSP_RESPONSE_STATUS_SUCCESSFUL, bs);
|
||||
|
||||
@ -1211,10 +1274,12 @@ static int send_ocsp_response(BIO *cbio, OCSP_RESPONSE *resp)
|
||||
}
|
||||
|
||||
static OCSP_RESPONSE *query_responder(BIO *err, BIO *cbio, char *path,
|
||||
STACK_OF(CONF_VALUE) *headers,
|
||||
OCSP_REQUEST *req, int req_timeout)
|
||||
{
|
||||
int fd;
|
||||
int rv;
|
||||
int i;
|
||||
OCSP_REQ_CTX *ctx = NULL;
|
||||
OCSP_RESPONSE *rsp = NULL;
|
||||
fd_set confds;
|
||||
@ -1231,16 +1296,13 @@ static OCSP_RESPONSE *query_responder(BIO *err, BIO *cbio, char *path,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (req_timeout == -1)
|
||||
return OCSP_sendreq_bio(cbio, path, req);
|
||||
|
||||
if (BIO_get_fd(cbio, &fd) <= 0)
|
||||
{
|
||||
BIO_puts(err, "Can't get connection fd\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (rv <= 0)
|
||||
if (req_timeout != -1 && rv <= 0)
|
||||
{
|
||||
FD_ZERO(&confds);
|
||||
openssl_fdset(fd, &confds);
|
||||
@ -1255,15 +1317,27 @@ static OCSP_RESPONSE *query_responder(BIO *err, BIO *cbio, char *path,
|
||||
}
|
||||
|
||||
|
||||
ctx = OCSP_sendreq_new(cbio, path, req, -1);
|
||||
ctx = OCSP_sendreq_new(cbio, path, NULL, -1);
|
||||
if (!ctx)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < sk_CONF_VALUE_num(headers); i++)
|
||||
{
|
||||
CONF_VALUE *hdr = sk_CONF_VALUE_value(headers, i);
|
||||
if (!OCSP_REQ_CTX_add1_header(ctx, hdr->name, hdr->value))
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!OCSP_REQ_CTX_set1_req(ctx, req))
|
||||
goto err;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
rv = OCSP_sendreq_nbio(&rsp, ctx);
|
||||
if (rv != -1)
|
||||
break;
|
||||
if (req_timeout == -1)
|
||||
continue;
|
||||
FD_ZERO(&confds);
|
||||
openssl_fdset(fd, &confds);
|
||||
tv.tv_usec = 0;
|
||||
@ -1287,7 +1361,7 @@ static OCSP_RESPONSE *query_responder(BIO *err, BIO *cbio, char *path,
|
||||
BIO_puts(err, "Select error\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
err:
|
||||
if (ctx)
|
||||
@ -1298,6 +1372,7 @@ static OCSP_RESPONSE *query_responder(BIO *err, BIO *cbio, char *path,
|
||||
|
||||
OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req,
|
||||
char *host, char *path, char *port, int use_ssl,
|
||||
STACK_OF(CONF_VALUE) *headers,
|
||||
int req_timeout)
|
||||
{
|
||||
BIO *cbio = NULL;
|
||||
@ -1332,14 +1407,14 @@ OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req,
|
||||
sbio = BIO_new_ssl(ctx, 1);
|
||||
cbio = BIO_push(sbio, cbio);
|
||||
}
|
||||
resp = query_responder(err, cbio, path, req, req_timeout);
|
||||
resp = query_responder(err, cbio, path, headers, req, req_timeout);
|
||||
if (!resp)
|
||||
BIO_printf(bio_err, "Error querying OCSP responsder\n");
|
||||
end:
|
||||
if (ctx)
|
||||
SSL_CTX_free(ctx);
|
||||
if (cbio)
|
||||
BIO_free_all(cbio);
|
||||
if (ctx)
|
||||
SSL_CTX_free(ctx);
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
@ -129,25 +129,26 @@
|
||||
#include "progs.h"
|
||||
#include "s_apps.h"
|
||||
#include <openssl/err.h>
|
||||
#ifdef OPENSSL_FIPS
|
||||
#include <openssl/fips.h>
|
||||
#endif
|
||||
|
||||
/* The LHASH callbacks ("hash" & "cmp") have been replaced by functions with the
|
||||
* base prototypes (we cast each variable inside the function to the required
|
||||
* type of "FUNCTION*"). This removes the necessity for macro-generated wrapper
|
||||
* functions. */
|
||||
|
||||
/* static unsigned long MS_CALLBACK hash(FUNCTION *a); */
|
||||
static unsigned long MS_CALLBACK hash(const void *a_void);
|
||||
/* static int MS_CALLBACK cmp(FUNCTION *a,FUNCTION *b); */
|
||||
static int MS_CALLBACK cmp(const void *a_void,const void *b_void);
|
||||
static LHASH *prog_init(void );
|
||||
static int do_cmd(LHASH *prog,int argc,char *argv[]);
|
||||
static LHASH_OF(FUNCTION) *prog_init(void );
|
||||
static int do_cmd(LHASH_OF(FUNCTION) *prog,int argc,char *argv[]);
|
||||
static void list_pkey(BIO *out);
|
||||
static void list_cipher(BIO *out);
|
||||
static void list_md(BIO *out);
|
||||
char *default_config_file=NULL;
|
||||
|
||||
/* Make sure there is only one when MONOLITH is defined */
|
||||
#ifdef MONOLITH
|
||||
CONF *config=NULL;
|
||||
BIO *bio_err=NULL;
|
||||
int in_FIPS_mode=0;
|
||||
#endif
|
||||
|
||||
|
||||
@ -214,8 +215,13 @@ static void lock_dbg_cb(int mode, int type, const char *file, int line)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE == 64)
|
||||
# define ARGV _Argv
|
||||
#else
|
||||
# define ARGV Argv
|
||||
#endif
|
||||
|
||||
int main(int Argc, char *Argv[])
|
||||
int main(int Argc, char *ARGV[])
|
||||
{
|
||||
ARGS arg;
|
||||
#define PROG_NAME_SIZE 39
|
||||
@ -227,28 +233,60 @@ int main(int Argc, char *Argv[])
|
||||
int n,i,ret=0;
|
||||
int argc;
|
||||
char **argv,*p;
|
||||
LHASH *prog=NULL;
|
||||
LHASH_OF(FUNCTION) *prog=NULL;
|
||||
long errline;
|
||||
|
||||
|
||||
#if defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE == 64)
|
||||
/* 2011-03-22 SMS.
|
||||
* If we have 32-bit pointers everywhere, then we're safe, and
|
||||
* we bypass this mess, as on non-VMS systems. (See ARGV,
|
||||
* above.)
|
||||
* Problem 1: Compaq/HP C before V7.3 always used 32-bit
|
||||
* pointers for argv[].
|
||||
* Fix 1: For a 32-bit argv[], when we're using 64-bit pointers
|
||||
* everywhere else, we always allocate and use a 64-bit
|
||||
* duplicate of argv[].
|
||||
* Problem 2: Compaq/HP C V7.3 (Alpha, IA64) before ECO1 failed
|
||||
* to NULL-terminate a 64-bit argv[]. (As this was written, the
|
||||
* compiler ECO was available only on IA64.)
|
||||
* Fix 2: Unless advised not to (VMS_TRUST_ARGV), we test a
|
||||
* 64-bit argv[argc] for NULL, and, if necessary, use a
|
||||
* (properly) NULL-terminated (64-bit) duplicate of argv[].
|
||||
* The same code is used in either case to duplicate argv[].
|
||||
* Some of these decisions could be handled in preprocessing,
|
||||
* but the code tends to get even uglier, and the penalty for
|
||||
* deciding at compile- or run-time is tiny.
|
||||
*/
|
||||
char **Argv = NULL;
|
||||
int free_Argv = 0;
|
||||
|
||||
if ((sizeof( _Argv) < 8) /* 32-bit argv[]. */
|
||||
# if !defined( VMS_TRUST_ARGV)
|
||||
|| (_Argv[ Argc] != NULL) /* Untrusted argv[argc] not NULL. */
|
||||
# endif
|
||||
)
|
||||
{
|
||||
int i;
|
||||
Argv = OPENSSL_malloc( (Argc+ 1)* sizeof( char *));
|
||||
if (Argv == NULL)
|
||||
{ ret = -1; goto end; }
|
||||
for(i = 0; i < Argc; i++)
|
||||
Argv[i] = _Argv[i];
|
||||
Argv[ Argc] = NULL; /* Certain NULL termination. */
|
||||
free_Argv = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Use the known-good 32-bit argv[] (which needs the
|
||||
* type cast to satisfy the compiler), or the trusted or
|
||||
* tested-good 64-bit argv[] as-is. */
|
||||
Argv = (char **)_Argv;
|
||||
}
|
||||
#endif /* defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE == 64) */
|
||||
|
||||
arg.data=NULL;
|
||||
arg.count=0;
|
||||
|
||||
in_FIPS_mode = 0;
|
||||
|
||||
if(getenv("OPENSSL_FIPS")) {
|
||||
#ifdef OPENSSL_FIPS
|
||||
if (!FIPS_mode_set(1)) {
|
||||
ERR_load_crypto_strings();
|
||||
ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
|
||||
EXIT(1);
|
||||
}
|
||||
in_FIPS_mode = 1;
|
||||
#else
|
||||
fprintf(stderr, "FIPS mode not supported.\n");
|
||||
EXIT(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (bio_err == NULL)
|
||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||
@ -275,6 +313,19 @@ int main(int Argc, char *Argv[])
|
||||
CRYPTO_set_locking_callback(lock_dbg_cb);
|
||||
}
|
||||
|
||||
if(getenv("OPENSSL_FIPS")) {
|
||||
#ifdef OPENSSL_FIPS
|
||||
if (!FIPS_mode_set(1)) {
|
||||
ERR_load_crypto_strings();
|
||||
ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
|
||||
EXIT(1);
|
||||
}
|
||||
#else
|
||||
fprintf(stderr, "FIPS mode not supported.\n");
|
||||
EXIT(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
apps_startup();
|
||||
|
||||
/* Lets load up our environment a little */
|
||||
@ -290,9 +341,21 @@ int main(int Argc, char *Argv[])
|
||||
i=NCONF_load(config,p,&errline);
|
||||
if (i == 0)
|
||||
{
|
||||
NCONF_free(config);
|
||||
config = NULL;
|
||||
ERR_clear_error();
|
||||
if (ERR_GET_REASON(ERR_peek_last_error())
|
||||
== CONF_R_NO_SUCH_FILE)
|
||||
{
|
||||
BIO_printf(bio_err,
|
||||
"WARNING: can't open config file: %s\n",p);
|
||||
ERR_clear_error();
|
||||
NCONF_free(config);
|
||||
config = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ERR_print_errors(bio_err);
|
||||
NCONF_free(config);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
prog=prog_init();
|
||||
@ -301,7 +364,7 @@ int main(int Argc, char *Argv[])
|
||||
program_name(Argv[0],pname,sizeof pname);
|
||||
|
||||
f.name=pname;
|
||||
fp=(FUNCTION *)lh_retrieve(prog,&f);
|
||||
fp=lh_FUNCTION_retrieve(prog,&f);
|
||||
if (fp != NULL)
|
||||
{
|
||||
Argv[0]=pname;
|
||||
@ -368,7 +431,7 @@ int main(int Argc, char *Argv[])
|
||||
NCONF_free(config);
|
||||
config=NULL;
|
||||
}
|
||||
if (prog != NULL) lh_free(prog);
|
||||
if (prog != NULL) lh_FUNCTION_free(prog);
|
||||
if (arg.data != NULL) OPENSSL_free(arg.data);
|
||||
|
||||
apps_shutdown();
|
||||
@ -379,14 +442,25 @@ int main(int Argc, char *Argv[])
|
||||
BIO_free(bio_err);
|
||||
bio_err=NULL;
|
||||
}
|
||||
#if defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE == 64)
|
||||
/* Free any duplicate Argv[] storage. */
|
||||
if (free_Argv)
|
||||
{
|
||||
OPENSSL_free(Argv);
|
||||
}
|
||||
#endif
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
#define LIST_STANDARD_COMMANDS "list-standard-commands"
|
||||
#define LIST_MESSAGE_DIGEST_COMMANDS "list-message-digest-commands"
|
||||
#define LIST_MESSAGE_DIGEST_ALGORITHMS "list-message-digest-algorithms"
|
||||
#define LIST_CIPHER_COMMANDS "list-cipher-commands"
|
||||
#define LIST_CIPHER_ALGORITHMS "list-cipher-algorithms"
|
||||
#define LIST_PUBLIC_KEY_ALGORITHMS "list-public-key-algorithms"
|
||||
|
||||
static int do_cmd(LHASH *prog, int argc, char *argv[])
|
||||
|
||||
static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
|
||||
{
|
||||
FUNCTION f,*fp;
|
||||
int i,ret=1,tp,nl;
|
||||
@ -394,7 +468,22 @@ static int do_cmd(LHASH *prog, int argc, char *argv[])
|
||||
if ((argc <= 0) || (argv[0] == NULL))
|
||||
{ ret=0; goto end; }
|
||||
f.name=argv[0];
|
||||
fp=(FUNCTION *)lh_retrieve(prog,&f);
|
||||
fp=lh_FUNCTION_retrieve(prog,&f);
|
||||
if (fp == NULL)
|
||||
{
|
||||
if (EVP_get_digestbyname(argv[0]))
|
||||
{
|
||||
f.type = FUNC_TYPE_MD;
|
||||
f.func = dgst_main;
|
||||
fp = &f;
|
||||
}
|
||||
else if (EVP_get_cipherbyname(argv[0]))
|
||||
{
|
||||
f.type = FUNC_TYPE_CIPHER;
|
||||
f.func = enc_main;
|
||||
fp = &f;
|
||||
}
|
||||
}
|
||||
if (fp != NULL)
|
||||
{
|
||||
ret=fp->func(argc,argv);
|
||||
@ -409,7 +498,7 @@ static int do_cmd(LHASH *prog, int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
f.name=argv[0]+3;
|
||||
ret = (lh_retrieve(prog,&f) != NULL);
|
||||
ret = (lh_FUNCTION_retrieve(prog,&f) != NULL);
|
||||
if (!ret)
|
||||
BIO_printf(bio_stdout, "%s\n", argv[0]);
|
||||
else
|
||||
@ -427,7 +516,10 @@ static int do_cmd(LHASH *prog, int argc, char *argv[])
|
||||
}
|
||||
else if ((strcmp(argv[0],LIST_STANDARD_COMMANDS) == 0) ||
|
||||
(strcmp(argv[0],LIST_MESSAGE_DIGEST_COMMANDS) == 0) ||
|
||||
(strcmp(argv[0],LIST_CIPHER_COMMANDS) == 0))
|
||||
(strcmp(argv[0],LIST_MESSAGE_DIGEST_ALGORITHMS) == 0) ||
|
||||
(strcmp(argv[0],LIST_CIPHER_COMMANDS) == 0) ||
|
||||
(strcmp(argv[0],LIST_CIPHER_ALGORITHMS) == 0) ||
|
||||
(strcmp(argv[0],LIST_PUBLIC_KEY_ALGORITHMS) == 0))
|
||||
{
|
||||
int list_type;
|
||||
BIO *bio_stdout;
|
||||
@ -436,6 +528,12 @@ static int do_cmd(LHASH *prog, int argc, char *argv[])
|
||||
list_type = FUNC_TYPE_GENERAL;
|
||||
else if (strcmp(argv[0],LIST_MESSAGE_DIGEST_COMMANDS) == 0)
|
||||
list_type = FUNC_TYPE_MD;
|
||||
else if (strcmp(argv[0],LIST_MESSAGE_DIGEST_ALGORITHMS) == 0)
|
||||
list_type = FUNC_TYPE_MD_ALG;
|
||||
else if (strcmp(argv[0],LIST_PUBLIC_KEY_ALGORITHMS) == 0)
|
||||
list_type = FUNC_TYPE_PKEY;
|
||||
else if (strcmp(argv[0],LIST_CIPHER_ALGORITHMS) == 0)
|
||||
list_type = FUNC_TYPE_CIPHER_ALG;
|
||||
else /* strcmp(argv[0],LIST_CIPHER_COMMANDS) == 0 */
|
||||
list_type = FUNC_TYPE_CIPHER;
|
||||
bio_stdout = BIO_new_fp(stdout,BIO_NOCLOSE);
|
||||
@ -445,10 +543,23 @@ static int do_cmd(LHASH *prog, int argc, char *argv[])
|
||||
bio_stdout = BIO_push(tmpbio, bio_stdout);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (fp=functions; fp->name != NULL; fp++)
|
||||
if (fp->type == list_type)
|
||||
BIO_printf(bio_stdout, "%s\n", fp->name);
|
||||
|
||||
if (!load_config(bio_err, NULL))
|
||||
goto end;
|
||||
|
||||
if (list_type == FUNC_TYPE_PKEY)
|
||||
list_pkey(bio_stdout);
|
||||
if (list_type == FUNC_TYPE_MD_ALG)
|
||||
list_md(bio_stdout);
|
||||
if (list_type == FUNC_TYPE_CIPHER_ALG)
|
||||
list_cipher(bio_stdout);
|
||||
else
|
||||
{
|
||||
for (fp=functions; fp->name != NULL; fp++)
|
||||
if (fp->type == list_type)
|
||||
BIO_printf(bio_stdout, "%s\n",
|
||||
fp->name);
|
||||
}
|
||||
BIO_free_all(bio_stdout);
|
||||
ret=0;
|
||||
goto end;
|
||||
@ -511,9 +622,94 @@ static int SortFnByName(const void *_f1,const void *_f2)
|
||||
return strcmp(f1->name,f2->name);
|
||||
}
|
||||
|
||||
static LHASH *prog_init(void)
|
||||
static void list_pkey(BIO *out)
|
||||
{
|
||||
LHASH *ret;
|
||||
int i;
|
||||
for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
|
||||
{
|
||||
const EVP_PKEY_ASN1_METHOD *ameth;
|
||||
int pkey_id, pkey_base_id, pkey_flags;
|
||||
const char *pinfo, *pem_str;
|
||||
ameth = EVP_PKEY_asn1_get0(i);
|
||||
EVP_PKEY_asn1_get0_info(&pkey_id, &pkey_base_id, &pkey_flags,
|
||||
&pinfo, &pem_str, ameth);
|
||||
if (pkey_flags & ASN1_PKEY_ALIAS)
|
||||
{
|
||||
BIO_printf(out, "Name: %s\n",
|
||||
OBJ_nid2ln(pkey_id));
|
||||
BIO_printf(out, "\tType: Alias to %s\n",
|
||||
OBJ_nid2ln(pkey_base_id));
|
||||
}
|
||||
else
|
||||
{
|
||||
BIO_printf(out, "Name: %s\n", pinfo);
|
||||
BIO_printf(out, "\tType: %s Algorithm\n",
|
||||
pkey_flags & ASN1_PKEY_DYNAMIC ?
|
||||
"External" : "Builtin");
|
||||
BIO_printf(out, "\tOID: %s\n", OBJ_nid2ln(pkey_id));
|
||||
if (pem_str == NULL)
|
||||
pem_str = "(none)";
|
||||
BIO_printf(out, "\tPEM string: %s\n", pem_str);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void list_cipher_fn(const EVP_CIPHER *c,
|
||||
const char *from, const char *to, void *arg)
|
||||
{
|
||||
if (c)
|
||||
BIO_printf(arg, "%s\n", EVP_CIPHER_name(c));
|
||||
else
|
||||
{
|
||||
if (!from)
|
||||
from = "<undefined>";
|
||||
if (!to)
|
||||
to = "<undefined>";
|
||||
BIO_printf(arg, "%s => %s\n", from, to);
|
||||
}
|
||||
}
|
||||
|
||||
static void list_cipher(BIO *out)
|
||||
{
|
||||
EVP_CIPHER_do_all_sorted(list_cipher_fn, out);
|
||||
}
|
||||
|
||||
static void list_md_fn(const EVP_MD *m,
|
||||
const char *from, const char *to, void *arg)
|
||||
{
|
||||
if (m)
|
||||
BIO_printf(arg, "%s\n", EVP_MD_name(m));
|
||||
else
|
||||
{
|
||||
if (!from)
|
||||
from = "<undefined>";
|
||||
if (!to)
|
||||
to = "<undefined>";
|
||||
BIO_printf(arg, "%s => %s\n", from, to);
|
||||
}
|
||||
}
|
||||
|
||||
static void list_md(BIO *out)
|
||||
{
|
||||
EVP_MD_do_all_sorted(list_md_fn, out);
|
||||
}
|
||||
|
||||
static int MS_CALLBACK function_cmp(const FUNCTION *a, const FUNCTION *b)
|
||||
{
|
||||
return strncmp(a->name,b->name,8);
|
||||
}
|
||||
static IMPLEMENT_LHASH_COMP_FN(function, FUNCTION)
|
||||
|
||||
static unsigned long MS_CALLBACK function_hash(const FUNCTION *a)
|
||||
{
|
||||
return lh_strhash(a->name);
|
||||
}
|
||||
static IMPLEMENT_LHASH_HASH_FN(function, FUNCTION)
|
||||
|
||||
static LHASH_OF(FUNCTION) *prog_init(void)
|
||||
{
|
||||
LHASH_OF(FUNCTION) *ret;
|
||||
FUNCTION *f;
|
||||
size_t i;
|
||||
|
||||
@ -522,23 +718,11 @@ static LHASH *prog_init(void)
|
||||
;
|
||||
qsort(functions,i,sizeof *functions,SortFnByName);
|
||||
|
||||
if ((ret=lh_new(hash, cmp)) == NULL)
|
||||
if ((ret=lh_FUNCTION_new()) == NULL)
|
||||
return(NULL);
|
||||
|
||||
for (f=functions; f->name != NULL; f++)
|
||||
lh_insert(ret,f);
|
||||
(void)lh_FUNCTION_insert(ret,f);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/* static int MS_CALLBACK cmp(FUNCTION *a, FUNCTION *b) */
|
||||
static int MS_CALLBACK cmp(const void *a_void, const void *b_void)
|
||||
{
|
||||
return(strncmp(((const FUNCTION *)a_void)->name,
|
||||
((const FUNCTION *)b_void)->name,8));
|
||||
}
|
||||
|
||||
/* static unsigned long MS_CALLBACK hash(FUNCTION *a) */
|
||||
static unsigned long MS_CALLBACK hash(const void *a_void)
|
||||
{
|
||||
return(lh_strhash(((const FUNCTION *)a_void)->name));
|
||||
}
|
||||
|
@ -22,12 +22,17 @@ oid_section = new_oids
|
||||
|
||||
[ new_oids ]
|
||||
|
||||
# We can add new OIDs in here for use by 'ca' and 'req'.
|
||||
# We can add new OIDs in here for use by 'ca', 'req' and 'ts'.
|
||||
# Add a simple OID like this:
|
||||
# testoid1=1.2.3.4
|
||||
# Or use config file substitution like this:
|
||||
# testoid2=${testoid1}.5.6
|
||||
|
||||
# Policies used by the TSA examples.
|
||||
tsa_policy1 = 1.2.3.4.1
|
||||
tsa_policy2 = 1.2.3.4.5.6
|
||||
tsa_policy3 = 1.2.3.4.5.7
|
||||
|
||||
####################################################################
|
||||
[ ca ]
|
||||
default_ca = CA_default # The default ca section
|
||||
@ -68,7 +73,7 @@ cert_opt = ca_default # Certificate field options
|
||||
|
||||
default_days = 365 # how long to certify for
|
||||
default_crl_days= 30 # how long before next CRL
|
||||
default_md = sha1 # which md to use.
|
||||
default_md = default # use public key default MD
|
||||
preserve = no # keep passed DN ordering
|
||||
|
||||
# A few difference way of specifying how similar the request should look
|
||||
@ -111,13 +116,12 @@ x509_extensions = v3_ca # The extentions to add to the self signed cert
|
||||
|
||||
# This sets a mask for permitted string types. There are several options.
|
||||
# default: PrintableString, T61String, BMPString.
|
||||
# pkix : PrintableString, BMPString.
|
||||
# utf8only: only UTF8Strings.
|
||||
# pkix : PrintableString, BMPString (PKIX recommendation before 2004)
|
||||
# utf8only: only UTF8Strings (PKIX recommendation after 2004).
|
||||
# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
|
||||
# MASK:XXXX a literal mask value.
|
||||
# WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings
|
||||
# so use this option with caution!
|
||||
string_mask = nombstr
|
||||
# WARNING: ancient versions of Netscape crash on BMPStrings or UTF8Strings.
|
||||
string_mask = utf8only
|
||||
|
||||
# req_extensions = v3_req # The extensions to add to a certificate request
|
||||
|
||||
@ -208,6 +212,9 @@ authorityKeyIdentifier=keyid,issuer
|
||||
#nsCaPolicyUrl
|
||||
#nsSslServerName
|
||||
|
||||
# This is required for TSA certificates.
|
||||
# extendedKeyUsage = critical,timeStamping
|
||||
|
||||
[ v3_req ]
|
||||
|
||||
# Extensions to add to a certificate request
|
||||
@ -225,7 +232,7 @@ keyUsage = nonRepudiation, digitalSignature, keyEncipherment
|
||||
|
||||
subjectKeyIdentifier=hash
|
||||
|
||||
authorityKeyIdentifier=keyid:always,issuer:always
|
||||
authorityKeyIdentifier=keyid:always,issuer
|
||||
|
||||
# This is what PKIX recommends but some broken software chokes on critical
|
||||
# extensions.
|
||||
@ -258,7 +265,7 @@ basicConstraints = CA:true
|
||||
# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
|
||||
|
||||
# issuerAltName=issuer:copy
|
||||
authorityKeyIdentifier=keyid:always,issuer:always
|
||||
authorityKeyIdentifier=keyid:always
|
||||
|
||||
[ proxy_cert_ext ]
|
||||
# These extensions should be added when creating a proxy certificate
|
||||
@ -291,7 +298,7 @@ nsComment = "OpenSSL Generated Certificate"
|
||||
|
||||
# PKIX recommendations harmless if included in all certificates.
|
||||
subjectKeyIdentifier=hash
|
||||
authorityKeyIdentifier=keyid,issuer:always
|
||||
authorityKeyIdentifier=keyid,issuer
|
||||
|
||||
# This stuff is for subjectAltName and issuerAltname.
|
||||
# Import the email address.
|
||||
@ -312,3 +319,33 @@ authorityKeyIdentifier=keyid,issuer:always
|
||||
|
||||
# This really needs to be in place for it to be a proxy certificate.
|
||||
proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo
|
||||
|
||||
####################################################################
|
||||
[ tsa ]
|
||||
|
||||
default_tsa = tsa_config1 # the default TSA section
|
||||
|
||||
[ tsa_config1 ]
|
||||
|
||||
# These are used by the TSA reply generation only.
|
||||
dir = ./demoCA # TSA root directory
|
||||
serial = $dir/tsaserial # The current serial number (mandatory)
|
||||
crypto_device = builtin # OpenSSL engine to use for signing
|
||||
signer_cert = $dir/tsacert.pem # The TSA signing certificate
|
||||
# (optional)
|
||||
certs = $dir/cacert.pem # Certificate chain to include in reply
|
||||
# (optional)
|
||||
signer_key = $dir/private/tsakey.pem # The TSA private key (optional)
|
||||
|
||||
default_policy = tsa_policy1 # Policy if request did not specify it
|
||||
# (optional)
|
||||
other_policies = tsa_policy2, tsa_policy3 # acceptable policies (optional)
|
||||
digests = md5, sha1 # Acceptable message digests (mandatory)
|
||||
accuracy = secs:1, millisecs:500, microsecs:100 # (optional)
|
||||
clock_precision_digits = 0 # number of digits after dot. (optional)
|
||||
ordering = yes # Is ordering defined for timestamps?
|
||||
# (optional, default: no)
|
||||
tsa_name = yes # Must the TSA name be included in the reply?
|
||||
# (optional, default: no)
|
||||
ess_cert_id_chain = no # Must the ESS cert id chain be included?
|
||||
# (optional, default: no)
|
||||
|
@ -68,12 +68,6 @@
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/pkcs12.h>
|
||||
|
||||
#ifdef OPENSSL_SYS_NETWARE
|
||||
/* Rename these functions to avoid name clashes on NetWare OS */
|
||||
#define uni2asc OPENSSL_uni2asc
|
||||
#define asc2uni OPENSSL_asc2uni
|
||||
#endif
|
||||
|
||||
#define PROG pkcs12_main
|
||||
|
||||
const EVP_CIPHER *enc;
|
||||
@ -94,6 +88,7 @@ int print_attribs(BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst,const char *name);
|
||||
void hex_prin(BIO *out, unsigned char *buf, int len);
|
||||
int alg_print(BIO *x, X509_ALGOR *alg);
|
||||
int cert_load(BIO *in, STACK_OF(X509) *sk);
|
||||
static int set_pbe(BIO *err, int *ppbe, const char *str);
|
||||
|
||||
int MAIN(int, char **);
|
||||
|
||||
@ -117,16 +112,17 @@ int MAIN(int argc, char **argv)
|
||||
int maciter = PKCS12_DEFAULT_ITER;
|
||||
int twopass = 0;
|
||||
int keytype = 0;
|
||||
int cert_pbe;
|
||||
int cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC;
|
||||
int key_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
|
||||
int ret = 1;
|
||||
int macver = 1;
|
||||
int noprompt = 0;
|
||||
STACK *canames = NULL;
|
||||
STACK_OF(OPENSSL_STRING) *canames = NULL;
|
||||
char *cpass = NULL, *mpass = NULL;
|
||||
char *passargin = NULL, *passargout = NULL, *passarg = NULL;
|
||||
char *passin = NULL, *passout = NULL;
|
||||
char *inrand = NULL;
|
||||
char *macalg = NULL;
|
||||
char *CApath = NULL, *CAfile = NULL;
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
char *engine=NULL;
|
||||
@ -134,13 +130,6 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
apps_startup();
|
||||
|
||||
#ifdef OPENSSL_FIPS
|
||||
if (FIPS_mode())
|
||||
cert_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
|
||||
else
|
||||
#endif
|
||||
cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC;
|
||||
|
||||
enc = EVP_des_ede3_cbc();
|
||||
if (bio_err == NULL ) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);
|
||||
|
||||
@ -191,33 +180,18 @@ int MAIN(int argc, char **argv)
|
||||
maciter = 1;
|
||||
else if (!strcmp (*args, "-nomac"))
|
||||
maciter = -1;
|
||||
else if (!strcmp (*args, "-macalg"))
|
||||
if (args[1]) {
|
||||
args++;
|
||||
macalg = *args;
|
||||
} else badarg = 1;
|
||||
else if (!strcmp (*args, "-nodes")) enc=NULL;
|
||||
else if (!strcmp (*args, "-certpbe")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
if (!strcmp(*args, "NONE"))
|
||||
cert_pbe = -1;
|
||||
else
|
||||
cert_pbe=OBJ_txt2nid(*args);
|
||||
if(cert_pbe == NID_undef) {
|
||||
BIO_printf(bio_err,
|
||||
"Unknown PBE algorithm %s\n", *args);
|
||||
badarg = 1;
|
||||
}
|
||||
} else badarg = 1;
|
||||
if (!set_pbe(bio_err, &cert_pbe, *++args))
|
||||
badarg = 1;
|
||||
} else if (!strcmp (*args, "-keypbe")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
if (!strcmp(*args, "NONE"))
|
||||
key_pbe = -1;
|
||||
else
|
||||
key_pbe=OBJ_txt2nid(*args);
|
||||
if(key_pbe == NID_undef) {
|
||||
BIO_printf(bio_err,
|
||||
"Unknown PBE algorithm %s\n", *args);
|
||||
badarg = 1;
|
||||
}
|
||||
} else badarg = 1;
|
||||
if (!set_pbe(bio_err, &key_pbe, *++args))
|
||||
badarg = 1;
|
||||
} else if (!strcmp (*args, "-rand")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
@ -248,8 +222,8 @@ int MAIN(int argc, char **argv)
|
||||
} else if (!strcmp (*args, "-caname")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
if (!canames) canames = sk_new_null();
|
||||
sk_push(canames, *args);
|
||||
if (!canames) canames = sk_OPENSSL_STRING_new_null();
|
||||
sk_OPENSSL_STRING_push(canames, *args);
|
||||
} else badarg = 1;
|
||||
} else if (!strcmp (*args, "-in")) {
|
||||
if (args[1]) {
|
||||
@ -338,11 +312,14 @@ int MAIN(int argc, char **argv)
|
||||
#endif
|
||||
BIO_printf (bio_err, "-nodes don't encrypt private keys\n");
|
||||
BIO_printf (bio_err, "-noiter don't use encryption iteration\n");
|
||||
BIO_printf (bio_err, "-nomaciter don't use MAC iteration\n");
|
||||
BIO_printf (bio_err, "-maciter use MAC iteration\n");
|
||||
BIO_printf (bio_err, "-nomac don't generate MAC\n");
|
||||
BIO_printf (bio_err, "-twopass separate MAC, encryption passwords\n");
|
||||
BIO_printf (bio_err, "-descert encrypt PKCS#12 certificates with triple DES (default RC2-40)\n");
|
||||
BIO_printf (bio_err, "-certpbe alg specify certificate PBE algorithm (default RC2-40)\n");
|
||||
BIO_printf (bio_err, "-keypbe alg specify private key PBE algorithm (default 3DES)\n");
|
||||
BIO_printf (bio_err, "-macalg alg digest algorithm used in MAC (default SHA1)\n");
|
||||
BIO_printf (bio_err, "-keyex set MS key exchange type\n");
|
||||
BIO_printf (bio_err, "-keysig set MS key signature type\n");
|
||||
BIO_printf (bio_err, "-password p set import/export password source\n");
|
||||
@ -354,8 +331,8 @@ int MAIN(int argc, char **argv)
|
||||
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, "-CSP name Microsoft CSP name\n");
|
||||
BIO_printf(bio_err, "-LMK Add local machine keyset attribute to private key\n");
|
||||
BIO_printf(bio_err, "-CSP name Microsoft CSP name\n");
|
||||
BIO_printf(bio_err, "-LMK Add local machine keyset attribute to private key\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -445,6 +422,7 @@ int MAIN(int argc, char **argv)
|
||||
EVP_PKEY *key = NULL;
|
||||
X509 *ucert = NULL, *x = NULL;
|
||||
STACK_OF(X509) *certs=NULL;
|
||||
const EVP_MD *macmd = NULL;
|
||||
unsigned char *catmp = NULL;
|
||||
int i;
|
||||
|
||||
@ -571,9 +549,9 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
/* Add any CA names */
|
||||
|
||||
for (i = 0; i < sk_num(canames); i++)
|
||||
for (i = 0; i < sk_OPENSSL_STRING_num(canames); i++)
|
||||
{
|
||||
catmp = (unsigned char *)sk_value(canames, i);
|
||||
catmp = (unsigned char *)sk_OPENSSL_STRING_value(canames, i);
|
||||
X509_alias_set1(sk_X509_value(certs, i), catmp, -1);
|
||||
}
|
||||
|
||||
@ -611,8 +589,18 @@ int MAIN(int argc, char **argv)
|
||||
goto export_end;
|
||||
}
|
||||
|
||||
if (macalg)
|
||||
{
|
||||
macmd = EVP_get_digestbyname(macalg);
|
||||
if (!macmd)
|
||||
{
|
||||
BIO_printf(bio_err, "Unknown digest algorithm %s\n",
|
||||
macalg);
|
||||
}
|
||||
}
|
||||
|
||||
if (maciter != -1)
|
||||
PKCS12_set_mac(p12, mpass, -1, NULL, 0, maciter, NULL);
|
||||
PKCS12_set_mac(p12, mpass, -1, NULL, 0, maciter, macmd);
|
||||
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
CRYPTO_pop_info();
|
||||
@ -699,7 +687,7 @@ int MAIN(int argc, char **argv)
|
||||
#endif
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
if (canames) sk_free(canames);
|
||||
if (canames) sk_OPENSSL_STRING_free(canames);
|
||||
if(passin) OPENSSL_free(passin);
|
||||
if(passout) OPENSSL_free(passout);
|
||||
apps_shutdown();
|
||||
@ -935,7 +923,7 @@ int print_attribs (BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst,const char *name)
|
||||
av = sk_ASN1_TYPE_value(attr->value.set, 0);
|
||||
switch(av->type) {
|
||||
case V_ASN1_BMPSTRING:
|
||||
value = uni2asc(av->value.bmpstring->data,
|
||||
value = OPENSSL_uni2asc(av->value.bmpstring->data,
|
||||
av->value.bmpstring->length);
|
||||
BIO_printf(out, "%s\n", value);
|
||||
OPENSSL_free(value);
|
||||
@ -968,4 +956,22 @@ void hex_prin(BIO *out, unsigned char *buf, int len)
|
||||
for (i = 0; i < len; i++) BIO_printf (out, "%02X ", buf[i]);
|
||||
}
|
||||
|
||||
static int set_pbe(BIO *err, int *ppbe, const char *str)
|
||||
{
|
||||
if (!str)
|
||||
return 0;
|
||||
if (!strcmp(str, "NONE"))
|
||||
{
|
||||
*ppbe = -1;
|
||||
return 1;
|
||||
}
|
||||
*ppbe=OBJ_txt2nid(str);
|
||||
if (*ppbe == NID_undef)
|
||||
{
|
||||
BIO_printf(bio_err, "Unknown PBE algorithm %s\n", str);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -87,7 +87,7 @@ int MAIN(int argc, char **argv)
|
||||
BIO *in=NULL,*out=NULL;
|
||||
int informat,outformat;
|
||||
char *infile,*outfile,*prog;
|
||||
int print_certs=0,text=0,noout=0;
|
||||
int print_certs=0,text=0,noout=0,p7_print=0;
|
||||
int ret=1;
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
char *engine=NULL;
|
||||
@ -136,6 +136,8 @@ int MAIN(int argc, char **argv)
|
||||
noout=1;
|
||||
else if (strcmp(*argv,"-text") == 0)
|
||||
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
|
||||
@ -235,6 +237,9 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (p7_print)
|
||||
PKCS7_print_ctx(out, p7, 0, NULL);
|
||||
|
||||
if (print_certs)
|
||||
{
|
||||
STACK_OF(X509) *certs=NULL;
|
||||
|
@ -80,11 +80,12 @@ int MAIN(int argc, char **argv)
|
||||
int informat, outformat;
|
||||
int p8_broken = PKCS8_OK;
|
||||
int nocrypt = 0;
|
||||
X509_SIG *p8;
|
||||
PKCS8_PRIV_KEY_INFO *p8inf;
|
||||
X509_SIG *p8 = NULL;
|
||||
PKCS8_PRIV_KEY_INFO *p8inf = NULL;
|
||||
EVP_PKEY *pkey=NULL;
|
||||
char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL;
|
||||
int badarg = 0;
|
||||
int ret = 1;
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
char *engine=NULL;
|
||||
#endif
|
||||
@ -225,7 +226,7 @@ int MAIN(int argc, char **argv)
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n");
|
||||
#endif
|
||||
return 1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
@ -235,7 +236,7 @@ int MAIN(int argc, char **argv)
|
||||
if (!app_passwd(bio_err, passargin, passargout, &passin, &passout))
|
||||
{
|
||||
BIO_printf(bio_err, "Error getting passwords\n");
|
||||
return 1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if ((pbe_nid == -1) && !cipher)
|
||||
@ -247,7 +248,7 @@ int MAIN(int argc, char **argv)
|
||||
{
|
||||
BIO_printf(bio_err,
|
||||
"Can't open input file %s\n", infile);
|
||||
return (1);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -259,7 +260,7 @@ int MAIN(int argc, char **argv)
|
||||
{
|
||||
BIO_printf(bio_err,
|
||||
"Can't open output file %s\n", outfile);
|
||||
return (1);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -274,21 +275,15 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
if (topk8)
|
||||
{
|
||||
BIO_free(in); /* Not needed in this section */
|
||||
pkey = load_key(bio_err, infile, informat, 1,
|
||||
passin, e, "key");
|
||||
if (!pkey)
|
||||
{
|
||||
BIO_free_all(out);
|
||||
return 1;
|
||||
}
|
||||
goto end;
|
||||
if (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken)))
|
||||
{
|
||||
BIO_printf(bio_err, "Error converting key\n");
|
||||
ERR_print_errors(bio_err);
|
||||
EVP_PKEY_free(pkey);
|
||||
BIO_free_all(out);
|
||||
return 1;
|
||||
goto end;
|
||||
}
|
||||
if (nocrypt)
|
||||
{
|
||||
@ -299,10 +294,7 @@ int MAIN(int argc, char **argv)
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_err, "Bad format specified for key\n");
|
||||
PKCS8_PRIV_KEY_INFO_free(p8inf);
|
||||
EVP_PKEY_free(pkey);
|
||||
BIO_free_all(out);
|
||||
return (1);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -313,12 +305,7 @@ int MAIN(int argc, char **argv)
|
||||
{
|
||||
p8pass = pass;
|
||||
if (EVP_read_pw_string(pass, sizeof pass, "Enter Encryption Password:", 1))
|
||||
{
|
||||
PKCS8_PRIV_KEY_INFO_free(p8inf);
|
||||
EVP_PKEY_free(pkey);
|
||||
BIO_free_all(out);
|
||||
return (1);
|
||||
}
|
||||
goto end;
|
||||
}
|
||||
app_RAND_load_file(NULL, bio_err, 0);
|
||||
if (!(p8 = PKCS8_encrypt(pbe_nid, cipher,
|
||||
@ -327,10 +314,7 @@ int MAIN(int argc, char **argv)
|
||||
{
|
||||
BIO_printf(bio_err, "Error encrypting key\n");
|
||||
ERR_print_errors(bio_err);
|
||||
PKCS8_PRIV_KEY_INFO_free(p8inf);
|
||||
EVP_PKEY_free(pkey);
|
||||
BIO_free_all(out);
|
||||
return (1);
|
||||
goto end;
|
||||
}
|
||||
app_RAND_write_file(NULL, bio_err);
|
||||
if (outformat == FORMAT_PEM)
|
||||
@ -340,22 +324,12 @@ int MAIN(int argc, char **argv)
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_err, "Bad format specified for key\n");
|
||||
PKCS8_PRIV_KEY_INFO_free(p8inf);
|
||||
EVP_PKEY_free(pkey);
|
||||
BIO_free_all(out);
|
||||
return (1);
|
||||
goto end;
|
||||
}
|
||||
X509_SIG_free(p8);
|
||||
}
|
||||
|
||||
PKCS8_PRIV_KEY_INFO_free (p8inf);
|
||||
EVP_PKEY_free(pkey);
|
||||
BIO_free_all(out);
|
||||
if (passin)
|
||||
OPENSSL_free(passin);
|
||||
if (passout)
|
||||
OPENSSL_free(passout);
|
||||
return (0);
|
||||
ret = 0;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (nocrypt)
|
||||
@ -367,7 +341,7 @@ int MAIN(int argc, char **argv)
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_err, "Bad format specified for key\n");
|
||||
return (1);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -379,14 +353,14 @@ int MAIN(int argc, char **argv)
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_err, "Bad format specified for key\n");
|
||||
return (1);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!p8)
|
||||
{
|
||||
BIO_printf (bio_err, "Error reading key\n");
|
||||
ERR_print_errors(bio_err);
|
||||
return (1);
|
||||
goto end;
|
||||
}
|
||||
if (passin)
|
||||
p8pass = passin;
|
||||
@ -396,21 +370,20 @@ int MAIN(int argc, char **argv)
|
||||
EVP_read_pw_string(pass, sizeof pass, "Enter Password:", 0);
|
||||
}
|
||||
p8inf = PKCS8_decrypt(p8, p8pass, strlen(p8pass));
|
||||
X509_SIG_free(p8);
|
||||
}
|
||||
|
||||
if (!p8inf)
|
||||
{
|
||||
BIO_printf(bio_err, "Error decrypting key\n");
|
||||
ERR_print_errors(bio_err);
|
||||
return (1);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!(pkey = EVP_PKCS82PKEY(p8inf)))
|
||||
{
|
||||
BIO_printf(bio_err, "Error converting key\n");
|
||||
ERR_print_errors(bio_err);
|
||||
return (1);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (p8inf->broken)
|
||||
@ -430,13 +403,16 @@ int MAIN(int argc, char **argv)
|
||||
BIO_printf(bio_err, "DSA public key include in PrivateKey\n");
|
||||
break;
|
||||
|
||||
case PKCS8_NEG_PRIVKEY:
|
||||
BIO_printf(bio_err, "DSA private key value is negative\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
BIO_printf(bio_err, "Unknown broken type\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PKCS8_PRIV_KEY_INFO_free(p8inf);
|
||||
if (outformat == FORMAT_PEM)
|
||||
PEM_write_bio_PrivateKey(out, pkey, NULL, NULL, 0, NULL, passout);
|
||||
else if (outformat == FORMAT_ASN1)
|
||||
@ -444,10 +420,13 @@ int MAIN(int argc, char **argv)
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_err, "Bad format specified for key\n");
|
||||
return (1);
|
||||
goto end;
|
||||
}
|
||||
ret = 0;
|
||||
|
||||
end:
|
||||
X509_SIG_free(p8);
|
||||
PKCS8_PRIV_KEY_INFO_free(p8inf);
|
||||
EVP_PKEY_free(pkey);
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
@ -456,5 +435,5 @@ int MAIN(int argc, char **argv)
|
||||
if (passout)
|
||||
OPENSSL_free(passout);
|
||||
|
||||
return (0);
|
||||
return ret;
|
||||
}
|
||||
|
284
crypto/openssl/apps/pkey.c
Normal file
284
crypto/openssl/apps/pkey.c
Normal file
@ -0,0 +1,284 @@
|
||||
/* apps/pkey.c */
|
||||
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
|
||||
* project 2006
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2006 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* licensing@OpenSSL.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "apps.h"
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/evp.h>
|
||||
|
||||
#define PROG pkey_main
|
||||
|
||||
int MAIN(int, char **);
|
||||
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
char **args, *infile = NULL, *outfile = NULL;
|
||||
char *passargin = NULL, *passargout = NULL;
|
||||
BIO *in = NULL, *out = NULL;
|
||||
const EVP_CIPHER *cipher = NULL;
|
||||
int informat, outformat;
|
||||
int pubin = 0, pubout = 0, pubtext = 0, text = 0, noout = 0;
|
||||
EVP_PKEY *pkey=NULL;
|
||||
char *passin = NULL, *passout = NULL;
|
||||
int badarg = 0;
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
char *engine=NULL;
|
||||
#endif
|
||||
int ret = 1;
|
||||
|
||||
if (bio_err == NULL)
|
||||
bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);
|
||||
|
||||
if (!load_config(bio_err, NULL))
|
||||
goto end;
|
||||
|
||||
informat=FORMAT_PEM;
|
||||
outformat=FORMAT_PEM;
|
||||
|
||||
ERR_load_crypto_strings();
|
||||
OpenSSL_add_all_algorithms();
|
||||
args = argv + 1;
|
||||
while (!badarg && *args && *args[0] == '-')
|
||||
{
|
||||
if (!strcmp(*args,"-inform"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
informat=str2fmt(*args);
|
||||
}
|
||||
else badarg = 1;
|
||||
}
|
||||
else if (!strcmp(*args,"-outform"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
outformat=str2fmt(*args);
|
||||
}
|
||||
else badarg = 1;
|
||||
}
|
||||
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
|
||||
else if (strcmp(*args,"-engine") == 0)
|
||||
{
|
||||
if (!args[1]) goto bad;
|
||||
engine= *(++args);
|
||||
}
|
||||
#endif
|
||||
else if (!strcmp (*args, "-in"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
infile = *args;
|
||||
}
|
||||
else badarg = 1;
|
||||
}
|
||||
else if (!strcmp (*args, "-out"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
outfile = *args;
|
||||
}
|
||||
else badarg = 1;
|
||||
}
|
||||
else if (strcmp(*args,"-pubin") == 0)
|
||||
{
|
||||
pubin=1;
|
||||
pubout=1;
|
||||
pubtext=1;
|
||||
}
|
||||
else if (strcmp(*args,"-pubout") == 0)
|
||||
pubout=1;
|
||||
else if (strcmp(*args,"-text_pub") == 0)
|
||||
{
|
||||
pubtext=1;
|
||||
text=1;
|
||||
}
|
||||
else if (strcmp(*args,"-text") == 0)
|
||||
text=1;
|
||||
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)
|
||||
{
|
||||
bad:
|
||||
BIO_printf(bio_err, "Usage pkey [options]\n");
|
||||
BIO_printf(bio_err, "where options are\n");
|
||||
BIO_printf(bio_err, "-in file input file\n");
|
||||
BIO_printf(bio_err, "-inform X input format (DER or PEM)\n");
|
||||
BIO_printf(bio_err, "-passin arg input file pass phrase source\n");
|
||||
BIO_printf(bio_err, "-outform X output format (DER or PEM)\n");
|
||||
BIO_printf(bio_err, "-out file output file\n");
|
||||
BIO_printf(bio_err, "-passout arg output file pass phrase source\n");
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
BIO_printf(bio_err, "-engine e use engine e, possibly a hardware device.\n");
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
e = setup_engine(bio_err, engine, 0);
|
||||
#endif
|
||||
|
||||
if (!app_passwd(bio_err, passargin, passargout, &passin, &passout))
|
||||
{
|
||||
BIO_printf(bio_err, "Error getting passwords\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (outfile)
|
||||
{
|
||||
if (!(out = BIO_new_file (outfile, "wb")))
|
||||
{
|
||||
BIO_printf(bio_err,
|
||||
"Can't open output file %s\n", outfile);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
out = BIO_new_fp (stdout, BIO_NOCLOSE);
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
{
|
||||
BIO *tmpbio = BIO_new(BIO_f_linebuffer());
|
||||
out = BIO_push(tmpbio, out);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (pubin)
|
||||
pkey = load_pubkey(bio_err, infile, informat, 1,
|
||||
passin, e, "Public Key");
|
||||
else
|
||||
pkey = load_key(bio_err, infile, informat, 1,
|
||||
passin, e, "key");
|
||||
if (!pkey)
|
||||
goto end;
|
||||
|
||||
if (!noout)
|
||||
{
|
||||
if (outformat == FORMAT_PEM)
|
||||
{
|
||||
if (pubout)
|
||||
PEM_write_bio_PUBKEY(out,pkey);
|
||||
else
|
||||
PEM_write_bio_PrivateKey(out, pkey, cipher,
|
||||
NULL, 0, NULL, passout);
|
||||
}
|
||||
else if (outformat == FORMAT_ASN1)
|
||||
{
|
||||
if (pubout)
|
||||
i2d_PUBKEY_bio(out, pkey);
|
||||
else
|
||||
i2d_PrivateKey_bio(out, pkey);
|
||||
}
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_err, "Bad format specified for key\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (text)
|
||||
{
|
||||
if (pubtext)
|
||||
EVP_PKEY_print_public(out, pkey, 0, NULL);
|
||||
else
|
||||
EVP_PKEY_print_private(out, pkey, 0, NULL);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
end:
|
||||
EVP_PKEY_free(pkey);
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
if (passin)
|
||||
OPENSSL_free(passin);
|
||||
if (passout)
|
||||
OPENSSL_free(passout);
|
||||
|
||||
return ret;
|
||||
}
|
200
crypto/openssl/apps/pkeyparam.c
Normal file
200
crypto/openssl/apps/pkeyparam.c
Normal file
@ -0,0 +1,200 @@
|
||||
/* apps/pkeyparam.c */
|
||||
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
|
||||
* project 2006
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2006 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* licensing@OpenSSL.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "apps.h"
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/evp.h>
|
||||
|
||||
#define PROG pkeyparam_main
|
||||
|
||||
int MAIN(int, char **);
|
||||
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
char **args, *infile = NULL, *outfile = NULL;
|
||||
BIO *in = NULL, *out = NULL;
|
||||
int text = 0, noout = 0;
|
||||
EVP_PKEY *pkey=NULL;
|
||||
int badarg = 0;
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
char *engine=NULL;
|
||||
#endif
|
||||
int ret = 1;
|
||||
|
||||
if (bio_err == NULL)
|
||||
bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);
|
||||
|
||||
if (!load_config(bio_err, NULL))
|
||||
goto end;
|
||||
|
||||
ERR_load_crypto_strings();
|
||||
OpenSSL_add_all_algorithms();
|
||||
args = argv + 1;
|
||||
while (!badarg && *args && *args[0] == '-')
|
||||
{
|
||||
if (!strcmp (*args, "-in"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
infile = *args;
|
||||
}
|
||||
else badarg = 1;
|
||||
}
|
||||
else if (!strcmp (*args, "-out"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
outfile = *args;
|
||||
}
|
||||
else badarg = 1;
|
||||
}
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
else if (strcmp(*args,"-engine") == 0)
|
||||
{
|
||||
if (!args[1]) goto bad;
|
||||
engine= *(++args);
|
||||
}
|
||||
#endif
|
||||
|
||||
else if (strcmp(*args,"-text") == 0)
|
||||
text=1;
|
||||
else if (strcmp(*args,"-noout") == 0)
|
||||
noout=1;
|
||||
args++;
|
||||
}
|
||||
|
||||
if (badarg)
|
||||
{
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
bad:
|
||||
#endif
|
||||
BIO_printf(bio_err, "Usage pkeyparam [options]\n");
|
||||
BIO_printf(bio_err, "where options are\n");
|
||||
BIO_printf(bio_err, "-in file input 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, "-noout don't output encoded parameters\n");
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
BIO_printf(bio_err, "-engine e use engine e, possibly a hardware device.\n");
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
setup_engine(bio_err, engine, 0);
|
||||
#endif
|
||||
|
||||
if (infile)
|
||||
{
|
||||
if (!(in = BIO_new_file (infile, "r")))
|
||||
{
|
||||
BIO_printf(bio_err,
|
||||
"Can't open input file %s\n", infile);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
in = BIO_new_fp (stdin, BIO_NOCLOSE);
|
||||
|
||||
if (outfile)
|
||||
{
|
||||
if (!(out = BIO_new_file (outfile, "w")))
|
||||
{
|
||||
BIO_printf(bio_err,
|
||||
"Can't open output file %s\n", outfile);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
out = BIO_new_fp (stdout, BIO_NOCLOSE);
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
{
|
||||
BIO *tmpbio = BIO_new(BIO_f_linebuffer());
|
||||
out = BIO_push(tmpbio, out);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
pkey = PEM_read_bio_Parameters(in, NULL);
|
||||
if (!pkey)
|
||||
{
|
||||
BIO_printf(bio_err, "Error reading parameters\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!noout)
|
||||
PEM_write_bio_Parameters(out,pkey);
|
||||
|
||||
if (text)
|
||||
EVP_PKEY_print_params(out, pkey, 0, NULL);
|
||||
|
||||
ret = 0;
|
||||
|
||||
end:
|
||||
EVP_PKEY_free(pkey);
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
|
||||
return ret;
|
||||
}
|
570
crypto/openssl/apps/pkeyutl.c
Normal file
570
crypto/openssl/apps/pkeyutl.c
Normal file
@ -0,0 +1,570 @@
|
||||
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
|
||||
* project 2006.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2006 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* licensing@OpenSSL.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "apps.h"
|
||||
#include <string.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/evp.h>
|
||||
|
||||
#define KEY_PRIVKEY 1
|
||||
#define KEY_PUBKEY 2
|
||||
#define KEY_CERT 3
|
||||
|
||||
static void usage(void);
|
||||
|
||||
#undef PROG
|
||||
|
||||
#define PROG pkeyutl_main
|
||||
|
||||
static EVP_PKEY_CTX *init_ctx(int *pkeysize,
|
||||
char *keyfile, int keyform, int key_type,
|
||||
char *passargin, int pkey_op, ENGINE *e);
|
||||
|
||||
static int setup_peer(BIO *err, EVP_PKEY_CTX *ctx, int peerform,
|
||||
const char *file);
|
||||
|
||||
static int do_keyop(EVP_PKEY_CTX *ctx, int pkey_op,
|
||||
unsigned char *out, size_t *poutlen,
|
||||
unsigned char *in, size_t inlen);
|
||||
|
||||
int MAIN(int argc, char **);
|
||||
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
BIO *in = NULL, *out = NULL;
|
||||
char *infile = NULL, *outfile = NULL, *sigfile = NULL;
|
||||
ENGINE *e = NULL;
|
||||
int pkey_op = EVP_PKEY_OP_SIGN, key_type = KEY_PRIVKEY;
|
||||
int keyform = FORMAT_PEM, peerform = FORMAT_PEM;
|
||||
char badarg = 0, rev = 0;
|
||||
char hexdump = 0, asn1parse = 0;
|
||||
EVP_PKEY_CTX *ctx = NULL;
|
||||
char *passargin = NULL;
|
||||
int keysize = -1;
|
||||
|
||||
unsigned char *buf_in = NULL, *buf_out = NULL, *sig = NULL;
|
||||
size_t buf_outlen;
|
||||
int buf_inlen = 0, siglen = -1;
|
||||
|
||||
int ret = 1, rv = -1;
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
if(!bio_err) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
|
||||
|
||||
if (!load_config(bio_err, NULL))
|
||||
goto end;
|
||||
ERR_load_crypto_strings();
|
||||
OpenSSL_add_all_algorithms();
|
||||
|
||||
while(argc >= 1)
|
||||
{
|
||||
if (!strcmp(*argv,"-in"))
|
||||
{
|
||||
if (--argc < 1) badarg = 1;
|
||||
else infile= *(++argv);
|
||||
}
|
||||
else if (!strcmp(*argv,"-out"))
|
||||
{
|
||||
if (--argc < 1) badarg = 1;
|
||||
else outfile= *(++argv);
|
||||
}
|
||||
else if (!strcmp(*argv,"-sigfile"))
|
||||
{
|
||||
if (--argc < 1) badarg = 1;
|
||||
else sigfile= *(++argv);
|
||||
}
|
||||
else if(!strcmp(*argv, "-inkey"))
|
||||
{
|
||||
if (--argc < 1)
|
||||
badarg = 1;
|
||||
else
|
||||
{
|
||||
ctx = init_ctx(&keysize,
|
||||
*(++argv), keyform, key_type,
|
||||
passargin, pkey_op, e);
|
||||
if (!ctx)
|
||||
{
|
||||
BIO_puts(bio_err,
|
||||
"Error initializing context\n");
|
||||
ERR_print_errors(bio_err);
|
||||
badarg = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcmp(*argv,"-peerkey"))
|
||||
{
|
||||
if (--argc < 1)
|
||||
badarg = 1;
|
||||
else if (!setup_peer(bio_err, ctx, peerform, *(++argv)))
|
||||
badarg = 1;
|
||||
}
|
||||
else if (!strcmp(*argv,"-passin"))
|
||||
{
|
||||
if (--argc < 1) badarg = 1;
|
||||
else passargin= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-peerform") == 0)
|
||||
{
|
||||
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
|
||||
else if(!strcmp(*argv, "-engine"))
|
||||
{
|
||||
if (--argc < 1)
|
||||
badarg = 1;
|
||||
else
|
||||
e = setup_engine(bio_err, *(++argv), 0);
|
||||
}
|
||||
#endif
|
||||
else if(!strcmp(*argv, "-pubin"))
|
||||
key_type = KEY_PUBKEY;
|
||||
else if(!strcmp(*argv, "-certin"))
|
||||
key_type = KEY_CERT;
|
||||
else if(!strcmp(*argv, "-asn1parse"))
|
||||
asn1parse = 1;
|
||||
else if(!strcmp(*argv, "-hexdump"))
|
||||
hexdump = 1;
|
||||
else if(!strcmp(*argv, "-sign"))
|
||||
pkey_op = EVP_PKEY_OP_SIGN;
|
||||
else if(!strcmp(*argv, "-verify"))
|
||||
pkey_op = EVP_PKEY_OP_VERIFY;
|
||||
else if(!strcmp(*argv, "-verifyrecover"))
|
||||
pkey_op = EVP_PKEY_OP_VERIFYRECOVER;
|
||||
else if(!strcmp(*argv, "-rev"))
|
||||
rev = 1;
|
||||
else if(!strcmp(*argv, "-encrypt"))
|
||||
pkey_op = EVP_PKEY_OP_ENCRYPT;
|
||||
else if(!strcmp(*argv, "-decrypt"))
|
||||
pkey_op = EVP_PKEY_OP_DECRYPT;
|
||||
else if(!strcmp(*argv, "-derive"))
|
||||
pkey_op = EVP_PKEY_OP_DERIVE;
|
||||
else if (strcmp(*argv,"-pkeyopt") == 0)
|
||||
{
|
||||
if (--argc < 1)
|
||||
badarg = 1;
|
||||
else if (!ctx)
|
||||
{
|
||||
BIO_puts(bio_err,
|
||||
"-pkeyopt command before -inkey\n");
|
||||
badarg = 1;
|
||||
}
|
||||
else if (pkey_ctrl_string(ctx, *(++argv)) <= 0)
|
||||
{
|
||||
BIO_puts(bio_err, "parameter setting error\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else badarg = 1;
|
||||
if(badarg)
|
||||
{
|
||||
usage();
|
||||
goto end;
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
|
||||
if (!ctx)
|
||||
{
|
||||
usage();
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (sigfile && (pkey_op != EVP_PKEY_OP_VERIFY))
|
||||
{
|
||||
BIO_puts(bio_err, "Signature file specified for non verify\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!sigfile && (pkey_op == EVP_PKEY_OP_VERIFY))
|
||||
{
|
||||
BIO_puts(bio_err, "No signature file specified for verify\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* FIXME: seed PRNG only if needed */
|
||||
app_RAND_load_file(NULL, bio_err, 0);
|
||||
|
||||
if (pkey_op != EVP_PKEY_OP_DERIVE)
|
||||
{
|
||||
if(infile)
|
||||
{
|
||||
if(!(in = BIO_new_file(infile, "rb")))
|
||||
{
|
||||
BIO_puts(bio_err,
|
||||
"Error Opening Input File\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
in = BIO_new_fp(stdin, BIO_NOCLOSE);
|
||||
}
|
||||
|
||||
if(outfile)
|
||||
{
|
||||
if(!(out = BIO_new_file(outfile, "wb")))
|
||||
{
|
||||
BIO_printf(bio_err, "Error Creating Output File\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
out = BIO_new_fp(stdout, BIO_NOCLOSE);
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
{
|
||||
BIO *tmpbio = BIO_new(BIO_f_linebuffer());
|
||||
out = BIO_push(tmpbio, out);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (sigfile)
|
||||
{
|
||||
BIO *sigbio = BIO_new_file(sigfile, "rb");
|
||||
if (!sigbio)
|
||||
{
|
||||
BIO_printf(bio_err, "Can't open signature file %s\n",
|
||||
sigfile);
|
||||
goto end;
|
||||
}
|
||||
siglen = bio_to_mem(&sig, keysize * 10, sigbio);
|
||||
BIO_free(sigbio);
|
||||
if (siglen <= 0)
|
||||
{
|
||||
BIO_printf(bio_err, "Error reading signature data\n");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (in)
|
||||
{
|
||||
/* Read the input data */
|
||||
buf_inlen = bio_to_mem(&buf_in, keysize * 10, in);
|
||||
if(buf_inlen <= 0)
|
||||
{
|
||||
BIO_printf(bio_err, "Error reading input Data\n");
|
||||
exit(1);
|
||||
}
|
||||
if(rev)
|
||||
{
|
||||
size_t i;
|
||||
unsigned char ctmp;
|
||||
size_t l = (size_t)buf_inlen;
|
||||
for(i = 0; i < l/2; i++)
|
||||
{
|
||||
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)
|
||||
{
|
||||
rv = EVP_PKEY_verify(ctx, sig, (size_t)siglen,
|
||||
buf_in, (size_t)buf_inlen);
|
||||
if (rv == 0)
|
||||
BIO_puts(out, "Signature Verification Failure\n");
|
||||
else if (rv == 1)
|
||||
BIO_puts(out, "Signature Verified Successfully\n");
|
||||
if (rv >= 0)
|
||||
goto end;
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = do_keyop(ctx, pkey_op, NULL, (size_t *)&buf_outlen,
|
||||
buf_in, (size_t)buf_inlen);
|
||||
if (rv > 0)
|
||||
{
|
||||
buf_out = OPENSSL_malloc(buf_outlen);
|
||||
if (!buf_out)
|
||||
rv = -1;
|
||||
else
|
||||
rv = do_keyop(ctx, pkey_op,
|
||||
buf_out, (size_t *)&buf_outlen,
|
||||
buf_in, (size_t)buf_inlen);
|
||||
}
|
||||
}
|
||||
|
||||
if(rv <= 0)
|
||||
{
|
||||
BIO_printf(bio_err, "Public Key operation error\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
ret = 0;
|
||||
if(asn1parse)
|
||||
{
|
||||
if(!ASN1_parse_dump(out, buf_out, buf_outlen, 1, -1))
|
||||
ERR_print_errors(bio_err);
|
||||
}
|
||||
else if(hexdump)
|
||||
BIO_dump(out, (char *)buf_out, buf_outlen);
|
||||
else
|
||||
BIO_write(out, buf_out, buf_outlen);
|
||||
|
||||
end:
|
||||
if (ctx)
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
if (buf_in)
|
||||
OPENSSL_free(buf_in);
|
||||
if (buf_out)
|
||||
OPENSSL_free(buf_out);
|
||||
if (sig)
|
||||
OPENSSL_free(sig);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void usage()
|
||||
{
|
||||
BIO_printf(bio_err, "Usage: pkeyutl [options]\n");
|
||||
BIO_printf(bio_err, "-in file input 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, "-inkey file input key\n");
|
||||
BIO_printf(bio_err, "-keyform arg private key format - default PEM\n");
|
||||
BIO_printf(bio_err, "-pubin input is a public key\n");
|
||||
BIO_printf(bio_err, "-certin input is a certificate carrying a public key\n");
|
||||
BIO_printf(bio_err, "-pkeyopt X:Y public key options\n");
|
||||
BIO_printf(bio_err, "-sign sign with private key\n");
|
||||
BIO_printf(bio_err, "-verify verify with public key\n");
|
||||
BIO_printf(bio_err, "-verifyrecover verify with public key, recover original data\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
|
||||
BIO_printf(bio_err, "-engine e use engine e, possibly a hardware device.\n");
|
||||
#endif
|
||||
BIO_printf(bio_err, "-passin arg pass phrase source\n");
|
||||
|
||||
}
|
||||
|
||||
static EVP_PKEY_CTX *init_ctx(int *pkeysize,
|
||||
char *keyfile, int keyform, int key_type,
|
||||
char *passargin, int pkey_op, ENGINE *e)
|
||||
{
|
||||
EVP_PKEY *pkey = NULL;
|
||||
EVP_PKEY_CTX *ctx = NULL;
|
||||
char *passin = NULL;
|
||||
int rv = -1;
|
||||
X509 *x;
|
||||
if(((pkey_op == EVP_PKEY_OP_SIGN) || (pkey_op == EVP_PKEY_OP_DECRYPT)
|
||||
|| (pkey_op == EVP_PKEY_OP_DERIVE))
|
||||
&& (key_type != KEY_PRIVKEY))
|
||||
{
|
||||
BIO_printf(bio_err, "A private key is needed for this operation\n");
|
||||
goto end;
|
||||
}
|
||||
if(!app_passwd(bio_err, passargin, NULL, &passin, NULL))
|
||||
{
|
||||
BIO_printf(bio_err, "Error getting password\n");
|
||||
goto end;
|
||||
}
|
||||
switch(key_type)
|
||||
{
|
||||
case KEY_PRIVKEY:
|
||||
pkey = load_key(bio_err, keyfile, keyform, 0,
|
||||
passin, e, "Private Key");
|
||||
break;
|
||||
|
||||
case KEY_PUBKEY:
|
||||
pkey = load_pubkey(bio_err, keyfile, keyform, 0,
|
||||
NULL, e, "Public Key");
|
||||
break;
|
||||
|
||||
case KEY_CERT:
|
||||
x = load_cert(bio_err, keyfile, keyform,
|
||||
NULL, e, "Certificate");
|
||||
if(x)
|
||||
{
|
||||
pkey = X509_get_pubkey(x);
|
||||
X509_free(x);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
*pkeysize = EVP_PKEY_size(pkey);
|
||||
|
||||
if (!pkey)
|
||||
goto end;
|
||||
|
||||
ctx = EVP_PKEY_CTX_new(pkey, e);
|
||||
|
||||
EVP_PKEY_free(pkey);
|
||||
|
||||
if (!ctx)
|
||||
goto end;
|
||||
|
||||
switch(pkey_op)
|
||||
{
|
||||
case EVP_PKEY_OP_SIGN:
|
||||
rv = EVP_PKEY_sign_init(ctx);
|
||||
break;
|
||||
|
||||
case EVP_PKEY_OP_VERIFY:
|
||||
rv = EVP_PKEY_verify_init(ctx);
|
||||
break;
|
||||
|
||||
case EVP_PKEY_OP_VERIFYRECOVER:
|
||||
rv = EVP_PKEY_verify_recover_init(ctx);
|
||||
break;
|
||||
|
||||
case EVP_PKEY_OP_ENCRYPT:
|
||||
rv = EVP_PKEY_encrypt_init(ctx);
|
||||
break;
|
||||
|
||||
case EVP_PKEY_OP_DECRYPT:
|
||||
rv = EVP_PKEY_decrypt_init(ctx);
|
||||
break;
|
||||
|
||||
case EVP_PKEY_OP_DERIVE:
|
||||
rv = EVP_PKEY_derive_init(ctx);
|
||||
break;
|
||||
}
|
||||
|
||||
if (rv <= 0)
|
||||
{
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
ctx = NULL;
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
if (passin)
|
||||
OPENSSL_free(passin);
|
||||
|
||||
return ctx;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static int setup_peer(BIO *err, EVP_PKEY_CTX *ctx, int peerform,
|
||||
const char *file)
|
||||
{
|
||||
EVP_PKEY *peer = NULL;
|
||||
int ret;
|
||||
if (!ctx)
|
||||
{
|
||||
BIO_puts(err, "-peerkey command before -inkey\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
peer = load_pubkey(bio_err, file, peerform, 0, NULL, NULL, "Peer Key");
|
||||
|
||||
if (!peer)
|
||||
{
|
||||
BIO_printf(bio_err, "Error reading peer key %s\n", file);
|
||||
ERR_print_errors(err);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = EVP_PKEY_derive_set_peer(ctx, peer);
|
||||
|
||||
EVP_PKEY_free(peer);
|
||||
if (ret <= 0)
|
||||
ERR_print_errors(err);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int do_keyop(EVP_PKEY_CTX *ctx, int pkey_op,
|
||||
unsigned char *out, size_t *poutlen,
|
||||
unsigned char *in, size_t inlen)
|
||||
{
|
||||
int rv = 0;
|
||||
switch(pkey_op)
|
||||
{
|
||||
case EVP_PKEY_OP_VERIFYRECOVER:
|
||||
rv = EVP_PKEY_verify_recover(ctx, out, poutlen, in, inlen);
|
||||
break;
|
||||
|
||||
case EVP_PKEY_OP_SIGN:
|
||||
rv = EVP_PKEY_sign(ctx, out, poutlen, in, inlen);
|
||||
break;
|
||||
|
||||
case EVP_PKEY_OP_ENCRYPT:
|
||||
rv = EVP_PKEY_encrypt(ctx, out, poutlen, in, inlen);
|
||||
break;
|
||||
|
||||
case EVP_PKEY_OP_DECRYPT:
|
||||
rv = EVP_PKEY_decrypt(ctx, out, poutlen, in, inlen);
|
||||
break;
|
||||
|
||||
case EVP_PKEY_OP_DERIVE:
|
||||
rv = EVP_PKEY_derive(ctx, out, poutlen);
|
||||
break;
|
||||
|
||||
}
|
||||
return rv;
|
||||
}
|
@ -62,6 +62,9 @@ int MAIN(int argc, char **argv)
|
||||
{
|
||||
int hex=0;
|
||||
int checks=20;
|
||||
int generate=0;
|
||||
int bits=0;
|
||||
int safe=0;
|
||||
BIGNUM *bn=NULL;
|
||||
BIO *bio_out;
|
||||
|
||||
@ -77,6 +80,15 @@ int MAIN(int argc, char **argv)
|
||||
{
|
||||
if(!strcmp(*argv,"-hex"))
|
||||
hex=1;
|
||||
else if(!strcmp(*argv,"-generate"))
|
||||
generate=1;
|
||||
else if(!strcmp(*argv,"-bits"))
|
||||
if(--argc < 1)
|
||||
goto bad;
|
||||
else
|
||||
bits=atoi(*++argv);
|
||||
else if(!strcmp(*argv,"-safe"))
|
||||
safe=1;
|
||||
else if(!strcmp(*argv,"-checks"))
|
||||
if(--argc < 1)
|
||||
goto bad;
|
||||
@ -91,13 +103,13 @@ int MAIN(int argc, char **argv)
|
||||
++argv;
|
||||
}
|
||||
|
||||
if (argv[0] == NULL)
|
||||
if (argv[0] == NULL && !generate)
|
||||
{
|
||||
BIO_printf(bio_err,"No prime specified\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if ((bio_out=BIO_new(BIO_s_file())) != NULL)
|
||||
if ((bio_out=BIO_new(BIO_s_file())) != NULL)
|
||||
{
|
||||
BIO_set_fp(bio_out,stdout,BIO_NOCLOSE);
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
@ -108,14 +120,32 @@ int MAIN(int argc, char **argv)
|
||||
#endif
|
||||
}
|
||||
|
||||
if(hex)
|
||||
BN_hex2bn(&bn,argv[0]);
|
||||
else
|
||||
BN_dec2bn(&bn,argv[0]);
|
||||
if(generate)
|
||||
{
|
||||
char *s;
|
||||
|
||||
BN_print(bio_out,bn);
|
||||
BIO_printf(bio_out," is %sprime\n",
|
||||
BN_is_prime_ex(bn,checks,NULL,NULL) ? "" : "not ");
|
||||
if(!bits)
|
||||
{
|
||||
BIO_printf(bio_err,"Specifiy the number of bits.\n");
|
||||
return 1;
|
||||
}
|
||||
bn=BN_new();
|
||||
BN_generate_prime_ex(bn,bits,safe,NULL,NULL,NULL);
|
||||
s=hex ? BN_bn2hex(bn) : BN_bn2dec(bn);
|
||||
BIO_printf(bio_out,"%s\n",s);
|
||||
OPENSSL_free(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(hex)
|
||||
BN_hex2bn(&bn,argv[0]);
|
||||
else
|
||||
BN_dec2bn(&bn,argv[0]);
|
||||
|
||||
BN_print(bio_out,bn);
|
||||
BIO_printf(bio_out," is %sprime\n",
|
||||
BN_is_prime_ex(bn,checks,NULL,NULL) ? "" : "not ");
|
||||
}
|
||||
|
||||
BN_free(bn);
|
||||
BIO_free_all(bio_out);
|
||||
|
@ -22,6 +22,7 @@ extern int ecparam_main(int argc,char *argv[]);
|
||||
extern int x509_main(int argc,char *argv[]);
|
||||
extern int genrsa_main(int argc,char *argv[]);
|
||||
extern int gendsa_main(int argc,char *argv[]);
|
||||
extern int genpkey_main(int argc,char *argv[]);
|
||||
extern int s_server_main(int argc,char *argv[]);
|
||||
extern int s_client_main(int argc,char *argv[]);
|
||||
extern int speed_main(int argc,char *argv[]);
|
||||
@ -35,22 +36,31 @@ extern int ciphers_main(int argc,char *argv[]);
|
||||
extern int nseq_main(int argc,char *argv[]);
|
||||
extern int pkcs12_main(int argc,char *argv[]);
|
||||
extern int pkcs8_main(int argc,char *argv[]);
|
||||
extern int pkey_main(int argc,char *argv[]);
|
||||
extern int pkeyparam_main(int argc,char *argv[]);
|
||||
extern int pkeyutl_main(int argc,char *argv[]);
|
||||
extern int spkac_main(int argc,char *argv[]);
|
||||
extern int smime_main(int argc,char *argv[]);
|
||||
extern int rand_main(int argc,char *argv[]);
|
||||
extern int engine_main(int argc,char *argv[]);
|
||||
extern int ocsp_main(int argc,char *argv[]);
|
||||
extern int prime_main(int argc,char *argv[]);
|
||||
extern int ts_main(int argc,char *argv[]);
|
||||
extern int srp_main(int argc,char *argv[]);
|
||||
|
||||
#define FUNC_TYPE_GENERAL 1
|
||||
#define FUNC_TYPE_MD 2
|
||||
#define FUNC_TYPE_CIPHER 3
|
||||
#define FUNC_TYPE_PKEY 4
|
||||
#define FUNC_TYPE_MD_ALG 5
|
||||
#define FUNC_TYPE_CIPHER_ALG 6
|
||||
|
||||
typedef struct {
|
||||
int type;
|
||||
const char *name;
|
||||
int (*func)(int argc,char *argv[]);
|
||||
} FUNCTION;
|
||||
DECLARE_LHASH_OF(FUNCTION);
|
||||
|
||||
FUNCTION functions[] = {
|
||||
{FUNC_TYPE_GENERAL,"verify",verify_main},
|
||||
@ -96,6 +106,7 @@ FUNCTION functions[] = {
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
{FUNC_TYPE_GENERAL,"gendsa",gendsa_main},
|
||||
#endif
|
||||
{FUNC_TYPE_GENERAL,"genpkey",genpkey_main},
|
||||
#if !defined(OPENSSL_NO_SOCK) && !(defined(OPENSSL_NO_SSL2) && defined(OPENSSL_NO_SSL3))
|
||||
{FUNC_TYPE_GENERAL,"s_server",s_server_main},
|
||||
#endif
|
||||
@ -123,14 +134,23 @@ FUNCTION functions[] = {
|
||||
{FUNC_TYPE_GENERAL,"pkcs12",pkcs12_main},
|
||||
#endif
|
||||
{FUNC_TYPE_GENERAL,"pkcs8",pkcs8_main},
|
||||
{FUNC_TYPE_GENERAL,"pkey",pkey_main},
|
||||
{FUNC_TYPE_GENERAL,"pkeyparam",pkeyparam_main},
|
||||
{FUNC_TYPE_GENERAL,"pkeyutl",pkeyutl_main},
|
||||
{FUNC_TYPE_GENERAL,"spkac",spkac_main},
|
||||
{FUNC_TYPE_GENERAL,"smime",smime_main},
|
||||
{FUNC_TYPE_GENERAL,"rand",rand_main},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{FUNC_TYPE_GENERAL,"engine",engine_main},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_OCSP
|
||||
{FUNC_TYPE_GENERAL,"ocsp",ocsp_main},
|
||||
#endif
|
||||
{FUNC_TYPE_GENERAL,"prime",prime_main},
|
||||
{FUNC_TYPE_GENERAL,"ts",ts_main},
|
||||
#ifndef OPENSSL_NO_SRP
|
||||
{FUNC_TYPE_GENERAL,"srp",srp_main},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_MD2
|
||||
{FUNC_TYPE_MD,"md2",dgst_main},
|
||||
#endif
|
||||
@ -189,6 +209,9 @@ FUNCTION functions[] = {
|
||||
{FUNC_TYPE_CIPHER,"camellia-256-ecb",enc_main},
|
||||
#endif
|
||||
{FUNC_TYPE_CIPHER,"base64",enc_main},
|
||||
#ifdef ZLIB
|
||||
{FUNC_TYPE_CIPHER,"zlib",enc_main},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{FUNC_TYPE_CIPHER,"des",enc_main},
|
||||
#endif
|
||||
|
@ -13,12 +13,16 @@ print <<'EOF';
|
||||
#define FUNC_TYPE_GENERAL 1
|
||||
#define FUNC_TYPE_MD 2
|
||||
#define FUNC_TYPE_CIPHER 3
|
||||
#define FUNC_TYPE_PKEY 4
|
||||
#define FUNC_TYPE_MD_ALG 5
|
||||
#define FUNC_TYPE_CIPHER_ALG 6
|
||||
|
||||
typedef struct {
|
||||
int type;
|
||||
const char *name;
|
||||
int (*func)(int argc,char *argv[]);
|
||||
} FUNCTION;
|
||||
DECLARE_LHASH_OF(FUNCTION);
|
||||
|
||||
FUNCTION functions[] = {
|
||||
EOF
|
||||
@ -45,6 +49,10 @@ foreach (@ARGV)
|
||||
{ print "#if !defined(OPENSSL_NO_DES) && !defined(OPENSSL_NO_SHA1)\n${str}#endif\n"; }
|
||||
elsif ( ($_ =~ /^cms$/))
|
||||
{ print "#ifndef OPENSSL_NO_CMS\n${str}#endif\n"; }
|
||||
elsif ( ($_ =~ /^ocsp$/))
|
||||
{ print "#ifndef OPENSSL_NO_OCSP\n${str}#endif\n"; }
|
||||
elsif ( ($_ =~ /^srp$/))
|
||||
{ print "#ifndef OPENSSL_NO_SRP\n${str}#endif\n"; }
|
||||
else
|
||||
{ print $str; }
|
||||
}
|
||||
@ -62,7 +70,7 @@ foreach (
|
||||
"camellia-128-cbc", "camellia-128-ecb",
|
||||
"camellia-192-cbc", "camellia-192-ecb",
|
||||
"camellia-256-cbc", "camellia-256-ecb",
|
||||
"base64",
|
||||
"base64", "zlib",
|
||||
"des", "des3", "desx", "idea", "seed", "rc4", "rc4-40",
|
||||
"rc2", "bf", "cast", "rc5",
|
||||
"des-ecb", "des-ede", "des-ede3",
|
||||
@ -89,6 +97,7 @@ foreach (
|
||||
elsif ($_ =~ /bf/) { $t="#ifndef OPENSSL_NO_BF\n${t}#endif\n"; }
|
||||
elsif ($_ =~ /cast/) { $t="#ifndef OPENSSL_NO_CAST\n${t}#endif\n"; }
|
||||
elsif ($_ =~ /rc5/) { $t="#ifndef OPENSSL_NO_RC5\n${t}#endif\n"; }
|
||||
elsif ($_ =~ /zlib/) { $t="#ifdef ZLIB\n${t}#endif\n"; }
|
||||
print $t;
|
||||
}
|
||||
|
||||
|
@ -141,39 +141,33 @@ static int add_attribute_object(X509_REQ *req, char *text, const char *def,
|
||||
int n_max, unsigned long chtype);
|
||||
static int add_DN_object(X509_NAME *n, char *text, const char *def, char *value,
|
||||
int nid,int n_min,int n_max, unsigned long chtype, int mval);
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
static int MS_CALLBACK req_cb(int p, int n, BN_GENCB *cb);
|
||||
#endif
|
||||
static int genpkey_cb(EVP_PKEY_CTX *ctx);
|
||||
static int req_check_len(int len,int n_min,int n_max);
|
||||
static int check_end(const char *str, const char *end);
|
||||
static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr, int *pkey_type,
|
||||
long *pkeylen, char **palgnam,
|
||||
ENGINE *keygen_engine);
|
||||
#ifndef MONOLITH
|
||||
static char *default_config_file=NULL;
|
||||
#endif
|
||||
static CONF *req_conf=NULL;
|
||||
static int batch=0;
|
||||
|
||||
#define TYPE_RSA 1
|
||||
#define TYPE_DSA 2
|
||||
#define TYPE_DH 3
|
||||
#define TYPE_EC 4
|
||||
|
||||
int MAIN(int, char **);
|
||||
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
DSA *dsa_params=NULL;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
EC_KEY *ec_params = NULL;
|
||||
#endif
|
||||
ENGINE *e = NULL, *gen_eng = NULL;
|
||||
unsigned long nmflag = 0, reqflag = 0;
|
||||
int ex=1,x509=0,days=30;
|
||||
X509 *x509ss=NULL;
|
||||
X509_REQ *req=NULL;
|
||||
EVP_PKEY_CTX *genctx = NULL;
|
||||
const char *keyalg = NULL;
|
||||
char *keyalgstr = NULL;
|
||||
STACK_OF(OPENSSL_STRING) *pkeyopts = NULL, *sigopts = NULL;
|
||||
EVP_PKEY *pkey=NULL;
|
||||
int i=0,badops=0,newreq=0,verbose=0,pkey_type=TYPE_RSA;
|
||||
int i=0,badops=0,newreq=0,verbose=0,pkey_type=-1;
|
||||
long newkey = -1;
|
||||
BIO *in=NULL,*out=NULL;
|
||||
int informat,outformat,verify=0,noout=0,text=0,keyform=FORMAT_PEM;
|
||||
@ -193,7 +187,7 @@ int MAIN(int argc, char **argv)
|
||||
char *p;
|
||||
char *subj = NULL;
|
||||
int multirdn = 0;
|
||||
const EVP_MD *md_alg=NULL,*digest=EVP_sha1();
|
||||
const EVP_MD *md_alg=NULL,*digest=NULL;
|
||||
unsigned long chtype = MBSTRING_ASC;
|
||||
#ifndef MONOLITH
|
||||
char *to_free;
|
||||
@ -236,6 +230,16 @@ int MAIN(int argc, char **argv)
|
||||
if (--argc < 1) goto bad;
|
||||
engine= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-keygen_engine") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
gen_eng = ENGINE_by_id(*(++argv));
|
||||
if (gen_eng == NULL)
|
||||
{
|
||||
BIO_printf(bio_err, "Can't find keygen engine %s\n", *argv);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if (strcmp(*argv,"-key") == 0)
|
||||
{
|
||||
@ -292,126 +296,29 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
else if (strcmp(*argv,"-newkey") == 0)
|
||||
{
|
||||
int is_numeric;
|
||||
|
||||
if (--argc < 1) goto bad;
|
||||
p= *(++argv);
|
||||
is_numeric = p[0] >= '0' && p[0] <= '9';
|
||||
if (strncmp("rsa:",p,4) == 0 || is_numeric)
|
||||
{
|
||||
pkey_type=TYPE_RSA;
|
||||
if(!is_numeric)
|
||||
p+=4;
|
||||
newkey= atoi(p);
|
||||
}
|
||||
else
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
if (strncmp("dsa:",p,4) == 0)
|
||||
{
|
||||
X509 *xtmp=NULL;
|
||||
EVP_PKEY *dtmp;
|
||||
|
||||
pkey_type=TYPE_DSA;
|
||||
p+=4;
|
||||
if ((in=BIO_new_file(p,"r")) == NULL)
|
||||
{
|
||||
perror(p);
|
||||
goto end;
|
||||
}
|
||||
if ((dsa_params=PEM_read_bio_DSAparams(in,NULL,NULL,NULL)) == NULL)
|
||||
{
|
||||
ERR_clear_error();
|
||||
(void)BIO_reset(in);
|
||||
if ((xtmp=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"unable to load DSA parameters from file\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if ((dtmp=X509_get_pubkey(xtmp)) == NULL) goto end;
|
||||
if (dtmp->type == EVP_PKEY_DSA)
|
||||
dsa_params=DSAparams_dup(dtmp->pkey.dsa);
|
||||
EVP_PKEY_free(dtmp);
|
||||
X509_free(xtmp);
|
||||
if (dsa_params == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"Certificate does not contain DSA parameters\n");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
BIO_free(in);
|
||||
in=NULL;
|
||||
newkey=BN_num_bits(dsa_params->p);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (strncmp("ec:",p,3) == 0)
|
||||
{
|
||||
X509 *xtmp=NULL;
|
||||
EVP_PKEY *dtmp;
|
||||
EC_GROUP *group;
|
||||
|
||||
pkey_type=TYPE_EC;
|
||||
p+=3;
|
||||
if ((in=BIO_new_file(p,"r")) == NULL)
|
||||
{
|
||||
perror(p);
|
||||
goto end;
|
||||
}
|
||||
if ((ec_params = EC_KEY_new()) == NULL)
|
||||
goto end;
|
||||
group = PEM_read_bio_ECPKParameters(in, NULL, NULL, NULL);
|
||||
if (group == NULL)
|
||||
{
|
||||
EC_KEY_free(ec_params);
|
||||
ERR_clear_error();
|
||||
(void)BIO_reset(in);
|
||||
if ((xtmp=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"unable to load EC parameters from file\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if ((dtmp=X509_get_pubkey(xtmp))==NULL)
|
||||
goto end;
|
||||
if (dtmp->type == EVP_PKEY_EC)
|
||||
ec_params = EC_KEY_dup(dtmp->pkey.ec);
|
||||
EVP_PKEY_free(dtmp);
|
||||
X509_free(xtmp);
|
||||
if (ec_params == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"Certificate does not contain EC parameters\n");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (EC_KEY_set_group(ec_params, group) == 0)
|
||||
goto end;
|
||||
EC_GROUP_free(group);
|
||||
}
|
||||
|
||||
BIO_free(in);
|
||||
in=NULL;
|
||||
newkey = EC_GROUP_get_degree(EC_KEY_get0_group(ec_params));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DH
|
||||
if (strncmp("dh:",p,4) == 0)
|
||||
{
|
||||
pkey_type=TYPE_DH;
|
||||
p+=3;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (--argc < 1)
|
||||
goto bad;
|
||||
}
|
||||
|
||||
keyalg = *(++argv);
|
||||
newreq=1;
|
||||
}
|
||||
else if (strcmp(*argv,"-pkeyopt") == 0)
|
||||
{
|
||||
if (--argc < 1)
|
||||
goto bad;
|
||||
if (!pkeyopts)
|
||||
pkeyopts = sk_OPENSSL_STRING_new_null();
|
||||
if (!pkeyopts || !sk_OPENSSL_STRING_push(pkeyopts, *(++argv)))
|
||||
goto bad;
|
||||
}
|
||||
else if (strcmp(*argv,"-sigopt") == 0)
|
||||
{
|
||||
if (--argc < 1)
|
||||
goto bad;
|
||||
if (!sigopts)
|
||||
sigopts = sk_OPENSSL_STRING_new_null();
|
||||
if (!sigopts || !sk_OPENSSL_STRING_push(sigopts, *(++argv)))
|
||||
goto bad;
|
||||
}
|
||||
else if (strcmp(*argv,"-batch") == 0)
|
||||
batch=1;
|
||||
else if (strcmp(*argv,"-newhdr") == 0)
|
||||
@ -467,11 +374,6 @@ int MAIN(int argc, char **argv)
|
||||
serial = s2i_ASN1_INTEGER(NULL, *(++argv));
|
||||
if (!serial) goto bad;
|
||||
}
|
||||
else if ((md_alg=EVP_get_digestbyname(&((*argv)[1]))) != NULL)
|
||||
{
|
||||
/* ok */
|
||||
digest=md_alg;
|
||||
}
|
||||
else if (strcmp(*argv,"-extensions") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
@ -482,6 +384,11 @@ int MAIN(int argc, char **argv)
|
||||
if (--argc < 1) goto bad;
|
||||
req_exts = *(++argv);
|
||||
}
|
||||
else if ((md_alg=EVP_get_digestbyname(&((*argv)[1]))) != NULL)
|
||||
{
|
||||
/* ok */
|
||||
digest=md_alg;
|
||||
}
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_err,"unknown option %s\n",*argv);
|
||||
@ -730,15 +637,20 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
if (newreq && (pkey == NULL))
|
||||
{
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
BN_GENCB cb;
|
||||
#endif
|
||||
char *randfile = NCONF_get_string(req_conf,SECTION,"RANDFILE");
|
||||
if (randfile == NULL)
|
||||
ERR_clear_error();
|
||||
app_RAND_load_file(randfile, bio_err, 0);
|
||||
if (inrand)
|
||||
app_RAND_load_files(inrand);
|
||||
|
||||
if (keyalg)
|
||||
{
|
||||
genctx = set_keygen_ctx(bio_err, keyalg, &pkey_type, &newkey,
|
||||
&keyalgstr, gen_eng);
|
||||
if (!genctx)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (newkey <= 0)
|
||||
{
|
||||
@ -746,58 +658,55 @@ int MAIN(int argc, char **argv)
|
||||
newkey=DEFAULT_KEY_LENGTH;
|
||||
}
|
||||
|
||||
if (newkey < MIN_KEY_LENGTH && (pkey_type == TYPE_RSA || pkey_type == TYPE_DSA))
|
||||
if (newkey < MIN_KEY_LENGTH && (pkey_type == EVP_PKEY_RSA || pkey_type == EVP_PKEY_DSA))
|
||||
{
|
||||
BIO_printf(bio_err,"private key length is too short,\n");
|
||||
BIO_printf(bio_err,"it needs to be at least %d bits, not %ld\n",MIN_KEY_LENGTH,newkey);
|
||||
goto end;
|
||||
}
|
||||
BIO_printf(bio_err,"Generating a %ld bit %s private key\n",
|
||||
newkey,(pkey_type == TYPE_RSA)?"RSA":
|
||||
(pkey_type == TYPE_DSA)?"DSA":"EC");
|
||||
|
||||
if ((pkey=EVP_PKEY_new()) == NULL) goto end;
|
||||
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
BN_GENCB_set(&cb, req_cb, bio_err);
|
||||
if (pkey_type == TYPE_RSA)
|
||||
if (!genctx)
|
||||
{
|
||||
RSA *rsa = RSA_new();
|
||||
BIGNUM *bn = BN_new();
|
||||
if(!bn || !rsa || !BN_set_word(bn, 0x10001) ||
|
||||
!RSA_generate_key_ex(rsa, newkey, bn, &cb) ||
|
||||
!EVP_PKEY_assign_RSA(pkey, rsa))
|
||||
genctx = set_keygen_ctx(bio_err, NULL, &pkey_type, &newkey,
|
||||
&keyalgstr, gen_eng);
|
||||
if (!genctx)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (pkeyopts)
|
||||
{
|
||||
char *genopt;
|
||||
for (i = 0; i < sk_OPENSSL_STRING_num(pkeyopts); i++)
|
||||
{
|
||||
if(bn) BN_free(bn);
|
||||
if(rsa) RSA_free(rsa);
|
||||
goto end;
|
||||
genopt = sk_OPENSSL_STRING_value(pkeyopts, i);
|
||||
if (pkey_ctrl_string(genctx, genopt) <= 0)
|
||||
{
|
||||
BIO_printf(bio_err,
|
||||
"parameter error \"%s\"\n",
|
||||
genopt);
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
BN_free(bn);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
if (pkey_type == TYPE_DSA)
|
||||
|
||||
BIO_printf(bio_err,"Generating a %ld bit %s private key\n",
|
||||
newkey, keyalgstr);
|
||||
|
||||
EVP_PKEY_CTX_set_cb(genctx, genpkey_cb);
|
||||
EVP_PKEY_CTX_set_app_data(genctx, bio_err);
|
||||
|
||||
if (EVP_PKEY_keygen(genctx, &pkey) <= 0)
|
||||
{
|
||||
if (!DSA_generate_key(dsa_params)) goto end;
|
||||
if (!EVP_PKEY_assign_DSA(pkey,dsa_params)) goto end;
|
||||
dsa_params=NULL;
|
||||
BIO_puts(bio_err, "Error Generating Key\n");
|
||||
goto end;
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (pkey_type == TYPE_EC)
|
||||
{
|
||||
if (!EC_KEY_generate_key(ec_params)) goto end;
|
||||
if (!EVP_PKEY_assign_EC_KEY(pkey, ec_params))
|
||||
goto end;
|
||||
ec_params = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
EVP_PKEY_CTX_free(genctx);
|
||||
genctx = NULL;
|
||||
|
||||
app_RAND_write_file(randfile, bio_err);
|
||||
|
||||
if (pkey == NULL) goto end;
|
||||
|
||||
if (keyout == NULL)
|
||||
{
|
||||
keyout=NCONF_get_string(req_conf,SECTION,KEYFILE);
|
||||
@ -895,14 +804,7 @@ int MAIN(int argc, char **argv)
|
||||
BIO_printf(bio_err,"you need to specify a private key\n");
|
||||
goto end;
|
||||
}
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
if (pkey->type == EVP_PKEY_DSA)
|
||||
digest=EVP_dss1();
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (pkey->type == EVP_PKEY_EC)
|
||||
digest=EVP_ecdsa();
|
||||
#endif
|
||||
|
||||
if (req == NULL)
|
||||
{
|
||||
req=X509_REQ_new();
|
||||
@ -945,7 +847,7 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
if (!X509_set_issuer_name(x509ss, X509_REQ_get_subject_name(req))) goto end;
|
||||
if (!X509_gmtime_adj(X509_get_notBefore(x509ss),0)) goto end;
|
||||
if (!X509_gmtime_adj(X509_get_notAfter(x509ss), (long)60*60*24*days)) goto end;
|
||||
if (!X509_time_adj_ex(X509_get_notAfter(x509ss), days, 0, NULL)) goto end;
|
||||
if (!X509_set_subject_name(x509ss, X509_REQ_get_subject_name(req))) goto end;
|
||||
tmppkey = X509_REQ_get_pubkey(req);
|
||||
if (!tmppkey || !X509_set_pubkey(x509ss,tmppkey)) goto end;
|
||||
@ -965,9 +867,13 @@ int MAIN(int argc, char **argv)
|
||||
extensions);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!(i=X509_sign(x509ss,pkey,digest)))
|
||||
|
||||
i=do_X509_sign(bio_err, x509ss, pkey, digest, sigopts);
|
||||
if (!i)
|
||||
{
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -987,8 +893,12 @@ int MAIN(int argc, char **argv)
|
||||
req_exts);
|
||||
goto end;
|
||||
}
|
||||
if (!(i=X509_REQ_sign(req,pkey,digest)))
|
||||
i=do_X509_REQ_sign(bio_err, req, pkey, digest, sigopts);
|
||||
if (!i)
|
||||
{
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1125,7 +1035,7 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
fprintf(stdout,"Modulus=");
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
if (tpubkey->type == EVP_PKEY_RSA)
|
||||
if (EVP_PKEY_base_id(tpubkey) == EVP_PKEY_RSA)
|
||||
BN_print(out,tpubkey->pkey.rsa->n);
|
||||
else
|
||||
#endif
|
||||
@ -1181,18 +1091,24 @@ int MAIN(int argc, char **argv)
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
EVP_PKEY_free(pkey);
|
||||
if (genctx)
|
||||
EVP_PKEY_CTX_free(genctx);
|
||||
if (pkeyopts)
|
||||
sk_OPENSSL_STRING_free(pkeyopts);
|
||||
if (sigopts)
|
||||
sk_OPENSSL_STRING_free(sigopts);
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
if (gen_eng)
|
||||
ENGINE_free(gen_eng);
|
||||
#endif
|
||||
if (keyalgstr)
|
||||
OPENSSL_free(keyalgstr);
|
||||
X509_REQ_free(req);
|
||||
X509_free(x509ss);
|
||||
ASN1_INTEGER_free(serial);
|
||||
if(passargin && passin) OPENSSL_free(passin);
|
||||
if(passargout && passout) OPENSSL_free(passout);
|
||||
OBJ_cleanup();
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
if (dsa_params != NULL) DSA_free(dsa_params);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (ec_params != NULL) EC_KEY_free(ec_params);
|
||||
#endif
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ex);
|
||||
}
|
||||
@ -1647,24 +1563,6 @@ static int add_attribute_object(X509_REQ *req, char *text, const char *def,
|
||||
return(0);
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
static int MS_CALLBACK req_cb(int p, int n, BN_GENCB *cb)
|
||||
{
|
||||
char c='*';
|
||||
|
||||
if (p == 0) c='.';
|
||||
if (p == 1) c='+';
|
||||
if (p == 2) c='*';
|
||||
if (p == 3) c='\n';
|
||||
BIO_write(cb->arg,&c,1);
|
||||
(void)BIO_flush(cb->arg);
|
||||
#ifdef LINT
|
||||
p=n;
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int req_check_len(int len, int n_min, int n_max)
|
||||
{
|
||||
if ((n_min > 0) && (len < n_min))
|
||||
@ -1691,3 +1589,248 @@ static int check_end(const char *str, const char *end)
|
||||
tmp = str + slen - elen;
|
||||
return strcmp(tmp, end);
|
||||
}
|
||||
|
||||
static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr, int *pkey_type,
|
||||
long *pkeylen, char **palgnam,
|
||||
ENGINE *keygen_engine)
|
||||
{
|
||||
EVP_PKEY_CTX *gctx = NULL;
|
||||
EVP_PKEY *param = NULL;
|
||||
long keylen = -1;
|
||||
BIO *pbio = NULL;
|
||||
const char *paramfile = NULL;
|
||||
|
||||
if (gstr == NULL)
|
||||
{
|
||||
*pkey_type = EVP_PKEY_RSA;
|
||||
keylen = *pkeylen;
|
||||
}
|
||||
else if (gstr[0] >= '0' && gstr[0] <= '9')
|
||||
{
|
||||
*pkey_type = EVP_PKEY_RSA;
|
||||
keylen = atol(gstr);
|
||||
*pkeylen = keylen;
|
||||
}
|
||||
else if (!strncmp(gstr, "param:", 6))
|
||||
paramfile = gstr + 6;
|
||||
else
|
||||
{
|
||||
const char *p = strchr(gstr, ':');
|
||||
int len;
|
||||
ENGINE *tmpeng;
|
||||
const EVP_PKEY_ASN1_METHOD *ameth;
|
||||
|
||||
if (p)
|
||||
len = p - gstr;
|
||||
else
|
||||
len = strlen(gstr);
|
||||
/* The lookup of a the string will cover all engines so
|
||||
* keep a note of the implementation.
|
||||
*/
|
||||
|
||||
ameth = EVP_PKEY_asn1_find_str(&tmpeng, gstr, len);
|
||||
|
||||
if (!ameth)
|
||||
{
|
||||
BIO_printf(err, "Unknown algorithm %.*s\n", len, gstr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EVP_PKEY_asn1_get0_info(NULL, pkey_type, NULL, NULL, NULL,
|
||||
ameth);
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
if (tmpeng)
|
||||
ENGINE_finish(tmpeng);
|
||||
#endif
|
||||
if (*pkey_type == EVP_PKEY_RSA)
|
||||
{
|
||||
if (p)
|
||||
{
|
||||
keylen = atol(p + 1);
|
||||
*pkeylen = keylen;
|
||||
}
|
||||
}
|
||||
else if (p)
|
||||
paramfile = p + 1;
|
||||
}
|
||||
|
||||
if (paramfile)
|
||||
{
|
||||
pbio = BIO_new_file(paramfile, "r");
|
||||
if (!pbio)
|
||||
{
|
||||
BIO_printf(err, "Can't open parameter file %s\n",
|
||||
paramfile);
|
||||
return NULL;
|
||||
}
|
||||
param = PEM_read_bio_Parameters(pbio, NULL);
|
||||
|
||||
if (!param)
|
||||
{
|
||||
X509 *x;
|
||||
(void)BIO_reset(pbio);
|
||||
x = PEM_read_bio_X509(pbio, NULL, NULL, NULL);
|
||||
if (x)
|
||||
{
|
||||
param = X509_get_pubkey(x);
|
||||
X509_free(x);
|
||||
}
|
||||
}
|
||||
|
||||
BIO_free(pbio);
|
||||
|
||||
if (!param)
|
||||
{
|
||||
BIO_printf(err, "Error reading parameter file %s\n",
|
||||
paramfile);
|
||||
return NULL;
|
||||
}
|
||||
if (*pkey_type == -1)
|
||||
*pkey_type = EVP_PKEY_id(param);
|
||||
else if (*pkey_type != EVP_PKEY_base_id(param))
|
||||
{
|
||||
BIO_printf(err, "Key Type does not match parameters\n");
|
||||
EVP_PKEY_free(param);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (palgnam)
|
||||
{
|
||||
const EVP_PKEY_ASN1_METHOD *ameth;
|
||||
ENGINE *tmpeng;
|
||||
const char *anam;
|
||||
ameth = EVP_PKEY_asn1_find(&tmpeng, *pkey_type);
|
||||
if (!ameth)
|
||||
{
|
||||
BIO_puts(err, "Internal error: can't find key algorithm\n");
|
||||
return NULL;
|
||||
}
|
||||
EVP_PKEY_asn1_get0_info(NULL, NULL, NULL, NULL, &anam, ameth);
|
||||
*palgnam = BUF_strdup(anam);
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
if (tmpeng)
|
||||
ENGINE_finish(tmpeng);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (param)
|
||||
{
|
||||
gctx = EVP_PKEY_CTX_new(param, keygen_engine);
|
||||
*pkeylen = EVP_PKEY_bits(param);
|
||||
EVP_PKEY_free(param);
|
||||
}
|
||||
else
|
||||
gctx = EVP_PKEY_CTX_new_id(*pkey_type, keygen_engine);
|
||||
|
||||
if (!gctx)
|
||||
{
|
||||
BIO_puts(err, "Error allocating keygen context\n");
|
||||
ERR_print_errors(err);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (EVP_PKEY_keygen_init(gctx) <= 0)
|
||||
{
|
||||
BIO_puts(err, "Error initializing keygen context\n");
|
||||
ERR_print_errors(err);
|
||||
return NULL;
|
||||
}
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
if ((*pkey_type == EVP_PKEY_RSA) && (keylen != -1))
|
||||
{
|
||||
if (EVP_PKEY_CTX_set_rsa_keygen_bits(gctx, keylen) <= 0)
|
||||
{
|
||||
BIO_puts(err, "Error setting RSA keysize\n");
|
||||
ERR_print_errors(err);
|
||||
EVP_PKEY_CTX_free(gctx);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return gctx;
|
||||
}
|
||||
|
||||
static int genpkey_cb(EVP_PKEY_CTX *ctx)
|
||||
{
|
||||
char c='*';
|
||||
BIO *b = EVP_PKEY_CTX_get_app_data(ctx);
|
||||
int p;
|
||||
p = EVP_PKEY_CTX_get_keygen_info(ctx, 0);
|
||||
if (p == 0) c='.';
|
||||
if (p == 1) c='+';
|
||||
if (p == 2) c='*';
|
||||
if (p == 3) c='\n';
|
||||
BIO_write(b,&c,1);
|
||||
(void)BIO_flush(b);
|
||||
#ifdef LINT
|
||||
p=n;
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int do_sign_init(BIO *err, EVP_MD_CTX *ctx, EVP_PKEY *pkey,
|
||||
const EVP_MD *md, STACK_OF(OPENSSL_STRING) *sigopts)
|
||||
{
|
||||
EVP_PKEY_CTX *pkctx = NULL;
|
||||
int i;
|
||||
EVP_MD_CTX_init(ctx);
|
||||
if (!EVP_DigestSignInit(ctx, &pkctx, md, NULL, pkey))
|
||||
return 0;
|
||||
for (i = 0; i < sk_OPENSSL_STRING_num(sigopts); i++)
|
||||
{
|
||||
char *sigopt = sk_OPENSSL_STRING_value(sigopts, i);
|
||||
if (pkey_ctrl_string(pkctx, sigopt) <= 0)
|
||||
{
|
||||
BIO_printf(err, "parameter error \"%s\"\n", sigopt);
|
||||
ERR_print_errors(bio_err);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_X509_sign(BIO *err, X509 *x, EVP_PKEY *pkey, const EVP_MD *md,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts)
|
||||
{
|
||||
int rv;
|
||||
EVP_MD_CTX mctx;
|
||||
EVP_MD_CTX_init(&mctx);
|
||||
rv = do_sign_init(err, &mctx, pkey, md, sigopts);
|
||||
if (rv > 0)
|
||||
rv = X509_sign_ctx(x, &mctx);
|
||||
EVP_MD_CTX_cleanup(&mctx);
|
||||
return rv > 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
int do_X509_REQ_sign(BIO *err, X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts)
|
||||
{
|
||||
int rv;
|
||||
EVP_MD_CTX mctx;
|
||||
EVP_MD_CTX_init(&mctx);
|
||||
rv = do_sign_init(err, &mctx, pkey, md, sigopts);
|
||||
if (rv > 0)
|
||||
rv = X509_REQ_sign_ctx(x, &mctx);
|
||||
EVP_MD_CTX_cleanup(&mctx);
|
||||
return rv > 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int do_X509_CRL_sign(BIO *err, X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts)
|
||||
{
|
||||
int rv;
|
||||
EVP_MD_CTX mctx;
|
||||
EVP_MD_CTX_init(&mctx);
|
||||
rv = do_sign_init(err, &mctx, pkey, md, sigopts);
|
||||
if (rv > 0)
|
||||
rv = X509_CRL_sign_ctx(x, &mctx);
|
||||
EVP_MD_CTX_cleanup(&mctx);
|
||||
return rv > 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -115,6 +115,8 @@ int MAIN(int argc, char **argv)
|
||||
#endif
|
||||
int modulus=0;
|
||||
|
||||
int pvk_encr = 2;
|
||||
|
||||
apps_startup();
|
||||
|
||||
if (bio_err == NULL)
|
||||
@ -177,6 +179,16 @@ int MAIN(int argc, char **argv)
|
||||
pubin=1;
|
||||
else if (strcmp(*argv,"-pubout") == 0)
|
||||
pubout=1;
|
||||
else if (strcmp(*argv,"-RSAPublicKey_in") == 0)
|
||||
pubin = 2;
|
||||
else if (strcmp(*argv,"-RSAPublicKey_out") == 0)
|
||||
pubout = 2;
|
||||
else if (strcmp(*argv,"-pvk-strong") == 0)
|
||||
pvk_encr=2;
|
||||
else if (strcmp(*argv,"-pvk-weak") == 0)
|
||||
pvk_encr=1;
|
||||
else if (strcmp(*argv,"-pvk-none") == 0)
|
||||
pvk_encr=0;
|
||||
else if (strcmp(*argv,"-noout") == 0)
|
||||
noout=1;
|
||||
else if (strcmp(*argv,"-text") == 0)
|
||||
@ -257,10 +269,23 @@ int MAIN(int argc, char **argv)
|
||||
EVP_PKEY *pkey;
|
||||
|
||||
if (pubin)
|
||||
pkey = load_pubkey(bio_err, infile,
|
||||
(informat == FORMAT_NETSCAPE && sgckey ?
|
||||
FORMAT_IISSGC : informat), 1,
|
||||
{
|
||||
int tmpformat=-1;
|
||||
if (pubin == 2)
|
||||
{
|
||||
if (informat == FORMAT_PEM)
|
||||
tmpformat = FORMAT_PEMRSA;
|
||||
else if (informat == FORMAT_ASN1)
|
||||
tmpformat = FORMAT_ASN1RSA;
|
||||
}
|
||||
else if (informat == FORMAT_NETSCAPE && sgckey)
|
||||
tmpformat = FORMAT_IISSGC;
|
||||
else
|
||||
tmpformat = informat;
|
||||
|
||||
pkey = load_pubkey(bio_err, infile, tmpformat, 1,
|
||||
passin, e, "Public Key");
|
||||
}
|
||||
else
|
||||
pkey = load_key(bio_err, infile,
|
||||
(informat == FORMAT_NETSCAPE && sgckey ?
|
||||
@ -268,7 +293,7 @@ int MAIN(int argc, char **argv)
|
||||
passin, e, "Private Key");
|
||||
|
||||
if (pkey != NULL)
|
||||
rsa = pkey == NULL ? NULL : EVP_PKEY_get1_RSA(pkey);
|
||||
rsa = EVP_PKEY_get1_RSA(pkey);
|
||||
EVP_PKEY_free(pkey);
|
||||
}
|
||||
|
||||
@ -346,7 +371,13 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
BIO_printf(bio_err,"writing RSA key\n");
|
||||
if (outformat == FORMAT_ASN1) {
|
||||
if(pubout || pubin) i=i2d_RSA_PUBKEY_bio(out,rsa);
|
||||
if(pubout || pubin)
|
||||
{
|
||||
if (pubout == 2)
|
||||
i=i2d_RSAPublicKey_bio(out,rsa);
|
||||
else
|
||||
i=i2d_RSA_PUBKEY_bio(out,rsa);
|
||||
}
|
||||
else i=i2d_RSAPrivateKey_bio(out,rsa);
|
||||
}
|
||||
#ifndef OPENSSL_NO_RC4
|
||||
@ -370,14 +401,32 @@ int MAIN(int argc, char **argv)
|
||||
#endif
|
||||
else if (outformat == FORMAT_PEM) {
|
||||
if(pubout || pubin)
|
||||
i=PEM_write_bio_RSA_PUBKEY(out,rsa);
|
||||
{
|
||||
if (pubout == 2)
|
||||
i=PEM_write_bio_RSAPublicKey(out,rsa);
|
||||
else
|
||||
i=PEM_write_bio_RSA_PUBKEY(out,rsa);
|
||||
}
|
||||
else i=PEM_write_bio_RSAPrivateKey(out,rsa,
|
||||
enc,NULL,0,NULL,passout);
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_RC4)
|
||||
} else if (outformat == FORMAT_MSBLOB || outformat == FORMAT_PVK) {
|
||||
EVP_PKEY *pk;
|
||||
pk = EVP_PKEY_new();
|
||||
EVP_PKEY_set1_RSA(pk, rsa);
|
||||
if (outformat == FORMAT_PVK)
|
||||
i = i2b_PVK_bio(out, pk, pvk_encr, 0, passout);
|
||||
else if (pubin || pubout)
|
||||
i = i2b_PublicKey_bio(out, pk);
|
||||
else
|
||||
i = i2b_PrivateKey_bio(out, pk);
|
||||
EVP_PKEY_free(pk);
|
||||
#endif
|
||||
} else {
|
||||
BIO_printf(bio_err,"bad output format specified for outfile\n");
|
||||
goto end;
|
||||
}
|
||||
if (!i)
|
||||
if (i <= 0)
|
||||
{
|
||||
BIO_printf(bio_err,"unable to write key\n");
|
||||
ERR_print_errors(bio_err);
|
||||
|
@ -342,4 +342,10 @@ static void usage()
|
||||
|
||||
}
|
||||
|
||||
#else /* !OPENSSL_NO_RSA */
|
||||
|
||||
# if PEDANTIC
|
||||
static void *dummy=&dummy;
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
@ -117,7 +117,7 @@
|
||||
#include <conio.h>
|
||||
#endif
|
||||
|
||||
#ifdef OPENSSL_SYS_MSDOS
|
||||
#if defined(OPENSSL_SYS_MSDOS) && !defined(_WIN32)
|
||||
#define _kbhit kbhit
|
||||
#endif
|
||||
|
||||
@ -162,7 +162,7 @@ int extract_port(char *str, short *port_ptr);
|
||||
int extract_host_port(char *str,char **host_ptr,unsigned char *ip,short *p);
|
||||
|
||||
long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
|
||||
int argi, long argl, long ret);
|
||||
int argi, long argl, long ret);
|
||||
|
||||
#ifdef HEADER_SSL_H
|
||||
void MS_CALLBACK apps_ssl_info_callback(const SSL *s, int where, int ret);
|
||||
|
@ -56,7 +56,7 @@
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
|
||||
* Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -126,12 +126,12 @@
|
||||
|
||||
int verify_depth=0;
|
||||
int verify_error=X509_V_OK;
|
||||
int verify_return_error=0;
|
||||
unsigned char cookie_secret[COOKIE_SECRET_LENGTH];
|
||||
int cookie_initialized=0;
|
||||
|
||||
int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx)
|
||||
{
|
||||
char buf[256];
|
||||
X509 *err_cert;
|
||||
int err,depth;
|
||||
|
||||
@ -139,15 +139,23 @@ int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx)
|
||||
err= X509_STORE_CTX_get_error(ctx);
|
||||
depth= X509_STORE_CTX_get_error_depth(ctx);
|
||||
|
||||
X509_NAME_oneline(X509_get_subject_name(err_cert),buf,sizeof buf);
|
||||
BIO_printf(bio_err,"depth=%d %s\n",depth,buf);
|
||||
BIO_printf(bio_err,"depth=%d ",depth);
|
||||
if (err_cert)
|
||||
{
|
||||
X509_NAME_print_ex(bio_err, X509_get_subject_name(err_cert),
|
||||
0, XN_FLAG_ONELINE);
|
||||
BIO_puts(bio_err, "\n");
|
||||
}
|
||||
else
|
||||
BIO_puts(bio_err, "<no cert>\n");
|
||||
if (!ok)
|
||||
{
|
||||
BIO_printf(bio_err,"verify error:num=%d:%s\n",err,
|
||||
X509_verify_cert_error_string(err));
|
||||
if (verify_depth >= depth)
|
||||
{
|
||||
ok=1;
|
||||
if (!verify_return_error)
|
||||
ok=1;
|
||||
verify_error=X509_V_OK;
|
||||
}
|
||||
else
|
||||
@ -156,25 +164,33 @@ int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx)
|
||||
verify_error=X509_V_ERR_CERT_CHAIN_TOO_LONG;
|
||||
}
|
||||
}
|
||||
switch (ctx->error)
|
||||
switch (err)
|
||||
{
|
||||
case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
|
||||
X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert),buf,sizeof buf);
|
||||
BIO_printf(bio_err,"issuer= %s\n",buf);
|
||||
BIO_puts(bio_err,"issuer= ");
|
||||
X509_NAME_print_ex(bio_err, X509_get_issuer_name(err_cert),
|
||||
0, XN_FLAG_ONELINE);
|
||||
BIO_puts(bio_err, "\n");
|
||||
break;
|
||||
case X509_V_ERR_CERT_NOT_YET_VALID:
|
||||
case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
|
||||
BIO_printf(bio_err,"notBefore=");
|
||||
ASN1_TIME_print(bio_err,X509_get_notBefore(ctx->current_cert));
|
||||
ASN1_TIME_print(bio_err,X509_get_notBefore(err_cert));
|
||||
BIO_printf(bio_err,"\n");
|
||||
break;
|
||||
case X509_V_ERR_CERT_HAS_EXPIRED:
|
||||
case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
|
||||
BIO_printf(bio_err,"notAfter=");
|
||||
ASN1_TIME_print(bio_err,X509_get_notAfter(ctx->current_cert));
|
||||
ASN1_TIME_print(bio_err,X509_get_notAfter(err_cert));
|
||||
BIO_printf(bio_err,"\n");
|
||||
break;
|
||||
case X509_V_ERR_NO_EXPLICIT_POLICY:
|
||||
policies_print(bio_err, ctx);
|
||||
break;
|
||||
}
|
||||
if (err == X509_V_OK && ok == 2)
|
||||
policies_print(bio_err, ctx);
|
||||
|
||||
BIO_printf(bio_err,"verify return:%d\n",ok);
|
||||
return(ok);
|
||||
}
|
||||
@ -263,7 +279,7 @@ int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key)
|
||||
}
|
||||
|
||||
long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
|
||||
int argi, long argl, long ret)
|
||||
int argi, long argl, long ret)
|
||||
{
|
||||
BIO *out;
|
||||
|
||||
@ -272,15 +288,15 @@ long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
|
||||
|
||||
if (cmd == (BIO_CB_READ|BIO_CB_RETURN))
|
||||
{
|
||||
BIO_printf(out,"read from %p [%p] (%d bytes => %ld (0x%lX))\n",
|
||||
(void *)bio,argp,argi,ret,ret);
|
||||
BIO_printf(out,"read from %p [%p] (%lu bytes => %ld (0x%lX))\n",
|
||||
(void *)bio,argp,(unsigned long)argi,ret,ret);
|
||||
BIO_dump(out,argp,(int)ret);
|
||||
return(ret);
|
||||
}
|
||||
else if (cmd == (BIO_CB_WRITE|BIO_CB_RETURN))
|
||||
{
|
||||
BIO_printf(out,"write to %p [%p] (%d bytes => %ld (0x%lX))\n",
|
||||
(void *)bio,argp,argi,ret,ret);
|
||||
BIO_printf(out,"write to %p [%p] (%lu bytes => %ld (0x%lX))\n",
|
||||
(void *)bio,argp,(unsigned long)argi,ret,ret);
|
||||
BIO_dump(out,argp,(int)ret);
|
||||
}
|
||||
return(ret);
|
||||
@ -341,14 +357,20 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *
|
||||
case TLS1_VERSION:
|
||||
str_version = "TLS 1.0 ";
|
||||
break;
|
||||
default:
|
||||
str_version = "???";
|
||||
case TLS1_1_VERSION:
|
||||
str_version = "TLS 1.1 ";
|
||||
break;
|
||||
case TLS1_2_VERSION:
|
||||
str_version = "TLS 1.2 ";
|
||||
break;
|
||||
case DTLS1_VERSION:
|
||||
str_version = "DTLS 1.0 ";
|
||||
break;
|
||||
case DTLS1_BAD_VER:
|
||||
str_version = "DTLS 1.0 (bad) ";
|
||||
break;
|
||||
default:
|
||||
str_version = "???";
|
||||
}
|
||||
|
||||
if (version == SSL2_VERSION)
|
||||
@ -518,6 +540,24 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *
|
||||
case 100:
|
||||
str_details2 = " no_renegotiation";
|
||||
break;
|
||||
case 110:
|
||||
str_details2 = " unsupported_extension";
|
||||
break;
|
||||
case 111:
|
||||
str_details2 = " certificate_unobtainable";
|
||||
break;
|
||||
case 112:
|
||||
str_details2 = " unrecognized_name";
|
||||
break;
|
||||
case 113:
|
||||
str_details2 = " bad_certificate_status_response";
|
||||
break;
|
||||
case 114:
|
||||
str_details2 = " bad_certificate_hash_value";
|
||||
break;
|
||||
case 115:
|
||||
str_details2 = " unknown_psk_identity";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -539,6 +579,9 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *
|
||||
case 2:
|
||||
str_details1 = ", ServerHello";
|
||||
break;
|
||||
case 3:
|
||||
str_details1 = ", HelloVerifyRequest";
|
||||
break;
|
||||
case 11:
|
||||
str_details1 = ", Certificate";
|
||||
break;
|
||||
@ -554,9 +597,6 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *
|
||||
case 15:
|
||||
str_details1 = ", CertificateVerify";
|
||||
break;
|
||||
case 3:
|
||||
str_details1 = ", HelloVerifyRequest";
|
||||
break;
|
||||
case 16:
|
||||
str_details1 = ", ClientKeyExchange";
|
||||
break;
|
||||
@ -566,6 +606,26 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_HEARTBEATS
|
||||
if (content_type == 24) /* Heartbeat */
|
||||
{
|
||||
str_details1 = ", Heartbeat";
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
switch (((const unsigned char*)buf)[0])
|
||||
{
|
||||
case 1:
|
||||
str_details1 = ", HeartbeatRequest";
|
||||
break;
|
||||
case 2:
|
||||
str_details1 = ", HeartbeatResponse";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
BIO_printf(bio, "%s %s%s [length %04lx]%s%s\n", str_write_p, str_version, str_content_type, (unsigned long)len, str_details1, str_details2);
|
||||
@ -626,6 +686,22 @@ void MS_CALLBACK tlsext_cb(SSL *s, int client_server, int type,
|
||||
extname = "status request";
|
||||
break;
|
||||
|
||||
case TLSEXT_TYPE_user_mapping:
|
||||
extname = "user mapping";
|
||||
break;
|
||||
|
||||
case TLSEXT_TYPE_client_authz:
|
||||
extname = "client authz";
|
||||
break;
|
||||
|
||||
case TLSEXT_TYPE_server_authz:
|
||||
extname = "server authz";
|
||||
break;
|
||||
|
||||
case TLSEXT_TYPE_cert_type:
|
||||
extname = "cert type";
|
||||
break;
|
||||
|
||||
case TLSEXT_TYPE_elliptic_curves:
|
||||
extname = "elliptic curves";
|
||||
break;
|
||||
@ -634,14 +710,41 @@ void MS_CALLBACK tlsext_cb(SSL *s, int client_server, int type,
|
||||
extname = "EC point formats";
|
||||
break;
|
||||
|
||||
case TLSEXT_TYPE_session_ticket:
|
||||
extname = "server ticket";
|
||||
case TLSEXT_TYPE_srp:
|
||||
extname = "SRP";
|
||||
break;
|
||||
|
||||
case TLSEXT_TYPE_renegotiate:
|
||||
extname = "renegotiate";
|
||||
case TLSEXT_TYPE_signature_algorithms:
|
||||
extname = "signature algorithms";
|
||||
break;
|
||||
|
||||
case TLSEXT_TYPE_use_srtp:
|
||||
extname = "use SRTP";
|
||||
break;
|
||||
|
||||
case TLSEXT_TYPE_heartbeat:
|
||||
extname = "heartbeat";
|
||||
break;
|
||||
|
||||
case TLSEXT_TYPE_session_ticket:
|
||||
extname = "session ticket";
|
||||
break;
|
||||
|
||||
case TLSEXT_TYPE_renegotiate:
|
||||
extname = "renegotiation info";
|
||||
break;
|
||||
|
||||
#ifdef TLSEXT_TYPE_opaque_prf_input
|
||||
case TLSEXT_TYPE_opaque_prf_input:
|
||||
extname = "opaque PRF input";
|
||||
break;
|
||||
#endif
|
||||
#ifdef TLSEXT_TYPE_next_proto_neg
|
||||
case TLSEXT_TYPE_next_proto_neg:
|
||||
extname = "next protocol";
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
extname = "unknown";
|
||||
break;
|
||||
@ -659,8 +762,14 @@ int MS_CALLBACK generate_cookie_callback(SSL *ssl, unsigned char *cookie, unsign
|
||||
{
|
||||
unsigned char *buffer, result[EVP_MAX_MD_SIZE];
|
||||
unsigned int length, resultlength;
|
||||
struct sockaddr_in peer;
|
||||
|
||||
union {
|
||||
struct sockaddr sa;
|
||||
struct sockaddr_in s4;
|
||||
#if OPENSSL_USE_IPV6
|
||||
struct sockaddr_in6 s6;
|
||||
#endif
|
||||
} peer;
|
||||
|
||||
/* Initialize a random secret */
|
||||
if (!cookie_initialized)
|
||||
{
|
||||
@ -676,8 +785,23 @@ int MS_CALLBACK generate_cookie_callback(SSL *ssl, unsigned char *cookie, unsign
|
||||
(void)BIO_dgram_get_peer(SSL_get_rbio(ssl), &peer);
|
||||
|
||||
/* Create buffer with peer's address and port */
|
||||
length = sizeof(peer.sin_addr);
|
||||
length += sizeof(peer.sin_port);
|
||||
length = 0;
|
||||
switch (peer.sa.sa_family)
|
||||
{
|
||||
case AF_INET:
|
||||
length += sizeof(struct in_addr);
|
||||
length += sizeof(peer.s4.sin_port);
|
||||
break;
|
||||
#if OPENSSL_USE_IPV6
|
||||
case AF_INET6:
|
||||
length += sizeof(struct in6_addr);
|
||||
length += sizeof(peer.s6.sin6_port);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
OPENSSL_assert(0);
|
||||
break;
|
||||
}
|
||||
buffer = OPENSSL_malloc(length);
|
||||
|
||||
if (buffer == NULL)
|
||||
@ -685,9 +809,31 @@ int MS_CALLBACK generate_cookie_callback(SSL *ssl, unsigned char *cookie, unsign
|
||||
BIO_printf(bio_err,"out of memory\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
memcpy(buffer, &peer.sin_addr, sizeof(peer.sin_addr));
|
||||
memcpy(buffer + sizeof(peer.sin_addr), &peer.sin_port, sizeof(peer.sin_port));
|
||||
|
||||
switch (peer.sa.sa_family)
|
||||
{
|
||||
case AF_INET:
|
||||
memcpy(buffer,
|
||||
&peer.s4.sin_port,
|
||||
sizeof(peer.s4.sin_port));
|
||||
memcpy(buffer + sizeof(peer.s4.sin_port),
|
||||
&peer.s4.sin_addr,
|
||||
sizeof(struct in_addr));
|
||||
break;
|
||||
#if OPENSSL_USE_IPV6
|
||||
case AF_INET6:
|
||||
memcpy(buffer,
|
||||
&peer.s6.sin6_port,
|
||||
sizeof(peer.s6.sin6_port));
|
||||
memcpy(buffer + sizeof(peer.s6.sin6_port),
|
||||
&peer.s6.sin6_addr,
|
||||
sizeof(struct in6_addr));
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
OPENSSL_assert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Calculate HMAC of buffer using the secret */
|
||||
HMAC(EVP_sha1(), cookie_secret, COOKIE_SECRET_LENGTH,
|
||||
@ -704,8 +850,14 @@ int MS_CALLBACK verify_cookie_callback(SSL *ssl, unsigned char *cookie, unsigned
|
||||
{
|
||||
unsigned char *buffer, result[EVP_MAX_MD_SIZE];
|
||||
unsigned int length, resultlength;
|
||||
struct sockaddr_in peer;
|
||||
|
||||
union {
|
||||
struct sockaddr sa;
|
||||
struct sockaddr_in s4;
|
||||
#if OPENSSL_USE_IPV6
|
||||
struct sockaddr_in6 s6;
|
||||
#endif
|
||||
} peer;
|
||||
|
||||
/* If secret isn't initialized yet, the cookie can't be valid */
|
||||
if (!cookie_initialized)
|
||||
return 0;
|
||||
@ -714,24 +866,61 @@ int MS_CALLBACK verify_cookie_callback(SSL *ssl, unsigned char *cookie, unsigned
|
||||
(void)BIO_dgram_get_peer(SSL_get_rbio(ssl), &peer);
|
||||
|
||||
/* Create buffer with peer's address and port */
|
||||
length = sizeof(peer.sin_addr);
|
||||
length += sizeof(peer.sin_port);
|
||||
buffer = (unsigned char*) OPENSSL_malloc(length);
|
||||
length = 0;
|
||||
switch (peer.sa.sa_family)
|
||||
{
|
||||
case AF_INET:
|
||||
length += sizeof(struct in_addr);
|
||||
length += sizeof(peer.s4.sin_port);
|
||||
break;
|
||||
#if OPENSSL_USE_IPV6
|
||||
case AF_INET6:
|
||||
length += sizeof(struct in6_addr);
|
||||
length += sizeof(peer.s6.sin6_port);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
OPENSSL_assert(0);
|
||||
break;
|
||||
}
|
||||
buffer = OPENSSL_malloc(length);
|
||||
|
||||
if (buffer == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"out of memory\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
memcpy(buffer, &peer.sin_addr, sizeof(peer.sin_addr));
|
||||
memcpy(buffer + sizeof(peer.sin_addr), &peer.sin_port, sizeof(peer.sin_port));
|
||||
|
||||
switch (peer.sa.sa_family)
|
||||
{
|
||||
case AF_INET:
|
||||
memcpy(buffer,
|
||||
&peer.s4.sin_port,
|
||||
sizeof(peer.s4.sin_port));
|
||||
memcpy(buffer + sizeof(peer.s4.sin_port),
|
||||
&peer.s4.sin_addr,
|
||||
sizeof(struct in_addr));
|
||||
break;
|
||||
#if OPENSSL_USE_IPV6
|
||||
case AF_INET6:
|
||||
memcpy(buffer,
|
||||
&peer.s6.sin6_port,
|
||||
sizeof(peer.s6.sin6_port));
|
||||
memcpy(buffer + sizeof(peer.s6.sin6_port),
|
||||
&peer.s6.sin6_addr,
|
||||
sizeof(struct in6_addr));
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
OPENSSL_assert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Calculate HMAC of buffer using the secret */
|
||||
HMAC(EVP_sha1(), cookie_secret, COOKIE_SECRET_LENGTH,
|
||||
buffer, length, result, &resultlength);
|
||||
OPENSSL_free(buffer);
|
||||
|
||||
|
||||
if (cookie_len == resultlength && memcmp(result, cookie, resultlength) == 0)
|
||||
return 1;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -237,14 +237,11 @@ static int ssl_sock_init(void)
|
||||
int init_client(int *sock, char *host, int port, int type)
|
||||
{
|
||||
unsigned char ip[4];
|
||||
short p=0;
|
||||
|
||||
memset(ip, '\0', sizeof ip);
|
||||
if (!host_ip(host,&(ip[0])))
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
if (p != 0) port=p;
|
||||
return(init_client_ip(sock,ip,port,type));
|
||||
return 0;
|
||||
return init_client_ip(sock,ip,port,type);
|
||||
}
|
||||
|
||||
static int init_client_ip(int *sock, unsigned char ip[4], int port, int type)
|
||||
@ -272,7 +269,7 @@ static int init_client_ip(int *sock, unsigned char ip[4], int port, int type)
|
||||
|
||||
if (s == INVALID_SOCKET) { perror("socket"); return(0); }
|
||||
|
||||
#ifndef OPENSSL_SYS_MPE
|
||||
#if defined(SO_KEEPALIVE) && !defined(OPENSSL_SYS_MPE)
|
||||
if (type == SOCK_STREAM)
|
||||
{
|
||||
i=0;
|
||||
@ -282,7 +279,7 @@ static int init_client_ip(int *sock, unsigned char ip[4], int port, int type)
|
||||
#endif
|
||||
|
||||
if (connect(s,(struct sockaddr *)&them,sizeof(them)) == -1)
|
||||
{ close(s); perror("connect"); return(0); }
|
||||
{ closesocket(s); perror("connect"); return(0); }
|
||||
*sock=s;
|
||||
return(1);
|
||||
}
|
||||
@ -291,7 +288,7 @@ int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, uns
|
||||
{
|
||||
int sock;
|
||||
char *name = NULL;
|
||||
int accept_socket;
|
||||
int accept_socket = 0;
|
||||
int i;
|
||||
|
||||
if (!init_server(&accept_socket,port,type)) return(0);
|
||||
|
@ -85,54 +85,6 @@
|
||||
#include OPENSSL_UNISTD
|
||||
#endif
|
||||
|
||||
#if !defined(OPENSSL_SYS_NETWARE) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VXWORKS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC))
|
||||
#define TIMES
|
||||
#endif
|
||||
|
||||
#ifndef _IRIX
|
||||
#include <time.h>
|
||||
#endif
|
||||
#ifdef TIMES
|
||||
#include <sys/types.h>
|
||||
#include <sys/times.h>
|
||||
#endif
|
||||
|
||||
/* Depending on the VMS version, the tms structure is perhaps defined.
|
||||
The __TMS macro will show if it was. If it wasn't defined, we should
|
||||
undefine TIMES, since that tells the rest of the program how things
|
||||
should be handled. -- Richard Levitte */
|
||||
#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
|
||||
#undef TIMES
|
||||
#endif
|
||||
|
||||
#if !defined(TIMES) && !defined(OPENSSL_SYS_VXWORKS) && !defined(OPENSSL_SYS_NETWARE)
|
||||
#include <sys/timeb.h>
|
||||
#endif
|
||||
|
||||
#if defined(sun) || defined(__ultrix)
|
||||
#define _POSIX_SOURCE
|
||||
#include <limits.h>
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
/* The following if from times(3) man page. It may need to be changed
|
||||
*/
|
||||
#ifndef HZ
|
||||
# ifdef _SC_CLK_TCK
|
||||
# define HZ ((double)sysconf(_SC_CLK_TCK))
|
||||
# else
|
||||
# ifndef CLK_TCK
|
||||
# ifndef _BSD_CLK_TCK_ /* FreeBSD hack */
|
||||
# define HZ 100.0
|
||||
# else /* _BSD_CLK_TCK_ */
|
||||
# define HZ ((double)_BSD_CLK_TCK_)
|
||||
# endif
|
||||
# else /* CLK_TCK */
|
||||
# define HZ ((double)CLK_TCK)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#undef PROG
|
||||
#define PROG s_time_main
|
||||
|
||||
@ -177,7 +129,7 @@ static char *tm_cipher=NULL;
|
||||
static int tm_verify = SSL_VERIFY_NONE;
|
||||
static int maxTime = SECONDS;
|
||||
static SSL_CTX *tm_ctx=NULL;
|
||||
static SSL_METHOD *s_time_meth=NULL;
|
||||
static const SSL_METHOD *s_time_meth=NULL;
|
||||
static char *s_www_path=NULL;
|
||||
static long bytes_read=0;
|
||||
static int st_bugs=0;
|
||||
@ -372,63 +324,8 @@ static int parseArgs(int argc, char **argv)
|
||||
|
||||
static double tm_Time_F(int s)
|
||||
{
|
||||
static double ret;
|
||||
#ifdef TIMES
|
||||
static struct tms tstart,tend;
|
||||
|
||||
if(s == START) {
|
||||
times(&tstart);
|
||||
return(0);
|
||||
} else {
|
||||
times(&tend);
|
||||
ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
|
||||
return((ret == 0.0)?1e-6:ret);
|
||||
return app_tminterval(s,1);
|
||||
}
|
||||
#elif defined(OPENSSL_SYS_NETWARE)
|
||||
static clock_t tstart,tend;
|
||||
|
||||
if (s == START)
|
||||
{
|
||||
tstart=clock();
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
tend=clock();
|
||||
ret=(double)((double)(tend)-(double)(tstart));
|
||||
return((ret < 0.001)?0.001:ret);
|
||||
}
|
||||
#elif defined(OPENSSL_SYS_VXWORKS)
|
||||
{
|
||||
static unsigned long tick_start, tick_end;
|
||||
|
||||
if( s == START )
|
||||
{
|
||||
tick_start = tickGet();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
tick_end = tickGet();
|
||||
ret = (double)(tick_end - tick_start) / (double)sysClkRateGet();
|
||||
return((ret == 0.0)?1e-6:ret);
|
||||
}
|
||||
}
|
||||
#else /* !times() */
|
||||
static struct timeb tstart,tend;
|
||||
long i;
|
||||
|
||||
if(s == START) {
|
||||
ftime(&tstart);
|
||||
return(0);
|
||||
} else {
|
||||
ftime(&tend);
|
||||
i=(long)tend.millitm-(long)tstart.millitm;
|
||||
ret=((double)(tend.time-tstart.time))+((double)i)/1000.0;
|
||||
return((ret == 0.0)?1e-6:ret);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MAIN - main processing area for client
|
||||
@ -704,7 +601,7 @@ static SSL *doConnection(SSL *scon)
|
||||
i=SSL_get_fd(serverCon);
|
||||
width=i+1;
|
||||
FD_ZERO(&readfds);
|
||||
FD_SET(i,&readfds);
|
||||
openssl_fdset(i,&readfds);
|
||||
/* Note: under VMS with SOCKETSHR the 2nd parameter
|
||||
* is currently of type (int *) whereas under other
|
||||
* systems it is (void *) if you don't have a cast it
|
||||
|
@ -1,369 +1,52 @@
|
||||
issuer= /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit)
|
||||
subject= /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Server test cert (512 bit)
|
||||
subject= C = UK, O = OpenSSL Group, OU = FOR TESTING PURPOSES ONLY, CN = Test Server Cert
|
||||
issuer= C = UK, O = OpenSSL Group, OU = FOR TESTING PURPOSES ONLY, CN = OpenSSL Test Intermediate CA
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIB6TCCAVICAQYwDQYJKoZIhvcNAQEEBQAwWzELMAkGA1UEBhMCQVUxEzARBgNV
|
||||
BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRswGQYD
|
||||
VQQDExJUZXN0IENBICgxMDI0IGJpdCkwHhcNMDAxMDE2MjIzMTAzWhcNMDMwMTE0
|
||||
MjIzMTAzWjBjMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDEaMBgG
|
||||
A1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxIzAhBgNVBAMTGlNlcnZlciB0ZXN0IGNl
|
||||
cnQgKDUxMiBiaXQpMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJ+zw4Qnlf8SMVIP
|
||||
Fe9GEcStgOY2Ww/dgNdhjeD8ckUJNP5VZkVDTGiXav6ooKXfX3j/7tdkuD8Ey2//
|
||||
Kv7+ue0CAwEAATANBgkqhkiG9w0BAQQFAAOBgQCT0grFQeZaqYb5EYfk20XixZV4
|
||||
GmyAbXMftG1Eo7qGiMhYzRwGNWxEYojf5PZkYZXvSqZ/ZXHXa4g59jK/rJNnaVGM
|
||||
k+xIX8mxQvlV0n5O9PIha5BX5teZnkHKgL8aKKLKW1BK7YTngsfSzzaeame5iKfz
|
||||
itAE+OjGF+PFKbwX8Q==
|
||||
MIID5zCCAs+gAwIBAgIJALnu1NlVpZ6zMA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
|
||||
BAYTAlVLMRYwFAYDVQQKDA1PcGVuU1NMIEdyb3VwMSIwIAYDVQQLDBlGT1IgVEVT
|
||||
VElORyBQVVJQT1NFUyBPTkxZMSUwIwYDVQQDDBxPcGVuU1NMIFRlc3QgSW50ZXJt
|
||||
ZWRpYXRlIENBMB4XDTExMTIwODE0MDE0OFoXDTIxMTAxNjE0MDE0OFowZDELMAkG
|
||||
A1UEBhMCVUsxFjAUBgNVBAoMDU9wZW5TU0wgR3JvdXAxIjAgBgNVBAsMGUZPUiBU
|
||||
RVNUSU5HIFBVUlBPU0VTIE9OTFkxGTAXBgNVBAMMEFRlc3QgU2VydmVyIENlcnQw
|
||||
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDzhPOSNtyyRspmeuUpxfNJ
|
||||
KCLTuf7g3uQ4zu4iHOmRO5TQci+HhVlLZrHF9XqFXcIP0y4pWDbMSGuiorUmzmfi
|
||||
R7bfSdI/+qIQt8KXRH6HNG1t8ou0VSvWId5TS5Dq/er5ODUr9OaaDva7EquHIcMv
|
||||
vPQGuI+OEAcnleVCy9HVEIySrO4P3CNIicnGkwwiAud05yUAq/gPXBC1hTtmlPD7
|
||||
TVcGVSEiJdvzqqlgv02qedGrkki6GY4S7GjZxrrf7Foc2EP+51LJzwLQx3/JfrCU
|
||||
41NEWAsu/Sl0tQabXESN+zJ1pDqoZ3uHMgpQjeGiE0olr+YcsSW/tJmiU9OiAr8R
|
||||
AgMBAAGjgY8wgYwwDAYDVR0TAQH/BAIwADAOBgNVHQ8BAf8EBAMCBeAwLAYJYIZI
|
||||
AYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQW
|
||||
BBSCvM8AABPR9zklmifnr9LvIBturDAfBgNVHSMEGDAWgBQ2w2yI55X+sL3szj49
|
||||
hqshgYfa2jANBgkqhkiG9w0BAQUFAAOCAQEAqb1NV0B0/pbpK9Z4/bNjzPQLTRLK
|
||||
WnSNm/Jh5v0GEUOE/Beg7GNjNrmeNmqxAlpqWz9qoeoFZax+QBpIZYjROU3TS3fp
|
||||
yLsrnlr0CDQ5R7kCCDGa8dkXxemmpZZLbUCpW2Uoy8sAA4JjN9OtsZY7dvUXFgJ7
|
||||
vVNTRnI01ghknbtD+2SxSQd3CWF6QhcRMAzZJ1z1cbbwGDDzfvGFPzJ+Sq+zEPds
|
||||
xoVLLSetCiBc+40ZcDS5dV98h9XD7JMTQfxzA7mNGv73JoZJA6nFgj+ADSlJsY/t
|
||||
JBv+z1iQRueoh9Qeee+ZbRifPouCB8FDx+AltvHTANdAq0t/K3o+pplMVA==
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIBPAIBAAJBAJ+zw4Qnlf8SMVIPFe9GEcStgOY2Ww/dgNdhjeD8ckUJNP5VZkVD
|
||||
TGiXav6ooKXfX3j/7tdkuD8Ey2//Kv7+ue0CAwEAAQJAN6W31vDEP2DjdqhzCDDu
|
||||
OA4NACqoiFqyblo7yc2tM4h4xMbC3Yx5UKMN9ZkCtX0gzrz6DyF47bdKcWBzNWCj
|
||||
gQIhANEoojVt7hq+SQ6MCN6FTAysGgQf56Q3TYoJMoWvdiXVAiEAw3e3rc+VJpOz
|
||||
rHuDo6bgpjUAAXM+v3fcpsfZSNO6V7kCIQCtbVjanpUwvZkMI9by02oUk9taki3b
|
||||
PzPfAfNPYAbCJQIhAJXNQDWyqwn/lGmR11cqY2y9nZ1+5w3yHGatLrcDnQHxAiEA
|
||||
vnlEGo8K85u+KwIOimM48ZG8oTk7iFdkqLJR1utT3aU=
|
||||
MIIEpAIBAAKCAQEA84TzkjbcskbKZnrlKcXzSSgi07n+4N7kOM7uIhzpkTuU0HIv
|
||||
h4VZS2axxfV6hV3CD9MuKVg2zEhroqK1Js5n4ke230nSP/qiELfCl0R+hzRtbfKL
|
||||
tFUr1iHeU0uQ6v3q+Tg1K/Tmmg72uxKrhyHDL7z0BriPjhAHJ5XlQsvR1RCMkqzu
|
||||
D9wjSInJxpMMIgLndOclAKv4D1wQtYU7ZpTw+01XBlUhIiXb86qpYL9NqnnRq5JI
|
||||
uhmOEuxo2ca63+xaHNhD/udSyc8C0Md/yX6wlONTRFgLLv0pdLUGm1xEjfsydaQ6
|
||||
qGd7hzIKUI3hohNKJa/mHLElv7SZolPTogK/EQIDAQABAoIBAADq9FwNtuE5IRQn
|
||||
zGtO4q7Y5uCzZ8GDNYr9RKp+P2cbuWDbvVAecYq2NV9QoIiWJOAYZKklOvekIju3
|
||||
r0UZLA0PRiIrTg6NrESx3JrjWDK8QNlUO7CPTZ39/K+FrmMkV9lem9yxjJjyC34D
|
||||
AQB+YRTx+l14HppjdxNwHjAVQpIx/uO2F5xAMuk32+3K+pq9CZUtrofe1q4Agj9R
|
||||
5s8mSy9pbRo9kW9wl5xdEotz1LivFOEiqPUJTUq5J5PeMKao3vdK726XI4Z455Nm
|
||||
W2/MA0YV0ug2FYinHcZdvKM6dimH8GLfa3X8xKRfzjGjTiMSwsdjgMa4awY3tEHH
|
||||
674jhAECgYEA/zqMrc0zsbNk83sjgaYIug5kzEpN4ic020rSZsmQxSCerJTgNhmg
|
||||
utKSCt0Re09Jt3LqG48msahX8ycqDsHNvlEGPQSbMu9IYeO3Wr3fAm75GEtFWePY
|
||||
BhM73I7gkRt4s8bUiUepMG/wY45c5tRF23xi8foReHFFe9MDzh8fJFECgYEA9EFX
|
||||
4qAik1pOJGNei9BMwmx0I0gfVEIgu0tzeVqT45vcxbxr7RkTEaDoAG6PlbWP6D9a
|
||||
WQNLp4gsgRM90ZXOJ4up5DsAWDluvaF4/omabMA+MJJ5kGZ0gCj5rbZbKqUws7x8
|
||||
bp+6iBfUPJUbcqNqFmi/08Yt7vrDnMnyMw2A/sECgYEAiiuRMxnuzVm34hQcsbhH
|
||||
6ymVqf7j0PW2qK0F4H1ocT9qhzWFd+RB3kHWrCjnqODQoI6GbGr/4JepHUpre1ex
|
||||
4UEN5oSS3G0ru0rC3U4C59dZ5KwDHFm7ffZ1pr52ljfQDUsrjjIMRtuiwNK2OoRa
|
||||
WSsqiaL+SDzSB+nBmpnAizECgYBdt/y6rerWUx4MhDwwtTnel7JwHyo2MDFS6/5g
|
||||
n8qC2Lj6/fMDRE22w+CA2esp7EJNQJGv+b27iFpbJEDh+/Lf5YzIT4MwVskQ5bYB
|
||||
JFcmRxUVmf4e09D7o705U/DjCgMH09iCsbLmqQ38ONIRSHZaJtMDtNTHD1yi+jF+
|
||||
OT43gQKBgQC/2OHZoko6iRlNOAQ/tMVFNq7fL81GivoQ9F1U0Qr+DH3ZfaH8eIkX
|
||||
xT0ToMPJUzWAn8pZv0snA0um6SIgvkCuxO84OkANCVbttzXImIsL7pFzfcwV/ERK
|
||||
UM6j0ZuSMFOCr/lGPAoOQU0fskidGEHi1/kW+suSr28TqsyYZpwBDQ==
|
||||
-----END RSA PRIVATE KEY-----
|
||||
subject=/C=US/O=AT&T Bell Laboratories/OU=Prototype Research CA
|
||||
issuer= /C=US/O=AT&T Bell Laboratories/OU=Prototype Research CA
|
||||
notBefore=950413210656Z
|
||||
notAfter =970412210656Z
|
||||
-----BEGIN X509 CERTIFICATE-----
|
||||
|
||||
MIICCDCCAXECAQAwDQYJKoZIhvcNAQEEBQAwTjELMAkGA1UEBhMCVVMxHzAdBgNV
|
||||
BAoUFkFUJlQgQmVsbCBMYWJvcmF0b3JpZXMxHjAcBgNVBAsUFVByb3RvdHlwZSBS
|
||||
ZXNlYXJjaCBDQTAeFw05NTA0MTMyMTA2NTZaFw05NzA0MTIyMTA2NTZaME4xCzAJ
|
||||
BgNVBAYTAlVTMR8wHQYDVQQKFBZBVCZUIEJlbGwgTGFib3JhdG9yaWVzMR4wHAYD
|
||||
VQQLFBVQcm90b3R5cGUgUmVzZWFyY2ggQ0EwgZwwDQYJKoZIhvcNAQEBBQADgYoA
|
||||
MIGGAoGAebOmgtSCl+wCYZc86UGYeTLY8cjmW2P0FN8ToT/u2pECCoFdrlycX0OR
|
||||
3wt0ZhpFXLVNeDnHwEE9veNUih7pCL2ZBFqoIoQkB1lZmXRiVtjGonz8BLm/qrFM
|
||||
YHb0lme/Ol+s118mwKVxnn6bSAeI/OXKhLaVdYZWk+aEaxEDkVkCAQ8wDQYJKoZI
|
||||
hvcNAQEEBQADgYEAAZMG14lZmZ8bahkaHaTV9dQf4p2FZiQTFwHP9ZyGsXPC+LT5
|
||||
dG5iTaRmyjNIJdPWohZDl97kAci79aBndvuEvRKOjLHs3WRGBIwERnAcnY9Mz8u/
|
||||
zIHK23PjYVxGGaZd669OJwD0CYyqH22HH9nFUGaoJdsv39ChW0NRdLE9+y8=
|
||||
-----END X509 CERTIFICATE-----
|
||||
issuer= /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test PCA (1024 bit)
|
||||
subject=/C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit)
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICJjCCAY8CAQAwDQYJKoZIhvcNAQEEBQAwXDELMAkGA1UEBhMCQVUxEzARBgNV
|
||||
BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYD
|
||||
VQQDExNUZXN0IFBDQSAoMTAyNCBiaXQpMB4XDTk3MDYwOTEzNTc0M1oXDTAxMDYw
|
||||
OTEzNTc0M1owWzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY
|
||||
BgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRswGQYDVQQDExJUZXN0IENBICgxMDI0
|
||||
IGJpdCkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKO7o8t116VP6cgybTsZ
|
||||
DCZhr95nYlZuya3aCi1IKoztqwWnjbmDFIriOqGFPrZQ+moMETC9D59iRW/dFXSv
|
||||
1F65ka/XY2hLh9exCCo7XuUcDs53Qp3bI3AmMqHjgzE8oO3ajyJAzJkTTOUecQU2
|
||||
mw/gI4tMM0LqWMQS7luTy4+xAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAM7achv3v
|
||||
hLQJcv/65eGEpBXM40ZDVoFQFFJWaY5p883HTqLB1x4FdzsXHH0QKBTcKpWwqyu4
|
||||
YDm3fb8oDugw72bCzfyZK/zVZPR/hVlqI/fvU109Qoc+7oPvIXWky71HfcK6ZBCA
|
||||
q30KIqGM/uoM60INq97qjDmCJapagcNBGQs=
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXQIBAAKBgQCju6PLddelT+nIMm07GQwmYa/eZ2JWbsmt2gotSCqM7asFp425
|
||||
gxSK4jqhhT62UPpqDBEwvQ+fYkVv3RV0r9ReuZGv12NoS4fXsQgqO17lHA7Od0Kd
|
||||
2yNwJjKh44MxPKDt2o8iQMyZE0zlHnEFNpsP4COLTDNC6ljEEu5bk8uPsQIDAQAB
|
||||
AoGAVZmpFZsDZfr0l2S9tLLwpjRWNOlKATQkno6q2WesT0eGLQufTciY+c8ypfU6
|
||||
hyio8r5iUl/VhhdjhAtKx1mRpiotftHo/eYf8rtsrnprOnWG0bWjLjtIoMbcxGn2
|
||||
J3bN6LJmbJMjDs0eJ3KnTu646F3nDUw2oGAwmpzKXA1KAP0CQQDRvQhxk2D3Pehs
|
||||
HvG665u2pB5ipYQngEFlZO7RHJZzJOZEWSLuuMqaF/7pTfA5jiBvWqCgJeCRRInL
|
||||
21ru4dlPAkEAx9jj7BgKn5TYnMoBSSe0afjsV9oApVpN1Nacb1YDtCwy+scp3++s
|
||||
nFxlv98wxIlSdpwMUn+AUWfjiWR7Tu/G/wJBAJ/KjwZIrFVxewP0x2ILYsTRYLzz
|
||||
MS4PDsO7FB+I0i7DbBOifXS2oNSpd3I0CNMwrxFnUHzynpbOStVfN3ZL5w0CQQCa
|
||||
pwFahxBRhkJKsxhjoFJBX9yl75JoY4Wvm5Tbo9ih6UJaRx3kqfkN14L2BKYcsZgb
|
||||
KY9vmDOYy6iNfjDeWTfJAkBkfPUb8oTJ/nSP5zN6sqGxSY4krc4xLxpRmxoJ8HL2
|
||||
XfhqXkTzbU13RX9JJ/NZ8vQN9Vm2NhxRGJocQkmcdVtJ
|
||||
-----END RSA PRIVATE KEY-----
|
||||
-----BEGIN X509 CERTIFICATE-----
|
||||
MIICYDCCAiACAgEoMAkGBSsOAwINBQAwfDELMAkGA1UEBhMCVVMxNjA0BgNVBAoT
|
||||
LU5hdGlvbmFsIEFlcm9uYXV0aWNzIGFuZCBTcGFjZSBBZG1pbmlzdHJhdGlvbjEZ
|
||||
MBcGA1UECxMQVGVzdCBFbnZpcm9ubWVudDEaMBgGA1UECxMRRFNTLU5BU0EtUGls
|
||||
b3QtQ0EwHhcNOTYwMjI2MTYzMjQ1WhcNOTcwMjI1MTYzMjQ1WjB8MQswCQYDVQQG
|
||||
EwJVUzE2MDQGA1UEChMtTmF0aW9uYWwgQWVyb25hdXRpY3MgYW5kIFNwYWNlIEFk
|
||||
bWluaXN0cmF0aW9uMRkwFwYDVQQLExBUZXN0IEVudmlyb25tZW50MRowGAYDVQQL
|
||||
ExFEU1MtTkFTQS1QaWxvdC1DQTCB8jAJBgUrDgMCDAUAA4HkADCB4AJBAMA/ssKb
|
||||
hPNUG7ZlASfVwEJU21O5OyF/iyBzgHI1O8eOhJGUYO8cc8wDMjR508Mr9cp6Uhl/
|
||||
ZB7FV5GkLNEnRHYCQQDUEaSg45P2qrDwixTRhFhmWz5Nvc4lRFQ/42XPcchiJBLb
|
||||
bn3QK74T2IxY1yY+kCNq8XrIqf5fJJzIH0J/xUP3AhUAsg2wsQHfDGYk/BOSulX3
|
||||
fVd0geUCQQCzCFUQAh+ZkEmp5804cs6ZWBhrUAfnra8lJItYo9xPcXgdIfLfibcX
|
||||
R71UsyO77MRD7B0+Ag2tq794IleCVcEEMAkGBSsOAwINBQADLwAwLAIUUayDfreR
|
||||
Yh2WeU86/pHNdkUC1IgCFEfxe1f0oMpxJyrJ5XIxTi7vGdoK
|
||||
-----END X509 CERTIFICATE-----
|
||||
-----BEGIN X509 CERTIFICATE-----
|
||||
|
||||
MIICGTCCAdgCAwCqTDAJBgUrDgMCDQUAMHwxCzAJBgNVBAYTAlVTMTYwNAYDVQQK
|
||||
Ey1OYXRpb25hbCBBZXJvbmF1dGljcyBhbmQgU3BhY2UgQWRtaW5pc3RyYXRpb24x
|
||||
GTAXBgNVBAsTEFRlc3QgRW52aXJvbm1lbnQxGjAYBgNVBAsTEURTUy1OQVNBLVBp
|
||||
bG90LUNBMB4XDTk2MDUxNDE3MDE0MVoXDTk3MDUxNDE3MDE0MVowMzELMAkGA1UE
|
||||
BhMCQVUxDzANBgNVBAoTBk1pbmNvbTETMBEGA1UEAxMKRXJpYyBZb3VuZzCB8jAJ
|
||||
BgUrDgMCDAUAA4HkADCB4AJBAKbfHz6vE6pXXMTpswtGUec2tvnfLJUsoxE9qs4+
|
||||
ObZX7LmLvragNPUeiTJx7UOWZ5DfBj6bXLc8eYne0lP1g3ACQQDUEaSg45P2qrDw
|
||||
ixTRhFhmWz5Nvc4lRFQ/42XPcchiJBLbbn3QK74T2IxY1yY+kCNq8XrIqf5fJJzI
|
||||
H0J/xUP3AhUAsg2wsQHfDGYk/BOSulX3fVd0geUCQQCzCFUQAh+ZkEmp5804cs6Z
|
||||
WBhrUAfnra8lJItYo9xPcXgdIfLfibcXR71UsyO77MRD7B0+Ag2tq794IleCVcEE
|
||||
MAkGBSsOAwINBQADMAAwLQIUWsuuJRE3VT4ueWkWMAJMJaZjj1ECFQCYY0zX4bzM
|
||||
LC7obsrHD8XAHG+ZRG==
|
||||
-----END X509 CERTIFICATE-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICTTCCAbagAwIBAgIBADANBgkqhkiG9w0BAQQFADBMMQswCQYDVQQGEwJHQjEM
|
||||
MAoGA1UEChMDVUNMMRgwFgYDVQQLEw9JQ0UtVEVMIFByb2plY3QxFTATBgNVBAMT
|
||||
DFRydXN0RmFjdG9yeTAeFw05NzA0MjIxNDM5MTRaFw05ODA0MjIxNDM5MTRaMEwx
|
||||
CzAJBgNVBAYTAkdCMQwwCgYDVQQKEwNVQ0wxGDAWBgNVBAsTD0lDRS1URUwgUHJv
|
||||
amVjdDEVMBMGA1UEAxMMVHJ1c3RGYWN0b3J5MIGcMAoGBFUIAQECAgQAA4GNADCB
|
||||
iQKBgQCEieR8NcXkUW1f0G6aC6u0i8q/98JqS6RxK5YmHIGKCkuTWAUjzLfUa4dt
|
||||
U9igGCjTuxaDqlzEim+t/02pmiBZT9HaX++35MjQPUWmsChcYU5WyzGErXi+rQaw
|
||||
zlwS73zM8qiPj/97lXYycWhgL0VaiDSPxRXEUdWoaGruom4mNQIDAQABo0IwQDAd
|
||||
BgNVHQ4EFgQUHal1LZr7oVg5z6lYzrhTgZRCmcUwDgYDVR0PAQH/BAQDAgH2MA8G
|
||||
A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAfaggfl6FZoioecjv0dq8
|
||||
/DXo/u11iMZvXn08gjX/zl2b4wtPbShOSY5FhkSm8GeySasz+/Nwb/uzfnIhokWi
|
||||
lfPZHtlCWtXbIy/TN51eJyq04ceDCQDWvLC2enVg9KB+GJ34b5c5VaPRzq8MBxsA
|
||||
S7ELuYGtmYgYm9NZOIr7yU0=
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIB6jCCAZQCAgEtMA0GCSqGSIb3DQEBBAUAMIGAMQswCQYDVQQGEwJVUzE2MDQG
|
||||
A1UEChMtTmF0aW9uYWwgQWVyb25hdXRpY3MgYW5kIFNwYWNlIEFkbWluaXN0cmF0
|
||||
aW9uMRkwFwYDVQQLExBUZXN0IEVudmlyb25tZW50MR4wHAYDVQQLExVNRDUtUlNB
|
||||
LU5BU0EtUGlsb3QtQ0EwHhcNOTYwNDMwMjIwNTAwWhcNOTcwNDMwMjIwNTAwWjCB
|
||||
gDELMAkGA1UEBhMCVVMxNjA0BgNVBAoTLU5hdGlvbmFsIEFlcm9uYXV0aWNzIGFu
|
||||
ZCBTcGFjZSBBZG1pbmlzdHJhdGlvbjEZMBcGA1UECxMQVGVzdCBFbnZpcm9ubWVu
|
||||
dDEeMBwGA1UECxMVTUQ1LVJTQS1OQVNBLVBpbG90LUNBMFkwCgYEVQgBAQICAgAD
|
||||
SwAwSAJBALmmX5+GqAvcrWK13rfDrNX9UfeA7f+ijyBgeFQjYUoDpFqapw4nzQBL
|
||||
bAXug8pKkRwa2Zh8YODhXsRWu2F/UckCAwEAATANBgkqhkiG9w0BAQQFAANBAH9a
|
||||
OBA+QCsjxXgnSqHx04gcU8S49DVUb1f2XVoLnHlIb8RnX0k5O6mpHT5eti9bLkiW
|
||||
GJNMJ4L0AJ/ac+SmHZc=
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICajCCAdMCBDGA0QUwDQYJKoZIhvcNAQEEBQAwfTELMAkGA1UEBhMCQ2ExDzAN
|
||||
BgNVBAcTBk5lcGVhbjEeMBwGA1UECxMVTm8gTGlhYmlsaXR5IEFjY2VwdGVkMR8w
|
||||
HQYDVQQKExZGb3IgRGVtbyBQdXJwb3NlcyBPbmx5MRwwGgYDVQQDExNFbnRydXN0
|
||||
IERlbW8gV2ViIENBMB4XDTk2MDQyNjEzMzUwMVoXDTA2MDQyNjEzMzUwMVowfTEL
|
||||
MAkGA1UEBhMCQ2ExDzANBgNVBAcTBk5lcGVhbjEeMBwGA1UECxMVTm8gTGlhYmls
|
||||
aXR5IEFjY2VwdGVkMR8wHQYDVQQKExZGb3IgRGVtbyBQdXJwb3NlcyBPbmx5MRww
|
||||
GgYDVQQDExNFbnRydXN0IERlbW8gV2ViIENBMIGdMA0GCSqGSIb3DQEBAQUAA4GL
|
||||
ADCBhwKBgQCaroS7O1DA0hm4IefNYU1cx/nqOmzEnk291d1XqznDeF4wEgakbkCc
|
||||
zTKxK791yNpXG5RmngqH7cygDRTHZJ6mfCRn0wGC+AI00F2vYTGqPGRQL1N3lZT0
|
||||
YDKFC0SQeMMjFIZ1aeQigroFQnHo0VB3zWIMpNkka8PY9lxHZAmWwQIBAzANBgkq
|
||||
hkiG9w0BAQQFAAOBgQBAx0UMVA1s54lMQyXjMX5kj99FJN5itb8bK1Rk+cegPQPF
|
||||
cWO9SEWyEjjBjIkjjzAwBkaEszFsNGxemxtXvwjIm1xEUMTVlPEWTs2qnDvAUA9W
|
||||
YqhWbhH0toGT36236QAsqCZ76rbTRVSSX2BHyJwJMG2tCRv7kRJ//NIgxj3H4w==
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
issuer= /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test PCA (1024 bit)
|
||||
subject=/C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test PCA (1024 bit)
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICJzCCAZACAQAwDQYJKoZIhvcNAQEEBQAwXDELMAkGA1UEBhMCQVUxEzARBgNV
|
||||
BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYD
|
||||
VQQDExNUZXN0IFBDQSAoMTAyNCBiaXQpMB4XDTk3MDYwOTEzNTczN1oXDTAxMDYw
|
||||
OTEzNTczN1owXDELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY
|
||||
BgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYDVQQDExNUZXN0IFBDQSAoMTAy
|
||||
NCBiaXQpMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCdoWk/3+WcMlfjIrkg
|
||||
40ketmnQaEogQe1LLcuOJV6rKfUSAsPgwgsabJ/wn8TxA1yy3eKJbFl3OiUXMRsp
|
||||
22Jp85PmemiDzyUIStwk72qhp1imbANZvlmlCFKiQrjUyuDfu4TABmn+kkt3vR1Y
|
||||
BEOGt+IFye1UBVSATVdRJ2UVhwIDAQABMA0GCSqGSIb3DQEBBAUAA4GBABNA1u/S
|
||||
Cg/LJZWb7GliiKJsvuhxlE4E5JxQF2zMub/CSNbF97//tYSyj96sxeFQxZXbcjm9
|
||||
xt6mr/xNLA4szNQMJ4P+L7b5e/jC5DSqlwS+CUYJgaFs/SP+qJoCSu1bR3IM9XWO
|
||||
cRBpDmcBbYLkSyB92WURvsZ1LtjEcn+cdQVI
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXAIBAAKBgQCdoWk/3+WcMlfjIrkg40ketmnQaEogQe1LLcuOJV6rKfUSAsPg
|
||||
wgsabJ/wn8TxA1yy3eKJbFl3OiUXMRsp22Jp85PmemiDzyUIStwk72qhp1imbANZ
|
||||
vlmlCFKiQrjUyuDfu4TABmn+kkt3vR1YBEOGt+IFye1UBVSATVdRJ2UVhwIDAQAB
|
||||
AoGAba4fTtuap5l7/8ZsbE7Z1O32KJY4ZcOZukLOLUUhXxXduT+FTgGWujc0/rgc
|
||||
z9qYCLlNZHOouMYTgtSfYvuMuLZ11VIt0GYH+nRioLShE59Yy+zCRyC+gPigS1kz
|
||||
xvo14AsOIPYV14Tk/SsHyq6E0eTk7VzaIE197giiINUERPECQQDSKmtPTh/lRKw7
|
||||
HSZSM0I1mFWn/1zqrAbontRQY5w98QWIOe5qmzYyFbPXYT3d9BzlsMyhgiRNoBbD
|
||||
yvohSHXJAkEAwAHx6ezAZeWWzD5yXD36nyjpkVCw7Tk7TSmOceLJMWt1QcrCfqlS
|
||||
xA5jjpQ6Z8suU5DdtWAryM2sAir1WisYzwJAd6Zcx56jvAQ3xcPXsE6scBTVFzrj
|
||||
7FqZ6E+cclPzfLQ+QQsyOBE7bpI6e/FJppY26XGZXo3YGzV8IGXrt40oOQJALETG
|
||||
h86EFXo3qGOFbmsDy4pdP5nBERCu8X1xUCSfintiD4c2DInxgS5oGclnJeMcjTvL
|
||||
QjQoJCX3UJCi/OUO1QJBAKgcDHWjMvt+l1pjJBsSEZ0HX9AAIIVx0RQmbFGS+F2Q
|
||||
hhu5l77WnnZOQ9vvhV5u7NPCUF9nhU3jh60qWWO8mkc=
|
||||
-----END RSA PRIVATE KEY-----
|
||||
subject=/C=US/O=RSA Data Security, Inc./OU=Commercial Certification Authority
|
||||
issuer= /C=US/O=RSA Data Security, Inc./OU=Commercial Certification Authority
|
||||
notBefore=941104185834Z
|
||||
notAfter =991103185834Z
|
||||
-----BEGIN X509 CERTIFICATE-----
|
||||
|
||||
MIICIzCCAZACBQJBAAAWMA0GCSqGSIb3DQEBAgUAMFwxCzAJBgNVBAYTAlVTMSAw
|
||||
HgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjErMCkGA1UECxMiQ29tbWVy
|
||||
Y2lhbCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NDExMDQxODU4MzRaFw05
|
||||
OTExMDMxODU4MzRaMFwxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdSU0EgRGF0YSBT
|
||||
ZWN1cml0eSwgSW5jLjErMCkGA1UECxMiQ29tbWVyY2lhbCBDZXJ0aWZpY2F0aW9u
|
||||
IEF1dGhvcml0eTCBmzANBgkqhkiG9w0BAQEFAAOBiQAwgYUCfgCk+4Fie84QJ93o
|
||||
975sbsZwmdu41QUDaSiCnHJ/lj+O7Kwpkj+KFPhCdr69XQO5kNTQvAayUTNfxMK/
|
||||
touPmbZiImDd298ggrTKoi8tUO2UMt7gVY3UaOLgTNLNBRYulWZcYVI4HlGogqHE
|
||||
7yXpCuaLK44xZtn42f29O2nZ6wIDAQABMA0GCSqGSIb3DQEBAgUAA34AdrW2EP4j
|
||||
9/dZYkuwX5zBaLxJu7NJbyFHXSudVMQAKD+YufKKg5tgf+tQx6sFEC097TgCwaVI
|
||||
0v5loMC86qYjFmZsGySp8+x5NRhPJsjjr1BKx6cxa9B8GJ1Qv6km+iYrRpwUqbtb
|
||||
MJhCKLVLU7tDCZJAuqiqWqTGtotXTcU=
|
||||
-----END X509 CERTIFICATE-----
|
||||
subject=/C=US/O=RSA Data Security, Inc./OU=Secure Server Certification Authority
|
||||
issuer= /C=US/O=RSA Data Security, Inc./OU=Secure Server Certification Authority
|
||||
notBefore=941109235417Z
|
||||
notAfter =991231235417Z
|
||||
-----BEGIN X509 CERTIFICATE-----
|
||||
|
||||
MIICKTCCAZYCBQJBAAABMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMSAw
|
||||
HgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjEuMCwGA1UECxMlU2VjdXJl
|
||||
IFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NDExMDkyMzU0MTda
|
||||
Fw05OTEyMzEyMzU0MTdaMF8xCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdSU0EgRGF0
|
||||
YSBTZWN1cml0eSwgSW5jLjEuMCwGA1UECxMlU2VjdXJlIFNlcnZlciBDZXJ0aWZp
|
||||
Y2F0aW9uIEF1dGhvcml0eTCBmzANBgkqhkiG9w0BAQEFAAOBiQAwgYUCfgCSznrB
|
||||
roM+WqqJg1esJQF2DK2ujiw3zus1eGRUA+WEQFHJv48I4oqCCNIWhjdV6bEhAq12
|
||||
aIGaBaJLyUslZiJWbIgHj/eBWW2EB2VwE3F2Ppt3TONQiVaYSLkdpykaEy5KEVmc
|
||||
HhXVSVQsczppgrGXOZxtcGdI5d0t1sgeewIDAQABMA0GCSqGSIb3DQEBAgUAA34A
|
||||
iNHReSHO4ovo+MF9NFM/YYPZtgs4F7boviGNjwC4i1N+RGceIr2XJ+CchcxK9oU7
|
||||
suK+ktPlDemvXA4MRpX/oRxePug2WHpzpgr4IhFrwwk4fia7c+8AvQKk8xQNMD9h
|
||||
cHsg/jKjn7P0Z1LctO6EjJY2IN6BCINxIYoPnqk=
|
||||
-----END X509 CERTIFICATE-----
|
||||
subject=/C=ZA/SP=Western Cape/L=Cape Town/O=Thawte Consulting cc
|
||||
/OU=Certification Services Division/CN=Thawte Server CA
|
||||
/Email=server-certs@thawte.com
|
||||
issuer= /C=ZA/SP=Western Cape/L=Cape Town/O=Thawte Consulting cc
|
||||
/OU=Certification Services Division/CN=Thawte Server CA
|
||||
/Email=server-certs@thawte.com
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIC+TCCAmICAQAwDQYJKoZIhvcNAQEEBQAwgcQxCzAJBgNVBAYTAlpBMRUwEwYD
|
||||
VQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU
|
||||
VGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2Vy
|
||||
dmljZXMgRGl2aXNpb24xGTAXBgNVBAMTEFRoYXd0ZSBTZXJ2ZXIgQ0ExJjAkBgkq
|
||||
hkiG9w0BCQEWF3NlcnZlci1jZXJ0c0B0aGF3dGUuY29tMB4XDTk2MDcyNzE4MDc1
|
||||
N1oXDTk4MDcyNzE4MDc1N1owgcQxCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0
|
||||
ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMUVGhhd3RlIENv
|
||||
bnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2
|
||||
aXNpb24xGTAXBgNVBAMTEFRoYXd0ZSBTZXJ2ZXIgQ0ExJjAkBgkqhkiG9w0BCQEW
|
||||
F3NlcnZlci1jZXJ0c0B0aGF3dGUuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB
|
||||
iQKBgQDTpFBuyP9Wa+bPXbbqDGh1R6KqwtqEJfyo9EdR2oW1IHSUhh4PdcnpCGH1
|
||||
Bm0wbhUZAulSwGLbTZme4moMRDjN/r7jZAlwxf6xaym2L0nIO9QnBCUQly/nkG3A
|
||||
KEKZ10xD3sP1IW1Un13DWOHA5NlbsLjctHvfNjrCtWYiEtaHDQIDAQABMA0GCSqG
|
||||
SIb3DQEBBAUAA4GBAIsvn7ifX3RUIrvYXtpI4DOfARkTogwm6o7OwVdl93yFhDcX
|
||||
7h5t0XZ11MUAMziKdde3rmTvzUYIUCYoY5b032IwGMTvdiclK+STN6NP2m5nvFAM
|
||||
qJT5gC5O+j/jBuZRQ4i0AMYQr5F4lT8oBJnhgafw6PL8aDY2vMHGSPl9+7uf
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDDTCCAnYCAQAwDQYJKoZIhvcNAQEEBQAwgc4xCzAJBgNVBAYTAlpBMRUwEwYD
|
||||
VQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU
|
||||
VGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2Vy
|
||||
dmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNlcnZlciBD
|
||||
QTEoMCYGCSqGSIb3DQEJARYZcHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNvbTAeFw05
|
||||
NjA3MjcxODA3MTRaFw05ODA3MjcxODA3MTRaMIHOMQswCQYDVQQGEwJaQTEVMBMG
|
||||
A1UECBMMV2VzdGVybiBDYXBlMRIwEAYDVQQHEwlDYXBlIFRvd24xHTAbBgNVBAoT
|
||||
FFRoYXd0ZSBDb25zdWx0aW5nIGNjMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNl
|
||||
cnZpY2VzIERpdmlzaW9uMSEwHwYDVQQDExhUaGF3dGUgUHJlbWl1bSBTZXJ2ZXIg
|
||||
Q0ExKDAmBgkqhkiG9w0BCQEWGXByZW1pdW0tc2VydmVyQHRoYXd0ZS5jb20wgZ8w
|
||||
DQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANI2NmqL18JbntqBQWKPOO5JBFXW0O8c
|
||||
G5UWR+8YSDU6UvQragaPOy/qVuOvho2eF/eetGV1Ak3vywmiIVHYm9Bn0LoNkgYU
|
||||
c9STy5cqAJxcTgy8+hVS/PJEbtoRSm4Iny8t4/mqOoZztkZTWMiJBb2DEbhzP6oH
|
||||
jfRCTedAnRw3AgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAutFIgTRZVYerIZfL9lvR
|
||||
w9Eifvvo5KTZ3h+Bj+VzNnyw4Qc/IyXkPOu6SIiH9LQ3sCmWBdxpe+qr4l77rLj2
|
||||
GYuMtESFfn1XVALzkYgC7JcPuTOjMfIiMByt+uFf8AV8x0IW/Qkuv+hEQcyM9vxK
|
||||
3VZdLbCVIhNoEsysrxCpxcI=
|
||||
-----END CERTIFICATE-----
|
||||
Tims test GCI CA
|
||||
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIB8DCCAZoCAQAwDQYJKoZIhvcNAQEEBQAwgYIxCzAJBgNVBAYTAkFVMRMwEQYD
|
||||
VQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5
|
||||
cHRTb2Z0IFB0eSBMdGQxFDASBgNVBAsTC2RldmVsb3BtZW50MRkwFwYDVQQDExBD
|
||||
cnlwdFNvZnQgRGV2IENBMB4XDTk3MDMyMjEzMzQwNFoXDTk4MDMyMjEzMzQwNFow
|
||||
gYIxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhC
|
||||
cmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxFDASBgNVBAsTC2Rl
|
||||
dmVsb3BtZW50MRkwFwYDVQQDExBDcnlwdFNvZnQgRGV2IENBMFwwDQYJKoZIhvcN
|
||||
AQEBBQADSwAwSAJBAOAOAqogG5QwAmLhzyO4CoRnx/wVy4NZP4dxJy83O1EnL0rw
|
||||
OdsamJKvPOLHgSXo3gDu9uVyvCf/QJmZAmC5ml8CAwEAATANBgkqhkiG9w0BAQQF
|
||||
AANBADRRS/GVdd7rAqRW6SdmgLJduOU2yq3avBu99kRqbp9A/dLu6r6jU+eP4oOA
|
||||
TfdbFZtAAD2Hx9jUtY3tfdrJOb8=
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICVjCCAgACAQAwDQYJKoZIhvcNAQEEBQAwgbUxCzAJBgNVBAYTAkFVMRMwEQYD
|
||||
VQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5
|
||||
cHRTb2Z0IFB0eSBMdGQxLDAqBgNVBAsTI1dPUlRITEVTUyBDRVJUSUZJQ0FUSU9O
|
||||
IEFVVEhPUklUSUVTMTQwMgYDVQQDEytaRVJPIFZBTFVFIENBIC0gREVNT05TVFJB
|
||||
VElPTiBQVVJQT1NFUyBPTkxZMB4XDTk3MDQwMzEzMjI1NFoXDTk4MDQwMzEzMjI1
|
||||
NFowgbUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQH
|
||||
EwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxLDAqBgNVBAsT
|
||||
I1dPUlRITEVTUyBDRVJUSUZJQ0FUSU9OIEFVVEhPUklUSUVTMTQwMgYDVQQDEyta
|
||||
RVJPIFZBTFVFIENBIC0gREVNT05TVFJBVElPTiBQVVJQT1NFUyBPTkxZMFwwDQYJ
|
||||
KoZIhvcNAQEBBQADSwAwSAJBAOZ7T7yqP/tyspcko3yPY1y0Cm2EmwNvzW4QgVXR
|
||||
Fjs3HmJ4xtSpXdo6mwcGezL3Abt/aQXaxv9PU8xt+Jr0OFUCAwEAATANBgkqhkiG
|
||||
9w0BAQQFAANBAOQpYmGgyCqCy1OljgJhCqQOu627oVlHzK1L+t9vBaMfn40AVUR4
|
||||
WzQVWO31KTgi5vTK1U+3h46fgUWqQ0h+6rU=
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIAwgKADAgECAgEAMA0GCSqGSIb3DQEBBAUAMGIxETAPBgNVBAcTCEludGVybmV0
|
||||
MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE0MDIGA1UECxMrVmVyaVNpZ24gQ2xh
|
||||
c3MgMSBDQSAtIEluZGl2aWR1YWwgU3Vic2NyaWJlcjAeFw05NjA0MDgxMDIwMjda
|
||||
Fw05NzA0MDgxMDIwMjdaMGIxETAPBgNVBAcTCEludGVybmV0MRcwFQYDVQQKEw5W
|
||||
ZXJpU2lnbiwgSW5jLjE0MDIGA1UECxMrVmVyaVNpZ24gQ2xhc3MgMSBDQSAtIElu
|
||||
ZGl2aWR1YWwgU3Vic2NyaWJlcjCAMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2
|
||||
FKbPTdAFDdjKI9BvqrQpkmOOLPhvltcunXZLEbE2jVfJw/0cxrr+Hgi6M8qV6r7j
|
||||
W80GqLd5HUQq7XPysVKDaBBwZJHXPmv5912dFEObbpdFmIFH0S3L3bty10w/cari
|
||||
QPJUObwW7s987LrbP2wqsxaxhhKdrpM01bjV0Pc+qQIDAQABAAAAADANBgkqhkiG
|
||||
9w0BAQQFAAOBgQA+1nJryNt8VBRjRr07ArDAV/3jAH7GjDc9jsrxZS68ost9v06C
|
||||
TvTNKGL+LISNmFLXl+JXhgGB0JZ9fvyYzNgHQ46HBUng1H6voalfJgS2KdEo50wW
|
||||
8EFZYMDkT1k4uynwJqkVN2QJK/2q4/A/VCov5h6SlM8Affg2W+1TLqvqkwAA
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
subject=/L=Internet/O=VeriSign, Inc./OU=VeriSign Class 2 CA - Individual Subscriber
|
||||
issuer= /L=Internet/O=VeriSign, Inc./OU=VeriSign Class 2 CA - Individual Subscriber
|
||||
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEkzCCA/ygAwIBAgIRANDTUpSRL3nTFeMrMayFSPAwDQYJKoZIhvcNAQECBQAw
|
||||
YjERMA8GA1UEBxMISW50ZXJuZXQxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTQw
|
||||
MgYDVQQLEytWZXJpU2lnbiBDbGFzcyAyIENBIC0gSW5kaXZpZHVhbCBTdWJzY3Jp
|
||||
YmVyMB4XDTk2MDYwNDAwMDAwMFoXDTk4MDYwNDIzNTk1OVowYjERMA8GA1UEBxMI
|
||||
SW50ZXJuZXQxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTQwMgYDVQQLEytWZXJp
|
||||
U2lnbiBDbGFzcyAyIENBIC0gSW5kaXZpZHVhbCBTdWJzY3JpYmVyMIGfMA0GCSqG
|
||||
SIb3DQEBAQUAA4GNADCBiQKBgQC6A+2czKGRcYMfm8gdnk+0de99TDDzsqo0v5nb
|
||||
RsbUmMcdRQ7nsMbRWe0SAb/9QoLTZ/cJ0iOBqdrkz7UpqqKarVoTSdlSMVM92tWp
|
||||
3bJncZHQD1t4xd6lQVdI1/T6R+5J0T1ukOdsI9Jmf+F28S6g3R3L1SFwiHKeZKZv
|
||||
z+793wIDAQABo4ICRzCCAkMwggIpBgNVHQMBAf8EggIdMIICGTCCAhUwggIRBgtg
|
||||
hkgBhvhFAQcBATCCAgAWggGrVGhpcyBjZXJ0aWZpY2F0ZSBpbmNvcnBvcmF0ZXMg
|
||||
YnkgcmVmZXJlbmNlLCBhbmQgaXRzIHVzZSBpcyBzdHJpY3RseSBzdWJqZWN0IHRv
|
||||
LCB0aGUgVmVyaVNpZ24gQ2VydGlmaWNhdGlvbiBQcmFjdGljZSBTdGF0ZW1lbnQg
|
||||
KENQUyksIGF2YWlsYWJsZSBhdDogaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL0NQ
|
||||
Uy0xLjA7IGJ5IEUtbWFpbCBhdCBDUFMtcmVxdWVzdHNAdmVyaXNpZ24uY29tOyBv
|
||||
ciBieSBtYWlsIGF0IFZlcmlTaWduLCBJbmMuLCAyNTkzIENvYXN0IEF2ZS4sIE1v
|
||||
dW50YWluIFZpZXcsIENBIDk0MDQzIFVTQSBUZWwuICsxICg0MTUpIDk2MS04ODMw
|
||||
IENvcHlyaWdodCAoYykgMTk5NiBWZXJpU2lnbiwgSW5jLiAgQWxsIFJpZ2h0cyBS
|
||||
ZXNlcnZlZC4gQ0VSVEFJTiBXQVJSQU5USUVTIERJU0NMQUlNRUQgYW5kIExJQUJJ
|
||||
TElUWSBMSU1JVEVELqAOBgxghkgBhvhFAQcBAQGhDgYMYIZIAYb4RQEHAQECMC8w
|
||||
LRYraHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JlcG9zaXRvcnkvQ1BTLTEuMDAU
|
||||
BglghkgBhvhCAQEBAf8EBAMCAgQwDQYJKoZIhvcNAQECBQADgYEApRJRkNBqLLgs
|
||||
53IR/d18ODdLOWMTZ+QOOxBrq460iBEdUwgF8vmPRX1ku7UiDeNzaLlurE6eFqHq
|
||||
2zPyK5j60zfTLVJMWKcQWwTJLjHtXrW8pxhNtFc6Fdvy5ZkHnC/9NIl7/t4U6WqB
|
||||
p4y+p7SdMIkEwIZfds0VbnQyX5MRUJY=
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
subject=/C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority
|
||||
issuer= /C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICMTCCAZoCBQKhAAABMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMRcw
|
||||
FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgMyBQdWJsaWMg
|
||||
UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NjAxMjkwMDAwMDBa
|
||||
Fw05OTEyMzEyMzU5NTlaMF8xCzAJBgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2ln
|
||||
biwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgMyBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZp
|
||||
Y2F0aW9uIEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAyVxZ
|
||||
nvIbigEUtBDfBEDb41evakVAj4QMC9Ez2dkRz+4CWB8l9yqoRAWq7AMfeH+ek7ma
|
||||
AKojfdashaJjRcdyJ8z0TMZ1cdI5709C8HXfCpDGjiBvmA/4rCNfcCk2pMmG57Ga
|
||||
IMtTpYXnPb59mv4kRTPcdhXtD6JxZExlLoFoRacCAwEAATANBgkqhkiG9w0BAQIF
|
||||
AAOBgQB1Zmw+0c2B27X4LzZRtvdCvM1Cr9wO+hVs+GeTVzrrtpLotgHKjLeOQ7RJ
|
||||
Zfk+7r11Ri7J/CVdqMcvi5uPaM+0nJcYwE3vH9mvgrPmZLiEXIqaB1JDYft0nls6
|
||||
NvxMsvwaPxUupVs8G5DsiCnkWRb5zget7Ond2tIxik/W2O8XjQ==
|
||||
-----END CERTIFICATE-----
|
||||
subject=/C=US/O=VeriSign, Inc./OU=Class 4 Public Primary Certification Authority
|
||||
issuer= /C=US/O=VeriSign, Inc./OU=Class 4 Public Primary Certification Authority
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICMTCCAZoCBQKmAAABMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMRcw
|
||||
FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgNCBQdWJsaWMg
|
||||
UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NjAxMjkwMDAwMDBa
|
||||
Fw05OTEyMzEyMzU5NTlaMF8xCzAJBgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2ln
|
||||
biwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgNCBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZp
|
||||
Y2F0aW9uIEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0LJ1
|
||||
9njQrlpQ9OlQqZ+M1++RlHDo0iSQdomF1t+s5gEXMoDwnZNHvJplnR+Xrr/phnVj
|
||||
IIm9gFidBAydqMEk6QvlMXi9/C0MN2qeeIDpRnX57aP7E3vIwUzSo+/1PLBij0pd
|
||||
O92VZ48TucE81qcmm+zDO3rZTbxtm+gVAePwR6kCAwEAATANBgkqhkiG9w0BAQIF
|
||||
AAOBgQBT3dPwnCR+QKri/AAa19oM/DJhuBUNlvP6Vxt/M3yv6ZiaYch6s7f/sdyZ
|
||||
g9ysEvxwyR84Qu1E9oAuW2szaayc01znX1oYx7EteQSWQZGZQbE8DbqEOcY7l/Am
|
||||
yY7uvcxClf8exwI/VAx49byqYHwCaejcrOICdmHEPgPq0ook0Q==
|
||||
-----END CERTIFICATE-----
|
||||
|
@ -1,376 +1,52 @@
|
||||
issuer= /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit)
|
||||
subject=/C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Server test cert (1024 bit)
|
||||
subject= C = UK, O = OpenSSL Group, OU = FOR TESTING PURPOSES ONLY, CN = Test Server Cert #2
|
||||
issuer= C = UK, O = OpenSSL Group, OU = FOR TESTING PURPOSES ONLY, CN = OpenSSL Test Intermediate CA
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICLjCCAZcCAQEwDQYJKoZIhvcNAQEEBQAwWzELMAkGA1UEBhMCQVUxEzARBgNV
|
||||
BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRswGQYD
|
||||
VQQDExJUZXN0IENBICgxMDI0IGJpdCkwHhcNOTcwNjA5MTM1NzU0WhcNOTgwNjA5
|
||||
MTM1NzU0WjBkMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDEaMBgG
|
||||
A1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxJDAiBgNVBAMTG1NlcnZlciB0ZXN0IGNl
|
||||
cnQgKDEwMjQgYml0KTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAsxH1PBPm
|
||||
RkxrR11eV4bzNi4N9n11CI8nV29+ARlT1+qDe/mjVUvXlmsr1v/vf71G9GgqopSa
|
||||
6RXrICLVdk/FYYYzhPvl1M+OrjaXDFO8BzBAF1Lnz6c7aRZvGRJNrRSr2nZEkqDf
|
||||
JW9dY7r2VZEpD5QeuaRYUnuECkqeieB65GMCAwEAATANBgkqhkiG9w0BAQQFAAOB
|
||||
gQCWsOta6C0wiVzXz8wPmJKyTrurMlgUss2iSuW9366iwofZddsNg7FXniMzkIf6
|
||||
dp7jnmWZwKZ9cXsNUS2o4OL07qOk2HOywC0YsNZQsOBu1CBTYYkIefDiKFL1zQHh
|
||||
8lwwNd4NP+OE3NzUNkCfh4DnFfg9WHkXUlD5UpxNRJ4gJA==
|
||||
MIID6jCCAtKgAwIBAgIJALnu1NlVpZ60MA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
|
||||
BAYTAlVLMRYwFAYDVQQKDA1PcGVuU1NMIEdyb3VwMSIwIAYDVQQLDBlGT1IgVEVT
|
||||
VElORyBQVVJQT1NFUyBPTkxZMSUwIwYDVQQDDBxPcGVuU1NMIFRlc3QgSW50ZXJt
|
||||
ZWRpYXRlIENBMB4XDTExMTIwODE0MDE0OFoXDTIxMTAxNjE0MDE0OFowZzELMAkG
|
||||
A1UEBhMCVUsxFjAUBgNVBAoMDU9wZW5TU0wgR3JvdXAxIjAgBgNVBAsMGUZPUiBU
|
||||
RVNUSU5HIFBVUlBPU0VTIE9OTFkxHDAaBgNVBAMME1Rlc3QgU2VydmVyIENlcnQg
|
||||
IzIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDrdi7j9yctG+L4EjBy
|
||||
gjPmEqZzOJEQba26MoQGzglU7e5Xf59Rb/hgVQuKAoiZe7/R8rK4zJ4W7iXdXw0L
|
||||
qBpyG8B5aGKeI32w+A9TcBApoXXL2CrYQEQjZwUIpLlYBIi2NkJj3nVkq5dgl1gO
|
||||
ALiQ+W8jg3kzg5Ec9rimp9r93N8wsSL3awsafurmYCvOf7leHaMP1WJ/zDRGUNHG
|
||||
/WtDjXc8ZUG1+6EXU9Jc2Fs+2Omf7fcN0l00AK/wPg8OaNS0rKyGq9JdIT9FRGV1
|
||||
bXe/rx58FaE5CItdwCSYhJvF/O95LWQoxJXye5bCFLmvDTEyVq9FMSCptfsmbXjE
|
||||
ZGsXAgMBAAGjgY8wgYwwDAYDVR0TAQH/BAIwADAOBgNVHQ8BAf8EBAMCBeAwLAYJ
|
||||
YIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1Ud
|
||||
DgQWBBR52UaWWTKzZGDH/X4mWNcuqeQVazAfBgNVHSMEGDAWgBQ2w2yI55X+sL3s
|
||||
zj49hqshgYfa2jANBgkqhkiG9w0BAQUFAAOCAQEANBW+XYLlHBqVY/31ie+3gRlS
|
||||
LPfy4SIqn0t3RJjagT29MXprblBO2cbMO8VGjkQdKGpmMXjxbht2arOOUXRHX4n/
|
||||
XTyn/QHEf0bcwIITMReO3DZUPAEw8hSjn9xEOM0IRVOCP+mH5fi74QzzQaZVCyYg
|
||||
5VtLKdww/+sc0nCbKl2KWgDluriH0nfVx95qgW3mg9dhXRr0zmf1w2zkBHYpARYL
|
||||
Dew6Z8EE4tS3HJu8/qM6meWzNtrfonQ3eiiMxjZBxzV46jchBwa2z9XYhP6AmpPb
|
||||
oeTSzcQNbWsxaGYzWo46oLDUZmJOwSBawbS31bZNMCoPIY6ukoesCzFSsUKZww==
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXgIBAAKBgQCzEfU8E+ZGTGtHXV5XhvM2Lg32fXUIjydXb34BGVPX6oN7+aNV
|
||||
S9eWayvW/+9/vUb0aCqilJrpFesgItV2T8VhhjOE++XUz46uNpcMU7wHMEAXUufP
|
||||
pztpFm8ZEk2tFKvadkSSoN8lb11juvZVkSkPlB65pFhSe4QKSp6J4HrkYwIDAQAB
|
||||
AoGBAKy8jvb0Lzby8q11yNLf7+78wCVdYi7ugMHcYA1JVFK8+zb1WfSm44FLQo/0
|
||||
dSChAjgz36TTexeLODPYxleJndjVcOMVzsLJjSM8dLpXsTS4FCeMbhw2s2u+xqKY
|
||||
bbPWfk+HOTyJjfnkcC5Nbg44eOmruq0gSmBeUXVM5UntlTnxAkEA7TGCA3h7kx5E
|
||||
Bl4zl2pc3gPAGt+dyfk5Po9mGJUUXhF5p2zueGmYWW74TmOWB1kzt4QRdYMzFePq
|
||||
zfDNXEa1CwJBAMFErdY0xp0UJ13WwBbUTk8rujqQdHtjw0klhpbuKkjxu2hN0wwM
|
||||
6p0D9qxF7JHaghqVRI0fAW/EE0OzdHMR9QkCQQDNR26dMFXKsoPu+vItljj/UEGf
|
||||
QG7gERiQ4yxaFBPHgdpGo0kT31eh9x9hQGDkxTe0GNG/YSgCRvm8+C3TMcKXAkBD
|
||||
dhGn36wkUFCddMSAM4NSJ1VN8/Z0y5HzCmI8dM3VwGtGMUQlxKxwOl30LEQzdS5M
|
||||
0SWojNYXiT2gOBfBwtbhAkEAhafl5QEOIgUz+XazS/IlZ8goNKdDVfYgK3mHHjvv
|
||||
nY5G+AuGebdNkXJr4KSWxDcN+C2i47zuj4QXA16MAOandA==
|
||||
MIIEowIBAAKCAQEA63Yu4/cnLRvi+BIwcoIz5hKmcziREG2tujKEBs4JVO3uV3+f
|
||||
UW/4YFULigKImXu/0fKyuMyeFu4l3V8NC6gachvAeWhiniN9sPgPU3AQKaF1y9gq
|
||||
2EBEI2cFCKS5WASItjZCY951ZKuXYJdYDgC4kPlvI4N5M4ORHPa4pqfa/dzfMLEi
|
||||
92sLGn7q5mArzn+5Xh2jD9Vif8w0RlDRxv1rQ413PGVBtfuhF1PSXNhbPtjpn+33
|
||||
DdJdNACv8D4PDmjUtKyshqvSXSE/RURldW13v68efBWhOQiLXcAkmISbxfzveS1k
|
||||
KMSV8nuWwhS5rw0xMlavRTEgqbX7Jm14xGRrFwIDAQABAoIBAHLsTPihIfLnYIE5
|
||||
x4GsQQ5zXeBw5ITDM37ktwHnQDC+rIzyUl1aLD1AZRBoKinXd4lOTqLZ4/NHKx4A
|
||||
DYr58mZtWyUmqLOMmQVuHXTZBlp7XtYuXMMNovQwjQlp9LicBeoBU6gQ5PVMtubD
|
||||
F4xGF89Sn0cTHW3iMkqTtQ5KcR1j57OcJO0FEb1vPvk2MXI5ZyAatUYE7YacbEzd
|
||||
rg02uIwx3FqNSkuSI79uz4hMdV5TPtuhxx9nTwj9aLUhXFeZ0mn2PVgVzEnnMoJb
|
||||
+znlsZDgzDlJqdaD744YGWh8Z3OEssB35KfzFcdOeO6yH8lmv2Zfznk7pNPT7LTb
|
||||
Lae9VgkCgYEA92p1qnAB3NtJtNcaW53i0S5WJgS1hxWKvUDx3lTB9s8X9fHpqL1a
|
||||
E94fDfWzp/hax6FefUKIvBOukPLQ6bYjTMiFoOHzVirghAIuIUoMI5VtLhwD1hKs
|
||||
Lr7l/dptMgKb1nZHyXoKHRBthsy3K4+udsPi8TzMvYElgEqyQIe/Rk0CgYEA86GL
|
||||
8HC6zLszzKERDPBxrboRmoFvVUCTQDhsfj1M8aR3nQ8V5LkdIJc7Wqm/Ggfk9QRf
|
||||
rJ8M2WUMlU5CNnCn/KCrKzCNZIReze3fV+HnKdbcXGLvgbHPrhnz8yYehUFG+RGq
|
||||
bVyDWRU94T38izy2s5qMYrMJWZEYyXncSPbfcPMCgYAtaXfxcZ+V5xYPQFARMtiX
|
||||
5nZfggvDoJuXgx0h3tK/N2HBfcaSdzbaYLG4gTmZggc/jwnl2dl5E++9oSPhUdIG
|
||||
3ONSFUbxsOsGr9PBvnKd8WZZyUCXAVRjPBzAzF+whzQNWCZy/5htnz9LN7YDI9s0
|
||||
5113Q96cheDZPFydZY0hHQKBgQDVbEhNukM5xCiNcu+f2SaMnLp9EjQ4h5g3IvaP
|
||||
5B16daw/Dw8LzcohWboqIxeAsze0GD/D1ZUJAEd0qBjC3g+a9BjefervCjKOzXng
|
||||
38mEUm+6EwVjJSQcjSmycEs+Sr/kwr/8i5WYvU32+jk4tFgMoC+o6tQe/Uesf68k
|
||||
z/dPVwKBgGbF7Vv1/3SmhlOy+zYyvJ0CrWtKxH9QP6tLIEgEpd8x7YTSuCH94yok
|
||||
kToMXYA3sWNPt22GbRDZ+rcp4c7HkDx6I6vpdP9aQEwJTp0EPy0sgWr2XwYmreIQ
|
||||
NFmkk8Itn9EY2R9VBaP7GLv5kvwxDdLAnmwGmzVtbmaVdxCaBwUk
|
||||
-----END RSA PRIVATE KEY-----
|
||||
subject=/C=US/O=AT&T Bell Laboratories/OU=Prototype Research CA
|
||||
issuer= /C=US/O=AT&T Bell Laboratories/OU=Prototype Research CA
|
||||
notBefore=950413210656Z
|
||||
notAfter =970412210656Z
|
||||
-----BEGIN X509 CERTIFICATE-----
|
||||
|
||||
MIICCDCCAXECAQAwDQYJKoZIhvcNAQEEBQAwTjELMAkGA1UEBhMCVVMxHzAdBgNV
|
||||
BAoUFkFUJlQgQmVsbCBMYWJvcmF0b3JpZXMxHjAcBgNVBAsUFVByb3RvdHlwZSBS
|
||||
ZXNlYXJjaCBDQTAeFw05NTA0MTMyMTA2NTZaFw05NzA0MTIyMTA2NTZaME4xCzAJ
|
||||
BgNVBAYTAlVTMR8wHQYDVQQKFBZBVCZUIEJlbGwgTGFib3JhdG9yaWVzMR4wHAYD
|
||||
VQQLFBVQcm90b3R5cGUgUmVzZWFyY2ggQ0EwgZwwDQYJKoZIhvcNAQEBBQADgYoA
|
||||
MIGGAoGAebOmgtSCl+wCYZc86UGYeTLY8cjmW2P0FN8ToT/u2pECCoFdrlycX0OR
|
||||
3wt0ZhpFXLVNeDnHwEE9veNUih7pCL2ZBFqoIoQkB1lZmXRiVtjGonz8BLm/qrFM
|
||||
YHb0lme/Ol+s118mwKVxnn6bSAeI/OXKhLaVdYZWk+aEaxEDkVkCAQ8wDQYJKoZI
|
||||
hvcNAQEEBQADgYEAAZMG14lZmZ8bahkaHaTV9dQf4p2FZiQTFwHP9ZyGsXPC+LT5
|
||||
dG5iTaRmyjNIJdPWohZDl97kAci79aBndvuEvRKOjLHs3WRGBIwERnAcnY9Mz8u/
|
||||
zIHK23PjYVxGGaZd669OJwD0CYyqH22HH9nFUGaoJdsv39ChW0NRdLE9+y8=
|
||||
-----END X509 CERTIFICATE-----
|
||||
issuer= /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test PCA (1024 bit)
|
||||
subject=/C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit)
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICJjCCAY8CAQAwDQYJKoZIhvcNAQEEBQAwXDELMAkGA1UEBhMCQVUxEzARBgNV
|
||||
BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYD
|
||||
VQQDExNUZXN0IFBDQSAoMTAyNCBiaXQpMB4XDTk3MDYwOTEzNTc0M1oXDTAxMDYw
|
||||
OTEzNTc0M1owWzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY
|
||||
BgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRswGQYDVQQDExJUZXN0IENBICgxMDI0
|
||||
IGJpdCkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKO7o8t116VP6cgybTsZ
|
||||
DCZhr95nYlZuya3aCi1IKoztqwWnjbmDFIriOqGFPrZQ+moMETC9D59iRW/dFXSv
|
||||
1F65ka/XY2hLh9exCCo7XuUcDs53Qp3bI3AmMqHjgzE8oO3ajyJAzJkTTOUecQU2
|
||||
mw/gI4tMM0LqWMQS7luTy4+xAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAM7achv3v
|
||||
hLQJcv/65eGEpBXM40ZDVoFQFFJWaY5p883HTqLB1x4FdzsXHH0QKBTcKpWwqyu4
|
||||
YDm3fb8oDugw72bCzfyZK/zVZPR/hVlqI/fvU109Qoc+7oPvIXWky71HfcK6ZBCA
|
||||
q30KIqGM/uoM60INq97qjDmCJapagcNBGQs=
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXQIBAAKBgQCju6PLddelT+nIMm07GQwmYa/eZ2JWbsmt2gotSCqM7asFp425
|
||||
gxSK4jqhhT62UPpqDBEwvQ+fYkVv3RV0r9ReuZGv12NoS4fXsQgqO17lHA7Od0Kd
|
||||
2yNwJjKh44MxPKDt2o8iQMyZE0zlHnEFNpsP4COLTDNC6ljEEu5bk8uPsQIDAQAB
|
||||
AoGAVZmpFZsDZfr0l2S9tLLwpjRWNOlKATQkno6q2WesT0eGLQufTciY+c8ypfU6
|
||||
hyio8r5iUl/VhhdjhAtKx1mRpiotftHo/eYf8rtsrnprOnWG0bWjLjtIoMbcxGn2
|
||||
J3bN6LJmbJMjDs0eJ3KnTu646F3nDUw2oGAwmpzKXA1KAP0CQQDRvQhxk2D3Pehs
|
||||
HvG665u2pB5ipYQngEFlZO7RHJZzJOZEWSLuuMqaF/7pTfA5jiBvWqCgJeCRRInL
|
||||
21ru4dlPAkEAx9jj7BgKn5TYnMoBSSe0afjsV9oApVpN1Nacb1YDtCwy+scp3++s
|
||||
nFxlv98wxIlSdpwMUn+AUWfjiWR7Tu/G/wJBAJ/KjwZIrFVxewP0x2ILYsTRYLzz
|
||||
MS4PDsO7FB+I0i7DbBOifXS2oNSpd3I0CNMwrxFnUHzynpbOStVfN3ZL5w0CQQCa
|
||||
pwFahxBRhkJKsxhjoFJBX9yl75JoY4Wvm5Tbo9ih6UJaRx3kqfkN14L2BKYcsZgb
|
||||
KY9vmDOYy6iNfjDeWTfJAkBkfPUb8oTJ/nSP5zN6sqGxSY4krc4xLxpRmxoJ8HL2
|
||||
XfhqXkTzbU13RX9JJ/NZ8vQN9Vm2NhxRGJocQkmcdVtJ
|
||||
-----END RSA PRIVATE KEY-----
|
||||
-----BEGIN X509 CERTIFICATE-----
|
||||
MIICYDCCAiACAgEoMAkGBSsOAwINBQAwfDELMAkGA1UEBhMCVVMxNjA0BgNVBAoT
|
||||
LU5hdGlvbmFsIEFlcm9uYXV0aWNzIGFuZCBTcGFjZSBBZG1pbmlzdHJhdGlvbjEZ
|
||||
MBcGA1UECxMQVGVzdCBFbnZpcm9ubWVudDEaMBgGA1UECxMRRFNTLU5BU0EtUGls
|
||||
b3QtQ0EwHhcNOTYwMjI2MTYzMjQ1WhcNOTcwMjI1MTYzMjQ1WjB8MQswCQYDVQQG
|
||||
EwJVUzE2MDQGA1UEChMtTmF0aW9uYWwgQWVyb25hdXRpY3MgYW5kIFNwYWNlIEFk
|
||||
bWluaXN0cmF0aW9uMRkwFwYDVQQLExBUZXN0IEVudmlyb25tZW50MRowGAYDVQQL
|
||||
ExFEU1MtTkFTQS1QaWxvdC1DQTCB8jAJBgUrDgMCDAUAA4HkADCB4AJBAMA/ssKb
|
||||
hPNUG7ZlASfVwEJU21O5OyF/iyBzgHI1O8eOhJGUYO8cc8wDMjR508Mr9cp6Uhl/
|
||||
ZB7FV5GkLNEnRHYCQQDUEaSg45P2qrDwixTRhFhmWz5Nvc4lRFQ/42XPcchiJBLb
|
||||
bn3QK74T2IxY1yY+kCNq8XrIqf5fJJzIH0J/xUP3AhUAsg2wsQHfDGYk/BOSulX3
|
||||
fVd0geUCQQCzCFUQAh+ZkEmp5804cs6ZWBhrUAfnra8lJItYo9xPcXgdIfLfibcX
|
||||
R71UsyO77MRD7B0+Ag2tq794IleCVcEEMAkGBSsOAwINBQADLwAwLAIUUayDfreR
|
||||
Yh2WeU86/pHNdkUC1IgCFEfxe1f0oMpxJyrJ5XIxTi7vGdoK
|
||||
-----END X509 CERTIFICATE-----
|
||||
-----BEGIN X509 CERTIFICATE-----
|
||||
|
||||
MIICGTCCAdgCAwCqTDAJBgUrDgMCDQUAMHwxCzAJBgNVBAYTAlVTMTYwNAYDVQQK
|
||||
Ey1OYXRpb25hbCBBZXJvbmF1dGljcyBhbmQgU3BhY2UgQWRtaW5pc3RyYXRpb24x
|
||||
GTAXBgNVBAsTEFRlc3QgRW52aXJvbm1lbnQxGjAYBgNVBAsTEURTUy1OQVNBLVBp
|
||||
bG90LUNBMB4XDTk2MDUxNDE3MDE0MVoXDTk3MDUxNDE3MDE0MVowMzELMAkGA1UE
|
||||
BhMCQVUxDzANBgNVBAoTBk1pbmNvbTETMBEGA1UEAxMKRXJpYyBZb3VuZzCB8jAJ
|
||||
BgUrDgMCDAUAA4HkADCB4AJBAKbfHz6vE6pXXMTpswtGUec2tvnfLJUsoxE9qs4+
|
||||
ObZX7LmLvragNPUeiTJx7UOWZ5DfBj6bXLc8eYne0lP1g3ACQQDUEaSg45P2qrDw
|
||||
ixTRhFhmWz5Nvc4lRFQ/42XPcchiJBLbbn3QK74T2IxY1yY+kCNq8XrIqf5fJJzI
|
||||
H0J/xUP3AhUAsg2wsQHfDGYk/BOSulX3fVd0geUCQQCzCFUQAh+ZkEmp5804cs6Z
|
||||
WBhrUAfnra8lJItYo9xPcXgdIfLfibcXR71UsyO77MRD7B0+Ag2tq794IleCVcEE
|
||||
MAkGBSsOAwINBQADMAAwLQIUWsuuJRE3VT4ueWkWMAJMJaZjj1ECFQCYY0zX4bzM
|
||||
LC7obsrHD8XAHG+ZRG==
|
||||
-----END X509 CERTIFICATE-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICTTCCAbagAwIBAgIBADANBgkqhkiG9w0BAQQFADBMMQswCQYDVQQGEwJHQjEM
|
||||
MAoGA1UEChMDVUNMMRgwFgYDVQQLEw9JQ0UtVEVMIFByb2plY3QxFTATBgNVBAMT
|
||||
DFRydXN0RmFjdG9yeTAeFw05NzA0MjIxNDM5MTRaFw05ODA0MjIxNDM5MTRaMEwx
|
||||
CzAJBgNVBAYTAkdCMQwwCgYDVQQKEwNVQ0wxGDAWBgNVBAsTD0lDRS1URUwgUHJv
|
||||
amVjdDEVMBMGA1UEAxMMVHJ1c3RGYWN0b3J5MIGcMAoGBFUIAQECAgQAA4GNADCB
|
||||
iQKBgQCEieR8NcXkUW1f0G6aC6u0i8q/98JqS6RxK5YmHIGKCkuTWAUjzLfUa4dt
|
||||
U9igGCjTuxaDqlzEim+t/02pmiBZT9HaX++35MjQPUWmsChcYU5WyzGErXi+rQaw
|
||||
zlwS73zM8qiPj/97lXYycWhgL0VaiDSPxRXEUdWoaGruom4mNQIDAQABo0IwQDAd
|
||||
BgNVHQ4EFgQUHal1LZr7oVg5z6lYzrhTgZRCmcUwDgYDVR0PAQH/BAQDAgH2MA8G
|
||||
A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAfaggfl6FZoioecjv0dq8
|
||||
/DXo/u11iMZvXn08gjX/zl2b4wtPbShOSY5FhkSm8GeySasz+/Nwb/uzfnIhokWi
|
||||
lfPZHtlCWtXbIy/TN51eJyq04ceDCQDWvLC2enVg9KB+GJ34b5c5VaPRzq8MBxsA
|
||||
S7ELuYGtmYgYm9NZOIr7yU0=
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIB6jCCAZQCAgEtMA0GCSqGSIb3DQEBBAUAMIGAMQswCQYDVQQGEwJVUzE2MDQG
|
||||
A1UEChMtTmF0aW9uYWwgQWVyb25hdXRpY3MgYW5kIFNwYWNlIEFkbWluaXN0cmF0
|
||||
aW9uMRkwFwYDVQQLExBUZXN0IEVudmlyb25tZW50MR4wHAYDVQQLExVNRDUtUlNB
|
||||
LU5BU0EtUGlsb3QtQ0EwHhcNOTYwNDMwMjIwNTAwWhcNOTcwNDMwMjIwNTAwWjCB
|
||||
gDELMAkGA1UEBhMCVVMxNjA0BgNVBAoTLU5hdGlvbmFsIEFlcm9uYXV0aWNzIGFu
|
||||
ZCBTcGFjZSBBZG1pbmlzdHJhdGlvbjEZMBcGA1UECxMQVGVzdCBFbnZpcm9ubWVu
|
||||
dDEeMBwGA1UECxMVTUQ1LVJTQS1OQVNBLVBpbG90LUNBMFkwCgYEVQgBAQICAgAD
|
||||
SwAwSAJBALmmX5+GqAvcrWK13rfDrNX9UfeA7f+ijyBgeFQjYUoDpFqapw4nzQBL
|
||||
bAXug8pKkRwa2Zh8YODhXsRWu2F/UckCAwEAATANBgkqhkiG9w0BAQQFAANBAH9a
|
||||
OBA+QCsjxXgnSqHx04gcU8S49DVUb1f2XVoLnHlIb8RnX0k5O6mpHT5eti9bLkiW
|
||||
GJNMJ4L0AJ/ac+SmHZc=
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICajCCAdMCBDGA0QUwDQYJKoZIhvcNAQEEBQAwfTELMAkGA1UEBhMCQ2ExDzAN
|
||||
BgNVBAcTBk5lcGVhbjEeMBwGA1UECxMVTm8gTGlhYmlsaXR5IEFjY2VwdGVkMR8w
|
||||
HQYDVQQKExZGb3IgRGVtbyBQdXJwb3NlcyBPbmx5MRwwGgYDVQQDExNFbnRydXN0
|
||||
IERlbW8gV2ViIENBMB4XDTk2MDQyNjEzMzUwMVoXDTA2MDQyNjEzMzUwMVowfTEL
|
||||
MAkGA1UEBhMCQ2ExDzANBgNVBAcTBk5lcGVhbjEeMBwGA1UECxMVTm8gTGlhYmls
|
||||
aXR5IEFjY2VwdGVkMR8wHQYDVQQKExZGb3IgRGVtbyBQdXJwb3NlcyBPbmx5MRww
|
||||
GgYDVQQDExNFbnRydXN0IERlbW8gV2ViIENBMIGdMA0GCSqGSIb3DQEBAQUAA4GL
|
||||
ADCBhwKBgQCaroS7O1DA0hm4IefNYU1cx/nqOmzEnk291d1XqznDeF4wEgakbkCc
|
||||
zTKxK791yNpXG5RmngqH7cygDRTHZJ6mfCRn0wGC+AI00F2vYTGqPGRQL1N3lZT0
|
||||
YDKFC0SQeMMjFIZ1aeQigroFQnHo0VB3zWIMpNkka8PY9lxHZAmWwQIBAzANBgkq
|
||||
hkiG9w0BAQQFAAOBgQBAx0UMVA1s54lMQyXjMX5kj99FJN5itb8bK1Rk+cegPQPF
|
||||
cWO9SEWyEjjBjIkjjzAwBkaEszFsNGxemxtXvwjIm1xEUMTVlPEWTs2qnDvAUA9W
|
||||
YqhWbhH0toGT36236QAsqCZ76rbTRVSSX2BHyJwJMG2tCRv7kRJ//NIgxj3H4w==
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
issuer= /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test PCA (1024 bit)
|
||||
subject=/C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test PCA (1024 bit)
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICJzCCAZACAQAwDQYJKoZIhvcNAQEEBQAwXDELMAkGA1UEBhMCQVUxEzARBgNV
|
||||
BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYD
|
||||
VQQDExNUZXN0IFBDQSAoMTAyNCBiaXQpMB4XDTk3MDYwOTEzNTczN1oXDTAxMDYw
|
||||
OTEzNTczN1owXDELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY
|
||||
BgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYDVQQDExNUZXN0IFBDQSAoMTAy
|
||||
NCBiaXQpMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCdoWk/3+WcMlfjIrkg
|
||||
40ketmnQaEogQe1LLcuOJV6rKfUSAsPgwgsabJ/wn8TxA1yy3eKJbFl3OiUXMRsp
|
||||
22Jp85PmemiDzyUIStwk72qhp1imbANZvlmlCFKiQrjUyuDfu4TABmn+kkt3vR1Y
|
||||
BEOGt+IFye1UBVSATVdRJ2UVhwIDAQABMA0GCSqGSIb3DQEBBAUAA4GBABNA1u/S
|
||||
Cg/LJZWb7GliiKJsvuhxlE4E5JxQF2zMub/CSNbF97//tYSyj96sxeFQxZXbcjm9
|
||||
xt6mr/xNLA4szNQMJ4P+L7b5e/jC5DSqlwS+CUYJgaFs/SP+qJoCSu1bR3IM9XWO
|
||||
cRBpDmcBbYLkSyB92WURvsZ1LtjEcn+cdQVI
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXAIBAAKBgQCdoWk/3+WcMlfjIrkg40ketmnQaEogQe1LLcuOJV6rKfUSAsPg
|
||||
wgsabJ/wn8TxA1yy3eKJbFl3OiUXMRsp22Jp85PmemiDzyUIStwk72qhp1imbANZ
|
||||
vlmlCFKiQrjUyuDfu4TABmn+kkt3vR1YBEOGt+IFye1UBVSATVdRJ2UVhwIDAQAB
|
||||
AoGAba4fTtuap5l7/8ZsbE7Z1O32KJY4ZcOZukLOLUUhXxXduT+FTgGWujc0/rgc
|
||||
z9qYCLlNZHOouMYTgtSfYvuMuLZ11VIt0GYH+nRioLShE59Yy+zCRyC+gPigS1kz
|
||||
xvo14AsOIPYV14Tk/SsHyq6E0eTk7VzaIE197giiINUERPECQQDSKmtPTh/lRKw7
|
||||
HSZSM0I1mFWn/1zqrAbontRQY5w98QWIOe5qmzYyFbPXYT3d9BzlsMyhgiRNoBbD
|
||||
yvohSHXJAkEAwAHx6ezAZeWWzD5yXD36nyjpkVCw7Tk7TSmOceLJMWt1QcrCfqlS
|
||||
xA5jjpQ6Z8suU5DdtWAryM2sAir1WisYzwJAd6Zcx56jvAQ3xcPXsE6scBTVFzrj
|
||||
7FqZ6E+cclPzfLQ+QQsyOBE7bpI6e/FJppY26XGZXo3YGzV8IGXrt40oOQJALETG
|
||||
h86EFXo3qGOFbmsDy4pdP5nBERCu8X1xUCSfintiD4c2DInxgS5oGclnJeMcjTvL
|
||||
QjQoJCX3UJCi/OUO1QJBAKgcDHWjMvt+l1pjJBsSEZ0HX9AAIIVx0RQmbFGS+F2Q
|
||||
hhu5l77WnnZOQ9vvhV5u7NPCUF9nhU3jh60qWWO8mkc=
|
||||
-----END RSA PRIVATE KEY-----
|
||||
subject=/C=US/O=RSA Data Security, Inc./OU=Commercial Certification Authority
|
||||
issuer= /C=US/O=RSA Data Security, Inc./OU=Commercial Certification Authority
|
||||
notBefore=941104185834Z
|
||||
notAfter =991103185834Z
|
||||
-----BEGIN X509 CERTIFICATE-----
|
||||
|
||||
MIICIzCCAZACBQJBAAAWMA0GCSqGSIb3DQEBAgUAMFwxCzAJBgNVBAYTAlVTMSAw
|
||||
HgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjErMCkGA1UECxMiQ29tbWVy
|
||||
Y2lhbCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NDExMDQxODU4MzRaFw05
|
||||
OTExMDMxODU4MzRaMFwxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdSU0EgRGF0YSBT
|
||||
ZWN1cml0eSwgSW5jLjErMCkGA1UECxMiQ29tbWVyY2lhbCBDZXJ0aWZpY2F0aW9u
|
||||
IEF1dGhvcml0eTCBmzANBgkqhkiG9w0BAQEFAAOBiQAwgYUCfgCk+4Fie84QJ93o
|
||||
975sbsZwmdu41QUDaSiCnHJ/lj+O7Kwpkj+KFPhCdr69XQO5kNTQvAayUTNfxMK/
|
||||
touPmbZiImDd298ggrTKoi8tUO2UMt7gVY3UaOLgTNLNBRYulWZcYVI4HlGogqHE
|
||||
7yXpCuaLK44xZtn42f29O2nZ6wIDAQABMA0GCSqGSIb3DQEBAgUAA34AdrW2EP4j
|
||||
9/dZYkuwX5zBaLxJu7NJbyFHXSudVMQAKD+YufKKg5tgf+tQx6sFEC097TgCwaVI
|
||||
0v5loMC86qYjFmZsGySp8+x5NRhPJsjjr1BKx6cxa9B8GJ1Qv6km+iYrRpwUqbtb
|
||||
MJhCKLVLU7tDCZJAuqiqWqTGtotXTcU=
|
||||
-----END X509 CERTIFICATE-----
|
||||
subject=/C=US/O=RSA Data Security, Inc./OU=Secure Server Certification Authority
|
||||
issuer= /C=US/O=RSA Data Security, Inc./OU=Secure Server Certification Authority
|
||||
notBefore=941109235417Z
|
||||
notAfter =991231235417Z
|
||||
-----BEGIN X509 CERTIFICATE-----
|
||||
|
||||
MIICKTCCAZYCBQJBAAABMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMSAw
|
||||
HgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjEuMCwGA1UECxMlU2VjdXJl
|
||||
IFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NDExMDkyMzU0MTda
|
||||
Fw05OTEyMzEyMzU0MTdaMF8xCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdSU0EgRGF0
|
||||
YSBTZWN1cml0eSwgSW5jLjEuMCwGA1UECxMlU2VjdXJlIFNlcnZlciBDZXJ0aWZp
|
||||
Y2F0aW9uIEF1dGhvcml0eTCBmzANBgkqhkiG9w0BAQEFAAOBiQAwgYUCfgCSznrB
|
||||
roM+WqqJg1esJQF2DK2ujiw3zus1eGRUA+WEQFHJv48I4oqCCNIWhjdV6bEhAq12
|
||||
aIGaBaJLyUslZiJWbIgHj/eBWW2EB2VwE3F2Ppt3TONQiVaYSLkdpykaEy5KEVmc
|
||||
HhXVSVQsczppgrGXOZxtcGdI5d0t1sgeewIDAQABMA0GCSqGSIb3DQEBAgUAA34A
|
||||
iNHReSHO4ovo+MF9NFM/YYPZtgs4F7boviGNjwC4i1N+RGceIr2XJ+CchcxK9oU7
|
||||
suK+ktPlDemvXA4MRpX/oRxePug2WHpzpgr4IhFrwwk4fia7c+8AvQKk8xQNMD9h
|
||||
cHsg/jKjn7P0Z1LctO6EjJY2IN6BCINxIYoPnqk=
|
||||
-----END X509 CERTIFICATE-----
|
||||
subject=/C=ZA/SP=Western Cape/L=Cape Town/O=Thawte Consulting cc
|
||||
/OU=Certification Services Division/CN=Thawte Server CA
|
||||
/Email=server-certs@thawte.com
|
||||
issuer= /C=ZA/SP=Western Cape/L=Cape Town/O=Thawte Consulting cc
|
||||
/OU=Certification Services Division/CN=Thawte Server CA
|
||||
/Email=server-certs@thawte.com
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIC+TCCAmICAQAwDQYJKoZIhvcNAQEEBQAwgcQxCzAJBgNVBAYTAlpBMRUwEwYD
|
||||
VQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU
|
||||
VGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2Vy
|
||||
dmljZXMgRGl2aXNpb24xGTAXBgNVBAMTEFRoYXd0ZSBTZXJ2ZXIgQ0ExJjAkBgkq
|
||||
hkiG9w0BCQEWF3NlcnZlci1jZXJ0c0B0aGF3dGUuY29tMB4XDTk2MDcyNzE4MDc1
|
||||
N1oXDTk4MDcyNzE4MDc1N1owgcQxCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0
|
||||
ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMUVGhhd3RlIENv
|
||||
bnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2
|
||||
aXNpb24xGTAXBgNVBAMTEFRoYXd0ZSBTZXJ2ZXIgQ0ExJjAkBgkqhkiG9w0BCQEW
|
||||
F3NlcnZlci1jZXJ0c0B0aGF3dGUuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB
|
||||
iQKBgQDTpFBuyP9Wa+bPXbbqDGh1R6KqwtqEJfyo9EdR2oW1IHSUhh4PdcnpCGH1
|
||||
Bm0wbhUZAulSwGLbTZme4moMRDjN/r7jZAlwxf6xaym2L0nIO9QnBCUQly/nkG3A
|
||||
KEKZ10xD3sP1IW1Un13DWOHA5NlbsLjctHvfNjrCtWYiEtaHDQIDAQABMA0GCSqG
|
||||
SIb3DQEBBAUAA4GBAIsvn7ifX3RUIrvYXtpI4DOfARkTogwm6o7OwVdl93yFhDcX
|
||||
7h5t0XZ11MUAMziKdde3rmTvzUYIUCYoY5b032IwGMTvdiclK+STN6NP2m5nvFAM
|
||||
qJT5gC5O+j/jBuZRQ4i0AMYQr5F4lT8oBJnhgafw6PL8aDY2vMHGSPl9+7uf
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDDTCCAnYCAQAwDQYJKoZIhvcNAQEEBQAwgc4xCzAJBgNVBAYTAlpBMRUwEwYD
|
||||
VQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU
|
||||
VGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2Vy
|
||||
dmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNlcnZlciBD
|
||||
QTEoMCYGCSqGSIb3DQEJARYZcHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNvbTAeFw05
|
||||
NjA3MjcxODA3MTRaFw05ODA3MjcxODA3MTRaMIHOMQswCQYDVQQGEwJaQTEVMBMG
|
||||
A1UECBMMV2VzdGVybiBDYXBlMRIwEAYDVQQHEwlDYXBlIFRvd24xHTAbBgNVBAoT
|
||||
FFRoYXd0ZSBDb25zdWx0aW5nIGNjMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNl
|
||||
cnZpY2VzIERpdmlzaW9uMSEwHwYDVQQDExhUaGF3dGUgUHJlbWl1bSBTZXJ2ZXIg
|
||||
Q0ExKDAmBgkqhkiG9w0BCQEWGXByZW1pdW0tc2VydmVyQHRoYXd0ZS5jb20wgZ8w
|
||||
DQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANI2NmqL18JbntqBQWKPOO5JBFXW0O8c
|
||||
G5UWR+8YSDU6UvQragaPOy/qVuOvho2eF/eetGV1Ak3vywmiIVHYm9Bn0LoNkgYU
|
||||
c9STy5cqAJxcTgy8+hVS/PJEbtoRSm4Iny8t4/mqOoZztkZTWMiJBb2DEbhzP6oH
|
||||
jfRCTedAnRw3AgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAutFIgTRZVYerIZfL9lvR
|
||||
w9Eifvvo5KTZ3h+Bj+VzNnyw4Qc/IyXkPOu6SIiH9LQ3sCmWBdxpe+qr4l77rLj2
|
||||
GYuMtESFfn1XVALzkYgC7JcPuTOjMfIiMByt+uFf8AV8x0IW/Qkuv+hEQcyM9vxK
|
||||
3VZdLbCVIhNoEsysrxCpxcI=
|
||||
-----END CERTIFICATE-----
|
||||
Tims test GCI CA
|
||||
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIB8DCCAZoCAQAwDQYJKoZIhvcNAQEEBQAwgYIxCzAJBgNVBAYTAkFVMRMwEQYD
|
||||
VQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5
|
||||
cHRTb2Z0IFB0eSBMdGQxFDASBgNVBAsTC2RldmVsb3BtZW50MRkwFwYDVQQDExBD
|
||||
cnlwdFNvZnQgRGV2IENBMB4XDTk3MDMyMjEzMzQwNFoXDTk4MDMyMjEzMzQwNFow
|
||||
gYIxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhC
|
||||
cmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxFDASBgNVBAsTC2Rl
|
||||
dmVsb3BtZW50MRkwFwYDVQQDExBDcnlwdFNvZnQgRGV2IENBMFwwDQYJKoZIhvcN
|
||||
AQEBBQADSwAwSAJBAOAOAqogG5QwAmLhzyO4CoRnx/wVy4NZP4dxJy83O1EnL0rw
|
||||
OdsamJKvPOLHgSXo3gDu9uVyvCf/QJmZAmC5ml8CAwEAATANBgkqhkiG9w0BAQQF
|
||||
AANBADRRS/GVdd7rAqRW6SdmgLJduOU2yq3avBu99kRqbp9A/dLu6r6jU+eP4oOA
|
||||
TfdbFZtAAD2Hx9jUtY3tfdrJOb8=
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICVjCCAgACAQAwDQYJKoZIhvcNAQEEBQAwgbUxCzAJBgNVBAYTAkFVMRMwEQYD
|
||||
VQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5
|
||||
cHRTb2Z0IFB0eSBMdGQxLDAqBgNVBAsTI1dPUlRITEVTUyBDRVJUSUZJQ0FUSU9O
|
||||
IEFVVEhPUklUSUVTMTQwMgYDVQQDEytaRVJPIFZBTFVFIENBIC0gREVNT05TVFJB
|
||||
VElPTiBQVVJQT1NFUyBPTkxZMB4XDTk3MDQwMzEzMjI1NFoXDTk4MDQwMzEzMjI1
|
||||
NFowgbUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQH
|
||||
EwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxLDAqBgNVBAsT
|
||||
I1dPUlRITEVTUyBDRVJUSUZJQ0FUSU9OIEFVVEhPUklUSUVTMTQwMgYDVQQDEyta
|
||||
RVJPIFZBTFVFIENBIC0gREVNT05TVFJBVElPTiBQVVJQT1NFUyBPTkxZMFwwDQYJ
|
||||
KoZIhvcNAQEBBQADSwAwSAJBAOZ7T7yqP/tyspcko3yPY1y0Cm2EmwNvzW4QgVXR
|
||||
Fjs3HmJ4xtSpXdo6mwcGezL3Abt/aQXaxv9PU8xt+Jr0OFUCAwEAATANBgkqhkiG
|
||||
9w0BAQQFAANBAOQpYmGgyCqCy1OljgJhCqQOu627oVlHzK1L+t9vBaMfn40AVUR4
|
||||
WzQVWO31KTgi5vTK1U+3h46fgUWqQ0h+6rU=
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIAwgKADAgECAgEAMA0GCSqGSIb3DQEBBAUAMGIxETAPBgNVBAcTCEludGVybmV0
|
||||
MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE0MDIGA1UECxMrVmVyaVNpZ24gQ2xh
|
||||
c3MgMSBDQSAtIEluZGl2aWR1YWwgU3Vic2NyaWJlcjAeFw05NjA0MDgxMDIwMjda
|
||||
Fw05NzA0MDgxMDIwMjdaMGIxETAPBgNVBAcTCEludGVybmV0MRcwFQYDVQQKEw5W
|
||||
ZXJpU2lnbiwgSW5jLjE0MDIGA1UECxMrVmVyaVNpZ24gQ2xhc3MgMSBDQSAtIElu
|
||||
ZGl2aWR1YWwgU3Vic2NyaWJlcjCAMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2
|
||||
FKbPTdAFDdjKI9BvqrQpkmOOLPhvltcunXZLEbE2jVfJw/0cxrr+Hgi6M8qV6r7j
|
||||
W80GqLd5HUQq7XPysVKDaBBwZJHXPmv5912dFEObbpdFmIFH0S3L3bty10w/cari
|
||||
QPJUObwW7s987LrbP2wqsxaxhhKdrpM01bjV0Pc+qQIDAQABAAAAADANBgkqhkiG
|
||||
9w0BAQQFAAOBgQA+1nJryNt8VBRjRr07ArDAV/3jAH7GjDc9jsrxZS68ost9v06C
|
||||
TvTNKGL+LISNmFLXl+JXhgGB0JZ9fvyYzNgHQ46HBUng1H6voalfJgS2KdEo50wW
|
||||
8EFZYMDkT1k4uynwJqkVN2QJK/2q4/A/VCov5h6SlM8Affg2W+1TLqvqkwAA
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
subject=/L=Internet/O=VeriSign, Inc./OU=VeriSign Class 2 CA - Individual Subscriber
|
||||
issuer= /L=Internet/O=VeriSign, Inc./OU=VeriSign Class 2 CA - Individual Subscriber
|
||||
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEkzCCA/ygAwIBAgIRANDTUpSRL3nTFeMrMayFSPAwDQYJKoZIhvcNAQECBQAw
|
||||
YjERMA8GA1UEBxMISW50ZXJuZXQxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTQw
|
||||
MgYDVQQLEytWZXJpU2lnbiBDbGFzcyAyIENBIC0gSW5kaXZpZHVhbCBTdWJzY3Jp
|
||||
YmVyMB4XDTk2MDYwNDAwMDAwMFoXDTk4MDYwNDIzNTk1OVowYjERMA8GA1UEBxMI
|
||||
SW50ZXJuZXQxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTQwMgYDVQQLEytWZXJp
|
||||
U2lnbiBDbGFzcyAyIENBIC0gSW5kaXZpZHVhbCBTdWJzY3JpYmVyMIGfMA0GCSqG
|
||||
SIb3DQEBAQUAA4GNADCBiQKBgQC6A+2czKGRcYMfm8gdnk+0de99TDDzsqo0v5nb
|
||||
RsbUmMcdRQ7nsMbRWe0SAb/9QoLTZ/cJ0iOBqdrkz7UpqqKarVoTSdlSMVM92tWp
|
||||
3bJncZHQD1t4xd6lQVdI1/T6R+5J0T1ukOdsI9Jmf+F28S6g3R3L1SFwiHKeZKZv
|
||||
z+793wIDAQABo4ICRzCCAkMwggIpBgNVHQMBAf8EggIdMIICGTCCAhUwggIRBgtg
|
||||
hkgBhvhFAQcBATCCAgAWggGrVGhpcyBjZXJ0aWZpY2F0ZSBpbmNvcnBvcmF0ZXMg
|
||||
YnkgcmVmZXJlbmNlLCBhbmQgaXRzIHVzZSBpcyBzdHJpY3RseSBzdWJqZWN0IHRv
|
||||
LCB0aGUgVmVyaVNpZ24gQ2VydGlmaWNhdGlvbiBQcmFjdGljZSBTdGF0ZW1lbnQg
|
||||
KENQUyksIGF2YWlsYWJsZSBhdDogaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL0NQ
|
||||
Uy0xLjA7IGJ5IEUtbWFpbCBhdCBDUFMtcmVxdWVzdHNAdmVyaXNpZ24uY29tOyBv
|
||||
ciBieSBtYWlsIGF0IFZlcmlTaWduLCBJbmMuLCAyNTkzIENvYXN0IEF2ZS4sIE1v
|
||||
dW50YWluIFZpZXcsIENBIDk0MDQzIFVTQSBUZWwuICsxICg0MTUpIDk2MS04ODMw
|
||||
IENvcHlyaWdodCAoYykgMTk5NiBWZXJpU2lnbiwgSW5jLiAgQWxsIFJpZ2h0cyBS
|
||||
ZXNlcnZlZC4gQ0VSVEFJTiBXQVJSQU5USUVTIERJU0NMQUlNRUQgYW5kIExJQUJJ
|
||||
TElUWSBMSU1JVEVELqAOBgxghkgBhvhFAQcBAQGhDgYMYIZIAYb4RQEHAQECMC8w
|
||||
LRYraHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JlcG9zaXRvcnkvQ1BTLTEuMDAU
|
||||
BglghkgBhvhCAQEBAf8EBAMCAgQwDQYJKoZIhvcNAQECBQADgYEApRJRkNBqLLgs
|
||||
53IR/d18ODdLOWMTZ+QOOxBrq460iBEdUwgF8vmPRX1ku7UiDeNzaLlurE6eFqHq
|
||||
2zPyK5j60zfTLVJMWKcQWwTJLjHtXrW8pxhNtFc6Fdvy5ZkHnC/9NIl7/t4U6WqB
|
||||
p4y+p7SdMIkEwIZfds0VbnQyX5MRUJY=
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
subject=/C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority
|
||||
issuer= /C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICMTCCAZoCBQKhAAABMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMRcw
|
||||
FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgMyBQdWJsaWMg
|
||||
UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NjAxMjkwMDAwMDBa
|
||||
Fw05OTEyMzEyMzU5NTlaMF8xCzAJBgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2ln
|
||||
biwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgMyBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZp
|
||||
Y2F0aW9uIEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAyVxZ
|
||||
nvIbigEUtBDfBEDb41evakVAj4QMC9Ez2dkRz+4CWB8l9yqoRAWq7AMfeH+ek7ma
|
||||
AKojfdashaJjRcdyJ8z0TMZ1cdI5709C8HXfCpDGjiBvmA/4rCNfcCk2pMmG57Ga
|
||||
IMtTpYXnPb59mv4kRTPcdhXtD6JxZExlLoFoRacCAwEAATANBgkqhkiG9w0BAQIF
|
||||
AAOBgQB1Zmw+0c2B27X4LzZRtvdCvM1Cr9wO+hVs+GeTVzrrtpLotgHKjLeOQ7RJ
|
||||
Zfk+7r11Ri7J/CVdqMcvi5uPaM+0nJcYwE3vH9mvgrPmZLiEXIqaB1JDYft0nls6
|
||||
NvxMsvwaPxUupVs8G5DsiCnkWRb5zget7Ond2tIxik/W2O8XjQ==
|
||||
-----END CERTIFICATE-----
|
||||
subject=/C=US/O=VeriSign, Inc./OU=Class 4 Public Primary Certification Authority
|
||||
issuer= /C=US/O=VeriSign, Inc./OU=Class 4 Public Primary Certification Authority
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICMTCCAZoCBQKmAAABMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMRcw
|
||||
FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgNCBQdWJsaWMg
|
||||
UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NjAxMjkwMDAwMDBa
|
||||
Fw05OTEyMzEyMzU5NTlaMF8xCzAJBgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2ln
|
||||
biwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgNCBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZp
|
||||
Y2F0aW9uIEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0LJ1
|
||||
9njQrlpQ9OlQqZ+M1++RlHDo0iSQdomF1t+s5gEXMoDwnZNHvJplnR+Xrr/phnVj
|
||||
IIm9gFidBAydqMEk6QvlMXi9/C0MN2qeeIDpRnX57aP7E3vIwUzSo+/1PLBij0pd
|
||||
O92VZ48TucE81qcmm+zDO3rZTbxtm+gVAePwR6kCAwEAATANBgkqhkiG9w0BAQIF
|
||||
AAOBgQBT3dPwnCR+QKri/AAa19oM/DJhuBUNlvP6Vxt/M3yv6ZiaYch6s7f/sdyZ
|
||||
g9ysEvxwyR84Qu1E9oAuW2szaayc01znX1oYx7EteQSWQZGZQbE8DbqEOcY7l/Am
|
||||
yY7uvcxClf8exwI/VAx49byqYHwCaejcrOICdmHEPgPq0ook0Q==
|
||||
-----END CERTIFICATE-----
|
||||
|
@ -90,6 +90,7 @@ int MAIN(int, char **);
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
SSL_SESSION *x=NULL;
|
||||
X509 *peer = NULL;
|
||||
int ret=1,i,num,badops=0;
|
||||
BIO *out=NULL;
|
||||
int informat,outformat;
|
||||
@ -163,16 +164,17 @@ int MAIN(int argc, char **argv)
|
||||
ERR_load_crypto_strings();
|
||||
x=load_sess_id(infile,informat);
|
||||
if (x == NULL) { goto end; }
|
||||
peer = SSL_SESSION_get0_peer(x);
|
||||
|
||||
if(context)
|
||||
{
|
||||
x->sid_ctx_length=strlen(context);
|
||||
if(x->sid_ctx_length > SSL_MAX_SID_CTX_LENGTH)
|
||||
size_t ctx_len = strlen(context);
|
||||
if(ctx_len > SSL_MAX_SID_CTX_LENGTH)
|
||||
{
|
||||
BIO_printf(bio_err,"Context too long\n");
|
||||
goto end;
|
||||
}
|
||||
memcpy(x->sid_ctx,context,x->sid_ctx_length);
|
||||
SSL_SESSION_set1_id_context(x, (unsigned char *)context, ctx_len);
|
||||
}
|
||||
|
||||
#ifdef undef
|
||||
@ -231,10 +233,10 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
if (cert)
|
||||
{
|
||||
if (x->peer == NULL)
|
||||
if (peer == NULL)
|
||||
BIO_puts(out,"No certificate present\n");
|
||||
else
|
||||
X509_print(out,x->peer);
|
||||
X509_print(out,peer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -253,12 +255,12 @@ int MAIN(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else if (!noout && (x->peer != NULL)) /* just print the certificate */
|
||||
else if (!noout && (peer != NULL)) /* just print the certificate */
|
||||
{
|
||||
if (outformat == FORMAT_ASN1)
|
||||
i=(int)i2d_X509_bio(out,x->peer);
|
||||
i=(int)i2d_X509_bio(out,peer);
|
||||
else if (outformat == FORMAT_PEM)
|
||||
i=PEM_write_bio_X509(out,x->peer);
|
||||
i=PEM_write_bio_X509(out,peer);
|
||||
else {
|
||||
BIO_printf(bio_err,"bad output format specified for outfile\n");
|
||||
goto end;
|
||||
|
@ -73,11 +73,14 @@ static int save_certs(char *signerfile, STACK_OF(X509) *signers);
|
||||
static int smime_cb(int ok, X509_STORE_CTX *ctx);
|
||||
|
||||
#define SMIME_OP 0x10
|
||||
#define SMIME_IP 0x20
|
||||
#define SMIME_SIGNERS 0x40
|
||||
#define SMIME_ENCRYPT (1 | SMIME_OP)
|
||||
#define SMIME_DECRYPT 2
|
||||
#define SMIME_SIGN (3 | SMIME_OP)
|
||||
#define SMIME_VERIFY 4
|
||||
#define SMIME_PK7OUT 5
|
||||
#define SMIME_DECRYPT (2 | SMIME_IP)
|
||||
#define SMIME_SIGN (3 | SMIME_OP | SMIME_SIGNERS)
|
||||
#define SMIME_VERIFY (4 | SMIME_IP)
|
||||
#define SMIME_PK7OUT (5 | SMIME_IP | SMIME_OP)
|
||||
#define SMIME_RESIGN (6 | SMIME_IP | SMIME_OP | SMIME_SIGNERS)
|
||||
|
||||
int MAIN(int, char **);
|
||||
|
||||
@ -90,6 +93,7 @@ int MAIN(int argc, char **argv)
|
||||
const char *inmode = "r", *outmode = "w";
|
||||
char *infile = NULL, *outfile = NULL;
|
||||
char *signerfile = NULL, *recipfile = NULL;
|
||||
STACK_OF(OPENSSL_STRING) *sksigners = NULL, *skkeys = NULL;
|
||||
char *certfile = NULL, *keyfile = NULL, *contfile=NULL;
|
||||
const EVP_CIPHER *cipher = NULL;
|
||||
PKCS7 *p7 = NULL;
|
||||
@ -105,6 +109,8 @@ int MAIN(int argc, char **argv)
|
||||
char *passargin = NULL, *passin = NULL;
|
||||
char *inrand = NULL;
|
||||
int need_rand = 0;
|
||||
int indef = 0;
|
||||
const EVP_MD *sign_md = NULL;
|
||||
int informat = FORMAT_SMIME, outformat = FORMAT_SMIME;
|
||||
int keyform = FORMAT_PEM;
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
@ -135,6 +141,8 @@ int MAIN(int argc, char **argv)
|
||||
operation = SMIME_DECRYPT;
|
||||
else if (!strcmp (*args, "-sign"))
|
||||
operation = SMIME_SIGN;
|
||||
else if (!strcmp (*args, "-resign"))
|
||||
operation = SMIME_RESIGN;
|
||||
else if (!strcmp (*args, "-verify"))
|
||||
operation = SMIME_VERIFY;
|
||||
else if (!strcmp (*args, "-pk7out"))
|
||||
@ -193,205 +201,209 @@ int MAIN(int argc, char **argv)
|
||||
flags |= PKCS7_BINARY;
|
||||
else if (!strcmp (*args, "-nosigs"))
|
||||
flags |= PKCS7_NOSIGS;
|
||||
else if (!strcmp (*args, "-stream"))
|
||||
indef = 1;
|
||||
else if (!strcmp (*args, "-indef"))
|
||||
indef = 1;
|
||||
else if (!strcmp (*args, "-noindef"))
|
||||
indef = 0;
|
||||
else if (!strcmp (*args, "-nooldmime"))
|
||||
flags |= PKCS7_NOOLDMIMETYPE;
|
||||
else if (!strcmp (*args, "-crlfeol"))
|
||||
flags |= PKCS7_CRLFEOL;
|
||||
else if (!strcmp(*args,"-rand"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
inrand = *args;
|
||||
}
|
||||
else
|
||||
badarg = 1;
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
args++;
|
||||
inrand = *args;
|
||||
need_rand = 1;
|
||||
}
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
else if (!strcmp(*args,"-engine"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
engine = *args;
|
||||
}
|
||||
else badarg = 1;
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
engine = *++args;
|
||||
}
|
||||
#endif
|
||||
else if (!strcmp(*args,"-passin"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
passargin = *args;
|
||||
}
|
||||
else
|
||||
badarg = 1;
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
passargin = *++args;
|
||||
}
|
||||
else if (!strcmp (*args, "-to"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
to = *args;
|
||||
}
|
||||
else
|
||||
badarg = 1;
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
to = *++args;
|
||||
}
|
||||
else if (!strcmp (*args, "-from"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
from = *args;
|
||||
}
|
||||
else badarg = 1;
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
from = *++args;
|
||||
}
|
||||
else if (!strcmp (*args, "-subject"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
subject = *args;
|
||||
}
|
||||
else
|
||||
badarg = 1;
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
subject = *++args;
|
||||
}
|
||||
else if (!strcmp (*args, "-signer"))
|
||||
{
|
||||
if (args[1])
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
/* If previous -signer argument add signer to list */
|
||||
|
||||
if (signerfile)
|
||||
{
|
||||
args++;
|
||||
signerfile = *args;
|
||||
if (!sksigners)
|
||||
sksigners = sk_OPENSSL_STRING_new_null();
|
||||
sk_OPENSSL_STRING_push(sksigners, signerfile);
|
||||
if (!keyfile)
|
||||
keyfile = signerfile;
|
||||
if (!skkeys)
|
||||
skkeys = sk_OPENSSL_STRING_new_null();
|
||||
sk_OPENSSL_STRING_push(skkeys, keyfile);
|
||||
keyfile = NULL;
|
||||
}
|
||||
else
|
||||
badarg = 1;
|
||||
signerfile = *++args;
|
||||
}
|
||||
else if (!strcmp (*args, "-recip"))
|
||||
{
|
||||
if (args[1])
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
recipfile = *++args;
|
||||
}
|
||||
else if (!strcmp (*args, "-md"))
|
||||
{
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
sign_md = EVP_get_digestbyname(*++args);
|
||||
if (sign_md == NULL)
|
||||
{
|
||||
args++;
|
||||
recipfile = *args;
|
||||
BIO_printf(bio_err, "Unknown digest %s\n",
|
||||
*args);
|
||||
goto argerr;
|
||||
}
|
||||
else badarg = 1;
|
||||
}
|
||||
else if (!strcmp (*args, "-inkey"))
|
||||
{
|
||||
if (args[1])
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
/* If previous -inkey arument add signer to list */
|
||||
if (keyfile)
|
||||
{
|
||||
args++;
|
||||
keyfile = *args;
|
||||
if (!signerfile)
|
||||
{
|
||||
BIO_puts(bio_err, "Illegal -inkey without -signer\n");
|
||||
goto argerr;
|
||||
}
|
||||
if (!sksigners)
|
||||
sksigners = sk_OPENSSL_STRING_new_null();
|
||||
sk_OPENSSL_STRING_push(sksigners, signerfile);
|
||||
signerfile = NULL;
|
||||
if (!skkeys)
|
||||
skkeys = sk_OPENSSL_STRING_new_null();
|
||||
sk_OPENSSL_STRING_push(skkeys, keyfile);
|
||||
}
|
||||
else
|
||||
badarg = 1;
|
||||
}
|
||||
keyfile = *++args;
|
||||
}
|
||||
else if (!strcmp (*args, "-keyform"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
keyform = str2fmt(*args);
|
||||
}
|
||||
else
|
||||
badarg = 1;
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
keyform = str2fmt(*++args);
|
||||
}
|
||||
else if (!strcmp (*args, "-certfile"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
certfile = *args;
|
||||
}
|
||||
else
|
||||
badarg = 1;
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
certfile = *++args;
|
||||
}
|
||||
else if (!strcmp (*args, "-CAfile"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
CAfile = *args;
|
||||
}
|
||||
else
|
||||
badarg = 1;
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
CAfile = *++args;
|
||||
}
|
||||
else if (!strcmp (*args, "-CApath"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
CApath = *args;
|
||||
}
|
||||
else
|
||||
badarg = 1;
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
CApath = *++args;
|
||||
}
|
||||
else if (!strcmp (*args, "-in"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
infile = *args;
|
||||
}
|
||||
else
|
||||
badarg = 1;
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
infile = *++args;
|
||||
}
|
||||
else if (!strcmp (*args, "-inform"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
informat = str2fmt(*args);
|
||||
}
|
||||
else
|
||||
badarg = 1;
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
informat = str2fmt(*++args);
|
||||
}
|
||||
else if (!strcmp (*args, "-outform"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
outformat = str2fmt(*args);
|
||||
}
|
||||
else
|
||||
badarg = 1;
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
outformat = str2fmt(*++args);
|
||||
}
|
||||
else if (!strcmp (*args, "-out"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
outfile = *args;
|
||||
}
|
||||
else
|
||||
badarg = 1;
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
outfile = *++args;
|
||||
}
|
||||
else if (!strcmp (*args, "-content"))
|
||||
{
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
contfile = *args;
|
||||
}
|
||||
else
|
||||
badarg = 1;
|
||||
if (!args[1])
|
||||
goto argerr;
|
||||
contfile = *++args;
|
||||
}
|
||||
else if (args_verify(&args, NULL, &badarg, bio_err, &vpm))
|
||||
continue;
|
||||
else
|
||||
else if ((cipher = EVP_get_cipherbyname(*args + 1)) == NULL)
|
||||
badarg = 1;
|
||||
args++;
|
||||
}
|
||||
|
||||
|
||||
if (operation == SMIME_SIGN)
|
||||
if (!(operation & SMIME_SIGNERS) && (skkeys || sksigners))
|
||||
{
|
||||
if (!signerfile)
|
||||
BIO_puts(bio_err, "Multiple signers or keys not allowed\n");
|
||||
goto argerr;
|
||||
}
|
||||
|
||||
if (operation & SMIME_SIGNERS)
|
||||
{
|
||||
/* Check to see if any final signer needs to be appended */
|
||||
if (keyfile && !signerfile)
|
||||
{
|
||||
BIO_puts(bio_err, "Illegal -inkey without -signer\n");
|
||||
goto argerr;
|
||||
}
|
||||
if (signerfile)
|
||||
{
|
||||
if (!sksigners)
|
||||
sksigners = sk_OPENSSL_STRING_new_null();
|
||||
sk_OPENSSL_STRING_push(sksigners, signerfile);
|
||||
if (!skkeys)
|
||||
skkeys = sk_OPENSSL_STRING_new_null();
|
||||
if (!keyfile)
|
||||
keyfile = signerfile;
|
||||
sk_OPENSSL_STRING_push(skkeys, keyfile);
|
||||
}
|
||||
if (!sksigners)
|
||||
{
|
||||
BIO_printf(bio_err, "No signer certificate specified\n");
|
||||
badarg = 1;
|
||||
}
|
||||
signerfile = NULL;
|
||||
keyfile = NULL;
|
||||
need_rand = 1;
|
||||
}
|
||||
else if (operation == SMIME_DECRYPT)
|
||||
@ -416,6 +428,7 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
if (badarg)
|
||||
{
|
||||
argerr:
|
||||
BIO_printf (bio_err, "Usage smime [options] cert.pem ...\n");
|
||||
BIO_printf (bio_err, "where options are\n");
|
||||
BIO_printf (bio_err, "-encrypt encrypt message\n");
|
||||
@ -499,13 +512,11 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
ret = 2;
|
||||
|
||||
if (operation != SMIME_SIGN)
|
||||
if (!(operation & SMIME_SIGNERS))
|
||||
flags &= ~PKCS7_DETACHED;
|
||||
|
||||
if (operation & SMIME_OP)
|
||||
{
|
||||
if (flags & PKCS7_BINARY)
|
||||
inmode = "rb";
|
||||
if (outformat == FORMAT_ASN1)
|
||||
outmode = "wb";
|
||||
}
|
||||
@ -513,9 +524,18 @@ int MAIN(int argc, char **argv)
|
||||
{
|
||||
if (flags & PKCS7_BINARY)
|
||||
outmode = "wb";
|
||||
}
|
||||
|
||||
if (operation & SMIME_IP)
|
||||
{
|
||||
if (informat == FORMAT_ASN1)
|
||||
inmode = "rb";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (flags & PKCS7_BINARY)
|
||||
inmode = "rb";
|
||||
}
|
||||
|
||||
if (operation == SMIME_ENCRYPT)
|
||||
{
|
||||
@ -545,26 +565,11 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (signerfile && (operation == SMIME_SIGN))
|
||||
{
|
||||
if (!(signer = load_cert(bio_err,signerfile,FORMAT_PEM, NULL,
|
||||
e, "signer certificate")))
|
||||
{
|
||||
#if 0 /* An appropri message has already been printed */
|
||||
BIO_printf(bio_err, "Can't read signer certificate file %s\n", signerfile);
|
||||
#endif
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (certfile)
|
||||
{
|
||||
if (!(other = load_certs(bio_err,certfile,FORMAT_PEM, NULL,
|
||||
e, "certificate file")))
|
||||
{
|
||||
#if 0 /* An appropriate message has already been printed */
|
||||
BIO_printf(bio_err, "Can't read certificate file %s\n", certfile);
|
||||
#endif
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
@ -575,9 +580,6 @@ int MAIN(int argc, char **argv)
|
||||
if (!(recip = load_cert(bio_err,recipfile,FORMAT_PEM,NULL,
|
||||
e, "recipient certificate file")))
|
||||
{
|
||||
#if 0 /* An appropriate message has alrady been printed */
|
||||
BIO_printf(bio_err, "Can't read recipient certificate file %s\n", recipfile);
|
||||
#endif
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
@ -615,50 +617,7 @@ int MAIN(int argc, char **argv)
|
||||
else
|
||||
in = BIO_new_fp(stdin, BIO_NOCLOSE);
|
||||
|
||||
if (outfile)
|
||||
{
|
||||
if (!(out = BIO_new_file(outfile, outmode)))
|
||||
{
|
||||
BIO_printf (bio_err,
|
||||
"Can't open output file %s\n", outfile);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
out = BIO_new_fp(stdout, BIO_NOCLOSE);
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
{
|
||||
BIO *tmpbio = BIO_new(BIO_f_linebuffer());
|
||||
out = BIO_push(tmpbio, out);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (operation == SMIME_VERIFY)
|
||||
{
|
||||
if (!(store = setup_verify(bio_err, CAfile, CApath)))
|
||||
goto end;
|
||||
X509_STORE_set_verify_cb_func(store, smime_cb);
|
||||
if (vpm)
|
||||
X509_STORE_set1_param(store, vpm);
|
||||
}
|
||||
|
||||
|
||||
ret = 3;
|
||||
|
||||
if (operation == SMIME_ENCRYPT)
|
||||
p7 = PKCS7_encrypt(encerts, in, cipher, flags);
|
||||
else if (operation == SMIME_SIGN)
|
||||
{
|
||||
/* If detached data and SMIME output enable partial
|
||||
* signing.
|
||||
*/
|
||||
if ((flags & PKCS7_DETACHED) && (outformat == FORMAT_SMIME))
|
||||
flags |= PKCS7_STREAM;
|
||||
p7 = PKCS7_sign(signer, key, other, in, flags);
|
||||
}
|
||||
else
|
||||
if (operation & SMIME_IP)
|
||||
{
|
||||
if (informat == FORMAT_SMIME)
|
||||
p7 = SMIME_read_PKCS7(in, &indata);
|
||||
@ -688,6 +647,94 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (outfile)
|
||||
{
|
||||
if (!(out = BIO_new_file(outfile, outmode)))
|
||||
{
|
||||
BIO_printf (bio_err,
|
||||
"Can't open output file %s\n", outfile);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
out = BIO_new_fp(stdout, BIO_NOCLOSE);
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
{
|
||||
BIO *tmpbio = BIO_new(BIO_f_linebuffer());
|
||||
out = BIO_push(tmpbio, out);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (operation == SMIME_VERIFY)
|
||||
{
|
||||
if (!(store = setup_verify(bio_err, CAfile, CApath)))
|
||||
goto end;
|
||||
X509_STORE_set_verify_cb(store, smime_cb);
|
||||
if (vpm)
|
||||
X509_STORE_set1_param(store, vpm);
|
||||
}
|
||||
|
||||
|
||||
ret = 3;
|
||||
|
||||
if (operation == SMIME_ENCRYPT)
|
||||
{
|
||||
if (indef)
|
||||
flags |= PKCS7_STREAM;
|
||||
p7 = PKCS7_encrypt(encerts, in, cipher, flags);
|
||||
}
|
||||
else if (operation & SMIME_SIGNERS)
|
||||
{
|
||||
int i;
|
||||
/* If detached data content we only enable streaming if
|
||||
* S/MIME output format.
|
||||
*/
|
||||
if (operation == SMIME_SIGN)
|
||||
{
|
||||
if (flags & PKCS7_DETACHED)
|
||||
{
|
||||
if (outformat == FORMAT_SMIME)
|
||||
flags |= PKCS7_STREAM;
|
||||
}
|
||||
else if (indef)
|
||||
flags |= PKCS7_STREAM;
|
||||
flags |= PKCS7_PARTIAL;
|
||||
p7 = PKCS7_sign(NULL, NULL, other, in, flags);
|
||||
if (!p7)
|
||||
goto end;
|
||||
}
|
||||
else
|
||||
flags |= PKCS7_REUSE_DIGEST;
|
||||
for (i = 0; i < sk_OPENSSL_STRING_num(sksigners); i++)
|
||||
{
|
||||
signerfile = sk_OPENSSL_STRING_value(sksigners, i);
|
||||
keyfile = sk_OPENSSL_STRING_value(skkeys, i);
|
||||
signer = load_cert(bio_err, signerfile,FORMAT_PEM, NULL,
|
||||
e, "signer certificate");
|
||||
if (!signer)
|
||||
goto end;
|
||||
key = load_key(bio_err, keyfile, keyform, 0, passin, e,
|
||||
"signing key file");
|
||||
if (!key)
|
||||
goto end;
|
||||
if (!PKCS7_sign_add_signer(p7, signer, key,
|
||||
sign_md, flags))
|
||||
goto end;
|
||||
X509_free(signer);
|
||||
signer = NULL;
|
||||
EVP_PKEY_free(key);
|
||||
key = NULL;
|
||||
}
|
||||
/* If not streaming or resigning finalize structure */
|
||||
if ((operation == SMIME_SIGN) && !(flags & PKCS7_STREAM))
|
||||
{
|
||||
if (!PKCS7_final(p7, in, flags))
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (!p7)
|
||||
{
|
||||
BIO_printf(bio_err, "Error creating PKCS#7 structure\n");
|
||||
@ -734,11 +781,16 @@ int MAIN(int argc, char **argv)
|
||||
if (subject)
|
||||
BIO_printf(out, "Subject: %s\n", subject);
|
||||
if (outformat == FORMAT_SMIME)
|
||||
SMIME_write_PKCS7(out, p7, in, flags);
|
||||
{
|
||||
if (operation == SMIME_RESIGN)
|
||||
SMIME_write_PKCS7(out, p7, indata, flags);
|
||||
else
|
||||
SMIME_write_PKCS7(out, p7, in, flags);
|
||||
}
|
||||
else if (outformat == FORMAT_PEM)
|
||||
PEM_write_bio_PKCS7(out,p7);
|
||||
PEM_write_bio_PKCS7_stream(out, p7, in, flags);
|
||||
else if (outformat == FORMAT_ASN1)
|
||||
i2d_PKCS7_bio(out,p7);
|
||||
i2d_PKCS7_bio_stream(out,p7, in, flags);
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_err, "Bad output format for PKCS#7 file\n");
|
||||
@ -754,6 +806,10 @@ int MAIN(int argc, char **argv)
|
||||
sk_X509_pop_free(other, X509_free);
|
||||
if (vpm)
|
||||
X509_VERIFY_PARAM_free(vpm);
|
||||
if (sksigners)
|
||||
sk_OPENSSL_STRING_free(sksigners);
|
||||
if (skkeys)
|
||||
sk_OPENSSL_STRING_free(skkeys);
|
||||
X509_STORE_free(store);
|
||||
X509_free(cert);
|
||||
X509_free(recip);
|
||||
|
@ -108,53 +108,14 @@
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(OPENSSL_SYS_MACOSX)
|
||||
# define USE_TOD
|
||||
#elif !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VXWORKS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC))
|
||||
# define TIMES
|
||||
#endif
|
||||
#if !defined(_UNICOS) && !defined(__OpenBSD__) && !defined(sgi) && !defined(__FreeBSD__) && !(defined(__bsdi) || defined(__bsdi__)) && !defined(_AIX) && !defined(OPENSSL_SYS_MPE) && !defined(__NetBSD__) && !defined(OPENSSL_SYS_VXWORKS) /* FIXME */
|
||||
# define TIMEB
|
||||
#endif
|
||||
|
||||
#if defined(OPENSSL_SYS_NETWARE)
|
||||
#undef TIMES
|
||||
#undef TIMEB
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#ifndef _IRIX
|
||||
# include <time.h>
|
||||
#endif
|
||||
#ifdef TIMES
|
||||
# include <sys/types.h>
|
||||
# include <sys/times.h>
|
||||
#endif
|
||||
#ifdef USE_TOD
|
||||
# include <sys/time.h>
|
||||
# include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
/* Depending on the VMS version, the tms structure is perhaps defined.
|
||||
The __TMS macro will show if it was. If it wasn't defined, we should
|
||||
undefine TIMES, since that tells the rest of the program how things
|
||||
should be handled. -- Richard Levitte */
|
||||
#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
|
||||
#undef TIMES
|
||||
#endif
|
||||
|
||||
#ifdef TIMEB
|
||||
#include <sys/timeb.h>
|
||||
#endif
|
||||
|
||||
#if !defined(TIMES) && !defined(TIMEB) && !defined(USE_TOD) && !defined(OPENSSL_SYS_VXWORKS) && !defined(OPENSSL_SYS_NETWARE)
|
||||
#error "It seems neither struct tms nor struct timeb is supported in this platform!"
|
||||
#endif
|
||||
|
||||
#if defined(sun) || defined(__ultrix)
|
||||
#define _POSIX_SOURCE
|
||||
#include <limits.h>
|
||||
#include <sys/param.h>
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
#include <windows.h>
|
||||
# if defined(__CYGWIN__) && !defined(_WIN32)
|
||||
/* <windows.h> should define _WIN32, which normally is mutually
|
||||
* exclusive with __CYGWIN__, but if it didn't... */
|
||||
# define _WIN32
|
||||
/* this is done because Cygwin alarm() fails sometimes. */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <openssl/bn.h>
|
||||
@ -189,6 +150,9 @@
|
||||
#ifndef OPENSSL_NO_RIPEMD
|
||||
#include <openssl/ripemd.h>
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_WHIRLPOOL
|
||||
#include <openssl/whrlpool.h>
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC4
|
||||
#include <openssl/rc4.h>
|
||||
#endif
|
||||
@ -225,33 +189,24 @@
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
#include <openssl/ecdh.h>
|
||||
#endif
|
||||
#include <openssl/modes.h>
|
||||
|
||||
/*
|
||||
* The following "HZ" timing stuff should be sync'd up with the code in
|
||||
* crypto/tmdiff.[ch]. That appears to try to do the same job, though I think
|
||||
* this code is more up to date than libcrypto's so there may be features to
|
||||
* migrate over first. This is used in two places further down AFAICS.
|
||||
* The point is that nothing in openssl actually *uses* that tmdiff stuff, so
|
||||
* either speed.c should be using it or it should go because it's obviously not
|
||||
* useful enough. Anyone want to do a janitorial job on this?
|
||||
*/
|
||||
|
||||
/* The following if from times(3) man page. It may need to be changed */
|
||||
#ifndef HZ
|
||||
# if defined(_SC_CLK_TCK) \
|
||||
&& (!defined(OPENSSL_SYS_VMS) || __CTRL_VER >= 70000000)
|
||||
# define HZ sysconf(_SC_CLK_TCK)
|
||||
# else
|
||||
# ifndef CLK_TCK
|
||||
# ifndef _BSD_CLK_TCK_ /* FreeBSD hack */
|
||||
# define HZ 100.0
|
||||
# else /* _BSD_CLK_TCK_ */
|
||||
# define HZ ((double)_BSD_CLK_TCK_)
|
||||
# endif
|
||||
# else /* CLK_TCK */
|
||||
# define HZ ((double)CLK_TCK)
|
||||
# endif
|
||||
# endif
|
||||
#ifdef OPENSSL_FIPS
|
||||
#ifdef OPENSSL_DOING_MAKEDEPEND
|
||||
#undef AES_set_encrypt_key
|
||||
#undef AES_set_decrypt_key
|
||||
#undef DES_set_key_unchecked
|
||||
#endif
|
||||
#define BF_set_key private_BF_set_key
|
||||
#define CAST_set_key private_CAST_set_key
|
||||
#define idea_set_encrypt_key private_idea_set_encrypt_key
|
||||
#define SEED_set_key private_SEED_set_key
|
||||
#define RC2_set_key private_RC2_set_key
|
||||
#define RC4_set_key private_RC4_set_key
|
||||
#define DES_set_key_unchecked private_DES_set_key_unchecked
|
||||
#define AES_set_encrypt_key private_AES_set_encrypt_key
|
||||
#define AES_set_decrypt_key private_AES_set_decrypt_key
|
||||
#define Camellia_set_key private_Camellia_set_key
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_FORK
|
||||
@ -263,16 +218,15 @@
|
||||
#endif
|
||||
|
||||
#if HAVE_FORK
|
||||
# undef NO_FORK
|
||||
#undef NO_FORK
|
||||
#else
|
||||
# define NO_FORK
|
||||
#define NO_FORK
|
||||
#endif
|
||||
|
||||
#undef BUFSIZE
|
||||
#define BUFSIZE ((long)1024*8+1)
|
||||
int run=0;
|
||||
|
||||
static char ftime_used = 0, times_used = 0, gettimeofday_used = 0, getrusage_used = 0;
|
||||
static int mr=0;
|
||||
static int usertime=1;
|
||||
|
||||
@ -285,7 +239,7 @@ static void print_result(int alg,int run_no,int count,double time_used);
|
||||
static int do_multi(int multi);
|
||||
#endif
|
||||
|
||||
#define ALGOR_NUM 28
|
||||
#define ALGOR_NUM 30
|
||||
#define SIZE_NUM 5
|
||||
#define RSA_NUM 4
|
||||
#define DSA_NUM 3
|
||||
@ -299,8 +253,8 @@ static const char *names[ALGOR_NUM]={
|
||||
"rc2 cbc","rc5-32/12 cbc","blowfish cbc","cast cbc",
|
||||
"aes-128 cbc","aes-192 cbc","aes-256 cbc",
|
||||
"camellia-128 cbc","camellia-192 cbc","camellia-256 cbc",
|
||||
"evp","sha256","sha512",
|
||||
"aes-128 ige","aes-192 ige","aes-256 ige"};
|
||||
"evp","sha256","sha512","whirlpool",
|
||||
"aes-128 ige","aes-192 ige","aes-256 ige","ghash"};
|
||||
static double results[ALGOR_NUM][SIZE_NUM];
|
||||
static int lengths[SIZE_NUM]={16,64,256,1024,8*1024};
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
@ -342,141 +296,49 @@ static SIGRETTYPE sig_done(int sig)
|
||||
#define START 0
|
||||
#define STOP 1
|
||||
|
||||
#if defined(OPENSSL_SYS_NETWARE)
|
||||
#if defined(_WIN32)
|
||||
|
||||
#if !defined(SIGALRM)
|
||||
#define SIGALRM
|
||||
#endif
|
||||
static unsigned int lapse,schlock;
|
||||
static void alarm_win32(unsigned int secs) { lapse = secs*1000; }
|
||||
#define alarm alarm_win32
|
||||
|
||||
static DWORD WINAPI sleepy(VOID *arg)
|
||||
{
|
||||
schlock = 1;
|
||||
Sleep(lapse);
|
||||
run = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* for NetWare the best we can do is use clock() which returns the
|
||||
* time, in hundredths of a second, since the NLM began executing
|
||||
*/
|
||||
static double Time_F(int s)
|
||||
{
|
||||
double ret;
|
||||
|
||||
static clock_t tstart,tend;
|
||||
|
||||
if (s == START)
|
||||
{
|
||||
tstart=clock();
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
tend=clock();
|
||||
ret=(double)((double)(tend)-(double)(tstart));
|
||||
return((ret < 0.001)?0.001:ret);
|
||||
}
|
||||
}
|
||||
if (s == START)
|
||||
{
|
||||
HANDLE thr;
|
||||
schlock = 0;
|
||||
thr = CreateThread(NULL,4096,sleepy,NULL,0,NULL);
|
||||
if (thr==NULL)
|
||||
{
|
||||
DWORD ret=GetLastError();
|
||||
BIO_printf(bio_err,"unable to CreateThread (%d)",ret);
|
||||
ExitProcess(ret);
|
||||
}
|
||||
CloseHandle(thr); /* detach the thread */
|
||||
while (!schlock) Sleep(0); /* scheduler spinlock */
|
||||
}
|
||||
|
||||
return app_tminterval(s,usertime);
|
||||
}
|
||||
#else
|
||||
|
||||
static double Time_F(int s)
|
||||
{
|
||||
double ret;
|
||||
|
||||
#ifdef USE_TOD
|
||||
if(usertime)
|
||||
{
|
||||
static struct rusage tstart,tend;
|
||||
|
||||
getrusage_used = 1;
|
||||
if (s == START)
|
||||
{
|
||||
getrusage(RUSAGE_SELF,&tstart);
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
long i;
|
||||
|
||||
getrusage(RUSAGE_SELF,&tend);
|
||||
i=(long)tend.ru_utime.tv_usec-(long)tstart.ru_utime.tv_usec;
|
||||
ret=((double)(tend.ru_utime.tv_sec-tstart.ru_utime.tv_sec))
|
||||
+((double)i)/1000000.0;
|
||||
return((ret < 0.001)?0.001:ret);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
static struct timeval tstart,tend;
|
||||
long i;
|
||||
|
||||
gettimeofday_used = 1;
|
||||
if (s == START)
|
||||
{
|
||||
gettimeofday(&tstart,NULL);
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
gettimeofday(&tend,NULL);
|
||||
i=(long)tend.tv_usec-(long)tstart.tv_usec;
|
||||
ret=((double)(tend.tv_sec-tstart.tv_sec))+((double)i)/1000000.0;
|
||||
return((ret < 0.001)?0.001:ret);
|
||||
}
|
||||
}
|
||||
#else /* ndef USE_TOD */
|
||||
|
||||
# ifdef TIMES
|
||||
if (usertime)
|
||||
{
|
||||
static struct tms tstart,tend;
|
||||
|
||||
times_used = 1;
|
||||
if (s == START)
|
||||
{
|
||||
times(&tstart);
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
times(&tend);
|
||||
ret = HZ;
|
||||
ret=(double)(tend.tms_utime-tstart.tms_utime) / ret;
|
||||
return((ret < 1e-3)?1e-3:ret);
|
||||
}
|
||||
}
|
||||
# endif /* times() */
|
||||
# if defined(TIMES) && defined(TIMEB)
|
||||
else
|
||||
# endif
|
||||
# ifdef OPENSSL_SYS_VXWORKS
|
||||
{
|
||||
static unsigned long tick_start, tick_end;
|
||||
|
||||
if( s == START )
|
||||
{
|
||||
tick_start = tickGet();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
tick_end = tickGet();
|
||||
ret = (double)(tick_end - tick_start) / (double)sysClkRateGet();
|
||||
return((ret < 0.001)?0.001:ret);
|
||||
}
|
||||
}
|
||||
# elif defined(TIMEB)
|
||||
{
|
||||
static struct timeb tstart,tend;
|
||||
long i;
|
||||
|
||||
ftime_used = 1;
|
||||
if (s == START)
|
||||
{
|
||||
ftime(&tstart);
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ftime(&tend);
|
||||
i=(long)tend.millitm-(long)tstart.millitm;
|
||||
ret=((double)(tend.time-tstart.time))+((double)i)/1000.0;
|
||||
return((ret < 0.001)?0.001:ret);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
return app_tminterval(s,usertime);
|
||||
}
|
||||
#endif /* if defined(OPENSSL_SYS_NETWARE) */
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
@ -533,6 +395,9 @@ int MAIN(int argc, char **argv)
|
||||
unsigned char sha512[SHA512_DIGEST_LENGTH];
|
||||
#endif
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_WHIRLPOOL
|
||||
unsigned char whirlpool[WHIRLPOOL_DIGEST_LENGTH];
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RIPEMD
|
||||
unsigned char rmd160[RIPEMD160_DIGEST_LENGTH];
|
||||
#endif
|
||||
@ -628,9 +493,11 @@ int MAIN(int argc, char **argv)
|
||||
#define D_EVP 22
|
||||
#define D_SHA256 23
|
||||
#define D_SHA512 24
|
||||
#define D_IGE_128_AES 25
|
||||
#define D_IGE_192_AES 26
|
||||
#define D_IGE_256_AES 27
|
||||
#define D_WHIRLPOOL 25
|
||||
#define D_IGE_128_AES 26
|
||||
#define D_IGE_192_AES 27
|
||||
#define D_IGE_256_AES 28
|
||||
#define D_GHASH 29
|
||||
double d=0.0;
|
||||
long c[ALGOR_NUM][SIZE_NUM];
|
||||
#define R_DSA_512 0
|
||||
@ -947,6 +814,10 @@ int MAIN(int argc, char **argv)
|
||||
else
|
||||
#endif
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_WHIRLPOOL
|
||||
if (strcmp(*argv,"whirlpool") == 0) doit[D_WHIRLPOOL]=1;
|
||||
else
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RIPEMD
|
||||
if (strcmp(*argv,"ripemd") == 0) doit[D_RMD160]=1;
|
||||
else
|
||||
@ -1052,6 +923,10 @@ int MAIN(int argc, char **argv)
|
||||
doit[D_CBC_192_AES]=1;
|
||||
doit[D_CBC_256_AES]=1;
|
||||
}
|
||||
else if (strcmp(*argv,"ghash") == 0)
|
||||
{
|
||||
doit[D_GHASH]=1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
@ -1158,12 +1033,16 @@ int MAIN(int argc, char **argv)
|
||||
#ifndef OPENSSL_NO_SHA512
|
||||
BIO_printf(bio_err,"sha512 ");
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_WHIRLPOOL
|
||||
BIO_printf(bio_err,"whirlpool");
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RIPEMD160
|
||||
BIO_printf(bio_err,"rmd160");
|
||||
#endif
|
||||
#if !defined(OPENSSL_NO_MD2) || !defined(OPENSSL_NO_MDC2) || \
|
||||
!defined(OPENSSL_NO_MD4) || !defined(OPENSSL_NO_MD5) || \
|
||||
!defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RIPEMD160)
|
||||
!defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RIPEMD160) || \
|
||||
!defined(OPENSSL_NO_WHIRLPOOL)
|
||||
BIO_printf(bio_err,"\n");
|
||||
#endif
|
||||
|
||||
@ -1290,17 +1169,20 @@ int MAIN(int argc, char **argv)
|
||||
rsa_doit[i]=1;
|
||||
for (i=0; i<DSA_NUM; i++)
|
||||
dsa_doit[i]=1;
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
for (i=0; i<EC_NUM; i++)
|
||||
ecdsa_doit[i]=1;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
for (i=0; i<EC_NUM; i++)
|
||||
ecdh_doit[i]=1;
|
||||
#endif
|
||||
}
|
||||
for (i=0; i<ALGOR_NUM; i++)
|
||||
if (doit[i]) pr_header++;
|
||||
|
||||
if (usertime == 0 && !mr)
|
||||
BIO_printf(bio_err,"You have chosen to measure elapsed time instead of user CPU time.\n");
|
||||
if (usertime <= 0 && !mr)
|
||||
{
|
||||
BIO_printf(bio_err,"To get the most accurate results, try to run this\n");
|
||||
BIO_printf(bio_err,"program when this computer is idle.\n");
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
for (i=0; i<RSA_NUM; i++)
|
||||
@ -1411,9 +1293,11 @@ int MAIN(int argc, char **argv)
|
||||
c[D_CBC_256_CML][0]=count;
|
||||
c[D_SHA256][0]=count;
|
||||
c[D_SHA512][0]=count;
|
||||
c[D_WHIRLPOOL][0]=count;
|
||||
c[D_IGE_128_AES][0]=count;
|
||||
c[D_IGE_192_AES][0]=count;
|
||||
c[D_IGE_256_AES][0]=count;
|
||||
c[D_GHASH][0]=count;
|
||||
|
||||
for (i=1; i<SIZE_NUM; i++)
|
||||
{
|
||||
@ -1426,6 +1310,7 @@ int MAIN(int argc, char **argv)
|
||||
c[D_RMD160][i]=c[D_RMD160][0]*4*lengths[0]/lengths[i];
|
||||
c[D_SHA256][i]=c[D_SHA256][0]*4*lengths[0]/lengths[i];
|
||||
c[D_SHA512][i]=c[D_SHA512][0]*4*lengths[0]/lengths[i];
|
||||
c[D_WHIRLPOOL][i]=c[D_WHIRLPOOL][0]*4*lengths[0]/lengths[i];
|
||||
}
|
||||
for (i=1; i<SIZE_NUM; i++)
|
||||
{
|
||||
@ -1607,9 +1492,11 @@ int MAIN(int argc, char **argv)
|
||||
# error "You cannot disable DES on systems without SIGALRM."
|
||||
#endif /* OPENSSL_NO_DES */
|
||||
#else
|
||||
#define COND(c) (run)
|
||||
#define COND(c) (run && count<0x7fffffff)
|
||||
#define COUNT(d) (count)
|
||||
#ifndef _WIN32
|
||||
signal(SIGALRM,sig_done);
|
||||
#endif
|
||||
#endif /* SIGALRM */
|
||||
|
||||
#ifndef OPENSSL_NO_MD2
|
||||
@ -1739,8 +1626,23 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_WHIRLPOOL
|
||||
if (doit[D_WHIRLPOOL])
|
||||
{
|
||||
for (j=0; j<SIZE_NUM; j++)
|
||||
{
|
||||
print_message(names[D_WHIRLPOOL],c[D_WHIRLPOOL][j],lengths[j]);
|
||||
Time_F(START);
|
||||
for (count=0,run=1; COND(c[D_WHIRLPOOL][j]); count++)
|
||||
WHIRLPOOL(buf,lengths[j],whirlpool);
|
||||
d=Time_F(STOP);
|
||||
print_result(D_WHIRLPOOL,j,count,d);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_RIPEMD
|
||||
if (doit[D_RMD160])
|
||||
{
|
||||
@ -1886,6 +1788,23 @@ int MAIN(int argc, char **argv)
|
||||
print_result(D_IGE_256_AES,j,count,d);
|
||||
}
|
||||
}
|
||||
if (doit[D_GHASH])
|
||||
{
|
||||
GCM128_CONTEXT *ctx = CRYPTO_gcm128_new(&aes_ks1,(block128_f)AES_encrypt);
|
||||
CRYPTO_gcm128_setiv (ctx,(unsigned char *)"0123456789ab",12);
|
||||
|
||||
for (j=0; j<SIZE_NUM; j++)
|
||||
{
|
||||
print_message(names[D_GHASH],c[D_GHASH][j],lengths[j]);
|
||||
Time_F(START);
|
||||
for (count=0,run=1; COND(c[D_GHASH][j]); count++)
|
||||
CRYPTO_gcm128_aad(ctx,buf,lengths[j]);
|
||||
d=Time_F(STOP);
|
||||
print_result(D_GHASH,j,count,d);
|
||||
}
|
||||
CRYPTO_gcm128_release(ctx);
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
if (doit[D_CBC_128_CML])
|
||||
@ -2498,35 +2417,6 @@ int MAIN(int argc, char **argv)
|
||||
printf("%s ",BF_options());
|
||||
#endif
|
||||
fprintf(stdout,"\n%s\n",SSLeay_version(SSLEAY_CFLAGS));
|
||||
printf("available timing options: ");
|
||||
#ifdef TIMES
|
||||
printf("TIMES ");
|
||||
#endif
|
||||
#ifdef TIMEB
|
||||
printf("TIMEB ");
|
||||
#endif
|
||||
#ifdef USE_TOD
|
||||
printf("USE_TOD ");
|
||||
#endif
|
||||
#ifdef HZ
|
||||
#define as_string(s) (#s)
|
||||
{
|
||||
double dbl = HZ;
|
||||
printf("HZ=%g", dbl);
|
||||
}
|
||||
# ifdef _SC_CLK_TCK
|
||||
printf(" [sysconf value]");
|
||||
# endif
|
||||
#endif
|
||||
printf("\n");
|
||||
printf("timing function used: %s%s%s%s%s%s%s\n",
|
||||
(ftime_used ? "ftime" : ""),
|
||||
(ftime_used + times_used > 1 ? "," : ""),
|
||||
(times_used ? "times" : ""),
|
||||
(ftime_used + times_used + gettimeofday_used > 1 ? "," : ""),
|
||||
(gettimeofday_used ? "gettimeofday" : ""),
|
||||
(ftime_used + times_used + gettimeofday_used + getrusage_used > 1 ? "," : ""),
|
||||
(getrusage_used ? "getrusage" : ""));
|
||||
}
|
||||
|
||||
if (pr_header)
|
||||
@ -2707,7 +2597,7 @@ static void pkey_print_message(const char *str, const char *str2, long num,
|
||||
BIO_printf(bio_err,mr ? "+DTP:%d:%s:%s:%d\n"
|
||||
: "Doing %d bit %s %s's for %ds: ",bits,str,str2,tm);
|
||||
(void)BIO_flush(bio_err);
|
||||
alarm(RSA_SECONDS);
|
||||
alarm(tm);
|
||||
#else
|
||||
BIO_printf(bio_err,mr ? "+DNP:%ld:%d:%s:%s\n"
|
||||
: "Doing %ld %d bit %s %s's: ",num,bits,str,str2);
|
||||
@ -2767,7 +2657,11 @@ static int do_multi(int multi)
|
||||
fds=malloc(multi*sizeof *fds);
|
||||
for(n=0 ; n < multi ; ++n)
|
||||
{
|
||||
pipe(fd);
|
||||
if (pipe(fd) == -1)
|
||||
{
|
||||
fprintf(stderr, "pipe failure\n");
|
||||
exit(1);
|
||||
}
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
if(fork())
|
||||
@ -2779,10 +2673,15 @@ static int do_multi(int multi)
|
||||
{
|
||||
close(fd[0]);
|
||||
close(1);
|
||||
dup(fd[1]);
|
||||
if (dup(fd[1]) == -1)
|
||||
{
|
||||
fprintf(stderr, "dup failed\n");
|
||||
exit(1);
|
||||
}
|
||||
close(fd[1]);
|
||||
mr=1;
|
||||
usertime=0;
|
||||
free(fds);
|
||||
return 0;
|
||||
}
|
||||
printf("Forked child %d\n",n);
|
||||
@ -2861,6 +2760,7 @@ static int do_multi(int multi)
|
||||
else
|
||||
rsa_results[k][1]=d;
|
||||
}
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
else if(!strncmp(buf,"+F3:",4))
|
||||
{
|
||||
int k;
|
||||
@ -2882,6 +2782,7 @@ static int do_multi(int multi)
|
||||
else
|
||||
dsa_results[k][1]=d;
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
else if(!strncmp(buf,"+F4:",4))
|
||||
{
|
||||
@ -2931,7 +2832,10 @@ static int do_multi(int multi)
|
||||
else
|
||||
fprintf(stderr,"Unknown type '%s' from child %d\n",buf,n);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
free(fds);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
756
crypto/openssl/apps/srp.c
Normal file
756
crypto/openssl/apps/srp.c
Normal file
@ -0,0 +1,756 @@
|
||||
/* apps/srp.c */
|
||||
/* Written by Peter Sylvester (peter.sylvester@edelweb.fr)
|
||||
* for the EdelKey project and contributed to the OpenSSL project 2004.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2004 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* licensing@OpenSSL.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
#include <openssl/opensslconf.h>
|
||||
|
||||
#ifndef OPENSSL_NO_SRP
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/txt_db.h>
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/srp.h>
|
||||
|
||||
#include "apps.h"
|
||||
|
||||
#undef PROG
|
||||
#define PROG srp_main
|
||||
|
||||
#define BASE_SECTION "srp"
|
||||
#define CONFIG_FILE "openssl.cnf"
|
||||
|
||||
#define ENV_RANDFILE "RANDFILE"
|
||||
|
||||
#define ENV_DATABASE "srpvfile"
|
||||
#define ENV_DEFAULT_SRP "default_srp"
|
||||
|
||||
static char *srp_usage[]={
|
||||
"usage: srp [args] [user] \n",
|
||||
"\n",
|
||||
" -verbose Talk alot while doing things\n",
|
||||
" -config file A config file\n",
|
||||
" -name arg The particular srp definition to use\n",
|
||||
" -srpvfile arg The srp verifier file name\n",
|
||||
" -add add an user and srp verifier\n",
|
||||
" -modify modify the srp verifier of an existing user\n",
|
||||
" -delete delete user from verifier file\n",
|
||||
" -list list user\n",
|
||||
" -gn arg g and N values to be used for new verifier\n",
|
||||
" -userinfo arg additional info to be set for user\n",
|
||||
" -passin arg input file pass phrase source\n",
|
||||
" -passout arg output file pass phrase source\n",
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
" -engine e - use engine e, possibly a hardware device.\n",
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
#ifdef EFENCE
|
||||
extern int EF_PROTECT_FREE;
|
||||
extern int EF_PROTECT_BELOW;
|
||||
extern int EF_ALIGNMENT;
|
||||
#endif
|
||||
|
||||
static CONF *conf=NULL;
|
||||
static char *section=NULL;
|
||||
|
||||
#define VERBOSE if (verbose)
|
||||
#define VVERBOSE if (verbose>1)
|
||||
|
||||
|
||||
int MAIN(int, char **);
|
||||
|
||||
static int get_index(CA_DB *db, char* id, char type)
|
||||
{
|
||||
char ** pp;
|
||||
int i;
|
||||
if (id == NULL) return -1;
|
||||
if (type == DB_SRP_INDEX)
|
||||
for (i = 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++)
|
||||
{
|
||||
pp = (char **)sk_OPENSSL_PSTRING_value(db->db->data, i);
|
||||
if (pp[DB_srptype][0] == DB_SRP_INDEX && !strcmp(id, pp[DB_srpid]))
|
||||
return i;
|
||||
}
|
||||
else for (i = 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++)
|
||||
{
|
||||
pp = (char **)sk_OPENSSL_PSTRING_value(db->db->data, i);
|
||||
|
||||
if (pp[DB_srptype][0] != DB_SRP_INDEX && !strcmp(id,pp[DB_srpid]))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1 ;
|
||||
}
|
||||
|
||||
static void print_entry(CA_DB *db, BIO *bio, int indx, int verbose, char *s)
|
||||
{
|
||||
if (indx >= 0 && verbose)
|
||||
{
|
||||
int j;
|
||||
char **pp = (char **)sk_OPENSSL_PSTRING_value(db->db->data, indx);
|
||||
BIO_printf(bio, "%s \"%s\"\n", s, pp[DB_srpid]);
|
||||
for (j = 0; j < DB_NUMBER; j++)
|
||||
{
|
||||
BIO_printf(bio_err," %d = \"%s\"\n", j, pp[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void print_index(CA_DB *db, BIO *bio, int indexindex, int verbose)
|
||||
{
|
||||
print_entry(db, bio, indexindex, verbose, "g N entry") ;
|
||||
}
|
||||
|
||||
static void print_user(CA_DB *db, BIO *bio, int userindex, int verbose)
|
||||
{
|
||||
if (verbose > 0)
|
||||
{
|
||||
char **pp = (char **)sk_OPENSSL_PSTRING_value(db->db->data, userindex);
|
||||
|
||||
if (pp[DB_srptype][0] != 'I')
|
||||
{
|
||||
print_entry(db, bio, userindex, verbose, "User entry");
|
||||
print_entry(db, bio, get_index(db, pp[DB_srpgN], 'I'), verbose, "g N entry");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static int update_index(CA_DB *db, BIO *bio, char **row)
|
||||
{
|
||||
char ** irow;
|
||||
int i;
|
||||
|
||||
if ((irow=(char **)OPENSSL_malloc(sizeof(char *)*(DB_NUMBER+1))) == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i=0; i<DB_NUMBER; i++)
|
||||
{
|
||||
irow[i]=row[i];
|
||||
row[i]=NULL;
|
||||
}
|
||||
irow[DB_NUMBER]=NULL;
|
||||
|
||||
if (!TXT_DB_insert(db->db,irow))
|
||||
{
|
||||
BIO_printf(bio,"failed to update srpvfile\n");
|
||||
BIO_printf(bio,"TXT_DB error number %ld\n",db->db->error);
|
||||
OPENSSL_free(irow);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void lookup_fail(const char *name, char *tag)
|
||||
{
|
||||
BIO_printf(bio_err,"variable lookup failed for %s::%s\n",name,tag);
|
||||
}
|
||||
|
||||
|
||||
static char *srp_verify_user(const char *user, const char *srp_verifier,
|
||||
char *srp_usersalt, const char *g, const char *N,
|
||||
const char *passin, BIO *bio, int verbose)
|
||||
{
|
||||
char password[1024];
|
||||
PW_CB_DATA cb_tmp;
|
||||
char *verifier = NULL;
|
||||
char *gNid = NULL;
|
||||
|
||||
cb_tmp.prompt_info = user;
|
||||
cb_tmp.password = passin;
|
||||
|
||||
if (password_callback(password, 1024, 0, &cb_tmp) >0)
|
||||
{
|
||||
VERBOSE BIO_printf(bio,"Validating\n user=\"%s\"\n srp_verifier=\"%s\"\n srp_usersalt=\"%s\"\n g=\"%s\"\n N=\"%s\"\n",user,srp_verifier,srp_usersalt, g, N);
|
||||
BIO_printf(bio, "Pass %s\n", password);
|
||||
|
||||
if (!(gNid=SRP_create_verifier(user, password, &srp_usersalt, &verifier, N, g)))
|
||||
{
|
||||
BIO_printf(bio, "Internal error validating SRP verifier\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp(verifier, srp_verifier))
|
||||
gNid = NULL;
|
||||
OPENSSL_free(verifier);
|
||||
}
|
||||
}
|
||||
return gNid;
|
||||
}
|
||||
|
||||
static char *srp_create_user(char *user, char **srp_verifier,
|
||||
char **srp_usersalt, char *g, char *N,
|
||||
char *passout, BIO *bio, int verbose)
|
||||
{
|
||||
char password[1024];
|
||||
PW_CB_DATA cb_tmp;
|
||||
char *gNid = NULL;
|
||||
char *salt = NULL;
|
||||
cb_tmp.prompt_info = user;
|
||||
cb_tmp.password = passout;
|
||||
|
||||
if (password_callback(password,1024,1,&cb_tmp) >0)
|
||||
{
|
||||
VERBOSE BIO_printf(bio,"Creating\n user=\"%s\"\n g=\"%s\"\n N=\"%s\"\n",user,g,N);
|
||||
if (!(gNid =SRP_create_verifier(user, password, &salt, srp_verifier, N, g)))
|
||||
{
|
||||
BIO_printf(bio,"Internal error creating SRP verifier\n");
|
||||
}
|
||||
else
|
||||
*srp_usersalt = salt;
|
||||
VVERBOSE BIO_printf(bio,"gNid=%s salt =\"%s\"\n verifier =\"%s\"\n", gNid,salt, *srp_verifier);
|
||||
|
||||
}
|
||||
return gNid;
|
||||
}
|
||||
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
int add_user = 0;
|
||||
int list_user= 0;
|
||||
int delete_user= 0;
|
||||
int modify_user= 0;
|
||||
char * user = NULL;
|
||||
|
||||
char *passargin = NULL, *passargout = NULL;
|
||||
char *passin = NULL, *passout = NULL;
|
||||
char * gN = NULL;
|
||||
int gNindex = -1;
|
||||
char ** gNrow = NULL;
|
||||
int maxgN = -1;
|
||||
|
||||
char * userinfo = NULL;
|
||||
|
||||
int badops=0;
|
||||
int ret=1;
|
||||
int errors=0;
|
||||
int verbose=0;
|
||||
int doupdatedb=0;
|
||||
char *configfile=NULL;
|
||||
char *dbfile=NULL;
|
||||
CA_DB *db=NULL;
|
||||
char **pp ;
|
||||
int i;
|
||||
long errorline = -1;
|
||||
char *randfile=NULL;
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
char *engine = NULL;
|
||||
#endif
|
||||
char *tofree=NULL;
|
||||
DB_ATTR db_attr;
|
||||
|
||||
#ifdef EFENCE
|
||||
EF_PROTECT_FREE=1;
|
||||
EF_PROTECT_BELOW=1;
|
||||
EF_ALIGNMENT=0;
|
||||
#endif
|
||||
|
||||
apps_startup();
|
||||
|
||||
conf = NULL;
|
||||
section = NULL;
|
||||
|
||||
if (bio_err == NULL)
|
||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
while (argc >= 1 && badops == 0)
|
||||
{
|
||||
if (strcmp(*argv,"-verbose") == 0)
|
||||
verbose++;
|
||||
else if (strcmp(*argv,"-config") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
configfile= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-name") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
section= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-srpvfile") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
dbfile= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-add") == 0)
|
||||
add_user=1;
|
||||
else if (strcmp(*argv,"-delete") == 0)
|
||||
delete_user=1;
|
||||
else if (strcmp(*argv,"-modify") == 0)
|
||||
modify_user=1;
|
||||
else if (strcmp(*argv,"-list") == 0)
|
||||
list_user=1;
|
||||
else if (strcmp(*argv,"-gn") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
gN= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-userinfo") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
userinfo= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-passin") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
passargin= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-passout") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
passargout= *(++argv);
|
||||
}
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
else if (strcmp(*argv,"-engine") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
engine= *(++argv);
|
||||
}
|
||||
#endif
|
||||
|
||||
else if (**argv == '-')
|
||||
{
|
||||
bad:
|
||||
BIO_printf(bio_err,"unknown option %s\n",*argv);
|
||||
badops=1;
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
|
||||
if (dbfile && configfile)
|
||||
{
|
||||
BIO_printf(bio_err,"-dbfile and -configfile cannot be specified together.\n");
|
||||
badops = 1;
|
||||
}
|
||||
if (add_user+delete_user+modify_user+list_user != 1)
|
||||
{
|
||||
BIO_printf(bio_err,"Exactly one of the options -add, -delete, -modify -list must be specified.\n");
|
||||
badops = 1;
|
||||
}
|
||||
if (delete_user+modify_user+delete_user== 1 && argc <= 0)
|
||||
{
|
||||
BIO_printf(bio_err,"Need at least one user for options -add, -delete, -modify. \n");
|
||||
badops = 1;
|
||||
}
|
||||
if ((passin || passout) && argc != 1 )
|
||||
{
|
||||
BIO_printf(bio_err,"-passin, -passout arguments only valid with one user.\n");
|
||||
badops = 1;
|
||||
}
|
||||
|
||||
if (badops)
|
||||
{
|
||||
for (pp=srp_usage; (*pp != NULL); pp++)
|
||||
BIO_printf(bio_err,"%s",*pp);
|
||||
|
||||
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();
|
||||
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
setup_engine(bio_err, engine, 0);
|
||||
#endif
|
||||
|
||||
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout))
|
||||
{
|
||||
BIO_printf(bio_err, "Error getting passwords\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!dbfile)
|
||||
{
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
tofree=NULL;
|
||||
if (configfile == NULL) configfile = getenv("OPENSSL_CONF");
|
||||
if (configfile == NULL) configfile = getenv("SSLEAY_CONF");
|
||||
if (configfile == NULL)
|
||||
{
|
||||
const char *s=X509_get_default_cert_area();
|
||||
size_t len;
|
||||
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
len = strlen(s)+sizeof(CONFIG_FILE);
|
||||
tofree=OPENSSL_malloc(len);
|
||||
strcpy(tofree,s);
|
||||
#else
|
||||
len = strlen(s)+sizeof(CONFIG_FILE)+1;
|
||||
tofree=OPENSSL_malloc(len);
|
||||
BUF_strlcpy(tofree,s,len);
|
||||
BUF_strlcat(tofree,"/",len);
|
||||
#endif
|
||||
BUF_strlcat(tofree,CONFIG_FILE,len);
|
||||
configfile=tofree;
|
||||
}
|
||||
|
||||
VERBOSE BIO_printf(bio_err,"Using configuration from %s\n",configfile);
|
||||
conf = NCONF_new(NULL);
|
||||
if (NCONF_load(conf,configfile,&errorline) <= 0)
|
||||
{
|
||||
if (errorline <= 0)
|
||||
BIO_printf(bio_err,"error loading the config file '%s'\n",
|
||||
configfile);
|
||||
else
|
||||
BIO_printf(bio_err,"error on line %ld of config file '%s'\n"
|
||||
,errorline,configfile);
|
||||
goto err;
|
||||
}
|
||||
if(tofree)
|
||||
{
|
||||
OPENSSL_free(tofree);
|
||||
tofree = NULL;
|
||||
}
|
||||
|
||||
if (!load_config(bio_err, conf))
|
||||
goto err;
|
||||
|
||||
/* Lets get the config section we are using */
|
||||
if (section == NULL)
|
||||
{
|
||||
VERBOSE BIO_printf(bio_err,"trying to read " ENV_DEFAULT_SRP " in \" BASE_SECTION \"\n");
|
||||
|
||||
section=NCONF_get_string(conf,BASE_SECTION,ENV_DEFAULT_SRP);
|
||||
if (section == NULL)
|
||||
{
|
||||
lookup_fail(BASE_SECTION,ENV_DEFAULT_SRP);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
if (randfile == NULL && conf)
|
||||
randfile = NCONF_get_string(conf, BASE_SECTION, "RANDFILE");
|
||||
|
||||
|
||||
VERBOSE BIO_printf(bio_err,"trying to read " ENV_DATABASE " in section \"%s\"\n",section);
|
||||
|
||||
if ((dbfile=NCONF_get_string(conf,section,ENV_DATABASE)) == NULL)
|
||||
{
|
||||
lookup_fail(section,ENV_DATABASE);
|
||||
goto err;
|
||||
}
|
||||
|
||||
}
|
||||
if (randfile == NULL)
|
||||
ERR_clear_error();
|
||||
else
|
||||
app_RAND_load_file(randfile, bio_err, 0);
|
||||
|
||||
VERBOSE BIO_printf(bio_err,"Trying to read SRP verifier file \"%s\"\n",dbfile);
|
||||
|
||||
db = load_index(dbfile, &db_attr);
|
||||
if (db == NULL) goto err;
|
||||
|
||||
/* Lets check some fields */
|
||||
for (i = 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++)
|
||||
{
|
||||
pp = (char **)sk_OPENSSL_PSTRING_value(db->db->data, i);
|
||||
|
||||
if (pp[DB_srptype][0] == DB_SRP_INDEX)
|
||||
{
|
||||
maxgN = i;
|
||||
if (gNindex < 0 && gN != NULL && !strcmp(gN, pp[DB_srpid]))
|
||||
gNindex = i;
|
||||
|
||||
print_index(db, bio_err, i, verbose > 1);
|
||||
}
|
||||
}
|
||||
|
||||
VERBOSE BIO_printf(bio_err, "Database initialised\n");
|
||||
|
||||
if (gNindex >= 0)
|
||||
{
|
||||
gNrow = (char **)sk_OPENSSL_PSTRING_value(db->db->data, gNindex);
|
||||
print_entry(db, bio_err, gNindex, verbose > 1, "Default g and N") ;
|
||||
}
|
||||
else if (maxgN > 0 && !SRP_get_default_gN(gN))
|
||||
{
|
||||
BIO_printf(bio_err, "No g and N value for index \"%s\"\n", gN);
|
||||
goto err;
|
||||
}
|
||||
else
|
||||
{
|
||||
VERBOSE BIO_printf(bio_err, "Database has no g N information.\n");
|
||||
gNrow = NULL;
|
||||
}
|
||||
|
||||
|
||||
VVERBOSE BIO_printf(bio_err,"Starting user processing\n");
|
||||
|
||||
if (argc > 0)
|
||||
user = *(argv++) ;
|
||||
|
||||
while (list_user || user)
|
||||
{
|
||||
int userindex = -1;
|
||||
if (user)
|
||||
VVERBOSE BIO_printf(bio_err, "Processing user \"%s\"\n", user);
|
||||
if ((userindex = get_index(db, user, 'U')) >= 0)
|
||||
{
|
||||
print_user(db, bio_err, userindex, (verbose > 0) || list_user);
|
||||
}
|
||||
|
||||
if (list_user)
|
||||
{
|
||||
if (user == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"List all users\n");
|
||||
|
||||
for (i = 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++)
|
||||
{
|
||||
print_user(db,bio_err, i, 1);
|
||||
}
|
||||
list_user = 0;
|
||||
}
|
||||
else if (userindex < 0)
|
||||
{
|
||||
BIO_printf(bio_err, "user \"%s\" does not exist, ignored. t\n",
|
||||
user);
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
else if (add_user)
|
||||
{
|
||||
if (userindex >= 0)
|
||||
{
|
||||
/* reactivation of a new user */
|
||||
char **row = (char **)sk_OPENSSL_PSTRING_value(db->db->data, userindex);
|
||||
BIO_printf(bio_err, "user \"%s\" reactivated.\n", user);
|
||||
row[DB_srptype][0] = 'V';
|
||||
|
||||
doupdatedb = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *row[DB_NUMBER] ; char *gNid;
|
||||
row[DB_srpverifier] = NULL;
|
||||
row[DB_srpsalt] = NULL;
|
||||
row[DB_srpinfo] = NULL;
|
||||
if (!(gNid = srp_create_user(user,&(row[DB_srpverifier]), &(row[DB_srpsalt]),gNrow?gNrow[DB_srpsalt]:gN,gNrow?gNrow[DB_srpverifier]:NULL, passout, bio_err,verbose)))
|
||||
{
|
||||
BIO_printf(bio_err, "Cannot create srp verifier for user \"%s\", operation abandoned .\n", user);
|
||||
errors++;
|
||||
goto err;
|
||||
}
|
||||
row[DB_srpid] = BUF_strdup(user);
|
||||
row[DB_srptype] = BUF_strdup("v");
|
||||
row[DB_srpgN] = BUF_strdup(gNid);
|
||||
|
||||
if (!row[DB_srpid] || !row[DB_srpgN] || !row[DB_srptype] || !row[DB_srpverifier] || !row[DB_srpsalt] ||
|
||||
(userinfo && (!(row[DB_srpinfo] = BUF_strdup(userinfo)))) ||
|
||||
!update_index(db, bio_err, row))
|
||||
{
|
||||
if (row[DB_srpid]) OPENSSL_free(row[DB_srpid]);
|
||||
if (row[DB_srpgN]) OPENSSL_free(row[DB_srpgN]);
|
||||
if (row[DB_srpinfo]) OPENSSL_free(row[DB_srpinfo]);
|
||||
if (row[DB_srptype]) OPENSSL_free(row[DB_srptype]);
|
||||
if (row[DB_srpverifier]) OPENSSL_free(row[DB_srpverifier]);
|
||||
if (row[DB_srpsalt]) OPENSSL_free(row[DB_srpsalt]);
|
||||
goto err;
|
||||
}
|
||||
doupdatedb = 1;
|
||||
}
|
||||
}
|
||||
else if (modify_user)
|
||||
{
|
||||
if (userindex < 0)
|
||||
{
|
||||
BIO_printf(bio_err,"user \"%s\" does not exist, operation ignored.\n",user);
|
||||
errors++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
char **row = (char **)sk_OPENSSL_PSTRING_value(db->db->data, userindex);
|
||||
char type = row[DB_srptype][0];
|
||||
if (type == 'v')
|
||||
{
|
||||
BIO_printf(bio_err,"user \"%s\" already updated, operation ignored.\n",user);
|
||||
errors++;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *gNid;
|
||||
|
||||
if (row[DB_srptype][0] == 'V')
|
||||
{
|
||||
int user_gN;
|
||||
char **irow = NULL;
|
||||
VERBOSE BIO_printf(bio_err,"Verifying password for user \"%s\"\n",user);
|
||||
if ( (user_gN = get_index(db, row[DB_srpgN], DB_SRP_INDEX)) >= 0)
|
||||
irow = (char **)sk_OPENSSL_PSTRING_value(db->db->data, userindex);
|
||||
|
||||
if (!srp_verify_user(user, row[DB_srpverifier], row[DB_srpsalt], irow ? irow[DB_srpsalt] : row[DB_srpgN], irow ? irow[DB_srpverifier] : NULL, passin, bio_err, verbose))
|
||||
{
|
||||
BIO_printf(bio_err, "Invalid password for user \"%s\", operation abandoned.\n", user);
|
||||
errors++;
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
VERBOSE BIO_printf(bio_err,"Password for user \"%s\" ok.\n",user);
|
||||
|
||||
if (!(gNid=srp_create_user(user,&(row[DB_srpverifier]), &(row[DB_srpsalt]),gNrow?gNrow[DB_srpsalt]:NULL, gNrow?gNrow[DB_srpverifier]:NULL, passout, bio_err,verbose)))
|
||||
{
|
||||
BIO_printf(bio_err, "Cannot create srp verifier for user \"%s\", operation abandoned.\n", user);
|
||||
errors++;
|
||||
goto err;
|
||||
}
|
||||
|
||||
row[DB_srptype][0] = 'v';
|
||||
row[DB_srpgN] = BUF_strdup(gNid);
|
||||
|
||||
if (!row[DB_srpid] || !row[DB_srpgN] || !row[DB_srptype] || !row[DB_srpverifier] || !row[DB_srpsalt] ||
|
||||
(userinfo && (!(row[DB_srpinfo] = BUF_strdup(userinfo)))))
|
||||
goto err;
|
||||
|
||||
doupdatedb = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (delete_user)
|
||||
{
|
||||
if (userindex < 0)
|
||||
{
|
||||
BIO_printf(bio_err, "user \"%s\" does not exist, operation ignored. t\n", user);
|
||||
errors++;
|
||||
}
|
||||
else
|
||||
{
|
||||
char **xpp = (char **)sk_OPENSSL_PSTRING_value(db->db->data, userindex);
|
||||
BIO_printf(bio_err, "user \"%s\" revoked. t\n", user);
|
||||
|
||||
xpp[DB_srptype][0] = 'R';
|
||||
|
||||
doupdatedb = 1;
|
||||
}
|
||||
}
|
||||
if (--argc > 0)
|
||||
user = *(argv++) ;
|
||||
else
|
||||
{
|
||||
user = NULL;
|
||||
list_user = 0;
|
||||
}
|
||||
}
|
||||
|
||||
VERBOSE BIO_printf(bio_err,"User procession done.\n");
|
||||
|
||||
|
||||
if (doupdatedb)
|
||||
{
|
||||
/* Lets check some fields */
|
||||
for (i = 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++)
|
||||
{
|
||||
pp = (char **)sk_OPENSSL_PSTRING_value(db->db->data, i);
|
||||
|
||||
if (pp[DB_srptype][0] == 'v')
|
||||
{
|
||||
pp[DB_srptype][0] = 'V';
|
||||
print_user(db, bio_err, i, verbose);
|
||||
}
|
||||
}
|
||||
|
||||
VERBOSE BIO_printf(bio_err, "Trying to update srpvfile.\n");
|
||||
if (!save_index(dbfile, "new", db)) goto err;
|
||||
|
||||
VERBOSE BIO_printf(bio_err, "Temporary srpvfile created.\n");
|
||||
if (!rotate_index(dbfile, "new", "old")) goto err;
|
||||
|
||||
VERBOSE BIO_printf(bio_err, "srpvfile updated.\n");
|
||||
}
|
||||
|
||||
ret = (errors != 0);
|
||||
err:
|
||||
if (errors != 0)
|
||||
VERBOSE BIO_printf(bio_err,"User errors %d.\n",errors);
|
||||
|
||||
VERBOSE BIO_printf(bio_err,"SRP terminating with code %d.\n",ret);
|
||||
if(tofree)
|
||||
OPENSSL_free(tofree);
|
||||
if (ret) ERR_print_errors(bio_err);
|
||||
if (randfile) app_RAND_write_file(randfile, bio_err);
|
||||
if (conf) NCONF_free(conf);
|
||||
if (db) free_index(db);
|
||||
|
||||
OBJ_cleanup();
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
1147
crypto/openssl/apps/ts.c
Normal file
1147
crypto/openssl/apps/ts.c
Normal file
File diff suppressed because it is too large
Load Diff
196
crypto/openssl/apps/tsget
Normal file
196
crypto/openssl/apps/tsget
Normal file
@ -0,0 +1,196 @@
|
||||
#!/usr/bin/perl -w
|
||||
# Written by Zoltan Glozik <zglozik@stones.com>.
|
||||
# Copyright (c) 2002 The OpenTSA Project. All rights reserved.
|
||||
$::version = '$Id: tsget,v 1.1.2.2 2009/09/07 17:57:02 steve Exp $';
|
||||
|
||||
use strict;
|
||||
use IO::Handle;
|
||||
use Getopt::Std;
|
||||
use File::Basename;
|
||||
use WWW::Curl::Easy;
|
||||
|
||||
use vars qw(%options);
|
||||
|
||||
# Callback for reading the body.
|
||||
sub read_body {
|
||||
my ($maxlength, $state) = @_;
|
||||
my $return_data = "";
|
||||
my $data_len = length ${$state->{data}};
|
||||
if ($state->{bytes} < $data_len) {
|
||||
$data_len = $data_len - $state->{bytes};
|
||||
$data_len = $maxlength if $data_len > $maxlength;
|
||||
$return_data = substr ${$state->{data}}, $state->{bytes}, $data_len;
|
||||
$state->{bytes} += $data_len;
|
||||
}
|
||||
return $return_data;
|
||||
}
|
||||
|
||||
# Callback for writing the body into a variable.
|
||||
sub write_body {
|
||||
my ($data, $pointer) = @_;
|
||||
${$pointer} .= $data;
|
||||
return length($data);
|
||||
}
|
||||
|
||||
# Initialise a new Curl object.
|
||||
sub create_curl {
|
||||
my $url = shift;
|
||||
|
||||
# Create Curl object.
|
||||
my $curl = WWW::Curl::Easy::new();
|
||||
|
||||
# Error-handling related options.
|
||||
$curl->setopt(CURLOPT_VERBOSE, 1) if $options{d};
|
||||
$curl->setopt(CURLOPT_FAILONERROR, 1);
|
||||
$curl->setopt(CURLOPT_USERAGENT, "OpenTSA tsget.pl/" . (split / /, $::version)[2]);
|
||||
|
||||
# Options for POST method.
|
||||
$curl->setopt(CURLOPT_UPLOAD, 1);
|
||||
$curl->setopt(CURLOPT_CUSTOMREQUEST, "POST");
|
||||
$curl->setopt(CURLOPT_HTTPHEADER,
|
||||
["Content-Type: application/timestamp-query",
|
||||
"Accept: application/timestamp-reply,application/timestamp-response"]);
|
||||
$curl->setopt(CURLOPT_READFUNCTION, \&read_body);
|
||||
$curl->setopt(CURLOPT_HEADERFUNCTION, sub { return length($_[0]); });
|
||||
|
||||
# Options for getting the result.
|
||||
$curl->setopt(CURLOPT_WRITEFUNCTION, \&write_body);
|
||||
|
||||
# SSL related options.
|
||||
$curl->setopt(CURLOPT_SSLKEYTYPE, "PEM");
|
||||
$curl->setopt(CURLOPT_SSL_VERIFYPEER, 1); # Verify server's certificate.
|
||||
$curl->setopt(CURLOPT_SSL_VERIFYHOST, 2); # Check server's CN.
|
||||
$curl->setopt(CURLOPT_SSLKEY, $options{k}) if defined($options{k});
|
||||
$curl->setopt(CURLOPT_SSLKEYPASSWD, $options{p}) if defined($options{p});
|
||||
$curl->setopt(CURLOPT_SSLCERT, $options{c}) if defined($options{c});
|
||||
$curl->setopt(CURLOPT_CAINFO, $options{C}) if defined($options{C});
|
||||
$curl->setopt(CURLOPT_CAPATH, $options{P}) if defined($options{P});
|
||||
$curl->setopt(CURLOPT_RANDOM_FILE, $options{r}) if defined($options{r});
|
||||
$curl->setopt(CURLOPT_EGDSOCKET, $options{g}) if defined($options{g});
|
||||
|
||||
# Setting destination.
|
||||
$curl->setopt(CURLOPT_URL, $url);
|
||||
|
||||
return $curl;
|
||||
}
|
||||
|
||||
# Send a request and returns the body back.
|
||||
sub get_timestamp {
|
||||
my $curl = shift;
|
||||
my $body = shift;
|
||||
my $ts_body;
|
||||
local $::error_buf;
|
||||
|
||||
# Error-handling related options.
|
||||
$curl->setopt(CURLOPT_ERRORBUFFER, "::error_buf");
|
||||
|
||||
# Options for POST method.
|
||||
$curl->setopt(CURLOPT_INFILE, {data => $body, bytes => 0});
|
||||
$curl->setopt(CURLOPT_INFILESIZE, length(${$body}));
|
||||
|
||||
# Options for getting the result.
|
||||
$curl->setopt(CURLOPT_FILE, \$ts_body);
|
||||
|
||||
# Send the request...
|
||||
my $error_code = $curl->perform();
|
||||
my $error_string;
|
||||
if ($error_code != 0) {
|
||||
my $http_code = $curl->getinfo(CURLINFO_HTTP_CODE);
|
||||
$error_string = "could not get timestamp";
|
||||
$error_string .= ", http code: $http_code" unless $http_code == 0;
|
||||
$error_string .= ", curl code: $error_code";
|
||||
$error_string .= " ($::error_buf)" if defined($::error_buf);
|
||||
} else {
|
||||
my $ct = $curl->getinfo(CURLINFO_CONTENT_TYPE);
|
||||
if (lc($ct) ne "application/timestamp-reply"
|
||||
&& lc($ct) ne "application/timestamp-response") {
|
||||
$error_string = "unexpected content type returned: $ct";
|
||||
}
|
||||
}
|
||||
return ($ts_body, $error_string);
|
||||
|
||||
}
|
||||
|
||||
# Print usage information and exists.
|
||||
sub usage {
|
||||
|
||||
print STDERR "usage: $0 -h <server_url> [-e <extension>] [-o <output>] ";
|
||||
print STDERR "[-v] [-d] [-k <private_key.pem>] [-p <key_password>] ";
|
||||
print STDERR "[-c <client_cert.pem>] [-C <CA_certs.pem>] [-P <CA_path>] ";
|
||||
print STDERR "[-r <file:file...>] [-g <EGD_socket>] [<request>]...\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Main program
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# Getting command-line options (default comes from TSGET environment variable).
|
||||
my $getopt_arg = "h:e:o:vdk:p:c:C:P:r:g:";
|
||||
if (exists $ENV{TSGET}) {
|
||||
my @old_argv = @ARGV;
|
||||
@ARGV = split /\s+/, $ENV{TSGET};
|
||||
getopts($getopt_arg, \%options) or usage;
|
||||
@ARGV = @old_argv;
|
||||
}
|
||||
getopts($getopt_arg, \%options) or usage;
|
||||
|
||||
# Checking argument consistency.
|
||||
if (!exists($options{h}) || (@ARGV == 0 && !exists($options{o}))
|
||||
|| (@ARGV > 1 && exists($options{o}))) {
|
||||
print STDERR "Inconsistent command line options.\n";
|
||||
usage;
|
||||
}
|
||||
# Setting defaults.
|
||||
@ARGV = ("-") unless @ARGV != 0;
|
||||
$options{e} = ".tsr" unless defined($options{e});
|
||||
|
||||
# Processing requests.
|
||||
my $curl = create_curl $options{h};
|
||||
undef $/; # For reading whole files.
|
||||
REQUEST: foreach (@ARGV) {
|
||||
my $input = $_;
|
||||
my ($base, $path) = fileparse($input, '\.[^.]*');
|
||||
my $output_base = $base . $options{e};
|
||||
my $output = defined($options{o}) ? $options{o} : $path . $output_base;
|
||||
|
||||
STDERR->printflush("$input: ") if $options{v};
|
||||
# Read request.
|
||||
my $body;
|
||||
if ($input eq "-") {
|
||||
# Read the request from STDIN;
|
||||
$body = <STDIN>;
|
||||
} else {
|
||||
# Read the request from file.
|
||||
open INPUT, "<" . $input
|
||||
or warn("$input: could not open input file: $!\n"), next REQUEST;
|
||||
$body = <INPUT>;
|
||||
close INPUT
|
||||
or warn("$input: could not close input file: $!\n"), next REQUEST;
|
||||
}
|
||||
|
||||
# Send request.
|
||||
STDERR->printflush("sending request") if $options{v};
|
||||
|
||||
my ($ts_body, $error) = get_timestamp $curl, \$body;
|
||||
if (defined($error)) {
|
||||
die "$input: fatal error: $error\n";
|
||||
}
|
||||
STDERR->printflush(", reply received") if $options{v};
|
||||
|
||||
# Write response.
|
||||
if ($output eq "-") {
|
||||
# Write to STDOUT.
|
||||
print $ts_body;
|
||||
} else {
|
||||
# Write to file.
|
||||
open OUTPUT, ">", $output
|
||||
or warn("$output: could not open output file: $!\n"), next REQUEST;
|
||||
print OUTPUT $ts_body;
|
||||
close OUTPUT
|
||||
or warn("$output: could not close output file: $!\n"), next REQUEST;
|
||||
}
|
||||
STDERR->printflush(", $output written.\n") if $options{v};
|
||||
}
|
||||
$curl->cleanup();
|
||||
WWW::Curl::Easy::global_cleanup();
|
@ -70,8 +70,9 @@
|
||||
#define PROG verify_main
|
||||
|
||||
static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx);
|
||||
static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X509) *tchain, int purpose, ENGINE *e);
|
||||
static STACK_OF(X509) *load_untrusted(char *file);
|
||||
static int check(X509_STORE *ctx, char *file,
|
||||
STACK_OF(X509) *uchain, STACK_OF(X509) *tchain,
|
||||
STACK_OF(X509_CRL) *crls, ENGINE *e);
|
||||
static int v_verbose=0, vflags = 0;
|
||||
|
||||
int MAIN(int, char **);
|
||||
@ -80,10 +81,10 @@ int MAIN(int argc, char **argv)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
int i,ret=1, badarg = 0;
|
||||
int purpose = -1;
|
||||
char *CApath=NULL,*CAfile=NULL;
|
||||
char *untfile = NULL, *trustfile = NULL;
|
||||
char *untfile = NULL, *trustfile = NULL, *crlfile = NULL;
|
||||
STACK_OF(X509) *untrusted = NULL, *trusted = NULL;
|
||||
STACK_OF(X509_CRL) *crls = NULL;
|
||||
X509_STORE *cert_ctx=NULL;
|
||||
X509_LOOKUP *lookup=NULL;
|
||||
X509_VERIFY_PARAM *vpm = NULL;
|
||||
@ -93,7 +94,7 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
cert_ctx=X509_STORE_new();
|
||||
if (cert_ctx == NULL) goto end;
|
||||
X509_STORE_set_verify_cb_func(cert_ctx,cb);
|
||||
X509_STORE_set_verify_cb(cert_ctx,cb);
|
||||
|
||||
ERR_load_crypto_strings();
|
||||
|
||||
@ -139,6 +140,11 @@ int MAIN(int argc, char **argv)
|
||||
if (argc-- < 1) goto end;
|
||||
trustfile= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-CRLfile") == 0)
|
||||
{
|
||||
if (argc-- < 1) goto end;
|
||||
crlfile= *(++argv);
|
||||
}
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
else if (strcmp(*argv,"-engine") == 0)
|
||||
{
|
||||
@ -192,30 +198,39 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
ERR_clear_error();
|
||||
|
||||
if(untfile) {
|
||||
if(!(untrusted = load_untrusted(untfile))) {
|
||||
BIO_printf(bio_err, "Error loading untrusted file %s\n", untfile);
|
||||
ERR_print_errors(bio_err);
|
||||
if(untfile)
|
||||
{
|
||||
untrusted = load_certs(bio_err, untfile, FORMAT_PEM,
|
||||
NULL, e, "untrusted certificates");
|
||||
if(!untrusted)
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if(trustfile) {
|
||||
if(!(trusted = load_untrusted(trustfile))) {
|
||||
BIO_printf(bio_err, "Error loading untrusted file %s\n", trustfile);
|
||||
ERR_print_errors(bio_err);
|
||||
if(trustfile)
|
||||
{
|
||||
trusted = load_certs(bio_err, trustfile, FORMAT_PEM,
|
||||
NULL, e, "trusted certificates");
|
||||
if(!trusted)
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) check(cert_ctx, NULL, untrusted, trusted, purpose, e);
|
||||
if(crlfile)
|
||||
{
|
||||
crls = load_crls(bio_err, crlfile, FORMAT_PEM,
|
||||
NULL, e, "other CRLs");
|
||||
if(!crls)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (argc < 1) check(cert_ctx, NULL, untrusted, trusted, crls, e);
|
||||
else
|
||||
for (i=0; i<argc; i++)
|
||||
check(cert_ctx,argv[i], untrusted, trusted, purpose, e);
|
||||
check(cert_ctx,argv[i], untrusted, trusted, crls, e);
|
||||
ret=0;
|
||||
end:
|
||||
if (ret == 1) {
|
||||
BIO_printf(bio_err,"usage: verify [-verbose] [-CApath path] [-CAfile file] [-purpose purpose] [-crl_check]");
|
||||
BIO_printf(bio_err," [-attime timestamp]");
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
BIO_printf(bio_err," [-engine e]");
|
||||
#endif
|
||||
@ -232,11 +247,14 @@ int MAIN(int argc, char **argv)
|
||||
if (cert_ctx != NULL) X509_STORE_free(cert_ctx);
|
||||
sk_X509_pop_free(untrusted, X509_free);
|
||||
sk_X509_pop_free(trusted, X509_free);
|
||||
sk_X509_CRL_pop_free(crls, X509_CRL_free);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X509) *tchain, int purpose, ENGINE *e)
|
||||
static int check(X509_STORE *ctx, char *file,
|
||||
STACK_OF(X509) *uchain, STACK_OF(X509) *tchain,
|
||||
STACK_OF(X509_CRL) *crls, ENGINE *e)
|
||||
{
|
||||
X509 *x=NULL;
|
||||
int i=0,ret=0;
|
||||
@ -260,7 +278,8 @@ static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X
|
||||
goto end;
|
||||
}
|
||||
if(tchain) X509_STORE_CTX_trusted_stack(csc, tchain);
|
||||
if(purpose >= 0) X509_STORE_CTX_set_purpose(csc, purpose);
|
||||
if (crls)
|
||||
X509_STORE_CTX_set0_crls(csc, crls);
|
||||
i=X509_verify_cert(csc);
|
||||
X509_STORE_CTX_free(csc);
|
||||
|
||||
@ -278,90 +297,53 @@ static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static STACK_OF(X509) *load_untrusted(char *certfile)
|
||||
{
|
||||
STACK_OF(X509_INFO) *sk=NULL;
|
||||
STACK_OF(X509) *stack=NULL, *ret=NULL;
|
||||
BIO *in=NULL;
|
||||
X509_INFO *xi;
|
||||
|
||||
if(!(stack = sk_X509_new_null())) {
|
||||
BIO_printf(bio_err,"memory allocation failure\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if(!(in=BIO_new_file(certfile, "r"))) {
|
||||
BIO_printf(bio_err,"error opening the file, %s\n",certfile);
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* This loads from a file, a stack of x509/crl/pkey sets */
|
||||
if(!(sk=PEM_X509_INFO_read_bio(in,NULL,NULL,NULL))) {
|
||||
BIO_printf(bio_err,"error reading the file, %s\n",certfile);
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* scan over it and pull out the certs */
|
||||
while (sk_X509_INFO_num(sk))
|
||||
{
|
||||
xi=sk_X509_INFO_shift(sk);
|
||||
if (xi->x509 != NULL)
|
||||
{
|
||||
sk_X509_push(stack,xi->x509);
|
||||
xi->x509=NULL;
|
||||
}
|
||||
X509_INFO_free(xi);
|
||||
}
|
||||
if(!sk_X509_num(stack)) {
|
||||
BIO_printf(bio_err,"no certificates in file, %s\n",certfile);
|
||||
sk_X509_free(stack);
|
||||
goto end;
|
||||
}
|
||||
ret=stack;
|
||||
end:
|
||||
BIO_free(in);
|
||||
sk_X509_INFO_free(sk);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx)
|
||||
{
|
||||
char buf[256];
|
||||
int cert_error = X509_STORE_CTX_get_error(ctx);
|
||||
X509 *current_cert = X509_STORE_CTX_get_current_cert(ctx);
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
if (ctx->current_cert)
|
||||
if (current_cert)
|
||||
{
|
||||
X509_NAME_oneline(
|
||||
X509_get_subject_name(ctx->current_cert),buf,
|
||||
sizeof buf);
|
||||
printf("%s\n",buf);
|
||||
X509_NAME_print_ex_fp(stdout,
|
||||
X509_get_subject_name(current_cert),
|
||||
0, XN_FLAG_ONELINE);
|
||||
printf("\n");
|
||||
}
|
||||
printf("%serror %d at %d depth lookup:%s\n",
|
||||
X509_STORE_CTX_get0_parent_ctx(ctx) ? "[CRL path]" : "",
|
||||
cert_error,
|
||||
X509_STORE_CTX_get_error_depth(ctx),
|
||||
X509_verify_cert_error_string(cert_error));
|
||||
switch(cert_error)
|
||||
{
|
||||
case X509_V_ERR_NO_EXPLICIT_POLICY:
|
||||
policies_print(NULL, ctx);
|
||||
case X509_V_ERR_CERT_HAS_EXPIRED:
|
||||
|
||||
/* since we are just checking the certificates, it is
|
||||
* ok if they are self signed. But we should still warn
|
||||
* the user.
|
||||
*/
|
||||
|
||||
case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
|
||||
/* Continue after extension errors too */
|
||||
case X509_V_ERR_INVALID_CA:
|
||||
case X509_V_ERR_INVALID_NON_CA:
|
||||
case X509_V_ERR_PATH_LENGTH_EXCEEDED:
|
||||
case X509_V_ERR_INVALID_PURPOSE:
|
||||
case X509_V_ERR_CRL_HAS_EXPIRED:
|
||||
case X509_V_ERR_CRL_NOT_YET_VALID:
|
||||
case X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION:
|
||||
ok = 1;
|
||||
|
||||
}
|
||||
printf("error %d at %d depth lookup:%s\n",ctx->error,
|
||||
ctx->error_depth,
|
||||
X509_verify_cert_error_string(ctx->error));
|
||||
if (ctx->error == X509_V_ERR_CERT_HAS_EXPIRED) ok=1;
|
||||
/* since we are just checking the certificates, it is
|
||||
* ok if they are self signed. But we should still warn
|
||||
* the user.
|
||||
*/
|
||||
if (ctx->error == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) ok=1;
|
||||
/* Continue after extension errors too */
|
||||
if (ctx->error == X509_V_ERR_INVALID_CA) ok=1;
|
||||
if (ctx->error == X509_V_ERR_INVALID_NON_CA) ok=1;
|
||||
if (ctx->error == X509_V_ERR_PATH_LENGTH_EXCEEDED) ok=1;
|
||||
if (ctx->error == X509_V_ERR_INVALID_PURPOSE) ok=1;
|
||||
if (ctx->error == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) ok=1;
|
||||
if (ctx->error == X509_V_ERR_CRL_HAS_EXPIRED) ok=1;
|
||||
if (ctx->error == X509_V_ERR_CRL_NOT_YET_VALID) ok=1;
|
||||
if (ctx->error == X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION) ok=1;
|
||||
|
||||
if (ctx->error == X509_V_ERR_NO_EXPLICIT_POLICY)
|
||||
policies_print(NULL, ctx);
|
||||
return ok;
|
||||
|
||||
}
|
||||
if ((ctx->error == X509_V_OK) && (ok == 2))
|
||||
if (cert_error == X509_V_OK && ok == 2)
|
||||
policies_print(NULL, ctx);
|
||||
if (!v_verbose)
|
||||
ERR_clear_error();
|
||||
|
@ -1,148 +0,0 @@
|
||||
/* apps/winrand.c */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
|
||||
/* Usage: winrand [filename]
|
||||
*
|
||||
* Collects entropy from mouse movements and other events and writes
|
||||
* random data to filename or .rnd
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <openssl/opensslv.h>
|
||||
#include <openssl/rand.h>
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
const char *filename;
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
PSTR cmdline, int iCmdShow)
|
||||
{
|
||||
static char appname[] = "OpenSSL";
|
||||
HWND hwnd;
|
||||
MSG msg;
|
||||
WNDCLASSEX wndclass;
|
||||
char buffer[200];
|
||||
|
||||
if (cmdline[0] == '\0')
|
||||
filename = RAND_file_name(buffer, sizeof buffer);
|
||||
else
|
||||
filename = cmdline;
|
||||
|
||||
RAND_load_file(filename, -1);
|
||||
|
||||
wndclass.cbSize = sizeof(wndclass);
|
||||
wndclass.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wndclass.lpfnWndProc = WndProc;
|
||||
wndclass.cbClsExtra = 0;
|
||||
wndclass.cbWndExtra = 0;
|
||||
wndclass.hInstance = hInstance;
|
||||
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
|
||||
wndclass.lpszMenuName = NULL;
|
||||
wndclass.lpszClassName = appname;
|
||||
wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
|
||||
RegisterClassEx(&wndclass);
|
||||
|
||||
hwnd = CreateWindow(appname, OPENSSL_VERSION_TEXT,
|
||||
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
|
||||
|
||||
ShowWindow(hwnd, iCmdShow);
|
||||
UpdateWindow(hwnd);
|
||||
|
||||
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
return msg.wParam;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HDC hdc;
|
||||
PAINTSTRUCT ps;
|
||||
RECT rect;
|
||||
static int seeded = 0;
|
||||
|
||||
switch (iMsg)
|
||||
{
|
||||
case WM_PAINT:
|
||||
hdc = BeginPaint(hwnd, &ps);
|
||||
GetClientRect(hwnd, &rect);
|
||||
DrawText(hdc, "Seeding the PRNG. Please move the mouse!", -1,
|
||||
&rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
EndPaint(hwnd, &ps);
|
||||
return 0;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (RAND_event(iMsg, wParam, lParam) == 1 && seeded == 0)
|
||||
{
|
||||
seeded = 1;
|
||||
if (RAND_write_file(filename) <= 0)
|
||||
MessageBox(hwnd, "Couldn't write random file!",
|
||||
"OpenSSL", MB_OK | MB_ICONERROR);
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
|
||||
return DefWindowProc(hwnd, iMsg, wParam, lParam);
|
||||
}
|
@ -99,7 +99,13 @@ static const char *x509_usage[]={
|
||||
" -passin arg - private key password source\n",
|
||||
" -serial - print serial number value\n",
|
||||
" -subject_hash - print subject hash value\n",
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
" -subject_hash_old - print old-style (MD5) subject hash value\n",
|
||||
#endif
|
||||
" -issuer_hash - print issuer hash value\n",
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
" -issuer_hash_old - print old-style (MD5) issuer hash value\n",
|
||||
#endif
|
||||
" -hash - synonym for -subject_hash\n",
|
||||
" -subject - print subject DN\n",
|
||||
" -issuer - print issuer DN\n",
|
||||
@ -151,9 +157,10 @@ static int MS_CALLBACK callb(int ok, X509_STORE_CTX *ctx);
|
||||
static int sign (X509 *x, EVP_PKEY *pkey,int days,int clrext, const EVP_MD *digest,
|
||||
CONF *conf, char *section);
|
||||
static int x509_certify (X509_STORE *ctx,char *CAfile,const EVP_MD *digest,
|
||||
X509 *x,X509 *xca,EVP_PKEY *pkey,char *serial,
|
||||
int create,int days, int clrext, CONF *conf, char *section,
|
||||
ASN1_INTEGER *sno);
|
||||
X509 *x,X509 *xca,EVP_PKEY *pkey,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
char *serial, int create ,int days, int clrext,
|
||||
CONF *conf, char *section, ASN1_INTEGER *sno);
|
||||
static int purpose_print(BIO *bio, X509 *cert, X509_PURPOSE *pt);
|
||||
static int reqfile=0;
|
||||
|
||||
@ -166,6 +173,7 @@ int MAIN(int argc, char **argv)
|
||||
X509_REQ *req=NULL;
|
||||
X509 *x=NULL,*xca=NULL;
|
||||
ASN1_OBJECT *objtmp;
|
||||
STACK_OF(OPENSSL_STRING) *sigopts = NULL;
|
||||
EVP_PKEY *Upkey=NULL,*CApkey=NULL;
|
||||
ASN1_INTEGER *sno = NULL;
|
||||
int i,num,badops=0;
|
||||
@ -179,6 +187,9 @@ int MAIN(int argc, char **argv)
|
||||
int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0;
|
||||
int next_serial=0;
|
||||
int subject_hash=0,issuer_hash=0,ocspid=0;
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
int subject_hash_old=0,issuer_hash_old=0;
|
||||
#endif
|
||||
int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0;
|
||||
int ocsp_uri=0;
|
||||
int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0;
|
||||
@ -190,7 +201,7 @@ int MAIN(int argc, char **argv)
|
||||
X509_REQ *rq=NULL;
|
||||
int fingerprint=0;
|
||||
char buf[256];
|
||||
const EVP_MD *md_alg,*digest=EVP_sha1();
|
||||
const EVP_MD *md_alg,*digest=NULL;
|
||||
CONF *extconf = NULL;
|
||||
char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;
|
||||
int need_rand = 0;
|
||||
@ -225,7 +236,7 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
ctx=X509_STORE_new();
|
||||
if (ctx == NULL) goto end;
|
||||
X509_STORE_set_verify_cb_func(ctx,callb);
|
||||
X509_STORE_set_verify_cb(ctx,callb);
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
@ -262,6 +273,15 @@ int MAIN(int argc, char **argv)
|
||||
if (--argc < 1) goto bad;
|
||||
CAkeyformat=str2fmt(*(++argv));
|
||||
}
|
||||
else if (strcmp(*argv,"-sigopt") == 0)
|
||||
{
|
||||
if (--argc < 1)
|
||||
goto bad;
|
||||
if (!sigopts)
|
||||
sigopts = sk_OPENSSL_STRING_new_null();
|
||||
if (!sigopts || !sk_OPENSSL_STRING_push(sigopts, *(++argv)))
|
||||
goto bad;
|
||||
}
|
||||
else if (strcmp(*argv,"-days") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
@ -397,8 +417,16 @@ int MAIN(int argc, char **argv)
|
||||
else if (strcmp(*argv,"-hash") == 0
|
||||
|| strcmp(*argv,"-subject_hash") == 0)
|
||||
subject_hash= ++num;
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
else if (strcmp(*argv,"-subject_hash_old") == 0)
|
||||
subject_hash_old= ++num;
|
||||
#endif
|
||||
else if (strcmp(*argv,"-issuer_hash") == 0)
|
||||
issuer_hash= ++num;
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
else if (strcmp(*argv,"-issuer_hash_old") == 0)
|
||||
issuer_hash_old= ++num;
|
||||
#endif
|
||||
else if (strcmp(*argv,"-subject") == 0)
|
||||
subject= ++num;
|
||||
else if (strcmp(*argv,"-issuer") == 0)
|
||||
@ -624,7 +652,7 @@ int MAIN(int argc, char **argv)
|
||||
if (!X509_set_subject_name(x,req->req_info->subject)) goto end;
|
||||
|
||||
X509_gmtime_adj(X509_get_notBefore(x),0);
|
||||
X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days);
|
||||
X509_time_adj_ex(X509_get_notAfter(x),days, 0, NULL);
|
||||
|
||||
pkey = X509_REQ_get_pubkey(req);
|
||||
X509_set_pubkey(x,pkey);
|
||||
@ -736,13 +764,14 @@ int MAIN(int argc, char **argv)
|
||||
else if ((email == i) || (ocsp_uri == i))
|
||||
{
|
||||
int j;
|
||||
STACK *emlst;
|
||||
STACK_OF(OPENSSL_STRING) *emlst;
|
||||
if (email == i)
|
||||
emlst = X509_get1_email(x);
|
||||
else
|
||||
emlst = X509_get1_ocsp(x);
|
||||
for (j = 0; j < sk_num(emlst); j++)
|
||||
BIO_printf(STDout, "%s\n", sk_value(emlst, j));
|
||||
for (j = 0; j < sk_OPENSSL_STRING_num(emlst); j++)
|
||||
BIO_printf(STDout, "%s\n",
|
||||
sk_OPENSSL_STRING_value(emlst, j));
|
||||
X509_email_free(emlst);
|
||||
}
|
||||
else if (aliasout == i)
|
||||
@ -756,10 +785,22 @@ int MAIN(int argc, char **argv)
|
||||
{
|
||||
BIO_printf(STDout,"%08lx\n",X509_subject_name_hash(x));
|
||||
}
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
else if (subject_hash_old == i)
|
||||
{
|
||||
BIO_printf(STDout,"%08lx\n",X509_subject_name_hash_old(x));
|
||||
}
|
||||
#endif
|
||||
else if (issuer_hash == i)
|
||||
{
|
||||
BIO_printf(STDout,"%08lx\n",X509_issuer_name_hash(x));
|
||||
}
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
else if (issuer_hash_old == i)
|
||||
{
|
||||
BIO_printf(STDout,"%08lx\n",X509_issuer_name_hash_old(x));
|
||||
}
|
||||
#endif
|
||||
else if (pprint == i)
|
||||
{
|
||||
X509_PURPOSE *ptmp;
|
||||
@ -890,14 +931,18 @@ int MAIN(int argc, char **argv)
|
||||
int j;
|
||||
unsigned int n;
|
||||
unsigned char md[EVP_MAX_MD_SIZE];
|
||||
const EVP_MD *fdig = digest;
|
||||
|
||||
if (!X509_digest(x,digest,md,&n))
|
||||
if (!fdig)
|
||||
fdig = EVP_sha1();
|
||||
|
||||
if (!X509_digest(x,fdig,md,&n))
|
||||
{
|
||||
BIO_printf(bio_err,"out of memory\n");
|
||||
goto end;
|
||||
}
|
||||
BIO_printf(STDout,"%s Fingerprint=",
|
||||
OBJ_nid2sn(EVP_MD_type(digest)));
|
||||
OBJ_nid2sn(EVP_MD_type(fdig)));
|
||||
for (j=0; j<(int)n; j++)
|
||||
{
|
||||
BIO_printf(STDout,"%02X%c",md[j],
|
||||
@ -917,14 +962,6 @@ int MAIN(int argc, char **argv)
|
||||
passin, e, "Private key");
|
||||
if (Upkey == NULL) goto end;
|
||||
}
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
if (Upkey->type == EVP_PKEY_DSA)
|
||||
digest=EVP_dss1();
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (Upkey->type == EVP_PKEY_EC)
|
||||
digest=EVP_ecdsa();
|
||||
#endif
|
||||
|
||||
assert(need_rand);
|
||||
if (!sign(x,Upkey,days,clrext,digest,
|
||||
@ -941,18 +978,11 @@ int MAIN(int argc, char **argv)
|
||||
"CA Private Key");
|
||||
if (CApkey == NULL) goto end;
|
||||
}
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
if (CApkey->type == EVP_PKEY_DSA)
|
||||
digest=EVP_dss1();
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (CApkey->type == EVP_PKEY_EC)
|
||||
digest = EVP_ecdsa();
|
||||
#endif
|
||||
|
||||
assert(need_rand);
|
||||
if (!x509_certify(ctx,CAfile,digest,x,xca,
|
||||
CApkey, CAserial,CA_createserial,days, clrext,
|
||||
CApkey, sigopts,
|
||||
CAserial,CA_createserial,days, clrext,
|
||||
extconf, extsect, sno))
|
||||
goto end;
|
||||
}
|
||||
@ -976,15 +1006,6 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
BIO_printf(bio_err,"Generating certificate request\n");
|
||||
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
if (pk->type == EVP_PKEY_DSA)
|
||||
digest=EVP_dss1();
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (pk->type == EVP_PKEY_EC)
|
||||
digest=EVP_ecdsa();
|
||||
#endif
|
||||
|
||||
rq=X509_to_X509_REQ(x,pk,digest);
|
||||
EVP_PKEY_free(pk);
|
||||
if (rq == NULL)
|
||||
@ -1038,16 +1059,15 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
else if (outformat == FORMAT_NETSCAPE)
|
||||
{
|
||||
ASN1_HEADER ah;
|
||||
ASN1_OCTET_STRING os;
|
||||
NETSCAPE_X509 nx;
|
||||
ASN1_OCTET_STRING hdr;
|
||||
|
||||
os.data=(unsigned char *)NETSCAPE_CERT_HDR;
|
||||
os.length=strlen(NETSCAPE_CERT_HDR);
|
||||
ah.header= &os;
|
||||
ah.data=(char *)x;
|
||||
ah.meth=X509_asn1_meth();
|
||||
hdr.data=(unsigned char *)NETSCAPE_CERT_HDR;
|
||||
hdr.length=strlen(NETSCAPE_CERT_HDR);
|
||||
nx.header= &hdr;
|
||||
nx.cert=x;
|
||||
|
||||
i=ASN1_i2d_bio_of(ASN1_HEADER,i2d_ASN1_HEADER,out,&ah);
|
||||
i=ASN1_item_i2d_bio(ASN1_ITEM_rptr(NETSCAPE_X509),out,&nx);
|
||||
}
|
||||
else {
|
||||
BIO_printf(bio_err,"bad output format specified for outfile\n");
|
||||
@ -1073,6 +1093,8 @@ int MAIN(int argc, char **argv)
|
||||
X509_free(xca);
|
||||
EVP_PKEY_free(Upkey);
|
||||
EVP_PKEY_free(CApkey);
|
||||
if (sigopts)
|
||||
sk_OPENSSL_STRING_free(sigopts);
|
||||
X509_REQ_free(rq);
|
||||
ASN1_INTEGER_free(sno);
|
||||
sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free);
|
||||
@ -1123,8 +1145,11 @@ static ASN1_INTEGER *x509_load_serial(char *CAfile, char *serialfile, int create
|
||||
}
|
||||
|
||||
static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
|
||||
X509 *x, X509 *xca, EVP_PKEY *pkey, char *serialfile, int create,
|
||||
int days, int clrext, CONF *conf, char *section, ASN1_INTEGER *sno)
|
||||
X509 *x, X509 *xca, EVP_PKEY *pkey,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
char *serialfile, int create,
|
||||
int days, int clrext, CONF *conf, char *section,
|
||||
ASN1_INTEGER *sno)
|
||||
{
|
||||
int ret=0;
|
||||
ASN1_INTEGER *bs=NULL;
|
||||
@ -1166,7 +1191,7 @@ static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
|
||||
goto end;
|
||||
|
||||
/* hardwired expired */
|
||||
if (X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days) == NULL)
|
||||
if (X509_time_adj_ex(X509_get_notAfter(x),days, 0, NULL) == NULL)
|
||||
goto end;
|
||||
|
||||
if (clrext)
|
||||
@ -1183,7 +1208,8 @@ static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
|
||||
if (!X509V3_EXT_add_nconf(conf, &ctx2, section, x)) goto end;
|
||||
}
|
||||
|
||||
if (!X509_sign(x,pkey,digest)) goto end;
|
||||
if (!do_X509_sign(bio_err, x, pkey, digest, sigopts))
|
||||
goto end;
|
||||
ret=1;
|
||||
end:
|
||||
X509_STORE_CTX_cleanup(&xsc);
|
||||
|
@ -1,7 +0,0 @@
|
||||
If you use the function that does an fopen inside the DLL, it's malloc
|
||||
will be used and when the function is then written inside, more
|
||||
hassles
|
||||
....
|
||||
|
||||
|
||||
think about it.
|
@ -1,49 +0,0 @@
|
||||
So far...
|
||||
|
||||
ssl3.netscape.com:443 does not support client side dynamic
|
||||
session-renegotiation.
|
||||
|
||||
ssl3.netscape.com:444 (asks for client cert) sends out all the CA RDN
|
||||
in an invalid format (the outer sequence is removed).
|
||||
|
||||
Netscape-Commerce/1.12, when talking SSLv2, accepts a 32 byte
|
||||
challenge but then appears to only use 16 bytes when generating the
|
||||
encryption keys. Using 16 bytes is ok but it should be ok to use 32.
|
||||
According to the SSLv3 spec, one should use 32 bytes for the challenge
|
||||
when opperating in SSLv2/v3 compatablity mode, but as mentioned above,
|
||||
this breaks this server so 16 bytes is the way to go.
|
||||
|
||||
www.microsoft.com - when talking SSLv2, if session-id reuse is
|
||||
performed, the session-id passed back in the server-finished message
|
||||
is different from the one decided upon.
|
||||
|
||||
ssl3.netscape.com:443, first a connection is established with RC4-MD5.
|
||||
If it is then resumed, we end up using DES-CBC3-SHA. It should be
|
||||
RC4-MD5 according to 7.6.1.3, 'cipher_suite'.
|
||||
Netscape-Enterprise/2.01 (https://merchant.netscape.com) has this bug.
|
||||
It only really shows up when connecting via SSLv2/v3 then reconnecting
|
||||
via SSLv3. The cipher list changes....
|
||||
NEW INFORMATION. Try connecting with a cipher list of just
|
||||
DES-CBC-SHA:RC4-MD5. For some weird reason, each new connection uses
|
||||
RC4-MD5, but a re-connect tries to use DES-CBC-SHA. So netscape, when
|
||||
doing a re-connect, always takes the first cipher in the cipher list.
|
||||
|
||||
If we accept a netscape connection, demand a client cert, have a
|
||||
non-self-signed CA which does not have it's CA in netscape, and the
|
||||
browser has a cert, it will crash/hang. Works for 3.x and 4.xbeta
|
||||
|
||||
Netscape browsers do not really notice the server sending a
|
||||
close notify message. I was sending one, and then some invalid data.
|
||||
netscape complained of an invalid mac. (a fork()ed child doing a
|
||||
SSL_shutdown() and still sharing the socket with its parent).
|
||||
|
||||
Netscape, when using export ciphers, will accept a 1024 bit temporary
|
||||
RSA key. It is supposed to only accept 512.
|
||||
|
||||
If Netscape connects to a server which requests a client certificate
|
||||
it will frequently hang after the user has selected one and never
|
||||
complete the connection. Hitting "Stop" and reload fixes this and
|
||||
all subsequent connections work fine. This appears to be because
|
||||
Netscape wont read any new records in when it is awaiting a server
|
||||
done message at this point. The fix is to send the certificate request
|
||||
and server done messages in one record.
|
@ -1,91 +0,0 @@
|
||||
/* bugs/alpha.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
/* while not exactly a bug (ASN1 C leaves this undefined) it is
|
||||
* something to watch out for. This was fine on linux/NT/Solaris but not
|
||||
* Alpha */
|
||||
|
||||
/* it is basically an example of
|
||||
* func(*(a++),*(a++))
|
||||
* which parameter is evaluated first? It is not defined in ASN1 C.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define TYPE unsigned int
|
||||
|
||||
void func(a,b)
|
||||
TYPE *a;
|
||||
TYPE b;
|
||||
{
|
||||
printf("%ld -1 == %ld\n",a[0],b);
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
TYPE data[5]={1L,2L,3L,4L,5L};
|
||||
TYPE *p;
|
||||
int i;
|
||||
|
||||
p=data;
|
||||
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
func(p,*(p++));
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/* NOCW */
|
||||
/* dggccbug.c */
|
||||
/* bug found by Eric Young (eay@cryptsoft.com) - May 1995 */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* There is a bug in
|
||||
* gcc version 2.5.8 (88open OCS/BCS, DG-2.5.8.3, Oct 14 1994)
|
||||
* as shipped with DGUX 5.4R3.10 that can be bypassed by defining
|
||||
* DG_GCC_BUG in my code.
|
||||
* The bug manifests itself by the vaule of a pointer that is
|
||||
* used only by reference, not having it's value change when it is used
|
||||
* to check for exiting the loop. Probably caused by there being 2
|
||||
* copies of the valiable, one in a register and one being an address
|
||||
* that is passed. */
|
||||
|
||||
/* compare the out put from
|
||||
* gcc dggccbug.c; ./a.out
|
||||
* and
|
||||
* gcc -O dggccbug.c; ./a.out
|
||||
* compile with -DFIXBUG to remove the bug when optimising.
|
||||
*/
|
||||
|
||||
void inc(a)
|
||||
int *a;
|
||||
{
|
||||
(*a)++;
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
int p=0;
|
||||
#ifdef FIXBUG
|
||||
int dummy;
|
||||
#endif
|
||||
|
||||
while (p<3)
|
||||
{
|
||||
fprintf(stderr,"%08X\n",p);
|
||||
inc(&p);
|
||||
#ifdef FIXBUG
|
||||
dummy+=p;
|
||||
#endif
|
||||
}
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/* NOCW */
|
||||
/* sgibug.c */
|
||||
/* bug found by Eric Young (eay@mincom.oz.au) May 95 */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* This compiler bug it present on IRIX 5.3, 5.1 and 4.0.5 (these are
|
||||
* the only versions of IRIX I have access to.
|
||||
* defining FIXBUG removes the bug.
|
||||
* (bug is still present in IRIX 6.3 according to
|
||||
* Gage <agage@forgetmenot.Mines.EDU>
|
||||
*/
|
||||
|
||||
/* Compare the output from
|
||||
* cc sgiccbug.c; ./a.out
|
||||
* and
|
||||
* cc -O sgiccbug.c; ./a.out
|
||||
*/
|
||||
|
||||
static unsigned long a[4]={0x01234567,0x89ABCDEF,0xFEDCBA98,0x76543210};
|
||||
static unsigned long b[4]={0x89ABCDEF,0xFEDCBA98,0x76543210,0x01234567};
|
||||
static unsigned long c[4]={0x77777778,0x8ACF1357,0x88888888,0x7530ECA9};
|
||||
|
||||
main()
|
||||
{
|
||||
unsigned long r[4];
|
||||
sub(r,a,b);
|
||||
fprintf(stderr,"input a= %08X %08X %08X %08X\n",a[3],a[2],a[1],a[0]);
|
||||
fprintf(stderr,"input b= %08X %08X %08X %08X\n",b[3],b[2],b[1],b[0]);
|
||||
fprintf(stderr,"output = %08X %08X %08X %08X\n",r[3],r[2],r[1],r[0]);
|
||||
fprintf(stderr,"correct= %08X %08X %08X %08X\n",c[3],c[2],c[1],c[0]);
|
||||
}
|
||||
|
||||
int sub(r,a,b)
|
||||
unsigned long *r,*a,*b;
|
||||
{
|
||||
register unsigned long t1,t2,*ap,*bp,*rp;
|
||||
int i,carry;
|
||||
#ifdef FIXBUG
|
||||
unsigned long dummy;
|
||||
#endif
|
||||
|
||||
ap=a;
|
||||
bp=b;
|
||||
rp=r;
|
||||
carry=0;
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
t1= *(ap++);
|
||||
t2= *(bp++);
|
||||
t1=(t1-t2);
|
||||
#ifdef FIXBUG
|
||||
dummy=t1;
|
||||
#endif
|
||||
*(rp++)=t1&0xffffffff;
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
The February 9th, 1995 version of the SSL document differs from
|
||||
https://www.netscape.com in the following ways.
|
||||
=====
|
||||
The key material for generating a SSL_CK_DES_64_CBC_WITH_MD5 key is
|
||||
KEY-MATERIAL-0 = MD5[MASTER-KEY,"0",CHALLENGE,CONNECTION-ID]
|
||||
not
|
||||
KEY-MATERIAL-0 = MD5[MASTER-KEY,CHALLENGE,CONNECTION-ID]
|
||||
as specified in the documentation.
|
||||
=====
|
||||
From the section 2.6 Server Only Protocol Messages
|
||||
|
||||
If the SESSION-ID-HIT flag is non-zero then the CERTIFICATE-TYPE,
|
||||
CERTIFICATE-LENGTH and CIPHER-SPECS-LENGTH fields will be zero.
|
||||
|
||||
This is not true for https://www.netscape.com. The CERTIFICATE-TYPE
|
||||
is returned as 1.
|
||||
=====
|
||||
I have not tested the following but it is reported by holtzman@mit.edu.
|
||||
|
||||
SSLref clients wait to recieve a server-verify before they send a
|
||||
client-finished. Besides this not being evident from the examples in
|
||||
2.2.1, it makes more sense to always send all packets you can before
|
||||
reading. SSLeay was waiting in the server to recieve a client-finish
|
||||
before sending the server-verify :-). I have changed SSLeay to send a
|
||||
server-verify before trying to read the client-finished.
|
||||
|
@ -1,131 +0,0 @@
|
||||
/* bugs/stream.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <openssl/rc4.h>
|
||||
#ifdef OPENSSL_NO_DES
|
||||
#include <des.h>
|
||||
#else
|
||||
#include <openssl/des.h>
|
||||
#endif
|
||||
|
||||
/* show how stream ciphers are not very good. The mac has no affect
|
||||
* on RC4 while it does for cfb DES
|
||||
*/
|
||||
|
||||
main()
|
||||
{
|
||||
fprintf(stderr,"rc4\n");
|
||||
rc4();
|
||||
fprintf(stderr,"cfb des\n");
|
||||
des();
|
||||
}
|
||||
|
||||
int des()
|
||||
{
|
||||
des_key_schedule ks;
|
||||
des_cblock iv,key;
|
||||
int num;
|
||||
static char *keystr="01234567";
|
||||
static char *in1="0123456789ABCEDFdata 12345";
|
||||
static char *in2="9876543210abcdefdata 12345";
|
||||
unsigned char out[100];
|
||||
int i;
|
||||
|
||||
des_set_key((des_cblock *)keystr,ks);
|
||||
|
||||
num=0;
|
||||
memset(iv,0,8);
|
||||
des_cfb64_encrypt(in1,out,26,ks,(des_cblock *)iv,&num,1);
|
||||
for (i=0; i<26; i++)
|
||||
fprintf(stderr,"%02X ",out[i]);
|
||||
fprintf(stderr,"\n");
|
||||
|
||||
num=0;
|
||||
memset(iv,0,8);
|
||||
des_cfb64_encrypt(in2,out,26,ks,(des_cblock *)iv,&num,1);
|
||||
for (i=0; i<26; i++)
|
||||
fprintf(stderr,"%02X ",out[i]);
|
||||
fprintf(stderr,"\n");
|
||||
}
|
||||
|
||||
int rc4()
|
||||
{
|
||||
static char *keystr="0123456789abcdef";
|
||||
RC4_KEY key;
|
||||
unsigned char in[100],out[100];
|
||||
int i;
|
||||
|
||||
RC4_set_key(&key,16,keystr);
|
||||
in[0]='\0';
|
||||
strcpy(in,"0123456789ABCEDFdata 12345");
|
||||
RC4(key,26,in,out);
|
||||
|
||||
for (i=0; i<26; i++)
|
||||
fprintf(stderr,"%02X ",out[i]);
|
||||
fprintf(stderr,"\n");
|
||||
|
||||
RC4_set_key(&key,16,keystr);
|
||||
in[0]='\0';
|
||||
strcpy(in,"9876543210abcdefdata 12345");
|
||||
RC4(key,26,in,out);
|
||||
|
||||
for (i=0; i<26; i++)
|
||||
fprintf(stderr,"%02X ",out[i]);
|
||||
fprintf(stderr,"\n");
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
/* This is a cc optimiser bug for ultrix 4.3, mips CPU.
|
||||
* What happens is that the compiler, due to the (a)&7,
|
||||
* does
|
||||
* i=a&7;
|
||||
* i--;
|
||||
* i*=4;
|
||||
* Then uses i as the offset into a jump table.
|
||||
* The problem is that a value of 0 generates an offset of
|
||||
* 0xfffffffc.
|
||||
*/
|
||||
|
||||
main()
|
||||
{
|
||||
f(5);
|
||||
f(0);
|
||||
}
|
||||
|
||||
int f(a)
|
||||
int a;
|
||||
{
|
||||
switch(a&7)
|
||||
{
|
||||
case 7:
|
||||
printf("7\n");
|
||||
case 6:
|
||||
printf("6\n");
|
||||
case 5:
|
||||
printf("5\n");
|
||||
case 4:
|
||||
printf("4\n");
|
||||
case 3:
|
||||
printf("3\n");
|
||||
case 2:
|
||||
printf("2\n");
|
||||
case 1:
|
||||
printf("1\n");
|
||||
#ifdef FIX_BUG
|
||||
case 0:
|
||||
;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -1,33 +0,0 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIC5TCCAk6gAwIBAgIBATANBgkqhkiG9w0BAQQFADBcMQswCQYDVQQGEwJBVTET
|
||||
MBEGA1UECBMKUXVlZW5zbGFuZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQx
|
||||
HDAaBgNVBAMTE1Rlc3QgUENBICgxMDI0IGJpdCkwHhcNOTkxMjAyMjEzODUxWhcN
|
||||
MDUwNzEwMjEzODUxWjBbMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFu
|
||||
ZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxGzAZBgNVBAMTElRlc3QgQ0Eg
|
||||
KDEwMjQgYml0KTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAo7ujy3XXpU/p
|
||||
yDJtOxkMJmGv3mdiVm7JrdoKLUgqjO2rBaeNuYMUiuI6oYU+tlD6agwRML0Pn2JF
|
||||
b90VdK/UXrmRr9djaEuH17EIKjte5RwOzndCndsjcCYyoeODMTyg7dqPIkDMmRNM
|
||||
5R5xBTabD+Aji0wzQupYxBLuW5PLj7ECAwEAAaOBtzCBtDAdBgNVHQ4EFgQU1WWA
|
||||
U42mkhi3ecgey1dsJjU61+UwgYQGA1UdIwR9MHuAFE0RaEcrj18q1dw+G6nJbsTW
|
||||
R213oWCkXjBcMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDEaMBgG
|
||||
A1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxHDAaBgNVBAMTE1Rlc3QgUENBICgxMDI0
|
||||
IGJpdCmCAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQBb39BRphHL
|
||||
6aRAQyymsvBvPSCiG9+kR0R1L23aTpNbhXp2BebyFjbEQYZc2kWGiKKcHkNECA35
|
||||
3d4LoqUlVey8DFyafOIJd9hxdZfg+rxlHMxnL7uCJRmx9+xB411Jtsol9/wg1uCK
|
||||
sleGpgB4j8cG2SVCz7V2MNZNK+d5QCnR7A==
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXQIBAAKBgQCju6PLddelT+nIMm07GQwmYa/eZ2JWbsmt2gotSCqM7asFp425
|
||||
gxSK4jqhhT62UPpqDBEwvQ+fYkVv3RV0r9ReuZGv12NoS4fXsQgqO17lHA7Od0Kd
|
||||
2yNwJjKh44MxPKDt2o8iQMyZE0zlHnEFNpsP4COLTDNC6ljEEu5bk8uPsQIDAQAB
|
||||
AoGAVZmpFZsDZfr0l2S9tLLwpjRWNOlKATQkno6q2WesT0eGLQufTciY+c8ypfU6
|
||||
hyio8r5iUl/VhhdjhAtKx1mRpiotftHo/eYf8rtsrnprOnWG0bWjLjtIoMbcxGn2
|
||||
J3bN6LJmbJMjDs0eJ3KnTu646F3nDUw2oGAwmpzKXA1KAP0CQQDRvQhxk2D3Pehs
|
||||
HvG665u2pB5ipYQngEFlZO7RHJZzJOZEWSLuuMqaF/7pTfA5jiBvWqCgJeCRRInL
|
||||
21ru4dlPAkEAx9jj7BgKn5TYnMoBSSe0afjsV9oApVpN1Nacb1YDtCwy+scp3++s
|
||||
nFxlv98wxIlSdpwMUn+AUWfjiWR7Tu/G/wJBAJ/KjwZIrFVxewP0x2ILYsTRYLzz
|
||||
MS4PDsO7FB+I0i7DbBOifXS2oNSpd3I0CNMwrxFnUHzynpbOStVfN3ZL5w0CQQCa
|
||||
pwFahxBRhkJKsxhjoFJBX9yl75JoY4Wvm5Tbo9ih6UJaRx3kqfkN14L2BKYcsZgb
|
||||
KY9vmDOYy6iNfjDeWTfJAkBkfPUb8oTJ/nSP5zN6sqGxSY4krc4xLxpRmxoJ8HL2
|
||||
XfhqXkTzbU13RX9JJ/NZ8vQN9Vm2NhxRGJocQkmcdVtJ
|
||||
-----END RSA PRIVATE KEY-----
|
@ -1,43 +0,0 @@
|
||||
-----BEGIN DSA PRIVATE KEY-----
|
||||
Proc-Type: 4,ENCRYPTED
|
||||
DEK-Info: DES-EDE3-CBC,C5B6C7CC9E1FE2C0
|
||||
|
||||
svCXBcBRhMuU22UXOfiKZA+thmz6KYXpt1Yg5Rd+TYQcQ1MdvNy0B0tkP1SxzDq0
|
||||
Xh1eMeTML9/9/0rKakgNXXXbpi5RB8t6BmwRSyej89F7nn1mtR3qzoyPRpp15SDl
|
||||
Tn67C+2v+HDF3MFk88hiNCYkNbcmi7TWvChsl8N1r7wdZwtIox56yXdgxw6ZIpa/
|
||||
par0oUCzN7fiavPgCWz1kfPNSaBQSdxwH7TZi5tMHAr0J3C7a7QRnZfE09R59Uqr
|
||||
zslrq+ndIw1BZAxoY0SlBu+iFOVaBVlwToC4AsHkv7j7l8ITtr7f42YbBa44D9TO
|
||||
uOhONmkk/v3Fso4RaOEzdKZC+hnmmzvHs6TiTWm6yzJgSFwyOUK0eGmKEeVxpcH5
|
||||
rUOlHOwzen+FFtocZDZAfdFnb7QY7L/boQvyA5A+ZbRG4DUpmBQeQsSaICHM5Rxx
|
||||
1QaLF413VNPXTLPbW0ilSc2H8x2iZTIVKfd33oSO6NhXPtSYQgfecEF4BvNHY5c4
|
||||
HovjT4mckbK95bcBzoCHu43vuSQkmZzdYo/ydSZt6zoPavbBLueTpgSbdXiDi827
|
||||
MVqOsYxGCb+kez0FoDSTgw==
|
||||
-----END DSA PRIVATE KEY-----
|
||||
-----BEGIN CERTIFICATE REQUEST-----
|
||||
MIICUjCCAhECAQAwUjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUx
|
||||
ITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDELMAkGA1UEAxMCQ0Ew
|
||||
ggG0MIIBKQYFKw4DAgwwggEeAoGBAKc/boW/QWopffCfRxkwkJoJHdpqMx7FPYaW
|
||||
sxXgUy6P4FmCc5A+dTGZR3pS+4Xk2aZ7OJtoioSbh8YetX6GS1NbWc9xZRmIbs5m
|
||||
rmuINvvsKNzC16W75Sw5JkvamnAYlTeVEFYj9hXtugRe3jlP/bdDH7WkZW/NgBHk
|
||||
cJVbUM1JAhUA9wcx7fpsBgPVhYocrJxl51BmZW8CgYBN30wDppGK9RlvUEYlmeVo
|
||||
bzDjaeHls12YuyiGSPzemQQ/X4gMnHMkDSBduSqaPxiWJ+Rih8F7dGJT/GEnqHqR
|
||||
CZ228U2cVA9YBu5JdAfOVX4jzhb2ytxaYQF+yXG1TfbcNCmHaPZeIJOz2/XkCWxB
|
||||
F5WS6wG1c6Vqftgy7Q4CuAOBhAACgYAapll6iqz9XrZFlk2GCVcB+KihxWnH7IuH
|
||||
vSLw9YUrJahcBHmbpvt494lF4gC5w3WPM+vXJofbusk4GoQEEsQNMDaah4m49uUq
|
||||
AylOVFJJJXuirVJ+o+0TtOFDITEAl+YZZariXOD7tdOSOl9RLMPC6+daHKS9e68u
|
||||
3enxhqnDGaAAMAkGBSsOAwIbBQADMAAwLQIVAJGVuFsG/0DBuSZ0jF7ypdU0/G0v
|
||||
AhQfeF5BoMMDbX/kidUVpQ6gadPlZA==
|
||||
-----END CERTIFICATE REQUEST-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIBrjCCAWwCAQswCQYFKw4DAhsFADBTMQswCQYDVQQGEwJBVTETMBEGA1UECBMK
|
||||
U29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMQww
|
||||
CgYDVQQDEwNQQ0EwHhcNOTcwNjE1MDIxNDI5WhcNOTcwNzE1MDIxNDI5WjBSMQsw
|
||||
CQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJu
|
||||
ZXQgV2lkZ2l0cyBQdHkgTHRkMQswCQYDVQQDEwJDQTCBkjAJBgUrDgMCDAUAA4GE
|
||||
AAKBgBqmWXqKrP1etkWWTYYJVwH4qKHFacfsi4e9IvD1hSslqFwEeZum+3j3iUXi
|
||||
ALnDdY8z69cmh9u6yTgahAQSxA0wNpqHibj25SoDKU5UUkkle6KtUn6j7RO04UMh
|
||||
MQCX5hllquJc4Pu105I6X1Esw8Lr51ocpL17ry7d6fGGqcMZMAkGBSsOAwIbBQAD
|
||||
MQAwLgIVAJ4wtQsANPxHo7Q4IQZYsL12SKdbAhUAjJ9n38zxT+iai2164xS+LIfa
|
||||
C1Q=
|
||||
-----END CERTIFICATE-----
|
||||
|
@ -1,49 +0,0 @@
|
||||
-----BEGIN DSA PRIVATE KEY-----
|
||||
Proc-Type: 4,ENCRYPTED
|
||||
DEK-Info: DES-EDE3-CBC,F80EEEBEEA7386C4
|
||||
|
||||
GZ9zgFcHOlnhPoiSbVi/yXc9mGoj44A6IveD4UlpSEUt6Xbse3Fr0KHIUyQ3oGnS
|
||||
mClKoAp/eOTb5Frhto85SzdsxYtac+X1v5XwdzAMy2KowHVk1N8A5jmE2OlkNPNt
|
||||
of132MNlo2cyIRYaa35PPYBGNCmUm7YcYS8O90YtkrQZZTf4+2C4kllhMcdkQwkr
|
||||
FWSWC8YOQ7w0LHb4cX1FejHHom9Nd/0PN3vn3UyySvfOqoR7nbXkrpHXmPIr0hxX
|
||||
RcF0aXcV/CzZ1/nfXWQf4o3+oD0T22SDoVcZY60IzI0oIc3pNCbDV3uKNmgekrFd
|
||||
qOUJ+QW8oWp7oefRx62iBfIeC8DZunohMXaWAQCU0sLQOR4yEdeUCnzCSywe0bG1
|
||||
diD0KYaEe+Yub1BQH4aLsBgDjardgpJRTQLq0DUvw0/QGO1irKTJzegEDNVBKrVn
|
||||
V4AHOKT1CUKqvGNRP1UnccUDTF6miOAtaj/qpzra7sSk7dkGBvIEeFoAg84kfh9h
|
||||
hVvF1YyzC9bwZepruoqoUwke/WdNIR5ymOVZ/4Liw0JdIOcq+atbdRX08niqIRkf
|
||||
dsZrUj4leo3zdefYUQ7w4N2Ns37yDFq7
|
||||
-----END DSA PRIVATE KEY-----
|
||||
-----BEGIN CERTIFICATE REQUEST-----
|
||||
MIICVTCCAhMCAQAwUzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUx
|
||||
ITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEMMAoGA1UEAxMDUENB
|
||||
MIIBtTCCASkGBSsOAwIMMIIBHgKBgQCnP26Fv0FqKX3wn0cZMJCaCR3aajMexT2G
|
||||
lrMV4FMuj+BZgnOQPnUxmUd6UvuF5NmmezibaIqEm4fGHrV+hktTW1nPcWUZiG7O
|
||||
Zq5riDb77Cjcwtelu+UsOSZL2ppwGJU3lRBWI/YV7boEXt45T/23Qx+1pGVvzYAR
|
||||
5HCVW1DNSQIVAPcHMe36bAYD1YWKHKycZedQZmVvAoGATd9MA6aRivUZb1BGJZnl
|
||||
aG8w42nh5bNdmLsohkj83pkEP1+IDJxzJA0gXbkqmj8YlifkYofBe3RiU/xhJ6h6
|
||||
kQmdtvFNnFQPWAbuSXQHzlV+I84W9srcWmEBfslxtU323DQph2j2XiCTs9v15Als
|
||||
QReVkusBtXOlan7YMu0OArgDgYUAAoGBAKbtuR5AdW+ICjCFe2ixjUiJJzM2IKwe
|
||||
6NZEMXg39+HQ1UTPTmfLZLps+rZfolHDXuRKMXbGFdSF0nXYzotPCzi7GauwEJTZ
|
||||
yr27ZZjA1C6apGSQ9GzuwNvZ4rCXystVEagAS8OQ4H3D4dWS17Zg31ICb5o4E5r0
|
||||
z09o/Uz46u0VoAAwCQYFKw4DAhsFAAMxADAuAhUArRubTxsbIXy3AhtjQ943AbNB
|
||||
nSICFQCu+g1iW3jwF+gOcbroD4S/ZcvB3w==
|
||||
-----END CERTIFICATE REQUEST-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIC0zCCApECAQAwCQYFKw4DAhsFADBTMQswCQYDVQQGEwJBVTETMBEGA1UECBMK
|
||||
U29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMQww
|
||||
CgYDVQQDEwNQQ0EwHhcNOTcwNjE0MjI1NDQ1WhcNOTcwNzE0MjI1NDQ1WjBTMQsw
|
||||
CQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJu
|
||||
ZXQgV2lkZ2l0cyBQdHkgTHRkMQwwCgYDVQQDEwNQQ0EwggG1MIIBKQYFKw4DAgww
|
||||
ggEeAoGBAKc/boW/QWopffCfRxkwkJoJHdpqMx7FPYaWsxXgUy6P4FmCc5A+dTGZ
|
||||
R3pS+4Xk2aZ7OJtoioSbh8YetX6GS1NbWc9xZRmIbs5mrmuINvvsKNzC16W75Sw5
|
||||
JkvamnAYlTeVEFYj9hXtugRe3jlP/bdDH7WkZW/NgBHkcJVbUM1JAhUA9wcx7fps
|
||||
BgPVhYocrJxl51BmZW8CgYBN30wDppGK9RlvUEYlmeVobzDjaeHls12YuyiGSPze
|
||||
mQQ/X4gMnHMkDSBduSqaPxiWJ+Rih8F7dGJT/GEnqHqRCZ228U2cVA9YBu5JdAfO
|
||||
VX4jzhb2ytxaYQF+yXG1TfbcNCmHaPZeIJOz2/XkCWxBF5WS6wG1c6Vqftgy7Q4C
|
||||
uAOBhQACgYEApu25HkB1b4gKMIV7aLGNSIknMzYgrB7o1kQxeDf34dDVRM9OZ8tk
|
||||
umz6tl+iUcNe5EoxdsYV1IXSddjOi08LOLsZq7AQlNnKvbtlmMDULpqkZJD0bO7A
|
||||
29nisJfKy1URqABLw5DgfcPh1ZLXtmDfUgJvmjgTmvTPT2j9TPjq7RUwCQYFKw4D
|
||||
AhsFAAMxADAuAhUAvtv6AkMolix1Jvy3UnVEIUqdCUICFQC+jq8P49mwrY9oJ24n
|
||||
5rKUjNBhSg==
|
||||
-----END CERTIFICATE-----
|
||||
|
@ -1,33 +0,0 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIC5jCCAk+gAwIBAgIBADANBgkqhkiG9w0BAQQFADBcMQswCQYDVQQGEwJBVTET
|
||||
MBEGA1UECBMKUXVlZW5zbGFuZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQx
|
||||
HDAaBgNVBAMTE1Rlc3QgUENBICgxMDI0IGJpdCkwHhcNOTkxMjAyMjEzNTQ4WhcN
|
||||
MDUwNzExMjEzNTQ4WjBcMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFu
|
||||
ZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxHDAaBgNVBAMTE1Rlc3QgUENB
|
||||
ICgxMDI0IGJpdCkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJ2haT/f5Zwy
|
||||
V+MiuSDjSR62adBoSiBB7Usty44lXqsp9RICw+DCCxpsn/CfxPEDXLLd4olsWXc6
|
||||
JRcxGynbYmnzk+Z6aIPPJQhK3CTvaqGnWKZsA1m+WaUIUqJCuNTK4N+7hMAGaf6S
|
||||
S3e9HVgEQ4a34gXJ7VQFVIBNV1EnZRWHAgMBAAGjgbcwgbQwHQYDVR0OBBYEFE0R
|
||||
aEcrj18q1dw+G6nJbsTWR213MIGEBgNVHSMEfTB7gBRNEWhHK49fKtXcPhupyW7E
|
||||
1kdtd6FgpF4wXDELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY
|
||||
BgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYDVQQDExNUZXN0IFBDQSAoMTAy
|
||||
NCBiaXQpggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAUa8B3pho
|
||||
+Mvxeq9HsEzJxHIFQla05S5J/e/V+DQTYoKiRFchKPrDAdrzYSEvP3h4QJEtsNqQ
|
||||
JfOxg5M42uLFq7aPGWkF6ZZqZsYS+zA9IVT14g7gNA6Ne+5QtJqQtH9HA24st0T0
|
||||
Tga/lZ9M2ovImovaxSL/kRHbpCWcqWVxpOw=
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXAIBAAKBgQCdoWk/3+WcMlfjIrkg40ketmnQaEogQe1LLcuOJV6rKfUSAsPg
|
||||
wgsabJ/wn8TxA1yy3eKJbFl3OiUXMRsp22Jp85PmemiDzyUIStwk72qhp1imbANZ
|
||||
vlmlCFKiQrjUyuDfu4TABmn+kkt3vR1YBEOGt+IFye1UBVSATVdRJ2UVhwIDAQAB
|
||||
AoGAba4fTtuap5l7/8ZsbE7Z1O32KJY4ZcOZukLOLUUhXxXduT+FTgGWujc0/rgc
|
||||
z9qYCLlNZHOouMYTgtSfYvuMuLZ11VIt0GYH+nRioLShE59Yy+zCRyC+gPigS1kz
|
||||
xvo14AsOIPYV14Tk/SsHyq6E0eTk7VzaIE197giiINUERPECQQDSKmtPTh/lRKw7
|
||||
HSZSM0I1mFWn/1zqrAbontRQY5w98QWIOe5qmzYyFbPXYT3d9BzlsMyhgiRNoBbD
|
||||
yvohSHXJAkEAwAHx6ezAZeWWzD5yXD36nyjpkVCw7Tk7TSmOceLJMWt1QcrCfqlS
|
||||
xA5jjpQ6Z8suU5DdtWAryM2sAir1WisYzwJAd6Zcx56jvAQ3xcPXsE6scBTVFzrj
|
||||
7FqZ6E+cclPzfLQ+QQsyOBE7bpI6e/FJppY26XGZXo3YGzV8IGXrt40oOQJALETG
|
||||
h86EFXo3qGOFbmsDy4pdP5nBERCu8X1xUCSfintiD4c2DInxgS5oGclnJeMcjTvL
|
||||
QjQoJCX3UJCi/OUO1QJBAKgcDHWjMvt+l1pjJBsSEZ0HX9AAIIVx0RQmbFGS+F2Q
|
||||
hhu5l77WnnZOQ9vvhV5u7NPCUF9nhU3jh60qWWO8mkc=
|
||||
-----END RSA PRIVATE KEY-----
|
@ -29,7 +29,7 @@ EXE=""
|
||||
for i
|
||||
do
|
||||
case "$i" in
|
||||
-d) PREFIX="debug-";;
|
||||
-d*) PREFIX="debug-";;
|
||||
-t*) TEST="true";;
|
||||
-h*) TEST="true"; cat <<EOF
|
||||
Usage: config [options]
|
||||
@ -122,6 +122,14 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
|
||||
echo "${MACHINE}-ibm-aix3"; exit 0
|
||||
;;
|
||||
|
||||
BeOS:*:BePC)
|
||||
if [ -e /boot/develop/headers/be/bone ]; then
|
||||
echo "beos-x86-bone"; exit 0
|
||||
else
|
||||
echo "beos-x86-r5"; exit 0
|
||||
fi
|
||||
;;
|
||||
|
||||
dgux:*)
|
||||
echo "${MACHINE}-dg-dgux"; exit 0
|
||||
;;
|
||||
@ -270,7 +278,7 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
|
||||
echo "ppc-apple-darwin${VERSION}"
|
||||
;;
|
||||
*)
|
||||
echo "i386-apple-darwin${VERSION}"
|
||||
echo "i686-apple-darwin${VERSION}"
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
@ -362,6 +370,10 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
|
||||
NONSTOP_KERNEL*)
|
||||
echo "nsr-tandem-nsk"; exit 0;
|
||||
;;
|
||||
|
||||
vxworks*)
|
||||
echo "${MACHINE}-whatever-vxworks"; exit 0;
|
||||
;;
|
||||
esac
|
||||
|
||||
#
|
||||
@ -399,23 +411,18 @@ exit 0
|
||||
# this is where the translation occurs into SSLeay terms
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
GCCVER=`(gcc -dumpversion) 2>/dev/null`
|
||||
if [ "$GCCVER" != "" ]; then
|
||||
# then strip off whatever prefix egcs prepends the number with...
|
||||
# Hopefully, this will work for any future prefixes as well.
|
||||
GCCVER=`echo $GCCVER | LC_ALL=C sed 's/^[a-zA-Z]*\-//'`
|
||||
# Since gcc 3.1 gcc --version behaviour has changed. gcc -dumpversion
|
||||
# does give us what we want though, so we use that. We just just the
|
||||
# major and minor version numbers.
|
||||
# peak single digit before and after first dot, e.g. 2.95.1 gives 29
|
||||
GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
|
||||
fi
|
||||
|
||||
# Only set CC if not supplied already
|
||||
if [ -z "$CC" ]; then
|
||||
# figure out if gcc is available and if so we use it otherwise
|
||||
# we fallback to whatever cc does on the system
|
||||
if [ -z "$CROSS_COMPILE$CC" ]; then
|
||||
GCCVER=`sh -c "gcc -dumpversion" 2>/dev/null`
|
||||
if [ "$GCCVER" != "" ]; then
|
||||
# then strip off whatever prefix egcs prepends the number with...
|
||||
# Hopefully, this will work for any future prefixes as well.
|
||||
GCCVER=`echo $GCCVER | LC_ALL=C sed 's/^[a-zA-Z]*\-//'`
|
||||
# Since gcc 3.1 gcc --version behaviour has changed. gcc -dumpversion
|
||||
# does give us what we want though, so we use that. We just just the
|
||||
# major and minor version numbers.
|
||||
# peak single digit before and after first dot, e.g. 2.95.1 gives 29
|
||||
GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
|
||||
CC=gcc
|
||||
else
|
||||
CC=cc
|
||||
@ -488,6 +495,12 @@ echo Operating system: $GUESSOS
|
||||
# script above so we end up with values in vars but that would take
|
||||
# more time that I want to waste at the moment
|
||||
case "$GUESSOS" in
|
||||
uClinux*64*)
|
||||
OUT=uClinux-dist64
|
||||
;;
|
||||
uClinux*)
|
||||
OUT=uClinux-dist
|
||||
;;
|
||||
mips2-sgi-irix)
|
||||
CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
|
||||
CPU=${CPU:-0}
|
||||
@ -523,8 +536,42 @@ case "$GUESSOS" in
|
||||
OUT="irix-mips3-$CC"
|
||||
;;
|
||||
ppc-apple-rhapsody) OUT="rhapsody-ppc-cc" ;;
|
||||
ppc-apple-darwin*) OUT="darwin-ppc-cc" ;;
|
||||
i386-apple-darwin*) OUT="darwin-i386-cc" ;;
|
||||
ppc-apple-darwin*)
|
||||
ISA64=`(sysctl -n hw.optional.64bitops) 2>/dev/null`
|
||||
if [ "$ISA64" = "1" -a -z "$KERNEL_BITS" ]; then
|
||||
echo "WARNING! If you wish to build 64-bit library, then you have to"
|
||||
echo " invoke './Configure darwin64-ppc-cc' *manually*."
|
||||
if [ "$TEST" = "false" -a -t 1 ]; then
|
||||
echo " You have about 5 seconds to press Ctrl-C to abort."
|
||||
(trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
|
||||
fi
|
||||
fi
|
||||
if [ "$ISA64" = "1" -a "$KERNEL_BITS" = "64" ]; then
|
||||
OUT="darwin64-ppc-cc"
|
||||
else
|
||||
OUT="darwin-ppc-cc"
|
||||
fi ;;
|
||||
i?86-apple-darwin*)
|
||||
ISA64=`(sysctl -n hw.optional.x86_64) 2>/dev/null`
|
||||
if [ "$ISA64" = "1" -a -z "$KERNEL_BITS" ]; then
|
||||
echo "WARNING! If you wish to build 64-bit library, then you have to"
|
||||
echo " invoke './Configure darwin64-x86_64-cc' *manually*."
|
||||
if [ "$TEST" = "false" -a -t 1 ]; then
|
||||
echo " You have about 5 seconds to press Ctrl-C to abort."
|
||||
(trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
|
||||
fi
|
||||
fi
|
||||
if [ "$ISA64" = "1" -a "$KERNEL_BITS" = "64" ]; then
|
||||
OUT="darwin64-x86_64-cc"
|
||||
else
|
||||
OUT="darwin-i386-cc"
|
||||
fi ;;
|
||||
armv6+7-*-iphoneos)
|
||||
options="$options -arch%20armv6 -arch%20armv7"
|
||||
OUT="iphoneos-cross" ;;
|
||||
*-*-iphoneos)
|
||||
options="$options -arch%20${MACHINE}"
|
||||
OUT="iphoneos-cross" ;;
|
||||
alpha-*-linux2)
|
||||
ISA=`awk '/cpu model/{print$4;exit(0);}' /proc/cpuinfo`
|
||||
case ${ISA:-generic} in
|
||||
@ -549,6 +596,11 @@ case "$GUESSOS" in
|
||||
OUT="linux-ppc"
|
||||
;;
|
||||
ppc-*-linux2) OUT="linux-ppc" ;;
|
||||
ppc60x-*-vxworks*) OUT="vxworks-ppc60x" ;;
|
||||
ppcgen-*-vxworks*) OUT="vxworks-ppcgen" ;;
|
||||
pentium-*-vxworks*) OUT="vxworks-pentium" ;;
|
||||
simlinux-*-vxworks*) OUT="vxworks-simlinux" ;;
|
||||
mips-*-vxworks*) OUT="vxworks-mips";;
|
||||
ia64-*-linux?) OUT="linux-ia64" ;;
|
||||
sparc64-*-linux2)
|
||||
echo "WARNING! If you *know* that your GNU C supports 64-bit/V9 ABI"
|
||||
@ -589,13 +641,25 @@ case "$GUESSOS" in
|
||||
|
||||
options="$options -DB_ENDIAN -mschedule=$CPUSCHEDULE -march=$CPUARCH"
|
||||
OUT="linux-generic32" ;;
|
||||
arm*b-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
|
||||
arm*l-*-linux2) OUT="linux-generic32"; options="$options -DL_ENDIAN" ;;
|
||||
armv[1-3]*-*-linux2) OUT="linux-generic32" ;;
|
||||
armv[7-9]*-*-linux2) OUT="linux-armv4"; options="$options -march=armv7-a" ;;
|
||||
arm*-*-linux2) OUT="linux-armv4" ;;
|
||||
sh*b-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
|
||||
sh*-*-linux2) OUT="linux-generic32"; options="$options -DL_ENDIAN" ;;
|
||||
m68k*-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
|
||||
s390-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN -DNO_ASM" ;;
|
||||
s390x-*-linux2) OUT="linux-generic64"; options="$options -DB_ENDIAN" ;;
|
||||
s390-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
|
||||
s390x-*-linux2)
|
||||
# To be uncommented when glibc bug is fixed, see Configure...
|
||||
#if egrep -e '^features.* highgprs' /proc/cpuinfo >/dev/null ; then
|
||||
# echo "WARNING! If you wish to build \"highgprs\" 32-bit library, then you"
|
||||
# echo " have to invoke './Configure linux32-s390x' *manually*."
|
||||
# if [ "$TEST" = "false" -a -t -1 ]; then
|
||||
# echo " You have about 5 seconds to press Ctrl-C to abort."
|
||||
# (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
|
||||
# fi
|
||||
#fi
|
||||
OUT="linux64-s390x"
|
||||
;;
|
||||
x86_64-*-linux?) OUT="linux-x86_64" ;;
|
||||
*86-*-linux2) OUT="linux-elf"
|
||||
if [ "$GCCVER" -gt 28 ]; then
|
||||
@ -614,7 +678,7 @@ case "$GUESSOS" in
|
||||
sun4[uv]*-*-solaris2)
|
||||
OUT="solaris-sparcv9-$CC"
|
||||
ISA64=`(isalist) 2>/dev/null | grep sparcv9`
|
||||
if [ "$ISA64" != "" ]; then
|
||||
if [ "$ISA64" != "" -a "$KERNEL_BITS" = "" ]; then
|
||||
if [ "$CC" = "cc" -a $CCVER -ge 50 ]; then
|
||||
echo "WARNING! If you wish to build 64-bit library, then you have to"
|
||||
echo " invoke './Configure solaris64-sparcv9-cc' *manually*."
|
||||
@ -644,13 +708,16 @@ case "$GUESSOS" in
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ "$ISA64" != "" -a "$KERNEL_BITS" = "64" ]; then
|
||||
OUT="solaris64-sparcv9-$CC"
|
||||
fi
|
||||
;;
|
||||
sun4m-*-solaris2) OUT="solaris-sparcv8-$CC" ;;
|
||||
sun4d-*-solaris2) OUT="solaris-sparcv8-$CC" ;;
|
||||
sun4*-*-solaris2) OUT="solaris-sparcv7-$CC" ;;
|
||||
*86*-*-solaris2)
|
||||
ISA64=`(isalist) 2>/dev/null | grep amd64`
|
||||
if [ "$ISA64" != "" ]; then
|
||||
if [ "$ISA64" != "" -a ${KERNEL_BITS:-64} -eq 64 ]; then
|
||||
OUT="solaris64-x86_64-$CC"
|
||||
else
|
||||
OUT="solaris-x86-$CC"
|
||||
@ -702,20 +769,17 @@ case "$GUESSOS" in
|
||||
if [ $CC = "gcc" -a $GCC_BITS = "64" ]; then
|
||||
OUT="hpux64-parisc2-gcc"
|
||||
fi
|
||||
KERNEL_BITS=`(getconf KERNEL_BITS) 2>/dev/null`
|
||||
[ "$KERNEL_BITS" ] || KERNEL_BITS=`(getconf KERNEL_BITS) 2>/dev/null`
|
||||
KERNEL_BITS=${KERNEL_BITS:-32}
|
||||
CPU_VERSION=`(getconf CPU_VERSION) 2>/dev/null`
|
||||
CPU_VERSION=${CPU_VERSION:-0}
|
||||
# See <sys/unistd.h> for further info on CPU_VERSION.
|
||||
if [ $CPU_VERSION -ge 768 ]; then # IA-64 CPU
|
||||
echo "WARNING! 64-bit ABI is the default configured ABI on HP-UXi."
|
||||
echo " If you wish to build 32-bit library, the you have to"
|
||||
echo " invoke './Configure hpux-ia64-cc' *manually*."
|
||||
if [ "$TEST" = "false" -a -t 1 ]; then
|
||||
echo " You have about 5 seconds to press Ctrl-C to abort."
|
||||
(trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
|
||||
fi
|
||||
OUT="hpux64-ia64-cc"
|
||||
if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then
|
||||
OUT="hpux64-ia64-cc"
|
||||
else
|
||||
OUT="hpux-ia64-cc"
|
||||
fi
|
||||
elif [ $CPU_VERSION -ge 532 ]; then # PA-RISC 2.x CPU
|
||||
OUT=${OUT:-"hpux-parisc2-${CC}"}
|
||||
if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then
|
||||
@ -736,7 +800,7 @@ case "$GUESSOS" in
|
||||
options="$options -D_REENTRANT" ;;
|
||||
*-hpux) OUT="hpux-parisc-$CC" ;;
|
||||
*-aix)
|
||||
KERNEL_BITS=`(getconf KERNEL_BITMODE) 2>/dev/null`
|
||||
[ "$KERNEL_BITS" ] || KERNEL_BITS=`(getconf KERNEL_BITMODE) 2>/dev/null`
|
||||
KERNEL_BITS=${KERNEL_BITS:-32}
|
||||
OBJECT_MODE=${OBJECT_MODE:-32}
|
||||
if [ "$CC" = "gcc" ]; then
|
||||
@ -773,8 +837,11 @@ case "$GUESSOS" in
|
||||
t3e-cray-unicosmk) OUT="cray-t3e" ;;
|
||||
j90-cray-unicos) OUT="cray-j90" ;;
|
||||
nsr-tandem-nsk) OUT="tandem-c89" ;;
|
||||
beos-*) OUT="$GUESSOS" ;;
|
||||
x86pc-*-qnx6) OUT="QNX6-i386" ;;
|
||||
*-*-qnx6) OUT="QNX6" ;;
|
||||
x86-*-android|i?86-*-android) OUT="android-x86" ;;
|
||||
armv[7-9]*-*-android) OUT="android-armv7" ;;
|
||||
*) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
|
||||
esac
|
||||
|
||||
@ -790,9 +857,11 @@ esac
|
||||
# options="$options -DATALLA"
|
||||
#fi
|
||||
|
||||
($CC -Wa,--help -c -o /dev/null -x assembler /dev/null 2>&1 | \
|
||||
grep \\--noexecstack) 2>&1 > /dev/null && \
|
||||
if expr "$options" : '.*no\-asm' > /dev/null; then :; else
|
||||
sh -c "$CROSS_COMPILE${CC:-gcc} -Wa,--help -c -o /tmp/null.$$.o -x assembler /dev/null && rm /tmp/null.$$.o" 2>&1 | \
|
||||
grep \\--noexecstack >/dev/null && \
|
||||
options="$options -Wa,--noexecstack"
|
||||
fi
|
||||
|
||||
# gcc < 2.8 does not support -march=ultrasparc
|
||||
if [ "$OUT" = solaris-sparcv9-gcc -a $GCCVER -lt 28 ]
|
||||
|
@ -1,42 +0,0 @@
|
||||
/* $LP: LPlib/source/LPdir_win.c,v 1.1 2004/06/14 10:07:56 _cvs_levitte Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2004, Richard Levitte <richard@levitte.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LPDIR_H
|
||||
#include "LPdir.h"
|
||||
#endif
|
||||
|
||||
struct LP_dir_context_st { void *dummy; };
|
||||
const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
||||
int LP_find_file_end(LP_DIR_CTX **ctx)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
@ -1,199 +0,0 @@
|
||||
/* $LP: LPlib/source/LPdir_vms.c,v 1.20 2004/08/26 13:36:05 _cvs_levitte Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2004, Richard Levitte <richard@levitte.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <descrip.h>
|
||||
#include <namdef.h>
|
||||
#include <rmsdef.h>
|
||||
#include <libfildef.h>
|
||||
#include <lib$routines.h>
|
||||
#include <strdef.h>
|
||||
#include <str$routines.h>
|
||||
#include <stsdef.h>
|
||||
#ifndef LPDIR_H
|
||||
#include "LPdir.h"
|
||||
#endif
|
||||
|
||||
/* Because some compiler options hide this macor */
|
||||
#ifndef EVMSERR
|
||||
#define EVMSERR 65535 /* error for non-translatable VMS errors */
|
||||
#endif
|
||||
|
||||
struct LP_dir_context_st
|
||||
{
|
||||
unsigned long VMS_context;
|
||||
#ifdef NAML$C_MAXRSS
|
||||
char filespec[NAML$C_MAXRSS+1];
|
||||
char result[NAML$C_MAXRSS+1];
|
||||
#else
|
||||
char filespec[256];
|
||||
char result[256];
|
||||
#endif
|
||||
struct dsc$descriptor_d filespec_dsc;
|
||||
struct dsc$descriptor_d result_dsc;
|
||||
};
|
||||
|
||||
const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
|
||||
{
|
||||
int status;
|
||||
char *p, *r;
|
||||
size_t l;
|
||||
unsigned long flags = 0;
|
||||
#ifdef NAML$C_MAXRSS
|
||||
flags |= LIB$M_FIL_LONG_NAMES;
|
||||
#endif
|
||||
|
||||
if (ctx == NULL || directory == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
if (*ctx == NULL)
|
||||
{
|
||||
size_t filespeclen = strlen(directory);
|
||||
char *filespec = NULL;
|
||||
|
||||
/* MUST be a VMS directory specification! Let's estimate if it is. */
|
||||
if (directory[filespeclen-1] != ']'
|
||||
&& directory[filespeclen-1] != '>'
|
||||
&& directory[filespeclen-1] != ':')
|
||||
{
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
filespeclen += 4; /* "*.*;" */
|
||||
|
||||
if (filespeclen >
|
||||
#ifdef NAML$C_MAXRSS
|
||||
NAML$C_MAXRSS
|
||||
#else
|
||||
255
|
||||
#endif
|
||||
)
|
||||
{
|
||||
errno = ENAMETOOLONG;
|
||||
return 0;
|
||||
}
|
||||
|
||||
*ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX));
|
||||
if (*ctx == NULL)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
memset(*ctx, '\0', sizeof(LP_DIR_CTX));
|
||||
|
||||
strcpy((*ctx)->filespec,directory);
|
||||
strcat((*ctx)->filespec,"*.*;");
|
||||
(*ctx)->filespec_dsc.dsc$w_length = filespeclen;
|
||||
(*ctx)->filespec_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
(*ctx)->filespec_dsc.dsc$b_class = DSC$K_CLASS_S;
|
||||
(*ctx)->filespec_dsc.dsc$a_pointer = (*ctx)->filespec;
|
||||
(*ctx)->result_dsc.dsc$w_length = 0;
|
||||
(*ctx)->result_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
(*ctx)->result_dsc.dsc$b_class = DSC$K_CLASS_D;
|
||||
(*ctx)->result_dsc.dsc$a_pointer = 0;
|
||||
}
|
||||
|
||||
(*ctx)->result_dsc.dsc$w_length = 0;
|
||||
(*ctx)->result_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
(*ctx)->result_dsc.dsc$b_class = DSC$K_CLASS_D;
|
||||
(*ctx)->result_dsc.dsc$a_pointer = 0;
|
||||
|
||||
status = lib$find_file(&(*ctx)->filespec_dsc, &(*ctx)->result_dsc,
|
||||
&(*ctx)->VMS_context, 0, 0, 0, &flags);
|
||||
|
||||
if (status == RMS$_NMF)
|
||||
{
|
||||
errno = 0;
|
||||
vaxc$errno = status;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(!$VMS_STATUS_SUCCESS(status))
|
||||
{
|
||||
errno = EVMSERR;
|
||||
vaxc$errno = status;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Quick, cheap and dirty way to discard any device and directory,
|
||||
since we only want file names */
|
||||
l = (*ctx)->result_dsc.dsc$w_length;
|
||||
p = (*ctx)->result_dsc.dsc$a_pointer;
|
||||
r = p;
|
||||
for (; *p; p++)
|
||||
{
|
||||
if (*p == '^' && p[1] != '\0') /* Take care of ODS-5 escapes */
|
||||
{
|
||||
p++;
|
||||
}
|
||||
else if (*p == ':' || *p == '>' || *p == ']')
|
||||
{
|
||||
l -= p + 1 - r;
|
||||
r = p + 1;
|
||||
}
|
||||
else if (*p == ';')
|
||||
{
|
||||
l = p - r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
strncpy((*ctx)->result, r, l);
|
||||
(*ctx)->result[l] = '\0';
|
||||
str$free1_dx(&(*ctx)->result_dsc);
|
||||
|
||||
return (*ctx)->result;
|
||||
}
|
||||
|
||||
int LP_find_file_end(LP_DIR_CTX **ctx)
|
||||
{
|
||||
if (ctx != NULL && *ctx != NULL)
|
||||
{
|
||||
int status = lib$find_file_end(&(*ctx)->VMS_context);
|
||||
|
||||
free(*ctx);
|
||||
|
||||
if(!$VMS_STATUS_SUCCESS(status))
|
||||
{
|
||||
errno = EVMSERR;
|
||||
vaxc$errno = status;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,155 +0,0 @@
|
||||
/* $LP: LPlib/source/LPdir_win.c,v 1.10 2004/08/26 13:36:05 _cvs_levitte Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2004, Richard Levitte <richard@levitte.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#ifndef LPDIR_H
|
||||
#include "LPdir.h"
|
||||
#endif
|
||||
|
||||
/* We're most likely overcautious here, but let's reserve for
|
||||
broken WinCE headers and explicitly opt for UNICODE call.
|
||||
Keep in mind that our WinCE builds are compiled with -DUNICODE
|
||||
[as well as -D_UNICODE]. */
|
||||
#if defined(LP_SYS_WINCE) && !defined(FindFirstFile)
|
||||
# define FindFirstFile FindFirstFileW
|
||||
#endif
|
||||
#if defined(LP_SYS_WINCE) && !defined(FindFirstFile)
|
||||
# define FindNextFile FindNextFileW
|
||||
#endif
|
||||
|
||||
#ifndef NAME_MAX
|
||||
#define NAME_MAX 255
|
||||
#endif
|
||||
|
||||
struct LP_dir_context_st
|
||||
{
|
||||
WIN32_FIND_DATA ctx;
|
||||
HANDLE handle;
|
||||
char entry_name[NAME_MAX+1];
|
||||
};
|
||||
|
||||
const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
|
||||
{
|
||||
struct dirent *direntry = NULL;
|
||||
|
||||
if (ctx == NULL || directory == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
if (*ctx == NULL)
|
||||
{
|
||||
*ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX));
|
||||
if (*ctx == NULL)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
memset(*ctx, '\0', sizeof(LP_DIR_CTX));
|
||||
|
||||
if (sizeof(TCHAR) != sizeof(char))
|
||||
{
|
||||
TCHAR *wdir = NULL;
|
||||
/* len_0 denotes string length *with* trailing 0 */
|
||||
size_t index = 0,len_0 = strlen(directory) + 1;
|
||||
|
||||
wdir = (TCHAR *)malloc(len_0 * sizeof(TCHAR));
|
||||
if (wdir == NULL)
|
||||
{
|
||||
free(*ctx);
|
||||
*ctx = NULL;
|
||||
errno = ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef LP_MULTIBYTE_AVAILABLE
|
||||
if (!MultiByteToWideChar(CP_ACP, 0, directory, len_0, (WCHAR *)wdir, len_0))
|
||||
#endif
|
||||
for (index = 0; index < len_0; index++)
|
||||
wdir[index] = (TCHAR)directory[index];
|
||||
|
||||
(*ctx)->handle = FindFirstFile(wdir, &(*ctx)->ctx);
|
||||
|
||||
free(wdir);
|
||||
}
|
||||
else
|
||||
(*ctx)->handle = FindFirstFile((TCHAR *)directory, &(*ctx)->ctx);
|
||||
|
||||
if ((*ctx)->handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
free(*ctx);
|
||||
*ctx = NULL;
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FindNextFile((*ctx)->handle, &(*ctx)->ctx) == FALSE)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof(TCHAR) != sizeof(char))
|
||||
{
|
||||
TCHAR *wdir = (*ctx)->ctx.cFileName;
|
||||
size_t index, len_0 = 0;
|
||||
|
||||
while (wdir[len_0] && len_0 < (sizeof((*ctx)->entry_name) - 1)) len_0++;
|
||||
len_0++;
|
||||
|
||||
#ifdef LP_MULTIBYTE_AVAILABLE
|
||||
if (!WideCharToMultiByte(CP_ACP, 0, (WCHAR *)wdir, len_0, (*ctx)->entry_name,
|
||||
sizeof((*ctx)->entry_name), NULL, 0))
|
||||
#endif
|
||||
for (index = 0; index < len_0; index++)
|
||||
(*ctx)->entry_name[index] = (char)wdir[index];
|
||||
}
|
||||
else
|
||||
strncpy((*ctx)->entry_name, (const char *)(*ctx)->ctx.cFileName,
|
||||
sizeof((*ctx)->entry_name)-1);
|
||||
|
||||
(*ctx)->entry_name[sizeof((*ctx)->entry_name)-1] = '\0';
|
||||
|
||||
return (*ctx)->entry_name;
|
||||
}
|
||||
|
||||
int LP_find_file_end(LP_DIR_CTX **ctx)
|
||||
{
|
||||
if (ctx != NULL && *ctx != NULL)
|
||||
{
|
||||
FindClose((*ctx)->handle);
|
||||
free(*ctx);
|
||||
*ctx = NULL;
|
||||
return 1;
|
||||
}
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
/* $LP: LPlib/source/LPdir_win32.c,v 1.3 2004/08/26 13:36:05 _cvs_levitte Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2004, Richard Levitte <richard@levitte.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define LP_SYS_WIN32
|
||||
#define LP_MULTIBYTE_AVAILABLE
|
||||
#include "LPdir_win.c"
|
@ -1,31 +0,0 @@
|
||||
/* $LP: LPlib/source/LPdir_wince.c,v 1.3 2004/08/26 13:36:05 _cvs_levitte Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2004, Richard Levitte <richard@levitte.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define LP_SYS_WINCE
|
||||
/* We might want to define LP_MULTIBYTE_AVAILABLE here. It's currently
|
||||
under investigation what the exact conditions would be */
|
||||
#include "LPdir_win.c"
|
@ -5,9 +5,9 @@
|
||||
DIR= crypto
|
||||
TOP= ..
|
||||
CC= cc
|
||||
INCLUDE= -I. -I$(TOP) -I../include
|
||||
INCLUDE= -I. -I$(TOP) -I../include $(ZLIB_INCLUDE)
|
||||
# INCLUDES targets sudbirs!
|
||||
INCLUDES= -I.. -I../.. -I../../include
|
||||
INCLUDES= -I.. -I../.. -I../modes -I../asn1 -I../evp -I../../include $(ZLIB_INCLUDE)
|
||||
CFLAG= -g
|
||||
MAKEDEPPROG= makedepend
|
||||
MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
|
||||
@ -17,7 +17,7 @@ AR= ar r
|
||||
|
||||
RECURSIVE_MAKE= [ -n "$(SDIRS)" ] && for i in $(SDIRS) ; do \
|
||||
(cd $$i && echo "making $$target in $(DIR)/$$i..." && \
|
||||
$(MAKE) -e TOP=../.. DIR=$$i INCLUDES='${INCLUDES}' $$target ) || exit 1; \
|
||||
$(MAKE) -e TOP=../.. DIR=$$i INCLUDES='$(INCLUDES)' $$target ) || exit 1; \
|
||||
done;
|
||||
|
||||
PEX_LIBS=
|
||||
@ -26,6 +26,7 @@ EX_LIBS=
|
||||
CFLAGS= $(INCLUDE) $(CFLAG)
|
||||
ASFLAGS= $(INCLUDE) $(ASFLAG)
|
||||
AFLAGS=$(ASFLAGS)
|
||||
CPUID_OBJ=mem_clr.o
|
||||
|
||||
LIBS=
|
||||
|
||||
@ -33,12 +34,14 @@ GENERAL=Makefile README crypto-lib.com install.com
|
||||
|
||||
LIB= $(TOP)/libcrypto.a
|
||||
SHARED_LIB= libcrypto$(SHLIB_EXT)
|
||||
LIBSRC= cryptlib.c dyn_lck.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c o_time.c o_str.c o_dir.c o_init.c fips_err.c
|
||||
LIBOBJ= cryptlib.o dyn_lck.o mem.o mem_clr.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o o_time.o o_str.o o_dir.o o_init.o fips_err.o $(CPUID_OBJ)
|
||||
LIBSRC= cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c cpt_err.c \
|
||||
ebcdic.c uid.c o_time.c o_str.c o_dir.c o_fips.c o_init.c fips_ers.c
|
||||
LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o cpt_err.o ebcdic.o \
|
||||
uid.o o_time.o o_str.o o_dir.o o_fips.o o_init.o fips_ers.o $(CPUID_OBJ)
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= crypto.h tmdiff.h opensslv.h opensslconf.h ebcdic.h symhacks.h \
|
||||
EXHEADER= crypto.h opensslv.h opensslconf.h ebcdic.h symhacks.h \
|
||||
ossl_typ.h
|
||||
HEADER= cryptlib.h buildinf.h md32_common.h o_time.h o_str.h o_dir.h $(EXHEADER)
|
||||
|
||||
@ -47,7 +50,7 @@ ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
top:
|
||||
@(cd ..; $(MAKE) DIRS=$(DIR) all)
|
||||
|
||||
all: lib
|
||||
all: shared
|
||||
|
||||
buildinf.h: ../Makefile
|
||||
( echo "#ifndef MK1MF_BUILD"; \
|
||||
@ -57,26 +60,27 @@ buildinf.h: ../Makefile
|
||||
echo " #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \
|
||||
echo '#endif' ) >buildinf.h
|
||||
|
||||
x86cpuid-elf.s: x86cpuid.pl perlasm/x86asm.pl
|
||||
$(PERL) x86cpuid.pl elf $(CFLAGS) $(PROCESSOR) > $@
|
||||
x86cpuid-cof.s: x86cpuid.pl perlasm/x86asm.pl
|
||||
$(PERL) x86cpuid.pl coff $(CFLAGS) $(PROCESSOR) > $@
|
||||
x86cpuid-out.s: x86cpuid.pl perlasm/x86asm.pl
|
||||
$(PERL) x86cpuid.pl a.out $(CFLAGS) $(PROCESSOR) > $@
|
||||
x86cpuid.s: x86cpuid.pl perlasm/x86asm.pl
|
||||
$(PERL) x86cpuid.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
|
||||
|
||||
uplink.o: ../ms/uplink.c
|
||||
$(CC) $(CFLAGS) -c -o $@ ../ms/uplink.c
|
||||
applink.o: $(TOP)/ms/applink.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/applink.c
|
||||
|
||||
uplink-cof.s: ../ms/uplink.pl
|
||||
$(PERL) ../ms/uplink.pl coff > $@
|
||||
uplink.o: $(TOP)/ms/uplink.c applink.o
|
||||
$(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/uplink.c
|
||||
|
||||
x86_64cpuid.s: x86_64cpuid.pl
|
||||
$(PERL) x86_64cpuid.pl $@
|
||||
ia64cpuid.s: ia64cpuid.S
|
||||
$(CC) $(CFLAGS) -E ia64cpuid.S > $@
|
||||
uplink-x86.s: $(TOP)/ms/uplink-x86.pl
|
||||
$(PERL) $(TOP)/ms/uplink-x86.pl $(PERLASM_SCHEME) > $@
|
||||
|
||||
x86_64cpuid.s: x86_64cpuid.pl; $(PERL) x86_64cpuid.pl $(PERLASM_SCHEME) > $@
|
||||
ia64cpuid.s: ia64cpuid.S; $(CC) $(CFLAGS) -E ia64cpuid.S > $@
|
||||
ppccpuid.s: ppccpuid.pl; $(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@
|
||||
pariscid.s: pariscid.pl; $(PERL) pariscid.pl $(PERLASM_SCHEME) $@
|
||||
alphacpuid.s: alphacpuid.pl
|
||||
$(PERL) $< | $(CC) -E - | tee $@ > /dev/null
|
||||
|
||||
testapps:
|
||||
[ -z "$(THIS)" ] || ( if echo ${SDIRS} | fgrep ' des '; \
|
||||
[ -z "$(THIS)" ] || ( if echo $(SDIRS) | fgrep ' des '; \
|
||||
then cd des && $(MAKE) -e des; fi )
|
||||
[ -z "$(THIS)" ] || ( cd pkcs7 && $(MAKE) -e testapps );
|
||||
@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
|
||||
@ -94,11 +98,12 @@ links:
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../apps $(APPS)
|
||||
@target=links; $(RECURSIVE_MAKE)
|
||||
|
||||
# lib: and $(LIB): are splitted to avoid end-less loop
|
||||
lib: buildinf.h $(LIB) subdirs
|
||||
# lib: $(LIB): are splitted to avoid end-less loop
|
||||
lib: $(LIB)
|
||||
@touch lib
|
||||
$(LIB): $(LIBOBJ)
|
||||
$(ARX) $(LIB) $(LIBOBJ)
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
[ -z "$(FIPSLIBDIR)" ] || $(AR) $(LIB) $(FIPSLIBDIR)fipscanister.o
|
||||
$(RANLIB) $(LIB) || echo Never mind.
|
||||
|
||||
shared: buildinf.h lib subdirs
|
||||
@ -135,6 +140,7 @@ clean:
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
rm -f opensslconf.h
|
||||
@target=dclean; $(RECURSIVE_MAKE)
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
@ -159,13 +165,6 @@ cversion.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
cversion.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
|
||||
cversion.o: ../include/openssl/stack.h ../include/openssl/symhacks.h buildinf.h
|
||||
cversion.o: cryptlib.h cversion.c
|
||||
dyn_lck.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
|
||||
dyn_lck.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
|
||||
dyn_lck.o: ../include/openssl/err.h ../include/openssl/lhash.h
|
||||
dyn_lck.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
dyn_lck.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
|
||||
dyn_lck.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
|
||||
dyn_lck.o: dyn_lck.c
|
||||
ebcdic.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h ebcdic.c
|
||||
ex_data.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
|
||||
ex_data.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
|
||||
@ -174,13 +173,7 @@ ex_data.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
ex_data.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
|
||||
ex_data.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
|
||||
ex_data.o: ex_data.c
|
||||
fips_err.o: ../include/openssl/bio.h ../include/openssl/crypto.h
|
||||
fips_err.o: ../include/openssl/e_os2.h ../include/openssl/err.h
|
||||
fips_err.o: ../include/openssl/fips.h ../include/openssl/lhash.h
|
||||
fips_err.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
fips_err.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
|
||||
fips_err.o: ../include/openssl/stack.h ../include/openssl/symhacks.h fips_err.c
|
||||
fips_err.o: fips_err.h
|
||||
fips_ers.o: ../include/openssl/opensslconf.h fips_ers.c
|
||||
mem.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
|
||||
mem.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
|
||||
mem.o: ../include/openssl/err.h ../include/openssl/lhash.h
|
||||
@ -201,6 +194,13 @@ mem_dbg.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
|
||||
mem_dbg.o: mem_dbg.c
|
||||
o_dir.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
|
||||
o_dir.o: LPdir_unix.c o_dir.c o_dir.h
|
||||
o_fips.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
|
||||
o_fips.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
|
||||
o_fips.o: ../include/openssl/err.h ../include/openssl/lhash.h
|
||||
o_fips.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
o_fips.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
|
||||
o_fips.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
|
||||
o_fips.o: o_fips.c
|
||||
o_init.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/crypto.h
|
||||
o_init.o: ../include/openssl/e_os2.h ../include/openssl/err.h
|
||||
o_init.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
|
||||
@ -211,13 +211,6 @@ o_str.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
|
||||
o_str.o: o_str.c o_str.h
|
||||
o_time.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h o_time.c
|
||||
o_time.o: o_time.h
|
||||
tmdiff.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
|
||||
tmdiff.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
|
||||
tmdiff.o: ../include/openssl/err.h ../include/openssl/lhash.h
|
||||
tmdiff.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
tmdiff.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
|
||||
tmdiff.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
|
||||
tmdiff.o: ../include/openssl/tmdiff.h cryptlib.h tmdiff.c
|
||||
uid.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
|
||||
uid.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
uid.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
|
||||
|
@ -11,7 +11,7 @@ CFLAG=-g
|
||||
MAKEFILE= Makefile
|
||||
AR= ar r
|
||||
|
||||
AES_ASM_OBJ=aes_core.o aes_cbc.o
|
||||
AES_ENC=aes_core.o aes_cbc.o
|
||||
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
ASFLAGS= $(INCLUDES) $(ASFLAG)
|
||||
@ -26,7 +26,7 @@ LIB=$(TOP)/libcrypto.a
|
||||
LIBSRC=aes_core.c aes_misc.c aes_ecb.c aes_cbc.c aes_cfb.c aes_ofb.c \
|
||||
aes_ctr.c aes_ige.c aes_wrap.c
|
||||
LIBOBJ=aes_misc.o aes_ecb.o aes_cfb.o aes_ofb.o aes_ctr.o aes_ige.o aes_wrap.o \
|
||||
$(AES_ASM_OBJ)
|
||||
$(AES_ENC)
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
@ -41,24 +41,46 @@ top:
|
||||
all: lib
|
||||
|
||||
lib: $(LIBOBJ)
|
||||
$(ARX) $(LIB) $(LIBOBJ)
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
$(RANLIB) $(LIB) || echo Never mind.
|
||||
@touch lib
|
||||
|
||||
$(LIBOBJ): $(LIBSRC)
|
||||
|
||||
aes-ia64.s: asm/aes-ia64.S
|
||||
$(CC) $(CFLAGS) -E asm/aes-ia64.S > $@
|
||||
|
||||
ax86-elf.s: asm/aes-586.pl ../perlasm/x86asm.pl
|
||||
(cd asm; $(PERL) aes-586.pl elf $(CFLAGS) $(PROCESSOR) > ../$@)
|
||||
ax86-cof.s: asm/aes-586.pl ../perlasm/x86asm.pl
|
||||
(cd asm; $(PERL) aes-586.pl coff $(CFLAGS) $(PROCESSOR) > ../$@)
|
||||
ax86-out.s: asm/aes-586.pl ../perlasm/x86asm.pl
|
||||
(cd asm; $(PERL) aes-586.pl a.out $(CFLAGS) $(PROCESSOR) > ../$@)
|
||||
aes-586.s: asm/aes-586.pl ../perlasm/x86asm.pl
|
||||
$(PERL) asm/aes-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
|
||||
vpaes-x86.s: asm/vpaes-x86.pl ../perlasm/x86asm.pl
|
||||
$(PERL) asm/vpaes-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
|
||||
aesni-x86.s: asm/aesni-x86.pl ../perlasm/x86asm.pl
|
||||
$(PERL) asm/aesni-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
|
||||
|
||||
aes-x86_64.s: asm/aes-x86_64.pl
|
||||
$(PERL) asm/aes-x86_64.pl $@
|
||||
$(PERL) asm/aes-x86_64.pl $(PERLASM_SCHEME) > $@
|
||||
vpaes-x86_64.s: asm/vpaes-x86_64.pl
|
||||
$(PERL) asm/vpaes-x86_64.pl $(PERLASM_SCHEME) > $@
|
||||
bsaes-x86_64.s: asm/bsaes-x86_64.pl
|
||||
$(PERL) asm/bsaes-x86_64.pl $(PERLASM_SCHEME) > $@
|
||||
aesni-x86_64.s: asm/aesni-x86_64.pl
|
||||
$(PERL) asm/aesni-x86_64.pl $(PERLASM_SCHEME) > $@
|
||||
aesni-sha1-x86_64.s: asm/aesni-sha1-x86_64.pl
|
||||
$(PERL) asm/aesni-sha1-x86_64.pl $(PERLASM_SCHEME) > $@
|
||||
|
||||
aes-sparcv9.s: asm/aes-sparcv9.pl
|
||||
$(PERL) asm/aes-sparcv9.pl $(CFLAGS) > $@
|
||||
|
||||
aes-ppc.s: asm/aes-ppc.pl
|
||||
$(PERL) asm/aes-ppc.pl $(PERLASM_SCHEME) $@
|
||||
|
||||
aes-parisc.s: asm/aes-parisc.pl
|
||||
$(PERL) asm/aes-parisc.pl $(PERLASM_SCHEME) $@
|
||||
|
||||
aes-mips.S: asm/aes-mips.pl
|
||||
$(PERL) asm/aes-mips.pl $(PERLASM_SCHEME) $@
|
||||
|
||||
# GNU make "catch all"
|
||||
aes-%.S: asm/aes-%.pl; $(PERL) $< $(PERLASM_SCHEME) > $@
|
||||
aes-armv4.o: aes-armv4.S
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
|
||||
@ -97,16 +119,14 @@ clean:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
aes_cbc.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
|
||||
aes_cbc.o: ../../include/openssl/opensslconf.h aes_cbc.c aes_locl.h
|
||||
aes_cfb.o: ../../e_os.h ../../include/openssl/aes.h
|
||||
aes_cfb.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
|
||||
aes_cfb.o: aes_cfb.c aes_locl.h
|
||||
aes_cbc.o: ../../include/openssl/aes.h ../../include/openssl/modes.h
|
||||
aes_cbc.o: ../../include/openssl/opensslconf.h aes_cbc.c
|
||||
aes_cfb.o: ../../include/openssl/aes.h ../../include/openssl/modes.h
|
||||
aes_cfb.o: ../../include/openssl/opensslconf.h aes_cfb.c
|
||||
aes_core.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
|
||||
aes_core.o: ../../include/openssl/fips.h ../../include/openssl/opensslconf.h
|
||||
aes_core.o: aes_core.c aes_locl.h
|
||||
aes_ctr.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
|
||||
aes_ctr.o: ../../include/openssl/opensslconf.h aes_ctr.c aes_locl.h
|
||||
aes_core.o: ../../include/openssl/opensslconf.h aes_core.c aes_locl.h
|
||||
aes_ctr.o: ../../include/openssl/aes.h ../../include/openssl/modes.h
|
||||
aes_ctr.o: ../../include/openssl/opensslconf.h aes_ctr.c
|
||||
aes_ecb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
|
||||
aes_ecb.o: ../../include/openssl/opensslconf.h aes_ecb.c aes_locl.h
|
||||
aes_ige.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/bio.h
|
||||
@ -116,11 +136,13 @@ aes_ige.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
|
||||
aes_ige.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
|
||||
aes_ige.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
aes_ige.o: ../../include/openssl/symhacks.h ../cryptlib.h aes_ige.c aes_locl.h
|
||||
aes_misc.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
|
||||
aes_misc.o: ../../include/openssl/opensslconf.h
|
||||
aes_misc.o: ../../include/openssl/opensslv.h aes_locl.h aes_misc.c
|
||||
aes_ofb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
|
||||
aes_ofb.o: ../../include/openssl/opensslconf.h aes_locl.h aes_ofb.c
|
||||
aes_misc.o: ../../include/openssl/aes.h ../../include/openssl/crypto.h
|
||||
aes_misc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
|
||||
aes_misc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
|
||||
aes_misc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
aes_misc.o: ../../include/openssl/symhacks.h aes_locl.h aes_misc.c
|
||||
aes_ofb.o: ../../include/openssl/aes.h ../../include/openssl/modes.h
|
||||
aes_ofb.o: ../../include/openssl/opensslconf.h aes_ofb.c
|
||||
aes_wrap.o: ../../e_os.h ../../include/openssl/aes.h
|
||||
aes_wrap.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
aes_wrap.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
|
||||
|
@ -58,6 +58,8 @@
|
||||
#error AES is disabled.
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#define AES_ENCRYPT 1
|
||||
#define AES_DECRYPT 0
|
||||
|
||||
@ -66,10 +68,6 @@
|
||||
#define AES_MAXNR 14
|
||||
#define AES_BLOCK_SIZE 16
|
||||
|
||||
#ifdef OPENSSL_FIPS
|
||||
#define FIPS_AES_SIZE_T int
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -92,6 +90,11 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
|
||||
int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
int private_AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
|
||||
void AES_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
void AES_decrypt(const unsigned char *in, unsigned char *out,
|
||||
@ -100,37 +103,32 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
|
||||
void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key, const int enc);
|
||||
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, const int enc);
|
||||
void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out,
|
||||
const int nbits,const AES_KEY *key,
|
||||
unsigned char *ivec,const int enc);
|
||||
void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num);
|
||||
void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char ivec[AES_BLOCK_SIZE],
|
||||
unsigned char ecount_buf[AES_BLOCK_SIZE],
|
||||
unsigned int *num);
|
||||
|
||||
/* For IGE, see also http://www.links.org/files/openssl-ige.pdf */
|
||||
/* NB: the IV is _two_ blocks long */
|
||||
void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, const int enc);
|
||||
/* NB: the IV is _four_ blocks long */
|
||||
void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
size_t length, const AES_KEY *key,
|
||||
const AES_KEY *key2, const unsigned char *ivec,
|
||||
const int enc);
|
||||
|
||||
@ -141,6 +139,7 @@ int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
|
||||
unsigned char *out,
|
||||
const unsigned char *in, unsigned int inlen);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -49,85 +49,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AES_DEBUG
|
||||
# ifndef NDEBUG
|
||||
# define NDEBUG
|
||||
# endif
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_locl.h"
|
||||
#include <openssl/modes.h>
|
||||
|
||||
#if !defined(OPENSSL_FIPS_AES_ASM)
|
||||
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
size_t len, const AES_KEY *key,
|
||||
unsigned char *ivec, const int enc) {
|
||||
|
||||
unsigned long n;
|
||||
unsigned long len = length;
|
||||
unsigned char tmp[AES_BLOCK_SIZE];
|
||||
const unsigned char *iv = ivec;
|
||||
|
||||
assert(in && out && key && ivec);
|
||||
assert((AES_ENCRYPT == enc)||(AES_DECRYPT == enc));
|
||||
|
||||
if (AES_ENCRYPT == enc) {
|
||||
while (len >= AES_BLOCK_SIZE) {
|
||||
for(n=0; n < AES_BLOCK_SIZE; ++n)
|
||||
out[n] = in[n] ^ iv[n];
|
||||
AES_encrypt(out, out, key);
|
||||
iv = out;
|
||||
len -= AES_BLOCK_SIZE;
|
||||
in += AES_BLOCK_SIZE;
|
||||
out += AES_BLOCK_SIZE;
|
||||
}
|
||||
if (len) {
|
||||
for(n=0; n < len; ++n)
|
||||
out[n] = in[n] ^ iv[n];
|
||||
for(n=len; n < AES_BLOCK_SIZE; ++n)
|
||||
out[n] = iv[n];
|
||||
AES_encrypt(out, out, key);
|
||||
iv = out;
|
||||
}
|
||||
memcpy(ivec,iv,AES_BLOCK_SIZE);
|
||||
} else if (in != out) {
|
||||
while (len >= AES_BLOCK_SIZE) {
|
||||
AES_decrypt(in, out, key);
|
||||
for(n=0; n < AES_BLOCK_SIZE; ++n)
|
||||
out[n] ^= iv[n];
|
||||
iv = in;
|
||||
len -= AES_BLOCK_SIZE;
|
||||
in += AES_BLOCK_SIZE;
|
||||
out += AES_BLOCK_SIZE;
|
||||
}
|
||||
if (len) {
|
||||
AES_decrypt(in,tmp,key);
|
||||
for(n=0; n < len; ++n)
|
||||
out[n] = tmp[n] ^ iv[n];
|
||||
iv = in;
|
||||
}
|
||||
memcpy(ivec,iv,AES_BLOCK_SIZE);
|
||||
} else {
|
||||
while (len >= AES_BLOCK_SIZE) {
|
||||
memcpy(tmp, in, AES_BLOCK_SIZE);
|
||||
AES_decrypt(in, out, key);
|
||||
for(n=0; n < AES_BLOCK_SIZE; ++n)
|
||||
out[n] ^= ivec[n];
|
||||
memcpy(ivec, tmp, AES_BLOCK_SIZE);
|
||||
len -= AES_BLOCK_SIZE;
|
||||
in += AES_BLOCK_SIZE;
|
||||
out += AES_BLOCK_SIZE;
|
||||
}
|
||||
if (len) {
|
||||
memcpy(tmp, in, AES_BLOCK_SIZE);
|
||||
AES_decrypt(tmp, out, key);
|
||||
for(n=0; n < len; ++n)
|
||||
out[n] ^= ivec[n];
|
||||
for(n=len; n < AES_BLOCK_SIZE; ++n)
|
||||
out[n] = tmp[n];
|
||||
memcpy(ivec, tmp, AES_BLOCK_SIZE);
|
||||
}
|
||||
}
|
||||
if (enc)
|
||||
CRYPTO_cbc128_encrypt(in,out,len,key,ivec,(block128_f)AES_encrypt);
|
||||
else
|
||||
CRYPTO_cbc128_decrypt(in,out,len,key,ivec,(block128_f)AES_decrypt);
|
||||
}
|
||||
#endif
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* crypto/aes/aes_cfb.c -*- mode:C; c-file-style: "eay" -*- */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||
* Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -48,73 +48,9 @@
|
||||
* ====================================================================
|
||||
*
|
||||
*/
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef AES_DEBUG
|
||||
# ifndef NDEBUG
|
||||
# define NDEBUG
|
||||
# endif
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_locl.h"
|
||||
#include "e_os.h"
|
||||
#include <openssl/modes.h>
|
||||
|
||||
/* The input and output encrypted as though 128bit cfb mode is being
|
||||
* used. The extra state information to record how much of the
|
||||
@ -122,103 +58,24 @@
|
||||
*/
|
||||
|
||||
void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc) {
|
||||
|
||||
unsigned int n;
|
||||
unsigned long l = length;
|
||||
unsigned char c;
|
||||
|
||||
assert(in && out && key && ivec && num);
|
||||
|
||||
n = *num;
|
||||
|
||||
if (enc) {
|
||||
while (l--) {
|
||||
if (n == 0) {
|
||||
AES_encrypt(ivec, ivec, key);
|
||||
}
|
||||
ivec[n] = *(out++) = *(in++) ^ ivec[n];
|
||||
n = (n+1) % AES_BLOCK_SIZE;
|
||||
}
|
||||
} else {
|
||||
while (l--) {
|
||||
if (n == 0) {
|
||||
AES_encrypt(ivec, ivec, key);
|
||||
}
|
||||
c = *(in);
|
||||
*(out++) = *(in++) ^ ivec[n];
|
||||
ivec[n] = c;
|
||||
n = (n+1) % AES_BLOCK_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
*num=n;
|
||||
CRYPTO_cfb128_encrypt(in,out,length,key,ivec,num,enc,(block128_f)AES_encrypt);
|
||||
}
|
||||
|
||||
/* This expects a single block of size nbits for both in and out. Note that
|
||||
it corrupts any extra bits in the last byte of out */
|
||||
void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out,
|
||||
const int nbits,const AES_KEY *key,
|
||||
unsigned char *ivec,const int enc)
|
||||
{
|
||||
int n,rem,num;
|
||||
unsigned char ovec[AES_BLOCK_SIZE*2];
|
||||
|
||||
if (nbits<=0 || nbits>128) return;
|
||||
|
||||
/* fill in the first half of the new IV with the current IV */
|
||||
memcpy(ovec,ivec,AES_BLOCK_SIZE);
|
||||
/* construct the new IV */
|
||||
AES_encrypt(ivec,ivec,key);
|
||||
num = (nbits+7)/8;
|
||||
if (enc) /* encrypt the input */
|
||||
for(n=0 ; n < num ; ++n)
|
||||
out[n] = (ovec[AES_BLOCK_SIZE+n] = in[n] ^ ivec[n]);
|
||||
else /* decrypt the input */
|
||||
for(n=0 ; n < num ; ++n)
|
||||
out[n] = (ovec[AES_BLOCK_SIZE+n] = in[n]) ^ ivec[n];
|
||||
/* shift ovec left... */
|
||||
rem = nbits%8;
|
||||
num = nbits/8;
|
||||
if(rem==0)
|
||||
memcpy(ivec,ovec+num,AES_BLOCK_SIZE);
|
||||
else
|
||||
for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
|
||||
ivec[n] = ovec[n+num]<<rem | ovec[n+num+1]>>(8-rem);
|
||||
|
||||
/* it is not necessary to cleanse ovec, since the IV is not secret */
|
||||
}
|
||||
|
||||
/* N.B. This expects the input to be packed, MS bit first */
|
||||
void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc)
|
||||
{
|
||||
unsigned int n;
|
||||
unsigned char c[1],d[1];
|
||||
|
||||
assert(in && out && key && ivec && num);
|
||||
assert(*num == 0);
|
||||
|
||||
for(n=0 ; n < length ; ++n)
|
||||
{
|
||||
c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0;
|
||||
AES_cfbr_encrypt_block(c,d,1,key,ivec,enc);
|
||||
out[n/8]=(out[n/8]&~(1 << (7-n%8)))|((d[0]&0x80) >> (n%8));
|
||||
}
|
||||
CRYPTO_cfb128_1_encrypt(in,out,length,key,ivec,num,enc,(block128_f)AES_encrypt);
|
||||
}
|
||||
|
||||
void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc)
|
||||
{
|
||||
unsigned int n;
|
||||
|
||||
assert(in && out && key && ivec && num);
|
||||
assert(*num == 0);
|
||||
|
||||
for(n=0 ; n < length ; ++n)
|
||||
AES_cfbr_encrypt_block(&in[n],&out[n],8,key,ivec,enc);
|
||||
CRYPTO_cfb128_8_encrypt(in,out,length,key,ivec,num,enc,(block128_f)AES_encrypt);
|
||||
}
|
||||
|
||||
|
@ -37,12 +37,9 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <openssl/aes.h>
|
||||
#ifdef OPENSSL_FIPS
|
||||
#include <openssl/fips.h>
|
||||
#endif
|
||||
|
||||
#include "aes_locl.h"
|
||||
|
||||
#ifndef AES_ASM
|
||||
/*
|
||||
Te0[x] = S [x].[02, 01, 01, 03];
|
||||
Te1[x] = S [x].[03, 02, 01, 01];
|
||||
@ -628,17 +625,13 @@ static const u32 rcon[] = {
|
||||
/**
|
||||
* Expand the cipher key into the encryption key schedule.
|
||||
*/
|
||||
int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key) {
|
||||
|
||||
u32 *rk;
|
||||
int i = 0;
|
||||
u32 temp;
|
||||
|
||||
#ifdef OPENSSL_FIPS
|
||||
FIPS_selftest_check();
|
||||
#endif
|
||||
|
||||
if (!userKey || !key)
|
||||
return -1;
|
||||
if (bits != 128 && bits != 192 && bits != 256)
|
||||
@ -733,7 +726,7 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
/**
|
||||
* Expand the cipher key into the decryption key schedule.
|
||||
*/
|
||||
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
int private_AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key) {
|
||||
|
||||
u32 *rk;
|
||||
@ -741,7 +734,7 @@ int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
u32 temp;
|
||||
|
||||
/* first, start with an encryption schedule */
|
||||
status = AES_set_encrypt_key(userKey, bits, key);
|
||||
status = private_AES_set_encrypt_key(userKey, bits, key);
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
@ -781,7 +774,6 @@ int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef AES_ASM
|
||||
/*
|
||||
* Encrypt a single block
|
||||
* in and out can overlap
|
||||
@ -1164,4 +1156,203 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
|
||||
PUTU32(out + 12, s3);
|
||||
}
|
||||
|
||||
#else /* AES_ASM */
|
||||
|
||||
static const u8 Te4[256] = {
|
||||
0x63U, 0x7cU, 0x77U, 0x7bU, 0xf2U, 0x6bU, 0x6fU, 0xc5U,
|
||||
0x30U, 0x01U, 0x67U, 0x2bU, 0xfeU, 0xd7U, 0xabU, 0x76U,
|
||||
0xcaU, 0x82U, 0xc9U, 0x7dU, 0xfaU, 0x59U, 0x47U, 0xf0U,
|
||||
0xadU, 0xd4U, 0xa2U, 0xafU, 0x9cU, 0xa4U, 0x72U, 0xc0U,
|
||||
0xb7U, 0xfdU, 0x93U, 0x26U, 0x36U, 0x3fU, 0xf7U, 0xccU,
|
||||
0x34U, 0xa5U, 0xe5U, 0xf1U, 0x71U, 0xd8U, 0x31U, 0x15U,
|
||||
0x04U, 0xc7U, 0x23U, 0xc3U, 0x18U, 0x96U, 0x05U, 0x9aU,
|
||||
0x07U, 0x12U, 0x80U, 0xe2U, 0xebU, 0x27U, 0xb2U, 0x75U,
|
||||
0x09U, 0x83U, 0x2cU, 0x1aU, 0x1bU, 0x6eU, 0x5aU, 0xa0U,
|
||||
0x52U, 0x3bU, 0xd6U, 0xb3U, 0x29U, 0xe3U, 0x2fU, 0x84U,
|
||||
0x53U, 0xd1U, 0x00U, 0xedU, 0x20U, 0xfcU, 0xb1U, 0x5bU,
|
||||
0x6aU, 0xcbU, 0xbeU, 0x39U, 0x4aU, 0x4cU, 0x58U, 0xcfU,
|
||||
0xd0U, 0xefU, 0xaaU, 0xfbU, 0x43U, 0x4dU, 0x33U, 0x85U,
|
||||
0x45U, 0xf9U, 0x02U, 0x7fU, 0x50U, 0x3cU, 0x9fU, 0xa8U,
|
||||
0x51U, 0xa3U, 0x40U, 0x8fU, 0x92U, 0x9dU, 0x38U, 0xf5U,
|
||||
0xbcU, 0xb6U, 0xdaU, 0x21U, 0x10U, 0xffU, 0xf3U, 0xd2U,
|
||||
0xcdU, 0x0cU, 0x13U, 0xecU, 0x5fU, 0x97U, 0x44U, 0x17U,
|
||||
0xc4U, 0xa7U, 0x7eU, 0x3dU, 0x64U, 0x5dU, 0x19U, 0x73U,
|
||||
0x60U, 0x81U, 0x4fU, 0xdcU, 0x22U, 0x2aU, 0x90U, 0x88U,
|
||||
0x46U, 0xeeU, 0xb8U, 0x14U, 0xdeU, 0x5eU, 0x0bU, 0xdbU,
|
||||
0xe0U, 0x32U, 0x3aU, 0x0aU, 0x49U, 0x06U, 0x24U, 0x5cU,
|
||||
0xc2U, 0xd3U, 0xacU, 0x62U, 0x91U, 0x95U, 0xe4U, 0x79U,
|
||||
0xe7U, 0xc8U, 0x37U, 0x6dU, 0x8dU, 0xd5U, 0x4eU, 0xa9U,
|
||||
0x6cU, 0x56U, 0xf4U, 0xeaU, 0x65U, 0x7aU, 0xaeU, 0x08U,
|
||||
0xbaU, 0x78U, 0x25U, 0x2eU, 0x1cU, 0xa6U, 0xb4U, 0xc6U,
|
||||
0xe8U, 0xddU, 0x74U, 0x1fU, 0x4bU, 0xbdU, 0x8bU, 0x8aU,
|
||||
0x70U, 0x3eU, 0xb5U, 0x66U, 0x48U, 0x03U, 0xf6U, 0x0eU,
|
||||
0x61U, 0x35U, 0x57U, 0xb9U, 0x86U, 0xc1U, 0x1dU, 0x9eU,
|
||||
0xe1U, 0xf8U, 0x98U, 0x11U, 0x69U, 0xd9U, 0x8eU, 0x94U,
|
||||
0x9bU, 0x1eU, 0x87U, 0xe9U, 0xceU, 0x55U, 0x28U, 0xdfU,
|
||||
0x8cU, 0xa1U, 0x89U, 0x0dU, 0xbfU, 0xe6U, 0x42U, 0x68U,
|
||||
0x41U, 0x99U, 0x2dU, 0x0fU, 0xb0U, 0x54U, 0xbbU, 0x16U
|
||||
};
|
||||
static const u32 rcon[] = {
|
||||
0x01000000, 0x02000000, 0x04000000, 0x08000000,
|
||||
0x10000000, 0x20000000, 0x40000000, 0x80000000,
|
||||
0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */
|
||||
};
|
||||
|
||||
/**
|
||||
* Expand the cipher key into the encryption key schedule.
|
||||
*/
|
||||
int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key) {
|
||||
u32 *rk;
|
||||
int i = 0;
|
||||
u32 temp;
|
||||
|
||||
if (!userKey || !key)
|
||||
return -1;
|
||||
if (bits != 128 && bits != 192 && bits != 256)
|
||||
return -2;
|
||||
|
||||
rk = key->rd_key;
|
||||
|
||||
if (bits==128)
|
||||
key->rounds = 10;
|
||||
else if (bits==192)
|
||||
key->rounds = 12;
|
||||
else
|
||||
key->rounds = 14;
|
||||
|
||||
rk[0] = GETU32(userKey );
|
||||
rk[1] = GETU32(userKey + 4);
|
||||
rk[2] = GETU32(userKey + 8);
|
||||
rk[3] = GETU32(userKey + 12);
|
||||
if (bits == 128) {
|
||||
while (1) {
|
||||
temp = rk[3];
|
||||
rk[4] = rk[0] ^
|
||||
(Te4[(temp >> 16) & 0xff] << 24) ^
|
||||
(Te4[(temp >> 8) & 0xff] << 16) ^
|
||||
(Te4[(temp ) & 0xff] << 8) ^
|
||||
(Te4[(temp >> 24) ]) ^
|
||||
rcon[i];
|
||||
rk[5] = rk[1] ^ rk[4];
|
||||
rk[6] = rk[2] ^ rk[5];
|
||||
rk[7] = rk[3] ^ rk[6];
|
||||
if (++i == 10) {
|
||||
return 0;
|
||||
}
|
||||
rk += 4;
|
||||
}
|
||||
}
|
||||
rk[4] = GETU32(userKey + 16);
|
||||
rk[5] = GETU32(userKey + 20);
|
||||
if (bits == 192) {
|
||||
while (1) {
|
||||
temp = rk[ 5];
|
||||
rk[ 6] = rk[ 0] ^
|
||||
(Te4[(temp >> 16) & 0xff] << 24) ^
|
||||
(Te4[(temp >> 8) & 0xff] << 16) ^
|
||||
(Te4[(temp ) & 0xff] << 8) ^
|
||||
(Te4[(temp >> 24) ]) ^
|
||||
rcon[i];
|
||||
rk[ 7] = rk[ 1] ^ rk[ 6];
|
||||
rk[ 8] = rk[ 2] ^ rk[ 7];
|
||||
rk[ 9] = rk[ 3] ^ rk[ 8];
|
||||
if (++i == 8) {
|
||||
return 0;
|
||||
}
|
||||
rk[10] = rk[ 4] ^ rk[ 9];
|
||||
rk[11] = rk[ 5] ^ rk[10];
|
||||
rk += 6;
|
||||
}
|
||||
}
|
||||
rk[6] = GETU32(userKey + 24);
|
||||
rk[7] = GETU32(userKey + 28);
|
||||
if (bits == 256) {
|
||||
while (1) {
|
||||
temp = rk[ 7];
|
||||
rk[ 8] = rk[ 0] ^
|
||||
(Te4[(temp >> 16) & 0xff] << 24) ^
|
||||
(Te4[(temp >> 8) & 0xff] << 16) ^
|
||||
(Te4[(temp ) & 0xff] << 8) ^
|
||||
(Te4[(temp >> 24) ]) ^
|
||||
rcon[i];
|
||||
rk[ 9] = rk[ 1] ^ rk[ 8];
|
||||
rk[10] = rk[ 2] ^ rk[ 9];
|
||||
rk[11] = rk[ 3] ^ rk[10];
|
||||
if (++i == 7) {
|
||||
return 0;
|
||||
}
|
||||
temp = rk[11];
|
||||
rk[12] = rk[ 4] ^
|
||||
(Te4[(temp >> 24) ] << 24) ^
|
||||
(Te4[(temp >> 16) & 0xff] << 16) ^
|
||||
(Te4[(temp >> 8) & 0xff] << 8) ^
|
||||
(Te4[(temp ) & 0xff]);
|
||||
rk[13] = rk[ 5] ^ rk[12];
|
||||
rk[14] = rk[ 6] ^ rk[13];
|
||||
rk[15] = rk[ 7] ^ rk[14];
|
||||
|
||||
rk += 8;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expand the cipher key into the decryption key schedule.
|
||||
*/
|
||||
int private_AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key) {
|
||||
|
||||
u32 *rk;
|
||||
int i, j, status;
|
||||
u32 temp;
|
||||
|
||||
/* first, start with an encryption schedule */
|
||||
status = private_AES_set_encrypt_key(userKey, bits, key);
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
rk = key->rd_key;
|
||||
|
||||
/* invert the order of the round keys: */
|
||||
for (i = 0, j = 4*(key->rounds); i < j; i += 4, j -= 4) {
|
||||
temp = rk[i ]; rk[i ] = rk[j ]; rk[j ] = temp;
|
||||
temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp;
|
||||
temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp;
|
||||
temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp;
|
||||
}
|
||||
/* apply the inverse MixColumn transform to all round keys but the first and the last: */
|
||||
for (i = 1; i < (key->rounds); i++) {
|
||||
rk += 4;
|
||||
for (j = 0; j < 4; j++) {
|
||||
u32 tp1, tp2, tp4, tp8, tp9, tpb, tpd, tpe, m;
|
||||
|
||||
tp1 = rk[j];
|
||||
m = tp1 & 0x80808080;
|
||||
tp2 = ((tp1 & 0x7f7f7f7f) << 1) ^
|
||||
((m - (m >> 7)) & 0x1b1b1b1b);
|
||||
m = tp2 & 0x80808080;
|
||||
tp4 = ((tp2 & 0x7f7f7f7f) << 1) ^
|
||||
((m - (m >> 7)) & 0x1b1b1b1b);
|
||||
m = tp4 & 0x80808080;
|
||||
tp8 = ((tp4 & 0x7f7f7f7f) << 1) ^
|
||||
((m - (m >> 7)) & 0x1b1b1b1b);
|
||||
tp9 = tp8 ^ tp1;
|
||||
tpb = tp9 ^ tp2;
|
||||
tpd = tp9 ^ tp4;
|
||||
tpe = tp8 ^ tp4 ^ tp2;
|
||||
#if defined(ROTATE)
|
||||
rk[j] = tpe ^ ROTATE(tpd,16) ^
|
||||
ROTATE(tp9,24) ^ ROTATE(tpb,8);
|
||||
#else
|
||||
rk[j] = tpe ^ (tpd >> 16) ^ (tpd << 16) ^
|
||||
(tp9 >> 8) ^ (tp9 << 24) ^
|
||||
(tpb >> 24) ^ (tpb << 8);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* AES_ASM */
|
||||
|
@ -49,91 +49,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AES_DEBUG
|
||||
# ifndef NDEBUG
|
||||
# define NDEBUG
|
||||
# endif
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_locl.h"
|
||||
#include <openssl/modes.h>
|
||||
|
||||
/* NOTE: the IV/counter CTR mode is big-endian. The rest of the AES code
|
||||
* is endian-neutral. */
|
||||
|
||||
/* increment counter (128-bit int) by 1 */
|
||||
static void AES_ctr128_inc(unsigned char *counter) {
|
||||
unsigned long c;
|
||||
|
||||
/* Grab bottom dword of counter and increment */
|
||||
c = GETU32(counter + 12);
|
||||
c++; c &= 0xFFFFFFFF;
|
||||
PUTU32(counter + 12, c);
|
||||
|
||||
/* if no overflow, we're done */
|
||||
if (c)
|
||||
return;
|
||||
|
||||
/* Grab 1st dword of counter and increment */
|
||||
c = GETU32(counter + 8);
|
||||
c++; c &= 0xFFFFFFFF;
|
||||
PUTU32(counter + 8, c);
|
||||
|
||||
/* if no overflow, we're done */
|
||||
if (c)
|
||||
return;
|
||||
|
||||
/* Grab 2nd dword of counter and increment */
|
||||
c = GETU32(counter + 4);
|
||||
c++; c &= 0xFFFFFFFF;
|
||||
PUTU32(counter + 4, c);
|
||||
|
||||
/* if no overflow, we're done */
|
||||
if (c)
|
||||
return;
|
||||
|
||||
/* Grab top dword of counter and increment */
|
||||
c = GETU32(counter + 0);
|
||||
c++; c &= 0xFFFFFFFF;
|
||||
PUTU32(counter + 0, c);
|
||||
}
|
||||
|
||||
/* The input encrypted as though 128bit counter mode is being
|
||||
* used. The extra state information to record how much of the
|
||||
* 128bit block we have used is contained in *num, and the
|
||||
* encrypted counter is kept in ecount_buf. Both *num and
|
||||
* ecount_buf must be initialised with zeros before the first
|
||||
* call to AES_ctr128_encrypt().
|
||||
*
|
||||
* This algorithm assumes that the counter is in the x lower bits
|
||||
* of the IV (ivec), and that the application has full control over
|
||||
* overflow and the rest of the IV. This implementation takes NO
|
||||
* responsability for checking that the counter doesn't overflow
|
||||
* into the rest of the IV when incremented.
|
||||
*/
|
||||
void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
unsigned char ivec[AES_BLOCK_SIZE],
|
||||
unsigned char ecount_buf[AES_BLOCK_SIZE],
|
||||
unsigned int *num) {
|
||||
|
||||
unsigned int n;
|
||||
unsigned long l=length;
|
||||
|
||||
assert(in && out && key && counter && num);
|
||||
assert(*num < AES_BLOCK_SIZE);
|
||||
|
||||
n = *num;
|
||||
|
||||
while (l--) {
|
||||
if (n == 0) {
|
||||
AES_encrypt(ivec, ecount_buf, key);
|
||||
AES_ctr128_inc(ivec);
|
||||
}
|
||||
*(out++) = *(in++) ^ ecount_buf[n];
|
||||
n = (n+1) % AES_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
*num=n;
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char ivec[AES_BLOCK_SIZE],
|
||||
unsigned char ecount_buf[AES_BLOCK_SIZE],
|
||||
unsigned int *num) {
|
||||
CRYPTO_ctr128_encrypt(in,out,length,key,ivec,ecount_buf,num,(block128_f)AES_encrypt);
|
||||
}
|
||||
|
@ -77,11 +77,11 @@ typedef struct {
|
||||
/* N.B. The IV for this mode is _twice_ the block size */
|
||||
|
||||
void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, const int enc)
|
||||
{
|
||||
unsigned long n;
|
||||
unsigned long len;
|
||||
size_t n;
|
||||
size_t len = length;
|
||||
|
||||
OPENSSL_assert(in && out && key && ivec);
|
||||
OPENSSL_assert((AES_ENCRYPT == enc)||(AES_DECRYPT == enc));
|
||||
@ -211,12 +211,12 @@ void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
|
||||
/* N.B. The IV for this mode is _four times_ the block size */
|
||||
|
||||
void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
size_t length, const AES_KEY *key,
|
||||
const AES_KEY *key2, const unsigned char *ivec,
|
||||
const int enc)
|
||||
{
|
||||
unsigned long n;
|
||||
unsigned long len = length;
|
||||
size_t n;
|
||||
size_t len = length;
|
||||
unsigned char tmp[AES_BLOCK_SIZE];
|
||||
unsigned char tmp2[AES_BLOCK_SIZE];
|
||||
unsigned char tmp3[AES_BLOCK_SIZE];
|
||||
|
@ -50,6 +50,7 @@
|
||||
*/
|
||||
|
||||
#include <openssl/opensslv.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_locl.h"
|
||||
|
||||
@ -62,3 +63,23 @@ const char *AES_options(void) {
|
||||
return "aes(partial)";
|
||||
#endif
|
||||
}
|
||||
|
||||
/* FIPS wrapper functions to block low level AES calls in FIPS mode */
|
||||
|
||||
int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key)
|
||||
{
|
||||
#ifdef OPENSSL_FIPS
|
||||
fips_cipher_abort(AES);
|
||||
#endif
|
||||
return private_AES_set_encrypt_key(userKey, bits, key);
|
||||
}
|
||||
|
||||
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key)
|
||||
{
|
||||
#ifdef OPENSSL_FIPS
|
||||
fips_cipher_abort(AES);
|
||||
#endif
|
||||
return private_AES_set_decrypt_key(userKey, bits, key);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* crypto/aes/aes_ofb.c -*- mode:C; c-file-style: "eay" -*- */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||
* Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -48,95 +48,13 @@
|
||||
* ====================================================================
|
||||
*
|
||||
*/
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef AES_DEBUG
|
||||
# ifndef NDEBUG
|
||||
# define NDEBUG
|
||||
# endif
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_locl.h"
|
||||
#include <openssl/modes.h>
|
||||
|
||||
/* The input and output encrypted as though 128bit ofb mode is being
|
||||
* used. The extra state information to record how much of the
|
||||
* 128bit block we have used is contained in *num;
|
||||
*/
|
||||
void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num) {
|
||||
|
||||
unsigned int n;
|
||||
unsigned long l=length;
|
||||
|
||||
assert(in && out && key && ivec && num);
|
||||
|
||||
n = *num;
|
||||
|
||||
while (l--) {
|
||||
if (n == 0) {
|
||||
AES_encrypt(ivec, ivec, key);
|
||||
}
|
||||
*(out++) = *(in++) ^ ivec[n];
|
||||
n = (n+1) % AES_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
*num=n;
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num)
|
||||
{
|
||||
CRYPTO_ofb128_encrypt(in,out,length,key,ivec,num,(block128_f)AES_encrypt);
|
||||
}
|
||||
|
1063
crypto/openssl/crypto/aes/aes_x86core.c
Normal file
1063
crypto/openssl/crypto/aes/aes_x86core.c
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1134
crypto/openssl/crypto/aes/asm/aes-armv4.pl
Executable file
1134
crypto/openssl/crypto/aes/asm/aes-armv4.pl
Executable file
File diff suppressed because it is too large
Load Diff
1611
crypto/openssl/crypto/aes/asm/aes-mips.pl
Executable file
1611
crypto/openssl/crypto/aes/asm/aes-mips.pl
Executable file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user