Compare commits
2 Commits
openssl-1.
...
openssl-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b123b12c0d | ||
|
|
b439f09b29 |
7
AUTHORS
7
AUTHORS
@@ -13,6 +13,8 @@ Ben Kaduk
|
||||
Bernd Edlinger
|
||||
Bodo Möller
|
||||
David Benjamin
|
||||
David von Oheimb
|
||||
Dmitry Belyavskiy (Дмитрий Белявский)
|
||||
Emilia Käsper
|
||||
Eric Young
|
||||
Geoff Thorpe
|
||||
@@ -22,14 +24,19 @@ Lutz Jänicke
|
||||
Mark J. Cox
|
||||
Matt Caswell
|
||||
Matthias St. Pierre
|
||||
Nicola Tuveri
|
||||
Nils Larsch
|
||||
Patrick Steuer
|
||||
Paul Dale
|
||||
Paul C. Sutton
|
||||
Paul Yang
|
||||
Ralf S. Engelschall
|
||||
Rich Salz
|
||||
Richard Levitte
|
||||
Shane Lontis
|
||||
Stephen Henson
|
||||
Steve Marquess
|
||||
Tim Hudson
|
||||
Tomáš Mráz
|
||||
Ulf Möller
|
||||
Viktor Dukhovni
|
||||
|
||||
146
CHANGES
146
CHANGES
@@ -7,6 +7,152 @@
|
||||
https://github.com/openssl/openssl/commits/ and pick the appropriate
|
||||
release branch.
|
||||
|
||||
Changes between 1.1.1k and 1.1.1l [24 Aug 2021]
|
||||
|
||||
*) Fixed an SM2 Decryption Buffer Overflow.
|
||||
|
||||
In order to decrypt SM2 encrypted data an application is expected to call the
|
||||
API function EVP_PKEY_decrypt(). Typically an application will call this
|
||||
function twice. The first time, on entry, the "out" parameter can be NULL and,
|
||||
on exit, the "outlen" parameter is populated with the buffer size required to
|
||||
hold the decrypted plaintext. The application can then allocate a sufficiently
|
||||
sized buffer and call EVP_PKEY_decrypt() again, but this time passing a non-NULL
|
||||
value for the "out" parameter.
|
||||
|
||||
A bug in the implementation of the SM2 decryption code means that the
|
||||
calculation of the buffer size required to hold the plaintext returned by the
|
||||
first call to EVP_PKEY_decrypt() can be smaller than the actual size required by
|
||||
the second call. This can lead to a buffer overflow when EVP_PKEY_decrypt() is
|
||||
called by the application a second time with a buffer that is too small.
|
||||
|
||||
A malicious attacker who is able present SM2 content for decryption to an
|
||||
application could cause attacker chosen data to overflow the buffer by up to a
|
||||
maximum of 62 bytes altering the contents of other data held after the
|
||||
buffer, possibly changing application behaviour or causing the application to
|
||||
crash. The location of the buffer is application dependent but is typically
|
||||
heap allocated.
|
||||
(CVE-2021-3711)
|
||||
[Matt Caswell]
|
||||
|
||||
*) Fixed various read buffer overruns processing ASN.1 strings
|
||||
|
||||
ASN.1 strings are represented internally within OpenSSL as an ASN1_STRING
|
||||
structure which contains a buffer holding the string data and a field holding
|
||||
the buffer length. This contrasts with normal C strings which are repesented as
|
||||
a buffer for the string data which is terminated with a NUL (0) byte.
|
||||
|
||||
Although not a strict requirement, ASN.1 strings that are parsed using OpenSSL's
|
||||
own "d2i" functions (and other similar parsing functions) as well as any string
|
||||
whose value has been set with the ASN1_STRING_set() function will additionally
|
||||
NUL terminate the byte array in the ASN1_STRING structure.
|
||||
|
||||
However, it is possible for applications to directly construct valid ASN1_STRING
|
||||
structures which do not NUL terminate the byte array by directly setting the
|
||||
"data" and "length" fields in the ASN1_STRING array. This can also happen by
|
||||
using the ASN1_STRING_set0() function.
|
||||
|
||||
Numerous OpenSSL functions that print ASN.1 data have been found to assume that
|
||||
the ASN1_STRING byte array will be NUL terminated, even though this is not
|
||||
guaranteed for strings that have been directly constructed. Where an application
|
||||
requests an ASN.1 structure to be printed, and where that ASN.1 structure
|
||||
contains ASN1_STRINGs that have been directly constructed by the application
|
||||
without NUL terminating the "data" field, then a read buffer overrun can occur.
|
||||
|
||||
The same thing can also occur during name constraints processing of certificates
|
||||
(for example if a certificate has been directly constructed by the application
|
||||
instead of loading it via the OpenSSL parsing functions, and the certificate
|
||||
contains non NUL terminated ASN1_STRING structures). It can also occur in the
|
||||
X509_get1_email(), X509_REQ_get1_email() and X509_get1_ocsp() functions.
|
||||
|
||||
If a malicious actor can cause an application to directly construct an
|
||||
ASN1_STRING and then process it through one of the affected OpenSSL functions
|
||||
then this issue could be hit. This might result in a crash (causing a Denial of
|
||||
Service attack). It could also result in the disclosure of private memory
|
||||
contents (such as private keys, or sensitive plaintext).
|
||||
(CVE-2021-3712)
|
||||
[Matt Caswell]
|
||||
|
||||
Changes between 1.1.1j and 1.1.1k [25 Mar 2021]
|
||||
|
||||
*) Fixed a problem with verifying a certificate chain when using the
|
||||
X509_V_FLAG_X509_STRICT flag. This flag enables additional security checks
|
||||
of the certificates present in a certificate chain. It is not set by
|
||||
default.
|
||||
|
||||
Starting from OpenSSL version 1.1.1h a check to disallow certificates in
|
||||
the chain that have explicitly encoded elliptic curve parameters was added
|
||||
as an additional strict check.
|
||||
|
||||
An error in the implementation of this check meant that the result of a
|
||||
previous check to confirm that certificates in the chain are valid CA
|
||||
certificates was overwritten. This effectively bypasses the check
|
||||
that non-CA certificates must not be able to issue other certificates.
|
||||
|
||||
If a "purpose" has been configured then there is a subsequent opportunity
|
||||
for checks that the certificate is a valid CA. All of the named "purpose"
|
||||
values implemented in libcrypto perform this check. Therefore, where
|
||||
a purpose is set the certificate chain will still be rejected even when the
|
||||
strict flag has been used. A purpose is set by default in libssl client and
|
||||
server certificate verification routines, but it can be overridden or
|
||||
removed by an application.
|
||||
|
||||
In order to be affected, an application must explicitly set the
|
||||
X509_V_FLAG_X509_STRICT verification flag and either not set a purpose
|
||||
for the certificate verification or, in the case of TLS client or server
|
||||
applications, override the default purpose.
|
||||
(CVE-2021-3450)
|
||||
[Tomáš Mráz]
|
||||
|
||||
*) Fixed an issue where an OpenSSL TLS server may crash if sent a maliciously
|
||||
crafted renegotiation ClientHello message from a client. If a TLSv1.2
|
||||
renegotiation ClientHello omits the signature_algorithms extension (where
|
||||
it was present in the initial ClientHello), but includes a
|
||||
signature_algorithms_cert extension then a NULL pointer dereference will
|
||||
result, leading to a crash and a denial of service attack.
|
||||
|
||||
A server is only vulnerable if it has TLSv1.2 and renegotiation enabled
|
||||
(which is the default configuration). OpenSSL TLS clients are not impacted
|
||||
by this issue.
|
||||
(CVE-2021-3449)
|
||||
[Peter Kästle and Samuel Sapalski]
|
||||
|
||||
Changes between 1.1.1i and 1.1.1j [16 Feb 2021]
|
||||
|
||||
*) Fixed the X509_issuer_and_serial_hash() function. It attempts to
|
||||
create a unique hash value based on the issuer and serial number data
|
||||
contained within an X509 certificate. However it was failing to correctly
|
||||
handle any errors that may occur while parsing the issuer field (which might
|
||||
occur if the issuer field is maliciously constructed). This may subsequently
|
||||
result in a NULL pointer deref and a crash leading to a potential denial of
|
||||
service attack.
|
||||
(CVE-2021-23841)
|
||||
[Matt Caswell]
|
||||
|
||||
*) Fixed the RSA_padding_check_SSLv23() function and the RSA_SSLV23_PADDING
|
||||
padding mode to correctly check for rollback attacks. This is considered a
|
||||
bug in OpenSSL 1.1.1 because it does not support SSLv2. In 1.0.2 this is
|
||||
CVE-2021-23839.
|
||||
[Matt Caswell]
|
||||
|
||||
*) Fixed the EVP_CipherUpdate, EVP_EncryptUpdate and EVP_DecryptUpdate
|
||||
functions. Previously they could overflow the output length argument in some
|
||||
cases where the input length is close to the maximum permissable length for
|
||||
an integer on the platform. In such cases the return value from the function
|
||||
call would be 1 (indicating success), but the output length value would be
|
||||
negative. This could cause applications to behave incorrectly or crash.
|
||||
(CVE-2021-23840)
|
||||
[Matt Caswell]
|
||||
|
||||
*) Fixed SRP_Calc_client_key so that it runs in constant time. The previous
|
||||
implementation called BN_mod_exp without setting BN_FLG_CONSTTIME. This
|
||||
could be exploited in a side channel attack to recover the password. Since
|
||||
the attack is local host only this is outside of the current OpenSSL
|
||||
threat model and therefore no CVE is assigned.
|
||||
|
||||
Thanks to Mohammed Sabt and Daniel De Almeida Braga for reporting this
|
||||
issue.
|
||||
[Matt Caswell]
|
||||
|
||||
Changes between 1.1.1h and 1.1.1i [8 Dec 2020]
|
||||
|
||||
*) Fixed NULL pointer deref in the GENERAL_NAME_cmp function
|
||||
|
||||
@@ -41,8 +41,8 @@ guidelines:
|
||||
https://www.openssl.org/policies/codingstyle.html) and compile
|
||||
without warnings. Where gcc or clang is available you should use the
|
||||
--strict-warnings Configure option. OpenSSL compiles on many varied
|
||||
platforms: try to ensure you only use portable features. Clean builds
|
||||
via Travis and AppVeyor are required, and they are started automatically
|
||||
platforms: try to ensure you only use portable features. Clean builds via
|
||||
GitHub Actions and AppVeyor are required, and they are started automatically
|
||||
whenever a PR is created or updated.
|
||||
|
||||
5. When at all possible, patches should include tests. These can
|
||||
|
||||
@@ -663,6 +663,7 @@ my %targets = (
|
||||
"linux-ppc" => {
|
||||
inherit_from => [ "linux-generic32", asm("ppc32_asm") ],
|
||||
perlasm_scheme => "linux32",
|
||||
lib_cppflags => add("-DB_ENDIAN"),
|
||||
},
|
||||
"linux-ppc64" => {
|
||||
inherit_from => [ "linux-generic64", asm("ppc64_asm") ],
|
||||
@@ -753,6 +754,13 @@ my %targets = (
|
||||
multilib => "64",
|
||||
},
|
||||
|
||||
# riscv64 below refers to contemporary RISCV Architecture
|
||||
# specifications,
|
||||
"linux64-riscv64" => {
|
||||
inherit_from => [ "linux-generic64"],
|
||||
perlasm_scheme => "linux64",
|
||||
},
|
||||
|
||||
#### IA-32 targets...
|
||||
#### These two targets are a bit aged and are to be used on older Linux
|
||||
#### machines where gcc doesn't understand -m32 and -m64
|
||||
|
||||
@@ -29,18 +29,18 @@
|
||||
$ndk = $ENV{$ndk_var};
|
||||
last if defined $ndk;
|
||||
}
|
||||
die "\$ANDROID_NDK_HOME is not defined" if (!$ndk);
|
||||
if (!-d "$ndk/platforms" && !-f "$ndk/AndroidVersion.txt") {
|
||||
# $ndk/platforms is traditional "all-inclusive" NDK, while
|
||||
# $ndk/AndroidVersion.txt is so-called standalone toolchain
|
||||
# tailored for specific target down to API level.
|
||||
die "\$ANDROID_NDK_HOME is not defined" if (!$ndk);
|
||||
my $is_standalone_toolchain = -f "$ndk/AndroidVersion.txt";
|
||||
my $ndk_src_props = "$ndk/source.properties";
|
||||
my $is_ndk = -f $ndk_src_props;
|
||||
if ($is_ndk == $is_standalone_toolchain) {
|
||||
die "\$ANDROID_NDK_HOME=$ndk is invalid";
|
||||
}
|
||||
$ndk = canonpath($ndk);
|
||||
|
||||
my $ndkver = undef;
|
||||
|
||||
if (open my $fh, "<$ndk/source.properties") {
|
||||
if (open my $fh, "<$ndk_src_props") {
|
||||
local $_;
|
||||
while(<$fh>) {
|
||||
if (m|Pkg\.Revision\s*=\s*([0-9]+)|) {
|
||||
@@ -59,7 +59,7 @@
|
||||
if ($sysroot = $ENV{CROSS_SYSROOT}) {
|
||||
$sysroot =~ m|/android-([0-9]+)/arch-(\w+)/?$|;
|
||||
($api, $arch) = ($1, $2);
|
||||
} elsif (-f "$ndk/AndroidVersion.txt") {
|
||||
} elsif ($is_standalone_toolchain) {
|
||||
$sysroot = "$ndk/sysroot";
|
||||
} else {
|
||||
$api = "*";
|
||||
@@ -72,17 +72,31 @@
|
||||
}
|
||||
}
|
||||
|
||||
# list available platforms (numerically)
|
||||
my @platforms = sort { $a =~ m/-([0-9]+)$/; my $aa = $1;
|
||||
$b =~ m/-([0-9]+)$/; $aa <=> $1;
|
||||
} glob("$ndk/platforms/android-$api");
|
||||
die "no $ndk/platforms/android-$api" if ($#platforms < 0);
|
||||
if (-d "$ndk/platforms") {
|
||||
# list available platforms (numerically)
|
||||
my @platforms = sort { $a =~ m/-([0-9]+)$/; my $aa = $1;
|
||||
$b =~ m/-([0-9]+)$/; $aa <=> $1;
|
||||
} glob("$ndk/platforms/android-$api");
|
||||
die "no $ndk/platforms/android-$api" if ($#platforms < 0);
|
||||
|
||||
$sysroot = "@platforms[$#platforms]/arch-$arch";
|
||||
$sysroot =~ m|/android-([0-9]+)/arch-$arch|;
|
||||
$api = $1;
|
||||
$sysroot = "@platforms[$#platforms]/arch-$arch";
|
||||
$sysroot =~ m|/android-([0-9]+)/arch-$arch|;
|
||||
$api = $1;
|
||||
} elsif ($api eq "*") {
|
||||
# r22 Removed platforms dir, use this JSON file
|
||||
my $path = "$ndk/meta/platforms.json";
|
||||
open my $fh, $path or die "Could not open '$path' $!";
|
||||
while (<$fh>) {
|
||||
if (/"max": (\d+),/) {
|
||||
$api = $1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
close $fh;
|
||||
}
|
||||
die "Could not get default API Level" if ($api eq "*");
|
||||
}
|
||||
die "no sysroot=$sysroot" if (!-d $sysroot);
|
||||
die "no sysroot=$sysroot" if (length $sysroot && !-d $sysroot);
|
||||
|
||||
my $triarch = $triplet{$arch};
|
||||
my $cflags;
|
||||
@@ -95,17 +109,21 @@
|
||||
my $arm = $ndkver > 16 ? "armv7a" : "armv5te";
|
||||
(my $tridefault = $triarch) =~ s/^arm-/$arm-/;
|
||||
(my $tritools = $triarch) =~ s/(?:x|i6)86(_64)?-.*/x86$1/;
|
||||
$cflags .= " -target $tridefault "
|
||||
. "-gcc-toolchain \$($ndk_var)/toolchains"
|
||||
. "/$tritools-4.9/prebuilt/$host";
|
||||
$user{CC} = "clang" if ($user{CC} !~ m|clang|);
|
||||
if (length $sysroot) {
|
||||
$cflags .= " -target $tridefault "
|
||||
. "-gcc-toolchain \$($ndk_var)/toolchains"
|
||||
. "/$tritools-4.9/prebuilt/$host";
|
||||
$user{CC} = "clang" if ($user{CC} !~ m|clang|);
|
||||
} else {
|
||||
$user{CC} = "$tridefault$api-clang";
|
||||
}
|
||||
$user{CROSS_COMPILE} = undef;
|
||||
if (which("llvm-ar") =~ m|^$ndk/.*/prebuilt/([^/]+)/|) {
|
||||
$user{AR} = "llvm-ar";
|
||||
$user{ARFLAGS} = [ "rs" ];
|
||||
$user{RANLIB} = ":";
|
||||
}
|
||||
} elsif (-f "$ndk/AndroidVersion.txt") { #"standalone toolchain"
|
||||
} elsif ($is_standalone_toolchain) {
|
||||
my $cc = $user{CC} // "clang";
|
||||
# One can probably argue that both clang and gcc should be
|
||||
# probed, but support for "standalone toolchain" was added
|
||||
@@ -127,19 +145,21 @@
|
||||
$user{CROSS_COMPILE} = "$triarch-";
|
||||
}
|
||||
|
||||
if (!-d "$sysroot/usr/include") {
|
||||
my $incroot = "$ndk/sysroot/usr/include";
|
||||
die "no $incroot" if (!-d $incroot);
|
||||
die "no $incroot/$triarch" if (!-d "$incroot/$triarch");
|
||||
$incroot =~ s|^$ndk/||;
|
||||
$cppflags = "-D__ANDROID_API__=$api";
|
||||
$cppflags .= " -isystem \$($ndk_var)/$incroot/$triarch";
|
||||
$cppflags .= " -isystem \$($ndk_var)/$incroot";
|
||||
if (length $sysroot) {
|
||||
if (!-d "$sysroot/usr/include") {
|
||||
my $incroot = "$ndk/sysroot/usr/include";
|
||||
die "no $incroot" if (!-d $incroot);
|
||||
die "no $incroot/$triarch" if (!-d "$incroot/$triarch");
|
||||
$incroot =~ s|^$ndk/||;
|
||||
$cppflags = "-D__ANDROID_API__=$api";
|
||||
$cppflags .= " -isystem \$($ndk_var)/$incroot/$triarch";
|
||||
$cppflags .= " -isystem \$($ndk_var)/$incroot";
|
||||
}
|
||||
$sysroot =~ s|^$ndk/||;
|
||||
$sysroot = " --sysroot=\$($ndk_var)/$sysroot";
|
||||
}
|
||||
|
||||
$sysroot =~ s|^$ndk/||;
|
||||
$android_ndk = {
|
||||
cflags => "$cflags --sysroot=\$($ndk_var)/$sysroot",
|
||||
cflags => $cflags . $sysroot,
|
||||
cppflags => $cppflags,
|
||||
bn_ops => $arch =~ m/64$/ ? "SIXTY_FOUR_BIT_LONG"
|
||||
: "BN_LLONG",
|
||||
|
||||
@@ -377,8 +377,13 @@ NODEBUG=@
|
||||
$(NODEBUG) !
|
||||
$(NODEBUG) ! Installation logical names
|
||||
$(NODEBUG) !
|
||||
$(NODEBUG) installtop = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
|
||||
$(NODEBUG) datatop = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
|
||||
$(NODEBUG) ! This also creates a few DCL variables that are used for
|
||||
$(NODEBUG) ! the "install_msg" target.
|
||||
$(NODEBUG) !
|
||||
$(NODEBUG) installroot = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;"
|
||||
$(NODEBUG) installtop = installroot + ".]"
|
||||
$(NODEBUG) dataroot = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;"
|
||||
$(NODEBUG) datatop = dataroot + ".]"
|
||||
$(NODEBUG) DEFINE ossl_installroot 'installtop'
|
||||
$(NODEBUG) DEFINE ossl_dataroot 'datatop'
|
||||
$(NODEBUG) !
|
||||
@@ -455,30 +460,19 @@ list-tests :
|
||||
@ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
|
||||
@ ! {- output_on() if !$disabled{tests}; "" -}
|
||||
|
||||
install : install_sw install_ssldirs install_docs
|
||||
install : install_sw install_ssldirs install_docs install_msg
|
||||
@ !
|
||||
|
||||
install_msg :
|
||||
@ WRITE SYS$OUTPUT ""
|
||||
@ WRITE SYS$OUTPUT "######################################################################"
|
||||
@ WRITE SYS$OUTPUT ""
|
||||
@ IF "$(DESTDIR)" .EQS. "" THEN -
|
||||
PIPE ( WRITE SYS$OUTPUT "Installation complete" ; -
|
||||
WRITE SYS$OUTPUT "" ; -
|
||||
WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
|
||||
WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
|
||||
WRITE SYS$OUTPUT "" )
|
||||
@{- sourcefile("VMS", "msg_install.com") -} "$(SYSTARTUP)" "{- $osslver -}"
|
||||
@ IF "$(DESTDIR)" .NES. "" THEN -
|
||||
PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; -
|
||||
WRITE SYS$OUTPUT "" ; -
|
||||
WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; -
|
||||
WRITE SYS$OUTPUT staging_instdir ; -
|
||||
WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; -
|
||||
WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; -
|
||||
WRITE SYS$OUTPUT staging_datadir ; -
|
||||
WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; -
|
||||
WRITE SYS$OUTPUT "" ; -
|
||||
WRITE SYS$OUTPUT "When in its final destination," ; -
|
||||
WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
|
||||
WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
|
||||
WRITE SYS$OUTPUT "" )
|
||||
@{- sourcefile("VMS", "msg_staging.com") -} -
|
||||
"''installroot']" "''dataroot']" "$(INSTALLTOP)" "$(OPENSSLDIR)" -
|
||||
"$(SYSTARTUP)" "{- $osslver -}"
|
||||
|
||||
check_install :
|
||||
spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
|
||||
|
||||
@@ -523,7 +523,6 @@ clean: libclean
|
||||
$(RM) -r test/test-runs
|
||||
$(RM) openssl.pc libcrypto.pc libssl.pc
|
||||
-$(RM) `find . -type l \! -name '.*' -print`
|
||||
$(RM) $(TARFILE)
|
||||
|
||||
distclean: clean
|
||||
$(RM) configdata.pm
|
||||
@@ -917,8 +916,8 @@ errors:
|
||||
done )
|
||||
|
||||
ordinals:
|
||||
( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update )
|
||||
( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update )
|
||||
$(PERL) $(SRCDIR)/util/mkdef.pl crypto update
|
||||
$(PERL) $(SRCDIR)/util/mkdef.pl ssl update
|
||||
|
||||
test_ordinals:
|
||||
( cd test; \
|
||||
|
||||
@@ -324,15 +324,15 @@ build_apps build_tests: build_programs
|
||||
# Convenience target to prebuild all generated files, not just the mandatory
|
||||
# ones
|
||||
build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
|
||||
@{- output_off() if $disabled{makedepend}; "" -}
|
||||
@{- output_off() if $disabled{makedepend}; "\@rem" -}
|
||||
@$(ECHO) "Warning: consider configuring with no-makedepend, because if"
|
||||
@$(ECHO) " target system doesn't have $(PERL),"
|
||||
@$(ECHO) " then make will fail..."
|
||||
@{- output_on() if $disabled{makedepend}; "" -}
|
||||
@{- output_on() if $disabled{makedepend}; "\@rem" -}
|
||||
|
||||
test: tests
|
||||
{- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep
|
||||
@{- output_off() if $disabled{tests}; "" -}
|
||||
@{- output_off() if $disabled{tests}; "\@rem" -}
|
||||
-mkdir $(BLDDIR)\test\test-runs
|
||||
set SRCTOP=$(SRCDIR)
|
||||
set BLDTOP=$(BLDDIR)
|
||||
@@ -341,17 +341,17 @@ test: tests
|
||||
set OPENSSL_ENGINES=$(MAKEDIR)\engines
|
||||
set OPENSSL_DEBUG_MEMORY=on
|
||||
"$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS)
|
||||
@{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
|
||||
@{- if ($disabled{tests}) { output_on(); } else { output_off(); } "\@rem" -}
|
||||
@$(ECHO) "Tests are not supported with your chosen Configure options"
|
||||
@{- output_on() if !$disabled{tests}; "" -}
|
||||
@{- output_on() if !$disabled{tests}; "\@rem" -}
|
||||
|
||||
list-tests:
|
||||
@{- output_off() if $disabled{tests}; "" -}
|
||||
@{- output_off() if $disabled{tests}; "\@rem" -}
|
||||
@set SRCTOP=$(SRCDIR)
|
||||
@"$(PERL)" "$(SRCDIR)\test\run_tests.pl" list
|
||||
@{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
|
||||
@{- if ($disabled{tests}) { output_on(); } else { output_off(); } "\@rem" -}
|
||||
@$(ECHO) "Tests are not supported with your chosen Configure options"
|
||||
@{- output_on() if !$disabled{tests}; "" -}
|
||||
@{- output_on() if !$disabled{tests}; "\@rem" -}
|
||||
|
||||
install: install_sw install_ssldirs install_docs
|
||||
|
||||
@@ -362,7 +362,7 @@ libclean:
|
||||
-del /Q /F $(LIBS) libcrypto.* libssl.* ossl_static.pdb
|
||||
|
||||
clean: libclean
|
||||
{- join("\n\t", map { "-del /Q /F $_" } @PROGRAMS) -}
|
||||
{- join("\n\t", map { "-del /Q /F $_" } @PROGRAMS) || "\@rem" -}
|
||||
-del /Q /F $(ENGINES)
|
||||
-del /Q /F $(SCRIPTS)
|
||||
-del /Q /F $(GENERATED_MANDATORY)
|
||||
@@ -378,9 +378,9 @@ distclean: clean
|
||||
-del /Q /F makefile
|
||||
|
||||
depend:
|
||||
@ {- output_off() if $disabled{makedepend}; "" -}
|
||||
@ {- output_off() if $disabled{makedepend}; "\@rem" -}
|
||||
@ "$(PERL)" "$(SRCDIR)\util\add-depends.pl" "VC"
|
||||
@ {- output_on() if $disabled{makedepend}; "" -}
|
||||
@ {- output_on() if $disabled{makedepend}; "\@rem" -}
|
||||
|
||||
# Install helper targets #############################################
|
||||
|
||||
@@ -413,10 +413,10 @@ install_dev: install_runtime_libs
|
||||
@if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 )
|
||||
@$(ECHO) "*** Installing development files"
|
||||
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\include\openssl"
|
||||
@{- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
|
||||
@{- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "\@rem" -}
|
||||
@"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\ms\applink.c" \
|
||||
"$(INSTALLTOP)\include\openssl"
|
||||
@{- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
|
||||
@{- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "\@rem" -}
|
||||
@"$(PERL)" "$(SRCDIR)\util\copy.pl" "-exclude_re=/__DECC_" \
|
||||
"$(SRCDIR)\include\openssl\*.h" \
|
||||
"$(INSTALLTOP)\include\openssl"
|
||||
|
||||
29
Configure
29
Configure
@@ -1,6 +1,6 @@
|
||||
#! /usr/bin/env perl
|
||||
# -*- mode: perl; -*-
|
||||
# Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
# Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the OpenSSL license (the "License"). You may not use
|
||||
# this file except in compliance with the License. You can obtain a copy
|
||||
@@ -1201,6 +1201,10 @@ foreach (keys %useradd) {
|
||||
# At this point, we can forget everything about %user and %useradd,
|
||||
# because it's now all been merged into the corresponding $config entry
|
||||
|
||||
if (grep { $_ eq '-static' } @{$config{LDFLAGS}}) {
|
||||
disable('static', 'pic', 'threads');
|
||||
}
|
||||
|
||||
# Allow overriding the build file name
|
||||
$config{build_file} = env('BUILDFILE') || $target{build_file} || "Makefile";
|
||||
|
||||
@@ -1521,10 +1525,6 @@ if ($strict_warnings)
|
||||
}
|
||||
}
|
||||
|
||||
if (grep { $_ eq '-static' } @{$config{LDFLAGS}}) {
|
||||
disable('static', 'pic', 'threads');
|
||||
}
|
||||
|
||||
$config{CFLAGS} = [ map { $_ eq '--ossl-strict-warnings'
|
||||
? @strict_warnings_collection
|
||||
: ( $_ ) }
|
||||
@@ -2611,19 +2611,22 @@ _____
|
||||
}
|
||||
print "\nEnabled features:\n\n";
|
||||
foreach my $what (@disablables) {
|
||||
print " $what\n" unless $disabled{$what};
|
||||
print " $what\n"
|
||||
unless grep { $_ =~ /^${what}$/ } keys %disabled;
|
||||
}
|
||||
print "\nDisabled features:\n\n";
|
||||
foreach my $what (@disablables) {
|
||||
if ($disabled{$what}) {
|
||||
print " $what", ' ' x ($longest - length($what) + 1),
|
||||
"[$disabled{$what}]", ' ' x ($longest2 - length($disabled{$what}) + 1);
|
||||
print $disabled_info{$what}->{macro}
|
||||
if $disabled_info{$what}->{macro};
|
||||
my @what2 = grep { $_ =~ /^${what}$/ } keys %disabled;
|
||||
my $what3 = $what2[0];
|
||||
if ($what3) {
|
||||
print " $what3", ' ' x ($longest - length($what3) + 1),
|
||||
"[$disabled{$what3}]", ' ' x ($longest2 - length($disabled{$what3}) + 1);
|
||||
print $disabled_info{$what3}->{macro}
|
||||
if $disabled_info{$what3}->{macro};
|
||||
print ' (skip ',
|
||||
join(', ', @{$disabled_info{$what}->{skipped}}),
|
||||
join(', ', @{$disabled_info{$what3}->{skipped}}),
|
||||
')'
|
||||
if $disabled_info{$what}->{skipped};
|
||||
if $disabled_info{$what3}->{skipped};
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
15
INSTALL
15
INSTALL
@@ -106,8 +106,7 @@
|
||||
This will build and install OpenSSL in the default location, which is:
|
||||
|
||||
Unix: normal installation directories under /usr/local
|
||||
OpenVMS: SYS$COMMON:[OPENSSL-'version'...], where 'version' is the
|
||||
OpenSSL version number with underscores instead of periods.
|
||||
OpenVMS: SYS$COMMON:[OPENSSL]
|
||||
Windows: C:\Program Files\OpenSSL or C:\Program Files (x86)\OpenSSL
|
||||
|
||||
The installation directory should be appropriately protected to ensure
|
||||
@@ -116,7 +115,9 @@
|
||||
your Operating System it is recommended that you do not overwrite the system
|
||||
version and instead install to somewhere else.
|
||||
|
||||
If you want to install it anywhere else, run config like this:
|
||||
If you want to install it anywhere else, run config like this (the options
|
||||
--prefix and --openssldir are explained further down, and the values shown
|
||||
here are mere examples):
|
||||
|
||||
On Unix:
|
||||
|
||||
@@ -198,7 +199,7 @@
|
||||
Unix: /usr/local
|
||||
Windows: C:\Program Files\OpenSSL
|
||||
or C:\Program Files (x86)\OpenSSL
|
||||
OpenVMS: SYS$COMMON:[OPENSSL-'version']
|
||||
OpenVMS: SYS$COMMON:[OPENSSL]
|
||||
|
||||
--release
|
||||
Build OpenSSL without debugging symbols. This is the default.
|
||||
@@ -961,9 +962,9 @@
|
||||
share/doc/openssl/html/man7
|
||||
Contains the HTML rendition of the man-pages.
|
||||
|
||||
OpenVMS ('arch' is replaced with the architecture name, "Alpha"
|
||||
or "ia64", 'sover' is replaced with the shared library version
|
||||
(0101 for 1.1), and 'pz' is replaced with the pointer size
|
||||
OpenVMS ('arch' is replaced with the architecture name, "ALPHA"
|
||||
or "IA64", 'sover' is replaced with the shared library version
|
||||
(0101 for 1.1.x), and 'pz' is replaced with the pointer size
|
||||
OpenSSL was built with):
|
||||
|
||||
[.EXE.'arch'] Contains the openssl binary.
|
||||
|
||||
23
NEWS
23
NEWS
@@ -5,6 +5,29 @@
|
||||
This file gives a brief overview of the major changes between each OpenSSL
|
||||
release. For more details please read the CHANGES file.
|
||||
|
||||
Major changes between OpenSSL 1.1.1k and OpenSSL 1.1.1l [24 Aug 2021]
|
||||
|
||||
o Fixed an SM2 Decryption Buffer Overflow (CVE-2021-3711)
|
||||
o Fixed various read buffer overruns processing ASN.1 strings (CVE-2021-3712)
|
||||
|
||||
Major changes between OpenSSL 1.1.1j and OpenSSL 1.1.1k [25 Mar 2021]
|
||||
|
||||
o Fixed a problem with verifying a certificate chain when using the
|
||||
X509_V_FLAG_X509_STRICT flag (CVE-2021-3450)
|
||||
o Fixed an issue where an OpenSSL TLS server may crash if sent a
|
||||
maliciously crafted renegotiation ClientHello message from a client
|
||||
(CVE-2021-3449)
|
||||
|
||||
Major changes between OpenSSL 1.1.1i and OpenSSL 1.1.1j [16 Feb 2021]
|
||||
|
||||
o Fixed a NULL pointer deref in the X509_issuer_and_serial_hash()
|
||||
function (CVE-2021-23841)
|
||||
o Fixed the RSA_padding_check_SSLv23() function and the RSA_SSLV23_PADDING
|
||||
padding mode to correctly check for rollback attacks
|
||||
o Fixed an overflow in the EVP_CipherUpdate, EVP_EncryptUpdate and
|
||||
EVP_DecryptUpdate functions (CVE-2021-23840)
|
||||
o Fixed SRP_Calc_client_key so that it runs in constant time
|
||||
|
||||
Major changes between OpenSSL 1.1.1h and OpenSSL 1.1.1i [8 Dec 2020]
|
||||
|
||||
o Fixed NULL pointer deref in GENERAL_NAME_cmp (CVE-2020-1971)
|
||||
|
||||
12
NOTES.VMS
12
NOTES.VMS
@@ -90,9 +90,9 @@
|
||||
Unix mount point.
|
||||
|
||||
The easiest way to check if everything got through as it should is to
|
||||
check for one of the following files:
|
||||
check that this file exists:
|
||||
|
||||
[.crypto]opensslconf^.h.in
|
||||
[.include.openssl]opensslconf^.h.in
|
||||
|
||||
The best way to get a correct distribution is to download the gzipped
|
||||
tar file from ftp://ftp.openssl.org/source/, use GZIP -d to uncompress
|
||||
@@ -105,3 +105,11 @@
|
||||
Should you need it, you can find UnZip for VMS here:
|
||||
|
||||
http://www.info-zip.org/UnZip.html
|
||||
|
||||
|
||||
How the value of 'arch' is determined
|
||||
-------------------------------------
|
||||
|
||||
'arch' is mentioned in INSTALL. It's value is determined like this:
|
||||
|
||||
arch = f$edit( f$getsyi( "arch_name"), "upcase")
|
||||
|
||||
@@ -62,8 +62,8 @@
|
||||
|
||||
For VC-WIN32, the following defaults are use:
|
||||
|
||||
PREFIX: %ProgramFiles(86)%\OpenSSL
|
||||
OPENSSLDIR: %CommonProgramFiles(86)%\SSL
|
||||
PREFIX: %ProgramFiles(x86)%\OpenSSL
|
||||
OPENSSLDIR: %CommonProgramFiles(x86)%\SSL
|
||||
|
||||
For VC-WIN64, the following defaults are use:
|
||||
|
||||
|
||||
4
README
4
README
@@ -1,7 +1,7 @@
|
||||
|
||||
OpenSSL 1.1.1i 8 Dec 2020
|
||||
OpenSSL 1.1.1l 24 Aug 2021
|
||||
|
||||
Copyright (c) 1998-2020 The OpenSSL Project
|
||||
Copyright (c) 1998-2021 The OpenSSL Project
|
||||
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
|
||||
All rights reserved.
|
||||
|
||||
|
||||
19
VMS/msg_install.com
Normal file
19
VMS/msg_install.com
Normal file
@@ -0,0 +1,19 @@
|
||||
$ ! Used by the main descrip.mms to print the installation complete
|
||||
$ ! message.
|
||||
$ ! Arguments:
|
||||
$ ! P1 startup / setup / shutdown scripts directory
|
||||
$ ! P2 distinguishing version number ("major version")
|
||||
$
|
||||
$ systartup = p1
|
||||
$ osslver = p2
|
||||
$
|
||||
$ WRITE SYS$OUTPUT "Installation complete"
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$ WRITE SYS$OUTPUT "The following commands need to be executed to enable you to use OpenSSL:"
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$ WRITE SYS$OUTPUT "- to set up OpenSSL logical names:"
|
||||
$ WRITE SYS$OUTPUT " @''systartup'openssl_startup''osslver'"
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$ WRITE SYS$OUTPUT "- to define the OpenSSL command"
|
||||
$ WRITE SYS$OUTPUT " @''systartup'openssl_utils''osslver'"
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
37
VMS/msg_staging.com
Normal file
37
VMS/msg_staging.com
Normal file
@@ -0,0 +1,37 @@
|
||||
$ ! Used by the main descrip.mms to print the statging installation
|
||||
$ ! complete
|
||||
$ ! message.
|
||||
$ ! Arguments:
|
||||
$ ! P1 staging software installation directory
|
||||
$ ! P2 staging data installation directory
|
||||
$ ! P3 final software installation directory
|
||||
$ ! P4 final data installation directory
|
||||
$ ! P5 startup / setup / shutdown scripts directory
|
||||
$ ! P6 distinguishing version number ("major version")
|
||||
$
|
||||
$ staging_instdir = p1
|
||||
$ staging_datadir = p2
|
||||
$ final_instdir = p3
|
||||
$ final_datadir = p4
|
||||
$ systartup = p5
|
||||
$ osslver = p6
|
||||
$
|
||||
$ WRITE SYS$OUTPUT "Staging installation complete"
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$ WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the following directory"
|
||||
$ WRITE SYS$OUTPUT "trees end up being copied:"
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$ WRITE SYS$OUTPUT "- from ", staging_instdir
|
||||
$ WRITE SYS$OUTPUT " to ", final_instdir
|
||||
$ WRITE SYS$OUTPUT "- from ", staging_datadir
|
||||
$ WRITE SYS$OUTPUT " to ", final_datadir
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$ WRITE SYS$OUTPUT "When in its final destination, the following commands need to be executed"
|
||||
$ WRITE SYS$OUTPUT "to use OpenSSL:"
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$ WRITE SYS$OUTPUT "- to set up OpenSSL logical names:"
|
||||
$ WRITE SYS$OUTPUT " @''systartup'openssl_startup''osslver'"
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$ WRITE SYS$OUTPUT "- to define the OpenSSL command"
|
||||
$ WRITE SYS$OUTPUT " @''systartup'openssl_utils''osslver'"
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
53
apps/ca.c
53
apps/ca.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -2223,62 +2223,51 @@ static int get_certificate_status(const char *serial, CA_DB *db)
|
||||
|
||||
static int do_updatedb(CA_DB *db)
|
||||
{
|
||||
ASN1_UTCTIME *a_tm = NULL;
|
||||
ASN1_TIME *a_tm = NULL;
|
||||
int i, cnt = 0;
|
||||
int db_y2k, a_y2k; /* flags = 1 if y >= 2000 */
|
||||
char **rrow, *a_tm_s;
|
||||
char **rrow;
|
||||
|
||||
a_tm = ASN1_UTCTIME_new();
|
||||
a_tm = ASN1_TIME_new();
|
||||
if (a_tm == NULL)
|
||||
return -1;
|
||||
|
||||
/* get actual time and make a string */
|
||||
/* get actual time */
|
||||
if (X509_gmtime_adj(a_tm, 0) == NULL) {
|
||||
ASN1_UTCTIME_free(a_tm);
|
||||
ASN1_TIME_free(a_tm);
|
||||
return -1;
|
||||
}
|
||||
a_tm_s = app_malloc(a_tm->length + 1, "time string");
|
||||
|
||||
memcpy(a_tm_s, a_tm->data, a_tm->length);
|
||||
a_tm_s[a_tm->length] = '\0';
|
||||
|
||||
if (strncmp(a_tm_s, "49", 2) <= 0)
|
||||
a_y2k = 1;
|
||||
else
|
||||
a_y2k = 0;
|
||||
|
||||
for (i = 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++) {
|
||||
rrow = sk_OPENSSL_PSTRING_value(db->db->data, i);
|
||||
|
||||
if (rrow[DB_type][0] == DB_TYPE_VAL) {
|
||||
/* ignore entries that are not valid */
|
||||
if (strncmp(rrow[DB_exp_date], "49", 2) <= 0)
|
||||
db_y2k = 1;
|
||||
else
|
||||
db_y2k = 0;
|
||||
ASN1_TIME *exp_date = NULL;
|
||||
|
||||
if (db_y2k == a_y2k) {
|
||||
/* all on the same y2k side */
|
||||
if (strcmp(rrow[DB_exp_date], a_tm_s) <= 0) {
|
||||
rrow[DB_type][0] = DB_TYPE_EXP;
|
||||
rrow[DB_type][1] = '\0';
|
||||
cnt++;
|
||||
exp_date = ASN1_TIME_new();
|
||||
if (exp_date == NULL) {
|
||||
ASN1_TIME_free(a_tm);
|
||||
return -1;
|
||||
}
|
||||
|
||||
BIO_printf(bio_err, "%s=Expired\n", rrow[DB_serial]);
|
||||
}
|
||||
} else if (db_y2k < a_y2k) {
|
||||
if (!ASN1_TIME_set_string(exp_date, rrow[DB_exp_date])) {
|
||||
ASN1_TIME_free(a_tm);
|
||||
ASN1_TIME_free(exp_date);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ASN1_TIME_compare(exp_date, a_tm) <= 0) {
|
||||
rrow[DB_type][0] = DB_TYPE_EXP;
|
||||
rrow[DB_type][1] = '\0';
|
||||
cnt++;
|
||||
|
||||
BIO_printf(bio_err, "%s=Expired\n", rrow[DB_serial]);
|
||||
}
|
||||
|
||||
ASN1_TIME_free(exp_date);
|
||||
}
|
||||
}
|
||||
|
||||
ASN1_UTCTIME_free(a_tm);
|
||||
OPENSSL_free(a_tm_s);
|
||||
ASN1_TIME_free(a_tm);
|
||||
return cnt;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -120,19 +120,20 @@ int crl2pkcs7_main(int argc, char **argv)
|
||||
|
||||
if (!ASN1_INTEGER_set(p7s->version, 1))
|
||||
goto end;
|
||||
if ((crl_stack = sk_X509_CRL_new_null()) == NULL)
|
||||
goto end;
|
||||
p7s->crl = crl_stack;
|
||||
|
||||
if (crl != NULL) {
|
||||
if ((crl_stack = sk_X509_CRL_new_null()) == NULL)
|
||||
goto end;
|
||||
p7s->crl = crl_stack;
|
||||
sk_X509_CRL_push(crl_stack, crl);
|
||||
crl = NULL; /* now part of p7 for OPENSSL_freeing */
|
||||
}
|
||||
|
||||
if ((cert_stack = sk_X509_new_null()) == NULL)
|
||||
goto end;
|
||||
p7s->cert = cert_stack;
|
||||
if (certflst != NULL) {
|
||||
if ((cert_stack = sk_X509_new_null()) == NULL)
|
||||
goto end;
|
||||
p7s->cert = cert_stack;
|
||||
|
||||
if (certflst != NULL)
|
||||
for (i = 0; i < sk_OPENSSL_STRING_num(certflst); i++) {
|
||||
certfile = sk_OPENSSL_STRING_value(certflst, i);
|
||||
if (add_certs_from_file(cert_stack, certfile) < 0) {
|
||||
@@ -141,6 +142,7 @@ int crl2pkcs7_main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
out = bio_open_default(outfile, 'w', outformat);
|
||||
if (out == NULL)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -81,7 +81,7 @@ const OPTIONS enc_options[] = {
|
||||
{"", OPT_CIPHER, '-', "Any supported cipher"},
|
||||
OPT_R_OPTIONS,
|
||||
#ifdef ZLIB
|
||||
{"z", OPT_Z, '-', "Use zlib as the 'encryption'"},
|
||||
{"z", OPT_Z, '-', "Compress or decompress encrypted data using zlib"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -934,7 +934,8 @@ static int set_cert_cb(SSL *ssl, void *arg)
|
||||
if (!SSL_build_cert_chain(ssl, 0))
|
||||
return 0;
|
||||
} else if (exc->chain != NULL) {
|
||||
SSL_set1_chain(ssl, exc->chain);
|
||||
if (!SSL_set1_chain(ssl, exc->chain))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
exc = exc->prev;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
|
||||
* Copyright 2005 Nokia. All rights reserved.
|
||||
*
|
||||
@@ -133,6 +133,17 @@ static unsigned int psk_server_cb(SSL *ssl, const char *identity,
|
||||
|
||||
if (s_debug)
|
||||
BIO_printf(bio_s_out, "psk_server_cb\n");
|
||||
|
||||
if (SSL_version(ssl) >= TLS1_3_VERSION) {
|
||||
/*
|
||||
* This callback is designed for use in TLSv1.2. It is possible to use
|
||||
* a single callback for all protocol versions - but it is preferred to
|
||||
* use a dedicated callback for TLSv1.3. For TLSv1.3 we have
|
||||
* psk_find_session_cb.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (identity == NULL) {
|
||||
BIO_printf(bio_err, "Error: client did not send PSK identity\n");
|
||||
goto out_err;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -214,6 +214,8 @@ int do_server(int *accept_sock, const char *host, const char *port,
|
||||
const BIO_ADDRINFO *next;
|
||||
int sock_family, sock_type, sock_protocol, sock_port;
|
||||
const BIO_ADDR *sock_address;
|
||||
int sock_family_fallback = AF_UNSPEC;
|
||||
const BIO_ADDR *sock_address_fallback = NULL;
|
||||
int sock_options = BIO_SOCK_REUSEADDR;
|
||||
int ret = 0;
|
||||
|
||||
@@ -244,6 +246,10 @@ int do_server(int *accept_sock, const char *host, const char *port,
|
||||
&& BIO_ADDRINFO_protocol(next) == sock_protocol) {
|
||||
if (sock_family == AF_INET
|
||||
&& BIO_ADDRINFO_family(next) == AF_INET6) {
|
||||
/* In case AF_INET6 is returned but not supported by the
|
||||
* kernel, retry with the first detected address family */
|
||||
sock_family_fallback = sock_family;
|
||||
sock_address_fallback = sock_address;
|
||||
sock_family = AF_INET6;
|
||||
sock_address = BIO_ADDRINFO_address(next);
|
||||
} else if (sock_family == AF_INET6
|
||||
@@ -253,6 +259,10 @@ int do_server(int *accept_sock, const char *host, const char *port,
|
||||
}
|
||||
|
||||
asock = BIO_socket(sock_family, sock_type, sock_protocol, 0);
|
||||
if (asock == INVALID_SOCKET && sock_family_fallback != AF_UNSPEC) {
|
||||
asock = BIO_socket(sock_family_fallback, sock_type, sock_protocol, 0);
|
||||
sock_address = sock_address_fallback;
|
||||
}
|
||||
if (asock == INVALID_SOCKET
|
||||
|| !BIO_listen(asock, sock_address, sock_options)) {
|
||||
BIO_ADDRINFO_free(res);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -263,7 +263,8 @@ int s_time_main(int argc, char **argv)
|
||||
nConn, totalTime, ((double)nConn / totalTime), bytes_read);
|
||||
printf
|
||||
("%d connections in %ld real seconds, %ld bytes read per connection\n",
|
||||
nConn, (long)time(NULL) - finishtime + maxtime, bytes_read / nConn);
|
||||
nConn, (long)time(NULL) - finishtime + maxtime,
|
||||
nConn > 0 ? bytes_read / nConn : 0l);
|
||||
|
||||
/*
|
||||
* Now loop and time connections using the same session id over and over
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2011-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -68,7 +68,39 @@ void OPENSSL_cpuid_setup(void) __attribute__ ((constructor));
|
||||
# include <sys/auxv.h>
|
||||
# define OSSL_IMPLEMENT_GETAUXVAL
|
||||
# endif
|
||||
# elif defined(__ANDROID_API__)
|
||||
/* see https://developer.android.google.cn/ndk/guides/cpu-features */
|
||||
# if __ANDROID_API__ >= 18
|
||||
# include <sys/auxv.h>
|
||||
# define OSSL_IMPLEMENT_GETAUXVAL
|
||||
# endif
|
||||
# endif
|
||||
# if defined(__FreeBSD__)
|
||||
# include <sys/param.h>
|
||||
# if __FreeBSD_version >= 1200000
|
||||
# include <sys/auxv.h>
|
||||
# define OSSL_IMPLEMENT_GETAUXVAL
|
||||
|
||||
static unsigned long getauxval(unsigned long key)
|
||||
{
|
||||
unsigned long val = 0ul;
|
||||
|
||||
if (elf_aux_info((int)key, &val, sizeof(val)) != 0)
|
||||
return 0ul;
|
||||
|
||||
return val;
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/*
|
||||
* Android: according to https://developer.android.com/ndk/guides/cpu-features,
|
||||
* getauxval is supported starting with API level 18
|
||||
*/
|
||||
# if defined(__ANDROID__) && defined(__ANDROID_API__) && __ANDROID_API__ >= 18
|
||||
# include <sys/auxv.h>
|
||||
# define OSSL_IMPLEMENT_GETAUXVAL
|
||||
# endif
|
||||
|
||||
/*
|
||||
* ARM puts the feature bits for Crypto Extensions in AT_HWCAP2, whereas
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -286,16 +286,13 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* only the ASN1_OBJECTs from the 'table' will have values for ->sn or
|
||||
* ->ln
|
||||
*/
|
||||
if ((a == NULL) || ((*a) == NULL) ||
|
||||
!((*a)->flags & ASN1_OBJECT_FLAG_DYNAMIC)) {
|
||||
if ((ret = ASN1_OBJECT_new()) == NULL)
|
||||
return NULL;
|
||||
} else
|
||||
} else {
|
||||
ret = (*a);
|
||||
}
|
||||
|
||||
p = *pp;
|
||||
/* detach data from object */
|
||||
@@ -313,6 +310,12 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
|
||||
ret->flags |= ASN1_OBJECT_FLAG_DYNAMIC_DATA;
|
||||
}
|
||||
memcpy(data, p, length);
|
||||
/* If there are dynamic strings, free them here, and clear the flag */
|
||||
if ((ret->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS) != 0) {
|
||||
OPENSSL_free((char *)ret->sn);
|
||||
OPENSSL_free((char *)ret->ln);
|
||||
ret->flags &= ~ASN1_OBJECT_FLAG_DYNAMIC_STRINGS;
|
||||
}
|
||||
/* reattach data to object, after which it remains const */
|
||||
ret->data = data;
|
||||
ret->length = length;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -280,6 +280,8 @@ static int do_dump(unsigned long lflags, char_io *io_ch, void *arg,
|
||||
t.type = str->type;
|
||||
t.value.ptr = (char *)str;
|
||||
der_len = i2d_ASN1_TYPE(&t, NULL);
|
||||
if (der_len <= 0)
|
||||
return -1;
|
||||
if ((der_buf = OPENSSL_malloc(der_len)) == NULL) {
|
||||
ASN1err(ASN1_F_DO_DUMP, ERR_R_MALLOC_FAILURE);
|
||||
return -1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -292,7 +292,12 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len_in)
|
||||
}
|
||||
if ((size_t)str->length <= len || str->data == NULL) {
|
||||
c = str->data;
|
||||
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
||||
/* No NUL terminator in fuzzing builds */
|
||||
str->data = OPENSSL_realloc(c, len);
|
||||
#else
|
||||
str->data = OPENSSL_realloc(c, len + 1);
|
||||
#endif
|
||||
if (str->data == NULL) {
|
||||
ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE);
|
||||
str->data = c;
|
||||
@@ -302,8 +307,13 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len_in)
|
||||
str->length = len;
|
||||
if (data != NULL) {
|
||||
memcpy(str->data, data, len);
|
||||
/* an allowance for strings :-) */
|
||||
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
||||
/*
|
||||
* Add a NUL terminator. This should not be necessary - but we add it as
|
||||
* a safety precaution
|
||||
*/
|
||||
str->data[len] = '\0';
|
||||
#endif
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -325,6 +325,7 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
|
||||
}
|
||||
if (BIO_puts(bp, "]") <= 0)
|
||||
goto end;
|
||||
dump_cont = 0;
|
||||
}
|
||||
|
||||
if (!nl) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -138,6 +138,11 @@ static int asn1_bio_free(BIO *b)
|
||||
if (ctx == NULL)
|
||||
return 0;
|
||||
|
||||
if (ctx->prefix_free != NULL)
|
||||
ctx->prefix_free(b, &ctx->ex_buf, &ctx->ex_len, &ctx->ex_arg);
|
||||
if (ctx->suffix_free != NULL)
|
||||
ctx->suffix_free(b, &ctx->ex_buf, &ctx->ex_len, &ctx->ex_arg);
|
||||
|
||||
OPENSSL_free(ctx->buf);
|
||||
OPENSSL_free(ctx);
|
||||
BIO_set_data(b, NULL);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -113,6 +113,8 @@ static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
|
||||
ndef_aux = *(NDEF_SUPPORT **)parg;
|
||||
|
||||
derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it);
|
||||
if (derlen < 0)
|
||||
return 0;
|
||||
if ((p = OPENSSL_malloc(derlen)) == NULL) {
|
||||
ASN1err(ASN1_F_NDEF_PREFIX, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
@@ -140,6 +142,9 @@ static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen,
|
||||
|
||||
ndef_aux = *(NDEF_SUPPORT **)parg;
|
||||
|
||||
if (ndef_aux == NULL)
|
||||
return 0;
|
||||
|
||||
OPENSSL_free(ndef_aux->derbuf);
|
||||
|
||||
ndef_aux->derbuf = NULL;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* WARNING: do not edit!
|
||||
* Generated by crypto/asn1/charmap.pl
|
||||
*
|
||||
* Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -78,13 +78,53 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
|
||||
* type
|
||||
*/
|
||||
|
||||
static EVP_PKEY *key_as_pkcs8(const unsigned char **pp, long length, int *carry_on)
|
||||
{
|
||||
const unsigned char *p = *pp;
|
||||
PKCS8_PRIV_KEY_INFO *p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, length);
|
||||
EVP_PKEY *ret;
|
||||
|
||||
if (p8 == NULL)
|
||||
return NULL;
|
||||
|
||||
ret = EVP_PKCS82PKEY(p8);
|
||||
if (ret == NULL)
|
||||
*carry_on = 0;
|
||||
|
||||
PKCS8_PRIV_KEY_INFO_free(p8);
|
||||
|
||||
if (ret != NULL)
|
||||
*pp = p;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
|
||||
long length)
|
||||
{
|
||||
STACK_OF(ASN1_TYPE) *inkey;
|
||||
const unsigned char *p;
|
||||
int keytype;
|
||||
EVP_PKEY *ret = NULL;
|
||||
int carry_on = 1;
|
||||
|
||||
ERR_set_mark();
|
||||
ret = key_as_pkcs8(pp, length, &carry_on);
|
||||
if (ret != NULL) {
|
||||
ERR_clear_last_mark();
|
||||
if (a != NULL)
|
||||
*a = ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (carry_on == 0) {
|
||||
ERR_clear_last_mark();
|
||||
ASN1err(ASN1_F_D2I_AUTOPRIVATEKEY,
|
||||
ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
|
||||
return NULL;
|
||||
}
|
||||
p = *pp;
|
||||
|
||||
/*
|
||||
* Dirty trick: read in the ASN1 data into a STACK_OF(ASN1_TYPE): by
|
||||
* analyzing it we can determine the passed structure: this assumes the
|
||||
@@ -100,28 +140,15 @@ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
|
||||
keytype = EVP_PKEY_DSA;
|
||||
else if (sk_ASN1_TYPE_num(inkey) == 4)
|
||||
keytype = EVP_PKEY_EC;
|
||||
else if (sk_ASN1_TYPE_num(inkey) == 3) { /* This seems to be PKCS8, not
|
||||
* traditional format */
|
||||
PKCS8_PRIV_KEY_INFO *p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, length);
|
||||
EVP_PKEY *ret;
|
||||
|
||||
sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
|
||||
if (!p8) {
|
||||
ASN1err(ASN1_F_D2I_AUTOPRIVATEKEY,
|
||||
ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
|
||||
return NULL;
|
||||
}
|
||||
ret = EVP_PKCS82PKEY(p8);
|
||||
PKCS8_PRIV_KEY_INFO_free(p8);
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
*pp = p;
|
||||
if (a) {
|
||||
*a = ret;
|
||||
}
|
||||
return ret;
|
||||
} else
|
||||
else
|
||||
keytype = EVP_PKEY_RSA;
|
||||
sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
|
||||
return d2i_PrivateKey(keytype, a, pp, length);
|
||||
|
||||
ret = d2i_PrivateKey(keytype, a, pp, length);
|
||||
if (ret != NULL)
|
||||
ERR_pop_to_mark();
|
||||
else
|
||||
ERR_clear_last_mark();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -38,7 +38,7 @@ int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki)
|
||||
}
|
||||
chal = spki->spkac->challenge;
|
||||
if (chal->length)
|
||||
BIO_printf(out, " Challenge String: %s\n", chal->data);
|
||||
BIO_printf(out, " Challenge String: %.*s\n", chal->length, chal->data);
|
||||
i = OBJ_obj2nid(spki->sig_algor.algorithm);
|
||||
BIO_printf(out, " Signature Algorithm: %s",
|
||||
(i == NID_undef) ? "UNKNOWN" : OBJ_nid2ln(i));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -689,7 +689,7 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
|
||||
hints.ai_protocol = protocol;
|
||||
# ifdef AI_ADDRCONFIG
|
||||
# ifdef AF_UNSPEC
|
||||
if (family == AF_UNSPEC)
|
||||
if (host != NULL && family == AF_UNSPEC)
|
||||
# endif
|
||||
hints.ai_flags |= AI_ADDRCONFIG;
|
||||
# endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -243,7 +243,8 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef IPV6_V6ONLY
|
||||
/* On OpenBSD it is always ipv6 only with ipv6 sockets thus read-only */
|
||||
# if defined(IPV6_V6ONLY) && !defined(__OpenBSD__)
|
||||
if (BIO_ADDR_family(addr) == AF_INET6) {
|
||||
/*
|
||||
* Note: Windows default of IPV6_V6ONLY is ON, and Linux is OFF.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -268,7 +268,7 @@ int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num,
|
||||
BIGNUM *tmp, *snum, *sdiv, *res;
|
||||
BN_ULONG *resp, *wnum, *wnumtop;
|
||||
BN_ULONG d0, d1;
|
||||
int num_n, div_n;
|
||||
int num_n, div_n, num_neg;
|
||||
|
||||
assert(divisor->top > 0 && divisor->d[divisor->top - 1] != 0);
|
||||
|
||||
@@ -326,7 +326,8 @@ int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num,
|
||||
/* Setup quotient */
|
||||
if (!bn_wexpand(res, loop))
|
||||
goto err;
|
||||
res->neg = (num->neg ^ divisor->neg);
|
||||
num_neg = num->neg;
|
||||
res->neg = (num_neg ^ divisor->neg);
|
||||
res->top = loop;
|
||||
res->flags |= BN_FLG_FIXED_TOP;
|
||||
resp = &(res->d[loop]);
|
||||
@@ -442,7 +443,7 @@ int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num,
|
||||
*--resp = q;
|
||||
}
|
||||
/* snum holds remainder, it's as wide as divisor */
|
||||
snum->neg = num->neg;
|
||||
snum->neg = num_neg;
|
||||
snum->top = div_n;
|
||||
snum->flags |= BN_FLG_FIXED_TOP;
|
||||
if (rm != NULL)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* WARNING: do not edit!
|
||||
* Generated by crypto/bn/bn_prime.pl
|
||||
*
|
||||
* Copyright 1998-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1998-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#! /usr/bin/env perl
|
||||
# Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
# Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the OpenSSL license (the "License"). You may not use
|
||||
# this file except in compliance with the License. You can obtain a copy
|
||||
@@ -471,7 +471,7 @@ sub SSSE3ROUND { # critical path is 20 "SIMD ticks" per round
|
||||
&por ($b,$t);
|
||||
}
|
||||
|
||||
my $xframe = $win64 ? 32+8 : 8;
|
||||
my $xframe = $win64 ? 160+8 : 8;
|
||||
|
||||
$code.=<<___;
|
||||
.type ChaCha20_ssse3,\@function,5
|
||||
@@ -2499,7 +2499,7 @@ sub AVX512ROUND { # critical path is 14 "SIMD ticks" per round
|
||||
&vprold ($b,$b,7);
|
||||
}
|
||||
|
||||
my $xframe = $win64 ? 32+8 : 8;
|
||||
my $xframe = $win64 ? 160+8 : 8;
|
||||
|
||||
$code.=<<___;
|
||||
.type ChaCha20_avx512,\@function,5
|
||||
@@ -2515,8 +2515,16 @@ ChaCha20_avx512:
|
||||
sub \$64+$xframe,%rsp
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
movaps %xmm6,-0x28(%r9)
|
||||
movaps %xmm7,-0x18(%r9)
|
||||
movaps %xmm6,-0xa8(%r9)
|
||||
movaps %xmm7,-0x98(%r9)
|
||||
movaps %xmm8,-0x88(%r9)
|
||||
movaps %xmm9,-0x78(%r9)
|
||||
movaps %xmm10,-0x68(%r9)
|
||||
movaps %xmm11,-0x58(%r9)
|
||||
movaps %xmm12,-0x48(%r9)
|
||||
movaps %xmm13,-0x38(%r9)
|
||||
movaps %xmm14,-0x28(%r9)
|
||||
movaps %xmm15,-0x18(%r9)
|
||||
.Lavx512_body:
|
||||
___
|
||||
$code.=<<___;
|
||||
@@ -2683,8 +2691,16 @@ $code.=<<___;
|
||||
vzeroall
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
movaps -0x28(%r9),%xmm6
|
||||
movaps -0x18(%r9),%xmm7
|
||||
movaps -0xa8(%r9),%xmm6
|
||||
movaps -0x98(%r9),%xmm7
|
||||
movaps -0x88(%r9),%xmm8
|
||||
movaps -0x78(%r9),%xmm9
|
||||
movaps -0x68(%r9),%xmm10
|
||||
movaps -0x58(%r9),%xmm11
|
||||
movaps -0x48(%r9),%xmm12
|
||||
movaps -0x38(%r9),%xmm13
|
||||
movaps -0x28(%r9),%xmm14
|
||||
movaps -0x18(%r9),%xmm15
|
||||
___
|
||||
$code.=<<___;
|
||||
lea (%r9),%rsp
|
||||
@@ -2711,8 +2727,16 @@ ChaCha20_avx512vl:
|
||||
sub \$64+$xframe,%rsp
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
movaps %xmm6,-0x28(%r9)
|
||||
movaps %xmm7,-0x18(%r9)
|
||||
movaps %xmm6,-0xa8(%r9)
|
||||
movaps %xmm7,-0x98(%r9)
|
||||
movaps %xmm8,-0x88(%r9)
|
||||
movaps %xmm9,-0x78(%r9)
|
||||
movaps %xmm10,-0x68(%r9)
|
||||
movaps %xmm11,-0x58(%r9)
|
||||
movaps %xmm12,-0x48(%r9)
|
||||
movaps %xmm13,-0x38(%r9)
|
||||
movaps %xmm14,-0x28(%r9)
|
||||
movaps %xmm15,-0x18(%r9)
|
||||
.Lavx512vl_body:
|
||||
___
|
||||
$code.=<<___;
|
||||
@@ -2836,8 +2860,16 @@ $code.=<<___;
|
||||
vzeroall
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
movaps -0x28(%r9),%xmm6
|
||||
movaps -0x18(%r9),%xmm7
|
||||
movaps -0xa8(%r9),%xmm6
|
||||
movaps -0x98(%r9),%xmm7
|
||||
movaps -0x88(%r9),%xmm8
|
||||
movaps -0x78(%r9),%xmm9
|
||||
movaps -0x68(%r9),%xmm10
|
||||
movaps -0x58(%r9),%xmm11
|
||||
movaps -0x48(%r9),%xmm12
|
||||
movaps -0x38(%r9),%xmm13
|
||||
movaps -0x28(%r9),%xmm14
|
||||
movaps -0x18(%r9),%xmm15
|
||||
___
|
||||
$code.=<<___;
|
||||
lea (%r9),%rsp
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -185,6 +185,7 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
|
||||
BUF_MEM *buff = NULL;
|
||||
char *s, *p, *end;
|
||||
int again;
|
||||
int first_call = 1;
|
||||
long eline = 0;
|
||||
char btmp[DECIMAL_SIZE(eline) + 1];
|
||||
CONF_VALUE *v = NULL, *tv;
|
||||
@@ -233,6 +234,19 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
|
||||
BIO_gets(in, p, CONFBUFSIZE - 1);
|
||||
p[CONFBUFSIZE - 1] = '\0';
|
||||
ii = i = strlen(p);
|
||||
if (first_call) {
|
||||
/* Other BOMs imply unsupported multibyte encoding,
|
||||
* so don't strip them and let the error raise */
|
||||
const unsigned char utf8_bom[3] = {0xEF, 0xBB, 0xBF};
|
||||
|
||||
if (i >= 3 && memcmp(p, utf8_bom, 3) == 0) {
|
||||
memmove(p, p + 3, i - 3);
|
||||
p[i - 3] = 0;
|
||||
i -= 3;
|
||||
ii -= 3;
|
||||
}
|
||||
first_call = 0;
|
||||
}
|
||||
if (i == 0 && !again) {
|
||||
/* the currently processed BIO is at EOF */
|
||||
BIO *parent;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* WARNING: do not edit!
|
||||
* Generated by crypto/conf/keysets.pl
|
||||
*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -25,18 +25,45 @@ int DH_generate_key(DH *dh)
|
||||
return dh->meth->generate_key(dh);
|
||||
}
|
||||
|
||||
/*-
|
||||
* NB: This function is inherently not constant time due to the
|
||||
* RFC 5246 (8.1.2) padding style that strips leading zero bytes.
|
||||
*/
|
||||
int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
|
||||
{
|
||||
return dh->meth->compute_key(key, pub_key, dh);
|
||||
int ret = 0, i;
|
||||
volatile size_t npad = 0, mask = 1;
|
||||
|
||||
/* compute the key; ret is constant unless compute_key is external */
|
||||
if ((ret = dh->meth->compute_key(key, pub_key, dh)) <= 0)
|
||||
return ret;
|
||||
|
||||
/* count leading zero bytes, yet still touch all bytes */
|
||||
for (i = 0; i < ret; i++) {
|
||||
mask &= !key[i];
|
||||
npad += mask;
|
||||
}
|
||||
|
||||
/* unpad key */
|
||||
ret -= npad;
|
||||
/* key-dependent memory access, potentially leaking npad / ret */
|
||||
memmove(key, key + npad, ret);
|
||||
/* key-dependent memory access, potentially leaking npad / ret */
|
||||
memset(key + ret, 0, npad);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int DH_compute_key_padded(unsigned char *key, const BIGNUM *pub_key, DH *dh)
|
||||
{
|
||||
int rv, pad;
|
||||
|
||||
/* rv is constant unless compute_key is external */
|
||||
rv = dh->meth->compute_key(key, pub_key, dh);
|
||||
if (rv <= 0)
|
||||
return rv;
|
||||
pad = BN_num_bytes(dh->p) - rv;
|
||||
/* pad is constant (zero) unless compute_key is external */
|
||||
if (pad > 0) {
|
||||
memmove(key + pad, key, rv);
|
||||
memset(key, 0, pad);
|
||||
@@ -212,7 +239,7 @@ static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = BN_bn2bin(tmp, key);
|
||||
ret = BN_bn2binpad(tmp, key, BN_num_bytes(dh->p));
|
||||
err:
|
||||
BN_CTX_end(ctx);
|
||||
BN_CTX_free(ctx);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -49,9 +49,11 @@ int DSA_print(BIO *bp, const DSA *x, int off)
|
||||
EVP_PKEY *pk;
|
||||
int ret;
|
||||
pk = EVP_PKEY_new();
|
||||
if (pk == NULL || !EVP_PKEY_set1_DSA(pk, (DSA *)x))
|
||||
if (pk == NULL)
|
||||
return 0;
|
||||
ret = EVP_PKEY_print_private(bp, pk, off, NULL);
|
||||
ret = EVP_PKEY_set1_DSA(pk, (DSA *)x);
|
||||
if (ret)
|
||||
ret = EVP_PKEY_print_private(bp, pk, off, NULL);
|
||||
EVP_PKEY_free(pk);
|
||||
return ret;
|
||||
}
|
||||
@@ -61,9 +63,11 @@ int DSAparams_print(BIO *bp, const DSA *x)
|
||||
EVP_PKEY *pk;
|
||||
int ret;
|
||||
pk = EVP_PKEY_new();
|
||||
if (pk == NULL || !EVP_PKEY_set1_DSA(pk, (DSA *)x))
|
||||
if (pk == NULL)
|
||||
return 0;
|
||||
ret = EVP_PKEY_print_params(bp, pk, 4, NULL);
|
||||
ret = EVP_PKEY_set1_DSA(pk, (DSA *)x);
|
||||
if (ret)
|
||||
ret = EVP_PKEY_print_params(bp, pk, 4, NULL);
|
||||
EVP_PKEY_free(pk);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2011-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
@@ -247,9 +247,21 @@ int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
|
||||
ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_BUFFER_TOO_SMALL);
|
||||
return 0;
|
||||
}
|
||||
form = buf[0];
|
||||
y_bit = form & 1;
|
||||
form = form & ~1U;
|
||||
|
||||
/*
|
||||
* The first octet is the point converison octet PC, see X9.62, page 4
|
||||
* and section 4.4.2. It must be:
|
||||
* 0x00 for the point at infinity
|
||||
* 0x02 or 0x03 for compressed form
|
||||
* 0x04 for uncompressed form
|
||||
* 0x06 or 0x07 for hybrid form.
|
||||
* For compressed or hybrid forms, we store the last bit of buf[0] as
|
||||
* y_bit and clear it from buf[0] so as to obtain a POINT_CONVERSION_*.
|
||||
* We error if buf[0] contains any but the above values.
|
||||
*/
|
||||
y_bit = buf[0] & 1;
|
||||
form = buf[0] & ~1U;
|
||||
|
||||
if ((form != 0) && (form != POINT_CONVERSION_COMPRESSED)
|
||||
&& (form != POINT_CONVERSION_UNCOMPRESSED)
|
||||
&& (form != POINT_CONVERSION_HYBRID)) {
|
||||
@@ -261,6 +273,7 @@ int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The point at infinity is represented by a single zero octet. */
|
||||
if (form == 0) {
|
||||
if (len != 1) {
|
||||
ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
|
||||
@@ -312,11 +325,23 @@ int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
|
||||
goto err;
|
||||
}
|
||||
if (form == POINT_CONVERSION_HYBRID) {
|
||||
if (!group->meth->field_div(group, yxi, y, x, ctx))
|
||||
goto err;
|
||||
if (y_bit != BN_is_odd(yxi)) {
|
||||
ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING);
|
||||
goto err;
|
||||
/*
|
||||
* Check that the form in the encoding was set correctly
|
||||
* according to X9.62 4.4.2.a, 4(c), see also first paragraph
|
||||
* of X9.62, 4.4.1.b.
|
||||
*/
|
||||
if (BN_is_zero(x)) {
|
||||
if (y_bit != 0) {
|
||||
ECerr(ERR_LIB_EC, EC_R_INVALID_ENCODING);
|
||||
goto err;
|
||||
}
|
||||
} else {
|
||||
if (!group->meth->field_div(group, yxi, y, x, ctx))
|
||||
goto err;
|
||||
if (y_bit != BN_is_odd(yxi)) {
|
||||
ECerr(ERR_LIB_EC, EC_R_INVALID_ENCODING);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -761,7 +761,10 @@ EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params)
|
||||
ret->seed_len = params->curve->seed->length;
|
||||
}
|
||||
|
||||
if (!params->order || !params->base || !params->base->data) {
|
||||
if (params->order == NULL
|
||||
|| params->base == NULL
|
||||
|| params->base->data == NULL
|
||||
|| params->base->length == 0) {
|
||||
ECerr(EC_F_EC_GROUP_NEW_FROM_ECPARAMETERS, EC_R_ASN1_ERROR);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -758,8 +758,9 @@ static int devcrypto_unload(ENGINE *e)
|
||||
void engine_load_devcrypto_int()
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
int fd;
|
||||
|
||||
if ((cfd = open("/dev/crypto", O_RDWR, 0)) < 0) {
|
||||
if ((fd = open("/dev/crypto", O_RDWR, 0)) < 0) {
|
||||
#ifndef ENGINE_DEVCRYPTO_DEBUG
|
||||
if (errno != ENOENT)
|
||||
#endif
|
||||
@@ -767,6 +768,18 @@ void engine_load_devcrypto_int()
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CRIOGET
|
||||
if (ioctl(fd, CRIOGET, &cfd) < 0) {
|
||||
fprintf(stderr, "Could not create crypto fd: %s\n", strerror(errno));
|
||||
close(fd);
|
||||
cfd = -1;
|
||||
return;
|
||||
}
|
||||
close(fd);
|
||||
#else
|
||||
cfd = fd;
|
||||
#endif
|
||||
|
||||
if ((e = ENGINE_new()) == NULL
|
||||
|| !ENGINE_set_destroy_function(e, devcrypto_unload)) {
|
||||
ENGINE_free(e);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
# Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the OpenSSL license (the "License"). You may not use
|
||||
# this file except in compliance with the License. You can obtain a copy
|
||||
@@ -1160,6 +1160,7 @@ SSL_F_FINAL_EC_PT_FORMATS:485:final_ec_pt_formats
|
||||
SSL_F_FINAL_EMS:486:final_ems
|
||||
SSL_F_FINAL_KEY_SHARE:503:final_key_share
|
||||
SSL_F_FINAL_MAXFRAGMENTLEN:557:final_maxfragmentlen
|
||||
SSL_F_FINAL_PSK:639:final_psk
|
||||
SSL_F_FINAL_RENEGOTIATE:483:final_renegotiate
|
||||
SSL_F_FINAL_SERVER_NAME:558:final_server_name
|
||||
SSL_F_FINAL_SIG_ALGS:497:final_sig_algs
|
||||
@@ -1652,6 +1653,7 @@ X509V3_F_I2S_ASN1_ENUMERATED:121:i2s_ASN1_ENUMERATED
|
||||
X509V3_F_I2S_ASN1_IA5STRING:149:i2s_ASN1_IA5STRING
|
||||
X509V3_F_I2S_ASN1_INTEGER:120:i2s_ASN1_INTEGER
|
||||
X509V3_F_I2V_AUTHORITY_INFO_ACCESS:138:i2v_AUTHORITY_INFO_ACCESS
|
||||
X509V3_F_I2V_AUTHORITY_KEYID:173:i2v_AUTHORITY_KEYID
|
||||
X509V3_F_LEVEL_ADD_NODE:168:level_add_node
|
||||
X509V3_F_NOTICE_SECTION:132:notice_section
|
||||
X509V3_F_NREF_NOS:133:nref_nos
|
||||
@@ -1692,6 +1694,7 @@ X509V3_F_V2I_SUBJECT_ALT:154:v2i_subject_alt
|
||||
X509V3_F_V2I_TLS_FEATURE:165:v2i_TLS_FEATURE
|
||||
X509V3_F_V3_GENERIC_EXTENSION:116:v3_generic_extension
|
||||
X509V3_F_X509V3_ADD1_I2D:140:X509V3_add1_i2d
|
||||
X509V3_F_X509V3_ADD_LEN_VALUE:174:x509v3_add_len_value
|
||||
X509V3_F_X509V3_ADD_VALUE:105:X509V3_add_value
|
||||
X509V3_F_X509V3_EXT_ADD:104:X509V3_EXT_add
|
||||
X509V3_F_X509V3_EXT_ADD_ALIAS:106:X509V3_EXT_add_alias
|
||||
@@ -2283,6 +2286,7 @@ EVP_R_ONLY_ONESHOT_SUPPORTED:177:only oneshot supported
|
||||
EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE:150:\
|
||||
operation not supported for this keytype
|
||||
EVP_R_OPERATON_NOT_INITIALIZED:151:operaton not initialized
|
||||
EVP_R_OUTPUT_WOULD_OVERFLOW:184:output would overflow
|
||||
EVP_R_PARTIALLY_OVERLAPPING:162:partially overlapping buffers
|
||||
EVP_R_PBKDF2_ERROR:181:pbkdf2 error
|
||||
EVP_R_PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED:179:\
|
||||
@@ -2740,6 +2744,7 @@ SSL_R_MISSING_DSA_SIGNING_CERT:165:missing dsa signing cert
|
||||
SSL_R_MISSING_ECDSA_SIGNING_CERT:381:missing ecdsa signing cert
|
||||
SSL_R_MISSING_FATAL:256:missing fatal
|
||||
SSL_R_MISSING_PARAMETERS:290:missing parameters
|
||||
SSL_R_MISSING_PSK_KEX_MODES_EXTENSION:310:missing psk kex modes extension
|
||||
SSL_R_MISSING_RSA_CERTIFICATE:168:missing rsa certificate
|
||||
SSL_R_MISSING_RSA_ENCRYPTING_CERT:169:missing rsa encrypting cert
|
||||
SSL_R_MISSING_RSA_SIGNING_CERT:170:missing rsa signing cert
|
||||
@@ -2783,6 +2788,7 @@ SSL_R_NO_VALID_SCTS:216:no valid scts
|
||||
SSL_R_NO_VERIFY_COOKIE_CALLBACK:403:no verify cookie callback
|
||||
SSL_R_NULL_SSL_CTX:195:null ssl ctx
|
||||
SSL_R_NULL_SSL_METHOD_PASSED:196:null ssl method passed
|
||||
SSL_R_OCSP_CALLBACK_FAILURE:294:ocsp callback failure
|
||||
SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED:197:old session cipher not returned
|
||||
SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED:344:\
|
||||
old session compression algorithm not returned
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -611,22 +611,22 @@ void aes_t4_decrypt(const unsigned char *in, unsigned char *out,
|
||||
*/
|
||||
void aes128_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const AES_KEY *key,
|
||||
unsigned char *ivec);
|
||||
unsigned char *ivec, int /*unused*/);
|
||||
void aes128_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const AES_KEY *key,
|
||||
unsigned char *ivec);
|
||||
unsigned char *ivec, int /*unused*/);
|
||||
void aes192_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const AES_KEY *key,
|
||||
unsigned char *ivec);
|
||||
unsigned char *ivec, int /*unused*/);
|
||||
void aes192_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const AES_KEY *key,
|
||||
unsigned char *ivec);
|
||||
unsigned char *ivec, int /*unused*/);
|
||||
void aes256_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const AES_KEY *key,
|
||||
unsigned char *ivec);
|
||||
unsigned char *ivec, int /*unused*/);
|
||||
void aes256_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const AES_KEY *key,
|
||||
unsigned char *ivec);
|
||||
unsigned char *ivec, int /*unused*/);
|
||||
void aes128_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const AES_KEY *key,
|
||||
unsigned char *ivec);
|
||||
@@ -1168,9 +1168,9 @@ typedef struct {
|
||||
static int s390x_aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
const unsigned char *iv, int enc);
|
||||
|
||||
# define S390X_aes_128_cbc_CAPABLE 1 /* checked by callee */
|
||||
# define S390X_aes_192_cbc_CAPABLE 1
|
||||
# define S390X_aes_256_cbc_CAPABLE 1
|
||||
# define S390X_aes_128_cbc_CAPABLE 0 /* checked by callee */
|
||||
# define S390X_aes_192_cbc_CAPABLE 0
|
||||
# define S390X_aes_256_cbc_CAPABLE 0
|
||||
# define S390X_AES_CBC_CTX EVP_AES_KEY
|
||||
|
||||
# define s390x_aes_cbc_init_key aes_init_key
|
||||
@@ -1190,11 +1190,11 @@ static int s390x_aes_ecb_init_key(EVP_CIPHER_CTX *ctx,
|
||||
S390X_AES_ECB_CTX *cctx = EVP_C_DATA(S390X_AES_ECB_CTX, ctx);
|
||||
const int keylen = EVP_CIPHER_CTX_key_length(ctx);
|
||||
|
||||
cctx->fc = S390X_AES_FC(keylen);
|
||||
if (!enc)
|
||||
cctx->fc |= S390X_DECRYPT;
|
||||
cctx->fc = S390X_AES_FC(keylen) | (enc ? 0 : S390X_DECRYPT);
|
||||
|
||||
if (key != NULL)
|
||||
memcpy(cctx->km.param.k, key, keylen);
|
||||
|
||||
memcpy(cctx->km.param.k, key, keylen);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1222,14 +1222,17 @@ static int s390x_aes_ofb_init_key(EVP_CIPHER_CTX *ctx,
|
||||
const unsigned char *ivec, int enc)
|
||||
{
|
||||
S390X_AES_OFB_CTX *cctx = EVP_C_DATA(S390X_AES_OFB_CTX, ctx);
|
||||
const unsigned char *iv = EVP_CIPHER_CTX_original_iv(ctx);
|
||||
const unsigned char *oiv = EVP_CIPHER_CTX_original_iv(ctx);
|
||||
const int keylen = EVP_CIPHER_CTX_key_length(ctx);
|
||||
const int ivlen = EVP_CIPHER_CTX_iv_length(ctx);
|
||||
|
||||
memcpy(cctx->kmo.param.cv, iv, ivlen);
|
||||
memcpy(cctx->kmo.param.k, key, keylen);
|
||||
cctx->fc = S390X_AES_FC(keylen);
|
||||
|
||||
if (key != NULL)
|
||||
memcpy(cctx->kmo.param.k, key, keylen);
|
||||
|
||||
cctx->res = 0;
|
||||
memcpy(cctx->kmo.param.cv, oiv, ivlen);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1237,9 +1240,12 @@ static int s390x_aes_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len)
|
||||
{
|
||||
S390X_AES_OFB_CTX *cctx = EVP_C_DATA(S390X_AES_OFB_CTX, ctx);
|
||||
const int ivlen = EVP_CIPHER_CTX_iv_length(ctx);
|
||||
unsigned char *iv = EVP_CIPHER_CTX_iv_noconst(ctx);
|
||||
int n = cctx->res;
|
||||
int rem;
|
||||
|
||||
memcpy(cctx->kmo.param.cv, iv, ivlen);
|
||||
while (n && len) {
|
||||
*out = *in ^ cctx->kmo.param.cv[n];
|
||||
n = (n + 1) & 0xf;
|
||||
@@ -1268,6 +1274,7 @@ static int s390x_aes_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(iv, cctx->kmo.param.cv, ivlen);
|
||||
cctx->res = n;
|
||||
return 1;
|
||||
}
|
||||
@@ -1287,18 +1294,18 @@ static int s390x_aes_cfb_init_key(EVP_CIPHER_CTX *ctx,
|
||||
const unsigned char *ivec, int enc)
|
||||
{
|
||||
S390X_AES_CFB_CTX *cctx = EVP_C_DATA(S390X_AES_CFB_CTX, ctx);
|
||||
const unsigned char *iv = EVP_CIPHER_CTX_original_iv(ctx);
|
||||
const unsigned char *oiv = EVP_CIPHER_CTX_original_iv(ctx);
|
||||
const int keylen = EVP_CIPHER_CTX_key_length(ctx);
|
||||
const int ivlen = EVP_CIPHER_CTX_iv_length(ctx);
|
||||
|
||||
cctx->fc = S390X_AES_FC(keylen);
|
||||
cctx->fc |= 16 << 24; /* 16 bytes cipher feedback */
|
||||
if (!enc)
|
||||
cctx->fc |= S390X_DECRYPT;
|
||||
cctx->fc = S390X_AES_FC(keylen) | (enc ? 0 : S390X_DECRYPT)
|
||||
| (16 << 24); /* 16 bytes cipher feedback */
|
||||
|
||||
if (key != NULL)
|
||||
memcpy(cctx->kmf.param.k, key, keylen);
|
||||
|
||||
cctx->res = 0;
|
||||
memcpy(cctx->kmf.param.cv, iv, ivlen);
|
||||
memcpy(cctx->kmf.param.k, key, keylen);
|
||||
memcpy(cctx->kmf.param.cv, oiv, ivlen);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1308,10 +1315,13 @@ static int s390x_aes_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
S390X_AES_CFB_CTX *cctx = EVP_C_DATA(S390X_AES_CFB_CTX, ctx);
|
||||
const int keylen = EVP_CIPHER_CTX_key_length(ctx);
|
||||
const int enc = EVP_CIPHER_CTX_encrypting(ctx);
|
||||
const int ivlen = EVP_CIPHER_CTX_iv_length(ctx);
|
||||
unsigned char *iv = EVP_CIPHER_CTX_iv_noconst(ctx);
|
||||
int n = cctx->res;
|
||||
int rem;
|
||||
unsigned char tmp;
|
||||
|
||||
memcpy(cctx->kmf.param.cv, iv, ivlen);
|
||||
while (n && len) {
|
||||
tmp = *in;
|
||||
*out = cctx->kmf.param.cv[n] ^ tmp;
|
||||
@@ -1344,6 +1354,7 @@ static int s390x_aes_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(iv, cctx->kmf.param.cv, ivlen);
|
||||
cctx->res = n;
|
||||
return 1;
|
||||
}
|
||||
@@ -1360,17 +1371,18 @@ static int s390x_aes_cfb8_init_key(EVP_CIPHER_CTX *ctx,
|
||||
const unsigned char *ivec, int enc)
|
||||
{
|
||||
S390X_AES_CFB_CTX *cctx = EVP_C_DATA(S390X_AES_CFB_CTX, ctx);
|
||||
const unsigned char *iv = EVP_CIPHER_CTX_original_iv(ctx);
|
||||
const unsigned char *oiv = EVP_CIPHER_CTX_original_iv(ctx);
|
||||
const int keylen = EVP_CIPHER_CTX_key_length(ctx);
|
||||
const int ivlen = EVP_CIPHER_CTX_iv_length(ctx);
|
||||
|
||||
cctx->fc = S390X_AES_FC(keylen);
|
||||
cctx->fc |= 1 << 24; /* 1 byte cipher feedback */
|
||||
if (!enc)
|
||||
cctx->fc |= S390X_DECRYPT;
|
||||
cctx->fc = S390X_AES_FC(keylen) | (enc ? 0 : S390X_DECRYPT)
|
||||
| (1 << 24); /* 1 byte cipher feedback flag */
|
||||
|
||||
memcpy(cctx->kmf.param.cv, iv, ivlen);
|
||||
memcpy(cctx->kmf.param.k, key, keylen);
|
||||
if (key != NULL)
|
||||
memcpy(cctx->kmf.param.k, key, keylen);
|
||||
|
||||
cctx->res = 0;
|
||||
memcpy(cctx->kmf.param.cv, oiv, ivlen);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1378,8 +1390,12 @@ static int s390x_aes_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len)
|
||||
{
|
||||
S390X_AES_CFB_CTX *cctx = EVP_C_DATA(S390X_AES_CFB_CTX, ctx);
|
||||
const int ivlen = EVP_CIPHER_CTX_iv_length(ctx);
|
||||
unsigned char *iv = EVP_CIPHER_CTX_iv_noconst(ctx);
|
||||
|
||||
memcpy(cctx->kmf.param.cv, iv, ivlen);
|
||||
s390x_kmf(in, len, out, cctx->fc, &cctx->kmf.param);
|
||||
memcpy(iv, cctx->kmf.param.cv, ivlen);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1393,9 +1409,9 @@ static int s390x_aes_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
static int s390x_aes_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len);
|
||||
|
||||
# define S390X_aes_128_ctr_CAPABLE 1 /* checked by callee */
|
||||
# define S390X_aes_192_ctr_CAPABLE 1
|
||||
# define S390X_aes_256_ctr_CAPABLE 1
|
||||
# define S390X_aes_128_ctr_CAPABLE 0 /* checked by callee */
|
||||
# define S390X_aes_192_ctr_CAPABLE 0
|
||||
# define S390X_aes_256_ctr_CAPABLE 0
|
||||
# define S390X_AES_CTR_CTX EVP_AES_KEY
|
||||
|
||||
# define s390x_aes_ctr_init_key aes_init_key
|
||||
@@ -1563,8 +1579,7 @@ static int s390x_aes_gcm(S390X_AES_GCM_CTX *ctx, const unsigned char *in,
|
||||
/*-
|
||||
* Initialize context structure. Code is big-endian.
|
||||
*/
|
||||
static void s390x_aes_gcm_setiv(S390X_AES_GCM_CTX *ctx,
|
||||
const unsigned char *iv)
|
||||
static void s390x_aes_gcm_setiv(S390X_AES_GCM_CTX *ctx)
|
||||
{
|
||||
ctx->kma.param.t.g[0] = 0;
|
||||
ctx->kma.param.t.g[1] = 0;
|
||||
@@ -1575,12 +1590,11 @@ static void s390x_aes_gcm_setiv(S390X_AES_GCM_CTX *ctx,
|
||||
ctx->kreslen = 0;
|
||||
|
||||
if (ctx->ivlen == 12) {
|
||||
memcpy(&ctx->kma.param.j0, iv, ctx->ivlen);
|
||||
memcpy(&ctx->kma.param.j0, ctx->iv, ctx->ivlen);
|
||||
ctx->kma.param.j0.w[3] = 1;
|
||||
ctx->kma.param.cv.w = 1;
|
||||
} else {
|
||||
/* ctx->iv has the right size and is already padded. */
|
||||
memcpy(ctx->iv, iv, ctx->ivlen);
|
||||
s390x_kma(ctx->iv, S390X_gcm_ivpadlen(ctx->ivlen), NULL, 0, NULL,
|
||||
ctx->fc, &ctx->kma.param);
|
||||
ctx->fc |= S390X_KMA_HS;
|
||||
@@ -1694,7 +1708,7 @@ static int s390x_aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
|
||||
if (gctx->iv_gen == 0 || gctx->key_set == 0)
|
||||
return 0;
|
||||
|
||||
s390x_aes_gcm_setiv(gctx, gctx->iv);
|
||||
s390x_aes_gcm_setiv(gctx);
|
||||
|
||||
if (arg <= 0 || arg > gctx->ivlen)
|
||||
arg = gctx->ivlen;
|
||||
@@ -1714,7 +1728,7 @@ static int s390x_aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
|
||||
return 0;
|
||||
|
||||
memcpy(gctx->iv + gctx->ivlen - arg, ptr, arg);
|
||||
s390x_aes_gcm_setiv(gctx, gctx->iv);
|
||||
s390x_aes_gcm_setiv(gctx);
|
||||
gctx->iv_set = 1;
|
||||
return 1;
|
||||
|
||||
@@ -1770,43 +1784,36 @@ static int s390x_aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
|
||||
}
|
||||
|
||||
/*-
|
||||
* Set key and/or iv. Returns 1 on success. Otherwise 0 is returned.
|
||||
* Set key or iv or enc/dec. Returns 1 on success. Otherwise 0 is returned.
|
||||
*/
|
||||
static int s390x_aes_gcm_init_key(EVP_CIPHER_CTX *ctx,
|
||||
const unsigned char *key,
|
||||
const unsigned char *iv, int enc)
|
||||
{
|
||||
S390X_AES_GCM_CTX *gctx = EVP_C_DATA(S390X_AES_GCM_CTX, ctx);
|
||||
int keylen;
|
||||
const int keylen = EVP_CIPHER_CTX_key_length(ctx);
|
||||
|
||||
if (iv == NULL && key == NULL)
|
||||
return 1;
|
||||
gctx->fc = S390X_AES_FC(keylen) | (enc ? 0 : S390X_DECRYPT);
|
||||
|
||||
if (key != NULL) {
|
||||
keylen = EVP_CIPHER_CTX_key_length(ctx);
|
||||
gctx->fc &= ~S390X_KMA_HS;
|
||||
memcpy(&gctx->kma.param.k, key, keylen);
|
||||
|
||||
gctx->fc = S390X_AES_FC(keylen);
|
||||
if (!enc)
|
||||
gctx->fc |= S390X_DECRYPT;
|
||||
|
||||
if (iv == NULL && gctx->iv_set)
|
||||
iv = gctx->iv;
|
||||
|
||||
if (iv != NULL) {
|
||||
s390x_aes_gcm_setiv(gctx, iv);
|
||||
gctx->iv_set = 1;
|
||||
}
|
||||
gctx->key_set = 1;
|
||||
} else {
|
||||
if (gctx->key_set)
|
||||
s390x_aes_gcm_setiv(gctx, iv);
|
||||
else
|
||||
memcpy(gctx->iv, iv, gctx->ivlen);
|
||||
|
||||
gctx->iv_set = 1;
|
||||
gctx->iv_gen = 0;
|
||||
}
|
||||
|
||||
if (iv != NULL) {
|
||||
memcpy(gctx->iv, iv, gctx->ivlen);
|
||||
gctx->iv_gen = 0;
|
||||
gctx->iv_set = 1;
|
||||
}
|
||||
|
||||
if (gctx->key_set && gctx->iv_set)
|
||||
s390x_aes_gcm_setiv(gctx);
|
||||
|
||||
gctx->fc &= ~(S390X_KMA_LPC | S390X_KMA_LAAD);
|
||||
gctx->areslen = 0;
|
||||
gctx->mreslen = 0;
|
||||
gctx->kreslen = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1895,7 +1902,6 @@ static int s390x_aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
/* recall that we already did en-/decrypt gctx->mres
|
||||
* and returned it to caller... */
|
||||
OPENSSL_cleanse(tmp, gctx->mreslen);
|
||||
gctx->iv_set = 0;
|
||||
|
||||
enc = EVP_CIPHER_CTX_encrypting(ctx);
|
||||
if (enc) {
|
||||
@@ -1929,8 +1935,8 @@ static int s390x_aes_gcm_cleanup(EVP_CIPHER_CTX *c)
|
||||
}
|
||||
|
||||
# define S390X_AES_XTS_CTX EVP_AES_XTS_CTX
|
||||
# define S390X_aes_128_xts_CAPABLE 1 /* checked by callee */
|
||||
# define S390X_aes_256_xts_CAPABLE 1
|
||||
# define S390X_aes_128_xts_CAPABLE 0 /* checked by callee */
|
||||
# define S390X_aes_256_xts_CAPABLE 0
|
||||
|
||||
# define s390x_aes_xts_init_key aes_xts_init_key
|
||||
static int s390x_aes_xts_init_key(EVP_CIPHER_CTX *ctx,
|
||||
@@ -2134,9 +2140,10 @@ static int s390x_aes_ccm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len)
|
||||
{
|
||||
S390X_AES_CCM_CTX *cctx = EVP_C_DATA(S390X_AES_CCM_CTX, ctx);
|
||||
unsigned char *ivec = EVP_CIPHER_CTX_iv_noconst(ctx);
|
||||
const unsigned char *ivec = EVP_CIPHER_CTX_iv(ctx);
|
||||
unsigned char *buf = EVP_CIPHER_CTX_buf_noconst(ctx);
|
||||
const int enc = EVP_CIPHER_CTX_encrypting(ctx);
|
||||
unsigned char iv[EVP_MAX_IV_LENGTH];
|
||||
|
||||
if (out != in
|
||||
|| len < (EVP_CCM_TLS_EXPLICIT_IV_LEN + (size_t)cctx->aes.ccm.m))
|
||||
@@ -2152,8 +2159,9 @@ static int s390x_aes_ccm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
* Get explicit iv (sequence number). We already have fixed iv
|
||||
* (server/client_write_iv) here.
|
||||
*/
|
||||
memcpy(ivec + EVP_CCM_TLS_FIXED_IV_LEN, in, EVP_CCM_TLS_EXPLICIT_IV_LEN);
|
||||
s390x_aes_ccm_setiv(cctx, ivec, len);
|
||||
memcpy(iv, ivec, sizeof(iv));
|
||||
memcpy(iv + EVP_CCM_TLS_FIXED_IV_LEN, in, EVP_CCM_TLS_EXPLICIT_IV_LEN);
|
||||
s390x_aes_ccm_setiv(cctx, iv, len);
|
||||
|
||||
/* Process aad (sequence number|type|version|length) */
|
||||
s390x_aes_ccm_aad(cctx, buf, cctx->aes.ccm.tls_aad_len);
|
||||
@@ -2180,42 +2188,35 @@ static int s390x_aes_ccm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
}
|
||||
|
||||
/*-
|
||||
* Set key and flag field and/or iv. Returns 1 if successful. Otherwise 0 is
|
||||
* returned.
|
||||
* Set key or iv or enc/dec. Returns 1 if successful.
|
||||
* Otherwise 0 is returned.
|
||||
*/
|
||||
static int s390x_aes_ccm_init_key(EVP_CIPHER_CTX *ctx,
|
||||
const unsigned char *key,
|
||||
const unsigned char *iv, int enc)
|
||||
{
|
||||
S390X_AES_CCM_CTX *cctx = EVP_C_DATA(S390X_AES_CCM_CTX, ctx);
|
||||
unsigned char *ivec;
|
||||
int keylen;
|
||||
const int keylen = EVP_CIPHER_CTX_key_length(ctx);
|
||||
unsigned char *ivec = EVP_CIPHER_CTX_iv_noconst(ctx);
|
||||
|
||||
if (iv == NULL && key == NULL)
|
||||
return 1;
|
||||
cctx->aes.ccm.fc = S390X_AES_FC(keylen);
|
||||
|
||||
if (key != NULL) {
|
||||
keylen = EVP_CIPHER_CTX_key_length(ctx);
|
||||
cctx->aes.ccm.fc = S390X_AES_FC(keylen);
|
||||
memcpy(cctx->aes.ccm.kmac_param.k, key, keylen);
|
||||
|
||||
/* Store encoded m and l. */
|
||||
cctx->aes.ccm.nonce.b[0] = ((cctx->aes.ccm.l - 1) & 0x7)
|
||||
| (((cctx->aes.ccm.m - 2) >> 1) & 0x7) << 3;
|
||||
memset(cctx->aes.ccm.nonce.b + 1, 0,
|
||||
sizeof(cctx->aes.ccm.nonce.b));
|
||||
cctx->aes.ccm.blocks = 0;
|
||||
|
||||
cctx->aes.ccm.key_set = 1;
|
||||
}
|
||||
|
||||
if (iv != NULL) {
|
||||
ivec = EVP_CIPHER_CTX_iv_noconst(ctx);
|
||||
memcpy(ivec, iv, 15 - cctx->aes.ccm.l);
|
||||
|
||||
cctx->aes.ccm.iv_set = 1;
|
||||
}
|
||||
|
||||
/* Store encoded m and l. */
|
||||
cctx->aes.ccm.nonce.b[0] = ((cctx->aes.ccm.l - 1) & 0x7)
|
||||
| (((cctx->aes.ccm.m - 2) >> 1) & 0x7) << 3;
|
||||
memset(cctx->aes.ccm.nonce.b + 1, 0, sizeof(cctx->aes.ccm.nonce.b) - 1);
|
||||
|
||||
cctx->aes.ccm.blocks = 0;
|
||||
cctx->aes.ccm.len_set = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2230,8 +2231,9 @@ static int s390x_aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
{
|
||||
S390X_AES_CCM_CTX *cctx = EVP_C_DATA(S390X_AES_CCM_CTX, ctx);
|
||||
const int enc = EVP_CIPHER_CTX_encrypting(ctx);
|
||||
const unsigned char *ivec = EVP_CIPHER_CTX_iv(ctx);
|
||||
unsigned char *buf;
|
||||
int rv;
|
||||
unsigned char *buf, *ivec;
|
||||
|
||||
if (!cctx->aes.ccm.key_set)
|
||||
return -1;
|
||||
@@ -2253,7 +2255,6 @@ static int s390x_aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
if (out == NULL) {
|
||||
/* Update(): Pass message length. */
|
||||
if (in == NULL) {
|
||||
ivec = EVP_CIPHER_CTX_iv_noconst(ctx);
|
||||
s390x_aes_ccm_setiv(cctx, ivec, len);
|
||||
|
||||
cctx->aes.ccm.len_set = 1;
|
||||
@@ -2279,7 +2280,6 @@ static int s390x_aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
* In case message length was not previously set explicitly via
|
||||
* Update(), set it now.
|
||||
*/
|
||||
ivec = EVP_CIPHER_CTX_iv_noconst(ctx);
|
||||
s390x_aes_ccm_setiv(cctx, ivec, len);
|
||||
|
||||
cctx->aes.ccm.len_set = 1;
|
||||
@@ -2304,9 +2304,6 @@ static int s390x_aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
if (rv == -1)
|
||||
OPENSSL_cleanse(out, len);
|
||||
|
||||
cctx->aes.ccm.iv_set = 0;
|
||||
cctx->aes.ccm.tag_set = 0;
|
||||
cctx->aes.ccm.len_set = 0;
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
@@ -2414,9 +2411,6 @@ static int s390x_aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
|
||||
return 0;
|
||||
|
||||
memcpy(ptr, cctx->aes.ccm.kmac_param.icv.b, cctx->aes.ccm.m);
|
||||
cctx->aes.ccm.tag_set = 0;
|
||||
cctx->aes.ccm.iv_set = 0;
|
||||
cctx->aes.ccm.len_set = 0;
|
||||
return 1;
|
||||
|
||||
case EVP_CTRL_COPY:
|
||||
@@ -2453,7 +2447,7 @@ static const EVP_CIPHER s390x_aes_##keylen##_##mode = { \
|
||||
nid##_##keylen##_##nmode,blocksize, \
|
||||
keylen / 8, \
|
||||
ivlen, \
|
||||
flags | EVP_CIPH_##MODE##_MODE, \
|
||||
flags | EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_##MODE##_MODE, \
|
||||
s390x_aes_##mode##_init_key, \
|
||||
s390x_aes_##mode##_cipher, \
|
||||
NULL, \
|
||||
@@ -2490,7 +2484,7 @@ static const EVP_CIPHER s390x_aes_##keylen##_##mode = { \
|
||||
blocksize, \
|
||||
(EVP_CIPH_##MODE##_MODE == EVP_CIPH_XTS_MODE ? 2 : 1) * keylen / 8, \
|
||||
ivlen, \
|
||||
flags | EVP_CIPH_##MODE##_MODE, \
|
||||
flags | EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_##MODE##_MODE, \
|
||||
s390x_aes_##mode##_init_key, \
|
||||
s390x_aes_##mode##_cipher, \
|
||||
s390x_aes_##mode##_cleanup, \
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -55,16 +55,16 @@ void cmll_t4_decrypt(const unsigned char *in, unsigned char *out,
|
||||
|
||||
void cmll128_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec);
|
||||
unsigned char *ivec, int /*unused*/);
|
||||
void cmll128_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec);
|
||||
unsigned char *ivec, int /*unused*/);
|
||||
void cmll256_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec);
|
||||
unsigned char *ivec, int /*unused*/);
|
||||
void cmll256_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec);
|
||||
unsigned char *ivec, int /*unused*/);
|
||||
void cmll128_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <assert.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
@@ -355,6 +356,19 @@ static int evp_EncryptDecryptUpdate(EVP_CIPHER_CTX *ctx,
|
||||
return 1;
|
||||
} else {
|
||||
j = bl - i;
|
||||
|
||||
/*
|
||||
* Once we've processed the first j bytes from in, the amount of
|
||||
* data left that is a multiple of the block length is:
|
||||
* (inl - j) & ~(bl - 1)
|
||||
* We must ensure that this amount of data, plus the one block that
|
||||
* we process from ctx->buf does not exceed INT_MAX
|
||||
*/
|
||||
if (((inl - j) & ~(bl - 1)) > INT_MAX - bl) {
|
||||
EVPerr(EVP_F_EVP_ENCRYPTDECRYPTUPDATE,
|
||||
EVP_R_OUTPUT_WOULD_OVERFLOW);
|
||||
return 0;
|
||||
}
|
||||
memcpy(&(ctx->buf[i]), in, j);
|
||||
inl -= j;
|
||||
in += j;
|
||||
@@ -502,6 +516,19 @@ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
|
||||
EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* final_used is only ever set if buf_len is 0. Therefore the maximum
|
||||
* length output we will ever see from evp_EncryptDecryptUpdate is
|
||||
* the maximum multiple of the block length that is <= inl, or just:
|
||||
* inl & ~(b - 1)
|
||||
* Since final_used has been set then the final output length is:
|
||||
* (inl & ~(b - 1)) + b
|
||||
* This must never exceed INT_MAX
|
||||
*/
|
||||
if ((inl & ~(b - 1)) > INT_MAX - b) {
|
||||
EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_OUTPUT_WOULD_OVERFLOW);
|
||||
return 0;
|
||||
}
|
||||
memcpy(out, ctx->final, b);
|
||||
out += b;
|
||||
fix_len = 1;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -239,6 +239,8 @@ static const ERR_STRING_DATA EVP_str_reasons[] = {
|
||||
"operation not supported for this keytype"},
|
||||
{ERR_PACK(ERR_LIB_EVP, 0, EVP_R_OPERATON_NOT_INITIALIZED),
|
||||
"operaton not initialized"},
|
||||
{ERR_PACK(ERR_LIB_EVP, 0, EVP_R_OUTPUT_WOULD_OVERFLOW),
|
||||
"output would overflow"},
|
||||
{ERR_PACK(ERR_LIB_EVP, 0, EVP_R_PARTIALLY_OVERLAPPING),
|
||||
"partially overlapping buffers"},
|
||||
{ERR_PACK(ERR_LIB_EVP, 0, EVP_R_PBKDF2_ERROR), "pbkdf2 error"},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -47,7 +47,8 @@ static int hmac_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
|
||||
|
||||
static int hmac_pkey_public_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
|
||||
{
|
||||
return ASN1_OCTET_STRING_cmp(EVP_PKEY_get0(a), EVP_PKEY_get0(b));
|
||||
/* the ameth pub_cmp must return 1 on match, 0 on mismatch */
|
||||
return ASN1_OCTET_STRING_cmp(EVP_PKEY_get0(a), EVP_PKEY_get0(b)) == 0;
|
||||
}
|
||||
|
||||
static int hmac_set_priv_key(EVP_PKEY *pkey, const unsigned char *priv,
|
||||
|
||||
@@ -34,6 +34,12 @@
|
||||
# include <errno.h>
|
||||
# endif
|
||||
# endif
|
||||
# if defined(__FreeBSD__)
|
||||
# define MADV_DONTDUMP MADV_NOCORE
|
||||
# endif
|
||||
# if !defined(MAP_CONCEAL)
|
||||
# define MAP_CONCEAL 0
|
||||
# endif
|
||||
# include <sys/param.h>
|
||||
# include <sys/stat.h>
|
||||
# include <fcntl.h>
|
||||
@@ -442,7 +448,7 @@ static int sh_init(size_t size, int minsize)
|
||||
if (1) {
|
||||
#ifdef MAP_ANON
|
||||
sh.map_result = mmap(NULL, sh.map_size,
|
||||
PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0);
|
||||
PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE|MAP_CONCEAL, -1, 0);
|
||||
} else {
|
||||
#endif
|
||||
int fd;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -69,7 +69,8 @@ void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
in += 16;
|
||||
out += 16;
|
||||
}
|
||||
memcpy(ivec, iv, 16);
|
||||
if (ivec != iv)
|
||||
memcpy(ivec, iv, 16);
|
||||
}
|
||||
|
||||
void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
|
||||
@@ -114,7 +115,8 @@ void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
|
||||
out += 16;
|
||||
}
|
||||
}
|
||||
memcpy(ivec, iv, 16);
|
||||
if (ivec != iv)
|
||||
memcpy(ivec, iv, 16);
|
||||
} else {
|
||||
if (STRICT_ALIGNMENT &&
|
||||
((size_t)in | (size_t)out | (size_t)ivec) % sizeof(size_t) != 0) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2010-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -1385,8 +1385,8 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,
|
||||
else
|
||||
ctx->Yi.d[3] = ctr;
|
||||
for (i = 0; i < 16 / sizeof(size_t); ++i) {
|
||||
size_t c = in[i];
|
||||
out[i] = c ^ ctx->EKi.t[i];
|
||||
size_t c = in_t[i];
|
||||
out_t[i] = c ^ ctx->EKi.t[i];
|
||||
ctx->Xi.t[i] ^= c;
|
||||
}
|
||||
GCM_MUL(ctx);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -133,8 +133,8 @@ int OPENSSL_gmtime_diff(int *pday, int *psec,
|
||||
static int julian_adj(const struct tm *tm, int off_day, long offset_sec,
|
||||
long *pday, int *psec)
|
||||
{
|
||||
int offset_hms, offset_day;
|
||||
long time_jd;
|
||||
int offset_hms;
|
||||
long offset_day, time_jd;
|
||||
int time_year, time_month, time_day;
|
||||
/* split offset into days and day seconds */
|
||||
offset_day = offset_sec / SECS_PER_DAY;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* WARNING: do not edit!
|
||||
* Generated by crypto/objects/obj_dat.pl
|
||||
*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* WARNING: do not edit!
|
||||
* Generated by objxref.pl
|
||||
*
|
||||
* Copyright 1998-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1998-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -101,7 +101,7 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
|
||||
#endif
|
||||
v = EVP_MD_block_size(md_type);
|
||||
u = EVP_MD_size(md_type);
|
||||
if (u < 0 || v <= 0)
|
||||
if (u <= 0 || v <= 0)
|
||||
goto err;
|
||||
D = OPENSSL_malloc(v);
|
||||
Ai = OPENSSL_malloc(u);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#! /usr/bin/env perl
|
||||
# Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
# Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the OpenSSL license (the "License"). You may not use
|
||||
# this file except in compliance with the License. You can obtain a copy
|
||||
@@ -133,10 +133,10 @@ poly1305_init:
|
||||
# ifdef __thumb2__
|
||||
itete eq
|
||||
# endif
|
||||
addeq r12,r11,#(poly1305_emit-.Lpoly1305_init)
|
||||
addne r12,r11,#(poly1305_emit_neon-.Lpoly1305_init)
|
||||
addeq r11,r11,#(poly1305_blocks-.Lpoly1305_init)
|
||||
addne r11,r11,#(poly1305_blocks_neon-.Lpoly1305_init)
|
||||
addeq r12,r11,#(.Lpoly1305_emit-.Lpoly1305_init)
|
||||
addne r12,r11,#(.Lpoly1305_emit_neon-.Lpoly1305_init)
|
||||
addeq r11,r11,#(.Lpoly1305_blocks-.Lpoly1305_init)
|
||||
addne r11,r11,#(.Lpoly1305_blocks_neon-.Lpoly1305_init)
|
||||
# endif
|
||||
# ifdef __thumb2__
|
||||
orr r12,r12,#1 @ thumb-ify address
|
||||
@@ -352,6 +352,7 @@ $code.=<<___;
|
||||
.type poly1305_emit,%function
|
||||
.align 5
|
||||
poly1305_emit:
|
||||
.Lpoly1305_emit:
|
||||
stmdb sp!,{r4-r11}
|
||||
.Lpoly1305_emit_enter:
|
||||
|
||||
@@ -671,6 +672,7 @@ poly1305_init_neon:
|
||||
.type poly1305_blocks_neon,%function
|
||||
.align 5
|
||||
poly1305_blocks_neon:
|
||||
.Lpoly1305_blocks_neon:
|
||||
ldr ip,[$ctx,#36] @ is_base2_26
|
||||
ands $len,$len,#-16
|
||||
beq .Lno_data_neon
|
||||
@@ -1157,6 +1159,7 @@ poly1305_blocks_neon:
|
||||
.type poly1305_emit_neon,%function
|
||||
.align 5
|
||||
poly1305_emit_neon:
|
||||
.Lpoly1305_emit_neon:
|
||||
ldr ip,[$ctx,#36] @ is_base2_26
|
||||
|
||||
stmdb sp!,{r4-r11}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -43,7 +43,7 @@ static int poly1305_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
|
||||
|
||||
static int poly1305_pkey_public_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
|
||||
{
|
||||
return ASN1_OCTET_STRING_cmp(EVP_PKEY_get0(a), EVP_PKEY_get0(b));
|
||||
return ASN1_OCTET_STRING_cmp(EVP_PKEY_get0(a), EVP_PKEY_get0(b)) == 0;
|
||||
}
|
||||
|
||||
static int poly1305_set_priv_key(EVP_PKEY *pkey, const unsigned char *priv,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2009-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2009-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -211,6 +211,30 @@ size_t OPENSSL_instrument_bus2(unsigned int *out, size_t cnt, size_t max)
|
||||
# if __GLIBC_PREREQ(2, 16)
|
||||
# include <sys/auxv.h>
|
||||
# define OSSL_IMPLEMENT_GETAUXVAL
|
||||
# elif defined(__ANDROID_API__)
|
||||
/* see https://developer.android.google.cn/ndk/guides/cpu-features */
|
||||
# if __ANDROID_API__ >= 18
|
||||
# include <sys/auxv.h>
|
||||
# define OSSL_IMPLEMENT_GETAUXVAL
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
# include <sys/param.h>
|
||||
# if __FreeBSD_version >= 1200000
|
||||
# include <sys/auxv.h>
|
||||
# define OSSL_IMPLEMENT_GETAUXVAL
|
||||
|
||||
static unsigned long getauxval(unsigned long key)
|
||||
{
|
||||
unsigned long val = 0ul;
|
||||
|
||||
if (elf_aux_info((int)key, &val, sizeof(val)) != 0)
|
||||
return 0ul;
|
||||
|
||||
return val;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -432,9 +432,13 @@ err:
|
||||
RAND_POOL *rand_pool_new(int entropy_requested, int secure,
|
||||
size_t min_len, size_t max_len)
|
||||
{
|
||||
RAND_POOL *pool = OPENSSL_zalloc(sizeof(*pool));
|
||||
RAND_POOL *pool;
|
||||
size_t min_alloc_size = RAND_POOL_MIN_ALLOCATION(secure);
|
||||
|
||||
if (!RUN_ONCE(&rand_init, do_rand_init))
|
||||
return NULL;
|
||||
|
||||
pool = OPENSSL_zalloc(sizeof(*pool));
|
||||
if (pool == NULL) {
|
||||
RANDerr(RAND_F_RAND_POOL_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -34,6 +34,9 @@
|
||||
#if defined(__OpenBSD__)
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
#if defined(__APPLE__)
|
||||
# include <CommonCrypto/CommonRandom.h>
|
||||
#endif
|
||||
|
||||
#if defined(OPENSSL_SYS_UNIX) || defined(__DJGPP__)
|
||||
# include <sys/types.h>
|
||||
@@ -378,6 +381,11 @@ static ssize_t syscall_random(void *buf, size_t buflen)
|
||||
if (errno != ENOSYS)
|
||||
return -1;
|
||||
}
|
||||
# elif defined(__APPLE__)
|
||||
if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess)
|
||||
return (ssize_t)buflen;
|
||||
|
||||
return -1;
|
||||
# else
|
||||
union {
|
||||
void *p;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -34,9 +34,11 @@ int RSA_print(BIO *bp, const RSA *x, int off)
|
||||
EVP_PKEY *pk;
|
||||
int ret;
|
||||
pk = EVP_PKEY_new();
|
||||
if (pk == NULL || !EVP_PKEY_set1_RSA(pk, (RSA *)x))
|
||||
if (pk == NULL)
|
||||
return 0;
|
||||
ret = EVP_PKEY_print_private(bp, pk, off, NULL);
|
||||
ret = EVP_PKEY_set1_RSA(pk, (RSA *)x);
|
||||
if (ret)
|
||||
ret = EVP_PKEY_print_private(bp, pk, off, NULL);
|
||||
EVP_PKEY_free(pk);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -55,7 +55,7 @@ int RSA_padding_add_SSLv23(unsigned char *to, int tlen,
|
||||
|
||||
/*
|
||||
* Copy of RSA_padding_check_PKCS1_type_2 with a twist that rejects padding
|
||||
* if nul delimiter is not preceded by 8 consecutive 0x03 bytes. It also
|
||||
* if nul delimiter is preceded by 8 consecutive 0x03 bytes. It also
|
||||
* preserves error code reporting for backward compatibility.
|
||||
*/
|
||||
int RSA_padding_check_SSLv23(unsigned char *to, int tlen,
|
||||
@@ -122,7 +122,13 @@ int RSA_padding_check_SSLv23(unsigned char *to, int tlen,
|
||||
RSA_R_NULL_BEFORE_BLOCK_MISSING);
|
||||
mask = ~good;
|
||||
|
||||
good &= constant_time_ge(threes_in_row, 8);
|
||||
/*
|
||||
* Reject if nul delimiter is preceded by 8 consecutive 0x03 bytes. Note
|
||||
* that RFC5246 incorrectly states this the other way around, i.e. reject
|
||||
* if it is not preceded by 8 consecutive 0x03 bytes. However this is
|
||||
* corrected in subsequent errata for that RFC.
|
||||
*/
|
||||
good &= constant_time_lt(threes_in_row, 8);
|
||||
err = constant_time_select_int(mask | good, err,
|
||||
RSA_R_SSLV3_ROLLBACK_ATTACK);
|
||||
mask = ~good;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -44,7 +44,7 @@ static int siphash_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
|
||||
|
||||
static int siphash_pkey_public_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
|
||||
{
|
||||
return ASN1_OCTET_STRING_cmp(EVP_PKEY_get0(a), EVP_PKEY_get0(b));
|
||||
return ASN1_OCTET_STRING_cmp(EVP_PKEY_get0(a), EVP_PKEY_get0(b)) == 0;
|
||||
}
|
||||
|
||||
static int siphash_set_priv_key(EVP_PKEY *pkey, const unsigned char *priv,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2017 Ribose Inc. All Rights Reserved.
|
||||
* Ported from Ribose contributions from Botan.
|
||||
*
|
||||
@@ -61,29 +61,20 @@ static size_t ec_field_size(const EC_GROUP *group)
|
||||
return field_size;
|
||||
}
|
||||
|
||||
int sm2_plaintext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len,
|
||||
size_t *pt_size)
|
||||
int sm2_plaintext_size(const unsigned char *ct, size_t ct_size, size_t *pt_size)
|
||||
{
|
||||
const size_t field_size = ec_field_size(EC_KEY_get0_group(key));
|
||||
const int md_size = EVP_MD_size(digest);
|
||||
size_t overhead;
|
||||
struct SM2_Ciphertext_st *sm2_ctext = NULL;
|
||||
|
||||
if (md_size < 0) {
|
||||
SM2err(SM2_F_SM2_PLAINTEXT_SIZE, SM2_R_INVALID_DIGEST);
|
||||
return 0;
|
||||
}
|
||||
if (field_size == 0) {
|
||||
SM2err(SM2_F_SM2_PLAINTEXT_SIZE, SM2_R_INVALID_FIELD);
|
||||
return 0;
|
||||
}
|
||||
sm2_ctext = d2i_SM2_Ciphertext(NULL, &ct, ct_size);
|
||||
|
||||
overhead = 10 + 2 * field_size + (size_t)md_size;
|
||||
if (msg_len <= overhead) {
|
||||
if (sm2_ctext == NULL) {
|
||||
SM2err(SM2_F_SM2_PLAINTEXT_SIZE, SM2_R_INVALID_ENCODING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
*pt_size = msg_len - overhead;
|
||||
*pt_size = sm2_ctext->C2->length;
|
||||
SM2_Ciphertext_free(sm2_ctext);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -303,6 +294,10 @@ int sm2_decrypt(const EC_KEY *key,
|
||||
C2 = sm2_ctext->C2->data;
|
||||
C3 = sm2_ctext->C3->data;
|
||||
msg_len = sm2_ctext->C2->length;
|
||||
if (*ptext_len < (size_t)msg_len) {
|
||||
SM2err(SM2_F_SM2_DECRYPT, SM2_R_BUFFER_TOO_SMALL);
|
||||
goto done;
|
||||
}
|
||||
|
||||
ctx = BN_CTX_new();
|
||||
if (ctx == NULL) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -151,7 +151,7 @@ static int pkey_sm2_decrypt(EVP_PKEY_CTX *ctx,
|
||||
const EVP_MD *md = (dctx->md == NULL) ? EVP_sm3() : dctx->md;
|
||||
|
||||
if (out == NULL) {
|
||||
if (!sm2_plaintext_size(ec, md, inlen, outlen))
|
||||
if (!sm2_plaintext_size(in, inlen, outlen))
|
||||
return -1;
|
||||
else
|
||||
return 1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2005-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <unistd.h>
|
||||
#include <openssl/bn.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include "bn/bn_local.h" /* for definition of bn_mul_mont */
|
||||
|
||||
#include "sparc_arch.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2004-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright (c) 2004, EdelKey Project. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
@@ -177,6 +177,7 @@ BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g,
|
||||
const BIGNUM *x, const BIGNUM *a, const BIGNUM *u)
|
||||
{
|
||||
BIGNUM *tmp = NULL, *tmp2 = NULL, *tmp3 = NULL, *k = NULL, *K = NULL;
|
||||
BIGNUM *xtmp = NULL;
|
||||
BN_CTX *bn_ctx;
|
||||
|
||||
if (u == NULL || B == NULL || N == NULL || g == NULL || x == NULL
|
||||
@@ -185,10 +186,13 @@ BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g,
|
||||
|
||||
if ((tmp = BN_new()) == NULL ||
|
||||
(tmp2 = BN_new()) == NULL ||
|
||||
(tmp3 = BN_new()) == NULL)
|
||||
(tmp3 = BN_new()) == NULL ||
|
||||
(xtmp = BN_new()) == NULL)
|
||||
goto err;
|
||||
|
||||
if (!BN_mod_exp(tmp, g, x, N, bn_ctx))
|
||||
BN_with_flags(xtmp, x, BN_FLG_CONSTTIME);
|
||||
BN_set_flags(tmp, BN_FLG_CONSTTIME);
|
||||
if (!BN_mod_exp(tmp, g, xtmp, N, bn_ctx))
|
||||
goto err;
|
||||
if ((k = srp_Calc_k(N, g)) == NULL)
|
||||
goto err;
|
||||
@@ -196,7 +200,7 @@ BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g,
|
||||
goto err;
|
||||
if (!BN_mod_sub(tmp, B, tmp2, N, bn_ctx))
|
||||
goto err;
|
||||
if (!BN_mul(tmp3, u, x, bn_ctx))
|
||||
if (!BN_mul(tmp3, u, xtmp, bn_ctx))
|
||||
goto err;
|
||||
if (!BN_add(tmp2, a, tmp3))
|
||||
goto err;
|
||||
@@ -208,6 +212,7 @@ BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g,
|
||||
|
||||
err:
|
||||
BN_CTX_free(bn_ctx);
|
||||
BN_free(xtmp);
|
||||
BN_clear_free(tmp);
|
||||
BN_clear_free(tmp2);
|
||||
BN_clear_free(tmp3);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2004-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright (c) 2004, EdelKey Project. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
@@ -684,7 +684,7 @@ int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
|
||||
BIGNUM *x = NULL;
|
||||
BN_CTX *bn_ctx = BN_CTX_new();
|
||||
unsigned char tmp2[MAX_LEN];
|
||||
BIGNUM *salttmp = NULL;
|
||||
BIGNUM *salttmp = NULL, *verif;
|
||||
|
||||
if ((user == NULL) ||
|
||||
(pass == NULL) ||
|
||||
@@ -707,17 +707,18 @@ int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
|
||||
if (x == NULL)
|
||||
goto err;
|
||||
|
||||
*verifier = BN_new();
|
||||
if (*verifier == NULL)
|
||||
verif = BN_new();
|
||||
if (verif == NULL)
|
||||
goto err;
|
||||
|
||||
if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) {
|
||||
BN_clear_free(*verifier);
|
||||
if (!BN_mod_exp(verif, g, x, N, bn_ctx)) {
|
||||
BN_clear_free(verif);
|
||||
goto err;
|
||||
}
|
||||
|
||||
result = 1;
|
||||
*salt = salttmp;
|
||||
*verifier = verif;
|
||||
|
||||
err:
|
||||
if (salt != NULL && *salt != salttmp)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -370,6 +370,7 @@ static OSSL_STORE_INFO *try_decode_PKCS8Encrypted(const char *pem_name,
|
||||
mem->data = (char *)new_data;
|
||||
mem->max = mem->length = (size_t)new_data_len;
|
||||
X509_SIG_free(p8);
|
||||
p8 = NULL;
|
||||
|
||||
store_info = ossl_store_info_new_EMBEDDED(PEM_STRING_PKCS8INF, mem);
|
||||
if (store_info == NULL) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -612,6 +612,7 @@ static int ts_compute_imprint(BIO *data, TS_TST_INFO *tst_info,
|
||||
err:
|
||||
EVP_MD_CTX_free(md_ctx);
|
||||
X509_ALGOR_free(*md_alg);
|
||||
*md_alg = NULL;
|
||||
OPENSSL_free(*imprint);
|
||||
*imprint_len = 0;
|
||||
*imprint = 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -126,6 +126,8 @@ TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx)
|
||||
goto err;
|
||||
msg = imprint->hashed_msg;
|
||||
ret->imprint_len = ASN1_STRING_length(msg);
|
||||
if (ret->imprint_len <= 0)
|
||||
goto err;
|
||||
if ((ret->imprint = OPENSSL_malloc(ret->imprint_len)) == NULL)
|
||||
goto err;
|
||||
memcpy(ret->imprint, ASN1_STRING_get0_data(msg), ret->imprint_len);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -36,6 +36,12 @@ int OPENSSL_issetugid(void)
|
||||
# include <sys/auxv.h>
|
||||
# define OSSL_IMPLEMENT_GETAUXVAL
|
||||
# endif
|
||||
# elif defined(__ANDROID_API__)
|
||||
/* see https://developer.android.google.cn/ndk/guides/cpu-features */
|
||||
# if __ANDROID_API__ >= 18
|
||||
# include <sys/auxv.h>
|
||||
# define OSSL_IMPLEMENT_GETAUXVAL
|
||||
# endif
|
||||
# endif
|
||||
|
||||
int OPENSSL_issetugid(void)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -365,9 +365,9 @@ int X509_aux_print(BIO *out, X509 *x, int indent)
|
||||
BIO_puts(out, "\n");
|
||||
} else
|
||||
BIO_printf(out, "%*sNo Rejected Uses.\n", indent, "");
|
||||
alias = X509_alias_get0(x, NULL);
|
||||
alias = X509_alias_get0(x, &i);
|
||||
if (alias)
|
||||
BIO_printf(out, "%*sAlias: %s\n", indent, "", alias);
|
||||
BIO_printf(out, "%*sAlias: %.*s\n", indent, "", i, alias);
|
||||
keyid = X509_keyid_get0(x, &keyidlen);
|
||||
if (keyid) {
|
||||
BIO_printf(out, "%*sKey Id: ", indent, "");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -39,6 +39,8 @@ unsigned long X509_issuer_and_serial_hash(X509 *a)
|
||||
if (ctx == NULL)
|
||||
goto err;
|
||||
f = X509_NAME_oneline(a->cert_info.issuer, NULL, 0);
|
||||
if (f == NULL)
|
||||
goto err;
|
||||
if (!EVP_DigestInit_ex(ctx, EVP_md5(), NULL))
|
||||
goto err;
|
||||
if (!EVP_DigestUpdate(ctx, (unsigned char *)f, strlen(f)))
|
||||
@@ -133,19 +135,21 @@ unsigned long X509_subject_name_hash_old(X509 *x)
|
||||
*/
|
||||
int X509_cmp(const X509 *a, const X509 *b)
|
||||
{
|
||||
int rv;
|
||||
int rv = 0;
|
||||
|
||||
if (a == b) /* for efficiency */
|
||||
return 0;
|
||||
/* ensure hash is valid */
|
||||
if (X509_check_purpose((X509 *)a, -1, 0) != 1)
|
||||
return -2;
|
||||
if (X509_check_purpose((X509 *)b, -1, 0) != 1)
|
||||
return -2;
|
||||
|
||||
rv = memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH);
|
||||
if (rv)
|
||||
/* try to make sure hash is valid */
|
||||
(void)X509_check_purpose((X509 *)a, -1, 0);
|
||||
(void)X509_check_purpose((X509 *)b, -1, 0);
|
||||
|
||||
if ((a->ex_flags & EXFLAG_NO_FINGERPRINT) == 0
|
||||
&& (b->ex_flags & EXFLAG_NO_FINGERPRINT) == 0)
|
||||
rv = memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH);
|
||||
if (rv != 0)
|
||||
return rv;
|
||||
|
||||
/* Check for match against stored encoding too */
|
||||
if (!a->cert_info.enc.modified && !b->cert_info.enc.modified) {
|
||||
if (a->cert_info.enc.len < b->cert_info.enc.len)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -323,9 +323,10 @@ static int sk_X509_contains(STACK_OF(X509) *sk, X509 *cert)
|
||||
}
|
||||
|
||||
/*
|
||||
* Find in given STACK_OF(X509) sk a non-expired issuer cert (if any) of given cert x.
|
||||
* The issuer must not be the same as x and must not yet be in ctx->chain, where the
|
||||
* exceptional case x is self-issued and ctx->chain has just one element is allowed.
|
||||
* Find in given STACK_OF(X509) sk an issuer cert of given cert x.
|
||||
* The issuer must not yet be in ctx->chain, where the exceptional case
|
||||
* that x is self-issued and ctx->chain has just one element is allowed.
|
||||
* Prefer the first one that is not expired, else take the last expired one.
|
||||
*/
|
||||
static X509 *find_issuer(X509_STORE_CTX *ctx, STACK_OF(X509) *sk, X509 *x)
|
||||
{
|
||||
@@ -334,11 +335,7 @@ static X509 *find_issuer(X509_STORE_CTX *ctx, STACK_OF(X509) *sk, X509 *x)
|
||||
|
||||
for (i = 0; i < sk_X509_num(sk); i++) {
|
||||
issuer = sk_X509_value(sk, i);
|
||||
/*
|
||||
* Below check 'issuer != x' is an optimization and safety precaution:
|
||||
* Candidate issuer cert cannot be the same as the subject cert 'x'.
|
||||
*/
|
||||
if (issuer != x && ctx->check_issued(ctx, x, issuer)
|
||||
if (ctx->check_issued(ctx, x, issuer)
|
||||
&& (((x->ex_flags & EXFLAG_SI) != 0 && sk_X509_num(ctx->chain) == 1)
|
||||
|| !sk_X509_contains(ctx->chain, issuer))) {
|
||||
rv = issuer;
|
||||
@@ -527,15 +524,19 @@ static int check_chain_extensions(X509_STORE_CTX *ctx)
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
if ((ctx->param->flags & X509_V_FLAG_X509_STRICT) && num > 1) {
|
||||
if (ret > 0
|
||||
&& (ctx->param->flags & X509_V_FLAG_X509_STRICT) && num > 1) {
|
||||
/* Check for presence of explicit elliptic curve parameters */
|
||||
ret = check_curve(x);
|
||||
if (ret < 0)
|
||||
if (ret < 0) {
|
||||
ctx->error = X509_V_ERR_UNSPECIFIED;
|
||||
else if (ret == 0)
|
||||
ret = 0;
|
||||
} else if (ret == 0) {
|
||||
ctx->error = X509_V_ERR_EC_KEY_EXPLICIT_PARAMS;
|
||||
}
|
||||
}
|
||||
if ((x->ex_flags & EXFLAG_CA) == 0
|
||||
if (ret > 0
|
||||
&& (x->ex_flags & EXFLAG_CA) == 0
|
||||
&& x->ex_pathlen != -1
|
||||
&& (ctx->param->flags & X509_V_FLAG_X509_STRICT)) {
|
||||
ctx->error = X509_V_ERR_INVALID_EXTENSION;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2004-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -199,7 +199,8 @@ int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *dest,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Copy the host flags if and only if we're copying the host list */
|
||||
x509_verify_param_copy(hostflags, 0);
|
||||
|
||||
if (test_x509_verify_param_copy(hosts, NULL)) {
|
||||
sk_OPENSSL_STRING_pop_free(dest->hosts, str_free);
|
||||
dest->hosts = NULL;
|
||||
@@ -208,7 +209,6 @@ int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *dest,
|
||||
sk_OPENSSL_STRING_deep_copy(src->hosts, str_copy, str_free);
|
||||
if (dest->hosts == NULL)
|
||||
return 0;
|
||||
dest->hostflags = src->hostflags;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -363,7 +363,7 @@ int X509_digest(const X509 *data, const EVP_MD *type, unsigned char *md,
|
||||
unsigned int *len)
|
||||
{
|
||||
if (type == EVP_sha1() && (data->ex_flags & EXFLAG_SET) != 0
|
||||
&& (data->ex_flags & EXFLAG_INVALID) == 0) {
|
||||
&& (data->ex_flags & EXFLAG_NO_FINGERPRINT) == 0) {
|
||||
/* Asking for SHA1 and we already computed it. */
|
||||
if (len != NULL)
|
||||
*len = sizeof(data->sha1_hash);
|
||||
|
||||
@@ -37,10 +37,13 @@ X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value)
|
||||
{
|
||||
X509_ATTRIBUTE *ret = NULL;
|
||||
ASN1_TYPE *val = NULL;
|
||||
ASN1_OBJECT *oid;
|
||||
|
||||
if ((oid = OBJ_nid2obj(nid)) == NULL)
|
||||
return NULL;
|
||||
if ((ret = X509_ATTRIBUTE_new()) == NULL)
|
||||
return NULL;
|
||||
ret->object = OBJ_nid2obj(nid);
|
||||
ret->object = oid;
|
||||
if ((val = ASN1_TYPE_new()) == NULL)
|
||||
goto err;
|
||||
if (!sk_ASN1_TYPE_push(ret->set, val))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -39,20 +39,48 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method,
|
||||
STACK_OF(CONF_VALUE)
|
||||
*extlist)
|
||||
{
|
||||
char *tmp;
|
||||
char *tmp = NULL;
|
||||
STACK_OF(CONF_VALUE) *origextlist = extlist, *tmpextlist;
|
||||
|
||||
if (akeyid->keyid) {
|
||||
tmp = OPENSSL_buf2hexstr(akeyid->keyid->data, akeyid->keyid->length);
|
||||
X509V3_add_value("keyid", tmp, &extlist);
|
||||
if (tmp == NULL) {
|
||||
X509V3err(X509V3_F_I2V_AUTHORITY_KEYID, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
if (!X509V3_add_value("keyid", tmp, &extlist)) {
|
||||
OPENSSL_free(tmp);
|
||||
X509V3err(X509V3_F_I2V_AUTHORITY_KEYID, ERR_R_X509_LIB);
|
||||
goto err;
|
||||
}
|
||||
OPENSSL_free(tmp);
|
||||
}
|
||||
if (akeyid->issuer)
|
||||
extlist = i2v_GENERAL_NAMES(NULL, akeyid->issuer, extlist);
|
||||
if (akeyid->issuer) {
|
||||
tmpextlist = i2v_GENERAL_NAMES(NULL, akeyid->issuer, extlist);
|
||||
if (tmpextlist == NULL) {
|
||||
X509V3err(X509V3_F_I2V_AUTHORITY_KEYID, ERR_R_X509_LIB);
|
||||
goto err;
|
||||
}
|
||||
extlist = tmpextlist;
|
||||
}
|
||||
if (akeyid->serial) {
|
||||
tmp = OPENSSL_buf2hexstr(akeyid->serial->data, akeyid->serial->length);
|
||||
X509V3_add_value("serial", tmp, &extlist);
|
||||
if (tmp == NULL) {
|
||||
X509V3err(X509V3_F_I2V_AUTHORITY_KEYID, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
if (!X509V3_add_value("serial", tmp, &extlist)) {
|
||||
OPENSSL_free(tmp);
|
||||
X509V3err(X509V3_F_I2V_AUTHORITY_KEYID, ERR_R_X509_LIB);
|
||||
goto err;
|
||||
}
|
||||
OPENSSL_free(tmp);
|
||||
}
|
||||
return extlist;
|
||||
err:
|
||||
if (origextlist == NULL)
|
||||
sk_CONF_VALUE_pop_free(extlist, X509V3_conf_free);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*-
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include "crypto/x509.h"
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include "ext_dat.h"
|
||||
@@ -99,17 +100,20 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method,
|
||||
break;
|
||||
|
||||
case GEN_EMAIL:
|
||||
if (!X509V3_add_value_uchar("email", gen->d.ia5->data, &ret))
|
||||
if (!x509v3_add_len_value_uchar("email", gen->d.ia5->data,
|
||||
gen->d.ia5->length, &ret))
|
||||
return NULL;
|
||||
break;
|
||||
|
||||
case GEN_DNS:
|
||||
if (!X509V3_add_value_uchar("DNS", gen->d.ia5->data, &ret))
|
||||
if (!x509v3_add_len_value_uchar("DNS", gen->d.ia5->data,
|
||||
gen->d.ia5->length, &ret))
|
||||
return NULL;
|
||||
break;
|
||||
|
||||
case GEN_URI:
|
||||
if (!X509V3_add_value_uchar("URI", gen->d.ia5->data, &ret))
|
||||
if (!x509v3_add_len_value_uchar("URI", gen->d.ia5->data,
|
||||
gen->d.ia5->length, &ret))
|
||||
return NULL;
|
||||
break;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -422,7 +422,8 @@ static void print_qualifiers(BIO *out, STACK_OF(POLICYQUALINFO) *quals,
|
||||
qualinfo = sk_POLICYQUALINFO_value(quals, i);
|
||||
switch (OBJ_obj2nid(qualinfo->pqualid)) {
|
||||
case NID_id_qt_cps:
|
||||
BIO_printf(out, "%*sCPS: %s\n", indent, "",
|
||||
BIO_printf(out, "%*sCPS: %.*s\n", indent, "",
|
||||
qualinfo->d.cpsuri->length,
|
||||
qualinfo->d.cpsuri->data);
|
||||
break;
|
||||
|
||||
@@ -447,7 +448,8 @@ static void print_notice(BIO *out, USERNOTICE *notice, int indent)
|
||||
if (notice->noticeref) {
|
||||
NOTICEREF *ref;
|
||||
ref = notice->noticeref;
|
||||
BIO_printf(out, "%*sOrganization: %s\n", indent, "",
|
||||
BIO_printf(out, "%*sOrganization: %.*s\n", indent, "",
|
||||
ref->organization->length,
|
||||
ref->organization->data);
|
||||
BIO_printf(out, "%*sNumber%s: ", indent, "",
|
||||
sk_ASN1_INTEGER_num(ref->noticenos) > 1 ? "s" : "");
|
||||
@@ -470,7 +472,8 @@ static void print_notice(BIO *out, USERNOTICE *notice, int indent)
|
||||
BIO_puts(out, "\n");
|
||||
}
|
||||
if (notice->exptext)
|
||||
BIO_printf(out, "%*sExplicit Text: %s\n", indent, "",
|
||||
BIO_printf(out, "%*sExplicit Text: %.*s\n", indent, "",
|
||||
notice->exptext->length,
|
||||
notice->exptext->data);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2003-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -63,8 +63,31 @@ ASN1_SEQUENCE(NAME_CONSTRAINTS) = {
|
||||
IMPLEMENT_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE)
|
||||
IMPLEMENT_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS)
|
||||
|
||||
|
||||
#define IA5_OFFSET_LEN(ia5base, offset) \
|
||||
((ia5base)->length - ((unsigned char *)(offset) - (ia5base)->data))
|
||||
|
||||
/* Like memchr but for ASN1_IA5STRING. Additionally you can specify the
|
||||
* starting point to search from
|
||||
*/
|
||||
# define ia5memchr(str, start, c) memchr(start, c, IA5_OFFSET_LEN(str, start))
|
||||
|
||||
/* Like memrrchr but for ASN1_IA5STRING */
|
||||
static char *ia5memrchr(ASN1_IA5STRING *str, int c)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = str->length; i > 0 && str->data[i - 1] != c; i--);
|
||||
|
||||
if (i == 0)
|
||||
return NULL;
|
||||
|
||||
return (char *)&str->data[i - 1];
|
||||
}
|
||||
|
||||
/*
|
||||
* We cannot use strncasecmp here because that applies locale specific rules.
|
||||
* We cannot use strncasecmp here because that applies locale specific rules. It
|
||||
* also doesn't work with ASN1_STRINGs that may have embedded NUL characters.
|
||||
* For example in Turkish 'I' is not the uppercase character for 'i'. We need to
|
||||
* do a simple ASCII case comparison ignoring the locale (that is why we use
|
||||
* numeric constants below).
|
||||
@@ -89,20 +112,12 @@ static int ia5ncasecmp(const char *s1, const char *s2, size_t n)
|
||||
|
||||
/* c1 > c2 */
|
||||
return 1;
|
||||
} else if (*s1 == 0) {
|
||||
/* If we get here we know that *s2 == 0 too */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ia5casecmp(const char *s1, const char *s2)
|
||||
{
|
||||
return ia5ncasecmp(s1, s2, SIZE_MAX);
|
||||
}
|
||||
|
||||
static void *v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method,
|
||||
X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval)
|
||||
{
|
||||
@@ -337,7 +352,7 @@ static int cn2dnsid(ASN1_STRING *cn, unsigned char **dnsid, size_t *idlen)
|
||||
--utf8_length;
|
||||
|
||||
/* Reject *embedded* NULs */
|
||||
if ((size_t)utf8_length != strlen((char *)utf8_value)) {
|
||||
if (memchr(utf8_value, 0, utf8_length) != NULL) {
|
||||
OPENSSL_free(utf8_value);
|
||||
return X509_V_ERR_UNSUPPORTED_NAME_SYNTAX;
|
||||
}
|
||||
@@ -536,9 +551,14 @@ static int nc_dns(ASN1_IA5STRING *dns, ASN1_IA5STRING *base)
|
||||
{
|
||||
char *baseptr = (char *)base->data;
|
||||
char *dnsptr = (char *)dns->data;
|
||||
|
||||
/* Empty matches everything */
|
||||
if (!*baseptr)
|
||||
if (base->length == 0)
|
||||
return X509_V_OK;
|
||||
|
||||
if (dns->length < base->length)
|
||||
return X509_V_ERR_PERMITTED_VIOLATION;
|
||||
|
||||
/*
|
||||
* Otherwise can add zero or more components on the left so compare RHS
|
||||
* and if dns is longer and expect '.' as preceding character.
|
||||
@@ -549,7 +569,7 @@ static int nc_dns(ASN1_IA5STRING *dns, ASN1_IA5STRING *base)
|
||||
return X509_V_ERR_PERMITTED_VIOLATION;
|
||||
}
|
||||
|
||||
if (ia5casecmp(baseptr, dnsptr))
|
||||
if (ia5ncasecmp(baseptr, dnsptr, base->length))
|
||||
return X509_V_ERR_PERMITTED_VIOLATION;
|
||||
|
||||
return X509_V_OK;
|
||||
@@ -560,16 +580,17 @@ static int nc_email(ASN1_IA5STRING *eml, ASN1_IA5STRING *base)
|
||||
{
|
||||
const char *baseptr = (char *)base->data;
|
||||
const char *emlptr = (char *)eml->data;
|
||||
const char *baseat = ia5memrchr(base, '@');
|
||||
const char *emlat = ia5memrchr(eml, '@');
|
||||
size_t basehostlen, emlhostlen;
|
||||
|
||||
const char *baseat = strchr(baseptr, '@');
|
||||
const char *emlat = strchr(emlptr, '@');
|
||||
if (!emlat)
|
||||
return X509_V_ERR_UNSUPPORTED_NAME_SYNTAX;
|
||||
/* Special case: initial '.' is RHS match */
|
||||
if (!baseat && (*baseptr == '.')) {
|
||||
if (!baseat && base->length > 0 && (*baseptr == '.')) {
|
||||
if (eml->length > base->length) {
|
||||
emlptr += eml->length - base->length;
|
||||
if (ia5casecmp(baseptr, emlptr) == 0)
|
||||
if (ia5ncasecmp(baseptr, emlptr, base->length) == 0)
|
||||
return X509_V_OK;
|
||||
}
|
||||
return X509_V_ERR_PERMITTED_VIOLATION;
|
||||
@@ -589,8 +610,10 @@ static int nc_email(ASN1_IA5STRING *eml, ASN1_IA5STRING *base)
|
||||
baseptr = baseat + 1;
|
||||
}
|
||||
emlptr = emlat + 1;
|
||||
basehostlen = IA5_OFFSET_LEN(base, baseptr);
|
||||
emlhostlen = IA5_OFFSET_LEN(eml, emlptr);
|
||||
/* Just have hostname left to match: case insensitive */
|
||||
if (ia5casecmp(baseptr, emlptr))
|
||||
if (basehostlen != emlhostlen || ia5ncasecmp(baseptr, emlptr, emlhostlen))
|
||||
return X509_V_ERR_PERMITTED_VIOLATION;
|
||||
|
||||
return X509_V_OK;
|
||||
@@ -601,10 +624,14 @@ static int nc_uri(ASN1_IA5STRING *uri, ASN1_IA5STRING *base)
|
||||
{
|
||||
const char *baseptr = (char *)base->data;
|
||||
const char *hostptr = (char *)uri->data;
|
||||
const char *p = strchr(hostptr, ':');
|
||||
const char *p = ia5memchr(uri, (char *)uri->data, ':');
|
||||
int hostlen;
|
||||
|
||||
/* Check for foo:// and skip past it */
|
||||
if (!p || (p[1] != '/') || (p[2] != '/'))
|
||||
if (p == NULL
|
||||
|| IA5_OFFSET_LEN(uri, p) < 3
|
||||
|| p[1] != '/'
|
||||
|| p[2] != '/')
|
||||
return X509_V_ERR_UNSUPPORTED_NAME_SYNTAX;
|
||||
hostptr = p + 3;
|
||||
|
||||
@@ -612,13 +639,13 @@ static int nc_uri(ASN1_IA5STRING *uri, ASN1_IA5STRING *base)
|
||||
|
||||
/* Look for a port indicator as end of hostname first */
|
||||
|
||||
p = strchr(hostptr, ':');
|
||||
p = ia5memchr(uri, hostptr, ':');
|
||||
/* Otherwise look for trailing slash */
|
||||
if (!p)
|
||||
p = strchr(hostptr, '/');
|
||||
if (p == NULL)
|
||||
p = ia5memchr(uri, hostptr, '/');
|
||||
|
||||
if (!p)
|
||||
hostlen = strlen(hostptr);
|
||||
if (p == NULL)
|
||||
hostlen = IA5_OFFSET_LEN(uri, hostptr);
|
||||
else
|
||||
hostlen = p - hostptr;
|
||||
|
||||
@@ -626,7 +653,7 @@ static int nc_uri(ASN1_IA5STRING *uri, ASN1_IA5STRING *base)
|
||||
return X509_V_ERR_UNSUPPORTED_NAME_SYNTAX;
|
||||
|
||||
/* Special case: initial '.' is RHS match */
|
||||
if (*baseptr == '.') {
|
||||
if (base->length > 0 && *baseptr == '.') {
|
||||
if (hostlen > base->length) {
|
||||
p = hostptr + hostlen - base->length;
|
||||
if (ia5ncasecmp(p, baseptr, base->length) == 0)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2004-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -77,7 +77,8 @@ static int i2r_pci(X509V3_EXT_METHOD *method, PROXY_CERT_INFO_EXTENSION *pci,
|
||||
i2a_ASN1_OBJECT(out, pci->proxyPolicy->policyLanguage);
|
||||
BIO_puts(out, "\n");
|
||||
if (pci->proxyPolicy->policy && pci->proxyPolicy->policy->data)
|
||||
BIO_printf(out, "%*sPolicy Text: %s\n", indent, "",
|
||||
BIO_printf(out, "%*sPolicy Text: %.*s\n", indent, "",
|
||||
pci->proxyPolicy->policy->length,
|
||||
pci->proxyPolicy->policy->data);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -348,14 +348,17 @@ static int setup_crldp(X509 *x)
|
||||
/* Check that issuer public key algorithm matches subject signature algorithm */
|
||||
static int check_sig_alg_match(const EVP_PKEY *pkey, const X509 *subject)
|
||||
{
|
||||
int pkey_nid;
|
||||
int pkey_sig_nid, subj_sig_nid;
|
||||
|
||||
if (pkey == NULL)
|
||||
return X509_V_ERR_NO_ISSUER_PUBLIC_KEY;
|
||||
if (OBJ_find_sigid_algs(EVP_PKEY_base_id(pkey),
|
||||
NULL, &pkey_sig_nid) == 0)
|
||||
pkey_sig_nid = EVP_PKEY_base_id(pkey);
|
||||
if (OBJ_find_sigid_algs(OBJ_obj2nid(subject->cert_info.signature.algorithm),
|
||||
NULL, &pkey_nid) == 0)
|
||||
NULL, &subj_sig_nid) == 0)
|
||||
return X509_V_ERR_UNSUPPORTED_SIGNATURE_ALGORITHM;
|
||||
if (EVP_PKEY_type(pkey_nid) != EVP_PKEY_base_id(pkey))
|
||||
if (pkey_sig_nid != EVP_PKEY_type(subj_sig_nid))
|
||||
return X509_V_ERR_SIGNATURE_ALGORITHM_MISMATCH;
|
||||
return X509_V_OK;
|
||||
}
|
||||
@@ -391,7 +394,8 @@ static void x509v3_cache_extensions(X509 *x)
|
||||
}
|
||||
|
||||
if (!X509_digest(x, EVP_sha1(), x->sha1_hash, NULL))
|
||||
x->ex_flags |= EXFLAG_INVALID;
|
||||
x->ex_flags |= (EXFLAG_NO_FINGERPRINT | EXFLAG_INVALID);
|
||||
|
||||
/* V1 should mean no extensions ... */
|
||||
if (!X509_get_version(x))
|
||||
x->ex_flags |= EXFLAG_V1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "e_os.h"
|
||||
#include "internal/cryptlib.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "crypto/ctype.h"
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/crypto.h>
|
||||
@@ -34,17 +35,26 @@ static int ipv6_hex(unsigned char *out, const char *in, int inlen);
|
||||
|
||||
/* Add a CONF_VALUE name value pair to stack */
|
||||
|
||||
int X509V3_add_value(const char *name, const char *value,
|
||||
STACK_OF(CONF_VALUE) **extlist)
|
||||
static int x509v3_add_len_value(const char *name, const char *value,
|
||||
size_t vallen, STACK_OF(CONF_VALUE) **extlist)
|
||||
{
|
||||
CONF_VALUE *vtmp = NULL;
|
||||
char *tname = NULL, *tvalue = NULL;
|
||||
int sk_allocated = (*extlist == NULL);
|
||||
|
||||
if (name && (tname = OPENSSL_strdup(name)) == NULL)
|
||||
goto err;
|
||||
if (value && (tvalue = OPENSSL_strdup(value)) == NULL)
|
||||
if (name != NULL && (tname = OPENSSL_strdup(name)) == NULL)
|
||||
goto err;
|
||||
if (value != NULL && vallen > 0) {
|
||||
/*
|
||||
* We tolerate a single trailing NUL character, but otherwise no
|
||||
* embedded NULs
|
||||
*/
|
||||
if (memchr(value, 0, vallen - 1) != NULL)
|
||||
goto err;
|
||||
tvalue = OPENSSL_strndup(value, vallen);
|
||||
if (tvalue == NULL)
|
||||
goto err;
|
||||
}
|
||||
if ((vtmp = OPENSSL_malloc(sizeof(*vtmp))) == NULL)
|
||||
goto err;
|
||||
if (sk_allocated && (*extlist = sk_CONF_VALUE_new_null()) == NULL)
|
||||
@@ -56,7 +66,7 @@ int X509V3_add_value(const char *name, const char *value,
|
||||
goto err;
|
||||
return 1;
|
||||
err:
|
||||
X509V3err(X509V3_F_X509V3_ADD_VALUE, ERR_R_MALLOC_FAILURE);
|
||||
X509V3err(X509V3_F_X509V3_ADD_LEN_VALUE, ERR_R_MALLOC_FAILURE);
|
||||
if (sk_allocated) {
|
||||
sk_CONF_VALUE_free(*extlist);
|
||||
*extlist = NULL;
|
||||
@@ -67,10 +77,26 @@ int X509V3_add_value(const char *name, const char *value,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int X509V3_add_value(const char *name, const char *value,
|
||||
STACK_OF(CONF_VALUE) **extlist)
|
||||
{
|
||||
return x509v3_add_len_value(name, value,
|
||||
value != NULL ? strlen((const char *)value) : 0,
|
||||
extlist);
|
||||
}
|
||||
|
||||
int X509V3_add_value_uchar(const char *name, const unsigned char *value,
|
||||
STACK_OF(CONF_VALUE) **extlist)
|
||||
{
|
||||
return X509V3_add_value(name, (const char *)value, extlist);
|
||||
return x509v3_add_len_value(name, (const char *)value,
|
||||
value != NULL ? strlen((const char *)value) : 0,
|
||||
extlist);
|
||||
}
|
||||
|
||||
int x509v3_add_len_value_uchar(const char *name, const unsigned char *value,
|
||||
size_t vallen, STACK_OF(CONF_VALUE) **extlist)
|
||||
{
|
||||
return x509v3_add_len_value(name, (const char *)value, vallen, extlist);
|
||||
}
|
||||
|
||||
/* Free function for STACK_OF(CONF_VALUE) */
|
||||
@@ -502,18 +528,26 @@ static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, const ASN1_IA5STRING *email
|
||||
/* First some sanity checks */
|
||||
if (email->type != V_ASN1_IA5STRING)
|
||||
return 1;
|
||||
if (!email->data || !email->length)
|
||||
if (email->data == NULL || email->length == 0)
|
||||
return 1;
|
||||
if (memchr(email->data, 0, email->length) != NULL)
|
||||
return 1;
|
||||
if (*sk == NULL)
|
||||
*sk = sk_OPENSSL_STRING_new(sk_strcmp);
|
||||
if (*sk == NULL)
|
||||
return 0;
|
||||
|
||||
emtmp = OPENSSL_strndup((char *)email->data, email->length);
|
||||
if (emtmp == NULL)
|
||||
return 0;
|
||||
|
||||
/* Don't add duplicates */
|
||||
if (sk_OPENSSL_STRING_find(*sk, (char *)email->data) != -1)
|
||||
if (sk_OPENSSL_STRING_find(*sk, emtmp) != -1) {
|
||||
OPENSSL_free(emtmp);
|
||||
return 1;
|
||||
emtmp = OPENSSL_strdup((char *)email->data);
|
||||
if (emtmp == NULL || !sk_OPENSSL_STRING_push(*sk, emtmp)) {
|
||||
OPENSSL_free(emtmp); /* free on push failure */
|
||||
}
|
||||
if (!sk_OPENSSL_STRING_push(*sk, emtmp)) {
|
||||
OPENSSL_free(emtmp); /* free on push failure */
|
||||
X509_email_free(*sk);
|
||||
*sk = NULL;
|
||||
return 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -39,6 +39,8 @@ static const ERR_STRING_DATA X509V3_str_functs[] = {
|
||||
"i2s_ASN1_INTEGER"},
|
||||
{ERR_PACK(ERR_LIB_X509V3, X509V3_F_I2V_AUTHORITY_INFO_ACCESS, 0),
|
||||
"i2v_AUTHORITY_INFO_ACCESS"},
|
||||
{ERR_PACK(ERR_LIB_X509V3, X509V3_F_I2V_AUTHORITY_KEYID, 0),
|
||||
"i2v_AUTHORITY_KEYID"},
|
||||
{ERR_PACK(ERR_LIB_X509V3, X509V3_F_LEVEL_ADD_NODE, 0), "level_add_node"},
|
||||
{ERR_PACK(ERR_LIB_X509V3, X509V3_F_NOTICE_SECTION, 0), "notice_section"},
|
||||
{ERR_PACK(ERR_LIB_X509V3, X509V3_F_NREF_NOS, 0), "nref_nos"},
|
||||
@@ -104,6 +106,8 @@ static const ERR_STRING_DATA X509V3_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_X509V3, X509V3_F_V3_GENERIC_EXTENSION, 0),
|
||||
"v3_generic_extension"},
|
||||
{ERR_PACK(ERR_LIB_X509V3, X509V3_F_X509V3_ADD1_I2D, 0), "X509V3_add1_i2d"},
|
||||
{ERR_PACK(ERR_LIB_X509V3, X509V3_F_X509V3_ADD_LEN_VALUE, 0),
|
||||
"x509v3_add_len_value"},
|
||||
{ERR_PACK(ERR_LIB_X509V3, X509V3_F_X509V3_ADD_VALUE, 0),
|
||||
"X509V3_add_value"},
|
||||
{ERR_PACK(ERR_LIB_X509V3, X509V3_F_X509V3_EXT_ADD, 0), "X509V3_EXT_add"},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -94,12 +94,6 @@ int main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (BIO_do_handshake(sbio) <= 0) {
|
||||
fprintf(stderr, "Error establishing SSL connection\n");
|
||||
ERR_print_errors_fp(stderr);
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* Could examine ssl here to get connection info */
|
||||
|
||||
BIO_puts(sbio, "GET / HTTP/1.0\n\n");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -102,12 +102,6 @@ int main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (BIO_do_handshake(sbio) <= 0) {
|
||||
fprintf(stderr, "Error establishing SSL connection\n");
|
||||
ERR_print_errors_fp(stderr);
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* Could examine ssl here to get connection info */
|
||||
|
||||
BIO_puts(sbio, "GET / HTTP/1.0\n\n");
|
||||
|
||||
@@ -163,7 +163,7 @@ self-signed certificate.
|
||||
=item B<-passin arg>
|
||||
|
||||
The key password source. For more information about the format of B<arg>
|
||||
see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
|
||||
see L<openssl(1)/Pass Phrase Options>.
|
||||
|
||||
=item B<-notext>
|
||||
|
||||
@@ -759,7 +759,7 @@ L<config(5)>, L<x509v3_config(5)>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the OpenSSL license (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -465,7 +465,7 @@ or to modify default parameters for ECDH.
|
||||
=item B<-passin arg>
|
||||
|
||||
The private key password source. For more information about the format of B<arg>
|
||||
see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
|
||||
see L<openssl(1)/Pass Phrase Options>.
|
||||
|
||||
=item B<-rand file...>
|
||||
|
||||
@@ -735,7 +735,7 @@ The -no_alt_chains option was added in OpenSSL 1.0.2b.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2008-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the OpenSSL license (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -56,7 +56,7 @@ output by default.
|
||||
|
||||
Specifies a filename containing one or more certificates in B<PEM> format.
|
||||
All certificates in the file will be added to the PKCS#7 structure. This
|
||||
option can be used more than once to read certificates form multiple
|
||||
option can be used more than once to read certificates from multiple
|
||||
files.
|
||||
|
||||
=item B<-nocrl>
|
||||
@@ -96,7 +96,7 @@ L<pkcs7(1)>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the OpenSSL license (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -109,7 +109,7 @@ Names and values of these options are algorithm-specific.
|
||||
=item B<-passin arg>
|
||||
|
||||
The private key password source. For more information about the format of B<arg>
|
||||
see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
|
||||
see L<openssl(1)/Pass Phrase Options>.
|
||||
|
||||
=item B<-verify filename>
|
||||
|
||||
@@ -241,7 +241,7 @@ The FIPS-related options were removed in OpenSSL 1.1.0.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the OpenSSL license (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -75,7 +75,7 @@ prompted for.
|
||||
=item B<-passin arg>
|
||||
|
||||
The input file password source. For more information about the format of B<arg>
|
||||
see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
|
||||
see L<openssl(1)/Pass Phrase Options>.
|
||||
|
||||
=item B<-out filename>
|
||||
|
||||
@@ -87,7 +87,7 @@ filename.
|
||||
=item B<-passout arg>
|
||||
|
||||
The output file password source. For more information about the format of B<arg>
|
||||
see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
|
||||
see L<openssl(1)/Pass Phrase Options>.
|
||||
|
||||
=item B<-aes128>, B<-aes192>, B<-aes256>, B<-aria128>, B<-aria192>, B<-aria256>, B<-camellia128>, B<-camellia192>, B<-camellia256>, B<-des>, B<-des3>, B<-idea>
|
||||
|
||||
@@ -172,7 +172,7 @@ L<genrsa(1)>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the OpenSSL license (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -68,7 +68,7 @@ prompted for.
|
||||
=item B<-passin arg>
|
||||
|
||||
The input file password source. For more information about the format of B<arg>
|
||||
see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
|
||||
see L<openssl(1)/Pass Phrase Options>.
|
||||
|
||||
=item B<-out filename>
|
||||
|
||||
@@ -80,7 +80,7 @@ filename.
|
||||
=item B<-passout arg>
|
||||
|
||||
The output file password source. For more information about the format of B<arg>
|
||||
see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
|
||||
see L<openssl(1)/Pass Phrase Options>.
|
||||
|
||||
=item B<-des|-des3|-idea>
|
||||
|
||||
@@ -193,7 +193,7 @@ L<ecparam(1)>, L<dsa(1)>, L<rsa(1)>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2003-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2003-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the OpenSSL license (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -76,7 +76,7 @@ The output filename, standard output by default.
|
||||
=item B<-pass arg>
|
||||
|
||||
The password source. For more information about the format of B<arg>
|
||||
see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
|
||||
see L<openssl(1)/Pass Phrase Options>.
|
||||
|
||||
=item B<-e>
|
||||
|
||||
@@ -180,8 +180,8 @@ Debug the BIOs used for I/O.
|
||||
|
||||
=item B<-z>
|
||||
|
||||
Compress or decompress clear text using zlib before encryption or after
|
||||
decryption. This option exists only if OpenSSL with compiled with zlib
|
||||
Compress or decompress encrypted data using zlib after encryption or before
|
||||
decryption. This option exists only if OpenSSL was compiled with the zlib
|
||||
or zlib-dynamic option.
|
||||
|
||||
=item B<-none>
|
||||
@@ -428,7 +428,7 @@ The B<-list> option was added in OpenSSL 1.1.1e.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the OpenSSL license (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -44,7 +44,7 @@ This specifies the output format DER or PEM. The default format is PEM.
|
||||
=item B<-pass arg>
|
||||
|
||||
The output file password source. For more information about the format of B<arg>
|
||||
see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
|
||||
see L<openssl(1)/Pass Phrase Options>.
|
||||
|
||||
=item B<-I<cipher>>
|
||||
|
||||
@@ -325,7 +325,7 @@ The ability to generate X448, ED25519 and ED448 keys was added in OpenSSL 1.1.1.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2006-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the OpenSSL license (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -51,7 +51,7 @@ standard output is used.
|
||||
=item B<-passout arg>
|
||||
|
||||
The output file password source. For more information about the format
|
||||
of B<arg> see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
|
||||
of B<arg> see L<openssl(1)/Pass Phrase Options>.
|
||||
|
||||
=item B<-aes128>, B<-aes192>, B<-aes256>, B<-aria128>, B<-aria192>, B<-aria256>, B<-camellia128>, B<-camellia192>, B<-camellia256>, B<-des>, B<-des3>, B<-idea>
|
||||
|
||||
@@ -118,7 +118,7 @@ L<gendsa(1)>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the OpenSSL license (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user