Version bump

This commit is contained in:
Hakase
2018-04-27 20:47:40 +09:00
parent 6aa2bc2941
commit a08448ab40
304 changed files with 7574 additions and 2162 deletions
+14
View File
@@ -0,0 +1,14 @@
<!--
Thank you for your pull request. Please review these requirements:
Contributors guide: https://github.com/openssl/openssl/blob/master/CONTRIBUTING
Other than that, provide a description above this comment if there isn't one already
If this fixes a github issue, make sure to have a line saying 'Fixes #XXXX' (without quotes) in the commit message.
-->
##### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->
- [ ] documentation is added or updated
- [ ] tests are added or updated
+1 -1
View File
@@ -5,7 +5,7 @@
./Configure dist
if [ "$1" == osx ]; then
make NAME='_srcdist' TARFILE='_srcdist.tar' \
TAR_COMMAND='$(TAR) $(TARFLAGS) -cvf -' tar
TAR_COMMAND='$(TAR) $(TARFLAGS) -cf -' tar
else
make TARFILE='_srcdist.tar' NAME='_srcdist' dist
fi
+12 -8
View File
@@ -124,7 +124,7 @@ before_script:
fi
- if [ -n "$DESTDIR" ]; then
sh .travis-create-release.sh $TRAVIS_OS_NAME;
tar -xvzf _srcdist.tar.gz;
tar -xzf _srcdist.tar.gz;
mkdir _build;
cd _build;
srcdir=../_srcdist;
@@ -133,14 +133,14 @@ before_script:
srcdir=.;
top=.;
fi
- if [ "$CC" == i686-w64-mingw32-gcc ]; then
- if [ "$CC" = i686-w64-mingw32-gcc ]; then
export CROSS_COMPILE=${CC%%gcc}; unset CC;
$srcdir/Configure mingw $CONFIG_OPTS -Wno-pedantic-ms-format;
elif [ "$CC" == x86_64-w64-mingw32-gcc ]; then
elif [ "$CC" = x86_64-w64-mingw32-gcc ]; then
export CROSS_COMPILE=${CC%%gcc}; unset CC;
$srcdir/Configure mingw64 $CONFIG_OPTS -Wno-pedantic-ms-format;
else
if [ "$CC" == clang-3.9 ]; then
if [ "$CC" = clang-3.9 ]; then
sudo cp .travis-apt-pin.preferences /etc/apt/preferences.d/no-ubuntu-clang;
curl -sSL "http://apt.llvm.org/llvm-snapshot.gpg.key" | sudo -E apt-key add -;
echo "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.9 main" | sudo tee -a /etc/apt/sources.list > /dev/null;
@@ -199,18 +199,22 @@ script:
echo -e '+\057\057\057\057 MAKE TEST FAILED'; false;
fi;
else
if $make build_tests; then
if $make build_tests >~/build.log 2>&1; then
echo -e '+\057\057\057\057\057 MAKE BUILD_TESTS OK';
else
echo -e '+\057\057\057\057\057 MAKE BUILD_TESTS FAILED'; false;
echo -e '+\057\057\057\057\057 MAKE BUILD_TESTS FAILED';
cat ~/build.log
false;
fi;
fi
- if [ -n "$DESTDIR" ]; then
mkdir "$top/$DESTDIR";
if $make install install_docs DESTDIR="$top/$DESTDIR"; then
if $make install install_docs DESTDIR="$top/$DESTDIR" >~/install.log 2>&1 ; then
echo -e '+\057\057\057\057\057\057 MAKE INSTALL OK';
else
echo -e '+\057\057\057\057\057\057 MAKE INSTALL FAILED'; false;
echo -e '+\057\057\057\057\057\057 MAKE INSTALL FAILED';
cat ~/install.log;
false;
fi;
fi
- cd $top
+23 -2
View File
@@ -9,6 +9,24 @@
Changes between 1.1.0g and 1.1.1 [xx XXX xxxx]
*) On POSIX (BSD, Linux, ...) systems the ocsp(1) command running
in responder mode now supports the new "-multi" option, which
spawns the specified number of child processes to handle OCSP
requests. The "-timeout" option now also limits the OCSP
responder's patience to wait to receive the full client request
on a newly accepted connection. Child processes are respawned
as needed, and the CA index file is automatically reloaded
when changed. This makes it possible to run the "ocsp" responder
as a long-running service, making the OpenSSL CA somewhat more
feature-complete. In this mode, most diagnostic messages logged
after entering the event loop are logged via syslog(3) rather than
written to stderr.
[Viktor Dukhovni]
*) Added support for X448 and Ed448. Heavily based on original work by
Mike Hamburg.
[Matt Caswell]
*) Extend OSSL_STORE with capabilities to search and to narrow the set of
objects loaded. This adds the functions OSSL_STORE_expect() and
OSSL_STORE_find() as well as needed tools to construct searches and
@@ -3256,8 +3274,11 @@
to work with OPENSSL_NO_SSL_INTERN defined.
[Steve Henson]
*) Add SRP support.
[Tom Wu <tjw@cs.stanford.edu> and Ben Laurie]
*) A long standing patch to add support for SRP from EdelWeb (Peter
Sylvester and Christophe Renou) was integrated.
[Christophe Renou <christophe.renou@edelweb.fr>, Peter Sylvester
<peter.sylvester@edelweb.fr>, Tom Wu <tjw@cs.stanford.edu>, and
Ben Laurie]
*) Add functions to copy EVP_PKEY_METHOD and retrieve flags and id.
[Steve Henson]
+33 -21
View File
@@ -8,6 +8,9 @@ my %targets=(
lflags => "",
defines => [],
includes => [],
lib_cflags => "",
lib_cppflags => "",
lib_defines => [],
thread_scheme => "(unknown)", # Assume we don't know
thread_defines => [],
@@ -46,16 +49,16 @@ my %targets=(
build_scheme => [ "unified", "unix" ],
build_file => "Makefile",
ar => "ar",
arflags => "r",
cc => "cc",
hashbangperl => "/usr/bin/env perl",
ranlib => sub { which("$config{cross_compile_prefix}ranlib")
AR => "ar",
ARFLAGS => "r",
CC => "cc",
HASHBANGPERL => "/usr/bin/env perl",
RANLIB => sub { which("$config{cross_compile_prefix}ranlib")
? "ranlib" : "" },
rc => "windres",
RC => "windres",
#### THESE WILL BE ENABLED IN OpenSSL 1.2
#hashbangperl => "PERL", # Only Unix actually cares
#HASHBANGPERL => "PERL", # Only Unix actually cares
},
BASE_common => {
@@ -84,19 +87,19 @@ my %targets=(
inherit_from => [ "BASE_common" ],
template => 1,
ar => "ar",
arflags => "r",
cc => "cc",
AR => "ar",
ARFLAGS => "r",
CC => "cc",
lflags =>
sub { $withargs{zlib_lib} ? "-L".$withargs{zlib_lib} : () },
ex_libs =>
sub { !defined($disabled{zlib})
&& defined($disabled{"zlib-dynamic"})
? "-lz" : () },
hashbangperl => "/usr/bin/env perl", # Only Unix actually cares
ranlib => sub { which("$config{cross_compile_prefix}ranlib")
HASHBANGPERL => "/usr/bin/env perl", # Only Unix actually cares
RANLIB => sub { which("$config{cross_compile_prefix}ranlib")
? "ranlib" : "" },
rc => "windres",
RC => "windres",
build_scheme => [ "unified", "unix" ],
build_file => "Makefile",
@@ -106,6 +109,15 @@ my %targets=(
inherit_from => [ "BASE_common" ],
template => 1,
lib_defines =>
sub {
my @defs = ();
unless ($disabled{"zlib-dynamic"}) {
my $zlib = $withargs{zlib_lib} // "ZLIB1";
push @defs, quotify("perl", 'LIBZ="' . $zlib . '"');
}
return [ @defs ];
},
ex_libs =>
sub {
unless ($disabled{zlib}) {
@@ -116,16 +128,16 @@ my %targets=(
return ();
},
ld => "link",
lflags => "/nologo",
loutflag => "/out:",
ar => "lib",
arflags => "/nologo",
LD => "link",
LDFLAGS => "/nologo",
ldoutflag => "/out:",
AR => "lib",
ARFLAGS => "/nologo",
aroutflag => "/out:",
rc => "rc",
RC => "rc",
rcoutflag => "/fo",
mt => "mt",
mtflags => "-nologo",
MT => "mt",
MTFLAGS => "-nologo",
mtinflag => "-manifest ",
mtoutflag => "-outputresource:",
+387 -441
View File
@@ -6,16 +6,20 @@ my $vc_win64a_info = {};
sub vc_win64a_info {
unless (%$vc_win64a_info) {
if (`nasm -v 2>NUL` =~ /NASM version ([0-9]+\.[0-9]+)/ && $1 >= 2.0) {
$vc_win64a_info = { as => "nasm",
asflags => "-f win64 -DNEAR -Ox -g",
asoutflag => "-o" };
$vc_win64a_info = { AS => "nasm",
ASFLAGS => "-g",
asflags => "-Ox -f win64 -DNEAR",
asoutflag => "-o " };
} elsif ($disabled{asm}) {
$vc_win64a_info = { as => "ml64",
asflags => "/c /Cp /Cx /Zi",
# assembler is still used to compile uplink shim
$vc_win64a_info = { AS => "ml64",
ASFLAGS => "/nologo /Zi",
asflags => "/c /Cp /Cx",
asoutflag => "/Fo" };
} else {
$die->("NASM not found - please read INSTALL and NOTES.WIN for further details\n");
$vc_win64a_info = { as => "{unknown}",
$vc_win64a_info = { AS => "{unknown}",
ASFLAGS => "",
asflags => "",
asoutflag => "" };
}
@@ -29,18 +33,22 @@ sub vc_win32_info {
my $ver=`nasm -v 2>NUL`;
my $vew=`nasmw -v 2>NUL`;
if ($ver ne "" || $vew ne "") {
$vc_win32_info = { as => $ver ge $vew ? "nasm" : "nasmw",
$vc_win32_info = { AS => $ver ge $vew ? "nasm" : "nasmw",
ASFLAGS => "",
asflags => "-f win32",
asoutflag => "-o",
asoutflag => "-o ",
perlasm_scheme => "win32n" };
} elsif ($disabled{asm}) {
$vc_win32_info = { as => "ml",
asflags => "/nologo /Cp /coff /c /Cx /Zi",
# not actually used, uplink shim is inlined into C code
$vc_win32_info = { AS => "ml",
ASFLAGS => "/nologo /Zi",
asflags => "/Cp /coff /c /Cx",
asoutflag => "/Fo",
perlasm_scheme => "win32" };
} else {
$die->("NASM not found - please read INSTALL and NOTES.WIN for further details\n");
$vc_win32_info = { as => "{unknown}",
$vc_win32_info = { AS => "{unknown}",
ASFLAGS => "",
asflags => "",
asoutflag => "",
perlasm_scheme => "win32" };
@@ -150,9 +158,10 @@ sub vms_info {
if ($config{target} =~ /-ia64/) {
`PIPE ias -H 2> NL:`;
if ($? == 0) {
$vms_info->{as} = "ias";
$vms_info->{asflags} = '-d debug "-N" vms_upcase';
$vms_info->{asoutflag} = "-o";
$vms_info->{AS} = "ias";
$vms_info->{ASFLAGS} = '-d debug';
$vms_info->{asflags} = '"-N" vms_upcase';
$vms_info->{asoutflag} = "-o ";
$vms_info->{perlasm_scheme} = "ias";
}
}
@@ -165,27 +174,28 @@ my %targets = (
#### Basic configs that should work on any 32-bit box
"gcc" => {
inherit_from => [ "BASE_unix" ],
cc => "gcc",
cflags => picker(debug => "-O0 -g",
CC => "gcc",
CFLAGS => picker(debug => "-O0 -g",
release => "-O3"),
thread_scheme => "(unknown)",
bn_ops => "BN_LLONG",
},
"cc" => {
inherit_from => [ "BASE_unix" ],
cc => "cc",
cflags => "-O",
CC => "cc",
CFLAGS => "-O",
thread_scheme => "(unknown)",
},
#### VOS Configurations
"vos-gcc" => {
inherit_from => [ "BASE_unix" ],
cc => "gcc",
cflags => picker(default => "-Wall",
CC => "gcc",
CFLAGS => picker(default => "-Wall",
debug => "-O0 -g",
release => "-O3"),
cppflags => "-D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN",
cppflags => "-D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES",
lib_cppflags => "-DB_ENDIAN",
thread_scheme => "(unknown)",
sys_id => "VOS",
lflags => add("-Wl,-map"),
@@ -197,7 +207,7 @@ my %targets = (
"solaris-common" => {
inherit_from => [ "BASE_unix" ],
template => 1,
cppflags => "-DFILIO_H",
lib_cppflags => "-DFILIO_H",
ex_libs => add("-lsocket -lnsl -ldl"),
dso_scheme => "dlfcn",
thread_scheme => "pthreads",
@@ -210,12 +220,12 @@ my %targets = (
# /usr/ccs/bin/as. Failure to comply will result in compile
# failures [at least] in 32-bit build.
inherit_from => [ "solaris-common", asm("x86_elf_asm") ],
cc => "gcc",
cflags => add_before(picker(default => "-Wall",
CC => "gcc",
CFLAGS => add_before(picker(default => "-Wall",
debug => "-O0 -g",
release => "-O3 -fomit-frame-pointer"),
threads("-pthread")),
cppflags => add("-DL_ENDIAN"),
release => "-O3 -fomit-frame-pointer")),
cflags => add(threads("-pthread")),
lib_cppflags => add("-DL_ENDIAN"),
ex_libs => add(threads("-pthread")),
bn_ops => "BN_LLONG",
shared_cflag => "-fPIC",
@@ -231,12 +241,12 @@ my %targets = (
# to consider using gcc shared build even with vendor compiler:-)
# -- <appro@openssl.org>
inherit_from => [ "solaris-common", asm("x86_64_asm") ],
cc => "gcc",
cflags => add_before(picker(default => "-m64 -Wall",
CC => "gcc",
CFLAGS => add_before(picker(default => "-Wall",
debug => "-O0 -g",
release => "-O3"),
threads("-pthread")),
cppflags => add("-DL_ENDIAN"),
release => "-O3")),
cflags => add_before("-m64", threads("-pthread")),
lib_cppflags => add("-DL_ENDIAN"),
ex_libs => add(threads("-pthread")),
bn_ops => "SIXTY_FOUR_BIT_LONG",
perlasm_scheme => "elf",
@@ -260,11 +270,12 @@ my %targets = (
#
"solaris64-x86_64-cc" => {
inherit_from => [ "solaris-common", asm("x86_64_asm") ],
cc => "cc",
cflags => add_before(picker(default => "-xarch=generic64 -xstrconst -Xa",
debug => "-g",
CC => "cc",
CFLAGS => add_before(picker(debug => "-g",
release => "-xO5 -xdepend -xbuiltin")),
cppflags => add("-DL_ENDIAN", threads("-D_REENTRANT")),
cflags => add_before("-xarch=generic64 -xstrconst -Xa"),
cppflags => add(threads("-D_REENTRANT")),
lib_cppflags => add("-DL_ENDIAN"),
thread_scheme => "pthreads",
lflags => add(threads("-mt")),
ex_libs => add(threads("-lpthread")),
@@ -278,12 +289,12 @@ my %targets = (
#### SPARC Solaris with GNU C setups
"solaris-sparcv7-gcc" => {
inherit_from => [ "solaris-common" ],
cc => "gcc",
cflags => add_before(picker(default => "-Wall",
CC => "gcc",
CFLAGS => add_before(picker(default => "-Wall",
debug => "-O0 -g",
release => "-O3"),
threads("-pthread")),
cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
release => "-O3")),
cflags => add(threads("-pthread")),
lib_cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
ex_libs => add(threads("-pthread")),
bn_ops => "BN_LLONG RC4_CHAR",
shared_cflag => "-fPIC",
@@ -312,12 +323,12 @@ my %targets = (
# SC5.0 note: Compiler common patch 107357-01 or later is required!
"solaris-sparcv7-cc" => {
inherit_from => [ "solaris-common" ],
cc => "cc",
cflags => add_before(picker(default => "-xstrconst -Xa",
debug => "-g",
CC => "cc",
CFLAGS => add_before(picker(debug => "-g",
release => "-xO5 -xdepend")),
cppflags => add("-DB_ENDIAN -DBN_DIV2W",
threads("-D_REENTRANT")),
cflags => add_before("-xstrconst -Xa"),
cppflags => add(threads("-D_REENTRANT")),
lib_cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
lflags => add(threads("-mt")),
ex_libs => add(threads("-lpthread")),
bn_ops => "BN_LLONG RC4_CHAR",
@@ -344,12 +355,14 @@ my %targets = (
# Only N32 and N64 ABIs are supported.
"irix-mips3-gcc" => {
inherit_from => [ "BASE_unix", asm("mips64_asm") ],
cc => "gcc",
cflags => combine(picker(default => "-mabi=n32",
debug => "-g -O0",
release => "-O3")),
CC => "gcc",
CFLAGS => picker(debug => "-g -O0",
release => "-O3"),
cflags => "-mabi=n32",
cppflags => combine("-DB_ENDIAN -DBN_DIV3W",
threads("-D_SGI_MP_SOURCE")),
cppflags => threads("-D_SGI_MP_SOURCE"),
lib_cppflags => "-DB_ENDIAN -DBN_DIV3W",
ex_libs => add(threads("-lpthread")),
bn_ops => "RC4_CHAR SIXTY_FOUR_BIT",
thread_scheme => "pthreads",
@@ -361,12 +374,12 @@ my %targets = (
},
"irix-mips3-cc" => {
inherit_from => [ "BASE_unix", asm("mips64_asm") ],
cc => "cc",
cflags => combine(picker(default => "-n32 -mips3 -use_readonly_const -G0 -rdata_shared",
debug => "-g -O0",
release => "-O2")),
cppflags => combine("-DB_ENDIAN -DBN_DIV3W",
threads("-D_SGI_MP_SOURCE")),
CC => "cc",
CFLAGS => picker(debug => "-g -O0",
release => "-O2"),
cflags => "-n32 -mips3 -use_readonly_const -G0 -rdata_shared",
cppflags => threads("-D_SGI_MP_SOURCE"),
lib_cppflags => "-DB_ENDIAN -DBN_DIV3W",
ex_libs => add(threads("-lpthread")),
bn_ops => "RC4_CHAR SIXTY_FOUR_BIT",
thread_scheme => "pthreads",
@@ -379,12 +392,12 @@ my %targets = (
# N64 ABI builds.
"irix64-mips4-gcc" => {
inherit_from => [ "BASE_unix", asm("mips64_asm") ],
cc => "gcc",
cflags => combine(picker(default => "-mabi=64 -mips4",
debug => "-g -O0",
release => "-O3")),
cppflags => combine("-DB_ENDIAN -DBN_DIV3W",
threads("-D_SGI_MP_SOURCE")),
CC => "gcc",
CFLAGS => picker(debug => "-g -O0",
release => "-O3"),
cflags => "-mabi=64 -mips4",
cppflags => threads("-D_SGI_MP_SOURCE"),
lib_cppflags => "-DB_ENDIAN -DBN_DIV3W",
ex_libs => add(threads("-lpthread")),
bn_ops => "RC4_CHAR SIXTY_FOUR_BIT_LONG",
thread_scheme => "pthreads",
@@ -396,13 +409,13 @@ my %targets = (
},
"irix64-mips4-cc" => {
inherit_from => [ "BASE_unix", asm("mips64_asm") ],
cc => "cc",
cflags => combine(picker(default => "-64 -mips4 -use_readonly_const -G0 -rdata_shared",
debug => "-g -O0",
release => "-O2")),
cppflags => combine("-DB_ENDIAN -DBN_DIV3W",
threads("-D_SGI_MP_SOURCE")),
ex_libs => add(threads("-lpthread")),
CC => "cc",
CFLAGS => picker(debug => "-g -O0",
release => "-O2"),
cflags => "-64 -mips4 -use_readonly_const -G0 -rdata_shared",
cppflags => threads("-D_SGI_MP_SOURCE"),
lib_cppflags => "-DB_ENDIAN -DBN_DIV3W",
ex_libs => threads("-lpthread"),
bn_ops => "RC4_CHAR SIXTY_FOUR_BIT_LONG",
thread_scheme => "pthreads",
perlasm_scheme => "64",
@@ -441,11 +454,11 @@ my %targets = (
# thus adequate performance is provided even with PA-RISC 1.1 build.
"hpux-parisc-gcc" => {
inherit_from => [ "BASE_unix" ],
cc => "gcc",
cflags => combine(picker(debug => "-O0 -g",
release => "-O3"),
threads("-pthread")),
cppflags => "-DB_ENDIAN -DBN_DIV2W",
CC => "gcc",
CFLAGS => picker(debug => "-O0 -g",
release => "-O3"),
cflags => add(threads("-pthread")),
lib_cppflags => "-DB_ENDIAN -DBN_DIV2W",
ex_libs => add("-Wl,+s -ldld", threads("-pthread")),
bn_ops => "BN_LLONG",
thread_scheme => "pthreads",
@@ -461,10 +474,11 @@ my %targets = (
},
"hpux64-parisc2-gcc" => {
inherit_from => [ "BASE_unix", asm("parisc20_64_asm") ],
cc => "gcc",
cflags => combine(picker(debug => "-O0 -g",
CC => "gcc",
CFLAGS => combine(picker(debug => "-O0 -g",
release => "-O3")),
cppflags => combine("-DB_ENDIAN", threads("-D_REENTRANT")),
cppflags => threads("-D_REENTRANT"),
lib_cppflags => "-DB_ENDIAN",
ex_libs => add("-ldl"),
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
thread_scheme => "pthreads",
@@ -479,12 +493,12 @@ my %targets = (
# More attempts at unified 10.X and 11.X targets for HP C compiler.
"hpux-parisc-cc" => {
inherit_from => [ "BASE_unix" ],
cc => "cc",
cflags => combine(picker(default => "+Optrs_strongly_typed -Ae +ESlit",
debug => "+O0 +d -g",
release => "+O3")),
cppflags => combine("-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY",
threads("-D_REENTRANT")),
CC => "cc",
CFLAGS => picker(debug => "+O0 +d -g",
release => "+O3"),
cflags => "+Optrs_strongly_typed -Ae +ESlit",
cppflags => threads("-D_REENTRANT"),
lib_cppflags => "-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY",
ex_libs => add("-Wl,+s -ldld",threads("-lpthread")),
bn_ops => "RC4_CHAR",
thread_scheme => "pthreads",
@@ -501,12 +515,12 @@ my %targets = (
},
"hpux64-parisc2-cc" => {
inherit_from => [ "BASE_unix", asm("parisc20_64_asm") ],
cc => "cc",
cflags => combine(picker(default => "+DD64 +Optrs_strongly_typed -Ae +ESlit",
debug => "+O0 +d -g",
release => "+O3")),
cppflags => combine("-DB_ENDIAN -DMD32_XARRAY",
threads("-D_REENTRANT")),
CC => "cc",
CFLAGS => picker(debug => "+O0 +d -g",
release => "+O3") ,
cflags => "+DD64 +Optrs_strongly_typed -Ae +ESlit",
cppflags => threads("-D_REENTRANT") ,
lib_cppflags => "-DB_ENDIAN -DMD32_XARRAY",
ex_libs => add("-ldl",threads("-lpthread")),
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
thread_scheme => "pthreads",
@@ -521,11 +535,12 @@ my %targets = (
# HP/UX IA-64 targets
"hpux-ia64-cc" => {
inherit_from => [ "BASE_unix", asm("ia64_asm") ],
cc => "cc",
cflags => combine(picker(default => "-Ae +DD32 +Olit=all -z",
debug => "+O0 +d -g",
release => "+O2")),
cppflags => combine("-DB_ENDIAN", threads("-D_REENTRANT")),
CC => "cc",
CFLAGS => picker(debug => "+O0 +d -g",
release => "+O2"),
cflags => "-Ae +DD32 +Olit=all -z",
cppflags => add(threads("-D_REENTRANT")),
lib_cppflags => "-DB_ENDIAN",
ex_libs => add("-ldl",threads("-lpthread")),
bn_ops => "SIXTY_FOUR_BIT",
thread_scheme => "pthreads",
@@ -538,11 +553,12 @@ my %targets = (
},
"hpux64-ia64-cc" => {
inherit_from => [ "BASE_unix", asm("ia64_asm") ],
cc => "cc",
cflags => combine(picker(default => "-Ae +DD64 +Olit=all -z",
debug => "+O0 +d -g",
release => "+O3")),
cppflags => combine("-DB_ENDIAN", threads("-D_REENTRANT")),
CC => "cc",
CFLAGS => picker(debug => "+O0 +d -g",
release => "+O3"),
cflags => "-Ae +DD64 +Olit=all -z",
cppflags => threads("-D_REENTRANT"),
lib_cppflags => "-DB_ENDIAN",
ex_libs => add("-ldl", threads("-lpthread")),
bn_ops => "SIXTY_FOUR_BIT_LONG",
thread_scheme => "pthreads",
@@ -556,11 +572,11 @@ my %targets = (
# GCC builds...
"hpux-ia64-gcc" => {
inherit_from => [ "BASE_unix", asm("ia64_asm") ],
cc => "gcc",
cflags => combine(picker(debug => "-O0 -g",
release => "-O3"),
threads("-pthread")),
cppflags => "-DB_ENDIAN",
CC => "gcc",
CFLAGS => picker(debug => "-O0 -g",
release => "-O3"),
cflags => add(threads("-pthread")),
lib_cppflags => "-DB_ENDIAN",
ex_libs => add("-ldl", threads("-pthread")),
bn_ops => "SIXTY_FOUR_BIT",
thread_scheme => "pthreads",
@@ -573,12 +589,11 @@ my %targets = (
},
"hpux64-ia64-gcc" => {
inherit_from => [ "BASE_unix", asm("ia64_asm") ],
cc => "gcc",
cflags => combine(picker(default => "-mlp64",
debug => "-O0 -g",
release => "-O3"),
threads("-pthread")),
cppflags => "-DB_ENDIAN",
CC => "gcc",
CFLAGS => picker(debug => "-O0 -g",
release => "-O3"),
cflags => combine("-mlp64", threads("-pthread")),
lib_cppflags => "-DB_ENDIAN",
ex_libs => add("-ldl", threads("-pthread")),
bn_ops => "SIXTY_FOUR_BIT_LONG",
thread_scheme => "pthreads",
@@ -593,10 +608,11 @@ my %targets = (
#### HP MPE/iX http://jazz.external.hp.com/src/openssl/
"MPE/iX-gcc" => {
inherit_from => [ "BASE_unix" ],
cc => "gcc",
cflags => "-O3",
cppflags => "-D_ENDIAN -DBN_DIV2W -D_POSIX_SOURCE -D_SOCKET_SOURCE",
includes => add("/SYSLOG/PUB"),
CC => "gcc",
CFLAGS => "-O3",
cppflags => "-D_POSIX_SOURCE -D_SOCKET_SOURCE",
includes => [ "/SYSLOG/PUB" ],
lib_cppflags => "-DBN_DIV2W",
sys_id => "MPE",
lflags => add("-L/SYSLOG/PUB"),
ex_libs => add("-lsyslog -lsocket -lcurses"),
@@ -610,8 +626,9 @@ my %targets = (
#### but not anymore...
"tru64-alpha-gcc" => {
inherit_from => [ "BASE_unix", asm("alpha_asm") ],
cc => "gcc",
cflags => combine("-std=c9x -O3", threads("-pthread")),
CC => "gcc",
CFLAGS => "-O3",
cflags => add("-std=c9x", threads("-pthread")),
cppflags => "-D_XOPEN_SOURCE=500 -D_OSF_SOURCE",
ex_libs => add("-lrt", threads("-pthread")), # for mlock(2)
bn_ops => "SIXTY_FOUR_BIT_LONG",
@@ -622,9 +639,10 @@ my %targets = (
},
"tru64-alpha-cc" => {
inherit_from => [ "BASE_unix", asm("alpha_asm") ],
cc => "cc",
cflags => combine("-std1 -tune host -fast -readonly_strings",
threads("-pthread")),
CC => "cc",
CFLAGS => "-tune host -fast",
cflags => add("-std1 -readonly_strings",
threads("-pthread")),
cppflags => "-D_XOPEN_SOURCE=500 -D_OSF_SOURCE",
ex_libs => add("-lrt", threads("-pthread")), # for mlock(2)
bn_ops => "SIXTY_FOUR_BIT_LONG",
@@ -642,17 +660,17 @@ my %targets = (
# throw in -D[BL]_ENDIAN, whichever appropriate...
"linux-generic32" => {
inherit_from => [ "BASE_unix" ],
cc => "gcc",
cxx => "g++",
cflags => combine(picker(default => "-Wall",
debug => "-O0 -g",
release => "-O3"),
threads("-pthread")),
cxxflags => combine(picker(default => "-std=c++11 -Wall",
debug => "-O0 -g",
release => "-O3"),
threads("-pthread")),
cppflags => "-DOPENSSL_USE_NODELETE",
CC => "gcc",
CXX => "g++",
CFLAGS => picker(default => "-Wall",
debug => "-O0 -g",
release => "-O3"),
CXXFLAGS => picker(default => "-Wall",
debug => "-O0 -g",
release => "-O3"),
cflags => threads("-pthread"),
cxxflags => combine("-std=c++11", threads("-pthread")),
lib_cppflags => "-DOPENSSL_USE_NODELETE",
ex_libs => add("-ldl", threads("-pthread")),
bn_ops => "BN_LLONG RC4_CHAR",
thread_scheme => "pthreads",
@@ -674,14 +692,16 @@ my %targets = (
"linux-ppc64" => {
inherit_from => [ "linux-generic64", asm("ppc64_asm") ],
cflags => add("-m64"),
cppflags => add("-DB_ENDIAN"),
cxxflags => add("-m64"),
lib_cppflags => add("-DB_ENDIAN"),
perlasm_scheme => "linux64",
multilib => "64",
},
"linux-ppc64le" => {
inherit_from => [ "linux-generic64", asm("ppc64_asm") ],
cflags => add("-m64"),
cppflags => add("-DL_ENDIAN"),
cxxflags => add("-m64"),
lib_cppflags => add("-DL_ENDIAN"),
perlasm_scheme => "linux64le",
},
@@ -727,6 +747,7 @@ my %targets = (
"linux-arm64ilp32" => { # https://wiki.linaro.org/Platform/arm64-ilp32
inherit_from => [ "linux-generic32", asm("aarch64_asm") ],
cflags => add("-mabi=ilp32"),
cxxflags => add("-mabi=ilp32"),
bn_ops => "SIXTY_FOUR_BIT RC4_CHAR",
perlasm_scheme => "linux64",
},
@@ -736,7 +757,8 @@ my %targets = (
# support, if no -march was specified at command line.
inherit_from => [ "linux-generic32", asm("mips32_asm") ],
cflags => add("-mabi=32"),
cppflags => add("-DBN_DIV3W"),
cxxflags => add("-mabi=32"),
lib_cppflags => add("-DBN_DIV3W"),
perlasm_scheme => "o32",
},
# mips32 and mips64 below refer to contemporary MIPS Architecture
@@ -744,7 +766,8 @@ my %targets = (
"linux-mips64" => {
inherit_from => [ "linux-generic32", asm("mips64_asm") ],
cflags => add("-mabi=n32"),
cppflags => add("-DBN_DIV3W"),
cxxflags => add("-mabi=n32"),
lib_cppflags => add("-DBN_DIV3W"),
bn_ops => "SIXTY_FOUR_BIT RC4_CHAR",
perlasm_scheme => "n32",
multilib => "32",
@@ -752,7 +775,8 @@ my %targets = (
"linux64-mips64" => {
inherit_from => [ "linux-generic64", asm("mips64_asm") ],
cflags => add("-mabi=64"),
cppflags => add("-DBN_DIV3W"),
cxxflags => add("-mabi=64"),
lib_cppflags => add("-DBN_DIV3W"),
perlasm_scheme => "64",
multilib => "64",
},
@@ -762,17 +786,17 @@ my %targets = (
#### machines where gcc doesn't understand -m32 and -m64
"linux-elf" => {
inherit_from => [ "linux-generic32", asm("x86_elf_asm") ],
cflags => add(picker(release => "-fomit-frame-pointer")),
cppflags => add("-DL_ENDIAN"),
CFLAGS => add(picker(release => "-fomit-frame-pointer")),
lib_cppflags => add("-DL_ENDIAN"),
bn_ops => "BN_LLONG",
},
"linux-aout" => {
inherit_from => [ "BASE_unix", asm("x86_asm") ],
cc => "gcc",
cflags => add(picker(default => "-Wall",
CC => "gcc",
CFLAGS => add(picker(default => "-Wall",
debug => "-O0 -g",
release => "-O3 -fomit-frame-pointer")),
cppflags => add("-DL_ENDIAN"),
lib_cppflags => add("-DL_ENDIAN"),
bn_ops => "BN_LLONG",
thread_scheme => "(unknown)",
perlasm_scheme => "a.out",
@@ -781,36 +805,37 @@ my %targets = (
#### X86 / X86_64 targets
"linux-x86" => {
inherit_from => [ "linux-generic32", asm("x86_asm") ],
cflags => add(picker(default => "-m32",
release => "-fomit-frame-pointer")),
cppflags => add("-DL_ENDIAN"),
CFLAGS => add(picker(release => "-fomit-frame-pointer")),
cflags => add("-m32"),
cxxflags => add("-m32"),
lib_cppflags => add("-DL_ENDIAN"),
bn_ops => "BN_LLONG",
perlasm_scheme => "elf",
},
"linux-x86-clang" => {
inherit_from => [ "linux-x86" ],
cc => "clang",
cxx => "clang++",
cflags => add("-Wextra"),
CC => "clang",
CXX => "clang++",
},
"linux-x86_64" => {
inherit_from => [ "linux-generic64", asm("x86_64_asm") ],
cflags => add("-m64"),
cppflags => add("-DL_ENDIAN"),
cxxflags => add("-m64"),
lib_cppflags => add("-DL_ENDIAN"),
bn_ops => "SIXTY_FOUR_BIT_LONG",
perlasm_scheme => "elf",
multilib => "64",
},
"linux-x86_64-clang" => {
inherit_from => [ "linux-x86_64" ],
cc => "clang",
cxx => "clang++",
cflags => add("-Wextra"),
CC => "clang",
CXX => "clang++",
},
"linux-x32" => {
inherit_from => [ "linux-generic32", asm("x86_64_asm") ],
cflags => add("-mx32"),
cppflags => add("-DL_ENDIAN"),
cxxflags => add("-mx32"),
lib_cppflags => add("-DL_ENDIAN"),
bn_ops => "SIXTY_FOUR_BIT",
perlasm_scheme => "elf32",
multilib => "x32",
@@ -824,7 +849,8 @@ my %targets = (
"linux64-s390x" => {
inherit_from => [ "linux-generic64", asm("s390x_asm") ],
cflags => add("-m64"),
cppflags => add("-DB_ENDIAN"),
cxxflags => add("-m64"),
lib_cppflags => add("-DB_ENDIAN"),
perlasm_scheme => "64",
multilib => "64",
},
@@ -847,7 +873,8 @@ my %targets = (
#
inherit_from => [ "linux-generic32", asm("s390x_asm") ],
cflags => add("-m31 -Wa,-mzarch"),
cppflags => add("-DB_ENDIAN"),
cxxflags => add("-m31 -Wa,-mzarch"),
lib_cppflags => add("-DB_ENDIAN"),
bn_asm_src => sub { my $r=join(" ",@_); $r=~s|asm/s390x\.S|bn_asm.c|; $r; },
perlasm_scheme => "31",
multilib => "/highgprs",
@@ -857,34 +884,39 @@ my %targets = (
"linux-sparcv8" => {
inherit_from => [ "linux-generic32", asm("sparcv8_asm") ],
cflags => add("-mcpu=v8"),
cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
cxxflags => add("-mcpu=v8"),
lib_cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
},
"linux-sparcv9" => {
# it's a real mess with -mcpu=ultrasparc option under Linux,
# but -Wa,-Av8plus should do the trick no matter what.
inherit_from => [ "linux-generic32", asm("sparcv9_asm") ],
cflags => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus"),
cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
cxxflags => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus"),
lib_cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
},
"linux64-sparcv9" => {
# GCC 3.1 is a requirement
inherit_from => [ "linux-generic64", asm("sparcv9_asm") ],
cflags => add("-m64 -mcpu=ultrasparc"),
cppflags => add("-DB_ENDIAN"),
cxxflags => add("-m64 -mcpu=ultrasparc"),
lib_cppflags => add("-DB_ENDIAN"),
bn_ops => "BN_LLONG RC4_CHAR",
multilib => "64",
},
"linux-alpha-gcc" => {
inherit_from => [ "linux-generic64", asm("alpha_asm") ],
cppflags => add("-DL_ENDIAN"),
lib_cppflags => add("-DL_ENDIAN"),
bn_ops => "SIXTY_FOUR_BIT_LONG",
},
"linux-c64xplus" => {
inherit_from => [ "BASE_unix" ],
# TI_CGT_C6000_7.3.x is a requirement
cc => "cl6x",
cflags => "--linux -ea=.s -eo=.o -mv6400+ -o2 -ox -ms -pden",
CC => "cl6x",
CFLAGS => "-o2 -ox -ms",
cflags => "--linux -ea=.s -eo=.o -mv6400+ -pden",
cxxflags => "--linux -ea=.s -eo=.o -mv6400+ -pden",
cppflags => combine("-DOPENSSL_SMALL_FOOTPRINT",
threads("-D_REENTRANT")),
bn_ops => "BN_LLONG",
@@ -906,97 +938,6 @@ my %targets = (
ranlib => "true",
},
#### Android: linux-* but without pointers to headers and libs.
#
# It takes pair of prior-set environment variables to make it work:
#
# CROSS_SYSROOT=/some/where/android-ndk-<ver>/platforms/android-<apiver>/arch-<arch>
# CROSS_COMPILE=<prefix>
#
# As well as PATH adjusted to cover ${CROSS_COMPILE}gcc and company.
# For example to compile for ICS and ARM with NDK 10d, you'd:
#
# ANDROID_NDK=/some/where/android-ndk-10d
# CROSS_SYSROOT=$ANDROID_NDK/platforms/android-14/arch-arm
# CROSS_COMPILE=arm-linux-androideabi-
# PATH=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.8/prebuild/linux-x86_64/bin
#
"android" => {
inherit_from => [ "linux-generic32" ],
# Special note about unconditional -fPIC and -pie. The underlying
# reason is that Lollipop refuses to run non-PIE. But what about
# older systems and NDKs? -fPIC was never problem, so the only
# concern is -pie. Older toolchains, e.g. r4, appear to handle it
# and binaries turn mostly functional. "Mostly" means that oldest
# Androids, such as Froyo, fail to handle executable, but newer
# systems are perfectly capable of executing binaries targeting
# Froyo. Keep in mind that in the nutshell Android builds are
# about JNI, i.e. shared libraries, not applications.
cflags => add(picker(default => "-mandroid -fPIC --sysroot=\$(CROSS_SYSROOT) -Wa,--noexecstack")),
bin_cflags => "-pie",
},
"android-x86" => {
inherit_from => [ "android", asm("x86_asm") ],
cflags => add(picker(release => "-fomit-frame-pointer")),
bn_ops => "BN_LLONG",
perlasm_scheme => "android",
},
################################################################
# Contemporary Android applications can provide multiple JNI
# providers in .apk, targeting multiple architectures. Among
# them there is "place" for two ARM flavours: generic eabi and
# armv7-a/hard-float. However, it should be noted that OpenSSL's
# ability to engage NEON is not constrained by ABI choice, nor
# is your ability to call OpenSSL from your application code
# compiled with floating-point ABI other than default 'soft'.
# [Latter thanks to __attribute__((pcs("aapcs"))) declaration.]
# This means that choice of ARM libraries you provide in .apk
# is driven by application needs. For example if application
# itself benefits from NEON or is floating-point intensive, then
# it might be appropriate to provide both libraries. Otherwise
# just generic eabi would do. But in latter case it would be
# appropriate to
#
# ./Configure android-armeabi -D__ARM_MAX_ARCH__=8
#
# in order to build "universal" binary and allow OpenSSL take
# advantage of NEON when it's available.
#
"android-armeabi" => {
inherit_from => [ "android", asm("armv4_asm") ],
},
"android-mips" => {
inherit_from => [ "android", asm("mips32_asm") ],
perlasm_scheme => "o32",
},
"android64" => {
inherit_from => [ "linux-generic64" ],
cflags => add(picker(default => "-mandroid -fPIC --sysroot=\$(CROSS_SYSROOT) -Wa,--noexecstack")),
bin_cflags => "-pie",
},
"android64-aarch64" => {
inherit_from => [ "android64", asm("aarch64_asm") ],
perlasm_scheme => "linux64",
},
"android64-x86_64" => {
inherit_from => [ "android64", asm("x86_64_asm") ],
perlasm_scheme => "elf",
},
"android64-mips64" => {
############################################################
# You are more than likely have to specify target processor
# on ./Configure command line. Trouble is that toolchain's
# default is MIPS64r6 (at least in r10d), but there are no
# such processors around (or they are too rare to spot one).
# Actual problem is that MIPS64r6 is binary incompatible
# with previous MIPS ISA versions, in sense that unlike
# prior versions original MIPS binary code will fail.
#
inherit_from => [ "android64", asm("mips64_asm") ],
perlasm_scheme => "64",
},
#### *BSD
"BSD-generic32" => {
# As for thread cflag. Idea is to maintain "collective" set of
@@ -1007,11 +948,11 @@ my %targets = (
# -D_THREAD_SAFE and sometimes -D_REENTRANT. FreeBSD 5.x
# expands it as -lc_r, which seems to be sufficient?
inherit_from => [ "BASE_unix" ],
cc => "cc",
cflags => combine(picker(default => "-Wall",
debug => "-O0 -g",
release => "-O3"),
threads("-pthread")),
CC => "cc",
CFLAGS => picker(default => "-Wall",
debug => "-O0 -g",
release => "-O3"),
cflags => threads("-pthread"),
cppflags => threads("-D_THREAD_SAFE -D_REENTRANT"),
ex_libs => add(threads("-pthread")),
enable => add("devcryptoeng"),
@@ -1029,8 +970,8 @@ my %targets = (
"BSD-x86" => {
inherit_from => [ "BSD-generic32", asm("x86_asm") ],
cflags => add(picker(release => "-fomit-frame-pointer")),
cppflags => add("-DL_ENDIAN"),
CFLAGS => add(picker(release => "-fomit-frame-pointer")),
lib_cppflags => add("-DL_ENDIAN"),
bn_ops => "BN_LLONG",
shared_target => "bsd-shared",
perlasm_scheme => "a.out",
@@ -1043,35 +984,35 @@ my %targets = (
"BSD-sparcv8" => {
inherit_from => [ "BSD-generic32", asm("sparcv8_asm") ],
cflags => add("-mcpu=v8"),
cppflags => add("-DB_ENDIAN"),
lib_cppflags => add("-DB_ENDIAN"),
},
"BSD-sparc64" => {
# -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
# simply *happens* to work around a compiler bug in gcc 3.3.3,
# triggered by RIPEMD160 code.
inherit_from => [ "BSD-generic64", asm("sparcv9_asm") ],
cppflags => add("-DB_ENDIAN -DMD32_REG_T=int"),
lib_cppflags => add("-DB_ENDIAN -DMD32_REG_T=int"),
bn_ops => "BN_LLONG",
},
"BSD-ia64" => {
inherit_from => [ "BSD-generic64", asm("ia64_asm") ],
cppflags => add("-DL_ENDIAN"),
lib_cppflags => add("-DL_ENDIAN"),
bn_ops => "SIXTY_FOUR_BIT_LONG",
},
"BSD-x86_64" => {
inherit_from => [ "BSD-generic64", asm("x86_64_asm") ],
cppflags => add("-DL_ENDIAN"),
lib_cppflags => add("-DL_ENDIAN"),
bn_ops => "SIXTY_FOUR_BIT_LONG",
perlasm_scheme => "elf",
},
"bsdi-elf-gcc" => {
inherit_from => [ "BASE_unix", asm("x86_elf_asm") ],
cc => "gcc",
cflags => "-fomit-frame-pointer -O3 -Wall",
cppflags => "-DPERL5 -DL_ENDIAN",
CC => "gcc",
CFLAGS => "-fomit-frame-pointer -O3 -Wall",
lib_cppflags => "-DPERL5 -DL_ENDIAN",
ex_libs => add("-ldl"),
bn_ops => "BN_LLONG",
thread_scheme => "(unknown)",
@@ -1083,16 +1024,16 @@ my %targets = (
"nextstep" => {
inherit_from => [ "BASE_unix" ],
cc => "cc",
cflags => "-O -Wall",
CC => "cc",
CFLAGS => "-O -Wall",
unistd => "<libc.h>",
bn_ops => "BN_LLONG",
thread_scheme => "(unknown)",
},
"nextstep3.3" => {
inherit_from => [ "BASE_unix" ],
cc => "cc",
cflags => "-O3 -Wall",
CC => "cc",
CFLAGS => "-O3 -Wall",
unistd => "<libc.h>",
bn_ops => "BN_LLONG",
thread_scheme => "(unknown)",
@@ -1101,14 +1042,14 @@ my %targets = (
# QNX
"qnx4" => {
inherit_from => [ "BASE_unix" ],
cc => "cc",
cflags => "",
cppflags => "-DL_ENDIAN -DTERMIO",
CC => "cc",
CFLAGS => "",
lib_cppflags => "-DL_ENDIAN -DTERMIO",
thread_scheme => "(unknown)",
},
"QNX6" => {
inherit_from => [ "BASE_unix" ],
cc => "gcc",
CC => "gcc",
ex_libs => add("-lsocket"),
dso_scheme => "dlfcn",
shared_target => "bsd-gcc-shared",
@@ -1117,9 +1058,9 @@ my %targets = (
},
"QNX6-i386" => {
inherit_from => [ "BASE_unix", asm("x86_elf_asm") ],
cc => "gcc",
cflags => "-O2 -Wall",
cppflags => "-DL_ENDIAN",
CC => "gcc",
CFLAGS => "-O2 -Wall",
lib_cppflags => "-DL_ENDIAN",
ex_libs => add("-lsocket"),
dso_scheme => "dlfcn",
shared_target => "bsd-gcc-shared",
@@ -1140,25 +1081,27 @@ my %targets = (
# UnixWare 2.0x fails destest with -O.
"unixware-2.0" => {
inherit_from => [ "BASE_unix" ],
cc => "cc",
cflags => combine(threads("-Kthread")),
cppflags => "-DFILIO_H -DNO_STRINGS_H",
CC => "cc",
cflags => threads("-Kthread"),
lib_cppflags => "-DFILIO_H -DNO_STRINGS_H",
ex_libs => add("-lsocket -lnsl -lresolv -lx"),
thread_scheme => "uithreads",
},
"unixware-2.1" => {
inherit_from => [ "BASE_unix" ],
cc => "cc",
cflags => combine("-O", threads("-Kthread")),
cppflags => "-DFILIO_H",
CC => "cc",
CFLAGS => "-O",
cflags => threads("-Kthread"),
lib_cppflags => "-DFILIO_H",
ex_libs => add("-lsocket -lnsl -lresolv -lx"),
thread_scheme => "uithreads",
},
"unixware-7" => {
inherit_from => [ "BASE_unix", asm("x86_elf_asm") ],
cc => "cc",
cflags => combine("-O -Kalloca", threads("-Kthread")),
cppflags => "-DFILIO_H",
CC => "cc",
CFLAGS => "-O",
cflags => combine("-Kalloca", threads("-Kthread")),
lib_cppflags => "-DFILIO_H",
ex_libs => add("-lsocket -lnsl"),
thread_scheme => "uithreads",
bn_ops => "BN_LLONG",
@@ -1170,10 +1113,10 @@ my %targets = (
},
"unixware-7-gcc" => {
inherit_from => [ "BASE_unix", asm("x86_elf_asm") ],
cc => "gcc",
cflags => combine("-O3 -fomit-frame-pointer -Wall"),
cppflags => add("-DL_ENDIAN -DFILIO_H",
threads("-D_REENTRANT")),
CC => "gcc",
CFLAGS => "-O3 -fomit-frame-pointer -Wall",
cppflags => add(threads("-D_REENTRANT")),
lib_cppflags => add("-DL_ENDIAN -DFILIO_H"),
ex_libs => add("-lsocket -lnsl"),
bn_ops => "BN_LLONG",
thread_scheme => "pthreads",
@@ -1218,11 +1161,11 @@ my %targets = (
# current value of $OBJECT_MODE.
"aix-gcc" => {
inherit_from => [ "BASE_unix", asm("ppc32_asm") ],
cc => "gcc",
cflags => combine(picker(debug => "-O0 -g",
release => "-O"),
threads("-pthread")),
cppflags => "-DB_ENDIAN",
CC => "gcc",
CFLAGS => picker(debug => "-O0 -g",
release => "-O"),
cflags => add(threads("-pthread")),
lib_cppflags => "-DB_ENDIAN",
ex_libs => add(threads("-pthread")),
sys_id => "AIX",
bn_ops => "BN_LLONG RC4_CHAR",
@@ -1236,12 +1179,11 @@ my %targets = (
},
"aix64-gcc" => {
inherit_from => [ "BASE_unix", asm("ppc64_asm") ],
cc => "gcc",
cflags => combine(picker(default => "-maix64",
debug => "-O0 -g",
release => "-O"),
threads("-pthread")),
cppflags => "-DB_ENDIAN",
CC => "gcc",
CFLAGS => picker(debug => "-O0 -g",
release => "-O"),
cflags => combine("-maix64", threads("-pthread")),
lib_cppflags => "-DB_ENDIAN",
ex_libs => add(threads("-pthread")),
sys_id => "AIX",
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
@@ -1255,12 +1197,13 @@ my %targets = (
},
"aix-cc" => {
inherit_from => [ "BASE_unix", asm("ppc32_asm") ],
cc => "cc",
cflags => combine(picker(default => "-q32 -qmaxmem=16384 -qro -qroconst",
debug => "-O0 -g",
release => "-O"),
CC => "cc",
CFLAGS => picker(debug => "-O0 -g",
release => "-O"),
cflags => combine("-q32 -qmaxmem=16384 -qro -qroconst",
threads("-qthreaded")),
cppflags => combine("-DB_ENDIAN", threads("-D_THREAD_SAFE")),
cppflags => threads("-D_THREAD_SAFE"),
lib_cppflags => "-DB_ENDIAN",
sys_id => "AIX",
bn_ops => "BN_LLONG RC4_CHAR",
thread_scheme => "pthreads",
@@ -1274,12 +1217,13 @@ my %targets = (
},
"aix64-cc" => {
inherit_from => [ "BASE_unix", asm("ppc64_asm") ],
cc => "cc",
cflags => combine(picker(default => "-q64 -qmaxmem=16384 -qro -qroconst",
debug => "-O0 -g",
release => "-O"),
CC => "cc",
CFLAGS => picker(debug => "-O0 -g",
release => "-O"),
cflags => combine("-q64 -qmaxmem=16384 -qro -qroconst",
threads("-qthreaded")),
cppflags => combine("-DB_ENDIAN", threads("-D_THREAD_SAFE")),
cppflags => threads("-D_THREAD_SAFE"),
lib_cppflags => "-DB_ENDIAN",
sys_id => "AIX",
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
thread_scheme => "pthreads",
@@ -1295,9 +1239,11 @@ my %targets = (
# SIEMENS BS2000/OSD: an EBCDIC-based mainframe
"BS2000-OSD" => {
inherit_from => [ "BASE_unix" ],
cc => "c89",
cflags => "-O -XLLML -XLLMK -XL",
cppflags => "-DB_ENDIAN -DCHARSET_EBCDIC",
CC => "c89",
CFLAGS => "-O",
cflags => "-XLLML -XLLMK -XL",
cppflags => "-DCHARSET_EBCDIC",
lib_cppflags => "-DB_ENDIAN",
ex_libs => add("-lsocket -lnsl"),
bn_ops => "THIRTY_TWO_BIT RC4_CHAR",
thread_scheme => "(unknown)",
@@ -1305,60 +1251,63 @@ my %targets = (
#### Visual C targets
#
# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64
# Win64 targets, WIN64I denotes IA-64/Itanium and WIN64A - AMD64
#
# Note about -wd4090, disable warning C4090. This warning returns false
# Note about /wd4090, disable warning C4090. This warning returns false
# positives in some situations. Disabling it altogether masks both
# legitimate and false cases, but as we compile on multiple platforms,
# we rely on other compilers to catch legitimate cases.
#
# Also note that we force threads no matter what. Configuring "no-threads"
# is ignored.
#
# UNICODE is defined in VC-common and applies to all targets. It used to
# be an opt-in option for VC-WIN32, but not anymore. The original reason
# was because ANSI API was *native* system interface for no longer
# supported Windows 9x. Keep in mind that UNICODE only affects how
# OpenSSL libraries interact with underlying OS, it doesn't affect API
# that OpenSSL presents to application.
"VC-common" => {
inherit_from => [ "BASE_Windows" ],
template => 1,
cc => "cl",
cpp => '$(CC) /EP /C',
cflags => "-W3 -wd4090 -Gs0 -GF -Gy -nologo",
defines => add("OPENSSL_SYS_WIN32", "WIN32_LEAN_AND_MEAN",
"L_ENDIAN", "_CRT_SECURE_NO_DEPRECATE",
"_WINSOCK_DEPRECATED_NO_WARNINGS",
sub { my @defs = ();
unless ($disabled{"zlib-dynamic"}) {
my $zlib =
$withargs{zlib_lib} // "ZLIB1";
push @defs,
quotify("perl",
'LIBZ="' . $zlib . '"');
}
return [ @defs ];
}),
CC => "cl",
CPP => '$(CC) /EP /C',
CFLAGS => "/W3 /wd4090 /nologo",
LDFLAGS => add("/debug"),
coutflag => "/Fo",
lib_cflags => add("/Zi /Fdossl_static"),
dso_cflags => "/Zi /Fddso",
bin_cflags => "/Zi /Fdapp",
lflags => add("/debug"),
defines => add("OPENSSL_SYS_WIN32", "WIN32_LEAN_AND_MEAN",
"UNICODE", "_UNICODE",
"_CRT_SECURE_NO_DEPRECATE",
"_WINSOCK_DEPRECATED_NO_WARNINGS"),
lib_cflags => add("/Zi /Fdossl_static.pdb"),
lib_defines => add("L_ENDIAN"),
dso_cflags => "/Zi /Fddso.pdb",
bin_cflags => "/Zi /Fdapp.pdb",
shared_ldflag => "/dll",
shared_target => "win-shared", # meaningless except it gives Configure a hint
thread_scheme => "winthreads",
dso_scheme => "win32",
apps_aux_src => add("win32_init.c"),
bn_ops => "EXPORT_VAR_AS_FN",
# additional parameter to build_scheme denotes install-path "flavour"
build_scheme => add("VC-common", { separator => undef }),
},
"VC-noCE-common" => {
inherit_from => [ "VC-common" ],
template => 1,
cflags => add(picker(debug =>
CFLAGS => add(picker(debug => '/Od',
release => '/O2')),
cflags => add(picker(default => '/Gs0 /GF /Gy',
debug =>
sub {
($disabled{shared} ? "" : "/MDd")
." /Od";
($disabled{shared} ? "" : "/MDd");
},
release =>
sub {
($disabled{shared} ? "" : "/MD")
." /O2";
($disabled{shared} ? "" : "/MD");
})),
defines => add(picker(default => [ "UNICODE", "_UNICODE" ],
debug => [ "DEBUG", "_DEBUG" ])),
defines => add(picker(debug => [ "DEBUG", "_DEBUG" ])),
lib_cflags => add(sub { $disabled{shared} ? "/MT /Zl" : () }),
# Following might/should appears controversial, i.e. defining
# /MDd without evaluating $disabled{shared}. It works in
@@ -1390,15 +1339,14 @@ my %targets = (
push @ex_libs, 'bufferoverflowu.lib' if (`cl 2>&1` =~ /14\.00\.4[0-9]{4}\./);
return join(" ", @_, @ex_libs);
}),
bn_ops => "SIXTY_FOUR_BIT EXPORT_VAR_AS_FN",
build_scheme => add("VC-W64", { separator => undef }),
bn_ops => add("SIXTY_FOUR_BIT"),
},
"VC-WIN64I" => {
inherit_from => [ "VC-WIN64-common", asm("ia64_asm"),
sub { $disabled{shared} ? () : "ia64_uplink" } ],
as => "ias",
asflags => "-d debug",
asoutflag => "-o",
AS => "ias",
ASFLAGS => "-d debug",
asoutflag => "-o ",
sys_id => "WIN64I",
bn_asm_src => sub { return undef unless @_;
my $r=join(" ",@_); $r=~s|bn-ia64.s|bn_asm.c|; $r; },
@@ -1408,9 +1356,10 @@ my %targets = (
"VC-WIN64A" => {
inherit_from => [ "VC-WIN64-common", asm("x86_64_asm"),
sub { $disabled{shared} ? () : "x86_64_uplink" } ],
as => sub { vc_win64a_info()->{as} },
asflags => sub { vc_win64a_info()->{asflags} },
AS => sub { vc_win64a_info()->{AS} },
ASFLAGS => sub { vc_win64a_info()->{ASFLAGS} },
asoutflag => sub { vc_win64a_info()->{asoutflag} },
asflags => sub { vc_win64a_info()->{asflags} },
sys_id => "WIN64A",
bn_asm_src => sub { return undef unless @_;
my $r=join(" ",@_); $r=~s|asm/x86_64-gcc|bn_asm|; $r; },
@@ -1418,60 +1367,46 @@ my %targets = (
multilib => "-x64",
},
"VC-WIN32" => {
# x86 Win32 target defaults to ANSI API, if you want UNICODE,
# configure with 'perl Configure VC-WIN32 -DUNICODE -D_UNICODE'
inherit_from => [ "VC-noCE-common", asm("x86_asm"),
sub { $disabled{shared} ? () : "uplink_common" } ],
cflags => add("-WX"),
as => sub { vc_win32_info()->{as} },
asflags => sub { vc_win32_info()->{asflags} },
CFLAGS => add("/WX"),
AS => sub { vc_win32_info()->{AS} },
ASFLAGS => sub { vc_win32_info()->{ASFLAGS} },
asoutflag => sub { vc_win32_info()->{asoutflag} },
ex_libs => add(sub {
my @ex_libs = ();
# WIN32 UNICODE build gets linked with unicows.lib for
# backward compatibility with Win9x.
push @ex_libs, 'unicows.lib'
if (grep { $_ eq "UNICODE" } @{$user{CPPDEFINES}});
return join(" ", @ex_libs, @_);
}),
asflags => sub { vc_win32_info()->{asflags} },
sys_id => "WIN32",
bn_ops => "BN_LLONG EXPORT_VAR_AS_FN",
bn_ops => add("BN_LLONG"),
perlasm_scheme => sub { vc_win32_info()->{perlasm_scheme} },
build_scheme => add("VC-W32", { separator => undef }),
# "WOW" stands for "Windows on Windows", and "VC-WOW" engages
# some installation path heuristics in windows-makefile.tmpl...
build_scheme => add("VC-WOW", { separator => undef }),
},
"VC-CE" => {
inherit_from => [ "VC-common" ],
as => "ml",
asflags => "/nologo /Cp /coff /c /Cx /Zi",
asoutflag => "/Fo",
cc => "cl",
CFLAGS => add(picker(debug => "/Od",
release => "/O1i")),
CPPDEFINES => picker(debug => [ "DEBUG", "_DEBUG" ]),
LDFLAGS => add("/nologo /opt:ref"),
cflags =>
picker(default =>
combine('/W3 /WX /GF /Gy /nologo',
sub { vc_wince_info()->{cflags}; },
sub { `cl 2>&1` =~ /Version ([0-9]+)\./ && $1>=14
? ($disabled{shared} ? " /MT" : " /MD")
: " /MC"; }),
debug => "/Od",
release => "/O1i"),
combine('/GF /Gy',
sub { vc_wince_info()->{cflags}; },
sub { `cl 2>&1` =~ /Version ([0-9]+)\./ && $1>=14
? ($disabled{shared} ? " /MT" : " /MD")
: " /MC"; }),
cppflags => sub { vc_wince_info()->{cppflags}; },
defines =>
picker(default => [ "UNICODE", "_UNICODE", "OPENSSL_SYS_WINCE",
"WIN32_LEAN_AND_MEAN", "L_ENDIAN", "DSO_WIN32",
"NO_CHMOD", "OPENSSL_SMALL_FOOTPRINT" ],
debug => [ "DEBUG", "_DEBUG" ]),
lib_defines => add("NO_CHMOD", "OPENSSL_SMALL_FOOTPRINT"),
lib_cppflags => sub { vc_wince_info()->{cppflags}; },
includes =>
add(combine(sub { defined(env('WCECOMPAT'))
? '$(WCECOMPAT)/include' : (); },
sub { defined(env('PORTSDK_LIBPATH'))
? '$(PORTSDK_LIBPATH)/../../include'
: (); })),
lflags => add(combine("/nologo /opt:ref",
sub { vc_wince_info()->{lflags}; },
lflags => add(combine(sub { vc_wince_info()->{lflags}; },
sub { defined(env('PORTSDK_LIBPATH'))
? "/entry:mainCRTstartup" : (); })),
sys_id => "WINCE",
bn_ops => "BN_LLONG EXPORT_VAR_AS_FN",
bn_ops => add("BN_LLONG"),
ex_libs => add(sub {
my @ex_libs = ();
push @ex_libs, 'ws2.lib' unless $disabled{sock};
@@ -1491,19 +1426,20 @@ my %targets = (
if (env('TARGETCPU') eq "X86");
return @ex_libs;
}),
build_scheme => add("VC-WCE", { separator => undef }),
},
#### MinGW
"mingw" => {
inherit_from => [ "BASE_unix", asm("x86_asm"),
sub { $disabled{shared} ? () : "x86_uplink" } ],
cc => "gcc",
cflags => picker(default => "-m32 -Wall",
CC => "gcc",
CFLAGS => picker(default => "-Wall",
debug => "-g -O0",
release => "-O3 -fomit-frame-pointer"),
cppflags => combine("-DL_ENDIAN -DWIN32_LEAN_AND_MEAN",
"-DUNICODE -D_UNICODE", threads("-D_MT")),
cflags => "-m32",
cppflags => combine("-DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN",
threads("-D_MT")),
lib_cppflags => "-DL_ENDIAN",
sys_id => "MINGW32",
ex_libs => add("-lws2_32 -lgdi32 -lcrypt32"),
bn_ops => "BN_LLONG EXPORT_VAR_AS_FN",
@@ -1528,12 +1464,14 @@ my %targets = (
# environment. And as mingw64 is always consistent with itself,
# Applink is never engaged and can as well be omitted.
inherit_from => [ "BASE_unix", asm("x86_64_asm") ],
cc => "gcc",
cflags => picker(default => "-m64 -Wall",
CC => "gcc",
CFLAGS => picker(default => "-Wall",
debug => "-g -O0",
release => "-O3"),
cppflags => combine("-DL_ENDIAN -DWIN32_LEAN_AND_MEAN",
"-DUNICODE -D_UNICODE", threads("-D_MT")),
cflags => "-m64",
cppflags => combine("-DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN",
threads("-D_MT")),
lib_cppflags => "-DL_ENDIAN",
sys_id => "MINGW64",
ex_libs => add("-lws2_32 -lgdi32 -lcrypt32"),
bn_ops => "SIXTY_FOUR_BIT EXPORT_VAR_AS_FN",
@@ -1552,18 +1490,18 @@ my %targets = (
#### UEFI
"UEFI" => {
inherit_from => [ "BASE_unix" ],
cc => "cc",
cflags => "-O",
cppflags => "-DL_ENDIAN",
CC => "cc",
CFLAGS => "-O",
lib_cppflags => "-DL_ENDIAN",
sys_id => "UEFI",
},
#### UWIN
"UWIN" => {
inherit_from => [ "BASE_unix" ],
cc => "cc",
cflags => "-O -Wall",
cppflags => "-DTERMIOS -DL_ENDIAN",
CC => "cc",
CFLAGS => "-O -Wall",
lib_cppflags => "-DTERMIOS -DL_ENDIAN",
sys_id => "UWIN",
bn_ops => "BN_LLONG",
dso_scheme => "win32",
@@ -1572,11 +1510,11 @@ my %targets = (
#### Cygwin
"Cygwin-x86" => {
inherit_from => [ "BASE_unix", asm("x86_asm") ],
cc => "gcc",
cflags => picker(default => "-Wall",
CC => "gcc",
CFLAGS => picker(default => "-Wall",
debug => "-g -O0",
release => "-O3 -fomit-frame-pointer"),
cppflags => "-DTERMIOS -DL_ENDIAN",
lib_cppflags => "-DTERMIOS -DL_ENDIAN",
sys_id => "CYGWIN",
bn_ops => "BN_LLONG",
thread_scheme => "pthread",
@@ -1588,11 +1526,11 @@ my %targets = (
},
"Cygwin-x86_64" => {
inherit_from => [ "BASE_unix", asm("x86_64_asm") ],
cc => "gcc",
cflags => picker(default => "-Wall",
CC => "gcc",
CFLAGS => picker(default => "-Wall",
debug => "-g -O0",
release => "-O3"),
cppflags => "-DTERMIOS -DL_ENDIAN",
lib_cppflags => "-DTERMIOS -DL_ENDIAN",
sys_id => "CYGWIN",
bn_ops => "SIXTY_FOUR_BIT_LONG",
thread_scheme => "pthread",
@@ -1624,13 +1562,12 @@ my %targets = (
"darwin-common" => {
inherit_from => [ "BASE_unix" ],
template => 1,
cc => "cc",
cflags => picker(default => "",
debug => "-g -O0",
CC => "cc",
CFLAGS => picker(debug => "-g -O0",
release => "-O3"),
cppflags => threads("-D_REENTRANT"),
lflags => "-Wl,-search_paths_first",
sys_id => "MACOSX",
plib_lflags => "-Wl,-search_paths_first",
bn_ops => "BN_LLONG RC4_CHAR",
thread_scheme => "pthreads",
perlasm_scheme => "osx32",
@@ -1646,28 +1583,30 @@ my %targets = (
"darwin-ppc-cc" => {
inherit_from => [ "darwin-common", asm("ppc32_asm") ],
cflags => add("-arch ppc -std=gnu9x -Wa,-force_cpusubtype_ALL"),
cppflags => add("-DB_ENDIAN"),
lib_cppflags => add("-DB_ENDIAN"),
shared_cflag => add("-fno-common"),
perlasm_scheme => "osx32",
},
"darwin64-ppc-cc" => {
inherit_from => [ "darwin-common", asm("ppc64_asm") ],
cflags => add("-arch ppc64 -std=gnu9x"),
cppflags => add("-DB_ENDIAN"),
lib_cppflags => add("-DB_ENDIAN"),
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
perlasm_scheme => "osx64",
},
"darwin-i386-cc" => {
inherit_from => [ "darwin-common", asm("x86_asm") ],
cflags => add(picker(default => "-arch i386",
release => "-fomit-frame-pointer")),
cppflags => add("-DL_ENDIAN"),
CFLAGS => add(picker(release => "-fomit-frame-pointer")),
cflags => add("-arch i386"),
lib_cppflags => add("-DL_ENDIAN"),
bn_ops => "BN_LLONG RC4_INT",
perlasm_scheme => "macosx",
},
"darwin64-x86_64-cc" => {
inherit_from => [ "darwin-common", asm("x86_64_asm") ],
cflags => add("-arch x86_64 -Wall"),
cppflags => add("-DL_ENDIAN"),
CFLAGS => add("-Wall"),
cflags => add("-arch x86_64"),
lib_cppflags => add("-DL_ENDIAN"),
bn_ops => "SIXTY_FOUR_BIT_LONG",
perlasm_scheme => "macosx",
},
@@ -1713,10 +1652,10 @@ my %targets = (
"hurd-x86" => {
inherit_from => [ "BASE_unix" ],
inherit_from => [ asm("x86_elf_asm") ],
cc => "gcc",
cflags => combine("-O3 -fomit-frame-pointer -Wall",
threads("-pthread")),
cppflags => "-DL_ENDIAN",
CC => "gcc",
CFLAGS => "-O3 -fomit-frame-pointer -Wall",
cflags => threads("-pthread"),
lib_cppflags => "-DL_ENDIAN",
ex_libs => add("-ldl", threads("-pthread")),
bn_ops => "BN_LLONG",
thread_scheme => "pthreads",
@@ -1729,8 +1668,9 @@ my %targets = (
##### VxWorks for various targets
"vxworks-ppc60x" => {
inherit_from => [ "BASE_unix" ],
cc => "ccppc",
cflags => "-mrtp -mhard-float -mstrict-align -fno-implicit-fp -O2 -fstrength-reduce -fno-builtin -fno-strict-aliasing -Wall",
CC => "ccppc",
CFLAGS => "-O2 -Wall -fstrength-reduce",
cflags => "-mrtp -mhard-float -mstrict-align -fno-implicit-fp -fno-builtin -fno-strict-aliasing",
cppflags => combine("-D_REENTRANT -DPPC32_fp60x -DCPU=PPC32",
"_DTOOL_FAMILY=gnu -DTOOL=gnu",
"-I\$(WIND_BASE)/target/usr/h",
@@ -1741,8 +1681,9 @@ my %targets = (
},
"vxworks-ppcgen" => {
inherit_from => [ "BASE_unix" ],
cc => "ccppc",
cflags => "-mrtp -msoft-float -mstrict-align -O1 -fno-builtin -fno-strict-aliasing -Wall",
CC => "ccppc",
CFLAGS => "-O1 -Wall",
cflags => "-mrtp -msoft-float -mstrict-align -fno-builtin -fno-strict-aliasing",
cppflags => combine("-D_REENTRANT -DPPC32 -DCPU=PPC32",
"-DTOOL_FAMILY=gnu -DTOOL=gnu",
"-I\$(WIND_BASE)/target/usr/h",
@@ -1753,8 +1694,9 @@ my %targets = (
},
"vxworks-ppc405" => {
inherit_from => [ "BASE_unix" ],
cc => "ccppc",
cflags => "-g -msoft-float -mlongcall",
CC => "ccppc",
CFLAGS => "-g",
cflags => "-msoft-float -mlongcall",
cppflags => combine("-D_REENTRANT -DPPC32 -DCPU=PPC405",
"-DTOOL_FAMILY=gnu -DTOOL=gnu",
"-I\$(WIND_BASE)/target/h"),
@@ -1763,8 +1705,9 @@ my %targets = (
},
"vxworks-ppc750" => {
inherit_from => [ "BASE_unix" ],
cc => "ccppc",
cflags => "-ansi -nostdinc -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall \$(DEBUG_FLAG)",
CC => "ccppc",
CFLAGS => "-ansi -fvolatile -Wall \$(DEBUG_FLAG)",
cflags => "-nostdinc -fno-builtin -fno-for-scope -fsigned-char -msoft-float -mlongcall",
cppflags => combine("-DPPC750 -D_REENTRANT -DCPU=PPC604",
"-I\$(WIND_BASE)/target/h"),
sys_id => "VXWORKS",
@@ -1772,8 +1715,9 @@ my %targets = (
},
"vxworks-ppc750-debug" => {
inherit_from => [ "BASE_unix" ],
cc => "ccppc",
cflags => "-ansi -nostdinc -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -g",
CC => "ccppc",
CFLAGS => "-ansi -fvolatile -Wall -g",
cflags => "-nostdinc -fno-builtin -fno-for-scope -fsigned-char -msoft-float -mlongcall",
cppflags => combine("-DPPC750 -D_REENTRANT -DCPU=PPC604",
"-DPEDANTIC -DDEBUG",
"-I\$(WIND_BASE)/target/h"),
@@ -1782,7 +1726,7 @@ my %targets = (
},
"vxworks-ppc860" => {
inherit_from => [ "BASE_unix" ],
cc => "ccppc",
CC => "ccppc",
cflags => "-nostdinc -msoft-float",
cppflags => combine("-DCPU=PPC860 -DNO_STRINGS_H",
"-I\$(WIND_BASE)/target/h"),
@@ -1791,7 +1735,7 @@ my %targets = (
},
"vxworks-simlinux" => {
inherit_from => [ "BASE_unix" ],
cc => "ccpentium",
CC => "ccpentium",
cflags => "-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -fno-builtin -fno-defer-pop",
cppflags => combine("-D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\"",
"-DL_ENDIAN -DCPU=SIMLINUX -DNO_STRINGS_H",
@@ -1805,8 +1749,9 @@ my %targets = (
},
"vxworks-mips" => {
inherit_from => [ "BASE_unix", asm("mips32_asm") ],
cc => "ccmips",
cflags => "-mrtp -mips2 -O -G 0 -B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -msoft-float -mno-branch-likely -fno-builtin -fno-defer-pop",
CC => "ccmips",
CFLAGS => "-O -G 0",
cflags => "-mrtp -mips2 -B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -msoft-float -mno-branch-likely -fno-builtin -fno-defer-pop",
cppflags => combine("-D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\"",
"-DCPU=MIPS32 -DNO_STRINGS_H",
"-DTOOL_FAMILY=gnu -DTOOL=gnu",
@@ -1825,7 +1770,7 @@ my %targets = (
#### uClinux
"uClinux-dist" => {
inherit_from => [ "BASE_unix" ],
cc => sub { env('CC') },
CC => sub { env('CC') },
cppflags => threads("-D_REENTRANT"),
ex_libs => add("\$(LDLIBS)"),
bn_ops => "BN_LLONG",
@@ -1838,7 +1783,7 @@ my %targets = (
},
"uClinux-dist64" => {
inherit_from => [ "BASE_unix" ],
cc => sub { env('CC') },
CC => sub { env('CC') },
cppflags => threads("-D_REENTRANT"),
ex_libs => add("\$(LDLIBS)"),
bn_ops => "SIXTY_FOUR_BIT_LONG",
@@ -1858,9 +1803,9 @@ my %targets = (
"vms-generic" => {
inherit_from => [ "BASE_VMS" ],
template => 1,
cc => "CC/DECC",
cpp => '$(CC)/PREPROCESS_ONLY=SYS$OUTPUT:',
cflags =>
CC => "CC/DECC",
CPP => '$(CC)/PREPROCESS_ONLY=SYS$OUTPUT:',
CFLAGS =>
combine(picker(default => "/STANDARD=(ISOC94,RELAXED)/NOLIST/PREFIX=ALL",
debug => "/NOOPTIMIZE/DEBUG",
release => "/OPTIMIZE/NODEBUG"),
@@ -1868,7 +1813,7 @@ my %targets = (
@{vms_info()->{disable_warns}};
@warnings
? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); }),
defines =>
lib_defines =>
add("OPENSSL_USE_NODELETE",
sub {
return vms_info()->{def_zlib}
@@ -1886,9 +1831,10 @@ my %targets = (
dso_scheme => "vms",
thread_scheme => "pthreads",
as => sub { vms_info()->{as} },
asflags => sub { vms_info()->{asflags} },
AS => sub { vms_info()->{AS} },
ASFLAGS => sub { vms_info()->{ASFLAGS} },
asoutflag => sub { vms_info()->{asoutflag} },
asflags => sub { vms_info()->{asflags} },
perlasm_scheme => sub { vms_info()->{perlasm_scheme} },
apps_aux_src => "vms_term_sock.c",
+214
View File
@@ -0,0 +1,214 @@
#### Android...
#
# It takes *one* prior-set environment variable to make it work:
#
# ANDROID_NDK=/some/where/android-ndk-<ver>
#
# As well as PATH *adjusted* to cover ${CROSS_COMPILE}gcc and company.
#
# Note that it's different from original instructions that required to
# set CROSS_SYSROOT [to $ANDROID_NDK/platforms/android-<api>/arch-<arch>]
# and CROSS_COMPILE. CROSS_SYSROOT is still recognized [and even required
# for some legacy targets], but if not set, it's detected and set to the
# latest Android platform available with appointed NDK automatically. If
# you need to target older platform, pass additional -D__ANDROID_API__=N
# to Configure. For example, to compile for ICS on ARM with NDK 10d:
#
# ANDROID_NDK=/some/where/android-ndk-10d
# PATH=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.8/prebuild/linux-x86_64/bin:$PATH
# [..]./Configure android-arm -D__ANDROID_API__=14
#
# One can engage clang by passing CC=clang to Configure. In such case
# PATH needs even more adjustments to cover NDK's clang itself, as well
# as unprefixed, yet target-specific ar and ranlib [or not, if you use
# binutils-multiarch].
{
my $android_ndk = {};
my %triplet = (
arm => "arm-linux-androideabi",
arm64 => "aarch64-linux-android",
mips => "mipsel-linux-android",
mips64 => "mips64el-linux-android",
x86 => "i686-linux-android",
x86_64 => "x86_64-linux-android",
);
sub android_ndk {
unless (%$android_ndk) {
my $ndk = $ENV{ANDROID_NDK};
die "\$ANDROID_NDK is not defined" if (!$ndk);
die "\$ANDROID_NDK=$ndk is invalid" if (!-d "$ndk/platforms");
my $sysroot;
if (!($sysroot = $ENV{CROSS_SYSROOT})) {
my $api = "*";
# see if user passed -D__ANDROID_API__=N
foreach (@{$useradd{CPPDEFINES}}) {
if (m|__ANDROID_API__=([0-9]+)|) {
$api = $1;
last;
}
}
# list available platforms [numerically]
my @platforms = sort { $a =~ m/-([0-9]+)$/; my $aa = $1;
$b =~ m/-([0-9]+)$/; $aa <=> $1;
} glob("$ndk/platforms/android-$api");
die "no $ndk/platforms/android-$api" if ($#platforms < 0);
$config{target} =~ m|[^-]+-([^-]+)$|; # split on dash
$sysroot = "@platforms[$#platforms]/arch-$1";
}
die "no sysroot=$sysroot" if (!-d $sysroot);
$sysroot =~ m|/android-([0-9]+)/arch-(\w+)/?$|;
my ($api, $arch) = ($1, $2);
my $triarch = $triplet{$arch};
my $cflags = "-Wa,--noexecstack";
my $cppflags;
# see if user passed CC=clang
if ($user{CC} eq "clang") {
if (which("clang") !~ m|^$ndk/.*/prebuilt/([^/]+)/|) {
die "no NDK clang on \$PATH";
}
# harmonize with gcc default
(my $tridefault = $triarch) =~ s|^arm-|armv5te-|;
$cflags .= " -target $tridefault -gcc-toolchain "
. "\$(ANDROID_NDK)/toolchains/$triarch-4.9/prebuilt/$1";
$user{CROSS_COMPILE} = undef;
} else {
$cflags .= " -mandroid";
$user{CROSS_COMPILE} = "$triarch-";
}
if (!-d "$sysroot/usr/include") {
my $incroot = "$ndk/sysroot/usr/include";
die "no $incroot" if (!-d $incroot);
die "no $incroot/$triarch" if (!-d "$incroot/$triarch");
$incroot =~ s|^$ndk/||;
$cppflags = "-D__ANDROID_API__=$api";
$cppflags .= " -isystem \$(ANDROID_NDK)/$incroot/$triarch";
$cppflags .= " -isystem \$(ANDROID_NDK)/$incroot";
}
$sysroot =~ s|^$ndk/||;
$android_ndk = {
cflags => "$cflags --sysroot=\$(ANDROID_NDK)/$sysroot",
cppflags => $cppflags,
bn_ops => $arch =~ m/64$/ ? "SIXTY_FOUR_BIT_LONG"
: "BN_LLONG",
};
}
return $android_ndk;
}
}
my %targets = (
"android" => {
inherit_from => [ "linux-generic32" ],
template => 1,
################################################################
# Special note about -pie. The underlying reason is that
# Lollipop refuses to run non-PIE. But what about older systems
# and NDKs? -fPIC was never problem, so the only concern is -pie.
# Older toolchains, e.g. r4, appear to handle it and binaries
# turn out mostly functional. "Mostly" means that oldest
# Androids, such as Froyo, fail to handle executable, but newer
# systems are perfectly capable of executing binaries targeting
# Froyo. Keep in mind that in the nutshell Android builds are
# about JNI, i.e. shared libraries, not applications.
cflags => add(sub { android_ndk()->{cflags} }),
cppflags => add(sub { android_ndk()->{cppflags} }),
cxxflags => add(sub { android_ndk()->{cflags} }),
bn_ops => sub { android_ndk()->{bn_ops} },
bin_cflags => "-pie",
},
"android-arm" => {
################################################################
# Contemporary Android applications can provide multiple JNI
# providers in .apk, targeting multiple architectures. Among
# them there is "place" for two ARM flavours: generic eabi and
# armv7-a/hard-float. However, it should be noted that OpenSSL's
# ability to engage NEON is not constrained by ABI choice, nor
# is your ability to call OpenSSL from your application code
# compiled with floating-point ABI other than default 'soft'.
# [Latter thanks to __attribute__((pcs("aapcs"))) declaration.]
# This means that choice of ARM libraries you provide in .apk
# is driven by application needs. For example if application
# itself benefits from NEON or is floating-point intensive, then
# it might be appropriate to provide both libraries. Otherwise
# just generic eabi would do. But in latter case it would be
# appropriate to
#
# ./Configure android-arm -D__ARM_MAX_ARCH__=8
#
# in order to build "universal" binary and allow OpenSSL take
# advantage of NEON when it's available.
#
# Keep in mind that [just like with linux-armv4] we rely on
# compiler defaults, which is not necessarily what you had
# in mind, in which case you would have to pass additional
# -march and/or -mfloat-abi flags. NDK defaults to armv5te.
#
inherit_from => [ "android", asm("armv4_asm") ],
},
"android-arm64" => {
inherit_from => [ "android", asm("aarch64_asm") ],
perlasm_scheme => "linux64",
},
"android-mips" => {
inherit_from => [ "android", asm("mips32_asm") ],
perlasm_scheme => "o32",
},
"android-mips64" => {
################################################################
# You are more than likely have to specify target processor
# on ./Configure command line. Trouble is that toolchain's
# default is MIPS64r6 (at least in r10d), but there are no
# such processors around (or they are too rare to spot one).
# Actual problem is that MIPS64r6 is binary incompatible
# with previous MIPS ISA versions, in sense that unlike
# prior versions original MIPS binary code will fail.
#
inherit_from => [ "android", asm("mips64_asm") ],
perlasm_scheme => "64",
},
"android-x86" => {
inherit_from => [ "android", asm("x86_asm") ],
CFLAGS => add(picker(release => "-fomit-frame-pointer")),
bn_ops => add("RC4_INT"),
perlasm_scheme => "android",
},
"android-x86_64" => {
inherit_from => [ "android", asm("x86_64_asm") ],
bn_ops => add("RC4_INT"),
perlasm_scheme => "elf",
},
####################################################################
# Backward compatible targets, [might] requre $CROSS_SYSROOT
#
"android-armeabi" => {
inherit_from => [ "android-arm" ],
},
"android64" => {
inherit_from => [ "android" ],
},
"android64-aarch64" => {
inherit_from => [ "android-arm64" ],
},
"android64-x86_64" => {
inherit_from => [ "android-x86_64" ],
},
"android64-mips64" => {
inherit_from => [ "android-mips64" ],
},
);
+3 -2
View File
@@ -5,8 +5,9 @@
my %targets = (
"DJGPP" => {
inherit_from => [ asm("x86_asm") ],
cc => "gcc",
cflags => "-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall",
CC => "gcc",
CFLAGS => "-fomit-frame-pointer -O2 -Wall",
cflags => "-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN",
sys_id => "MSDOS",
lflags => add("-L/dev/env/WATT_ROOT/lib"),
ex_libs => add("-lwatt"),
+5 -4
View File
@@ -1,10 +1,11 @@
my %targets = (
"haiku-common" => {
template => 1,
cc => "cc",
cflags => add_before(picker(default => "-DL_ENDIAN -Wall -include \$(SRCDIR)/os-dep/haiku.h",
CC => "cc",
CFLAGS => add_before(picker(default => "-Wall",
debug => "-g -O0",
release => "-O2"),
release => "-O2")),
cflags => add_before("-DL_ENDIAN -include \$(SRCDIR)/os-dep/haiku.h",
threads("-D_REENTRANT")),
sys_id => "HAIKU",
ex_libs => "-lnetwork",
@@ -18,7 +19,7 @@ my %targets = (
},
"haiku-x86" => {
inherit_from => [ "haiku-common", asm("x86_elf_asm") ],
cflags => add(picker(release => "-fomit-frame-pointer")),
CFLAGS => add(picker(release => "-fomit-frame-pointer")),
bn_ops => "BN_LLONG",
},
"haiku-x86_64" => {
+3 -2
View File
@@ -11,9 +11,10 @@ my %targets = (
"VC-WIN64A-masm" => {
inherit_from => [ "VC-WIN64-common", asm("x86_64_asm"),
sub { $disabled{shared} ? () : "x86_64_uplink" } ],
as => "ml64",
asflags => "/nologo /c /Cp /Cx /Zi",
AS => "ml64",
ASFLAGS => "/nologo /Zi",
asoutflag => "/Fo",
asflags => "/c /Cp /Cx",
sys_id => "WIN64A",
bn_asm_src => sub { return undef unless @_;
my $r=join(" ",@_); $r=~s|asm/x86_64-gcc|bn_asm|; $r; },
+56
View File
@@ -0,0 +1,56 @@
# Windows OneCore targets.
#
# OneCore is new API stability "contract" that transends Desktop, IoT and
# Mobile[?] Windows editions. It's a set up "umbrella" libraries that
# export subset of Win32 API that are common to all Windows 10 devices.
#
# TODO: drop onecore_downlevel.lib.
my %targets = (
"VC-WIN32-ONECORE" => {
inherit_from => [ "VC-WIN32" ],
# /NODEFAULTLIB:kernel32.lib is needed, because MSVCRT.LIB has
# hidden reference to kernel32.lib, but we don't actually want
# it in "onecore" build.
lflags => add("/NODEFAULTLIB:kernel32.lib"),
ex_libs => "onecore.lib onecore_downlevel.lib",
},
"VC-WIN64A-ONECORE" => {
inherit_from => [ "VC-WIN64A" ],
lflags => add("/NODEFAULTLIB:kernel32.lib"),
ex_libs => "onecore.lib onecore_downlevel.lib",
},
# Windows on ARM targets. ARM compilers are additional components in
# VS2017, i.e. they are not installed by default. And when installed,
# there are no "ARM Tool Command Prompt"s on Start menu, you have
# to locate vcvarsall.bat and act accordingly. VC-WIN32-ARM has
# received limited testing with evp_test.exe on Windows 10 IoT Core,
# but not VC-WIN64-ARM, no hardware... In other words they are not
# actually supported...
#
# Another thing to keep in mind [in cross-compilation scenario such
# as this one] is that target's file system has nothing to do with
# compilation system's one. This means that you're are likely to use
# --prefix and --openssldir with target-specific values. 'nmake install'
# step is effectively meaningless in cross-compilation case, though
# it might be useful to 'nmake install DESTDIR=S:\ome\where' where you
# can point Visual Studio to when compiling custom application code.
"VC-WIN32-ARM" => {
inherit_from => [ "VC-noCE-common" ],
defines => add("_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE"),
bn_ops => "BN_LLONG RC4_CHAR EXPORT_VAR_AS_FN",
lflags => add("/NODEFAULTLIB:kernel32.lib"),
ex_libs => "onecore.lib onecore_downlevel.lib",
multilib => "-arm",
},
"VC-WIN64-ARM" => {
inherit_from => [ "VC-noCE-common" ],
defines => add("_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE"),
bn_ops => "SIXTY_FOUR_BIT RC4_CHAR EXPORT_VAR_AS_FN",
lflags => add("/NODEFAULTLIB:kernel32.lib"),
ex_libs => "onecore.lib onecore_downlevel.lib",
multilib => "-arm64",
},
);
+3 -3
View File
@@ -5,7 +5,7 @@ my %targets = (
"purify" => {
inherit_from => [ 'BASE_unix' ],
cc => "purify gcc",
cflags => "-g -Wall",
CFLAGS => "-g -Wall",
thread_scheme => "(unknown)",
ex_libs => add(" ","-lsocket -lnsl"),
},
@@ -81,8 +81,8 @@ my %targets = (
},
"dist" => {
inherit_from => [ 'BASE_unix' ],
cc => "cc",
cflags => "-O",
CC => "cc",
CFLAGS => "-O",
thread_scheme => "(unknown)",
},
"debug-test-64-clang" => {
+40 -27
View File
@@ -45,19 +45,24 @@ In each table entry, the following keys are significant:
Note: if the same feature is both enabled
and disabled, disable wins.
as => The assembler command. This is not always
used (for example on Unix, where the C
compiler is used instead).
asflags => Default assembler command flags [4].
cpp => The C preprocessor command, normally not
given, as the build file defaults are
usually good enough.
cppflags => The C preprocessor flags.
cppflags => Default C preprocessor flags [4].
defines => As an alternative, macro definitions may be
given here instead of in `cppflags'. If
given here, they MUST be as an array of the
string such as "MACRO=value", or just
given here instead of in `cppflags' [4].
If given here, they MUST be as an array of
the string such as "MACRO=value", or just
"MACRO" for definitions without value.
includes => As an alternative, inclusion directories
may be given here instead of in `cppflags'.
If given here, the MUST be an array of
strings, one directory specification each.
may be given here instead of in `cppflags'
[4]. If given here, the MUST be an array
of strings, one directory specification
each.
cc => The C compiler command, usually one of "cc",
"gcc" or "clang". This command is normally
also used to link object files and
@@ -67,14 +72,9 @@ In each table entry, the following keys are significant:
also used when linking a program where at
least one of the object file is made from
C++ source.
cflags => Flags that are used at all times when
compiling C object files.
cxxflags => Flags that are used at all times when
compiling C++ object files. If unset, it
gets the same value as cflags.
shared_cflag => Extra compilation flags used when
compiling for shared libraries, typically
something like "-fPIC".
cflags => Defaults C compiler flags [4].
cxxflags => Default C++ compiler flags [4]. If unset,
it gets the same value as cflags.
(linking is a complex thing, see [3] below)
ld => Linker command, usually not defined
@@ -82,13 +82,24 @@ In each table entry, the following keys are significant:
instead).
(NOTE: this is here for future use, it's
not implemented yet)
lflags => Flags that are used when linking apps.
shared_ldflag => Flags that are used when linking shared
or dynamic libraries.
plib_lflags => Extra linking flags to appear just before
the libraries on the command line.
lflags => Default flags used when linking apps,
shared libraries or DSOs [4].
ex_libs => Extra libraries that are needed when
linking.
linking shared libraries, DSOs or programs.
shared_cppflags => Extra C preprocessor flags used when
processing C files for shared libraries.
shared_cflag => Extra C compiler flags used when compiling
for shared libraries, typically something
like "-fPIC".
shared_ldflag => Extra linking flags used when linking
shared libraries.
module_cppflags
module_cflags
module_ldflags => Has the same function as the corresponding
`shared_' attributes, but for building DSOs.
When unset, they get the same values as the
corresponding `shared_' attributes.
ar => The library archive command, the default is
"ar".
@@ -338,18 +349,20 @@ In each table entry, the following keys are significant:
of this file):
shared libraries:
{ld} $(CFLAGS) {shared_ldflag} -shared -o libfoo.so \
-Wl,--whole-archive libfoo.a -Wl,--no-whole-archive \
{plib_lflags} -lcrypto {ex_libs}
{ld} $(CFLAGS) {lflags} {shared_ldflag} -o libfoo.so \
foo/something.o foo/somethingelse.o {ex_libs}
shared objects:
{ld} $(CFLAGS) {shared_ldflag} -shared -o libeng.so \
blah1.o blah2.o {plib_lflags} -lcrypto {ex_libs}
{ld} $(CFLAGS) {lflags} {module_ldflags} -o libeng.so \
blah1.o blah2.o -lcrypto {ex_libs}
applications:
{ld} $(CFLAGS) {lflags} -o app \
app1.o utils.o {plib_lflags} -lssl -lcrypto {ex_libs}
app1.o utils.o -lssl -lcrypto {ex_libs}
[4] There are variants of these attribute, prefixed with `lib_',
`dso_' or `bin_'. Those variants replace the unprefixed attribute
when building library, DSO or program modules specifically.
Historically, the target configurations came in form of a string with
values separated by colons. This use is deprecated. The string form
+171 -53
View File
@@ -171,51 +171,174 @@ OPENSSLDIR_C={- $osslprefix -}DATAROOT:[000000]
# Where installed engines reside, for C
ENGINESDIR_C={- $osslprefix -}ENGINES{- $sover_dirname.$target{pointer_size} -}:
CC= {- $config{cc} -}
CPP= {- $config{cpp} -}
DEFINES={- our $defines = join(",",
'__dummy', # To make comma processing easier
@{$config{defines}}) -}
INCLUDES={- our $includes = join(',', @{$config{includes}}) -}
CPPFLAGS='qual_includes'{- our $cppflags = join('', @{$config{cppflags}}) -}
CPPFLAGS_Q={- (my $x = $cppflags) =~ s|"|""|g;
(my $d = $defines) =~ s|"|""|g;
$x .= "/INCLUDE=($includes)" if $includes;
$x .= "/DEFINE=($d)";
$x; -}
CFLAGS={- join('', @{$config{cflags}}) -}
LDFLAGS= {- join('', @{$config{lflags}}) -}
EX_LIBS= {- join('', map { ','.$_ } @{$config{ex_libs}}) -}
##### User defined commands and flags ################################
LIB_DEFINES=$(DEFINES){- join("", (map { ",$_" }
@{$target{shared_defines}},
'OPENSSLDIR="""$(OPENSSLDIR_C)"""',
'ENGINESDIR="""$(ENGINESDIR_C)"""')) -}
LIB_CPPFLAGS=$(CPPFLAGS)/DEFINE=($(LIB_DEFINES))
LIB_CFLAGS=$(CFLAGS){- $target{lib_cflags} // "" -}
DSO_DEFINES=$(DEFINES){- join("", (map { ",$_" } @{$target{dso_defines}})) -}
DSO_CPPFLAGS=$(CPPFLAGS)/DEFINE=($(DSO_DEFINES))
DSO_CFLAGS=$(CFLAGS){- $target{dso_cflags} // "" -}
BIN_DEFINES=$(DEFINES){- join("", (map { ",$_" } @{$target{bin_defines}})) -}
BIN_CPPFLAGS=$(CPPFLAGS)/DEFINE=($(BIN_DEFINES))
BIN_CFLAGS=$(CFLAGS){- $target{bin_cflags} // "" -}
NO_INST_LIB_CFLAGS=$(CFLAGS){- $target{no_inst_lib_cflags}
// $target{lib_cflags}
// "" -}
NO_INST_DSO_CFLAGS=$(CFLAGS){- $target{no_inst_dso_cflags}
// $target{dso_cflags}
// "" -}
NO_INST_BIN_CFLAGS=$(CFLAGS){- $target{no_inst_bin_cflags}
// $target{bin_cflags}
// "" -}
CC={- $config{CC} -}
CPP={- $config{CPP} -}
DEFINES={- our $defines1 = join('', map { ",$_" } @{$config{CPPDEFINES}}) -}
INCLUDES={- our $includes1 = join(',', @{$config{CPPINCLUDES}}) -}
CPPFLAGS={- our $cppflags1 = join('', @{$config{CPPFLAGS}}) -}
CFLAGS={- join('', @{$config{CFLAGS}}) -}
LDFLAGS={- join('', @{$config{LFLAGS}}) -}
EX_LIBS={- join('', map { ",$_" } @{$config{LDLIBS}}) -}
PERL={- $config{perl} -}
AS={- $config{as} -}
ASFLAGS={- join(' ', @{$config{asflags}}) -}
AS={- $config{AS} -}
ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -}
##### Special command flags ##########################################
ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
##### Project flags ##################################################
# Variables starting with CNF_ are common variables for all product types
CNF_ASFLAGS={- join('', $target{asflags} || (),
@{$config{asflags}}) -}
CNF_DEFINES={- our $defines2 = join('', map { ",$_" } @{$target{defines}},
@{$config{defines}}) -}
CNF_INCLUDES={- our $includes2 = join(',', @{$target{includes}},
@{$config{includes}}) -}
CNF_CPPFLAGS={- our $cppflags2 = join('', $target{cppflags} || (),
@{$config{cppflags}}) -}
CNF_CFLAGS={- join('', $target{cflags} || (),
@{$config{cflags}}) -}
CNF_CXXFLAGS={- join('', $target{cxxflags} || (),
@{$config{cxxflags}}) -}
CNF_LDFLAGS={- join('', $target{lflags} || (),
@{$config{lflags}}) -}
CNF_EX_LIBS={- join('', map{ ",$_" } @{$target{ex_libs}},
@{$config{ex_libs}}) -}
# Variables starting with LIB_ are used to build library object files
# and shared libraries.
# Variables starting with DSO_ are used to build DSOs and their object files.
# Variables starting with BIN_ are used to build programs and their object
# files.
LIB_ASFLAGS={- join(' ', $target{lib_asflags} || (),
@{$config{lib_asflags}},
'$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
LIB_DEFINES={- our $lib_defines =
join('', (map { ",$_" } @{$target{lib_defines}},
@{$target{shared_defines}},
@{$config{lib_defines}},
@{$config{shared_defines}}));
join('', $lib_defines,
(map { ",$_" } 'OPENSSLDIR="""$(OPENSSLDIR_C)"""',
'ENGINESDIR="""$(ENGINESDIR_C)"""'),
'$(CNF_DEFINES)', '$(DEFINES)') -}
LIB_INCLUDES={- our $lib_includes =
join(',', @{$target{lib_includes}},
@{$target{shared_includes}},
@{$config{lib_includes}},
@{$config{shared_includes}}) -}
LIB_CPPFLAGS={- our $lib_cppflags =
join('', $target{lib_cppflags} || (),
$target{shared_cppflags} || (),
@{$config{lib_cppflags}},
@{$config{shared_cppflag}});
join('', "'qual_includes'",
'/DEFINE=(__dummy$(LIB_DEFINES))',
$lib_cppflags,
'$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
LIB_CFLAGS={- join('', $target{lib_cflags} || (),
$target{shared_cflag} || (),
@{$config{lib_cflags}},
@{$config{shared_cflag}},
'$(CNF_CFLAGS)', '$(CFLAGS)') -}
LIB_LDFLAGS={- join('', $target{lib_lflags} || (),
$target{shared_ldflag} || (),
@{$config{lib_lflags}},
@{$config{shared_ldflag}},
'$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
LIB_EX_LIBS=$(CNF_EX_LIBS)$(EX_LIBS)
DSO_ASFLAGS={- join(' ', $target{dso_asflags} || (),
$target{module_asflags} || (),
@{$config{dso_asflags}},
@{$config{module_asflags}},
'$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
DSO_DEFINES={- join('', (map { ",$_" } @{$target{dso_defines}},
@{$target{module_defines}},
@{$config{dso_defines}},
@{$config{module_defines}}),
'$(CNF_DEFINES)', '$(DEFINES)') -}
DSO_INCLUDES={- join(',', @{$target{dso_includes}},
@{$target{module_includes}},
@{$config{dso_includes}},
@{$config{module_includes}}) -}
DSO_CPPFLAGS={- join('', "'qual_includes'",
'/DEFINE=(__dummy$(DSO_DEFINES))',
$target{dso_cppflags} || (),
$target{module_cppflags} || (),
@{$config{dso_cppflags}},
@{$config{module_cppflags}},
'$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
DSO_CFLAGS={- join('', $target{dso_cflags} || (),
$target{module_cflags} || (),
@{$config{dso_cflags}},
@{$config{module_cflags}},
'$(CNF_CFLAGS)', '$(CFLAGS)') -}
DSO_LDFLAGS={- join('', $target{dso_lflags} || (),
$target{module_ldflags} || (),
@{$config{dso_lflags}},
@{$config{module_ldflags}},
'$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
BIN_ASFLAGS={- join(' ', $target{bin_asflags} || (),
@{$config{bin_asflags}},
'$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
BIN_DEFINES={- join('', (map { ",$_" } @{$target{bin_defines}},
@{$config{bin_defines}}),
'$(CNF_DEFINES)', '$(DEFINES)') -}
BIN_INCLUDES={- join(',', @{$target{bin_includes}},
@{$config{bin_includes}}) -}
BIN_CPPFLAGS={- join('', "'qual_includes'",
'/DEFINE=(__dummy$(DSO_DEFINES))',
$target{bin_cppflags} || (),
@{$config{bin_cppflag}},
'$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
BIN_CFLAGS={- join('', $target{bin_cflag} || (),
@{$config{bin_cflag}},
'$(CNF_CFLAGS)', '$(CFLAGS)') -}
BIN_LDFLAGS={- join('', $target{bin_lflags} || (),
@{$config{bin_lflags}} || (),
'$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
NO_INST_LIB_CFLAGS={- join('', $target{no_inst_lib_cflags}
// $target{lib_cflags}
// (),
$target{shared_cflag} || (),
@{$config{lib_cflags}},
@{$config{shared_cflag}},
'$(CNF_CFLAGS)', '$(CFLAGS)') -}
NO_INST_DSO_CFLAGS={- join('', $target{no_inst_lib_cflags}
// $target{lib_cflags}
// (),
$target{dso_cflags} || (),
@{$config{lib_cflags}},
@{$config{dso_cflags}},
'$(CNF_CFLAGS)', '$(CFLAGS)') -}
NO_INST_BIN_CFLAGS={- join('', $target{no_inst_bin_cflags}
// $target{bin_cflags}
// (),
@{$config{bin_cflags}},
'$(CNF_CFLAGS)', '$(CFLAGS)') -}
PERLASM_SCHEME={- $target{perlasm_scheme} -}
# CPPFLAGS_Q is used for one thing only: to build up buildinf.h
CPPFLAGS_Q={- (my $c = $lib_cppflags.$cppflags2.$cppflags1) =~ s|"|""|g;
(my $d = $lib_defines.$defines2.$defines1) =~ s|"|""|g;
my $i = join(',', $lib_includes || (), $includes2 || (),
$includes1 || ());
my $x = $c;
$x .= "/INCLUDE=($i)" if $i;
$x .= "/DEFINE=($d)" if $d;
$x; -}
# .FIRST and .LAST are special targets with MMS and MMK.
# The defines in there are for C. includes that look like
# this:
@@ -381,16 +504,7 @@ distclean : clean
depend : descrip.mms
descrip.mms : FORCE
@ ! {- output_off() if $disabled{makedepend}; "" -}
@ $(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }" -
< descrip.mms > descrip.mms-new
@ OPEN/APPEND DESCRIP descrip.mms-new
@ WRITE DESCRIP "# DO NOT DELETE THIS LINE -- make depend depends on it."
{- join("\n\t", map { "\@ IF F\$SEARCH(\"$_\") .NES. \"\" THEN TYPE $_ /OUTPUT=DESCRIP:" } @deps); -}
@ CLOSE DESCRIP
@ PIPE ( $(PERL) -e "use File::Compare qw/compare_text/; my $x = compare_text(""descrip.mms"",""descrip.mms-new""); exit(0x10000000 + ($x == 0));" || -
RENAME descrip.mms-new descrip.mms )
@ IF F$SEARCH("descrip.mms-new") .NES. "" THEN DELETE descrip.mms-new;*
-@ SPAWN/OUTPUT=NLA0: PURGE/NOLOG descrip.mms
@ $(PERL) {- sourcefile("util", "add-depends.pl") -}
@ ! {- output_on() if $disabled{makedepend}; "" -}
# Install helper targets #############################################
@@ -666,6 +780,7 @@ EOF
my @incs_cmds = includes({ lib => '$(LIB_INCLUDES)',
dso => '$(DSO_INCLUDES)',
bin => '$(BIN_INCLUDES)' } -> {$args{intent}},
'$(CNF_INCLUDES)',
'$(INCLUDES)',
@{$args{incs}});
my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!';
@@ -725,11 +840,14 @@ EOF
my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
if ($srcs[0] =~ /\.asm$/) {
my $asflags = { lib => ' $(LIB_ASFLAGS)',
dso => ' $(DSO_ASFLAGS)',
bin => ' $(BIN_ASFLAGS)' } -> {$args{intent}};
return <<"EOF";
$obj.OBJ : $deps
${before}
SET DEFAULT $forward
\$(AS) \$(ASFLAGS) \$(ASOUTFLAG)${objd}${objn}.OBJ $srcs
\$(AS) $asflags \$(ASOUTFLAG)${objd}${objn}.OBJ $srcs
SET DEFAULT $backward
EOF
}
@@ -817,8 +935,8 @@ $shlib.EXE : $lib.OLB $deps
$write_opt1
$write_opt2
CLOSE OPT_FILE
LINK \$(LDFLAGS)/SHARE=\$\@ $defs[0]-translated/OPT,-
$lib-components.OPT/OPT \$(EX_LIBS)
LINK \$(LIB_LDFLAGS)/SHARE=\$\@ $defs[0]-translated/OPT,-
$lib-components.OPT/OPT \$(LIB_EX_LIBS)
DELETE $defs[0]-translated;*,$lib-components.OPT;*
PURGE $shlib.EXE,$shlib.MAP
EOF
@@ -861,7 +979,7 @@ $lib.EXE : $deps
$write_opt1
$write_opt2
CLOSE OPT_FILE
LINK \$(LDFLAGS)/SHARE=\$\@ $lib.OPT/OPT \$(EX_LIBS)
LINK \$(DSO_LDFLAGS)/SHARE=\$\@ $lib.OPT/OPT \$(DSO_EX_LIBS)
- PURGE $lib.EXE,$lib.OPT,$lib.MAP
EOF
. ($config{target} =~ m|alpha| ? "" : <<"EOF"
@@ -949,7 +1067,7 @@ $bin.EXE : $deps
@ CLOSE OPT_FILE
TYPE $bin.opt ! For debugging
- pipe SPAWN/WAIT/NOLOG/OUT=$bin.LINKLOG -
LINK \$(LDFLAGS)/EXEC=\$\@ $bin.OPT/OPT \$(EX_LIBS) ; -
LINK \$(BIN_LDFLAGS)/EXEC=\$\@ $bin.OPT/OPT \$(BIN_EX_LIBS) ; -
link_status = \$status ; link_severity = link_status .AND. 7
@ search_severity = 1
-@ IF link_severity .EQ. 0 THEN -
+4 -4
View File
@@ -13,12 +13,12 @@
sub detect_gnu_ld {
my @lines =
`$config{cross_compile_prefix}$config{cc} -Wl,-V /dev/null 2>&1`;
`$config{CROSS_COMPILE}$config{CC} -Wl,-V /dev/null 2>&1`;
return grep /^GNU ld/, @lines;
}
sub detect_gnu_cc {
my @lines =
`$config{cross_compile_prefix}$config{cc} -v 2>&1`;
`$config{CROSS_COMPILE}$config{CC} -v 2>&1`;
return grep /gcc/, @lines;
}
@@ -42,7 +42,7 @@ my %shared_info;
};
},
'darwin-shared' => {
dso_lflags => '-bundle',
module_ldflags => '-bundle',
shared_ldflag => '-dynamiclib -current_version $(SHLIB_VERSION_NUMBER) -compatibility_version $(SHLIB_VERSION_NUMBER)',
shared_sonameflag => '-install_name $(INSTALLTOP)/$(LIBDIR)/',
},
@@ -61,7 +61,7 @@ my %shared_info;
'alpha-osf1-shared' => sub {
return $shared_info{'gnu-shared'} if detect_gnu_ld();
return {
dso_lflags => '-shared -Wl,-Bsymbolic',
module_ldflags => '-shared -Wl,-Bsymbolic',
shared_ldflag => '-shared -Wl,-Bsymbolic -set_version $(SHLIB_VERSION_NUMBER)',
};
},
+170 -98
View File
@@ -107,8 +107,7 @@ DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; }
{- output_on() if $disabled{makedepend}; "" -}
GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}} ) -}
GENERATED={- join(" ",
( map { (my $x = $_) =~ s|\.S$|\.s|; $x }
grep { defined $unified_info{generate}->{$_} }
( grep { defined $unified_info{generate}->{$_} }
map { @{$unified_info{sources}->{$_}} }
grep { /\.o$/ } keys %{$unified_info{sources}} ),
( grep { /\.h$/ } keys %{$unified_info{generate}} )) -}
@@ -188,61 +187,141 @@ HTMLSUFFIX=html
# For "optional" echo messages, to get "real" silence
ECHO = echo
CROSS_COMPILE= {- $config{cross_compile_prefix} -}
CPPFLAGS={- our $cppflags = join(" ",
(map { "-D".$_} @{$config{defines}}),
(map { "-I".$_} @{$config{includes}}),
@{$config{cppflags}}) -}
CPPFLAGS_Q={- $cppflags =~ s|([\\"])|\\$1|g; $cppflags -}
CC= $(CROSS_COMPILE){- $config{cc} -}
CFLAGS={- join(' ', @{$config{cflags}}) -}
CXX={- $config{cxx} ? "\$(CROSS_COMPILE)$config{cxx}" : '' -}
CXXFLAGS={- join(' ', @{$config{cxxflags}}) -}
LDFLAGS= {- join(' ', @{$config{lflags}}) -}
PLIB_LDFLAGS= {- join(' ', @{$config{plib_lflags}}) -}
EX_LIBS= {- join(' ', @{$config{ex_libs}}) -}
LIB_CPPFLAGS={- join(' ', '$(CPPFLAGS)',
$target{shared_cppflag} || (),
(map { '-D'.$_ }
('OPENSSLDIR="\"$(OPENSSLDIR)\""',
'ENGINESDIR="\"$(ENGINESDIR)\""'))) -}
LIB_CFLAGS={- join(' ', '$(CFLAGS)', $target{shared_cflag} || ()) -}
LIB_CXXFLAGS={- join(' ', '$(CXXFLAGS)', $target{shared_cxxflag} || ()) -}
LIB_LDFLAGS={- join(' ', '$(LDFLAGS)', $target{shared_ldflag} || (), $config{shared_ldflag} || ()) -}
DSO_CPPFLAGS={- join(' ', '$(CPPFLAGS)', $target{dso_cppflags} || ()) -}
DSO_CFLAGS={- join(' ', '$(CFLAGS)', $target{dso_cflags} || ()) -}
DSO_CXXFLAGS={- join(' ', '$(CXXFLAGS)', $target{dso_cxxflags} || ()) -}
DSO_LDFLAGS={- join(' ', '$(LDFLAGS)', $target{dso_lflags} || ()) -}
BIN_CPPFLAGS={- join(' ', '$(CPPFLAGS)', $target{bin_cppflags} || ()) -}
BIN_CFLAGS={- join(' ', '$(CFLAGS)', $target{bin_cflags} || ()) -}
BIN_CXXFLAGS={- join(' ', '$(CXXFLAGS)', $target{bin_cxxflags} || ()) -}
BIN_LDFLAGS={- join(' ', '$(LDFLAGS)', $target{bin_lflags} || ()) -}
PERL={- $config{perl} -}
AR=$(CROSS_COMPILE){- $config{ar} -}
ARFLAGS= {- join(' ', @{$config{arflags}}) -}
RANLIB={- $config{ranlib} ? "\$(CROSS_COMPILE)$config{ranlib}" : "true"; -}
RC= $(CROSS_COMPILE){- $target{rc} || "windres" -}
RCFLAGS={- join(' ', @{$config{rcflags}}) -} {- $target{shared_rcflag} -}
RM= rm -f
RMDIR= rmdir
TAR= {- $target{tar} || "tar" -}
TARFLAGS= {- $target{tarflags} -}
MAKEDEPEND={- $config{makedepprog} -}
BASENAME= openssl
NAME= $(BASENAME)-$(VERSION)
TARFILE= ../$(NAME).tar
##### User defined commands and flags ################################
# We let the C compiler driver to take care of .s files. This is done in
# order to be excused from maintaining a separate set of architecture
# dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
# gcc, then the driver will automatically translate it to -xarch=v8plus
# and pass it down to assembler.
AS={- $config{as} ? "\$(CROSS_COMPILE)$config{as}" : '$(CC) -c' -}
ASFLAGS={- join(' ', @{$config{asflags}}) || '$(CFLAGS)' -}
# and pass it down to assembler. In any case, we do not define AS or
# ASFLAGS for this reason.
CROSS_COMPILE={- $config{CROSS_COMPILE} -}
CC=$(CROSS_COMPILE){- $config{CC} -}
CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -}
CPPFLAGS={- our $cppflags1 = join(" ",
(map { "-D".$_} @{$config{CPPDEFINES}}),
(map { "-I".$_} @{$config{CPPINCLUDES}}),
@{$config{CPPFLAGS}}) -}
CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -}
LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -}
EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -}
MAKEDEPEND={- $config{makedepprog} -}
PERL={- $config{perl} -}
AR=$(CROSS_COMPILE){- $config{AR} -}
ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -}
RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -}
RC= $(CROSS_COMPILE){- $config{RC} -}
RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -}
RM= rm -f
RMDIR= rmdir
TAR= {- $target{TAR} || "tar" -}
TARFLAGS= {- $target{TARFLAGS} -}
BASENAME= openssl
NAME= $(BASENAME)-$(VERSION)
TARFILE= ../$(NAME).tar
##### Project flags ##################################################
# Variables starting with CNF_ are common variables for all product types
CNF_CPPFLAGS={- our $cppflags2 =
join(' ', $target{cppflags} || (),
(map { "-D".$_} @{$target{defines}},
@{$config{defines}}),
(map { "-I".$_} @{$target{includes}},
@{$config{includes}}),
@{$config{cppflags}}) -}
CNF_CFLAGS={- join(' ', $target{cflags} || (),
@{$config{cflags}}) -}
CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (),
@{$config{cxxflags}}) -}
CNF_LDFLAGS={- join(' ', $target{lflags} || (),
@{$config{lflags}}) -}
CNF_EX_LIBS={- join(' ', $target{ex_libs} || (),
@{$config{ex_libs}}) -}
# Variables starting with LIB_ are used to build library object files
# and shared libraries.
# Variables starting with DSO_ are used to build DSOs and their object files.
# Variables starting with BIN_ are used to build programs and their object
# files.
LIB_CPPFLAGS={- our $lib_cppflags =
join(' ', $target{lib_cppflags} || (),
$target{shared_cppflag} || (),
(map { '-D'.$_ }
@{$config{lib_defines}},
@{$config{shared_defines}}),
@{$config{lib_cppflags}},
@{$config{shared_cppflag}});
join(' ', $lib_cppflags,
(map { '-D'.$_ }
'OPENSSLDIR="\"$(OPENSSLDIR)\""',
'ENGINESDIR="\"$(ENGINESDIR)\""'),
'$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
LIB_CFLAGS={- join(' ', $target{lib_cflags} || (),
$target{shared_cflag} || (),
@{$config{lib_cflags}},
@{$config{shared_cflag}},
'$(CNF_CFLAGS)', '$(CFLAGS)') -}
LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (),
$target{shared_cxxflag} || (),
@{$config{lib_cxxflags}},
@{$config{shared_cxxflag}},
'$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (),
$config{shared_ldflag} || (),
'$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (),
$target{module_cppflags} || (),
@{$config{dso_cppflags}},
@{$config{module_cppflags}},
'$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
DSO_CFLAGS={- join(' ', $target{dso_cflags} || (),
$target{module_cflags} || (),
@{$config{dso_cflags}},
@{$config{module_cflags}},
'$(CNF_CFLAGS)', '$(CFLAGS)') -}
DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (),
$target{module_cxxflags} || (),
@{$config{dso_cxxflags}},
@{$config{module_cxxflag}},
'$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (),
$target{module_ldflags} || (),
@{$config{dso_ldflags}},
@{$config{module_ldflags}},
'$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (),
@{$config{bin_cppflags}},
'$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
BIN_CFLAGS={- join(' ', $target{bin_cflags} || (),
@{$config{bin_cflags}},
'$(CNF_CFLAGS)', '$(CFLAGS)') -}
BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (),
@{$config{bin_cxxflags}},
'$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
@{$config{bin_lflags}},
'$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
# CPPFLAGS_Q is used for one thing only: to build up buildinf.h
CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
$cppflags2 =~ s|([\\"])|\\$1|g;
$lib_cppflags =~ s|([\\"])|\\$1|g;
join(' ', $lib_cppflags || (), $cppflags2 || (),
$cppflags1 || ()) -}
PERLASM_SCHEME= {- $target{perlasm_scheme} -}
# For x86 assembler: Set PROCESSOR to 386 if you want to support
@@ -340,19 +419,7 @@ distclean: clean
# concatenate only if that is true.
depend:
@: {- output_off() if $disabled{makedepend}; "" -}
@if egrep "^# DO NOT DELETE THIS LINE" Makefile >/dev/null && [ -z "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then :; else \
( $(PERL) -pe 'exit 0 if /^# DO NOT DELETE THIS LINE.*/' < Makefile; \
echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \
echo; \
for f in $(DEPS); do \
if [ -f $$f ]; then cat $$f; fi; \
done ) > Makefile.new; \
if cmp Makefile.new Makefile >/dev/null 2>&1; then \
rm -f Makefile.new; \
else \
mv -f Makefile.new Makefile; \
fi; \
fi
@$(PERL) $(SRCDIR)/util/add-depends.pl
@: {- output_on() if $disabled{makedepend}; "" -}
# Install helper targets #############################################
@@ -651,13 +718,18 @@ generate_crypto_bn:
( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
generate_crypto_objects:
( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \
crypto/objects/objects.txt \
crypto/objects/obj_mac.num \
> crypto/objects/obj_mac.new && \
mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num )
( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
crypto/objects/objects.txt \
crypto/objects/obj_mac.num \
include/openssl/obj_mac.h )
> include/openssl/obj_mac.h )
( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
include/openssl/obj_mac.h \
crypto/objects/obj_dat.h )
> crypto/objects/obj_dat.h )
( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
crypto/objects/obj_mac.num \
crypto/objects/obj_xref.txt \
@@ -707,7 +779,7 @@ tags TAGS: FORCE
# If your tar command doesn't support --owner and --group, make sure to
# use one that does, for example GNU tar
TAR_COMMAND=$(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf -
TAR_COMMAND=$(TAR) $(TARFLAGS) --owner 0 --group 0 -cf -
PREPARE_CMD=:
tar:
set -e; \
@@ -767,7 +839,7 @@ libcrypto.pc:
echo 'Description: OpenSSL cryptography library'; \
echo 'Version: '$(VERSION); \
echo 'Libs: -L$${libdir} -lcrypto'; \
echo 'Libs.private: $(EX_LIBS)'; \
echo 'Libs.private: $(LIB_EX_LIBS)'; \
echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
libssl.pc:
@@ -872,20 +944,6 @@ EOF
bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
} -> {$args{intent}};
if (defined($generator)) {
# If the target is named foo.S in build.info, we want to
# end up generating foo.s in two steps.
if ($args{src} =~ /\.S$/) {
(my $target = $args{src}) =~ s|\.S$|.s|;
return <<"EOF";
$target: $args{generator}->[0] $deps
( trap "rm -f \$@.*" INT 0; \\
$generator \$@.S; \\
\$(CPP) $incs $cppflags \$@.S | \\
\$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.i && \\
mv -f \$@.i \$@ )
EOF
}
# Otherwise....
return <<"EOF";
$args{src}: $args{generator}->[0] $deps
$generator \$@
@@ -905,12 +963,7 @@ EOF
sub src2obj {
my %args = @_;
(my $obj = $args{obj}) =~ s|\.o$||;
my @srcs = map { if ($unified_info{generate}->{$_}) {
(my $x = $_) =~ s/\.S$/.s/; $x
} else {
$_
}
} ( @{$args{srcs}} );
my @srcs = @{$args{srcs}};
my $srcs = join(" ", @srcs);
my $deps = join(" ", @srcs, @{$args{deps}});
my $incs = join("", map { " -I".$_ } @{$args{incs}});
@@ -940,12 +993,30 @@ EOF
bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
} -> {$args{intent}};
}
$cmdflags .= $cmdcompile;
my $recipe = <<"EOF";
$obj$objext: $deps
EOF
if (defined $makedepprog && $makedepprog !~ /\/makedepend/) {
my $recipe;
# extension-specific rules
if (grep /\.s$/, @srcs) {
$recipe .= <<"EOF";
$obj$objext: $deps
$cmd $cmdflags -c -o \$\@ $srcs
EOF
} elsif (grep /\.S$/, @srcs) {
# In case one wonders why not just $(CC) -c file.S. While it
# does work with contemporary compilers, there are some legacy
# ones that get it wrong. Hence the elaborate scheme... We
# don't care to maintain dependecy lists, because dependency
# is rather weak, at most one header file that lists constants
# which are assigned in ascending order.
$recipe .= <<"EOF";
$obj$objext: $deps
( trap "rm -f \$@.*" INT 0; \\
\$(CPP) $incs $cmdflags $srcs | \\
\$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.s && \\
$cmd $cmdflags -c -o \$\@ \$@.s )
EOF
} elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/) {
$recipe .= <<"EOF";
$obj$objext: $deps
$cmd $incs $cmdflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
\@touch $obj$depext.tmp
\@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
@@ -956,7 +1027,8 @@ EOF
EOF
} else {
$recipe .= <<"EOF";
$cmd $incs $cmdflags -o \$\@ $srcs
$obj$objext: $deps
$cmd $incs $cmdflags $cmdcompile -o \$\@ $srcs
EOF
if (defined $makedepprog && $makedepprog =~ /\/makedepend/) {
$recipe .= <<"EOF";
@@ -1020,7 +1092,7 @@ EOF
$target: $deps
\$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
-o $target_full$shared_def $objs \\
\$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)
$linklibs \$(LIB_EX_LIBS)
EOF
if (windowsdll()) {
$recipe .= <<"EOF";
@@ -1063,7 +1135,7 @@ EOF
$target: $objs $deps
\$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
-o $target $objs \\
\$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)
$linklibs \$(DSO_EX_LIBS)
EOF
}
sub obj2lib {
@@ -1111,7 +1183,7 @@ $bin$exeext: $objs $deps
rm -f $bin$exeext
\$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
-o $bin$exeext $objs \\
\$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)
$linklibs \$(BIN_EX_LIBS)
EOF
}
sub in2script {
+150 -50
View File
@@ -14,18 +14,18 @@
(our $sover_dirname = $config{shlib_version_number}) =~ s|\.|_|g;
my $build_scheme = $target{build_scheme};
my $install_flavour = $build_scheme->[$#$build_scheme]; # last element
my $win_installenv =
$target{build_scheme}->[2] eq "VC-W32" ?
"ProgramFiles(x86)" : "ProgramW6432";
$install_flavour eq "VC-WOW" ? "ProgramFiles(x86)"
: "ProgramW6432";
my $win_commonenv =
$target{build_scheme}->[2] eq "VC-W32"
? "CommonProgramFiles(x86)" : "CommonProgramW6432";
$install_flavour eq "VC-WOW" ? "CommonProgramFiles(x86)"
: "CommonProgramW6432";
our $win_installroot =
defined($ENV{$win_installenv})
? $win_installenv : 'ProgramFiles';
defined($ENV{$win_installenv}) ? $win_installenv : 'ProgramFiles';
our $win_commonroot =
defined($ENV{$win_commonenv})
? $win_commonenv : 'CommonProgramFiles';
defined($ENV{$win_commonenv}) ? $win_commonenv : 'CommonProgramFiles';
# expand variables early
$win_installroot = $ENV{$win_installroot};
@@ -163,50 +163,143 @@ ENGINESDIR=$(ENGINESDIR_dev)$(ENGINESDIR_dir)
libdir={- file_name_is_absolute($libdir)
? $libdir : '$(INSTALLTOP)\$(LIBDIR)' -}
CC={- $config{cc} -}
CPP={- $config{cpp} -}
CPPFLAGS={- our $cppflags = join(" ",
(map { "-D".$_} @{$config{defines}}),
(map { " /I ".$_} @{$config{includes}}),
@{$config{cppflags}}) -}
CPPFLAGS_Q={- $cppflags =~ s|([\\"])|\\$1|g; $cppflags -}
CFLAGS={- join(' ', @{$config{cflags}}) -}
COUTFLAG={- $target{coutflag} || "/Fo" -}$(OSSL_EMPTY)
RC={- $config{rc} -}
RCOUTFLAG={- $target{rcoutflag} || "/fo" -}$(OSSL_EMPTY)
LD={- $config{ld} -}
LDFLAGS={- join(' ', @{$config{lflags}}) -}
LDOUTFLAG={- $target{loutflag} || "/out:" -}$(OSSL_EMPTY)
EX_LIBS={- join(' ', @{$config{ex_libs}}) -}
##### User defined commands and flags ################################
LIB_CPPFLAGS={- join(' ', '$(CPPFLAGS)',
$target{shared_cppflag} || (),
(map { quotify_l("-D".$_) }
"OPENSSLDIR=\"$openssldir\"",
"ENGINESDIR=\"$enginesdir\"")) -}
LIB_CFLAGS={- join(' ', '$(CFLAGS)', $target{lib_cflags} || (), $target{shared_cflag} || ()) -}
LIB_LDFLAGS={- join(' ', '$(LDFLAGS)', $target{shared_ldflag} || (), $config{shared_ldflag} || ()) -}
DSO_CPPFLAGS={- join(' ', '$(CPPFLAGS)', $target{dso_cppflags} || ()) -}
DSO_CFLAGS={- join(' ', '$(CFLAGS)', $target{dso_cflags} || ()) -}
DSO_LDFLAGS={- join(' ', '$(LDFLAGS)', $target{dso_ldflag} || ()) -}
BIN_CPPFLAGS={- join(' ', '$(CPPFLAGS)', $target{dso_cppflags} || ()) -}
BIN_CFLAGS={- join(' ', '$(CFLAGS)', $target{bin_cflags} || ()) -}
BIN_LDFLAGS={- join(' ', '$(LDFLAGS)', $target{bin_lflags} || ()) -}
CC={- $config{CC} -}
CPP={- $config{CPP} -}
CPPFLAGS={- our $cppflags1 = join(" ",
(map { "-D".$_} @{$config{CPPDEFINES}}),
(map { " /I ".$_} @{$config{CPPINCLUDES}}),
@{$config{CPPFLAGS}}) -}
CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
LD={- $config{LD} -}
LDFLAGS={- join(' ', @{$config{LDFLAGS}}) -}
EX_LIBS={- join(' ', @{$config{LDLIBS}}) -}
PERL={- $config{perl} -}
AR={- $config{ar} -}
ARFLAGS= {- join(' ', @{$config{arflags}}) -}
AROUTFLAG={- $target{aroutflag} || "/out:" -}$(OSSL_EMPTY)
AR={- $config{AR} -}
ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -}
MT={- $config{mt} -}
MTFLAGS= {- join(' ', @{$config{mtflags}}) -}
MTINFLAG={- $target{mtinflag} || "-manifest " -}$(OSSL_EMPTY)
MTOUTFLAG={- $target{mtoutflag} || "-outputresource:" -}$(OSSL_EMPTY)
MT={- $config{MT} -}
MTFLAGS= {- join(' ', @{$config{MTFLAGS}}) -}
AS={- $config{as} -}
ASFLAGS={- join(' ', @{$config{asflags}}) -}
AS={- $config{AS} -}
ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -}
RC={- $config{RC} -}
##### Special command flags ##########################################
COUTFLAG={- $target{coutflag} -}$(OSSL_EMPTY)
LDOUTFLAG={- $target{ldoutflag} -}$(OSSL_EMPTY)
AROUTFLAG={- $target{aroutflag} -}$(OSSL_EMPTY)
MTINFLAG={- $target{mtinflag} -}$(OSSL_EMPTY)
MTOUTFLAG={- $target{mtoutflag} -}$(OSSL_EMPTY)
ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
RCOUTFLAG={- $target{rcoutflag} -}$(OSSL_EMPTY)
##### Project flags ##################################################
# Variables starting with CNF_ are common variables for all product types
CNF_ASFLAGS={- join(' ', $target{asflags} || (),
@{$config{asflags}}) -}
CNF_CPPFLAGS={- our $cppfags2 =
join(' ', $target{cppflags} || (),
(map { quotify_l("-D".$_) } @{$target{defines}},
@{$config{defines}}),
(map { quotify_l("-I".$_) } @{$target{includes}},
@{$config{includes}}),
@{$config{cppflags}}) -}
CNF_CFLAGS={- join(' ', $target{cflags} || (),
@{$config{cflags}}) -}
CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (),
@{$config{cxxflags}}) -}
CNF_LDFLAGS={- join(' ', $target{lflags} || (),
@{$config{lflags}}) -}
CNF_EX_LIBS={- join(' ', $target{ex_libs} || (),
@{$config{ex_libs}}) -}
# Variables starting with LIB_ are used to build library object files
# and shared libraries.
# Variables starting with DSO_ are used to build DSOs and their object files.
# Variables starting with BIN_ are used to build programs and their object
# files.
LIB_ASFLAGS={- join(' ', $target{lib_asflags} || (),
@{$config{lib_asflags}},
'$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
LIB_CPPFLAGS={- our $lib_cppflags =
join(' ', $target{lib_cppflags} || (),
$target{shared_cppflag} || (),
(map { quotify_l("-D".$_) }
@{$target{lib_defines}},
@{$target{shared_defines}},
@{$config{lib_defines}},
@{$config{shared_defines}}),
(map { quotify_l("-I".$_) }
@{$target{lib_includes}},
@{$target{shared_includes}},
@{$config{lib_includes}},
@{$config{shared_includes}}),
@{$config{lib_cppflags}},
@{$config{shared_cppflag}});
join(' ', $lib_cppflags,
(map { quotify_l("-D".$_) }
"OPENSSLDIR=\"$openssldir\"",
"ENGINESDIR=\"$enginesdir\""),
'$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
LIB_CFLAGS={- join(' ', $target{lib_cflags} || (),
$target{shared_cflag} || (),
@{$config{lib_cflags}},
@{$config{shared_cflag}},
'$(CNF_CFLAGS)', '$(CFLAGS)') -}
LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (),
$config{shared_ldflag} || (),
'$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
DSO_ASFLAGS={- join(' ', $target{dso_asflags} || (),
$target{module_asflags} || (),
@{$config{dso_asflags}},
@{$config{module_asflags}},
'$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (),
$target{module_cppflags} || (),
@{$config{dso_cppflags}},
@{$config{module_cppflags}},
'$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
DSO_CFLAGS={- join(' ', $target{dso_cflags} || (),
$target{module_cflags} || (),
@{$config{dso_cflags}},
@{$config{module_cflags}},
'$(CNF_CFLAGS)', '$(CFLAGS)') -}
DSO_LDFLAGS={- join(' ', $target{dso_lflags} || (),
$target{module_ldflags} || (),
@{$config{dso_lflags}},
@{$config{module_ldflags}},
'$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
BIN_ASFLAGS={- join(' ', $target{bin_asflags} || (),
@{$config{bin_asflags}},
'$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (),
@{$config{bin_cppflags}},
'$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
BIN_CFLAGS={- join(' ', $target{bin_cflags} || (),
@{$config{bin_cflags}},
'$(CNF_CFLAGS)', '$(CFLAGS)') -}
BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
@{$config{bin_lflags}},
'$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
# CPPFLAGS_Q is used for one thing only: to build up buildinf.h
CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
$cppflags2 =~ s|([\\"])|\\$1|g;
join(' ', $lib_cppflags || (), $cppflags2 || (),
$cppflags1 || ()) -}
PERLASM_SCHEME= {- $target{perlasm_scheme} -}
PROCESSOR= {- $config{processor} -}
@@ -288,6 +381,9 @@ distclean: clean
-del /Q /F makefile
depend:
@ rem {- output_off() if $disabled{makedepend}; "" -}
@ "$(PERL)" "$(SRCDIR)\util\add-depends.pl"
@ rem {- output_on() if $disabled{makedepend}; "" -}
# Install helper targets #############################################
@@ -406,7 +502,8 @@ reconfigure reconf:
sub generatesrc {
my %args = @_;
(my $target = $args{src}) =~ s/\.[sS]$/.asm/;
my $generator = '"'.join('" "', @{$args{generator}}).'"';
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 $deps = @{$args{deps}} ?
@@ -483,6 +580,9 @@ EOF
$cflags .= { lib => ' $(LIB_CPPFLAGS)',
dso => ' $(DSO_CPPFLAGS)',
bin => ' $(BIN_CPPFLAGS)' } -> {$args{intent}};
my $asflags = { lib => ' $(LIB_ASFLAGS)',
dso => ' $(DSO_ASFLAGS)',
bin => ' $(BIN_ASFLAGS)' } -> {$args{intent}};
my $makedepprog = $config{makedepprog};
if ($srcs[0] =~ /\.rc$/) {
return <<"EOF";
@@ -494,7 +594,7 @@ EOF
if ($srcs[0] =~ /\.asm$/) {
return <<"EOF";
$obj$objext: $deps
\$(AS) \$(ASFLAGS) \$(ASOUTFLAG)\$\@ $srcs
\$(AS) $asflags \$(ASOUTFLAG)\$\@ $srcs
EOF
}
return <<"EOF" if (!$disabled{makedepend});
@@ -541,7 +641,7 @@ $target: $deps
\$(LD) \$(LDFLAGS) \$(LIB_LDFLAGS) \\
/implib:\$@ \$(LDOUTFLAG)$shlib$shlibext$shared_def @<< || (DEL /Q \$(\@B).* $shlib.* && EXIT 1)
$objs
$linklibs\$(EX_LIBS)
$linklibs\$(LIB_EX_LIBS)
<<
IF EXIST $shlib$shlibext.manifest \\
\$(MT) \$(MTFLAGS) \$(MTINFLAG)$shlib$shlibext.manifest \$(MTOUTFLAG)$shlib$shlibext
@@ -572,7 +672,7 @@ EXPORTS
v_check @2
<<
$objs
$linklibs \$(EX_LIBS)
$linklibs \$(DSO_EX_LIBS)
<<
IF EXIST $dso$dsoext.manifest \\
\$(MT) \$(MTFLAGS) \$(MTINFLAG)$dso$dsoext.manifest \$(MTOUTFLAG)$dso$dsoext
@@ -612,7 +712,7 @@ $bin$exeext: $deps
\$(LD) \$(LDFLAGS) \$(BIN_LDFLAGS) \$(LDOUTFLAG)$bin$exeext @<<
$objs
setargv.obj
$linklibs\$(EX_LIBS)
$linklibs\$(BIN_EX_LIBS)
<<
IF EXIST $bin$exeext.manifest \\
\$(MT) \$(MTFLAGS) \$(MTINFLAG)$bin$exeext.manifest \$(MTOUTFLAG)$bin$exeext
Executable → Regular
+150 -112
View File
@@ -568,15 +568,31 @@ my %user_synonyms = (
HASHBANGPERL=> 'PERL',
RC => 'WINDRES',
);
my %user_to_target = (
# If not given here, the value is the lc of the key
CPPDEFINES => 'defines',
CPPINCLUDES => 'includes',
CROSS_COMPILE => 'cross_compile_prefix',
LDFLAGS => 'lflags',
LDLIBS => 'ex_libs',
# Some target attributes have been renamed, this is the translation table
my %target_attr_translate =(
ar => 'AR',
as => 'AS',
cc => 'CC',
cxx => 'CXX',
cpp => 'CPP',
hashbangperl => 'HASHBANGPERL',
ld => 'LD',
mt => 'MT',
ranlib => 'RANLIB',
rc => 'RC',
rm => 'RM',
);
# Initialisers coming from 'config' scripts
$config{defines} = [ split(/$list_separator_re/, env('__CNF_CPPDEFINES')) ],
$config{includes} = [ split(/$list_separator_re/, env('__CNF_CPPINCLUDES')) ],
$config{cppflags} = [ env('__CNF_CPPFLAGS') || () ],
$config{cflags} = [ env('__CNF_CFLAGS') || () ],
$config{cxxflags} = [ env('__CNF_CXXFLAGS') || () ],
$config{lflags} = [ env('__CNF_LDFLAGS') || () ],
$config{ex_libs} = [ env('__CNF_LDLIBS') || () ],
$config{openssl_api_defines}=[];
$config{openssl_algorithm_defines}=[];
$config{openssl_thread_defines}=[];
@@ -605,10 +621,10 @@ while (@argvcopy)
{
$user{$1} = ref $user{$1} eq "ARRAY" ? [] : undef;
}
if (exists $useradd{$1})
{
$useradd{$1} = [];
}
#if (exists $useradd{$1})
# {
# $useradd{$1} = [];
# }
next;
}
@@ -875,6 +891,33 @@ while (@argvcopy)
}
}
# If any %useradd entry has been set, we must check that the environment
# variables haven't been set. We start by checking of any %useradd entry
# is set.
if (grep { scalar @$_ > 0 } values %useradd) {
# Hash of env / make variables names. The possible values are:
# 1 - environment set
# 2 - %useradd entry set
# 3 - both set
my %detected_env =
map { my $v = 0;
$v += 1 if env($_);
$v += 2 if @{$useradd{$_}};
$_ => $v }
keys %useradd;
# If any of the corresponding environment variables is set, we error
if (grep { $_ & 1 } values %detected_env) {
my $names = join(', ', grep { $detected_env{$_} > 0 }
sort keys %detected_env);
die <<"_____";
***** Mixing env / make variables and additional compiler/linker flags as
***** configure command line option is not permitted.
***** Affected env / make variables: $names
_____
}
}
foreach (keys %user) {
my $value = env($_);
$value //= defined $user_synonyms{$_} ? env($user_synonyms{$_}) : undef;
@@ -969,13 +1012,19 @@ my %target = resolve_config($target);
&usage if (!%target || $target{template});
foreach (keys %target_attr_translate) {
$target{$target_attr_translate{$_}} = $target{$_}
if $target{$_};
delete $target{$_};
}
%target = ( %{$table{DEFAULTS}}, %target );
# Make the flags to build DSOs the same as for shared libraries unless they
# are already defined
$target{dso_cflags} = $target{shared_cflag} unless defined $target{dso_cflags};
$target{dso_cxxflags} = $target{shared_cxxflag} unless defined $target{dso_cxxflags};
$target{dso_lflags} = $target{shared_ldflag} unless defined $target{dso_lflags};
$target{module_cflags} = $target{shared_cflag} unless defined $target{module_cflags};
$target{module_cxxflags} = $target{shared_cxxflag} unless defined $target{module_cxxflags};
$target{module_ldflags} = $target{shared_ldflag} unless defined $target{module_ldflags};
{
my $shared_info_pl =
catfile(dirname($0), "Configurations", "shared-info.pl");
@@ -997,10 +1046,10 @@ $target{dso_lflags} = $target{shared_ldflag} unless defined $target{dso_lflags};
# Windows and VMS.
if (defined $si) {
# Just as above, copy certain shared_* attributes to the corresponding
# dso_ attribute unless the latter is already defined
$si->{dso_cflags} = $si->{shared_cflag} unless defined $si->{dso_cflags};
$si->{dso_cxxflags} = $si->{shared_cxxflag} unless defined $si->{dso_cxxflags};
$si->{dso_lflags} = $si->{shared_ldflag} unless defined $si->{dso_lflags};
# module_ attribute unless the latter is already defined
$si->{module_cflags} = $si->{shared_cflag} unless defined $si->{module_cflags};
$si->{module_cxxflags} = $si->{shared_cxxflag} unless defined $si->{module_cxxflags};
$si->{module_ldflags} = $si->{shared_ldflag} unless defined $si->{module_ldflags};
foreach (sort keys %$si) {
$target{$_} = defined $target{$_}
? add($si->{$_})->($target{$_})
@@ -1031,7 +1080,8 @@ foreach my $feature (@{$target{enable}}) {
}
}
$target{cxxflags}//=$target{cflags} if $target{cxx};
$target{CXXFLAGS}//=$target{CFLAGS} if $target{CXX};
$target{cxxflags}//=$target{cflags} if $target{CXX};
$target{exe_extension}="";
$target{exe_extension}=".exe" if ($config{target} eq "DJGPP"
|| $config{target} =~ /^(?:Cygwin|mingw)/);
@@ -1048,7 +1098,6 @@ $target{dso_extension}=$target{shared_extension_simple};
# the default string.
$config{perl} = ($^O ne "VMS" ? $^X : "perl");
foreach (keys %user) {
my $target_key = $user_to_target{$_} // lc $_;
my $ref_type = ref $user{$_};
# Temporary function. Takes an intended ref type (empty string or "ARRAY")
@@ -1074,12 +1123,11 @@ foreach (keys %user) {
return $value;
};
$config{$target_key} =
$config{$_} =
$mkvalue->($ref_type, $user{$_})
|| $mkvalue->($ref_type, $target{$target_key});
delete $config{$target_key} unless defined $config{$target_key};
|| $mkvalue->($ref_type, $target{$_});
delete $config{$_} unless defined $config{$_};
}
$config{plib_lflags} = [ $target{plib_lflags} ];
# Allow overriding the build file name
$config{build_file} = env('BUILDFILE') || $target{build_file} || "Makefile";
@@ -1149,10 +1197,10 @@ foreach my $checker (($builder_platform."-".$target{build_file}."-checker.pm",
push @{$config{defines}}, "NDEBUG" if $config{build_type} eq "release";
if ($target =~ /^mingw/ && `$config{cc} --target-help 2>&1` =~ m/-mno-cygwin/m)
if ($target =~ /^mingw/ && `$config{CC} --target-help 2>&1` =~ m/-mno-cygwin/m)
{
push @{$config{cflags}}, "-mno-cygwin";
push @{$config{cxxflags}}, "-mno-cygwin" if $config{cxx};
push @{$config{cxxflags}}, "-mno-cygwin" if $config{CXX};
push @{$config{shared_ldflag}}, "-mno-cygwin";
}
@@ -1164,7 +1212,7 @@ if ($target =~ /linux.*-mips/ && !$disabled{asm}
$value = '-mips2' if ($target =~ /mips32/);
$value = '-mips3' if ($target =~ /mips64/);
unshift @{$config{cflags}}, $value;
unshift @{$config{cxxflags}}, $value if $config{cxx};
unshift @{$config{cxxflags}}, $value if $config{CXX};
}
# The DSO code currently always implements all functions so that no
@@ -1178,15 +1226,15 @@ if (!$disabled{dso} && $target{dso_scheme} ne "")
$target{dso_scheme} =~ tr/[a-z]/[A-Z]/;
if ($target{dso_scheme} eq "DLFCN")
{
unshift @{$config{defines}}, "DSO_DLFCN", "HAVE_DLFCN_H";
unshift @{$config{lib_defines}}, "DSO_DLFCN", "HAVE_DLFCN_H";
}
elsif ($target{dso_scheme} eq "DLFCN_NO_H")
{
unshift @{$config{defines}}, "DSO_DLFCN";
unshift @{$config{lib_defines}}, "DSO_DLFCN";
}
else
{
unshift @{$config{defines}}, "DSO_$target{dso_scheme}";
unshift @{$config{lib_defines}}, "DSO_$target{dso_scheme}";
}
}
@@ -1237,16 +1285,16 @@ if ($target{shared_target} eq "")
}
if ($disabled{"dynamic-engine"}) {
push @{$config{defines}}, "OPENSSL_NO_DYNAMIC_ENGINE";
push @{$config{openssl_other_defines}}, "OPENSSL_NO_DYNAMIC_ENGINE";
$config{dynamic_engines} = 0;
} else {
push @{$config{defines}}, "OPENSSL_NO_STATIC_ENGINE";
push @{$config{openssl_other_defines}}, "OPENSSL_NO_STATIC_ENGINE";
$config{dynamic_engines} = 1;
}
unless ($disabled{asan}) {
push @{$config{cflags}}, "-fsanitize=address";
push @{$config{cxxflags}}, "-fsanitize=address" if $config{cxx};
push @{$config{cxxflags}}, "-fsanitize=address" if $config{CXX};
}
unless ($disabled{ubsan}) {
@@ -1254,18 +1302,18 @@ unless ($disabled{ubsan}) {
# platforms.
push @{$config{cflags}}, "-fsanitize=undefined", "-fno-sanitize-recover=all";
push @{$config{cxxflags}}, "-fsanitize=undefined", "-fno-sanitize-recover=all"
if $config{cxx};
if $config{CXX};
}
unless ($disabled{msan}) {
push @{$config{cflags}}, "-fsanitize=memory";
push @{$config{cxxflags}}, "-fsanitize=memory" if $config{cxx};
push @{$config{cxxflags}}, "-fsanitize=memory" if $config{CXX};
}
unless ($disabled{"fuzz-libfuzzer"} && $disabled{"fuzz-afl"}
&& $disabled{asan} && $disabled{ubsan} && $disabled{msan}) {
push @{$config{cflags}}, "-fno-omit-frame-pointer", "-g";
push @{$config{cxxflags}}, "-fno-omit-frame-pointer", "-g" if $config{cxx};
push @{$config{cxxflags}}, "-fno-omit-frame-pointer", "-g" if $config{CXX};
}
#
# Platform fix-ups
@@ -1275,9 +1323,9 @@ unless ($disabled{"fuzz-libfuzzer"} && $disabled{"fuzz-afl"}
if ($disabled{pic})
{
foreach (qw(shared_cflag shared_cxxflag shared_cppflag
shared_defines shared_includes shared_ldflag
dso_cflags dso_cxxflags dso_cppflags
dso_defines dso_includes dso_lflags))
shared_defines shared_includes shared_ldflag
module_cflags module_cxxflags module_cppflags
module_defines module_includes module_lflags))
{
delete $config{$_};
$target{$_} = "";
@@ -1285,7 +1333,7 @@ if ($disabled{pic})
}
else
{
push @{$config{defines}}, "OPENSSL_PIC";
push @{$config{lib_defines}}, "OPENSSL_PIC";
}
if ($target{sys_id} ne "")
@@ -1295,69 +1343,69 @@ if ($target{sys_id} ne "")
unless ($disabled{asm}) {
$target{cpuid_asm_src}=$table{DEFAULTS}->{cpuid_asm_src} if ($config{processor} eq "386");
push @{$config{defines}}, "OPENSSL_CPUID_OBJ" if ($target{cpuid_asm_src} ne "mem_clr.c");
push @{$config{lib_defines}}, "OPENSSL_CPUID_OBJ" if ($target{cpuid_asm_src} ne "mem_clr.c");
$target{bn_asm_src} =~ s/\w+-gf2m.c// if (defined($disabled{ec2m}));
# bn-586 is the only one implementing bn_*_part_words
push @{$config{defines}}, "OPENSSL_BN_ASM_PART_WORDS" if ($target{bn_asm_src} =~ /bn-586/);
push @{$config{defines}}, "OPENSSL_IA32_SSE2" if (!$disabled{sse2} && $target{bn_asm_src} =~ /86/);
push @{$config{lib_defines}}, "OPENSSL_BN_ASM_PART_WORDS" if ($target{bn_asm_src} =~ /bn-586/);
push @{$config{lib_defines}}, "OPENSSL_IA32_SSE2" if (!$disabled{sse2} && $target{bn_asm_src} =~ /86/);
push @{$config{defines}}, "OPENSSL_BN_ASM_MONT" if ($target{bn_asm_src} =~ /-mont/);
push @{$config{defines}}, "OPENSSL_BN_ASM_MONT5" if ($target{bn_asm_src} =~ /-mont5/);
push @{$config{defines}}, "OPENSSL_BN_ASM_GF2m" if ($target{bn_asm_src} =~ /-gf2m/);
push @{$config{lib_defines}}, "OPENSSL_BN_ASM_MONT" if ($target{bn_asm_src} =~ /-mont/);
push @{$config{lib_defines}}, "OPENSSL_BN_ASM_MONT5" if ($target{bn_asm_src} =~ /-mont5/);
push @{$config{lib_defines}}, "OPENSSL_BN_ASM_GF2m" if ($target{bn_asm_src} =~ /-gf2m/);
if ($target{sha1_asm_src}) {
push @{$config{defines}}, "SHA1_ASM" if ($target{sha1_asm_src} =~ /sx86/ || $target{sha1_asm_src} =~ /sha1/);
push @{$config{defines}}, "SHA256_ASM" if ($target{sha1_asm_src} =~ /sha256/);
push @{$config{defines}}, "SHA512_ASM" if ($target{sha1_asm_src} =~ /sha512/);
push @{$config{lib_defines}}, "SHA1_ASM" if ($target{sha1_asm_src} =~ /sx86/ || $target{sha1_asm_src} =~ /sha1/);
push @{$config{lib_defines}}, "SHA256_ASM" if ($target{sha1_asm_src} =~ /sha256/);
push @{$config{lib_defines}}, "SHA512_ASM" if ($target{sha1_asm_src} =~ /sha512/);
}
if ($target{rc4_asm_src} ne $table{DEFAULTS}->{rc4_asm_src}) {
push @{$config{defines}}, "RC4_ASM";
push @{$config{lib_defines}}, "RC4_ASM";
}
if ($target{md5_asm_src}) {
push @{$config{defines}}, "MD5_ASM";
push @{$config{lib_defines}}, "MD5_ASM";
}
$target{cast_asm_src}=$table{DEFAULTS}->{cast_asm_src} unless $disabled{pic}; # CAST assembler is not PIC
if ($target{rmd160_asm_src}) {
push @{$config{defines}}, "RMD160_ASM";
push @{$config{lib_defines}}, "RMD160_ASM";
}
if ($target{aes_asm_src}) {
push @{$config{defines}}, "AES_ASM" if ($target{aes_asm_src} =~ m/\baes-/);;
push @{$config{lib_defines}}, "AES_ASM" if ($target{aes_asm_src} =~ m/\baes-/);;
# aes-ctr.fake is not a real file, only indication that assembler
# module implements AES_ctr32_encrypt...
push @{$config{defines}}, "AES_CTR_ASM" if ($target{aes_asm_src} =~ s/\s*aes-ctr\.fake//);
push @{$config{lib_defines}}, "AES_CTR_ASM" if ($target{aes_asm_src} =~ s/\s*aes-ctr\.fake//);
# aes-xts.fake indicates presence of AES_xts_[en|de]crypt...
push @{$config{defines}}, "AES_XTS_ASM" if ($target{aes_asm_src} =~ s/\s*aes-xts\.fake//);
push @{$config{lib_defines}}, "AES_XTS_ASM" if ($target{aes_asm_src} =~ s/\s*aes-xts\.fake//);
$target{aes_asm_src} =~ s/\s*(vpaes|aesni)-x86\.s//g if ($disabled{sse2});
push @{$config{defines}}, "VPAES_ASM" if ($target{aes_asm_src} =~ m/vpaes/);
push @{$config{defines}}, "BSAES_ASM" if ($target{aes_asm_src} =~ m/bsaes/);
push @{$config{lib_defines}}, "VPAES_ASM" if ($target{aes_asm_src} =~ m/vpaes/);
push @{$config{lib_defines}}, "BSAES_ASM" if ($target{aes_asm_src} =~ m/bsaes/);
}
if ($target{wp_asm_src} =~ /mmx/) {
if ($config{processor} eq "386") {
$target{wp_asm_src}=$table{DEFAULTS}->{wp_asm_src};
} elsif (!$disabled{"whirlpool"}) {
push @{$config{defines}}, "WHIRLPOOL_ASM";
push @{$config{lib_defines}}, "WHIRLPOOL_ASM";
}
}
if ($target{modes_asm_src} =~ /ghash-/) {
push @{$config{defines}}, "GHASH_ASM";
push @{$config{lib_defines}}, "GHASH_ASM";
}
if ($target{ec_asm_src} =~ /ecp_nistz256/) {
push @{$config{defines}}, "ECP_NISTZ256_ASM";
push @{$config{lib_defines}}, "ECP_NISTZ256_ASM";
}
if ($target{ec_asm_src} =~ /x25519/) {
push @{$config{defines}}, "X25519_ASM";
push @{$config{lib_defines}}, "X25519_ASM";
}
if ($target{padlock_asm_src} ne $table{DEFAULTS}->{padlock_asm_src}) {
push @{$config{defines}}, "PADLOCK_ASM";
push @{$config{lib_defines}}, "PADLOCK_ASM";
}
if ($target{poly1305_asm_src} ne "") {
push @{$config{defines}}, "POLY1305_ASM";
push @{$config{lib_defines}}, "POLY1305_ASM";
}
}
my %predefined = compiler_predefined($config{cc});
my %predefined = compiler_predefined($config{CC});
# Check for makedepend capabilities.
if (!$disabled{makedepend}) {
@@ -1368,7 +1416,7 @@ if (!$disabled{makedepend}) {
} elsif ($predefined{__GNUC__} >= 3) {
# We know that GNU C version 3 and up as well as all clang
# versions support dependency generation
$config{makedepprog} = "\$(CROSS_COMPILE)$config{cc}";
$config{makedepprog} = "\$(CROSS_COMPILE)$config{CC}";
} else {
# In all other cases, we look for 'makedepend', and disable the
# capability if not found.
@@ -1410,7 +1458,7 @@ die "Exactly one of SIXTY_FOUR_BIT|SIXTY_FOUR_BIT_LONG|THIRTY_TWO_BIT can be set
$config{cflags} = [ map { (my $x = $_) =~ s/([\\\"])/\\$1/g; $x }
@{$config{cflags}} ];
$config{cxxflags} = [ map { (my $x = $_) =~ s/([\\\"])/\\$1/g; $x }
@{$config{cxxflags}} ] if $config{cxx};
@{$config{cxxflags}} ] if $config{CXX};
if (defined($config{api})) {
$config{openssl_api_defines} = [ "OPENSSL_MIN_API=".$apitable->{$config{api}} ];
@@ -1420,7 +1468,7 @@ if (defined($config{api})) {
if (defined($predefined{__clang__}) && !$disabled{asm}) {
push @{$config{cflags}}, "-Qunused-arguments";
push @{$config{cxxflags}}, "-Qunused-arguments" if $config{cxx};
push @{$config{cxxflags}}, "-Qunused-arguments" if $config{CXX};
}
if ($strict_warnings)
@@ -1436,7 +1484,7 @@ if ($strict_warnings)
push @{$config{cflags}}, $wopt
unless grep { $_ eq $wopt } @{$config{cflags}};
push @{$config{cxxflags}}, $wopt
if ($config{cxx}
if ($config{CXX}
&& !grep { $_ eq $wopt } @{$config{cxxflags}});
}
if (defined($predefined{__clang__}))
@@ -1446,7 +1494,7 @@ if ($strict_warnings)
push @{$config{cflags}}, $wopt
unless grep { $_ eq $wopt } @{$config{cflags}};
push @{$config{cxxflags}}, $wopt
if ($config{cxx}
if ($config{CXX}
&& !grep { $_ eq $wopt } @{$config{cxxflags}});
}
}
@@ -1459,7 +1507,7 @@ unless ($disabled{"crypto-mdebug-backtrace"})
push @{$config{cflags}}, $wopt
unless grep { $_ eq $wopt } @{$config{cflags}};
push @{$config{cxxflags}}, $wopt
if ($config{cxx}
if ($config{CXX}
&& !grep { $_ eq $wopt } @{$config{cxxflags}});
}
if ($target =~ /^BSD-/)
@@ -1472,7 +1520,7 @@ unless ($disabled{afalgeng}) {
$config{afalgeng}="";
if ($target =~ m/^linux/) {
my $minver = 4*10000 + 1*100 + 0;
if ($config{cross_compile_prefix} eq "") {
if ($config{CROSS_COMPILE} eq "") {
my $verstr = `uname -r`;
my ($ma, $mi1, $mi2) = split("\\.", $verstr);
($mi2) = $mi2 =~ /(\d+)/;
@@ -1499,12 +1547,10 @@ foreach (keys %useradd) {
die "internal error: \$useradd{$_} isn't an ARRAY\n"
unless ref $useradd{$_} eq 'ARRAY';
my $target_key = $user_to_target{$_} // lc $_;
if (defined $config{$target_key}) {
push @{$config{$target_key}}, @{$useradd{$_}};
if (defined $config{$_}) {
push @{$config{$_}}, @{$useradd{$_}};
} else {
$config{$target_key} = [ @{$useradd{$_}} ];
$config{$_} = [ @{$useradd{$_}} ];
}
}
@@ -1641,6 +1687,10 @@ if ($builder eq "unified") {
my %sharednames = ();
my %generate = ();
# We want to detect configdata.pm in the source tree, so we
# don't use it if the build tree is different.
my $src_configdata = cleanfile($srcdir, "configdata.pm", $blddir);
push @{$config{build_infos}}, catfile(abs2rel($sourced, $blddir), $f);
my $template =
Text::Template->new(TYPE => 'FILE',
@@ -1937,7 +1987,7 @@ EOF
# If it isn't in the source tree, we assume it's generated
# in the build tree
if (! -f $s || $generate{$_}) {
if ($s eq $src_configdata || ! -f $s || $generate{$_}) {
$s = cleanfile($buildd, $_, $blddir);
}
# We recognise C++, C and asm files
@@ -1965,7 +2015,7 @@ EOF
# If it isn't in the source tree, we assume it's generated
# in the build tree
if (! -f $s || $generate{$_}) {
if ($s eq $src_configdata || ! -f $s || $generate{$_}) {
$s = cleanfile($buildd, $_, $blddir);
}
@@ -2015,7 +2065,7 @@ EOF
# If the destination doesn't exist in source, it can only be
# a generated file in the build tree.
if ($ddest ne "" && ! -f $ddest) {
if ($ddest ne "" && ($ddest eq $src_configdata || ! -f $ddest)) {
$ddest = cleanfile($buildd, $_, $blddir);
if ($unified_info{rename}->{$ddest}) {
$ddest = $unified_info{rename}->{$ddest};
@@ -2029,7 +2079,8 @@ EOF
# in the build tree rather than the source tree, and assume
# and that there are lines to build it in a BEGINRAW..ENDRAW
# section or in the Makefile template.
if (! -f $d
if ($d eq $src_configdata
|| ! -f $d
|| (grep { $d eq $_ }
map { cleanfile($srcdir, $_, $blddir) }
grep { /\.h$/ } keys %{$unified_info{generate}})) {
@@ -2056,7 +2107,7 @@ EOF
# If the destination doesn't exist in source, it can only be
# a generated file in the build tree.
if (! -f $ddest) {
if ($ddest eq $src_configdata || ! -f $ddest) {
$ddest = cleanfile($buildd, $_, $blddir);
if ($unified_info{rename}->{$ddest}) {
$ddest = $unified_info{rename}->{$ddest};
@@ -2089,16 +2140,12 @@ EOF
next if $dest eq "";
foreach my $d (keys %{$unified_info{depends}->{$dest}}) {
next unless $d =~ /\.(h|pm)$/;
if ($d eq "configdata.pm"
|| defined($unified_info{generate}->{$d})) {
my $i = cleandir($blddir, dirname($d));
push @{$unified_info{includes}->{$dest}->{build}}, $i
unless grep { $_ eq $i } @{$unified_info{includes}->{$dest}->{build}};
} else {
my $i = cleandir($srcdir, dirname($d));
push @{$unified_info{includes}->{$dest}->{source}}, $i
unless grep { $_ eq $i } @{$unified_info{includes}->{$dest}->{source}};
}
my $i = dirname($d);
my $spot =
$d eq "configdata.pm" || defined($unified_info{generate}->{$d})
? 'build' : 'source';
push @{$unified_info{includes}->{$dest}->{$spot}}, $i
unless grep { $_ eq $i } @{$unified_info{includes}->{$dest}->{$spot}};
}
}
@@ -2168,7 +2215,7 @@ foreach (grep /_(asm|aux)_src$/, keys %target) {
print "Creating configdata.pm\n";
open(OUT,">configdata.pm") || die "unable to create configdata.pm: $!\n";
print OUT <<"EOF";
#! $config{hashbangperl}
#! $config{HASHBANGPERL}
package configdata;
@@ -2306,10 +2353,9 @@ EOF
}
print OUT
"# The following data is only used when this files is use as a script\n";
print OUT "my \%makevars = (\n";
print OUT "my \@makevars = (\n";
foreach (sort keys %user) {
print OUT ' ',$_,' ' x (20 - length $_),'=> ',
"'",$user_to_target{$_} || lc $_,"',\n";
print OUT " '",$_,"',\n";
}
print OUT ");\n";
print OUT "my \%disabled_info = (\n";
@@ -2440,16 +2486,17 @@ _____
}
if ($dump || $makevars) {
print "\nMakevars:\n\n";
foreach my $var (sort keys %makevars) {
foreach my $var (@makevars) {
my $prefix = '';
$prefix = $config{cross_compile_prefix}
$prefix = $config{CROSS_COMPILE}
if grep { $var eq $_ } @user_crossable;
$prefix //= '';
print ' ',$var,' ' x (16 - length $var),'= ',
(ref $config{$makevars{$var}} eq 'ARRAY'
? join(' ', @{$config{$makevars{$var}}})
: $prefix.$config{$makevars{$var}}),
(ref $config{$var} eq 'ARRAY'
? join(' ', @{$config{$var}})
: $prefix.$config{$var}),
"\n"
if defined $config{$makevars{$var}};
if defined $config{$var};
}
my @buildfile = ($config{builddir}, $config{build_file});
@@ -2619,14 +2666,6 @@ or position independent code, please let us know (but please first make sure
you have tried with a current version of OpenSSL).
EOF
print <<"EOF" if (-f catfile($srcdir, "configdata.pm") && $srcdir ne $blddir);
WARNING: there are indications that another build was made in the source
directory. This build may have picked up artifacts from that build, the
safest course of action is to clean the source directory and redo this
configuration.
EOF
print <<"EOF";
**********************************************************************
@@ -3007,11 +3046,11 @@ sub compiler_predefined {
return () if $^O eq 'VMS';
die 'compiler_predefines called without a default compiler'
die 'compiler_predefined called without a default compiler'
unless $default_compiler;
if (! $predefined{$default_compiler}) {
my $cc = "$config{cross_compile_prefix}$default_compiler";
my $cc = "$config{CROSS_COMPILE}$default_compiler";
$predefined{$default_compiler} = {};
@@ -3084,7 +3123,6 @@ sub print_table_entry
"ld",
"lflags",
"loutflag",
"plib_lflags",
"ex_libs",
"bn_ops",
"apps_aux_src",
+3 -21
View File
@@ -581,30 +581,12 @@
RCFLAGS Flags for the Windows reources manipulator.
RM The command to remove files and directories.
These can be mixed with flags given on the command line.
Any variable assignment resets any corresponding flags
given before it, so for example:
These cannot be mixed with compiling / linking flags given
on the command line. In other words, something like this
isn't permitted.
./config -DFOO CPPFLAGS=-DBAR -DCOOKIE
Will end up having 'CPPFLAGS=-DBAR -DCOOKIE'.
Here is how the flags documented above are collected as
augmentation of these variables:
-Dxxx xxx is collected in CPPDEFINES
-Ixxx xxx is collected in CPPINCLUDES
-Wp,xxx collected in CPPFLAGS
-Lxxx collected in LDFLAGS
-lxxx collected in LDLIBS
-Wp,xxx collected in LDLIBS
-rpath xxx collected in LDLIBS
-R xxx collected in LDLIBS
-framework xxx collected in LDLIBS
-static collected in LDLIBS
-xxx collected in CFLAGS
+xxx collected in CFLAGS
reconf
reconfigure
Reconfigure from earlier data. This fetches the previous
+1 -1
View File
@@ -1,5 +1,5 @@
OpenSSL 1.1.1-pre2 (alpha) 27 Feb 2018
OpenSSL 1.1.1-pre3-dev
Copyright (c) 1998-2018 The OpenSSL Project
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
+1 -1
View File
@@ -1,4 +1,4 @@
#!{- $config{hashbangperl} -}
#!{- $config{HASHBANGPERL} -}
# Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the OpenSSL license (the "License"). You may not use
+137
View File
@@ -25,6 +25,12 @@
#endif
#include <ctype.h>
#include <errno.h>
#ifdef __VMS
# include <descrip.h>
# include <iledef.h>
# include <fscndef.h>
# include <starlet.h>
#endif
#include <openssl/err.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
@@ -1532,12 +1538,27 @@ CA_DB *load_index(const char *dbfile, DB_ATTR *db_attr)
BIO *in;
CONF *dbattr_conf = NULL;
char buf[BSIZE];
#ifndef OPENSSL_NO_POSIX_IO
FILE *dbfp;
struct stat dbst;
#endif
in = BIO_new_file(dbfile, "r");
if (in == NULL) {
ERR_print_errors(bio_err);
goto err;
}
#ifndef OPENSSL_NO_POSIX_IO
BIO_get_fp(in, &dbfp);
if (fstat(fileno(dbfp), &dbst) == -1) {
SYSerr(SYS_F_FSTAT, errno);
ERR_add_error_data(3, "fstat('", dbfile, "')");
ERR_print_errors(bio_err);
goto err;
}
#endif
if ((tmpdb = TXT_DB_read(in, DB_NUMBER)) == NULL)
goto err;
@@ -1564,6 +1585,11 @@ CA_DB *load_index(const char *dbfile, DB_ATTR *db_attr)
}
}
retdb->dbfname = OPENSSL_strdup(dbfile);
#ifndef OPENSSL_NO_POSIX_IO
retdb->dbst = dbst;
#endif
err:
NCONF_free(dbattr_conf);
TXT_DB_free(tmpdb);
@@ -1709,6 +1735,7 @@ void free_index(CA_DB *db)
{
if (db) {
TXT_DB_free(db->db);
OPENSSL_free(db->dbfname);
OPENSSL_free(db);
}
}
@@ -2340,6 +2367,116 @@ int app_isdir(const char *name)
}
#endif
/* app_dirname section */
/*
* This exactly follows what POSIX's
* dirname does, but is implemented
* in a more platform independent way.
*
* path dirname
* /usr/lib /usr
* /usr/ /
* usr .
* / /
* . .
* .. .
* "" .
*
* Note: this function also keeps the
* possibility of modifying the 'path'
* string same as POSIX dirname.
*/
static char *posix_dirname(char *path)
{
size_t l;
char *ret = ".";
l = strlen(path);
if (l == 0)
goto out;
if (strcmp(path, ".") == 0)
goto out;
if (strcmp(path, "..") == 0)
goto out;
if (strcmp(path, "/") == 0) {
ret = "/";
goto out;
}
if (path[l - 1] == '/') {
/* /usr/ */
path[l - 1] = '\0';
}
if ((ret = strrchr(path, '/')) == NULL) {
/* usr */
ret = ".";
} else if (ret == path) {
/* /usr */
*++ret = '\0';
ret = path;
} else {
/* /usr/lib */
*ret = '\0';
ret = path;
}
out:
return ret;
}
/*
* TODO: implement app_dirname for Windows.
*/
#if !defined(_WIN32)
char *app_dirname(char *path)
{
return posix_dirname(path);
}
#elif defined(__VMS)
/*
* sys$filescan fills the given item list with pointers into the original
* path string, so all we need to do is to find the file name and simply
* put a NUL byte wherever the FSCN$_NAME pointer points. If there is no
* file name part and the path string isn't the empty string, we know for
* a fact that the whole string is a directory spec and return it as is.
* Otherwise or if that pointer is the starting address of the original
* path string, we know to return "sys$disk:[]", which corresponds to the
* Unixly ".".
*
* If sys$filescan returns an error status, we know that this is not
* parsable as a VMS file spec, and then use the fallback, in case we
* have a Unix type path.
*/
char *app_dirname(char *path)
{
char *ret = "sys$disk:[]";
struct dsc$descriptor_s dsc_path = { 0 };
ile2 itemlist[] = {
{0, FSCN$_NAME, 0},
{0, 0, 0}
};
int fields;
int status;
dsc_path.dsc$a_pointer = path;
dsc_path.dsc$w_length = strlen(path);
status = sys$filescan(&dsc_path, itemlist, &fields, 0, 0);
if (!(status & 1))
return posix_dirname(path);
if ((fields & (1 << FSCN$_NAME)) == 0) {
if (dsc_path.dsc$w_length != 0)
ret = path;
} else if (itemlist[0].ile2$ps_bufaddr != path) {
if (itemlist[0].ile2$ps_bufaddr != path) {
*itemlist[0].ile2$ps_bufaddr = '\0';
ret = path;
}
}
return ret;
}
#endif
/* raw_read|write section */
#if defined(__VMS)
# include "vms_term_sock.h"
+11
View File
@@ -14,6 +14,12 @@
# include "internal/nelem.h"
# include <assert.h>
# include <sys/types.h>
# ifndef OPENSSL_NO_POSIX_IO
# include <sys/stat.h>
# include <fcntl.h>
# endif
# include <openssl/e_os2.h>
# include <openssl/ossl_typ.h>
# include <openssl/bio.h>
@@ -509,6 +515,10 @@ typedef struct db_attr_st {
typedef struct ca_db_st {
DB_ATTR attributes;
TXT_DB *db;
char *dbfname;
# ifndef OPENSSL_NO_POSIX_IO
struct stat dbst;
# endif
} CA_DB;
void* app_malloc(int sz, const char *what);
@@ -594,6 +604,7 @@ void store_setup_crl_download(X509_STORE *st);
int app_isdir(const char *);
int app_access(const char *, int flag);
char *app_dirname(char *path);
int fileno_stdin(void);
int fileno_stdout(void);
int raw_read_stdin(void *, int);
+1 -1
View File
@@ -44,7 +44,7 @@ const OPTIONS genrsa_options[] = {
{"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, 's', "Output the key to specified file"},
{"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"},
+322 -55
View File
@@ -26,6 +26,7 @@ NON_EMPTY_TRANSLATION_UNIT
/* Needs to be included before the openssl headers */
# include "apps.h"
# include "progs.h"
# include "internal/sockets.h"
# include <openssl/e_os2.h>
# include <openssl/crypto.h>
# include <openssl/err.h>
@@ -33,6 +34,23 @@ NON_EMPTY_TRANSLATION_UNIT
# include <openssl/evp.h>
# include <openssl/bn.h>
# include <openssl/x509v3.h>
# include <openssl/rand.h>
# if defined(OPENSSL_SYS_UNIX) && !defined(OPENSSL_NO_SOCK)
# define OCSP_DAEMON
# include <sys/types.h>
# include <sys/wait.h>
# include <syslog.h>
# include <signal.h>
# define MAXERRLEN 1000 /* limit error text sent to syslog to 1000 bytes */
# else
# undef LOG_INFO
# undef LOG_WARNING
# undef LOG_ERR
# define LOG_INFO 0
# define LOG_WARNING 1
# define LOG_ERR 2
# endif
/* Maximum leeway in validity period: default 5 minutes */
# define MAX_VALIDITY_PERIOD (5 * 60)
@@ -56,8 +74,19 @@ static void make_ocsp_response(BIO *err, OCSP_RESPONSE **resp, OCSP_REQUEST *req
static char **lookup_serial(CA_DB *db, ASN1_INTEGER *ser);
static BIO *init_responder(const char *port);
static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio);
static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio, int timeout);
static int send_ocsp_response(BIO *cbio, OCSP_RESPONSE *resp);
static void log_message(int level, const char *fmt, ...);
static char *prog;
static int multi = 0;
# ifdef OCSP_DAEMON
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);
# endif
# ifndef OPENSSL_NO_SOCK
static OCSP_RESPONSE *query_responder(BIO *cbio, const char *host,
@@ -81,7 +110,8 @@ typedef enum OPTION_choice {
OPT_INDEX, OPT_CA, OPT_NMIN, OPT_REQUEST, OPT_NDAYS, OPT_RSIGNER,
OPT_RKEY, OPT_ROTHER, OPT_RMD, OPT_RSIGOPT, OPT_HEADER,
OPT_V_ENUM,
OPT_MD
OPT_MD,
OPT_MULTI
} OPTION_CHOICE;
const OPTIONS ocsp_options[] = {
@@ -101,6 +131,9 @@ const OPTIONS ocsp_options[] = {
"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"},
{"no_signature_verify", OPT_NO_SIGNATURE_VERIFY, '-',
@@ -197,13 +230,10 @@ int ocsp_main(int argc, char **argv)
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;
#ifndef OPENSSL_NO_SOCK
int req_timeout = -1;
#endif
long nsec = MAX_VALIDITY_PERIOD, maxage = -1;
unsigned long sign_flags = 0, verify_flags = 0, rflags = 0;
OPTION_CHOICE o;
char *prog;
reqnames = sk_OPENSSL_STRING_new_null();
if (reqnames == NULL)
@@ -451,9 +481,13 @@ int ocsp_main(int argc, char **argv)
goto opthelp;
trailing_md = 1;
break;
case OPT_MULTI:
# ifdef OCSP_DAEMON
multi = atoi(opt_arg());
# endif
break;
}
}
if (trailing_md) {
BIO_printf(bio_err, "%s: Digest must be before -cert or -serial\n",
prog);
@@ -464,7 +498,7 @@ int ocsp_main(int argc, char **argv)
goto opthelp;
/* Have we anything to do? */
if (req == NULL&& reqin == NULL
if (req == NULL && reqin == NULL
&& respin == NULL && !(port != NULL && ridx_filename != NULL))
goto opthelp;
@@ -514,14 +548,53 @@ int ocsp_main(int argc, char **argv)
if (rkey == NULL)
goto end;
}
if (ridx_filename != NULL
&& (rkey != NULL || rsigner != NULL || rca_cert != NULL)) {
BIO_printf(bio_err,
"Responder mode requires certificate, key, and CA.\n");
goto end;
}
if (ridx_filename != NULL) {
rdb = load_index(ridx_filename, NULL);
if (rdb == NULL || !index_index(rdb)) {
ret = 1;
goto end;
}
}
# ifdef OCSP_DAEMON
if (multi && acbio != NULL)
spawn_loop();
if (acbio != NULL && req_timeout > 0)
signal(SIGALRM, sock_timeout);
#endif
if (acbio != NULL)
BIO_printf(bio_err, "Waiting for OCSP client connections...\n");
log_message(LOG_INFO, "waiting for OCSP client connections...");
redo_accept:
if (acbio != NULL) {
if (!do_responder(&req, &cbio, acbio))
goto end;
# ifdef OCSP_DAEMON
if (index_changed(rdb)) {
CA_DB *newrdb = load_index(ridx_filename, NULL);
if (newrdb != NULL) {
free_index(rdb);
rdb = newrdb;
} else {
log_message(LOG_ERR, "error reloading updated index: %s",
ridx_filename);
}
}
# endif
req = NULL;
if (!do_responder(&req, &cbio, acbio, req_timeout))
goto redo_accept;
if (req == NULL) {
resp =
OCSP_response_create(OCSP_RESPONSE_STATUS_MALFORMEDREQUEST,
@@ -577,21 +650,6 @@ redo_accept:
BIO_free(derbio);
}
if (ridx_filename != NULL
&& (rkey == NULL || rsigner == NULL || rca_cert == NULL)) {
BIO_printf(bio_err,
"Need a responder certificate, key and CA for this operation!\n");
goto end;
}
if (ridx_filename != NULL && rdb == NULL) {
rdb = load_index(ridx_filename, NULL);
if (rdb == NULL)
goto end;
if (!index_index(rdb))
goto end;
}
if (rdb != NULL) {
make_ocsp_response(bio_err, &resp, req, rdb, rca_cert, rsigner, rkey,
rsign_md, rsign_sigopts, rother, rflags, nmin, ndays, badsig);
@@ -637,10 +695,10 @@ redo_accept:
if (i != OCSP_RESPONSE_STATUS_SUCCESSFUL) {
BIO_printf(out, "Responder Error: %s (%d)\n",
OCSP_response_status_str(i), i);
if (ignore_err)
goto redo_accept;
ret = 0;
goto end;
if (!ignore_err) {
ret = 0;
goto end;
}
}
if (resp_text)
@@ -746,6 +804,180 @@ redo_accept:
return ret;
}
static void
log_message(int level, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
# ifdef OCSP_DAEMON
if (multi) {
vsyslog(level, fmt, ap);
if (level >= LOG_ERR)
ERR_print_errors_cb(print_syslog, &level);
}
# endif
if (!multi) {
BIO_printf(bio_err, "%s: ", prog);
BIO_vprintf(bio_err, fmt, ap);
BIO_printf(bio_err, "\n");
}
va_end(ap);
}
# ifdef OCSP_DAEMON
static int print_syslog(const char *str, size_t len, void *levPtr)
{
int level = *(int *)levPtr;
int ilen = (len > MAXERRLEN) ? MAXERRLEN : len;
syslog(level, "%.*s", ilen, str);
return ilen;
}
static int index_changed(CA_DB *rdb)
{
struct stat sb;
if (rdb != NULL && stat(rdb->dbfname, &sb) != -1) {
if (rdb->dbst.st_mtime != sb.st_mtime
|| rdb->dbst.st_ctime != sb.st_ctime
|| rdb->dbst.st_ino != sb.st_ino
|| rdb->dbst.st_dev != sb.st_dev) {
syslog(LOG_INFO, "index file changed, reloading");
return 1;
}
}
return 0;
}
static void killall(int ret, pid_t *kidpids)
{
int i;
for (i = 0; i < multi; ++i)
if (kidpids[i] != 0)
(void)kill(kidpids[i], SIGTERM);
sleep(1);
exit(ret);
}
static int termsig = 0;
static void noteterm (int sig)
{
termsig = sig;
}
/*
* Loop spawning up to `multi` child processes, only child processes return
* from this function. The parent process loops until receiving a termination
* signal, kills extant children and exits without returning.
*/
static void spawn_loop(void)
{
const char *signame;
pid_t *kidpids = NULL;
int status;
int procs = 0;
int i;
openlog(prog, LOG_PID, LOG_DAEMON);
if (setpgid(0, 0)) {
syslog(LOG_ERR, "fatal: error detaching from parent process group: %s",
strerror(errno));
exit(1);
}
kidpids = app_malloc(multi * sizeof(*kidpids), "child PID array");
for (i = 0; i < multi; ++i)
kidpids[i] = 0;
signal(SIGINT, noteterm);
signal(SIGTERM, noteterm);
while (termsig == 0) {
pid_t fpid;
/*
* Wait for a child to replace when we're at the limit.
* Slow down if a child exited abnormally or waitpid() < 0
*/
while (termsig == 0 && procs >= multi) {
if ((fpid = waitpid(-1, &status, 0)) > 0) {
for (i = 0; i < procs; ++i) {
if (kidpids[i] == fpid) {
kidpids[i] = 0;
--procs;
break;
}
}
if (i >= multi) {
syslog(LOG_ERR, "fatal: internal error: "
"no matching child slot for pid: %ld",
(long) fpid);
killall(1, kidpids);
}
if (status != 0) {
if (WIFEXITED(status))
syslog(LOG_WARNING, "child process: %ld, exit status: %d",
(long)fpid, WEXITSTATUS(status));
else if (WIFSIGNALED(status))
syslog(LOG_WARNING, "child process: %ld, term signal %d%s",
(long)fpid, WTERMSIG(status),
WCOREDUMP(status) ? " (core dumped)" : "");
sleep(1);
}
break;
} else if (errno != EINTR) {
syslog(LOG_ERR, "fatal: waitpid(): %s", strerror(errno));
killall(1, kidpids);
}
}
if (termsig)
break;
switch(fpid = fork()) {
case -1: /* error */
/* System critically low on memory, pause and try again later */
sleep(30);
break;
case 0: /* child */
signal(SIGINT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
if (termsig)
_exit(0);
if (RAND_poll() <= 0) {
syslog(LOG_ERR, "fatal: RAND_poll() failed");
_exit(1);
}
return;
default: /* parent */
for (i = 0; i < multi; ++i) {
if (kidpids[i] == 0) {
kidpids[i] = fpid;
procs++;
break;
}
}
if (i >= multi) {
syslog(LOG_ERR, "fatal: internal error: no free child slots");
killall(1, kidpids);
}
break;
}
}
/* The loop above can only break on termsig */
signame = strsignal(termsig);
syslog(LOG_INFO, "terminating on signal: %s(%d)",
signame ? signame : "", termsig);
killall(0, kidpids);
}
# endif
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert,
const EVP_MD *cert_id_md, X509 *issuer,
STACK_OF(OCSP_CERTID) *ids)
@@ -1035,16 +1267,14 @@ static BIO *init_responder(const char *port)
if (acbio == NULL
|| BIO_set_bind_mode(acbio, BIO_BIND_REUSEADDR) < 0
|| BIO_set_accept_port(acbio, port) < 0) {
BIO_printf(bio_err, "Error setting up accept BIO\n");
ERR_print_errors(bio_err);
log_message(LOG_ERR, "Error setting up accept BIO");
goto err;
}
BIO_set_accept_bios(acbio, bufbio);
bufbio = NULL;
if (BIO_do_accept(acbio) <= 0) {
BIO_printf(bio_err, "Error starting accept\n");
ERR_print_errors(bio_err);
log_message(LOG_ERR, "Error starting accept");
goto err;
}
@@ -1083,7 +1313,16 @@ static int urldecode(char *p)
}
# endif
static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio)
# ifdef OCSP_DAEMON
static void sock_timeout(int signum)
{
if (acfd != (int)INVALID_SOCKET)
(void)shutdown(acfd, SHUT_RD);
}
# endif
static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio,
int timeout)
{
# ifdef OPENSSL_NO_SOCK
return 0;
@@ -1093,27 +1332,37 @@ static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio)
char inbuf[2048], reqbuf[2048];
char *p, *q;
BIO *cbio = NULL, *getbio = NULL, *b64 = NULL;
const char *client;
if (BIO_do_accept(acbio) <= 0) {
BIO_printf(bio_err, "Error accepting connection\n");
ERR_print_errors(bio_err);
*preq = NULL;
/* Connection loss before accept() is routine, ignore silently */
if (BIO_do_accept(acbio) <= 0)
return 0;
}
cbio = BIO_pop(acbio);
*pcbio = cbio;
client = BIO_get_peer_name(cbio);
# ifdef OCSP_DAEMON
if (timeout > 0) {
(void) BIO_get_fd(cbio, &acfd);
alarm(timeout);
}
# endif
/* Read the request line. */
len = BIO_gets(cbio, reqbuf, sizeof(reqbuf));
if (len <= 0)
return 1;
goto out;
if (strncmp(reqbuf, "GET ", 4) == 0) {
/* Expecting GET {sp} /URL {sp} HTTP/1.x */
for (p = reqbuf + 4; *p == ' '; ++p)
continue;
if (*p != '/') {
BIO_printf(bio_err, "Invalid request -- bad URL\n");
return 1;
log_message(LOG_INFO, "Invalid request -- bad URL: %s", client);
goto out;
}
p++;
@@ -1122,37 +1371,51 @@ static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio)
if (*q == ' ')
break;
if (strncmp(q, " HTTP/1.", 8) != 0) {
BIO_printf(bio_err, "Invalid request -- bad HTTP version\n");
return 1;
log_message(LOG_INFO,
"Invalid request -- bad HTTP version: %s", client);
goto out;
}
*q = '\0';
/*
* Skip "GET / HTTP..." requests often used by load-balancers
*/
if (p[1] == '\0')
goto out;
len = urldecode(p);
if (len <= 0) {
BIO_printf(bio_err, "Invalid request -- bad URL encoding\n");
return 1;
log_message(LOG_INFO,
"Invalid request -- bad URL encoding: %s", client);
goto out;
}
if ((getbio = BIO_new_mem_buf(p, len)) == NULL
|| (b64 = BIO_new(BIO_f_base64())) == NULL) {
BIO_printf(bio_err, "Could not allocate memory\n");
ERR_print_errors(bio_err);
return 1;
log_message(LOG_ERR, "Could not allocate base64 bio: %s", client);
goto out;
}
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
getbio = BIO_push(b64, getbio);
} else if (strncmp(reqbuf, "POST ", 5) != 0) {
BIO_printf(bio_err, "Invalid request -- bad HTTP verb\n");
return 1;
log_message(LOG_INFO, "Invalid request -- bad HTTP verb: %s", client);
goto out;
}
/* Read and skip past the headers. */
for (;;) {
len = BIO_gets(cbio, inbuf, sizeof(inbuf));
if (len <= 0)
return 1;
goto out;
if ((inbuf[0] == '\r') || (inbuf[0] == '\n'))
break;
}
# ifdef OCSP_DAEMON
/* Clear alarm before we close the client socket */
alarm(0);
timeout = 0;
# endif
/* Try to read OCSP request */
if (getbio != NULL) {
req = d2i_OCSP_REQUEST_bio(getbio, NULL);
@@ -1161,13 +1424,17 @@ static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio)
req = d2i_OCSP_REQUEST_bio(cbio, NULL);
}
if (req == NULL) {
BIO_printf(bio_err, "Error parsing OCSP request\n");
ERR_print_errors(bio_err);
}
if (req == NULL)
log_message(LOG_ERR, "Error parsing OCSP request");
*preq = req;
out:
# ifdef OCSP_DAEMON
if (timeout > 0)
alarm(0);
acfd = (int)INVALID_SOCKET;
# endif
return 1;
# endif
}
+4
View File
@@ -3,6 +3,10 @@
# This is mostly being used for generation of certificate requests.
#
# Note that you can include other files from the main configuration
# file using the .include directive.
#.include filename
# This definition stops the following lines choking if HOME isn't
# defined.
HOME = .
+4
View File
@@ -3,6 +3,10 @@
# This is mostly being used for generation of certificate requests.
#
# Note that you can include other files from the main configuration
# file using the .include directive.
#.include filename
# This definition stops the following lines choking if HOME isn't
# defined.
HOME = .
+36 -5
View File
@@ -613,13 +613,17 @@ int opt_verify(int opt, X509_VERIFY_PARAM *vpm)
*/
int opt_next(void)
{
char *p;
char *p, *estr;
const OPTIONS *o;
int ival;
long lval;
unsigned long ulval;
ossl_intmax_t imval;
ossl_uintmax_t umval;
#if !defined(_WIN32)
char *c;
int oerrno;
#endif
/* Look at current arg; at end of the list? */
arg = NULL;
@@ -676,13 +680,13 @@ int opt_next(void)
/* Just a string. */
break;
case '/':
if (app_isdir(arg) >= 0)
if (app_isdir(arg) > 0)
break;
BIO_printf(bio_err, "%s: Not a directory: %s\n", prog, arg);
return -1;
case '<':
/* Input file. */
if (strcmp(arg, "-") == 0 || app_access(arg, R_OK) >= 0)
if (strcmp(arg, "-") == 0 || app_access(arg, R_OK) == 0)
break;
BIO_printf(bio_err,
"%s: Cannot open input file %s, %s\n",
@@ -690,11 +694,38 @@ int opt_next(void)
return -1;
case '>':
/* Output file. */
if (strcmp(arg, "-") == 0 || app_access(arg, W_OK) >= 0 || errno == ENOENT)
#if !defined(_WIN32)
c = OPENSSL_strdup(arg);
if (c == NULL) {
BIO_printf(bio_err,
"%s: Memory allocation failure\n", prog);
return -1;
}
oerrno = errno;
errno = 0;
if (strcmp(arg, "-") == 0
|| (app_access(app_dirname(c), W_OK) == 0
&& app_isdir(arg) <= 0
&& (app_access(arg, W_OK) == 0 || errno == ENOENT))) {
OPENSSL_free(c);
break;
}
OPENSSL_free(c);
if (errno == 0)
/* only possible if 'arg' is a directory */
estr = "is a directory";
else
estr = strerror(errno);
errno = oerrno;
#else
if (strcmp(arg, "-") == 0 || app_access(arg, W_OK) == 0
|| errno == ENOENT)
break;
estr = strerror(errno);
#endif
BIO_printf(bio_err,
"%s: Cannot open output file %s, %s\n",
prog, arg, strerror(errno));
prog, arg, estr);
return -1;
case 'p':
case 'n':
-19
View File
@@ -293,24 +293,6 @@ static int ends_with_dirsep(const char *path)
return *path == '/';
}
static int massage_filename(char *name)
{
# ifdef __VMS
char *p = strchr(name, ';');
char *q = p;
if (q != NULL) {
for (q++; *q != '\0'; q++) {
if (!isdigit((unsigned char)*q))
return 1;
}
}
*p = '\0';
# endif
return 1;
}
/*
* Process a directory; return number of errors found.
*/
@@ -346,7 +328,6 @@ static int do_dir(const char *dirname, enum Hash h)
}
while ((filename = OPENSSL_DIR_read(&d, dirname)) != NULL) {
if ((copy = strdup(filename)) == NULL
|| !massage_filename(copy)
|| sk_OPENSSL_STRING_push(files, copy) == 0) {
BIO_puts(bio_err, "out of memory\n");
exit(1);
+5
View File
@@ -58,6 +58,11 @@ int generate_cookie_callback(SSL *ssl, unsigned char *cookie,
int verify_cookie_callback(SSL *ssl, const unsigned char *cookie,
unsigned int cookie_len);
int generate_stateless_cookie_callback(SSL *ssl, unsigned char *cookie,
size_t *cookie_len);
int verify_stateless_cookie_callback(SSL *ssl, const unsigned char *cookie,
size_t cookie_len);
typedef struct ssl_excert_st SSL_EXCERT;
void ssl_ctx_set_excert(SSL_CTX *ctx, SSL_EXCERT *exc);
+21 -2
View File
@@ -231,6 +231,9 @@ static const char *get_sigtype(int nid)
case NID_ED25519:
return "Ed25519";
case NID_ED448:
return "Ed448";
default:
return NULL;
}
@@ -533,9 +536,9 @@ static STRINT_PAIR handshakes[] = {
{", CertificateVerify", SSL3_MT_CERTIFICATE_VERIFY},
{", ClientKeyExchange", SSL3_MT_CLIENT_KEY_EXCHANGE},
{", Finished", SSL3_MT_FINISHED},
{", CertificateUrl", 21},
{", CertificateUrl", SSL3_MT_CERTIFICATE_URL},
{", CertificateStatus", SSL3_MT_CERTIFICATE_STATUS},
{", SupplementalData", 23},
{", SupplementalData", SSL3_MT_SUPPLEMENTAL_DATA},
{", KeyUpdate", SSL3_MT_KEY_UPDATE},
#ifndef OPENSSL_NO_NEXTPROTONEG
{", NextProto", SSL3_MT_NEXT_PROTO},
@@ -752,6 +755,22 @@ int verify_cookie_callback(SSL *ssl, const unsigned char *cookie,
return 0;
}
int generate_stateless_cookie_callback(SSL *ssl, unsigned char *cookie,
size_t *cookie_len)
{
unsigned int temp;
int res = generate_cookie_callback(ssl, cookie, &temp);
*cookie_len = temp;
return res;
}
int verify_stateless_cookie_callback(SSL *ssl, const unsigned char *cookie,
size_t cookie_len)
{
return verify_cookie_callback(ssl, cookie, cookie_len);
}
#endif
/*
+5 -11
View File
@@ -197,19 +197,13 @@ static int psk_use_session_cb(SSL *s, const EVP_MD *md,
return 0;
}
if (key_len == EVP_MD_size(EVP_sha256()))
cipher = SSL_CIPHER_find(s, tls13_aes128gcmsha256_id);
else if (key_len == EVP_MD_size(EVP_sha384()))
cipher = SSL_CIPHER_find(s, tls13_aes256gcmsha384_id);
/* We default to SHA-256 */
cipher = SSL_CIPHER_find(s, tls13_aes128gcmsha256_id);
if (cipher == NULL) {
/* Doesn't look like a suitable TLSv1.3 key. Ignore it */
OPENSSL_free(key);
*id = NULL;
*idlen = 0;
*sess = NULL;
return 1;
BIO_printf(bio_err, "Error finding suitable ciphersuite\n");
return 0;
}
usesess = SSL_SESSION_new();
if (usesess == NULL
|| !SSL_SESSION_set1_master_key(usesess, key, key_len)
+9 -7
View File
@@ -208,14 +208,10 @@ static int psk_find_session_cb(SSL *ssl, const unsigned char *identity,
return 0;
}
if (key_len == EVP_MD_size(EVP_sha256()))
cipher = SSL_CIPHER_find(ssl, tls13_aes128gcmsha256_id);
else if (key_len == EVP_MD_size(EVP_sha384()))
cipher = SSL_CIPHER_find(ssl, tls13_aes256gcmsha384_id);
/* We default to SHA256 */
cipher = SSL_CIPHER_find(ssl, tls13_aes128gcmsha256_id);
if (cipher == NULL) {
/* Doesn't look like a suitable TLSv1.3 key. Ignore it */
OPENSSL_free(key);
BIO_printf(bio_err, "Error finding suitable ciphersuite\n");
return 0;
}
@@ -1570,6 +1566,8 @@ int s_server_main(int argc, char *argv[])
break;
case OPT_EARLY_DATA:
early_data = 1;
if (max_early_data == -1)
max_early_data = SSL3_RT_MAX_PLAIN_LENGTH;
break;
}
}
@@ -2040,6 +2038,10 @@ int s_server_main(int argc, char *argv[])
SSL_CTX_set_cookie_generate_cb(ctx, generate_cookie_callback);
SSL_CTX_set_cookie_verify_cb(ctx, verify_cookie_callback);
/* Set TLS1.3 cookie generation and verification callbacks */
SSL_CTX_set_stateless_cookie_generate_cb(ctx, generate_stateless_cookie_callback);
SSL_CTX_set_stateless_cookie_verify_cb(ctx, verify_stateless_cookie_callback);
if (ctx2 != NULL) {
SSL_CTX_set_verify(ctx2, s_server_verify, verify_callback);
if (!SSL_CTX_set_session_id_context(ctx2,
+1 -1
View File
@@ -30,7 +30,7 @@ const OPTIONS sess_id_options[] = {
{"outform", OPT_OUTFORM, 'f',
"Output format - default PEM (PEM, DER or NSS)"},
{"in", OPT_IN, 's', "Input file - default stdin"},
{"out", OPT_OUT, 's', "Output file - default stdout"},
{"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"},
+6 -4
View File
@@ -118,7 +118,7 @@
#define RSA_NUM 7
#define DSA_NUM 3
#define EC_NUM 17
#define EC_NUM 18
#define MAX_ECDH_SIZE 256
#define MISALIGN 64
@@ -533,6 +533,7 @@ static OPT_PAIR rsa_choices[] = {
#define R_EC_B409 14
#define R_EC_B571 15
#define R_EC_X25519 16
#define R_EC_X448 17
#ifndef OPENSSL_NO_EC
static OPT_PAIR ecdsa_choices[] = {
{"ecdsap160", R_EC_P160},
@@ -572,6 +573,7 @@ static OPT_PAIR ecdh_choices[] = {
{"ecdhb409", R_EC_B409},
{"ecdhb571", R_EC_B571},
{"ecdhx25519", R_EC_X25519},
{"ecdhx448", R_EC_X448},
{NULL}
};
#endif
@@ -1377,7 +1379,7 @@ int speed_main(int argc, char **argv)
NID_sect233r1, NID_sect283r1, NID_sect409r1,
NID_sect571r1,
/* Other */
NID_X25519
NID_X25519, NID_X448
};
static const char *test_curves_names[EC_NUM] = {
/* Prime Curves */
@@ -1389,7 +1391,7 @@ int speed_main(int argc, char **argv)
"nistb233", "nistb283", "nistb409",
"nistb571",
/* Other */
"X25519"
"X25519", "X448"
};
static const int test_curves_bits[EC_NUM] = {
160, 192, 224,
@@ -1397,7 +1399,7 @@ int speed_main(int argc, char **argv)
163, 233, 283,
409, 571, 163,
233, 283, 409,
571, 253 /* X25519 */
571, 253, 448
};
int ecdsa_doit[EC_NUM] = { 0 };
+4
View File
@@ -1,10 +1,14 @@
/*
* Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved.
* Copyright (c) 2004, EdelKey Project. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*
* Originally written by Christophe Renou and Peter Sylvester,
* for the EdelKey project.
*/
#include <openssl/opensslconf.h>
+1
View File
@@ -14,6 +14,7 @@
#include <openssl/err.h>
#include <openssl/pem.h>
#include <openssl/store.h>
#include <openssl/x509v3.h> /* s2i_ASN1_INTEGER */
static int process(const char *uri, const UI_METHOD *uimeth, PW_CB_DATA *uidata,
int expected, int criterion, OSSL_STORE_SEARCH *search,
+1 -1
View File
@@ -1,4 +1,4 @@
#!{- $config{hashbangperl} -}
#!{- $config{HASHBANGPERL} -}
# Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
# Copyright (c) 2002 The OpenTSA Project. All rights reserved.
#
+2 -1
View File
@@ -105,7 +105,8 @@ opthelp:
dirty = version = 1;
break;
case OPT_A:
seed = cflags = version = date = platform = dir = engdir = 1;
seed = options = cflags = version = date = platform = dir = engdir
= 1;
break;
}
}
Executable → Regular
+78 -25
View File
@@ -40,6 +40,15 @@ EOF
esac
done
# Environment that's being passed to Configure
__CNF_CPPDEFINES=
__CNF_CPPINCLUDES=
__CNF_CPPFLAGS=
__CNF_CFLAGS=
__CNF_CXXFLAGS=
__CNF_LDFLAGS=
__CNF_LDLIBS=
# First get uname entries that we use below
[ "$MACHINE" ] || MACHINE=`(uname -m) 2>/dev/null` || MACHINE="unknown"
@@ -504,10 +513,12 @@ case "$GUESSOS" in
OUT="darwin64-x86_64-cc"
fi ;;
armv6+7-*-iphoneos)
options="$options -arch%20armv6 -arch%20armv7"
__CNF_CFLAGS="$__CNF_CFLAGS -arch%20armv6 -arch%20armv7"
__CNF_CXXFLAGS="$__CNF_CXXFLAGS -arch%20armv6 -arch%20armv7"
OUT="iphoneos-cross" ;;
*-*-iphoneos)
options="$options -arch%20${MACHINE}"
__CNF_CFLAGS="$__CNF_CFLAGS -arch%20${MACHINE}"
__CNF_CXXFLAGS="$__CNF_CXXFLAGS -arch%20${MACHINE}"
OUT="iphoneos-cross" ;;
arm64-*-iphoneos|*-*-ios64)
OUT="ios64-cross" ;;
@@ -519,9 +530,12 @@ case "$GUESSOS" in
esac
if [ "$CC" = "gcc" ]; then
case ${ISA:-generic} in
EV5|EV45) options="$options -mcpu=ev5";;
EV56|PCA56) options="$options -mcpu=ev56";;
*) options="$options -mcpu=ev6";;
EV5|EV45) __CNF_CFLAGS="$__CNF_CFLAGS -mcpu=ev5"
__CNF_CXXFLAGS="$__CNF_CFLAGS -mcpu=ev5";;
EV56|PCA56) __CNF_CFLAGS="$__CNF_CFLAGS -mcpu=ev56"
__CNF_CXXFLAGS="$__CNF_CXXFLAGS -mcpu=ev56";;
*) __CNF_CFLAGS="$__CNF_CFLAGS -mcpu=ev6"
__CNF_CXXFLAGS="$__CNF_CXXFLAGS -mcpu=ev6";;
esac
fi
;;
@@ -538,7 +552,12 @@ case "$GUESSOS" in
OUT="linux-ppc64"
else
OUT="linux-ppc"
(echo "__LP64__" | gcc -E -x c - 2>/dev/null | grep "^__LP64__" 2>&1 > /dev/null) || options="$options -m32"
if (echo "__LP64__" | gcc -E -x c - 2>/dev/null | grep "^__LP64__" 2>&1 > /dev/null); then
:;
else
__CNF_CFLAGS="$__CNF_CFLAGS -m32"
__CNF_CXXFLAGS="$__CNF_CXXFLAGS -m32"
fi
fi
;;
ppc64le-*-linux2) OUT="linux-ppc64le" ;;
@@ -574,7 +593,8 @@ case "$GUESSOS" in
sun4u*) OUT="linux-sparcv9" ;;
sun4m) OUT="linux-sparcv8" ;;
sun4d) OUT="linux-sparcv8" ;;
*) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
*) OUT="linux-generic32";
__CNF_CPPFLAGS="$__CNF_CPPFLAGS -DB_ENDIAN" ;;
esac ;;
parisc*-*-linux2)
# 64-bit builds under parisc64 linux are not supported and
@@ -596,16 +616,25 @@ case "$GUESSOS" in
CPUSCHEDULE=`echo $CPUSCHEDULE|sed -e 's/7300LC/7100LC/' -e 's/8.00/8000/'`
# Finish Model transformations
options="$options -DB_ENDIAN -mschedule=$CPUSCHEDULE -march=$CPUARCH"
__CNF_CPPFLAGS="$__CNF_CPPFLAGS -DB_ENDIAN"
__CNF_CFLAGS="$__CNF_CFLAGS -mschedule=$CPUSCHEDULE -march=$CPUARCH"
__CNF_CXXFLAGS="$__CNF_CXXFLAGS -mschedule=$CPUSCHEDULE -march=$CPUARCH"
OUT="linux-generic32" ;;
armv[1-3]*-*-linux2) OUT="linux-generic32" ;;
armv[7-9]*-*-linux2) OUT="linux-armv4"; options="$options -march=armv7-a" ;;
armv[7-9]*-*-linux2) OUT="linux-armv4"
__CNF_CFLAGS="$__CNF_CFLAGS -march=armv7-a"
__CNF_CXXFLAGS="$__CNF_CXXFLAGS -march=armv7-a"
;;
arm*-*-linux2) OUT="linux-armv4" ;;
aarch64-*-linux2) OUT="linux-aarch64" ;;
sh*b-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
sh*-*-linux2) OUT="linux-generic32"; options="$options -DL_ENDIAN" ;;
m68k*-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
s390-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
sh*b-*-linux2) OUT="linux-generic32";
__CNF_CPPFLAGS="$__CNF_CPPFLAGS -DB_ENDIAN" ;;
sh*-*-linux2) OUT="linux-generic32";
__CNF_CPPFLAGS="$__CNF_CPPFLAGS -DL_ENDIAN" ;;
m68k*-*-linux2) OUT="linux-generic32";
__CNF_CPPFLAGS="$__CNF_CPPFLAGS -DB_ENDIAN" ;;
s390-*-linux2) OUT="linux-generic32";
__CNF_CPPFLAGS="$__CNF_CPPFLAGS -DB_ENDIAN" ;;
s390x-*-linux2)
# To be uncommented when glibc bug is fixed, see Configure...
#if egrep -e '^features.* highgprs' /proc/cpuinfo >/dev/null ; then
@@ -687,9 +716,12 @@ case "$GUESSOS" in
;;
*-*-sunos4) OUT="sunos-$CC" ;;
*86*-*-bsdi4) OUT="BSD-x86-elf"; options="$options no-sse2 -ldl" ;;
alpha*-*-*bsd*) OUT="BSD-generic64"; options="$options -DL_ENDIAN" ;;
powerpc64-*-*bsd*) OUT="BSD-generic64"; options="$options -DB_ENDIAN" ;;
*86*-*-bsdi4) OUT="BSD-x86-elf"; options="$options no-sse2";
__CNF_LDFLAGS="$__CNF_LDFLAGS -ldl" ;;
alpha*-*-*bsd*) OUT="BSD-generic64";
__CNF_CPPFLAGS="$__CNF_CPPFLAGS -DL_ENDIAN" ;;
powerpc64-*-*bsd*) OUT="BSD-generic64";
__CNF_CPPFLAGS="$__CNF_CPPFLAGS -DB_ENDIAN" ;;
sparc64-*-*bsd*) OUT="BSD-sparc64" ;;
ia64-*-*bsd*) OUT="BSD-ia64" ;;
x86_64-*-dragonfly*) OUT="BSD-x86_64" ;;
@@ -716,7 +748,8 @@ case "$GUESSOS" in
if [ "$CC" = "gcc" ]; then
OUT="unixware-7-gcc" ; options="$options no-sse2"
else
OUT="unixware-7" ; options="$options no-sse2 -D__i386__"
OUT="unixware-7" ; options="$options no-sse2"
__CNF_CPPFLAGS="$__CNF_CPPFLAGS -D__i386__"
fi
;;
*-*-[Uu]nix[Ww]are20*) OUT="unixware-2.0"; options="$options no-sse2 no-sha512" ;;
@@ -763,7 +796,7 @@ case "$GUESSOS" in
else # Motorola(?) CPU
OUT="hpux-$CC"
fi
options="$options -D_REENTRANT" ;;
__CNF_CPPFLAGS="$__CNF_CPPFLAGS -D_REENTRANT" ;;
*-hpux) OUT="hpux-parisc-$CC" ;;
*-aix)
[ "$KERNEL_BITS" ] || KERNEL_BITS=`(getconf KERNEL_BITMODE) 2>/dev/null`
@@ -802,7 +835,9 @@ case "$GUESSOS" in
*-*-qnx6) OUT="QNX6" ;;
x86-*-android|i?86-*-android) OUT="android-x86" ;;
armv[7-9]*-*-android)
OUT="android-armeabi"; options="$options -march=armv7-a" ;;
OUT="android-armeabi"
__CNF_CFLAGS="$__CNF_CFLAGS -march=armv7-a"
__CNF_CXXFLAGS="$__CNF_CXXFLAGS -march=armv7-a";;
arm*-*-android) OUT="android-armeabi" ;;
*) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
esac
@@ -816,7 +851,7 @@ esac
# See whether we can compile Atalla support
#if [ -f /usr/include/atasi.h ]
#then
# options="$options -DATALLA"
# __CNF_CPPFLAGS="$__CNF_CPPFLAGS -DATALLA"
#fi
if [ -n "$CONFIG_OPTIONS" ]; then
@@ -824,9 +859,11 @@ if [ -n "$CONFIG_OPTIONS" ]; then
fi
if expr "$options" : '.*no\-asm' > /dev/null; then :; else
sh -c "$CROSS_COMPILE${CC:-gcc} -Wa,--help -c -o /tmp/null.$$.o -x assembler /dev/null && rm /tmp/null.$$.o" 2>&1 | \
grep \\--noexecstack >/dev/null && \
options="$options -Wa,--noexecstack"
if sh -c "$CROSS_COMPILE${CC:-gcc} -Wa,--help -c -o /tmp/null.$$.o -x assembler /dev/null && rm /tmp/null.$$.o" 2>&1 | \
grep \\--noexecstack >/dev/null; then
__CNF_CFLAGS="$__CNF_CFLAGS -Wa,--noexecstack"
__CNF_CXXFLAGS="$__CNF_CXXFLAGS -Wa,--noexecstack"
fi
fi
# gcc < 2.8 does not support -march=ultrasparc
@@ -900,12 +937,28 @@ OUT="$OUT"
$PERL $THERE/Configure LIST | grep "$OUT" > /dev/null
if [ $? = "0" ]; then
if [ "$VERBOSE" = "true" ]; then
echo $PERL $THERE/Configure $OUT $options
echo /usr/bin/env \
__CNF_CPPDEFINES="'$__CNF_CPPDEFINES'" \
__CNF_CPPINCLUDES="'$__CNF_CPPINCLUDES'" \
__CNF_CPPFLAGS="'$__CNF_CPPFLAGS'" \
__CNF_CFLAGS="'$__CNF_CFLAGS'" \
__CNF_CXXFLAGS="'$__CNF_CXXFLAGS'" \
__CNF_LDFLAGS="'$__CNF_LDFLAGS'" \
__CNF_LDLIBS="'$__CNF_LDLIBS'" \
$PERL $THERE/Configure $OUT $options
fi
if [ "$DRYRUN" = "false" ]; then
# eval to make sure quoted options, possibly with spaces inside,
# are treated right
eval $PERL $THERE/Configure $OUT $options
eval /usr/bin/env \
__CNF_CPPDEFINES="'$__CNF_CPPDEFINES'" \
__CNF_CPPINCLUDES="'$__CNF_CPPINCLUDES'" \
__CNF_CPPFLAGS="'$__CNF_CPPFLAGS'" \
__CNF_CFLAGS="'$__CNF_CFLAGS'" \
__CNF_CXXFLAGS="'$__CNF_CXXFLAGS'" \
__CNF_LDFLAGS="'$__CNF_LDFLAGS'" \
__CNF_LDLIBS="'$__CNF_LDLIBS'" \
$PERL $THERE/Configure $OUT $options
fi
else
echo "This system ($OUT) is not supported. See file INSTALL for details."
+37 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2016 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -11,7 +11,7 @@
* This file is dual-licensed and is also available under the following
* terms:
*
* Copyright (c) 2004, Richard Levitte <richard@levitte.org>
* Copyright (c) 2004, 2018, Richard Levitte <richard@levitte.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -46,6 +46,9 @@
#ifndef LPDIR_H
# include "LPdir.h"
#endif
#ifdef __VMS
# include <ctype.h>
#endif
/*
* The POSIXly macro for the maximum number of characters in a file path is
@@ -73,6 +76,10 @@
struct LP_dir_context_st {
DIR *dir;
char entry_name[LP_ENTRY_SIZE + 1];
#ifdef __VMS
int expect_file_generations;
char previous_entry_name[LP_ENTRY_SIZE + 1];
#endif
};
const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
@@ -93,6 +100,15 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
}
memset(*ctx, 0, sizeof(**ctx));
#ifdef __VMS
{
char c = directory[strlen(directory) - 1];
if (c == ']' || c == '>' || c == ':')
(*ctx)->expect_file_generations = 1;
}
#endif
(*ctx)->dir = opendir(directory);
if ((*ctx)->dir == NULL) {
int save_errno = errno; /* Probably not needed, but I'm paranoid */
@@ -103,6 +119,13 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
}
}
#ifdef __VMS
strncpy((*ctx)->previous_entry_name, (*ctx)->entry_name,
sizeof((*ctx)->previous_entry_name));
again:
#endif
direntry = readdir((*ctx)->dir);
if (direntry == NULL) {
return 0;
@@ -111,6 +134,18 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
strncpy((*ctx)->entry_name, direntry->d_name,
sizeof((*ctx)->entry_name) - 1);
(*ctx)->entry_name[sizeof((*ctx)->entry_name) - 1] = '\0';
#ifdef __VMS
if ((*ctx)->expect_file_generations) {
char *p = (*ctx)->entry_name + strlen((*ctx)->entry_name);
while(p > (*ctx)->entry_name && isdigit(p[-1]))
p--;
if (p > (*ctx)->entry_name && p[-1] == ';')
p[-1] = '\0';
if (strcasecmp((*ctx)->entry_name, (*ctx)->previous_entry_name) == 0)
goto again;
}
#endif
return (*ctx)->entry_name;
}
Executable → Regular
View File
+3 -3
View File
@@ -203,7 +203,7 @@ AES_encrypt:
adr r3,.
#endif
stmdb sp!,{r1,r4-r12,lr}
#ifdef __APPLE__
#if defined(__thumb2__) || defined(__APPLE__)
adr $tbl,AES_Te
#else
sub $tbl,r3,#AES_encrypt-AES_Te @ Te
@@ -481,7 +481,7 @@ _armv4_AES_set_encrypt_key:
mov lr,r1 @ bits
mov $key,r2 @ key
#ifdef __APPLE__
#if defined(__thumb2__) || defined(__APPLE__)
adr $tbl,AES_Te+1024 @ Te4
#else
sub $tbl,r3,#_armv4_AES_set_encrypt_key-AES_Te-1024 @ Te4
@@ -979,7 +979,7 @@ AES_decrypt:
adr r3,.
#endif
stmdb sp!,{r1,r4-r12,lr}
#ifdef __APPLE__
#if defined(__thumb2__) || defined(__APPLE__)
adr $tbl,AES_Td
#else
sub $tbl,r3,#AES_decrypt-AES_Td @ Td
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
+3 -3
View File
@@ -742,7 +742,7 @@ $code.=<<___;
_bsaes_decrypt8:
adr $const,.
vldmia $key!, {@XMM[9]} @ round 0 key
#ifdef __APPLE__
#if defined(__thumb2__) || defined(__APPLE__)
adr $const,.LM0ISR
#else
add $const,$const,#.LM0ISR-_bsaes_decrypt8
@@ -841,7 +841,7 @@ _bsaes_const:
_bsaes_encrypt8:
adr $const,.
vldmia $key!, {@XMM[9]} @ round 0 key
#ifdef __APPLE__
#if defined(__thumb2__) || defined(__APPLE__)
adr $const,.LM0SR
#else
sub $const,$const,#_bsaes_encrypt8-.LM0SR
@@ -949,7 +949,7 @@ $code.=<<___;
_bsaes_key_convert:
adr $const,.
vld1.8 {@XMM[7]}, [$inp]! @ load round 0 key
#ifdef __APPLE__
#if defined(__thumb2__) || defined(__APPLE__)
adr $const,.LM0
#else
sub $const,$const,#_bsaes_key_convert-.LM0
Executable → Regular
View File
Executable → Regular
View File
+1 -1
View File
@@ -191,7 +191,7 @@ void OPENSSL_cpuid_setup(void)
_armv8_sha256_probe();
OPENSSL_armcap_P |= ARMV8_SHA256;
}
# ifdef __aarch64__
# if defined(__aarch64__) && !defined(__APPLE__)
if (sigsetjmp(ill_jmp, 1) == 0) {
_armv8_sha512_probe();
OPENSSL_armcap_P |= ARMV8_SHA512;
+2
View File
@@ -42,6 +42,7 @@ static const EVP_PKEY_ASN1_METHOD *standard_methods[] = {
#endif
#ifndef OPENSSL_NO_EC
&ecx25519_asn1_meth,
&ecx448_asn1_meth,
#endif
#ifndef OPENSSL_NO_POLY1305
&poly1305_asn1_meth,
@@ -51,6 +52,7 @@ static const EVP_PKEY_ASN1_METHOD *standard_methods[] = {
#endif
#ifndef OPENSSL_NO_EC
&ed25519_asn1_meth,
&ed448_asn1_meth,
#endif
};
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
+4 -6
View File
@@ -112,7 +112,7 @@ int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom)
/* random number r: 0 <= r < range */
static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range)
{
int b, n;
int n;
int count = 100;
if (range->neg || BN_is_zero(range)) {
@@ -132,11 +132,9 @@ static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range)
* than range
*/
do {
b = flag == NORMAL
? BN_rand(r, n + 1, BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY)
: BN_priv_rand(r, n + 1, BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY);
if (!b)
if (!bnrand(flag, r, n + 1, BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY))
return 0;
/*
* If r < 3*range, use r := r MOD range (which is either r, r -
* range, or r - 2*range). Otherwise, iterate once more. Since
@@ -161,7 +159,7 @@ static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range)
} else {
do {
/* range = 11..._2 or range = 101..._2 */
if (!BN_rand(r, n, BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY))
if (!bnrand(flag, r, n, BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY))
return 0;
if (!--count) {
+1 -1
View File
@@ -11,7 +11,7 @@ EXTRA= ../ms/uplink-x86.pl ../ms/uplink.c ../ms/applink.c \
ppccpuid.pl pariscid.pl alphacpuid.pl arm64cpuid.pl armv4cpuid.pl
DEPEND[cversion.o]=buildinf.h
GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC) $(CFLAGS) $(CPPFLAGS_Q)" "$(PLATFORM)"
GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC) $(LIB_CFLAGS) $(CPPFLAGS_Q)" "$(PLATFORM)"
DEPEND[buildinf.h]=../configdata.pm
GENERATE[uplink-x86.s]=../ms/uplink-x86.pl $(PERLASM_SCHEME)
View File
View File
View File
Executable → Regular
View File
View File
Executable → Regular
View File
View File
+204 -14
View File
@@ -1,5 +1,5 @@
/*
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -12,12 +12,20 @@
#include <stdio.h>
#include <string.h>
#include "internal/cryptlib.h"
#include "internal/o_dir.h"
#include <openssl/lhash.h>
#include <openssl/conf.h>
#include <openssl/conf_api.h>
#include "conf_def.h"
#include <openssl/buffer.h>
#include <openssl/err.h>
#ifndef OPENSSL_NO_POSIX_IO
# include <sys/stat.h>
# ifdef _WIN32
# define stat _stat
# define strcasecmp _stricmp
# endif
#endif
/*
* The maximum length we can grow a value to after variable expansion. 64k
@@ -26,12 +34,18 @@
#define MAX_CONF_VALUE_LENGTH 65536
static char *eat_ws(CONF *conf, char *p);
static void trim_ws(CONF *conf, char *start);
static char *eat_alpha_numeric(CONF *conf, char *p);
static void clear_comments(CONF *conf, char *p);
static int str_copy(CONF *conf, char *section, char **to, char *from);
static char *scan_quote(CONF *conf, char *p);
static char *scan_dquote(CONF *conf, char *p);
#define scan_esc(conf,p) (((IS_EOF((conf),(p)[1]))?((p)+1):((p)+2)))
#ifndef OPENSSL_NO_POSIX_IO
static BIO *process_include(char *include, OPENSSL_DIR_CTX **dirctx,
char **dirpath);
static BIO *get_next_file(const char *path, OPENSSL_DIR_CTX **dirctx);
#endif
static CONF *def_create(CONF_METHOD *meth);
static int def_init_default(CONF *conf);
@@ -173,6 +187,11 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
char *section = NULL, *buf;
char *start, *psection, *pname;
void *h = (void *)(conf->data);
STACK_OF(BIO) *biosk = NULL;
#ifndef OPENSSL_NO_POSIX_IO
char *dirpath = NULL;
OPENSSL_DIR_CTX *dirctx = NULL;
#endif
if ((buff = BUF_MEM_new()) == NULL) {
CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_BUF_LIB);
@@ -205,11 +224,39 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
}
p = &(buff->data[bufnum]);
*p = '\0';
read_retry:
BIO_gets(in, p, CONFBUFSIZE - 1);
p[CONFBUFSIZE - 1] = '\0';
ii = i = strlen(p);
if (i == 0 && !again)
break;
if (i == 0 && !again) {
/* the currently processed BIO is at EOF */
BIO *parent;
#ifndef OPENSSL_NO_POSIX_IO
/* continue processing with the next file from directory */
if (dirctx != NULL) {
BIO *next;
if ((next = get_next_file(dirpath, &dirctx)) != NULL) {
BIO_vfree(in);
in = next;
goto read_retry;
} else {
OPENSSL_free(dirpath);
dirpath = NULL;
}
}
#endif
/* no more files in directory, continue with processing parent */
if ((parent = sk_BIO_pop(biosk)) == NULL) {
/* everything processed get out of the loop */
break;
} else {
BIO_vfree(in);
in = parent;
goto read_retry;
}
}
again = 0;
while (i > 0) {
if ((p[i - 1] != '\r') && (p[i - 1] != '\n'))
@@ -285,7 +332,6 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
continue;
} else {
pname = s;
psection = NULL;
end = eat_alpha_numeric(conf, s);
if ((end[0] == ':') && (end[1] == ':')) {
*end = '\0';
@@ -293,29 +339,57 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
psection = pname;
pname = end;
end = eat_alpha_numeric(conf, end);
} else {
psection = section;
}
p = eat_ws(conf, end);
if (*p != '=') {
if (strncmp(pname, ".include", 8) == 0 && p != pname + 8) {
char *include = NULL;
BIO *next;
trim_ws(conf, p);
if (!str_copy(conf, psection, &include, p))
goto err;
/* get the BIO of the included file */
#ifndef OPENSSL_NO_POSIX_IO
next = process_include(include, &dirctx, &dirpath);
if (include != dirpath) {
/* dirpath will contain include in case of a directory */
OPENSSL_free(include);
}
#else
next = BIO_new_file(include, "r");
OPENSSL_free(include);
#endif
if (next != NULL) {
/* push the currently processing BIO onto stack */
if (biosk == NULL) {
if ((biosk = sk_BIO_new_null()) == NULL) {
CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
goto err;
}
}
if (!sk_BIO_push(biosk, in)) {
CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
goto err;
}
/* continue with reading from the included BIO */
in = next;
}
continue;
} else if (*p != '=') {
CONFerr(CONF_F_DEF_LOAD_BIO, CONF_R_MISSING_EQUAL_SIGN);
goto err;
}
*end = '\0';
p++;
start = eat_ws(conf, p);
while (!IS_EOF(conf, *p))
p++;
p--;
while ((p != start) && (IS_WS(conf, *p)))
p--;
p++;
*p = '\0';
trim_ws(conf, start);
if ((v = OPENSSL_malloc(sizeof(*v))) == NULL) {
CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
goto err;
}
if (psection == NULL)
psection = section;
v->name = OPENSSL_strdup(pname);
v->value = NULL;
if (v->name == NULL) {
@@ -345,10 +419,17 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
}
BUF_MEM_free(buff);
OPENSSL_free(section);
sk_BIO_pop_free(biosk, BIO_vfree);
return 1;
err:
BUF_MEM_free(buff);
OPENSSL_free(section);
sk_BIO_pop_free(biosk, BIO_vfree);
#ifndef OPENSSL_NO_POSIX_IO
OPENSSL_free(dirpath);
if (dirctx != NULL)
OPENSSL_DIR_end(&dirctx);
#endif
if (line != NULL)
*line = eline;
BIO_snprintf(btmp, sizeof(btmp), "%ld", eline);
@@ -555,6 +636,102 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
return 0;
}
#ifndef OPENSSL_NO_POSIX_IO
/*
* Check whether included path is a directory.
* Returns next BIO to process and in case of a directory
* also an opened directory context and the include path.
*/
static BIO *process_include(char *include, OPENSSL_DIR_CTX **dirctx,
char **dirpath)
{
struct stat st = { 0 };
BIO *next;
if (stat(include, &st) < 0) {
SYSerr(SYS_F_STAT, errno);
ERR_add_error_data(1, include);
/* missing include file is not fatal error */
return NULL;
}
if ((st.st_mode & S_IFDIR) == S_IFDIR) {
if (*dirctx != NULL) {
CONFerr(CONF_F_PROCESS_INCLUDE,
CONF_R_RECURSIVE_DIRECTORY_INCLUDE);
ERR_add_error_data(1, include);
return NULL;
}
/* a directory, load its contents */
if ((next = get_next_file(include, dirctx)) != NULL)
*dirpath = include;
return next;
}
next = BIO_new_file(include, "r");
return next;
}
/*
* Get next file from the directory path.
* Returns BIO of the next file to read and updates dirctx.
*/
static BIO *get_next_file(const char *path, OPENSSL_DIR_CTX **dirctx)
{
const char *filename;
while ((filename = OPENSSL_DIR_read(dirctx, path)) != NULL) {
size_t namelen;
namelen = strlen(filename);
if ((namelen > 5 && strcasecmp(filename + namelen - 5, ".conf") == 0)
|| (namelen > 4 && strcasecmp(filename + namelen - 4, ".cnf") == 0)) {
size_t newlen;
char *newpath;
BIO *bio;
newlen = strlen(path) + namelen + 2;
newpath = OPENSSL_zalloc(newlen);
if (newpath == NULL) {
CONFerr(CONF_F_GET_NEXT_FILE, ERR_R_MALLOC_FAILURE);
break;
}
#ifdef OPENSSL_SYS_VMS
/*
* If the given path isn't clear VMS syntax,
* we treat it as on Unix.
*/
{
size_t pathlen = strlen(path);
if (path[pathlen - 1] == ']' || path[pathlen - 1] == '>'
|| path[pathlen - 1] == ':') {
/* Clear VMS directory syntax, just copy as is */
OPENSSL_strlcpy(newpath, path, newlen);
}
}
#endif
if (newpath[0] == '\0') {
OPENSSL_strlcpy(newpath, path, newlen);
OPENSSL_strlcat(newpath, "/", newlen);
}
OPENSSL_strlcat(newpath, filename, newlen);
bio = BIO_new_file(newpath, "r");
OPENSSL_free(newpath);
/* Errors when opening files are non-fatal. */
if (bio != NULL)
return bio;
}
}
OPENSSL_DIR_end(dirctx);
*dirctx = NULL;
return NULL;
}
#endif
static char *eat_ws(CONF *conf, char *p)
{
while (IS_WS(conf, *p) && (!IS_EOF(conf, *p)))
@@ -562,6 +739,19 @@ static char *eat_ws(CONF *conf, char *p)
return p;
}
static void trim_ws(CONF *conf, char *start)
{
char *p = start;
while (!IS_EOF(conf, *p))
p++;
p--;
while ((p >= start) && IS_WS(conf, *p))
p--;
p++;
*p = '\0';
}
static char *eat_alpha_numeric(CONF *conf, char *p)
{
for (;;) {
+5 -1
View File
@@ -1,6 +1,6 @@
/*
* Generated by util/mkerr.pl DO NOT EDIT
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -20,6 +20,7 @@ static const ERR_STRING_DATA CONF_str_functs[] = {
{ERR_PACK(ERR_LIB_CONF, CONF_F_CONF_PARSE_LIST, 0), "CONF_parse_list"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_DEF_LOAD, 0), "def_load"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_DEF_LOAD_BIO, 0), "def_load_bio"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_GET_NEXT_FILE, 0), "get_next_file"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_MODULE_INIT, 0), "module_init"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_MODULE_LOAD_DSO, 0), "module_load_dso"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_MODULE_RUN, 0), "module_run"},
@@ -33,6 +34,7 @@ static const ERR_STRING_DATA CONF_str_functs[] = {
{ERR_PACK(ERR_LIB_CONF, CONF_F_NCONF_LOAD_BIO, 0), "NCONF_load_bio"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_NCONF_LOAD_FP, 0), "NCONF_load_fp"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_NCONF_NEW, 0), "NCONF_new"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_PROCESS_INCLUDE, 0), "process_include"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_STR_COPY, 0), "str_copy"},
{0, NULL}
};
@@ -56,6 +58,8 @@ static const ERR_STRING_DATA CONF_str_reasons[] = {
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_NO_SECTION), "no section"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_NO_SUCH_FILE), "no such file"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_NO_VALUE), "no value"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_RECURSIVE_DIRECTORY_INCLUDE),
"recursive directory include"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_UNABLE_TO_CREATE_NEW_SECTION),
"unable to create new section"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_UNKNOWN_MODULE_NAME),
View File
View File
View File
View File
View File
View File
Executable → Regular
+7 -16
View File
@@ -40,12 +40,12 @@
# P4 +22% +40%
# Sandy Bridge -3% +11%
# Haswell -1% +13%
# Broadwell(***) +26% +30%
# Skylake(***) +30% +47%
# Broadwell(***) +30% +35%
# Skylake(***) +33% +47%
# Silvermont +20% +26%
# Goldmont +40% +50%
# Bulldozer +20% +9%
# Ryzen(***) +35% +32%
# Ryzen(***) +43% +40%
# VIA +170% +120%
#
# (*) amd64-51 is popular assembly implementation with 2^51 radix,
@@ -631,13 +631,10 @@ x25519_fe64_sqr:
and \$38,%rax
add %rax,$acc0
adc \$0,$acc1
mov $acc0,8*0(%rdi)
adc \$0,$acc2
mov $acc1,8*1(%rdi)
adc \$0,$acc3
mov $acc2,8*2(%rdi)
mov $acc3,8*3(%rdi)
mov $acc0,8*0(%rdi)
mov 8*3(%rsp),%r15
mov 8*4(%rsp),%r14
@@ -674,13 +671,10 @@ x25519_fe64_mul121666:
and \$38,%rax
add %rax,$acc0
adc \$0,$acc1
mov $acc0,8*0(%rdi)
adc \$0,$acc2
mov $acc1,8*1(%rdi)
adc \$0,$acc3
mov $acc2,8*2(%rdi)
mov $acc3,8*3(%rdi)
mov $acc0,8*0(%rdi)
ret
.size x25519_fe64_mul121666,.-x25519_fe64_mul121666
@@ -769,14 +763,11 @@ x25519_fe64_tobytes:
and \$19,%rax
add %rax,$acc0
adc \$0,$acc1
adc \$0,$acc2
adc \$0,$acc3
mov $acc0,8*0(%rdi)
mov $acc1,8*1(%rdi)
mov $acc2,8*2(%rdi)
mov $acc3,8*3(%rdi)
mov $acc0,8*0(%rdi)
ret
.size x25519_fe64_tobytes,.-x25519_fe64_tobytes
@@ -815,4 +806,4 @@ ___
$code =~ s/\`([^\`]*)\`/eval $1/gem;
print $code;
close $STDOUT;
close STDOUT;
+2 -1
View File
@@ -13,7 +13,8 @@
#if defined(X25519_ASM) \
|| ( (defined(__SIZEOF_INT128__) && __SIZEOF_INT128__ == 16) \
&& !defined(__sparc__) )
&& !defined(__sparc__) \
&& !(defined(__ANDROID__) && !defined(__clang__)) )
/*
* Base 2^51 implementation.
*/
+1 -1
View File
@@ -579,7 +579,7 @@ static int recode_wnaf(struct smvt_control *control,
assert(position >= 0);
if (odd & (1 << (table_bits + 1)))
delta -= (1 << (table_bits + 1));
current -= delta << pos;
current -= delta * (1 << pos);
control[position].power = pos + 16 * (w - 1);
control[position].addend = delta;
position--;
+2 -2
View File
@@ -122,7 +122,7 @@ void gf_strong_reduce(gf a)
* it was < p, so now scarry = -1 and this = x - p + 2^255 so let's add
* back in p. will carry back off the top for 2^255.
*/
assert(word_is_zero(scarry) | word_is_zero(scarry + 1));
assert(scarry == 0 || scarry == -1);
scarry_0 = (word_t)scarry;
@@ -135,7 +135,7 @@ void gf_strong_reduce(gf a)
carry >>= LIMB_PLACE_VALUE(LIMBPERM(i));
}
assert(word_is_zero(carry + scarry_0));
assert(carry < 2 && ((word_t)carry + scarry_0) == 0);
}
/* Subtract two gf elements d=a-b */
+2 -2
View File
@@ -135,9 +135,9 @@ void curve448_scalar_add(curve448_scalar_t out, const curve448_scalar_t a,
static ossl_inline void scalar_decode_short(curve448_scalar_t s,
const unsigned char *ser,
unsigned int nbytes)
size_t nbytes)
{
unsigned int i, j, k = 0;
size_t i, j, k = 0;
for (i = 0; i < C448_SCALAR_LIMBS; i++) {
c448_word_t out = 0;
+5
View File
@@ -242,6 +242,10 @@ static const ERR_STRING_DATA EC_str_functs[] = {
"ossl_ecdsa_verify_sig"},
{ERR_PACK(ERR_LIB_EC, EC_F_PKEY_ECD_CTRL, 0), "pkey_ecd_ctrl"},
{ERR_PACK(ERR_LIB_EC, EC_F_PKEY_ECD_DIGESTSIGN, 0), "pkey_ecd_digestsign"},
{ERR_PACK(ERR_LIB_EC, EC_F_PKEY_ECD_DIGESTSIGN25519, 0),
"pkey_ecd_digestsign25519"},
{ERR_PACK(ERR_LIB_EC, EC_F_PKEY_ECD_DIGESTSIGN448, 0),
"pkey_ecd_digestsign448"},
{ERR_PACK(ERR_LIB_EC, EC_F_PKEY_ECX_DERIVE, 0), "pkey_ecx_derive"},
{ERR_PACK(ERR_LIB_EC, EC_F_PKEY_EC_CTRL, 0), "pkey_ec_ctrl"},
{ERR_PACK(ERR_LIB_EC, EC_F_PKEY_EC_CTRL_STR, 0), "pkey_ec_ctrl_str"},
@@ -249,6 +253,7 @@ static const ERR_STRING_DATA EC_str_functs[] = {
{ERR_PACK(ERR_LIB_EC, EC_F_PKEY_EC_KEYGEN, 0), "pkey_ec_keygen"},
{ERR_PACK(ERR_LIB_EC, EC_F_PKEY_EC_PARAMGEN, 0), "pkey_ec_paramgen"},
{ERR_PACK(ERR_LIB_EC, EC_F_PKEY_EC_SIGN, 0), "pkey_ec_sign"},
{ERR_PACK(ERR_LIB_EC, EC_F_VALIDATE_ECX_DERIVE, 0), "validate_ecx_derive"},
{0, NULL}
};
+1
View File
@@ -14,6 +14,7 @@
#include <openssl/ec.h>
#include <openssl/bn.h>
#include "internal/refcount.h"
#include "curve448/curve448_lcl.h"
#if defined(__SUNPRO_C)
# if __SUNPRO_C >= 0x520
+314 -104
View File
@@ -16,30 +16,39 @@
#include "internal/evp_int.h"
#include "ec_lcl.h"
#define X25519_KEYLEN 32
#define X25519_BITS 253
#define X25519_SECURITY_BITS 128
#define ED25519_SIGSIZE 64
typedef struct {
unsigned char pubkey[X25519_KEYLEN];
unsigned char *privkey;
} X25519_KEY;
#define X448_BITS 448
#define ED448_BITS 456
#define X448_SECURITY_BITS 224
#define ED448_SIGSIZE 114
#define ISX448(id) ((id) == EVP_PKEY_X448)
#define IS25519(id) ((id) == EVP_PKEY_X25519 || (id) == EVP_PKEY_ED25519)
#define KEYLENID(id) (IS25519(id) ? X25519_KEYLEN \
: ((id) == EVP_PKEY_X448 ? X448_KEYLEN \
: ED448_KEYLEN))
#define KEYLEN(p) KEYLENID((p)->ameth->pkey_id)
typedef enum {
X25519_PUBLIC,
X25519_PRIVATE,
X25519_KEYGEN
KEY_OP_PUBLIC,
KEY_OP_PRIVATE,
KEY_OP_KEYGEN
} ecx_key_op_t;
/* Setup EVP_PKEY using public, private or generation */
static int ecx_key_op(EVP_PKEY *pkey, int id, const X509_ALGOR *palg,
const unsigned char *p, int plen, ecx_key_op_t op)
{
X25519_KEY *xkey;
ECX_KEY *key = NULL;
unsigned char *privkey, *pubkey;
if (op != X25519_KEYGEN) {
if (op != KEY_OP_KEYGEN) {
if (palg != NULL) {
int ptype;
@@ -51,69 +60,85 @@ static int ecx_key_op(EVP_PKEY *pkey, int id, const X509_ALGOR *palg,
}
}
if (p == NULL || plen != X25519_KEYLEN) {
if (p == NULL || plen != KEYLENID(id)) {
ECerr(EC_F_ECX_KEY_OP, EC_R_INVALID_ENCODING);
return 0;
}
}
xkey = OPENSSL_zalloc(sizeof(*xkey));
if (xkey == NULL) {
key = OPENSSL_zalloc(sizeof(*key));
if (key == NULL) {
ECerr(EC_F_ECX_KEY_OP, ERR_R_MALLOC_FAILURE);
return 0;
}
pubkey = key->pubkey;
if (op == X25519_PUBLIC) {
memcpy(xkey->pubkey, p, plen);
if (op == KEY_OP_PUBLIC) {
memcpy(pubkey, p, plen);
} else {
xkey->privkey = OPENSSL_secure_malloc(X25519_KEYLEN);
if (xkey->privkey == NULL) {
privkey = key->privkey = OPENSSL_secure_malloc(KEYLENID(id));
if (privkey == NULL) {
ECerr(EC_F_ECX_KEY_OP, ERR_R_MALLOC_FAILURE);
OPENSSL_free(xkey);
return 0;
goto err;
}
if (op == X25519_KEYGEN) {
if (RAND_bytes(xkey->privkey, X25519_KEYLEN) <= 0) {
OPENSSL_secure_free(xkey->privkey);
OPENSSL_free(xkey);
return 0;
if (op == KEY_OP_KEYGEN) {
if (RAND_priv_bytes(privkey, KEYLENID(id)) <= 0) {
OPENSSL_secure_free(privkey);
key->privkey = NULL;
goto err;
}
if (id == EVP_PKEY_X25519) {
xkey->privkey[0] &= 248;
xkey->privkey[31] &= 127;
xkey->privkey[31] |= 64;
privkey[0] &= 248;
privkey[X25519_KEYLEN - 1] &= 127;
privkey[X25519_KEYLEN - 1] |= 64;
} else if (id == EVP_PKEY_X448) {
privkey[0] &= 252;
privkey[X448_KEYLEN - 1] |= 128;
}
} else {
memcpy(xkey->privkey, p, X25519_KEYLEN);
memcpy(privkey, p, KEYLENID(id));
}
switch (id) {
case EVP_PKEY_X25519:
X25519_public_from_private(pubkey, privkey);
break;
case EVP_PKEY_ED25519:
ED25519_public_from_private(pubkey, privkey);
break;
case EVP_PKEY_X448:
X448_public_from_private(pubkey, privkey);
break;
case EVP_PKEY_ED448:
ED448_public_from_private(pubkey, privkey);
break;
}
if (id == EVP_PKEY_X25519)
X25519_public_from_private(xkey->pubkey, xkey->privkey);
else
ED25519_public_from_private(xkey->pubkey, xkey->privkey);
}
EVP_PKEY_assign(pkey, id, xkey);
EVP_PKEY_assign(pkey, id, key);
return 1;
err:
OPENSSL_free(key);
return 0;
}
static int ecx_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
{
const X25519_KEY *xkey = pkey->pkey.ptr;
const ECX_KEY *ecxkey = pkey->pkey.ecx;
unsigned char *penc;
if (xkey == NULL) {
if (ecxkey == NULL) {
ECerr(EC_F_ECX_PUB_ENCODE, EC_R_INVALID_KEY);
return 0;
}
penc = OPENSSL_memdup(xkey->pubkey, X25519_KEYLEN);
penc = OPENSSL_memdup(ecxkey->pubkey, KEYLEN(pkey));
if (penc == NULL) {
ECerr(EC_F_ECX_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
return 0;
}
if (!X509_PUBKEY_set0_param(pk, OBJ_nid2obj(pkey->ameth->pkey_id),
V_ASN1_UNDEF, NULL, penc, X25519_KEYLEN)) {
V_ASN1_UNDEF, NULL, penc, KEYLEN(pkey))) {
OPENSSL_free(penc);
ECerr(EC_F_ECX_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
return 0;
@@ -130,17 +155,18 @@ static int ecx_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, &palg, pubkey))
return 0;
return ecx_key_op(pkey, pkey->ameth->pkey_id, palg, p, pklen,
X25519_PUBLIC);
KEY_OP_PUBLIC);
}
static int ecx_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
{
const X25519_KEY *akey = a->pkey.ptr;
const X25519_KEY *bkey = b->pkey.ptr;
const ECX_KEY *akey = a->pkey.ecx;
const ECX_KEY *bkey = b->pkey.ecx;
if (akey == NULL || bkey == NULL)
return -2;
return !CRYPTO_memcmp(akey->pubkey, bkey->pubkey, X25519_KEYLEN);
return CRYPTO_memcmp(akey->pubkey, bkey->pubkey, KEYLEN(a)) == 0;
}
static int ecx_priv_decode(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8)
@@ -163,25 +189,25 @@ static int ecx_priv_decode(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8)
plen = ASN1_STRING_length(oct);
}
rv = ecx_key_op(pkey, pkey->ameth->pkey_id, palg, p, plen, X25519_PRIVATE);
rv = ecx_key_op(pkey, pkey->ameth->pkey_id, palg, p, plen, KEY_OP_PRIVATE);
ASN1_OCTET_STRING_free(oct);
return rv;
}
static int ecx_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
{
const X25519_KEY *xkey = pkey->pkey.ptr;
const ECX_KEY *ecxkey = pkey->pkey.ecx;
ASN1_OCTET_STRING oct;
unsigned char *penc = NULL;
int penclen;
if (xkey == NULL || xkey->privkey == NULL) {
if (ecxkey == NULL || ecxkey->privkey == NULL) {
ECerr(EC_F_ECX_PRIV_ENCODE, EC_R_INVALID_PRIVATE_KEY);
return 0;
}
oct.data = xkey->privkey;
oct.length = X25519_KEYLEN;
oct.data = ecxkey->privkey;
oct.length = KEYLEN(pkey);
oct.flags = 0;
penclen = i2d_ASN1_OCTET_STRING(&oct, &penc);
@@ -202,26 +228,34 @@ static int ecx_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
static int ecx_size(const EVP_PKEY *pkey)
{
return X25519_KEYLEN;
return KEYLEN(pkey);
}
static int ecx_bits(const EVP_PKEY *pkey)
{
return X25519_BITS;
if (IS25519(pkey->ameth->pkey_id)) {
return X25519_BITS;
} else if(ISX448(pkey->ameth->pkey_id)) {
return X448_BITS;
} else {
return ED448_BITS;
}
}
static int ecx_security_bits(const EVP_PKEY *pkey)
{
return X25519_SECURITY_BITS;
if (IS25519(pkey->ameth->pkey_id)) {
return X25519_SECURITY_BITS;
} else {
return X448_SECURITY_BITS;
}
}
static void ecx_free(EVP_PKEY *pkey)
{
X25519_KEY *xkey = pkey->pkey.ptr;
if (xkey)
OPENSSL_secure_clear_free(xkey->privkey, X25519_KEYLEN);
OPENSSL_free(xkey);
if (pkey->pkey.ecx != NULL)
OPENSSL_secure_clear_free(pkey->pkey.ecx->privkey, KEYLEN(pkey));
OPENSSL_free(pkey->pkey.ecx);
}
/* "parameters" are always equal */
@@ -233,12 +267,11 @@ static int ecx_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)
static int ecx_key_print(BIO *bp, const EVP_PKEY *pkey, int indent,
ASN1_PCTX *ctx, ecx_key_op_t op)
{
const X25519_KEY *xkey = pkey->pkey.ptr;
const ECX_KEY *ecxkey = pkey->pkey.ecx;
const char *nm = OBJ_nid2ln(pkey->ameth->pkey_id);
if (op == X25519_PRIVATE) {
if (xkey == NULL || xkey->privkey == NULL) {
if (op == KEY_OP_PRIVATE) {
if (ecxkey == NULL || ecxkey->privkey == NULL) {
if (BIO_printf(bp, "%*s<INVALID PRIVATE KEY>\n", indent, "") <= 0)
return 0;
return 1;
@@ -247,10 +280,11 @@ static int ecx_key_print(BIO *bp, const EVP_PKEY *pkey, int indent,
return 0;
if (BIO_printf(bp, "%*spriv:\n", indent, "") <= 0)
return 0;
if (ASN1_buf_print(bp, xkey->privkey, X25519_KEYLEN, indent + 4) == 0)
if (ASN1_buf_print(bp, ecxkey->privkey, KEYLEN(pkey),
indent + 4) == 0)
return 0;
} else {
if (xkey == NULL) {
if (ecxkey == NULL) {
if (BIO_printf(bp, "%*s<INVALID PUBLIC KEY>\n", indent, "") <= 0)
return 0;
return 1;
@@ -260,7 +294,9 @@ static int ecx_key_print(BIO *bp, const EVP_PKEY *pkey, int indent,
}
if (BIO_printf(bp, "%*spub:\n", indent, "") <= 0)
return 0;
if (ASN1_buf_print(bp, xkey->pubkey, X25519_KEYLEN, indent + 4) == 0)
if (ASN1_buf_print(bp, ecxkey->pubkey, KEYLEN(pkey),
indent + 4) == 0)
return 0;
return 1;
}
@@ -268,13 +304,13 @@ static int ecx_key_print(BIO *bp, const EVP_PKEY *pkey, int indent,
static int ecx_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent,
ASN1_PCTX *ctx)
{
return ecx_key_print(bp, pkey, indent, ctx, X25519_PRIVATE);
return ecx_key_print(bp, pkey, indent, ctx, KEY_OP_PRIVATE);
}
static int ecx_pub_print(BIO *bp, const EVP_PKEY *pkey, int indent,
ASN1_PCTX *ctx)
{
return ecx_key_print(bp, pkey, indent, ctx, X25519_PUBLIC);
return ecx_key_print(bp, pkey, indent, ctx, KEY_OP_PUBLIC);
}
static int ecx_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
@@ -282,16 +318,16 @@ static int ecx_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
switch (op) {
case ASN1_PKEY_CTRL_SET1_TLS_ENCPT:
return ecx_key_op(pkey, EVP_PKEY_X25519, NULL, arg2, arg1,
X25519_PUBLIC);
return ecx_key_op(pkey, pkey->ameth->pkey_id, NULL, arg2, arg1,
KEY_OP_PUBLIC);
case ASN1_PKEY_CTRL_GET1_TLS_ENCPT:
if (pkey->pkey.ptr != NULL) {
const X25519_KEY *xkey = pkey->pkey.ptr;
if (pkey->pkey.ecx != NULL) {
unsigned char **ppt = arg2;
*ppt = OPENSSL_memdup(xkey->pubkey, X25519_KEYLEN);
*ppt = OPENSSL_memdup(pkey->pkey.ecx->pubkey, KEYLEN(pkey));
if (*ppt != NULL)
return X25519_KEYLEN;
return KEYLEN(pkey);
}
return 0;
@@ -335,21 +371,58 @@ const EVP_PKEY_ASN1_METHOD ecx25519_asn1_meth = {
NULL
};
static int ecd_size(const EVP_PKEY *pkey)
const EVP_PKEY_ASN1_METHOD ecx448_asn1_meth = {
EVP_PKEY_X448,
EVP_PKEY_X448,
0,
"X448",
"OpenSSL X448 algorithm",
ecx_pub_decode,
ecx_pub_encode,
ecx_pub_cmp,
ecx_pub_print,
ecx_priv_decode,
ecx_priv_encode,
ecx_priv_print,
ecx_size,
ecx_bits,
ecx_security_bits,
0, 0, 0, 0,
ecx_cmp_parameters,
0, 0,
ecx_free,
ecx_ctrl,
NULL,
NULL
};
static int ecd_size25519(const EVP_PKEY *pkey)
{
return ED25519_SIGSIZE;
}
static int ecd_size448(const EVP_PKEY *pkey)
{
return ED448_SIGSIZE;
}
static int ecd_item_verify(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
X509_ALGOR *sigalg, ASN1_BIT_STRING *str,
EVP_PKEY *pkey)
{
const ASN1_OBJECT *obj;
int ptype;
int nid;
/* Sanity check: make sure it is ED25519/ED448 with absent parameters */
X509_ALGOR_get0(&obj, &ptype, NULL, sigalg);
/* Sanity check: make sure it is ED25519 with absent parameters */
if (OBJ_obj2nid(obj) != NID_ED25519 || ptype != V_ASN1_UNDEF) {
nid = OBJ_obj2nid(obj);
if ((nid != NID_ED25519 && nid != NID_ED448) || ptype != V_ASN1_UNDEF) {
ECerr(EC_F_ECD_ITEM_VERIFY, EC_R_INVALID_ENCODING);
return 0;
}
@@ -360,9 +433,9 @@ static int ecd_item_verify(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
return 2;
}
static int ecd_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
X509_ALGOR *alg1, X509_ALGOR *alg2,
ASN1_BIT_STRING *str)
static int ecd_item_sign25519(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
X509_ALGOR *alg1, X509_ALGOR *alg2,
ASN1_BIT_STRING *str)
{
/* Set algorithms identifiers */
X509_ALGOR_set0(alg1, OBJ_nid2obj(NID_ED25519), V_ASN1_UNDEF, NULL);
@@ -372,14 +445,35 @@ static int ecd_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
return 3;
}
static int ecd_sig_info_set(X509_SIG_INFO *siginf, const X509_ALGOR *alg,
const ASN1_STRING *sig)
static int ecd_sig_info_set25519(X509_SIG_INFO *siginf, const X509_ALGOR *alg,
const ASN1_STRING *sig)
{
X509_SIG_INFO_set(siginf, NID_undef, NID_ED25519, X25519_SECURITY_BITS,
X509_SIG_INFO_TLS);
return 1;
}
static int ecd_item_sign448(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
X509_ALGOR *alg1, X509_ALGOR *alg2,
ASN1_BIT_STRING *str)
{
/* Set algorithm identifier */
X509_ALGOR_set0(alg1, OBJ_nid2obj(NID_ED448), V_ASN1_UNDEF, NULL);
if (alg2 != NULL)
X509_ALGOR_set0(alg2, OBJ_nid2obj(NID_ED448), V_ASN1_UNDEF, NULL);
/* Algorithm identifier set: carry on as normal */
return 3;
}
static int ecd_sig_info_set448(X509_SIG_INFO *siginf, const X509_ALGOR *alg,
const ASN1_STRING *sig)
{
X509_SIG_INFO_set(siginf, NID_undef, NID_ED448, X448_SECURITY_BITS,
X509_SIG_INFO_TLS);
return 1;
}
const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth = {
EVP_PKEY_ED25519,
EVP_PKEY_ED25519,
@@ -396,7 +490,7 @@ const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth = {
ecx_priv_encode,
ecx_priv_print,
ecd_size,
ecd_size25519,
ecx_bits,
ecx_security_bits,
@@ -409,37 +503,98 @@ const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth = {
NULL,
NULL,
ecd_item_verify,
ecd_item_sign,
ecd_sig_info_set
ecd_item_sign25519,
ecd_sig_info_set25519
};
const EVP_PKEY_ASN1_METHOD ed448_asn1_meth = {
EVP_PKEY_ED448,
EVP_PKEY_ED448,
0,
"ED448",
"OpenSSL ED448 algorithm",
ecx_pub_decode,
ecx_pub_encode,
ecx_pub_cmp,
ecx_pub_print,
ecx_priv_decode,
ecx_priv_encode,
ecx_priv_print,
ecd_size448,
ecx_bits,
ecx_security_bits,
0, 0, 0, 0,
ecx_cmp_parameters,
0, 0,
ecx_free,
0,
NULL,
NULL,
ecd_item_verify,
ecd_item_sign448,
ecd_sig_info_set448
};
static int pkey_ecx_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
{
return ecx_key_op(pkey, ctx->pmeth->pkey_id, NULL, NULL, 0, X25519_KEYGEN);
return ecx_key_op(pkey, ctx->pmeth->pkey_id, NULL, NULL, 0, KEY_OP_KEYGEN);
}
static int pkey_ecx_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
size_t *keylen)
static int validate_ecx_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
size_t *keylen,
const unsigned char **privkey,
const unsigned char **pubkey)
{
const X25519_KEY *pkey, *peerkey;
const ECX_KEY *ecxkey, *peerkey;
if (ctx->pkey == NULL || ctx->peerkey == NULL) {
ECerr(EC_F_PKEY_ECX_DERIVE, EC_R_KEYS_NOT_SET);
ECerr(EC_F_VALIDATE_ECX_DERIVE, EC_R_KEYS_NOT_SET);
return 0;
}
pkey = ctx->pkey->pkey.ptr;
peerkey = ctx->peerkey->pkey.ptr;
if (pkey == NULL || pkey->privkey == NULL) {
ECerr(EC_F_PKEY_ECX_DERIVE, EC_R_INVALID_PRIVATE_KEY);
ecxkey = ctx->pkey->pkey.ecx;
peerkey = ctx->peerkey->pkey.ecx;
if (ecxkey == NULL || ecxkey->privkey == NULL) {
ECerr(EC_F_VALIDATE_ECX_DERIVE, EC_R_INVALID_PRIVATE_KEY);
return 0;
}
if (peerkey == NULL) {
ECerr(EC_F_PKEY_ECX_DERIVE, EC_R_INVALID_PEER_KEY);
ECerr(EC_F_VALIDATE_ECX_DERIVE, EC_R_INVALID_PEER_KEY);
return 0;
}
*keylen = X25519_KEYLEN;
if (key != NULL && X25519(key, pkey->privkey, peerkey->pubkey) == 0)
*privkey = ecxkey->privkey;
*pubkey = peerkey->pubkey;
return 1;
}
static int pkey_ecx_derive25519(EVP_PKEY_CTX *ctx, unsigned char *key,
size_t *keylen)
{
const unsigned char *privkey, *pubkey;
if (!validate_ecx_derive(ctx, key, keylen, &privkey, &pubkey)
|| (key != NULL
&& X25519(key, privkey, pubkey) == 0))
return 0;
*keylen = X25519_KEYLEN;
return 1;
}
static int pkey_ecx_derive448(EVP_PKEY_CTX *ctx, unsigned char *key,
size_t *keylen)
{
const unsigned char *privkey, *pubkey;
if (!validate_ecx_derive(ctx, key, keylen, &privkey, &pubkey)
|| (key != NULL
&& X448(key, privkey, pubkey) == 0))
return 0;
*keylen = X448_KEYLEN;
return 1;
}
@@ -456,23 +611,33 @@ const EVP_PKEY_METHOD ecx25519_pkey_meth = {
0, 0, 0, 0, 0, 0, 0,
pkey_ecx_keygen,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
pkey_ecx_derive,
pkey_ecx_derive25519,
pkey_ecx_ctrl,
0
};
static int pkey_ecd_digestsign(EVP_MD_CTX *ctx, unsigned char *sig,
size_t *siglen, const unsigned char *tbs,
size_t tbslen)
const EVP_PKEY_METHOD ecx448_pkey_meth = {
EVP_PKEY_X448,
0, 0, 0, 0, 0, 0, 0,
pkey_ecx_keygen,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
pkey_ecx_derive448,
pkey_ecx_ctrl,
0
};
static int pkey_ecd_digestsign25519(EVP_MD_CTX *ctx, unsigned char *sig,
size_t *siglen, const unsigned char *tbs,
size_t tbslen)
{
const X25519_KEY *edkey = EVP_MD_CTX_pkey_ctx(ctx)->pkey->pkey.ptr;
const ECX_KEY *edkey = EVP_MD_CTX_pkey_ctx(ctx)->pkey->pkey.ecx;
if (sig == NULL) {
*siglen = ED25519_SIGSIZE;
return 1;
}
if (*siglen < ED25519_SIGSIZE) {
ECerr(EC_F_PKEY_ECD_DIGESTSIGN, EC_R_BUFFER_TOO_SMALL);
ECerr(EC_F_PKEY_ECD_DIGESTSIGN25519, EC_R_BUFFER_TOO_SMALL);
return 0;
}
@@ -482,11 +647,33 @@ static int pkey_ecd_digestsign(EVP_MD_CTX *ctx, unsigned char *sig,
return 1;
}
static int pkey_ecd_digestverify(EVP_MD_CTX *ctx, const unsigned char *sig,
size_t siglen, const unsigned char *tbs,
size_t tbslen)
static int pkey_ecd_digestsign448(EVP_MD_CTX *ctx, unsigned char *sig,
size_t *siglen, const unsigned char *tbs,
size_t tbslen)
{
const X25519_KEY *edkey = EVP_MD_CTX_pkey_ctx(ctx)->pkey->pkey.ptr;
const ECX_KEY *edkey = EVP_MD_CTX_pkey_ctx(ctx)->pkey->pkey.ecx;
if (sig == NULL) {
*siglen = ED448_SIGSIZE;
return 1;
}
if (*siglen < ED448_SIGSIZE) {
ECerr(EC_F_PKEY_ECD_DIGESTSIGN448, EC_R_BUFFER_TOO_SMALL);
return 0;
}
if (ED448_sign(sig, tbs, tbslen, edkey->pubkey, edkey->privkey, NULL,
0) == 0)
return 0;
*siglen = ED448_SIGSIZE;
return 1;
}
static int pkey_ecd_digestverify25519(EVP_MD_CTX *ctx, const unsigned char *sig,
size_t siglen, const unsigned char *tbs,
size_t tbslen)
{
const ECX_KEY *edkey = EVP_MD_CTX_pkey_ctx(ctx)->pkey->pkey.ecx;
if (siglen != ED25519_SIGSIZE)
return 0;
@@ -494,6 +681,18 @@ static int pkey_ecd_digestverify(EVP_MD_CTX *ctx, const unsigned char *sig,
return ED25519_verify(tbs, tbslen, sig, edkey->pubkey);
}
static int pkey_ecd_digestverify448(EVP_MD_CTX *ctx, const unsigned char *sig,
size_t siglen, const unsigned char *tbs,
size_t tbslen)
{
const ECX_KEY *edkey = EVP_MD_CTX_pkey_ctx(ctx)->pkey->pkey.ecx;
if (siglen != ED448_SIGSIZE)
return 0;
return ED448_verify(tbs, tbslen, sig, edkey->pubkey, NULL, 0);
}
static int pkey_ecd_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
{
switch (type) {
@@ -517,6 +716,17 @@ const EVP_PKEY_METHOD ed25519_pkey_meth = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
pkey_ecd_ctrl,
0,
pkey_ecd_digestsign,
pkey_ecd_digestverify
pkey_ecd_digestsign25519,
pkey_ecd_digestverify25519
};
const EVP_PKEY_METHOD ed448_pkey_meth = {
EVP_PKEY_ED448, EVP_PKEY_FLAG_SIGCTX_CUSTOM,
0, 0, 0, 0, 0, 0,
pkey_ecx_keygen,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
pkey_ecd_ctrl,
0,
pkey_ecd_digestsign448,
pkey_ecd_digestverify448
};
+5 -18
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2011-2016 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2011-2018 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -20,28 +20,15 @@
defined(__x86_64) || defined(__x86_64__) || \
defined(_M_AMD64) || defined (_M_X64)) && defined(OPENSSL_CPUID_OBJ)
size_t OPENSSL_ia32_rdrand(void);
size_t OPENSSL_ia32_rdrand_bytes(unsigned char *buf, size_t len);
static int get_random_bytes(unsigned char *buf, int num)
{
size_t rnd;
while (num >= (int)sizeof(size_t)) {
if ((rnd = OPENSSL_ia32_rdrand()) == 0)
return 0;
*((size_t *)buf) = rnd;
buf += sizeof(size_t);
num -= sizeof(size_t);
}
if (num) {
if ((rnd = OPENSSL_ia32_rdrand()) == 0)
return 0;
memcpy(buf, &rnd, num);
if (num < 0) {
return 0;
}
return 1;
return (size_t)num == OPENSSL_ia32_rdrand_bytes(buf, (size_t)num);
}
static int random_status(void)
+5
View File
@@ -109,6 +109,11 @@ int engine_table_register(ENGINE_TABLE **table, ENGINE_CLEANUP_CB *cleanup,
}
fnd->funct = NULL;
(void)lh_ENGINE_PILE_insert(&(*table)->piles, fnd);
if (lh_ENGINE_PILE_retrieve(&(*table)->piles, &tmplate) != fnd) {
sk_ENGINE_free(fnd->sk);
OPENSSL_free(fnd);
goto end;
}
}
/* A registration shouldn't add duplicate entries */
(void)sk_ENGINE_delete_ptr(fnd->sk, e);
+1
View File
@@ -89,6 +89,7 @@ static ERR_STRING_DATA ERR_str_functs[] = {
{ERR_PACK(0, SYS_F_IOCTL, 0), "ioctl"},
{ERR_PACK(0, SYS_F_STAT, 0), "stat"},
{ERR_PACK(0, SYS_F_FCNTL, 0), "fcntl"},
{ERR_PACK(0, SYS_F_FSTAT, 0), "fstat"},
{0, NULL},
};
+13
View File
@@ -299,6 +299,7 @@ CONF_F_CONF_LOAD_FP:103:CONF_load_fp
CONF_F_CONF_PARSE_LIST:119:CONF_parse_list
CONF_F_DEF_LOAD:120:def_load
CONF_F_DEF_LOAD_BIO:121:def_load_bio
CONF_F_GET_NEXT_FILE:107:get_next_file
CONF_F_MODULE_INIT:115:module_init
CONF_F_MODULE_LOAD_DSO:117:module_load_dso
CONF_F_MODULE_RUN:118:module_run
@@ -311,6 +312,7 @@ CONF_F_NCONF_LOAD:113:NCONF_load
CONF_F_NCONF_LOAD_BIO:110:NCONF_load_bio
CONF_F_NCONF_LOAD_FP:114:NCONF_load_fp
CONF_F_NCONF_NEW:111:NCONF_new
CONF_F_PROCESS_INCLUDE:116:process_include
CONF_F_STR_COPY:101:str_copy
CRYPTO_F_CRYPTO_DUP_EX_DATA:110:CRYPTO_dup_ex_data
CRYPTO_F_CRYPTO_FREE_EX_DATA:111:CRYPTO_free_ex_data
@@ -594,6 +596,8 @@ EC_F_OSSL_ECDSA_SIGN_SIG:249:ossl_ecdsa_sign_sig
EC_F_OSSL_ECDSA_VERIFY_SIG:250:ossl_ecdsa_verify_sig
EC_F_PKEY_ECD_CTRL:271:pkey_ecd_ctrl
EC_F_PKEY_ECD_DIGESTSIGN:272:pkey_ecd_digestsign
EC_F_PKEY_ECD_DIGESTSIGN25519:276:pkey_ecd_digestsign25519
EC_F_PKEY_ECD_DIGESTSIGN448:277:pkey_ecd_digestsign448
EC_F_PKEY_ECX_DERIVE:269:pkey_ecx_derive
EC_F_PKEY_EC_CTRL:197:pkey_ec_ctrl
EC_F_PKEY_EC_CTRL_STR:198:pkey_ec_ctrl_str
@@ -601,6 +605,7 @@ EC_F_PKEY_EC_DERIVE:217:pkey_ec_derive
EC_F_PKEY_EC_KEYGEN:199:pkey_ec_keygen
EC_F_PKEY_EC_PARAMGEN:219:pkey_ec_paramgen
EC_F_PKEY_EC_SIGN:218:pkey_ec_sign
EC_F_VALIDATE_ECX_DERIVE:278:validate_ecx_derive
ENGINE_F_DIGEST_UPDATE:198:digest_update
ENGINE_F_DYNAMIC_CTRL:180:dynamic_ctrl
ENGINE_F_DYNAMIC_GET_DATA_CTX:181:dynamic_get_data_ctx
@@ -902,6 +907,7 @@ RAND_F_GET_ENTROPY:106:get_entropy
RAND_F_RAND_BYTES:100:RAND_bytes
RAND_F_RAND_DRBG_ENABLE_LOCKING:119:rand_drbg_enable_locking
RAND_F_RAND_DRBG_GENERATE:107:RAND_DRBG_generate
RAND_F_RAND_DRBG_GET_ENTROPY:120:rand_drbg_get_entropy
RAND_F_RAND_DRBG_INSTANTIATE:108:RAND_DRBG_instantiate
RAND_F_RAND_DRBG_NEW:109:RAND_DRBG_new
RAND_F_RAND_DRBG_RESEED:110:RAND_DRBG_reseed
@@ -1177,6 +1183,7 @@ SSL_F_SSL_SESSION_SET1_ID:423:SSL_SESSION_set1_id
SSL_F_SSL_SESSION_SET1_ID_CONTEXT:312:SSL_SESSION_set1_id_context
SSL_F_SSL_SET_ALPN_PROTOS:344:SSL_set_alpn_protos
SSL_F_SSL_SET_CERT:191:ssl_set_cert
SSL_F_SSL_SET_CERT_AND_KEY:621:ssl_set_cert_and_key
SSL_F_SSL_SET_CIPHER_LIST:271:SSL_set_cipher_list
SSL_F_SSL_SET_CT_VALIDATION_CALLBACK:399:SSL_set_ct_validation_callback
SSL_F_SSL_SET_FD:192:SSL_set_fd
@@ -1869,6 +1876,7 @@ CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE:106:no conf or environment variable
CONF_R_NO_SECTION:107:no section
CONF_R_NO_SUCH_FILE:114:no such file
CONF_R_NO_VALUE:108:no value
CONF_R_RECURSIVE_DIRECTORY_INCLUDE:111:recursive directory include
CONF_R_UNABLE_TO_CREATE_NEW_SECTION:103:unable to create new section
CONF_R_UNKNOWN_MODULE_NAME:113:unknown module name
CONF_R_VARIABLE_EXPANSION_TOO_LONG:116:variable expansion too long
@@ -2294,6 +2302,7 @@ RAND_R_NOT_A_REGULAR_FILE:122:Not a regular file
RAND_R_NOT_INSTANTIATED:115:not instantiated
RAND_R_NO_DRBG_IMPLEMENTATION_SELECTED:128:no drbg implementation selected
RAND_R_PARENT_LOCKING_NOT_ENABLED:130:parent locking not enabled
RAND_R_PARENT_STRENGTH_TOO_WEAK:131:parent strength too weak
RAND_R_PERSONALISATION_STRING_TOO_LONG:116:personalisation string too long
RAND_R_PRNG_NOT_SEEDED:100:PRNG not seeded
RAND_R_RANDOM_POOL_OVERFLOW:125:random pool overflow
@@ -2517,6 +2526,7 @@ SSL_R_LIBRARY_HAS_NO_CIPHERS:161:library has no ciphers
SSL_R_MISSING_DSA_SIGNING_CERT:165:missing dsa signing cert
SSL_R_MISSING_ECDSA_SIGNING_CERT:381:missing ecdsa signing cert
SSL_R_MISSING_FATAL:256:missing fatal
SSL_R_MISSING_PARAMETERS:290:missing parameters
SSL_R_MISSING_RSA_CERTIFICATE:168:missing rsa certificate
SSL_R_MISSING_RSA_ENCRYPTING_CERT:169:missing rsa encrypting cert
SSL_R_MISSING_RSA_SIGNING_CERT:170:missing rsa signing cert
@@ -2527,6 +2537,7 @@ SSL_R_MISSING_SUPPORTED_GROUPS_EXTENSION:209:missing supported groups extension
SSL_R_MISSING_TMP_DH_KEY:171:missing tmp dh key
SSL_R_MISSING_TMP_ECDH_KEY:311:missing tmp ecdh key
SSL_R_NOT_ON_RECORD_BOUNDARY:182:not on record boundary
SSL_R_NOT_REPLACING_CERTIFICATE:289:not replacing certificate
SSL_R_NOT_SERVER:284:not server
SSL_R_NO_APPLICATION_PROTOCOL:235:no application protocol
SSL_R_NO_CERTIFICATES_RETURNED:176:no certificates returned
@@ -2538,6 +2549,7 @@ SSL_R_NO_CIPHERS_SPECIFIED:183:no ciphers specified
SSL_R_NO_CIPHER_MATCH:185:no cipher match
SSL_R_NO_CLIENT_CERT_METHOD:331:no client cert method
SSL_R_NO_COMPRESSION_SPECIFIED:187:no compression specified
SSL_R_NO_COOKIE_CALLBACK_SET:287:no cookie callback set
SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER:330:\
Peer haven't sent GOST certificate, required for selected ciphersuite
SSL_R_NO_METHOD_SPECIFIED:188:no method specified
@@ -2568,6 +2580,7 @@ SSL_R_PEM_NAME_BAD_PREFIX:391:pem name bad prefix
SSL_R_PEM_NAME_TOO_SHORT:392:pem name too short
SSL_R_PIPELINE_FAILURE:406:pipeline failure
SSL_R_POST_HANDSHAKE_AUTH_ENCODING_ERR:278:post handshake auth encoding err
SSL_R_PRIVATE_KEY_MISMATCH:288:private key mismatch
SSL_R_PROTOCOL_IS_SHUTDOWN:207:protocol is shutdown
SSL_R_PSK_IDENTITY_NOT_FOUND:223:psk identity not found
SSL_R_PSK_NO_CLIENT_CB:224:psk no client cb
+8
View File
@@ -289,6 +289,14 @@ static int b64_read(BIO *b, char *out, int outl)
(unsigned char *)ctx->tmp, i);
ctx->tmp_len = 0;
}
/*
* If eof or an error was signalled, then the condition
* 'ctx->cont <= 0' will prevent b64_read() from reading
* more data on subsequent calls. This assignment was
* deleted accidentally in commit 5562cfaca4f3.
*/
ctx->cont = i;
ctx->buf_off = 0;
if (i < 0) {
ret_code = 0;
+17 -5
View File
@@ -17,6 +17,7 @@
#include "internal/evp_int.h"
#include "modes_lcl.h"
#include <openssl/rand.h>
#include <internal/rand.h>
#include "evp_locl.h"
typedef struct {
@@ -1404,8 +1405,14 @@ static int s390x_aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
memcpy(gctx->iv, ptr, arg);
enc = EVP_CIPHER_CTX_encrypting(c);
if (enc && RAND_bytes(gctx->iv + arg, gctx->ivlen - arg) <= 0)
return 0;
if (enc) {
if (c->drbg != NULL) {
if (RAND_DRBG_bytes(c->drbg, gctx->iv + arg, gctx->ivlen - arg) == 0)
return 0;
} else if (RAND_bytes(gctx->iv + arg, gctx->ivlen - arg) <= 0) {
return 0;
}
}
gctx->iv_gen = 1;
return 1;
@@ -2632,9 +2639,14 @@ static int aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
return 0;
if (arg)
memcpy(gctx->iv, ptr, arg);
if (EVP_CIPHER_CTX_encrypting(c)
&& RAND_bytes(gctx->iv + arg, gctx->ivlen - arg) <= 0)
return 0;
if (EVP_CIPHER_CTX_encrypting(c)) {
if (c->drbg != NULL) {
if (RAND_DRBG_bytes(c->drbg, gctx->iv + arg, gctx->ivlen - arg) == 0)
return 0;
} else if (RAND_bytes(gctx->iv + arg, gctx->ivlen - arg) <= 0) {
return 0;
}
}
gctx->iv_gen = 1;
return 1;
+12 -3
View File
@@ -17,9 +17,11 @@
#include <openssl/aes.h>
#include <openssl/sha.h>
#include <openssl/rand.h>
#include <internal/rand.h>
#include "modes_lcl.h"
#include "internal/evp_int.h"
#include "internal/constant_time_locl.h"
#include "evp_locl.h"
typedef struct {
AES_KEY ks;
@@ -154,7 +156,8 @@ void aesni_multi_cbc_encrypt(CIPH_DESC *, void *, int);
static size_t tls1_1_multi_block_encrypt(EVP_AES_HMAC_SHA1 *key,
unsigned char *out,
const unsigned char *inp,
size_t inp_len, int n4x)
size_t inp_len, int n4x,
RAND_DRBG *drbg)
{ /* n4x is 1 or 2 */
HASH_DESC hash_d[8], edges[8];
CIPH_DESC ciph_d[8];
@@ -174,8 +177,13 @@ static size_t tls1_1_multi_block_encrypt(EVP_AES_HMAC_SHA1 *key,
# endif
/* ask for IVs in bulk */
if (RAND_bytes((IVs = blocks[0].c), 16 * x4) <= 0)
IVs = blocks[0].c;
if (drbg != NULL) {
if (RAND_DRBG_bytes(drbg, IVs, 16 * x4) == 0)
return 0;
} else if (RAND_bytes(IVs, 16 * x4) <= 0) {
return 0;
}
ctx = (SHA1_MB_CTX *) (storage + 32 - ((size_t)storage % 32)); /* align */
@@ -893,7 +901,8 @@ static int aesni_cbc_hmac_sha1_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg,
return (int)tls1_1_multi_block_encrypt(key, param->out,
param->inp, param->len,
param->interleave / 4);
param->interleave / 4,
ctx->drbg);
}
case EVP_CTRL_TLS1_1_MULTIBLOCK_DECRYPT:
# endif
+12 -3
View File
@@ -18,9 +18,11 @@
#include <openssl/aes.h>
#include <openssl/sha.h>
#include <openssl/rand.h>
#include <internal/rand.h>
#include "modes_lcl.h"
#include "internal/constant_time_locl.h"
#include "internal/evp_int.h"
#include "evp_locl.h"
typedef struct {
AES_KEY ks;
@@ -150,7 +152,8 @@ void aesni_multi_cbc_encrypt(CIPH_DESC *, void *, int);
static size_t tls1_1_multi_block_encrypt(EVP_AES_HMAC_SHA256 *key,
unsigned char *out,
const unsigned char *inp,
size_t inp_len, int n4x)
size_t inp_len, int n4x,
RAND_DRBG *drbg)
{ /* n4x is 1 or 2 */
HASH_DESC hash_d[8], edges[8];
CIPH_DESC ciph_d[8];
@@ -170,8 +173,13 @@ static size_t tls1_1_multi_block_encrypt(EVP_AES_HMAC_SHA256 *key,
# endif
/* ask for IVs in bulk */
if (RAND_bytes((IVs = blocks[0].c), 16 * x4) <= 0)
IVs = blocks[0].c;
if (drbg != NULL) {
if (RAND_DRBG_bytes(drbg, IVs, 16 * x4) == 0)
return 0;
} else if (RAND_bytes(IVs, 16 * x4) <= 0) {
return 0;
}
/* align */
ctx = (SHA256_MB_CTX *) (storage + 32 - ((size_t)storage % 32));
@@ -877,7 +885,8 @@ static int aesni_cbc_hmac_sha256_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg,
return (int)tls1_1_multi_block_encrypt(key, param->out,
param->inp, param->len,
param->interleave / 4);
param->interleave / 4,
ctx->drbg);
}
case EVP_CTRL_TLS1_1_MULTIBLOCK_DECRYPT:
# endif
+9 -3
View File
@@ -15,6 +15,7 @@
# include <openssl/rand.h>
# include "internal/aria.h"
# include "internal/evp_int.h"
# include "internal/rand.h"
# include "modes_lcl.h"
# include "evp_locl.h"
@@ -301,9 +302,14 @@ static int aria_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
return 0;
if (arg)
memcpy(gctx->iv, ptr, arg);
if (EVP_CIPHER_CTX_encrypting(c)
&& RAND_bytes(gctx->iv + arg, gctx->ivlen - arg) <= 0)
return 0;
if (EVP_CIPHER_CTX_encrypting(c)) {
if (c->drbg != NULL) {
if (RAND_DRBG_bytes(c->drbg, gctx->iv + arg, gctx->ivlen - arg) == 0)
return 0;
} else if (RAND_bytes(gctx->iv + arg, gctx->ivlen - arg) <= 0) {
return 0;
}
}
gctx->iv_gen = 1;
return 1;
+7 -1
View File
@@ -15,6 +15,8 @@
# include "internal/evp_int.h"
# include <openssl/des.h>
# include <openssl/rand.h>
# include <internal/rand.h>
# include "evp_locl.h"
typedef struct {
union {
@@ -229,8 +231,12 @@ static int des_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
switch (type) {
case EVP_CTRL_RAND_KEY:
if (RAND_bytes(ptr, 8) <= 0)
if (c->drbg != NULL) {
if (RAND_DRBG_bytes(c->drbg, ptr, 8) == 0)
return 0;
} else if (RAND_bytes(ptr, 8) <= 0) {
return 0;
}
DES_set_odd_parity((DES_cblock *)ptr);
return 1;
+11 -2
View File
@@ -15,6 +15,7 @@
# include "internal/evp_int.h"
# include <openssl/des.h>
# include <openssl/rand.h>
# include <internal/rand.h>
# include "evp_locl.h"
typedef struct {
@@ -283,8 +284,12 @@ static int des3_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)
switch (type) {
case EVP_CTRL_RAND_KEY:
if (RAND_bytes(ptr, EVP_CIPHER_CTX_key_length(ctx)) <= 0)
if (ctx->drbg != NULL) {
if (RAND_DRBG_bytes(ctx->drbg, ptr, EVP_CIPHER_CTX_key_length(ctx)) == 0)
return 0;
} else if (RAND_bytes(ptr, EVP_CIPHER_CTX_key_length(ctx)) <= 0) {
return 0;
}
DES_set_odd_parity(deskey);
if (EVP_CIPHER_CTX_key_length(ctx) >= 16)
DES_set_odd_parity(deskey + 1);
@@ -372,8 +377,12 @@ static int des_ede3_wrap(EVP_CIPHER_CTX *ctx, unsigned char *out,
memcpy(out + inl + 8, sha1tmp, 8);
OPENSSL_cleanse(sha1tmp, SHA_DIGEST_LENGTH);
/* Generate random IV */
if (RAND_bytes(EVP_CIPHER_CTX_iv_noconst(ctx), 8) <= 0)
if (ctx->drbg != NULL) {
if (RAND_DRBG_bytes(ctx->drbg, EVP_CIPHER_CTX_iv_noconst(ctx), 8) == 0)
return -1;
} else if (RAND_bytes(EVP_CIPHER_CTX_iv_noconst(ctx), 8) <= 0) {
return -1;
}
memcpy(out, EVP_CIPHER_CTX_iv_noconst(ctx), 8);
/* Encrypt everything after IV in place */
des_ede_cbc_cipher(ctx, out + 8, out + 8, inl + 8);
+15 -1
View File
@@ -15,6 +15,7 @@
#include <openssl/rand.h>
#include <openssl/engine.h>
#include "internal/evp_int.h"
#include "internal/rand.h"
#include "evp_locl.h"
int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c)
@@ -577,6 +578,15 @@ int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int pad)
int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)
{
int ret;
if (type == EVP_CTRL_GET_DRBG) {
*(RAND_DRBG **)ptr = ctx->drbg;
return 1;
}
if (type == EVP_CTRL_SET_DRBG) {
ctx->drbg = ptr;
return 1;
}
if (!ctx->cipher) {
EVPerr(EVP_F_EVP_CIPHER_CTX_CTRL, EVP_R_NO_CIPHER_SET);
return 0;
@@ -600,8 +610,12 @@ int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key)
{
if (ctx->cipher->flags & EVP_CIPH_RAND_KEY)
return EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_RAND_KEY, 0, key);
if (RAND_bytes(key, ctx->key_len) <= 0)
if (ctx->drbg) {
if (RAND_DRBG_bytes(ctx->drbg, key, ctx->key_len) == 0)
return 0;
} else if (RAND_bytes(key, ctx->key_len) <= 0) {
return 0;
}
return 1;
}
+1
View File
@@ -39,6 +39,7 @@ struct evp_cipher_ctx_st {
int final_used;
int block_mask;
unsigned char final[EVP_MAX_BLOCK_LENGTH]; /* possible final block */
RAND_DRBG *drbg;
} /* EVP_CIPHER_CTX */ ;
int PKCS5_v2_PBKDF2_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass,
+10 -3
View File
@@ -14,6 +14,8 @@
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/x509.h>
#include <internal/rand.h>
#include "evp_locl.h"
int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
unsigned char **ek, int *ekl, unsigned char *iv,
@@ -31,9 +33,14 @@ int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
return 1;
if (EVP_CIPHER_CTX_rand_key(ctx, key) <= 0)
return 0;
if (EVP_CIPHER_CTX_iv_length(ctx)
&& RAND_bytes(iv, EVP_CIPHER_CTX_iv_length(ctx)) <= 0)
return 0;
if (EVP_CIPHER_CTX_iv_length(ctx)) {
if (ctx->drbg) {
if (RAND_DRBG_bytes(ctx->drbg, iv, EVP_CIPHER_CTX_iv_length(ctx)) == 0)
return 0;
} else if (RAND_bytes(iv, EVP_CIPHER_CTX_iv_length(ctx)) <= 0) {
return 0;
}
}
if (!EVP_EncryptInit_ex(ctx, NULL, NULL, key, iv))
return 0;
+2
View File
@@ -51,6 +51,7 @@ static const EVP_PKEY_METHOD *standard_methods[] = {
&tls1_prf_pkey_meth,
#ifndef OPENSSL_NO_EC
&ecx25519_pkey_meth,
&ecx448_pkey_meth,
#endif
&hkdf_pkey_meth,
#ifndef OPENSSL_NO_POLY1305
@@ -61,6 +62,7 @@ static const EVP_PKEY_METHOD *standard_methods[] = {
#endif
#ifndef OPENSSL_NO_EC
&ed25519_pkey_meth,
&ed448_pkey_meth,
#endif
};

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