Latest update.
This commit is contained in:
@@ -9,6 +9,204 @@
|
||||
|
||||
Changes between 1.1.1 and 3.0.0 [xx XXX xxxx]
|
||||
|
||||
*) Enhanced the documentation of EVP_PKEY_size(), EVP_PKEY_bits()
|
||||
and EVP_PKEY_security_bits(). Especially EVP_PKEY_size() needed
|
||||
a new formulation to include all the things it can be used for,
|
||||
as well as words of caution.
|
||||
[Richard Levitte]
|
||||
|
||||
*) All of the low level MD2, MD4, MD5, MDC2, RIPEMD160, SHA1, SHA224, SHA256,
|
||||
SHA384, SHA512 and Whirlpool digest functions have been deprecated.
|
||||
These include:
|
||||
MD2, MD2_options, MD2_Init, MD2_Update, MD2_Final, MD4, MD4_Init,
|
||||
MD4_Update, MD4_Final, MD4_Transform, MD5, MD5_Init, MD5_Update,
|
||||
MD5_Final, MD5_Transform, MDC2, MDC2_Init, MDC2_Update, MDC2_Final,
|
||||
RIPEMD160, RIPEMD160_Init, RIPEMD160_Update, RIPEMD160_Final,
|
||||
RIPEMD160_Transform, SHA1_Init, SHA1_Update, SHA1_Final,
|
||||
SHA1_Transform, SHA224_Init, SHA224_Update, SHA224_Final,
|
||||
SHA224_Transform, SHA256_Init, SHA256_Update, SHA256_Final,
|
||||
SHA256_Transform, SHA384, SHA384_Init, SHA384_Update, SHA384_Final,
|
||||
SHA512, SHA512_Init, SHA512_Update, SHA512_Final, SHA512_Transform,
|
||||
WHIRLPOOL, WHIRLPOOL_Init, WHIRLPOOL_Update, WHIRLPOOL_BitUpdate
|
||||
and WHIRLPOOL_Final.
|
||||
Use of these low level functions has been informally discouraged for a long
|
||||
time. Instead applications should instead use the EVP_DigestInit_ex,
|
||||
EVP_DigestUpdate(3) and EVP_DigestFinal_ex(3) functions.
|
||||
[Paul Dale]
|
||||
|
||||
*) Corrected the documentation of the return values from the EVP_DigestSign*
|
||||
set of functions. The documentation mentioned negative values for some
|
||||
errors, but this was never the case, so the mention of negative values
|
||||
was removed.
|
||||
|
||||
Code that followed the documentation and thereby check with something
|
||||
like 'EVP_DigestSignInit(...) <= 0' will continue to work undisturbed.
|
||||
[Richard Levitte]
|
||||
|
||||
*) All of the low level cipher functions have been deprecated including:
|
||||
AES_options, AES_set_encrypt_key, AES_set_decrypt_key, AES_encrypt,
|
||||
AES_decrypt, AES_ecb_encrypt, AES_cbc_encrypt, AES_cfb128_encrypt,
|
||||
AES_cfb1_encrypt, AES_cfb8_encrypt, AES_ofb128_encrypt,
|
||||
AES_wrap_key, AES_unwrap_key, BF_set_key, BF_encrypt, BF_decrypt,
|
||||
BF_ecb_encrypt, BF_cbc_encrypt, BF_cfb64_encrypt, BF_ofb64_encrypt,
|
||||
BF_options, Camellia_set_key, Camellia_encrypt, Camellia_decrypt,
|
||||
Camellia_ecb_encrypt, Camellia_cbc_encrypt, Camellia_cfb128_encrypt,
|
||||
Camellia_cfb1_encrypt, Camellia_cfb8_encrypt, Camellia_ofb128_encrypt,
|
||||
Camellia_ctr128_encrypt, CAST_set_key, CAST_encrypt, CAST_decrypt,
|
||||
CAST_ecb_encrypt, CAST_cbc_encrypt, CAST_cfb64_encrypt,
|
||||
CAST_ofb64_encrypt, DES_options, DES_encrypt1, DES_encrypt2,
|
||||
DES_encrypt3, DES_decrypt3, DES_cbc_encrypt, DES_ncbc_encrypt,
|
||||
DES_pcbc_encrypt, DES_xcbc_encrypt, DES_cfb_encrypt, DES_cfb64_encrypt,
|
||||
DES_ecb_encrypt, DES_ofb_encrypt, DES_ofb64_encrypt, DES_random_key,
|
||||
DES_set_odd_parity, DES_check_key_parity, DES_is_weak_key, DES_set_key,
|
||||
DES_key_sched, DES_set_key_checked, DES_set_key_unchecked,
|
||||
DES_string_to_key, DES_string_to_2keys, DES_fixup_key_parity,
|
||||
DES_ecb2_encrypt, DES_ede2_cbc_encrypt, DES_ede2_cfb64_encrypt,
|
||||
DES_ede2_ofb64_encrypt, DES_ecb3_encrypt, DES_ede3_cbc_encrypt,
|
||||
DES_ede3_cfb64_encrypt, DES_ede3_cfb_encrypt, DES_ede3_ofb64_encrypt,
|
||||
DES_cbc_cksum, DES_quad_cksum, IDEA_encrypt, IDEA_options,
|
||||
IDEA_ecb_encrypt, IDEA_set_encrypt_key, IDEA_set_decrypt_key,
|
||||
IDEA_cbc_encrypt, IDEA_cfb64_encrypt, IDEA_ofb64_encrypt, RC2_set_key,
|
||||
RC2_encrypt, RC2_decrypt, RC2_ecb_encrypt, RC2_cbc_encrypt,
|
||||
RC2_cfb64_encrypt, RC2_ofb64_encrypt, RC4, RC4_options, RC4_set_key,
|
||||
RC5_32_set_key, RC5_32_encrypt, RC5_32_decrypt, RC5_32_ecb_encrypt,
|
||||
RC5_32_cbc_encrypt, RC5_32_cfb64_encrypt, RC5_32_ofb64_encrypt,
|
||||
SEED_set_key, SEED_encrypt, SEED_decrypt, SEED_ecb_encrypt,
|
||||
SEED_cbc_encrypt, SEED_cfb128_encrypt and SEED_ofb128_encrypt.
|
||||
|
||||
Use of these low level functions has been informally discouraged for a long
|
||||
time. Instead applications should use the high level EVP APIs, e.g.
|
||||
EVP_EncryptInit_ex, EVP_EncryptUpdate, EVP_EncryptFinal_ex, and the
|
||||
equivalently named decrypt functions.
|
||||
[Matt Caswell and Paul Dale]
|
||||
|
||||
*) Removed include/openssl/opensslconf.h.in and replaced it with
|
||||
include/openssl/configuration.h.in, which differs in not including
|
||||
<openssl/macros.h>. A short header include/openssl/opensslconf.h
|
||||
was added to include both.
|
||||
|
||||
This allows internal hacks where one might need to modify the set
|
||||
of configured macros, for example this if deprecated symbols are
|
||||
still supposed to be available internally:
|
||||
|
||||
#include <openssl/configuration.h>
|
||||
|
||||
#undef OPENSSL_NO_DEPRECATED
|
||||
#define OPENSSL_SUPPRESS_DEPRECATED
|
||||
|
||||
#include <openssl/macros.h>
|
||||
|
||||
This should not be used by applications that use the exported
|
||||
symbols, as that will lead to linking errors.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Fixed an an overflow bug in the x64_64 Montgomery squaring procedure
|
||||
used in exponentiation with 512-bit moduli. No EC algorithms are
|
||||
affected. Analysis suggests that attacks against 2-prime RSA1024,
|
||||
3-prime RSA1536, and DSA1024 as a result of this defect would be very
|
||||
difficult to perform and are not believed likely. Attacks against DH512
|
||||
are considered just feasible. However, for an attack the target would
|
||||
have to re-use the DH512 private key, which is not recommended anyway.
|
||||
Also applications directly using the low level API BN_mod_exp may be
|
||||
affected if they use BN_FLG_CONSTTIME.
|
||||
(CVE-2019-1551)
|
||||
[Andy Polyakov]
|
||||
|
||||
*) Most memory-debug features have been deprecated, and the functionality
|
||||
replaced with no-ops.
|
||||
[Rich Salz]
|
||||
|
||||
*) Introduced a new method type and API, OSSL_SERIALIZER, to
|
||||
represent generic serializers. An implementation is expected to
|
||||
be able to serialize an object associated with a given name (such
|
||||
as an algorithm name for an asymmetric key) into forms given by
|
||||
implementation properties.
|
||||
|
||||
Serializers are primarily used from inside libcrypto, through
|
||||
calls to functions like EVP_PKEY_print_private(),
|
||||
PEM_write_bio_PrivateKey() and similar.
|
||||
|
||||
Serializers are specified in such a way that they can be made to
|
||||
directly handle the provider side portion of an object, if this
|
||||
provider side part comes from the same provider as the serializer
|
||||
itself, but can also be made to handle objects in parametrized
|
||||
form (as an OSSL_PARAM array of data). This allows a provider to
|
||||
offer generic serializers as a service for any other provider.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Added a .pragma directive to the syntax of configuration files, to
|
||||
allow varying behavior in a supported and predictable manner.
|
||||
Currently added pragma:
|
||||
|
||||
.pragma dollarid:on
|
||||
|
||||
This allows dollar signs to be a keyword character unless it's
|
||||
followed by a opening brace or parenthesis. This is useful for
|
||||
platforms where dollar signs are commonly used in names, such as
|
||||
volume names and system directory names on VMS.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Added functionality to create an EVP_PKEY from user data. This
|
||||
is effectively the same as creating a RSA, DH or DSA object and
|
||||
then assigning them to an EVP_PKEY, but directly using algorithm
|
||||
agnostic EVP functions. A benefit is that this should be future
|
||||
proof for public key algorithms to come.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Change the interpretation of the '--api' configuration option to
|
||||
mean that this is a desired API compatibility level with no
|
||||
further meaning. The previous interpretation, that this would
|
||||
also mean to remove all deprecated symbols up to and including
|
||||
the given version, no requires that 'no-deprecated' is also used
|
||||
in the configuration.
|
||||
|
||||
When building applications, the desired API compatibility level
|
||||
can be set with the OPENSSL_API_COMPAT macro like before. For
|
||||
API compatibility version below 3.0, the old style numerical
|
||||
value is valid as before, such as -DOPENSSL_API_COMPAT=0x10100000L.
|
||||
For version 3.0 and on, the value is expected to be the decimal
|
||||
value calculated from the major and minor version like this:
|
||||
|
||||
MAJOR * 10000 + MINOR * 100
|
||||
|
||||
Examples:
|
||||
|
||||
-DOPENSSL_API_COMPAT=30000 For 3.0
|
||||
-DOPENSSL_API_COMPAT=30200 For 3.2
|
||||
|
||||
To hide declarations that are deprecated up to and including the
|
||||
given API compatibility level, -DOPENSSL_NO_DEPRECATED must be
|
||||
given when building the application as well.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Added the X509_LOOKUP_METHOD called X509_LOOKUP_store, to allow
|
||||
access to certificate and CRL stores via URIs and OSSL_STORE
|
||||
loaders.
|
||||
|
||||
This adds the following functions:
|
||||
|
||||
X509_LOOKUP_store()
|
||||
X509_STORE_load_file()
|
||||
X509_STORE_load_path()
|
||||
X509_STORE_load_store()
|
||||
SSL_add_store_cert_subjects_to_stack()
|
||||
SSL_CTX_set_default_verify_store()
|
||||
SSL_CTX_load_verify_file()
|
||||
SSL_CTX_load_verify_dir()
|
||||
SSL_CTX_load_verify_store()
|
||||
|
||||
Also, the following functions are now deprecated:
|
||||
|
||||
- X509_STORE_load_locations() (use X509_STORE_load_file(),
|
||||
X509_STORE_load_path() or X509_STORE_load_store() instead)
|
||||
- SSL_CTX_load_verify_locations() (use SSL_CTX_load_verify_file(),
|
||||
SSL_CTX_load_verify_dir() or SSL_CTX_load_verify_store() instead)
|
||||
[Richard Levitte]
|
||||
|
||||
*) Added a new method to gather entropy on VMS, based on SYS$GET_ENTROPY.
|
||||
The presence of this system service is determined at run-time.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Added functionality to create an EVP_PKEY context based on data
|
||||
for methods from providers. This takes an algorithm name and a
|
||||
property query string and simply stores them, with the intent
|
||||
@@ -27,6 +225,10 @@
|
||||
pages for further details.
|
||||
[Matt Caswell]
|
||||
|
||||
*) Most common options (such as -rand/-writerand, TLS version control, etc)
|
||||
were refactored and point to newly-enhanced descriptions in openssl.pod
|
||||
[Rich Salz]
|
||||
|
||||
*) Over two thousand fixes were made to the documentation, including:
|
||||
adding missing command flags, better style conformance, documentation
|
||||
of internals, etc.
|
||||
@@ -332,15 +534,6 @@
|
||||
*) Change the license to the Apache License v2.0.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Change the possible version information given with OPENSSL_API_COMPAT.
|
||||
It may be a pre-3.0.0 style numerical version number as it was defined
|
||||
in 1.1.0, and it may also simply take the major version number.
|
||||
|
||||
Because of the version numbering of pre-3.0.0 releases, the values 0,
|
||||
1 and 2 are equivalent to 0x00908000L (0.9.8), 0x10000000L (1.0.0) and
|
||||
0x10100000L (1.1.0), respectively.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Switch to a new version scheme using three numbers MAJOR.MINOR.PATCH.
|
||||
|
||||
o Major releases (indicated by incrementing the MAJOR release number)
|
||||
|
||||
@@ -10,7 +10,7 @@ my %targets=(
|
||||
includes => [],
|
||||
lib_cflags => "",
|
||||
lib_cppflags => "",
|
||||
lib_defines => [],
|
||||
lib_defines => [ 'OPENSSL_BUILDING_OPENSSL' ],
|
||||
thread_scheme => "(unknown)", # Assume we don't know
|
||||
thread_defines => [],
|
||||
|
||||
|
||||
@@ -211,17 +211,28 @@ my %targets = (
|
||||
ex_libs => add("-lsocket -lnsl -ldl"),
|
||||
dso_scheme => "dlfcn",
|
||||
thread_scheme => "pthreads",
|
||||
},
|
||||
#### Solaris common with Sun C setups
|
||||
"solaris-common-cc" => {
|
||||
inherit_from => [ "solaris-common" ],
|
||||
template => 1,
|
||||
shared_target => "solaris",
|
||||
shared_ldflag => "-Wl,-Bsymbolic",
|
||||
shared_defflag => "-Wl,-M,",
|
||||
shared_sonameflag=> "-Wl,-h,",
|
||||
},
|
||||
#### Solaris common with GNU C setups
|
||||
"solaris-common-gcc" => {
|
||||
inherit_from => [ "solaris-common" ],
|
||||
template => 1,
|
||||
shared_target => "solaris-gcc", # The rest is on shared_info.pl
|
||||
},
|
||||
#### Solaris x86 with GNU C setups
|
||||
"solaris-x86-gcc" => {
|
||||
# NB. GNU C has to be configured to use GNU assembler, and not
|
||||
# /usr/ccs/bin/as. Failure to comply will result in compile
|
||||
# failures [at least] in 32-bit build.
|
||||
inherit_from => [ "solaris-common" ],
|
||||
inherit_from => [ "solaris-common-gcc" ],
|
||||
CC => "gcc",
|
||||
CFLAGS => add_before(picker(default => "-Wall",
|
||||
debug => "-O0 -g",
|
||||
@@ -244,7 +255,7 @@ my %targets = (
|
||||
# code [thanks to inline assembler], I would actually recommend
|
||||
# to consider using gcc shared build even with vendor compiler:-)
|
||||
# -- <appro@openssl.org>
|
||||
inherit_from => [ "solaris-common" ],
|
||||
inherit_from => [ "solaris-common-gcc" ],
|
||||
CC => "gcc",
|
||||
CFLAGS => add_before(picker(default => "-Wall",
|
||||
debug => "-O0 -g",
|
||||
@@ -265,7 +276,7 @@ my %targets = (
|
||||
# primarily because vendor assembler can't assemble our modules
|
||||
# with -KPIC flag. As result it, assembly support, was not even
|
||||
# available as option. But its lack means lack of side-channel
|
||||
# resistant code, which is incompatible with security by todays
|
||||
# resistant code, which is incompatible with security by today's
|
||||
# standards. Fortunately gcc is readily available prepackaged
|
||||
# option, which we can firmly point at...
|
||||
#
|
||||
@@ -274,7 +285,7 @@ my %targets = (
|
||||
# Consider switching to solaris64-x86_64-gcc even here...
|
||||
#
|
||||
"solaris64-x86_64-cc" => {
|
||||
inherit_from => [ "solaris-common" ],
|
||||
inherit_from => [ "solaris-common-cc" ],
|
||||
CC => "cc",
|
||||
CFLAGS => add_before(picker(debug => "-g",
|
||||
release => "-xO5 -xdepend -xbuiltin")),
|
||||
@@ -294,7 +305,7 @@ my %targets = (
|
||||
|
||||
#### SPARC Solaris with GNU C setups
|
||||
"solaris-sparcv7-gcc" => {
|
||||
inherit_from => [ "solaris-common" ],
|
||||
inherit_from => [ "solaris-common-gcc" ],
|
||||
CC => "gcc",
|
||||
CFLAGS => add_before(picker(default => "-Wall",
|
||||
debug => "-O0 -g",
|
||||
@@ -332,7 +343,7 @@ my %targets = (
|
||||
# SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8
|
||||
# SC5.0 note: Compiler common patch 107357-01 or later is required!
|
||||
"solaris-sparcv7-cc" => {
|
||||
inherit_from => [ "solaris-common" ],
|
||||
inherit_from => [ "solaris-common-cc" ],
|
||||
CC => "cc",
|
||||
CFLAGS => add_before(picker(debug => "-g",
|
||||
release => "-xO5 -xdepend")),
|
||||
@@ -1352,7 +1363,6 @@ my %targets = (
|
||||
},
|
||||
"VC-WIN32" => {
|
||||
inherit_from => [ "VC-noCE-common" ],
|
||||
CFLAGS => add("/WX"),
|
||||
AS => sub { vc_win32_info()->{AS} },
|
||||
ASFLAGS => sub { vc_win32_info()->{ASFLAGS} },
|
||||
asoutflag => sub { vc_win32_info()->{asoutflag} },
|
||||
@@ -1766,7 +1776,7 @@ my %targets = (
|
||||
debug => "/DEBUG/TRACEBACK",
|
||||
release => "/NODEBUG/NOTRACEBACK"),
|
||||
# Because of dso_cflags below, we can't set the generic |cflags| here,
|
||||
# as it can't be overriden, so we set separate C flags for libraries
|
||||
# as it can't be overridden, so we set separate C flags for libraries
|
||||
# and binaries instead.
|
||||
bin_cflags => add("/NAMES=(AS_IS,SHORTENED)/EXTERN_MODEL=STRICT_REFDEF"),
|
||||
lib_cflags => add("/NAMES=(AS_IS,SHORTENED)/EXTERN_MODEL=STRICT_REFDEF"),
|
||||
|
||||
@@ -151,10 +151,18 @@
|
||||
generator_incs => $unified_info{includes}->{$script},
|
||||
generator_deps => $unified_info{depends}->{$script},
|
||||
deps => $unified_info{depends}->{$src},
|
||||
incs => [ @{$unified_info{includes}->{$obj}},
|
||||
@{$unified_info{includes}->{$bin}} ],
|
||||
defs => [ @{$unified_info{defines}->{$obj}},
|
||||
@{$unified_info{defines}->{$bin}} ],
|
||||
incs => [ defined $obj
|
||||
? @{$unified_info{includes}->{$obj}}
|
||||
: (),
|
||||
defined $bin
|
||||
? @{$unified_info{includes}->{$bin}}
|
||||
: () ],
|
||||
defs => [ defined $obj
|
||||
? @{$unified_info{defines}->{$obj}}
|
||||
: (),
|
||||
defined $bin
|
||||
? @{$unified_info{defines}->{$bin}}
|
||||
: () ],
|
||||
%opts);
|
||||
foreach (@{$unified_info{depends}->{$src}}) {
|
||||
dogenerate($_, $obj, $bin, %opts);
|
||||
@@ -436,6 +444,22 @@
|
||||
$cache{$dir} = 1;
|
||||
}
|
||||
|
||||
# dodocs is responsible for building documentation from .pods.
|
||||
# It will call generatesrc.
|
||||
sub dodocs {
|
||||
my $type = shift;
|
||||
my $section = shift;
|
||||
foreach my $doc (@{$unified_info{"${type}docs"}->{$section}}) {
|
||||
next if $cache{$doc};
|
||||
$OUT .= generatesrc(src => $doc,
|
||||
generator => $unified_info{generate}->{$doc});
|
||||
foreach ((@{$unified_info{depends}->{$doc}})) {
|
||||
dogenerate($_, undef, undef, %opts);
|
||||
}
|
||||
$cache{$doc} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# Start with populating the cache with all the overrides
|
||||
%cache = map { $_ => 1 } @{$unified_info{overrides}};
|
||||
|
||||
@@ -448,6 +472,7 @@
|
||||
foreach (@{$unified_info{modules}}) { domodule($_); }
|
||||
foreach (@{$unified_info{programs}}) { dobin($_); }
|
||||
foreach (@{$unified_info{scripts}}) { doscript($_); }
|
||||
|
||||
foreach (sort keys %{$unified_info{htmldocs}}) { dodocs('html', $_); }
|
||||
foreach (sort keys %{$unified_info{mandocs}}) { dodocs('man', $_); }
|
||||
foreach (sort keys %{$unified_info{dirinfo}}) { dodir($_); }
|
||||
-}
|
||||
@@ -143,6 +143,10 @@ INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @install_engines) -}
|
||||
INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @install_programs) -}
|
||||
BIN_SCRIPTS={- join(", ", @install_bin_scripts) -}
|
||||
MISC_SCRIPTS={- join(", ", @install_misc_scripts) -}
|
||||
HTMLDOCS1={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man1}}) -}
|
||||
HTMLDOCS3={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man3}}) -}
|
||||
HTMLDOCS5={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man5}}) -}
|
||||
HTMLDOCS7={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man7}}) -}
|
||||
|
||||
APPS_OPENSSL={- use File::Spec::Functions;
|
||||
catfile("apps","openssl") -}
|
||||
@@ -405,7 +409,7 @@ NODEBUG=@
|
||||
|
||||
# The main targets ###################################################
|
||||
|
||||
{- dependmagic('all'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep
|
||||
{- dependmagic('build_sw'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep
|
||||
{- dependmagic('build_libs'); -} : build_libs_nodep
|
||||
{- dependmagic('build_modules'); -} : build_modules_nodep
|
||||
{- dependmagic('build_programs'); -} : build_programs_nodep
|
||||
@@ -415,18 +419,23 @@ build_libs_nodep : $(LIBS), $(SHLIBS)
|
||||
build_modules_nodep : $(MODULES)
|
||||
build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
|
||||
|
||||
build_docs: build_html_docs
|
||||
build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
|
||||
|
||||
# Kept around for backward compatibility
|
||||
build_apps build_tests : build_programs
|
||||
|
||||
# Convenience target to prebuild all generated files, not just the mandatory
|
||||
# ones
|
||||
build_all_generated : $(GENERATED_MANDATORY) $(GENERATED)
|
||||
build_all_generated : $(GENERATED_MANDATORY) $(GENERATED) build_docs
|
||||
@ ! {- output_off() if $disabled{makedepend}; "" -}
|
||||
@ WRITE SYS$OUTPUT "Warning: consider configuring with no-makedepend, because if"
|
||||
@ WRITE SYS$OUTPUT " target system doesn't have $(PERL),"
|
||||
@ WRITE SYS$OUTPUT " then make will fail..."
|
||||
@ ! {- output_on() if $disabled{makedepend}; "" -}
|
||||
|
||||
all : build_sw build_docs
|
||||
|
||||
test : tests
|
||||
{- dependmagic('tests'); -} : build_programs_nodep, build_modules_nodep
|
||||
@ ! {- output_off() if $disabled{tests}; "" -}
|
||||
@@ -437,10 +446,8 @@ test : tests
|
||||
DEFINE RESULT_D {- builddir(qw(test test-runs)) -}
|
||||
DEFINE OPENSSL_ENGINES {- builddir("engines") -}
|
||||
DEFINE OPENSSL_MODULES {- builddir("providers") -}
|
||||
DEFINE OPENSSL_DEBUG_MEMORY "on"
|
||||
IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
|
||||
$(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
|
||||
DEASSIGN OPENSSL_DEBUG_MEMORY
|
||||
DEASSIGN OPENSSL_MODULES
|
||||
DEASSIGN OPENSSL_ENGINES
|
||||
DEASSIGN BLDTOP
|
||||
@@ -459,7 +466,9 @@ list-tests :
|
||||
@ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
|
||||
@ ! {- output_on() if !$disabled{tests}; "" -}
|
||||
|
||||
install : install_sw install_ssldirs install_docs
|
||||
install : install_sw install_ssldirs install_docs install_final
|
||||
|
||||
install_final :
|
||||
@ WRITE SYS$OUTPUT ""
|
||||
@ WRITE SYS$OUTPUT "######################################################################"
|
||||
@ WRITE SYS$OUTPUT ""
|
||||
@@ -496,6 +505,10 @@ libclean :
|
||||
{- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
|
||||
|
||||
clean : libclean
|
||||
{- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man1}}) || "@ !" -}
|
||||
{- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man3}}) || "@ !" -}
|
||||
{- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man5}}) || "@ !" -}
|
||||
{- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man7}}) || "@ !" -}
|
||||
{- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
|
||||
{- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{modules}}) || "@ !" -}
|
||||
{- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
|
||||
@@ -659,11 +672,21 @@ vmsconfig.pm : configdata.pm
|
||||
WRITE CONFIG "1;"
|
||||
CLOSE CONFIG
|
||||
|
||||
install_html_docs : check_INSTALLTOP
|
||||
sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]"
|
||||
$(PERL) {- sourcefile("util", "process_docs.pl") -} -
|
||||
--sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] -
|
||||
--type=html
|
||||
install_html_docs : check_INSTALLTOP build_html_docs
|
||||
@ WRITE SYS$OUTPUT "*** Installing HTML docs"
|
||||
- CREATE/DIR ossl_installroot:[HTML.MAN1]
|
||||
- CREATE/DIR ossl_installroot:[HTML.MAN3]
|
||||
- CREATE/DIR ossl_installroot:[HTML.MAN5]
|
||||
- CREATE/DIR ossl_installroot:[HTML.MAN7]
|
||||
{- join("\n ",
|
||||
( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN1]" }
|
||||
@{$unified_info{htmldocs}->{man1}} ),
|
||||
( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN3]" }
|
||||
@{$unified_info{htmldocs}->{man3}} ),
|
||||
( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN5]" }
|
||||
@{$unified_info{htmldocs}->{man5}} ),
|
||||
( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN7]" }
|
||||
@{$unified_info{htmldocs}->{man7}} )) -}
|
||||
|
||||
check_INSTALLTOP :
|
||||
@ IF "$(INSTALLTOP)" .EQS. "" THEN -
|
||||
@@ -756,7 +779,18 @@ reconfigure reconf :
|
||||
my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
|
||||
my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
|
||||
|
||||
if (platform->isdef($args{src})) {
|
||||
if ($args{src} =~ /\.html$/) {
|
||||
my $title = basename($args{src}, ".html");
|
||||
my $pod = $args{generator}->[0];
|
||||
return <<"EOF";
|
||||
$args{src}: $pod
|
||||
pipe pod2html "--podroot=\$(SRCDIR)/doc" --htmldir=.. -
|
||||
--podpath=man1:man3:man5:man7 "--infile=$pod" -
|
||||
"--title=$title" -
|
||||
| \$(PERL) -pe "s|href=""http://man\\.he\\.net/(man\d/[^""]+)(?:\\.html)?""|href=""../\$1.html|g;" -
|
||||
> \$\@
|
||||
EOF
|
||||
} elsif (platform->isdef($args{src})) {
|
||||
my $target = platform->def($args{src});
|
||||
my $mkdef = sourcefile('util', 'mkdef.pl');
|
||||
my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
|
||||
|
||||
@@ -84,4 +84,16 @@ my %shared_info;
|
||||
shared_sonameflag => '-h ',
|
||||
};
|
||||
},
|
||||
'solaris-gcc-shared' => sub {
|
||||
return $shared_info{'linux-shared'} if detect_gnu_ld();
|
||||
return {
|
||||
# Note: we should also have -shared here, but because some
|
||||
# config targets define it with an added -static-libgcc
|
||||
# following it, we don't want to change the order. This
|
||||
# forces all solaris gcc config targets to define shared_ldflag
|
||||
shared_ldflag => '-Wl,-Bsymbolic',
|
||||
shared_defflag => "-Wl,-M,",
|
||||
shared_sonameflag => "-Wl,-h,",
|
||||
};
|
||||
},
|
||||
);
|
||||
@@ -162,6 +162,38 @@ MISC_SCRIPTS={-
|
||||
&& $unified_info{attributes}->{scripts}->{$_}->{misc} }
|
||||
@{$unified_info{scripts}}))
|
||||
-}
|
||||
HTMLDOCS1={-
|
||||
join(" \\\n" . ' ' x 10,
|
||||
fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
|
||||
@{$unified_info{htmldocs}->{man1}})) -}
|
||||
HTMLDOCS3={-
|
||||
join(" \\\n" . ' ' x 10,
|
||||
fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
|
||||
@{$unified_info{htmldocs}->{man3}})) -}
|
||||
HTMLDOCS5={-
|
||||
join(" \\\n" . ' ' x 10,
|
||||
fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
|
||||
@{$unified_info{htmldocs}->{man5}})) -}
|
||||
HTMLDOCS7={-
|
||||
join(" \\\n" . ' ' x 10,
|
||||
fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
|
||||
@{$unified_info{htmldocs}->{man7}})) -}
|
||||
MANDOCS1={-
|
||||
join(" \\\n" . ' ' x 9,
|
||||
fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
|
||||
@{$unified_info{mandocs}->{man1}})) -}
|
||||
MANDOCS3={-
|
||||
join(" \\\n" . ' ' x 9,
|
||||
fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
|
||||
@{$unified_info{mandocs}->{man3}})) -}
|
||||
MANDOCS5={-
|
||||
join(" \\\n" . ' ' x 9,
|
||||
fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
|
||||
@{$unified_info{mandocs}->{man5}})) -}
|
||||
MANDOCS7={-
|
||||
join(" \\\n" . ' ' x 9,
|
||||
fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
|
||||
@{$unified_info{mandocs}->{man7}})) -}
|
||||
|
||||
APPS_OPENSSL={- use File::Spec::Functions;
|
||||
catfile("apps","openssl") -}
|
||||
@@ -300,8 +332,15 @@ LIB_CPPFLAGS={- our $lib_cppflags =
|
||||
join(' ', $target{lib_cppflags} || (),
|
||||
$target{shared_cppflag} || (),
|
||||
(map { '-D'.$_ }
|
||||
@{$target{lib_defines} || ()},
|
||||
@{$target{shared_defines} || ()},
|
||||
@{$config{lib_defines} || ()},
|
||||
@{$config{shared_defines} || ()}),
|
||||
(map { '-I'.quotify1($_) }
|
||||
@{$target{lib_includes}},
|
||||
@{$target{shared_includes}},
|
||||
@{$config{lib_includes}},
|
||||
@{$config{shared_includes}}),
|
||||
@{$config{lib_cppflags}},
|
||||
@{$config{shared_cppflag}});
|
||||
join(' ', $lib_cppflags,
|
||||
@@ -327,8 +366,15 @@ LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
|
||||
DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (),
|
||||
$target{module_cppflags} || (),
|
||||
(map { '-D'.$_ }
|
||||
@{$target{dso_defines}},
|
||||
@{$target{module_defines}},
|
||||
@{$config{dso_defines} || ()},
|
||||
@{$config{module_defines} || ()}),
|
||||
(map { '-I'.quotify1($_) }
|
||||
@{$target{dso_includes}},
|
||||
@{$target{module_includes}},
|
||||
@{$config{dso_includes}},
|
||||
@{$config{module_includes}}),
|
||||
@{$config{dso_cppflags}},
|
||||
@{$config{module_cppflags}},
|
||||
'$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
|
||||
@@ -387,11 +433,15 @@ LANG=C
|
||||
|
||||
# The main targets ###################################################
|
||||
|
||||
{- dependmagic('all'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils
|
||||
{- dependmagic('build_sw'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils
|
||||
{- dependmagic('build_libs'); -}: build_libs_nodep
|
||||
{- dependmagic('build_modules'); -}: build_modules_nodep
|
||||
{- dependmagic('build_programs'); -}: build_programs_nodep
|
||||
|
||||
build_docs: build_man_docs build_html_docs
|
||||
build_man_docs: $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7)
|
||||
build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
|
||||
|
||||
build_generated: $(GENERATED_MANDATORY)
|
||||
build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
|
||||
build_modules_nodep: $(MODULES)
|
||||
@@ -402,13 +452,15 @@ build_apps build_tests: build_programs
|
||||
|
||||
# Convenience target to prebuild all generated files, not just the mandatory
|
||||
# ones
|
||||
build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
|
||||
build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs
|
||||
@ : {- output_off() if $disabled{makedepend}; "" -}
|
||||
@echo "Warning: consider configuring with no-makedepend, because if"
|
||||
@echo " target system doesn't have $(PERL),"
|
||||
@echo " then make will fail..."
|
||||
@ : {- output_on() if $disabled{makedepend}; "" -}
|
||||
|
||||
all: build_sw build_docs
|
||||
|
||||
test: tests
|
||||
{- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep link-utils
|
||||
@ : {- output_off() if $disabled{tests}; "" -}
|
||||
@@ -421,8 +473,7 @@ test: tests
|
||||
EXE_EXT={- platform->binext() -} \
|
||||
OPENSSL_ENGINES=`cd ../$(BLDDIR)/engines 2>/dev/null && pwd` \
|
||||
OPENSSL_MODULES=`cd ../$(BLDDIR)/providers 2>/dev/null && pwd` \
|
||||
OPENSSL_DEBUG_MEMORY=on \
|
||||
$(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
|
||||
$(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
|
||||
@ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
|
||||
@echo "Tests are not supported with your chosen Configure options"
|
||||
@ : {- output_on() if !$disabled{tests}; "" -}
|
||||
@@ -458,10 +509,12 @@ libclean:
|
||||
$(RM) *{- platform->defext() -}
|
||||
|
||||
clean: libclean
|
||||
$(RM) $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
|
||||
$(RM) $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7)
|
||||
$(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(SCRIPTS)
|
||||
$(RM) $(GENERATED_MANDATORY) $(GENERATED)
|
||||
-$(RM) `find . -name '*{- platform->depext() -}' \! -name '.*' -print`
|
||||
-$(RM) `find . -name '*{- platform->objext() -}' \! -name '.*' -print`
|
||||
-$(RM) `find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -print`
|
||||
-$(RM) `find . -name '*{- platform->objext() -}' \! -name '.*' \! -type d -print`
|
||||
$(RM) core
|
||||
$(RM) tags TAGS doc-nits
|
||||
$(RM) -r test/test-runs
|
||||
@@ -764,29 +817,131 @@ uninstall_runtime_libs:
|
||||
@ : {- output_on() unless windowsdll(); "" -}
|
||||
|
||||
|
||||
install_man_docs:
|
||||
install_man_docs: build_man_docs
|
||||
@[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
|
||||
@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man1
|
||||
@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man3
|
||||
@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man5
|
||||
@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man7
|
||||
@$(ECHO) "*** Installing manpages"
|
||||
$(PERL) $(SRCDIR)/util/process_docs.pl \
|
||||
--destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX)
|
||||
@set -e; for x in dummy $(MANDOCS1); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$$fn"; \
|
||||
cp $$x $(DESTDIR)$(MANDIR)/man1/$$fn$(MANSUFFIX); \
|
||||
chmod 755 $(DESTDIR)$(MANDIR)/man1/$$fn$(MANSUFFIX); \
|
||||
done
|
||||
@set -e; for x in dummy $(MANDOCS3); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$$fn"; \
|
||||
cp $$x $(DESTDIR)$(MANDIR)/man3/$$fn$(MANSUFFIX); \
|
||||
chmod 755 $(DESTDIR)$(MANDIR)/man3/$$fn$(MANSUFFIX); \
|
||||
done
|
||||
@set -e; for x in dummy $(MANDOCS5); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$$fn"; \
|
||||
cp $$x $(DESTDIR)$(MANDIR)/man5/$$fn$(MANSUFFIX); \
|
||||
chmod 755 $(DESTDIR)$(MANDIR)/man5/$$fn$(MANSUFFIX); \
|
||||
done
|
||||
@set -e; for x in dummy $(MANDOCS7); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$$fn"; \
|
||||
cp $$x $(DESTDIR)$(MANDIR)/man7/$$fn$(MANSUFFIX); \
|
||||
chmod 755 $(DESTDIR)$(MANDIR)/man7/$$fn$(MANSUFFIX); \
|
||||
done
|
||||
|
||||
uninstall_man_docs:
|
||||
@$(ECHO) "*** Uninstalling manpages"
|
||||
$(PERL) $(SRCDIR)/util/process_docs.pl \
|
||||
--destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \
|
||||
--remove
|
||||
@set -e; for x in dummy $(MANDOCS1); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$$fn"; \
|
||||
$(RM) $(DESTDIR)$(MANDIR)/man1/$$fn$(MANSUFFIX); \
|
||||
done
|
||||
@set -e; for x in dummy $(MANDOCS3); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$$fn"; \
|
||||
$(RM) $(DESTDIR)$(MANDIR)/man3/$$fn$(MANSUFFIX); \
|
||||
done
|
||||
@set -e; for x in dummy $(MANDOCS5); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$$fn"; \
|
||||
$(RM) $(DESTDIR)$(MANDIR)/man5/$$fn$(MANSUFFIX); \
|
||||
done
|
||||
@set -e; for x in dummy $(MANDOCS7); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$$fn"; \
|
||||
$(RM) $(DESTDIR)$(MANDIR)/man7/$$fn$(MANSUFFIX); \
|
||||
done
|
||||
|
||||
install_html_docs:
|
||||
install_html_docs: build_html_docs
|
||||
@[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
|
||||
@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man1
|
||||
@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man3
|
||||
@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man5
|
||||
@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man7
|
||||
@$(ECHO) "*** Installing HTML manpages"
|
||||
$(PERL) $(SRCDIR)/util/process_docs.pl \
|
||||
--destdir=$(DESTDIR)$(HTMLDIR) --type=html
|
||||
@set -e; for x in dummy $(HTMLDOCS1); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
|
||||
cp $$x $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
|
||||
chmod 755 $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
|
||||
done
|
||||
@set -e; for x in dummy $(HTMLDOCS3); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
|
||||
cp $$x $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
|
||||
chmod 755 $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
|
||||
done
|
||||
@set -e; for x in dummy $(HTMLDOCS5); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
|
||||
cp $$x $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
|
||||
chmod 755 $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
|
||||
done
|
||||
@set -e; for x in dummy $(HTMLDOCS7); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
|
||||
cp $$x $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
|
||||
chmod 755 $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
|
||||
done
|
||||
|
||||
uninstall_html_docs:
|
||||
@$(ECHO) "*** Uninstalling manpages"
|
||||
$(PERL) $(SRCDIR)/util/process_docs.pl \
|
||||
--destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove
|
||||
|
||||
@$(ECHO) "*** Uninstalling HTML manpages"
|
||||
@set -e; for x in dummy $(HTMLDOCS1); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
|
||||
$(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
|
||||
done
|
||||
@set -e; for x in dummy $(HTMLDOCS3); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
|
||||
$(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
|
||||
done
|
||||
@set -e; for x in dummy $(HTMLDOCS5); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
|
||||
$(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
|
||||
done
|
||||
@set -e; for x in dummy $(HTMLDOCS7); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
|
||||
$(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
|
||||
done
|
||||
|
||||
# Developer targets (note: these are only available on Unix) #########
|
||||
|
||||
@@ -1027,7 +1182,27 @@ reconfigure reconf:
|
||||
my $defs = join("", map { " -D".$_ } @{$args{defs}});
|
||||
my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
|
||||
|
||||
if (platform->isdef($args{src})) {
|
||||
if ($args{src} =~ /\.html$/) {
|
||||
my $title = basename($args{src}, ".html");
|
||||
my $pod = $args{generator}->[0];
|
||||
return <<"EOF";
|
||||
$args{src}: $pod
|
||||
pod2html "--podroot=\$(SRCDIR)/doc" --htmldir=.. \\
|
||||
--podpath=man1:man3:man5:man7 --infile=$pod "--title=$title" \\
|
||||
| \$(PERL) -pe 's|href="http://man\\.he\\.net/(man\\d/[^"]+)(?:\\.html)?"|href="../\$1.html|g;' \\
|
||||
> \$\@
|
||||
EOF
|
||||
} elsif ($args{src} =~ /\.(\d)$/) {
|
||||
my $section = $1;
|
||||
my $name = uc basename($args{src}, ".$section");
|
||||
my $pod = $args{generator}->[0];
|
||||
return <<"EOF";
|
||||
$args{src}: $pod
|
||||
pod2man --name=$name --section=$section --center=OpenSSL \\
|
||||
--release=\$(VERSION) $pod \\
|
||||
> \$\@
|
||||
EOF
|
||||
} elsif (platform->isdef($args{src})) {
|
||||
my $target = platform->def($args{src});
|
||||
(my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
|
||||
my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
##
|
||||
## {- join("\n## ", @autowarntext) -}
|
||||
{-
|
||||
use File::Basename;
|
||||
|
||||
our $sover_dirname = platform->shlib_version_as_filename();
|
||||
|
||||
my $build_scheme = $target{build_scheme};
|
||||
@@ -111,6 +113,22 @@ MISC_SCRIPTS={-
|
||||
&& $unified_info{attributes}->{scripts}->{$_}->{misc} }
|
||||
@{$unified_info{scripts}})
|
||||
-}
|
||||
HTMLDOCS1={- our @HTMLDOCS1 = @{$unified_info{htmldocs}->{man1}};
|
||||
join(" ", @HTMLDOCS1) -}
|
||||
HTMLDOCS3={- our @HTMLDOCS3 = @{$unified_info{htmldocs}->{man3}};
|
||||
join(" ", @HTMLDOCS3) -}
|
||||
HTMLDOCS5={- our @HTMLDOCS5 = @{$unified_info{htmldocs}->{man5}};
|
||||
join(" ", @HTMLDOCS5) -}
|
||||
HTMLDOCS7={- our @HTMLDOCS7 = @{$unified_info{htmldocs}->{man7}};
|
||||
join(" ", @HTMLDOCS7) -}
|
||||
HTMLDOCS1_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS1;
|
||||
join(' ', sort keys %dirs) -}
|
||||
HTMLDOCS3_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS3;
|
||||
join(' ', sort keys %dirs) -}
|
||||
HTMLDOCS5_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS5;
|
||||
join(' ', sort keys %dirs) -}
|
||||
HTMLDOCS7_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS7;
|
||||
join(' ', sort keys %dirs) -}
|
||||
|
||||
APPS_OPENSSL={- use File::Spec::Functions;
|
||||
"\"".catfile("apps","openssl")."\"" -}
|
||||
@@ -183,29 +201,29 @@ libdir={- file_name_is_absolute($libdir)
|
||||
|
||||
##### User defined commands and flags ################################
|
||||
|
||||
CC={- $config{CC} -}
|
||||
CPP={- $config{CPP} -}
|
||||
CC="{- $config{CC} -}"
|
||||
CPP="{- $config{CPP} -}"
|
||||
CPPFLAGS={- our $cppflags1 = join(" ",
|
||||
(map { "-D".$_} @{$config{CPPDEFINES}}),
|
||||
(map { " /I ".$_} @{$config{CPPINCLUDES}}),
|
||||
(map { " -I ".$_} @{$config{CPPINCLUDES}}),
|
||||
@{$config{CPPFLAGS}}) -}
|
||||
CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
|
||||
LD={- $config{LD} -}
|
||||
LD="{- $config{LD} -}"
|
||||
LDFLAGS={- join(' ', @{$config{LDFLAGS}}) -}
|
||||
EX_LIBS={- join(' ', @{$config{LDLIBS}}) -}
|
||||
|
||||
PERL={- $config{PERL} -}
|
||||
|
||||
AR={- $config{AR} -}
|
||||
AR="{- $config{AR} -}"
|
||||
ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -}
|
||||
|
||||
MT={- $config{MT} -}
|
||||
MT="{- $config{MT} -}"
|
||||
MTFLAGS= {- join(' ', @{$config{MTFLAGS}}) -}
|
||||
|
||||
AS={- $config{AS} -}
|
||||
AS="{- $config{AS} -}"
|
||||
ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -}
|
||||
|
||||
RC={- $config{RC} -}
|
||||
RC="{- $config{RC} -}"
|
||||
RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -}
|
||||
|
||||
ECHO="$(PERL)" "$(SRCDIR)\util\echo.pl"
|
||||
@@ -316,6 +334,7 @@ BIN_ASFLAGS={- join(' ', $target{bin_asflags} || (),
|
||||
@{$config{bin_asflags}},
|
||||
'$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
|
||||
BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (),
|
||||
(map { '-D'.$_ } @{$config{bin_defines} || ()}),
|
||||
@{$config{bin_cppflags}},
|
||||
'$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
|
||||
BIN_CFLAGS={- join(' ', $target{bin_cflags} || (),
|
||||
@@ -338,11 +357,14 @@ PROCESSOR= {- $config{processor} -}
|
||||
|
||||
# The main targets ###################################################
|
||||
|
||||
{- dependmagic('all'); -}: build_libs_nodep build_modules_nodep build_programs_nodep
|
||||
{- dependmagic('build_sw'); -}: build_libs_nodep build_modules_nodep build_programs_nodep
|
||||
{- dependmagic('build_libs'); -}: build_libs_nodep
|
||||
{- dependmagic('build_modules'); -}: build_modules_nodep
|
||||
{- dependmagic('build_programs'); -}: build_programs_nodep
|
||||
|
||||
build_docs: build_html_docs
|
||||
build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
|
||||
|
||||
build_generated: $(GENERATED_MANDATORY)
|
||||
build_libs_nodep: $(LIBS) {- join(" ",map { platform->sharedlib_import($_) // () } @{$unified_info{libraries}}) -}
|
||||
build_modules_nodep: $(MODULES)
|
||||
@@ -353,13 +375,15 @@ build_apps build_tests: build_programs
|
||||
|
||||
# Convenience target to prebuild all generated files, not just the mandatory
|
||||
# ones
|
||||
build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
|
||||
build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs
|
||||
@{- output_off() if $disabled{makedepend}; "" -}
|
||||
@$(ECHO) "Warning: consider configuring with no-makedepend, because if"
|
||||
@$(ECHO) " target system doesn't have $(PERL),"
|
||||
@$(ECHO) " then make will fail..."
|
||||
@{- output_on() if $disabled{makedepend}; "" -}
|
||||
|
||||
all: build_sw build_docs
|
||||
|
||||
test: tests
|
||||
{- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep
|
||||
@{- output_off() if $disabled{tests}; "" -}
|
||||
@@ -370,7 +394,6 @@ test: tests
|
||||
set PERL=$(PERL)
|
||||
set OPENSSL_ENGINES=$(MAKEDIR)\engines
|
||||
set OPENSSL_MODULES=$(MAKEDIR)\providers
|
||||
set OPENSSL_DEBUG_MEMORY=on
|
||||
"$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS)
|
||||
@{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
|
||||
@$(ECHO) "Tests are not supported with your chosen Configure options"
|
||||
@@ -393,6 +416,10 @@ libclean:
|
||||
-del /Q /F $(LIBS) libcrypto.* libssl.* ossl_static.pdb
|
||||
|
||||
clean: libclean
|
||||
-rmdir /Q /S $(HTMLDOCS1_BLDDIRS)
|
||||
-rmdir /Q /S $(HTMLDOCS3_BLDDIRS)
|
||||
-rmdir /Q /S $(HTMLDOCS5_BLDDIRS)
|
||||
-rmdir /Q /S $(HTMLDOCS7_BLDDIRS)
|
||||
{- join("\n\t", map { "-del /Q /F $_" } @PROGRAMS) -}
|
||||
-del /Q /F $(MODULES)
|
||||
-del /Q /F $(SCRIPTS)
|
||||
@@ -432,7 +459,8 @@ install_ssldirs:
|
||||
@IF NOT EXIST "$(OPENSSLDIR)\openssl.cnf" \
|
||||
"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \
|
||||
"$(OPENSSLDIR)\openssl.cnf"
|
||||
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(MISC_SCRIPTS) \
|
||||
@if not "$(MISC_SCRIPTS)"=="" \
|
||||
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(MISC_SCRIPTS) \
|
||||
"$(OPENSSLDIR)\misc"
|
||||
@"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\ct_log_list.cnf" \
|
||||
"$(OPENSSLDIR)\ct_log_list.cnf.dist"
|
||||
@@ -486,19 +514,35 @@ install_runtime_libs: build_libs
|
||||
install_programs: install_runtime_libs build_programs
|
||||
@if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 )
|
||||
@$(ECHO) "*** Installing runtime programs"
|
||||
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\bin"
|
||||
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMS) \
|
||||
@if not "$(INSTALL_PROGRAMS)"=="" \
|
||||
"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\bin"
|
||||
@if not "$(INSTALL_PROGRAMS)"=="" \
|
||||
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMS) \
|
||||
"$(INSTALLTOP)\bin"
|
||||
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMPDBS) \
|
||||
@if not "$(INSTALL_PROGRAMS)"=="" \
|
||||
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMPDBS) \
|
||||
"$(INSTALLTOP)\bin"
|
||||
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BIN_SCRIPTS) \
|
||||
@if not "$(INSTALL_PROGRAMS)"=="" \
|
||||
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BIN_SCRIPTS) \
|
||||
"$(INSTALLTOP)\bin"
|
||||
|
||||
uninstall_runtime:
|
||||
|
||||
install_html_docs:
|
||||
"$(PERL)" "$(SRCDIR)\util\process_docs.pl" \
|
||||
"--destdir=$(INSTALLTOP)\html" --type=html
|
||||
install_html_docs: build_html_docs
|
||||
@if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 )
|
||||
@echo *** Installing HTML docs
|
||||
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man1"
|
||||
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man3"
|
||||
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man5"
|
||||
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man7"
|
||||
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man1\*.html \
|
||||
"$(INSTALLTOP)\html\man1"
|
||||
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man3\*.html \
|
||||
"$(INSTALLTOP)\html\man3"
|
||||
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man5\*.html \
|
||||
"$(INSTALLTOP)\html\man5"
|
||||
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man7\*.html \
|
||||
"$(INSTALLTOP)\html\man7"
|
||||
|
||||
uninstall_html_docs:
|
||||
|
||||
@@ -535,12 +579,22 @@ reconfigure reconf:
|
||||
my ($gen0, @gens) = @{$args{generator}};
|
||||
my $generator = '"'.$gen0.'"'.join('', map { " $_" } @gens);
|
||||
my $generator_incs = join("", map { " -I \"$_\"" } @{$args{generator_incs}});
|
||||
my $incs = join("", map { " /I \"$_\"" } @{$args{incs}});
|
||||
my $defs = join("", map { " /D".$_ } @{$args{defs}});
|
||||
my $incs = join("", map { " -I \"$_\"" } @{$args{incs}});
|
||||
my $defs = join("", map { " -D".$_ } @{$args{defs}});
|
||||
my $deps = @{$args{deps}} ?
|
||||
'"'.join('" "', @{$args{generator_deps}}, @{$args{deps}}).'"' : '';
|
||||
|
||||
if (platform->isdef($args{src})) {
|
||||
if ($args{src} =~ /\.html$/) {
|
||||
my $title = basename($args{src}, ".html");
|
||||
my $pod = $args{generator}->[0];
|
||||
return <<"EOF";
|
||||
$args{src}: "$pod"
|
||||
pod2html "--podroot=\$(SRCDIR)/doc" --htmldir=.. \\
|
||||
--podpath=man1:man3:man5:man7 "--infile=$pod" "--title=$title" \\
|
||||
| \$(PERL) -pe ^"s^|href=\\^"http://man\\.he\\.net/^(man\\d/[^^\\^"]+^)^(?:\.html^)?^"^|href=\\^"../\$\$1.html^|g;^" \\
|
||||
> \$\@
|
||||
EOF
|
||||
} elsif (platform->isdef($args{src})) {
|
||||
my $target = platform->def($args{src});
|
||||
my $mkdef = abs2rel(rel2abs(catfile($config{sourcedir},
|
||||
"util", "mkdef.pl")),
|
||||
@@ -627,8 +681,8 @@ EOF
|
||||
( @{$args{srcs}} );
|
||||
my $srcs = '"'.join('" "', @srcs).'"';
|
||||
my $deps = '"'.join('" "', @srcs, @{$args{deps}}).'"';
|
||||
my $incs = join("", map { ' /I "'.$_.'"' } @{$args{incs}});
|
||||
my $defs = join("", map { " /D".$_ } @{$args{defs}});
|
||||
my $incs = join("", map { ' -I "'.$_.'"' } @{$args{incs}});
|
||||
my $defs = join("", map { " -D".$_ } @{$args{defs}});
|
||||
my $cflags = { shlib => ' $(LIB_CFLAGS)',
|
||||
lib => ' $(LIB_CFLAGS)',
|
||||
dso => ' $(DSO_CFLAGS)',
|
||||
@@ -660,7 +714,7 @@ EOF
|
||||
} elsif ($srcs[0] =~ /.S$/) {
|
||||
return <<"EOF";
|
||||
$obj: $deps
|
||||
\$(CC) /EP /D__ASSEMBLER__ $cflags $defs $srcs > \$@.asm && \$(AS) $asflags \$(ASOUTFLAG)\$\@ \$@.asm
|
||||
\$(CC) /EP -D__ASSEMBLER__ $cflags $defs $srcs > \$@.asm && \$(AS) $asflags \$(ASOUTFLAG)\$\@ \$@.asm
|
||||
EOF
|
||||
}
|
||||
my $recipe = <<"EOF";
|
||||
|
||||
@@ -45,9 +45,11 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lx
|
||||
#
|
||||
# --cross-compile-prefix Add specified prefix to binutils components.
|
||||
#
|
||||
# --api One of 0.9.8, 1.0.0, 1.0.1, 1.0.2, 1.1.0, 1.1.1, or 3.0.0 / 3.
|
||||
# Do not compile support for interfaces deprecated as of the
|
||||
# specified OpenSSL version.
|
||||
# --api One of 0.9.8, 1.0.0, 1.0.1, 1.0.2, 1.1.0, 1.1.1, or 3.0
|
||||
# Define the public APIs as they were for that version
|
||||
# including patch releases. If 'no-deprecated' is also
|
||||
# given, do not compile support for interfaces deprecated
|
||||
# up to and including the specified OpenSSL version.
|
||||
#
|
||||
# no-hw-xxx do not compile support for specific crypto hardware.
|
||||
# Generic OpenSSL-style methods relating to this support
|
||||
@@ -164,9 +166,9 @@ my @clang_devteam_warn = qw(
|
||||
-Wmissing-variable-declarations
|
||||
);
|
||||
|
||||
# This adds backtrace information to the memory leak info. Is only used
|
||||
# when crypto-mdebug-backtrace is enabled.
|
||||
my $memleak_devteam_backtrace = "-rdynamic";
|
||||
my @cl_devteam_warn = qw(
|
||||
/WX
|
||||
);
|
||||
|
||||
my $strict_warnings = 0;
|
||||
|
||||
@@ -182,15 +184,24 @@ our $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT";
|
||||
#
|
||||
# API compatibility name to version number mapping.
|
||||
#
|
||||
my $maxapi = "3.0.0"; # API for "no-deprecated" builds
|
||||
my $apitable = {
|
||||
"3.0.0" => 3,
|
||||
"1.1.1" => 2,
|
||||
"1.1.0" => 2,
|
||||
"1.0.2" => 1,
|
||||
"1.0.1" => 1,
|
||||
"1.0.0" => 1,
|
||||
"0.9.8" => 0,
|
||||
# This table expresses when API additions or changes can occur.
|
||||
# The numbering used changes from 3.0 and on because we updated
|
||||
# (solidified) our version numbering scheme at that point.
|
||||
|
||||
# From 3.0 and on, we internalise the given version number in dedcimal
|
||||
# as MAJOR * 10000 + MINOR * 100 + 0
|
||||
"3.0.0" => 30000,
|
||||
"3.0" => 30000,
|
||||
|
||||
# Note that before 3.0, we didn't have the same version number scheme.
|
||||
# Still, the numbering we use here covers what we need.
|
||||
"1.1.1" => 10101,
|
||||
"1.1.0" => 10100,
|
||||
"1.0.2" => 10002,
|
||||
"1.0.1" => 10001,
|
||||
"1.0.0" => 10000,
|
||||
"0.9.8" => 908,
|
||||
};
|
||||
|
||||
our %table = ();
|
||||
@@ -255,38 +266,39 @@ if (grep /^reconf(igure)?$/, @argvcopy) {
|
||||
$config{perlargv} = [ @argvcopy ];
|
||||
|
||||
# Collect version numbers
|
||||
$config{major} = "unknown";
|
||||
$config{minor} = "unknown";
|
||||
$config{patch} = "unknown";
|
||||
$config{prerelease} = "";
|
||||
$config{build_metadata} = "";
|
||||
$config{shlib_version} = "unknown";
|
||||
my %version = ();
|
||||
|
||||
collect_information(
|
||||
collect_from_file(catfile($srcdir,'include/openssl/opensslv.h')),
|
||||
qr/#\s+define\s+OPENSSL_VERSION_MAJOR\s+(\d+)/ =>
|
||||
sub { $config{major} = $1; },
|
||||
qr/#\s+define\s+OPENSSL_VERSION_MINOR\s+(\d+)/ =>
|
||||
sub { $config{minor} = $1; },
|
||||
qr/#\s+define\s+OPENSSL_VERSION_PATCH\s+(\d+)/ =>
|
||||
sub { $config{patch} = $1; },
|
||||
qr/#\s+define\s+OPENSSL_VERSION_PRE_RELEASE\s+"((?:\\.|[^"])*)"/ =>
|
||||
sub { $config{prerelease} = $1; },
|
||||
qr/#\s+define\s+OPENSSL_VERSION_BUILD_METADATA\s+"((?:\\.|[^"])*)"/ =>
|
||||
sub { $config{build_metadata} = $1; },
|
||||
qr/#\s+define\s+OPENSSL_SHLIB_VERSION\s+([\d\.]+)/ =>
|
||||
sub { $config{shlib_version} = $1; },
|
||||
collect_from_file(catfile($srcdir,'VERSION')),
|
||||
qr/\s*(\w+)\s*=\s*(.*?)\s*$/ =>
|
||||
sub {
|
||||
# Only define it if there is a value at all
|
||||
$version{uc $1} = $2 if $2 ne '';
|
||||
},
|
||||
"OTHERWISE" =>
|
||||
sub { die "Something wrong with this line:\n$_\nin $srcdir/VERSION" },
|
||||
);
|
||||
die "erroneous version information in opensslv.h: ",
|
||||
"$config{major}.$config{minor}.$config{patch}, $config{shlib_version}\n"
|
||||
if ($config{major} eq "unknown"
|
||||
|| $config{minor} eq "unknown"
|
||||
|| $config{patch} eq "unknown"
|
||||
|| $config{shlib_version} eq "unknown");
|
||||
|
||||
$config{major} = $version{MAJOR} // 'unknown';
|
||||
$config{minor} = $version{MINOR} // 'unknown';
|
||||
$config{patch} = $version{PATCH} // 'unknown';
|
||||
$config{prerelease} =
|
||||
defined $version{PRE_RELEASE_TAG} ? "-$version{PRE_RELEASE_TAG}" : '';
|
||||
$config{build_metadata} =
|
||||
defined $version{BUILD_METADATA} ? "+$version{BUILD_METADATA}" : '';
|
||||
$config{shlib_version} = $version{SHLIB_VERSION} // 'unknown';
|
||||
$config{release_date} = $version{RELEASE_DATE} // 'xx XXX xxxx';
|
||||
|
||||
$config{version} = "$config{major}.$config{minor}.$config{patch}";
|
||||
$config{full_version} = "$config{version}$config{prerelease}$config{build_metadata}";
|
||||
|
||||
die "erroneous version information in VERSION: ",
|
||||
"$config{version}, $config{shlib_version}\n"
|
||||
unless (defined $version{MAJOR}
|
||||
&& defined $version{MINOR}
|
||||
&& defined $version{PATCH}
|
||||
&& defined $version{SHLIB_VERSION});
|
||||
|
||||
# Collect target configurations
|
||||
|
||||
my $pattern = catfile(dirname($0), "Configurations", "*.conf");
|
||||
@@ -329,7 +341,6 @@ my @dtls = qw(dtls1 dtls1_2);
|
||||
# For developers: keep it sorted alphabetically
|
||||
|
||||
my @disablables = (
|
||||
"ktls",
|
||||
"afalgeng",
|
||||
"aria",
|
||||
"asan",
|
||||
@@ -350,7 +361,6 @@ my @disablables = (
|
||||
"cms",
|
||||
"comp",
|
||||
"crypto-mdebug",
|
||||
"crypto-mdebug-backtrace",
|
||||
"ct",
|
||||
"deprecated",
|
||||
"des",
|
||||
@@ -376,6 +386,7 @@ my @disablables = (
|
||||
"fuzz-afl",
|
||||
"gost",
|
||||
"idea",
|
||||
"ktls",
|
||||
"legacy",
|
||||
"makedepend",
|
||||
"md2",
|
||||
@@ -447,6 +458,7 @@ my @disablables_int = qw(
|
||||
my %deprecated_disablables = (
|
||||
"ssl2" => undef,
|
||||
"buf-freelists" => undef,
|
||||
"crypto-mdebug-backtrace" => undef,
|
||||
"hw" => "hw", # causes cascade, but no macro
|
||||
"hw-padlock" => "padlockeng",
|
||||
"ripemd" => "rmd160",
|
||||
@@ -547,6 +559,11 @@ my @disable_cascades = (
|
||||
"legacy" => [ "md2" ],
|
||||
|
||||
"cmp" => [ "crmf" ],
|
||||
|
||||
# Padlock engine uses low-level AES APIs which are deprecated
|
||||
sub { $disabled{"deprecated"}
|
||||
&& (!defined $config{"api"} || $config{"api"} >= 30000) }
|
||||
=> [ "padlockeng" ]
|
||||
);
|
||||
|
||||
# Avoid protocol support holes. Also disable all versions below N, if version
|
||||
@@ -573,7 +590,7 @@ while ((my $first, my $second) = (shift @list, shift @list)) {
|
||||
|
||||
&usage if ($#ARGV < 0);
|
||||
|
||||
# For the "make variables" CINCLUDES and CDEFINES, we support lists with
|
||||
# For the "make variables" CPPINCLUDES and CPPDEFINES, we support lists with
|
||||
# platform specific list separators. Users from those platforms should
|
||||
# recognise those separators from how you set up the PATH to find executables.
|
||||
# The default is the Unix like separator, :, but as an exception, we also
|
||||
@@ -839,7 +856,10 @@ while (@argvcopy)
|
||||
}
|
||||
elsif (/^--api=(.*)$/)
|
||||
{
|
||||
$config{api}=$1;
|
||||
my $api = $1;
|
||||
die "Unknown API compatibility level $api"
|
||||
unless defined $apitable->{$api};
|
||||
$config{api}=$apitable->{$api};
|
||||
}
|
||||
elsif (/^--libdir=(.*)$/)
|
||||
{
|
||||
@@ -956,10 +976,6 @@ while (@argvcopy)
|
||||
}
|
||||
}
|
||||
|
||||
if (defined($config{api}) && !exists $apitable->{$config{api}}) {
|
||||
die "***** Unsupported api compatibility level: $config{api}\n",
|
||||
}
|
||||
|
||||
if (keys %deprecated_options)
|
||||
{
|
||||
warn "***** Deprecated options: ",
|
||||
@@ -1014,7 +1030,11 @@ foreach (keys %user) {
|
||||
|
||||
if (defined $value) {
|
||||
if (ref $user{$_} eq 'ARRAY') {
|
||||
$user{$_} = [ split /$list_separator_re/, $value ];
|
||||
if ($_ eq 'CPPDEFINES' || $_ eq 'CPPINCLUDES') {
|
||||
$user{$_} = [ split /$list_separator_re/, $value ];
|
||||
} else {
|
||||
$user{$_} = [ $value ];
|
||||
}
|
||||
} elsif (!defined $user{$_}) {
|
||||
$user{$_} = $value;
|
||||
}
|
||||
@@ -1224,46 +1244,6 @@ foreach (keys %useradd) {
|
||||
# Allow overriding the build file name
|
||||
$config{build_file} = env('BUILDFILE') || $target{build_file} || "Makefile";
|
||||
|
||||
######################################################################
|
||||
# Build up information for skipping certain directories depending on disabled
|
||||
# features, as well as setting up macros for disabled features.
|
||||
|
||||
# This is a tentative database of directories to skip. Some entries may not
|
||||
# correspond to anything real, but that's ok, they will simply be ignored.
|
||||
# The actual processing of these entries is done in the build.info lookup
|
||||
# loop further down.
|
||||
#
|
||||
# The key is a Unix formated path in the source tree, the value is an index
|
||||
# into %disabled_info, so any existing path gets added to a corresponding
|
||||
# 'skipped' entry in there with the list of skipped directories.
|
||||
my %skipdir = ();
|
||||
my %disabled_info = (); # For configdata.pm
|
||||
foreach my $what (sort keys %disabled) {
|
||||
# There are deprecated disablables that translate to themselves.
|
||||
# They cause disabling cascades, but should otherwise not regiter.
|
||||
next if $deprecated_disablables{$what};
|
||||
|
||||
$config{options} .= " no-$what";
|
||||
|
||||
if (!grep { $what eq $_ } ( 'buildtest-c++', 'fips', 'threads', 'shared',
|
||||
'module', 'pic', 'dynamic-engine', 'makedepend',
|
||||
'zlib-dynamic', 'zlib', 'sse2', 'legacy' )) {
|
||||
(my $WHAT = uc $what) =~ s|-|_|g;
|
||||
my $skipdir = $what;
|
||||
|
||||
# fix-up crypto/directory name(s)
|
||||
$skipdir = "ripemd" if $what eq "rmd160";
|
||||
$skipdir = "whrlpool" if $what eq "whirlpool";
|
||||
|
||||
my $macro = $disabled_info{$what}->{macro} = "OPENSSL_NO_$WHAT";
|
||||
push @{$config{openssl_feature_defines}}, $macro;
|
||||
|
||||
$skipdir{engines} = $what if $what eq 'engine';
|
||||
$skipdir{"crypto/$skipdir"} = $what
|
||||
unless $what eq 'async' || $what eq 'err' || $what eq 'dso';
|
||||
}
|
||||
}
|
||||
|
||||
# Make sure build_scheme is consistent.
|
||||
$target{build_scheme} = [ $target{build_scheme} ]
|
||||
if ref($target{build_scheme}) ne "ARRAY";
|
||||
@@ -1360,11 +1340,6 @@ unless($disabled{threads}) {
|
||||
push @{$config{openssl_feature_defines}}, "OPENSSL_THREADS";
|
||||
}
|
||||
|
||||
# With "deprecated" disable all deprecated features.
|
||||
if (defined($disabled{"deprecated"})) {
|
||||
$config{api} = $maxapi;
|
||||
}
|
||||
|
||||
my $no_shared_warn=0;
|
||||
if ($target{shared_target} eq "")
|
||||
{
|
||||
@@ -1374,10 +1349,8 @@ if ($target{shared_target} eq "")
|
||||
}
|
||||
|
||||
if ($disabled{"dynamic-engine"}) {
|
||||
push @{$config{openssl_feature_defines}}, "OPENSSL_NO_DYNAMIC_ENGINE";
|
||||
$config{dynamic_engines} = 0;
|
||||
} else {
|
||||
push @{$config{openssl_feature_defines}}, "OPENSSL_NO_STATIC_ENGINE";
|
||||
$config{dynamic_engines} = 1;
|
||||
}
|
||||
|
||||
@@ -1426,14 +1399,18 @@ if ($target{sys_id} ne "")
|
||||
push @{$config{openssl_sys_defines}}, "OPENSSL_SYS_$target{sys_id}";
|
||||
}
|
||||
|
||||
unless ($disabled{asm}) {
|
||||
}
|
||||
|
||||
my %predefined_C = compiler_predefined($config{CROSS_COMPILE}.$config{CC});
|
||||
my %predefined_CXX = $config{CXX}
|
||||
? compiler_predefined($config{CROSS_COMPILE}.$config{CXX})
|
||||
: ();
|
||||
|
||||
unless ($disabled{asm}) {
|
||||
# big endian systems can use ELFv2 ABI
|
||||
if ($target eq "linux-ppc64") {
|
||||
$target{perlasm_scheme} = "linux64v2" if ($predefined_C{_CALL_ELF} == 2);
|
||||
}
|
||||
}
|
||||
|
||||
# Check for makedepend capabilities.
|
||||
if (!$disabled{makedepend}) {
|
||||
if ($config{target} =~ /^(VC|vms)-/) {
|
||||
@@ -1498,6 +1475,8 @@ foreach (sort split(/\s+/,$target{bn_ops})) {
|
||||
die "Exactly one of SIXTY_FOUR_BIT|SIXTY_FOUR_BIT_LONG|THIRTY_TWO_BIT can be set in bn_ops\n"
|
||||
if $count > 1;
|
||||
|
||||
$config{api} = $config{major} * 10000 + $config{minor} * 100
|
||||
unless $config{api};
|
||||
|
||||
# Hack cflags for better warnings (dev option) #######################
|
||||
|
||||
@@ -1509,7 +1488,7 @@ $config{cxxflags} = [ map { (my $x = $_) =~ s/([\\\"])/\\$1/g; $x }
|
||||
@{$config{cxxflags}} ] if $config{CXX};
|
||||
|
||||
$config{openssl_api_defines} = [
|
||||
"OPENSSL_MIN_API=".($apitable->{$config{api} // ""} // -1)
|
||||
"OPENSSL_CONFIGURED_API=".$config{api}
|
||||
];
|
||||
|
||||
my @strict_warnings_collection=();
|
||||
@@ -1518,11 +1497,20 @@ if ($strict_warnings)
|
||||
my $wopt;
|
||||
my $gccver = $predefined_C{__GNUC__} // -1;
|
||||
|
||||
warn "WARNING --strict-warnings requires gcc[>=4] or gcc-alike"
|
||||
unless $gccver >= 4;
|
||||
push @strict_warnings_collection, @gcc_devteam_warn;
|
||||
push @strict_warnings_collection, @clang_devteam_warn
|
||||
if (defined($predefined_C{__clang__}));
|
||||
if ($gccver >= 4)
|
||||
{
|
||||
push @strict_warnings_collection, @gcc_devteam_warn;
|
||||
push @strict_warnings_collection, @clang_devteam_warn
|
||||
if (defined($predefined_C{__clang__}));
|
||||
}
|
||||
elsif ($config{target} =~ /^VC-/)
|
||||
{
|
||||
push @strict_warnings_collection, @cl_devteam_warn;
|
||||
}
|
||||
else
|
||||
{
|
||||
warn "WARNING --strict-warnings requires gcc[>=4] or gcc-alike, or MSVC"
|
||||
}
|
||||
}
|
||||
|
||||
if (grep { $_ eq '-static' } @{$config{LDFLAGS}}) {
|
||||
@@ -1534,19 +1522,6 @@ $config{CFLAGS} = [ map { $_ eq '--ossl-strict-warnings'
|
||||
: ( $_ ) }
|
||||
@{$config{CFLAGS}} ];
|
||||
|
||||
unless ($disabled{"crypto-mdebug-backtrace"})
|
||||
{
|
||||
foreach my $wopt (split /\s+/, $memleak_devteam_backtrace)
|
||||
{
|
||||
push @{$config{cflags}}, $wopt
|
||||
unless grep { $_ eq $wopt } @{$config{cflags}};
|
||||
}
|
||||
if ($target =~ /^BSD-/)
|
||||
{
|
||||
push @{$config{ex_libs}}, "-lexecinfo";
|
||||
}
|
||||
}
|
||||
|
||||
unless ($disabled{afalgeng}) {
|
||||
$config{afalgeng}="";
|
||||
if (grep { $_ eq 'afalgeng' } @{$target{enable}}) {
|
||||
@@ -1569,7 +1544,20 @@ unless ($disabled{afalgeng}) {
|
||||
}
|
||||
}
|
||||
|
||||
push @{$config{openssl_feature_defines}}, "OPENSSL_NO_AFALGENG" if ($disabled{afalgeng});
|
||||
unless ($disabled{devcryptoeng}) {
|
||||
if ($target =~ m/^BSD/) {
|
||||
my $maxver = 5*100 + 7;
|
||||
my $sysstr = `uname -s`;
|
||||
my $verstr = `uname -r`;
|
||||
$sysstr =~ s|\R$||;
|
||||
$verstr =~ s|\R$||;
|
||||
my ($ma, $mi, @rest) = split m|\.|, $verstr;
|
||||
my $ver = $ma*100 + $mi;
|
||||
if ($sysstr eq 'OpenBSD' && $ver >= $maxver) {
|
||||
disable('too-new-kernel', 'devcryptoeng');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unless ($disabled{ktls}) {
|
||||
$config{ktls}="";
|
||||
@@ -1585,8 +1573,14 @@ unless ($disabled{ktls}) {
|
||||
if ($verstr[2] < $minver) {
|
||||
disable('too-old-kernel', 'ktls');
|
||||
}
|
||||
} elsif ($target =~ m/^BSD/) {
|
||||
my $cc = $config{CROSS_COMPILE}.$config{CC};
|
||||
system("printf '#include <sys/types.h>\n#include <sys/ktls.h>' | $cc -E - >/dev/null 2>&1");
|
||||
if ($? != 0) {
|
||||
disable('too-old-freebsd', 'ktls');
|
||||
}
|
||||
} else {
|
||||
disable('not-linux', 'ktls');
|
||||
disable('not-linux-or-freebsd', 'ktls');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1635,6 +1629,52 @@ $target{module_ldflags} = $target{shared_ldflag} unless defined $target{module_l
|
||||
|
||||
# ALL MODIFICATIONS TO %disabled, %config and %target MUST BE DONE FROM HERE ON
|
||||
|
||||
######################################################################
|
||||
# Build up information for skipping certain directories depending on disabled
|
||||
# features, as well as setting up macros for disabled features.
|
||||
|
||||
# This is a tentative database of directories to skip. Some entries may not
|
||||
# correspond to anything real, but that's ok, they will simply be ignored.
|
||||
# The actual processing of these entries is done in the build.info lookup
|
||||
# loop further down.
|
||||
#
|
||||
# The key is a Unix formatted path in the source tree, the value is an index
|
||||
# into %disabled_info, so any existing path gets added to a corresponding
|
||||
# 'skipped' entry in there with the list of skipped directories.
|
||||
my %skipdir = ();
|
||||
my %disabled_info = (); # For configdata.pm
|
||||
foreach my $what (sort keys %disabled) {
|
||||
# There are deprecated disablables that translate to themselves.
|
||||
# They cause disabling cascades, but should otherwise not regiter.
|
||||
next if $deprecated_disablables{$what};
|
||||
|
||||
$config{options} .= " no-$what";
|
||||
|
||||
if (!grep { $what eq $_ } ( 'buildtest-c++', 'fips', 'threads', 'shared',
|
||||
'module', 'pic', 'dynamic-engine', 'makedepend',
|
||||
'zlib-dynamic', 'zlib', 'sse2', 'legacy' )) {
|
||||
(my $WHAT = uc $what) =~ s|-|_|g;
|
||||
my $skipdir = $what;
|
||||
|
||||
# fix-up crypto/directory name(s)
|
||||
$skipdir = "ripemd" if $what eq "rmd160";
|
||||
$skipdir = "whrlpool" if $what eq "whirlpool";
|
||||
|
||||
my $macro = $disabled_info{$what}->{macro} = "OPENSSL_NO_$WHAT";
|
||||
push @{$config{openssl_feature_defines}}, $macro;
|
||||
|
||||
$skipdir{engines} = $what if $what eq 'engine';
|
||||
$skipdir{"crypto/$skipdir"} = $what
|
||||
unless $what eq 'async' || $what eq 'err' || $what eq 'dso';
|
||||
}
|
||||
}
|
||||
|
||||
if ($disabled{"dynamic-engine"}) {
|
||||
push @{$config{openssl_feature_defines}}, "OPENSSL_NO_DYNAMIC_ENGINE";
|
||||
} else {
|
||||
push @{$config{openssl_feature_defines}}, "OPENSSL_NO_STATIC_ENGINE";
|
||||
}
|
||||
|
||||
# If we use the unified build, collect information from build.info files
|
||||
my %unified_info = ();
|
||||
|
||||
@@ -1750,6 +1790,8 @@ if ($builder eq "unified") {
|
||||
my %defines = ();
|
||||
my %depends = ();
|
||||
my %generate = ();
|
||||
my %htmldocs = ();
|
||||
my %mandocs = ();
|
||||
|
||||
# Support for $variablename in build.info files.
|
||||
# Embedded perl code is the ultimate master, still. If its output
|
||||
@@ -1810,6 +1852,10 @@ if ($builder eq "unified") {
|
||||
# don't use it if the build tree is different.
|
||||
my $src_configdata = cleanfile($srcdir, "configdata.pm", $blddir);
|
||||
|
||||
|
||||
if ($buildinfo_debug) {
|
||||
print STDERR "DEBUG: Reading ",catfile($sourced, $f),"\n";
|
||||
}
|
||||
push @{$config{build_infos}}, catfile(abs2rel($sourced, $blddir), $f);
|
||||
my $template =
|
||||
Text::Template->new(TYPE => 'FILE',
|
||||
@@ -1921,7 +1967,14 @@ if ($builder eq "unified") {
|
||||
@s);
|
||||
}
|
||||
},
|
||||
|
||||
qr/^\s* HTMLDOCS ${index_re} = ${value_re} $/x
|
||||
=> sub { push @{$htmldocs{$expand_variables->($+{INDEX})}},
|
||||
tokenize($expand_variables->($+{VALUE}))
|
||||
if !@skip || $skip[$#skip] > 0 },
|
||||
qr/^\s* MANDOCS ${index_re} = ${value_re} $/x
|
||||
=> sub { push @{$mandocs{$expand_variables->($+{INDEX})}},
|
||||
tokenize($expand_variables->($+{VALUE}))
|
||||
if !@skip || $skip[$#skip] > 0 },
|
||||
qr/^\s* ORDINALS ${index_re} = ${value_re} $/x
|
||||
=> sub { push @{$ordinals{$expand_variables->($+{INDEX})}},
|
||||
tokenize($expand_variables->($+{VALUE}))
|
||||
@@ -2084,10 +2137,18 @@ EOF
|
||||
my $dest = $_;
|
||||
my $ddest = cleanfile($buildd, $_, $blddir);
|
||||
die "more than one generator for $dest: "
|
||||
,join(" ", @{$generate{$_}}),"\n"
|
||||
if scalar @{$generate{$_}} > 1;
|
||||
,join(" ", @{$generate{$_}}),"\n"
|
||||
if scalar @{$generate{$_}} > 1;
|
||||
my @generator = split /\s+/, $generate{$dest}->[0];
|
||||
$generator[0] = cleanfile($sourced, $generator[0], $blddir),
|
||||
my $gen = $generator[0];
|
||||
$generator[0] = cleanfile($sourced, $gen, $blddir);
|
||||
|
||||
# If the generator isn't in the source tree, we assume it's
|
||||
# generated in the build tree
|
||||
if ($generate{$gen}) {
|
||||
$generator[0] = cleanfile($buildd, $gen, $blddir);
|
||||
}
|
||||
|
||||
$unified_info{generate}->{$ddest} = [ @generator ];
|
||||
}
|
||||
|
||||
@@ -2179,6 +2240,20 @@ EOF
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $section (keys %htmldocs) {
|
||||
foreach (@{$htmldocs{$section}}) {
|
||||
my $htmldocs = cleanfile($buildd, $_, $blddir);
|
||||
$unified_info{htmldocs}->{$section}->{$htmldocs} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $section (keys %mandocs) {
|
||||
foreach (@{$mandocs{$section}}) {
|
||||
my $mandocs = cleanfile($buildd, $_, $blddir);
|
||||
$unified_info{mandocs}->{$section}->{$mandocs} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $ordinals_text = join(', ', sort keys %ordinals);
|
||||
@@ -2339,7 +2414,8 @@ EOF
|
||||
$unified_info{$_} = [ sort keys %{$unified_info{$_}} ];
|
||||
}
|
||||
# Two level structures
|
||||
foreach my $l1 (("sources", "shared_sources", "ldadd", "depends")) {
|
||||
foreach my $l1 (("sources", "shared_sources", "ldadd", "depends",
|
||||
"htmldocs", "mandocs")) {
|
||||
foreach my $l2 (sort keys %{$unified_info{$l1}}) {
|
||||
my @items =
|
||||
sort
|
||||
@@ -2385,7 +2461,11 @@ EOF
|
||||
my %loopinfo = ( "lib" => [ @{$unified_info{libraries}} ],
|
||||
"dso" => [ @{$unified_info{modules}} ],
|
||||
"bin" => [ @{$unified_info{programs}} ],
|
||||
"script" => [ @{$unified_info{scripts}} ] );
|
||||
"script" => [ @{$unified_info{scripts}} ],
|
||||
"docs" => [ (map { @{$unified_info{htmldocs}->{$_} // []} }
|
||||
keys %{$unified_info{htmldocs} // {}}),
|
||||
(map { @{$unified_info{mandocs}->{$_} // []} }
|
||||
keys %{$unified_info{mandocs} // {}}) ] );
|
||||
foreach my $type (keys %loopinfo) {
|
||||
foreach my $product (@{$loopinfo{$type}}) {
|
||||
my %dirs = ();
|
||||
|
||||
@@ -141,14 +141,20 @@
|
||||
--openssldir depend in what configuration is used and what Windows
|
||||
implementation OpenSSL is built on. More notes on this in NOTES.WIN):
|
||||
|
||||
--api=x.y.z
|
||||
Don't build with support for deprecated APIs below the
|
||||
specified version number. For example "--api=1.1.0" will
|
||||
remove support for all APIS that were deprecated in OpenSSL
|
||||
version 1.1.0 or below. This is a rather specialized option
|
||||
for developers. If you just intend to remove all deprecated
|
||||
APIs entirely (up to the current version), it is easier
|
||||
to add the 'no-deprecated' option instead (see below).
|
||||
--api=x.y[.z]
|
||||
Build the OpenSSL libraries to support the API for
|
||||
the specified version. If "no-deprecated" is also
|
||||
given, don't build with support for deprecated APIs
|
||||
in or below the specified version number. For example
|
||||
"--api=1.1.0" with "no-deprecated" will remove
|
||||
support for all APIS that were deprecated in
|
||||
OpenSSL version 1.1.0 or below.
|
||||
This is a rather specialized option for developers.
|
||||
If you just intend to remove all deprecated APIs
|
||||
entirely (up to the current version), only specify
|
||||
"-no-deprecated" (see below).
|
||||
If "--api" isn't given, it defaults to the current
|
||||
OpenSSL minor version.
|
||||
|
||||
--cross-compile-prefix=PREFIX
|
||||
The PREFIX to include in front of commands for your
|
||||
@@ -338,27 +344,20 @@
|
||||
work if the zlib or zlib-dynamic options are also chosen.
|
||||
|
||||
enable-crypto-mdebug
|
||||
Build support for debugging memory allocated via
|
||||
OPENSSL_malloc() or OPENSSL_zalloc().
|
||||
This now only enables the failed-malloc feature.
|
||||
|
||||
enable-crypto-mdebug-backtrace
|
||||
As for crypto-mdebug, but additionally provide backtrace
|
||||
information for allocated memory.
|
||||
TO BE USED WITH CARE: this uses GNU C functionality, and
|
||||
is therefore not usable for non-GNU config targets. If
|
||||
your build complains about the use of '-rdynamic' or the
|
||||
lack of header file execinfo.h, this option is not for you.
|
||||
ALSO NOTE that even though execinfo.h is available on your
|
||||
system (through Gnulib), the functions might just be stubs
|
||||
that do nothing.
|
||||
This is a no-op; the project uses the compiler's
|
||||
address/leak sanitizer instead.
|
||||
|
||||
no-ct
|
||||
Don't build support for Certificate Transparency.
|
||||
|
||||
no-deprecated
|
||||
Don't build with support for any deprecated APIs. This is the
|
||||
same as using "--api" and supplying the latest version
|
||||
number.
|
||||
Don't build with support for deprecated APIs up
|
||||
until and including the version given with
|
||||
"--api" (or the current version of "--api" wasn't
|
||||
given).
|
||||
|
||||
no-dgram
|
||||
Don't build support for datagram based BIOs. Selecting this
|
||||
@@ -829,8 +828,8 @@
|
||||
|
||||
Configure creates a build file ("Makefile" on Unix, "makefile" on Windows
|
||||
and "descrip.mms" on OpenVMS) from a suitable template in Configurations,
|
||||
and defines various macros in include/openssl/opensslconf.h (generated from
|
||||
include/openssl/opensslconf.h.in).
|
||||
and defines various macros in include/openssl/configuration.h (generated
|
||||
from include/openssl/configuration.h.in).
|
||||
|
||||
1c. Configure OpenSSL for building outside of the source tree.
|
||||
|
||||
@@ -1122,7 +1121,7 @@
|
||||
|
||||
HASHBANGPERL
|
||||
The command string for the Perl executable to insert in the
|
||||
#! line of perl scripts that will be publically installed.
|
||||
#! line of perl scripts that will be publicly installed.
|
||||
Default: /usr/bin/env perl
|
||||
Note: the value of this variable is added to the same scripts
|
||||
on all platforms, but it's only relevant on Unix-like platforms.
|
||||
@@ -1149,7 +1148,15 @@
|
||||
described here. Examine the Makefiles themselves for the full list.
|
||||
|
||||
all
|
||||
The default target to build all the software components.
|
||||
The target to build all the software components and
|
||||
documentation.
|
||||
|
||||
build_sw
|
||||
Build all the software components.
|
||||
THIS IS THE DEFAULT TARGET.
|
||||
|
||||
build_docs
|
||||
Build all documentation components.
|
||||
|
||||
clean
|
||||
Remove all build artefacts and return the directory to a "clean"
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
|
||||
Major changes between OpenSSL 1.1.1 and OpenSSL 3.0.0 [under development]
|
||||
|
||||
o enable-crypto-mdebug and enable-crypto-mdebug-backtrace were mostly
|
||||
disabled; the project uses address sanitize/leak-detect instead.
|
||||
o Added OSSL_SERIALIZER, a generic serializer API.
|
||||
o Added error raising macros, ERR_raise() and ERR_raise_data().
|
||||
o Deprecated ERR_put_error().
|
||||
o Added OSSL_PROVIDER_available(), to check provider availibility.
|
||||
@@ -22,6 +25,11 @@
|
||||
o Removed the heartbeat message in DTLS feature.
|
||||
o Added EVP_KDF, an EVP layer KDF API, and a generic EVP_PKEY to EVP_KDF
|
||||
bridge.
|
||||
o All of the low level MD2, MD4, MD5, MDC2, RIPEMD160, SHA1, SHA224,
|
||||
SHA256, SHA384, SHA512 and Whirlpool digest functions have been
|
||||
deprecated.
|
||||
o All of the low level AES, Blowfish, Camellia, CAST, DES, IDEA, RC2,
|
||||
RC4, RC5 and SEED cipher functions have been deprecated.
|
||||
|
||||
Major changes between OpenSSL 1.1.1 and OpenSSL 1.1.1a [20 Nov 2018]
|
||||
|
||||
|
||||
+25
-14
@@ -15,22 +15,33 @@
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
Android is naturally cross-compiled target and you can't use ./config.
|
||||
Android is a naturally cross-compiled target and you can't use ./config.
|
||||
You have to use ./Configure and name your target explicitly; there are
|
||||
android-arm, android-arm64, android-mips, android-mip64, android-x86
|
||||
and android-x86_64. Do not pass --cross-compile-prefix (as you might
|
||||
be tempted), as it will be "calculated" automatically based on chosen
|
||||
platform. Though you still need to know the prefix to extend your PATH,
|
||||
in order to invoke $(CROSS_COMPILE)gcc and company. (Configure will fail
|
||||
and give you a hint if you get it wrong.) Apart from PATH adjustment
|
||||
you need to set ANDROID_NDK_HOME environment to point at NDK directory
|
||||
as /some/where/android-ndk-<ver>. Both variables are significant at both
|
||||
configuration and compilation times. NDK customarily supports multiple
|
||||
Android API levels, e.g. android-14, android-21, etc. By default latest
|
||||
one available is chosen. If you need to target older platform, pass
|
||||
additional -D__ANDROID_API__=N to Configure. N is numeric value of the
|
||||
target platform version. For example, to compile for ICS on ARM with
|
||||
NDK 10d:
|
||||
and android-x86_64 (*MIPS targets are no longer supported with NDK R20+).
|
||||
Do not pass --cross-compile-prefix (as you might be tempted), as it will
|
||||
be "calculated" automatically based on chosen platform. Though you still
|
||||
need to know the prefix to extend your PATH, in order to invoke
|
||||
$(CROSS_COMPILE)clang [*gcc on NDK 19 and lower] and company. (Configure
|
||||
will fail and give you a hint if you get it wrong.) Apart from PATH
|
||||
adjustment you need to set ANDROID_NDK_HOME environment to point at the
|
||||
NDK directory. If you're using a side-by-side NDK the path will look
|
||||
something like /some/where/android-sdk/ndk/<ver>, and for a standalone
|
||||
NDK the path will be something like /some/where/android-ndk-<ver>.
|
||||
Both variables are significant at both configuration and compilation times.
|
||||
The NDK customarily supports multiple Android API levels, e.g. android-14,
|
||||
android-21, etc. By default latest API level is chosen. If you need to
|
||||
target an older platform pass the argument -D__ANDROID_API__=N to Configure,
|
||||
with N being the numerical value of the target platform version. For example,
|
||||
to compile for Android 10 arm64 with a side-by-side NDK r20.0.5594570
|
||||
|
||||
export ANDROID_NDK_HOME=/home/whoever/Android/android-sdk/ndk/20.0.5594570
|
||||
PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
|
||||
./Configure android-arm64 -D__ANDROID_API__=29
|
||||
make
|
||||
|
||||
Older versions of the NDK have GCC under their common prebuilt tools directory, so the bin path
|
||||
will be slightly different. EG: to compile for ICS on ARM with NDK 10d:
|
||||
|
||||
export ANDROID_NDK_HOME=/some/where/android-ndk-10d
|
||||
PATH=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin:$PATH
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
|
||||
OpenSSL 3.0.0-dev
|
||||
|
||||
Copyright (c) 1998-2018 The OpenSSL Project
|
||||
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
|
||||
All rights reserved.
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
MAJOR=3
|
||||
MINOR=0
|
||||
PATCH=0
|
||||
PRE_RELEASE_TAG=dev
|
||||
BUILD_METADATA=
|
||||
RELEASE_DATE=
|
||||
SHLIB_VERSION=3
|
||||
+12
-7
@@ -27,27 +27,32 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS asn1parse_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"oid", OPT_OID, '<', "file of extra oid definitions"},
|
||||
|
||||
OPT_SECTION("I/O"),
|
||||
{"inform", OPT_INFORM, 'F', "input format - one of DER PEM"},
|
||||
{"in", OPT_IN, '<', "input file"},
|
||||
{"out", OPT_OUT, '>', "output file (output format is always DER)"},
|
||||
{"i", OPT_INDENT, 0, "indents the output"},
|
||||
{"noout", OPT_NOOUT, 0, "do not produce any output"},
|
||||
{"offset", OPT_OFFSET, 'p', "offset into file"},
|
||||
{"length", OPT_LENGTH, 'p', "length of section in file"},
|
||||
{"oid", OPT_OID, '<', "file of extra oid definitions"},
|
||||
{"dump", OPT_DUMP, 0, "unknown data in hex form"},
|
||||
{"dlimit", OPT_DLIMIT, 'p',
|
||||
"dump the first arg bytes of unknown data in hex form"},
|
||||
{"strparse", OPT_STRPARSE, 'p',
|
||||
"offset; a series of these can be used to 'dig'"},
|
||||
{OPT_MORE_STR, 0, 0, "into multiple ASN1 blob wrappings"},
|
||||
{"genstr", OPT_GENSTR, 's', "string to generate ASN1 structure from"},
|
||||
{OPT_MORE_STR, 0, 0, "into multiple ASN1 blob wrappings"},
|
||||
{"genconf", OPT_GENCONF, 's', "file to generate ASN1 structure from"},
|
||||
{OPT_MORE_STR, 0, 0, "(-inform will be ignored)"},
|
||||
{"strictpem", OPT_STRICTPEM, 0,
|
||||
"do not attempt base64 decode outside PEM markers"},
|
||||
{"item", OPT_ITEM, 's', "item to parse and print"},
|
||||
{OPT_MORE_STR, 0, 0, "(-inform will be ignored)"},
|
||||
|
||||
OPT_SECTION("Formatting"),
|
||||
{"i", OPT_INDENT, 0, "indents the output"},
|
||||
{"dump", OPT_DUMP, 0, "unknown data in hex form"},
|
||||
{"dlimit", OPT_DLIMIT, 'p',
|
||||
"dump the first arg bytes of unknown data in hex form"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -154,10 +154,32 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS ca_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] [certreq...]\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"verbose", OPT_VERBOSE, '-', "Verbose output during processing"},
|
||||
{"outdir", OPT_OUTDIR, '/', "Where to put output cert"},
|
||||
{"in", OPT_IN, '<', "The input PEM encoded cert request(s)"},
|
||||
{"infiles", OPT_INFILES, '-', "The last argument, requests to process"},
|
||||
{"out", OPT_OUT, '>', "Where to put the output file(s)"},
|
||||
{"notext", OPT_NOTEXT, '-', "Do not print the generated certificate"},
|
||||
{"batch", OPT_BATCH, '-', "Don't ask questions"},
|
||||
{"msie_hack", OPT_MSIE_HACK, '-',
|
||||
"msie modifications to handle all Universal Strings"},
|
||||
{"ss_cert", OPT_SS_CERT, '<', "File contains a self signed cert to sign"},
|
||||
{"spkac", OPT_SPKAC, '<',
|
||||
"File contains DN and signed public key and challenge"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Configuration"),
|
||||
{"config", OPT_CONFIG, 's', "A config file"},
|
||||
{"name", OPT_NAME, 's', "The particular CA definition to use"},
|
||||
{"policy", OPT_POLICY, 's', "The CA 'policy' to support"},
|
||||
|
||||
OPT_SECTION("Certificate"),
|
||||
{"subj", OPT_SUBJ, 's', "Use arg instead of request's subject"},
|
||||
{"utf8", OPT_UTF8, '-', "Input characters are UTF8 (default ASCII)"},
|
||||
{"create_serial", OPT_CREATE_SERIAL, '-',
|
||||
@@ -170,8 +192,21 @@ const OPTIONS ca_options[] = {
|
||||
{"enddate", OPT_ENDDATE, 's',
|
||||
"YYMMDDHHMMSSZ cert notAfter (overrides -days)"},
|
||||
{"days", OPT_DAYS, 'p', "Number of days to certify the cert for"},
|
||||
{"extensions", OPT_EXTENSIONS, 's',
|
||||
"Extension section (override value in config file)"},
|
||||
{"extfile", OPT_EXTFILE, '<',
|
||||
"Configuration file with X509v3 extensions to add"},
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
{"sm2-id", OPT_SM2ID, 's',
|
||||
"Specify an ID string to verify an SM2 certificate request"},
|
||||
{"sm2-hex-id", OPT_SM2HEXID, 's',
|
||||
"Specify a hex ID string to verify an SM2 certificate request"},
|
||||
#endif
|
||||
{"preserveDN", OPT_PRESERVEDN, '-', "Don't re-order the DN"},
|
||||
{"noemailDN", OPT_NOEMAILDN, '-', "Don't add the EMAIL field to the DN"},
|
||||
|
||||
OPT_SECTION("Signing"),
|
||||
{"md", OPT_MD, 's', "md to use; one of md2, md5, sha or sha1"},
|
||||
{"policy", OPT_POLICY, 's', "The CA 'policy' to support"},
|
||||
{"keyfile", OPT_KEYFILE, 's', "Private key"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Private key file format (PEM or ENGINE)"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
@@ -179,31 +214,12 @@ const OPTIONS ca_options[] = {
|
||||
{"cert", OPT_CERT, '<', "The CA cert"},
|
||||
{"selfsign", OPT_SELFSIGN, '-',
|
||||
"Sign a cert with the key associated with it"},
|
||||
{"in", OPT_IN, '<', "The input PEM encoded cert request(s)"},
|
||||
{"out", OPT_OUT, '>', "Where to put the output file(s)"},
|
||||
{"outdir", OPT_OUTDIR, '/', "Where to put output cert"},
|
||||
{"sigopt", OPT_SIGOPT, 's', "Signature parameter in n:v form"},
|
||||
{"notext", OPT_NOTEXT, '-', "Do not print the generated certificate"},
|
||||
{"batch", OPT_BATCH, '-', "Don't ask questions"},
|
||||
{"preserveDN", OPT_PRESERVEDN, '-', "Don't re-order the DN"},
|
||||
{"noemailDN", OPT_NOEMAILDN, '-', "Don't add the EMAIL field to the DN"},
|
||||
|
||||
OPT_SECTION("Revocation"),
|
||||
{"gencrl", OPT_GENCRL, '-', "Generate a new CRL"},
|
||||
{"msie_hack", OPT_MSIE_HACK, '-',
|
||||
"msie modifications to handle all those universal strings"},
|
||||
{"crldays", OPT_CRLDAYS, 'p', "Days until the next CRL is due"},
|
||||
{"crlhours", OPT_CRLHOURS, 'p', "Hours until the next CRL is due"},
|
||||
{"crlsec", OPT_CRLSEC, 'p', "Seconds until the next CRL is due"},
|
||||
{"infiles", OPT_INFILES, '-', "The last argument, requests to process"},
|
||||
{"ss_cert", OPT_SS_CERT, '<', "File contains a self signed cert to sign"},
|
||||
{"spkac", OPT_SPKAC, '<',
|
||||
"File contains DN and signed public key and challenge"},
|
||||
{"revoke", OPT_REVOKE, '<', "Revoke a cert (given in file)"},
|
||||
{"valid", OPT_VALID, 's',
|
||||
"Add a Valid(not-revoked) DB entry about a cert (given in file)"},
|
||||
{"extensions", OPT_EXTENSIONS, 's',
|
||||
"Extension section (override value in config file)"},
|
||||
{"extfile", OPT_EXTFILE, '<',
|
||||
"Configuration file with X509v3 extensions to add"},
|
||||
{"status", OPT_STATUS, 's', "Shows cert status given the serial number"},
|
||||
{"updatedb", OPT_UPDATEDB, '-', "Updates db for expired cert"},
|
||||
{"crlexts", OPT_CRLEXTS, 's',
|
||||
@@ -215,16 +231,15 @@ const OPTIONS ca_options[] = {
|
||||
"sets compromise time to val and the revocation reason to keyCompromise"},
|
||||
{"crl_CA_compromise", OPT_CRL_CA_COMPROMISE, 's',
|
||||
"sets compromise time to val and the revocation reason to CACompromise"},
|
||||
{"crldays", OPT_CRLDAYS, 'p', "Days until the next CRL is due"},
|
||||
{"crlhours", OPT_CRLHOURS, 'p', "Hours until the next CRL is due"},
|
||||
{"crlsec", OPT_CRLSEC, 'p', "Seconds until the next CRL is due"},
|
||||
{"revoke", OPT_REVOKE, '<', "Revoke a cert (given in file)"},
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
{"sm2-id", OPT_SM2ID, 's',
|
||||
"Specify an ID string to verify an SM2 certificate request"},
|
||||
{"sm2-hex-id", OPT_SM2HEXID, 's',
|
||||
"Specify a hex ID string to verify an SM2 certificate request"},
|
||||
#endif
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"certreq", 0, 0, "Certificate requests to be signed (optional)"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+19
-9
@@ -31,35 +31,45 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS ciphers_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] [cipher]\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"v", OPT_V, '-', "Verbose listing of the SSL/TLS ciphers"},
|
||||
{"V", OPT_UPPER_V, '-', "Even more verbose"},
|
||||
{"stdname", OPT_STDNAME, '-', "Show standard cipher names"},
|
||||
{"convert", OPT_CONVERT, 's', "Convert standard name into OpenSSL name"},
|
||||
|
||||
OPT_SECTION("Cipher specification"),
|
||||
{"s", OPT_S, '-', "Only supported ciphers"},
|
||||
#ifndef OPENSSL_NO_SSL3
|
||||
{"ssl3", OPT_SSL3, '-', "SSL3 mode"},
|
||||
{"ssl3", OPT_SSL3, '-', "Ciphers compatible with SSL3"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_TLS1
|
||||
{"tls1", OPT_TLS1, '-', "TLS1 mode"},
|
||||
{"tls1", OPT_TLS1, '-', "Ciphers compatible with TLS1"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_TLS1_1
|
||||
{"tls1_1", OPT_TLS1_1, '-', "TLS1.1 mode"},
|
||||
{"tls1_1", OPT_TLS1_1, '-', "Ciphers compatible with TLS1.1"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_TLS1_2
|
||||
{"tls1_2", OPT_TLS1_2, '-', "TLS1.2 mode"},
|
||||
{"tls1_2", OPT_TLS1_2, '-', "Ciphers compatible with TLS1.2"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_TLS1_3
|
||||
{"tls1_3", OPT_TLS1_3, '-', "TLS1.3 mode"},
|
||||
{"tls1_3", OPT_TLS1_3, '-', "Ciphers compatible with TLS1.3"},
|
||||
#endif
|
||||
{"stdname", OPT_STDNAME, '-', "Show standard cipher names"},
|
||||
#ifndef OPENSSL_NO_PSK
|
||||
{"psk", OPT_PSK, '-', "include ciphersuites requiring PSK"},
|
||||
{"psk", OPT_PSK, '-', "Include ciphersuites requiring PSK"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SRP
|
||||
{"srp", OPT_SRP, '-', "include ciphersuites requiring SRP"},
|
||||
{"srp", OPT_SRP, '-', "Include ciphersuites requiring SRP"},
|
||||
#endif
|
||||
{"convert", OPT_CONVERT, 's', "Convert standard name into OpenSSL name"},
|
||||
{"ciphersuites", OPT_CIPHERSUITES, 's',
|
||||
"Configure the TLSv1.3 ciphersuites to use"},
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"cipher", 0, 0, "Cipher string to decode (optional)"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+80
-52
@@ -75,7 +75,8 @@ typedef enum OPTION_choice {
|
||||
OPT_NOSIGS, OPT_NO_CONTENT_VERIFY, OPT_NO_ATTR_VERIFY, OPT_INDEF,
|
||||
OPT_NOINDEF, OPT_CRLFEOL, OPT_NOOUT, OPT_RR_PRINT,
|
||||
OPT_RR_ALL, OPT_RR_FIRST, OPT_RCTFORM, OPT_CERTFILE, OPT_CAFILE,
|
||||
OPT_CAPATH, OPT_NOCAPATH, OPT_NOCAFILE,OPT_CONTENT, OPT_PRINT,
|
||||
OPT_CAPATH, OPT_CASTORE, OPT_NOCAPATH, OPT_NOCAFILE, OPT_NOCASTORE,
|
||||
OPT_CONTENT, OPT_PRINT,
|
||||
OPT_SECRETKEY, OPT_SECRETKEYID, OPT_PWRI_PASSWORD, OPT_ECONTENT_TYPE,
|
||||
OPT_PASSIN, OPT_TO, OPT_FROM, OPT_SUBJECT, OPT_SIGNER, OPT_RECIP,
|
||||
OPT_CERTSOUT, OPT_MD, OPT_INKEY, OPT_KEYFORM, OPT_KEYOPT, OPT_RR_FROM,
|
||||
@@ -87,16 +88,36 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS cms_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] cert.pem...\n"},
|
||||
{OPT_HELP_STR, 1, '-',
|
||||
" cert.pem... recipient certs for encryption\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Valid options are:\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] [cert...]\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"inform", OPT_INFORM, 'c', "Input format SMIME (default), PEM or DER"},
|
||||
{"outform", OPT_OUTFORM, 'c',
|
||||
"Output format SMIME (default), PEM or DER"},
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"debug_decrypt", OPT_DEBUG_DECRYPT, '-',
|
||||
"Disable MMA protection and return an error if no recipient found"
|
||||
" (see documentation)"},
|
||||
{"stream", OPT_INDEF, '-', "Enable CMS streaming"},
|
||||
{"indef", OPT_INDEF, '-', "Same as -stream"},
|
||||
{"noindef", OPT_NOINDEF, '-', "Disable CMS streaming"},
|
||||
{"crlfeol", OPT_CRLFEOL, '-', "Use CRLF as EOL termination instead of CR only" },
|
||||
{"CAfile", OPT_CAFILE, '<', "Trusted certificates file"},
|
||||
{"CApath", OPT_CAPATH, '/', "trusted certificates directory"},
|
||||
{"CAstore", OPT_CASTORE, ':', "trusted certificates store URI"},
|
||||
{"no-CAfile", OPT_NOCAFILE, '-',
|
||||
"Do not load the default certificates file"},
|
||||
{"no-CApath", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates directory"},
|
||||
{"no-CAstore", OPT_NOCASTORE, '-',
|
||||
"Do not load certificates from the default certificates store"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine e, possibly a hardware device"},
|
||||
# endif
|
||||
|
||||
OPT_SECTION("Action"),
|
||||
{"encrypt", OPT_ENCRYPT, '-', "Encrypt message"},
|
||||
{"decrypt", OPT_DECRYPT, '-', "Decrypt encrypted message"},
|
||||
{"sign", OPT_SIGN, '-', "Sign message"},
|
||||
@@ -108,45 +129,42 @@ const OPTIONS cms_options[] = {
|
||||
"Exit non-zero on verification failure"},
|
||||
{"verify_receipt", OPT_VERIFY_RECEIPT, '<',
|
||||
"Verify receipts; exit if receipt signatures do not verify"},
|
||||
{"cmsout", OPT_CMSOUT, '-', "Output CMS structure"},
|
||||
{"data_out", OPT_DATA_OUT, '-', "Copy CMS \"Data\" object to output"},
|
||||
{"data_create", OPT_DATA_CREATE, '-', "Create a CMS \"Data\" object"},
|
||||
{"digest_verify", OPT_DIGEST_VERIFY, '-',
|
||||
"Verify a CMS \"DigestedData\" object and output it"},
|
||||
{"digest_create", OPT_DIGEST_CREATE, '-',
|
||||
"Create a CMS \"DigestedData\" object"},
|
||||
{"compress", OPT_COMPRESS, '-', "Create a CMS \"CompressedData\" object"},
|
||||
{"uncompress", OPT_UNCOMPRESS, '-', "Uncompress a CMS \"CompressedData\" object"},
|
||||
{"uncompress", OPT_UNCOMPRESS, '-',
|
||||
"Uncompress a CMS \"CompressedData\" object"},
|
||||
{"EncryptedData_decrypt", OPT_ED_DECRYPT, '-',
|
||||
"Decrypt CMS \"EncryptedData\" object using symmetric key"},
|
||||
{"EncryptedData_encrypt", OPT_ED_ENCRYPT, '-',
|
||||
"Create CMS \"EncryptedData\" object using symmetric key"},
|
||||
{"debug_decrypt", OPT_DEBUG_DECRYPT, '-',
|
||||
"Disable MMA protection and return an error if no recipient found"
|
||||
" (see documentation)"},
|
||||
{"text", OPT_TEXT, '-', "Include or delete text MIME headers"},
|
||||
{"asciicrlf", OPT_ASCIICRLF, '-',
|
||||
"Perform CRLF canonicalisation when signing"},
|
||||
{"nointern", OPT_NOINTERN, '-',
|
||||
"Don't search certificates in message for signer"},
|
||||
{"noverify", OPT_NOVERIFY, '-', "Don't verify signers certificate"},
|
||||
{"nocerts", OPT_NOCERTS, '-',
|
||||
"Don't include signers certificate when signing"},
|
||||
{"noattr", OPT_NOATTR, '-', "Don't include any signed attributes"},
|
||||
{"nodetach", OPT_NODETACH, '-', "Use opaque signing"},
|
||||
{"nosmimecap", OPT_NOSMIMECAP, '-', "Omit the SMIMECapabilities attribute"},
|
||||
{"binary", OPT_BINARY, '-', "Don't translate message to text"},
|
||||
{"keyid", OPT_KEYID, '-', "Use subject key identifier"},
|
||||
{"nosigs", OPT_NOSIGS, '-', "Don't verify message signature"},
|
||||
{"data_out", OPT_DATA_OUT, '-', "Copy CMS \"Data\" object to output"},
|
||||
{"data_create", OPT_DATA_CREATE, '-', "Create a CMS \"Data\" object"},
|
||||
{"cmsout", OPT_CMSOUT, '-', "Output CMS structure"},
|
||||
{"no_content_verify", OPT_NO_CONTENT_VERIFY, '-',
|
||||
"Do not verify signed content signatures"},
|
||||
{"no_attr_verify", OPT_NO_ATTR_VERIFY, '-',
|
||||
"Do not verify signed attribute signatures"},
|
||||
{"stream", OPT_INDEF, '-', "Enable CMS streaming"},
|
||||
{"indef", OPT_INDEF, '-', "Same as -stream"},
|
||||
{"noindef", OPT_NOINDEF, '-', "Disable CMS streaming"},
|
||||
{"crlfeol", OPT_CRLFEOL, '-', "Use CRLF as EOL termination instead of CR only" },
|
||||
{"noout", OPT_NOOUT, '-', "For the -cmsout operation do not output the parsed CMS structure"},
|
||||
{"nointern", OPT_NOINTERN, '-',
|
||||
"Don't search certificates in message for signer"},
|
||||
{"noverify", OPT_NOVERIFY, '-', "Don't verify signers certificate"},
|
||||
|
||||
OPT_SECTION("Formatting"),
|
||||
{"text", OPT_TEXT, '-', "Include or delete text MIME headers"},
|
||||
{"asciicrlf", OPT_ASCIICRLF, '-',
|
||||
"Perform CRLF canonicalisation when signing"},
|
||||
{"nodetach", OPT_NODETACH, '-', "Use opaque signing"},
|
||||
{"nosmimecap", OPT_NOSMIMECAP, '-', "Omit the SMIMECapabilities attribute"},
|
||||
{"noattr", OPT_NOATTR, '-', "Don't include any signed attributes"},
|
||||
{"binary", OPT_BINARY, '-', "Don't translate message to text"},
|
||||
{"keyid", OPT_KEYID, '-', "Use subject key identifier"},
|
||||
{"nosigs", OPT_NOSIGS, '-', "Don't verify message signature"},
|
||||
{"nocerts", OPT_NOCERTS, '-',
|
||||
"Don't include signers certificate when signing"},
|
||||
{"noout", OPT_NOOUT, '-',
|
||||
"For the -cmsout operation do not output the parsed CMS structure"},
|
||||
{"receipt_request_print", OPT_RR_PRINT, '-', "Print CMS Receipt Request" },
|
||||
{"receipt_request_all", OPT_RR_ALL, '-',
|
||||
"When signing, create a receipt request for all recipients"},
|
||||
@@ -154,51 +172,54 @@ const OPTIONS cms_options[] = {
|
||||
"When signing, create a receipt request for first recipient"},
|
||||
{"rctform", OPT_RCTFORM, 'F', "Receipt file format"},
|
||||
{"certfile", OPT_CERTFILE, '<', "Other certificates file"},
|
||||
{"CAfile", OPT_CAFILE, '<', "Trusted certificates file"},
|
||||
{"CApath", OPT_CAPATH, '/', "trusted certificates directory"},
|
||||
{"no-CAfile", OPT_NOCAFILE, '-',
|
||||
"Do not load the default certificates file"},
|
||||
{"no-CApath", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates directory"},
|
||||
{"content", OPT_CONTENT, '<',
|
||||
"Supply or override content for detached signature"},
|
||||
{"print", OPT_PRINT, '-',
|
||||
"For the -cmsout operation print out all fields of the CMS structure"},
|
||||
{"certsout", OPT_CERTSOUT, '>', "Certificate output file"},
|
||||
|
||||
OPT_SECTION("Keying"),
|
||||
{"secretkey", OPT_SECRETKEY, 's',
|
||||
"Use specified hex-encoded key to decrypt/encrypt recipients or content"},
|
||||
{"secretkeyid", OPT_SECRETKEYID, 's',
|
||||
"Identity of the -secretkey for CMS \"KEKRecipientInfo\" object"},
|
||||
{"pwri_password", OPT_PWRI_PASSWORD, 's',
|
||||
"Specific password for recipient"},
|
||||
{"econtent_type", OPT_ECONTENT_TYPE, 's', "OID for external content"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"inkey", OPT_INKEY, 's',
|
||||
"Input private key (if not signer or recipient)"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Input private key format (PEM or ENGINE)"},
|
||||
{"keyopt", OPT_KEYOPT, 's', "Set public key parameters as n:v pairs"},
|
||||
|
||||
OPT_SECTION("Mail header"),
|
||||
{"econtent_type", OPT_ECONTENT_TYPE, 's', "OID for external content"},
|
||||
{"to", OPT_TO, 's', "To address"},
|
||||
{"from", OPT_FROM, 's', "From address"},
|
||||
{"subject", OPT_SUBJECT, 's', "Subject"},
|
||||
{"signer", OPT_SIGNER, 's', "Signer certificate file"},
|
||||
{"recip", OPT_RECIP, '<', "Recipient cert file for decryption"},
|
||||
{"certsout", OPT_CERTSOUT, '>', "Certificate output file"},
|
||||
{"md", OPT_MD, 's', "Digest algorithm to use when signing or resigning"},
|
||||
{"inkey", OPT_INKEY, 's',
|
||||
"Input private key (if not signer or recipient)"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Input private key format (PEM or ENGINE)"},
|
||||
{"keyopt", OPT_KEYOPT, 's', "Set public key parameters as n:v pairs"},
|
||||
{"receipt_request_from", OPT_RR_FROM, 's',
|
||||
"Create signed receipt request with specified email address"},
|
||||
{"receipt_request_to", OPT_RR_TO, 's',
|
||||
"Create signed receipt targeted to specified address"},
|
||||
|
||||
OPT_SECTION("Encryption"),
|
||||
{"md", OPT_MD, 's', "Digest algorithm to use when signing or resigning"},
|
||||
{"", OPT_CIPHER, '-', "Any supported cipher"},
|
||||
OPT_R_OPTIONS,
|
||||
OPT_V_OPTIONS,
|
||||
|
||||
OPT_SECTION("Key-wrapping"),
|
||||
{"aes128-wrap", OPT_AES128_WRAP, '-', "Use AES128 to wrap key"},
|
||||
{"aes192-wrap", OPT_AES192_WRAP, '-', "Use AES192 to wrap key"},
|
||||
{"aes256-wrap", OPT_AES256_WRAP, '-', "Use AES256 to wrap key"},
|
||||
# ifndef OPENSSL_NO_DES
|
||||
{"des3-wrap", OPT_3DES_WRAP, '-', "Use 3DES-EDE to wrap key"},
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine e, possibly a hardware device"},
|
||||
# endif
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
OPT_V_OPTIONS,
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"cert", 0, 0, "Recipient certs (optional; used only when encrypting)"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -219,9 +240,9 @@ int cms_main(int argc, char **argv)
|
||||
X509_STORE *store = NULL;
|
||||
X509_VERIFY_PARAM *vpm = NULL;
|
||||
char *certfile = NULL, *keyfile = NULL, *contfile = NULL;
|
||||
const char *CAfile = NULL, *CApath = NULL;
|
||||
const char *CAfile = NULL, *CApath = NULL, *CAstore = NULL;
|
||||
char *certsoutfile = NULL;
|
||||
int noCAfile = 0, noCApath = 0;
|
||||
int noCAfile = 0, noCApath = 0, noCAstore = 0;
|
||||
char *infile = NULL, *outfile = NULL, *rctfile = NULL;
|
||||
char *passinarg = NULL, *passin = NULL, *signerfile = NULL, *recipfile = NULL;
|
||||
char *to = NULL, *from = NULL, *subject = NULL, *prog;
|
||||
@@ -401,12 +422,18 @@ int cms_main(int argc, char **argv)
|
||||
case OPT_CAPATH:
|
||||
CApath = opt_arg();
|
||||
break;
|
||||
case OPT_CASTORE:
|
||||
CAstore = opt_arg();
|
||||
break;
|
||||
case OPT_NOCAFILE:
|
||||
noCAfile = 1;
|
||||
break;
|
||||
case OPT_NOCAPATH:
|
||||
noCApath = 1;
|
||||
break;
|
||||
case OPT_NOCASTORE:
|
||||
noCAstore = 1;
|
||||
break;
|
||||
case OPT_IN:
|
||||
infile = opt_arg();
|
||||
break;
|
||||
@@ -825,7 +852,8 @@ int cms_main(int argc, char **argv)
|
||||
goto end;
|
||||
|
||||
if ((operation == SMIME_VERIFY) || (operation == SMIME_VERIFY_RECEIPT)) {
|
||||
if ((store = setup_verify(CAfile, CApath, noCAfile, noCApath)) == NULL)
|
||||
if ((store = setup_verify(CAfile, noCAfile, CApath, noCApath,
|
||||
CAstore, noCAstore)) == NULL)
|
||||
goto end;
|
||||
X509_STORE_set_verify_cb(store, cms_cb);
|
||||
if (vpmtouched)
|
||||
|
||||
+38
-18
@@ -22,19 +22,34 @@ typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
OPT_INFORM, OPT_IN, OPT_OUTFORM, OPT_OUT, OPT_KEYFORM, OPT_KEY,
|
||||
OPT_ISSUER, OPT_LASTUPDATE, OPT_NEXTUPDATE, OPT_FINGERPRINT,
|
||||
OPT_CRLNUMBER, OPT_BADSIG, OPT_GENDELTA, OPT_CAPATH, OPT_CAFILE,
|
||||
OPT_NOCAPATH, OPT_NOCAFILE, OPT_VERIFY, OPT_TEXT, OPT_HASH, OPT_HASH_OLD,
|
||||
OPT_NOOUT, OPT_NAMEOPT, OPT_MD
|
||||
OPT_CRLNUMBER, OPT_BADSIG, OPT_GENDELTA, OPT_CAPATH, OPT_CAFILE, OPT_CASTORE,
|
||||
OPT_NOCAPATH, OPT_NOCAFILE, OPT_NOCASTORE, OPT_VERIFY, OPT_TEXT, OPT_HASH,
|
||||
OPT_HASH_OLD, OPT_NOOUT, OPT_NAMEOPT, OPT_MD
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS crl_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"inform", OPT_INFORM, 'F', "Input format; default PEM"},
|
||||
{"verify", OPT_VERIFY, '-', "Verify CRL signature"},
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input file - default stdin"},
|
||||
{"outform", OPT_OUTFORM, 'F', "Output format - default PEM"},
|
||||
{"out", OPT_OUT, '>', "output file - default stdout"},
|
||||
{"keyform", OPT_KEYFORM, 'F', "Private key file format (PEM or ENGINE)"},
|
||||
{"inform", OPT_INFORM, 'F', "Input format; default PEM"},
|
||||
{"key", OPT_KEY, '<', "CRL signing Private key to use"},
|
||||
{"keyform", OPT_KEYFORM, 'F', "Private key file format (PEM or ENGINE)"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "output file - default stdout"},
|
||||
{"outform", OPT_OUTFORM, 'F', "Output format - default PEM"},
|
||||
{"text", OPT_TEXT, '-', "Print out a text format version"},
|
||||
{"hash", OPT_HASH, '-', "Print hash value"},
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
{"hash_old", OPT_HASH_OLD, '-', "Print old-style (MD5) hash value"},
|
||||
#endif
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"},
|
||||
{"", OPT_MD, '-', "Any supported digest"},
|
||||
|
||||
OPT_SECTION("CRL"),
|
||||
{"issuer", OPT_ISSUER, '-', "Print issuer DN"},
|
||||
{"lastupdate", OPT_LASTUPDATE, '-', "Set lastUpdate field"},
|
||||
{"nextupdate", OPT_NEXTUPDATE, '-', "Set nextUpdate field"},
|
||||
@@ -43,20 +58,17 @@ const OPTIONS crl_options[] = {
|
||||
{"crlnumber", OPT_CRLNUMBER, '-', "Print CRL number"},
|
||||
{"badsig", OPT_BADSIG, '-', "Corrupt last byte of loaded CRL signature (for test)" },
|
||||
{"gendelta", OPT_GENDELTA, '<', "Other CRL to compare/diff to the Input one"},
|
||||
|
||||
OPT_SECTION("Certificate"),
|
||||
{"CApath", OPT_CAPATH, '/', "Verify CRL using certificates in dir"},
|
||||
{"CAfile", OPT_CAFILE, '<', "Verify CRL using certificates in file name"},
|
||||
{"CAstore", OPT_CASTORE, ':', "Verify CRL using certificates in store URI"},
|
||||
{"no-CAfile", OPT_NOCAFILE, '-',
|
||||
"Do not load the default certificates file"},
|
||||
{"no-CApath", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates directory"},
|
||||
{"verify", OPT_VERIFY, '-', "Verify CRL signature"},
|
||||
{"text", OPT_TEXT, '-', "Print out a text format version"},
|
||||
{"hash", OPT_HASH, '-', "Print hash value"},
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"},
|
||||
{"", OPT_MD, '-', "Any supported digest"},
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
{"hash_old", OPT_HASH_OLD, '-', "Print old-style (MD5) hash value"},
|
||||
#endif
|
||||
{"no-CAstore", OPT_NOCASTORE, '-',
|
||||
"Do not load certificates from the default certificates store"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -71,12 +83,12 @@ int crl_main(int argc, char **argv)
|
||||
EVP_PKEY *pkey;
|
||||
const EVP_MD *digest = EVP_sha1();
|
||||
char *infile = NULL, *outfile = NULL, *crldiff = NULL, *keyfile = NULL;
|
||||
const char *CAfile = NULL, *CApath = NULL, *prog;
|
||||
const char *CAfile = NULL, *CApath = NULL, *CAstore = NULL, *prog;
|
||||
OPTION_CHOICE o;
|
||||
int hash = 0, issuer = 0, lastupdate = 0, nextupdate = 0, noout = 0;
|
||||
int informat = FORMAT_PEM, outformat = FORMAT_PEM, keyformat = FORMAT_PEM;
|
||||
int ret = 1, num = 0, badsig = 0, fingerprint = 0, crlnumber = 0;
|
||||
int text = 0, do_ver = 0, noCAfile = 0, noCApath = 0;
|
||||
int text = 0, do_ver = 0, noCAfile = 0, noCApath = 0, noCAstore = 0;
|
||||
int i;
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
int hash_old = 0;
|
||||
@@ -126,12 +138,19 @@ int crl_main(int argc, char **argv)
|
||||
CAfile = opt_arg();
|
||||
do_ver = 1;
|
||||
break;
|
||||
case OPT_CASTORE:
|
||||
CAstore = opt_arg();
|
||||
do_ver = 1;
|
||||
break;
|
||||
case OPT_NOCAPATH:
|
||||
noCApath = 1;
|
||||
break;
|
||||
case OPT_NOCAFILE:
|
||||
noCAfile = 1;
|
||||
break;
|
||||
case OPT_NOCASTORE:
|
||||
noCAstore = 1;
|
||||
break;
|
||||
case OPT_HASH_OLD:
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
hash_old = ++num;
|
||||
@@ -185,7 +204,8 @@ int crl_main(int argc, char **argv)
|
||||
goto end;
|
||||
|
||||
if (do_ver) {
|
||||
if ((store = setup_verify(CAfile, CApath, noCAfile, noCApath)) == NULL)
|
||||
if ((store = setup_verify(CAfile, noCAfile, CApath, noCApath,
|
||||
CAstore, noCAstore)) == NULL)
|
||||
goto end;
|
||||
lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
|
||||
if (lookup == NULL)
|
||||
|
||||
+8
-3
@@ -27,14 +27,19 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS crl2pkcs7_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"inform", OPT_INFORM, 'F', "Input format - DER or PEM"},
|
||||
{"outform", OPT_OUTFORM, 'F', "Output format - DER or PEM"},
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"inform", OPT_INFORM, 'F', "Input format - DER or PEM"},
|
||||
{"nocrl", OPT_NOCRL, '-', "No crl to load, just certs from '-certfile'"},
|
||||
{"certfile", OPT_CERTFILE, '<',
|
||||
"File of chain of certs to a trusted CA; can be repeated"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"outform", OPT_OUTFORM, 'F', "Output format - DER or PEM"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+101
-37
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/hmac.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#undef BUFSIZE
|
||||
#define BUFSIZE 1024*8
|
||||
@@ -27,9 +28,15 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
|
||||
EVP_PKEY *key, unsigned char *sigin, int siglen,
|
||||
const char *sig_name, const char *md_name,
|
||||
const char *file);
|
||||
static void show_digests(const OBJ_NAME *name, void *bio_);
|
||||
|
||||
struct doall_dgst_digests {
|
||||
BIO *bio;
|
||||
int n;
|
||||
};
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_LIST,
|
||||
OPT_C, OPT_R, OPT_OUT, OPT_SIGN, OPT_PASSIN, OPT_VERIFY,
|
||||
OPT_PRVERIFY, OPT_SIGNATURE, OPT_KEYFORM, OPT_ENGINE, OPT_ENGINE_IMPL,
|
||||
OPT_HEX, OPT_BINARY, OPT_DEBUG, OPT_FIPS_FINGERPRINT,
|
||||
@@ -40,37 +47,44 @@ typedef enum OPTION_choice {
|
||||
|
||||
const OPTIONS dgst_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] [file...]\n"},
|
||||
{OPT_HELP_STR, 1, '-',
|
||||
" file... files to digest (default is stdin)\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"c", OPT_C, '-', "Print the digest with separating colons"},
|
||||
{"r", OPT_R, '-', "Print the digest in coreutils format"},
|
||||
{"out", OPT_OUT, '>', "Output to filename rather than stdout"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"sign", OPT_SIGN, 's', "Sign digest using private key"},
|
||||
{"verify", OPT_VERIFY, 's',
|
||||
"Verify a signature using public key"},
|
||||
{"prverify", OPT_PRVERIFY, 's',
|
||||
"Verify a signature using private key"},
|
||||
{"signature", OPT_SIGNATURE, '<', "File with signature to verify"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Key file format (PEM or ENGINE)"},
|
||||
{"hex", OPT_HEX, '-', "Print as hex dump"},
|
||||
{"binary", OPT_BINARY, '-', "Print in binary form"},
|
||||
{"d", OPT_DEBUG, '-', "Print debug info"},
|
||||
{"debug", OPT_DEBUG, '-', "Print debug info"},
|
||||
{"fips-fingerprint", OPT_FIPS_FINGERPRINT, '-',
|
||||
"Compute HMAC with the key used in OpenSSL-FIPS fingerprint"},
|
||||
{"hmac", OPT_HMAC, 's', "Create hashed MAC with key"},
|
||||
{"mac", OPT_MAC, 's', "Create MAC (not necessarily HMAC)"},
|
||||
{"sigopt", OPT_SIGOPT, 's', "Signature parameter in n:v form"},
|
||||
{"macopt", OPT_MACOPT, 's', "MAC algorithm parameters in n:v form or key"},
|
||||
{"", OPT_DIGEST, '-', "Any supported digest"},
|
||||
OPT_R_OPTIONS,
|
||||
{"list", OPT_LIST, '-', "List digests"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine e, possibly a hardware device"},
|
||||
{"engine_impl", OPT_ENGINE_IMPL, '-',
|
||||
"Also use engine given by -engine for digest operations"},
|
||||
#endif
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"c", OPT_C, '-', "Print the digest with separating colons"},
|
||||
{"r", OPT_R, '-', "Print the digest in coreutils format"},
|
||||
{"out", OPT_OUT, '>', "Output to filename rather than stdout"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Key file format (PEM or ENGINE)"},
|
||||
{"hex", OPT_HEX, '-', "Print as hex dump"},
|
||||
{"binary", OPT_BINARY, '-', "Print in binary form"},
|
||||
{"d", OPT_DEBUG, '-', "Print debug info"},
|
||||
{"debug", OPT_DEBUG, '-', "Print debug info"},
|
||||
|
||||
OPT_SECTION("Signing"),
|
||||
{"sign", OPT_SIGN, 's', "Sign digest using private key"},
|
||||
{"verify", OPT_VERIFY, 's', "Verify a signature using public key"},
|
||||
{"prverify", OPT_PRVERIFY, 's', "Verify a signature using private key"},
|
||||
{"sigopt", OPT_SIGOPT, 's', "Signature parameter in n:v form"},
|
||||
{"signature", OPT_SIGNATURE, '<', "File with signature to verify"},
|
||||
{"hmac", OPT_HMAC, 's', "Create hashed MAC with key"},
|
||||
{"mac", OPT_MAC, 's', "Create MAC (not necessarily HMAC)"},
|
||||
{"macopt", OPT_MACOPT, 's', "MAC algorithm parameters in n:v form or key"},
|
||||
{"", OPT_DIGEST, '-', "Any supported digest"},
|
||||
{"fips-fingerprint", OPT_FIPS_FINGERPRINT, '-',
|
||||
"Compute HMAC with the key used in OpenSSL-FIPS fingerprint"},
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"file", 0, 0, "Files to digest (optional; default is stdin)"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -92,6 +106,7 @@ int dgst_main(int argc, char **argv)
|
||||
int i, ret = 1, out_bin = -1, want_pub = 0, do_verify = 0;
|
||||
unsigned char *buf = NULL, *sigbuf = NULL;
|
||||
int engine_impl = 0;
|
||||
struct doall_dgst_digests dec;
|
||||
|
||||
prog = opt_progname(argv[0]);
|
||||
buf = app_malloc(BUFSIZE, "I/O buffer");
|
||||
@@ -109,6 +124,15 @@ int dgst_main(int argc, char **argv)
|
||||
opt_help(dgst_options);
|
||||
ret = 0;
|
||||
goto end;
|
||||
case OPT_LIST:
|
||||
BIO_printf(bio_out, "Supported digests:\n");
|
||||
dec.bio = bio_out;
|
||||
dec.n = 0;
|
||||
OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_MD_METH,
|
||||
show_digests, &dec);
|
||||
BIO_printf(bio_out, "\n");
|
||||
ret = 0;
|
||||
goto end;
|
||||
case OPT_C:
|
||||
separator = 1;
|
||||
break;
|
||||
@@ -414,6 +438,32 @@ int dgst_main(int argc, char **argv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void show_digests(const OBJ_NAME *name, void *arg)
|
||||
{
|
||||
struct doall_dgst_digests *dec = (struct doall_dgst_digests *)arg;
|
||||
const EVP_MD *md = NULL;
|
||||
|
||||
/* Filter out signed digests (a.k.a signature algorithms) */
|
||||
if (strstr(name->name, "rsa") != NULL || strstr(name->name, "RSA") != NULL)
|
||||
return;
|
||||
|
||||
if (!islower((unsigned char)*name->name))
|
||||
return;
|
||||
|
||||
/* Filter out message digests that we cannot use */
|
||||
md = EVP_get_digestbyname(name->name);
|
||||
if (md == NULL)
|
||||
return;
|
||||
|
||||
BIO_printf(dec->bio, "-%-25s", name->name);
|
||||
if (++dec->n == 3) {
|
||||
BIO_printf(dec->bio, "\n");
|
||||
dec->n = 0;
|
||||
} else {
|
||||
BIO_printf(dec->bio, " ");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The newline_escape_filename function performs newline escaping for any
|
||||
* filename that contains a newline. This function also takes a pointer
|
||||
@@ -458,15 +508,16 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
|
||||
const char *sig_name, const char *md_name,
|
||||
const char *file)
|
||||
{
|
||||
size_t len;
|
||||
int i, backslash = 0;
|
||||
size_t len = BUFSIZE;
|
||||
int i, backslash = 0, ret = 1;
|
||||
unsigned char *sigbuf = NULL;
|
||||
|
||||
while (BIO_pending(bp) || !BIO_eof(bp)) {
|
||||
i = BIO_read(bp, (char *)buf, BUFSIZE);
|
||||
if (i < 0) {
|
||||
BIO_printf(bio_err, "Read Error in %s\n", file);
|
||||
ERR_print_errors(bio_err);
|
||||
return 1;
|
||||
goto end;
|
||||
}
|
||||
if (i == 0)
|
||||
break;
|
||||
@@ -479,28 +530,35 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
|
||||
BIO_printf(out, "Verified OK\n");
|
||||
} else if (i == 0) {
|
||||
BIO_printf(out, "Verification Failure\n");
|
||||
return 1;
|
||||
goto end;
|
||||
} else {
|
||||
BIO_printf(bio_err, "Error Verifying Data\n");
|
||||
ERR_print_errors(bio_err);
|
||||
return 1;
|
||||
goto end;
|
||||
}
|
||||
return 0;
|
||||
ret = 0;
|
||||
goto end;
|
||||
}
|
||||
if (key != NULL) {
|
||||
EVP_MD_CTX *ctx;
|
||||
int pkey_len;
|
||||
BIO_get_md_ctx(bp, &ctx);
|
||||
len = BUFSIZE;
|
||||
pkey_len = EVP_PKEY_size(key);
|
||||
if (pkey_len > BUFSIZE) {
|
||||
len = pkey_len;
|
||||
sigbuf = app_malloc(len, "Signature buffer");
|
||||
buf = sigbuf;
|
||||
}
|
||||
if (!EVP_DigestSignFinal(ctx, buf, &len)) {
|
||||
BIO_printf(bio_err, "Error Signing Data\n");
|
||||
ERR_print_errors(bio_err);
|
||||
return 1;
|
||||
goto end;
|
||||
}
|
||||
} else {
|
||||
len = BIO_gets(bp, (char *)buf, BUFSIZE);
|
||||
if ((int)len < 0) {
|
||||
ERR_print_errors(bio_err);
|
||||
return 1;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -535,5 +593,11 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
|
||||
}
|
||||
BIO_printf(out, "\n");
|
||||
}
|
||||
return 0;
|
||||
|
||||
ret = 0;
|
||||
end:
|
||||
if (sigbuf != NULL)
|
||||
OPENSSL_clear_free(sigbuf, len);
|
||||
|
||||
return ret;
|
||||
}
|
||||
+22
-13
@@ -42,21 +42,11 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS dhparam_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [flags] [numbits]\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Valid options are:\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] [numbits]\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"inform", OPT_INFORM, 'F', "Input format, DER or PEM"},
|
||||
{"outform", OPT_OUTFORM, 'F', "Output format, DER or PEM"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"check", OPT_CHECK, '-', "Check the DH parameters"},
|
||||
{"text", OPT_TEXT, '-', "Print a text form of the DH parameters"},
|
||||
{"noout", OPT_NOOUT, '-', "Don't output any DH parameters"},
|
||||
OPT_R_OPTIONS,
|
||||
{"C", OPT_C, '-', "Print C code"},
|
||||
{"2", OPT_2, '-', "Generate parameters using 2 as the generator value"},
|
||||
{"3", OPT_3, '-', "Generate parameters using 3 as the generator value"},
|
||||
{"5", OPT_5, '-', "Generate parameters using 5 as the generator value"},
|
||||
# ifndef OPENSSL_NO_DSA
|
||||
{"dsaparam", OPT_DSAPARAM, '-',
|
||||
"Read or generate DSA parameters, convert to DH"},
|
||||
@@ -64,6 +54,25 @@ const OPTIONS dhparam_options[] = {
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine e, possibly a hardware device"},
|
||||
# endif
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"inform", OPT_INFORM, 'F', "Input format, DER or PEM"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"outform", OPT_OUTFORM, 'F', "Output format, DER or PEM"},
|
||||
{"text", OPT_TEXT, '-', "Print a text form of the DH parameters"},
|
||||
{"noout", OPT_NOOUT, '-', "Don't output any DH parameters"},
|
||||
{"C", OPT_C, '-', "Print C code"},
|
||||
{"2", OPT_2, '-', "Generate parameters using 2 as the generator value"},
|
||||
{"3", OPT_3, '-', "Generate parameters using 3 as the generator value"},
|
||||
{"5", OPT_5, '-', "Generate parameters using 5 as the generator value"},
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"numbits", 0, 0, "Number of bits if generating parameters (optional)"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+17
-11
@@ -36,18 +36,8 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS dsa_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"inform", OPT_INFORM, 'f', "Input format, DER PEM PVK"},
|
||||
{"outform", OPT_OUTFORM, 'f', "Output format, DER PEM PVK"},
|
||||
{"in", OPT_IN, 's', "Input key"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"noout", OPT_NOOUT, '-', "Don't print key out"},
|
||||
{"text", OPT_TEXT, '-', "Print the key in text"},
|
||||
{"modulus", OPT_MODULUS, '-', "Print the DSA public value"},
|
||||
{"pubin", OPT_PUBIN, '-', "Expect a public key in input file"},
|
||||
{"pubout", OPT_PUBOUT, '-', "Output public key, not private"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
{"", OPT_CIPHER, '-', "Any supported cipher"},
|
||||
# ifndef OPENSSL_NO_RC4
|
||||
{"pvk-strong", OPT_PVK_STRONG, '-', "Enable 'Strong' PVK encoding level (default)"},
|
||||
@@ -57,6 +47,22 @@ const OPTIONS dsa_options[] = {
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine e, possibly a hardware device"},
|
||||
# endif
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, 's', "Input key"},
|
||||
{"inform", OPT_INFORM, 'f', "Input format, DER PEM PVK"},
|
||||
{"pubin", OPT_PUBIN, '-', "Expect a public key in input file"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"outform", OPT_OUTFORM, 'f', "Output format, DER PEM PVK"},
|
||||
{"noout", OPT_NOOUT, '-', "Don't print key out"},
|
||||
{"text", OPT_TEXT, '-', "Print the key in text"},
|
||||
{"modulus", OPT_MODULUS, '-', "Print the DSA public value"},
|
||||
{"pubout", OPT_PUBOUT, '-', "Output public key, not private"},
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+20
-9
@@ -37,20 +37,31 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS dsaparam_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] [numbits]\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"inform", OPT_INFORM, 'F', "Input format - DER or PEM"},
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"outform", OPT_OUTFORM, 'F', "Output format - DER or PEM"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"text", OPT_TEXT, '-', "Print as text"},
|
||||
{"C", OPT_C, '-', "Output C code"},
|
||||
{"noout", OPT_NOOUT, '-', "No output"},
|
||||
{"genkey", OPT_GENKEY, '-', "Generate a DSA key"},
|
||||
OPT_R_OPTIONS,
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine e, possibly a hardware device"},
|
||||
# endif
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"inform", OPT_INFORM, 'F', "Input format - DER or PEM"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"outform", OPT_OUTFORM, 'F', "Output format - DER or PEM"},
|
||||
{"text", OPT_TEXT, '-', "Print as text"},
|
||||
{"C", OPT_C, '-', "Output C code"},
|
||||
{"noout", OPT_NOOUT, '-', "No output"},
|
||||
{"verbose", OPT_VERBOSE, '-', "Verbose output"},
|
||||
{"genkey", OPT_GENKEY, '-', "Generate a DSA key"},
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"numbits", 0, 0, "Number of bits if generating parameters (optional)"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -44,27 +44,32 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS ec_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, 's', "Input file"},
|
||||
{"inform", OPT_INFORM, 'f', "Input format - DER or PEM"},
|
||||
{"pubin", OPT_PUBIN, '-', "Expect a public key in input file"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"check", OPT_CHECK, '-', "check key consistency"},
|
||||
{"", OPT_CIPHER, '-', "Any supported cipher"},
|
||||
{"param_enc", OPT_PARAM_ENC, 's',
|
||||
"Specifies the way the ec parameters are encoded"},
|
||||
{"conv_form", OPT_CONV_FORM, 's', "Specifies the point conversion form "},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"outform", OPT_OUTFORM, 'F', "Output format - DER or PEM"},
|
||||
{"noout", OPT_NOOUT, '-', "Don't print key out"},
|
||||
{"text", OPT_TEXT, '-', "Print the key"},
|
||||
{"param_out", OPT_PARAM_OUT, '-', "Print the elliptic curve parameters"},
|
||||
{"pubin", OPT_PUBIN, '-', "Expect a public key in input file"},
|
||||
{"pubout", OPT_PUBOUT, '-', "Output public key, not private"},
|
||||
{"no_public", OPT_NO_PUBLIC, '-', "exclude public key from private key"},
|
||||
{"check", OPT_CHECK, '-', "check key consistency"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
{"param_enc", OPT_PARAM_ENC, 's',
|
||||
"Specifies the way the ec parameters are encoded"},
|
||||
{"conv_form", OPT_CONV_FORM, 's', "Specifies the point conversion form "},
|
||||
{"", OPT_CIPHER, '-', "Any supported cipher"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+26
-19
@@ -35,31 +35,38 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS ecparam_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"inform", OPT_INFORM, 'F', "Input format - default PEM (DER or PEM)"},
|
||||
{"outform", OPT_OUTFORM, 'F', "Output format - default PEM"},
|
||||
{"in", OPT_IN, '<', "Input file - default stdin"},
|
||||
{"out", OPT_OUT, '>', "Output file - default stdout"},
|
||||
{"text", OPT_TEXT, '-', "Print the ec parameters in text form"},
|
||||
{"C", OPT_C, '-', "Print a 'C' function creating the parameters"},
|
||||
{"check", OPT_CHECK, '-', "Validate the ec parameters"},
|
||||
{"check_named", OPT_CHECK_NAMED, '-',
|
||||
"Check that named EC curve parameters have not been modified"},
|
||||
{"list_curves", OPT_LIST_CURVES, '-',
|
||||
"Prints a list of all curve 'short names'"},
|
||||
{"no_seed", OPT_NO_SEED, '-',
|
||||
"If 'explicit' parameters are chosen do not use the seed"},
|
||||
{"noout", OPT_NOOUT, '-', "Do not print the ec parameter"},
|
||||
{"name", OPT_NAME, 's',
|
||||
"Use the ec parameters with specified 'short name'"},
|
||||
{"conv_form", OPT_CONV_FORM, 's', "Specifies the point conversion form "},
|
||||
{"param_enc", OPT_PARAM_ENC, 's',
|
||||
"Specifies the way the ec parameters are encoded"},
|
||||
{"genkey", OPT_GENKEY, '-', "Generate ec key"},
|
||||
OPT_R_OPTIONS,
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
|
||||
{"genkey", OPT_GENKEY, '-', "Generate ec key"},
|
||||
{"in", OPT_IN, '<', "Input file - default stdin"},
|
||||
{"inform", OPT_INFORM, 'F', "Input format - default PEM (DER or PEM)"},
|
||||
{"out", OPT_OUT, '>', "Output file - default stdout"},
|
||||
{"outform", OPT_OUTFORM, 'F', "Output format - default PEM"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"text", OPT_TEXT, '-', "Print the ec parameters in text form"},
|
||||
{"C", OPT_C, '-', "Print a 'C' function creating the parameters"},
|
||||
{"noout", OPT_NOOUT, '-', "Do not print the ec parameter"},
|
||||
{"param_enc", OPT_PARAM_ENC, 's',
|
||||
"Specifies the way the ec parameters are encoded"},
|
||||
|
||||
OPT_SECTION("Parameter"),
|
||||
{"check", OPT_CHECK, '-', "Validate the ec parameters"},
|
||||
{"check_named", OPT_CHECK_NAMED, '-',
|
||||
"Check that named EC curve parameters have not been modified"},
|
||||
{"no_seed", OPT_NO_SEED, '-',
|
||||
"If 'explicit' parameters are chosen do not use the seed"},
|
||||
{"name", OPT_NAME, 's',
|
||||
"Use the ec parameters with specified 'short name'"},
|
||||
{"conv_form", OPT_CONV_FORM, 's', "Specifies the point conversion form "},
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+28
-16
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -49,27 +49,41 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS enc_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"ciphers", OPT_LIST, '-', "List ciphers"},
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"pass", OPT_PASS, 's', "Passphrase source"},
|
||||
{"list", OPT_LIST, '-', "List ciphers"},
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
{"ciphers", OPT_LIST, '-', "Alias for -list"},
|
||||
#endif
|
||||
{"e", OPT_E, '-', "Encrypt"},
|
||||
{"d", OPT_D, '-', "Decrypt"},
|
||||
{"p", OPT_P, '-', "Print the iv/key"},
|
||||
{"P", OPT_UPPER_P, '-', "Print the iv/key and exit"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"k", OPT_K, 's', "Passphrase"},
|
||||
{"kfile", OPT_KFILE, '<', "Read passphrase from file"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"pass", OPT_PASS, 's', "Passphrase source"},
|
||||
{"v", OPT_V, '-', "Verbose output"},
|
||||
{"nopad", OPT_NOPAD, '-', "Disable standard block padding"},
|
||||
{"salt", OPT_SALT, '-', "Use salt in the KDF (default)"},
|
||||
{"nosalt", OPT_NOSALT, '-', "Do not use salt in the KDF"},
|
||||
{"debug", OPT_DEBUG, '-', "Print debug info"},
|
||||
{"a", OPT_A, '-', "Base64 encode/decode, depending on encryption flag"},
|
||||
{"base64", OPT_A, '-', "Same as option -a"},
|
||||
{"A", OPT_UPPER_A, '-',
|
||||
"Used with -[base64|a] to specify base64 buffer as a single line"},
|
||||
|
||||
OPT_SECTION("Encryption"),
|
||||
{"nopad", OPT_NOPAD, '-', "Disable standard block padding"},
|
||||
{"salt", OPT_SALT, '-', "Use salt in the KDF (default)"},
|
||||
{"nosalt", OPT_NOSALT, '-', "Do not use salt in the KDF"},
|
||||
{"debug", OPT_DEBUG, '-', "Print debug info"},
|
||||
|
||||
{"bufsize", OPT_BUFSIZE, 's', "Buffer size"},
|
||||
{"k", OPT_K, 's', "Passphrase"},
|
||||
{"kfile", OPT_KFILE, '<', "Read passphrase from file"},
|
||||
{"K", OPT_UPPER_K, 's', "Raw key, in hex"},
|
||||
{"S", OPT_UPPER_S, 's', "Salt, in hex"},
|
||||
{"iv", OPT_IV, 's', "IV in hex"},
|
||||
@@ -77,14 +91,12 @@ const OPTIONS enc_options[] = {
|
||||
{"iter", OPT_ITER, 'p', "Specify the iteration count and force use of PBKDF2"},
|
||||
{"pbkdf2", OPT_PBKDF2, '-', "Use password-based key derivation function 2"},
|
||||
{"none", OPT_NONE, '-', "Don't encrypt"},
|
||||
{"", OPT_CIPHER, '-', "Any supported cipher"},
|
||||
OPT_R_OPTIONS,
|
||||
#ifdef ZLIB
|
||||
{"z", OPT_Z, '-', "Use zlib as the 'encryption'"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
{"", OPT_CIPHER, '-', "Any supported cipher"},
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+10
-5
@@ -30,20 +30,25 @@ typedef enum OPTION_choice {
|
||||
|
||||
const OPTIONS engine_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] engine...\n"},
|
||||
{OPT_HELP_STR, 1, '-',
|
||||
" engine... Engines to load\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"t", OPT_T, '-', "Check that specified engine is available"},
|
||||
{"pre", OPT_PRE, 's', "Run command against the ENGINE before loading it"},
|
||||
{"post", OPT_POST, 's', "Run command against the ENGINE after loading it"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"v", OPT_V, '-', "List 'control commands' For each specified engine"},
|
||||
{"vv", OPT_VV, '-', "Also display each command's description"},
|
||||
{"vvv", OPT_VVV, '-', "Also add the input flags for each command"},
|
||||
{"vvvv", OPT_VVVV, '-', "Also show internal input flags"},
|
||||
{"c", OPT_C, '-', "List the capabilities of specified engine"},
|
||||
{"t", OPT_T, '-', "Check that specified engine is available"},
|
||||
{"tt", OPT_TT, '-', "Display error trace for unavailable engines"},
|
||||
{"pre", OPT_PRE, 's', "Run command against the ENGINE before loading it"},
|
||||
{"post", OPT_POST, 's', "Run command against the ENGINE after loading it"},
|
||||
{OPT_MORE_STR, OPT_EOF, 1,
|
||||
"Commands are like \"SO_PATH:/lib/libdriver.so\""},
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"engine", 0, 0, "ID of engine(s) to load"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+5
-1
@@ -22,8 +22,12 @@ typedef enum OPTION_choice {
|
||||
|
||||
const OPTIONS errstr_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] errnum...\n"},
|
||||
{OPT_HELP_STR, 1, '-', " errnum Error number\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"errnum", 0, 0, "Error number(s) to decode"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+86
-9
@@ -13,6 +13,8 @@
|
||||
#include <openssl/provider.h>
|
||||
#include <openssl/params.h>
|
||||
#include <openssl/fips_names.h>
|
||||
#include <openssl/core_names.h>
|
||||
#include <openssl/self_test.h>
|
||||
#include "apps.h"
|
||||
#include "progs.h"
|
||||
|
||||
@@ -25,28 +27,39 @@
|
||||
#define VERSION_VAL "1"
|
||||
#define INSTALL_STATUS_VAL "INSTALL_SELF_TEST_KATS_RUN"
|
||||
|
||||
static OSSL_CALLBACK self_test_events;
|
||||
static char *self_test_corrupt_desc = NULL;
|
||||
static char *self_test_corrupt_type = NULL;
|
||||
static int self_test_log = 1;
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
OPT_IN, OPT_OUT, OPT_MODULE,
|
||||
OPT_PROV_NAME, OPT_SECTION_NAME, OPT_MAC_NAME, OPT_MACOPT, OPT_VERIFY
|
||||
OPT_PROV_NAME, OPT_SECTION_NAME, OPT_MAC_NAME, OPT_MACOPT, OPT_VERIFY,
|
||||
OPT_NO_LOG, OPT_CORRUPT_DESC, OPT_CORRUPT_TYPE
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS fipsinstall_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{OPT_MORE_STR, 0, 0, "e.g: openssl fipsinstall -provider_name fips"
|
||||
"-section_name fipsinstall -out fips.conf -module ./fips.so"
|
||||
"-mac_name HMAC -macopt digest:SHA256 -macopt hexkey:00"},
|
||||
{"verify", OPT_VERIFY, '-', "Verification mode, i.e verify a config file "
|
||||
"instead of generating one"},
|
||||
{"in", OPT_IN, '<', "Input config file, used when verifying"},
|
||||
{"out", OPT_OUT, '>', "Output config file, used when generating"},
|
||||
{"verify", OPT_VERIFY, '-',
|
||||
"Verify a config file instead of generating one"},
|
||||
{"module", OPT_MODULE, '<', "File name of the provider module"},
|
||||
{"provider_name", OPT_PROV_NAME, 's', "FIPS provider name"},
|
||||
{"section_name", OPT_SECTION_NAME, 's',
|
||||
"FIPS Provider config section name (optional)"},
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input config file, used when verifying"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output config file, used when generating"},
|
||||
{"mac_name", OPT_MAC_NAME, 's', "MAC name"},
|
||||
{"macopt", OPT_MACOPT, 's', "MAC algorithm parameters in n:v form. "
|
||||
"See 'PARAMETER NAMES' in the EVP_MAC_ docs"},
|
||||
{"noout", OPT_NO_LOG, '-', "Disable logging of self test events"},
|
||||
{"corrupt_desc", OPT_CORRUPT_DESC, 's', "Corrupt a self test by description"},
|
||||
{"corrupt_type", OPT_CORRUPT_TYPE, 's', "Corrupt a self test by type"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -168,7 +181,7 @@ static CONF *generate_config_and_load(const char *prov_name,
|
||||
if (conf == NULL)
|
||||
goto end;
|
||||
|
||||
if (!CONF_modules_load(conf, NULL, 0))
|
||||
if (CONF_modules_load(conf, NULL, 0) <= 0)
|
||||
goto end;
|
||||
BIO_free(mem_bio);
|
||||
return conf;
|
||||
@@ -285,6 +298,15 @@ opthelp:
|
||||
case OPT_OUT:
|
||||
out_fname = opt_arg();
|
||||
break;
|
||||
case OPT_NO_LOG:
|
||||
self_test_log = 0;
|
||||
break;
|
||||
case OPT_CORRUPT_DESC:
|
||||
self_test_corrupt_desc = opt_arg();
|
||||
break;
|
||||
case OPT_CORRUPT_TYPE:
|
||||
self_test_corrupt_type = opt_arg();
|
||||
break;
|
||||
case OPT_PROV_NAME:
|
||||
prov_name = opt_arg();
|
||||
break;
|
||||
@@ -316,6 +338,11 @@ opthelp:
|
||||
|| argc != 0)
|
||||
goto opthelp;
|
||||
|
||||
if (self_test_log
|
||||
|| self_test_corrupt_desc != NULL
|
||||
|| self_test_corrupt_type != NULL)
|
||||
OSSL_SELF_TEST_set_callback(NULL, self_test_events, NULL);
|
||||
|
||||
module_bio = bio_open_default(module_fname, 'r', FORMAT_BINARY);
|
||||
if (module_bio == NULL) {
|
||||
BIO_printf(bio_err, "Failed to open module file\n");
|
||||
@@ -418,3 +445,53 @@ end:
|
||||
free_config_and_unload(conf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int self_test_events(const OSSL_PARAM params[], void *arg)
|
||||
{
|
||||
const OSSL_PARAM *p = NULL;
|
||||
const char *phase = NULL, *type = NULL, *desc = NULL;
|
||||
int ret = 0;
|
||||
|
||||
p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_PHASE);
|
||||
if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING)
|
||||
goto err;
|
||||
phase = (const char *)p->data;
|
||||
|
||||
p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_DESC);
|
||||
if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING)
|
||||
goto err;
|
||||
desc = (const char *)p->data;
|
||||
|
||||
p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_TYPE);
|
||||
if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING)
|
||||
goto err;
|
||||
type = (const char *)p->data;
|
||||
|
||||
if (self_test_log) {
|
||||
if (strcmp(phase, OSSL_SELF_TEST_PHASE_START) == 0)
|
||||
BIO_printf(bio_out, "%s : (%s) : ", desc, type);
|
||||
else if (strcmp(phase, OSSL_SELF_TEST_PHASE_PASS) == 0
|
||||
|| strcmp(phase, OSSL_SELF_TEST_PHASE_FAIL) == 0)
|
||||
BIO_printf(bio_out, "%s\n", phase);
|
||||
}
|
||||
/*
|
||||
* The self test code will internally corrupt the KAT test result if an
|
||||
* error is returned during the corrupt phase.
|
||||
*/
|
||||
if (strcmp(phase, OSSL_SELF_TEST_PHASE_CORRUPT) == 0
|
||||
&& (self_test_corrupt_desc != NULL
|
||||
|| self_test_corrupt_type != NULL)) {
|
||||
if (self_test_corrupt_desc != NULL
|
||||
&& strcmp(self_test_corrupt_desc, desc) != 0)
|
||||
goto end;
|
||||
if (self_test_corrupt_type != NULL
|
||||
&& strcmp(self_test_corrupt_type, type) != 0)
|
||||
goto end;
|
||||
BIO_printf(bio_out, "%s ", phase);
|
||||
goto err;
|
||||
}
|
||||
end:
|
||||
ret = 1;
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
+11
-5
@@ -32,17 +32,23 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS gendsa_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [args] dsaparam-file\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Valid options are:\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] dsaparam-file\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output the key to the specified file"},
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
OPT_R_OPTIONS,
|
||||
{"", OPT_CIPHER, '-', "Encrypt the output with any supported cipher"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
{"verbose", OPT_VERBOSE, '-', "Verbose output"},
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"dsaparam-file", 0, 0, "File containing DSA parameters"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+10
-6
@@ -28,20 +28,24 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS genpkey_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"outform", OPT_OUTFORM, 'F', "output format (DER or PEM)"},
|
||||
{"pass", OPT_PASS, 's', "Output file pass phrase source"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
{"paramfile", OPT_PARAMFILE, '<', "Parameters file"},
|
||||
{"algorithm", OPT_ALGORITHM, 's', "The public key algorithm"},
|
||||
{"pkeyopt", OPT_PKEYOPT, 's',
|
||||
"Set the public key algorithm option as opt:value"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"outform", OPT_OUTFORM, 'F', "output format (DER or PEM)"},
|
||||
{"pass", OPT_PASS, 's', "Output file pass phrase source"},
|
||||
{"genparam", OPT_GENPARAM, '-', "Generate parameters, not key"},
|
||||
{"text", OPT_TEXT, '-', "Print the in text"},
|
||||
{"", OPT_CIPHER, '-', "Cipher to use to encrypt the key"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
|
||||
/* This is deliberately last. */
|
||||
{OPT_HELP_STR, 1, 1,
|
||||
"Order of options may be important! See the documentation.\n"},
|
||||
|
||||
+18
-7
@@ -42,19 +42,30 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS genrsa_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] numbits\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"3", OPT_3, '-', "Use 3 for the E value"},
|
||||
{"F4", OPT_F4, '-', "Use F4 (0x10001) for the E value"},
|
||||
{"f4", OPT_F4, '-', "Use F4 (0x10001) for the E value"},
|
||||
{"out", OPT_OUT, '>', "Output the key to specified file"},
|
||||
OPT_R_OPTIONS,
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
{"", OPT_CIPHER, '-', "Encrypt the output with any supported cipher"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"3", OPT_3, '-', "Use 3 for the E value"},
|
||||
{"F4", OPT_F4, '-', "Use F4 (0x10001) for the E value"},
|
||||
{"f4", OPT_F4, '-', "Use F4 (0x10001) for the E value"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output the key to specified file"},
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
{"primes", OPT_PRIMES, 'p', "Specify number of primes"},
|
||||
{"verbose", OPT_VERBOSE, '-', "Verbose output"},
|
||||
{"", OPT_CIPHER, '-', "Encrypt the output with any supported cipher"},
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"numbits", 0, 0, "Size of key in bits"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+7
-19
@@ -58,20 +58,6 @@ extern const unsigned char tls13_aes128gcmsha256_id[];
|
||||
extern const unsigned char tls13_aes256gcmsha384_id[];
|
||||
extern BIO_ADDR *ourpeer;
|
||||
|
||||
BIO_METHOD *apps_bf_prefix(void);
|
||||
/*
|
||||
* The control used to set the prefix with BIO_ctrl()
|
||||
* We make it high enough so the chance of ever clashing with the BIO library
|
||||
* remains unlikely for the foreseeable future and beyond.
|
||||
*/
|
||||
#define PREFIX_CTRL_SET_PREFIX (1 << 15)
|
||||
/*
|
||||
* apps_bf_prefix() returns a dynamically created BIO_METHOD, which we
|
||||
* need to destroy at some point. When created internally, it's stored
|
||||
* in an internal pointer which can be freed with the following function
|
||||
*/
|
||||
void destroy_prefix_method(void);
|
||||
|
||||
BIO *dup_bio_in(int format);
|
||||
BIO *dup_bio_out(int format);
|
||||
BIO *dup_bio_err(int format);
|
||||
@@ -126,11 +112,13 @@ int load_certs(const char *file, STACK_OF(X509) **certs, int format,
|
||||
const char *pass, const char *cert_descrip);
|
||||
int load_crls(const char *file, STACK_OF(X509_CRL) **crls, int format,
|
||||
const char *pass, const char *cert_descrip);
|
||||
X509_STORE *setup_verify(const char *CAfile, const char *CApath,
|
||||
int noCAfile, int noCApath);
|
||||
__owur int ctx_set_verify_locations(SSL_CTX *ctx, const char *CAfile,
|
||||
const char *CApath, int noCAfile,
|
||||
int noCApath);
|
||||
X509_STORE *setup_verify(const char *CAfile, int noCAfile,
|
||||
const char *CApath, int noCApath,
|
||||
const char *CAstore, int noCAstore);
|
||||
__owur int ctx_set_verify_locations(SSL_CTX *ctx,
|
||||
const char *CAfile, int noCAfile,
|
||||
const char *CApath, int noCApath,
|
||||
const char *CAstore, int noCAstore);
|
||||
|
||||
#ifndef OPENSSL_NO_CT
|
||||
|
||||
|
||||
+9
-2
@@ -32,6 +32,7 @@
|
||||
OPT_V__LAST
|
||||
|
||||
# define OPT_V_OPTIONS \
|
||||
OPT_SECTION("Validation"), \
|
||||
{ "policy", OPT_V_POLICY, 's', "adds policy to the acceptable policy set"}, \
|
||||
{ "purpose", OPT_V_PURPOSE, 's', \
|
||||
"certificate chain purpose"}, \
|
||||
@@ -124,6 +125,7 @@
|
||||
OPT_X__LAST
|
||||
|
||||
# define OPT_X_OPTIONS \
|
||||
OPT_SECTION("Extended certificate"), \
|
||||
{ "xkey", OPT_X_KEY, '<', "key for Extended certificates"}, \
|
||||
{ "xcert", OPT_X_CERT, '<', "cert for Extended certificates"}, \
|
||||
{ "xchain", OPT_X_CHAIN, '<', "chain for Extended certificates"}, \
|
||||
@@ -161,6 +163,7 @@
|
||||
OPT_S_NO_RENEGOTIATION, OPT_S_NO_MIDDLEBOX, OPT_S__LAST
|
||||
|
||||
# define OPT_S_OPTIONS \
|
||||
OPT_SECTION("TLS/SSL"), \
|
||||
{"no_ssl3", OPT_S_NOSSL3, '-',"Just disable SSLv3" }, \
|
||||
{"no_tls1", OPT_S_NOTLS1, '-', "Just disable TLSv1"}, \
|
||||
{"no_tls1_1", OPT_S_NOTLS1_1, '-', "Just disable TLSv1.1" }, \
|
||||
@@ -254,6 +257,7 @@
|
||||
OPT_R__FIRST=1500, OPT_R_RAND, OPT_R_WRITERAND, OPT_R__LAST
|
||||
|
||||
# define OPT_R_OPTIONS \
|
||||
OPT_SECTION("Random state"), \
|
||||
{"rand", OPT_R_RAND, 's', "Load the file(s) into the random number generator"}, \
|
||||
{"writerand", OPT_R_WRITERAND, '>', "Write random data to the specified file"}
|
||||
|
||||
@@ -267,6 +271,8 @@
|
||||
extern const char OPT_HELP_STR[];
|
||||
extern const char OPT_MORE_STR[];
|
||||
extern const char OPT_SECTION_STR[];
|
||||
extern const char OPT_PARAM_STR[];
|
||||
|
||||
typedef struct options_st {
|
||||
const char *name;
|
||||
int retval;
|
||||
@@ -309,7 +315,8 @@ typedef struct string_int_pair_st {
|
||||
OPT_FMT_TEXT | OPT_FMT_HTTP | OPT_FMT_PVK)
|
||||
|
||||
/* Divide options into sections when displaying usage */
|
||||
#define OPT_SECTION(sec) {OPT_SECTION_STR, 1, '-', sec " options:\n"}
|
||||
#define OPT_SECTION(sec) { OPT_SECTION_STR, 1, '-', sec " options:\n" }
|
||||
#define OPT_PARAMETERS() { OPT_PARAM_STR, 1, '-', "Parameters:\n" }
|
||||
|
||||
char *opt_progname(const char *argv0);
|
||||
char *opt_getprog(void);
|
||||
@@ -342,7 +349,7 @@ int opt_num_rest(void);
|
||||
int opt_verify(int i, X509_VERIFY_PARAM *vpm);
|
||||
int opt_rand(int i);
|
||||
void opt_help(const OPTIONS * list);
|
||||
void opt_print(const OPTIONS * opt, int width);
|
||||
void opt_print(const OPTIONS * opt, int doingparams, int width);
|
||||
int opt_format_error(const char *s, unsigned long flags);
|
||||
int opt_isdir(const char *name);
|
||||
int opt_printf_stderr(const char *fmt, ...);
|
||||
|
||||
@@ -69,8 +69,9 @@ int config_ctx(SSL_CONF_CTX *cctx, STACK_OF(OPENSSL_STRING) *str, SSL_CTX *ctx);
|
||||
int ssl_ctx_add_crls(SSL_CTX *ctx, STACK_OF(X509_CRL) *crls,
|
||||
int crl_download);
|
||||
int ssl_load_stores(SSL_CTX *ctx, const char *vfyCApath,
|
||||
const char *vfyCAfile, const char *chCApath,
|
||||
const char *chCAfile, STACK_OF(X509_CRL) *crls,
|
||||
const char *vfyCAfile, const char *vfyCAstore,
|
||||
const char *chCApath, const char *chCAfile,
|
||||
const char *chCAstore, STACK_OF(X509_CRL) *crls,
|
||||
int crl_download);
|
||||
void ssl_ctx_security_debug(SSL_CTX *ctx, int verbose);
|
||||
int set_keylog_file(SSL_CTX *ctx, const char *keylog_file);
|
||||
|
||||
@@ -18,7 +18,11 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS info_options[] = {
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"configdir", OPT_CONFIGDIR, '-', "Default configuration file directory"},
|
||||
{"enginesdir", OPT_ENGINESDIR, '-', "Default engine module directory"},
|
||||
{"modulesdir", OPT_MODULESDIR, '-',
|
||||
|
||||
+15
-5
@@ -24,14 +24,20 @@ typedef enum OPTION_choice {
|
||||
|
||||
const OPTIONS kdf_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] kdf_name\n"},
|
||||
{OPT_HELP_STR, 1, '-', "kdf_name\t KDF algorithm.\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"kdfopt", OPT_KDFOPT, 's', "KDF algorithm control parameters in n:v form. "
|
||||
"See 'Supported Controls' in the EVP_KDF_ docs"},
|
||||
{"kdfopt", OPT_KDFOPT, 's', "KDF algorithm control parameters in n:v form"},
|
||||
{OPT_MORE_STR, 1, '-', "See 'Supported Controls' in the EVP_KDF_ docs\n"},
|
||||
{"keylen", OPT_KEYLEN, 's', "The size of the output derived key"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output to filename rather than stdout"},
|
||||
{"binary", OPT_BIN, '-', "Output in binary format (Default is hexadecimal "
|
||||
"output)"},
|
||||
{"binary", OPT_BIN, '-',
|
||||
"Output in binary format (default is hexadecimal)"},
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"kdf_name", 0, 0, "Name of the KDF algorithm"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -132,6 +138,10 @@ opthelp:
|
||||
BIO_write(out, dkm_bytes, dkm_len);
|
||||
} else {
|
||||
hexout = OPENSSL_buf2hexstr(dkm_bytes, dkm_len);
|
||||
if (hexout == NULL) {
|
||||
BIO_printf(bio_err, "Memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
BIO_printf(out, "%s\n\n", hexout);
|
||||
}
|
||||
|
||||
|
||||
+33
-20
@@ -125,18 +125,29 @@ int app_init(long mesgwin)
|
||||
}
|
||||
#endif
|
||||
|
||||
int ctx_set_verify_locations(SSL_CTX *ctx, const char *CAfile,
|
||||
const char *CApath, int noCAfile, int noCApath)
|
||||
int ctx_set_verify_locations(SSL_CTX *ctx,
|
||||
const char *CAfile, int noCAfile,
|
||||
const char *CApath, int noCApath,
|
||||
const char *CAstore, int noCAstore)
|
||||
{
|
||||
if (CAfile == NULL && CApath == NULL) {
|
||||
if (CAfile == NULL && CApath == NULL && CAstore == NULL) {
|
||||
if (!noCAfile && SSL_CTX_set_default_verify_file(ctx) <= 0)
|
||||
return 0;
|
||||
if (!noCApath && SSL_CTX_set_default_verify_dir(ctx) <= 0)
|
||||
return 0;
|
||||
if (!noCAstore && SSL_CTX_set_default_verify_store(ctx) <= 0)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
return SSL_CTX_load_verify_locations(ctx, CAfile, CApath);
|
||||
|
||||
if (CAfile != NULL && !SSL_CTX_load_verify_file(ctx, CAfile))
|
||||
return 0;
|
||||
if (CApath != NULL && !SSL_CTX_load_verify_dir(ctx, CApath))
|
||||
return 0;
|
||||
if (CAstore != NULL && !SSL_CTX_load_verify_store(ctx, CAstore))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_CT
|
||||
@@ -1068,7 +1079,9 @@ void print_array(BIO *out, const char* title, int len, const unsigned char* d)
|
||||
BIO_printf(out, "\n};\n");
|
||||
}
|
||||
|
||||
X509_STORE *setup_verify(const char *CAfile, const char *CApath, int noCAfile, int noCApath)
|
||||
X509_STORE *setup_verify(const char *CAfile, int noCAfile,
|
||||
const char *CApath, int noCApath,
|
||||
const char *CAstore, int noCAstore)
|
||||
{
|
||||
X509_STORE *store = X509_STORE_new();
|
||||
X509_LOOKUP *lookup;
|
||||
@@ -1080,7 +1093,7 @@ X509_STORE *setup_verify(const char *CAfile, const char *CApath, int noCAfile, i
|
||||
lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
|
||||
if (lookup == NULL)
|
||||
goto end;
|
||||
if (CAfile) {
|
||||
if (CAfile != NULL) {
|
||||
if (!X509_LOOKUP_load_file(lookup, CAfile, X509_FILETYPE_PEM)) {
|
||||
BIO_printf(bio_err, "Error loading file %s\n", CAfile);
|
||||
goto end;
|
||||
@@ -1094,7 +1107,7 @@ X509_STORE *setup_verify(const char *CAfile, const char *CApath, int noCAfile, i
|
||||
lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir());
|
||||
if (lookup == NULL)
|
||||
goto end;
|
||||
if (CApath) {
|
||||
if (CApath != NULL) {
|
||||
if (!X509_LOOKUP_add_dir(lookup, CApath, X509_FILETYPE_PEM)) {
|
||||
BIO_printf(bio_err, "Error loading directory %s\n", CApath);
|
||||
goto end;
|
||||
@@ -1104,6 +1117,17 @@ X509_STORE *setup_verify(const char *CAfile, const char *CApath, int noCAfile, i
|
||||
}
|
||||
}
|
||||
|
||||
if (CAstore != NULL || !noCAstore) {
|
||||
lookup = X509_STORE_add_lookup(store, X509_LOOKUP_store());
|
||||
if (lookup == NULL)
|
||||
goto end;
|
||||
if (!X509_LOOKUP_add_store(lookup, CAstore)) {
|
||||
if (CAstore != NULL)
|
||||
BIO_printf(bio_err, "Error loading store URI %s\n", CAstore);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
ERR_clear_error();
|
||||
return store;
|
||||
end:
|
||||
@@ -2300,8 +2324,8 @@ BIO *dup_bio_out(int format)
|
||||
|
||||
if (FMT_istext(format)
|
||||
&& (prefix = getenv("HARNESS_OSSL_PREFIX")) != NULL) {
|
||||
b = BIO_push(BIO_new(apps_bf_prefix()), b);
|
||||
BIO_ctrl(b, PREFIX_CTRL_SET_PREFIX, 0, prefix);
|
||||
b = BIO_push(BIO_new(BIO_f_prefix()), b);
|
||||
BIO_set_prefix(b, prefix);
|
||||
}
|
||||
|
||||
return b;
|
||||
@@ -2318,17 +2342,6 @@ BIO *dup_bio_err(int format)
|
||||
return b;
|
||||
}
|
||||
|
||||
/*
|
||||
* Because the prefix method is created dynamically, we must also be able
|
||||
* to destroy it.
|
||||
*/
|
||||
void destroy_prefix_method(void)
|
||||
{
|
||||
BIO_METHOD *prefix_method = apps_bf_prefix();
|
||||
BIO_meth_free(prefix_method);
|
||||
prefix_method = NULL;
|
||||
}
|
||||
|
||||
void unbuffer(FILE *fp)
|
||||
{
|
||||
/*
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
# Auxilliary program source
|
||||
# Auxiliary program source
|
||||
IF[{- $config{target} =~ /^(?:VC-|mingw)/ -}]
|
||||
# It's called 'init', but doesn't have much 'init' in it...
|
||||
$AUXLIBAPPSSRC=win32_init.c
|
||||
@@ -9,7 +9,7 @@ ENDIF
|
||||
|
||||
# Source for libapps
|
||||
$LIBAPPSSRC=apps.c apps_ui.c opt.c fmt.c s_cb.c s_socket.c app_rand.c \
|
||||
bf_prefix.c columns.c app_params.c names.c
|
||||
columns.c app_params.c names.c
|
||||
|
||||
IF[{- !$disabled{apps} -}]
|
||||
LIBS{noinst}=../libapps.a
|
||||
|
||||
+33
-16
@@ -26,9 +26,10 @@
|
||||
#include <openssl/x509v3.h>
|
||||
|
||||
#define MAX_OPT_HELP_WIDTH 30
|
||||
const char OPT_HELP_STR[] = "--";
|
||||
const char OPT_MORE_STR[] = "---";
|
||||
const char OPT_SECTION_STR[] = "----";
|
||||
const char OPT_HELP_STR[] = "-H";
|
||||
const char OPT_MORE_STR[] = "-M";
|
||||
const char OPT_SECTION_STR[] = "-S";
|
||||
const char OPT_PARAM_STR[] = "-P";
|
||||
|
||||
/* Our state */
|
||||
static char **argv;
|
||||
@@ -128,14 +129,16 @@ char *opt_init(int ac, char **av, const OPTIONS *o)
|
||||
opt_progname(av[0]);
|
||||
unknown = NULL;
|
||||
|
||||
for (; o->name; ++o) {
|
||||
/* Check all options up until the PARAM marker (if present) */
|
||||
for (; o->name != NULL && o->name != OPT_PARAM_STR; ++o) {
|
||||
#ifndef NDEBUG
|
||||
const OPTIONS *next;
|
||||
int duplicated, i;
|
||||
#endif
|
||||
|
||||
if (o->name == OPT_HELP_STR || o->name == OPT_MORE_STR ||
|
||||
o->name == OPT_SECTION_STR)
|
||||
if (o->name == OPT_HELP_STR
|
||||
|| o->name == OPT_MORE_STR
|
||||
|| o->name == OPT_SECTION_STR)
|
||||
continue;
|
||||
#ifndef NDEBUG
|
||||
i = o->valtype;
|
||||
@@ -146,7 +149,7 @@ char *opt_init(int ac, char **av, const OPTIONS *o)
|
||||
switch (i) {
|
||||
case 0: case '-': case '/': case '<': case '>': case 'E': case 'F':
|
||||
case 'M': case 'U': case 'f': case 'l': case 'n': case 'p': case 's':
|
||||
case 'u': case 'c':
|
||||
case 'u': case 'c': case ':':
|
||||
break;
|
||||
default:
|
||||
OPENSSL_assert(0);
|
||||
@@ -285,7 +288,7 @@ int opt_cipher(const char *name, const EVP_CIPHER **cipherp)
|
||||
*cipherp = EVP_get_cipherbyname(name);
|
||||
if (*cipherp != NULL)
|
||||
return 1;
|
||||
opt_printf_stderr("%s: Unrecognized flag %s\n", prog, name);
|
||||
opt_printf_stderr("%s: Unknown cipher: %s\n", prog, name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -297,7 +300,7 @@ int opt_md(const char *name, const EVP_MD **mdp)
|
||||
*mdp = EVP_get_digestbyname(name);
|
||||
if (*mdp != NULL)
|
||||
return 1;
|
||||
opt_printf_stderr("%s: Unrecognized flag %s\n", prog, name);
|
||||
opt_printf_stderr("%s: Unknown message digest: %s\n", prog, name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -686,6 +689,7 @@ int opt_next(void)
|
||||
switch (o->valtype) {
|
||||
default:
|
||||
case 's':
|
||||
case ':':
|
||||
/* Just a string. */
|
||||
break;
|
||||
case '/':
|
||||
@@ -758,7 +762,7 @@ int opt_next(void)
|
||||
dunno = p;
|
||||
return unknown->retval;
|
||||
}
|
||||
opt_printf_stderr("%s: Option unknown option -%s\n", prog, p);
|
||||
opt_printf_stderr("%s: Unknown option: -%s\n", prog, p);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -804,6 +808,8 @@ static const char *valtype2param(const OPTIONS *o)
|
||||
case 0:
|
||||
case '-':
|
||||
return "";
|
||||
case ':':
|
||||
return "uri";
|
||||
case 's':
|
||||
return "val";
|
||||
case '/':
|
||||
@@ -834,17 +840,26 @@ static const char *valtype2param(const OPTIONS *o)
|
||||
return "parm";
|
||||
}
|
||||
|
||||
void opt_print(const OPTIONS *o, int width)
|
||||
void opt_print(const OPTIONS *o, int doingparams, int width)
|
||||
{
|
||||
const char* help;
|
||||
char start[80 + 1];
|
||||
char *p;
|
||||
|
||||
help = o->helpstr ? o->helpstr : "(No additional info)";
|
||||
if (o->name == OPT_HELP_STR || o->name == OPT_SECTION_STR) {
|
||||
if (o->name == OPT_HELP_STR) {
|
||||
opt_printf_stderr(help, prog);
|
||||
return;
|
||||
}
|
||||
if (o->name == OPT_SECTION_STR) {
|
||||
opt_printf_stderr("\n");
|
||||
opt_printf_stderr(help, prog);
|
||||
return;
|
||||
}
|
||||
if (o->name == OPT_PARAM_STR) {
|
||||
opt_printf_stderr("\nParameters:\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Pad out prefix */
|
||||
memset(start, ' ', sizeof(start) - 1);
|
||||
@@ -860,7 +875,8 @@ void opt_print(const OPTIONS *o, int width)
|
||||
/* Build up the "-flag [param]" part. */
|
||||
p = start;
|
||||
*p++ = ' ';
|
||||
*p++ = '-';
|
||||
if (!doingparams)
|
||||
*p++ = '-';
|
||||
if (o->name[0])
|
||||
p += strlen(strcpy(p, o->name));
|
||||
else
|
||||
@@ -882,9 +898,8 @@ void opt_print(const OPTIONS *o, int width)
|
||||
void opt_help(const OPTIONS *list)
|
||||
{
|
||||
const OPTIONS *o;
|
||||
int i;
|
||||
int i, sawparams = 0, width = 5;
|
||||
int standard_prolog;
|
||||
int width = 5;
|
||||
char start[80 + 1];
|
||||
|
||||
/* Starts with its own help message? */
|
||||
@@ -910,7 +925,9 @@ void opt_help(const OPTIONS *list)
|
||||
|
||||
/* Now let's print. */
|
||||
for (o = list; o->name; o++) {
|
||||
opt_print(o, width);
|
||||
if (o->name == OPT_PARAM_STR)
|
||||
sawparams = 1;
|
||||
opt_print(o, sawparams, width);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-4
@@ -1262,27 +1262,37 @@ int ssl_ctx_add_crls(SSL_CTX *ctx, STACK_OF(X509_CRL) *crls, int crl_download)
|
||||
|
||||
int ssl_load_stores(SSL_CTX *ctx,
|
||||
const char *vfyCApath, const char *vfyCAfile,
|
||||
const char *vfyCAstore,
|
||||
const char *chCApath, const char *chCAfile,
|
||||
const char *chCAstore,
|
||||
STACK_OF(X509_CRL) *crls, int crl_download)
|
||||
{
|
||||
X509_STORE *vfy = NULL, *ch = NULL;
|
||||
int rv = 0;
|
||||
if (vfyCApath != NULL || vfyCAfile != NULL) {
|
||||
if (vfyCApath != NULL || vfyCAfile != NULL || vfyCAstore != NULL) {
|
||||
vfy = X509_STORE_new();
|
||||
if (vfy == NULL)
|
||||
goto err;
|
||||
if (!X509_STORE_load_locations(vfy, vfyCAfile, vfyCApath))
|
||||
if (vfyCAfile != NULL && !X509_STORE_load_file(vfy, vfyCAfile))
|
||||
goto err;
|
||||
if (vfyCApath != NULL && !X509_STORE_load_path(vfy, vfyCApath))
|
||||
goto err;
|
||||
if (vfyCAstore != NULL && !X509_STORE_load_store(vfy, vfyCAstore))
|
||||
goto err;
|
||||
add_crls_store(vfy, crls);
|
||||
SSL_CTX_set1_verify_cert_store(ctx, vfy);
|
||||
if (crl_download)
|
||||
store_setup_crl_download(vfy);
|
||||
}
|
||||
if (chCApath != NULL || chCAfile != NULL) {
|
||||
if (chCApath != NULL || chCAfile != NULL || chCAstore != NULL) {
|
||||
ch = X509_STORE_new();
|
||||
if (ch == NULL)
|
||||
goto err;
|
||||
if (!X509_STORE_load_locations(ch, chCAfile, chCApath))
|
||||
if (chCAfile != NULL && !X509_STORE_load_file(ch, chCAfile))
|
||||
goto err;
|
||||
if (chCApath != NULL && !X509_STORE_load_path(ch, chCApath))
|
||||
goto err;
|
||||
if (chCAstore != NULL && !X509_STORE_load_store(ch, chCAstore))
|
||||
goto err;
|
||||
SSL_CTX_set1_chain_cert_store(ctx, ch);
|
||||
}
|
||||
|
||||
@@ -366,6 +366,8 @@ static void list_options_for_command(const char *command)
|
||||
|
||||
if (o->name == OPT_HELP_STR
|
||||
|| o->name == OPT_MORE_STR
|
||||
|| o->name == OPT_SECTION_STR
|
||||
|| o->name == OPT_PARAM_STR
|
||||
|| o->name[0] == '\0')
|
||||
continue;
|
||||
BIO_printf(bio_out, "%s %c\n", o->name, c == '\0' ? '-' : c);
|
||||
@@ -617,7 +619,11 @@ typedef enum HELPLIST_CHOICE {
|
||||
} HELPLIST_CHOICE;
|
||||
|
||||
const OPTIONS list_options[] = {
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"1", OPT_ONE, '-', "List in one column"},
|
||||
{"verbose", OPT_VERBOSE, '-', "Verbose listing"},
|
||||
{"commands", OPT_COMMANDS, '-', "List of standard commands"},
|
||||
|
||||
+13
-6
@@ -26,15 +26,22 @@ typedef enum OPTION_choice {
|
||||
|
||||
const OPTIONS mac_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] mac_name\n"},
|
||||
{OPT_HELP_STR, 1, '-', "mac_name\t\t MAC algorithm (See list "
|
||||
"-mac-algorithms)"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"macopt", OPT_MACOPT, 's', "MAC algorithm parameters in n:v form. "
|
||||
"See 'PARAMETER NAMES' in the EVP_MAC_ docs"},
|
||||
{"macopt", OPT_MACOPT, 's', "MAC algorithm parameters in n:v form"},
|
||||
{OPT_MORE_STR, 1, '-', "See 'PARAMETER NAMES' in the EVP_MAC_ docs"},
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input file to MAC (default is stdin)"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output to filename rather than stdout"},
|
||||
{"binary", OPT_BIN, '-', "Output in binary format (Default is hexadecimal "
|
||||
"output)"},
|
||||
{"binary", OPT_BIN, '-',
|
||||
"Output in binary format (default is hexadecimal)"},
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"mac_name", 0, 0, "MAC algorithm"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+6
-1
@@ -20,9 +20,14 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS nseq_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"toseq", OPT_TOSEQ, '-', "Output NS Sequence file"},
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"toseq", OPT_TOSEQ, '-', "Output NS Sequence file"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
+80
-53
@@ -115,7 +115,7 @@ static int acfd = (int) INVALID_SOCKET;
|
||||
static int index_changed(CA_DB *);
|
||||
static void spawn_loop(void);
|
||||
static int print_syslog(const char *str, size_t len, void *levPtr);
|
||||
static void sock_timeout(int signum);
|
||||
static void socket_timeout(int signum);
|
||||
# endif
|
||||
|
||||
# ifndef OPENSSL_NO_SOCK
|
||||
@@ -134,11 +134,13 @@ typedef enum OPTION_choice {
|
||||
OPT_NO_CERT_CHECKS, OPT_NO_EXPLICIT, OPT_TRUST_OTHER,
|
||||
OPT_NO_INTERN, OPT_BADSIG, OPT_TEXT, OPT_REQ_TEXT, OPT_RESP_TEXT,
|
||||
OPT_REQIN, OPT_RESPIN, OPT_SIGNER, OPT_VAFILE, OPT_SIGN_OTHER,
|
||||
OPT_VERIFY_OTHER, OPT_CAFILE, OPT_CAPATH, OPT_NOCAFILE, OPT_NOCAPATH,
|
||||
OPT_VERIFY_OTHER, OPT_CAFILE, OPT_CAPATH, OPT_CASTORE, OPT_NOCAFILE,
|
||||
OPT_NOCAPATH, OPT_NOCASTORE,
|
||||
OPT_VALIDITY_PERIOD, OPT_STATUS_AGE, OPT_SIGNKEY, OPT_REQOUT,
|
||||
OPT_RESPOUT, OPT_PATH, OPT_ISSUER, OPT_CERT, OPT_SERIAL,
|
||||
OPT_INDEX, OPT_CA, OPT_NMIN, OPT_REQUEST, OPT_NDAYS, OPT_RSIGNER,
|
||||
OPT_RKEY, OPT_ROTHER, OPT_RMD, OPT_RSIGOPT, OPT_HEADER,
|
||||
OPT_PASSIN,
|
||||
OPT_RCID,
|
||||
OPT_V_ENUM,
|
||||
OPT_MD,
|
||||
@@ -146,31 +148,70 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS ocsp_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"out", OPT_OUTFILE, '>', "Output filename"},
|
||||
{"timeout", OPT_TIMEOUT, 'p',
|
||||
"Connection timeout (in seconds) to the OCSP responder"},
|
||||
{"url", OPT_URL, 's', "Responder URL"},
|
||||
{"host", OPT_HOST, 's', "TCP/IP hostname:port to connect to"},
|
||||
{"port", OPT_PORT, 'p', "Port to run responder on"},
|
||||
{"ignore_err", OPT_IGNORE_ERR, '-',
|
||||
"Ignore error on OCSP request or response and continue running"},
|
||||
{"noverify", OPT_NOVERIFY, '-', "Don't verify response at all"},
|
||||
{"nonce", OPT_NONCE, '-', "Add OCSP nonce to request"},
|
||||
{"no_nonce", OPT_NO_NONCE, '-', "Don't add OCSP nonce to request"},
|
||||
{"CAfile", OPT_CAFILE, '<', "Trusted certificates file"},
|
||||
{"CApath", OPT_CAPATH, '<', "Trusted certificates directory"},
|
||||
{"CAstore", OPT_CASTORE, ':', "Trusted certificates store URI"},
|
||||
{"no-CAfile", OPT_NOCAFILE, '-',
|
||||
"Do not load the default certificates file"},
|
||||
{"no-CApath", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates directory"},
|
||||
{"no-CAstore", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates store"},
|
||||
|
||||
OPT_SECTION("Responder"),
|
||||
{"timeout", OPT_TIMEOUT, 'p',
|
||||
"Connection timeout (in seconds) to the OCSP responder"},
|
||||
{"resp_no_certs", OPT_RESP_NO_CERTS, '-',
|
||||
"Don't include any certificates in response"},
|
||||
{"resp_key_id", OPT_RESP_KEY_ID, '-',
|
||||
"Identify response by signing certificate key ID"},
|
||||
# ifdef OCSP_DAEMON
|
||||
{"multi", OPT_MULTI, 'p', "run multiple responder processes"},
|
||||
# endif
|
||||
{"no_certs", OPT_NO_CERTS, '-',
|
||||
"Don't include any certificates in signed request"},
|
||||
{"badsig", OPT_BADSIG, '-',
|
||||
"Corrupt last byte of loaded OSCP response signature (for test)"},
|
||||
{"CA", OPT_CA, '<', "CA certificate"},
|
||||
{"nmin", OPT_NMIN, 'p', "Number of minutes before next update"},
|
||||
{"nrequest", OPT_REQUEST, 'p',
|
||||
"Number of requests to accept (default unlimited)"},
|
||||
{"reqin", OPT_REQIN, 's', "File with the DER-encoded request"},
|
||||
{"signer", OPT_SIGNER, '<', "Certificate to sign OCSP request with"},
|
||||
{"sign_other", OPT_SIGN_OTHER, '<',
|
||||
"Additional certificates to include in signed request"},
|
||||
{"index", OPT_INDEX, '<', "Certificate status index file"},
|
||||
{"ndays", OPT_NDAYS, 'p', "Number of days before next update"},
|
||||
{"rsigner", OPT_RSIGNER, '<',
|
||||
"Responder certificate to sign responses with"},
|
||||
{"rkey", OPT_RKEY, '<', "Responder key to sign responses with"},
|
||||
{"passin", OPT_PASSIN, 's', "Responder key pass phrase source"},
|
||||
{"rother", OPT_ROTHER, '<', "Other certificates to include in response"},
|
||||
{"rmd", OPT_RMD, 's', "Digest Algorithm to use in signature of OCSP response"},
|
||||
{"rsigopt", OPT_RSIGOPT, 's', "OCSP response signature parameter in n:v form"},
|
||||
{"header", OPT_HEADER, 's', "key=value header to add"},
|
||||
{"rcid", OPT_RCID, 's', "Use specified algorithm for cert id in response"},
|
||||
{"", OPT_MD, '-', "Any supported digest algorithm (sha1,sha256, ... )"},
|
||||
|
||||
OPT_SECTION("Client"),
|
||||
{"url", OPT_URL, 's', "Responder URL"},
|
||||
{"host", OPT_HOST, 's', "TCP/IP hostname:port to connect to"},
|
||||
{"port", OPT_PORT, 'p', "Port to run responder on"},
|
||||
{"out", OPT_OUTFILE, '>', "Output filename"},
|
||||
{"noverify", OPT_NOVERIFY, '-', "Don't verify response at all"},
|
||||
{"nonce", OPT_NONCE, '-', "Add OCSP nonce to request"},
|
||||
{"no_nonce", OPT_NO_NONCE, '-', "Don't add OCSP nonce to request"},
|
||||
{"no_signature_verify", OPT_NO_SIGNATURE_VERIFY, '-',
|
||||
"Don't check signature on response"},
|
||||
{"resp_key_id", OPT_RESP_KEY_ID, '-',
|
||||
"Identify response by signing certificate key ID"},
|
||||
{"no_cert_verify", OPT_NO_CERT_VERIFY, '-',
|
||||
"Don't check signing certificate"},
|
||||
{"text", OPT_TEXT, '-', "Print text form of request and response"},
|
||||
{"req_text", OPT_REQ_TEXT, '-', "Print text form of request"},
|
||||
{"resp_text", OPT_RESP_TEXT, '-', "Print text form of response"},
|
||||
{"no_chain", OPT_NO_CHAIN, '-', "Don't chain verify response"},
|
||||
{"no_cert_checks", OPT_NO_CERT_CHECKS, '-',
|
||||
"Don't do additional checks on signing certificate"},
|
||||
@@ -180,50 +221,21 @@ const OPTIONS ocsp_options[] = {
|
||||
"Don't verify additional certificates"},
|
||||
{"no_intern", OPT_NO_INTERN, '-',
|
||||
"Don't search certificates contained in response for signer"},
|
||||
{"badsig", OPT_BADSIG, '-',
|
||||
"Corrupt last byte of loaded OSCP response signature (for test)"},
|
||||
{"text", OPT_TEXT, '-', "Print text form of request and response"},
|
||||
{"req_text", OPT_REQ_TEXT, '-', "Print text form of request"},
|
||||
{"resp_text", OPT_RESP_TEXT, '-', "Print text form of response"},
|
||||
{"reqin", OPT_REQIN, 's', "File with the DER-encoded request"},
|
||||
{"respin", OPT_RESPIN, 's', "File with the DER-encoded response"},
|
||||
{"signer", OPT_SIGNER, '<', "Certificate to sign OCSP request with"},
|
||||
{"VAfile", OPT_VAFILE, '<', "Validator certificates file"},
|
||||
{"sign_other", OPT_SIGN_OTHER, '<',
|
||||
"Additional certificates to include in signed request"},
|
||||
{"verify_other", OPT_VERIFY_OTHER, '<',
|
||||
"Additional certificates to search for signer"},
|
||||
{"CAfile", OPT_CAFILE, '<', "Trusted certificates file"},
|
||||
{"CApath", OPT_CAPATH, '<', "Trusted certificates directory"},
|
||||
{"no-CAfile", OPT_NOCAFILE, '-',
|
||||
"Do not load the default certificates file"},
|
||||
{"no-CApath", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates directory"},
|
||||
{"path", OPT_PATH, 's', "Path to use in OCSP request"},
|
||||
{"cert", OPT_CERT, '<', "Certificate to check"},
|
||||
{"serial", OPT_SERIAL, 's', "Serial number to check"},
|
||||
{"validity_period", OPT_VALIDITY_PERIOD, 'u',
|
||||
"Maximum validity discrepancy in seconds"},
|
||||
{"status_age", OPT_STATUS_AGE, 'p', "Maximum status age in seconds"},
|
||||
{"signkey", OPT_SIGNKEY, 's', "Private key to sign OCSP request with"},
|
||||
{"reqout", OPT_REQOUT, 's', "Output file for the DER-encoded request"},
|
||||
{"respout", OPT_RESPOUT, 's', "Output file for the DER-encoded response"},
|
||||
{"path", OPT_PATH, 's', "Path to use in OCSP request"},
|
||||
{"issuer", OPT_ISSUER, '<', "Issuer certificate"},
|
||||
{"cert", OPT_CERT, '<', "Certificate to check"},
|
||||
{"serial", OPT_SERIAL, 's', "Serial number to check"},
|
||||
{"index", OPT_INDEX, '<', "Certificate status index file"},
|
||||
{"CA", OPT_CA, '<', "CA certificate"},
|
||||
{"nmin", OPT_NMIN, 'p', "Number of minutes before next update"},
|
||||
{"nrequest", OPT_REQUEST, 'p',
|
||||
"Number of requests to accept (default unlimited)"},
|
||||
{"ndays", OPT_NDAYS, 'p', "Number of days before next update"},
|
||||
{"rsigner", OPT_RSIGNER, '<',
|
||||
"Responder certificate to sign responses with"},
|
||||
{"rkey", OPT_RKEY, '<', "Responder key to sign responses with"},
|
||||
{"rother", OPT_ROTHER, '<', "Other certificates to include in response"},
|
||||
{"rmd", OPT_RMD, 's', "Digest Algorithm to use in signature of OCSP response"},
|
||||
{"rsigopt", OPT_RSIGOPT, 's', "OCSP response signature parameter in n:v form"},
|
||||
{"header", OPT_HEADER, 's', "key=value header to add"},
|
||||
{"rcid", OPT_RCID, 's', "Use specified algorithm for cert id in response"},
|
||||
{"", OPT_MD, '-', "Any supported digest algorithm (sha1,sha256, ... )"},
|
||||
{"status_age", OPT_STATUS_AGE, 'p', "Maximum status age in seconds"},
|
||||
|
||||
OPT_V_OPTIONS,
|
||||
{NULL}
|
||||
};
|
||||
@@ -250,16 +262,17 @@ int ocsp_main(int argc, char **argv)
|
||||
X509 *signer = NULL, *rsigner = NULL;
|
||||
X509_STORE *store = NULL;
|
||||
X509_VERIFY_PARAM *vpm = NULL;
|
||||
const char *CAfile = NULL, *CApath = NULL;
|
||||
const char *CAfile = NULL, *CApath = NULL, *CAstore = NULL;
|
||||
char *header, *value;
|
||||
char *host = NULL, *port = NULL, *path = "/", *outfile = NULL;
|
||||
char *rca_filename = NULL, *reqin = NULL, *respin = NULL;
|
||||
char *reqout = NULL, *respout = NULL, *ridx_filename = NULL;
|
||||
char *rsignfile = NULL, *rkeyfile = NULL;
|
||||
char *passinarg = NULL, *passin = NULL;
|
||||
char *sign_certfile = NULL, *verify_certfile = NULL, *rcertfile = NULL;
|
||||
char *signfile = NULL, *keyfile = NULL;
|
||||
char *thost = NULL, *tport = NULL, *tpath = NULL;
|
||||
int noCAfile = 0, noCApath = 0;
|
||||
int noCAfile = 0, noCApath = 0, noCAstore = 0;
|
||||
int accept_count = -1, add_nonce = 1, noverify = 0, use_ssl = -1;
|
||||
int vpmtouched = 0, badsig = 0, i, ignore_err = 0, nmin = 0, ndays = -1;
|
||||
int req_text = 0, resp_text = 0, ret = 1;
|
||||
@@ -395,12 +408,18 @@ int ocsp_main(int argc, char **argv)
|
||||
case OPT_CAPATH:
|
||||
CApath = opt_arg();
|
||||
break;
|
||||
case OPT_CASTORE:
|
||||
CAstore = opt_arg();
|
||||
break;
|
||||
case OPT_NOCAFILE:
|
||||
noCAfile = 1;
|
||||
break;
|
||||
case OPT_NOCAPATH:
|
||||
noCApath = 1;
|
||||
break;
|
||||
case OPT_NOCASTORE:
|
||||
noCAstore = 1;
|
||||
break;
|
||||
case OPT_V_CASES:
|
||||
if (!opt_verify(o, vpm))
|
||||
goto end;
|
||||
@@ -479,6 +498,9 @@ int ocsp_main(int argc, char **argv)
|
||||
case OPT_RKEY:
|
||||
rkeyfile = opt_arg();
|
||||
break;
|
||||
case OPT_PASSIN:
|
||||
passinarg = opt_arg();
|
||||
break;
|
||||
case OPT_ROTHER:
|
||||
rcertfile = opt_arg();
|
||||
break;
|
||||
@@ -581,7 +603,11 @@ int ocsp_main(int argc, char **argv)
|
||||
"responder other certificates"))
|
||||
goto end;
|
||||
}
|
||||
rkey = load_key(rkeyfile, FORMAT_PEM, 0, NULL, NULL,
|
||||
if (!app_passwd(passinarg, NULL, &passin, NULL)) {
|
||||
BIO_printf(bio_err, "Error getting password\n");
|
||||
goto end;
|
||||
}
|
||||
rkey = load_key(rkeyfile, FORMAT_PEM, 0, passin, NULL,
|
||||
"responder private key");
|
||||
if (rkey == NULL)
|
||||
goto end;
|
||||
@@ -606,7 +632,7 @@ int ocsp_main(int argc, char **argv)
|
||||
if (multi && acbio != NULL)
|
||||
spawn_loop();
|
||||
if (acbio != NULL && req_timeout > 0)
|
||||
signal(SIGALRM, sock_timeout);
|
||||
signal(SIGALRM, socket_timeout);
|
||||
#endif
|
||||
|
||||
if (acbio != NULL)
|
||||
@@ -765,7 +791,8 @@ redo_accept:
|
||||
}
|
||||
|
||||
if (store == NULL) {
|
||||
store = setup_verify(CAfile, CApath, noCAfile, noCApath);
|
||||
store = setup_verify(CAfile, noCAfile, CApath, noCApath,
|
||||
CAstore, noCAstore);
|
||||
if (!store)
|
||||
goto end;
|
||||
}
|
||||
@@ -1372,7 +1399,7 @@ static int urldecode(char *p)
|
||||
# endif
|
||||
|
||||
# ifdef OCSP_DAEMON
|
||||
static void sock_timeout(int signum)
|
||||
static void socket_timeout(int signum)
|
||||
{
|
||||
if (acfd != (int)INVALID_SOCKET)
|
||||
(void)shutdown(acfd, SHUT_RD);
|
||||
|
||||
+18
-24
@@ -113,10 +113,10 @@ static size_t internal_trace_cb(const char *buf, size_t cnt,
|
||||
tid = CRYPTO_THREAD_get_current_id();
|
||||
hex = OPENSSL_buf2hexstr((const unsigned char *)&tid, sizeof(tid));
|
||||
BIO_snprintf(buffer, sizeof(buffer), "TRACE[%s]:%s: ",
|
||||
hex, OSSL_trace_get_category_name(category));
|
||||
hex == NULL ? "<null>" : hex,
|
||||
OSSL_trace_get_category_name(category));
|
||||
OPENSSL_free(hex);
|
||||
BIO_ctrl(trace_data->bio, PREFIX_CTRL_SET_PREFIX,
|
||||
strlen(buffer), buffer);
|
||||
BIO_set_prefix(trace_data->bio, buffer);
|
||||
break;
|
||||
case OSSL_TRACE_CTRL_WRITE:
|
||||
if (!ossl_assert(trace_data->ingroup))
|
||||
@@ -129,7 +129,7 @@ static size_t internal_trace_cb(const char *buf, size_t cnt,
|
||||
return 0;
|
||||
trace_data->ingroup = 0;
|
||||
|
||||
BIO_ctrl(trace_data->bio, PREFIX_CTRL_SET_PREFIX, 0, NULL);
|
||||
BIO_set_prefix(trace_data->bio, NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -161,8 +161,7 @@ static void setup_trace_category(int category)
|
||||
if (OSSL_trace_enabled(category))
|
||||
return;
|
||||
|
||||
channel = BIO_push(BIO_new(apps_bf_prefix()),
|
||||
dup_bio_err(FORMAT_TEXT));
|
||||
channel = BIO_push(BIO_new(BIO_f_prefix()), dup_bio_err(FORMAT_TEXT));
|
||||
trace_data = OPENSSL_zalloc(sizeof(*trace_data));
|
||||
|
||||
if (trace_data == NULL
|
||||
@@ -246,22 +245,10 @@ int main(int argc, char *argv[])
|
||||
win32_utf8argv(&argc, &argv);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We use the prefix method to get the trace output we want. Since some
|
||||
* trace outputs happen with OPENSSL_cleanup(), which is run automatically
|
||||
* after exit(), we need to destroy the prefix method as late as possible.
|
||||
*/
|
||||
atexit(destroy_prefix_method);
|
||||
|
||||
#ifndef OPENSSL_NO_TRACE
|
||||
setup_trace(getenv("OPENSSL_TRACE"));
|
||||
#endif
|
||||
|
||||
p = getenv("OPENSSL_DEBUG_MEMORY");
|
||||
if (p != NULL && strcmp(p, "on") == 0)
|
||||
CRYPTO_set_mem_debug(1);
|
||||
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
|
||||
|
||||
if (getenv("OPENSSL_FIPS")) {
|
||||
BIO_printf(bio_err, "FIPS mode not supported.\n");
|
||||
return 1;
|
||||
@@ -276,6 +263,13 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
prog = prog_init();
|
||||
if (prog == NULL) {
|
||||
BIO_printf(bio_err,
|
||||
"FATAL: Startup failure (dev note: prog_init() failed)\n");
|
||||
ERR_print_errors(bio_err);
|
||||
ret = 1;
|
||||
goto end;
|
||||
}
|
||||
pname = opt_progname(argv[0]);
|
||||
|
||||
/* first check the program name */
|
||||
@@ -371,10 +365,6 @@ int main(int argc, char *argv[])
|
||||
BIO_free(bio_in);
|
||||
BIO_free_all(bio_out);
|
||||
apps_shutdown();
|
||||
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
|
||||
if (CRYPTO_mem_leaks(bio_err) <= 0)
|
||||
ret = 1;
|
||||
#endif
|
||||
BIO_free(bio_err);
|
||||
EXIT(ret);
|
||||
}
|
||||
@@ -384,9 +374,13 @@ typedef enum HELP_CHOICE {
|
||||
} HELP_CHOICE;
|
||||
|
||||
const OPTIONS help_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: help [options]\n"},
|
||||
{OPT_HELP_STR, 1, '-', " help [command]\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Usage: help [options] [command]\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_hHELP, '-', "Display this summary"},
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"command", 0, 0, "Name of command to display help (optional)"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+15
-2
@@ -59,15 +59,24 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS passwd_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] [password]\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Read passwords from file"},
|
||||
{"noverify", OPT_NOVERIFY, '-',
|
||||
"Never verify when reading password from terminal"},
|
||||
{"stdin", OPT_STDIN, '-', "Read passwords from stdin"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"quiet", OPT_QUIET, '-', "No warnings"},
|
||||
{"table", OPT_TABLE, '-', "Format output as table"},
|
||||
{"reverse", OPT_REVERSE, '-', "Switch table columns"},
|
||||
|
||||
OPT_SECTION("Cryptographic"),
|
||||
{"salt", OPT_SALT, 's', "Use provided salt"},
|
||||
{"stdin", OPT_STDIN, '-', "Read passwords from stdin"},
|
||||
{"6", OPT_6, '-', "SHA512-based password algorithm"},
|
||||
{"5", OPT_5, '-', "SHA256-based password algorithm"},
|
||||
{"apr1", OPT_APR1, '-', "MD5-based password algorithm, Apache variant"},
|
||||
@@ -76,7 +85,11 @@ const OPTIONS passwd_options[] = {
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{"crypt", OPT_CRYPT, '-', "Standard Unix password algorithm (default)"},
|
||||
#endif
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"password", 0, 0, "Password text to digest (optional)"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -807,7 +820,7 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
|
||||
(*salt_p)[i] = cov_2char[(*salt_p)[i] & 0x3f]; /* 6 bits */
|
||||
(*salt_p)[i] = 0;
|
||||
# ifdef CHARSET_EBCDIC
|
||||
/* The password encryption funtion will convert back to ASCII */
|
||||
/* The password encryption function will convert back to ASCII */
|
||||
ascii2ebcdic(*salt_p, *salt_p, saltlen);
|
||||
# endif
|
||||
}
|
||||
|
||||
+65
-39
@@ -53,27 +53,65 @@ typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
OPT_CIPHER, OPT_NOKEYS, OPT_KEYEX, OPT_KEYSIG, OPT_NOCERTS, OPT_CLCERTS,
|
||||
OPT_CACERTS, OPT_NOOUT, OPT_INFO, OPT_CHAIN, OPT_TWOPASS, OPT_NOMACVER,
|
||||
OPT_DESCERT, OPT_EXPORT, OPT_NOITER, OPT_MACITER, OPT_NOMACITER,
|
||||
OPT_DESCERT, OPT_EXPORT, OPT_ITER, OPT_NOITER, OPT_MACITER, OPT_NOMACITER,
|
||||
OPT_NOMAC, OPT_LMK, OPT_NODES, OPT_MACALG, OPT_CERTPBE, OPT_KEYPBE,
|
||||
OPT_INKEY, OPT_CERTFILE, OPT_NAME, OPT_CSP, OPT_CANAME,
|
||||
OPT_IN, OPT_OUT, OPT_PASSIN, OPT_PASSOUT, OPT_PASSWORD, OPT_CAPATH,
|
||||
OPT_CAFILE, OPT_NOCAPATH, OPT_NOCAFILE, OPT_ENGINE,
|
||||
OPT_CAFILE, OPT_CASTORE, OPT_NOCAPATH, OPT_NOCAFILE, OPT_NOCASTORE, OPT_ENGINE,
|
||||
OPT_R_ENUM
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS pkcs12_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"nokeys", OPT_NOKEYS, '-', "Don't output private keys"},
|
||||
{"keyex", OPT_KEYEX, '-', "Set MS key exchange type"},
|
||||
{"keysig", OPT_KEYSIG, '-', "Set MS key signature type"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
|
||||
OPT_SECTION("CA"),
|
||||
{"CApath", OPT_CAPATH, '/', "PEM-format directory of CA's"},
|
||||
{"CAfile", OPT_CAFILE, '<', "PEM-format file of CA's"},
|
||||
{"CAstore", OPT_CASTORE, ':', "URI to store of CA's"},
|
||||
{"no-CAfile", OPT_NOCAFILE, '-',
|
||||
"Do not load the default certificates file"},
|
||||
{"no-CApath", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates directory"},
|
||||
{"no-CAstore", OPT_NOCASTORE, '-',
|
||||
"Do not load certificates from the default certificates store"},
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"inkey", OPT_INKEY, 's', "Private key if not infile"},
|
||||
{"certfile", OPT_CERTFILE, '<', "Load certs from file"},
|
||||
{"name", OPT_NAME, 's', "Use name as friendly name"},
|
||||
{"CSP", OPT_CSP, 's', "Microsoft CSP name"},
|
||||
{"caname", OPT_CANAME, 's',
|
||||
"Use name as CA friendly name (can be repeated)"},
|
||||
{"in", OPT_IN, '<', "Input filename"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"export", OPT_EXPORT, '-', "Output PKCS12 file"},
|
||||
{"LMK", OPT_LMK, '-',
|
||||
"Add local machine keyset attribute to private key"},
|
||||
{"macalg", OPT_MACALG, 's',
|
||||
"Digest algorithm used in MAC (default SHA1)"},
|
||||
{"keypbe", OPT_KEYPBE, 's', "Private key PBE algorithm (default 3DES)"},
|
||||
{"out", OPT_OUT, '>', "Output filename"},
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
{"password", OPT_PASSWORD, 's', "Set import/export password source"},
|
||||
{"nocerts", OPT_NOCERTS, '-', "Don't output certificates"},
|
||||
{"clcerts", OPT_CLCERTS, '-', "Only output client certificates"},
|
||||
{"cacerts", OPT_CACERTS, '-', "Only output CA certificates"},
|
||||
{"noout", OPT_NOOUT, '-', "Don't output anything, just verify"},
|
||||
{"info", OPT_INFO, '-', "Print info about PKCS#12 structure"},
|
||||
{"chain", OPT_CHAIN, '-', "Add certificate chain"},
|
||||
{"twopass", OPT_TWOPASS, '-', "Separate MAC, encryption passwords"},
|
||||
{"nomacver", OPT_NOMACVER, '-', "Don't verify MAC"},
|
||||
{"info", OPT_INFO, '-', "Print info about PKCS#12 structure"},
|
||||
{"nokeys", OPT_NOKEYS, '-', "Don't output private keys"},
|
||||
{"keyex", OPT_KEYEX, '-', "Set MS key exchange type"},
|
||||
{"keysig", OPT_KEYSIG, '-', "Set MS key signature type"},
|
||||
|
||||
OPT_SECTION("Encryption"),
|
||||
# ifndef OPENSSL_NO_RC2
|
||||
{"descert", OPT_DESCERT, '-',
|
||||
"Encrypt output with 3DES (default RC2-40)"},
|
||||
@@ -83,39 +121,15 @@ const OPTIONS pkcs12_options[] = {
|
||||
{"descert", OPT_DESCERT, '-', "Encrypt output with 3DES (the default)"},
|
||||
{"certpbe", OPT_CERTPBE, 's', "Certificate PBE algorithm (default 3DES)"},
|
||||
# endif
|
||||
{"export", OPT_EXPORT, '-', "Output PKCS12 file"},
|
||||
{"noiter", OPT_NOITER, '-', "Don't use encryption iteration"},
|
||||
{"maciter", OPT_MACITER, '-', "Use MAC iteration"},
|
||||
{"iter", OPT_ITER, 'p', "Specify the iteration count for encryption key and MAC"},
|
||||
{"noiter", OPT_NOITER, '-', "Don't use encryption key iteration"},
|
||||
{"maciter", OPT_MACITER, '-', "Unused, kept for backwards compatibility"},
|
||||
{"nomaciter", OPT_NOMACITER, '-', "Don't use MAC iteration"},
|
||||
{"nomac", OPT_NOMAC, '-', "Don't generate MAC"},
|
||||
{"LMK", OPT_LMK, '-',
|
||||
"Add local machine keyset attribute to private key"},
|
||||
{"nodes", OPT_NODES, '-', "Don't encrypt private keys"},
|
||||
{"macalg", OPT_MACALG, 's',
|
||||
"Digest algorithm used in MAC (default SHA1)"},
|
||||
{"keypbe", OPT_KEYPBE, 's', "Private key PBE algorithm (default 3DES)"},
|
||||
OPT_R_OPTIONS,
|
||||
{"inkey", OPT_INKEY, 's', "Private key if not infile"},
|
||||
{"certfile", OPT_CERTFILE, '<', "Load certs from file"},
|
||||
{"name", OPT_NAME, 's', "Use name as friendly name"},
|
||||
{"CSP", OPT_CSP, 's', "Microsoft CSP name"},
|
||||
{"caname", OPT_CANAME, 's',
|
||||
"Use name as CA friendly name (can be repeated)"},
|
||||
{"in", OPT_IN, '<', "Input filename"},
|
||||
{"out", OPT_OUT, '>', "Output filename"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
{"password", OPT_PASSWORD, 's', "Set import/export password source"},
|
||||
{"CApath", OPT_CAPATH, '/', "PEM-format directory of CA's"},
|
||||
{"CAfile", OPT_CAFILE, '<', "PEM-format file of CA's"},
|
||||
{"no-CAfile", OPT_NOCAFILE, '-',
|
||||
"Do not load the default certificates file"},
|
||||
{"no-CApath", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates directory"},
|
||||
{"", OPT_CIPHER, '-', "Any supported cipher"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -137,8 +151,8 @@ int pkcs12_main(int argc, char **argv)
|
||||
char *passinarg = NULL, *passoutarg = NULL, *passarg = NULL;
|
||||
char *passin = NULL, *passout = NULL, *macalg = NULL;
|
||||
char *cpass = NULL, *mpass = NULL, *badpass = NULL;
|
||||
const char *CApath = NULL, *CAfile = NULL, *prog;
|
||||
int noCApath = 0, noCAfile = 0;
|
||||
const char *CApath = NULL, *CAfile = NULL, *CAstore = NULL, *prog;
|
||||
int noCApath = 0, noCAfile = 0, noCAstore = 0;
|
||||
ENGINE *e = NULL;
|
||||
BIO *in = NULL, *out = NULL;
|
||||
PKCS12 *p12 = NULL;
|
||||
@@ -201,11 +215,16 @@ int pkcs12_main(int argc, char **argv)
|
||||
if (!opt_cipher(opt_unknown(), &enc))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_ITER:
|
||||
if (!opt_int(opt_arg(), &iter))
|
||||
goto opthelp;
|
||||
maciter = iter;
|
||||
break;
|
||||
case OPT_NOITER:
|
||||
iter = 1;
|
||||
break;
|
||||
case OPT_MACITER:
|
||||
maciter = PKCS12_DEFAULT_ITER;
|
||||
/* no-op */
|
||||
break;
|
||||
case OPT_NOMACITER:
|
||||
maciter = 1;
|
||||
@@ -270,12 +289,18 @@ int pkcs12_main(int argc, char **argv)
|
||||
case OPT_CAPATH:
|
||||
CApath = opt_arg();
|
||||
break;
|
||||
case OPT_CASTORE:
|
||||
CAstore = opt_arg();
|
||||
break;
|
||||
case OPT_CAFILE:
|
||||
CAfile = opt_arg();
|
||||
break;
|
||||
case OPT_NOCAPATH:
|
||||
noCApath = 1;
|
||||
break;
|
||||
case OPT_NOCASTORE:
|
||||
noCAstore = 1;
|
||||
break;
|
||||
case OPT_NOCAFILE:
|
||||
noCAfile = 1;
|
||||
break;
|
||||
@@ -404,7 +429,8 @@ int pkcs12_main(int argc, char **argv)
|
||||
int vret;
|
||||
STACK_OF(X509) *chain2;
|
||||
X509_STORE *store;
|
||||
if ((store = setup_verify(CAfile, CApath, noCAfile, noCApath))
|
||||
if ((store = setup_verify(CAfile, noCAfile, CApath, noCApath,
|
||||
CAstore, noCAstore))
|
||||
== NULL)
|
||||
goto export_end;
|
||||
|
||||
|
||||
+9
-4
@@ -27,9 +27,17 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS pkcs7_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"inform", OPT_INFORM, 'F', "Input format - DER or PEM"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"inform", OPT_INFORM, 'F', "Input format - DER or PEM"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"outform", OPT_OUTFORM, 'F', "Output format - DER or PEM"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"noout", OPT_NOOUT, '-', "Don't output encoded data"},
|
||||
@@ -37,9 +45,6 @@ const OPTIONS pkcs7_options[] = {
|
||||
{"print", OPT_PRINT, '-', "Print out all fields of the PKCS7 structure"},
|
||||
{"print_certs", OPT_PRINT_CERTS, '-',
|
||||
"Print_certs print any certs or crl in the input"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+23
-15
@@ -30,31 +30,39 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS pkcs8_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"inform", OPT_INFORM, 'F', "Input format (DER or PEM)"},
|
||||
{"outform", OPT_OUTFORM, 'F', "Output format (DER or PEM)"},
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"topk8", OPT_TOPK8, '-', "Output PKCS8 file"},
|
||||
{"noiter", OPT_NOITER, '-', "Use 1 as iteration count"},
|
||||
{"nocrypt", OPT_NOCRYPT, '-', "Use or expect unencrypted private key"},
|
||||
OPT_R_OPTIONS,
|
||||
{"v2", OPT_V2, 's', "Use PKCS#5 v2.0 and cipher"},
|
||||
{"v1", OPT_V1, 's', "Use PKCS#5 v1.5 and cipher"},
|
||||
{"v2prf", OPT_V2PRF, 's', "Set the PRF algorithm to use with PKCS#5 v2.0"},
|
||||
{"iter", OPT_ITER, 'p', "Specify the iteration count"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
{"traditional", OPT_TRADITIONAL, '-', "use traditional format private key"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
{"v1", OPT_V1, 's', "Use PKCS#5 v1.5 and cipher"},
|
||||
{"v2", OPT_V2, 's', "Use PKCS#5 v2.0 and cipher"},
|
||||
{"v2prf", OPT_V2PRF, 's', "Set the PRF algorithm to use with PKCS#5 v2.0"},
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"inform", OPT_INFORM, 'F', "Input format (DER or PEM)"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"nocrypt", OPT_NOCRYPT, '-', "Use or expect unencrypted private key"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"outform", OPT_OUTFORM, 'F', "Output format (DER or PEM)"},
|
||||
{"topk8", OPT_TOPK8, '-', "Output PKCS8 file"},
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
{"traditional", OPT_TRADITIONAL, '-', "use traditional format private key"},
|
||||
{"iter", OPT_ITER, 'p', "Specify the iteration count"},
|
||||
{"noiter", OPT_NOITER, '-', "Use 1 as iteration count"},
|
||||
|
||||
#ifndef OPENSSL_NO_SCRYPT
|
||||
OPT_SECTION("Scrypt"),
|
||||
{"scrypt", OPT_SCRYPT, '-', "Use scrypt algorithm"},
|
||||
{"scrypt_N", OPT_SCRYPT_N, 's', "Set scrypt N parameter"},
|
||||
{"scrypt_r", OPT_SCRYPT_R, 's', "Set scrypt r parameter"},
|
||||
{"scrypt_p", OPT_SCRYPT_P, 's', "Set scrypt p parameter"},
|
||||
#endif
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+21
-15
@@ -23,27 +23,33 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS pkey_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"inform", OPT_INFORM, 'f', "Input format (DER or PEM)"},
|
||||
{"outform", OPT_OUTFORM, 'F', "Output format (DER or PEM)"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
{"in", OPT_IN, 's', "Input key"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"pubin", OPT_PUBIN, '-',
|
||||
"Read public key from input (default is private key)"},
|
||||
{"pubout", OPT_PUBOUT, '-', "Output public key, not private"},
|
||||
{"text_pub", OPT_TEXT_PUB, '-', "Only output public key components"},
|
||||
{"text", OPT_TEXT, '-', "Output in plaintext as well"},
|
||||
{"noout", OPT_NOOUT, '-', "Don't output the key"},
|
||||
{"", OPT_MD, '-', "Any supported cipher"},
|
||||
{"traditional", OPT_TRADITIONAL, '-',
|
||||
"Use traditional format for private keys"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
{"check", OPT_CHECK, '-', "Check key consistency"},
|
||||
{"pubcheck", OPT_PUB_CHECK, '-', "Check public key consistency"},
|
||||
{"", OPT_MD, '-', "Any supported cipher"},
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, 's', "Input key"},
|
||||
{"inform", OPT_INFORM, 'f', "Input format (DER or PEM)"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"pubin", OPT_PUBIN, '-',
|
||||
"Read public key from input (default is private key)"},
|
||||
{"traditional", OPT_TRADITIONAL, '-',
|
||||
"Use traditional format for private keys"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"outform", OPT_OUTFORM, 'F', "Output format (DER or PEM)"},
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"pubout", OPT_PUBOUT, '-', "Output public key, not private"},
|
||||
{"text_pub", OPT_TEXT_PUB, '-', "Only output public key components"},
|
||||
{"text", OPT_TEXT, '-', "Output in plaintext as well"},
|
||||
{"noout", OPT_NOOUT, '-', "Don't output the key"},
|
||||
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+9
-4
@@ -22,15 +22,20 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS pkeyparam_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"text", OPT_TEXT, '-', "Print parameters as text"},
|
||||
{"noout", OPT_NOOUT, '-', "Don't output encoded parameters"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
{"check", OPT_CHECK, '-', "Check key param consistency"},
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"text", OPT_TEXT, '-', "Print parameters as text"},
|
||||
{"noout", OPT_NOOUT, '-', "Don't output encoded parameters"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+37
-29
@@ -49,41 +49,49 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS pkeyutl_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"in", OPT_IN, '<', "Input file - default stdin"},
|
||||
{"rawin", OPT_RAWIN, '-', "Indicate the input data is in raw form"},
|
||||
{"digest", OPT_DIGEST, 's',
|
||||
"Specify the digest algorithm when signing the raw input data"},
|
||||
{"out", OPT_OUT, '>', "Output file - default stdout"},
|
||||
{"pubin", OPT_PUBIN, '-', "Input is a public key"},
|
||||
{"certin", OPT_CERTIN, '-', "Input is a cert with a public key"},
|
||||
{"asn1parse", OPT_ASN1PARSE, '-', "asn1parse the output data"},
|
||||
{"hexdump", OPT_HEXDUMP, '-', "Hex dump output"},
|
||||
{"sign", OPT_SIGN, '-', "Sign input data with private key"},
|
||||
{"verify", OPT_VERIFY, '-', "Verify with public key"},
|
||||
{"verifyrecover", OPT_VERIFYRECOVER, '-',
|
||||
"Verify with public key, recover original data"},
|
||||
{"rev", OPT_REV, '-', "Reverse the order of the input buffer"},
|
||||
{"encrypt", OPT_ENCRYPT, '-', "Encrypt input data with public key"},
|
||||
{"decrypt", OPT_DECRYPT, '-', "Decrypt input data with private key"},
|
||||
{"derive", OPT_DERIVE, '-', "Derive shared secret"},
|
||||
{"kdf", OPT_KDF, 's', "Use KDF algorithm"},
|
||||
{"kdflen", OPT_KDFLEN, 'p', "KDF algorithm output length"},
|
||||
{"sigfile", OPT_SIGFILE, '<', "Signature file (verify operation only)"},
|
||||
{"inkey", OPT_INKEY, 's', "Input private key file"},
|
||||
{"peerkey", OPT_PEERKEY, 's', "Peer key file used in key derivation"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"peerform", OPT_PEERFORM, 'E', "Peer key format - default PEM"},
|
||||
{"keyform", OPT_KEYFORM, 'E', "Private key format - default PEM"},
|
||||
{"pkeyopt", OPT_PKEYOPT, 's', "Public key options as opt:value"},
|
||||
{"pkeyopt_passin", OPT_PKEYOPT_PASSIN, 's',
|
||||
"Public key option that is read as a passphrase argument opt:passphrase"},
|
||||
OPT_R_OPTIONS,
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
{"engine_impl", OPT_ENGINE_IMPL, '-',
|
||||
"Also use engine given by -engine for crypto operations"},
|
||||
#endif
|
||||
{"sign", OPT_SIGN, '-', "Sign input data with private key"},
|
||||
{"verify", OPT_VERIFY, '-', "Verify with public key"},
|
||||
{"encrypt", OPT_ENCRYPT, '-', "Encrypt input data with public key"},
|
||||
{"decrypt", OPT_DECRYPT, '-', "Decrypt input data with private key"},
|
||||
{"derive", OPT_DERIVE, '-', "Derive shared secret"},
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input file - default stdin"},
|
||||
{"rawin", OPT_RAWIN, '-', "Indicate the input data is in raw form"},
|
||||
{"pubin", OPT_PUBIN, '-', "Input is a public key"},
|
||||
{"inkey", OPT_INKEY, 's', "Input private key file"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"peerkey", OPT_PEERKEY, 's', "Peer key file used in key derivation"},
|
||||
{"peerform", OPT_PEERFORM, 'E', "Peer key format - default PEM"},
|
||||
{"certin", OPT_CERTIN, '-', "Input is a cert with a public key"},
|
||||
{"rev", OPT_REV, '-', "Reverse the order of the input buffer"},
|
||||
{"sigfile", OPT_SIGFILE, '<', "Signature file (verify operation only)"},
|
||||
{"keyform", OPT_KEYFORM, 'E', "Private key format - default PEM"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file - default stdout"},
|
||||
{"asn1parse", OPT_ASN1PARSE, '-', "asn1parse the output data"},
|
||||
{"hexdump", OPT_HEXDUMP, '-', "Hex dump output"},
|
||||
{"verifyrecover", OPT_VERIFYRECOVER, '-',
|
||||
"Verify with public key, recover original data"},
|
||||
|
||||
OPT_SECTION("Signing/Derivation"),
|
||||
{"digest", OPT_DIGEST, 's',
|
||||
"Specify the digest algorithm when signing the raw input data"},
|
||||
{"pkeyopt", OPT_PKEYOPT, 's', "Public key options as opt:value"},
|
||||
{"pkeyopt_passin", OPT_PKEYOPT_PASSIN, 's',
|
||||
"Public key option that is read as a passphrase argument opt:passphrase"},
|
||||
{"kdf", OPT_KDF, 's', "Use KDF algorithm"},
|
||||
{"kdflen", OPT_KDFLEN, 'p', "KDF algorithm output length"},
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+9
-4
@@ -20,15 +20,20 @@ typedef enum OPTION_choice {
|
||||
|
||||
const OPTIONS prime_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] [number...]\n"},
|
||||
{OPT_HELP_STR, 1, '-',
|
||||
" number Number to check for primality\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"bits", OPT_BITS, 'p', "Size of number in bits"},
|
||||
{"checks", OPT_CHECKS, 'p', "Number of checks"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"hex", OPT_HEX, '-', "Hex output"},
|
||||
{"generate", OPT_GENERATE, '-', "Generate a prime"},
|
||||
{"bits", OPT_BITS, 'p', "Size of number in bits"},
|
||||
{"safe", OPT_SAFE, '-',
|
||||
"When used with -generate, generate a safe prime"},
|
||||
{"checks", OPT_CHECKS, 'p', "Number of checks"},
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"number", 0, 0, "Number(s) to check for primality if not generating"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
* WARNING: do not edit!
|
||||
* Generated by apps/progs.pl
|
||||
*
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
* WARNING: do not edit!
|
||||
* Generated by apps/progs.pl
|
||||
*
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
+9
-2
@@ -26,14 +26,20 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS provider_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] provider...\n"},
|
||||
{OPT_HELP_STR, 1, '-', " provider... Providers to load\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] [provider...]\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"v", OPT_V, '-', "List the algorithm names of specified provider"},
|
||||
{"vv", OPT_VV, '-', "List the algorithm names of specified providers,"},
|
||||
{OPT_MORE_STR, 0, '-', "categorised by operation type"},
|
||||
{"vvv", OPT_VVV, '-', "List the algorithm names of specified provider"},
|
||||
{OPT_MORE_STR, 0, '-', "one at a time, and list all known parameters"},
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"provider", 0, 0, "Provider(s) to load"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -264,6 +270,7 @@ int provider_main(int argc, char **argv)
|
||||
argc = opt_num_rest();
|
||||
argv = opt_rest();
|
||||
for ( ; *argv; argv++) {
|
||||
/* This isn't necessary since -- is supported. */
|
||||
if (**argv == '-') {
|
||||
BIO_printf(bio_err, "%s: Cannot mix flags and provider names.\n",
|
||||
prog);
|
||||
|
||||
+13
-6
@@ -25,16 +25,23 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS rand_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [flags] num\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Valid options are:\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] num\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
OPT_R_OPTIONS,
|
||||
{"base64", OPT_BASE64, '-', "Base64 encode output"},
|
||||
{"hex", OPT_HEX, '-', "Hex encode output"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"base64", OPT_BASE64, '-', "Base64 encode output"},
|
||||
{"hex", OPT_HEX, '-', "Hex encode output"},
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"num", 0, 0, "Number of bytes to generate"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+8
-2
@@ -451,14 +451,20 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS rehash_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] [cert-directory...]\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Valid options are:\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] [directory...]\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"h", OPT_HELP, '-', "Display this summary"},
|
||||
{"compat", OPT_COMPAT, '-', "Create both new- and old-style hash links"},
|
||||
{"old", OPT_OLD, '-', "Use old-style hash to generate links"},
|
||||
{"n", OPT_N, '-', "Do not remove existing links"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"v", OPT_VERBOSE, '-', "Verbose output"},
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"directory", 0, 0, "One or more directories to process (optional)"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+45
-32
@@ -95,37 +95,26 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS req_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"inform", OPT_INFORM, 'F', "Input format - DER or PEM"},
|
||||
{"outform", OPT_OUTFORM, 'F', "Output format - DER or PEM"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
{"keygen_engine", OPT_KEYGEN_ENGINE, 's',
|
||||
"Specify engine to be used for key generation operations"},
|
||||
#endif
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"key", OPT_KEY, 's', "Private key to use"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Key file format"},
|
||||
{"pubkey", OPT_PUBKEY, '-', "Output public key"},
|
||||
{"inform", OPT_INFORM, 'F', "Input format - DER or PEM"},
|
||||
{"verify", OPT_VERIFY, '-', "Verify signature on REQ"},
|
||||
|
||||
OPT_SECTION("Certificate"),
|
||||
{"new", OPT_NEW, '-', "New request"},
|
||||
{"config", OPT_CONFIG, '<', "Request template file"},
|
||||
{"keyout", OPT_KEYOUT, '>', "File to send the key to"},
|
||||
{"passin", OPT_PASSIN, 's', "Private key password source"},
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
OPT_R_OPTIONS,
|
||||
{"newkey", OPT_NEWKEY, 's', "Specify as type:bits"},
|
||||
{"pkeyopt", OPT_PKEYOPT, 's', "Public key options as opt:value"},
|
||||
{"sigopt", OPT_SIGOPT, 's', "Signature parameter in n:v form"},
|
||||
{"batch", OPT_BATCH, '-',
|
||||
"Do not ask anything during request generation"},
|
||||
{"newhdr", OPT_NEWHDR, '-', "Output \"NEW\" in the header lines"},
|
||||
{"modulus", OPT_MODULUS, '-', "RSA modulus"},
|
||||
{"verify", OPT_VERIFY, '-', "Verify signature on REQ"},
|
||||
{"nodes", OPT_NODES, '-', "Don't encrypt the output key"},
|
||||
{"noout", OPT_NOOUT, '-', "Do not output REQ"},
|
||||
{"verbose", OPT_VERBOSE, '-', "Verbose output"},
|
||||
{"utf8", OPT_UTF8, '-', "Input characters are UTF8 (default ASCII)"},
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"},
|
||||
{"reqopt", OPT_REQOPT, 's', "Various request text options"},
|
||||
{"text", OPT_TEXT, '-', "Text form of request"},
|
||||
{"x509", OPT_X509, '-',
|
||||
"Output a x509 structure instead of a cert request"},
|
||||
"Output an x509 structure instead of a cert request"},
|
||||
{OPT_MORE_STR, 1, 1, "(Required by some CA's)"},
|
||||
{"subj", OPT_SUBJ, 's', "Set or modify request subject"},
|
||||
{"subject", OPT_SUBJECT, '-', "Output the request's subject"},
|
||||
@@ -140,18 +129,37 @@ const OPTIONS req_options[] = {
|
||||
{"reqexts", OPT_REQEXTS, 's',
|
||||
"Request extension section (override value in config file)"},
|
||||
{"precert", OPT_PRECERT, '-', "Add a poison extension (implies -new)"},
|
||||
|
||||
OPT_SECTION("Keys and Signing"),
|
||||
{"key", OPT_KEY, 's', "Private key to use"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Key file format"},
|
||||
{"pubkey", OPT_PUBKEY, '-', "Output public key"},
|
||||
{"keyout", OPT_KEYOUT, '>', "File to send the key to"},
|
||||
{"passin", OPT_PASSIN, 's', "Private key password source"},
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
{"newkey", OPT_NEWKEY, 's', "Specify as type:bits"},
|
||||
{"pkeyopt", OPT_PKEYOPT, 's', "Public key options as opt:value"},
|
||||
{"sigopt", OPT_SIGOPT, 's', "Signature parameter in n:v form"},
|
||||
{"", OPT_MD, '-', "Any supported digest"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
{"keygen_engine", OPT_KEYGEN_ENGINE, 's',
|
||||
"Specify engine to be used for key generation operations"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
{"sm2-id", OPT_SM2ID, 's',
|
||||
"Specify an ID string to verify an SM2 certificate request"},
|
||||
{"sm2-hex-id", OPT_SM2HEXID, 's',
|
||||
"Specify a hex ID string to verify an SM2 certificate request"},
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"outform", OPT_OUTFORM, 'F', "Output format - DER or PEM"},
|
||||
{"batch", OPT_BATCH, '-',
|
||||
"Do not ask anything during request generation"},
|
||||
{"verbose", OPT_VERBOSE, '-', "Verbose output"},
|
||||
{"nodes", OPT_NODES, '-', "Don't encrypt the output key"},
|
||||
{"noout", OPT_NOOUT, '-', "Do not output REQ"},
|
||||
{"newhdr", OPT_NEWHDR, '-', "Output \"NEW\" in the header lines"},
|
||||
{"modulus", OPT_MODULUS, '-', "RSA modulus"},
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -206,9 +214,12 @@ static int duplicated(LHASH_OF(OPENSSL_STRING) *addexts, char *kv)
|
||||
*p = '\0';
|
||||
|
||||
/* Finally have a clean "key"; see if it's there [by attempt to add it]. */
|
||||
if ((p = (char *)lh_OPENSSL_STRING_insert(addexts, (OPENSSL_STRING*)kv))
|
||||
!= NULL || lh_OPENSSL_STRING_error(addexts)) {
|
||||
OPENSSL_free(p != NULL ? p : kv);
|
||||
p = (char *)lh_OPENSSL_STRING_insert(addexts, (OPENSSL_STRING*)kv);
|
||||
if (p != NULL) {
|
||||
OPENSSL_free(p);
|
||||
return 1;
|
||||
} else if (lh_OPENSSL_STRING_error(addexts)) {
|
||||
OPENSSL_free(kv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -468,12 +479,14 @@ int req_main(int argc, char **argv)
|
||||
|
||||
if (verbose)
|
||||
BIO_printf(bio_err, "Using configuration from %s\n", template);
|
||||
req_conf = app_load_config(template);
|
||||
if ((req_conf = app_load_config(template)) == NULL)
|
||||
goto end;
|
||||
if (addext_bio) {
|
||||
if (verbose)
|
||||
BIO_printf(bio_err,
|
||||
"Using additional configuration from command line\n");
|
||||
addext_conf = app_load_config_bio(addext_bio, NULL);
|
||||
if ((addext_conf = app_load_config_bio(addext_bio, NULL)) == NULL)
|
||||
goto end;
|
||||
}
|
||||
if (template != default_config_file && !app_load_modules(req_conf))
|
||||
goto end;
|
||||
|
||||
+18
-11
@@ -37,29 +37,36 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS rsa_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"inform", OPT_INFORM, 'f', "Input format, one of DER PEM"},
|
||||
{"outform", OPT_OUTFORM, 'f', "Output format, one of DER PEM PVK"},
|
||||
{"check", OPT_CHECK, '-', "Verify key consistency"},
|
||||
{"", OPT_CIPHER, '-', "Any supported cipher"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, 's', "Input file"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"inform", OPT_INFORM, 'f', "Input format, one of DER PEM"},
|
||||
{"pubin", OPT_PUBIN, '-', "Expect a public key in input file"},
|
||||
{"pubout", OPT_PUBOUT, '-', "Output a public key"},
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"RSAPublicKey_in", OPT_RSAPUBKEY_IN, '-', "Input is an RSAPublicKey"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"outform", OPT_OUTFORM, 'f', "Output format, one of DER PEM PVK"},
|
||||
{"pubout", OPT_PUBOUT, '-', "Output a public key"},
|
||||
{"RSAPublicKey_out", OPT_RSAPUBKEY_OUT, '-', "Output is an RSAPublicKey"},
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
{"noout", OPT_NOOUT, '-', "Don't print key out"},
|
||||
{"text", OPT_TEXT, '-', "Print the key in text"},
|
||||
{"modulus", OPT_MODULUS, '-', "Print the RSA key modulus"},
|
||||
{"check", OPT_CHECK, '-', "Verify key consistency"},
|
||||
{"", OPT_CIPHER, '-', "Any supported cipher"},
|
||||
|
||||
# if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_RC4)
|
||||
OPT_SECTION("PVK"),
|
||||
{"pvk-strong", OPT_PVK_STRONG, '-', "Enable 'Strong' PVK encoding level (default)"},
|
||||
{"pvk-weak", OPT_PVK_WEAK, '-', "Enable 'Weak' PVK encoding level"},
|
||||
{"pvk-none", OPT_PVK_NONE, '-', "Don't enforce PVK encoding"},
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
{NULL}
|
||||
};
|
||||
|
||||
+17
-11
@@ -38,31 +38,37 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS rsautl_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"sign", OPT_SIGN, '-', "Sign with private key"},
|
||||
{"verify", OPT_VERIFY, '-', "Verify with public key"},
|
||||
{"encrypt", OPT_ENCRYPT, '-', "Encrypt with public key"},
|
||||
{"decrypt", OPT_DECRYPT, '-', "Decrypt with private key"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"inkey", OPT_INKEY, 's', "Input key"},
|
||||
{"keyform", OPT_KEYFORM, 'E', "Private key format - default PEM"},
|
||||
{"pubin", OPT_PUBIN, '-', "Input is an RSA public"},
|
||||
{"certin", OPT_CERTIN, '-', "Input is a cert carrying an RSA public key"},
|
||||
{"rev", OPT_REV, '-', "Reverse the order of the input buffer"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"ssl", OPT_SSL, '-', "Use SSL v2 padding"},
|
||||
{"raw", OPT_RSA_RAW, '-', "Use no padding"},
|
||||
{"pkcs", OPT_PKCS, '-', "Use PKCS#1 v1.5 padding (default)"},
|
||||
{"x931", OPT_X931, '-', "Use ANSI X9.31 padding"},
|
||||
{"oaep", OPT_OAEP, '-', "Use PKCS#1 OAEP"},
|
||||
{"sign", OPT_SIGN, '-', "Sign with private key"},
|
||||
{"verify", OPT_VERIFY, '-', "Verify with public key"},
|
||||
{"asn1parse", OPT_ASN1PARSE, '-',
|
||||
"Run output through asn1parse; useful with -verify"},
|
||||
{"hexdump", OPT_HEXDUMP, '-', "Hex dump output"},
|
||||
{"x931", OPT_X931, '-', "Use ANSI X9.31 padding"},
|
||||
{"rev", OPT_REV, '-', "Reverse the order of the input buffer"},
|
||||
{"encrypt", OPT_ENCRYPT, '-', "Encrypt with public key"},
|
||||
{"decrypt", OPT_DECRYPT, '-', "Decrypt with private key"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+131
-87
@@ -581,9 +581,11 @@ typedef enum OPTION_choice {
|
||||
OPT_SSL3, OPT_SSL_CONFIG,
|
||||
OPT_TLS1_3, OPT_TLS1_2, OPT_TLS1_1, OPT_TLS1, OPT_DTLS, OPT_DTLS1,
|
||||
OPT_DTLS1_2, OPT_SCTP, OPT_TIMEOUT, OPT_MTU, OPT_KEYFORM, OPT_PASS,
|
||||
OPT_CERT_CHAIN, OPT_CAPATH, OPT_NOCAPATH, OPT_CHAINCAPATH, OPT_VERIFYCAPATH,
|
||||
OPT_KEY, OPT_RECONNECT, OPT_BUILD_CHAIN, OPT_CAFILE, OPT_NOCAFILE,
|
||||
OPT_CHAINCAFILE, OPT_VERIFYCAFILE, OPT_NEXTPROTONEG, OPT_ALPN,
|
||||
OPT_CERT_CHAIN, OPT_KEY, OPT_RECONNECT, OPT_BUILD_CHAIN,
|
||||
OPT_NEXTPROTONEG, OPT_ALPN,
|
||||
OPT_CAPATH, OPT_NOCAPATH, OPT_CHAINCAPATH, OPT_VERIFYCAPATH,
|
||||
OPT_CAFILE, OPT_NOCAFILE, OPT_CHAINCAFILE, OPT_VERIFYCAFILE,
|
||||
OPT_CASTORE, OPT_NOCASTORE, OPT_CHAINCASTORE, OPT_VERIFYCASTORE,
|
||||
OPT_SERVERINFO, OPT_STARTTLS, OPT_SERVERNAME, OPT_NOSERVERNAME, OPT_ASYNC,
|
||||
OPT_USE_SRTP, OPT_KEYMATEXPORT, OPT_KEYMATEXPORTLEN, OPT_PROTOHOST,
|
||||
OPT_MAXFRAGLEN, OPT_MAX_SEND_FRAG, OPT_SPLIT_SEND_FRAG, OPT_MAX_PIPELINES,
|
||||
@@ -603,7 +605,23 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS s_client_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] [host:port]\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
{"ssl_client_engine", OPT_SSL_CLIENT_ENGINE, 's',
|
||||
"Specify engine to be used for client certificate operations"},
|
||||
#endif
|
||||
{"ssl_config", OPT_SSL_CONFIG, 's', "Use specified configuration file"},
|
||||
#ifndef OPENSSL_NO_CT
|
||||
{"ct", OPT_CT, '-', "Request and parse SCTs (also enables OCSP stapling)"},
|
||||
{"noct", OPT_NOCT, '-', "Do not request or parse SCTs (default)"},
|
||||
{"ctlogfile", OPT_CTLOG_FILE, '<', "CT log list CONF file"},
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Network"),
|
||||
{"host", OPT_HOST, 's', "Use -connect instead"},
|
||||
{"port", OPT_PORT, 'p', "Use -connect instead"},
|
||||
{"connect", OPT_CONNECT, 's',
|
||||
@@ -620,6 +638,18 @@ const OPTIONS s_client_options[] = {
|
||||
#ifdef AF_INET6
|
||||
{"6", OPT_6, '-', "Use IPv6 only"},
|
||||
#endif
|
||||
{"maxfraglen", OPT_MAXFRAGLEN, 'p',
|
||||
"Enable Maximum Fragment Length Negotiation (len values: 512, 1024, 2048 and 4096)"},
|
||||
{"max_send_frag", OPT_MAX_SEND_FRAG, 'p', "Maximum Size of send frames "},
|
||||
{"split_send_frag", OPT_SPLIT_SEND_FRAG, 'p',
|
||||
"Size used to split data for encrypt pipelines"},
|
||||
{"max_pipelines", OPT_MAX_PIPELINES, 'p',
|
||||
"Maximum number of encrypt/decrypt pipelines to be used"},
|
||||
{"read_buf", OPT_READ_BUF, 'p',
|
||||
"Default read buffer size to be used for connections"},
|
||||
{"fallback_scsv", OPT_FALLBACKSCSV, '-', "Send the fallback SCSV"},
|
||||
|
||||
OPT_SECTION("Identity"),
|
||||
{"verify", OPT_VERIFY, 'p', "Turn on peer certificate verification"},
|
||||
{"cert", OPT_CERT, '<', "Certificate file to use, PEM format assumed"},
|
||||
{"certform", OPT_CERTFORM, 'F',
|
||||
@@ -630,10 +660,13 @@ const OPTIONS s_client_options[] = {
|
||||
{"pass", OPT_PASS, 's', "Private key file pass phrase source"},
|
||||
{"CApath", OPT_CAPATH, '/', "PEM format directory of CA's"},
|
||||
{"CAfile", OPT_CAFILE, '<', "PEM format file of CA's"},
|
||||
{"CAstore", OPT_CAFILE, ':', "URI to store of CA's"},
|
||||
{"no-CAfile", OPT_NOCAFILE, '-',
|
||||
"Do not load the default certificates file"},
|
||||
{"no-CApath", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates directory"},
|
||||
{"no-CAstore", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates store"},
|
||||
{"requestCAfile", OPT_REQCAFILE, '<',
|
||||
"PEM format file of CA names to send to the server"},
|
||||
{"dane_tlsa_domain", OPT_DANE_TLSA_DOMAIN, 's', "DANE TLSA base domain"},
|
||||
@@ -641,16 +674,19 @@ const OPTIONS s_client_options[] = {
|
||||
"DANE TLSA rrdata presentation form"},
|
||||
{"dane_ee_no_namechecks", OPT_DANE_EE_NO_NAME, '-',
|
||||
"Disable name checks when matching DANE-EE(3) TLSA records"},
|
||||
{"psk_identity", OPT_PSK_IDENTITY, 's', "PSK identity"},
|
||||
{"psk", OPT_PSK, 's', "PSK in hex (without 0x)"},
|
||||
{"psk_session", OPT_PSK_SESS, '<', "File to read PSK SSL session from"},
|
||||
{"name", OPT_PROTOHOST, 's',
|
||||
"Hostname to use for \"-starttls lmtp\", \"-starttls smtp\" or \"-starttls xmpp[-server]\""},
|
||||
|
||||
OPT_SECTION("Session"),
|
||||
{"reconnect", OPT_RECONNECT, '-',
|
||||
"Drop and re-make the connection with the same Session-ID"},
|
||||
{"showcerts", OPT_SHOWCERTS, '-',
|
||||
"Show all certificates sent by the server"},
|
||||
{"debug", OPT_DEBUG, '-', "Extra output"},
|
||||
{"msg", OPT_MSG, '-', "Show protocol messages"},
|
||||
{"msgfile", OPT_MSGFILE, '>',
|
||||
"File to send output of -msg or -trace, instead of stdout"},
|
||||
{"nbio_test", OPT_NBIO_TEST, '-', "More ssl protocol testing"},
|
||||
{"state", OPT_STATE, '-', "Print the ssl states"},
|
||||
{"sess_out", OPT_SESS_OUT, '>', "File to write SSL session to"},
|
||||
{"sess_in", OPT_SESS_IN, '<', "File to read SSL session from"},
|
||||
|
||||
OPT_SECTION("Input/Output"),
|
||||
{"crlf", OPT_CRLF, '-', "Convert LF from terminal into CRLF"},
|
||||
{"quiet", OPT_QUIET, '-', "No s_client output"},
|
||||
{"ign_eof", OPT_IGN_EOF, '-', "Ignore input eof (default when -quiet)"},
|
||||
@@ -659,47 +695,35 @@ const OPTIONS s_client_options[] = {
|
||||
"Use the appropriate STARTTLS command before starting TLS"},
|
||||
{"xmpphost", OPT_XMPPHOST, 's',
|
||||
"Alias of -name option for \"-starttls xmpp[-server]\""},
|
||||
OPT_R_OPTIONS,
|
||||
{"sess_out", OPT_SESS_OUT, '>', "File to write SSL session to"},
|
||||
{"sess_in", OPT_SESS_IN, '<', "File to read SSL session from"},
|
||||
#ifndef OPENSSL_NO_SRTP
|
||||
{"use_srtp", OPT_USE_SRTP, 's',
|
||||
"Offer SRTP key management with a colon-separated profile list"},
|
||||
#endif
|
||||
{"keymatexport", OPT_KEYMATEXPORT, 's',
|
||||
"Export keying material using label"},
|
||||
{"keymatexportlen", OPT_KEYMATEXPORTLEN, 'p',
|
||||
"Export len bytes of keying material (default 20)"},
|
||||
{"maxfraglen", OPT_MAXFRAGLEN, 'p',
|
||||
"Enable Maximum Fragment Length Negotiation (len values: 512, 1024, 2048 and 4096)"},
|
||||
{"fallback_scsv", OPT_FALLBACKSCSV, '-', "Send the fallback SCSV"},
|
||||
{"name", OPT_PROTOHOST, 's',
|
||||
"Hostname to use for \"-starttls lmtp\", \"-starttls smtp\" or \"-starttls xmpp[-server]\""},
|
||||
{"CRL", OPT_CRL, '<', "CRL file to use"},
|
||||
{"crl_download", OPT_CRL_DOWNLOAD, '-', "Download CRL from distribution points"},
|
||||
{"CRLform", OPT_CRLFORM, 'F', "CRL format (PEM or DER) PEM is default"},
|
||||
{"verify_return_error", OPT_VERIFY_RET_ERROR, '-',
|
||||
"Close connection on verification error"},
|
||||
{"verify_quiet", OPT_VERIFY_QUIET, '-', "Restrict verify output to errors"},
|
||||
{"brief", OPT_BRIEF, '-',
|
||||
"Restrict output to brief summary of connection parameters"},
|
||||
{"prexit", OPT_PREXIT, '-',
|
||||
"Print session information when the program exits"},
|
||||
|
||||
OPT_SECTION("Debug"),
|
||||
{"showcerts", OPT_SHOWCERTS, '-',
|
||||
"Show all certificates sent by the server"},
|
||||
{"debug", OPT_DEBUG, '-', "Extra output"},
|
||||
{"msg", OPT_MSG, '-', "Show protocol messages"},
|
||||
{"msgfile", OPT_MSGFILE, '>',
|
||||
"File to send output of -msg or -trace, instead of stdout"},
|
||||
{"nbio_test", OPT_NBIO_TEST, '-', "More ssl protocol testing"},
|
||||
{"state", OPT_STATE, '-', "Print the ssl states"},
|
||||
{"keymatexport", OPT_KEYMATEXPORT, 's',
|
||||
"Export keying material using label"},
|
||||
{"keymatexportlen", OPT_KEYMATEXPORTLEN, 'p',
|
||||
"Export len bytes of keying material (default 20)"},
|
||||
{"security_debug", OPT_SECURITY_DEBUG, '-',
|
||||
"Enable security debug messages"},
|
||||
{"security_debug_verbose", OPT_SECURITY_DEBUG_VERBOSE, '-',
|
||||
"Output more security debug output"},
|
||||
{"cert_chain", OPT_CERT_CHAIN, '<',
|
||||
"Certificate chain file (in PEM format)"},
|
||||
{"chainCApath", OPT_CHAINCAPATH, '/',
|
||||
"Use dir as certificate store path to build CA certificate chain"},
|
||||
{"verifyCApath", OPT_VERIFYCAPATH, '/',
|
||||
"Use dir as certificate store path to verify CA certificate"},
|
||||
{"build_chain", OPT_BUILD_CHAIN, '-', "Build certificate chain"},
|
||||
{"chainCAfile", OPT_CHAINCAFILE, '<',
|
||||
"CA file for certificate chain (PEM format)"},
|
||||
{"verifyCAfile", OPT_VERIFYCAFILE, '<',
|
||||
"CA file for certificate verification (PEM format)"},
|
||||
#ifndef OPENSSL_NO_SSL_TRACE
|
||||
{"trace", OPT_TRACE, '-', "Show trace output of protocol messages"},
|
||||
#endif
|
||||
#ifdef WATT32
|
||||
{"wdebug", OPT_WDEBUG, '-', "WATT-32 tcp debugging"},
|
||||
#endif
|
||||
{"keylogfile", OPT_KEYLOG_FILE, '>', "Write TLS secrets to file"},
|
||||
{"nocommands", OPT_NOCMDS, '-', "Do not use interactive command letters"},
|
||||
{"servername", OPT_SERVERNAME, 's',
|
||||
"Set TLS extension servername (SNI) in ClientHello (default)"},
|
||||
@@ -715,17 +739,9 @@ const OPTIONS s_client_options[] = {
|
||||
{"alpn", OPT_ALPN, 's',
|
||||
"Enable ALPN extension, considering named protocols supported (comma-separated list)"},
|
||||
{"async", OPT_ASYNC, '-', "Support asynchronous operation"},
|
||||
{"ssl_config", OPT_SSL_CONFIG, 's', "Use specified configuration file"},
|
||||
{"max_send_frag", OPT_MAX_SEND_FRAG, 'p', "Maximum Size of send frames "},
|
||||
{"split_send_frag", OPT_SPLIT_SEND_FRAG, 'p',
|
||||
"Size used to split data for encrypt pipelines"},
|
||||
{"max_pipelines", OPT_MAX_PIPELINES, 'p',
|
||||
"Maximum number of encrypt/decrypt pipelines to be used"},
|
||||
{"read_buf", OPT_READ_BUF, 'p',
|
||||
"Default read buffer size to be used for connections"},
|
||||
OPT_S_OPTIONS,
|
||||
OPT_V_OPTIONS,
|
||||
OPT_X_OPTIONS,
|
||||
{"nbio", OPT_NBIO, '-', "Use non-blocking IO"},
|
||||
|
||||
OPT_SECTION("Protocol and version"),
|
||||
#ifndef OPENSSL_NO_SSL3
|
||||
{"ssl3", OPT_SSL3, '-', "Just use SSLv3"},
|
||||
#endif
|
||||
@@ -757,16 +773,16 @@ const OPTIONS s_client_options[] = {
|
||||
{"sctp", OPT_SCTP, '-', "Use SCTP"},
|
||||
{"sctp_label_bug", OPT_SCTP_LABEL_BUG, '-', "Enable SCTP label length bug"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SSL_TRACE
|
||||
{"trace", OPT_TRACE, '-', "Show trace output of protocol messages"},
|
||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||
{"nextprotoneg", OPT_NEXTPROTONEG, 's',
|
||||
"Enable NPN extension, considering named protocols supported (comma-separated list)"},
|
||||
#endif
|
||||
#ifdef WATT32
|
||||
{"wdebug", OPT_WDEBUG, '-', "WATT-32 tcp debugging"},
|
||||
{"early_data", OPT_EARLY_DATA, '<', "File to send as early data"},
|
||||
{"enable_pha", OPT_ENABLE_PHA, '-', "Enable post-handshake-authentication"},
|
||||
#ifndef OPENSSL_NO_SRTP
|
||||
{"use_srtp", OPT_USE_SRTP, 's',
|
||||
"Offer SRTP key management with a colon-separated profile list"},
|
||||
#endif
|
||||
{"nbio", OPT_NBIO, '-', "Use non-blocking IO"},
|
||||
{"psk_identity", OPT_PSK_IDENTITY, 's', "PSK identity"},
|
||||
{"psk", OPT_PSK, 's', "PSK in hex (without 0x)"},
|
||||
{"psk_session", OPT_PSK_SESS, '<', "File to read PSK SSL session from"},
|
||||
#ifndef OPENSSL_NO_SRP
|
||||
{"srpuser", OPT_SRPUSER, 's', "SRP authentication for 'user'"},
|
||||
{"srppass", OPT_SRPPASS, 's', "Password for 'user'"},
|
||||
@@ -776,24 +792,36 @@ const OPTIONS s_client_options[] = {
|
||||
"Tolerate other than the known g N values."},
|
||||
{"srp_strength", OPT_SRP_STRENGTH, 'p', "Minimal length in bits for N"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||
{"nextprotoneg", OPT_NEXTPROTONEG, 's',
|
||||
"Enable NPN extension, considering named protocols supported (comma-separated list)"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
{"ssl_client_engine", OPT_SSL_CLIENT_ENGINE, 's',
|
||||
"Specify engine to be used for client certificate operations"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CT
|
||||
{"ct", OPT_CT, '-', "Request and parse SCTs (also enables OCSP stapling)"},
|
||||
{"noct", OPT_NOCT, '-', "Do not request or parse SCTs (default)"},
|
||||
{"ctlogfile", OPT_CTLOG_FILE, '<', "CT log list CONF file"},
|
||||
#endif
|
||||
{"keylogfile", OPT_KEYLOG_FILE, '>', "Write TLS secrets to file"},
|
||||
{"early_data", OPT_EARLY_DATA, '<', "File to send as early data"},
|
||||
{"enable_pha", OPT_ENABLE_PHA, '-', "Enable post-handshake-authentication"},
|
||||
{NULL, OPT_EOF, 0x00, NULL}
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
OPT_S_OPTIONS,
|
||||
OPT_V_OPTIONS,
|
||||
{"CRL", OPT_CRL, '<', "CRL file to use"},
|
||||
{"crl_download", OPT_CRL_DOWNLOAD, '-', "Download CRL from distribution points"},
|
||||
{"CRLform", OPT_CRLFORM, 'F', "CRL format (PEM or DER) PEM is default"},
|
||||
{"verify_return_error", OPT_VERIFY_RET_ERROR, '-',
|
||||
"Close connection on verification error"},
|
||||
{"verify_quiet", OPT_VERIFY_QUIET, '-', "Restrict verify output to errors"},
|
||||
{"cert_chain", OPT_CERT_CHAIN, '<',
|
||||
"Certificate chain file (in PEM format)"},
|
||||
{"chainCApath", OPT_CHAINCAPATH, '/',
|
||||
"Use dir as certificate store path to build CA certificate chain"},
|
||||
{"chainCAstore", OPT_CHAINCASTORE, ':',
|
||||
"CA store URI for certificate chain"},
|
||||
{"verifyCAfile", OPT_VERIFYCAFILE, '<',
|
||||
"CA file for certificate verification (PEM format)"},
|
||||
{"verifyCApath", OPT_VERIFYCAPATH, '/',
|
||||
"Use dir as certificate store path to verify CA certificate"},
|
||||
{"verifyCAstore", OPT_VERIFYCASTORE, ':',
|
||||
"CA store URI for certificate verification"},
|
||||
{"build_chain", OPT_BUILD_CHAIN, '-', "Build certificate chain"},
|
||||
{"chainCAfile", OPT_CHAINCAFILE, '<',
|
||||
"CA file for certificate chain (PEM format)"},
|
||||
OPT_X_OPTIONS,
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"host:port", 0, 0, "Where to connect; same as -connect option"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
typedef enum PROTOCOL_choice {
|
||||
@@ -899,22 +927,23 @@ int s_client_main(int argc, char **argv)
|
||||
int dane_ee_no_name = 0;
|
||||
STACK_OF(X509_CRL) *crls = NULL;
|
||||
const SSL_METHOD *meth = TLS_client_method();
|
||||
const char *CApath = NULL, *CAfile = NULL;
|
||||
const char *CApath = NULL, *CAfile = NULL, *CAstore = NULL;
|
||||
char *cbuf = NULL, *sbuf = NULL, *mbuf = NULL;
|
||||
char *proxystr = NULL, *proxyuser = NULL;
|
||||
char *proxypassarg = NULL, *proxypass = NULL;
|
||||
char *connectstr = NULL, *bindstr = NULL;
|
||||
char *cert_file = NULL, *key_file = NULL, *chain_file = NULL;
|
||||
char *chCApath = NULL, *chCAfile = NULL, *host = NULL;
|
||||
char *chCApath = NULL, *chCAfile = NULL, *chCAstore = NULL, *host = NULL;
|
||||
char *port = OPENSSL_strdup(PORT);
|
||||
char *bindhost = NULL, *bindport = NULL;
|
||||
char *passarg = NULL, *pass = NULL, *vfyCApath = NULL, *vfyCAfile = NULL;
|
||||
char *passarg = NULL, *pass = NULL;
|
||||
char *vfyCApath = NULL, *vfyCAfile = NULL, *vfyCAstore = NULL;
|
||||
char *ReqCAfile = NULL;
|
||||
char *sess_in = NULL, *crl_file = NULL, *p;
|
||||
const char *protohost = NULL;
|
||||
struct timeval timeout, *timeoutp;
|
||||
fd_set readfds, writefds;
|
||||
int noCApath = 0, noCAfile = 0;
|
||||
int noCApath = 0, noCAfile = 0, noCAstore = 0;
|
||||
int build_chain = 0, cbuf_len, cbuf_off, cert_format = FORMAT_PEM;
|
||||
int key_format = FORMAT_PEM, crlf = 0, full_log = 1, mbuf_len = 0;
|
||||
int prexit = 0;
|
||||
@@ -1416,6 +1445,18 @@ int s_client_main(int argc, char **argv)
|
||||
case OPT_VERIFYCAFILE:
|
||||
vfyCAfile = opt_arg();
|
||||
break;
|
||||
case OPT_CASTORE:
|
||||
CAstore = opt_arg();
|
||||
break;
|
||||
case OPT_NOCASTORE:
|
||||
noCAstore = 1;
|
||||
break;
|
||||
case OPT_CHAINCASTORE:
|
||||
chCAstore = opt_arg();
|
||||
break;
|
||||
case OPT_VERIFYCASTORE:
|
||||
vfyCAstore = opt_arg();
|
||||
break;
|
||||
case OPT_DANE_TLSA_DOMAIN:
|
||||
dane_tlsa_domain = opt_arg();
|
||||
break;
|
||||
@@ -1796,7 +1837,9 @@ int s_client_main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!ssl_load_stores(ctx, vfyCApath, vfyCAfile, chCApath, chCAfile,
|
||||
if (!ssl_load_stores(ctx,
|
||||
vfyCApath, vfyCAfile, vfyCAstore,
|
||||
chCApath, chCAfile, chCAstore,
|
||||
crls, crl_download)) {
|
||||
BIO_printf(bio_err, "Error loading store locations\n");
|
||||
ERR_print_errors(bio_err);
|
||||
@@ -1925,7 +1968,8 @@ int s_client_main(int argc, char **argv)
|
||||
|
||||
SSL_CTX_set_verify(ctx, verify, verify_callback);
|
||||
|
||||
if (!ctx_set_verify_locations(ctx, CAfile, CApath, noCAfile, noCApath)) {
|
||||
if (!ctx_set_verify_locations(ctx, CAfile, noCAfile, CApath, noCApath,
|
||||
CAstore, noCAstore)) {
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
+134
-87
@@ -182,9 +182,6 @@ static unsigned int psk_server_cb(SSL *ssl, const char *identity,
|
||||
}
|
||||
#endif
|
||||
|
||||
#define TLS13_AES_128_GCM_SHA256_BYTES ((const unsigned char *)"\x13\x01")
|
||||
#define TLS13_AES_256_GCM_SHA384_BYTES ((const unsigned char *)"\x13\x02")
|
||||
|
||||
static int psk_find_session_cb(SSL *ssl, const unsigned char *identity,
|
||||
size_t identity_len, SSL_SESSION **sess)
|
||||
{
|
||||
@@ -738,7 +735,9 @@ typedef enum OPTION_choice {
|
||||
OPT_CAPATH, OPT_NOCAPATH, OPT_CHAINCAPATH, OPT_VERIFYCAPATH, OPT_NO_CACHE,
|
||||
OPT_EXT_CACHE, OPT_CRLFORM, OPT_VERIFY_RET_ERROR, OPT_VERIFY_QUIET,
|
||||
OPT_BUILD_CHAIN, OPT_CAFILE, OPT_NOCAFILE, OPT_CHAINCAFILE,
|
||||
OPT_VERIFYCAFILE, OPT_NBIO, OPT_NBIO_TEST, OPT_IGN_EOF, OPT_NO_IGN_EOF,
|
||||
OPT_VERIFYCAFILE,
|
||||
OPT_CASTORE, OPT_NOCASTORE, OPT_CHAINCASTORE, OPT_VERIFYCASTORE,
|
||||
OPT_NBIO, OPT_NBIO_TEST, OPT_IGN_EOF, OPT_NO_IGN_EOF,
|
||||
OPT_DEBUG, OPT_TLSEXTDEBUG, OPT_STATUS, OPT_STATUS_VERBOSE,
|
||||
OPT_STATUS_TIMEOUT, OPT_STATUS_URL, OPT_STATUS_FILE, OPT_MSG, OPT_MSGFILE,
|
||||
OPT_TRACE, OPT_SECURITY_DEBUG, OPT_SECURITY_DEBUG_VERBOSE, OPT_STATE,
|
||||
@@ -762,26 +761,50 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS s_server_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"ssl_config", OPT_SSL_CONFIG, 's',
|
||||
"Configure SSL_CTX using the configuration 'val'"},
|
||||
#ifndef OPENSSL_NO_SSL_TRACE
|
||||
{"trace", OPT_TRACE, '-', "trace protocol messages"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Network"),
|
||||
{"port", OPT_PORT, 'p',
|
||||
"TCP/IP port to listen on for connections (default is " PORT ")"},
|
||||
{"accept", OPT_ACCEPT, 's',
|
||||
"TCP/IP optional host and port to listen on for connections (default is *:" PORT ")"},
|
||||
#ifdef AF_UNIX
|
||||
{"unix", OPT_UNIX, 's', "Unix domain socket to accept on"},
|
||||
{"unlink", OPT_UNLINK, '-', "For -unix, unlink existing socket first"},
|
||||
#endif
|
||||
{"4", OPT_4, '-', "Use IPv4 only"},
|
||||
{"6", OPT_6, '-', "Use IPv6 only"},
|
||||
#ifdef AF_UNIX
|
||||
{"unlink", OPT_UNLINK, '-', "For -unix, unlink existing socket first"},
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Identity"),
|
||||
{"context", OPT_CONTEXT, 's', "Set session ID context"},
|
||||
{"CAfile", OPT_CAFILE, '<', "PEM format file of CA's"},
|
||||
{"CApath", OPT_CAPATH, '/', "PEM format directory of CA's"},
|
||||
{"CAstore", OPT_CASTORE, ':', "URI to store of CA's"},
|
||||
{"no-CAfile", OPT_NOCAFILE, '-',
|
||||
"Do not load the default certificates file"},
|
||||
{"no-CApath", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates directory"},
|
||||
{"no-CAstore", OPT_NOCASTORE, '-',
|
||||
"Do not load certificates from the default certificates store URI"},
|
||||
{"nocert", OPT_NOCERT, '-', "Don't use any certificates (Anon-DH)"},
|
||||
{"verify", OPT_VERIFY, 'n', "Turn on peer certificate verification"},
|
||||
{"Verify", OPT_UPPER_V_VERIFY, 'n',
|
||||
"Turn on peer certificate verification, must have a cert"},
|
||||
{"cert", OPT_CERT, '<', "Certificate file to use; default is " TEST_CERT},
|
||||
{"cert2", OPT_CERT2, '<',
|
||||
"Certificate file to use for servername; default is" TEST_CERT2},
|
||||
{"key2", OPT_KEY2, '<',
|
||||
"-Private Key file to use for servername if not in -cert2"},
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"},
|
||||
{"naccept", OPT_NACCEPT, 'p', "Terminate after #num connections"},
|
||||
{"serverinfo", OPT_SERVERINFO, 's',
|
||||
"PEM serverinfo file for certificate"},
|
||||
{"certform", OPT_CERTFORM, 'F',
|
||||
@@ -801,39 +824,24 @@ const OPTIONS s_server_options[] = {
|
||||
{"dkeyform", OPT_DKEYFORM, 'F',
|
||||
"Second key format (PEM, DER or ENGINE) PEM default"},
|
||||
{"dpass", OPT_DPASS, 's', "Second private key file pass phrase source"},
|
||||
{"servername", OPT_SERVERNAME, 's',
|
||||
"Servername for HostName TLS extension"},
|
||||
{"servername_fatal", OPT_SERVERNAME_FATAL, '-',
|
||||
"mismatch send fatal alert (default warning alert)"},
|
||||
|
||||
{"nbio_test", OPT_NBIO_TEST, '-', "Test with the non-blocking test bio"},
|
||||
{"crlf", OPT_CRLF, '-', "Convert LF from terminal into CRLF"},
|
||||
{"debug", OPT_DEBUG, '-', "Print more output"},
|
||||
{"msg", OPT_MSG, '-', "Show protocol messages"},
|
||||
{"msgfile", OPT_MSGFILE, '>',
|
||||
"File to send output of -msg or -trace, instead of stdout"},
|
||||
{"state", OPT_STATE, '-', "Print the SSL states"},
|
||||
{"CAfile", OPT_CAFILE, '<', "PEM format file of CA's"},
|
||||
{"CApath", OPT_CAPATH, '/', "PEM format directory of CA's"},
|
||||
{"no-CAfile", OPT_NOCAFILE, '-',
|
||||
"Do not load the default certificates file"},
|
||||
{"no-CApath", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates directory"},
|
||||
{"nocert", OPT_NOCERT, '-', "Don't use any certificates (Anon-DH)"},
|
||||
|
||||
{"quiet", OPT_QUIET, '-', "No server output"},
|
||||
{"no_resume_ephemeral", OPT_NO_RESUME_EPHEMERAL, '-',
|
||||
"Disable caching and tickets if ephemeral (EC)DH is used"},
|
||||
{"www", OPT_WWW, '-', "Respond to a 'GET /' with a status page"},
|
||||
{"WWW", OPT_UPPER_WWW, '-', "Respond to a 'GET with the file ./path"},
|
||||
{"servername", OPT_SERVERNAME, 's',
|
||||
"Servername for HostName TLS extension"},
|
||||
{"servername_fatal", OPT_SERVERNAME_FATAL, '-',
|
||||
"mismatch send fatal alert (default warning alert)"},
|
||||
{"cert2", OPT_CERT2, '<',
|
||||
"Certificate file to use for servername; default is" TEST_CERT2},
|
||||
{"key2", OPT_KEY2, '<',
|
||||
"-Private Key file to use for servername if not in -cert2"},
|
||||
{"tlsextdebug", OPT_TLSEXTDEBUG, '-',
|
||||
"Hex dump of all TLS extensions received"},
|
||||
{"HTTP", OPT_HTTP, '-', "Like -WWW but ./path includes HTTP headers"},
|
||||
{"id_prefix", OPT_ID_PREFIX, 's',
|
||||
"Generate SSL/TLS session IDs prefixed by arg"},
|
||||
OPT_R_OPTIONS,
|
||||
{"keymatexport", OPT_KEYMATEXPORT, 's',
|
||||
"Export keying material using label"},
|
||||
{"keymatexportlen", OPT_KEYMATEXPORTLEN, 'p',
|
||||
@@ -841,14 +849,14 @@ const OPTIONS s_server_options[] = {
|
||||
{"CRL", OPT_CRL, '<', "CRL file to use"},
|
||||
{"crl_download", OPT_CRL_DOWNLOAD, '-',
|
||||
"Download CRL from distribution points"},
|
||||
{"cert_chain", OPT_CERT_CHAIN, '<',
|
||||
"certificate chain file in PEM format"},
|
||||
{"dcert_chain", OPT_DCERT_CHAIN, '<',
|
||||
"second certificate chain file in PEM format"},
|
||||
{"chainCApath", OPT_CHAINCAPATH, '/',
|
||||
"use dir as certificate store path to build CA certificate chain"},
|
||||
{"chainCAstore", OPT_CHAINCASTORE, ':',
|
||||
"use URI as certificate store to build CA certificate chain"},
|
||||
{"verifyCApath", OPT_VERIFYCAPATH, '/',
|
||||
"use dir as certificate store path to verify CA certificate"},
|
||||
{"verifyCAstore", OPT_VERIFYCASTORE, ':',
|
||||
"use URI as certificate store to verify CA certificate"},
|
||||
{"no_cache", OPT_NO_CACHE, '-', "Disable session cache"},
|
||||
{"ext_cache", OPT_EXT_CACHE, '-',
|
||||
"Disable internal cache, setup and use external cache"},
|
||||
@@ -857,14 +865,13 @@ const OPTIONS s_server_options[] = {
|
||||
"Close connection on verification error"},
|
||||
{"verify_quiet", OPT_VERIFY_QUIET, '-',
|
||||
"No verify output except verify errors"},
|
||||
{"build_chain", OPT_BUILD_CHAIN, '-', "Build certificate chain"},
|
||||
{"chainCAfile", OPT_CHAINCAFILE, '<',
|
||||
"CA file for certificate chain (PEM format)"},
|
||||
{"verifyCAfile", OPT_VERIFYCAFILE, '<',
|
||||
"CA file for certificate verification (PEM format)"},
|
||||
{"ign_eof", OPT_IGN_EOF, '-', "ignore input eof (default when -quiet)"},
|
||||
{"no_ign_eof", OPT_NO_IGN_EOF, '-', "Do not ignore input eof"},
|
||||
|
||||
#ifndef OPENSSL_NO_OCSP
|
||||
OPT_SECTION("OCSP"),
|
||||
{"status", OPT_STATUS, '-', "Request certificate status from server"},
|
||||
{"status_verbose", OPT_STATUS_VERBOSE, '-',
|
||||
"Print more output in certificate status callback"},
|
||||
@@ -874,9 +881,8 @@ const OPTIONS s_server_options[] = {
|
||||
{"status_file", OPT_STATUS_FILE, '<',
|
||||
"File containing DER encoded OCSP Response"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SSL_TRACE
|
||||
{"trace", OPT_TRACE, '-', "trace protocol messages"},
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Debug"),
|
||||
{"security_debug", OPT_SECURITY_DEBUG, '-',
|
||||
"Print output from SSL/TLS security framework"},
|
||||
{"security_debug_verbose", OPT_SECURITY_DEBUG_VERBOSE, '-',
|
||||
@@ -885,20 +891,28 @@ const OPTIONS s_server_options[] = {
|
||||
"Restrict output to brief summary of connection parameters"},
|
||||
{"rev", OPT_REV, '-',
|
||||
"act as a simple test server which just sends back with the received text reversed"},
|
||||
{"debug", OPT_DEBUG, '-', "Print more output"},
|
||||
{"msg", OPT_MSG, '-', "Show protocol messages"},
|
||||
{"msgfile", OPT_MSGFILE, '>',
|
||||
"File to send output of -msg or -trace, instead of stdout"},
|
||||
{"state", OPT_STATE, '-', "Print the SSL states"},
|
||||
{"async", OPT_ASYNC, '-', "Operate in asynchronous mode"},
|
||||
{"ssl_config", OPT_SSL_CONFIG, 's',
|
||||
"Configure SSL_CTX using the configuration 'val'"},
|
||||
{"max_send_frag", OPT_MAX_SEND_FRAG, 'p', "Maximum Size of send frames "},
|
||||
{"split_send_frag", OPT_SPLIT_SEND_FRAG, 'p',
|
||||
"Size used to split data for encrypt pipelines"},
|
||||
{"max_pipelines", OPT_MAX_PIPELINES, 'p',
|
||||
"Maximum number of encrypt/decrypt pipelines to be used"},
|
||||
{"naccept", OPT_NACCEPT, 'p', "Terminate after #num connections"},
|
||||
{"keylogfile", OPT_KEYLOG_FILE, '>', "Write TLS secrets to file"},
|
||||
|
||||
OPT_SECTION("Network"),
|
||||
{"nbio", OPT_NBIO, '-', "Use non-blocking IO"},
|
||||
{"timeout", OPT_TIMEOUT, '-', "Enable timeouts"},
|
||||
{"mtu", OPT_MTU, 'p', "Set link layer MTU"},
|
||||
{"read_buf", OPT_READ_BUF, 'p',
|
||||
"Default read buffer size to be used for connections"},
|
||||
OPT_S_OPTIONS,
|
||||
OPT_V_OPTIONS,
|
||||
OPT_X_OPTIONS,
|
||||
{"nbio", OPT_NBIO, '-', "Use non-blocking IO"},
|
||||
{"split_send_frag", OPT_SPLIT_SEND_FRAG, 'p',
|
||||
"Size used to split data for encrypt pipelines"},
|
||||
{"max_send_frag", OPT_MAX_SEND_FRAG, 'p', "Maximum Size of send frames "},
|
||||
|
||||
OPT_SECTION("Server identity"),
|
||||
{"psk_identity", OPT_PSK_IDENTITY, 's', "PSK identity to expect"},
|
||||
#ifndef OPENSSL_NO_PSK
|
||||
{"psk_hint", OPT_PSK_HINT, 's', "PSK identity hint to use"},
|
||||
@@ -910,6 +924,19 @@ const OPTIONS s_server_options[] = {
|
||||
{"srpuserseed", OPT_SRPUSERSEED, 's',
|
||||
"A seed string for a default user salt"},
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Protocol and version"),
|
||||
{"max_early_data", OPT_MAX_EARLY, 'n',
|
||||
"The maximum number of bytes of early data as advertised in tickets"},
|
||||
{"recv_max_early_data", OPT_RECV_MAX_EARLY, 'n',
|
||||
"The maximum number of bytes of early data (hard limit)"},
|
||||
{"early_data", OPT_EARLY_DATA, '-', "Attempt to read early data"},
|
||||
{"num_tickets", OPT_S_NUM_TICKETS, 'n',
|
||||
"The number of TLSv1.3 session tickets that a server will automatically issue" },
|
||||
{"anti_replay", OPT_ANTI_REPLAY, '-', "Switch on anti-replay protection (default)"},
|
||||
{"no_anti_replay", OPT_NO_ANTI_REPLAY, '-', "Switch off anti-replay protection"},
|
||||
{"http_server_binmode", OPT_HTTP_SERVER_BINMODE, '-', "opening files in binary mode when acting as http server (-WWW and -HTTP)"},
|
||||
{"stateless", OPT_STATELESS, '-', "Require TLSv1.3 cookies"},
|
||||
#ifndef OPENSSL_NO_SSL3
|
||||
{"ssl3", OPT_SSL3, '-', "Just talk SSLv3"},
|
||||
#endif
|
||||
@@ -927,12 +954,9 @@ const OPTIONS s_server_options[] = {
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DTLS
|
||||
{"dtls", OPT_DTLS, '-', "Use any DTLS version"},
|
||||
{"timeout", OPT_TIMEOUT, '-', "Enable timeouts"},
|
||||
{"mtu", OPT_MTU, 'p', "Set link layer MTU"},
|
||||
{"listen", OPT_LISTEN, '-',
|
||||
"Listen for a DTLS ClientHello with a cookie and then connect"},
|
||||
#endif
|
||||
{"stateless", OPT_STATELESS, '-', "Require TLSv1.3 cookies"},
|
||||
#ifndef OPENSSL_NO_DTLS1
|
||||
{"dtls1", OPT_DTLS1, '-', "Just talk DTLSv1"},
|
||||
#endif
|
||||
@@ -943,34 +967,32 @@ const OPTIONS s_server_options[] = {
|
||||
{"sctp", OPT_SCTP, '-', "Use SCTP"},
|
||||
{"sctp_label_bug", OPT_SCTP_LABEL_BUG, '-', "Enable SCTP label length bug"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SRTP
|
||||
{"use_srtp", OPT_SRTP_PROFILES, 's',
|
||||
"Offer SRTP key management with a colon-separated profile list"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DH
|
||||
{"no_dhe", OPT_NO_DHE, '-', "Disable ephemeral DH"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||
{"nextprotoneg", OPT_NEXTPROTONEG, 's',
|
||||
"Set the advertised protocols for the NPN extension (comma-separated list)"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SRTP
|
||||
{"use_srtp", OPT_SRTP_PROFILES, 's',
|
||||
"Offer SRTP key management with a colon-separated profile list"},
|
||||
#endif
|
||||
{"alpn", OPT_ALPN, 's',
|
||||
"Set the advertised protocols for the ALPN extension (comma-separated list)"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
{"keylogfile", OPT_KEYLOG_FILE, '>', "Write TLS secrets to file"},
|
||||
{"max_early_data", OPT_MAX_EARLY, 'n',
|
||||
"The maximum number of bytes of early data as advertised in tickets"},
|
||||
{"recv_max_early_data", OPT_RECV_MAX_EARLY, 'n',
|
||||
"The maximum number of bytes of early data (hard limit)"},
|
||||
{"early_data", OPT_EARLY_DATA, '-', "Attempt to read early data"},
|
||||
{"num_tickets", OPT_S_NUM_TICKETS, 'n',
|
||||
"The number of TLSv1.3 session tickets that a server will automatically issue" },
|
||||
{"anti_replay", OPT_ANTI_REPLAY, '-', "Switch on anti-replay protection (default)"},
|
||||
{"no_anti_replay", OPT_NO_ANTI_REPLAY, '-', "Switch off anti-replay protection"},
|
||||
{"http_server_binmode", OPT_HTTP_SERVER_BINMODE, '-', "opening files in binary mode when acting as http server (-WWW and -HTTP)"},
|
||||
{NULL, OPT_EOF, 0, NULL}
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
OPT_S_OPTIONS,
|
||||
OPT_V_OPTIONS,
|
||||
{"cert_chain", OPT_CERT_CHAIN, '<',
|
||||
"certificate chain file in PEM format"},
|
||||
{"dcert_chain", OPT_DCERT_CHAIN, '<',
|
||||
"second certificate chain file in PEM format"},
|
||||
{"build_chain", OPT_BUILD_CHAIN, '-', "Build certificate chain"},
|
||||
{"chainCAfile", OPT_CHAINCAFILE, '<',
|
||||
"CA file for certificate chain (PEM format)"},
|
||||
OPT_X_OPTIONS,
|
||||
{NULL}
|
||||
};
|
||||
|
||||
#define IS_PROT_FLAG(o) \
|
||||
@@ -989,9 +1011,11 @@ int s_server_main(int argc, char *argv[])
|
||||
STACK_OF(X509_CRL) *crls = NULL;
|
||||
X509 *s_cert = NULL, *s_dcert = NULL;
|
||||
X509_VERIFY_PARAM *vpm = NULL;
|
||||
const char *CApath = NULL, *CAfile = NULL, *chCApath = NULL, *chCAfile = NULL;
|
||||
const char *CApath = NULL, *CAfile = NULL, *CAstore = NULL;
|
||||
const char *chCApath = NULL, *chCAfile = NULL, *chCAstore = NULL;
|
||||
char *dpassarg = NULL, *dpass = NULL;
|
||||
char *passarg = NULL, *pass = NULL, *vfyCApath = NULL, *vfyCAfile = NULL;
|
||||
char *passarg = NULL, *pass = NULL;
|
||||
char *vfyCApath = NULL, *vfyCAfile = NULL, *vfyCAstore = NULL;
|
||||
char *crl_file = NULL, *prog;
|
||||
#ifdef AF_UNIX
|
||||
int unlink_unix_path = 0;
|
||||
@@ -1003,14 +1027,14 @@ int s_server_main(int argc, char *argv[])
|
||||
int no_dhe = 0;
|
||||
#endif
|
||||
int nocert = 0, ret = 1;
|
||||
int noCApath = 0, noCAfile = 0;
|
||||
int noCApath = 0, noCAfile = 0, noCAstore = 0;
|
||||
int s_cert_format = FORMAT_PEM, s_key_format = FORMAT_PEM;
|
||||
int s_dcert_format = FORMAT_PEM, s_dkey_format = FORMAT_PEM;
|
||||
int rev = 0, naccept = -1, sdebug = 0;
|
||||
int socket_family = AF_UNSPEC, socket_type = SOCK_STREAM, protocol = 0;
|
||||
int state = 0, crl_format = FORMAT_PEM, crl_download = 0;
|
||||
char *host = NULL;
|
||||
char *port = BUF_strdup(PORT);
|
||||
char *port = OPENSSL_strdup(PORT);
|
||||
unsigned char *context = NULL;
|
||||
OPTION_CHOICE o;
|
||||
EVP_PKEY *s_key2 = NULL;
|
||||
@@ -1159,7 +1183,7 @@ int s_server_main(int argc, char *argv[])
|
||||
#ifdef AF_UNIX
|
||||
case OPT_UNIX:
|
||||
socket_family = AF_UNIX;
|
||||
OPENSSL_free(host); host = BUF_strdup(opt_arg());
|
||||
OPENSSL_free(host); host = OPENSSL_strdup(opt_arg());
|
||||
OPENSSL_free(port); port = NULL;
|
||||
break;
|
||||
case OPT_UNLINK:
|
||||
@@ -1261,6 +1285,18 @@ int s_server_main(int argc, char *argv[])
|
||||
case OPT_VERIFYCAPATH:
|
||||
vfyCApath = opt_arg();
|
||||
break;
|
||||
case OPT_CASTORE:
|
||||
CAstore = opt_arg();
|
||||
break;
|
||||
case OPT_NOCASTORE:
|
||||
noCAstore = 1;
|
||||
break;
|
||||
case OPT_CHAINCASTORE:
|
||||
chCAstore = opt_arg();
|
||||
break;
|
||||
case OPT_VERIFYCASTORE:
|
||||
vfyCAstore = opt_arg();
|
||||
break;
|
||||
case OPT_NO_CACHE:
|
||||
no_cache = 1;
|
||||
break;
|
||||
@@ -1883,7 +1919,8 @@ int s_server_main(int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!ctx_set_verify_locations(ctx, CAfile, CApath, noCAfile, noCApath)) {
|
||||
if (!ctx_set_verify_locations(ctx, CAfile, noCAfile, CApath, noCApath,
|
||||
CAstore, noCAstore)) {
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
@@ -1895,7 +1932,9 @@ int s_server_main(int argc, char *argv[])
|
||||
|
||||
ssl_ctx_add_crls(ctx, crls, 0);
|
||||
|
||||
if (!ssl_load_stores(ctx, vfyCApath, vfyCAfile, chCApath, chCAfile,
|
||||
if (!ssl_load_stores(ctx,
|
||||
vfyCApath, vfyCAfile, vfyCAstore,
|
||||
chCApath, chCAfile, chCAstore,
|
||||
crls, crl_download)) {
|
||||
BIO_printf(bio_err, "Error loading store locations\n");
|
||||
ERR_print_errors(bio_err);
|
||||
@@ -1944,8 +1983,8 @@ int s_server_main(int argc, char *argv[])
|
||||
if (async)
|
||||
SSL_CTX_set_mode(ctx2, SSL_MODE_ASYNC);
|
||||
|
||||
if (!ctx_set_verify_locations(ctx2, CAfile, CApath, noCAfile,
|
||||
noCApath)) {
|
||||
if (!ctx_set_verify_locations(ctx2, CAfile, noCAfile, CApath,
|
||||
noCApath, CAstore, noCAstore)) {
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
@@ -2555,8 +2594,8 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
|
||||
continue;
|
||||
}
|
||||
if (buf[0] == 'P') {
|
||||
static const char *str = "Lets print some clear text\n";
|
||||
BIO_write(SSL_get_wbio(con), str, strlen(str));
|
||||
static const char str[] = "Lets print some clear text\n";
|
||||
BIO_write(SSL_get_wbio(con), str, sizeof(str) -1);
|
||||
}
|
||||
if (buf[0] == 'S') {
|
||||
print_stats(bio_s_out, SSL_get_SSL_CTX(con));
|
||||
@@ -3214,6 +3253,12 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
|
||||
if (e[0] == ' ')
|
||||
break;
|
||||
|
||||
if (e[0] == ':') {
|
||||
/* Windows drive. We treat this the same way as ".." */
|
||||
dot = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (dot) {
|
||||
case 1:
|
||||
dot = (e[0] == '.') ? 2 : 0;
|
||||
@@ -3222,11 +3267,11 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
|
||||
dot = (e[0] == '.') ? 3 : 0;
|
||||
break;
|
||||
case 3:
|
||||
dot = (e[0] == '/') ? -1 : 0;
|
||||
dot = (e[0] == '/' || e[0] == '\\') ? -1 : 0;
|
||||
break;
|
||||
}
|
||||
if (dot == 0)
|
||||
dot = (e[0] == '/') ? 1 : 0;
|
||||
dot = (e[0] == '/' || e[0] == '\\') ? 1 : 0;
|
||||
}
|
||||
dot = (dot == 3) || (dot == -1); /* filename contains ".."
|
||||
* component */
|
||||
@@ -3240,11 +3285,11 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
|
||||
|
||||
if (dot) {
|
||||
BIO_puts(io, text);
|
||||
BIO_printf(io, "'%s' contains '..' reference\r\n", p);
|
||||
BIO_printf(io, "'%s' contains '..' or ':'\r\n", p);
|
||||
break;
|
||||
}
|
||||
|
||||
if (*p == '/') {
|
||||
if (*p == '/' || *p == '\\') {
|
||||
BIO_puts(io, text);
|
||||
BIO_printf(io, "'%s' is an invalid path\r\n", p);
|
||||
break;
|
||||
@@ -3499,6 +3544,8 @@ static int generate_session_id(SSL *ssl, unsigned char *id,
|
||||
unsigned int *id_len)
|
||||
{
|
||||
unsigned int count = 0;
|
||||
unsigned int session_id_prefix_len = strlen(session_id_prefix);
|
||||
|
||||
do {
|
||||
if (RAND_bytes(id, *id_len) <= 0)
|
||||
return 0;
|
||||
@@ -3510,8 +3557,8 @@ static int generate_session_id(SSL *ssl, unsigned char *id,
|
||||
* conflicts.
|
||||
*/
|
||||
memcpy(id, session_id_prefix,
|
||||
(strlen(session_id_prefix) < *id_len) ?
|
||||
strlen(session_id_prefix) : *id_len);
|
||||
(session_id_prefix_len < *id_len) ?
|
||||
session_id_prefix_len : *id_len);
|
||||
}
|
||||
while (SSL_has_matching_session_id(ssl, id, *id_len) &&
|
||||
(++count < MAX_SESSION_ID_ATTEMPTS));
|
||||
|
||||
+39
-21
@@ -45,34 +45,25 @@ static const size_t fmt_http_get_cmd_size = sizeof(fmt_http_get_cmd) - 2;
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
OPT_CONNECT, OPT_CIPHER, OPT_CIPHERSUITES, OPT_CERT, OPT_NAMEOPT, OPT_KEY,
|
||||
OPT_CAPATH, OPT_CAFILE, OPT_NOCAPATH, OPT_NOCAFILE, OPT_NEW, OPT_REUSE,
|
||||
OPT_BUGS, OPT_VERIFY, OPT_TIME, OPT_SSL3,
|
||||
OPT_CAPATH, OPT_CAFILE, OPT_CASTORE,
|
||||
OPT_NOCAPATH, OPT_NOCAFILE, OPT_NOCASTORE,
|
||||
OPT_NEW, OPT_REUSE, OPT_BUGS, OPT_VERIFY, OPT_TIME, OPT_SSL3,
|
||||
OPT_WWW, OPT_TLS1, OPT_TLS1_1, OPT_TLS1_2, OPT_TLS1_3
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS s_time_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
|
||||
OPT_SECTION("Connection"),
|
||||
{"connect", OPT_CONNECT, 's',
|
||||
"Where to connect as post:port (default is " SSL_CONNECT_NAME ")"},
|
||||
{"cipher", OPT_CIPHER, 's', "TLSv1.2 and below cipher list to be used"},
|
||||
{"ciphersuites", OPT_CIPHERSUITES, 's',
|
||||
"Specify TLSv1.3 ciphersuites to be used"},
|
||||
{"cert", OPT_CERT, '<', "Cert file to use, PEM format assumed"},
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"},
|
||||
{"key", OPT_KEY, '<', "File with key, PEM; default is -cert file"},
|
||||
{"CApath", OPT_CAPATH, '/', "PEM format directory of CA's"},
|
||||
{"cafile", OPT_CAFILE, '<', "PEM format file of CA's"},
|
||||
{"no-CAfile", OPT_NOCAFILE, '-',
|
||||
"Do not load the default certificates file"},
|
||||
{"no-CApath", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates directory"},
|
||||
{"new", OPT_NEW, '-', "Just time new connections"},
|
||||
{"reuse", OPT_REUSE, '-', "Just time connection reuse"},
|
||||
{"bugs", OPT_BUGS, '-', "Turn on SSL bug compatibility"},
|
||||
{"verify", OPT_VERIFY, 'p',
|
||||
"Turn on peer certificate verification, set depth"},
|
||||
{"time", OPT_TIME, 'p', "Seconds to collect data, default " SECONDSSTR},
|
||||
{"www", OPT_WWW, 's', "Fetch specified page from the site"},
|
||||
{"cipher", OPT_CIPHER, 's', "TLSv1.2 and below cipher list to be used"},
|
||||
{"ciphersuites", OPT_CIPHERSUITES, 's',
|
||||
"Specify TLSv1.3 ciphersuites to be used"},
|
||||
#ifndef OPENSSL_NO_SSL3
|
||||
{"ssl3", OPT_SSL3, '-', "Just use SSLv3"},
|
||||
#endif
|
||||
@@ -88,6 +79,25 @@ const OPTIONS s_time_options[] = {
|
||||
#ifndef OPENSSL_NO_TLS1_3
|
||||
{"tls1_3", OPT_TLS1_3, '-', "Just use TLSv1.3"},
|
||||
#endif
|
||||
{"verify", OPT_VERIFY, 'p',
|
||||
"Turn on peer certificate verification, set depth"},
|
||||
{"time", OPT_TIME, 'p', "Seconds to collect data, default " SECONDSSTR},
|
||||
{"www", OPT_WWW, 's', "Fetch specified page from the site"},
|
||||
|
||||
OPT_SECTION("Certificate"),
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"},
|
||||
{"cert", OPT_CERT, '<', "Cert file to use, PEM format assumed"},
|
||||
{"key", OPT_KEY, '<', "File with key, PEM; default is -cert file"},
|
||||
{"cafile", OPT_CAFILE, '<', "PEM format file of CA's"},
|
||||
{"CApath", OPT_CAPATH, '/', "PEM format directory of CA's"},
|
||||
{"CAstore", OPT_CASTORE, ':', "URI to store of CA's"},
|
||||
{"no-CAfile", OPT_NOCAFILE, '-',
|
||||
"Do not load the default certificates file"},
|
||||
{"no-CApath", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates directory"},
|
||||
{"no-CAstore", OPT_NOCASTORE, '-',
|
||||
"Do not load certificates from the default certificates store URI"},
|
||||
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -105,11 +115,12 @@ int s_time_main(int argc, char **argv)
|
||||
SSL *scon = NULL;
|
||||
SSL_CTX *ctx = NULL;
|
||||
const SSL_METHOD *meth = NULL;
|
||||
char *CApath = NULL, *CAfile = NULL, *cipher = NULL, *ciphersuites = NULL;
|
||||
char *CApath = NULL, *CAfile = NULL, *CAstore = NULL;
|
||||
char *cipher = NULL, *ciphersuites = NULL;
|
||||
char *www_path = NULL;
|
||||
char *host = SSL_CONNECT_NAME, *certfile = NULL, *keyfile = NULL, *prog;
|
||||
double totalTime = 0.0;
|
||||
int noCApath = 0, noCAfile = 0;
|
||||
int noCApath = 0, noCAfile = 0, noCAstore = 0;
|
||||
int maxtime = SECONDS, nConn = 0, perform = 3, ret = 1, i, st_bugs = 0;
|
||||
long bytes_read = 0, finishtime = 0;
|
||||
OPTION_CHOICE o;
|
||||
@@ -167,6 +178,12 @@ int s_time_main(int argc, char **argv)
|
||||
case OPT_NOCAFILE:
|
||||
noCAfile = 1;
|
||||
break;
|
||||
case OPT_CASTORE:
|
||||
CAstore = opt_arg();
|
||||
break;
|
||||
case OPT_NOCASTORE:
|
||||
noCAstore = 1;
|
||||
break;
|
||||
case OPT_CIPHER:
|
||||
cipher = opt_arg();
|
||||
break;
|
||||
@@ -236,7 +253,8 @@ int s_time_main(int argc, char **argv)
|
||||
if (!set_cert_stuff(ctx, certfile, keyfile))
|
||||
goto end;
|
||||
|
||||
if (!ctx_set_verify_locations(ctx, CAfile, CApath, noCAfile, noCApath)) {
|
||||
if (!ctx_set_verify_locations(ctx, CAfile, noCAfile, CApath, noCApath,
|
||||
CAstore, noCAstore)) {
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
+8
-3
@@ -25,16 +25,21 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS sess_id_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"context", OPT_CONTEXT, 's', "Set the session ID context"},
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, 's', "Input file - default stdin"},
|
||||
{"inform", OPT_INFORM, 'F', "Input format - default PEM (DER or PEM)"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file - default stdout"},
|
||||
{"outform", OPT_OUTFORM, 'f',
|
||||
"Output format - default PEM (PEM, DER or NSS)"},
|
||||
{"in", OPT_IN, 's', "Input file - default stdin"},
|
||||
{"out", OPT_OUT, '>', "Output file - default stdout"},
|
||||
{"text", OPT_TEXT, '-', "Print ssl session id details"},
|
||||
{"cert", OPT_CERT, '-', "Output certificate "},
|
||||
{"noout", OPT_NOOUT, '-', "Don't output the encoded session info"},
|
||||
{"context", OPT_CONTEXT, 's', "Set the session ID context"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+64
-39
@@ -41,71 +41,89 @@ typedef enum OPTION_choice {
|
||||
OPT_CRLFEOL, OPT_ENGINE, OPT_PASSIN,
|
||||
OPT_TO, OPT_FROM, OPT_SUBJECT, OPT_SIGNER, OPT_RECIP, OPT_MD,
|
||||
OPT_CIPHER, OPT_INKEY, OPT_KEYFORM, OPT_CERTFILE, OPT_CAFILE,
|
||||
OPT_CAPATH, OPT_CASTORE, OPT_NOCAFILE, OPT_NOCAPATH, OPT_NOCASTORE,
|
||||
OPT_R_ENUM,
|
||||
OPT_V_ENUM,
|
||||
OPT_CAPATH, OPT_NOCAFILE, OPT_NOCAPATH, OPT_IN, OPT_INFORM, OPT_OUT,
|
||||
OPT_IN, OPT_INFORM, OPT_OUT,
|
||||
OPT_OUTFORM, OPT_CONTENT
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS smime_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] cert.pem...\n"},
|
||||
{OPT_HELP_STR, 1, '-',
|
||||
" cert.pem... recipient certs for encryption\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Valid options are:\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] [cert...]\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"encrypt", OPT_ENCRYPT, '-', "Encrypt message"},
|
||||
{"decrypt", OPT_DECRYPT, '-', "Decrypt encrypted message"},
|
||||
{"sign", OPT_SIGN, '-', "Sign message"},
|
||||
{"verify", OPT_VERIFY, '-', "Verify signed message"},
|
||||
{"pk7out", OPT_PK7OUT, '-', "Output PKCS#7 structure"},
|
||||
{"nointern", OPT_NOINTERN, '-',
|
||||
"Don't search certificates in message for signer"},
|
||||
{"nosigs", OPT_NOSIGS, '-', "Don't verify message signature"},
|
||||
{"noverify", OPT_NOVERIFY, '-', "Don't verify signers certificate"},
|
||||
{"nocerts", OPT_NOCERTS, '-',
|
||||
"Don't include signers certificate when signing"},
|
||||
{"nodetach", OPT_NODETACH, '-', "Use opaque signing"},
|
||||
{"noattr", OPT_NOATTR, '-', "Don't include any signed attributes"},
|
||||
{"binary", OPT_BINARY, '-', "Don't translate message to text"},
|
||||
{"certfile", OPT_CERTFILE, '<', "Other certificates file"},
|
||||
{"signer", OPT_SIGNER, 's', "Signer certificate file"},
|
||||
{"recip", OPT_RECIP, '<', "Recipient certificate file for decryption"},
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"inform", OPT_INFORM, 'c', "Input format SMIME (default), PEM or DER"},
|
||||
{"inkey", OPT_INKEY, 's',
|
||||
"Input private key (if not signer or recipient)"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Input private key format (PEM or ENGINE)"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"outform", OPT_OUTFORM, 'c',
|
||||
"Output format SMIME (default), PEM or DER"},
|
||||
{"inkey", OPT_INKEY, 's',
|
||||
"Input private key (if not signer or recipient)"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Input private key format (PEM or ENGINE)"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
{"stream", OPT_STREAM, '-', "Enable CMS streaming" },
|
||||
{"indef", OPT_INDEF, '-', "Same as -stream" },
|
||||
{"noindef", OPT_NOINDEF, '-', "Disable CMS streaming"},
|
||||
|
||||
OPT_SECTION("Action"),
|
||||
{"encrypt", OPT_ENCRYPT, '-', "Encrypt message"},
|
||||
{"decrypt", OPT_DECRYPT, '-', "Decrypt encrypted message"},
|
||||
{"sign", OPT_SIGN, '-', "Sign message"},
|
||||
{"resign", OPT_RESIGN, '-', "Resign a signed message"},
|
||||
{"verify", OPT_VERIFY, '-', "Verify signed message"},
|
||||
|
||||
OPT_SECTION("Signing/Encryption"),
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"md", OPT_MD, 's', "Digest algorithm to use when signing or resigning"},
|
||||
{"", OPT_CIPHER, '-', "Any supported cipher"},
|
||||
{"pk7out", OPT_PK7OUT, '-', "Output PKCS#7 structure"},
|
||||
{"nointern", OPT_NOINTERN, '-',
|
||||
"Don't search certificates in message for signer"},
|
||||
{"nodetach", OPT_NODETACH, '-', "Use opaque signing"},
|
||||
{"noattr", OPT_NOATTR, '-', "Don't include any signed attributes"},
|
||||
{"binary", OPT_BINARY, '-', "Don't translate message to text"},
|
||||
{"signer", OPT_SIGNER, 's', "Signer certificate file"},
|
||||
{"content", OPT_CONTENT, '<',
|
||||
"Supply or override content for detached signature"},
|
||||
{"nocerts", OPT_NOCERTS, '-',
|
||||
"Don't include signers certificate when signing"},
|
||||
|
||||
OPT_SECTION("Verification/Decryption"),
|
||||
{"nosigs", OPT_NOSIGS, '-', "Don't verify message signature"},
|
||||
{"noverify", OPT_NOVERIFY, '-', "Don't verify signers certificate"},
|
||||
|
||||
{"certfile", OPT_CERTFILE, '<', "Other certificates file"},
|
||||
{"recip", OPT_RECIP, '<', "Recipient certificate file for decryption"},
|
||||
|
||||
OPT_SECTION("Email"),
|
||||
{"to", OPT_TO, 's', "To address"},
|
||||
{"from", OPT_FROM, 's', "From address"},
|
||||
{"subject", OPT_SUBJECT, 's', "Subject"},
|
||||
{"text", OPT_TEXT, '-', "Include or delete text MIME headers"},
|
||||
{"nosmimecap", OPT_NOSMIMECAP, '-', "Omit the SMIMECapabilities attribute"},
|
||||
|
||||
OPT_SECTION("Certificate chain"),
|
||||
{"CApath", OPT_CAPATH, '/', "Trusted certificates directory"},
|
||||
{"CAfile", OPT_CAFILE, '<', "Trusted certificates file"},
|
||||
{"CAstore", OPT_CASTORE, ':', "Trusted certificates store URI"},
|
||||
{"no-CAfile", OPT_NOCAFILE, '-',
|
||||
"Do not load the default certificates file"},
|
||||
{"no-CApath", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates directory"},
|
||||
{"resign", OPT_RESIGN, '-', "Resign a signed message"},
|
||||
{"no-CAstore", OPT_NOCASTORE, '-',
|
||||
"Do not load certificates from the default certificates store"},
|
||||
{"nochain", OPT_NOCHAIN, '-',
|
||||
"set PKCS7_NOCHAIN so certificates contained in the message are not used as untrusted CAs" },
|
||||
{"nosmimecap", OPT_NOSMIMECAP, '-', "Omit the SMIMECapabilities attribute"},
|
||||
{"stream", OPT_STREAM, '-', "Enable CMS streaming" },
|
||||
{"indef", OPT_INDEF, '-', "Same as -stream" },
|
||||
{"noindef", OPT_NOINDEF, '-', "Disable CMS streaming"},
|
||||
{"crlfeol", OPT_CRLFEOL, '-', "Use CRLF as EOL termination instead of CR only"},
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"md", OPT_MD, 's', "Digest algorithm to use when signing or resigning"},
|
||||
{"", OPT_CIPHER, '-', "Any supported cipher"},
|
||||
OPT_V_OPTIONS,
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"cert", 0, 0, "Recipient certs, used when encrypting"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -121,12 +139,12 @@ int smime_main(int argc, char **argv)
|
||||
X509_VERIFY_PARAM *vpm = NULL;
|
||||
const EVP_CIPHER *cipher = NULL;
|
||||
const EVP_MD *sign_md = NULL;
|
||||
const char *CAfile = NULL, *CApath = NULL, *prog = NULL;
|
||||
const char *CAfile = NULL, *CApath = NULL, *CAstore = NULL, *prog = NULL;
|
||||
char *certfile = NULL, *keyfile = NULL, *contfile = NULL;
|
||||
char *infile = NULL, *outfile = NULL, *signerfile = NULL, *recipfile = NULL;
|
||||
char *passinarg = NULL, *passin = NULL, *to = NULL, *from = NULL, *subject = NULL;
|
||||
OPTION_CHOICE o;
|
||||
int noCApath = 0, noCAfile = 0;
|
||||
int noCApath = 0, noCAfile = 0, noCAstore = 0;
|
||||
int flags = PKCS7_DETACHED, operation = 0, ret = 0, indef = 0;
|
||||
int informat = FORMAT_SMIME, outformat = FORMAT_SMIME, keyform =
|
||||
FORMAT_PEM;
|
||||
@@ -302,12 +320,18 @@ int smime_main(int argc, char **argv)
|
||||
case OPT_CAPATH:
|
||||
CApath = opt_arg();
|
||||
break;
|
||||
case OPT_CASTORE:
|
||||
CAstore = opt_arg();
|
||||
break;
|
||||
case OPT_NOCAFILE:
|
||||
noCAfile = 1;
|
||||
break;
|
||||
case OPT_NOCAPATH:
|
||||
noCApath = 1;
|
||||
break;
|
||||
case OPT_NOCASTORE:
|
||||
noCAstore = 1;
|
||||
break;
|
||||
case OPT_CONTENT:
|
||||
contfile = opt_arg();
|
||||
break;
|
||||
@@ -473,7 +497,8 @@ int smime_main(int argc, char **argv)
|
||||
goto end;
|
||||
|
||||
if (operation == SMIME_VERIFY) {
|
||||
if ((store = setup_verify(CAfile, CApath, noCAfile, noCApath)) == NULL)
|
||||
if ((store = setup_verify(CAfile, noCAfile, CApath, noCApath,
|
||||
CAstore, noCAstore)) == NULL)
|
||||
goto end;
|
||||
X509_STORE_set_verify_cb(store, smime_cb);
|
||||
if (vpmtouched)
|
||||
|
||||
+459
-601
@@ -17,6 +17,9 @@
|
||||
#define EdDSA_SECONDS 10
|
||||
#define SM2_SECONDS 10
|
||||
|
||||
/* We need to use some deprecated APIs */
|
||||
#define OPENSSL_SUPPRESS_DEPRECATED
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -41,7 +44,9 @@
|
||||
#ifndef OPENSSL_NO_DES
|
||||
# include <openssl/des.h>
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
#include <openssl/aes.h>
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
# include <openssl/camellia.h>
|
||||
#endif
|
||||
@@ -133,72 +138,9 @@ typedef struct openssl_speed_sec_st {
|
||||
|
||||
static volatile int run = 0;
|
||||
|
||||
static int mr = 0;
|
||||
static int mr = 0; /* machine-readeable output format to merge fork results */
|
||||
static int usertime = 1;
|
||||
|
||||
#ifndef OPENSSL_NO_MD2
|
||||
static int EVP_Digest_MD2_loop(void *args);
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_MDC2
|
||||
static int EVP_Digest_MDC2_loop(void *args);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_MD4
|
||||
static int EVP_Digest_MD4_loop(void *args);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
static int MD5_loop(void *args);
|
||||
static int HMAC_loop(void *args);
|
||||
#endif
|
||||
static int SHA1_loop(void *args);
|
||||
static int SHA256_loop(void *args);
|
||||
static int SHA512_loop(void *args);
|
||||
#ifndef OPENSSL_NO_WHIRLPOOL
|
||||
static int WHIRLPOOL_loop(void *args);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RMD160
|
||||
static int EVP_Digest_RMD160_loop(void *args);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC4
|
||||
static int RC4_loop(void *args);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
static int DES_ncbc_encrypt_loop(void *args);
|
||||
static int DES_ede3_cbc_encrypt_loop(void *args);
|
||||
#endif
|
||||
static int AES_cbc_128_encrypt_loop(void *args);
|
||||
static int AES_cbc_192_encrypt_loop(void *args);
|
||||
static int AES_cbc_256_encrypt_loop(void *args);
|
||||
#if !OPENSSL_API_3
|
||||
static int AES_ige_128_encrypt_loop(void *args);
|
||||
static int AES_ige_192_encrypt_loop(void *args);
|
||||
static int AES_ige_256_encrypt_loop(void *args);
|
||||
#endif
|
||||
static int CRYPTO_gcm128_aad_loop(void *args);
|
||||
static int RAND_bytes_loop(void *args);
|
||||
static int EVP_Update_loop(void *args);
|
||||
static int EVP_Update_loop_ccm(void *args);
|
||||
static int EVP_Update_loop_aead(void *args);
|
||||
static int EVP_Digest_loop(void *args);
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
static int RSA_sign_loop(void *args);
|
||||
static int RSA_verify_loop(void *args);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
static int DSA_sign_loop(void *args);
|
||||
static int DSA_verify_loop(void *args);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC
|
||||
static int ECDSA_sign_loop(void *args);
|
||||
static int ECDSA_verify_loop(void *args);
|
||||
static int EdDSA_sign_loop(void *args);
|
||||
static int EdDSA_verify_loop(void *args);
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
static int SM2_sign_loop(void *args);
|
||||
static int SM2_verify_loop(void *args);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static double Time_F(int s);
|
||||
static void print_message(const char *s, long num, int length, int tm);
|
||||
static void pkey_print_message(const char *str, const char *str2,
|
||||
@@ -211,6 +153,7 @@ static int do_multi(int multi, int size_num);
|
||||
static const int lengths_list[] = {
|
||||
16, 64, 256, 1024, 8 * 1024, 16 * 1024
|
||||
};
|
||||
#define SIZE_NUM OSSL_NELEM(lengths_list)
|
||||
static const int *lengths = lengths_list;
|
||||
|
||||
static const int aead_lengths_list[] = {
|
||||
@@ -292,8 +235,6 @@ static double Time_F(int s)
|
||||
static void multiblock_speed(const EVP_CIPHER *evp_cipher, int lengths_single,
|
||||
const openssl_speed_sec_t *seconds);
|
||||
|
||||
#define found(value, pairs, result)\
|
||||
opt_found(value, result, pairs, OSSL_NELEM(pairs))
|
||||
static int opt_found(const char *name, unsigned int *result,
|
||||
const OPT_PAIR pairs[], unsigned int nbelem)
|
||||
{
|
||||
@@ -306,6 +247,8 @@ static int opt_found(const char *name, unsigned int *result,
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#define opt_found(value, pairs, result)\
|
||||
opt_found(value, result, pairs, OSSL_NELEM(pairs))
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
@@ -315,18 +258,10 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS speed_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] ciphers...\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Valid options are:\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] [algorithm...]\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"evp", OPT_EVP, 's', "Use EVP-named cipher or digest"},
|
||||
{"hmac", OPT_HMAC, 's', "HMAC using EVP-named digest"},
|
||||
#ifndef OPENSSL_NO_CMAC
|
||||
{"cmac", OPT_CMAC, 's', "CMAC using EVP-named cipher"},
|
||||
#endif
|
||||
{"decrypt", OPT_DECRYPT, '-',
|
||||
"Time decryption instead of encryption (only EVP)"},
|
||||
{"aead", OPT_AEAD, '-',
|
||||
"Benchmark EVP-named AEAD cipher in TLS-like sequence"},
|
||||
{"mb", OPT_MB, '-',
|
||||
"Enable (tls1>=1) multi-block mode on EVP-named cipher"},
|
||||
{"mr", OPT_MR, '-', "Produce machine readable output"},
|
||||
@@ -337,58 +272,51 @@ const OPTIONS speed_options[] = {
|
||||
{"async_jobs", OPT_ASYNCJOBS, 'p',
|
||||
"Enable async mode and start specified number of jobs"},
|
||||
#endif
|
||||
OPT_R_OPTIONS,
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
{"primes", OPT_PRIMES, 'p', "Specify number of primes (for RSA only)"},
|
||||
|
||||
OPT_SECTION("Selection"),
|
||||
{"evp", OPT_EVP, 's', "Use EVP-named cipher or digest"},
|
||||
{"hmac", OPT_HMAC, 's', "HMAC using EVP-named digest"},
|
||||
#ifndef OPENSSL_NO_CMAC
|
||||
{"cmac", OPT_CMAC, 's', "CMAC using EVP-named cipher"},
|
||||
#endif
|
||||
{"decrypt", OPT_DECRYPT, '-',
|
||||
"Time decryption instead of encryption (only EVP)"},
|
||||
{"aead", OPT_AEAD, '-',
|
||||
"Benchmark EVP-named AEAD cipher in TLS-like sequence"},
|
||||
|
||||
OPT_SECTION("Timing"),
|
||||
{"elapsed", OPT_ELAPSED, '-',
|
||||
"Use wall-clock time instead of CPU user time as divisor"},
|
||||
{"primes", OPT_PRIMES, 'p', "Specify number of primes (for RSA only)"},
|
||||
{"seconds", OPT_SECONDS, 'p',
|
||||
"Run benchmarks for specified amount of seconds"},
|
||||
{"bytes", OPT_BYTES, 'p',
|
||||
"Run [non-PKI] benchmarks on custom-sized buffer"},
|
||||
{"misalign", OPT_MISALIGN, 'p',
|
||||
"Use specified offset to mis-align buffers"},
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"algorithm", 0, 0, "Algorithm(s) to test (optional; otherwise tests all)"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
#define D_MD2 0
|
||||
#define D_MDC2 1
|
||||
#define D_MD4 2
|
||||
#define D_MD5 3
|
||||
#define D_HMAC 4
|
||||
#define D_SHA1 5
|
||||
#define D_RMD160 6
|
||||
#define D_RC4 7
|
||||
#define D_CBC_DES 8
|
||||
#define D_EDE3_DES 9
|
||||
#define D_CBC_IDEA 10
|
||||
#define D_CBC_SEED 11
|
||||
#define D_CBC_RC2 12
|
||||
#define D_CBC_RC5 13
|
||||
#define D_CBC_BF 14
|
||||
#define D_CBC_CAST 15
|
||||
#define D_CBC_128_AES 16
|
||||
#define D_CBC_192_AES 17
|
||||
#define D_CBC_256_AES 18
|
||||
#define D_CBC_128_CML 19
|
||||
#define D_CBC_192_CML 20
|
||||
#define D_CBC_256_CML 21
|
||||
#define D_EVP 22
|
||||
#define D_SHA256 23
|
||||
#define D_SHA512 24
|
||||
#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
|
||||
#define D_RAND 30
|
||||
#define D_EVP_HMAC 31
|
||||
#define D_EVP_CMAC 32
|
||||
|
||||
/* name of algorithms to test */
|
||||
static const char *names[] = {
|
||||
enum {
|
||||
D_MD2, D_MDC2, D_MD4, D_MD5 , D_HMAC, D_SHA1, D_RMD160, D_RC4,
|
||||
D_CBC_DES, D_EDE3_DES, D_CBC_IDEA, D_CBC_SEED,
|
||||
D_CBC_RC2, D_CBC_RC5, D_CBC_BF, D_CBC_CAST,
|
||||
D_CBC_128_AES, D_CBC_192_AES, D_CBC_256_AES,
|
||||
D_CBC_128_CML, D_CBC_192_CML, D_CBC_256_CML,
|
||||
D_EVP, D_SHA256, D_SHA512, D_WHIRLPOOL,
|
||||
D_IGE_128_AES, D_IGE_192_AES, D_IGE_256_AES,
|
||||
D_GHASH, D_RAND, D_EVP_HMAC, D_EVP_CMAC, ALGOR_NUM
|
||||
};
|
||||
/* name of algorithms to test. MUST BE KEEP IN SYNC with above enum ! */
|
||||
static const char *names[ALGOR_NUM] = {
|
||||
"md2", "mdc2", "md4", "md5", "hmac(md5)", "sha1", "rmd160", "rc4",
|
||||
"des cbc", "des ede3", "idea cbc", "seed cbc",
|
||||
"rc2 cbc", "rc5-32/12 cbc", "blowfish cbc", "cast cbc",
|
||||
@@ -398,17 +326,16 @@ static const char *names[] = {
|
||||
"aes-128 ige", "aes-192 ige", "aes-256 ige", "ghash",
|
||||
"rand", "hmac", "cmac"
|
||||
};
|
||||
#define ALGOR_NUM OSSL_NELEM(names)
|
||||
|
||||
/* list of configured algorithm (remaining) */
|
||||
/* list of configured algorithm (remaining), with some few alias */
|
||||
static const OPT_PAIR doit_choices[] = {
|
||||
#ifndef OPENSSL_NO_MD2
|
||||
#if !defined(OPENSSL_NO_MD2) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
{"md2", D_MD2},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_MDC2
|
||||
#if !defined(OPENSSL_NO_MDC2) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
{"mdc2", D_MDC2},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_MD4
|
||||
#if !defined(OPENSSL_NO_MD4) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
{"md4", D_MD4},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
@@ -418,34 +345,34 @@ static const OPT_PAIR doit_choices[] = {
|
||||
{"sha1", D_SHA1},
|
||||
{"sha256", D_SHA256},
|
||||
{"sha512", D_SHA512},
|
||||
#ifndef OPENSSL_NO_WHIRLPOOL
|
||||
#if !defined(OPENSSL_NO_WHIRLPOOL) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
{"whirlpool", D_WHIRLPOOL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RMD160
|
||||
#if !defined(OPENSSL_NO_RMD160) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
{"ripemd", D_RMD160},
|
||||
{"rmd160", D_RMD160},
|
||||
{"ripemd160", D_RMD160},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC4
|
||||
#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
{"rc4", D_RC4},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{"des-cbc", D_CBC_DES},
|
||||
{"des-ede3", D_EDE3_DES},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
{"aes-128-cbc", D_CBC_128_AES},
|
||||
{"aes-192-cbc", D_CBC_192_AES},
|
||||
{"aes-256-cbc", D_CBC_256_AES},
|
||||
#if !OPENSSL_API_3
|
||||
{"aes-128-ige", D_IGE_128_AES},
|
||||
{"aes-192-ige", D_IGE_192_AES},
|
||||
{"aes-256-ige", D_IGE_256_AES},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC2
|
||||
#if !defined(OPENSSL_NO_RC2) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
{"rc2-cbc", D_CBC_RC2},
|
||||
{"rc2", D_CBC_RC2},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC5
|
||||
#if !defined(OPENSSL_NO_RC5) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
{"rc5-cbc", D_CBC_RC5},
|
||||
{"rc5", D_CBC_RC5},
|
||||
#endif
|
||||
@@ -453,16 +380,16 @@ static const OPT_PAIR doit_choices[] = {
|
||||
{"idea-cbc", D_CBC_IDEA},
|
||||
{"idea", D_CBC_IDEA},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SEED
|
||||
#if !defined(OPENSSL_NO_SEED) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
{"seed-cbc", D_CBC_SEED},
|
||||
{"seed", D_CBC_SEED},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_BF
|
||||
#if !defined(OPENSSL_NO_BF) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
{"bf-cbc", D_CBC_BF},
|
||||
{"blowfish", D_CBC_BF},
|
||||
{"bf", D_CBC_BF},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAST
|
||||
#if !defined(OPENSSL_NO_CAST) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
{"cast-cbc", D_CBC_CAST},
|
||||
{"cast", D_CBC_CAST},
|
||||
{"cast5", D_CBC_CAST},
|
||||
@@ -471,31 +398,24 @@ static const OPT_PAIR doit_choices[] = {
|
||||
{"rand", D_RAND}
|
||||
};
|
||||
|
||||
static double results[ALGOR_NUM][OSSL_NELEM(lengths_list)];
|
||||
static double results[ALGOR_NUM][SIZE_NUM];
|
||||
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
# define R_DSA_512 0
|
||||
# define R_DSA_1024 1
|
||||
# define R_DSA_2048 2
|
||||
static const OPT_PAIR dsa_choices[] = {
|
||||
enum { R_DSA_512, R_DSA_1024, R_DSA_2048, DSA_NUM };
|
||||
static const OPT_PAIR dsa_choices[DSA_NUM] = {
|
||||
{"dsa512", R_DSA_512},
|
||||
{"dsa1024", R_DSA_1024},
|
||||
{"dsa2048", R_DSA_2048}
|
||||
};
|
||||
# define DSA_NUM OSSL_NELEM(dsa_choices)
|
||||
|
||||
static double dsa_results[DSA_NUM][2]; /* 2 ops: sign then verify */
|
||||
#endif /* OPENSSL_NO_DSA */
|
||||
|
||||
#define R_RSA_512 0
|
||||
#define R_RSA_1024 1
|
||||
#define R_RSA_2048 2
|
||||
#define R_RSA_3072 3
|
||||
#define R_RSA_4096 4
|
||||
#define R_RSA_7680 5
|
||||
#define R_RSA_15360 6
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
static const OPT_PAIR rsa_choices[] = {
|
||||
enum {
|
||||
R_RSA_512, R_RSA_1024, R_RSA_2048, R_RSA_3072, R_RSA_4096, R_RSA_7680,
|
||||
R_RSA_15360, RSA_NUM
|
||||
};
|
||||
static const OPT_PAIR rsa_choices[RSA_NUM] = {
|
||||
{"rsa512", R_RSA_512},
|
||||
{"rsa1024", R_RSA_1024},
|
||||
{"rsa2048", R_RSA_2048},
|
||||
@@ -504,42 +424,22 @@ static const OPT_PAIR rsa_choices[] = {
|
||||
{"rsa7680", R_RSA_7680},
|
||||
{"rsa15360", R_RSA_15360}
|
||||
};
|
||||
# define RSA_NUM OSSL_NELEM(rsa_choices)
|
||||
|
||||
static double rsa_results[RSA_NUM][2]; /* 2 ops: sign then verify */
|
||||
#endif /* OPENSSL_NO_RSA */
|
||||
|
||||
enum {
|
||||
R_EC_P160,
|
||||
R_EC_P192,
|
||||
R_EC_P224,
|
||||
R_EC_P256,
|
||||
R_EC_P384,
|
||||
R_EC_P521,
|
||||
#ifndef OPENSSL_NO_EC2M
|
||||
R_EC_K163,
|
||||
R_EC_K233,
|
||||
R_EC_K283,
|
||||
R_EC_K409,
|
||||
R_EC_K571,
|
||||
R_EC_B163,
|
||||
R_EC_B233,
|
||||
R_EC_B283,
|
||||
R_EC_B409,
|
||||
R_EC_B571,
|
||||
#endif
|
||||
R_EC_BRP256R1,
|
||||
R_EC_BRP256T1,
|
||||
R_EC_BRP384R1,
|
||||
R_EC_BRP384T1,
|
||||
R_EC_BRP512R1,
|
||||
R_EC_BRP512T1,
|
||||
R_EC_X25519,
|
||||
R_EC_X448
|
||||
};
|
||||
|
||||
#ifndef OPENSSL_NO_EC
|
||||
static OPT_PAIR ecdsa_choices[] = {
|
||||
enum ec_curves_t {
|
||||
R_EC_P160, R_EC_P192, R_EC_P224, R_EC_P256, R_EC_P384, R_EC_P521,
|
||||
# ifndef OPENSSL_NO_EC2M
|
||||
R_EC_K163, R_EC_K233, R_EC_K283, R_EC_K409, R_EC_K571,
|
||||
R_EC_B163, R_EC_B233, R_EC_B283, R_EC_B409, R_EC_B571,
|
||||
# endif
|
||||
R_EC_BRP256R1, R_EC_BRP256T1, R_EC_BRP384R1, R_EC_BRP384T1,
|
||||
R_EC_BRP512R1, R_EC_BRP512T1, ECDSA_NUM
|
||||
};
|
||||
/* list of ecdsa curves */
|
||||
static const OPT_PAIR ecdsa_choices[ECDSA_NUM] = {
|
||||
{"ecdsap160", R_EC_P160},
|
||||
{"ecdsap192", R_EC_P192},
|
||||
{"ecdsap224", R_EC_P224},
|
||||
@@ -565,11 +465,9 @@ static OPT_PAIR ecdsa_choices[] = {
|
||||
{"ecdsabrp512r1", R_EC_BRP512R1},
|
||||
{"ecdsabrp512t1", R_EC_BRP512T1}
|
||||
};
|
||||
# define ECDSA_NUM OSSL_NELEM(ecdsa_choices)
|
||||
|
||||
static double ecdsa_results[ECDSA_NUM][2]; /* 2 ops: sign then verify */
|
||||
|
||||
static const OPT_PAIR ecdh_choices[] = {
|
||||
enum { R_EC_X25519 = ECDSA_NUM, R_EC_X448, EC_NUM };
|
||||
/* list of ecdh curves, extension of |ecdsa_choices| list above */
|
||||
static const OPT_PAIR ecdh_choices[EC_NUM] = {
|
||||
{"ecdhp160", R_EC_P160},
|
||||
{"ecdhp192", R_EC_P192},
|
||||
{"ecdhp224", R_EC_P224},
|
||||
@@ -597,29 +495,25 @@ static const OPT_PAIR ecdh_choices[] = {
|
||||
{"ecdhx25519", R_EC_X25519},
|
||||
{"ecdhx448", R_EC_X448}
|
||||
};
|
||||
# define EC_NUM OSSL_NELEM(ecdh_choices)
|
||||
|
||||
static double ecdh_results[EC_NUM][1]; /* 1 op: derivation */
|
||||
static double ecdh_results[EC_NUM][1]; /* 1 op: derivation */
|
||||
static double ecdsa_results[ECDSA_NUM][2]; /* 2 ops: sign then verify */
|
||||
|
||||
#define R_EC_Ed25519 0
|
||||
#define R_EC_Ed448 1
|
||||
static OPT_PAIR eddsa_choices[] = {
|
||||
enum { R_EC_Ed25519, R_EC_Ed448, EdDSA_NUM };
|
||||
static const OPT_PAIR eddsa_choices[EdDSA_NUM] = {
|
||||
{"ed25519", R_EC_Ed25519},
|
||||
{"ed448", R_EC_Ed448}
|
||||
};
|
||||
# define EdDSA_NUM OSSL_NELEM(eddsa_choices)
|
||||
|
||||
};
|
||||
static double eddsa_results[EdDSA_NUM][2]; /* 2 ops: sign then verify */
|
||||
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
# define R_EC_CURVESM2 0
|
||||
static OPT_PAIR sm2_choices[] = {
|
||||
enum { R_EC_CURVESM2, SM2_NUM };
|
||||
static const OPT_PAIR sm2_choices[SM2_NUM] = {
|
||||
{"curveSM2", R_EC_CURVESM2}
|
||||
};
|
||||
# define SM2_ID "TLSv1.3+GM+Cipher+Suite"
|
||||
# define SM2_ID_LEN sizeof("TLSv1.3+GM+Cipher+Suite") - 1
|
||||
# define SM2_NUM OSSL_NELEM(sm2_choices)
|
||||
|
||||
static double sm2_results[SM2_NUM][2]; /* 2 ops: sign then verify */
|
||||
# endif /* OPENSSL_NO_SM2 */
|
||||
#endif /* OPENSSL_NO_EC */
|
||||
@@ -674,9 +568,9 @@ static int run_benchmark(int async_jobs, int (*loop_function) (void *),
|
||||
static unsigned int testnum;
|
||||
|
||||
/* Nb of iterations to do per algorithm and key-size */
|
||||
static long c[ALGOR_NUM][OSSL_NELEM(lengths_list)];
|
||||
static long c[ALGOR_NUM][SIZE_NUM];
|
||||
|
||||
#ifndef OPENSSL_NO_MD2
|
||||
#if !defined(OPENSSL_NO_MD2) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
static int EVP_Digest_MD2_loop(void *args)
|
||||
{
|
||||
loopargs_t *tempargs = *(loopargs_t **) args;
|
||||
@@ -693,7 +587,7 @@ static int EVP_Digest_MD2_loop(void *args)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_MDC2
|
||||
#if !defined(OPENSSL_NO_MDC2) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
static int EVP_Digest_MDC2_loop(void *args)
|
||||
{
|
||||
loopargs_t *tempargs = *(loopargs_t **) args;
|
||||
@@ -710,7 +604,7 @@ static int EVP_Digest_MDC2_loop(void *args)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_MD4
|
||||
#if !defined(OPENSSL_NO_MD4) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
static int EVP_Digest_MD4_loop(void *args)
|
||||
{
|
||||
loopargs_t *tempargs = *(loopargs_t **) args;
|
||||
@@ -789,7 +683,7 @@ static int SHA512_loop(void *args)
|
||||
return count;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_WHIRLPOOL
|
||||
#if !defined(OPENSSL_NO_WHIRLPOOL) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
static int WHIRLPOOL_loop(void *args)
|
||||
{
|
||||
loopargs_t *tempargs = *(loopargs_t **) args;
|
||||
@@ -802,7 +696,7 @@ static int WHIRLPOOL_loop(void *args)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_RMD160
|
||||
#if !defined(OPENSSL_NO_RMD160) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
static int EVP_Digest_RMD160_loop(void *args)
|
||||
{
|
||||
loopargs_t *tempargs = *(loopargs_t **) args;
|
||||
@@ -818,7 +712,7 @@ static int EVP_Digest_RMD160_loop(void *args)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_RC4
|
||||
#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
static RC4_KEY rc4_ks;
|
||||
static int RC4_loop(void *args)
|
||||
{
|
||||
@@ -833,16 +727,14 @@ static int RC4_loop(void *args)
|
||||
|
||||
#ifndef OPENSSL_NO_DES
|
||||
static unsigned char DES_iv[8];
|
||||
static DES_key_schedule sch;
|
||||
static DES_key_schedule sch2;
|
||||
static DES_key_schedule sch3;
|
||||
static DES_key_schedule sch[3];
|
||||
static int DES_ncbc_encrypt_loop(void *args)
|
||||
{
|
||||
loopargs_t *tempargs = *(loopargs_t **) args;
|
||||
unsigned char *buf = tempargs->buf;
|
||||
int count;
|
||||
for (count = 0; COND(c[D_CBC_DES][testnum]); count++)
|
||||
DES_ncbc_encrypt(buf, buf, lengths[testnum], &sch,
|
||||
DES_ncbc_encrypt(buf, buf, lengths[testnum], &sch[0],
|
||||
&DES_iv, DES_ENCRYPT);
|
||||
return count;
|
||||
}
|
||||
@@ -854,7 +746,7 @@ static int DES_ede3_cbc_encrypt_loop(void *args)
|
||||
int count;
|
||||
for (count = 0; COND(c[D_EDE3_DES][testnum]); count++)
|
||||
DES_ede3_cbc_encrypt(buf, buf, lengths[testnum],
|
||||
&sch, &sch2, &sch3, &DES_iv, DES_ENCRYPT);
|
||||
&sch[0], &sch[1], &sch[2], &DES_iv, DES_ENCRYPT);
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
@@ -862,6 +754,8 @@ static int DES_ede3_cbc_encrypt_loop(void *args)
|
||||
#define MAX_BLOCK_SIZE 128
|
||||
|
||||
static unsigned char iv[2 * MAX_BLOCK_SIZE / 8];
|
||||
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
static AES_KEY aes_ks1, aes_ks2, aes_ks3;
|
||||
static int AES_cbc_128_encrypt_loop(void *args)
|
||||
{
|
||||
@@ -896,7 +790,6 @@ static int AES_cbc_256_encrypt_loop(void *args)
|
||||
return count;
|
||||
}
|
||||
|
||||
#if !OPENSSL_API_3
|
||||
static int AES_ige_128_encrypt_loop(void *args)
|
||||
{
|
||||
loopargs_t *tempargs = *(loopargs_t **) args;
|
||||
@@ -932,7 +825,6 @@ static int AES_ige_256_encrypt_loop(void *args)
|
||||
(size_t)lengths[testnum], &aes_ks3, iv, AES_ENCRYPT);
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int CRYPTO_gcm128_aad_loop(void *args)
|
||||
{
|
||||
@@ -944,6 +836,7 @@ static int CRYPTO_gcm128_aad_loop(void *args)
|
||||
CRYPTO_gcm128_aad(gcm_ctx, buf, lengths[testnum]);
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int RAND_bytes_loop(void *args)
|
||||
{
|
||||
@@ -956,7 +849,6 @@ static int RAND_bytes_loop(void *args)
|
||||
return count;
|
||||
}
|
||||
|
||||
static long save_count = 0;
|
||||
static int decrypt = 0;
|
||||
static int EVP_Update_loop(void *args)
|
||||
{
|
||||
@@ -964,11 +856,9 @@ static int EVP_Update_loop(void *args)
|
||||
unsigned char *buf = tempargs->buf;
|
||||
EVP_CIPHER_CTX *ctx = tempargs->ctx;
|
||||
int outl, count, rc;
|
||||
#ifndef SIGALRM
|
||||
int nb_iter = save_count * 4 * lengths[0] / lengths[testnum];
|
||||
#endif
|
||||
|
||||
if (decrypt) {
|
||||
for (count = 0; COND(nb_iter); count++) {
|
||||
for (count = 0; COND(c[D_EVP][testnum]); count++) {
|
||||
rc = EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
|
||||
if (rc != 1) {
|
||||
/* reset iv in case of counter overflow */
|
||||
@@ -976,7 +866,7 @@ static int EVP_Update_loop(void *args)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (count = 0; COND(nb_iter); count++) {
|
||||
for (count = 0; COND(c[D_EVP][testnum]); count++) {
|
||||
rc = EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
|
||||
if (rc != 1) {
|
||||
/* reset iv in case of counter overflow */
|
||||
@@ -1003,11 +893,9 @@ static int EVP_Update_loop_ccm(void *args)
|
||||
EVP_CIPHER_CTX *ctx = tempargs->ctx;
|
||||
int outl, count;
|
||||
unsigned char tag[12];
|
||||
#ifndef SIGALRM
|
||||
int nb_iter = save_count * 4 * lengths[0] / lengths[testnum];
|
||||
#endif
|
||||
|
||||
if (decrypt) {
|
||||
for (count = 0; COND(nb_iter); count++) {
|
||||
for (count = 0; COND(c[D_EVP][testnum]); count++) {
|
||||
EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, sizeof(tag), tag);
|
||||
/* reset iv */
|
||||
EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv);
|
||||
@@ -1015,7 +903,7 @@ static int EVP_Update_loop_ccm(void *args)
|
||||
EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
|
||||
}
|
||||
} else {
|
||||
for (count = 0; COND(nb_iter); count++) {
|
||||
for (count = 0; COND(c[D_EVP][testnum]); count++) {
|
||||
/* restore iv length field */
|
||||
EVP_EncryptUpdate(ctx, NULL, &outl, NULL, lengths[testnum]);
|
||||
/* counter is reset on every update */
|
||||
@@ -1042,11 +930,9 @@ static int EVP_Update_loop_aead(void *args)
|
||||
int outl, count;
|
||||
unsigned char aad[13] = { 0xcc };
|
||||
unsigned char faketag[16] = { 0xcc };
|
||||
#ifndef SIGALRM
|
||||
int nb_iter = save_count * 4 * lengths[0] / lengths[testnum];
|
||||
#endif
|
||||
|
||||
if (decrypt) {
|
||||
for (count = 0; COND(nb_iter); count++) {
|
||||
for (count = 0; COND(c[D_EVP][testnum]); count++) {
|
||||
EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv);
|
||||
EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG,
|
||||
sizeof(faketag), faketag);
|
||||
@@ -1055,7 +941,7 @@ static int EVP_Update_loop_aead(void *args)
|
||||
EVP_DecryptFinal_ex(ctx, buf + outl, &outl);
|
||||
}
|
||||
} else {
|
||||
for (count = 0; COND(nb_iter); count++) {
|
||||
for (count = 0; COND(c[D_EVP][testnum]); count++) {
|
||||
EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv);
|
||||
EVP_EncryptUpdate(ctx, NULL, &outl, aad, sizeof(aad));
|
||||
EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
|
||||
@@ -1072,11 +958,8 @@ static int EVP_Digest_loop(void *args)
|
||||
unsigned char *buf = tempargs->buf;
|
||||
unsigned char md[EVP_MAX_MD_SIZE];
|
||||
int count;
|
||||
#ifndef SIGALRM
|
||||
int nb_iter = save_count * 4 * lengths[0] / lengths[testnum];
|
||||
#endif
|
||||
|
||||
for (count = 0; COND(nb_iter); count++) {
|
||||
for (count = 0; COND(c[D_EVP][testnum]); count++) {
|
||||
if (!EVP_Digest(buf, lengths[testnum], md, NULL, evp_md, NULL))
|
||||
return -1;
|
||||
}
|
||||
@@ -1091,11 +974,8 @@ static int EVP_HMAC_loop(void *args)
|
||||
unsigned char *buf = tempargs->buf;
|
||||
unsigned char no_key[32];
|
||||
int count;
|
||||
#ifndef SIGALRM
|
||||
int nb_iter = save_count * 4 * lengths[0] / lengths[testnum];
|
||||
#endif
|
||||
|
||||
for (count = 0; COND(nb_iter); count++) {
|
||||
for (count = 0; COND(c[D_EVP_HMAC][testnum]); count++) {
|
||||
if (HMAC(evp_hmac_md, no_key, sizeof(no_key), buf, lengths[testnum],
|
||||
NULL, NULL) == NULL)
|
||||
return -1;
|
||||
@@ -1116,11 +996,8 @@ static int EVP_CMAC_loop(void *args)
|
||||
unsigned char mac[16];
|
||||
size_t len = sizeof(mac);
|
||||
int count;
|
||||
#ifndef SIGALRM
|
||||
int nb_iter = save_count * 4 * lengths[0] / lengths[testnum];
|
||||
#endif
|
||||
|
||||
for (count = 0; COND(nb_iter); count++) {
|
||||
for (count = 0; COND(c[D_EVP_CMAC][testnum]); count++) {
|
||||
if (!CMAC_Init(cmac_ctx, key, sizeof(key), evp_cmac_cipher, NULL)
|
||||
|| !CMAC_Update(cmac_ctx, buf, lengths[testnum])
|
||||
|| !CMAC_Final(cmac_ctx, mac, &len))
|
||||
@@ -1399,8 +1276,6 @@ static int run_benchmark(int async_jobs,
|
||||
OSSL_ASYNC_FD job_fd = 0;
|
||||
size_t num_job_fds = 0;
|
||||
|
||||
run = 1;
|
||||
|
||||
if (async_jobs == 0) {
|
||||
return loop_function((void *)&loopargs);
|
||||
}
|
||||
@@ -1542,6 +1417,9 @@ static int run_benchmark(int async_jobs,
|
||||
return error ? -1 : total_op_count;
|
||||
}
|
||||
|
||||
#define stop_it(do_it, test_num)\
|
||||
memset(do_it + test_num, 0, OSSL_NELEM(do_it) - test_num);
|
||||
|
||||
int speed_main(int argc, char **argv)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
@@ -1552,11 +1430,11 @@ int speed_main(int argc, char **argv)
|
||||
double d = 0.0;
|
||||
OPTION_CHOICE o;
|
||||
int async_init = 0, multiblock = 0, pr_header = 0;
|
||||
int doit[ALGOR_NUM] = { 0 };
|
||||
uint8_t doit[ALGOR_NUM] = { 0 };
|
||||
int ret = 1, misalign = 0, lengths_single = 0, aead = 0;
|
||||
long count = 0;
|
||||
unsigned int size_num = OSSL_NELEM(lengths_list);
|
||||
unsigned int i, k, loop, loopargs_len = 0, async_jobs = 0;
|
||||
unsigned int size_num = SIZE_NUM;
|
||||
unsigned int i, k, loopargs_len = 0, async_jobs = 0;
|
||||
int keylen;
|
||||
int buflen;
|
||||
#ifndef NO_FORK
|
||||
@@ -1571,28 +1449,29 @@ int speed_main(int argc, char **argv)
|
||||
EdDSA_SECONDS, SM2_SECONDS };
|
||||
|
||||
/* What follows are the buffers and key material. */
|
||||
#ifndef OPENSSL_NO_RC5
|
||||
#if !defined(OPENSSL_NO_RC5) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
RC5_32_KEY rc5_ks;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC2
|
||||
#if !defined(OPENSSL_NO_RC2) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
RC2_KEY rc2_ks;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_IDEA
|
||||
IDEA_KEY_SCHEDULE idea_ks;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SEED
|
||||
#if !defined(OPENSSL_NO_SEED) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
SEED_KEY_SCHEDULE seed_ks;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_BF
|
||||
#if !defined(OPENSSL_NO_BF) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
BF_KEY bf_ks;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAST
|
||||
#if !defined(OPENSSL_NO_CAST) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
CAST_KEY cast_ks;
|
||||
#endif
|
||||
static const unsigned char key16[16] = {
|
||||
0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
|
||||
0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12
|
||||
};
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
static const unsigned char key24[24] = {
|
||||
0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
|
||||
0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,
|
||||
@@ -1604,62 +1483,45 @@ int speed_main(int argc, char **argv)
|
||||
0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34,
|
||||
0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56
|
||||
};
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
static const unsigned char ckey24[24] = {
|
||||
0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
|
||||
0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,
|
||||
0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34
|
||||
};
|
||||
static const unsigned char ckey32[32] = {
|
||||
0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
|
||||
0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,
|
||||
0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34,
|
||||
0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56
|
||||
};
|
||||
CAMELLIA_KEY camellia_ks1, camellia_ks2, camellia_ks3;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
static DES_cblock key = {
|
||||
0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0
|
||||
};
|
||||
static DES_cblock key2 = {
|
||||
0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12
|
||||
};
|
||||
static DES_cblock key3 = {
|
||||
0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34
|
||||
};
|
||||
#if !defined(OPENSSL_NO_CAMELLIA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
CAMELLIA_KEY camellia_ks[3];
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
static const unsigned int rsa_bits[RSA_NUM] = {
|
||||
512, 1024, 2048, 3072, 4096, 7680, 15360
|
||||
static const struct {
|
||||
const unsigned char *data;
|
||||
unsigned int length;
|
||||
unsigned int bits;
|
||||
} rsa_keys[] = {
|
||||
{ test512, sizeof(test512), 512 },
|
||||
{ test1024, sizeof(test1024), 1024 },
|
||||
{ test2048, sizeof(test2048), 2048 },
|
||||
{ test3072, sizeof(test3072), 3072 },
|
||||
{ test4096, sizeof(test4096), 4092 },
|
||||
{ test7680, sizeof(test7680), 7680 },
|
||||
{ test15360, sizeof(test15360), 15360 }
|
||||
};
|
||||
static const unsigned char *rsa_data[RSA_NUM] = {
|
||||
test512, test1024, test2048, test3072, test4096, test7680, test15360
|
||||
};
|
||||
static const int rsa_data_length[RSA_NUM] = {
|
||||
sizeof(test512), sizeof(test1024),
|
||||
sizeof(test2048), sizeof(test3072),
|
||||
sizeof(test4096), sizeof(test7680),
|
||||
sizeof(test15360)
|
||||
};
|
||||
int rsa_doit[RSA_NUM] = { 0 };
|
||||
uint8_t rsa_doit[RSA_NUM] = { 0 };
|
||||
int primes = RSA_DEFAULT_PRIME_NUM;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
static const unsigned int dsa_bits[DSA_NUM] = { 512, 1024, 2048 };
|
||||
int dsa_doit[DSA_NUM] = { 0 };
|
||||
uint8_t dsa_doit[DSA_NUM] = { 0 };
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC
|
||||
/*
|
||||
* We only test over the following curves as they are representative, To
|
||||
* add tests over more curves, simply add the curve NID and curve name to
|
||||
* the following arrays and increase the |ecdh_choices| list accordingly.
|
||||
*/
|
||||
static const struct {
|
||||
typedef struct ec_curve_st {
|
||||
const char *name;
|
||||
unsigned int nid;
|
||||
unsigned int bits;
|
||||
} test_curves[] = {
|
||||
size_t sigsize; /* only used for EdDSA curves */
|
||||
} EC_CURVE;
|
||||
/*
|
||||
* We only test over the following curves as they are representative, To
|
||||
* add tests over more curves, simply add the curve NID and curve name to
|
||||
* the following arrays and increase the |ecdh_choices| and |ecdsa_choices|
|
||||
* lists accordingly.
|
||||
*/
|
||||
static const EC_CURVE ec_curves[EC_NUM] = {
|
||||
/* Prime Curves */
|
||||
{"secp160r1", NID_secp160r1, 160},
|
||||
{"nistp192", NID_X9_62_prime192v1, 192},
|
||||
@@ -1690,33 +1552,36 @@ int speed_main(int argc, char **argv)
|
||||
{"X25519", NID_X25519, 253},
|
||||
{"X448", NID_X448, 448}
|
||||
};
|
||||
static const struct {
|
||||
const char *name;
|
||||
unsigned int nid;
|
||||
unsigned int bits;
|
||||
size_t sigsize;
|
||||
} test_ed_curves[] = {
|
||||
static const EC_CURVE ed_curves[EdDSA_NUM] = {
|
||||
/* EdDSA */
|
||||
{"Ed25519", NID_ED25519, 253, 64},
|
||||
{"Ed448", NID_ED448, 456, 114}
|
||||
};
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
static const struct {
|
||||
const char *name;
|
||||
unsigned int nid;
|
||||
unsigned int bits;
|
||||
} test_sm2_curves[] = {
|
||||
static const EC_CURVE sm2_curves[SM2_NUM] = {
|
||||
/* SM2 */
|
||||
{"CurveSM2", NID_sm2, 256}
|
||||
};
|
||||
uint8_t sm2_doit[SM2_NUM] = { 0 };
|
||||
# endif
|
||||
uint8_t ecdsa_doit[ECDSA_NUM] = { 0 };
|
||||
uint8_t ecdh_doit[EC_NUM] = { 0 };
|
||||
uint8_t eddsa_doit[EdDSA_NUM] = { 0 };
|
||||
|
||||
/* checks declarated curves against choices list. */
|
||||
OPENSSL_assert(ed_curves[EdDSA_NUM - 1].nid == NID_ED448);
|
||||
OPENSSL_assert(strcmp(eddsa_choices[EdDSA_NUM - 1].name, "ed448") == 0);
|
||||
|
||||
OPENSSL_assert(ec_curves[EC_NUM - 1].nid == NID_X448);
|
||||
OPENSSL_assert(strcmp(ecdh_choices[EC_NUM - 1].name, "ecdhx448") == 0);
|
||||
|
||||
OPENSSL_assert(ec_curves[ECDSA_NUM - 1].nid == NID_brainpoolP512t1);
|
||||
OPENSSL_assert(strcmp(ecdsa_choices[ECDSA_NUM - 1].name, "ecdsabrp512t1") == 0);
|
||||
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
OPENSSL_assert(sm2_curves[SM2_NUM - 1].nid == NID_sm2);
|
||||
OPENSSL_assert(strcmp(sm2_choices[SM2_NUM - 1].name, "curveSM2") == 0);
|
||||
# endif
|
||||
int ecdsa_doit[ECDSA_NUM] = { 0 };
|
||||
int ecdh_doit[EC_NUM] = { 0 };
|
||||
int eddsa_doit[EdDSA_NUM] = { 0 };
|
||||
int sm2_doit[SM2_NUM] = { 0 };
|
||||
OPENSSL_assert(OSSL_NELEM(test_curves) >= EC_NUM);
|
||||
OPENSSL_assert(OSSL_NELEM(test_ed_curves) >= EdDSA_NUM);
|
||||
OPENSSL_assert(OSSL_NELEM(test_sm2_curves) >= SM2_NUM);
|
||||
#endif /* ndef OPENSSL_NO_EC */
|
||||
|
||||
prog = opt_init(argc, argv, speed_options);
|
||||
@@ -1847,95 +1712,101 @@ int speed_main(int argc, char **argv)
|
||||
|
||||
/* Remaining arguments are algorithms. */
|
||||
for (; *argv; argv++) {
|
||||
if (found(*argv, doit_choices, &i)) {
|
||||
const char *algo = *argv;
|
||||
|
||||
if (opt_found(algo, doit_choices, &i)) {
|
||||
doit[i] = 1;
|
||||
continue;
|
||||
}
|
||||
#ifndef OPENSSL_NO_DES
|
||||
if (strcmp(*argv, "des") == 0) {
|
||||
if (strcmp(algo, "des") == 0) {
|
||||
doit[D_CBC_DES] = doit[D_EDE3_DES] = 1;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (strcmp(*argv, "sha") == 0) {
|
||||
if (strcmp(algo, "sha") == 0) {
|
||||
doit[D_SHA1] = doit[D_SHA256] = doit[D_SHA512] = 1;
|
||||
continue;
|
||||
}
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
if (strcmp(*argv, "openssl") == 0)
|
||||
continue;
|
||||
if (strcmp(*argv, "rsa") == 0) {
|
||||
for (loop = 0; loop < OSSL_NELEM(rsa_doit); loop++)
|
||||
rsa_doit[loop] = 1;
|
||||
continue;
|
||||
}
|
||||
if (found(*argv, rsa_choices, &i)) {
|
||||
rsa_doit[i] = 1;
|
||||
if (strcmp(algo, "openssl") == 0) /* just for compatibility */
|
||||
continue;
|
||||
if (strncmp(algo, "rsa", 3) == 0) {
|
||||
if (algo[3] == '\0') {
|
||||
memset(rsa_doit, 1, sizeof(rsa_doit));
|
||||
continue;
|
||||
}
|
||||
if (opt_found(algo, rsa_choices, &i)) {
|
||||
rsa_doit[i] = 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
if (strcmp(*argv, "dsa") == 0) {
|
||||
dsa_doit[R_DSA_512] = dsa_doit[R_DSA_1024] =
|
||||
dsa_doit[R_DSA_2048] = 1;
|
||||
continue;
|
||||
}
|
||||
if (found(*argv, dsa_choices, &i)) {
|
||||
dsa_doit[i] = 2;
|
||||
continue;
|
||||
if (strncmp(algo, "dsa", 3) == 0) {
|
||||
if (algo[3] == '\0') {
|
||||
memset(dsa_doit, 1, sizeof(dsa_doit));
|
||||
continue;
|
||||
}
|
||||
if (opt_found(algo, dsa_choices, &i)) {
|
||||
dsa_doit[i] = 2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (strcmp(*argv, "aes") == 0) {
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
if (strcmp(algo, "aes") == 0) {
|
||||
doit[D_CBC_128_AES] = doit[D_CBC_192_AES] = doit[D_CBC_256_AES] = 1;
|
||||
continue;
|
||||
}
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
if (strcmp(*argv, "camellia") == 0) {
|
||||
#endif
|
||||
#if !defined(OPENSSL_NO_CAMELLIA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (strcmp(algo, "camellia") == 0) {
|
||||
doit[D_CBC_128_CML] = doit[D_CBC_192_CML] = doit[D_CBC_256_CML] = 1;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC
|
||||
if (strcmp(*argv, "ecdsa") == 0) {
|
||||
for (loop = 0; loop < OSSL_NELEM(ecdsa_doit); loop++)
|
||||
ecdsa_doit[loop] = 1;
|
||||
if (strncmp(algo, "ecdsa", 5) == 0) {
|
||||
if (algo[5] == '\0') {
|
||||
memset(ecdsa_doit, 1, sizeof(ecdsa_doit));
|
||||
continue;
|
||||
}
|
||||
if (opt_found(algo, ecdsa_choices, &i)) {
|
||||
ecdsa_doit[i] = 2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (strncmp(algo, "ecdh", 4) == 0) {
|
||||
if (algo[4] == '\0') {
|
||||
memset(ecdh_doit, 1, sizeof(ecdh_doit));
|
||||
continue;
|
||||
}
|
||||
if (opt_found(algo, ecdh_choices, &i)) {
|
||||
ecdh_doit[i] = 2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (strcmp(algo, "eddsa") == 0) {
|
||||
memset(eddsa_doit, 1, sizeof(eddsa_doit));
|
||||
continue;
|
||||
}
|
||||
if (found(*argv, ecdsa_choices, &i)) {
|
||||
ecdsa_doit[i] = 2;
|
||||
continue;
|
||||
}
|
||||
if (strcmp(*argv, "ecdh") == 0) {
|
||||
for (loop = 0; loop < OSSL_NELEM(ecdh_doit); loop++)
|
||||
ecdh_doit[loop] = 1;
|
||||
continue;
|
||||
}
|
||||
if (found(*argv, ecdh_choices, &i)) {
|
||||
ecdh_doit[i] = 2;
|
||||
continue;
|
||||
}
|
||||
if (strcmp(*argv, "eddsa") == 0) {
|
||||
for (loop = 0; loop < OSSL_NELEM(eddsa_doit); loop++)
|
||||
eddsa_doit[loop] = 1;
|
||||
continue;
|
||||
}
|
||||
if (found(*argv, eddsa_choices, &i)) {
|
||||
if (opt_found(algo, eddsa_choices, &i)) {
|
||||
eddsa_doit[i] = 2;
|
||||
continue;
|
||||
}
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
if (strcmp(*argv, "sm2") == 0) {
|
||||
for (loop = 0; loop < OSSL_NELEM(sm2_doit); loop++)
|
||||
sm2_doit[loop] = 1;
|
||||
if (strcmp(algo, "sm2") == 0) {
|
||||
memset(sm2_doit, 1, sizeof(sm2_doit));
|
||||
continue;
|
||||
}
|
||||
if (found(*argv, sm2_choices, &i)) {
|
||||
if (opt_found(algo, sm2_choices, &i)) {
|
||||
sm2_doit[i] = 2;
|
||||
continue;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
BIO_printf(bio_err, "%s: Unknown algorithm %s\n", prog, *argv);
|
||||
#endif /* OPENSSL_NO_EC */
|
||||
BIO_printf(bio_err, "%s: Unknown algorithm %s\n", prog, algo);
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -2018,27 +1889,20 @@ int speed_main(int argc, char **argv)
|
||||
|
||||
/* No parameters; turn on everything. */
|
||||
if (argc == 0 && !doit[D_EVP] && !doit[D_EVP_HMAC] && !doit[D_EVP_CMAC]) {
|
||||
for (i = 0; i < ALGOR_NUM; i++)
|
||||
if (i != D_EVP && i != D_EVP_HMAC && i != D_EVP_CMAC)
|
||||
doit[i] = 1;
|
||||
memset(doit, 1, sizeof(doit));
|
||||
doit[D_EVP] = doit[D_EVP_HMAC] = doit[D_EVP_CMAC] = 0;
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
for (i = 0; i < RSA_NUM; i++)
|
||||
rsa_doit[i] = 1;
|
||||
memset(rsa_doit, 1, sizeof(rsa_doit));
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
for (i = 0; i < DSA_NUM; i++)
|
||||
dsa_doit[i] = 1;
|
||||
memset(dsa_doit, 1, sizeof(dsa_doit));
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC
|
||||
for (loop = 0; loop < OSSL_NELEM(ecdsa_doit); loop++)
|
||||
ecdsa_doit[loop] = 1;
|
||||
for (loop = 0; loop < OSSL_NELEM(ecdh_doit); loop++)
|
||||
ecdh_doit[loop] = 1;
|
||||
for (loop = 0; loop < OSSL_NELEM(eddsa_doit); loop++)
|
||||
eddsa_doit[loop] = 1;
|
||||
memset(ecdsa_doit, 1, sizeof(ecdsa_doit));
|
||||
memset(ecdh_doit, 1, sizeof(ecdh_doit));
|
||||
memset(eddsa_doit, 1, sizeof(eddsa_doit));
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
for (loop = 0; loop < OSSL_NELEM(sm2_doit); loop++)
|
||||
sm2_doit[loop] = 1;
|
||||
memset(sm2_doit, 1, sizeof(sm2_doit));
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
@@ -2058,11 +1922,10 @@ int speed_main(int argc, char **argv)
|
||||
break;
|
||||
}
|
||||
for (k = 0; k < RSA_NUM; k++) {
|
||||
const unsigned char *p;
|
||||
const unsigned char *p = rsa_keys[k].data;
|
||||
|
||||
p = rsa_data[k];
|
||||
loopargs[i].rsa_key[k] =
|
||||
d2i_RSAPrivateKey(NULL, &p, rsa_data_length[k]);
|
||||
d2i_RSAPrivateKey(NULL, &p, rsa_keys[k].length);
|
||||
if (loopargs[i].rsa_key[k] == NULL) {
|
||||
BIO_printf(bio_err,
|
||||
"internal error loading RSA key number %d\n", k);
|
||||
@@ -2079,41 +1942,59 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
DES_set_key_unchecked(&key, &sch);
|
||||
DES_set_key_unchecked(&key2, &sch2);
|
||||
DES_set_key_unchecked(&key3, &sch3);
|
||||
if (doit[D_CBC_DES] || doit[D_EDE3_DES]) {
|
||||
static DES_cblock keys[] = {
|
||||
{ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 }, /* keys[0] */
|
||||
{ 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12 }, /* keys[1] */
|
||||
{ 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34 } /* keys[3] */
|
||||
};
|
||||
DES_set_key_unchecked(&keys[0], &sch[0]);
|
||||
DES_set_key_unchecked(&keys[1], &sch[1]);
|
||||
DES_set_key_unchecked(&keys[2], &sch[2]);
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
AES_set_encrypt_key(key16, 128, &aes_ks1);
|
||||
AES_set_encrypt_key(key24, 192, &aes_ks2);
|
||||
AES_set_encrypt_key(key32, 256, &aes_ks3);
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
Camellia_set_key(key16, 128, &camellia_ks1);
|
||||
Camellia_set_key(ckey24, 192, &camellia_ks2);
|
||||
Camellia_set_key(ckey32, 256, &camellia_ks3);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_IDEA
|
||||
IDEA_set_encrypt_key(key16, &idea_ks);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SEED
|
||||
SEED_set_key(key16, &seed_ks);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC4
|
||||
RC4_set_key(&rc4_ks, 16, key16);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC2
|
||||
RC2_set_key(&rc2_ks, 16, key16, 128);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC5
|
||||
if (!RC5_32_set_key(&rc5_ks, 16, key16, 12)) {
|
||||
BIO_printf(bio_err, "Failed setting RC5 key\n");
|
||||
goto end;
|
||||
#if !defined(OPENSSL_NO_CAMELLIA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_CBC_128_CML] || doit[D_CBC_192_CML] || doit[D_CBC_256_CML]) {
|
||||
Camellia_set_key(key16, 128, &camellia_ks[0]);
|
||||
Camellia_set_key(key24, 192, &camellia_ks[1]);
|
||||
Camellia_set_key(key32, 256, &camellia_ks[2]);
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_BF
|
||||
BF_set_key(&bf_ks, 16, key16);
|
||||
#ifndef OPENSSL_NO_IDEA
|
||||
if (doit[D_CBC_IDEA])
|
||||
IDEA_set_encrypt_key(key16, &idea_ks);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAST
|
||||
CAST_set_key(&cast_ks, 16, key16);
|
||||
#if !defined(OPENSSL_NO_SEED) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_CBC_SEED])
|
||||
SEED_set_key(key16, &seed_ks);
|
||||
#endif
|
||||
#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_RC4])
|
||||
RC4_set_key(&rc4_ks, 16, key16);
|
||||
#endif
|
||||
#if !defined(OPENSSL_NO_RC2) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_CBC_RC2])
|
||||
RC2_set_key(&rc2_ks, 16, key16, 128);
|
||||
#endif
|
||||
#if !defined(OPENSSL_NO_RC5) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_CBC_RC5])
|
||||
if (!RC5_32_set_key(&rc5_ks, 16, key16, 12)) {
|
||||
BIO_printf(bio_err, "Failed setting RC5 key\n");
|
||||
goto end;
|
||||
}
|
||||
#endif
|
||||
#if !defined(OPENSSL_NO_BF) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_CBC_BF])
|
||||
BF_set_key(&bf_ks, 16, key16);
|
||||
#endif
|
||||
#if !defined(OPENSSL_NO_CAST) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_CBC_CAST])
|
||||
CAST_set_key(&cast_ks, 16, key16);
|
||||
#endif
|
||||
#ifndef SIGALRM
|
||||
# ifndef OPENSSL_NO_DES
|
||||
@@ -2128,7 +2009,6 @@ int speed_main(int argc, char **argv)
|
||||
(DES_cblock *)loopargs[0].buf, &sch, DES_ENCRYPT);
|
||||
d = Time_F(STOP);
|
||||
} while (d < 3);
|
||||
save_count = count;
|
||||
c[D_MD2][0] = count / 10;
|
||||
c[D_MDC2][0] = count / 10;
|
||||
c[D_MD4][0] = count;
|
||||
@@ -2151,6 +2031,7 @@ int speed_main(int argc, char **argv)
|
||||
c[D_CBC_128_CML][0] = count;
|
||||
c[D_CBC_192_CML][0] = count;
|
||||
c[D_CBC_256_CML][0] = count;
|
||||
c[D_EVP][0] = count;
|
||||
c[D_SHA256][0] = count;
|
||||
c[D_SHA512][0] = count;
|
||||
c[D_WHIRLPOOL][0] = count;
|
||||
@@ -2159,12 +2040,12 @@ int speed_main(int argc, char **argv)
|
||||
c[D_IGE_256_AES][0] = count;
|
||||
c[D_GHASH][0] = count;
|
||||
c[D_RAND][0] = count;
|
||||
c[D_EVP_HMAC][0] = count;
|
||||
c[D_EVP_CMAC][0] = count;
|
||||
|
||||
for (i = 1; i < size_num; i++) {
|
||||
long l0, l1;
|
||||
|
||||
l0 = (long)lengths[0];
|
||||
l1 = (long)lengths[i];
|
||||
long l0 = (long)lengths[0];
|
||||
long l1 = (long)lengths[i];
|
||||
|
||||
c[D_MD2][i] = c[D_MD2][0] * 4 * l0 / l1;
|
||||
c[D_MDC2][i] = c[D_MDC2][0] * 4 * l0 / l1;
|
||||
@@ -2173,11 +2054,14 @@ int speed_main(int argc, char **argv)
|
||||
c[D_HMAC][i] = c[D_HMAC][0] * 4 * l0 / l1;
|
||||
c[D_SHA1][i] = c[D_SHA1][0] * 4 * l0 / l1;
|
||||
c[D_RMD160][i] = c[D_RMD160][0] * 4 * l0 / l1;
|
||||
c[D_EVP][i] = = c[D_EVP][0] * 4 * l0 / l1;
|
||||
c[D_SHA256][i] = c[D_SHA256][0] * 4 * l0 / l1;
|
||||
c[D_SHA512][i] = c[D_SHA512][0] * 4 * l0 / l1;
|
||||
c[D_WHIRLPOOL][i] = c[D_WHIRLPOOL][0] * 4 * l0 / l1;
|
||||
c[D_GHASH][i] = c[D_GHASH][0] * 4 * l0 / l1;
|
||||
c[D_RAND][i] = c[D_RAND][0] * 4 * l0 / l1;
|
||||
c[D_EVP_HMAC][i] = = c[D_EVP_HMAC][0] * 4 * l0 / l1;
|
||||
c[D_EVP_CMAC][i] = = c[D_EVP_CMAC][0] * 4 * l0 / l1;
|
||||
|
||||
l0 = (long)lengths[i - 1];
|
||||
|
||||
@@ -2349,7 +2233,7 @@ int speed_main(int argc, char **argv)
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
sm2_c[R_EC_SM2P256][0] = count / 1800;
|
||||
# endif
|
||||
# endif
|
||||
# endif /* OPENSSL_NO_EC */
|
||||
|
||||
# else
|
||||
/* not worth fixing */
|
||||
@@ -2359,7 +2243,7 @@ int speed_main(int argc, char **argv)
|
||||
signal(SIGALRM, alarmed);
|
||||
#endif /* SIGALRM */
|
||||
|
||||
#ifndef OPENSSL_NO_MD2
|
||||
#if !defined(OPENSSL_NO_MD2) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_MD2]) {
|
||||
for (testnum = 0; testnum < size_num; testnum++) {
|
||||
print_message(names[D_MD2], c[D_MD2][testnum], lengths[testnum],
|
||||
@@ -2371,7 +2255,7 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_MDC2
|
||||
#if !defined(OPENSSL_NO_MDC2) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_MDC2]) {
|
||||
for (testnum = 0; testnum < size_num; testnum++) {
|
||||
print_message(names[D_MDC2], c[D_MDC2][testnum], lengths[testnum],
|
||||
@@ -2380,11 +2264,13 @@ int speed_main(int argc, char **argv)
|
||||
count = run_benchmark(async_jobs, EVP_Digest_MDC2_loop, loopargs);
|
||||
d = Time_F(STOP);
|
||||
print_result(D_MDC2, testnum, count, d);
|
||||
if (count < 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_MD4
|
||||
#if !defined(OPENSSL_NO_MD4) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_MD4]) {
|
||||
for (testnum = 0; testnum < size_num; testnum++) {
|
||||
print_message(names[D_MD4], c[D_MD4][testnum], lengths[testnum],
|
||||
@@ -2393,6 +2279,8 @@ int speed_main(int argc, char **argv)
|
||||
count = run_benchmark(async_jobs, EVP_Digest_MD4_loop, loopargs);
|
||||
d = Time_F(STOP);
|
||||
print_result(D_MD4, testnum, count, d);
|
||||
if (count < 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -2430,9 +2318,8 @@ int speed_main(int argc, char **argv)
|
||||
d = Time_F(STOP);
|
||||
print_result(D_HMAC, testnum, count, d);
|
||||
}
|
||||
for (i = 0; i < loopargs_len; i++) {
|
||||
for (i = 0; i < loopargs_len; i++)
|
||||
HMAC_CTX_free(loopargs[i].hctx);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (doit[D_SHA1]) {
|
||||
@@ -2465,7 +2352,7 @@ int speed_main(int argc, char **argv)
|
||||
print_result(D_SHA512, testnum, count, d);
|
||||
}
|
||||
}
|
||||
#ifndef OPENSSL_NO_WHIRLPOOL
|
||||
#if !defined(OPENSSL_NO_WHIRLPOOL) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_WHIRLPOOL]) {
|
||||
for (testnum = 0; testnum < size_num; testnum++) {
|
||||
print_message(names[D_WHIRLPOOL], c[D_WHIRLPOOL][testnum],
|
||||
@@ -2478,7 +2365,7 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_RMD160
|
||||
#if !defined(OPENSSL_NO_RMD160) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_RMD160]) {
|
||||
for (testnum = 0; testnum < size_num; testnum++) {
|
||||
print_message(names[D_RMD160], c[D_RMD160][testnum],
|
||||
@@ -2487,10 +2374,12 @@ int speed_main(int argc, char **argv)
|
||||
count = run_benchmark(async_jobs, EVP_Digest_RMD160_loop, loopargs);
|
||||
d = Time_F(STOP);
|
||||
print_result(D_RMD160, testnum, count, d);
|
||||
if (count < 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC4
|
||||
#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_RC4]) {
|
||||
for (testnum = 0; testnum < size_num; testnum++) {
|
||||
print_message(names[D_RC4], c[D_RC4][testnum], lengths[testnum],
|
||||
@@ -2527,6 +2416,7 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
if (doit[D_CBC_128_AES]) {
|
||||
for (testnum = 0; testnum < size_num; testnum++) {
|
||||
print_message(names[D_CBC_128_AES], c[D_CBC_128_AES][testnum],
|
||||
@@ -2561,7 +2451,7 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
#if !OPENSSL_API_3
|
||||
|
||||
if (doit[D_IGE_128_AES]) {
|
||||
for (testnum = 0; testnum < size_num; testnum++) {
|
||||
print_message(names[D_IGE_128_AES], c[D_IGE_128_AES][testnum],
|
||||
@@ -2595,7 +2485,6 @@ int speed_main(int argc, char **argv)
|
||||
print_result(D_IGE_256_AES, testnum, count, d);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (doit[D_GHASH]) {
|
||||
for (i = 0; i < loopargs_len; i++) {
|
||||
loopargs[i].gcm_ctx =
|
||||
@@ -2615,7 +2504,8 @@ int speed_main(int argc, char **argv)
|
||||
for (i = 0; i < loopargs_len; i++)
|
||||
CRYPTO_gcm128_release(loopargs[i].gcm_ctx);
|
||||
}
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
#endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
||||
#if !defined(OPENSSL_NO_CAMELLIA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_CBC_128_CML]) {
|
||||
if (async_jobs > 0) {
|
||||
BIO_printf(bio_err, "Async mode is not supported with %s\n",
|
||||
@@ -2626,9 +2516,9 @@ int speed_main(int argc, char **argv)
|
||||
print_message(names[D_CBC_128_CML], c[D_CBC_128_CML][testnum],
|
||||
lengths[testnum], seconds.sym);
|
||||
Time_F(START);
|
||||
for (count = 0, run = 1; COND(c[D_CBC_128_CML][testnum]); count++)
|
||||
for (count = 0; COND(c[D_CBC_128_CML][testnum]); count++)
|
||||
Camellia_cbc_encrypt(loopargs[0].buf, loopargs[0].buf,
|
||||
(size_t)lengths[testnum], &camellia_ks1,
|
||||
(size_t)lengths[testnum], &camellia_ks[0],
|
||||
iv, CAMELLIA_ENCRYPT);
|
||||
d = Time_F(STOP);
|
||||
print_result(D_CBC_128_CML, testnum, count, d);
|
||||
@@ -2648,9 +2538,9 @@ int speed_main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
Time_F(START);
|
||||
for (count = 0, run = 1; COND(c[D_CBC_192_CML][testnum]); count++)
|
||||
for (count = 0; COND(c[D_CBC_192_CML][testnum]); count++)
|
||||
Camellia_cbc_encrypt(loopargs[0].buf, loopargs[0].buf,
|
||||
(size_t)lengths[testnum], &camellia_ks2,
|
||||
(size_t)lengths[testnum], &camellia_ks[1],
|
||||
iv, CAMELLIA_ENCRYPT);
|
||||
d = Time_F(STOP);
|
||||
print_result(D_CBC_192_CML, testnum, count, d);
|
||||
@@ -2666,9 +2556,9 @@ int speed_main(int argc, char **argv)
|
||||
print_message(names[D_CBC_256_CML], c[D_CBC_256_CML][testnum],
|
||||
lengths[testnum], seconds.sym);
|
||||
Time_F(START);
|
||||
for (count = 0, run = 1; COND(c[D_CBC_256_CML][testnum]); count++)
|
||||
for (count = 0; COND(c[D_CBC_256_CML][testnum]); count++)
|
||||
Camellia_cbc_encrypt(loopargs[0].buf, loopargs[0].buf,
|
||||
(size_t)lengths[testnum], &camellia_ks3,
|
||||
(size_t)lengths[testnum], &camellia_ks[2],
|
||||
iv, CAMELLIA_ENCRYPT);
|
||||
d = Time_F(STOP);
|
||||
print_result(D_CBC_256_CML, testnum, count, d);
|
||||
@@ -2686,7 +2576,7 @@ int speed_main(int argc, char **argv)
|
||||
print_message(names[D_CBC_IDEA], c[D_CBC_IDEA][testnum],
|
||||
lengths[testnum], seconds.sym);
|
||||
Time_F(START);
|
||||
for (count = 0, run = 1; COND(c[D_CBC_IDEA][testnum]); count++)
|
||||
for (count = 0; COND(c[D_CBC_IDEA][testnum]); count++)
|
||||
IDEA_cbc_encrypt(loopargs[0].buf, loopargs[0].buf,
|
||||
(size_t)lengths[testnum], &idea_ks,
|
||||
iv, IDEA_ENCRYPT);
|
||||
@@ -2695,7 +2585,7 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SEED
|
||||
#if !defined(OPENSSL_NO_SEED) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_CBC_SEED]) {
|
||||
if (async_jobs > 0) {
|
||||
BIO_printf(bio_err, "Async mode is not supported with %s\n",
|
||||
@@ -2706,7 +2596,7 @@ int speed_main(int argc, char **argv)
|
||||
print_message(names[D_CBC_SEED], c[D_CBC_SEED][testnum],
|
||||
lengths[testnum], seconds.sym);
|
||||
Time_F(START);
|
||||
for (count = 0, run = 1; COND(c[D_CBC_SEED][testnum]); count++)
|
||||
for (count = 0; COND(c[D_CBC_SEED][testnum]); count++)
|
||||
SEED_cbc_encrypt(loopargs[0].buf, loopargs[0].buf,
|
||||
(size_t)lengths[testnum], &seed_ks, iv, 1);
|
||||
d = Time_F(STOP);
|
||||
@@ -2714,7 +2604,7 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC2
|
||||
#if !defined(OPENSSL_NO_RC2) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_CBC_RC2]) {
|
||||
if (async_jobs > 0) {
|
||||
BIO_printf(bio_err, "Async mode is not supported with %s\n",
|
||||
@@ -2729,7 +2619,7 @@ int speed_main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
Time_F(START);
|
||||
for (count = 0, run = 1; COND(c[D_CBC_RC2][testnum]); count++)
|
||||
for (count = 0; COND(c[D_CBC_RC2][testnum]); count++)
|
||||
RC2_cbc_encrypt(loopargs[0].buf, loopargs[0].buf,
|
||||
(size_t)lengths[testnum], &rc2_ks,
|
||||
iv, RC2_ENCRYPT);
|
||||
@@ -2738,7 +2628,7 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC5
|
||||
#if !defined(OPENSSL_NO_RC5) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_CBC_RC5]) {
|
||||
if (async_jobs > 0) {
|
||||
BIO_printf(bio_err, "Async mode is not supported with %s\n",
|
||||
@@ -2753,7 +2643,7 @@ int speed_main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
Time_F(START);
|
||||
for (count = 0, run = 1; COND(c[D_CBC_RC5][testnum]); count++)
|
||||
for (count = 0; COND(c[D_CBC_RC5][testnum]); count++)
|
||||
RC5_32_cbc_encrypt(loopargs[0].buf, loopargs[0].buf,
|
||||
(size_t)lengths[testnum], &rc5_ks,
|
||||
iv, RC5_ENCRYPT);
|
||||
@@ -2762,7 +2652,7 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_BF
|
||||
#if !defined(OPENSSL_NO_BF) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_CBC_BF]) {
|
||||
if (async_jobs > 0) {
|
||||
BIO_printf(bio_err, "Async mode is not supported with %s\n",
|
||||
@@ -2773,7 +2663,7 @@ int speed_main(int argc, char **argv)
|
||||
print_message(names[D_CBC_BF], c[D_CBC_BF][testnum],
|
||||
lengths[testnum], seconds.sym);
|
||||
Time_F(START);
|
||||
for (count = 0, run = 1; COND(c[D_CBC_BF][testnum]); count++)
|
||||
for (count = 0; COND(c[D_CBC_BF][testnum]); count++)
|
||||
BF_cbc_encrypt(loopargs[0].buf, loopargs[0].buf,
|
||||
(size_t)lengths[testnum], &bf_ks,
|
||||
iv, BF_ENCRYPT);
|
||||
@@ -2782,7 +2672,7 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAST
|
||||
#if !defined(OPENSSL_NO_CAST) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (doit[D_CBC_CAST]) {
|
||||
if (async_jobs > 0) {
|
||||
BIO_printf(bio_err, "Async mode is not supported with %s\n",
|
||||
@@ -2793,7 +2683,7 @@ int speed_main(int argc, char **argv)
|
||||
print_message(names[D_CBC_CAST], c[D_CBC_CAST][testnum],
|
||||
lengths[testnum], seconds.sym);
|
||||
Time_F(START);
|
||||
for (count = 0, run = 1; COND(c[D_CBC_CAST][testnum]); count++)
|
||||
for (count = 0; COND(c[D_CBC_CAST][testnum]); count++)
|
||||
CAST_cbc_encrypt(loopargs[0].buf, loopargs[0].buf,
|
||||
(size_t)lengths[testnum], &cast_ks,
|
||||
iv, CAST_ENCRYPT);
|
||||
@@ -2815,7 +2705,7 @@ int speed_main(int argc, char **argv)
|
||||
|
||||
if (doit[D_EVP]) {
|
||||
if (evp_cipher != NULL) {
|
||||
int (*loopfunc)(void *args) = EVP_Update_loop;
|
||||
int (*loopfunc) (void *) = EVP_Update_loop;
|
||||
|
||||
if (multiblock && (EVP_CIPHER_flags(evp_cipher) &
|
||||
EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK)) {
|
||||
@@ -2838,7 +2728,7 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
for (testnum = 0; testnum < size_num; testnum++) {
|
||||
print_message(names[D_EVP], save_count, lengths[testnum],
|
||||
print_message(names[D_EVP], c[D_EVP][testnum], lengths[testnum],
|
||||
seconds.sym);
|
||||
|
||||
for (k = 0; k < loopargs_len; k++) {
|
||||
@@ -2884,7 +2774,7 @@ int speed_main(int argc, char **argv)
|
||||
names[D_EVP] = OBJ_nid2ln(EVP_MD_type(evp_md));
|
||||
|
||||
for (testnum = 0; testnum < size_num; testnum++) {
|
||||
print_message(names[D_EVP], save_count, lengths[testnum],
|
||||
print_message(names[D_EVP], c[D_EVP][testnum], lengths[testnum],
|
||||
seconds.sym);
|
||||
Time_F(START);
|
||||
count = run_benchmark(async_jobs, EVP_Digest_loop, loopargs);
|
||||
@@ -2894,52 +2784,50 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (doit[D_EVP_HMAC]) {
|
||||
if (evp_hmac_md != NULL) {
|
||||
const char *md_name = OBJ_nid2ln(EVP_MD_type(evp_hmac_md));
|
||||
evp_hmac_name = app_malloc(sizeof("HMAC()") + strlen(md_name),
|
||||
"HMAC name");
|
||||
sprintf(evp_hmac_name, "HMAC(%s)", md_name);
|
||||
names[D_EVP_HMAC] = evp_hmac_name;
|
||||
if (doit[D_EVP_HMAC] && evp_hmac_md != NULL) {
|
||||
const char *md_name = OBJ_nid2ln(EVP_MD_type(evp_hmac_md));
|
||||
|
||||
for (testnum = 0; testnum < size_num; testnum++) {
|
||||
print_message(names[D_EVP_HMAC], save_count, lengths[testnum],
|
||||
seconds.sym);
|
||||
Time_F(START);
|
||||
count = run_benchmark(async_jobs, EVP_HMAC_loop, loopargs);
|
||||
d = Time_F(STOP);
|
||||
print_result(D_EVP_HMAC, testnum, count, d);
|
||||
}
|
||||
evp_hmac_name = app_malloc(sizeof("HMAC()") + strlen(md_name),
|
||||
"HMAC name");
|
||||
sprintf(evp_hmac_name, "HMAC(%s)", md_name);
|
||||
names[D_EVP_HMAC] = evp_hmac_name;
|
||||
|
||||
for (testnum = 0; testnum < size_num; testnum++) {
|
||||
print_message(names[D_EVP_HMAC], c[D_EVP_HMAC][testnum], lengths[testnum],
|
||||
seconds.sym);
|
||||
Time_F(START);
|
||||
count = run_benchmark(async_jobs, EVP_HMAC_loop, loopargs);
|
||||
d = Time_F(STOP);
|
||||
print_result(D_EVP_HMAC, testnum, count, d);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_CMAC
|
||||
if (doit[D_EVP_CMAC]) {
|
||||
if (evp_cmac_cipher != NULL) {
|
||||
const char *cipher_name = OBJ_nid2ln(EVP_CIPHER_type(evp_cmac_cipher));
|
||||
evp_cmac_name = app_malloc(sizeof("CMAC()") + strlen(cipher_name),
|
||||
"CMAC name");
|
||||
sprintf(evp_cmac_name, "CMAC(%s)", cipher_name);
|
||||
names[D_EVP_CMAC] = evp_cmac_name;
|
||||
if (doit[D_EVP_CMAC] && evp_cmac_cipher != NULL) {
|
||||
const char *cipher_name = OBJ_nid2ln(EVP_CIPHER_type(evp_cmac_cipher));
|
||||
|
||||
for (i = 0; i < loopargs_len; i++) {
|
||||
loopargs[i].cmac_ctx = CMAC_CTX_new();
|
||||
if (loopargs[i].cmac_ctx == NULL) {
|
||||
BIO_printf(bio_err, "CMAC malloc failure, exiting...");
|
||||
exit(1);
|
||||
}
|
||||
evp_cmac_name = app_malloc(sizeof("CMAC()") + strlen(cipher_name),
|
||||
"CMAC name");
|
||||
sprintf(evp_cmac_name, "CMAC(%s)", cipher_name);
|
||||
names[D_EVP_CMAC] = evp_cmac_name;
|
||||
|
||||
for (i = 0; i < loopargs_len; i++) {
|
||||
loopargs[i].cmac_ctx = CMAC_CTX_new();
|
||||
if (loopargs[i].cmac_ctx == NULL) {
|
||||
BIO_printf(bio_err, "CMAC malloc failure, exiting...");
|
||||
exit(1);
|
||||
}
|
||||
for (testnum = 0; testnum < size_num; testnum++) {
|
||||
print_message(names[D_EVP_CMAC], save_count, lengths[testnum],
|
||||
seconds.sym);
|
||||
Time_F(START);
|
||||
count = run_benchmark(async_jobs, EVP_CMAC_loop, loopargs);
|
||||
d = Time_F(STOP);
|
||||
print_result(D_EVP_CMAC, testnum, count, d);
|
||||
}
|
||||
for (i = 0; i < loopargs_len; i++)
|
||||
CMAC_CTX_free(loopargs[i].cmac_ctx);
|
||||
}
|
||||
for (testnum = 0; testnum < size_num; testnum++) {
|
||||
print_message(names[D_EVP_CMAC], c[D_EVP_CMAC][testnum], lengths[testnum],
|
||||
seconds.sym);
|
||||
Time_F(START);
|
||||
count = run_benchmark(async_jobs, EVP_CMAC_loop, loopargs);
|
||||
d = Time_F(STOP);
|
||||
print_result(D_EVP_CMAC, testnum, count, d);
|
||||
}
|
||||
for (i = 0; i < loopargs_len; i++)
|
||||
CMAC_CTX_free(loopargs[i].cmac_ctx);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2953,7 +2841,7 @@ int speed_main(int argc, char **argv)
|
||||
if (!rsa_doit[testnum])
|
||||
continue;
|
||||
for (i = 0; i < loopargs_len; i++) {
|
||||
if (primes > 2) {
|
||||
if (primes > RSA_DEFAULT_PRIME_NUM) {
|
||||
/* we haven't set keys yet, generate multi-prime RSA keys */
|
||||
BIGNUM *bn = BN_new();
|
||||
|
||||
@@ -2974,7 +2862,7 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (!RSA_generate_multi_prime_key(loopargs[i].rsa_key[testnum],
|
||||
rsa_bits[testnum],
|
||||
rsa_keys[testnum].bits,
|
||||
primes, bn, NULL)) {
|
||||
BN_free(bn);
|
||||
goto end;
|
||||
@@ -2993,7 +2881,7 @@ int speed_main(int argc, char **argv)
|
||||
rsa_count = 1;
|
||||
} else {
|
||||
pkey_print_message("private", "rsa",
|
||||
rsa_c[testnum][0], rsa_bits[testnum],
|
||||
rsa_c[testnum][0], rsa_keys[testnum].bits,
|
||||
seconds.rsa);
|
||||
/* RSA_blinding_on(rsa_key[testnum],NULL); */
|
||||
Time_F(START);
|
||||
@@ -3002,7 +2890,7 @@ int speed_main(int argc, char **argv)
|
||||
BIO_printf(bio_err,
|
||||
mr ? "+R1:%ld:%d:%.2f\n"
|
||||
: "%ld %u bits private RSA's in %.2fs\n",
|
||||
count, rsa_bits[testnum], d);
|
||||
count, rsa_keys[testnum].bits, d);
|
||||
rsa_results[testnum][0] = (double)count / d;
|
||||
rsa_count = count;
|
||||
}
|
||||
@@ -3020,7 +2908,7 @@ int speed_main(int argc, char **argv)
|
||||
rsa_doit[testnum] = 0;
|
||||
} else {
|
||||
pkey_print_message("public", "rsa",
|
||||
rsa_c[testnum][1], rsa_bits[testnum],
|
||||
rsa_c[testnum][1], rsa_keys[testnum].bits,
|
||||
seconds.rsa);
|
||||
Time_F(START);
|
||||
count = run_benchmark(async_jobs, RSA_verify_loop, loopargs);
|
||||
@@ -3028,14 +2916,13 @@ int speed_main(int argc, char **argv)
|
||||
BIO_printf(bio_err,
|
||||
mr ? "+R2:%ld:%d:%.2f\n"
|
||||
: "%ld %u bits public RSA's in %.2fs\n",
|
||||
count, rsa_bits[testnum], d);
|
||||
count, rsa_keys[testnum].bits, d);
|
||||
rsa_results[testnum][1] = (double)count / d;
|
||||
}
|
||||
|
||||
if (rsa_count <= 1) {
|
||||
/* if longer than 10s, don't do any more */
|
||||
for (testnum++; testnum < RSA_NUM; testnum++)
|
||||
rsa_doit[testnum] = 0;
|
||||
stop_it(rsa_doit, testnum);
|
||||
}
|
||||
}
|
||||
#endif /* OPENSSL_NO_RSA */
|
||||
@@ -3105,8 +2992,7 @@ int speed_main(int argc, char **argv)
|
||||
|
||||
if (rsa_count <= 1) {
|
||||
/* if longer than 10s, don't do any more */
|
||||
for (testnum++; testnum < DSA_NUM; testnum++)
|
||||
dsa_doit[testnum] = 0;
|
||||
stop_it(dsa_doit, testnum);
|
||||
}
|
||||
}
|
||||
#endif /* OPENSSL_NO_DSA */
|
||||
@@ -3119,7 +3005,7 @@ int speed_main(int argc, char **argv)
|
||||
continue; /* Ignore Curve */
|
||||
for (i = 0; i < loopargs_len; i++) {
|
||||
loopargs[i].ecdsa[testnum] =
|
||||
EC_KEY_new_by_curve_name(test_curves[testnum].nid);
|
||||
EC_KEY_new_by_curve_name(ec_curves[testnum].nid);
|
||||
if (loopargs[i].ecdsa[testnum] == NULL) {
|
||||
st = 0;
|
||||
break;
|
||||
@@ -3148,7 +3034,7 @@ int speed_main(int argc, char **argv)
|
||||
} else {
|
||||
pkey_print_message("sign", "ecdsa",
|
||||
ecdsa_c[testnum][0],
|
||||
test_curves[testnum].bits, seconds.ecdsa);
|
||||
ec_curves[testnum].bits, seconds.ecdsa);
|
||||
Time_F(START);
|
||||
count = run_benchmark(async_jobs, ECDSA_sign_loop, loopargs);
|
||||
d = Time_F(STOP);
|
||||
@@ -3156,7 +3042,7 @@ int speed_main(int argc, char **argv)
|
||||
BIO_printf(bio_err,
|
||||
mr ? "+R5:%ld:%u:%.2f\n" :
|
||||
"%ld %u bits ECDSA signs in %.2fs \n",
|
||||
count, test_curves[testnum].bits, d);
|
||||
count, ec_curves[testnum].bits, d);
|
||||
ecdsa_results[testnum][0] = (double)count / d;
|
||||
rsa_count = count;
|
||||
}
|
||||
@@ -3177,21 +3063,20 @@ int speed_main(int argc, char **argv)
|
||||
} else {
|
||||
pkey_print_message("verify", "ecdsa",
|
||||
ecdsa_c[testnum][1],
|
||||
test_curves[testnum].bits, seconds.ecdsa);
|
||||
ec_curves[testnum].bits, seconds.ecdsa);
|
||||
Time_F(START);
|
||||
count = run_benchmark(async_jobs, ECDSA_verify_loop, loopargs);
|
||||
d = Time_F(STOP);
|
||||
BIO_printf(bio_err,
|
||||
mr ? "+R6:%ld:%u:%.2f\n"
|
||||
: "%ld %u bits ECDSA verify in %.2fs\n",
|
||||
count, test_curves[testnum].bits, d);
|
||||
count, ec_curves[testnum].bits, d);
|
||||
ecdsa_results[testnum][1] = (double)count / d;
|
||||
}
|
||||
|
||||
if (rsa_count <= 1) {
|
||||
/* if longer than 10s, don't do any more */
|
||||
for (testnum++; testnum < ECDSA_NUM; testnum++)
|
||||
ecdsa_doit[testnum] = 0;
|
||||
stop_it(ecdsa_doit, testnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3224,7 +3109,7 @@ int speed_main(int argc, char **argv)
|
||||
* If this fails we try creating a EVP_PKEY_EC generic param ctx,
|
||||
* then we set the curve by NID before deriving the actual keygen
|
||||
* ctx for that specific curve. */
|
||||
kctx = EVP_PKEY_CTX_new_id(test_curves[testnum].nid, NULL); /* keygen ctx from NID */
|
||||
kctx = EVP_PKEY_CTX_new_id(ec_curves[testnum].nid, NULL); /* keygen ctx from NID */
|
||||
if (!kctx) {
|
||||
EVP_PKEY_CTX *pctx = NULL;
|
||||
EVP_PKEY *params = NULL;
|
||||
@@ -3247,13 +3132,13 @@ int speed_main(int argc, char **argv)
|
||||
break;
|
||||
}
|
||||
|
||||
if ( /* Create the context for parameter generation */
|
||||
!(pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_EC, NULL)) ||
|
||||
/* Create the context for parameter generation */
|
||||
if (!(pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_EC, NULL)) ||
|
||||
/* Initialise the parameter generation */
|
||||
!EVP_PKEY_paramgen_init(pctx) ||
|
||||
/* Set the curve by NID */
|
||||
!EVP_PKEY_CTX_set_ec_paramgen_curve_nid(pctx,
|
||||
test_curves
|
||||
ec_curves
|
||||
[testnum].nid) ||
|
||||
/* Create the parameter object params */
|
||||
!EVP_PKEY_paramgen(pctx, ¶ms)) {
|
||||
@@ -3336,7 +3221,7 @@ int speed_main(int argc, char **argv)
|
||||
if (ecdh_checks != 0) {
|
||||
pkey_print_message("", "ecdh",
|
||||
ecdh_c[testnum][0],
|
||||
test_curves[testnum].bits, seconds.ecdh);
|
||||
ec_curves[testnum].bits, seconds.ecdh);
|
||||
Time_F(START);
|
||||
count =
|
||||
run_benchmark(async_jobs, ECDH_EVP_derive_key_loop, loopargs);
|
||||
@@ -3344,15 +3229,14 @@ int speed_main(int argc, char **argv)
|
||||
BIO_printf(bio_err,
|
||||
mr ? "+R7:%ld:%d:%.2f\n" :
|
||||
"%ld %u-bits ECDH ops in %.2fs\n", count,
|
||||
test_curves[testnum].bits, d);
|
||||
ec_curves[testnum].bits, d);
|
||||
ecdh_results[testnum][0] = (double)count / d;
|
||||
rsa_count = count;
|
||||
}
|
||||
|
||||
if (rsa_count <= 1) {
|
||||
/* if longer than 10s, don't do any more */
|
||||
for (testnum++; testnum < OSSL_NELEM(ecdh_doit); testnum++)
|
||||
ecdh_doit[testnum] = 0;
|
||||
stop_it(ecdh_doit, testnum);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3370,7 +3254,7 @@ int speed_main(int argc, char **argv)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((ed_pctx = EVP_PKEY_CTX_new_id(test_ed_curves[testnum].nid, NULL))
|
||||
if ((ed_pctx = EVP_PKEY_CTX_new_id(ed_curves[testnum].nid, NULL))
|
||||
== NULL
|
||||
|| EVP_PKEY_keygen_init(ed_pctx) <= 0
|
||||
|| EVP_PKEY_keygen(ed_pctx, &ed_pkey) <= 0) {
|
||||
@@ -3395,7 +3279,7 @@ int speed_main(int argc, char **argv)
|
||||
} else {
|
||||
for (i = 0; i < loopargs_len; i++) {
|
||||
/* Perform EdDSA signature test */
|
||||
loopargs[i].sigsize = test_ed_curves[testnum].sigsize;
|
||||
loopargs[i].sigsize = ed_curves[testnum].sigsize;
|
||||
st = EVP_DigestSign(loopargs[i].eddsa_ctx[testnum],
|
||||
loopargs[i].buf2, &loopargs[i].sigsize,
|
||||
loopargs[i].buf, 20);
|
||||
@@ -3408,9 +3292,9 @@ int speed_main(int argc, char **argv)
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count = 1;
|
||||
} else {
|
||||
pkey_print_message("sign", test_ed_curves[testnum].name,
|
||||
pkey_print_message("sign", ed_curves[testnum].name,
|
||||
eddsa_c[testnum][0],
|
||||
test_ed_curves[testnum].bits, seconds.eddsa);
|
||||
ed_curves[testnum].bits, seconds.eddsa);
|
||||
Time_F(START);
|
||||
count = run_benchmark(async_jobs, EdDSA_sign_loop, loopargs);
|
||||
d = Time_F(STOP);
|
||||
@@ -3418,8 +3302,8 @@ int speed_main(int argc, char **argv)
|
||||
BIO_printf(bio_err,
|
||||
mr ? "+R8:%ld:%u:%s:%.2f\n" :
|
||||
"%ld %u bits %s signs in %.2fs \n",
|
||||
count, test_ed_curves[testnum].bits,
|
||||
test_ed_curves[testnum].name, d);
|
||||
count, ed_curves[testnum].bits,
|
||||
ed_curves[testnum].name, d);
|
||||
eddsa_results[testnum][0] = (double)count / d;
|
||||
rsa_count = count;
|
||||
}
|
||||
@@ -3438,24 +3322,23 @@ int speed_main(int argc, char **argv)
|
||||
ERR_print_errors(bio_err);
|
||||
eddsa_doit[testnum] = 0;
|
||||
} else {
|
||||
pkey_print_message("verify", test_ed_curves[testnum].name,
|
||||
pkey_print_message("verify", ed_curves[testnum].name,
|
||||
eddsa_c[testnum][1],
|
||||
test_ed_curves[testnum].bits, seconds.eddsa);
|
||||
ed_curves[testnum].bits, seconds.eddsa);
|
||||
Time_F(START);
|
||||
count = run_benchmark(async_jobs, EdDSA_verify_loop, loopargs);
|
||||
d = Time_F(STOP);
|
||||
BIO_printf(bio_err,
|
||||
mr ? "+R9:%ld:%u:%s:%.2f\n"
|
||||
: "%ld %u bits %s verify in %.2fs\n",
|
||||
count, test_ed_curves[testnum].bits,
|
||||
test_ed_curves[testnum].name, d);
|
||||
count, ed_curves[testnum].bits,
|
||||
ed_curves[testnum].name, d);
|
||||
eddsa_results[testnum][1] = (double)count / d;
|
||||
}
|
||||
|
||||
if (rsa_count <= 1) {
|
||||
/* if longer than 10s, don't do any more */
|
||||
for (testnum++; testnum < EdDSA_NUM; testnum++)
|
||||
eddsa_doit[testnum] = 0;
|
||||
stop_it(eddsa_doit, testnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3464,105 +3347,73 @@ int speed_main(int argc, char **argv)
|
||||
for (testnum = 0; testnum < SM2_NUM; testnum++) {
|
||||
int st = 1;
|
||||
EVP_PKEY *sm2_pkey = NULL;
|
||||
EVP_PKEY_CTX *pctx = NULL;
|
||||
EVP_PKEY_CTX *sm2_pctx = NULL;
|
||||
EVP_PKEY_CTX *sm2_vfy_pctx = NULL;
|
||||
size_t sm2_sigsize = 0;
|
||||
|
||||
if (!sm2_doit[testnum])
|
||||
continue; /* Ignore Curve */
|
||||
/* Init signing and verification */
|
||||
for (i = 0; i < loopargs_len; i++) {
|
||||
EVP_PKEY_CTX *sm2_pctx = NULL;
|
||||
EVP_PKEY_CTX *sm2_vfy_pctx = NULL;
|
||||
EVP_PKEY_CTX *pctx = NULL;
|
||||
st = 0;
|
||||
|
||||
loopargs[i].sm2_ctx[testnum] = EVP_MD_CTX_new();
|
||||
if (loopargs[i].sm2_ctx[testnum] == NULL) {
|
||||
st = 0;
|
||||
break;
|
||||
}
|
||||
loopargs[i].sm2_vfy_ctx[testnum] = EVP_MD_CTX_new();
|
||||
if (loopargs[i].sm2_vfy_ctx[testnum] == NULL) {
|
||||
st = 0;
|
||||
if (loopargs[i].sm2_ctx[testnum] == NULL
|
||||
|| loopargs[i].sm2_vfy_ctx[testnum] == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
/* SM2 keys are generated as normal EC keys with a special curve */
|
||||
if ((pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_EC, NULL)) == NULL
|
||||
st = !((pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_EC, NULL)) == NULL
|
||||
|| EVP_PKEY_keygen_init(pctx) <= 0
|
||||
|| EVP_PKEY_CTX_set_ec_paramgen_curve_nid(pctx,
|
||||
test_sm2_curves[testnum].nid) <= 0
|
||||
|| EVP_PKEY_keygen(pctx, &sm2_pkey) <= 0) {
|
||||
st = 0;
|
||||
EVP_PKEY_CTX_free(pctx);
|
||||
break;
|
||||
}
|
||||
/* free previous one and alloc a new one */
|
||||
sm2_curves[testnum].nid) <= 0
|
||||
|| EVP_PKEY_keygen(pctx, &sm2_pkey) <= 0);
|
||||
EVP_PKEY_CTX_free(pctx);
|
||||
|
||||
loopargs[i].sigsize = sm2_sigsize
|
||||
= ECDSA_size(EVP_PKEY_get0_EC_KEY(sm2_pkey));
|
||||
|
||||
if (!EVP_PKEY_set_alias_type(sm2_pkey, EVP_PKEY_SM2)) {
|
||||
st = 0;
|
||||
EVP_PKEY_free(sm2_pkey);
|
||||
if (st == 0)
|
||||
break;
|
||||
|
||||
st = 0; /* set back to zero */
|
||||
/* attach it sooner to rely on main final cleanup */
|
||||
loopargs[i].sm2_pkey[testnum] = sm2_pkey;
|
||||
loopargs[i].sigsize = ECDSA_size(EVP_PKEY_get0_EC_KEY(sm2_pkey));
|
||||
if (!EVP_PKEY_set_alias_type(sm2_pkey, EVP_PKEY_SM2))
|
||||
break;
|
||||
}
|
||||
|
||||
sm2_pctx = EVP_PKEY_CTX_new(sm2_pkey, NULL);
|
||||
if (sm2_pctx == NULL) {
|
||||
st = 0;
|
||||
EVP_PKEY_free(sm2_pkey);
|
||||
break;
|
||||
}
|
||||
sm2_vfy_pctx = EVP_PKEY_CTX_new(sm2_pkey, NULL);
|
||||
if (sm2_vfy_pctx == NULL) {
|
||||
st = 0;
|
||||
EVP_PKEY_CTX_free(sm2_pctx);
|
||||
EVP_PKEY_free(sm2_pkey);
|
||||
if (sm2_pctx == NULL || sm2_vfy_pctx == NULL) {
|
||||
EVP_PKEY_CTX_free(sm2_vfy_pctx);
|
||||
break;
|
||||
}
|
||||
/* attach them directly to respective ctx */
|
||||
EVP_MD_CTX_set_pkey_ctx(loopargs[i].sm2_ctx[testnum], sm2_pctx);
|
||||
EVP_MD_CTX_set_pkey_ctx(loopargs[i].sm2_vfy_ctx[testnum], sm2_vfy_pctx);
|
||||
|
||||
/*
|
||||
* No need to allow user to set an explicit ID here, just use
|
||||
* the one defined in the 'draft-yang-tls-tl13-sm-suites' I-D.
|
||||
*/
|
||||
if (EVP_PKEY_CTX_set1_id(sm2_pctx, SM2_ID, SM2_ID_LEN) != 1) {
|
||||
st = 0;
|
||||
EVP_PKEY_CTX_free(sm2_pctx);
|
||||
EVP_PKEY_CTX_free(sm2_vfy_pctx);
|
||||
EVP_PKEY_free(sm2_pkey);
|
||||
if (EVP_PKEY_CTX_set1_id(sm2_pctx, SM2_ID, SM2_ID_LEN) != 1
|
||||
|| EVP_PKEY_CTX_set1_id(sm2_vfy_pctx, SM2_ID, SM2_ID_LEN) != 1)
|
||||
break;
|
||||
}
|
||||
|
||||
if (EVP_PKEY_CTX_set1_id(sm2_vfy_pctx, SM2_ID, SM2_ID_LEN) != 1) {
|
||||
st = 0;
|
||||
EVP_PKEY_CTX_free(sm2_pctx);
|
||||
EVP_PKEY_CTX_free(sm2_vfy_pctx);
|
||||
EVP_PKEY_free(sm2_pkey);
|
||||
break;
|
||||
}
|
||||
|
||||
EVP_MD_CTX_set_pkey_ctx(loopargs[i].sm2_ctx[testnum], sm2_pctx);
|
||||
EVP_MD_CTX_set_pkey_ctx(loopargs[i].sm2_vfy_ctx[testnum], sm2_vfy_pctx);
|
||||
|
||||
if (!EVP_DigestSignInit(loopargs[i].sm2_ctx[testnum], NULL,
|
||||
EVP_sm3(), NULL, sm2_pkey)) {
|
||||
st = 0;
|
||||
EVP_PKEY_free(sm2_pkey);
|
||||
EVP_sm3(), NULL, sm2_pkey))
|
||||
break;
|
||||
}
|
||||
if (!EVP_DigestVerifyInit(loopargs[i].sm2_vfy_ctx[testnum], NULL,
|
||||
EVP_sm3(), NULL, sm2_pkey)) {
|
||||
st = 0;
|
||||
EVP_PKEY_free(sm2_pkey);
|
||||
EVP_sm3(), NULL, sm2_pkey))
|
||||
break;
|
||||
}
|
||||
loopargs[i].sm2_pkey[testnum] = sm2_pkey;
|
||||
st = 1; /* mark loop as succeeded */
|
||||
}
|
||||
if (st == 0) {
|
||||
BIO_printf(bio_err, "SM2 failure.\n");
|
||||
BIO_printf(bio_err, "SM2 init failure.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count = 1;
|
||||
} else {
|
||||
for (i = 0; i < loopargs_len; i++) {
|
||||
sm2_sigsize = loopargs[i].sigsize;
|
||||
size_t sm2_sigsize = loopargs[i].sigsize;
|
||||
|
||||
/* Perform SM2 signature test */
|
||||
st = EVP_DigestSign(loopargs[i].sm2_ctx[testnum],
|
||||
loopargs[i].buf2, &sm2_sigsize,
|
||||
@@ -3576,9 +3427,9 @@ int speed_main(int argc, char **argv)
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count = 1;
|
||||
} else {
|
||||
pkey_print_message("sign", test_sm2_curves[testnum].name,
|
||||
pkey_print_message("sign", sm2_curves[testnum].name,
|
||||
sm2_c[testnum][0],
|
||||
test_sm2_curves[testnum].bits, seconds.sm2);
|
||||
sm2_curves[testnum].bits, seconds.sm2);
|
||||
Time_F(START);
|
||||
count = run_benchmark(async_jobs, SM2_sign_loop, loopargs);
|
||||
d = Time_F(STOP);
|
||||
@@ -3586,8 +3437,8 @@ int speed_main(int argc, char **argv)
|
||||
BIO_printf(bio_err,
|
||||
mr ? "+R8:%ld:%u:%s:%.2f\n" :
|
||||
"%ld %u bits %s signs in %.2fs \n",
|
||||
count, test_sm2_curves[testnum].bits,
|
||||
test_sm2_curves[testnum].name, d);
|
||||
count, sm2_curves[testnum].bits,
|
||||
sm2_curves[testnum].name, d);
|
||||
sm2_results[testnum][0] = (double)count / d;
|
||||
rsa_count = count;
|
||||
}
|
||||
@@ -3606,17 +3457,17 @@ int speed_main(int argc, char **argv)
|
||||
ERR_print_errors(bio_err);
|
||||
sm2_doit[testnum] = 0;
|
||||
} else {
|
||||
pkey_print_message("verify", test_sm2_curves[testnum].name,
|
||||
pkey_print_message("verify", sm2_curves[testnum].name,
|
||||
sm2_c[testnum][1],
|
||||
test_sm2_curves[testnum].bits, seconds.sm2);
|
||||
sm2_curves[testnum].bits, seconds.sm2);
|
||||
Time_F(START);
|
||||
count = run_benchmark(async_jobs, SM2_verify_loop, loopargs);
|
||||
d = Time_F(STOP);
|
||||
BIO_printf(bio_err,
|
||||
mr ? "+R9:%ld:%u:%s:%.2f\n"
|
||||
: "%ld %u bits %s verify in %.2fs\n",
|
||||
count, test_sm2_curves[testnum].bits,
|
||||
test_sm2_curves[testnum].name, d);
|
||||
count, sm2_curves[testnum].bits,
|
||||
sm2_curves[testnum].name, d);
|
||||
sm2_results[testnum][1] = (double)count / d;
|
||||
}
|
||||
|
||||
@@ -3638,20 +3489,22 @@ int speed_main(int argc, char **argv)
|
||||
printf("built on: %s\n", OpenSSL_version(OPENSSL_BUILT_ON));
|
||||
printf("options:");
|
||||
printf("%s ", BN_options());
|
||||
#ifndef OPENSSL_NO_MD2
|
||||
#if !defined(OPENSSL_NO_MD2) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
printf("%s ", MD2_options());
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC4
|
||||
#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
printf("%s ", RC4_options());
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
printf("%s ", DES_options());
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
printf("%s ", AES_options());
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_IDEA
|
||||
printf("%s ", IDEA_options());
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_BF
|
||||
#if !defined(OPENSSL_NO_BF) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
printf("%s ", BF_options());
|
||||
#endif
|
||||
printf("\n%s\n", OpenSSL_version(OPENSSL_CFLAGS));
|
||||
@@ -3697,10 +3550,10 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
if (mr)
|
||||
printf("+F2:%u:%u:%f:%f\n",
|
||||
k, rsa_bits[k], rsa_results[k][0], rsa_results[k][1]);
|
||||
k, rsa_keys[k].bits, rsa_results[k][0], rsa_results[k][1]);
|
||||
else
|
||||
printf("rsa %4u bits %8.6fs %8.6fs %8.1f %8.1f\n",
|
||||
rsa_bits[k], 1.0 / rsa_results[k][0], 1.0 / rsa_results[k][1],
|
||||
rsa_keys[k].bits, 1.0 / rsa_results[k][0], 1.0 / rsa_results[k][1],
|
||||
rsa_results[k][0], rsa_results[k][1]);
|
||||
}
|
||||
#endif
|
||||
@@ -3734,11 +3587,11 @@ int speed_main(int argc, char **argv)
|
||||
|
||||
if (mr)
|
||||
printf("+F4:%u:%u:%f:%f\n",
|
||||
k, test_curves[k].bits,
|
||||
k, ec_curves[k].bits,
|
||||
ecdsa_results[k][0], ecdsa_results[k][1]);
|
||||
else
|
||||
printf("%4u bits ecdsa (%s) %8.4fs %8.4fs %8.1f %8.1f\n",
|
||||
test_curves[k].bits, test_curves[k].name,
|
||||
ec_curves[k].bits, ec_curves[k].name,
|
||||
1.0 / ecdsa_results[k][0], 1.0 / ecdsa_results[k][1],
|
||||
ecdsa_results[k][0], ecdsa_results[k][1]);
|
||||
}
|
||||
@@ -3753,12 +3606,12 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
if (mr)
|
||||
printf("+F5:%u:%u:%f:%f\n",
|
||||
k, test_curves[k].bits,
|
||||
k, ec_curves[k].bits,
|
||||
ecdh_results[k][0], 1.0 / ecdh_results[k][0]);
|
||||
|
||||
else
|
||||
printf("%4u bits ecdh (%s) %8.4fs %8.1f\n",
|
||||
test_curves[k].bits, test_curves[k].name,
|
||||
ec_curves[k].bits, ec_curves[k].name,
|
||||
1.0 / ecdh_results[k][0], ecdh_results[k][0]);
|
||||
}
|
||||
|
||||
@@ -3773,11 +3626,11 @@ int speed_main(int argc, char **argv)
|
||||
|
||||
if (mr)
|
||||
printf("+F6:%u:%u:%s:%f:%f\n",
|
||||
k, test_ed_curves[k].bits, test_ed_curves[k].name,
|
||||
k, ed_curves[k].bits, ed_curves[k].name,
|
||||
eddsa_results[k][0], eddsa_results[k][1]);
|
||||
else
|
||||
printf("%4u bits EdDSA (%s) %8.4fs %8.4fs %8.1f %8.1f\n",
|
||||
test_ed_curves[k].bits, test_ed_curves[k].name,
|
||||
ed_curves[k].bits, ed_curves[k].name,
|
||||
1.0 / eddsa_results[k][0], 1.0 / eddsa_results[k][1],
|
||||
eddsa_results[k][0], eddsa_results[k][1]);
|
||||
}
|
||||
@@ -3794,16 +3647,16 @@ int speed_main(int argc, char **argv)
|
||||
|
||||
if (mr)
|
||||
printf("+F6:%u:%u:%s:%f:%f\n",
|
||||
k, test_sm2_curves[k].bits, test_sm2_curves[k].name,
|
||||
k, sm2_curves[k].bits, sm2_curves[k].name,
|
||||
sm2_results[k][0], sm2_results[k][1]);
|
||||
else
|
||||
printf("%4u bits SM2 (%s) %8.4fs %8.4fs %8.1f %8.1f\n",
|
||||
test_sm2_curves[k].bits, test_sm2_curves[k].name,
|
||||
sm2_curves[k].bits, sm2_curves[k].name,
|
||||
1.0 / sm2_results[k][0], 1.0 / sm2_results[k][1],
|
||||
sm2_results[k][0], sm2_results[k][1]);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
#endif /* OPENSSL_NO_EC */
|
||||
|
||||
ret = 0;
|
||||
|
||||
@@ -3875,6 +3728,7 @@ static void print_message(const char *s, long num, int length, int tm)
|
||||
mr ? "+DT:%s:%d:%d\n"
|
||||
: "Doing %s for %ds on %d size blocks: ", s, tm, length);
|
||||
(void)BIO_flush(bio_err);
|
||||
run = 1;
|
||||
alarm(tm);
|
||||
#else
|
||||
BIO_printf(bio_err,
|
||||
@@ -3892,6 +3746,7 @@ static void pkey_print_message(const char *str, const char *str2, long num,
|
||||
mr ? "+DTP:%d:%s:%s:%d\n"
|
||||
: "Doing %u bits %s %s's for %ds: ", bits, str, str2, tm);
|
||||
(void)BIO_flush(bio_err);
|
||||
run = 1;
|
||||
alarm(tm);
|
||||
#else
|
||||
BIO_printf(bio_err,
|
||||
@@ -3904,8 +3759,10 @@ static void pkey_print_message(const char *str, const char *str2, long num,
|
||||
static void print_result(int alg, int run_no, int count, double time_used)
|
||||
{
|
||||
if (count == -1) {
|
||||
BIO_puts(bio_err, "EVP error!\n");
|
||||
exit(1);
|
||||
BIO_printf(bio_err, "%s error!\n", names[alg]);
|
||||
ERR_print_errors(bio_err);
|
||||
/* exit(1); disable exit until default provider enabled */
|
||||
return;
|
||||
}
|
||||
BIO_printf(bio_err,
|
||||
mr ? "+R:%d:%s:%f\n"
|
||||
@@ -4064,6 +3921,7 @@ static int do_multi(int multi, int size_num)
|
||||
p = buf + 4;
|
||||
k = atoi(sstrsep(&p, sep));
|
||||
sstrsep(&p, sep);
|
||||
sstrsep(&p, sep);
|
||||
|
||||
d = atof(sstrsep(&p, sep));
|
||||
eddsa_results[k][0] += d;
|
||||
@@ -4137,7 +3995,7 @@ static void multiblock_speed(const EVP_CIPHER *evp_cipher, int lengths_single,
|
||||
for (j = 0; j < num; j++) {
|
||||
print_message(alg_name, 0, mblengths[j], seconds->sym);
|
||||
Time_F(START);
|
||||
for (count = 0, run = 1; run && count < 0x7fffffff; count++) {
|
||||
for (count = 0; run && count < 0x7fffffff; count++) {
|
||||
unsigned char aad[EVP_AEAD_TLS1_AAD_LEN];
|
||||
EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM mb_param;
|
||||
size_t len = mblengths[j];
|
||||
|
||||
+15
-10
@@ -28,22 +28,27 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS spkac_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"key", OPT_KEY, '<', "Create SPKAC using private key"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Private key file format - default PEM (PEM, DER, or ENGINE)"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"challenge", OPT_CHALLENGE, 's', "Challenge string"},
|
||||
{"spkac", OPT_SPKAC, 's', "Alternative SPKAC name"},
|
||||
{"noout", OPT_NOOUT, '-', "Don't print SPKAC"},
|
||||
{"pubkey", OPT_PUBKEY, '-', "Output public key"},
|
||||
{"verify", OPT_VERIFY, '-', "Verify SPKAC signature"},
|
||||
{"spksect", OPT_SPKSECT, 's',
|
||||
"Specify the name of an SPKAC-dedicated section of configuration"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"key", OPT_KEY, '<', "Create SPKAC using private key"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Private key file format - default PEM (PEM, DER, or ENGINE)"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"challenge", OPT_CHALLENGE, 's', "Challenge string"},
|
||||
{"spkac", OPT_SPKAC, 's', "Alternative SPKAC name"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"noout", OPT_NOOUT, '-', "Don't print SPKAC"},
|
||||
{"pubkey", OPT_PUBKEY, '-', "Output public key"},
|
||||
{"verify", OPT_VERIFY, '-', "Verify SPKAC signature"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+16
-6
@@ -197,24 +197,34 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS srp_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] [user...]\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"verbose", OPT_VERBOSE, '-', "Talk a lot while doing things"},
|
||||
{"config", OPT_CONFIG, '<', "A config file"},
|
||||
{"name", OPT_NAME, 's', "The particular srp definition to use"},
|
||||
{"srpvfile", OPT_SRPVFILE, '<', "The srp verifier file name"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
|
||||
OPT_SECTION("Action"),
|
||||
{"add", OPT_ADD, '-', "Add a user and srp verifier"},
|
||||
{"modify", OPT_MODIFY, '-',
|
||||
"Modify the srp verifier of an existing user"},
|
||||
{"modify", OPT_MODIFY, '-', "Modify the srp verifier of an existing user"},
|
||||
{"delete", OPT_DELETE, '-', "Delete user from verifier file"},
|
||||
{"list", OPT_LIST, '-', "List users"},
|
||||
|
||||
OPT_SECTION("Configuration"),
|
||||
{"srpvfile", OPT_SRPVFILE, '<', "The srp verifier file name"},
|
||||
{"gn", OPT_GN, 's', "Set g and N values to be used for new verifier"},
|
||||
{"userinfo", OPT_USERINFO, 's', "Additional info to be set for user"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"user", 0, 0, "Username(s) to process (optional)"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
+20
-9
@@ -31,12 +31,16 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS storeutl_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] uri\nValid options are:\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] uri\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"out", OPT_OUT, '>', "Output file - default stdout"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"text", OPT_TEXT, '-', "Print a text form of the objects"},
|
||||
{"noout", OPT_NOOUT, '-', "No PEM output, just status"},
|
||||
{"", OPT_MD, '-', "Any supported digest"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Search"),
|
||||
{"certs", OPT_SEARCHFOR_CERTS, '-', "Search for certificates only"},
|
||||
{"keys", OPT_SEARCHFOR_KEYS, '-', "Search for keys only"},
|
||||
{"crls", OPT_SEARCHFOR_CRLS, '-', "Search for CRLs only"},
|
||||
@@ -45,11 +49,18 @@ const OPTIONS storeutl_options[] = {
|
||||
{"serial", OPT_CRITERION_SERIAL, 's', "Search by issuer and serial, serial number"},
|
||||
{"fingerprint", OPT_CRITERION_FINGERPRINT, 's', "Search by public key fingerprint, given in hex"},
|
||||
{"alias", OPT_CRITERION_ALIAS, 's', "Search by alias"},
|
||||
{"", OPT_MD, '-', "Any supported digest"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
{"r", OPT_RECURSIVE, '-', "Recurse through names"},
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file - default stdout"},
|
||||
{"text", OPT_TEXT, '-', "Print a text form of the objects"},
|
||||
{"noout", OPT_NOOUT, '-', "No PEM output, just status"},
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"uri", 0, 0, "URI of the store object"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -66,15 +66,17 @@ static int save_ts_serial(const char *serialfile, ASN1_INTEGER *serial);
|
||||
/* Verify related functions. */
|
||||
static int verify_command(const char *data, const char *digest, const char *queryfile,
|
||||
const char *in, int token_in,
|
||||
const char *CApath, const char *CAfile, const char *untrusted,
|
||||
X509_VERIFY_PARAM *vpm);
|
||||
const char *CApath, const char *CAfile,
|
||||
const char *CAstore,
|
||||
const char *untrusted, X509_VERIFY_PARAM *vpm);
|
||||
static TS_VERIFY_CTX *create_verify_ctx(const char *data, const char *digest,
|
||||
const char *queryfile,
|
||||
const char *CApath, const char *CAfile,
|
||||
const char *CAstore,
|
||||
const char *untrusted,
|
||||
X509_VERIFY_PARAM *vpm);
|
||||
static X509_STORE *create_cert_store(const char *CApath, const char *CAfile,
|
||||
X509_VERIFY_PARAM *vpm);
|
||||
const char *CAstore, X509_VERIFY_PARAM *vpm);
|
||||
static int verify_cb(int ok, X509_STORE_CTX *ctx);
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
@@ -83,43 +85,48 @@ typedef enum OPTION_choice {
|
||||
OPT_DIGEST, OPT_TSPOLICY, OPT_NO_NONCE, OPT_CERT,
|
||||
OPT_IN, OPT_TOKEN_IN, OPT_OUT, OPT_TOKEN_OUT, OPT_TEXT,
|
||||
OPT_REPLY, OPT_QUERYFILE, OPT_PASSIN, OPT_INKEY, OPT_SIGNER,
|
||||
OPT_CHAIN, OPT_VERIFY, OPT_CAPATH, OPT_CAFILE, OPT_UNTRUSTED,
|
||||
OPT_CHAIN, OPT_VERIFY, OPT_CAPATH, OPT_CAFILE, OPT_CASTORE, OPT_UNTRUSTED,
|
||||
OPT_MD, OPT_V_ENUM, OPT_R_ENUM
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS ts_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"config", OPT_CONFIG, '<', "Configuration file"},
|
||||
{"section", OPT_SECTION, 's', "Section to use within config file"},
|
||||
{"query", OPT_QUERY, '-', "Generate a TS query"},
|
||||
{"data", OPT_DATA, '<', "File to hash"},
|
||||
{"digest", OPT_DIGEST, 's', "Digest (as a hex string)"},
|
||||
OPT_R_OPTIONS,
|
||||
{"tspolicy", OPT_TSPOLICY, 's', "Policy OID to use"},
|
||||
{"no_nonce", OPT_NO_NONCE, '-', "Do not include a nonce"},
|
||||
{"cert", OPT_CERT, '-', "Put cert request into query"},
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"token_in", OPT_TOKEN_IN, '-', "Input is a PKCS#7 file"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"token_out", OPT_TOKEN_OUT, '-', "Output is a PKCS#7 file"},
|
||||
{"text", OPT_TEXT, '-', "Output text (not DER)"},
|
||||
{"reply", OPT_REPLY, '-', "Generate a TS reply"},
|
||||
{"queryfile", OPT_QUERYFILE, '<', "File containing a TS query"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"inkey", OPT_INKEY, 's', "File with private key for reply"},
|
||||
{"signer", OPT_SIGNER, 's', "Signer certificate file"},
|
||||
{"chain", OPT_CHAIN, '<', "File with signer CA chain"},
|
||||
{"verify", OPT_VERIFY, '-', "Verify a TS response"},
|
||||
{"CApath", OPT_CAPATH, '/', "Path to trusted CA files"},
|
||||
{"CAfile", OPT_CAFILE, '<', "File with trusted CA certs"},
|
||||
{"untrusted", OPT_UNTRUSTED, '<', "File with untrusted certs"},
|
||||
{"", OPT_MD, '-', "Any supported digest"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
{OPT_HELP_STR, 1, '-', "\nOptions specific to 'ts -verify': \n"},
|
||||
{"inkey", OPT_INKEY, 's', "File with private key for reply"},
|
||||
{"signer", OPT_SIGNER, 's', "Signer certificate file"},
|
||||
{"chain", OPT_CHAIN, '<', "File with signer CA chain"},
|
||||
{"CApath", OPT_CAPATH, '/', "Path to trusted CA files"},
|
||||
{"CAfile", OPT_CAFILE, '<', "File with trusted CA certs"},
|
||||
{"CAstore", OPT_CASTORE, ':', "URI to trusted CA store"},
|
||||
{"untrusted", OPT_UNTRUSTED, '<', "File with untrusted certs"},
|
||||
{"token_in", OPT_TOKEN_IN, '-', "Input is a PKCS#7 file"},
|
||||
{"token_out", OPT_TOKEN_OUT, '-', "Output is a PKCS#7 file"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"", OPT_MD, '-', "Any supported digest"},
|
||||
|
||||
OPT_SECTION("Query"),
|
||||
{"query", OPT_QUERY, '-', "Generate a TS query"},
|
||||
{"data", OPT_DATA, '<', "File to hash"},
|
||||
{"digest", OPT_DIGEST, 's', "Digest (as a hex string)"},
|
||||
{"queryfile", OPT_QUERYFILE, '<', "File containing a TS query"},
|
||||
{"cert", OPT_CERT, '-', "Put cert request into query"},
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
|
||||
OPT_SECTION("Verify"),
|
||||
{"verify", OPT_VERIFY, '-', "Verify a TS response"},
|
||||
{"reply", OPT_REPLY, '-', "Generate a TS reply"},
|
||||
{"tspolicy", OPT_TSPOLICY, 's', "Policy OID to use"},
|
||||
{"no_nonce", OPT_NO_NONCE, '-', "Do not include a nonce"},
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"text", OPT_TEXT, '-', "Output text (not DER)"},
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
OPT_V_OPTIONS,
|
||||
{OPT_HELP_STR, 1, '-', "\n"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -127,26 +134,26 @@ const OPTIONS ts_options[] = {
|
||||
* This command is so complex, special help is needed.
|
||||
*/
|
||||
static char* opt_helplist[] = {
|
||||
"",
|
||||
"Typical uses:",
|
||||
"ts -query [-rand file...] [-config file] [-data file]",
|
||||
" [-digest hexstring] [-tspolicy oid] [-no_nonce] [-cert]",
|
||||
" [-in file] [-out file] [-text]",
|
||||
" or",
|
||||
"ts -reply [-config file] [-section tsa_section]",
|
||||
" [-queryfile file] [-passin password]",
|
||||
" [-signer tsa_cert.pem] [-inkey private_key.pem]",
|
||||
" [-chain certs_file.pem] [-tspolicy oid]",
|
||||
" [-in file] [-token_in] [-out file] [-token_out]",
|
||||
" openssl ts -query [-rand file...] [-config file] [-data file]",
|
||||
" [-digest hexstring] [-tspolicy oid] [-no_nonce] [-cert]",
|
||||
" [-in file] [-out file] [-text]",
|
||||
"",
|
||||
" openssl ts -reply [-config file] [-section tsa_section]",
|
||||
" [-queryfile file] [-passin password]",
|
||||
" [-signer tsa_cert.pem] [-inkey private_key.pem]",
|
||||
" [-chain certs_file.pem] [-tspolicy oid]",
|
||||
" [-in file] [-token_in] [-out file] [-token_out]",
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
" [-text] [-engine id]",
|
||||
" [-text] [-engine id]",
|
||||
# else
|
||||
" [-text]",
|
||||
" [-text]",
|
||||
# endif
|
||||
" or",
|
||||
"ts -verify -CApath dir -CAfile file.pem -untrusted file.pem",
|
||||
" [-data file] [-digest hexstring]",
|
||||
" [-queryfile file] -in file [-token_in]",
|
||||
" [[options specific to 'ts -verify']]",
|
||||
"",
|
||||
" openssl ts -verify -CApath dir -CAfile file.pem -CAstore uri",
|
||||
" -untrusted file.pem [-data file] [-digest hexstring]",
|
||||
" [-queryfile file] -in file [-token_in] ...",
|
||||
NULL,
|
||||
};
|
||||
|
||||
@@ -161,6 +168,7 @@ int ts_main(int argc, char **argv)
|
||||
char *data = NULL, *digest = NULL, *policy = NULL;
|
||||
char *in = NULL, *out = NULL, *queryfile = NULL, *passin = NULL;
|
||||
char *inkey = NULL, *signer = NULL, *chain = NULL, *CApath = NULL;
|
||||
char *CAstore = NULL;
|
||||
const EVP_MD *md = NULL;
|
||||
OPTION_CHOICE o, mode = OPT_ERR;
|
||||
int ret = 1, no_nonce = 0, cert = 0, text = 0;
|
||||
@@ -256,6 +264,9 @@ int ts_main(int argc, char **argv)
|
||||
case OPT_CAFILE:
|
||||
CAfile = opt_arg();
|
||||
break;
|
||||
case OPT_CASTORE:
|
||||
CAstore = opt_arg();
|
||||
break;
|
||||
case OPT_UNTRUSTED:
|
||||
untrusted = opt_arg();
|
||||
break;
|
||||
@@ -282,7 +293,8 @@ int ts_main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
conf = load_config_file(configfile);
|
||||
if ((conf = load_config_file(configfile)) == NULL)
|
||||
goto end;
|
||||
if (configfile != default_config_file && !app_load_modules(conf))
|
||||
goto end;
|
||||
|
||||
@@ -311,7 +323,7 @@ int ts_main(int argc, char **argv)
|
||||
if ((in == NULL) || !EXACTLY_ONE(queryfile, data, digest))
|
||||
goto opthelp;
|
||||
ret = !verify_command(data, digest, queryfile, in, token_in,
|
||||
CApath, CAfile, untrusted,
|
||||
CApath, CAfile, CAstore, untrusted,
|
||||
vpmtouched ? vpm : NULL);
|
||||
} else {
|
||||
goto opthelp;
|
||||
@@ -820,7 +832,8 @@ static int save_ts_serial(const char *serialfile, ASN1_INTEGER *serial)
|
||||
|
||||
static int verify_command(const char *data, const char *digest, const char *queryfile,
|
||||
const char *in, int token_in,
|
||||
const char *CApath, const char *CAfile, const char *untrusted,
|
||||
const char *CApath, const char *CAfile,
|
||||
const char *CAstore, const char *untrusted,
|
||||
X509_VERIFY_PARAM *vpm)
|
||||
{
|
||||
BIO *in_bio = NULL;
|
||||
@@ -840,7 +853,7 @@ static int verify_command(const char *data, const char *digest, const char *quer
|
||||
}
|
||||
|
||||
if ((verify_ctx = create_verify_ctx(data, digest, queryfile,
|
||||
CApath, CAfile, untrusted,
|
||||
CApath, CAfile, CAstore, untrusted,
|
||||
vpm)) == NULL)
|
||||
goto end;
|
||||
|
||||
@@ -867,6 +880,7 @@ static int verify_command(const char *data, const char *digest, const char *quer
|
||||
static TS_VERIFY_CTX *create_verify_ctx(const char *data, const char *digest,
|
||||
const char *queryfile,
|
||||
const char *CApath, const char *CAfile,
|
||||
const char *CAstore,
|
||||
const char *untrusted,
|
||||
X509_VERIFY_PARAM *vpm)
|
||||
{
|
||||
@@ -915,7 +929,8 @@ static TS_VERIFY_CTX *create_verify_ctx(const char *data, const char *digest,
|
||||
TS_VERIFY_CTX_add_flags(ctx, f | TS_VFY_SIGNATURE);
|
||||
|
||||
/* Initialising the X509_STORE object. */
|
||||
if (TS_VERIFY_CTX_set_store(ctx, create_cert_store(CApath, CAfile, vpm))
|
||||
if (TS_VERIFY_CTX_set_store(ctx,
|
||||
create_cert_store(CApath, CAfile, CAstore, vpm))
|
||||
== NULL)
|
||||
goto err;
|
||||
|
||||
@@ -936,11 +951,10 @@ static TS_VERIFY_CTX *create_verify_ctx(const char *data, const char *digest,
|
||||
}
|
||||
|
||||
static X509_STORE *create_cert_store(const char *CApath, const char *CAfile,
|
||||
X509_VERIFY_PARAM *vpm)
|
||||
const char *CAstore, X509_VERIFY_PARAM *vpm)
|
||||
{
|
||||
X509_STORE *cert_ctx = NULL;
|
||||
X509_LOOKUP *lookup = NULL;
|
||||
int i;
|
||||
|
||||
cert_ctx = X509_STORE_new();
|
||||
X509_STORE_set_verify_cb(cert_ctx, verify_cb);
|
||||
@@ -950,8 +964,7 @@ static X509_STORE *create_cert_store(const char *CApath, const char *CAfile,
|
||||
BIO_printf(bio_err, "memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
i = X509_LOOKUP_add_dir(lookup, CApath, X509_FILETYPE_PEM);
|
||||
if (!i) {
|
||||
if (!X509_LOOKUP_add_dir(lookup, CApath, X509_FILETYPE_PEM)) {
|
||||
BIO_printf(bio_err, "Error loading directory %s\n", CApath);
|
||||
goto err;
|
||||
}
|
||||
@@ -963,13 +976,24 @@ static X509_STORE *create_cert_store(const char *CApath, const char *CAfile,
|
||||
BIO_printf(bio_err, "memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
i = X509_LOOKUP_load_file(lookup, CAfile, X509_FILETYPE_PEM);
|
||||
if (!i) {
|
||||
if (!X509_LOOKUP_load_file(lookup, CAfile, X509_FILETYPE_PEM)) {
|
||||
BIO_printf(bio_err, "Error loading file %s\n", CAfile);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
if (CAstore != NULL) {
|
||||
lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_store());
|
||||
if (lookup == NULL) {
|
||||
BIO_printf(bio_err, "memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
if (!X509_LOOKUP_load_store(lookup, CAstore)) {
|
||||
BIO_printf(bio_err, "Error loading store URI %s\n", CAstore);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
if (vpm != NULL)
|
||||
X509_STORE_set1_param(cert_ctx, vpm);
|
||||
|
||||
|
||||
+40
-20
@@ -27,24 +27,35 @@ static int v_verbose = 0, vflags = 0;
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
OPT_ENGINE, OPT_CAPATH, OPT_CAFILE, OPT_NOCAPATH, OPT_NOCAFILE,
|
||||
OPT_ENGINE, OPT_CAPATH, OPT_CAFILE, OPT_CASTORE,
|
||||
OPT_NOCAPATH, OPT_NOCAFILE, OPT_NOCASTORE,
|
||||
OPT_UNTRUSTED, OPT_TRUSTED, OPT_CRLFILE, OPT_CRL_DOWNLOAD, OPT_SHOW_CHAIN,
|
||||
OPT_V_ENUM, OPT_NAMEOPT,
|
||||
OPT_VERBOSE, OPT_SM2ID, OPT_SM2HEXID
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS verify_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] cert.pem...\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Valid options are:\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] [cert...]\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
{"verbose", OPT_VERBOSE, '-',
|
||||
"Print extra information about the operations being performed."},
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"},
|
||||
|
||||
OPT_SECTION("Certificate chain"),
|
||||
{"CApath", OPT_CAPATH, '/', "A directory of trusted certificates"},
|
||||
{"CAfile", OPT_CAFILE, '<', "A file of trusted certificates"},
|
||||
{"CAstore", OPT_CASTORE, ':', "URI to a store of trusted certificates"},
|
||||
{"no-CAfile", OPT_NOCAFILE, '-',
|
||||
"Do not load the default certificates file"},
|
||||
{"no-CApath", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates directory"},
|
||||
{"no-CAstore", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates store"},
|
||||
{"untrusted", OPT_UNTRUSTED, '<', "A file of untrusted certificates"},
|
||||
{"trusted", OPT_TRUSTED, '<', "A file of trusted certificates"},
|
||||
{"CRLfile", OPT_CRLFILE, '<',
|
||||
@@ -53,17 +64,17 @@ const OPTIONS verify_options[] = {
|
||||
"Attempt to download CRL information for this certificate"},
|
||||
{"show_chain", OPT_SHOW_CHAIN, '-',
|
||||
"Display information about the certificate chain"},
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"},
|
||||
|
||||
OPT_V_OPTIONS,
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
{"sm2-id", OPT_SM2ID, 's',
|
||||
"Specify an ID string to verify an SM2 certificate"},
|
||||
{"sm2-hex-id", OPT_SM2HEXID, 's',
|
||||
"Specify a hex ID string to verify an SM2 certificate"},
|
||||
#endif
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"cert", 0, 0, "Certificate(s) to verify (optional; stdin used otherwise)"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -74,8 +85,8 @@ int verify_main(int argc, char **argv)
|
||||
STACK_OF(X509_CRL) *crls = NULL;
|
||||
X509_STORE *store = NULL;
|
||||
X509_VERIFY_PARAM *vpm = NULL;
|
||||
const char *prog, *CApath = NULL, *CAfile = NULL;
|
||||
int noCApath = 0, noCAfile = 0;
|
||||
const char *prog, *CApath = NULL, *CAfile = NULL, *CAstore = NULL;
|
||||
int noCApath = 0, noCAfile = 0, noCAstore = 0;
|
||||
int vpmtouched = 0, crl_download = 0, show_chain = 0, i = 0, ret = 1;
|
||||
OPTION_CHOICE o;
|
||||
unsigned char *sm2_id = NULL;
|
||||
@@ -94,20 +105,20 @@ int verify_main(int argc, char **argv)
|
||||
goto end;
|
||||
case OPT_HELP:
|
||||
opt_help(verify_options);
|
||||
BIO_printf(bio_err, "Recognized usages:\n");
|
||||
BIO_printf(bio_err, "\nRecognized certificate chain purposes:\n");
|
||||
for (i = 0; i < X509_PURPOSE_get_count(); i++) {
|
||||
X509_PURPOSE *ptmp;
|
||||
ptmp = X509_PURPOSE_get0(i);
|
||||
BIO_printf(bio_err, "\t%-10s\t%s\n",
|
||||
X509_PURPOSE *ptmp = X509_PURPOSE_get0(i);
|
||||
|
||||
BIO_printf(bio_err, " %-15s %s\n",
|
||||
X509_PURPOSE_get0_sname(ptmp),
|
||||
X509_PURPOSE_get0_name(ptmp));
|
||||
}
|
||||
|
||||
BIO_printf(bio_err, "Recognized verify names:\n");
|
||||
BIO_printf(bio_err, "Recognized certificate policy names:\n");
|
||||
for (i = 0; i < X509_VERIFY_PARAM_get_count(); i++) {
|
||||
const X509_VERIFY_PARAM *vptmp;
|
||||
vptmp = X509_VERIFY_PARAM_get0(i);
|
||||
BIO_printf(bio_err, "\t%-10s\n",
|
||||
const X509_VERIFY_PARAM *vptmp = X509_VERIFY_PARAM_get0(i);
|
||||
|
||||
BIO_printf(bio_err, " %s\n",
|
||||
X509_VERIFY_PARAM_get0_name(vptmp));
|
||||
}
|
||||
ret = 0;
|
||||
@@ -123,12 +134,18 @@ int verify_main(int argc, char **argv)
|
||||
case OPT_CAFILE:
|
||||
CAfile = opt_arg();
|
||||
break;
|
||||
case OPT_CASTORE:
|
||||
CAstore = opt_arg();
|
||||
break;
|
||||
case OPT_NOCAPATH:
|
||||
noCApath = 1;
|
||||
break;
|
||||
case OPT_NOCAFILE:
|
||||
noCAfile = 1;
|
||||
break;
|
||||
case OPT_NOCASTORE:
|
||||
noCAstore = 1;
|
||||
break;
|
||||
case OPT_UNTRUSTED:
|
||||
/* Zero or more times */
|
||||
if (!load_certs(opt_arg(), &untrusted, FORMAT_PEM, NULL,
|
||||
@@ -139,6 +156,7 @@ int verify_main(int argc, char **argv)
|
||||
/* Zero or more times */
|
||||
noCAfile = 1;
|
||||
noCApath = 1;
|
||||
noCAstore = 1;
|
||||
if (!load_certs(opt_arg(), &trusted, FORMAT_PEM, NULL,
|
||||
"trusted certificates"))
|
||||
goto end;
|
||||
@@ -195,14 +213,16 @@ int verify_main(int argc, char **argv)
|
||||
}
|
||||
argc = opt_num_rest();
|
||||
argv = opt_rest();
|
||||
if (trusted != NULL && (CAfile || CApath)) {
|
||||
if (trusted != NULL
|
||||
&& (CAfile != NULL || CApath != NULL || CAstore != NULL)) {
|
||||
BIO_printf(bio_err,
|
||||
"%s: Cannot use -trusted with -CAfile or -CApath\n",
|
||||
"%s: Cannot use -trusted with -CAfile, -CApath or -CAstore\n",
|
||||
prog);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if ((store = setup_verify(CAfile, CApath, noCAfile, noCApath)) == NULL)
|
||||
if ((store = setup_verify(CAfile, noCAfile, CApath, noCApath,
|
||||
CAstore, noCAstore)) == NULL)
|
||||
goto end;
|
||||
X509_STORE_set_verify_cb(store, cb);
|
||||
|
||||
|
||||
+3
-12
@@ -18,9 +18,6 @@
|
||||
#ifndef OPENSSL_NO_MD2
|
||||
# include <openssl/md2.h>
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC4
|
||||
# include <openssl/rc4.h>
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
# include <openssl/des.h>
|
||||
#endif
|
||||
@@ -37,7 +34,10 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS version_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"a", OPT_A, '-', "Show all data"},
|
||||
{"b", OPT_B, '-', "Show build date"},
|
||||
{"d", OPT_D, '-', "Show configuration directory"},
|
||||
@@ -126,20 +126,11 @@ opthelp:
|
||||
if (options) {
|
||||
printf("options: ");
|
||||
printf(" %s", BN_options());
|
||||
#ifndef OPENSSL_NO_MD2
|
||||
printf(" %s", MD2_options());
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC4
|
||||
printf(" %s", RC4_options());
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
printf(" %s", DES_options());
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_IDEA
|
||||
printf(" %s", IDEA_options());
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_BF
|
||||
printf(" %s", BF_options());
|
||||
#endif
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
+45
-38
@@ -65,15 +65,23 @@ typedef enum OPTION_choice {
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS x509_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
|
||||
{"inform", OPT_INFORM, 'f',
|
||||
"Input format - default PEM (one of DER or PEM)"},
|
||||
{"in", OPT_IN, '<', "Input file - default stdin"},
|
||||
{"passin", OPT_PASSIN, 's', "Private key password/pass-phrase source"},
|
||||
{"outform", OPT_OUTFORM, 'f',
|
||||
"Output format - default PEM (one of DER or PEM)"},
|
||||
{"out", OPT_OUT, '>', "Output file - default stdout"},
|
||||
{"keyform", OPT_KEYFORM, 'F', "Private key format - default PEM"},
|
||||
{"passin", OPT_PASSIN, 's', "Private key password/pass-phrase source"},
|
||||
{"keyform", OPT_KEYFORM, 'E', "Private key format - default PEM"},
|
||||
{"req", OPT_REQ, '-', "Input is a certificate request, sign and output"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"serial", OPT_SERIAL, '-', "Print serial number value"},
|
||||
{"subject_hash", OPT_HASH, '-', "Print subject hash value"},
|
||||
{"issuer_hash", OPT_ISSUER_HASH, '-', "Print issuer hash value"},
|
||||
@@ -81,21 +89,37 @@ const OPTIONS x509_options[] = {
|
||||
{"subject", OPT_SUBJECT, '-', "Print subject DN"},
|
||||
{"issuer", OPT_ISSUER, '-', "Print issuer DN"},
|
||||
{"email", OPT_EMAIL, '-', "Print email address(es)"},
|
||||
{"startdate", OPT_STARTDATE, '-', "Set notBefore field"},
|
||||
{"enddate", OPT_ENDDATE, '-', "Set notAfter field"},
|
||||
{"purpose", OPT_PURPOSE, '-', "Print out certificate purposes"},
|
||||
{"dates", OPT_DATES, '-', "Both Before and After dates"},
|
||||
{"modulus", OPT_MODULUS, '-', "Print the RSA key modulus"},
|
||||
{"pubkey", OPT_PUBKEY, '-', "Output the public key"},
|
||||
{"fingerprint", OPT_FINGERPRINT, '-',
|
||||
"Print the certificate fingerprint"},
|
||||
{"fingerprint", OPT_FINGERPRINT, '-', "Print the certificate fingerprint"},
|
||||
{"alias", OPT_ALIAS, '-', "Output certificate alias"},
|
||||
{"noout", OPT_NOOUT, '-', "No output, just status"},
|
||||
{"nocert", OPT_NOCERT, '-', "No certificate output"},
|
||||
{"ocspid", OPT_OCSPID, '-',
|
||||
"Print OCSP hash values for the subject name and public key"},
|
||||
{"ocsp_uri", OPT_OCSP_URI, '-', "Print OCSP Responder URL(s)"},
|
||||
{"nocert", OPT_NOCERT, '-', "No certificate output"},
|
||||
{"trustout", OPT_TRUSTOUT, '-', "Output a trusted certificate"},
|
||||
{"x509toreq", OPT_X509TOREQ, '-',
|
||||
"Output a certification request object"},
|
||||
{"checkend", OPT_CHECKEND, 'M',
|
||||
"Check whether the cert expires in the next arg seconds"},
|
||||
{OPT_MORE_STR, 1, 1, "Exit 1 if so, 0 if not"},
|
||||
{"text", OPT_TEXT, '-', "Print the certificate in text form"},
|
||||
{"ext", OPT_EXT, 's', "Print various X509V3 extensions"},
|
||||
{"C", OPT_C, '-', "Print out C code forms"},
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
{"subject_hash_old", OPT_SUBJECT_HASH_OLD, '-',
|
||||
"Print old-style (MD5) issuer hash value"},
|
||||
{"issuer_hash_old", OPT_ISSUER_HASH_OLD, '-',
|
||||
"Print old-style (MD5) subject hash value"},
|
||||
#endif
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"},
|
||||
|
||||
OPT_SECTION("Certificate"),
|
||||
{"startdate", OPT_STARTDATE, '-', "Set notBefore field"},
|
||||
{"enddate", OPT_ENDDATE, '-', "Set notAfter field"},
|
||||
{"dates", OPT_DATES, '-', "Both Before and After dates"},
|
||||
{"clrtrust", OPT_CLRTRUST, '-', "Clear all trusted purposes"},
|
||||
{"clrext", OPT_CLREXT, '-', "Clear all certificate extensions"},
|
||||
{"addtrust", OPT_ADDTRUST, 's', "Trust certificate for a given purpose"},
|
||||
@@ -104,51 +128,34 @@ const OPTIONS x509_options[] = {
|
||||
{"setalias", OPT_SETALIAS, 's', "Set certificate alias"},
|
||||
{"days", OPT_DAYS, 'n',
|
||||
"How long till expiry of a signed certificate - def 30 days"},
|
||||
{"checkend", OPT_CHECKEND, 'M',
|
||||
"Check whether the cert expires in the next arg seconds"},
|
||||
{OPT_MORE_STR, 1, 1, "Exit 1 if so, 0 if not"},
|
||||
{"signkey", OPT_SIGNKEY, '<', "Self sign cert with arg"},
|
||||
{"x509toreq", OPT_X509TOREQ, '-',
|
||||
"Output a certification request object"},
|
||||
{"req", OPT_REQ, '-', "Input is a certificate request, sign and output"},
|
||||
{"CA", OPT_CA, '<', "Set the CA certificate, must be PEM format"},
|
||||
{"CAkey", OPT_CAKEY, 's',
|
||||
"The CA key, must be PEM format; if not in CAfile"},
|
||||
{"CAcreateserial", OPT_CACREATESERIAL, '-',
|
||||
"Create serial number file if it does not exist"},
|
||||
{"CAserial", OPT_CASERIAL, 's', "Serial file"},
|
||||
{"set_serial", OPT_SET_SERIAL, 's', "Serial number to use"},
|
||||
{"text", OPT_TEXT, '-', "Print the certificate in text form"},
|
||||
{"ext", OPT_EXT, 's', "Print various X509V3 extensions"},
|
||||
{"C", OPT_C, '-', "Print out C code forms"},
|
||||
{"extfile", OPT_EXTFILE, '<', "File with X509V3 extensions to add"},
|
||||
OPT_R_OPTIONS,
|
||||
{"extensions", OPT_EXTENSIONS, 's', "Section from config file to use"},
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"},
|
||||
{"certopt", OPT_CERTOPT, 's', "Various certificate text options"},
|
||||
{"checkhost", OPT_CHECKHOST, 's', "Check certificate matches host"},
|
||||
{"checkemail", OPT_CHECKEMAIL, 's', "Check certificate matches email"},
|
||||
{"checkip", OPT_CHECKIP, 's', "Check certificate matches ipaddr"},
|
||||
{"force_pubkey", OPT_FORCE_PUBKEY, '<', "Force the key to put inside certificate"},
|
||||
{"subj", OPT_SUBJ, 's', "Set or override certificate subject (and issuer)"},
|
||||
|
||||
OPT_SECTION("CA"),
|
||||
{"CA", OPT_CA, '<', "Set the CA certificate, must be PEM format"},
|
||||
{"CAkey", OPT_CAKEY, 's',
|
||||
"The CA key, must be PEM format; if not in CAfile"},
|
||||
{"extfile", OPT_EXTFILE, '<', "File with X509V3 extensions to add"},
|
||||
OPT_R_OPTIONS,
|
||||
{"CAform", OPT_CAFORM, 'F', "CA format - default PEM"},
|
||||
{"CAkeyform", OPT_CAKEYFORM, 'f', "CA key format - default PEM"},
|
||||
{"sigopt", OPT_SIGOPT, 's', "Signature parameter in n:v form"},
|
||||
{"CAcreateserial", OPT_CACREATESERIAL, '-',
|
||||
"Create serial number file if it does not exist"},
|
||||
{"CAserial", OPT_CASERIAL, 's', "Serial file"},
|
||||
{"new", OPT_NEW, '-', "Generate a certificate from scratch"},
|
||||
{"force_pubkey", OPT_FORCE_PUBKEY, '<', "Force the key to put inside certificate"},
|
||||
{"subj", OPT_SUBJ, 's', "Set or override certificate subject (and issuer)"},
|
||||
{"next_serial", OPT_NEXT_SERIAL, '-', "Increment current certificate serial number"},
|
||||
{"clrreject", OPT_CLRREJECT, '-',
|
||||
"Clears all the prohibited or rejected uses of the certificate"},
|
||||
{"badsig", OPT_BADSIG, '-', "Corrupt last byte of certificate signature (for test)"},
|
||||
{"", OPT_MD, '-', "Any supported digest"},
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
{"subject_hash_old", OPT_SUBJECT_HASH_OLD, '-',
|
||||
"Print old-style (MD5) issuer hash value"},
|
||||
{"issuer_hash_old", OPT_ISSUER_HASH_OLD, '-',
|
||||
"Print old-style (MD5) subject hash value"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
{"preserve_dates", OPT_PRESERVE_DATES, '-', "preserve existing dates when signing"},
|
||||
{NULL}
|
||||
};
|
||||
@@ -224,7 +231,7 @@ int x509_main(int argc, char **argv)
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_KEYFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &keyformat))
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PDE, &keyformat))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_CAFORM:
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ before_build:
|
||||
- ps: >-
|
||||
If ($env:Platform -Match "x86") {
|
||||
$env:VCVARS_PLATFORM="x86"
|
||||
$env:TARGET="VC-WIN32 no-asm"
|
||||
$env:TARGET="VC-WIN32 no-asm --strict-warnings"
|
||||
} Else {
|
||||
$env:VCVARS_PLATFORM="amd64"
|
||||
$env:TARGET="VC-WIN64A-masm"
|
||||
|
||||
+7
-4
@@ -1,6 +1,6 @@
|
||||
# Note that some of these directories are filtered in Configure. Look for
|
||||
# %skipdir there for further explanations.
|
||||
SUBDIRS=crypto ssl apps test util tools fuzz engines providers
|
||||
SUBDIRS=crypto ssl apps test util tools fuzz engines providers doc
|
||||
|
||||
LIBS=libcrypto libssl
|
||||
INCLUDE[libcrypto]=. include
|
||||
@@ -9,9 +9,12 @@ DEPEND[libssl]=libcrypto
|
||||
|
||||
# Empty DEPEND "indices" means the dependencies are expected to be built
|
||||
# unconditionally before anything else.
|
||||
DEPEND[]=include/openssl/opensslconf.h include/crypto/bn_conf.h \
|
||||
include/crypto/dso_conf.h doc/man7/openssl_user_macros.pod
|
||||
GENERATE[include/openssl/opensslconf.h]=include/openssl/opensslconf.h.in
|
||||
DEPEND[]=include/openssl/configuration.h include/openssl/opensslv.h \
|
||||
include/crypto/bn_conf.h include/crypto/dso_conf.h \
|
||||
doc/man7/openssl_user_macros.pod
|
||||
|
||||
GENERATE[include/openssl/configuration.h]=include/openssl/configuration.h.in
|
||||
GENERATE[include/openssl/opensslv.h]=include/openssl/opensslv.h.in
|
||||
GENERATE[include/crypto/bn_conf.h]=include/crypto/bn_conf.h.in
|
||||
GENERATE[include/crypto/dso_conf.h]=include/crypto/dso_conf.h.in
|
||||
GENERATE[doc/man7/openssl_user_macros.pod]=doc/man7/openssl_user_macros.pod.in
|
||||
|
||||
+7
-3
@@ -124,8 +124,6 @@ unless (caller) {
|
||||
my $prepend = <<"_____";
|
||||
use File::Spec::Functions;
|
||||
use lib '{- sourcedir('util', 'perl') -}';
|
||||
_____
|
||||
$prepend .= <<"_____" if defined $target{perl_platform};
|
||||
use lib '{- sourcedir('Configurations') -}';
|
||||
use lib '{- $config{builddir} -}';
|
||||
use platform;
|
||||
@@ -247,7 +245,13 @@ _____
|
||||
foreach (sort keys %target) {
|
||||
next if $_ =~ m|^_| || $_ eq 'template';
|
||||
my $quotify = sub {
|
||||
map { (my $x = $_) =~ s|([\\\$\@"])|\\$1|g; "\"$x\""} @_;
|
||||
map {
|
||||
if (defined $_) {
|
||||
(my $x = $_) =~ s|([\\\$\@"])|\\$1|g; "\"$x\""
|
||||
} else {
|
||||
"undef";
|
||||
}
|
||||
} @_;
|
||||
};
|
||||
print ' ', $_, ' => ';
|
||||
if (ref($target{$_}) eq "ARRAY") {
|
||||
|
||||
+2
-3
@@ -131,9 +131,8 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
|
||||
return 0;
|
||||
}
|
||||
|
||||
strncpy((*ctx)->entry_name, direntry->d_name,
|
||||
sizeof((*ctx)->entry_name) - 1);
|
||||
(*ctx)->entry_name[sizeof((*ctx)->entry_name) - 1] = '\0';
|
||||
OPENSSL_strlcpy((*ctx)->entry_name, direntry->d_name,
|
||||
sizeof((*ctx)->entry_name));
|
||||
#ifdef __VMS
|
||||
if ((*ctx)->expect_file_generations) {
|
||||
char *p = (*ctx)->entry_name + strlen((*ctx)->entry_name);
|
||||
|
||||
@@ -7,6 +7,13 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* AES low level APIs are deprecated for public use, but still ok for internal
|
||||
* use where we're using them to implement the higher level EVP interface, as is
|
||||
* the case here.
|
||||
*/
|
||||
#include "internal/deprecated.h"
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include <openssl/modes.h>
|
||||
|
||||
|
||||
@@ -7,6 +7,12 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* AES_encrypt is deprecated - but we need to use it to implement these other
|
||||
* deprecated APIs.
|
||||
*/
|
||||
#include "internal/deprecated.h"
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include <openssl/modes.h>
|
||||
|
||||
|
||||
@@ -36,6 +36,13 @@
|
||||
/* Note: rewritten a little bit to provide error control and an OpenSSL-
|
||||
compatible API */
|
||||
|
||||
/*
|
||||
* AES low level APIs are deprecated for public use, but still ok for internal
|
||||
* use where we're using them to implement the higher level EVP interface, as is
|
||||
* the case here.
|
||||
*/
|
||||
#include "internal/deprecated.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -9,6 +9,12 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/*
|
||||
* AES_encrypt/AES_decrypt are deprecated - but we need to use them to implement
|
||||
* AES_ecb_encrypt
|
||||
*/
|
||||
#include "internal/deprecated.h"
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_local.h"
|
||||
|
||||
|
||||
@@ -7,9 +7,15 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* AES_encrypt/AES_decrypt are deprecated - but we need to use them to implement
|
||||
* these functions
|
||||
*/
|
||||
#include "internal/deprecated.h"
|
||||
|
||||
#include "internal/cryptlib.h"
|
||||
|
||||
#if OPENSSL_API_3
|
||||
#ifdef OPENSSL_NO_DEPRECATED_3_0
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
#else
|
||||
|
||||
|
||||
@@ -11,11 +11,13 @@
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_local.h"
|
||||
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
const char *AES_options(void)
|
||||
{
|
||||
#ifdef FULL_UNROLL
|
||||
# ifdef FULL_UNROLL
|
||||
return "aes(full)";
|
||||
#else
|
||||
# else
|
||||
return "aes(partial)";
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
@@ -7,6 +7,12 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* AES_encrypt is deprecated - but we need to use it to implement
|
||||
* AES_ofb128_encrypt
|
||||
*/
|
||||
#include "internal/deprecated.h"
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include <openssl/modes.h>
|
||||
|
||||
|
||||
@@ -7,6 +7,12 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* AES_encrypt/AES_decrypt are deprecated - but we need to use them to implement
|
||||
* these functions
|
||||
*/
|
||||
#include "internal/deprecated.h"
|
||||
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/aes.h>
|
||||
#include <openssl/modes.h>
|
||||
|
||||
@@ -328,6 +328,7 @@ $code.=<<___;
|
||||
.type _x86_64_AES_encrypt,\@abi-omnipotent
|
||||
.align 16
|
||||
_x86_64_AES_encrypt:
|
||||
.cfi_startproc
|
||||
xor 0($key),$s0 # xor with key
|
||||
xor 4($key),$s1
|
||||
xor 8($key),$s2
|
||||
@@ -363,6 +364,7 @@ ___
|
||||
}
|
||||
$code.=<<___;
|
||||
.byte 0xf3,0xc3 # rep ret
|
||||
.cfi_endproc
|
||||
.size _x86_64_AES_encrypt,.-_x86_64_AES_encrypt
|
||||
___
|
||||
|
||||
@@ -912,6 +914,7 @@ $code.=<<___;
|
||||
.type _x86_64_AES_decrypt,\@abi-omnipotent
|
||||
.align 16
|
||||
_x86_64_AES_decrypt:
|
||||
.cfi_startproc
|
||||
xor 0($key),$s0 # xor with key
|
||||
xor 4($key),$s1
|
||||
xor 8($key),$s2
|
||||
@@ -954,6 +957,7 @@ ___
|
||||
}
|
||||
$code.=<<___;
|
||||
.byte 0xf3,0xc3 # rep ret
|
||||
.cfi_endproc
|
||||
.size _x86_64_AES_decrypt,.-_x86_64_AES_decrypt
|
||||
___
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) &&
|
||||
$avx = ($1>=10) + ($1>=11);
|
||||
}
|
||||
|
||||
if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
|
||||
if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) {
|
||||
$avx = ($2>=3.0) + ($2>3.0);
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ $avx=1 if (!$avx && $win64 && ($flavour =~ /nasm/ || $ENV{ASM} =~ /nasm/) &&
|
||||
$avx=1 if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) &&
|
||||
`ml64 2>&1` =~ /Version ([0-9]+)\./ &&
|
||||
$1>=10);
|
||||
$avx=1 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/ && $2>=3.0);
|
||||
$avx=1 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/ && $2>=3.0);
|
||||
|
||||
$shaext=1; ### set to zero if compiling for 1.0.1
|
||||
|
||||
@@ -135,6 +135,7 @@ $code.=<<___;
|
||||
.type aesni_cbc_sha1_enc,\@abi-omnipotent
|
||||
.align 32
|
||||
aesni_cbc_sha1_enc:
|
||||
.cfi_startproc
|
||||
# caller should check for SSSE3 and AES-NI bits
|
||||
mov OPENSSL_ia32cap_P+0(%rip),%r10d
|
||||
mov OPENSSL_ia32cap_P+4(%rip),%r11
|
||||
@@ -153,6 +154,7 @@ ___
|
||||
$code.=<<___;
|
||||
jmp aesni_cbc_sha1_enc_ssse3
|
||||
ret
|
||||
.cfi_endproc
|
||||
.size aesni_cbc_sha1_enc,.-aesni_cbc_sha1_enc
|
||||
___
|
||||
|
||||
@@ -842,6 +844,7 @@ $code.=<<___;
|
||||
.type aesni256_cbc_sha1_dec,\@abi-omnipotent
|
||||
.align 32
|
||||
aesni256_cbc_sha1_dec:
|
||||
.cfi_startproc
|
||||
# caller should check for SSSE3 and AES-NI bits
|
||||
mov OPENSSL_ia32cap_P+0(%rip),%r10d
|
||||
mov OPENSSL_ia32cap_P+4(%rip),%r11d
|
||||
@@ -856,6 +859,7 @@ ___
|
||||
$code.=<<___;
|
||||
jmp aesni256_cbc_sha1_dec_ssse3
|
||||
ret
|
||||
.cfi_endproc
|
||||
.size aesni256_cbc_sha1_dec,.-aesni256_cbc_sha1_dec
|
||||
|
||||
.type aesni256_cbc_sha1_dec_ssse3,\@function,6
|
||||
@@ -1762,6 +1766,7 @@ $code.=<<___;
|
||||
.type aesni_cbc_sha1_enc_shaext,\@function,6
|
||||
.align 32
|
||||
aesni_cbc_sha1_enc_shaext:
|
||||
.cfi_startproc
|
||||
mov `($win64?56:8)`(%rsp),$inp # load 7th argument
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
@@ -1913,6 +1918,7 @@ $code.=<<___ if ($win64);
|
||||
___
|
||||
$code.=<<___;
|
||||
ret
|
||||
.cfi_endproc
|
||||
.size aesni_cbc_sha1_enc_shaext,.-aesni_cbc_sha1_enc_shaext
|
||||
___
|
||||
}}}
|
||||
|
||||
@@ -71,7 +71,7 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) &&
|
||||
$avx = ($1>=10) + ($1>=12);
|
||||
}
|
||||
|
||||
if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
|
||||
if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) {
|
||||
$avx = ($2>=3.0) + ($2>3.0);
|
||||
}
|
||||
|
||||
@@ -125,6 +125,7 @@ $code=<<___;
|
||||
.type $func,\@abi-omnipotent
|
||||
.align 16
|
||||
$func:
|
||||
.cfi_startproc
|
||||
___
|
||||
if ($avx) {
|
||||
$code.=<<___;
|
||||
@@ -164,6 +165,7 @@ $code.=<<___;
|
||||
ud2
|
||||
.Lprobe:
|
||||
ret
|
||||
.cfi_endproc
|
||||
.size $func,.-$func
|
||||
|
||||
.align 64
|
||||
@@ -1086,7 +1088,23 @@ $code.=<<___;
|
||||
vmovdqa $t0,0x00(%rsp)
|
||||
xor $a1,$a1
|
||||
vmovdqa $t1,0x20(%rsp)
|
||||
___
|
||||
$code.=<<___ if (!$win64);
|
||||
# temporarily use %rsi as frame pointer
|
||||
mov $_rsp,%rsi
|
||||
.cfi_def_cfa %rsi,8
|
||||
___
|
||||
$code.=<<___;
|
||||
lea -$PUSH8(%rsp),%rsp
|
||||
___
|
||||
$code.=<<___ if (!$win64);
|
||||
# the frame info is at $_rsp, but the stack is moving...
|
||||
# so a second frame pointer is saved at -8(%rsp)
|
||||
# that is in the red zone
|
||||
mov %rsi,-8(%rsp)
|
||||
.cfi_cfa_expression %rsp-8,deref,+8
|
||||
___
|
||||
$code.=<<___;
|
||||
mov $B,$a3
|
||||
vmovdqa $t2,0x00(%rsp)
|
||||
xor $C,$a3 # magic
|
||||
@@ -1108,7 +1126,17 @@ my @X = @_;
|
||||
my @insns = (&$body,&$body,&$body,&$body); # 96 instructions
|
||||
my $base = "+2*$PUSH8(%rsp)";
|
||||
|
||||
&lea ("%rsp","-$PUSH8(%rsp)") if (($j%2)==0);
|
||||
if (($j%2)==0) {
|
||||
&lea ("%rsp","-$PUSH8(%rsp)");
|
||||
$code.=<<___ if (!$win64);
|
||||
.cfi_cfa_expression %rsp+`$PUSH8-8`,deref,+8
|
||||
# copy secondary frame pointer to new location again at -8(%rsp)
|
||||
pushq $PUSH8-8(%rsp)
|
||||
.cfi_cfa_expression %rsp,deref,+8
|
||||
lea 8(%rsp),%rsp
|
||||
.cfi_cfa_expression %rsp-8,deref,+8
|
||||
___
|
||||
}
|
||||
foreach (Xupdate_256_AVX()) { # 29 instructions
|
||||
eval;
|
||||
eval(shift(@insns));
|
||||
@@ -1234,26 +1262,28 @@ $code.=<<___;
|
||||
|
||||
jbe .Loop_avx2
|
||||
lea (%rsp),$Tbl
|
||||
# temporarily use $Tbl as index to $_rsp
|
||||
# this avoids the need to save a secondary frame pointer at -8(%rsp)
|
||||
.cfi_cfa_expression $Tbl+`16*$SZ+7*8`,deref,+8
|
||||
|
||||
.Ldone_avx2:
|
||||
lea ($Tbl),%rsp
|
||||
mov $_ivp,$ivp
|
||||
mov $_rsp,%rsi
|
||||
mov 16*$SZ+4*8($Tbl),$ivp
|
||||
mov 16*$SZ+7*8($Tbl),%rsi
|
||||
.cfi_def_cfa %rsi,8
|
||||
vmovdqu $iv,($ivp) # output IV
|
||||
vzeroall
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
movaps `$framesz+16*0`(%rsp),%xmm6
|
||||
movaps `$framesz+16*1`(%rsp),%xmm7
|
||||
movaps `$framesz+16*2`(%rsp),%xmm8
|
||||
movaps `$framesz+16*3`(%rsp),%xmm9
|
||||
movaps `$framesz+16*4`(%rsp),%xmm10
|
||||
movaps `$framesz+16*5`(%rsp),%xmm11
|
||||
movaps `$framesz+16*6`(%rsp),%xmm12
|
||||
movaps `$framesz+16*7`(%rsp),%xmm13
|
||||
movaps `$framesz+16*8`(%rsp),%xmm14
|
||||
movaps `$framesz+16*9`(%rsp),%xmm15
|
||||
movaps `$framesz+16*0`($Tbl),%xmm6
|
||||
movaps `$framesz+16*1`($Tbl),%xmm7
|
||||
movaps `$framesz+16*2`($Tbl),%xmm8
|
||||
movaps `$framesz+16*3`($Tbl),%xmm9
|
||||
movaps `$framesz+16*4`($Tbl),%xmm10
|
||||
movaps `$framesz+16*5`($Tbl),%xmm11
|
||||
movaps `$framesz+16*6`($Tbl),%xmm12
|
||||
movaps `$framesz+16*7`($Tbl),%xmm13
|
||||
movaps `$framesz+16*8`($Tbl),%xmm14
|
||||
movaps `$framesz+16*9`($Tbl),%xmm15
|
||||
___
|
||||
$code.=<<___;
|
||||
mov -48(%rsi),%r15
|
||||
@@ -1341,6 +1371,7 @@ $code.=<<___;
|
||||
.type ${func}_shaext,\@function,6
|
||||
.align 32
|
||||
${func}_shaext:
|
||||
.cfi_startproc
|
||||
mov `($win64?56:8)`(%rsp),$inp # load 7th argument
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
@@ -1557,6 +1588,7 @@ $code.=<<___ if ($win64);
|
||||
___
|
||||
$code.=<<___;
|
||||
ret
|
||||
.cfi_endproc
|
||||
.size ${func}_shaext,.-${func}_shaext
|
||||
___
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
# nothing one can do and the result appears optimal. CCM result is
|
||||
# identical to CBC, because CBC-MAC is essentially CBC encrypt without
|
||||
# saving output. CCM CTR "stays invisible," because it's neatly
|
||||
# interleaved wih CBC-MAC. This provides ~30% improvement over
|
||||
# interleaved with CBC-MAC. This provides ~30% improvement over
|
||||
# "straightforward" CCM implementation with CTR and CBC-MAC performed
|
||||
# disjointly. Parallelizable modes practically achieve the theoretical
|
||||
# limit.
|
||||
@@ -986,6 +986,7 @@ $code.=<<___;
|
||||
.type aesni_ccm64_encrypt_blocks,\@function,6
|
||||
.align 16
|
||||
aesni_ccm64_encrypt_blocks:
|
||||
.cfi_startproc
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
lea -0x58(%rsp),%rsp
|
||||
@@ -1068,6 +1069,7 @@ $code.=<<___ if ($win64);
|
||||
___
|
||||
$code.=<<___;
|
||||
ret
|
||||
.cfi_endproc
|
||||
.size aesni_ccm64_encrypt_blocks,.-aesni_ccm64_encrypt_blocks
|
||||
___
|
||||
######################################################################
|
||||
@@ -1076,6 +1078,7 @@ $code.=<<___;
|
||||
.type aesni_ccm64_decrypt_blocks,\@function,6
|
||||
.align 16
|
||||
aesni_ccm64_decrypt_blocks:
|
||||
.cfi_startproc
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
lea -0x58(%rsp),%rsp
|
||||
@@ -1175,6 +1178,7 @@ $code.=<<___ if ($win64);
|
||||
___
|
||||
$code.=<<___;
|
||||
ret
|
||||
.cfi_endproc
|
||||
.size aesni_ccm64_decrypt_blocks,.-aesni_ccm64_decrypt_blocks
|
||||
___
|
||||
}
|
||||
@@ -3033,6 +3037,7 @@ $code.=<<___;
|
||||
.type __ocb_encrypt6,\@abi-omnipotent
|
||||
.align 32
|
||||
__ocb_encrypt6:
|
||||
.cfi_startproc
|
||||
pxor $rndkey0l,@offset[5] # offset_i ^ round[0]
|
||||
movdqu ($L_p,$i1),@offset[1]
|
||||
movdqa @offset[0],@offset[2]
|
||||
@@ -3130,11 +3135,13 @@ __ocb_encrypt6:
|
||||
aesenclast @offset[4],$inout4
|
||||
aesenclast @offset[5],$inout5
|
||||
ret
|
||||
.cfi_endproc
|
||||
.size __ocb_encrypt6,.-__ocb_encrypt6
|
||||
|
||||
.type __ocb_encrypt4,\@abi-omnipotent
|
||||
.align 32
|
||||
__ocb_encrypt4:
|
||||
.cfi_startproc
|
||||
pxor $rndkey0l,@offset[5] # offset_i ^ round[0]
|
||||
movdqu ($L_p,$i1),@offset[1]
|
||||
movdqa @offset[0],@offset[2]
|
||||
@@ -3199,11 +3206,13 @@ __ocb_encrypt4:
|
||||
aesenclast @offset[2],$inout2
|
||||
aesenclast @offset[3],$inout3
|
||||
ret
|
||||
.cfi_endproc
|
||||
.size __ocb_encrypt4,.-__ocb_encrypt4
|
||||
|
||||
.type __ocb_encrypt1,\@abi-omnipotent
|
||||
.align 32
|
||||
__ocb_encrypt1:
|
||||
.cfi_startproc
|
||||
pxor @offset[5],$inout5 # offset_i
|
||||
pxor $rndkey0l,$inout5 # offset_i ^ round[0]
|
||||
pxor $inout0,$checksum # accumulate checksum
|
||||
@@ -3234,6 +3243,7 @@ __ocb_encrypt1:
|
||||
|
||||
aesenclast $inout5,$inout0
|
||||
ret
|
||||
.cfi_endproc
|
||||
.size __ocb_encrypt1,.-__ocb_encrypt1
|
||||
|
||||
.globl aesni_ocb_decrypt
|
||||
@@ -3515,6 +3525,7 @@ $code.=<<___;
|
||||
.type __ocb_decrypt6,\@abi-omnipotent
|
||||
.align 32
|
||||
__ocb_decrypt6:
|
||||
.cfi_startproc
|
||||
pxor $rndkey0l,@offset[5] # offset_i ^ round[0]
|
||||
movdqu ($L_p,$i1),@offset[1]
|
||||
movdqa @offset[0],@offset[2]
|
||||
@@ -3606,11 +3617,13 @@ __ocb_decrypt6:
|
||||
aesdeclast @offset[4],$inout4
|
||||
aesdeclast @offset[5],$inout5
|
||||
ret
|
||||
.cfi_endproc
|
||||
.size __ocb_decrypt6,.-__ocb_decrypt6
|
||||
|
||||
.type __ocb_decrypt4,\@abi-omnipotent
|
||||
.align 32
|
||||
__ocb_decrypt4:
|
||||
.cfi_startproc
|
||||
pxor $rndkey0l,@offset[5] # offset_i ^ round[0]
|
||||
movdqu ($L_p,$i1),@offset[1]
|
||||
movdqa @offset[0],@offset[2]
|
||||
@@ -3671,11 +3684,13 @@ __ocb_decrypt4:
|
||||
aesdeclast @offset[2],$inout2
|
||||
aesdeclast @offset[3],$inout3
|
||||
ret
|
||||
.cfi_endproc
|
||||
.size __ocb_decrypt4,.-__ocb_decrypt4
|
||||
|
||||
.type __ocb_decrypt1,\@abi-omnipotent
|
||||
.align 32
|
||||
__ocb_decrypt1:
|
||||
.cfi_startproc
|
||||
pxor @offset[5],$inout5 # offset_i
|
||||
pxor $rndkey0l,$inout5 # offset_i ^ round[0]
|
||||
pxor $inout5,$inout0 # input ^ round[0] ^ offset_i
|
||||
@@ -3705,6 +3720,7 @@ __ocb_decrypt1:
|
||||
|
||||
aesdeclast $inout5,$inout0
|
||||
ret
|
||||
.cfi_endproc
|
||||
.size __ocb_decrypt1,.-__ocb_decrypt1
|
||||
___
|
||||
} }}
|
||||
@@ -4639,7 +4655,6 @@ __aesni_set_encrypt_key:
|
||||
add \$8,%rsp
|
||||
.cfi_adjust_cfa_offset -8
|
||||
ret
|
||||
.cfi_endproc
|
||||
.LSEH_end_set_encrypt_key:
|
||||
|
||||
.align 16
|
||||
@@ -4710,6 +4725,7 @@ __aesni_set_encrypt_key:
|
||||
shufps \$0b10101010,%xmm1,%xmm1 # critical path
|
||||
xorps %xmm1,%xmm2
|
||||
ret
|
||||
.cfi_endproc
|
||||
.size ${PREFIX}_set_encrypt_key,.-${PREFIX}_set_encrypt_key
|
||||
.size __aesni_set_encrypt_key,.-__aesni_set_encrypt_key
|
||||
___
|
||||
|
||||
@@ -384,6 +384,836 @@ ___
|
||||
&gen_block("en");
|
||||
&gen_block("de");
|
||||
}}}
|
||||
|
||||
# Performance in cycles per byte.
|
||||
# Processed with AES-ECB different key size.
|
||||
# It shows the value before and after optimization as below:
|
||||
# (before/after):
|
||||
#
|
||||
# AES-128-ECB AES-192-ECB AES-256-ECB
|
||||
# Cortex-A57 1.85/0.82 2.16/0.96 2.47/1.10
|
||||
# Cortex-A72 1.64/0.85 1.82/0.99 2.13/1.14
|
||||
|
||||
# Optimization is implemented by loop unrolling and interleaving.
|
||||
# Commonly, we choose the unrolling factor as 5, if the input
|
||||
# data size smaller than 5 blocks, but not smaller than 3 blocks,
|
||||
# choose 3 as the unrolling factor.
|
||||
# If the input data size dsize >= 5*16 bytes, then take 5 blocks
|
||||
# as one iteration, every loop the left size lsize -= 5*16.
|
||||
# If 5*16 > lsize >= 3*16 bytes, take 3 blocks as one iteration,
|
||||
# every loop lsize -=3*16.
|
||||
# If lsize < 3*16 bytes, treat them as the tail, interleave the
|
||||
# two blocks AES instructions.
|
||||
# There is one special case, if the original input data size dsize
|
||||
# = 16 bytes, we will treat it seperately to improve the
|
||||
# performance: one independent code block without LR, FP load and
|
||||
# store, just looks like what the original ECB implementation does.
|
||||
|
||||
{{{
|
||||
my ($inp,$out,$len,$key)=map("x$_",(0..3));
|
||||
my ($enc,$rounds,$cnt,$key_,$step)=("w4","w5","w6","x7","x8");
|
||||
my ($dat0,$dat1,$in0,$in1,$tmp0,$tmp1,$tmp2,$rndlast)=map("q$_",(0..7));
|
||||
|
||||
my ($dat,$tmp,$rndzero_n_last)=($dat0,$tmp0,$tmp1);
|
||||
|
||||
### q7 last round key
|
||||
### q10-q15 q7 Last 7 round keys
|
||||
### q8-q9 preloaded round keys except last 7 keys for big size
|
||||
### q5, q6, q8-q9 preloaded round keys except last 7 keys for only 16 byte
|
||||
|
||||
{
|
||||
my ($dat2,$in2,$tmp2)=map("q$_",(10,11,9));
|
||||
|
||||
my ($dat3,$in3,$tmp3); # used only in 64-bit mode
|
||||
my ($dat4,$in4,$tmp4);
|
||||
if ($flavour =~ /64/) {
|
||||
($dat2,$dat3,$dat4,$in2,$in3,$in4,$tmp3,$tmp4)=map("q$_",(16..23));
|
||||
}
|
||||
|
||||
$code.=<<___;
|
||||
.globl ${prefix}_ecb_encrypt
|
||||
.type ${prefix}_ecb_encrypt,%function
|
||||
.align 5
|
||||
${prefix}_ecb_encrypt:
|
||||
___
|
||||
$code.=<<___ if ($flavour =~ /64/);
|
||||
subs $len,$len,#16
|
||||
// Original input data size bigger than 16, jump to big size processing.
|
||||
b.ne .Lecb_big_size
|
||||
vld1.8 {$dat0},[$inp]
|
||||
cmp $enc,#0 // en- or decrypting?
|
||||
ldr $rounds,[$key,#240]
|
||||
vld1.32 {q5-q6},[$key],#32 // load key schedule...
|
||||
|
||||
b.eq .Lecb_small_dec
|
||||
aese $dat0,q5
|
||||
aesmc $dat0,$dat0
|
||||
vld1.32 {q8-q9},[$key],#32 // load key schedule...
|
||||
aese $dat0,q6
|
||||
aesmc $dat0,$dat0
|
||||
subs $rounds,$rounds,#10 // if rounds==10, jump to aes-128-ecb processing
|
||||
b.eq .Lecb_128_enc
|
||||
.Lecb_round_loop:
|
||||
aese $dat0,q8
|
||||
aesmc $dat0,$dat0
|
||||
vld1.32 {q8},[$key],#16 // load key schedule...
|
||||
aese $dat0,q9
|
||||
aesmc $dat0,$dat0
|
||||
vld1.32 {q9},[$key],#16 // load key schedule...
|
||||
subs $rounds,$rounds,#2 // bias
|
||||
b.gt .Lecb_round_loop
|
||||
.Lecb_128_enc:
|
||||
vld1.32 {q10-q11},[$key],#32 // load key schedule...
|
||||
aese $dat0,q8
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat0,q9
|
||||
aesmc $dat0,$dat0
|
||||
vld1.32 {q12-q13},[$key],#32 // load key schedule...
|
||||
aese $dat0,q10
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat0,q11
|
||||
aesmc $dat0,$dat0
|
||||
vld1.32 {q14-q15},[$key],#32 // load key schedule...
|
||||
aese $dat0,q12
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat0,q13
|
||||
aesmc $dat0,$dat0
|
||||
vld1.32 {$rndlast},[$key]
|
||||
aese $dat0,q14
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat0,q15
|
||||
veor $dat0,$dat0,$rndlast
|
||||
vst1.8 {$dat0},[$out]
|
||||
b .Lecb_Final_abort
|
||||
.Lecb_small_dec:
|
||||
aesd $dat0,q5
|
||||
aesimc $dat0,$dat0
|
||||
vld1.32 {q8-q9},[$key],#32 // load key schedule...
|
||||
aesd $dat0,q6
|
||||
aesimc $dat0,$dat0
|
||||
subs $rounds,$rounds,#10 // bias
|
||||
b.eq .Lecb_128_dec
|
||||
.Lecb_dec_round_loop:
|
||||
aesd $dat0,q8
|
||||
aesimc $dat0,$dat0
|
||||
vld1.32 {q8},[$key],#16 // load key schedule...
|
||||
aesd $dat0,q9
|
||||
aesimc $dat0,$dat0
|
||||
vld1.32 {q9},[$key],#16 // load key schedule...
|
||||
subs $rounds,$rounds,#2 // bias
|
||||
b.gt .Lecb_dec_round_loop
|
||||
.Lecb_128_dec:
|
||||
vld1.32 {q10-q11},[$key],#32 // load key schedule...
|
||||
aesd $dat0,q8
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat0,q9
|
||||
aesimc $dat0,$dat0
|
||||
vld1.32 {q12-q13},[$key],#32 // load key schedule...
|
||||
aesd $dat0,q10
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat0,q11
|
||||
aesimc $dat0,$dat0
|
||||
vld1.32 {q14-q15},[$key],#32 // load key schedule...
|
||||
aesd $dat0,q12
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat0,q13
|
||||
aesimc $dat0,$dat0
|
||||
vld1.32 {$rndlast},[$key]
|
||||
aesd $dat0,q14
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat0,q15
|
||||
veor $dat0,$dat0,$rndlast
|
||||
vst1.8 {$dat0},[$out]
|
||||
b .Lecb_Final_abort
|
||||
.Lecb_big_size:
|
||||
___
|
||||
$code.=<<___ if ($flavour =~ /64/);
|
||||
stp x29,x30,[sp,#-16]!
|
||||
add x29,sp,#0
|
||||
___
|
||||
$code.=<<___ if ($flavour !~ /64/);
|
||||
mov ip,sp
|
||||
stmdb sp!,{r4-r8,lr}
|
||||
vstmdb sp!,{d8-d15} @ ABI specification says so
|
||||
ldmia ip,{r4-r5} @ load remaining args
|
||||
subs $len,$len,#16
|
||||
___
|
||||
$code.=<<___;
|
||||
mov $step,#16
|
||||
b.lo .Lecb_done
|
||||
cclr $step,eq
|
||||
|
||||
cmp $enc,#0 // en- or decrypting?
|
||||
ldr $rounds,[$key,#240]
|
||||
and $len,$len,#-16
|
||||
vld1.8 {$dat},[$inp],$step
|
||||
|
||||
vld1.32 {q8-q9},[$key] // load key schedule...
|
||||
sub $rounds,$rounds,#6
|
||||
add $key_,$key,x5,lsl#4 // pointer to last 7 round keys
|
||||
sub $rounds,$rounds,#2
|
||||
vld1.32 {q10-q11},[$key_],#32
|
||||
vld1.32 {q12-q13},[$key_],#32
|
||||
vld1.32 {q14-q15},[$key_],#32
|
||||
vld1.32 {$rndlast},[$key_]
|
||||
|
||||
add $key_,$key,#32
|
||||
mov $cnt,$rounds
|
||||
b.eq .Lecb_dec
|
||||
|
||||
vld1.8 {$dat1},[$inp],#16
|
||||
subs $len,$len,#32 // bias
|
||||
add $cnt,$rounds,#2
|
||||
vorr $in1,$dat1,$dat1
|
||||
vorr $dat2,$dat1,$dat1
|
||||
vorr $dat1,$dat,$dat
|
||||
b.lo .Lecb_enc_tail
|
||||
|
||||
vorr $dat1,$in1,$in1
|
||||
vld1.8 {$dat2},[$inp],#16
|
||||
___
|
||||
$code.=<<___ if ($flavour =~ /64/);
|
||||
cmp $len,#32
|
||||
b.lo .Loop3x_ecb_enc
|
||||
|
||||
vld1.8 {$dat3},[$inp],#16
|
||||
vld1.8 {$dat4},[$inp],#16
|
||||
sub $len,$len,#32 // bias
|
||||
mov $cnt,$rounds
|
||||
|
||||
.Loop5x_ecb_enc:
|
||||
aese $dat0,q8
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat1,q8
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q8
|
||||
aesmc $dat2,$dat2
|
||||
aese $dat3,q8
|
||||
aesmc $dat3,$dat3
|
||||
aese $dat4,q8
|
||||
aesmc $dat4,$dat4
|
||||
vld1.32 {q8},[$key_],#16
|
||||
subs $cnt,$cnt,#2
|
||||
aese $dat0,q9
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat1,q9
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q9
|
||||
aesmc $dat2,$dat2
|
||||
aese $dat3,q9
|
||||
aesmc $dat3,$dat3
|
||||
aese $dat4,q9
|
||||
aesmc $dat4,$dat4
|
||||
vld1.32 {q9},[$key_],#16
|
||||
b.gt .Loop5x_ecb_enc
|
||||
|
||||
aese $dat0,q8
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat1,q8
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q8
|
||||
aesmc $dat2,$dat2
|
||||
aese $dat3,q8
|
||||
aesmc $dat3,$dat3
|
||||
aese $dat4,q8
|
||||
aesmc $dat4,$dat4
|
||||
cmp $len,#0x40 // because .Lecb_enc_tail4x
|
||||
sub $len,$len,#0x50
|
||||
|
||||
aese $dat0,q9
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat1,q9
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q9
|
||||
aesmc $dat2,$dat2
|
||||
aese $dat3,q9
|
||||
aesmc $dat3,$dat3
|
||||
aese $dat4,q9
|
||||
aesmc $dat4,$dat4
|
||||
csel x6,xzr,$len,gt // borrow x6, $cnt, "gt" is not typo
|
||||
mov $key_,$key
|
||||
|
||||
aese $dat0,q10
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat1,q10
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q10
|
||||
aesmc $dat2,$dat2
|
||||
aese $dat3,q10
|
||||
aesmc $dat3,$dat3
|
||||
aese $dat4,q10
|
||||
aesmc $dat4,$dat4
|
||||
add $inp,$inp,x6 // $inp is adjusted in such way that
|
||||
// at exit from the loop $dat1-$dat4
|
||||
// are loaded with last "words"
|
||||
add x6,$len,#0x60 // because .Lecb_enc_tail4x
|
||||
|
||||
aese $dat0,q11
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat1,q11
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q11
|
||||
aesmc $dat2,$dat2
|
||||
aese $dat3,q11
|
||||
aesmc $dat3,$dat3
|
||||
aese $dat4,q11
|
||||
aesmc $dat4,$dat4
|
||||
|
||||
aese $dat0,q12
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat1,q12
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q12
|
||||
aesmc $dat2,$dat2
|
||||
aese $dat3,q12
|
||||
aesmc $dat3,$dat3
|
||||
aese $dat4,q12
|
||||
aesmc $dat4,$dat4
|
||||
|
||||
aese $dat0,q13
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat1,q13
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q13
|
||||
aesmc $dat2,$dat2
|
||||
aese $dat3,q13
|
||||
aesmc $dat3,$dat3
|
||||
aese $dat4,q13
|
||||
aesmc $dat4,$dat4
|
||||
|
||||
aese $dat0,q14
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat1,q14
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q14
|
||||
aesmc $dat2,$dat2
|
||||
aese $dat3,q14
|
||||
aesmc $dat3,$dat3
|
||||
aese $dat4,q14
|
||||
aesmc $dat4,$dat4
|
||||
|
||||
aese $dat0,q15
|
||||
vld1.8 {$in0},[$inp],#16
|
||||
aese $dat1,q15
|
||||
vld1.8 {$in1},[$inp],#16
|
||||
aese $dat2,q15
|
||||
vld1.8 {$in2},[$inp],#16
|
||||
aese $dat3,q15
|
||||
vld1.8 {$in3},[$inp],#16
|
||||
aese $dat4,q15
|
||||
vld1.8 {$in4},[$inp],#16
|
||||
cbz x6,.Lecb_enc_tail4x
|
||||
vld1.32 {q8},[$key_],#16 // re-pre-load rndkey[0]
|
||||
veor $tmp0,$rndlast,$dat0
|
||||
vorr $dat0,$in0,$in0
|
||||
veor $tmp1,$rndlast,$dat1
|
||||
vorr $dat1,$in1,$in1
|
||||
veor $tmp2,$rndlast,$dat2
|
||||
vorr $dat2,$in2,$in2
|
||||
veor $tmp3,$rndlast,$dat3
|
||||
vorr $dat3,$in3,$in3
|
||||
veor $tmp4,$rndlast,$dat4
|
||||
vst1.8 {$tmp0},[$out],#16
|
||||
vorr $dat4,$in4,$in4
|
||||
vst1.8 {$tmp1},[$out],#16
|
||||
mov $cnt,$rounds
|
||||
vst1.8 {$tmp2},[$out],#16
|
||||
vld1.32 {q9},[$key_],#16 // re-pre-load rndkey[1]
|
||||
vst1.8 {$tmp3},[$out],#16
|
||||
vst1.8 {$tmp4},[$out],#16
|
||||
b.hs .Loop5x_ecb_enc
|
||||
|
||||
add $len,$len,#0x50
|
||||
cbz $len,.Lecb_done
|
||||
|
||||
add $cnt,$rounds,#2
|
||||
subs $len,$len,#0x30
|
||||
vorr $dat0,$in2,$in2
|
||||
vorr $dat1,$in3,$in3
|
||||
vorr $dat2,$in4,$in4
|
||||
b.lo .Lecb_enc_tail
|
||||
|
||||
b .Loop3x_ecb_enc
|
||||
|
||||
.align 4
|
||||
.Lecb_enc_tail4x:
|
||||
veor $tmp1,$rndlast,$dat1
|
||||
veor $tmp2,$rndlast,$dat2
|
||||
veor $tmp3,$rndlast,$dat3
|
||||
veor $tmp4,$rndlast,$dat4
|
||||
vst1.8 {$tmp1},[$out],#16
|
||||
vst1.8 {$tmp2},[$out],#16
|
||||
vst1.8 {$tmp3},[$out],#16
|
||||
vst1.8 {$tmp4},[$out],#16
|
||||
|
||||
b .Lecb_done
|
||||
.align 4
|
||||
___
|
||||
$code.=<<___;
|
||||
.Loop3x_ecb_enc:
|
||||
aese $dat0,q8
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat1,q8
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q8
|
||||
aesmc $dat2,$dat2
|
||||
vld1.32 {q8},[$key_],#16
|
||||
subs $cnt,$cnt,#2
|
||||
aese $dat0,q9
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat1,q9
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q9
|
||||
aesmc $dat2,$dat2
|
||||
vld1.32 {q9},[$key_],#16
|
||||
b.gt .Loop3x_ecb_enc
|
||||
|
||||
aese $dat0,q8
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat1,q8
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q8
|
||||
aesmc $dat2,$dat2
|
||||
subs $len,$len,#0x30
|
||||
mov.lo x6,$len // x6, $cnt, is zero at this point
|
||||
aese $dat0,q9
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat1,q9
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q9
|
||||
aesmc $dat2,$dat2
|
||||
add $inp,$inp,x6 // $inp is adjusted in such way that
|
||||
// at exit from the loop $dat1-$dat2
|
||||
// are loaded with last "words"
|
||||
mov $key_,$key
|
||||
aese $dat0,q12
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat1,q12
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q12
|
||||
aesmc $dat2,$dat2
|
||||
vld1.8 {$in0},[$inp],#16
|
||||
aese $dat0,q13
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat1,q13
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q13
|
||||
aesmc $dat2,$dat2
|
||||
vld1.8 {$in1},[$inp],#16
|
||||
aese $dat0,q14
|
||||
aesmc $dat0,$dat0
|
||||
aese $dat1,q14
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q14
|
||||
aesmc $dat2,$dat2
|
||||
vld1.8 {$in2},[$inp],#16
|
||||
aese $dat0,q15
|
||||
aese $dat1,q15
|
||||
aese $dat2,q15
|
||||
vld1.32 {q8},[$key_],#16 // re-pre-load rndkey[0]
|
||||
add $cnt,$rounds,#2
|
||||
veor $tmp0,$rndlast,$dat0
|
||||
veor $tmp1,$rndlast,$dat1
|
||||
veor $dat2,$dat2,$rndlast
|
||||
vld1.32 {q9},[$key_],#16 // re-pre-load rndkey[1]
|
||||
vst1.8 {$tmp0},[$out],#16
|
||||
vorr $dat0,$in0,$in0
|
||||
vst1.8 {$tmp1},[$out],#16
|
||||
vorr $dat1,$in1,$in1
|
||||
vst1.8 {$dat2},[$out],#16
|
||||
vorr $dat2,$in2,$in2
|
||||
b.hs .Loop3x_ecb_enc
|
||||
|
||||
cmn $len,#0x30
|
||||
b.eq .Lecb_done
|
||||
nop
|
||||
|
||||
.Lecb_enc_tail:
|
||||
aese $dat1,q8
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q8
|
||||
aesmc $dat2,$dat2
|
||||
vld1.32 {q8},[$key_],#16
|
||||
subs $cnt,$cnt,#2
|
||||
aese $dat1,q9
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q9
|
||||
aesmc $dat2,$dat2
|
||||
vld1.32 {q9},[$key_],#16
|
||||
b.gt .Lecb_enc_tail
|
||||
|
||||
aese $dat1,q8
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q8
|
||||
aesmc $dat2,$dat2
|
||||
aese $dat1,q9
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q9
|
||||
aesmc $dat2,$dat2
|
||||
aese $dat1,q12
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q12
|
||||
aesmc $dat2,$dat2
|
||||
cmn $len,#0x20
|
||||
aese $dat1,q13
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q13
|
||||
aesmc $dat2,$dat2
|
||||
aese $dat1,q14
|
||||
aesmc $dat1,$dat1
|
||||
aese $dat2,q14
|
||||
aesmc $dat2,$dat2
|
||||
aese $dat1,q15
|
||||
aese $dat2,q15
|
||||
b.eq .Lecb_enc_one
|
||||
veor $tmp1,$rndlast,$dat1
|
||||
veor $tmp2,$rndlast,$dat2
|
||||
vst1.8 {$tmp1},[$out],#16
|
||||
vst1.8 {$tmp2},[$out],#16
|
||||
b .Lecb_done
|
||||
|
||||
.Lecb_enc_one:
|
||||
veor $tmp1,$rndlast,$dat2
|
||||
vst1.8 {$tmp1},[$out],#16
|
||||
b .Lecb_done
|
||||
___
|
||||
|
||||
$code.=<<___;
|
||||
.align 5
|
||||
.Lecb_dec:
|
||||
vld1.8 {$dat1},[$inp],#16
|
||||
subs $len,$len,#32 // bias
|
||||
add $cnt,$rounds,#2
|
||||
vorr $in1,$dat1,$dat1
|
||||
vorr $dat2,$dat1,$dat1
|
||||
vorr $dat1,$dat,$dat
|
||||
b.lo .Lecb_dec_tail
|
||||
|
||||
vorr $dat1,$in1,$in1
|
||||
vld1.8 {$dat2},[$inp],#16
|
||||
___
|
||||
$code.=<<___ if ($flavour =~ /64/);
|
||||
cmp $len,#32
|
||||
b.lo .Loop3x_ecb_dec
|
||||
|
||||
vld1.8 {$dat3},[$inp],#16
|
||||
vld1.8 {$dat4},[$inp],#16
|
||||
sub $len,$len,#32 // bias
|
||||
mov $cnt,$rounds
|
||||
|
||||
.Loop5x_ecb_dec:
|
||||
aesd $dat0,q8
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat1,q8
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q8
|
||||
aesimc $dat2,$dat2
|
||||
aesd $dat3,q8
|
||||
aesimc $dat3,$dat3
|
||||
aesd $dat4,q8
|
||||
aesimc $dat4,$dat4
|
||||
vld1.32 {q8},[$key_],#16
|
||||
subs $cnt,$cnt,#2
|
||||
aesd $dat0,q9
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat1,q9
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q9
|
||||
aesimc $dat2,$dat2
|
||||
aesd $dat3,q9
|
||||
aesimc $dat3,$dat3
|
||||
aesd $dat4,q9
|
||||
aesimc $dat4,$dat4
|
||||
vld1.32 {q9},[$key_],#16
|
||||
b.gt .Loop5x_ecb_dec
|
||||
|
||||
aesd $dat0,q8
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat1,q8
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q8
|
||||
aesimc $dat2,$dat2
|
||||
aesd $dat3,q8
|
||||
aesimc $dat3,$dat3
|
||||
aesd $dat4,q8
|
||||
aesimc $dat4,$dat4
|
||||
cmp $len,#0x40 // because .Lecb_tail4x
|
||||
sub $len,$len,#0x50
|
||||
|
||||
aesd $dat0,q9
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat1,q9
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q9
|
||||
aesimc $dat2,$dat2
|
||||
aesd $dat3,q9
|
||||
aesimc $dat3,$dat3
|
||||
aesd $dat4,q9
|
||||
aesimc $dat4,$dat4
|
||||
csel x6,xzr,$len,gt // borrow x6, $cnt, "gt" is not typo
|
||||
mov $key_,$key
|
||||
|
||||
aesd $dat0,q10
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat1,q10
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q10
|
||||
aesimc $dat2,$dat2
|
||||
aesd $dat3,q10
|
||||
aesimc $dat3,$dat3
|
||||
aesd $dat4,q10
|
||||
aesimc $dat4,$dat4
|
||||
add $inp,$inp,x6 // $inp is adjusted in such way that
|
||||
// at exit from the loop $dat1-$dat4
|
||||
// are loaded with last "words"
|
||||
add x6,$len,#0x60 // because .Lecb_tail4x
|
||||
|
||||
aesd $dat0,q11
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat1,q11
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q11
|
||||
aesimc $dat2,$dat2
|
||||
aesd $dat3,q11
|
||||
aesimc $dat3,$dat3
|
||||
aesd $dat4,q11
|
||||
aesimc $dat4,$dat4
|
||||
|
||||
aesd $dat0,q12
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat1,q12
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q12
|
||||
aesimc $dat2,$dat2
|
||||
aesd $dat3,q12
|
||||
aesimc $dat3,$dat3
|
||||
aesd $dat4,q12
|
||||
aesimc $dat4,$dat4
|
||||
|
||||
aesd $dat0,q13
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat1,q13
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q13
|
||||
aesimc $dat2,$dat2
|
||||
aesd $dat3,q13
|
||||
aesimc $dat3,$dat3
|
||||
aesd $dat4,q13
|
||||
aesimc $dat4,$dat4
|
||||
|
||||
aesd $dat0,q14
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat1,q14
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q14
|
||||
aesimc $dat2,$dat2
|
||||
aesd $dat3,q14
|
||||
aesimc $dat3,$dat3
|
||||
aesd $dat4,q14
|
||||
aesimc $dat4,$dat4
|
||||
|
||||
aesd $dat0,q15
|
||||
vld1.8 {$in0},[$inp],#16
|
||||
aesd $dat1,q15
|
||||
vld1.8 {$in1},[$inp],#16
|
||||
aesd $dat2,q15
|
||||
vld1.8 {$in2},[$inp],#16
|
||||
aesd $dat3,q15
|
||||
vld1.8 {$in3},[$inp],#16
|
||||
aesd $dat4,q15
|
||||
vld1.8 {$in4},[$inp],#16
|
||||
cbz x6,.Lecb_tail4x
|
||||
vld1.32 {q8},[$key_],#16 // re-pre-load rndkey[0]
|
||||
veor $tmp0,$rndlast,$dat0
|
||||
vorr $dat0,$in0,$in0
|
||||
veor $tmp1,$rndlast,$dat1
|
||||
vorr $dat1,$in1,$in1
|
||||
veor $tmp2,$rndlast,$dat2
|
||||
vorr $dat2,$in2,$in2
|
||||
veor $tmp3,$rndlast,$dat3
|
||||
vorr $dat3,$in3,$in3
|
||||
veor $tmp4,$rndlast,$dat4
|
||||
vst1.8 {$tmp0},[$out],#16
|
||||
vorr $dat4,$in4,$in4
|
||||
vst1.8 {$tmp1},[$out],#16
|
||||
mov $cnt,$rounds
|
||||
vst1.8 {$tmp2},[$out],#16
|
||||
vld1.32 {q9},[$key_],#16 // re-pre-load rndkey[1]
|
||||
vst1.8 {$tmp3},[$out],#16
|
||||
vst1.8 {$tmp4},[$out],#16
|
||||
b.hs .Loop5x_ecb_dec
|
||||
|
||||
add $len,$len,#0x50
|
||||
cbz $len,.Lecb_done
|
||||
|
||||
add $cnt,$rounds,#2
|
||||
subs $len,$len,#0x30
|
||||
vorr $dat0,$in2,$in2
|
||||
vorr $dat1,$in3,$in3
|
||||
vorr $dat2,$in4,$in4
|
||||
b.lo .Lecb_dec_tail
|
||||
|
||||
b .Loop3x_ecb_dec
|
||||
|
||||
.align 4
|
||||
.Lecb_tail4x:
|
||||
veor $tmp1,$rndlast,$dat1
|
||||
veor $tmp2,$rndlast,$dat2
|
||||
veor $tmp3,$rndlast,$dat3
|
||||
veor $tmp4,$rndlast,$dat4
|
||||
vst1.8 {$tmp1},[$out],#16
|
||||
vst1.8 {$tmp2},[$out],#16
|
||||
vst1.8 {$tmp3},[$out],#16
|
||||
vst1.8 {$tmp4},[$out],#16
|
||||
|
||||
b .Lecb_done
|
||||
.align 4
|
||||
___
|
||||
$code.=<<___;
|
||||
.Loop3x_ecb_dec:
|
||||
aesd $dat0,q8
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat1,q8
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q8
|
||||
aesimc $dat2,$dat2
|
||||
vld1.32 {q8},[$key_],#16
|
||||
subs $cnt,$cnt,#2
|
||||
aesd $dat0,q9
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat1,q9
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q9
|
||||
aesimc $dat2,$dat2
|
||||
vld1.32 {q9},[$key_],#16
|
||||
b.gt .Loop3x_ecb_dec
|
||||
|
||||
aesd $dat0,q8
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat1,q8
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q8
|
||||
aesimc $dat2,$dat2
|
||||
subs $len,$len,#0x30
|
||||
mov.lo x6,$len // x6, $cnt, is zero at this point
|
||||
aesd $dat0,q9
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat1,q9
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q9
|
||||
aesimc $dat2,$dat2
|
||||
add $inp,$inp,x6 // $inp is adjusted in such way that
|
||||
// at exit from the loop $dat1-$dat2
|
||||
// are loaded with last "words"
|
||||
mov $key_,$key
|
||||
aesd $dat0,q12
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat1,q12
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q12
|
||||
aesimc $dat2,$dat2
|
||||
vld1.8 {$in0},[$inp],#16
|
||||
aesd $dat0,q13
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat1,q13
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q13
|
||||
aesimc $dat2,$dat2
|
||||
vld1.8 {$in1},[$inp],#16
|
||||
aesd $dat0,q14
|
||||
aesimc $dat0,$dat0
|
||||
aesd $dat1,q14
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q14
|
||||
aesimc $dat2,$dat2
|
||||
vld1.8 {$in2},[$inp],#16
|
||||
aesd $dat0,q15
|
||||
aesd $dat1,q15
|
||||
aesd $dat2,q15
|
||||
vld1.32 {q8},[$key_],#16 // re-pre-load rndkey[0]
|
||||
add $cnt,$rounds,#2
|
||||
veor $tmp0,$rndlast,$dat0
|
||||
veor $tmp1,$rndlast,$dat1
|
||||
veor $dat2,$dat2,$rndlast
|
||||
vld1.32 {q9},[$key_],#16 // re-pre-load rndkey[1]
|
||||
vst1.8 {$tmp0},[$out],#16
|
||||
vorr $dat0,$in0,$in0
|
||||
vst1.8 {$tmp1},[$out],#16
|
||||
vorr $dat1,$in1,$in1
|
||||
vst1.8 {$dat2},[$out],#16
|
||||
vorr $dat2,$in2,$in2
|
||||
b.hs .Loop3x_ecb_dec
|
||||
|
||||
cmn $len,#0x30
|
||||
b.eq .Lecb_done
|
||||
nop
|
||||
|
||||
.Lecb_dec_tail:
|
||||
aesd $dat1,q8
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q8
|
||||
aesimc $dat2,$dat2
|
||||
vld1.32 {q8},[$key_],#16
|
||||
subs $cnt,$cnt,#2
|
||||
aesd $dat1,q9
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q9
|
||||
aesimc $dat2,$dat2
|
||||
vld1.32 {q9},[$key_],#16
|
||||
b.gt .Lecb_dec_tail
|
||||
|
||||
aesd $dat1,q8
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q8
|
||||
aesimc $dat2,$dat2
|
||||
aesd $dat1,q9
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q9
|
||||
aesimc $dat2,$dat2
|
||||
aesd $dat1,q12
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q12
|
||||
aesimc $dat2,$dat2
|
||||
cmn $len,#0x20
|
||||
aesd $dat1,q13
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q13
|
||||
aesimc $dat2,$dat2
|
||||
aesd $dat1,q14
|
||||
aesimc $dat1,$dat1
|
||||
aesd $dat2,q14
|
||||
aesimc $dat2,$dat2
|
||||
aesd $dat1,q15
|
||||
aesd $dat2,q15
|
||||
b.eq .Lecb_dec_one
|
||||
veor $tmp1,$rndlast,$dat1
|
||||
veor $tmp2,$rndlast,$dat2
|
||||
vst1.8 {$tmp1},[$out],#16
|
||||
vst1.8 {$tmp2},[$out],#16
|
||||
b .Lecb_done
|
||||
|
||||
.Lecb_dec_one:
|
||||
veor $tmp1,$rndlast,$dat2
|
||||
vst1.8 {$tmp1},[$out],#16
|
||||
|
||||
.Lecb_done:
|
||||
___
|
||||
}
|
||||
$code.=<<___ if ($flavour !~ /64/);
|
||||
vldmia sp!,{d8-d15}
|
||||
ldmia sp!,{r4-r8,pc}
|
||||
___
|
||||
$code.=<<___ if ($flavour =~ /64/);
|
||||
ldr x29,[sp],#16
|
||||
___
|
||||
$code.=<<___ if ($flavour =~ /64/);
|
||||
.Lecb_Final_abort:
|
||||
ret
|
||||
___
|
||||
$code.=<<___;
|
||||
.size ${prefix}_ecb_encrypt,.-${prefix}_ecb_encrypt
|
||||
___
|
||||
}}}
|
||||
{{{
|
||||
my ($inp,$out,$len,$key,$ivp)=map("x$_",(0..4)); my $enc="w5";
|
||||
my ($rounds,$cnt,$key_,$step,$step1)=($enc,"w6","x7","x8","x12");
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
# - code was made position-independent;
|
||||
# - rounds were folded into a loop resulting in >5x size reduction
|
||||
# from 12.5KB to 2.2KB;
|
||||
# - above was possibile thanks to mixcolumns() modification that
|
||||
# - above was possible thanks to mixcolumns() modification that
|
||||
# allowed to feed its output back to aesenc[last], this was
|
||||
# achieved at cost of two additional inter-registers moves;
|
||||
# - some instruction reordering and interleaving;
|
||||
|
||||
@@ -68,8 +68,6 @@ SOURCE[../../providers/libfips.a]=$COMMON
|
||||
DEFINE[../../libcrypto]=$AESDEF
|
||||
DEFINE[../../providers/libfips.a]=$AESDEF
|
||||
DEFINE[../../providers/libimplementations.a]=$AESDEF
|
||||
# fipsprov.c needs access to AESNI.
|
||||
DEFINE[../../providers/fips]=$AESDEF
|
||||
|
||||
GENERATE[aes-ia64.s]=asm/aes-ia64.S
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/asn1.h>
|
||||
#include "asn1_local.h"
|
||||
#include <openssl/asn1t.h>
|
||||
|
||||
IMPLEMENT_ASN1_DUP_FUNCTION(ASN1_GENERALIZEDTIME)
|
||||
|
||||
/* This is the primary function used to parse ASN1_GENERALIZEDTIME */
|
||||
int asn1_generalizedtime_to_tm(struct tm *tm, const ASN1_GENERALIZEDTIME *d)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
IMPLEMENT_ASN1_MSTRING(ASN1_TIME, B_ASN1_TIME)
|
||||
|
||||
IMPLEMENT_ASN1_FUNCTIONS(ASN1_TIME)
|
||||
IMPLEMENT_ASN1_DUP_FUNCTION(ASN1_TIME)
|
||||
|
||||
static int is_utc(const int year)
|
||||
{
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/asn1.h>
|
||||
#include "asn1_local.h"
|
||||
#include <openssl/asn1t.h>
|
||||
|
||||
IMPLEMENT_ASN1_DUP_FUNCTION(ASN1_UTCTIME)
|
||||
|
||||
/* This is the primary function used to parse ASN1_UTCTIME */
|
||||
int asn1_utctime_to_tm(struct tm *tm, const ASN1_UTCTIME *d)
|
||||
|
||||
@@ -78,7 +78,7 @@ static ASN1_ITEM_EXP *asn1_item_list[] = {
|
||||
ASN1_ITEM_ref(IPAddressRange),
|
||||
#endif
|
||||
ASN1_ITEM_ref(ISSUING_DIST_POINT),
|
||||
#if !OPENSSL_API_3
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
ASN1_ITEM_ref(LONG),
|
||||
#endif
|
||||
ASN1_ITEM_ref(NAME_CONSTRAINTS),
|
||||
@@ -164,7 +164,7 @@ static ASN1_ITEM_EXP *asn1_item_list[] = {
|
||||
ASN1_ITEM_ref(X509_SIG),
|
||||
ASN1_ITEM_ref(X509_VAL),
|
||||
ASN1_ITEM_ref(X509),
|
||||
#if !OPENSSL_API_3
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
ASN1_ITEM_ref(ZLONG),
|
||||
#endif
|
||||
ASN1_ITEM_ref(INT32),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user