Latest update.
This commit is contained in:
@@ -9,6 +9,33 @@
|
||||
|
||||
Changes between 1.1.1 and 3.0.0 [xx XXX xxxx]
|
||||
|
||||
*) Added functionality to create an EVP_PKEY context based on data
|
||||
for methods from providers. This takes an algorithm name and a
|
||||
property query string and simply stores them, with the intent
|
||||
that any operation that uses this context will use those strings
|
||||
to fetch the needed methods implicitly, thereby making the port
|
||||
of application written for pre-3.0 OpenSSL easier.
|
||||
[Richard Levitte]
|
||||
|
||||
*) The undocumented function NCONF_WIN32() has been deprecated; for
|
||||
conversion details see the HISTORY section of doc/man5/config.pod
|
||||
[Rich Salz]
|
||||
|
||||
*) Introduced the new functions EVP_DigestSignInit_ex() and
|
||||
EVP_DigestVerifyInit_ex(). The macros EVP_DigestSignUpdate() and
|
||||
EVP_DigestVerifyUpdate() have been converted to functions. See the man
|
||||
pages for further details.
|
||||
[Matt Caswell]
|
||||
|
||||
*) Over two thousand fixes were made to the documentation, including:
|
||||
adding missing command flags, better style conformance, documentation
|
||||
of internals, etc.
|
||||
[Rich Salz, Richard Levitte]
|
||||
|
||||
*) s390x assembly pack: add hardware-support for P-256, P-384, P-521,
|
||||
X25519, X448, Ed25519 and Ed448.
|
||||
[Patrick Steuer]
|
||||
|
||||
*) Print all values for a PKCS#12 attribute with 'openssl pkcs12', not just
|
||||
the first value.
|
||||
[Jon Spillett]
|
||||
|
||||
@@ -450,7 +450,7 @@ my %targets = (
|
||||
# 32-bit message digests. (For the moment of this writing) HP C
|
||||
# doesn't seem to "digest" too many local variables (they make "him"
|
||||
# chew forever:-). For more details look-up MD32_XARRAY comment in
|
||||
# crypto/sha/sha_lcl.h.
|
||||
# crypto/sha/sha_local.h.
|
||||
# - originally there were 32-bit hpux-parisc2-* targets. They were
|
||||
# scrapped, because a) they were not interchangeable with other 32-bit
|
||||
# targets; b) performance-critical 32-bit assembly modules implement
|
||||
|
||||
+286
-53
@@ -2,37 +2,99 @@
|
||||
|
||||
use File::Basename;
|
||||
|
||||
my $debug_resolvedepends = $ENV{BUILDFILE_DEBUG_DEPENDS};
|
||||
my $debug_rules = $ENV{BUILDFILE_DEBUG_RULES};
|
||||
|
||||
# A cache of objects for which a recipe has already been generated
|
||||
my %cache;
|
||||
|
||||
# resolvedepends and reducedepends work in tandem to make sure
|
||||
# there are no duplicate dependencies and that they are in the
|
||||
# right order. This is especially used to sort the list of
|
||||
# libraries that a build depends on.
|
||||
# collectdepends, expanddepends and reducedepends work together to make
|
||||
# sure there are no duplicate or weak dependencies and that they are in
|
||||
# the right order. This is used to sort the list of libraries that a
|
||||
# build depends on.
|
||||
sub extensionlesslib {
|
||||
my @result = map { $_ =~ /(\.a)?$/; $` } @_;
|
||||
return @result if wantarray;
|
||||
return $result[0];
|
||||
}
|
||||
sub resolvedepends {
|
||||
|
||||
# collectdepends dives into the tree of dependencies and returns
|
||||
# a list of all the non-weak ones.
|
||||
sub collectdepends {
|
||||
return () unless @_;
|
||||
|
||||
my $thing = shift;
|
||||
my $extensionlessthing = extensionlesslib($thing);
|
||||
my @listsofar = @_; # to check if we're looping
|
||||
my @list = @{$unified_info{depends}->{$thing} //
|
||||
$unified_info{depends}->{$extensionlessthing}};
|
||||
my @newlist = ();
|
||||
if (scalar @list) {
|
||||
foreach my $item (@list) {
|
||||
my $extensionlessitem = extensionlesslib($item);
|
||||
# It's time to break off when the dependency list starts looping
|
||||
next if grep { extensionlesslib($_) eq $extensionlessitem } @listsofar;
|
||||
push @newlist, $item, resolvedepends($item, @listsofar, $item);
|
||||
}
|
||||
|
||||
print STDERR "DEBUG[collectdepends] $thing > ", join(' ', @listsofar), "\n"
|
||||
if $debug_resolvedepends;
|
||||
foreach my $item (@list) {
|
||||
my $extensionlessitem = extensionlesslib($item);
|
||||
# It's time to break off when the dependency list starts looping
|
||||
next if grep { extensionlesslib($_) eq $extensionlessitem } @listsofar;
|
||||
# Don't add anything here if the dependency is weak
|
||||
next if defined $unified_info{attributes}->{depends}->{$thing}->{$item}->{'weak'};
|
||||
my @resolved = collectdepends($item, @listsofar, $item);
|
||||
push @newlist, $item, @resolved;
|
||||
}
|
||||
print STDERR "DEBUG[collectdepends] $thing < ", join(' ', @newlist), "\n"
|
||||
if $debug_resolvedepends;
|
||||
@newlist;
|
||||
}
|
||||
|
||||
# expanddepends goes through a list of stuff, checks if they have any
|
||||
# dependencies, and adds them at the end of the current position if
|
||||
# they aren't already present later on.
|
||||
sub expanddepends {
|
||||
my @after = ( @_ );
|
||||
print STDERR "DEBUG[expanddepends]> ", join(' ', @after), "\n"
|
||||
if $debug_resolvedepends;
|
||||
my @before = ();
|
||||
while (@after) {
|
||||
my $item = shift @after;
|
||||
print STDERR "DEBUG[expanddepends]\\ ", join(' ', @before), "\n"
|
||||
if $debug_resolvedepends;
|
||||
print STDERR "DEBUG[expanddepends] - ", $item, "\n"
|
||||
if $debug_resolvedepends;
|
||||
my @middle = (
|
||||
$item,
|
||||
map {
|
||||
my $x = $_;
|
||||
my $extlessx = extensionlesslib($x);
|
||||
if (grep { $extlessx eq extensionlesslib($_) } @before
|
||||
and
|
||||
!grep { $extlessx eq extensionlesslib($_) } @after) {
|
||||
print STDERR "DEBUG[expanddepends] + ", $x, "\n"
|
||||
if $debug_resolvedepends;
|
||||
( $x )
|
||||
} else {
|
||||
print STDERR "DEBUG[expanddepends] ! ", $x, "\n"
|
||||
if $debug_resolvedepends;
|
||||
()
|
||||
}
|
||||
} @{$unified_info{depends}->{$item} // []}
|
||||
);
|
||||
print STDERR "DEBUG[expanddepends] = ", join(' ', @middle), "\n"
|
||||
if $debug_resolvedepends;
|
||||
print STDERR "DEBUG[expanddepends]/ ", join(' ', @after), "\n"
|
||||
if $debug_resolvedepends;
|
||||
push @before, @middle;
|
||||
}
|
||||
print STDERR "DEBUG[expanddepends]< ", join(' ', @before), "\n"
|
||||
if $debug_resolvedepends;
|
||||
@before;
|
||||
}
|
||||
|
||||
# reducedepends looks through a list, and checks if each item is
|
||||
# repeated later on. If it is, the earlier copy is dropped.
|
||||
sub reducedepends {
|
||||
my @list = @_;
|
||||
print STDERR "DEBUG[reducedepends]> ", join(' ', @list), "\n"
|
||||
if $debug_resolvedepends;
|
||||
my @newlist = ();
|
||||
my %replace = ();
|
||||
while (@list) {
|
||||
@@ -49,7 +111,25 @@
|
||||
push @newlist, $item;
|
||||
}
|
||||
}
|
||||
map { $replace{$_} // $_; } @newlist;
|
||||
@newlist = map { $replace{$_} // $_; } @newlist;
|
||||
print STDERR "DEBUG[reducedepends]< ", join(' ', @newlist), "\n"
|
||||
if $debug_resolvedepends;
|
||||
@newlist;
|
||||
}
|
||||
|
||||
# Do it all
|
||||
# This takes multiple inputs and combine them into a single list of
|
||||
# interdependent things. The returned value will include all the input.
|
||||
# Callers are responsible for taking away the things they are building.
|
||||
sub resolvedepends {
|
||||
print STDERR "DEBUG[resolvedepends] START (", join(', ', @_), ")\n"
|
||||
if $debug_resolvedepends;
|
||||
my @all =
|
||||
reducedepends(expanddepends(map { ( $_, collectdepends($_) ) } @_));
|
||||
print STDERR "DEBUG[resolvedepends] END (", join(', ', @_), ") : ",
|
||||
join(',', map { "\n $_" } @all), "\n"
|
||||
if $debug_resolvedepends;
|
||||
@all;
|
||||
}
|
||||
|
||||
# dogenerate is responsible for producing all the recipes that build
|
||||
@@ -91,14 +171,30 @@
|
||||
my $bin = shift;
|
||||
my %opts = @_;
|
||||
if (@{$unified_info{sources}->{$obj}}) {
|
||||
$OUT .= src2obj(obj => $obj,
|
||||
product => $bin,
|
||||
srcs => $unified_info{sources}->{$obj},
|
||||
deps => $unified_info{depends}->{$obj},
|
||||
incs => [ @{$unified_info{includes}->{$obj}},
|
||||
@{$unified_info{includes}->{$bin}} ],
|
||||
defs => [ @{$unified_info{defines}->{$obj}},
|
||||
@{$unified_info{defines}->{$bin}} ],
|
||||
my @srcs = @{$unified_info{sources}->{$obj}};
|
||||
my @deps = @{$unified_info{depends}->{$obj}};
|
||||
my @incs = ( @{$unified_info{includes}->{$obj}},
|
||||
@{$unified_info{includes}->{$bin}} );
|
||||
my @defs = ( @{$unified_info{defines}->{$obj}},
|
||||
@{$unified_info{defines}->{$bin}} );
|
||||
print STDERR "DEBUG[doobj] \@srcs for $obj ($bin) : ",
|
||||
join(",", map { "\n $_" } @srcs), "\n"
|
||||
if $debug_rules;
|
||||
print STDERR "DEBUG[doobj] \@deps for $obj ($bin) : ",
|
||||
join(",", map { "\n $_" } @deps), "\n"
|
||||
if $debug_rules;
|
||||
print STDERR "DEBUG[doobj] \@incs for $obj ($bin) : ",
|
||||
join(",", map { "\n $_" } @incs), "\n"
|
||||
if $debug_rules;
|
||||
print STDERR "DEBUG[doobj] \@defs for $obj ($bin) : ",
|
||||
join(",", map { "\n $_" } @defs), "\n"
|
||||
if $debug_rules;
|
||||
print STDERR "DEBUG[doobj] \%opts for $obj ($bin) : ", ,
|
||||
join(",", map { "\n $_ = $opts{$_}" } sort keys %opts), "\n"
|
||||
if $debug_rules;
|
||||
$OUT .= src2obj(obj => $obj, product => $bin,
|
||||
srcs => [ @srcs ], deps => [ @deps ],
|
||||
incs => [ @incs ], defs => [ @defs ],
|
||||
%opts);
|
||||
foreach ((@{$unified_info{sources}->{$obj}},
|
||||
@{$unified_info{depends}->{$obj}})) {
|
||||
@@ -108,37 +204,152 @@
|
||||
$cache{$obj} = 1;
|
||||
}
|
||||
|
||||
# Helper functions to grab all applicable intermediary files.
|
||||
# This is particularly useful when a library is given as source
|
||||
# rather than a dependency. In that case, we consider it to be a
|
||||
# container with object file references, or possibly references
|
||||
# to further libraries to pilfer in the same way.
|
||||
sub getsrclibs {
|
||||
my $section = shift;
|
||||
|
||||
# For all input, see if it sources static libraries. If it does,
|
||||
# return them together with the result of a recursive call.
|
||||
map { ( $_, getsrclibs($section, $_) ) }
|
||||
grep { $_ =~ m|\.a$| }
|
||||
map { @{$unified_info{$section}->{$_} // []} }
|
||||
@_;
|
||||
}
|
||||
|
||||
sub getlibobjs {
|
||||
my $section = shift;
|
||||
|
||||
# For all input, see if it's an intermediary file (library or object).
|
||||
# If it is, collect the result of a recursive call, or if that returns
|
||||
# an empty list, the element itself. Return the result.
|
||||
map {
|
||||
my @x = getlibobjs($section, @{$unified_info{$section}->{$_}});
|
||||
@x ? @x : ( $_ );
|
||||
}
|
||||
grep { defined $unified_info{$section}->{$_} }
|
||||
@_;
|
||||
}
|
||||
|
||||
# dolib is responsible for building libraries. It will call
|
||||
# obj2shlib is shared libraries are produced, and obj2lib in all
|
||||
# obj2shlib if shared libraries are produced, and obj2lib in all
|
||||
# cases. It also makes sure all object files for the library are
|
||||
# built.
|
||||
sub dolib {
|
||||
my $lib = shift;
|
||||
return "" if $cache{$lib};
|
||||
|
||||
my %attrs = %{$unified_info{attributes}->{libraries}->{$lib}};
|
||||
|
||||
my @deps = ( resolvedepends(getsrclibs('sources', $lib)) );
|
||||
|
||||
# We support two types of objs, those who are specific to this library
|
||||
# (they end up in @objs) and those that we get indirectly, via other
|
||||
# libraries (they end up in @foreign_objs). We get the latter any time
|
||||
# someone has done something like this in build.info:
|
||||
# SOURCE[libfoo.a]=libbar.a
|
||||
# The indirect object files must be kept in a separate array so they
|
||||
# don't get rebuilt unnecessarily (and with incorrect auxiliary
|
||||
# information).
|
||||
#
|
||||
# Object files can't be collected commonly for shared and static
|
||||
# libraries, because we contain their respective object files in
|
||||
# {shared_sources} and {sources}, and because the implications are
|
||||
# slightly different for each library form.
|
||||
#
|
||||
# We grab all these "foreign" object files recursively with getlibobjs().
|
||||
|
||||
unless ($disabled{shared} || $lib =~ /\.a$/) {
|
||||
my $obj2shlib = defined &obj2shlib ? \&obj2shlib : \&libobj2shlib;
|
||||
# If this library sources other static libraries and those
|
||||
# libraries are marked {noinst}, there's no need to include
|
||||
# all of their object files. Instead, we treat those static
|
||||
# libraries as dependents alongside any other library this
|
||||
# one depends on, and let symbol resolution do its job.
|
||||
my @sourced_libs = ();
|
||||
my @objs = ();
|
||||
my @foreign_objs = ();
|
||||
my @deps = ();
|
||||
foreach (@{$unified_info{shared_sources}->{$lib}}) {
|
||||
if ($_ !~ m|\.a$|) {
|
||||
push @objs, $_;
|
||||
} elsif ($unified_info{attributes}->{libraries}->{$_}->{noinst}) {
|
||||
push @deps, $_;
|
||||
} else {
|
||||
push @deps, getsrclibs('sources', $_);
|
||||
push @foreign_objs, getlibobjs('sources', $_);
|
||||
}
|
||||
}
|
||||
@deps = ( grep { $_ ne $lib } resolvedepends($lib, @deps) );
|
||||
print STDERR "DEBUG[dolib:shlib] \%attrs for $lib : ", ,
|
||||
join(",", map { "\n $_ = $attrs{$_}" } sort keys %attrs), "\n"
|
||||
if %attrs && $debug_rules;
|
||||
print STDERR "DEBUG[dolib:shlib] \@deps for $lib : ",
|
||||
join(",", map { "\n $_" } @deps), "\n"
|
||||
if @deps && $debug_rules;
|
||||
print STDERR "DEBUG[dolib:shlib] \@objs for $lib : ",
|
||||
join(",", map { "\n $_" } @objs), "\n"
|
||||
if @objs && $debug_rules;
|
||||
print STDERR "DEBUG[dolib:shlib] \@foreign_objs for $lib : ",
|
||||
join(",", map { "\n $_" } @foreign_objs), "\n"
|
||||
if @foreign_objs && $debug_rules;
|
||||
$OUT .= $obj2shlib->(lib => $lib,
|
||||
attrs => $unified_info{attributes}->{$lib},
|
||||
objs => $unified_info{shared_sources}->{$lib},
|
||||
deps => [ reducedepends(resolvedepends($lib)) ]);
|
||||
foreach ((@{$unified_info{shared_sources}->{$lib}},
|
||||
@{$unified_info{sources}->{$lib}})) {
|
||||
attrs => { %attrs },
|
||||
objs => [ @objs, @foreign_objs ],
|
||||
deps => [ @deps ]);
|
||||
foreach (@objs) {
|
||||
# If this is somehow a compiled object, take care of it that way
|
||||
# Otherwise, it might simply be generated
|
||||
if (defined $unified_info{sources}->{$_}) {
|
||||
doobj($_, $lib, intent => "shlib",
|
||||
attrs => $unified_info{attributes}->{$lib});
|
||||
if($_ =~ /\.a$/) {
|
||||
dolib($_);
|
||||
} else {
|
||||
doobj($_, $lib, intent => "shlib", attrs => { %attrs });
|
||||
}
|
||||
} else {
|
||||
dogenerate($_, undef, undef, intent => "lib");
|
||||
}
|
||||
}
|
||||
}
|
||||
$OUT .= obj2lib(lib => $lib,
|
||||
attrs => $unified_info{attributes}->{$lib},
|
||||
objs => [ @{$unified_info{sources}->{$lib}} ]);
|
||||
foreach (@{$unified_info{sources}->{$lib}}) {
|
||||
doobj($_, $lib, intent => "lib",
|
||||
attrs => $unified_info{attributes}->{$lib});
|
||||
{
|
||||
# When putting static libraries together, we cannot rely on any
|
||||
# symbol resolution, so for all static libraries used as source for
|
||||
# this one, as well as other libraries they depend on, we simply
|
||||
# grab all their object files unconditionally,
|
||||
# Symbol resolution will happen when any program, module or shared
|
||||
# library is linked with this one.
|
||||
my @objs = ();
|
||||
my @sourcedeps = ();
|
||||
my @foreign_objs = ();
|
||||
foreach (@{$unified_info{sources}->{$lib}}) {
|
||||
if ($_ !~ m|\.a$|) {
|
||||
push @objs, $_;
|
||||
} else {
|
||||
push @sourcedeps, $_;
|
||||
}
|
||||
}
|
||||
@sourcedeps = ( grep { $_ ne $lib } resolvedepends(@sourcedeps) );
|
||||
print STDERR "DEBUG[dolib:lib] : \@sourcedeps for $_ : ",
|
||||
join(",", map { "\n $_" } @sourcedeps), "\n"
|
||||
if @sourcedeps && $debug_rules;
|
||||
@foreign_objs = getlibobjs('sources', @sourcedeps);
|
||||
print STDERR "DEBUG[dolib:lib] \%attrs for $lib : ", ,
|
||||
join(",", map { "\n $_ = $attrs{$_}" } sort keys %attrs), "\n"
|
||||
if %attrs && $debug_rules;
|
||||
print STDERR "DEBUG[dolib:lib] \@objs for $lib : ",
|
||||
join(",", map { "\n $_" } @objs), "\n"
|
||||
if @objs && $debug_rules;
|
||||
print STDERR "DEBUG[dolib:lib] \@foreign_objs for $lib : ",
|
||||
join(",", map { "\n $_" } @foreign_objs), "\n"
|
||||
if @foreign_objs && $debug_rules;
|
||||
$OUT .= obj2lib(lib => $lib, attrs => { %attrs },
|
||||
objs => [ @objs, @foreign_objs ]);
|
||||
foreach (@objs) {
|
||||
doobj($_, $lib, intent => "lib", attrs => { %attrs });
|
||||
}
|
||||
}
|
||||
$cache{$lib} = 1;
|
||||
}
|
||||
@@ -147,23 +358,35 @@
|
||||
# obj2dso, and also makes sure all object files for the library
|
||||
# are built.
|
||||
sub domodule {
|
||||
my $lib = shift;
|
||||
return "" if $cache{$lib};
|
||||
$OUT .= obj2dso(lib => $lib,
|
||||
attrs => $unified_info{attributes}->{$lib},
|
||||
objs => $unified_info{sources}->{$lib},
|
||||
deps => [ resolvedepends($lib) ]);
|
||||
foreach (@{$unified_info{sources}->{$lib}}) {
|
||||
my $module = shift;
|
||||
return "" if $cache{$module};
|
||||
my %attrs = %{$unified_info{attributes}->{modules}->{$module}};
|
||||
my @objs = @{$unified_info{sources}->{$module}};
|
||||
my @deps = ( grep { $_ ne $module }
|
||||
resolvedepends($module) );
|
||||
print STDERR "DEBUG[domodule] \%attrs for $module :",
|
||||
join(",", map { "\n $_ = $attrs{$_}" } sort keys %attrs), "\n"
|
||||
if $debug_rules;
|
||||
print STDERR "DEBUG[domodule] \@objs for $module : ",
|
||||
join(",", map { "\n $_" } @objs), "\n"
|
||||
if $debug_rules;
|
||||
print STDERR "DEBUG[domodule] \@deps for $module : ",
|
||||
join(",", map { "\n $_" } @deps), "\n"
|
||||
if $debug_rules;
|
||||
$OUT .= obj2dso(module => $module,
|
||||
attrs => { %attrs },
|
||||
objs => [ @objs ],
|
||||
deps => [ @deps ]);
|
||||
foreach (@{$unified_info{sources}->{$module}}) {
|
||||
# If this is somehow a compiled object, take care of it that way
|
||||
# Otherwise, it might simply be generated
|
||||
if (defined $unified_info{sources}->{$_}) {
|
||||
doobj($_, $lib, intent => "dso",
|
||||
attrs => $unified_info{attributes}->{$lib});
|
||||
doobj($_, $module, intent => "dso", attrs => { %attrs });
|
||||
} else {
|
||||
dogenerate($_, undef, $lib, intent => "dso");
|
||||
dogenerate($_, undef, $module, intent => "dso");
|
||||
}
|
||||
}
|
||||
$cache{$lib} = 1;
|
||||
$cache{$module} = 1;
|
||||
}
|
||||
|
||||
# dobin is responsible for building programs. It will call obj2bin,
|
||||
@@ -171,14 +394,24 @@
|
||||
sub dobin {
|
||||
my $bin = shift;
|
||||
return "" if $cache{$bin};
|
||||
my $deps = [ reducedepends(resolvedepends($bin)) ];
|
||||
my %attrs = %{$unified_info{attributes}->{programs}->{$bin}};
|
||||
my @objs = @{$unified_info{sources}->{$bin}};
|
||||
my @deps = ( grep { $_ ne $bin } resolvedepends($bin) );
|
||||
print STDERR "DEBUG[dobin] \%attrs for $bin : ",
|
||||
join(",", map { "\n $_ = $attrs{$_}" } sort keys %attrs), "\n"
|
||||
if %attrs && $debug_rules;
|
||||
print STDERR "DEBUG[dobin] \@objs for $bin : ",
|
||||
join(",", map { "\n $_" } @objs), "\n"
|
||||
if @objs && $debug_rules;
|
||||
print STDERR "DEBUG[dobin] \@deps for $bin : ",
|
||||
join(",", map { "\n $_" } @deps), "\n"
|
||||
if @deps && $debug_rules;
|
||||
$OUT .= obj2bin(bin => $bin,
|
||||
attrs => $unified_info{attributes}->{$bin},
|
||||
objs => [ @{$unified_info{sources}->{$bin}} ],
|
||||
deps => $deps);
|
||||
foreach (@{$unified_info{sources}->{$bin}}) {
|
||||
doobj($_, $bin, intent => "bin",
|
||||
attrs => $unified_info{attributes}->{$bin});
|
||||
attrs => { %attrs },
|
||||
objs => [ @objs ],
|
||||
deps => [ @deps ]);
|
||||
foreach (@objs) {
|
||||
doobj($_, $bin, intent => "bin", attrs => { %attrs });
|
||||
}
|
||||
$cache{$bin} = 1;
|
||||
}
|
||||
|
||||
@@ -48,26 +48,26 @@
|
||||
@{$unified_info{libraries}};
|
||||
our @install_libs =
|
||||
map { platform->staticname($_) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}};
|
||||
our @install_shlibs =
|
||||
map { platform->sharedname($_) // () }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}};
|
||||
our @install_engines =
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{$_}->{engine} }
|
||||
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{modules}->{$_}->{engine} }
|
||||
@{$unified_info{modules}};
|
||||
our @install_programs =
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
|
||||
@{$unified_info{programs}};
|
||||
our @install_bin_scripts =
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& !$unified_info{attributes}->{$_}->{misc} }
|
||||
grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
|
||||
&& !$unified_info{attributes}->{scripts}->{$_}->{misc} }
|
||||
@{$unified_info{scripts}};
|
||||
our @install_misc_scripts =
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{$_}->{misc} }
|
||||
grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{scripts}->{$_}->{misc} }
|
||||
@{$unified_info{scripts}};
|
||||
|
||||
# This is a horrible hack, but is needed because recursive inclusion of files
|
||||
@@ -704,7 +704,7 @@ reconfigure reconf :
|
||||
# On Unix platforms, we depend on {shlibname}.so
|
||||
return map {
|
||||
{ lib => platform->sharedlib($_) // platform->staticlib($_),
|
||||
attrs => $unified_info{attributes}->{$_} }
|
||||
attrs => $unified_info{attributes}->{libraries}->{$_} }
|
||||
} @_;
|
||||
}
|
||||
|
||||
@@ -775,10 +775,14 @@ EOF
|
||||
my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
|
||||
"util", "dofile.pl")),
|
||||
rel2abs($config{builddir}));
|
||||
my @modules = ( 'configdata.pm',
|
||||
grep { $_ =~ m|\.pm$| } @{$args{deps}} );
|
||||
my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules;
|
||||
@modules = map { '"-M'.basename($_, '.pm').'"' } @modules;
|
||||
my $modules = join(' ', '', sort keys %moduleincs, @modules);
|
||||
return <<"EOF";
|
||||
$target : $args{generator}->[0] $deps
|
||||
\$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\
|
||||
"-o$target{build_file}" $generator > \$\@
|
||||
\$(PERL)$modules $dofile "-o$target{build_file}" $generator > \$\@
|
||||
EOF
|
||||
} else {
|
||||
return <<"EOF";
|
||||
@@ -1014,8 +1018,8 @@ EOF
|
||||
}
|
||||
sub obj2dso {
|
||||
my %args = @_;
|
||||
my $dsoname = platform->dsoname($args{lib});
|
||||
my $dso = platform->dso($args{lib});
|
||||
my $dsoname = platform->dsoname($args{module});
|
||||
my $dso = platform->dso($args{module});
|
||||
my @objs = map { platform->convertext($_) }
|
||||
grep { platform->isobj($_) }
|
||||
@{$args{objs}};
|
||||
|
||||
@@ -52,11 +52,13 @@ sub isdef { return $_[1] =~ m|\.ld$|; }
|
||||
sub isobj { return $_[1] =~ m|\.o$|; }
|
||||
sub isres { return $_[1] =~ m|\.res$|; }
|
||||
sub isasm { return $_[1] =~ m|\.[Ss]$|; }
|
||||
sub isstaticlib { return $_[1] =~ m|\.a$|; }
|
||||
sub convertext {
|
||||
if ($_[0]->isdef($_[1])) { return $_[0]->def($_[1]); }
|
||||
if ($_[0]->isobj($_[1])) { return $_[0]->obj($_[1]); }
|
||||
if ($_[0]->isres($_[1])) { return $_[0]->res($_[1]); }
|
||||
if ($_[0]->isasm($_[1])) { return $_[0]->asm($_[1]); }
|
||||
if ($_[0]->isdef($_[1])) { return $_[0]->def($_[1]); }
|
||||
if ($_[0]->isobj($_[1])) { return $_[0]->obj($_[1]); }
|
||||
if ($_[0]->isres($_[1])) { return $_[0]->res($_[1]); }
|
||||
if ($_[0]->isasm($_[1])) { return $_[0]->asm($_[1]); }
|
||||
if ($_[0]->isstaticlib($_[1])) { return $_[0]->staticlib($_[1]); }
|
||||
return $_[1];
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,9 @@ sub objext { '.obj' }
|
||||
sub libext { '.a' }
|
||||
sub dsoext { '.dll' }
|
||||
sub defext { '.def' }
|
||||
|
||||
# Other extra that aren't defined in platform::BASE
|
||||
sub resext { '.res.obj' }
|
||||
sub shlibext { '.dll' }
|
||||
sub shlibextimport { $target{shared_import_extension} || '.dll.a' }
|
||||
sub shlibextsimple { undef }
|
||||
|
||||
@@ -20,6 +20,40 @@
|
||||
|
||||
return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
|
||||
}
|
||||
|
||||
our $COLUMNS = $ENV{COLUMNS};
|
||||
if ($COLUMNS =~ /^\d+$/) {
|
||||
$COLUMNS = int($COLUMNS) - 2; # 2 to leave space for ending ' \'
|
||||
} else {
|
||||
$COLUMNS = 76;
|
||||
}
|
||||
|
||||
sub fill_lines {
|
||||
my $item_sep = shift; # string
|
||||
my $line_length = shift; # number of chars
|
||||
|
||||
my @result = ();
|
||||
my $resultpos = 0;
|
||||
|
||||
foreach (@_) {
|
||||
my $fill_line = $result[$resultpos] // '';
|
||||
my $newline =
|
||||
($fill_line eq '' ? '' : $fill_line . $item_sep) . $_;
|
||||
|
||||
if (length($newline) > $line_length) {
|
||||
# If this is a single item and the intended result line
|
||||
# is empty, we put it there anyway
|
||||
if ($fill_line eq '') {
|
||||
$result[$resultpos++] = $newline;
|
||||
} else {
|
||||
$result[++$resultpos] = $_;
|
||||
}
|
||||
} else {
|
||||
$result[$resultpos] = $newline;
|
||||
}
|
||||
}
|
||||
return @result;
|
||||
}
|
||||
'';
|
||||
-}
|
||||
PLATFORM={- $config{target} -}
|
||||
@@ -34,65 +68,99 @@ MINOR={- $config{minor} -}
|
||||
SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
|
||||
SHLIB_TARGET={- $target{shared_target} -}
|
||||
|
||||
LIBS={- join(" ", map { platform->staticlib($_) // () } @{$unified_info{libraries}}) -}
|
||||
SHLIBS={- join(" ", map { platform->sharedlib($_) // () } @{$unified_info{libraries}}) -}
|
||||
SHLIB_INFO={- join(" ", map { my $x = platform->sharedlib($_);
|
||||
my $y = platform->sharedlib_simple($_);
|
||||
$x ? "\"$x;$y\"" : () }
|
||||
@{$unified_info{libraries}}) -}
|
||||
MODULES={- join(" ", map { platform->dso($_) } @{$unified_info{modules}}) -}
|
||||
PROGRAMS={- join(" ", map { platform->bin($_) } @{$unified_info{programs}}) -}
|
||||
SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
|
||||
LIBS={- join(" \\\n" . ' ' x 5,
|
||||
fill_lines(" ", $COLUMNS - 5,
|
||||
map { platform->staticlib($_) // () }
|
||||
@{$unified_info{libraries}})) -}
|
||||
SHLIBS={- join(" \\\n" . ' ' x 7,
|
||||
fill_lines(" ", $COLUMNS - 7,
|
||||
map { platform->sharedlib($_) // () }
|
||||
@{$unified_info{libraries}})) -}
|
||||
SHLIB_INFO={- join(" \\\n" . ' ' x 11,
|
||||
fill_lines(" ", $COLUMNS - 11,
|
||||
map { my $x = platform->sharedlib($_);
|
||||
my $y = platform->sharedlib_simple($_);
|
||||
$x ? "\"$x;$y\"" : () }
|
||||
@{$unified_info{libraries}})) -}
|
||||
MODULES={- join(" \\\n" . ' ' x 8,
|
||||
fill_lines(" ", $COLUMNS - 8,
|
||||
map { platform->dso($_) }
|
||||
@{$unified_info{modules}})) -}
|
||||
PROGRAMS={- join(" \\\n" . ' ' x 9,
|
||||
fill_lines(" ", $COLUMNS - 9,
|
||||
map { platform->bin($_) }
|
||||
@{$unified_info{programs}})) -}
|
||||
SCRIPTS={- join(" \\\n" . ' ' x 8,
|
||||
fill_lines(" ", $COLUMNS - 8, @{$unified_info{scripts}})) -}
|
||||
{- output_off() if $disabled{makedepend}; "" -}
|
||||
DEPS={- join(" ", map { platform->isobj($_) ? platform->dep($_) : () }
|
||||
grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
|
||||
keys %{$unified_info{sources}}); -}
|
||||
DEPS={- join(" \\\n" . ' ' x 5,
|
||||
fill_lines(" ", $COLUMNS - 5,
|
||||
map { platform->isobj($_) ? platform->dep($_) : () }
|
||||
grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
|
||||
keys %{$unified_info{sources}})); -}
|
||||
{- output_on() if $disabled{makedepend}; "" -}
|
||||
GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}}) -}
|
||||
GENERATED_MANDATORY={- join(" \\\n" . ' ' x 20,
|
||||
fill_lines(" ", $COLUMNS - 20,
|
||||
@{$unified_info{depends}->{""}})) -}
|
||||
GENERATED={- # common0.tmpl provides @generated
|
||||
join(" ", map { platform->convertext($_) } @generated ) -}
|
||||
join(" \\\n" . ' ' x 5,
|
||||
fill_lines(" ", $COLUMNS - 5,
|
||||
map { platform->convertext($_) } @generated )) -}
|
||||
|
||||
INSTALL_LIBS={-
|
||||
join(" ", map { platform->staticlib($_) // () }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}})
|
||||
join(" \\\n" . ' ' x 13,
|
||||
fill_lines(" ", $COLUMNS - 13,
|
||||
map { platform->staticlib($_) // () }
|
||||
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}}))
|
||||
-}
|
||||
INSTALL_SHLIBS={-
|
||||
join(" ", map { platform->sharedlib($_) // () }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}})
|
||||
join(" \\\n" . ' ' x 15,
|
||||
fill_lines(" ", $COLUMNS - 15,
|
||||
map { platform->sharedlib($_) // () }
|
||||
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}}))
|
||||
-}
|
||||
INSTALL_SHLIB_INFO={-
|
||||
join(" ", map { my $x = platform->sharedlib($_);
|
||||
my $y = platform->sharedlib_simple($_);
|
||||
$x ? "\"$x;$y\"" : () }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}})
|
||||
join(" \\\n" . ' ' x 19,
|
||||
fill_lines(" ", $COLUMNS - 19,
|
||||
map { my $x = platform->sharedlib($_);
|
||||
my $y = platform->sharedlib_simple($_);
|
||||
$x ? "\"$x;$y\"" : () }
|
||||
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}}))
|
||||
-}
|
||||
INSTALL_ENGINES={-
|
||||
join(" ", map { platform->dso($_) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{$_}->{engine} }
|
||||
@{$unified_info{modules}})
|
||||
join(" \\\n" . ' ' x 16,
|
||||
fill_lines(" ", $COLUMNS - 16,
|
||||
map { platform->dso($_) }
|
||||
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{modules}->{$_}->{engine} }
|
||||
@{$unified_info{modules}}))
|
||||
-}
|
||||
INSTALL_PROGRAMS={-
|
||||
join(" ", map { platform->bin($_) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
@{$unified_info{programs}})
|
||||
join(" \\\n" . ' ' x 16,
|
||||
fill_lines(" ", $COLUMNS - 16, map { platform->bin($_) }
|
||||
grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
|
||||
@{$unified_info{programs}}))
|
||||
-}
|
||||
BIN_SCRIPTS={-
|
||||
join(" ", map { my $x = $unified_info{attributes}->{$_}->{linkname};
|
||||
$x ? "$_:$x" : $_ }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& !$unified_info{attributes}->{$_}->{misc} }
|
||||
@{$unified_info{scripts}})
|
||||
join(" \\\n" . ' ' x 12,
|
||||
fill_lines(" ", $COLUMNS - 12,
|
||||
map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname};
|
||||
$x ? "$_:$x" : $_ }
|
||||
grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
|
||||
&& !$unified_info{attributes}->{scripts}->{$_}->{misc} }
|
||||
@{$unified_info{scripts}}))
|
||||
-}
|
||||
MISC_SCRIPTS={-
|
||||
join(" ", map { my $x = $unified_info{attributes}->{$_}->{linkname};
|
||||
$x ? "$_:$x" : $_ }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{$_}->{misc} }
|
||||
@{$unified_info{scripts}})
|
||||
join(" \\\n" . ' ' x 13,
|
||||
fill_lines(" ", $COLUMNS - 13,
|
||||
map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname};
|
||||
$x ? "$_:$x" : $_ }
|
||||
grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{scripts}->{$_}->{misc} }
|
||||
@{$unified_info{scripts}}))
|
||||
-}
|
||||
|
||||
APPS_OPENSSL={- use File::Spec::Functions;
|
||||
@@ -729,7 +797,7 @@ generate: generate_apps generate_crypto_bn generate_crypto_objects \
|
||||
|
||||
.PHONY: doc-nits
|
||||
doc-nits: build_generated
|
||||
(cd $(SRCDIR); $(PERL) util/find-doc-nits -n -p -s )
|
||||
(cd $(SRCDIR); $(PERL) util/find-doc-nits -n -e )
|
||||
|
||||
# Test coverage is a good idea for the future
|
||||
#coverage: $(PROGRAMS) $(TESTPROGRAMS)
|
||||
@@ -823,8 +891,10 @@ errors:
|
||||
}
|
||||
"";
|
||||
-}
|
||||
CRYPTOHEADERS={- join(" \\\n\t", sort @cryptoheaders) -}
|
||||
SSLHEADERS={- join(" \\\n\t", sort @sslheaders) -}
|
||||
CRYPTOHEADERS={- join(" \\\n" . ' ' x 14,
|
||||
fill_lines(" ", $COLUMNS - 14, sort @cryptoheaders)) -}
|
||||
SSLHEADERS={- join(" \\\n" . ' ' x 11,
|
||||
fill_lines(" ", $COLUMNS - 11, sort @sslheaders)) -}
|
||||
ordinals:
|
||||
( cd $(SRCDIR); \
|
||||
$(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
|
||||
@@ -918,7 +988,12 @@ openssl.pc:
|
||||
echo 'Version: '$(VERSION); \
|
||||
echo 'Requires: libssl libcrypto' ) > openssl.pc
|
||||
|
||||
configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
|
||||
configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config \
|
||||
{- join(" \\\n" . ' ' x 15,
|
||||
fill_lines(" ", $COLUMNS - 15,
|
||||
@{$config{build_file_templates}},
|
||||
@{$config{build_infos}},
|
||||
@{$config{conf_files}})) -}
|
||||
@echo "Detected changed: $?"
|
||||
$(PERL) configdata.pm -r
|
||||
@echo "**************************************************"
|
||||
@@ -966,10 +1041,14 @@ EOF
|
||||
my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
|
||||
"util", "dofile.pl")),
|
||||
rel2abs($config{builddir}));
|
||||
my @modules = ( 'configdata.pm',
|
||||
grep { $_ =~ m|\.pm$| } @{$args{deps}} );
|
||||
my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules;
|
||||
@modules = map { "-M".basename($_, '.pm') } @modules;
|
||||
my $modules = join(' ', '', sort keys %moduleincs, @modules);
|
||||
return <<"EOF";
|
||||
$args{src}: $args{generator}->[0] $deps
|
||||
\$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
|
||||
"-o$target{build_file}" $generator > \$@
|
||||
$args{src}: $args{generator}->[0] $deps \$(BLDDIR)/configdata.pm
|
||||
\$(PERL)$modules "$dofile" "-o$target{build_file}" $generator > \$@
|
||||
EOF
|
||||
} else {
|
||||
return <<"EOF";
|
||||
@@ -1015,7 +1094,7 @@ EOF
|
||||
# last in the line. We may therefore need to put back a line ending.
|
||||
sub src2obj {
|
||||
my %args = @_;
|
||||
my $obj = platform->obj($args{obj});
|
||||
my $obj = platform->convertext($args{obj});
|
||||
my $dep = platform->dep($args{obj});
|
||||
my @srcs = @{$args{srcs}};
|
||||
my $srcs = join(" ", @srcs);
|
||||
@@ -1095,15 +1174,22 @@ EOF
|
||||
sub obj2shlib {
|
||||
my %args = @_;
|
||||
my @linkdirs = ();
|
||||
foreach (@{args{deps}}) {
|
||||
my $d = dirname($_);
|
||||
push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
|
||||
my @linklibs = ();
|
||||
foreach (@{$args{deps}}) {
|
||||
if (platform->isstaticlib($_)) {
|
||||
push @linklibs, platform->convertext($_);
|
||||
} else {
|
||||
my $d = "-L" . dirname($_);
|
||||
my $l = basename($_);
|
||||
$l =~ s/^lib//;
|
||||
$l = "-l" . $l;
|
||||
push @linklibs, $l;
|
||||
push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
|
||||
}
|
||||
}
|
||||
my $linkflags = join("", map { "-L$_ " } @linkdirs);
|
||||
my $linklibs = join("", map { my $f = basename($_);
|
||||
(my $l = $f) =~ s/^lib//;
|
||||
" -l$l" } @{$args{deps}});
|
||||
my @objs = map { platform->obj($_) }
|
||||
my $linkflags = join("", map { $_." " } @linkdirs);
|
||||
my $linklibs = join("", map { $_." " } @linklibs);
|
||||
my @objs = map { platform->convertext($_) }
|
||||
grep { !platform->isdef($_) }
|
||||
@{$args{objs}};
|
||||
my @defs = map { platform->def($_) }
|
||||
@@ -1111,8 +1197,7 @@ EOF
|
||||
@{$args{objs}};
|
||||
my @deps = compute_lib_depends(@{$args{deps}});
|
||||
die "More than one exported symbol map" if scalar @defs > 1;
|
||||
my $objs = join(" ", @objs);
|
||||
my $deps = join(" ", @objs, @defs, @deps);
|
||||
|
||||
my $simple = platform->sharedlib_simple($args{lib});
|
||||
my $full = platform->sharedlib($args{lib});
|
||||
my $shared_soname = "";
|
||||
@@ -1122,6 +1207,12 @@ EOF
|
||||
$shared_imp .= ' '.$target{shared_impflag}.basename($simple)
|
||||
if defined $target{shared_impflag};
|
||||
my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
|
||||
|
||||
my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
|
||||
my $deps = join(" \\\n" . ' ' x (length($full) + 2),
|
||||
fill_lines(' ', $COLUMNS - length($full) - 2,
|
||||
@objs, @defs, @deps));
|
||||
|
||||
my $recipe = <<"EOF";
|
||||
$simple: $full
|
||||
EOF
|
||||
@@ -1139,8 +1230,9 @@ EOF
|
||||
$recipe .= <<"EOF";
|
||||
$full: $deps
|
||||
\$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
|
||||
-o $full$shared_def $objs \\
|
||||
$linklibs \$(LIB_EX_LIBS)
|
||||
-o $full$shared_def \\
|
||||
$objs \\
|
||||
$linklibs \$(LIB_EX_LIBS)
|
||||
EOF
|
||||
if (windowsdll()) {
|
||||
$recipe .= <<"EOF";
|
||||
@@ -1156,38 +1248,52 @@ EOF
|
||||
}
|
||||
sub obj2dso {
|
||||
my %args = @_;
|
||||
my $dso = platform->dso($args{lib});
|
||||
my $dso = platform->dso($args{module});
|
||||
my @linkdirs = ();
|
||||
foreach (@{args{deps}}) {
|
||||
my $d = dirname($_);
|
||||
push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
|
||||
my @linklibs = ();
|
||||
foreach (@{$args{deps}}) {
|
||||
next unless defined $_;
|
||||
if (platform->isstaticlib($_)) {
|
||||
push @linklibs, platform->convertext($_);
|
||||
} else {
|
||||
my $d = "-L" . dirname($_);
|
||||
my $l = basename($_);
|
||||
$l =~ s/^lib//;
|
||||
$l = "-l" . $l;
|
||||
push @linklibs, $l;
|
||||
push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
|
||||
}
|
||||
}
|
||||
my $linkflags = join("", map { "-L$_ " } @linkdirs);
|
||||
my $linklibs = join("", map { my $f = basename($_);
|
||||
(my $l = $f) =~ s/^lib//;
|
||||
" -l$l" } @{$args{deps}});
|
||||
my @objs = map { platform->obj($_) }
|
||||
my $linkflags = join("", map { $_." " } @linkdirs);
|
||||
my $linklibs = join("", map { $_." " } @linklibs);
|
||||
my @objs = map { platform->convertext($_) }
|
||||
grep { !platform->isdef($_) }
|
||||
@{$args{objs}};
|
||||
my @defs = map { platform->def($_) }
|
||||
grep { platform->isdef($_) }
|
||||
@{$args{objs}};
|
||||
my @deps = compute_lib_depends(@{$args{deps}});
|
||||
my $objs = join(" ", @objs);
|
||||
my $deps = join(" ", @objs, @defs, @deps);
|
||||
my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
|
||||
|
||||
my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
|
||||
my $deps = join(" \\\n" . ' ' x (length($dso) + 2),
|
||||
fill_lines(' ', $COLUMNS - length($dso) - 2,
|
||||
@objs, @defs, @deps));
|
||||
|
||||
return <<"EOF";
|
||||
$dso: $deps
|
||||
\$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
|
||||
-o $dso$shared_def $objs \\
|
||||
$linklibs \$(DSO_EX_LIBS)
|
||||
-o $dso$shared_def \\
|
||||
$objs \\
|
||||
$linklibs\$(DSO_EX_LIBS)
|
||||
EOF
|
||||
}
|
||||
sub obj2lib {
|
||||
my %args = @_;
|
||||
my $lib = platform->staticlib($args{lib});
|
||||
my @objs = map { platform->obj($_) } @{$args{objs}};
|
||||
my $objs = join(" ", @objs);
|
||||
my $objs = join(" \\\n" . ' ' x (length($lib) + 2),
|
||||
fill_lines(' ', $COLUMNS - length($lib) - 2, @objs));
|
||||
return <<"EOF";
|
||||
$lib: $objs
|
||||
\$(AR) \$(ARFLAGS) \$\@ \$\?
|
||||
@@ -1197,35 +1303,46 @@ EOF
|
||||
sub obj2bin {
|
||||
my %args = @_;
|
||||
my $bin = platform->bin($args{bin});
|
||||
my $objs = join(" ", map { platform->obj($_) } @{$args{objs}});
|
||||
my $deps = join(" ", compute_lib_depends(@{$args{deps}}));
|
||||
my @objs = map { platform->obj($_) } @{$args{objs}};
|
||||
my @deps = compute_lib_depends(@{$args{deps}});
|
||||
my $objs = join(" \\\n" . ' ' x (length($bin) + 2),
|
||||
fill_lines(' ', $COLUMNS - length($bin) - 2, @objs));
|
||||
my @linkdirs = ();
|
||||
foreach (@{args{deps}}) {
|
||||
next if $_ =~ /\.a$/;
|
||||
my $d = dirname($_);
|
||||
push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
|
||||
my @linklibs = ();
|
||||
foreach (@{$args{deps}}) {
|
||||
next unless defined $_;
|
||||
if (platform->isstaticlib($_)) {
|
||||
push @linklibs, platform->convertext($_);
|
||||
} else {
|
||||
my $d = "-L" . dirname($_);
|
||||
my $l = basename($_);
|
||||
$l =~ s/^lib//;
|
||||
$l = "-l" . $l;
|
||||
push @linklibs, $l;
|
||||
push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
|
||||
}
|
||||
}
|
||||
my $linkflags = join("", map { "-L$_ " } @linkdirs);
|
||||
my $linklibs = join("", map { if ($_ =~ m/\.a$/) {
|
||||
" ".platform->staticlib($_);
|
||||
} else {
|
||||
my $f = basename($_);
|
||||
(my $l = $f) =~ s/^lib//;
|
||||
" -l$l"
|
||||
}
|
||||
} @{$args{deps}});
|
||||
my $linkflags = join("", map { $_." " } @linkdirs);
|
||||
my $linklibs = join("", map { $_." " } @linklibs);
|
||||
my $cmd = '$(CC)';
|
||||
my $cmdflags = '$(BIN_CFLAGS)';
|
||||
if (grep /_cc\.o$/, @{$args{objs}}) {
|
||||
$cmd = '$(CXX)';
|
||||
$cmdflags = '$(BIN_CXXFLAGS)';
|
||||
}
|
||||
|
||||
my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
|
||||
my $deps = join(" \\\n" . ' ' x (length($bin) + 2),
|
||||
fill_lines(' ', $COLUMNS - length($bin) - 2,
|
||||
@objs, @deps));
|
||||
|
||||
return <<"EOF";
|
||||
$bin: $objs $deps
|
||||
$bin: $deps
|
||||
rm -f $bin
|
||||
\$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
|
||||
-o $bin $objs \\
|
||||
$linklibs \$(BIN_EX_LIBS)
|
||||
-o $bin \\
|
||||
$objs \\
|
||||
$linklibs\$(BIN_EX_LIBS)
|
||||
EOF
|
||||
}
|
||||
sub in2script {
|
||||
@@ -1246,7 +1363,7 @@ EOF
|
||||
my %args = @_;
|
||||
my $dir = $args{dir};
|
||||
my @deps = map { platform->convertext($_) } @{$args{deps}};
|
||||
my @actions = ();
|
||||
my @comments = ();
|
||||
my %extinfo = ( dso => platform->dsoext(),
|
||||
lib => platform->libext(),
|
||||
bin => platform->binext() );
|
||||
@@ -1266,16 +1383,19 @@ EOF
|
||||
if (dirname($prod) eq $dir) {
|
||||
push @deps, $prod.$extinfo{$type};
|
||||
} else {
|
||||
push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
|
||||
push @comments, "# No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $deps = join(" ", @deps);
|
||||
my $actions = join("\n", "", @actions);
|
||||
my $target = "$dir $dir/";
|
||||
my $deps = join(" \\\n\t",
|
||||
fill_lines(' ', $COLUMNS - 8, @deps));
|
||||
my $comments = join("\n", "", @comments);
|
||||
return <<"EOF";
|
||||
$dir $dir/: $deps$actions
|
||||
$target: \\
|
||||
$deps$comments
|
||||
EOF
|
||||
}
|
||||
"" # Important! This becomes part of the template result.
|
||||
|
||||
@@ -62,53 +62,53 @@ GENERATED={- # common0.tmpl provides @generated
|
||||
INSTALL_LIBS={-
|
||||
join(" ", map { quotify1(platform->sharedlib_import($_)
|
||||
// platform->staticlib($_)) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}})
|
||||
-}
|
||||
INSTALL_SHLIBS={-
|
||||
join(" ", map { my $x = platform->sharedlib($_);
|
||||
$x ? quotify_l($x) : () }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}})
|
||||
-}
|
||||
INSTALL_SHLIBPDBS={-
|
||||
join(" ", map { my $x = platform->sharedlibpdb($_);
|
||||
$x ? quotify_l($x) : () }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}})
|
||||
-}
|
||||
INSTALL_ENGINES={-
|
||||
join(" ", map { quotify1(platform->dso($_)) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{$_}->{engine} }
|
||||
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{modules}->{$_}->{engine} }
|
||||
@{$unified_info{modules}})
|
||||
-}
|
||||
INSTALL_ENGINEPDBS={-
|
||||
join(" ", map { quotify1(platform->dsopdb($_)) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{$_}->{engine} }
|
||||
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{modules}->{$_}->{engine} }
|
||||
@{$unified_info{modules}})
|
||||
-}
|
||||
INSTALL_PROGRAMS={-
|
||||
join(" ", map { quotify1(platform->bin($_)) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
|
||||
@{$unified_info{programs}})
|
||||
-}
|
||||
INSTALL_PROGRAMPDBS={-
|
||||
join(" ", map { quotify1(platform->binpdb($_)) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
|
||||
@{$unified_info{programs}})
|
||||
-}
|
||||
BIN_SCRIPTS={-
|
||||
join(" ", map { quotify1($_) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& !$unified_info{attributes}->{$_}->{misc} }
|
||||
grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
|
||||
&& !$unified_info{attributes}->{scripts}->{$_}->{misc} }
|
||||
@{$unified_info{scripts}})
|
||||
-}
|
||||
MISC_SCRIPTS={-
|
||||
join(" ", map { quotify1($_) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{$_}->{misc} }
|
||||
grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{scripts}->{$_}->{misc} }
|
||||
@{$unified_info{scripts}})
|
||||
-}
|
||||
|
||||
@@ -558,10 +558,14 @@ EOF
|
||||
my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
|
||||
"util", "dofile.pl")),
|
||||
rel2abs($config{builddir}));
|
||||
my @modules = ( 'configdata.pm',
|
||||
grep { $_ =~ m|\.pm$| } @{$args{deps}} );
|
||||
my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules;
|
||||
@modules = map { "-M".basename($_, '.pm') } @modules;
|
||||
my $modules = join(' ', '', sort keys %moduleincs, @modules);
|
||||
return <<"EOF";
|
||||
$target: "$args{generator}->[0]" $deps
|
||||
"\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
|
||||
"-o$target{build_file}" $generator > \$@
|
||||
"\$(PERL)"$modules "$dofile" "-o$target{build_file}" $generator > \$@
|
||||
EOF
|
||||
} else {
|
||||
return <<"EOF";
|
||||
@@ -714,8 +718,8 @@ EOF
|
||||
}
|
||||
sub obj2dso {
|
||||
my %args = @_;
|
||||
my $dso = platform->dso($args{lib});
|
||||
my $dso_n = platform->dsoname($args{lib});
|
||||
my $dso = platform->dso($args{module});
|
||||
my $dso_n = platform->dsoname($args{module});
|
||||
my @objs = map { platform->convertext($_) }
|
||||
grep { platform->isobj($_) || platform->isres($_) }
|
||||
@{$args{objs}};
|
||||
|
||||
@@ -73,7 +73,15 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lx
|
||||
# no-sse2 disables IA-32 SSE2 code in assembly modules, the above
|
||||
# mentioned '386' option implies this one
|
||||
# no-<cipher> build without specified algorithm (rsa, idea, rc5, ...)
|
||||
# -<xxx> +<xxx> compiler options are passed through
|
||||
# -<xxx> +<xxx> All options which are unknown to the 'Configure' script are
|
||||
# /<xxx> passed through to the compiler. Unix-style options beginning
|
||||
# with a '-' or '+' are recognized, as well as Windows-style
|
||||
# options beginning with a '/'. If the option contains arguments
|
||||
# separated by spaces, then the URL-style notation %20 can be
|
||||
# used for the space character in order to avoid having to quote
|
||||
# the option. For example, -opt%20arg gets expanded to -opt arg.
|
||||
# In fact, any ASCII character can be encoded as %xx using its
|
||||
# hexadecimal encoding.
|
||||
# -static while -static is also a pass-through compiler option (and
|
||||
# as such is limited to environments where it's actually
|
||||
# meaningful), it triggers a number configuration options,
|
||||
@@ -518,7 +526,7 @@ my @disable_cascades = (
|
||||
# or modules.
|
||||
"pic" => [ "shared", "module" ],
|
||||
|
||||
"module" => [ "fips", "legacy" ],
|
||||
"module" => [ "fips" ],
|
||||
|
||||
"engine" => [ grep /eng$/, @disablables ],
|
||||
"hw" => [ "padlockeng" ],
|
||||
@@ -821,7 +829,7 @@ while (@argvcopy)
|
||||
{
|
||||
die "FIPS mode not supported\n";
|
||||
}
|
||||
elsif (/^[-+]/)
|
||||
elsif (m|^[-+/]|)
|
||||
{
|
||||
if (/^--prefix=(.*)$/)
|
||||
{
|
||||
@@ -898,11 +906,11 @@ while (@argvcopy)
|
||||
{
|
||||
push @{$useradd{LDFLAGS}}, $_;
|
||||
}
|
||||
elsif (/^-D(.*)$/)
|
||||
elsif (m|^[-/]D(.*)$|)
|
||||
{
|
||||
push @{$useradd{CPPDEFINES}}, $1;
|
||||
}
|
||||
elsif (/^-I(.*)$/)
|
||||
elsif (m|^[-/]I(.*)$|)
|
||||
{
|
||||
push @{$useradd{CPPINCLUDES}}, $1;
|
||||
}
|
||||
@@ -912,11 +920,23 @@ while (@argvcopy)
|
||||
}
|
||||
else # common if (/^[-+]/), just pass down...
|
||||
{
|
||||
# Treat %xx as an ASCII code (e.g. replace %20 by a space character).
|
||||
# This provides a simple way to pass options with arguments separated
|
||||
# by spaces without quoting (e.g. -opt%20arg translates to -opt arg).
|
||||
$_ =~ s/%([0-9a-f]{1,2})/chr(hex($1))/gei;
|
||||
push @{$useradd{CFLAGS}}, $_;
|
||||
push @{$useradd{CXXFLAGS}}, $_;
|
||||
}
|
||||
}
|
||||
elsif (m|^/|)
|
||||
{
|
||||
# Treat %xx as an ASCII code (e.g. replace %20 by a space character).
|
||||
# This provides a simple way to pass options with arguments separated
|
||||
# by spaces without quoting (e.g. /opt%20arg translates to /opt arg).
|
||||
$_ =~ s/%([0-9a-f]{1,2})/chr(hex($1))/gei;
|
||||
push @{$useradd{CFLAGS}}, $_;
|
||||
push @{$useradd{CXXFLAGS}}, $_;
|
||||
}
|
||||
else
|
||||
{
|
||||
die "target already defined - $target (offending arg: $_)\n" if ($target ne "");
|
||||
@@ -1724,7 +1744,6 @@ if ($builder eq "unified") {
|
||||
my @modules = ();
|
||||
my @scripts = ();
|
||||
|
||||
my %attributes = ();
|
||||
my %sources = ();
|
||||
my %shared_sources = ();
|
||||
my %includes = ();
|
||||
@@ -1737,19 +1756,56 @@ if ($builder eq "unified") {
|
||||
# contains a dollar sign, it had better be escaped, or it will be
|
||||
# taken for a variable name prefix.
|
||||
my %variables = ();
|
||||
my $variable_re = qr/\$([[:alpha:]][[:alnum:]_]*)/;
|
||||
my $variable_re = qr/\$(?P<VARIABLE>[[:alpha:]][[:alnum:]_]*)/;
|
||||
my $expand_variables = sub {
|
||||
my $value = '';
|
||||
my $value_rest = shift;
|
||||
|
||||
if ($ENV{CONFIGURE_DEBUG_VARIABLE_EXPAND}) {
|
||||
print STDERR
|
||||
"DEBUG[\$expand_variables] Parsed '$value_rest' into:\n"
|
||||
}
|
||||
while ($value_rest =~ /(?<!\\)${variable_re}/) {
|
||||
$value .= $`;
|
||||
$value .= $variables{$1};
|
||||
$value .= $variables{$+{VARIABLE}};
|
||||
$value_rest = $';
|
||||
}
|
||||
if ($ENV{CONFIGURE_DEBUG_VARIABLE_EXPAND}) {
|
||||
print STDERR
|
||||
"DEBUG[\$expand_variables] ... '$value$value_rest'\n";
|
||||
}
|
||||
return $value . $value_rest;
|
||||
};
|
||||
|
||||
# Support for attributes in build.info files
|
||||
my %attributes = ();
|
||||
my $handle_attributes = sub {
|
||||
my $attr_str = shift;
|
||||
my $ref = shift;
|
||||
my @goals = @_;
|
||||
|
||||
return unless defined $attr_str;
|
||||
|
||||
my @a = tokenize($attr_str, qr|\s*,\s*|);
|
||||
foreach my $a (@a) {
|
||||
my $ac = 1;
|
||||
my $ak = $a;
|
||||
my $av = 1;
|
||||
if ($a =~ m|^(!)?(.*?)\s* = \s*(.*?)$|) {
|
||||
$ac = ! $1;
|
||||
$ak = $1;
|
||||
$av = $2;
|
||||
}
|
||||
foreach my $g (@goals) {
|
||||
if ($ac) {
|
||||
$$ref->{$g}->{$ak} = $av;
|
||||
} else {
|
||||
delete $$ref->{$g}->{$ak};
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
# 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);
|
||||
@@ -1779,148 +1835,129 @@ if ($builder eq "unified") {
|
||||
# 1 last was positive (don't skip lines until next ELSE, ELSIF or ENDIF)
|
||||
# 2 positive ELSE (following ELSIF should fail)
|
||||
my @skip = ();
|
||||
|
||||
# A few useful generic regexps
|
||||
my $index_re = qr/\[\s*(?P<INDEX>(?:\\.|.)*?)\s*\]/;
|
||||
my $cond_re = qr/\[\s*(?P<COND>(?:\\.|.)*?)\s*\]/;
|
||||
my $attribs_re = qr/(?:\{\s*(?P<ATTRIBS>(?:\\.|.)*?)\s*\})?/;
|
||||
my $value_re = qr/\s*(?P<VALUE>.*?)\s*/;
|
||||
collect_information(
|
||||
collect_from_array([ @text ],
|
||||
qr/\\$/ => sub { my $l1 = shift; my $l2 = shift;
|
||||
$l1 =~ s/\\$//; $l1.$l2 }),
|
||||
# Info we're looking for
|
||||
qr/^\s*IF\[((?:\\.|[^\\\]])*)\]\s*$/
|
||||
qr/^\s* IF ${cond_re} \s*$/x
|
||||
=> sub {
|
||||
if (! @skip || $skip[$#skip] > 0) {
|
||||
push @skip, !! $expand_variables->($1);
|
||||
push @skip, !! $expand_variables->($+{COND});
|
||||
} else {
|
||||
push @skip, -1;
|
||||
}
|
||||
},
|
||||
qr/^\s*ELSIF\[((?:\\.|[^\\\]])*)\]\s*$/
|
||||
qr/^\s* ELSIF ${cond_re} \s*$/x
|
||||
=> sub { die "ELSIF out of scope" if ! @skip;
|
||||
die "ELSIF following ELSE" if abs($skip[$#skip]) == 2;
|
||||
$skip[$#skip] = -1 if $skip[$#skip] != 0;
|
||||
$skip[$#skip] = !! $expand_variables->($1)
|
||||
$skip[$#skip] = !! $expand_variables->($+{COND})
|
||||
if $skip[$#skip] == 0; },
|
||||
qr/^\s*ELSE\s*$/
|
||||
qr/^\s* ELSE \s*$/x
|
||||
=> sub { die "ELSE out of scope" if ! @skip;
|
||||
$skip[$#skip] = -2 if $skip[$#skip] != 0;
|
||||
$skip[$#skip] = 2 if $skip[$#skip] == 0; },
|
||||
qr/^\s*ENDIF\s*$/
|
||||
qr/^\s* ENDIF \s*$/x
|
||||
=> sub { die "ENDIF out of scope" if ! @skip;
|
||||
pop @skip; },
|
||||
qr/^\s*${variable_re}\s*=\s*(.*?)\s*$/
|
||||
qr/^\s* ${variable_re} \s* = ${value_re} $/x
|
||||
=> sub {
|
||||
if (!@skip || $skip[$#skip] > 0) {
|
||||
my $n = $1;
|
||||
my $v = $2;
|
||||
$variables{$n} = $expand_variables->($v);
|
||||
$variables{$+{VARIABLE}} = $expand_variables->($+{VALUE});
|
||||
}
|
||||
},
|
||||
qr/^\s*SUBDIRS\s*=\s*(.*)\s*$/
|
||||
qr/^\s* SUBDIRS \s* = ${value_re} $/x
|
||||
=> sub {
|
||||
if (!@skip || $skip[$#skip] > 0) {
|
||||
foreach (tokenize($expand_variables->($1))) {
|
||||
foreach (tokenize($expand_variables->($+{VALUE}))) {
|
||||
push @build_dirs, [ @curd, splitdir($_, 1) ];
|
||||
}
|
||||
}
|
||||
},
|
||||
qr/^\s*PROGRAMS(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/
|
||||
qr/^\s* PROGRAMS ${attribs_re} \s* = ${value_re} $/x
|
||||
=> sub {
|
||||
if (!@skip || $skip[$#skip] > 0) {
|
||||
my @a = tokenize($1, qr|\s*,\s*|);
|
||||
my @p = tokenize($expand_variables->($2));
|
||||
my @p = tokenize($expand_variables->($+{VALUE}));
|
||||
push @programs, @p;
|
||||
foreach my $a (@a) {
|
||||
my $ak = $a;
|
||||
my $av = 1;
|
||||
if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) {
|
||||
$ak = $1;
|
||||
$av = $2;
|
||||
}
|
||||
foreach my $p (@p) {
|
||||
$attributes{$p}->{$ak} = $av;
|
||||
}
|
||||
}
|
||||
$handle_attributes->($+{ATTRIBS},
|
||||
\$attributes{programs},
|
||||
@p);
|
||||
}
|
||||
},
|
||||
qr/^\s*LIBS(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/
|
||||
qr/^\s* LIBS ${attribs_re} \s* = ${value_re} $/x
|
||||
=> sub {
|
||||
if (!@skip || $skip[$#skip] > 0) {
|
||||
my @a = tokenize($1, qr|\s*,\s*|);
|
||||
my @l = tokenize($expand_variables->($2));
|
||||
my @l = tokenize($expand_variables->($+{VALUE}));
|
||||
push @libraries, @l;
|
||||
foreach my $a (@a) {
|
||||
my $ak = $a;
|
||||
my $av = 1;
|
||||
if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) {
|
||||
$ak = $1;
|
||||
$av = $2;
|
||||
}
|
||||
foreach my $l (@l) {
|
||||
$attributes{$l}->{$ak} = $av;
|
||||
}
|
||||
}
|
||||
$handle_attributes->($+{ATTRIBS},
|
||||
\$attributes{libraries},
|
||||
@l);
|
||||
}
|
||||
},
|
||||
qr/^\s*MODULES(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/
|
||||
qr/^\s* MODULES ${attribs_re} \s* = ${value_re} $/x
|
||||
=> sub {
|
||||
if (!@skip || $skip[$#skip] > 0) {
|
||||
my @a = tokenize($1, qr|\s*,\s*|);
|
||||
my @m = tokenize($expand_variables->($2));
|
||||
my @m = tokenize($expand_variables->($+{VALUE}));
|
||||
push @modules, @m;
|
||||
foreach my $a (@a) {
|
||||
my $ak = $a;
|
||||
my $av = 1;
|
||||
if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) {
|
||||
$ak = $1;
|
||||
$av = $2;
|
||||
}
|
||||
foreach my $m (@m) {
|
||||
$attributes{$m}->{$ak} = $av;
|
||||
}
|
||||
}
|
||||
$handle_attributes->($+{ATTRIBS},
|
||||
\$attributes{modules},
|
||||
@m);
|
||||
}
|
||||
},
|
||||
qr/^\s*SCRIPTS(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/
|
||||
qr/^\s* SCRIPTS ${attribs_re} \s* = ${value_re} $/x
|
||||
=> sub {
|
||||
if (!@skip || $skip[$#skip] > 0) {
|
||||
my @a = tokenize($1, qr|\s*,\s*|);
|
||||
my @s = tokenize($expand_variables->($2));
|
||||
my @s = tokenize($expand_variables->($+{VALUE}));
|
||||
push @scripts, @s;
|
||||
foreach my $a (@a) {
|
||||
my $ak = $a;
|
||||
my $av = 1;
|
||||
if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) {
|
||||
$ak = $1;
|
||||
$av = $2;
|
||||
}
|
||||
foreach my $s (@s) {
|
||||
$attributes{$s}->{$ak} = $av;
|
||||
}
|
||||
}
|
||||
$handle_attributes->($+{ATTRIBS},
|
||||
\$attributes{scripts},
|
||||
@s);
|
||||
}
|
||||
},
|
||||
|
||||
qr/^\s*ORDINALS\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/,
|
||||
=> sub { push @{$ordinals{$1}}, tokenize($expand_variables->($2))
|
||||
qr/^\s* ORDINALS ${index_re} = ${value_re} $/x
|
||||
=> sub { push @{$ordinals{$expand_variables->($+{INDEX})}},
|
||||
tokenize($expand_variables->($+{VALUE}))
|
||||
if !@skip || $skip[$#skip] > 0 },
|
||||
qr/^\s*SOURCE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
|
||||
=> sub { push @{$sources{$1}}, tokenize($expand_variables->($2))
|
||||
qr/^\s* SOURCE ${index_re} = ${value_re} $/x
|
||||
=> sub { push @{$sources{$expand_variables->($+{INDEX})}},
|
||||
tokenize($expand_variables->($+{VALUE}))
|
||||
if !@skip || $skip[$#skip] > 0 },
|
||||
qr/^\s*SHARED_SOURCE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
|
||||
=> sub { push @{$shared_sources{$1}},
|
||||
tokenize($expand_variables->($2))
|
||||
qr/^\s* SHARED_SOURCE ${index_re} = ${value_re} $/x
|
||||
=> sub { push @{$shared_sources{$expand_variables->($+{INDEX})}},
|
||||
tokenize($expand_variables->($+{VALUE}))
|
||||
if !@skip || $skip[$#skip] > 0 },
|
||||
qr/^\s*INCLUDE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
|
||||
=> sub { push @{$includes{$1}}, tokenize($expand_variables->($2))
|
||||
qr/^\s* INCLUDE ${index_re} = ${value_re} $/x
|
||||
=> sub { push @{$includes{$expand_variables->($+{INDEX})}},
|
||||
tokenize($expand_variables->($+{VALUE}))
|
||||
if !@skip || $skip[$#skip] > 0 },
|
||||
qr/^\s*DEFINE\[((?:\\.|[^\\\]])*)\]\s*=\s*(.*)\s*$/
|
||||
=> sub { push @{$defines{$1}}, tokenize($expand_variables->($2))
|
||||
qr/^\s* DEFINE ${index_re} = ${value_re} $/x
|
||||
=> sub { push @{$defines{$expand_variables->($+{INDEX})}},
|
||||
tokenize($expand_variables->($+{VALUE}))
|
||||
if !@skip || $skip[$#skip] > 0 },
|
||||
qr/^\s*DEPEND\[((?:\\.|[^\\\]])*)\]\s*=\s*(.*)\s*$/
|
||||
=> sub { push @{$depends{$1}}, tokenize($expand_variables->($2))
|
||||
qr/^\s* DEPEND ${index_re} ${attribs_re} = ${value_re} $/x
|
||||
=> sub {
|
||||
if (!@skip || $skip[$#skip] > 0) {
|
||||
my $i = $expand_variables->($+{INDEX});
|
||||
my @d = tokenize($expand_variables->($+{VALUE}));
|
||||
push @{$depends{$i}}, @d;
|
||||
$handle_attributes->($+{ATTRIBS},
|
||||
\$attributes{depends}->{$i},
|
||||
@d);
|
||||
}
|
||||
},
|
||||
qr/^\s* GENERATE ${index_re} = ${value_re} $/x
|
||||
=> sub { push @{$generate{$expand_variables->($+{INDEX})}},
|
||||
$+{VALUE}
|
||||
if !@skip || $skip[$#skip] > 0 },
|
||||
qr/^\s*GENERATE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
|
||||
=> sub { push @{$generate{$1}}, $2
|
||||
if !@skip || $skip[$#skip] > 0 },
|
||||
qr/^\s*(?:#.*)?$/ => sub { },
|
||||
qr/^\s* (?:\#.*)? $/x => sub { },
|
||||
"OTHERWISE" => sub { die "Something wrong with this line:\n$_\nat $sourced/$f" },
|
||||
"BEFORE" => sub {
|
||||
if ($buildinfo_debug) {
|
||||
@@ -1936,7 +1973,7 @@ if ($builder eq "unified") {
|
||||
);
|
||||
die "runaway IF?" if (@skip);
|
||||
|
||||
if (grep { defined $attributes{$_}->{engine} } keys %attributes
|
||||
if (grep { defined $attributes{modules}->{$_}->{engine} } keys %attributes
|
||||
and !$config{dynamic_engines}) {
|
||||
die <<"EOF"
|
||||
ENGINES can only be used if configured with 'dynamic-engine'.
|
||||
@@ -1944,15 +1981,6 @@ This is usually a fault in a build.info file.
|
||||
EOF
|
||||
}
|
||||
|
||||
foreach (keys %attributes) {
|
||||
my $dest = $_;
|
||||
my $ddest = cleanfile($buildd, $_, $blddir);
|
||||
foreach (keys %{$attributes{$dest} // {}}) {
|
||||
$unified_info{attributes}->{$ddest}->{$_} =
|
||||
$attributes{$dest}->{$_};
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
my %infos = ( programs => [ @programs ],
|
||||
libraries => [ @libraries ],
|
||||
@@ -1962,6 +1990,11 @@ EOF
|
||||
foreach (@{$infos{$k}}) {
|
||||
my $item = cleanfile($buildd, $_, $blddir);
|
||||
$unified_info{$k}->{$item} = 1;
|
||||
|
||||
# Fix up associated attributes
|
||||
$unified_info{attributes}->{$k}->{$item} =
|
||||
$attributes{$k}->{$_}
|
||||
if defined $attributes{$k}->{$_};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2090,6 +2123,11 @@ EOF
|
||||
my $e = $1 // "";
|
||||
$d = $`.$e;
|
||||
$unified_info{depends}->{$ddest}->{$d} = 1;
|
||||
|
||||
# Fix up associated attributes
|
||||
$unified_info{attributes}->{depends}->{$ddest}->{$d} =
|
||||
$attributes{depends}->{$dest}->{$_}
|
||||
if defined $attributes{depends}->{$dest}->{$_};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -641,10 +641,19 @@
|
||||
Take note of the VAR=value documentation below and how
|
||||
these flags interact with those variables.
|
||||
|
||||
-xxx, +xxx
|
||||
-xxx, +xxx, /xxx
|
||||
Additional options that are not otherwise recognised are
|
||||
passed through as they are to the compiler as well. Again,
|
||||
consult your compiler documentation.
|
||||
passed through as they are to the compiler as well.
|
||||
Unix-style options beginning with a '-' or '+' and
|
||||
Windows-style options beginning with a '/' are recognized.
|
||||
Again, consult your compiler documentation.
|
||||
|
||||
If the option contains arguments separated by spaces,
|
||||
then the URL-style notation %20 can be used for the space
|
||||
character in order to avoid having to quote the option.
|
||||
For example, -opt%20arg gets expanded to -opt arg.
|
||||
In fact, any ASCII character can be encoded as %xx using its
|
||||
hexadecimal encoding.
|
||||
|
||||
Take note of the VAR=value documentation below and how
|
||||
these flags interact with those variables.
|
||||
|
||||
+40
-22
@@ -104,20 +104,29 @@ const OPTIONS cms_options[] = {
|
||||
{"resign", OPT_RESIGN, '-', "Resign a signed message"},
|
||||
{"cades", OPT_CADES, '-', "Include signer certificate digest"},
|
||||
{"verify", OPT_VERIFY, '-', "Verify signed message"},
|
||||
{"verify_retcode", OPT_VERIFY_RETCODE, '-'},
|
||||
{"verify_receipt", OPT_VERIFY_RECEIPT, '<'},
|
||||
{"verify_retcode", OPT_VERIFY_RETCODE, '-',
|
||||
"Exit non-zero on verification failure"},
|
||||
{"verify_receipt", OPT_VERIFY_RECEIPT, '<',
|
||||
"Verify receipts; exit if receipt signatures do not verify"},
|
||||
{"cmsout", OPT_CMSOUT, '-', "Output CMS structure"},
|
||||
{"data_out", OPT_DATA_OUT, '-'},
|
||||
{"data_create", OPT_DATA_CREATE, '-'},
|
||||
{"digest_verify", OPT_DIGEST_VERIFY, '-'},
|
||||
{"digest_create", OPT_DIGEST_CREATE, '-'},
|
||||
{"compress", OPT_COMPRESS, '-'},
|
||||
{"uncompress", OPT_UNCOMPRESS, '-'},
|
||||
{"EncryptedData_decrypt", OPT_ED_DECRYPT, '-'},
|
||||
{"EncryptedData_encrypt", OPT_ED_ENCRYPT, '-'},
|
||||
{"debug_decrypt", OPT_DEBUG_DECRYPT, '-'},
|
||||
{"data_out", OPT_DATA_OUT, '-', "Copy CMS \"Data\" object to output"},
|
||||
{"data_create", OPT_DATA_CREATE, '-', "Create a CMS \"Data\" object"},
|
||||
{"digest_verify", OPT_DIGEST_VERIFY, '-',
|
||||
"Verify a CMS \"DigestedData\" object and output it"},
|
||||
{"digest_create", OPT_DIGEST_CREATE, '-',
|
||||
"Create a CMS \"DigestedData\" object"},
|
||||
{"compress", OPT_COMPRESS, '-', "Create a CMS \"CompressedData\" object"},
|
||||
{"uncompress", OPT_UNCOMPRESS, '-', "Uncompress a CMS \"CompressedData\" object"},
|
||||
{"EncryptedData_decrypt", OPT_ED_DECRYPT, '-',
|
||||
"Decrypt CMS \"EncryptedData\" object using symmetric key"},
|
||||
{"EncryptedData_encrypt", OPT_ED_ENCRYPT, '-',
|
||||
"Create CMS \"EncryptedData\" object using symmetric key"},
|
||||
{"debug_decrypt", OPT_DEBUG_DECRYPT, '-',
|
||||
"Disable MMA protection and return an error if no recipient found"
|
||||
" (see documentation)"},
|
||||
{"text", OPT_TEXT, '-', "Include or delete text MIME headers"},
|
||||
{"asciicrlf", OPT_ASCIICRLF, '-'},
|
||||
{"asciicrlf", OPT_ASCIICRLF, '-',
|
||||
"Perform CRLF canonicalisation when signing"},
|
||||
{"nointern", OPT_NOINTERN, '-',
|
||||
"Don't search certificates in message for signer"},
|
||||
{"noverify", OPT_NOVERIFY, '-', "Don't verify signers certificate"},
|
||||
@@ -129,16 +138,20 @@ const OPTIONS cms_options[] = {
|
||||
{"binary", OPT_BINARY, '-', "Don't translate message to text"},
|
||||
{"keyid", OPT_KEYID, '-', "Use subject key identifier"},
|
||||
{"nosigs", OPT_NOSIGS, '-', "Don't verify message signature"},
|
||||
{"no_content_verify", OPT_NO_CONTENT_VERIFY, '-'},
|
||||
{"no_attr_verify", OPT_NO_ATTR_VERIFY, '-'},
|
||||
{"no_content_verify", OPT_NO_CONTENT_VERIFY, '-',
|
||||
"Do not verify signed content signatures"},
|
||||
{"no_attr_verify", OPT_NO_ATTR_VERIFY, '-',
|
||||
"Do not verify signed attribute signatures"},
|
||||
{"stream", OPT_INDEF, '-', "Enable CMS streaming"},
|
||||
{"indef", OPT_INDEF, '-', "Same as -stream"},
|
||||
{"noindef", OPT_NOINDEF, '-', "Disable CMS streaming"},
|
||||
{"crlfeol", OPT_CRLFEOL, '-', "Use CRLF as EOL termination instead of CR only" },
|
||||
{"noout", OPT_NOOUT, '-', "For the -cmsout operation do not output the parsed CMS structure"},
|
||||
{"receipt_request_print", OPT_RR_PRINT, '-', "Print CMS Receipt Request" },
|
||||
{"receipt_request_all", OPT_RR_ALL, '-'},
|
||||
{"receipt_request_first", OPT_RR_FIRST, '-'},
|
||||
{"receipt_request_all", OPT_RR_ALL, '-',
|
||||
"When signing, create a receipt request for all recipients"},
|
||||
{"receipt_request_first", OPT_RR_FIRST, '-',
|
||||
"When signing, create a receipt request for first recipient"},
|
||||
{"rctform", OPT_RCTFORM, 'F', "Receipt file format"},
|
||||
{"certfile", OPT_CERTFILE, '<', "Other certificates file"},
|
||||
{"CAfile", OPT_CAFILE, '<', "Trusted certificates file"},
|
||||
@@ -151,10 +164,13 @@ const OPTIONS cms_options[] = {
|
||||
"Supply or override content for detached signature"},
|
||||
{"print", OPT_PRINT, '-',
|
||||
"For the -cmsout operation print out all fields of the CMS structure"},
|
||||
{"secretkey", OPT_SECRETKEY, 's'},
|
||||
{"secretkeyid", OPT_SECRETKEYID, 's'},
|
||||
{"pwri_password", OPT_PWRI_PASSWORD, 's'},
|
||||
{"econtent_type", OPT_ECONTENT_TYPE, 's'},
|
||||
{"secretkey", OPT_SECRETKEY, 's',
|
||||
"Use specified hex-encoded key to decrypt/encrypt recipients or content"},
|
||||
{"secretkeyid", OPT_SECRETKEYID, 's',
|
||||
"Identity of the -secretkey for CMS \"KEKRecipientInfo\" object"},
|
||||
{"pwri_password", OPT_PWRI_PASSWORD, 's',
|
||||
"Specific password for recipient"},
|
||||
{"econtent_type", OPT_ECONTENT_TYPE, 's', "OID for external content"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"to", OPT_TO, 's', "To address"},
|
||||
{"from", OPT_FROM, 's', "From address"},
|
||||
@@ -167,8 +183,10 @@ const OPTIONS cms_options[] = {
|
||||
"Input private key (if not signer or recipient)"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Input private key format (PEM or ENGINE)"},
|
||||
{"keyopt", OPT_KEYOPT, 's', "Set public key parameters as n:v pairs"},
|
||||
{"receipt_request_from", OPT_RR_FROM, 's'},
|
||||
{"receipt_request_to", OPT_RR_TO, 's'},
|
||||
{"receipt_request_from", OPT_RR_FROM, 's',
|
||||
"Create signed receipt request with specified email address"},
|
||||
{"receipt_request_to", OPT_RR_TO, 's',
|
||||
"Create signed receipt targeted to specified address"},
|
||||
{"", OPT_CIPHER, '-', "Any supported cipher"},
|
||||
OPT_R_OPTIONS,
|
||||
OPT_V_OPTIONS,
|
||||
|
||||
+2
-2
@@ -204,7 +204,7 @@ int crl_main(int argc, char **argv)
|
||||
}
|
||||
pkey = X509_get_pubkey(X509_OBJECT_get0_X509(xobj));
|
||||
X509_OBJECT_free(xobj);
|
||||
if (!pkey) {
|
||||
if (pkey == NULL) {
|
||||
BIO_printf(bio_err, "Error getting CRL issuer public key\n");
|
||||
goto end;
|
||||
}
|
||||
@@ -228,7 +228,7 @@ int crl_main(int argc, char **argv)
|
||||
if (!newcrl)
|
||||
goto end;
|
||||
pkey = load_key(keyfile, keyformat, 0, NULL, NULL, "CRL signing key");
|
||||
if (!pkey) {
|
||||
if (pkey == NULL) {
|
||||
X509_CRL_free(newcrl);
|
||||
goto end;
|
||||
}
|
||||
|
||||
+1
-1
@@ -341,7 +341,7 @@ opthelp:
|
||||
if (opts != NULL) {
|
||||
int ok = 1;
|
||||
OSSL_PARAM *params =
|
||||
app_params_new_from_opts(opts, EVP_MAC_CTX_settable_params(mac));
|
||||
app_params_new_from_opts(opts, EVP_MAC_settable_ctx_params(mac));
|
||||
|
||||
if (params == NULL)
|
||||
goto end;
|
||||
|
||||
+2
-2
@@ -217,7 +217,7 @@ static int init_keygen_file(EVP_PKEY_CTX **pctx, const char *file, ENGINE *e)
|
||||
}
|
||||
|
||||
pbio = BIO_new_file(file, "r");
|
||||
if (!pbio) {
|
||||
if (pbio == NULL) {
|
||||
BIO_printf(bio_err, "Can't open parameter file %s\n", file);
|
||||
return 0;
|
||||
}
|
||||
@@ -225,7 +225,7 @@ static int init_keygen_file(EVP_PKEY_CTX **pctx, const char *file, ENGINE *e)
|
||||
pkey = PEM_read_bio_Parameters(pbio, NULL);
|
||||
BIO_free(pbio);
|
||||
|
||||
if (!pkey) {
|
||||
if (pkey == NULL) {
|
||||
BIO_printf(bio_err, "Error reading parameter file %s\n", file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+3
-3
@@ -7,8 +7,8 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_APPS_H
|
||||
# define HEADER_APPS_H
|
||||
#ifndef OSSL_APPS_H
|
||||
# define OSSL_APPS_H
|
||||
|
||||
# include "e_os.h" /* struct timeval for DTLS */
|
||||
# include "internal/nelem.h"
|
||||
@@ -21,7 +21,7 @@
|
||||
# endif
|
||||
|
||||
# include <openssl/e_os2.h>
|
||||
# include <openssl/ossl_typ.h>
|
||||
# include <openssl/types.h>
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/conf.h>
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_APPS_UI_H
|
||||
# define HEADER_APPS_UI_H
|
||||
#ifndef OSSL_APPS_UI_H
|
||||
# define OSSL_APPS_UI_H
|
||||
|
||||
|
||||
# define PW_MIN_LENGTH 4
|
||||
|
||||
+3
-3
@@ -14,8 +14,8 @@
|
||||
* shared fields have been moved into this file.
|
||||
*/
|
||||
|
||||
#ifndef HEADER_FMT_H
|
||||
#define HEADER_FMT_H
|
||||
#ifndef OSSL_APPS_FMT_H
|
||||
#define OSSL_APPS_FMT_H
|
||||
|
||||
/* On some platforms, it's important to distinguish between text and binary
|
||||
* files. On some, there might even be specific file formats for different
|
||||
@@ -41,4 +41,4 @@
|
||||
|
||||
int FMT_istext(int format);
|
||||
|
||||
#endif /* HEADER_FMT_H_ */
|
||||
#endif /* OSSL_APPS_FMT_H_ */
|
||||
@@ -7,8 +7,8 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef APPS_FUNCTION_H
|
||||
# define APPS_FUNCTION_H
|
||||
#ifndef OSSL_APPS_FUNCTION_H
|
||||
# define OSSL_APPS_FUNCTION_H
|
||||
|
||||
# include <openssl/lhash.h>
|
||||
# include "opt.h"
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <openssl/safestack.h>
|
||||
|
||||
/* Standard comparing function for names */
|
||||
int name_cmp(const char * const *a, const char * const *b);
|
||||
/* collect_names is meant to be used with EVP_{type}_doall_names */
|
||||
void collect_names(const char *name, void *vdata);
|
||||
/* Sorts and prints a stack of names to |out| */
|
||||
void print_names(BIO *out, STACK_OF(OPENSSL_CSTRING) *names);
|
||||
+4
-4
@@ -6,12 +6,12 @@
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
#ifndef HEADER_OPT_H
|
||||
#define HEADER_OPT_H
|
||||
#ifndef OSSL_APPS_OPT_H
|
||||
#define OSSL_APPS_OPT_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <openssl/e_os2.h>
|
||||
#include <openssl/ossl_typ.h>
|
||||
#include <openssl/types.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
/*
|
||||
@@ -347,4 +347,4 @@ int opt_format_error(const char *s, unsigned long flags);
|
||||
int opt_isdir(const char *name);
|
||||
int opt_printf_stderr(const char *fmt, ...);
|
||||
|
||||
#endif /* HEADER_OPT_H */
|
||||
#endif /* OSSL_APPS_OPT_H */
|
||||
@@ -7,8 +7,8 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_PLATFORM_H
|
||||
# define HEADER_PLATFORM_H
|
||||
#ifndef OSSL_APPS_PLATFORM_H
|
||||
# define OSSL_APPS_PLATFORM_H
|
||||
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef TERM_SOCK_H
|
||||
# define TERM_SOCK_H
|
||||
#ifndef OSSL_APPS_VMS_TERM_SOCK_H
|
||||
# define OSSL_APPS_VMS_TERM_SOCK_H
|
||||
|
||||
/*
|
||||
** Terminal Socket Function Codes
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ opthelp:
|
||||
if (opts != NULL) {
|
||||
int ok = 1;
|
||||
OSSL_PARAM *params =
|
||||
app_params_new_from_opts(opts, EVP_KDF_CTX_settable_params(kdf));
|
||||
app_params_new_from_opts(opts, EVP_KDF_settable_ctx_params(kdf));
|
||||
|
||||
if (params == NULL)
|
||||
goto err;
|
||||
|
||||
+28
-8
@@ -85,7 +85,7 @@ int chopup_args(ARGS *arg, char *buf)
|
||||
/* Skip whitespace. */
|
||||
while (*p && isspace(_UC(*p)))
|
||||
p++;
|
||||
if (!*p)
|
||||
if (*p == '\0')
|
||||
break;
|
||||
|
||||
/* The start of something good :-) */
|
||||
@@ -258,7 +258,7 @@ static char *app_get_pass(const char *arg, int keepbio)
|
||||
#endif
|
||||
} else if (strcmp(arg, "stdin") == 0) {
|
||||
pwdbio = dup_bio_in(FORMAT_TEXT);
|
||||
if (!pwdbio) {
|
||||
if (pwdbio == NULL) {
|
||||
BIO_printf(bio_err, "Can't open BIO for stdin\n");
|
||||
return NULL;
|
||||
}
|
||||
@@ -407,7 +407,7 @@ static int load_pkcs12(BIO *in, const char *desc,
|
||||
if (PKCS12_verify_mac(p12, "", 0) || PKCS12_verify_mac(p12, NULL, 0)) {
|
||||
pass = "";
|
||||
} else {
|
||||
if (!pem_cb)
|
||||
if (pem_cb == NULL)
|
||||
pem_cb = (pem_password_cb *)password_callback;
|
||||
len = pem_cb(tpass, PEM_BUFSIZE, 0, cb_data);
|
||||
if (len < 0) {
|
||||
@@ -1809,26 +1809,46 @@ unsigned char *next_protos_parse(size_t *outlen, const char *in)
|
||||
size_t len;
|
||||
unsigned char *out;
|
||||
size_t i, start = 0;
|
||||
size_t skipped = 0;
|
||||
|
||||
len = strlen(in);
|
||||
if (len >= 65535)
|
||||
if (len == 0 || len >= 65535)
|
||||
return NULL;
|
||||
|
||||
out = app_malloc(strlen(in) + 1, "NPN buffer");
|
||||
out = app_malloc(len + 1, "NPN buffer");
|
||||
for (i = 0; i <= len; ++i) {
|
||||
if (i == len || in[i] == ',') {
|
||||
/*
|
||||
* Zero-length ALPN elements are invalid on the wire, we could be
|
||||
* strict and reject the entire string, but just ignoring extra
|
||||
* commas seems harmless and more friendly.
|
||||
*
|
||||
* Every comma we skip in this way puts the input buffer another
|
||||
* byte ahead of the output buffer, so all stores into the output
|
||||
* buffer need to be decremented by the number commas skipped.
|
||||
*/
|
||||
if (i == start) {
|
||||
++start;
|
||||
++skipped;
|
||||
continue;
|
||||
}
|
||||
if (i - start > 255) {
|
||||
OPENSSL_free(out);
|
||||
return NULL;
|
||||
}
|
||||
out[start] = (unsigned char)(i - start);
|
||||
out[start-skipped] = (unsigned char)(i - start);
|
||||
start = i + 1;
|
||||
} else {
|
||||
out[i + 1] = in[i];
|
||||
out[i + 1 - skipped] = in[i];
|
||||
}
|
||||
}
|
||||
|
||||
*outlen = len + 1;
|
||||
if (len <= skipped) {
|
||||
OPENSSL_free(out);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*outlen = len + 1 - skipped;
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ ENDIF
|
||||
|
||||
# Source for libapps
|
||||
$LIBAPPSSRC=apps.c apps_ui.c opt.c fmt.c s_cb.c s_socket.c app_rand.c \
|
||||
bf_prefix.c columns.c app_params.c
|
||||
bf_prefix.c columns.c app_params.c names.c
|
||||
|
||||
IF[{- !$disabled{apps} -}]
|
||||
LIBS{noinst}=../libapps.a
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/safestack.h>
|
||||
#include "names.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
# define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
int name_cmp(const char * const *a, const char * const *b)
|
||||
{
|
||||
return strcasecmp(*a, *b);
|
||||
}
|
||||
|
||||
void collect_names(const char *name, void *vdata)
|
||||
{
|
||||
STACK_OF(OPENSSL_CSTRING) *names = vdata;
|
||||
|
||||
sk_OPENSSL_CSTRING_push(names, name);
|
||||
}
|
||||
|
||||
void print_names(BIO *out, STACK_OF(OPENSSL_CSTRING) *names)
|
||||
{
|
||||
int i = sk_OPENSSL_CSTRING_num(names);
|
||||
int j;
|
||||
|
||||
sk_OPENSSL_CSTRING_sort(names);
|
||||
if (i > 1)
|
||||
BIO_printf(out, "{ ");
|
||||
for (j = 0; j < i; j++) {
|
||||
const char *name = sk_OPENSSL_CSTRING_value(names, j);
|
||||
|
||||
if (j > 0)
|
||||
BIO_printf(out, ", ");
|
||||
BIO_printf(out, "%s", name);
|
||||
}
|
||||
if (i > 1)
|
||||
BIO_printf(out, " }");
|
||||
}
|
||||
+59
-24
@@ -17,6 +17,7 @@
|
||||
#include "app_params.h"
|
||||
#include "progs.h"
|
||||
#include "opt.h"
|
||||
#include "names.h"
|
||||
|
||||
static int verbose = 0;
|
||||
|
||||
@@ -38,7 +39,7 @@ DEFINE_STACK_OF(EVP_CIPHER)
|
||||
static int cipher_cmp(const EVP_CIPHER * const *a,
|
||||
const EVP_CIPHER * const *b)
|
||||
{
|
||||
int ret = strcasecmp(EVP_CIPHER_name(*a), EVP_CIPHER_name(*b));
|
||||
int ret = EVP_CIPHER_number(*a) - EVP_CIPHER_number(*b);
|
||||
|
||||
if (ret == 0)
|
||||
ret = strcmp(OSSL_PROVIDER_name(EVP_CIPHER_provider(*a)),
|
||||
@@ -64,21 +65,29 @@ static void list_ciphers(void)
|
||||
EVP_CIPHER_do_all_sorted(legacy_cipher_fn, bio_out);
|
||||
|
||||
BIO_printf(bio_out, "Provided:\n");
|
||||
EVP_CIPHER_do_all_ex(NULL, collect_ciphers, ciphers);
|
||||
EVP_CIPHER_do_all_provided(NULL, collect_ciphers, ciphers);
|
||||
sk_EVP_CIPHER_sort(ciphers);
|
||||
for (i = 0; i < sk_EVP_CIPHER_num(ciphers); i++) {
|
||||
const EVP_CIPHER *c = sk_EVP_CIPHER_value(ciphers, i);
|
||||
STACK_OF(OPENSSL_CSTRING) *names =
|
||||
sk_OPENSSL_CSTRING_new(name_cmp);
|
||||
|
||||
BIO_printf(bio_out, " %s", EVP_CIPHER_name(c));
|
||||
EVP_CIPHER_names_do_all(c, collect_names, names);
|
||||
|
||||
BIO_printf(bio_out, " ");
|
||||
print_names(bio_out, names);
|
||||
BIO_printf(bio_out, " @ %s\n",
|
||||
OSSL_PROVIDER_name(EVP_CIPHER_provider(c)));
|
||||
|
||||
sk_OPENSSL_CSTRING_free(names);
|
||||
|
||||
if (verbose) {
|
||||
print_param_types("retrievable algorithm parameters",
|
||||
EVP_CIPHER_gettable_params(c), 4);
|
||||
print_param_types("retrievable operation parameters",
|
||||
EVP_CIPHER_CTX_gettable_params(c), 4);
|
||||
EVP_CIPHER_gettable_ctx_params(c), 4);
|
||||
print_param_types("settable operation parameters",
|
||||
EVP_CIPHER_CTX_settable_params(c), 4);
|
||||
EVP_CIPHER_settable_ctx_params(c), 4);
|
||||
}
|
||||
}
|
||||
sk_EVP_CIPHER_pop_free(ciphers, EVP_CIPHER_free);
|
||||
@@ -101,7 +110,7 @@ static void list_md_fn(const EVP_MD *m,
|
||||
DEFINE_STACK_OF(EVP_MD)
|
||||
static int md_cmp(const EVP_MD * const *a, const EVP_MD * const *b)
|
||||
{
|
||||
int ret = strcasecmp(EVP_MD_name(*a), EVP_MD_name(*b));
|
||||
int ret = EVP_MD_number(*a) - EVP_MD_number(*b);
|
||||
|
||||
if (ret == 0)
|
||||
ret = strcmp(OSSL_PROVIDER_name(EVP_MD_provider(*a)),
|
||||
@@ -127,21 +136,29 @@ static void list_digests(void)
|
||||
EVP_MD_do_all_sorted(list_md_fn, bio_out);
|
||||
|
||||
BIO_printf(bio_out, "Provided:\n");
|
||||
EVP_MD_do_all_ex(NULL, collect_digests, digests);
|
||||
EVP_MD_do_all_provided(NULL, collect_digests, digests);
|
||||
sk_EVP_MD_sort(digests);
|
||||
for (i = 0; i < sk_EVP_MD_num(digests); i++) {
|
||||
const EVP_MD *m = sk_EVP_MD_value(digests, i);
|
||||
STACK_OF(OPENSSL_CSTRING) *names =
|
||||
sk_OPENSSL_CSTRING_new(name_cmp);
|
||||
|
||||
BIO_printf(bio_out, " %s", EVP_MD_name(m));
|
||||
EVP_MD_names_do_all(m, collect_names, names);
|
||||
|
||||
BIO_printf(bio_out, " ");
|
||||
print_names(bio_out, names);
|
||||
BIO_printf(bio_out, " @ %s\n",
|
||||
OSSL_PROVIDER_name(EVP_MD_provider(m)));
|
||||
|
||||
sk_OPENSSL_CSTRING_free(names);
|
||||
|
||||
if (verbose) {
|
||||
print_param_types("retrievable algorithm parameters",
|
||||
EVP_MD_gettable_params(m), 4);
|
||||
print_param_types("retrievable operation parameters",
|
||||
EVP_MD_CTX_gettable_params(m), 4);
|
||||
EVP_MD_gettable_ctx_params(m), 4);
|
||||
print_param_types("settable operation parameters",
|
||||
EVP_MD_CTX_settable_params(m), 4);
|
||||
EVP_MD_settable_ctx_params(m), 4);
|
||||
}
|
||||
}
|
||||
sk_EVP_MD_pop_free(digests, EVP_MD_free);
|
||||
@@ -150,7 +167,7 @@ static void list_digests(void)
|
||||
DEFINE_STACK_OF(EVP_MAC)
|
||||
static int mac_cmp(const EVP_MAC * const *a, const EVP_MAC * const *b)
|
||||
{
|
||||
int ret = strcasecmp(EVP_MAC_name(*a), EVP_MAC_name(*b));
|
||||
int ret = EVP_MAC_number(*a) - EVP_MAC_number(*b);
|
||||
|
||||
if (ret == 0)
|
||||
ret = strcmp(OSSL_PROVIDER_name(EVP_MAC_provider(*a)),
|
||||
@@ -173,22 +190,29 @@ static void list_macs(void)
|
||||
int i;
|
||||
|
||||
BIO_printf(bio_out, "Provided MACs:\n");
|
||||
EVP_MAC_do_all_ex(NULL, collect_macs, macs);
|
||||
EVP_MAC_do_all_provided(NULL, collect_macs, macs);
|
||||
sk_EVP_MAC_sort(macs);
|
||||
for (i = 0; i < sk_EVP_MAC_num(macs); i++) {
|
||||
const EVP_MAC *m = sk_EVP_MAC_value(macs, i);
|
||||
STACK_OF(OPENSSL_CSTRING) *names =
|
||||
sk_OPENSSL_CSTRING_new(name_cmp);
|
||||
|
||||
BIO_printf(bio_out, " %s", EVP_MAC_name(m));
|
||||
EVP_MAC_names_do_all(m, collect_names, names);
|
||||
|
||||
BIO_printf(bio_out, " ");
|
||||
print_names(bio_out, names);
|
||||
BIO_printf(bio_out, " @ %s\n",
|
||||
OSSL_PROVIDER_name(EVP_MAC_provider(m)));
|
||||
|
||||
sk_OPENSSL_CSTRING_free(names);
|
||||
|
||||
if (verbose) {
|
||||
print_param_types("retrievable algorithm parameters",
|
||||
EVP_MAC_gettable_params(m), 4);
|
||||
print_param_types("retrievable operation parameters",
|
||||
EVP_MAC_CTX_gettable_params(m), 4);
|
||||
EVP_MAC_gettable_ctx_params(m), 4);
|
||||
print_param_types("settable operation parameters",
|
||||
EVP_MAC_CTX_settable_params(m), 4);
|
||||
EVP_MAC_settable_ctx_params(m), 4);
|
||||
}
|
||||
}
|
||||
sk_EVP_MAC_pop_free(macs, EVP_MAC_free);
|
||||
@@ -200,7 +224,7 @@ static void list_macs(void)
|
||||
DEFINE_STACK_OF(EVP_KDF)
|
||||
static int kdf_cmp(const EVP_KDF * const *a, const EVP_KDF * const *b)
|
||||
{
|
||||
int ret = strcasecmp(EVP_KDF_name(*a), EVP_KDF_name(*b));
|
||||
int ret = EVP_KDF_number(*a) - EVP_KDF_number(*b);
|
||||
|
||||
if (ret == 0)
|
||||
ret = strcmp(OSSL_PROVIDER_name(EVP_KDF_provider(*a)),
|
||||
@@ -223,22 +247,29 @@ static void list_kdfs(void)
|
||||
int i;
|
||||
|
||||
BIO_printf(bio_out, "Provided KDFs and PDFs:\n");
|
||||
EVP_KDF_do_all_ex(NULL, collect_kdfs, kdfs);
|
||||
EVP_KDF_do_all_provided(NULL, collect_kdfs, kdfs);
|
||||
sk_EVP_KDF_sort(kdfs);
|
||||
for (i = 0; i < sk_EVP_KDF_num(kdfs); i++) {
|
||||
const EVP_KDF *m = sk_EVP_KDF_value(kdfs, i);
|
||||
const EVP_KDF *k = sk_EVP_KDF_value(kdfs, i);
|
||||
STACK_OF(OPENSSL_CSTRING) *names =
|
||||
sk_OPENSSL_CSTRING_new(name_cmp);
|
||||
|
||||
BIO_printf(bio_out, " %s", EVP_KDF_name(m));
|
||||
EVP_KDF_names_do_all(k, collect_names, names);
|
||||
|
||||
BIO_printf(bio_out, " ");
|
||||
print_names(bio_out, names);
|
||||
BIO_printf(bio_out, " @ %s\n",
|
||||
OSSL_PROVIDER_name(EVP_KDF_provider(m)));
|
||||
OSSL_PROVIDER_name(EVP_KDF_provider(k)));
|
||||
|
||||
sk_OPENSSL_CSTRING_free(names);
|
||||
|
||||
if (verbose) {
|
||||
print_param_types("retrievable algorithm parameters",
|
||||
EVP_KDF_gettable_params(m), 4);
|
||||
EVP_KDF_gettable_params(k), 4);
|
||||
print_param_types("retrievable operation parameters",
|
||||
EVP_KDF_CTX_gettable_params(m), 4);
|
||||
EVP_KDF_gettable_ctx_params(k), 4);
|
||||
print_param_types("settable operation parameters",
|
||||
EVP_KDF_CTX_settable_params(m), 4);
|
||||
EVP_KDF_settable_ctx_params(k), 4);
|
||||
}
|
||||
}
|
||||
sk_EVP_KDF_pop_free(kdfs, EVP_KDF_free);
|
||||
@@ -331,12 +362,16 @@ static void list_options_for_command(const char *command)
|
||||
return;
|
||||
|
||||
for ( ; o->name != NULL; o++) {
|
||||
char c = o->valtype;
|
||||
|
||||
if (o->name == OPT_HELP_STR
|
||||
|| o->name == OPT_MORE_STR
|
||||
|| o->name[0] == '\0')
|
||||
continue;
|
||||
BIO_printf(bio_out, "%s %c\n", o->name, o->valtype);
|
||||
BIO_printf(bio_out, "%s %c\n", o->name, c == '\0' ? '-' : c);
|
||||
}
|
||||
/* Always output the -- marker since it is sometimes documented. */
|
||||
BIO_printf(bio_out, "- -\n");
|
||||
}
|
||||
|
||||
static void list_type(FUNC_TYPE ft, int one)
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@ opthelp:
|
||||
if (opts != NULL) {
|
||||
int ok = 1;
|
||||
OSSL_PARAM *params =
|
||||
app_params_new_from_opts(opts, EVP_MAC_CTX_settable_params(mac));
|
||||
app_params_new_from_opts(opts, EVP_MAC_settable_ctx_params(mac));
|
||||
|
||||
if (params == NULL)
|
||||
goto err;
|
||||
|
||||
+1
-1
@@ -465,7 +465,7 @@ int pkcs12_main(int argc, char **argv)
|
||||
p12 = PKCS12_create(cpass, name, key, ucert, certs,
|
||||
key_pbe, cert_pbe, iter, -1, keytype);
|
||||
|
||||
if (!p12) {
|
||||
if (p12 == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
goto export_end;
|
||||
}
|
||||
|
||||
+4
-3
@@ -35,7 +35,7 @@ const OPTIONS prime_options[] = {
|
||||
int prime_main(int argc, char **argv)
|
||||
{
|
||||
BIGNUM *bn = NULL;
|
||||
int hex = 0, checks = 20, generate = 0, bits = 0, safe = 0, ret = 1;
|
||||
int hex = 0, generate = 0, bits = 0, safe = 0, ret = 1;
|
||||
char *prog;
|
||||
OPTION_CHOICE o;
|
||||
|
||||
@@ -64,7 +64,8 @@ opthelp:
|
||||
safe = 1;
|
||||
break;
|
||||
case OPT_CHECKS:
|
||||
checks = atoi(opt_arg());
|
||||
/* ignore parameter and argument */
|
||||
opt_arg();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -121,7 +122,7 @@ opthelp:
|
||||
BN_print(bio_out, bn);
|
||||
BIO_printf(bio_out, " (%s) %s prime\n",
|
||||
argv[0],
|
||||
BN_is_prime_ex(bn, checks, NULL, NULL)
|
||||
BN_check_prime(bn, NULL, NULL)
|
||||
? "is" : "is not");
|
||||
}
|
||||
}
|
||||
|
||||
+107
-30
@@ -12,6 +12,7 @@
|
||||
#include "apps.h"
|
||||
#include "app_params.h"
|
||||
#include "progs.h"
|
||||
#include "names.h"
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/safestack.h>
|
||||
@@ -40,7 +41,7 @@ typedef struct info_st INFO;
|
||||
typedef struct meta_st META;
|
||||
|
||||
struct info_st {
|
||||
const char *name;
|
||||
void (*collect_names_fn)(void *method, STACK_OF(OPENSSL_CSTRING) *names);
|
||||
void *method;
|
||||
const OSSL_PARAM *gettable_params;
|
||||
const OSSL_PARAM *gettable_ctx_params;
|
||||
@@ -58,11 +59,58 @@ struct meta_st {
|
||||
void (*fn)(META *meta, INFO *info);
|
||||
};
|
||||
|
||||
static void collect_cipher_names(void *method,
|
||||
STACK_OF(OPENSSL_CSTRING) *names)
|
||||
{
|
||||
EVP_CIPHER_names_do_all(method, collect_names, names);
|
||||
}
|
||||
|
||||
static void collect_digest_names(void *method,
|
||||
STACK_OF(OPENSSL_CSTRING) *names)
|
||||
{
|
||||
EVP_MD_names_do_all(method, collect_names, names);
|
||||
}
|
||||
|
||||
static void collect_mac_names(void *method,
|
||||
STACK_OF(OPENSSL_CSTRING) *names)
|
||||
{
|
||||
EVP_MAC_names_do_all(method, collect_names, names);
|
||||
}
|
||||
|
||||
static void collect_keymgmt_names(void *method,
|
||||
STACK_OF(OPENSSL_CSTRING) *names)
|
||||
{
|
||||
EVP_KEYMGMT_names_do_all(method, collect_names, names);
|
||||
}
|
||||
|
||||
static void collect_keyexch_names(void *method,
|
||||
STACK_OF(OPENSSL_CSTRING) *names)
|
||||
{
|
||||
EVP_KEYEXCH_names_do_all(method, collect_names, names);
|
||||
}
|
||||
|
||||
static void collect_signature_names(void *method,
|
||||
STACK_OF(OPENSSL_CSTRING) *names)
|
||||
{
|
||||
EVP_SIGNATURE_names_do_all(method, collect_names, names);
|
||||
}
|
||||
|
||||
static void print_method_names(BIO *out, INFO *info)
|
||||
{
|
||||
STACK_OF(OPENSSL_CSTRING) *names = sk_OPENSSL_CSTRING_new(name_cmp);
|
||||
|
||||
info->collect_names_fn(info->method, names);
|
||||
print_names(out, names);
|
||||
sk_OPENSSL_CSTRING_free(names);
|
||||
}
|
||||
|
||||
static void print_caps(META *meta, INFO *info)
|
||||
{
|
||||
switch (meta->verbose) {
|
||||
case 1:
|
||||
BIO_printf(bio_out, meta->first ? "%s" : " %s", info->name);
|
||||
if (!meta->first)
|
||||
BIO_printf(bio_out, "; ");
|
||||
print_method_names(bio_out, info);
|
||||
break;
|
||||
case 2:
|
||||
if (meta->first) {
|
||||
@@ -70,12 +118,14 @@ static void print_caps(META *meta, INFO *info)
|
||||
BIO_printf(bio_out, "\n");
|
||||
BIO_printf(bio_out, "%*s%ss:", meta->indent, "", meta->label);
|
||||
}
|
||||
BIO_printf(bio_out, " %s", info->name);
|
||||
BIO_printf(bio_out, " ");
|
||||
print_method_names(bio_out, info);
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
BIO_printf(bio_out, "%*s%s %s\n", meta->indent, "", meta->label,
|
||||
info->name);
|
||||
BIO_printf(bio_out, "%*s%s ", meta->indent, "", meta->label);
|
||||
print_method_names(bio_out, info);
|
||||
BIO_printf(bio_out, "\n");
|
||||
print_param_types("retrievable algorithm parameters",
|
||||
info->gettable_params, meta->subindent);
|
||||
print_param_types("retrievable operation parameters",
|
||||
@@ -87,7 +137,9 @@ static void print_caps(META *meta, INFO *info)
|
||||
meta->first = 0;
|
||||
}
|
||||
|
||||
static void do_method(void *method, const char *name,
|
||||
static void do_method(void *method,
|
||||
void (*collect_names_fn)(void *method,
|
||||
STACK_OF(OPENSSL_CSTRING) *names),
|
||||
const OSSL_PARAM *gettable_params,
|
||||
const OSSL_PARAM *gettable_ctx_params,
|
||||
const OSSL_PARAM *settable_ctx_params,
|
||||
@@ -95,7 +147,7 @@ static void do_method(void *method, const char *name,
|
||||
{
|
||||
INFO info;
|
||||
|
||||
info.name = name;
|
||||
info.collect_names_fn = collect_names_fn;
|
||||
info.method = method;
|
||||
info.gettable_params = gettable_params;
|
||||
info.gettable_ctx_params = gettable_ctx_params;
|
||||
@@ -106,53 +158,78 @@ static void do_method(void *method, const char *name,
|
||||
|
||||
static void do_cipher(EVP_CIPHER *cipher, void *meta)
|
||||
{
|
||||
do_method(cipher, EVP_CIPHER_name(cipher),
|
||||
do_method(cipher, collect_cipher_names,
|
||||
EVP_CIPHER_gettable_params(cipher),
|
||||
EVP_CIPHER_CTX_gettable_params(cipher),
|
||||
EVP_CIPHER_CTX_settable_params(cipher),
|
||||
EVP_CIPHER_gettable_ctx_params(cipher),
|
||||
EVP_CIPHER_settable_ctx_params(cipher),
|
||||
meta);
|
||||
}
|
||||
|
||||
static void do_digest(EVP_MD *digest, void *meta)
|
||||
{
|
||||
do_method(digest, EVP_MD_name(digest),
|
||||
do_method(digest, collect_digest_names,
|
||||
EVP_MD_gettable_params(digest),
|
||||
EVP_MD_CTX_gettable_params(digest),
|
||||
EVP_MD_CTX_settable_params(digest),
|
||||
EVP_MD_gettable_ctx_params(digest),
|
||||
EVP_MD_settable_ctx_params(digest),
|
||||
meta);
|
||||
}
|
||||
|
||||
static void do_mac(EVP_MAC *mac, void *meta)
|
||||
{
|
||||
do_method(mac, EVP_MAC_name(mac),
|
||||
do_method(mac, collect_mac_names,
|
||||
EVP_MAC_gettable_params(mac),
|
||||
EVP_MAC_CTX_gettable_params(mac),
|
||||
EVP_MAC_CTX_settable_params(mac),
|
||||
EVP_MAC_gettable_ctx_params(mac),
|
||||
EVP_MAC_settable_ctx_params(mac),
|
||||
meta);
|
||||
}
|
||||
|
||||
static void do_keymgmt(EVP_KEYMGMT *keymgmt, void *meta)
|
||||
{
|
||||
do_method(keymgmt, collect_keymgmt_names,
|
||||
/*
|
||||
* TODO(3.0) Enable when KEYMGMT and KEYEXCH have gettables and settables
|
||||
*/
|
||||
#if 0
|
||||
static void do_keymgmt(EVP_KEYMGMT *keymgmt, void *meta)
|
||||
{
|
||||
do_method(keymgmt, EVP_KEYMGMT_name(keymgmt),
|
||||
EVP_KEYMGMT_gettable_params(keymgmt),
|
||||
EVP_KEYMGMT_gettable_ctx_params(keymgmt),
|
||||
EVP_KEYMGMT_settable_ctx_params(keymgmt),
|
||||
#else
|
||||
NULL, NULL, NULL,
|
||||
#endif
|
||||
meta);
|
||||
}
|
||||
|
||||
static void do_keyexch(EVP_KEYEXCH *keyexch, void *meta)
|
||||
{
|
||||
do_method(keyexch, EVP_KEYEXCH_name(keyexch),
|
||||
do_method(keyexch, collect_keyexch_names,
|
||||
/*
|
||||
* TODO(3.0) Enable when KEYMGMT and KEYEXCH have gettables and settables
|
||||
*/
|
||||
#if 0
|
||||
EVP_KEYEXCH_gettable_params(keyexch),
|
||||
EVP_KEYEXCH_gettable_ctx_params(keyexch),
|
||||
EVP_KEYEXCH_settable_ctx_params(keyexch),
|
||||
#else
|
||||
NULL, NULL, NULL,
|
||||
#endif
|
||||
meta);
|
||||
}
|
||||
|
||||
static void do_signature(EVP_SIGNATURE *signature, void *meta)
|
||||
{
|
||||
do_method(signature, collect_signature_names,
|
||||
/*
|
||||
* TODO(3.0) Enable when KEYMGMT and SIGNATURE have gettables and settables
|
||||
*/
|
||||
#if 0
|
||||
EVP_SIGNATURE_gettable_params(signature),
|
||||
EVP_SIGNATURE_gettable_ctx_params(signature),
|
||||
EVP_SIGNATURE_settable_ctx_params(signature),
|
||||
#else
|
||||
NULL, NULL, NULL,
|
||||
#endif
|
||||
meta);
|
||||
}
|
||||
|
||||
int provider_main(int argc, char **argv)
|
||||
{
|
||||
@@ -231,33 +308,33 @@ int provider_main(int argc, char **argv)
|
||||
data.first = 1;
|
||||
data.label = "Cipher";
|
||||
}
|
||||
EVP_CIPHER_do_all_ex(NULL, do_cipher, &data);
|
||||
EVP_CIPHER_do_all_provided(NULL, do_cipher, &data);
|
||||
if (verbose > 1) {
|
||||
data.first = 1;
|
||||
data.label = "Digest";
|
||||
}
|
||||
EVP_MD_do_all_ex(NULL, do_digest, &data);
|
||||
EVP_MD_do_all_provided(NULL, do_digest, &data);
|
||||
if (verbose > 1) {
|
||||
data.first = 1;
|
||||
data.label = "MAC";
|
||||
}
|
||||
EVP_MAC_do_all_ex(NULL, do_mac, &data);
|
||||
EVP_MAC_do_all_provided(NULL, do_mac, &data);
|
||||
|
||||
/*
|
||||
* TODO(3.0) Enable when KEYMGMT and KEYEXCH have do_all_ex functions
|
||||
*/
|
||||
#if 0
|
||||
if (verbose > 1) {
|
||||
data.first = 1;
|
||||
data.label = "Key manager";
|
||||
}
|
||||
EVP_KEYMGMT_do_all_ex(NULL, do_keymgmt, &data);
|
||||
EVP_KEYMGMT_do_all_provided(NULL, do_keymgmt, &data);
|
||||
if (verbose > 1) {
|
||||
data.first = 1;
|
||||
data.label = "Key exchange";
|
||||
}
|
||||
EVP_KEYEXCH_do_all_ex(NULL, do_keyexch, &data);
|
||||
#endif
|
||||
EVP_KEYEXCH_do_all_provided(NULL, do_keyexch, &data);
|
||||
if (verbose > 1) {
|
||||
data.first = 1;
|
||||
data.label = "Signature";
|
||||
}
|
||||
EVP_SIGNATURE_do_all_provided(NULL, do_signature, &data);
|
||||
|
||||
switch (verbose) {
|
||||
default:
|
||||
|
||||
+33
-20
@@ -325,9 +325,10 @@ int req_main(int argc, char **argv)
|
||||
newreq = 1;
|
||||
break;
|
||||
case OPT_PKEYOPT:
|
||||
if (!pkeyopts)
|
||||
if (pkeyopts == NULL)
|
||||
pkeyopts = sk_OPENSSL_STRING_new_null();
|
||||
if (!pkeyopts || !sk_OPENSSL_STRING_push(pkeyopts, opt_arg()))
|
||||
if (pkeyopts == NULL
|
||||
|| !sk_OPENSSL_STRING_push(pkeyopts, opt_arg()))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_SIGOPT:
|
||||
@@ -1751,15 +1752,19 @@ int do_X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md,
|
||||
#endif
|
||||
|
||||
rv = do_sign_init(mctx, pkey, md, sigopts);
|
||||
if (rv > 0)
|
||||
if (rv > 0) {
|
||||
rv = X509_sign_ctx(x, mctx);
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
/* only in SM2 case we need to free the pctx explicitly */
|
||||
if (ec_pkey_is_sm2(pkey)) {
|
||||
pctx = EVP_MD_CTX_pkey_ctx(mctx);
|
||||
EVP_PKEY_CTX_free(pctx);
|
||||
}
|
||||
/*
|
||||
* only in SM2 case we need to free the pctx explicitly
|
||||
* if do_sign_init() fails, pctx is already freed in it
|
||||
*/
|
||||
if (ec_pkey_is_sm2(pkey)) {
|
||||
pctx = EVP_MD_CTX_pkey_ctx(mctx);
|
||||
EVP_PKEY_CTX_free(pctx);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
EVP_MD_CTX_free(mctx);
|
||||
return rv > 0 ? 1 : 0;
|
||||
}
|
||||
@@ -1774,15 +1779,19 @@ int do_X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md,
|
||||
#endif
|
||||
|
||||
rv = do_sign_init(mctx, pkey, md, sigopts);
|
||||
if (rv > 0)
|
||||
if (rv > 0) {
|
||||
rv = X509_REQ_sign_ctx(x, mctx);
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
/* only in SM2 case we need to free the pctx explicitly */
|
||||
if (ec_pkey_is_sm2(pkey)) {
|
||||
pctx = EVP_MD_CTX_pkey_ctx(mctx);
|
||||
EVP_PKEY_CTX_free(pctx);
|
||||
}
|
||||
/*
|
||||
* only in SM2 case we need to free the pctx explicitly
|
||||
* if do_sign_init() fails, pctx is already freed in it
|
||||
*/
|
||||
if (ec_pkey_is_sm2(pkey)) {
|
||||
pctx = EVP_MD_CTX_pkey_ctx(mctx);
|
||||
EVP_PKEY_CTX_free(pctx);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
EVP_MD_CTX_free(mctx);
|
||||
return rv > 0 ? 1 : 0;
|
||||
}
|
||||
@@ -1797,15 +1806,19 @@ int do_X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md,
|
||||
#endif
|
||||
|
||||
rv = do_sign_init(mctx, pkey, md, sigopts);
|
||||
if (rv > 0)
|
||||
if (rv > 0) {
|
||||
rv = X509_CRL_sign_ctx(x, mctx);
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
/* only in SM2 case we need to free the pctx explicitly */
|
||||
if (ec_pkey_is_sm2(pkey)) {
|
||||
pctx = EVP_MD_CTX_pkey_ctx(mctx);
|
||||
EVP_PKEY_CTX_free(pctx);
|
||||
}
|
||||
/*
|
||||
* only in SM2 case we need to free the pctx explicitly
|
||||
* if do_sign_init() fails, no need to double free pctx
|
||||
*/
|
||||
if (ec_pkey_is_sm2(pkey)) {
|
||||
pctx = EVP_MD_CTX_pkey_ctx(mctx);
|
||||
EVP_PKEY_CTX_free(pctx);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
EVP_MD_CTX_free(mctx);
|
||||
return rv > 0 ? 1 : 0;
|
||||
}
|
||||
+2
-4
@@ -272,8 +272,6 @@ typedef struct srp_arg_st {
|
||||
int strength; /* minimal size for N */
|
||||
} SRP_ARG;
|
||||
|
||||
# define SRP_NUMBER_ITERATIONS_FOR_PRIME 64
|
||||
|
||||
static int srp_Verify_N_and_g(const BIGNUM *N, const BIGNUM *g)
|
||||
{
|
||||
BN_CTX *bn_ctx = BN_CTX_new();
|
||||
@@ -281,10 +279,10 @@ static int srp_Verify_N_and_g(const BIGNUM *N, const BIGNUM *g)
|
||||
BIGNUM *r = BN_new();
|
||||
int ret =
|
||||
g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
|
||||
BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 &&
|
||||
BN_check_prime(N, bn_ctx, NULL) == 1 &&
|
||||
p != NULL && BN_rshift1(p, N) &&
|
||||
/* p = (N-1)/2 */
|
||||
BN_is_prime_ex(p, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 &&
|
||||
BN_check_prime(p, bn_ctx, NULL) == 1 &&
|
||||
r != NULL &&
|
||||
/* verify g^((N-1)/2) == -1 (mod N) */
|
||||
BN_mod_exp(r, g, p, N, bn_ctx) &&
|
||||
|
||||
+358
-10
@@ -15,6 +15,7 @@
|
||||
#define ECDSA_SECONDS 10
|
||||
#define ECDH_SECONDS 10
|
||||
#define EdDSA_SECONDS 10
|
||||
#define SM2_SECONDS 10
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -127,6 +128,7 @@ typedef struct openssl_speed_sec_st {
|
||||
int ecdsa;
|
||||
int ecdh;
|
||||
int eddsa;
|
||||
int sm2;
|
||||
} openssl_speed_sec_t;
|
||||
|
||||
static volatile int run = 0;
|
||||
@@ -191,6 +193,10 @@ static int ECDSA_sign_loop(void *args);
|
||||
static int ECDSA_verify_loop(void *args);
|
||||
static int EdDSA_sign_loop(void *args);
|
||||
static int EdDSA_verify_loop(void *args);
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
static int SM2_sign_loop(void *args);
|
||||
static int SM2_verify_loop(void *args);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static double Time_F(int s);
|
||||
@@ -604,6 +610,18 @@ static OPT_PAIR eddsa_choices[] = {
|
||||
# define EdDSA_NUM OSSL_NELEM(eddsa_choices)
|
||||
|
||||
static double eddsa_results[EdDSA_NUM][2]; /* 2 ops: sign then verify */
|
||||
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
# define R_EC_CURVESM2 0
|
||||
static OPT_PAIR sm2_choices[] = {
|
||||
{"curveSM2", R_EC_CURVESM2}
|
||||
};
|
||||
# define SM2_ID "TLSv1.3+GM+Cipher+Suite"
|
||||
# define SM2_ID_LEN sizeof("TLSv1.3+GM+Cipher+Suite") - 1
|
||||
# define SM2_NUM OSSL_NELEM(sm2_choices)
|
||||
|
||||
static double sm2_results[SM2_NUM][2]; /* 2 ops: sign then verify */
|
||||
# endif /* OPENSSL_NO_SM2 */
|
||||
#endif /* OPENSSL_NO_EC */
|
||||
|
||||
#ifndef SIGALRM
|
||||
@@ -634,6 +652,11 @@ typedef struct loopargs_st {
|
||||
EC_KEY *ecdsa[ECDSA_NUM];
|
||||
EVP_PKEY_CTX *ecdh_ctx[EC_NUM];
|
||||
EVP_MD_CTX *eddsa_ctx[EdDSA_NUM];
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
EVP_MD_CTX *sm2_ctx[SM2_NUM];
|
||||
EVP_MD_CTX *sm2_vfy_ctx[SM2_NUM];
|
||||
EVP_PKEY *sm2_pkey[SM2_NUM];
|
||||
# endif
|
||||
unsigned char *secret_a;
|
||||
unsigned char *secret_b;
|
||||
size_t outlen[EC_NUM];
|
||||
@@ -1296,6 +1319,74 @@ static int EdDSA_verify_loop(void *args)
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
static long sm2_c[SM2_NUM][2];
|
||||
static int SM2_sign_loop(void *args)
|
||||
{
|
||||
loopargs_t *tempargs = *(loopargs_t **) args;
|
||||
unsigned char *buf = tempargs->buf;
|
||||
EVP_MD_CTX **sm2ctx = tempargs->sm2_ctx;
|
||||
unsigned char *sm2sig = tempargs->buf2;
|
||||
size_t sm2sigsize = tempargs->sigsize;
|
||||
const size_t max_size = tempargs->sigsize;
|
||||
int ret, count;
|
||||
EVP_PKEY **sm2_pkey = tempargs->sm2_pkey;
|
||||
|
||||
for (count = 0; COND(sm2_c[testnum][0]); count++) {
|
||||
if (!EVP_DigestSignInit(sm2ctx[testnum], NULL, EVP_sm3(),
|
||||
NULL, sm2_pkey[testnum])) {
|
||||
BIO_printf(bio_err, "SM2 init sign failure\n");
|
||||
ERR_print_errors(bio_err);
|
||||
count = -1;
|
||||
break;
|
||||
}
|
||||
ret = EVP_DigestSign(sm2ctx[testnum], sm2sig, &sm2sigsize,
|
||||
buf, 20);
|
||||
if (ret == 0) {
|
||||
BIO_printf(bio_err, "SM2 sign failure\n");
|
||||
ERR_print_errors(bio_err);
|
||||
count = -1;
|
||||
break;
|
||||
}
|
||||
/* update the latest returned size and always use the fixed buffer size */
|
||||
tempargs->sigsize = sm2sigsize;
|
||||
sm2sigsize = max_size;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static int SM2_verify_loop(void *args)
|
||||
{
|
||||
loopargs_t *tempargs = *(loopargs_t **) args;
|
||||
unsigned char *buf = tempargs->buf;
|
||||
EVP_MD_CTX **sm2ctx = tempargs->sm2_vfy_ctx;
|
||||
unsigned char *sm2sig = tempargs->buf2;
|
||||
size_t sm2sigsize = tempargs->sigsize;
|
||||
int ret, count;
|
||||
EVP_PKEY **sm2_pkey = tempargs->sm2_pkey;
|
||||
|
||||
for (count = 0; COND(sm2_c[testnum][1]); count++) {
|
||||
if (!EVP_DigestVerifyInit(sm2ctx[testnum], NULL, EVP_sm3(),
|
||||
NULL, sm2_pkey[testnum])) {
|
||||
BIO_printf(bio_err, "SM2 verify init failure\n");
|
||||
ERR_print_errors(bio_err);
|
||||
count = -1;
|
||||
break;
|
||||
}
|
||||
ret = EVP_DigestVerify(sm2ctx[testnum], sm2sig, sm2sigsize,
|
||||
buf, 20);
|
||||
if (ret != 1) {
|
||||
BIO_printf(bio_err, "SM2 verify failure\n");
|
||||
ERR_print_errors(bio_err);
|
||||
count = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
# endif /* OPENSSL_NO_SM2 */
|
||||
#endif /* OPENSSL_NO_EC */
|
||||
|
||||
static int run_benchmark(int async_jobs,
|
||||
@@ -1477,7 +1568,7 @@ int speed_main(int argc, char **argv)
|
||||
#endif
|
||||
openssl_speed_sec_t seconds = { SECONDS, RSA_SECONDS, DSA_SECONDS,
|
||||
ECDSA_SECONDS, ECDH_SECONDS,
|
||||
EdDSA_SECONDS };
|
||||
EdDSA_SECONDS, SM2_SECONDS };
|
||||
|
||||
/* What follows are the buffers and key material. */
|
||||
#ifndef OPENSSL_NO_RC5
|
||||
@@ -1609,11 +1700,23 @@ int speed_main(int argc, char **argv)
|
||||
{"Ed25519", NID_ED25519, 253, 64},
|
||||
{"Ed448", NID_ED448, 456, 114}
|
||||
};
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
static const struct {
|
||||
const char *name;
|
||||
unsigned int nid;
|
||||
unsigned int bits;
|
||||
} test_sm2_curves[] = {
|
||||
/* SM2 */
|
||||
{"CurveSM2", NID_sm2, 256}
|
||||
};
|
||||
# endif
|
||||
int ecdsa_doit[ECDSA_NUM] = { 0 };
|
||||
int ecdh_doit[EC_NUM] = { 0 };
|
||||
int eddsa_doit[EdDSA_NUM] = { 0 };
|
||||
int sm2_doit[SM2_NUM] = { 0 };
|
||||
OPENSSL_assert(OSSL_NELEM(test_curves) >= EC_NUM);
|
||||
OPENSSL_assert(OSSL_NELEM(test_ed_curves) >= EdDSA_NUM);
|
||||
OPENSSL_assert(OSSL_NELEM(test_sm2_curves) >= SM2_NUM);
|
||||
#endif /* ndef OPENSSL_NO_EC */
|
||||
|
||||
prog = opt_init(argc, argv, speed_options);
|
||||
@@ -1726,7 +1829,8 @@ int speed_main(int argc, char **argv)
|
||||
break;
|
||||
case OPT_SECONDS:
|
||||
seconds.sym = seconds.rsa = seconds.dsa = seconds.ecdsa
|
||||
= seconds.ecdh = seconds.eddsa = atoi(opt_arg());
|
||||
= seconds.ecdh = seconds.eddsa
|
||||
= seconds.sm2 = atoi(opt_arg());
|
||||
break;
|
||||
case OPT_BYTES:
|
||||
lengths_single = atoi(opt_arg());
|
||||
@@ -1819,6 +1923,17 @@ int speed_main(int argc, char **argv)
|
||||
eddsa_doit[i] = 2;
|
||||
continue;
|
||||
}
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
if (strcmp(*argv, "sm2") == 0) {
|
||||
for (loop = 0; loop < OSSL_NELEM(sm2_doit); loop++)
|
||||
sm2_doit[loop] = 1;
|
||||
continue;
|
||||
}
|
||||
if (found(*argv, sm2_choices, &i)) {
|
||||
sm2_doit[i] = 2;
|
||||
continue;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
BIO_printf(bio_err, "%s: Unknown algorithm %s\n", prog, *argv);
|
||||
goto end;
|
||||
@@ -1921,6 +2036,10 @@ int speed_main(int argc, char **argv)
|
||||
ecdh_doit[loop] = 1;
|
||||
for (loop = 0; loop < OSSL_NELEM(eddsa_doit); loop++)
|
||||
eddsa_doit[loop] = 1;
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
for (loop = 0; loop < OSSL_NELEM(sm2_doit); loop++)
|
||||
sm2_doit[loop] = 1;
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
for (i = 0; i < ALGOR_NUM; i++)
|
||||
@@ -2226,6 +2345,10 @@ int speed_main(int argc, char **argv)
|
||||
|
||||
eddsa_c[R_EC_Ed25519][0] = count / 1800;
|
||||
eddsa_c[R_EC_Ed448][0] = count / 7200;
|
||||
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
sm2_c[R_EC_SM2P256][0] = count / 1800;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# else
|
||||
@@ -3149,7 +3272,7 @@ int speed_main(int argc, char **argv)
|
||||
pctx = NULL;
|
||||
}
|
||||
if (kctx == NULL || /* keygen ctx is not null */
|
||||
!EVP_PKEY_keygen_init(kctx) /* init keygen ctx */ ) {
|
||||
EVP_PKEY_keygen_init(kctx) <= 0/* init keygen ctx */ ) {
|
||||
ecdh_checks = 0;
|
||||
BIO_printf(bio_err, "ECDH keygen failure.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
@@ -3157,12 +3280,12 @@ int speed_main(int argc, char **argv)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!EVP_PKEY_keygen(kctx, &key_A) || /* generate secret key A */
|
||||
!EVP_PKEY_keygen(kctx, &key_B) || /* generate secret key B */
|
||||
if (EVP_PKEY_keygen(kctx, &key_A) <= 0 || /* generate secret key A */
|
||||
EVP_PKEY_keygen(kctx, &key_B) <= 0 || /* generate secret key B */
|
||||
!(ctx = EVP_PKEY_CTX_new(key_A, NULL)) || /* derivation ctx from skeyA */
|
||||
!EVP_PKEY_derive_init(ctx) || /* init derivation ctx */
|
||||
!EVP_PKEY_derive_set_peer(ctx, key_B) || /* set peer pubkey in ctx */
|
||||
!EVP_PKEY_derive(ctx, NULL, &outlen) || /* determine max length */
|
||||
EVP_PKEY_derive_init(ctx) <= 0 || /* init derivation ctx */
|
||||
EVP_PKEY_derive_set_peer(ctx, key_B) <= 0 || /* set peer pubkey in ctx */
|
||||
EVP_PKEY_derive(ctx, NULL, &outlen) <= 0 || /* determine max length */
|
||||
outlen == 0 || /* ensure outlen is a valid size */
|
||||
outlen > MAX_ECDH_SIZE /* avoid buffer overflow */ ) {
|
||||
ecdh_checks = 0;
|
||||
@@ -3249,8 +3372,8 @@ int speed_main(int argc, char **argv)
|
||||
|
||||
if ((ed_pctx = EVP_PKEY_CTX_new_id(test_ed_curves[testnum].nid, NULL))
|
||||
== NULL
|
||||
|| !EVP_PKEY_keygen_init(ed_pctx)
|
||||
|| !EVP_PKEY_keygen(ed_pctx, &ed_pkey)) {
|
||||
|| EVP_PKEY_keygen_init(ed_pctx) <= 0
|
||||
|| EVP_PKEY_keygen(ed_pctx, &ed_pkey) <= 0) {
|
||||
st = 0;
|
||||
EVP_PKEY_CTX_free(ed_pctx);
|
||||
break;
|
||||
@@ -3337,6 +3460,175 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
for (testnum = 0; testnum < SM2_NUM; testnum++) {
|
||||
int st = 1;
|
||||
EVP_PKEY *sm2_pkey = NULL;
|
||||
EVP_PKEY_CTX *pctx = NULL;
|
||||
EVP_PKEY_CTX *sm2_pctx = NULL;
|
||||
EVP_PKEY_CTX *sm2_vfy_pctx = NULL;
|
||||
size_t sm2_sigsize = 0;
|
||||
|
||||
if (!sm2_doit[testnum])
|
||||
continue; /* Ignore Curve */
|
||||
/* Init signing and verification */
|
||||
for (i = 0; i < loopargs_len; i++) {
|
||||
loopargs[i].sm2_ctx[testnum] = EVP_MD_CTX_new();
|
||||
if (loopargs[i].sm2_ctx[testnum] == NULL) {
|
||||
st = 0;
|
||||
break;
|
||||
}
|
||||
loopargs[i].sm2_vfy_ctx[testnum] = EVP_MD_CTX_new();
|
||||
if (loopargs[i].sm2_vfy_ctx[testnum] == NULL) {
|
||||
st = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* SM2 keys are generated as normal EC keys with a special curve */
|
||||
if ((pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_EC, NULL)) == NULL
|
||||
|| EVP_PKEY_keygen_init(pctx) <= 0
|
||||
|| EVP_PKEY_CTX_set_ec_paramgen_curve_nid(pctx,
|
||||
test_sm2_curves[testnum].nid) <= 0
|
||||
|| EVP_PKEY_keygen(pctx, &sm2_pkey) <= 0) {
|
||||
st = 0;
|
||||
EVP_PKEY_CTX_free(pctx);
|
||||
break;
|
||||
}
|
||||
/* free previous one and alloc a new one */
|
||||
EVP_PKEY_CTX_free(pctx);
|
||||
|
||||
loopargs[i].sigsize = sm2_sigsize
|
||||
= ECDSA_size(EVP_PKEY_get0_EC_KEY(sm2_pkey));
|
||||
|
||||
if (!EVP_PKEY_set_alias_type(sm2_pkey, EVP_PKEY_SM2)) {
|
||||
st = 0;
|
||||
EVP_PKEY_free(sm2_pkey);
|
||||
break;
|
||||
}
|
||||
|
||||
sm2_pctx = EVP_PKEY_CTX_new(sm2_pkey, NULL);
|
||||
if (sm2_pctx == NULL) {
|
||||
st = 0;
|
||||
EVP_PKEY_free(sm2_pkey);
|
||||
break;
|
||||
}
|
||||
sm2_vfy_pctx = EVP_PKEY_CTX_new(sm2_pkey, NULL);
|
||||
if (sm2_vfy_pctx == NULL) {
|
||||
st = 0;
|
||||
EVP_PKEY_CTX_free(sm2_pctx);
|
||||
EVP_PKEY_free(sm2_pkey);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* No need to allow user to set an explicit ID here, just use
|
||||
* the one defined in the 'draft-yang-tls-tl13-sm-suites' I-D.
|
||||
*/
|
||||
if (EVP_PKEY_CTX_set1_id(sm2_pctx, SM2_ID, SM2_ID_LEN) != 1) {
|
||||
st = 0;
|
||||
EVP_PKEY_CTX_free(sm2_pctx);
|
||||
EVP_PKEY_CTX_free(sm2_vfy_pctx);
|
||||
EVP_PKEY_free(sm2_pkey);
|
||||
break;
|
||||
}
|
||||
|
||||
if (EVP_PKEY_CTX_set1_id(sm2_vfy_pctx, SM2_ID, SM2_ID_LEN) != 1) {
|
||||
st = 0;
|
||||
EVP_PKEY_CTX_free(sm2_pctx);
|
||||
EVP_PKEY_CTX_free(sm2_vfy_pctx);
|
||||
EVP_PKEY_free(sm2_pkey);
|
||||
break;
|
||||
}
|
||||
|
||||
EVP_MD_CTX_set_pkey_ctx(loopargs[i].sm2_ctx[testnum], sm2_pctx);
|
||||
EVP_MD_CTX_set_pkey_ctx(loopargs[i].sm2_vfy_ctx[testnum], sm2_vfy_pctx);
|
||||
|
||||
if (!EVP_DigestSignInit(loopargs[i].sm2_ctx[testnum], NULL,
|
||||
EVP_sm3(), NULL, sm2_pkey)) {
|
||||
st = 0;
|
||||
EVP_PKEY_free(sm2_pkey);
|
||||
break;
|
||||
}
|
||||
if (!EVP_DigestVerifyInit(loopargs[i].sm2_vfy_ctx[testnum], NULL,
|
||||
EVP_sm3(), NULL, sm2_pkey)) {
|
||||
st = 0;
|
||||
EVP_PKEY_free(sm2_pkey);
|
||||
break;
|
||||
}
|
||||
loopargs[i].sm2_pkey[testnum] = sm2_pkey;
|
||||
}
|
||||
if (st == 0) {
|
||||
BIO_printf(bio_err, "SM2 failure.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count = 1;
|
||||
} else {
|
||||
for (i = 0; i < loopargs_len; i++) {
|
||||
sm2_sigsize = loopargs[i].sigsize;
|
||||
/* Perform SM2 signature test */
|
||||
st = EVP_DigestSign(loopargs[i].sm2_ctx[testnum],
|
||||
loopargs[i].buf2, &sm2_sigsize,
|
||||
loopargs[i].buf, 20);
|
||||
if (st == 0)
|
||||
break;
|
||||
}
|
||||
if (st == 0) {
|
||||
BIO_printf(bio_err,
|
||||
"SM2 sign failure. No SM2 sign will be done.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count = 1;
|
||||
} else {
|
||||
pkey_print_message("sign", test_sm2_curves[testnum].name,
|
||||
sm2_c[testnum][0],
|
||||
test_sm2_curves[testnum].bits, seconds.sm2);
|
||||
Time_F(START);
|
||||
count = run_benchmark(async_jobs, SM2_sign_loop, loopargs);
|
||||
d = Time_F(STOP);
|
||||
|
||||
BIO_printf(bio_err,
|
||||
mr ? "+R8:%ld:%u:%s:%.2f\n" :
|
||||
"%ld %u bits %s signs in %.2fs \n",
|
||||
count, test_sm2_curves[testnum].bits,
|
||||
test_sm2_curves[testnum].name, d);
|
||||
sm2_results[testnum][0] = (double)count / d;
|
||||
rsa_count = count;
|
||||
}
|
||||
|
||||
/* Perform SM2 verification test */
|
||||
for (i = 0; i < loopargs_len; i++) {
|
||||
st = EVP_DigestVerify(loopargs[i].sm2_vfy_ctx[testnum],
|
||||
loopargs[i].buf2, loopargs[i].sigsize,
|
||||
loopargs[i].buf, 20);
|
||||
if (st != 1)
|
||||
break;
|
||||
}
|
||||
if (st != 1) {
|
||||
BIO_printf(bio_err,
|
||||
"SM2 verify failure. No SM2 verify will be done.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
sm2_doit[testnum] = 0;
|
||||
} else {
|
||||
pkey_print_message("verify", test_sm2_curves[testnum].name,
|
||||
sm2_c[testnum][1],
|
||||
test_sm2_curves[testnum].bits, seconds.sm2);
|
||||
Time_F(START);
|
||||
count = run_benchmark(async_jobs, SM2_verify_loop, loopargs);
|
||||
d = Time_F(STOP);
|
||||
BIO_printf(bio_err,
|
||||
mr ? "+R9:%ld:%u:%s:%.2f\n"
|
||||
: "%ld %u bits %s verify in %.2fs\n",
|
||||
count, test_sm2_curves[testnum].bits,
|
||||
test_sm2_curves[testnum].name, d);
|
||||
sm2_results[testnum][1] = (double)count / d;
|
||||
}
|
||||
|
||||
if (rsa_count <= 1) {
|
||||
/* if longer than 10s, don't do any more */
|
||||
for (testnum++; testnum < SM2_NUM; testnum++)
|
||||
sm2_doit[testnum] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
# endif /* OPENSSL_NO_SM2 */
|
||||
|
||||
#endif /* OPENSSL_NO_EC */
|
||||
#ifndef NO_FORK
|
||||
show_res:
|
||||
@@ -3489,6 +3781,28 @@ int speed_main(int argc, char **argv)
|
||||
1.0 / eddsa_results[k][0], 1.0 / eddsa_results[k][1],
|
||||
eddsa_results[k][0], eddsa_results[k][1]);
|
||||
}
|
||||
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
testnum = 1;
|
||||
for (k = 0; k < OSSL_NELEM(sm2_doit); k++) {
|
||||
if (!sm2_doit[k])
|
||||
continue;
|
||||
if (testnum && !mr) {
|
||||
printf("%30ssign verify sign/s verify/s\n", " ");
|
||||
testnum = 0;
|
||||
}
|
||||
|
||||
if (mr)
|
||||
printf("+F6:%u:%u:%s:%f:%f\n",
|
||||
k, test_sm2_curves[k].bits, test_sm2_curves[k].name,
|
||||
sm2_results[k][0], sm2_results[k][1]);
|
||||
else
|
||||
printf("%4u bits SM2 (%s) %8.4fs %8.4fs %8.1f %8.1f\n",
|
||||
test_sm2_curves[k].bits, test_sm2_curves[k].name,
|
||||
1.0 / sm2_results[k][0], 1.0 / sm2_results[k][1],
|
||||
sm2_results[k][0], sm2_results[k][1]);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
ret = 0;
|
||||
@@ -3514,6 +3828,24 @@ int speed_main(int argc, char **argv)
|
||||
EVP_PKEY_CTX_free(loopargs[i].ecdh_ctx[k]);
|
||||
for (k = 0; k < EdDSA_NUM; k++)
|
||||
EVP_MD_CTX_free(loopargs[i].eddsa_ctx[k]);
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
for (k = 0; k < SM2_NUM; k++) {
|
||||
EVP_PKEY_CTX *pctx = NULL;
|
||||
|
||||
/* free signing ctx */
|
||||
if (loopargs[i].sm2_ctx[k] != NULL
|
||||
&& (pctx = EVP_MD_CTX_pkey_ctx(loopargs[i].sm2_ctx[k])) != NULL)
|
||||
EVP_PKEY_CTX_free(pctx);
|
||||
EVP_MD_CTX_free(loopargs[i].sm2_ctx[k]);
|
||||
/* free verification ctx */
|
||||
if (loopargs[i].sm2_vfy_ctx[k] != NULL
|
||||
&& (pctx = EVP_MD_CTX_pkey_ctx(loopargs[i].sm2_vfy_ctx[k])) != NULL)
|
||||
EVP_PKEY_CTX_free(pctx);
|
||||
EVP_MD_CTX_free(loopargs[i].sm2_vfy_ctx[k]);
|
||||
/* free pkey */
|
||||
EVP_PKEY_free(loopargs[i].sm2_pkey[k]);
|
||||
}
|
||||
# endif
|
||||
OPENSSL_free(loopargs[i].secret_a);
|
||||
OPENSSL_free(loopargs[i].secret_b);
|
||||
#endif
|
||||
@@ -3739,6 +4071,22 @@ static int do_multi(int multi, int size_num)
|
||||
d = atof(sstrsep(&p, sep));
|
||||
eddsa_results[k][1] += d;
|
||||
}
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
else if (strncmp(buf, "+F7:", 4) == 0) {
|
||||
int k;
|
||||
double d;
|
||||
|
||||
p = buf + 4;
|
||||
k = atoi(sstrsep(&p, sep));
|
||||
sstrsep(&p, sep);
|
||||
|
||||
d = atof(sstrsep(&p, sep));
|
||||
sm2_results[k][0] += d;
|
||||
|
||||
d = atof(sstrsep(&p, sep));
|
||||
sm2_results[k][1] += d;
|
||||
}
|
||||
# endif /* OPENSSL_NO_SM2 */
|
||||
# endif
|
||||
|
||||
else if (strncmp(buf, "+H:", 3) == 0) {
|
||||
|
||||
+3
-3
@@ -7,11 +7,11 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_TIMEOUTS_H
|
||||
# define INCLUDED_TIMEOUTS_H
|
||||
#ifndef OSSL_APPS_TIMEOUTS_H
|
||||
# define OSSL_APPS_TIMEOUTS_H
|
||||
|
||||
/* numbers in us */
|
||||
# define DGRAM_RCV_TIMEOUT 250000
|
||||
# define DGRAM_SND_TIMEOUT 250000
|
||||
|
||||
#endif /* ! INCLUDED_TIMEOUTS_H */
|
||||
#endif /* ! OSSL_APPS_TIMEOUTS_H */
|
||||
@@ -507,8 +507,9 @@ static int create_digest(BIO *input, const char *digest, const EVP_MD *md,
|
||||
md_value_len = EVP_MD_size(md);
|
||||
} else {
|
||||
long digest_len;
|
||||
|
||||
*md_value = OPENSSL_hexstr2buf(digest, &digest_len);
|
||||
if (!*md_value || md_value_len != digest_len) {
|
||||
if (*md_value == NULL || md_value_len != digest_len) {
|
||||
OPENSSL_free(*md_value);
|
||||
*md_value = NULL;
|
||||
BIO_printf(bio_err, "bad digest, %d bytes "
|
||||
@@ -920,7 +921,7 @@ static TS_VERIFY_CTX *create_verify_ctx(const char *data, const char *digest,
|
||||
|
||||
/* Loading untrusted certificates. */
|
||||
if (untrusted
|
||||
&& TS_VERIFY_CTS_set_certs(ctx, TS_CONF_load_certs(untrusted)) == NULL)
|
||||
&& TS_VERIFY_CTX_set_certs(ctx, TS_CONF_load_certs(untrusted)) == NULL)
|
||||
goto err;
|
||||
ret = 1;
|
||||
|
||||
|
||||
+5
-9
@@ -3,21 +3,17 @@
|
||||
SUBDIRS=crypto ssl apps test util tools fuzz engines providers
|
||||
|
||||
LIBS=libcrypto libssl
|
||||
INCLUDE[libcrypto]=. crypto/include include
|
||||
INCLUDE[libcrypto]=. include
|
||||
INCLUDE[libssl]=. include
|
||||
DEPEND[libssl]=libcrypto
|
||||
|
||||
# Empty DEPEND "indices" means the dependencies are expected to be built
|
||||
# unconditionally before anything else.
|
||||
DEPEND[]=include/openssl/opensslconf.h crypto/include/internal/bn_conf.h \
|
||||
crypto/include/internal/dso_conf.h doc/man7/openssl_user_macros.pod
|
||||
DEPEND[include/openssl/opensslconf.h]=configdata.pm
|
||||
DEPEND[]=include/openssl/opensslconf.h include/crypto/bn_conf.h \
|
||||
include/crypto/dso_conf.h doc/man7/openssl_user_macros.pod
|
||||
GENERATE[include/openssl/opensslconf.h]=include/openssl/opensslconf.h.in
|
||||
DEPEND[crypto/include/internal/bn_conf.h]=configdata.pm
|
||||
GENERATE[crypto/include/internal/bn_conf.h]=crypto/include/internal/bn_conf.h.in
|
||||
DEPEND[crypto/include/internal/dso_conf.h]=configdata.pm
|
||||
GENERATE[crypto/include/internal/dso_conf.h]=crypto/include/internal/dso_conf.h.in
|
||||
DEPEND[doc/man7/openssl_user_macros.pod]=configdata.pm
|
||||
GENERATE[include/crypto/bn_conf.h]=include/crypto/bn_conf.h.in
|
||||
GENERATE[include/crypto/dso_conf.h]=include/crypto/dso_conf.h.in
|
||||
GENERATE[doc/man7/openssl_user_macros.pod]=doc/man7/openssl_user_macros.pod.in
|
||||
|
||||
IF[{- defined $target{shared_defflag} -}]
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_locl.h"
|
||||
#include "aes_local.h"
|
||||
|
||||
#ifndef AES_ASM
|
||||
/*-
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_locl.h"
|
||||
#include "aes_local.h"
|
||||
|
||||
void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key, const int enc)
|
||||
|
||||
@@ -14,7 +14,7 @@ NON_EMPTY_TRANSLATION_UNIT
|
||||
#else
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_locl.h"
|
||||
#include "aes_local.h"
|
||||
|
||||
#define N_WORDS (AES_BLOCK_SIZE / sizeof(unsigned long))
|
||||
typedef struct {
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_AES_LOCL_H
|
||||
# define HEADER_AES_LOCL_H
|
||||
#ifndef OSSL_CRYPTO_AES_LOCAL_H
|
||||
# define OSSL_CRYPTO_AES_LOCAL_H
|
||||
|
||||
# include <openssl/e_os2.h>
|
||||
# include <stdio.h>
|
||||
@@ -39,4 +39,4 @@ typedef unsigned char u8;
|
||||
/* This controls loop-unrolling in aes_core.c */
|
||||
# undef FULL_UNROLL
|
||||
|
||||
#endif /* !HEADER_AES_LOCL_H */
|
||||
#endif /* !OSSL_CRYPTO_AES_LOCAL_H */
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <openssl/opensslv.h>
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_locl.h"
|
||||
#include "aes_local.h"
|
||||
|
||||
const char *AES_options(void)
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_locl.h"
|
||||
#include "aes_local.h"
|
||||
|
||||
/*
|
||||
* These two parameters control which table, 256-byte or 2KB, is
|
||||
|
||||
@@ -61,8 +61,14 @@ ENDIF
|
||||
|
||||
$COMMON=aes_misc.c aes_ecb.c $AESASM
|
||||
SOURCE[../../libcrypto]=$COMMON aes_cfb.c aes_ofb.c aes_ige.c aes_wrap.c
|
||||
SOURCE[../../providers/libfips.a]=$COMMON
|
||||
|
||||
# Implementations are now spread across several libraries, so the defines
|
||||
# need to be applied to all affected libraries and modules.
|
||||
DEFINE[../../libcrypto]=$AESDEF
|
||||
SOURCE[../../providers/fips]=$COMMON
|
||||
DEFINE[../../providers/libfips.a]=$AESDEF
|
||||
DEFINE[../../providers/libimplementations.a]=$AESDEF
|
||||
# fipsprov.c needs access to AESNI.
|
||||
DEFINE[../../providers/fips]=$AESDEF
|
||||
|
||||
GENERATE[aes-ia64.s]=asm/aes-ia64.S
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <openssl/e_os2.h>
|
||||
#include "internal/aria.h"
|
||||
#include "crypto/aria.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef __ARM_ARCH_H__
|
||||
# define __ARM_ARCH_H__
|
||||
#ifndef OSSL_CRYPTO_ARM_ARCH_H
|
||||
# define OSSL_CRYPTO_ARM_ARCH_H
|
||||
|
||||
# if !defined(__ARM_ARCH__)
|
||||
# if defined(__CC_ARM)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <stdio.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/asn1.h>
|
||||
#include "asn1_locl.h"
|
||||
#include "asn1_local.h"
|
||||
|
||||
int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "internal/numbers.h"
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/asn1.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "crypto/asn1.h"
|
||||
|
||||
#ifndef NO_OLD_ASN1
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <time.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/asn1.h>
|
||||
#include "asn1_locl.h"
|
||||
#include "asn1_local.h"
|
||||
|
||||
/* This is the primary function used to parse ASN1_GENERALIZEDTIME */
|
||||
int asn1_generalizedtime_to_tm(struct tm *tm, const ASN1_GENERALIZEDTIME *d)
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
#include <limits.h>
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/bn.h>
|
||||
#include "asn1_locl.h"
|
||||
#include "asn1_local.h"
|
||||
|
||||
ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "internal/ctype.h"
|
||||
#include "crypto/ctype.h"
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/asn1.h>
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include "internal/ctype.h"
|
||||
#include "crypto/ctype.h"
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/bn.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "asn1_locl.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include "asn1_local.h"
|
||||
|
||||
int i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "internal/ctype.h"
|
||||
#include "crypto/ctype.h"
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/asn1.h>
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/buffer.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "internal/evp_int.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include "crypto/evp.h"
|
||||
|
||||
#ifndef NO_ASN1_OLD
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include "internal/asn1_int.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/asn1.h>
|
||||
|
||||
@@ -51,7 +51,7 @@ int ASN1_STRING_set_default_mask_asc(const char *p)
|
||||
char *end;
|
||||
|
||||
if (strncmp(p, "MASK:", 5) == 0) {
|
||||
if (!p[5])
|
||||
if (p[5] == '\0')
|
||||
return 0;
|
||||
mask = strtoul(p + 5, &end, 0);
|
||||
if (*end)
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "internal/ctype.h"
|
||||
#include "crypto/ctype.h"
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/asn1t.h>
|
||||
#include "asn1_locl.h"
|
||||
#include "asn1_local.h"
|
||||
|
||||
IMPLEMENT_ASN1_MSTRING(ASN1_TIME, B_ASN1_TIME)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/objects.h>
|
||||
#include "asn1_locl.h"
|
||||
#include "asn1_local.h"
|
||||
|
||||
int ASN1_TYPE_get(const ASN1_TYPE *a)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <time.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/asn1.h>
|
||||
#include "asn1_locl.h"
|
||||
#include "asn1_local.h"
|
||||
|
||||
/* This is the primary function used to parse ASN1_UTCTIME */
|
||||
int asn1_utctime_to_tm(struct tm *tm, const ASN1_UTCTIME *d)
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/evp.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "internal/evp_int.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include "crypto/evp.h"
|
||||
|
||||
#ifndef NO_ASN1_OLD
|
||||
|
||||
@@ -116,7 +116,7 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a,
|
||||
goto err;
|
||||
}
|
||||
if (mdnid == NID_undef) {
|
||||
if (!pkey->ameth || !pkey->ameth->item_verify) {
|
||||
if (pkey->ameth == NULL || pkey->ameth->item_verify == NULL) {
|
||||
ASN1err(ASN1_F_ASN1_ITEM_VERIFY,
|
||||
ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM);
|
||||
goto err;
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/engine.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "internal/evp_int.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include "crypto/evp.h"
|
||||
|
||||
#include "standard_methods.h"
|
||||
|
||||
@@ -56,6 +56,7 @@ static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type)
|
||||
{
|
||||
EVP_PKEY_ASN1_METHOD tmp;
|
||||
const EVP_PKEY_ASN1_METHOD *t = &tmp, **ret;
|
||||
|
||||
tmp.pkey_id = type;
|
||||
if (app_methods) {
|
||||
int idx;
|
||||
@@ -64,7 +65,7 @@ static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type)
|
||||
return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);
|
||||
}
|
||||
ret = OBJ_bsearch_ameth(&t, standard_methods, OSSL_NELEM(standard_methods));
|
||||
if (!ret || !*ret)
|
||||
if (ret == NULL || *ret == NULL)
|
||||
return NULL;
|
||||
return *ret;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <limits.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/asn1.h>
|
||||
#include "asn1_locl.h"
|
||||
#include "asn1_local.h"
|
||||
|
||||
static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,
|
||||
long max);
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "internal/ctype.h"
|
||||
#include "crypto/ctype.h"
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/asn1t.h>
|
||||
#include "internal/evp_int.h"
|
||||
#include "crypto/evp.h"
|
||||
#include "internal/bio.h"
|
||||
#include "asn1_locl.h"
|
||||
#include "asn1_local.h"
|
||||
|
||||
/*
|
||||
* Generalised MIME like utilities for streaming ASN1. Although many have a
|
||||
@@ -399,7 +399,7 @@ ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it)
|
||||
if (strcmp(hdr->value, "multipart/signed") == 0) {
|
||||
/* Split into two parts */
|
||||
prm = mime_param_find(hdr, "boundary");
|
||||
if (!prm || !prm->param_value) {
|
||||
if (prm == NULL || prm->param_value == NULL) {
|
||||
sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
|
||||
ASN1err(ASN1_F_SMIME_READ_ASN1, ASN1_R_NO_MULTIPART_BOUNDARY);
|
||||
return NULL;
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "internal/ctype.h"
|
||||
#include "crypto/ctype.h"
|
||||
#include <openssl/crypto.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "internal/objects.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include "crypto/objects.h"
|
||||
|
||||
/* Simple ASN1 OID module: add all objects in a given section */
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
|
||||
unsigned char *p;
|
||||
int derlen;
|
||||
|
||||
if (!parg)
|
||||
if (parg == NULL)
|
||||
return 0;
|
||||
|
||||
ndef_aux = *(NDEF_SUPPORT **)parg;
|
||||
@@ -123,7 +123,7 @@ static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
|
||||
*pbuf = p;
|
||||
derlen = ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it);
|
||||
|
||||
if (!*ndef_aux->boundary)
|
||||
if (*ndef_aux->boundary == NULL)
|
||||
return 0;
|
||||
|
||||
*plen = *ndef_aux->boundary - *pbuf;
|
||||
@@ -136,7 +136,7 @@ static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen,
|
||||
{
|
||||
NDEF_SUPPORT *ndef_aux;
|
||||
|
||||
if (!parg)
|
||||
if (parg == NULL)
|
||||
return 0;
|
||||
|
||||
ndef_aux = *(NDEF_SUPPORT **)parg;
|
||||
@@ -168,7 +168,7 @@ static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
|
||||
const ASN1_AUX *aux;
|
||||
ASN1_STREAM_ARG sarg;
|
||||
|
||||
if (!parg)
|
||||
if (parg == NULL)
|
||||
return 0;
|
||||
|
||||
ndef_aux = *(NDEF_SUPPORT **)parg;
|
||||
@@ -195,7 +195,7 @@ static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
|
||||
*pbuf = p;
|
||||
derlen = ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it);
|
||||
|
||||
if (!*ndef_aux->boundary)
|
||||
if (*ndef_aux->boundary == NULL)
|
||||
return 0;
|
||||
*pbuf = *ndef_aux->boundary;
|
||||
*plen = derlen - (*ndef_aux->boundary - ndef_aux->derbuf);
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/asn1.h>
|
||||
#include "internal/evp_int.h"
|
||||
#include "internal/asn1_int.h"
|
||||
#include "crypto/evp.h"
|
||||
#include "crypto/asn1.h"
|
||||
|
||||
EVP_PKEY *d2i_KeyParams(int type, EVP_PKEY **a, const unsigned char **pp,
|
||||
long length)
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/asn1.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "internal/evp_int.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include "crypto/evp.h"
|
||||
|
||||
EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
|
||||
long length)
|
||||
@@ -48,7 +48,7 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
|
||||
EVP_PKEY *tmp;
|
||||
PKCS8_PRIV_KEY_INFO *p8 = NULL;
|
||||
p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, length);
|
||||
if (!p8)
|
||||
if (p8 == NULL)
|
||||
goto err;
|
||||
tmp = EVP_PKCS82PKEY(p8);
|
||||
PKCS8_PRIV_KEY_INFO_free(p8);
|
||||
@@ -104,7 +104,7 @@ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
|
||||
EVP_PKEY *ret;
|
||||
|
||||
sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
|
||||
if (!p8) {
|
||||
if (p8 == NULL) {
|
||||
ASN1err(ASN1_F_D2I_AUTOPRIVATEKEY,
|
||||
ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
|
||||
return NULL;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <openssl/dsa.h>
|
||||
#include <openssl/ec.h>
|
||||
|
||||
#include "internal/evp_int.h"
|
||||
#include "crypto/evp.h"
|
||||
|
||||
EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,
|
||||
long length)
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "internal/ctype.h"
|
||||
#include "crypto/ctype.h"
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/asn1.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "internal/ctype.h"
|
||||
#include "crypto/ctype.h"
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/asn1.h>
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/asn1.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "internal/evp_int.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include "crypto/evp.h"
|
||||
|
||||
int i2d_KeyParams(const EVP_PKEY *a, unsigned char **pp)
|
||||
{
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "internal/evp_int.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include "crypto/evp.h"
|
||||
|
||||
int i2d_PrivateKey(const EVP_PKEY *a, unsigned char **pp)
|
||||
{
|
||||
|
||||
@@ -107,7 +107,7 @@ X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
|
||||
|
||||
pbe2->keyfunc = PKCS5_pbkdf2_set(iter, salt, saltlen, prf_nid, keylen);
|
||||
|
||||
if (!pbe2->keyfunc)
|
||||
if (pbe2->keyfunc == NULL)
|
||||
goto merr;
|
||||
|
||||
/* Now set up top level AlgorithmIdentifier */
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
|
||||
/* Minor tweak to operation: zero private key data */
|
||||
static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/buffer.h>
|
||||
#include "internal/bn_int.h"
|
||||
#include "crypto/bn.h"
|
||||
|
||||
/* Number of octets per line */
|
||||
#define ASN1_BUF_PRINT_WIDTH 15
|
||||
|
||||
@@ -30,7 +30,7 @@ int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki)
|
||||
BIO_printf(out, " Public Key Algorithm: %s\n",
|
||||
(i == NID_undef) ? "UNKNOWN" : OBJ_nid2ln(i));
|
||||
pkey = X509_PUBKEY_get(spki->spkac->pubkey);
|
||||
if (!pkey)
|
||||
if (pkey == NULL)
|
||||
BIO_printf(out, " Unable to load public key\n");
|
||||
else {
|
||||
EVP_PKEY_print_public(out, pkey, 4, NULL);
|
||||
|
||||
+14
-10
@@ -15,7 +15,7 @@
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/err.h>
|
||||
#include "internal/numbers.h"
|
||||
#include "asn1_locl.h"
|
||||
#include "asn1_local.h"
|
||||
|
||||
|
||||
/*
|
||||
@@ -108,7 +108,8 @@ ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval,
|
||||
{
|
||||
ASN1_TLC c;
|
||||
ASN1_VALUE *ptmpval = NULL;
|
||||
if (!pval)
|
||||
|
||||
if (pval == NULL)
|
||||
pval = &ptmpval;
|
||||
asn1_tlc_clear_nc(&c);
|
||||
if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0)
|
||||
@@ -149,7 +150,8 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in,
|
||||
int otag;
|
||||
int ret = 0;
|
||||
ASN1_VALUE **pchptr;
|
||||
if (!pval)
|
||||
|
||||
if (pval == NULL)
|
||||
return 0;
|
||||
if (aux && aux->asn1_cb)
|
||||
asn1_cb = aux->asn1_cb;
|
||||
@@ -303,7 +305,7 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in,
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!*pval && !ASN1_item_ex_new(pval, it)) {
|
||||
if (*pval == NULL && !ASN1_item_ex_new(pval, it)) {
|
||||
ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ERR_R_NESTED_ASN1_ERROR);
|
||||
goto err;
|
||||
}
|
||||
@@ -554,7 +556,7 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val,
|
||||
return 0;
|
||||
} else if (ret == -1)
|
||||
return -1;
|
||||
if (!*val)
|
||||
if (*val == NULL)
|
||||
*val = (ASN1_VALUE *)sk_ASN1_VALUE_new_null();
|
||||
else {
|
||||
/*
|
||||
@@ -568,7 +570,7 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val,
|
||||
}
|
||||
}
|
||||
|
||||
if (!*val) {
|
||||
if (*val == NULL) {
|
||||
ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
@@ -649,7 +651,8 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval,
|
||||
BUF_MEM buf = { 0, NULL, 0, 0 };
|
||||
const unsigned char *cont = NULL;
|
||||
long len;
|
||||
if (!pval) {
|
||||
|
||||
if (pval == NULL) {
|
||||
ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_NULL);
|
||||
return 0; /* Should never happen */
|
||||
}
|
||||
@@ -786,7 +789,7 @@ static int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
|
||||
return pf->prim_c2i(pval, cont, len, utype, free_cont, it);
|
||||
/* If ANY type clear type and set pointer to internal value */
|
||||
if (it->utype == V_ASN1_ANY) {
|
||||
if (!*pval) {
|
||||
if (*pval == NULL) {
|
||||
typ = ASN1_TYPE_new();
|
||||
if (typ == NULL)
|
||||
goto err;
|
||||
@@ -866,7 +869,7 @@ static int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
|
||||
goto err;
|
||||
}
|
||||
/* All based on ASN1_STRING and handled the same */
|
||||
if (!*pval) {
|
||||
if (*pval == NULL) {
|
||||
stmp = ASN1_STRING_type_new(utype);
|
||||
if (stmp == NULL) {
|
||||
ASN1err(ASN1_F_ASN1_EX_C2I, ERR_R_MALLOC_FAILURE);
|
||||
@@ -1058,10 +1061,11 @@ static int collect_data(BUF_MEM *buf, const unsigned char **p, long plen)
|
||||
static int asn1_check_eoc(const unsigned char **in, long len)
|
||||
{
|
||||
const unsigned char *p;
|
||||
|
||||
if (len < 2)
|
||||
return 0;
|
||||
p = *in;
|
||||
if (!p[0] && !p[1]) {
|
||||
if (p[0] == '\0' && p[1] == '\0') {
|
||||
*in += 2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/objects.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "asn1_locl.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include "asn1_local.h"
|
||||
|
||||
static int asn1_i2d_ex_primitive(const ASN1_VALUE **pval, unsigned char **out,
|
||||
const ASN1_ITEM *it, int tag, int aclass);
|
||||
@@ -55,7 +55,7 @@ int ASN1_item_i2d(const ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *i
|
||||
static int asn1_item_flags_i2d(const ASN1_VALUE *val, unsigned char **out,
|
||||
const ASN1_ITEM *it, int flags)
|
||||
{
|
||||
if (out && !*out) {
|
||||
if (out != NULL && *out == NULL) {
|
||||
unsigned char *p, *buf;
|
||||
int len;
|
||||
|
||||
@@ -89,7 +89,7 @@ int ASN1_item_ex_i2d(const ASN1_VALUE **pval, unsigned char **out,
|
||||
const ASN1_AUX *aux = it->funcs;
|
||||
ASN1_aux_const_cb *asn1_cb = NULL;
|
||||
|
||||
if ((it->itype != ASN1_ITYPE_PRIMITIVE) && !*pval)
|
||||
if ((it->itype != ASN1_ITYPE_PRIMITIVE) && *pval == NULL)
|
||||
return 0;
|
||||
|
||||
if (aux != NULL) {
|
||||
@@ -258,7 +258,7 @@ static int asn1_template_ex_i2d(const ASN1_VALUE **pval, unsigned char **out,
|
||||
int skcontlen, sklen;
|
||||
const ASN1_VALUE *skitem;
|
||||
|
||||
if (!*pval)
|
||||
if (*pval == NULL)
|
||||
return 0;
|
||||
|
||||
if (flags & ASN1_TFLG_SET_OF) {
|
||||
@@ -510,7 +510,7 @@ static int asn1_ex_i2c(const ASN1_VALUE **pval, unsigned char *cout, int *putype
|
||||
/* Should type be omitted? */
|
||||
if ((it->itype != ASN1_ITYPE_PRIMITIVE)
|
||||
|| (it->utype != V_ASN1_BOOLEAN)) {
|
||||
if (!*pval)
|
||||
if (*pval == NULL)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/objects.h>
|
||||
#include "asn1_locl.h"
|
||||
#include "asn1_local.h"
|
||||
|
||||
/* Free up an ASN1 structure */
|
||||
|
||||
@@ -33,9 +33,9 @@ void asn1_item_embed_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed)
|
||||
ASN1_aux_cb *asn1_cb;
|
||||
int i;
|
||||
|
||||
if (!pval)
|
||||
if (pval == NULL)
|
||||
return;
|
||||
if ((it->itype != ASN1_ITYPE_PRIMITIVE) && !*pval)
|
||||
if ((it->itype != ASN1_ITYPE_PRIMITIVE) && *pval == NULL)
|
||||
return;
|
||||
if (aux && aux->asn1_cb)
|
||||
asn1_cb = aux->asn1_cb;
|
||||
@@ -168,15 +168,15 @@ void asn1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed)
|
||||
|
||||
utype = typ->type;
|
||||
pval = &typ->value.asn1_value;
|
||||
if (!*pval)
|
||||
if (*pval == NULL)
|
||||
return;
|
||||
} else if (it->itype == ASN1_ITYPE_MSTRING) {
|
||||
utype = -1;
|
||||
if (!*pval)
|
||||
if (*pval == NULL)
|
||||
return;
|
||||
} else {
|
||||
utype = it->utype;
|
||||
if ((utype != V_ASN1_BOOLEAN) && !*pval)
|
||||
if ((utype != V_ASN1_BOOLEAN) && *pval == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/asn1t.h>
|
||||
#include <string.h>
|
||||
#include "asn1_locl.h"
|
||||
#include "asn1_local.h"
|
||||
|
||||
static int asn1_item_embed_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||
int embed);
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "asn1_locl.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include "asn1_local.h"
|
||||
|
||||
/*
|
||||
* Print routines.
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include "asn1_locl.h"
|
||||
#include "asn1_local.h"
|
||||
|
||||
/*
|
||||
* General ASN1 structure recursive scanner: iterate through all fields
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/err.h>
|
||||
#include "asn1_locl.h"
|
||||
#include "asn1_local.h"
|
||||
|
||||
/* Utility functions for manipulating fields and offsets */
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/asn1t.h>
|
||||
#include "internal/evp_int.h"
|
||||
#include "crypto/evp.h"
|
||||
|
||||
ASN1_SEQUENCE(X509_ALGOR) = {
|
||||
ASN1_SIMPLE(X509_ALGOR, algorithm, ASN1_OBJECT),
|
||||
|
||||
@@ -82,7 +82,7 @@ static int bn_secure_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
|
||||
static void bn_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
{
|
||||
if (!*pval)
|
||||
if (*pval == NULL)
|
||||
return;
|
||||
if (it->size & BN_SENSITIVE)
|
||||
BN_clear_free((BIGNUM *)*pval);
|
||||
@@ -96,7 +96,7 @@ static int bn_i2c(const ASN1_VALUE **pval, unsigned char *cont, int *putype,
|
||||
{
|
||||
BIGNUM *bn;
|
||||
int pad;
|
||||
if (!*pval)
|
||||
if (*pval == NULL)
|
||||
return -1;
|
||||
bn = (BIGNUM *)*pval;
|
||||
/* If MSB set in an octet we need a padding byte */
|
||||
@@ -133,7 +133,7 @@ static int bn_secure_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
|
||||
int ret;
|
||||
BIGNUM *bn;
|
||||
|
||||
if (!*pval && !bn_secure_new(pval, it))
|
||||
if (*pval == NULL && !bn_secure_new(pval, it))
|
||||
return 0;
|
||||
|
||||
ret = bn_c2i(pval, cont, len, utype, free_cont, it);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "internal/numbers.h"
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/bn.h>
|
||||
#include "asn1_locl.h"
|
||||
#include "asn1_local.h"
|
||||
|
||||
/*
|
||||
* Custom primitive types for handling int32_t, int64_t, uint32_t, uint64_t.
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
|
||||
ASN1_SEQUENCE(X509_SIG) = {
|
||||
ASN1_SIMPLE(X509_SIG, algor, X509_ALGOR),
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/bn.h>
|
||||
#include "internal/asn1_dsa.h"
|
||||
#include "crypto/asn1_dsa.h"
|
||||
#include "internal/packet.h"
|
||||
|
||||
#define ID_SEQUENCE 0x30
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
/* This must be the first #include file */
|
||||
#include "../async_locl.h"
|
||||
#include "../async_local.h"
|
||||
|
||||
#ifdef ASYNC_NULL
|
||||
int ASYNC_is_capable(void)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
/* This must be the first #include file */
|
||||
#include "../async_locl.h"
|
||||
#include "../async_local.h"
|
||||
|
||||
#ifdef ASYNC_POSIX
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_ASYNC_ARCH_ASYNC_POSIX_H
|
||||
#define OPENSSL_ASYNC_ARCH_ASYNC_POSIX_H
|
||||
#ifndef OSSL_CRYPTO_ASYNC_POSIX_H
|
||||
#define OSSL_CRYPTO_ASYNC_POSIX_H
|
||||
#include <openssl/e_os2.h>
|
||||
|
||||
#if defined(OPENSSL_SYS_UNIX) \
|
||||
@@ -55,4 +55,4 @@ void async_fibre_free(async_fibre *fibre);
|
||||
|
||||
# endif
|
||||
#endif
|
||||
#endif /* OPENSSL_ASYNC_ARCH_ASYNC_POSIX_H */
|
||||
#endif /* OSSL_CRYPTO_ASYNC_POSIX_H */
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
/* This must be the first #include file */
|
||||
#include "../async_locl.h"
|
||||
#include "../async_local.h"
|
||||
|
||||
#ifdef ASYNC_WIN
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
#undef _FORTIFY_SOURCE
|
||||
|
||||
/* This must be the first #include file */
|
||||
#include "async_locl.h"
|
||||
#include "async_local.h"
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include "internal/cryptlib_int.h"
|
||||
#include "crypto/cryptlib.h"
|
||||
#include <string.h>
|
||||
|
||||
#define ASYNC_JOB_RUNNING 0
|
||||
@@ -287,7 +287,7 @@ static void async_empty_pool(async_pool *pool)
|
||||
{
|
||||
ASYNC_JOB *job;
|
||||
|
||||
if (!pool || !pool->jobs)
|
||||
if (pool == NULL || pool->jobs == NULL)
|
||||
return;
|
||||
|
||||
do {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "internal/async.h"
|
||||
#include "crypto/async.h"
|
||||
#include <openssl/crypto.h>
|
||||
|
||||
typedef struct async_ctx_st async_ctx;
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
/* This must be the first #include file */
|
||||
#include "async_locl.h"
|
||||
#include "async_local.h"
|
||||
|
||||
#include <openssl/err.h>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <openssl/blowfish.h>
|
||||
#include "bf_locl.h"
|
||||
#include "bf_local.h"
|
||||
|
||||
/*
|
||||
* The input and output encrypted as though 64bit cfb mode is being used.
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <openssl/blowfish.h>
|
||||
#include "bf_locl.h"
|
||||
#include "bf_local.h"
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <openssl/blowfish.h>
|
||||
#include "bf_locl.h"
|
||||
#include "bf_local.h"
|
||||
|
||||
/*
|
||||
* Blowfish as implemented from 'Blowfish: Springer-Verlag paper' (From
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BF_LOCL_H
|
||||
# define HEADER_BF_LOCL_H
|
||||
#ifndef OSSL_CRYPTO_BF_LOCAL_H
|
||||
# define OSSL_CRYPTO_BF_LOCAL_H
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
/* NOTE - c is not incremented as per n2l */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user