Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/external/bsd/openssl/dist Changes between 1.1.1l and ...



details:   https://anonhg.NetBSD.org/src/rev/c69867c22902
branches:  trunk
changeset: 359482:c69867c22902
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jan 07 15:46:01 2022 +0000

description:
Changes between 1.1.1l and 1.1.1m [14 Dec 2021]

*) Avoid loading of a dynamic engine twice.
[Bernd Edlinger]

*) Fixed building on Debian with kfreebsd kernels
[Mattias Ellert]

*) Prioritise DANE TLSA issuer certs over peer certs
[Viktor Dukhovni]

*) Fixed random API for MacOS prior to 10.12
These MacOS versions don't support the CommonCrypto APIs
[Lenny Primak]

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]

diffstat:

 crypto/external/bsd/openssl/dist/Configurations/10-main.conf                   |    7 +
 crypto/external/bsd/openssl/dist/Configurations/15-android.conf                |   84 +++--
 crypto/external/bsd/openssl/dist/Configurations/unix-Makefile.tmpl             |    1 -
 crypto/external/bsd/openssl/dist/Configurations/windows-makefile.tmpl          |   26 +-
 crypto/external/bsd/openssl/dist/apps/ciphers.c                                |    3 +-
 crypto/external/bsd/openssl/dist/apps/crl2p7.c                                 |   18 +-
 crypto/external/bsd/openssl/dist/apps/dgst.c                                   |    6 +-
 crypto/external/bsd/openssl/dist/apps/enc.c                                    |    4 +-
 crypto/external/bsd/openssl/dist/apps/s_cb.c                                   |    4 +-
 crypto/external/bsd/openssl/dist/apps/s_socket.c                               |   12 +-
 crypto/external/bsd/openssl/dist/crypto/asn1/a_object.c                        |   15 +-
 crypto/external/bsd/openssl/dist/crypto/asn1/a_print.c                         |    9 +-
 crypto/external/bsd/openssl/dist/crypto/asn1/asn1_lib.c                        |   21 +-
 crypto/external/bsd/openssl/dist/crypto/asn1/bio_asn1.c                        |    7 +-
 crypto/external/bsd/openssl/dist/crypto/asn1/bio_ndef.c                        |    3 +
 crypto/external/bsd/openssl/dist/crypto/asn1/d2i_pr.c                          |   73 +++-
 crypto/external/bsd/openssl/dist/crypto/asn1/t_spki.c                          |    4 +-
 crypto/external/bsd/openssl/dist/crypto/bio/b_addr.c                           |    4 +-
 crypto/external/bsd/openssl/dist/crypto/bio/b_sock2.c                          |    5 +-
 crypto/external/bsd/openssl/dist/crypto/bio/bss_dgram.c                        |    6 +-
 crypto/external/bsd/openssl/dist/crypto/bio/bss_mem.c                          |    4 +-
 crypto/external/bsd/openssl/dist/crypto/bn/bn_div.c                            |    9 +-
 crypto/external/bsd/openssl/dist/crypto/chacha/asm/chacha-x86_64.pl            |   54 ++-
 crypto/external/bsd/openssl/dist/crypto/cms/cms_env.c                          |    3 +-
 crypto/external/bsd/openssl/dist/crypto/dh/dh_ameth.c                          |   13 +-
 crypto/external/bsd/openssl/dist/crypto/dsa/dsa_prn.c                          |   14 +-
 crypto/external/bsd/openssl/dist/crypto/ec/curve448/field.h                    |    4 +-
 crypto/external/bsd/openssl/dist/crypto/ec/ec2_oct.c                           |   43 ++-
 crypto/external/bsd/openssl/dist/crypto/ec/ec_curve.c                          |   29 +-
 crypto/external/bsd/openssl/dist/crypto/engine/eng_dyn.c                       |    6 +-
 crypto/external/bsd/openssl/dist/crypto/engine/eng_list.c                      |   89 +++++-
 crypto/external/bsd/openssl/dist/crypto/engine/eng_local.h                     |   11 +-
 crypto/external/bsd/openssl/dist/crypto/err/err.c                              |    3 +-
 crypto/external/bsd/openssl/dist/crypto/err/openssl.txt                        |    5 +
 crypto/external/bsd/openssl/dist/crypto/evp/e_camellia.c                       |   10 +-
 crypto/external/bsd/openssl/dist/crypto/evp/p_lib.c                            |   13 +-
 crypto/external/bsd/openssl/dist/crypto/hmac/hm_ameth.c                        |    5 +-
 crypto/external/bsd/openssl/dist/crypto/pem/pem_lib.c                          |   25 +-
 crypto/external/bsd/openssl/dist/crypto/pkcs12/p12_key.c                       |    4 +-
 crypto/external/bsd/openssl/dist/crypto/poly1305/poly1305_ameth.c              |    4 +-
 crypto/external/bsd/openssl/dist/crypto/rand/rand_vms.c                        |    6 +-
 crypto/external/bsd/openssl/dist/crypto/rsa/rsa_prn.c                          |    8 +-
 crypto/external/bsd/openssl/dist/crypto/siphash/siphash_ameth.c                |    4 +-
 crypto/external/bsd/openssl/dist/crypto/sm2/sm2_crypt.c                        |   29 +-
 crypto/external/bsd/openssl/dist/crypto/sm2/sm2_pmeth.c                        |    4 +-
 crypto/external/bsd/openssl/dist/crypto/sparcv9cap.c                           |    3 +-
 crypto/external/bsd/openssl/dist/crypto/srp/srp_vfy.c                          |   13 +-
 crypto/external/bsd/openssl/dist/crypto/store/loader_file.c                    |    3 +-
 crypto/external/bsd/openssl/dist/crypto/ts/ts_rsp_verify.c                     |    3 +-
 crypto/external/bsd/openssl/dist/crypto/ts/ts_verify_ctx.c                     |    5 +-
 crypto/external/bsd/openssl/dist/crypto/x509/t_x509.c                          |    6 +-
 crypto/external/bsd/openssl/dist/crypto/x509/x509_vpm.c                        |    6 +-
 crypto/external/bsd/openssl/dist/crypto/x509/x_name.c                          |    6 +-
 crypto/external/bsd/openssl/dist/crypto/x509v3/v3_akey.c                       |   40 ++-
 crypto/external/bsd/openssl/dist/crypto/x509v3/v3_alt.c                        |   12 +-
 crypto/external/bsd/openssl/dist/crypto/x509v3/v3_cpols.c                      |   11 +-
 crypto/external/bsd/openssl/dist/crypto/x509v3/v3_ncons.c                      |   82 +++-
 crypto/external/bsd/openssl/dist/crypto/x509v3/v3_pci.c                        |    5 +-
 crypto/external/bsd/openssl/dist/crypto/x509v3/v3_utl.c                        |   60 ++-
 crypto/external/bsd/openssl/dist/crypto/x509v3/v3err.c                         |    6 +-
 crypto/external/bsd/openssl/dist/demos/bio/client-arg.c                        |    8 +-
 crypto/external/bsd/openssl/dist/demos/bio/client-conf.c                       |    8 +-
 crypto/external/bsd/openssl/dist/doc/man1/enc.pod                              |    4 +-
 crypto/external/bsd/openssl/dist/doc/man1/passwd.pod                           |    4 +-
 crypto/external/bsd/openssl/dist/doc/man1/pkeyutl.pod                          |   10 +
 crypto/external/bsd/openssl/dist/doc/man1/s_client.pod                         |    2 +-
 crypto/external/bsd/openssl/dist/doc/man1/s_server.pod                         |    2 +-
 crypto/external/bsd/openssl/dist/doc/man3/BIO_f_ssl.pod                        |   24 +-
 crypto/external/bsd/openssl/dist/doc/man3/BIO_push.pod                         |   55 ++-
 crypto/external/bsd/openssl/dist/doc/man3/BN_cmp.pod                           |   41 +-
 crypto/external/bsd/openssl/dist/doc/man3/BN_rand.pod                          |    4 +-
 crypto/external/bsd/openssl/dist/doc/man3/ENGINE_add.pod                       |    7 +-
 crypto/external/bsd/openssl/dist/doc/man3/ERR_load_strings.pod                 |    6 +-
 crypto/external/bsd/openssl/dist/doc/man3/EVP_EncryptInit.pod                  |   16 +-
 crypto/external/bsd/openssl/dist/doc/man3/OBJ_nid2obj.pod                      |   30 +-
 crypto/external/bsd/openssl/dist/doc/man3/SSL_CTX_set_num_tickets.pod          |   10 +-
 crypto/external/bsd/openssl/dist/doc/man3/SSL_CTX_set_tlsext_ticket_key_cb.pod |    4 +-
 crypto/external/bsd/openssl/dist/doc/man3/SSL_get_session.pod                  |    9 +-
 crypto/external/bsd/openssl/dist/doc/man3/SSL_set_fd.pod                       |   13 +-
 crypto/external/bsd/openssl/dist/doc/man3/d2i_PrivateKey.pod                   |    6 +-
 crypto/external/bsd/openssl/dist/doc/man3/d2i_X509.pod                         |    6 +-
 crypto/external/bsd/openssl/dist/doc/man7/ossl_store.pod                       |    4 +-
 crypto/external/bsd/openssl/dist/doc/man7/x509.pod                             |    6 +-
 crypto/external/bsd/openssl/dist/engines/e_afalg.c                             |    9 +-
 crypto/external/bsd/openssl/dist/engines/e_dasync.c                            |   30 +-
 crypto/external/bsd/openssl/dist/include/crypto/rand.h                         |   12 +-
 crypto/external/bsd/openssl/dist/include/crypto/sm2.h                          |    5 +-
 crypto/external/bsd/openssl/dist/include/crypto/x509.h                         |    7 +-
 crypto/external/bsd/openssl/dist/include/openssl/e_os2.h                       |    5 +-
 crypto/external/bsd/openssl/dist/include/openssl/ec.h                          |   17 +-
 crypto/external/bsd/openssl/dist/include/openssl/opensslv.h                    |    4 +-
 crypto/external/bsd/openssl/dist/include/openssl/sslerr.h                      |    5 +-
 crypto/external/bsd/openssl/dist/include/openssl/x509v3err.h                   |    4 +-
 crypto/external/bsd/openssl/dist/ssl/bio_ssl.c                                 |   10 +-
 crypto/external/bsd/openssl/dist/ssl/record/rec_layer_s3.c                     |    8 +-
 crypto/external/bsd/openssl/dist/ssl/record/ssl3_buffer.c                      |    3 +-
 crypto/external/bsd/openssl/dist/ssl/record/ssl3_record.c                      |   38 +-
 crypto/external/bsd/openssl/dist/ssl/s3_msg.c                                  |    4 +-
 crypto/external/bsd/openssl/dist/ssl/ssl_asn1.c                                |    4 +-
 crypto/external/bsd/openssl/dist/ssl/ssl_cert.c                                |   35 +-
 crypto/external/bsd/openssl/dist/ssl/ssl_local.h                               |    4 +-
 crypto/external/bsd/openssl/dist/ssl/statem/README                             |    2 +-
 crypto/external/bsd/openssl/dist/ssl/statem/extensions.c                       |   31 +-
 crypto/external/bsd/openssl/dist/ssl/statem/extensions_clnt.c                  |    5 +-
 crypto/external/bsd/openssl/dist/ssl/statem/extensions_cust.c                  |   13 +-
 crypto/external/bsd/openssl/dist/ssl/statem/extensions_srvr.c                  |    9 +-
 crypto/external/bsd/openssl/dist/ssl/statem/statem_clnt.c                      |    5 +-
 crypto/external/bsd/openssl/dist/ssl/statem/statem_lib.c                       |    4 +-
 crypto/external/bsd/openssl/dist/ssl/statem/statem_local.h                     |    4 +-
 crypto/external/bsd/openssl/dist/ssl/statem/statem_srvr.c                      |    9 +-
 crypto/external/bsd/openssl/dist/test/afalgtest.c                              |   44 +-
 crypto/external/bsd/openssl/dist/test/asn1_decode_test.c                       |   28 +-
 crypto/external/bsd/openssl/dist/test/bio_memleak_test.c                       |   78 ++++-
 crypto/external/bsd/openssl/dist/test/build.info                               |    6 +-
 crypto/external/bsd/openssl/dist/test/certs/cross-key.pem                      |   28 +
 crypto/external/bsd/openssl/dist/test/certs/cross-root.pem                     |   18 +
 crypto/external/bsd/openssl/dist/test/certs/ee-self-signed.pem                 |   33 +-
 crypto/external/bsd/openssl/dist/test/certs/root-cross-cert.pem                |   18 +
 crypto/external/bsd/openssl/dist/test/certs/setup.sh                           |    2 +
 crypto/external/bsd/openssl/dist/test/clienthellotest.c                        |   14 +-
 crypto/external/bsd/openssl/dist/test/dane-cross.in                            |  113 +++++++
 crypto/external/bsd/openssl/dist/test/danetest.c                               |    4 +-
 crypto/external/bsd/openssl/dist/test/data.bin                                 |    4 +
 crypto/external/bsd/openssl/dist/test/ec_internal_test.c                       |   45 ++-
 crypto/external/bsd/openssl/dist/test/packettest.c                             |    4 +-
 crypto/external/bsd/openssl/dist/test/recipes/01-test_symbol_presence.t        |   18 +-
 crypto/external/bsd/openssl/dist/test/recipes/20-test_dgst.t                   |   25 +-
 crypto/external/bsd/openssl/dist/test/recipes/25-test_req.t                    |   29 +-
 crypto/external/bsd/openssl/dist/test/recipes/25-test_verify.t                 |    3 +-
 crypto/external/bsd/openssl/dist/test/recipes/30-test_evp_data/evpkdf.txt      |    4 +-
 crypto/external/bsd/openssl/dist/test/recipes/30-test_evp_data/evppkey.txt     |   12 +-
 crypto/external/bsd/openssl/dist/test/recipes/70-test_tls13kexmodes.t          |   14 +-
 crypto/external/bsd/openssl/dist/test/recipes/80-test_dane.t                   |    8 +-
 crypto/external/bsd/openssl/dist/test/recipes/80-test_ssl_old.t                |   14 +-
 crypto/external/bsd/openssl/dist/test/sm2_internal_test.c                      |   45 ++-
 crypto/external/bsd/openssl/dist/test/sslapitest.c                             |  158 +++++++++-
 crypto/external/bsd/openssl/dist/test/ssltest_old.c                            |   47 ++-
 crypto/external/bsd/openssl/dist/test/testrsa_withattrs.der                    |  Bin 
 crypto/external/bsd/openssl/dist/test/testrsa_withattrs.pem                    |   29 +
 crypto/external/bsd/openssl/dist/test/x509_time_test.c                         |   12 +-
 crypto/external/bsd/openssl/dist/util/mkdir-p.pl                               |    5 +-
 141 files changed, 1794 insertions(+), 605 deletions(-)

diffs (truncated from 5576 to 300 lines):

diff -r 6e737092ecba -r c69867c22902 crypto/external/bsd/openssl/dist/Configurations/10-main.conf
--- a/crypto/external/bsd/openssl/dist/Configurations/10-main.conf      Fri Jan 07 14:03:55 2022 +0000
+++ b/crypto/external/bsd/openssl/dist/Configurations/10-main.conf      Fri Jan 07 15:46:01 2022 +0000
@@ -754,6 +754,13 @@
         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
diff -r 6e737092ecba -r c69867c22902 crypto/external/bsd/openssl/dist/Configurations/15-android.conf
--- a/crypto/external/bsd/openssl/dist/Configurations/15-android.conf   Fri Jan 07 14:03:55 2022 +0000
+++ b/crypto/external/bsd/openssl/dist/Configurations/15-android.conf   Fri Jan 07 15:46:01 2022 +0000
@@ -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",
diff -r 6e737092ecba -r c69867c22902 crypto/external/bsd/openssl/dist/Configurations/unix-Makefile.tmpl
--- a/crypto/external/bsd/openssl/dist/Configurations/unix-Makefile.tmpl        Fri Jan 07 14:03:55 2022 +0000
+++ b/crypto/external/bsd/openssl/dist/Configurations/unix-Makefile.tmpl        Fri Jan 07 15:46:01 2022 +0000
@@ -523,7 +523,6 @@
        $(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
diff -r 6e737092ecba -r c69867c22902 crypto/external/bsd/openssl/dist/Configurations/windows-makefile.tmpl
--- a/crypto/external/bsd/openssl/dist/Configurations/windows-makefile.tmpl     Fri Jan 07 14:03:55 2022 +0000
+++ b/crypto/external/bsd/openssl/dist/Configurations/windows-makefile.tmpl     Fri Jan 07 15:46:01 2022 +0000
@@ -324,15 +324,15 @@
 # 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 @@
        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 @@
        -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 @@
        -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 @@
        @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"
diff -r 6e737092ecba -r c69867c22902 crypto/external/bsd/openssl/dist/apps/ciphers.c
--- a/crypto/external/bsd/openssl/dist/apps/ciphers.c   Fri Jan 07 14:03:55 2022 +0000
+++ b/crypto/external/bsd/openssl/dist/apps/ciphers.c   Fri Jan 07 15:46:01 2022 +0000
@@ -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
@@ -172,6 +172,7 @@
     if (convert != NULL) {
         BIO_printf(bio_out, "OpenSSL cipher name: %s\n",
                    OPENSSL_cipher_name(convert));
+        ret = 0;
         goto end;
     }
 
diff -r 6e737092ecba -r c69867c22902 crypto/external/bsd/openssl/dist/apps/crl2p7.c
--- a/crypto/external/bsd/openssl/dist/apps/crl2p7.c    Fri Jan 07 14:03:55 2022 +0000
+++ b/crypto/external/bsd/openssl/dist/apps/crl2p7.c    Fri Jan 07 15:46:01 2022 +0000
@@ -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 @@
 
     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);



Home | Main Index | Thread Index | Old Index