Index: /trunk/Config.kmk
===================================================================
--- /trunk/Config.kmk	(revision 95218)
+++ /trunk/Config.kmk	(revision 95219)
@@ -4767,5 +4767,5 @@
 SDK_VBOX_OPENSSL                        := OpenSSL - Only for VBoxRT and/or statically linked programs.
 if defined(VBOX_WITH_OPENSSL3)
- SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS     := $(PATH_OUT)/obj/crypto-3.0.2-headers/include
+ SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS     := $(PATH_OUT)/obj/crypto-3.0.3-headers/include
 else
  SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS     := $(PATH_OUT)/obj/crypto-1.1.1-headers/include
@@ -4785,5 +4785,5 @@
 SDK_VBOX_OPENSSL-x86                    := OpenSSL/x86 - Only for VBoxRT and/or statically linked programs.
 if defined(VBOX_WITH_OPENSSL3)
- SDK_VBOX_OPENSSL-x86_VBOX_DEFAULT_INCS := $(PATH_OUT)/obj/crypto-3.0.2-headers/include
+ SDK_VBOX_OPENSSL-x86_VBOX_DEFAULT_INCS := $(PATH_OUT)/obj/crypto-3.0.3-headers/include
 else
  SDK_VBOX_OPENSSL-x86_VBOX_DEFAULT_INCS := $(PATH_OUT)/obj/crypto-1.1.1-headers/include
Index: /trunk/src/libs/Makefile.kmk
===================================================================
--- /trunk/src/libs/Makefile.kmk	(revision 95218)
+++ /trunk/src/libs/Makefile.kmk	(revision 95219)
@@ -91,5 +91,5 @@
  && ("$(SDK_VBOX_OPENSSL_INCS)" == "$(SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS)" || defined(VBOX_NEED_EXTPACK_OPENSSL))
  ifdef VBOX_WITH_OPENSSL3
-  include $(PATH_SUB_CURRENT)/openssl-3.0.2/Makefile.kmk
+  include $(PATH_SUB_CURRENT)/openssl-3.0.3/Makefile.kmk
  else
   include $(PATH_SUB_CURRENT)/openssl-1.1.1l/Makefile.kmk
Index: /trunk/src/libs/openssl-3.0.3/CHANGES.md
===================================================================
--- /trunk/src/libs/openssl-3.0.3/CHANGES.md	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/CHANGES.md	(revision 95219)
@@ -28,4 +28,112 @@
 
 [Migration guide]: https://github.com/openssl/openssl/tree/master/doc/man7/migration_guide.pod
+
+### Changes between 3.0.2 and 3.0.3 [3 May 2022]
+
+ * Fixed a bug in the c_rehash script which was not properly sanitising shell
+   metacharacters to prevent command injection.  This script is distributed by
+   some operating systems in a manner where it is automatically executed.  On
+   such operating systems, an attacker could execute arbitrary commands with the
+   privileges of the script.
+
+   Use of the c_rehash script is considered obsolete and should be replaced
+   by the OpenSSL rehash command line tool.
+   (CVE-2022-1292)
+
+   *Tomáš Mráz*
+
+ * Fixed a bug in the function `OCSP_basic_verify` that verifies the signer
+   certificate on an OCSP response. The bug caused the function in the case
+   where the (non-default) flag OCSP_NOCHECKS is used to return a postivie
+   response (meaning a successful verification) even in the case where the
+   response signing certificate fails to verify.
+
+   It is anticipated that most users of `OCSP_basic_verify` will not use the
+   OCSP_NOCHECKS flag. In this case the `OCSP_basic_verify` function will return
+   a negative value (indicating a fatal error) in the case of a certificate
+   verification failure. The normal expected return value in this case would be
+   0.
+
+   This issue also impacts the command line OpenSSL "ocsp" application. When
+   verifying an ocsp response with the "-no_cert_checks" option the command line
+   application will report that the verification is successful even though it
+   has in fact failed. In this case the incorrect successful response will also
+   be accompanied by error messages showing the failure and contradicting the
+   apparently successful result.
+   ([CVE-2022-1343])
+
+   *Matt Caswell*
+
+ * Fixed a bug where the RC4-MD5 ciphersuite incorrectly used the
+   AAD data as the MAC key. This made the MAC key trivially predictable.
+
+   An attacker could exploit this issue by performing a man-in-the-middle attack
+   to modify data being sent from one endpoint to an OpenSSL 3.0 recipient such
+   that the modified data would still pass the MAC integrity check.
+
+   Note that data sent from an OpenSSL 3.0 endpoint to a non-OpenSSL 3.0
+   endpoint will always be rejected by the recipient and the connection will
+   fail at that point. Many application protocols require data to be sent from
+   the client to the server first. Therefore, in such a case, only an OpenSSL
+   3.0 server would be impacted when talking to a non-OpenSSL 3.0 client.
+
+   If both endpoints are OpenSSL 3.0 then the attacker could modify data being
+   sent in both directions. In this case both clients and servers could be
+   affected, regardless of the application protocol.
+
+   Note that in the absence of an attacker this bug means that an OpenSSL 3.0
+   endpoint communicating with a non-OpenSSL 3.0 endpoint will fail to complete
+   the handshake when using this ciphersuite.
+
+   The confidentiality of data is not impacted by this issue, i.e. an attacker
+   cannot decrypt data that has been encrypted using this ciphersuite - they can
+   only modify it.
+
+   In order for this attack to work both endpoints must legitimately negotiate
+   the RC4-MD5 ciphersuite. This ciphersuite is not compiled by default in
+   OpenSSL 3.0, and is not available within the default provider or the default
+   ciphersuite list. This ciphersuite will never be used if TLSv1.3 has been
+   negotiated. In order for an OpenSSL 3.0 endpoint to use this ciphersuite the
+   following must have occurred:
+
+   1) OpenSSL must have been compiled with the (non-default) compile time option
+      enable-weak-ssl-ciphers
+
+   2) OpenSSL must have had the legacy provider explicitly loaded (either
+      through application code or via configuration)
+
+   3) The ciphersuite must have been explicitly added to the ciphersuite list
+
+   4) The libssl security level must have been set to 0 (default is 1)
+
+   5) A version of SSL/TLS below TLSv1.3 must have been negotiated
+
+   6) Both endpoints must negotiate the RC4-MD5 ciphersuite in preference to any
+      others that both endpoints have in common
+   (CVE-2022-1434)
+
+   *Matt Caswell*
+
+ * Fix a bug in the OPENSSL_LH_flush() function that breaks reuse of the memory
+   occuppied by the removed hash table entries.
+
+   This function is used when decoding certificates or keys. If a long lived
+   process periodically decodes certificates or keys its memory usage will
+   expand without bounds and the process might be terminated by the operating
+   system causing a denial of service. Also traversing the empty hash table
+   entries will take increasingly more time.
+
+   Typically such long lived processes might be TLS clients or TLS servers
+   configured to accept client certificate authentication.
+   (CVE-2022-1473)
+
+   *Hugo Landau, Aliaksei Levin*
+
+ * The functions `OPENSSL_LH_stats` and `OPENSSL_LH_stats_bio` now only report
+   the `num_items`, `num_nodes` and `num_alloc_nodes` statistics. All other
+   statistics are no longer supported. For compatibility, these statistics are
+   still listed in the output but are now always reported as zero.
+
+   *Hugo Landau*
 
 ### Changes between 3.0.1 and 3.0.2 [15 Mar 2022]
Index: /trunk/src/libs/openssl-3.0.3/CONTRIBUTING.md
===================================================================
--- /trunk/src/libs/openssl-3.0.3/CONTRIBUTING.md	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/CONTRIBUTING.md	(revision 95219)
@@ -61,5 +61,5 @@
     whenever a PR is created or updated.
 
-    [coding style]: https://www.openssl.org/policies/codingstyle.html
+    [coding style]: https://www.openssl.org/policies/technical/coding-style.html
 
  5. When at all possible, patches should include tests. These can
Index: /trunk/src/libs/openssl-3.0.3/Config.kmk
===================================================================
--- /trunk/src/libs/openssl-3.0.3/Config.kmk	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/Config.kmk	(revision 95219)
@@ -32,5 +32,5 @@
 
 # Can't use relative paths when dealing with sub-makefiles.
-VBOX_PATH_OPENSSL           := $(PATH_ROOT)/src/libs/openssl-3.0.2
+VBOX_PATH_OPENSSL           := $(PATH_ROOT)/src/libs/openssl-3.0.3
 VBOX_PATH_CRYPTO            := $(VBOX_PATH_OPENSSL)/crypto
 VBOX_PATH_CRYPTO_GENASM     := $(VBOX_PATH_CRYPTO)/genasm-$(VBOX_CRYPTO_ASM_SCHEME)
@@ -46,5 +46,5 @@
 VBOX_PATH_CRYPTO_DES        := $(VBOX_PATH_CRYPTO)/des
 VBOX_PATH_CRYPTO_CAMELLIA   := $(VBOX_PATH_CRYPTO)/camellia
-VBOX_INST_CRYPTO_HEADERS    := obj/$(if-expr "$(CURSUBDIR)" == ".",,$(CURSUBDIR)/)crypto-3.0.2-headers/include/openssl/
+VBOX_INST_CRYPTO_HEADERS    := obj/$(if-expr "$(CURSUBDIR)" == ".",,$(CURSUBDIR)/)crypto-3.0.3-headers/include/openssl/
 VBOX_PATH_CRYPTO_HEADERS    := $(abspath $(PATH_OUT))/$(patsubst %/,%,$(VBOX_INST_CRYPTO_HEADERS))
 VBOX_PATH_CRYPTO_PROVIDERS  := $(VBOX_PATH_OPENSSL)/providers
Index: /trunk/src/libs/openssl-3.0.3/Configurations/platform/AIX.pm
===================================================================
--- /trunk/src/libs/openssl-3.0.3/Configurations/platform/AIX.pm	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/Configurations/platform/AIX.pm	(revision 95219)
@@ -26,4 +26,4 @@
         if $unified_info{attributes}->{libraries}->{$_[1]}->{noinst};
 
-    return platform::BASE->staticname($_[1]) . '_a';
+    return platform::BASE->staticname($_[1]) . ($disabled{shared} ? '' : '_a');
 }
Index: /trunk/src/libs/openssl-3.0.3/NEWS.md
===================================================================
--- /trunk/src/libs/openssl-3.0.3/NEWS.md	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/NEWS.md	(revision 95219)
@@ -18,4 +18,15 @@
 OpenSSL 3.0
 -----------
+
+### Major changes between OpenSSL 3.0.2 and OpenSSL 3.0.3 [3 May 2022]
+
+  * Fixed a bug in the c_rehash script which was not properly sanitising shell
+    metacharacters to prevent command injection ([CVE-2022-1292])
+  * Fixed a bug in the function `OCSP_basic_verify` that verifies the signer
+    certificate on an OCSP response ([CVE-2022-1343])
+  * Fixed a bug where the RC4-MD5 ciphersuite incorrectly used the
+    AAD data as the MAC key ([CVE-2022-1434])
+  * Fix a bug in the OPENSSL_LH_flush() function that breaks reuse of the memory
+    occuppied by the removed hash table entries ([CVE-2022-1473])
 
 ### Major changes between OpenSSL 3.0.1 and OpenSSL 3.0.2 [15 Mar 2022]
Index: /trunk/src/libs/openssl-3.0.3/NOTES-WINDOWS.md
===================================================================
--- /trunk/src/libs/openssl-3.0.3/NOTES-WINDOWS.md	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/NOTES-WINDOWS.md	(revision 95219)
@@ -29,10 +29,10 @@
 ==============================
 
-The native builds using Visual C++ have a VC-* prefix.
+The native builds using Visual C++ have a `VC-*` prefix.
 
 Requirement details
 -------------------
 
-In addition to the requirements and instructions listed in INSTALL.md,
+In addition to the requirements and instructions listed in `INSTALL.md`,
 these are required as well:
 
@@ -65,20 +65,24 @@
  4. Use Visual Studio Developer Command Prompt with administrative privileges,
     choosing one of its variants depending on the intended architecture.
-    Or run "cmd" and execute "vcvarsall.bat" with one of the options x86,
-    x86_amd64, x86_arm, x86_arm64, amd64, amd64_x86, amd64_arm, or amd64_arm64.
-    This sets up the environment variables needed for nmake.exe, cl.exe, etc.
+    Or run `cmd` and execute `vcvarsall.bat` with one of the options `x86`,
+    `x86_amd64`, `x86_arm`, `x86_arm64`, `amd64`, `amd64_x86`, `amd64_arm`,
+    or `amd64_arm64`.
+    This sets up the environment variables needed for `nmake.exe`, `cl.exe`,
+    etc.
     See also
     <https://docs.microsoft.com/cpp/build/building-on-the-command-line>
 
  5. From the root of the OpenSSL source directory enter
-    perl Configure VC-WIN32    if you want 32-bit OpenSSL or
-    perl Configure VC-WIN64A   if you want 64-bit OpenSSL or
-    perl Configure             to let Configure figure out the platform
-
- 6. nmake
-
- 7. nmake test
-
- 8. nmake install
+    - `perl Configure VC-WIN32`     if you want 32-bit OpenSSL or
+    - `perl Configure VC-WIN64A`    if you want 64-bit OpenSSL or
+    - `perl Configure VC-WIN64-ARM` if you want Windows on Arm (win-arm64)
+       OpenSSL or
+    - `perl Configure`              to let Configure figure out the platform
+
+ 6. `nmake`
+
+ 7. `nmake test`
+
+ 8. `nmake install`
 
 For the full installation instructions, or if anything goes wrong at any stage,
@@ -110,16 +114,16 @@
 your account is in the Administrators group.  To work around that,
 start the command prompt by right-clicking on it and choosing "Run as
-Administrator" before running 'nmake install'.  The other solution
+Administrator" before running `nmake install`.  The other solution
 is, of course, to choose a different set of directories by using
---prefix and --openssldir when configuring.
-
-Special notes for Universal Windows Platform builds, aka VC-*-UWP
---------------------------------------------------------------------
+`--prefix` and `--openssldir` when configuring.
+
+Special notes for Universal Windows Platform builds, aka `VC-*-UWP`
+-------------------------------------------------------------------
 
  - UWP targets only support building the static and dynamic libraries.
 
- - You should define the platform type to "uwp" and the target arch via
-   "vcvarsall.bat" before you compile. For example, if you want to build
-   "arm64" builds, you should run "vcvarsall.bat x86_arm64 uwp".
+ - You should define the platform type to `uwp` and the target arch via
+   `vcvarsall.bat` before you compile. For example, if you want to build
+   `arm64` builds, you should run `vcvarsall.bat x86_arm64 uwp`.
 
 Native builds using Embarcadero C++Builder
@@ -128,5 +132,5 @@
 This toolchain (a descendant of Turbo/Borland C++) is an alternative to MSVC.
 OpenSSL currently includes an experimental 32-bit configuration targeting the
-Clang-based compiler (bcc32c.exe) in v10.3.3 Community Edition.
+Clang-based compiler (`bcc32c.exe`) in v10.3.3 Community Edition.
 <https://www.embarcadero.com/products/cbuilder/starter>
 
@@ -136,9 +140,9 @@
 
  3. Go to the root of the OpenSSL source directory and run:
-    perl Configure BC-32 --prefix=%CD%
-
- 4. make -N
-
- 5. make -N test
+    `perl Configure BC-32 --prefix=%CD%`
+
+ 4. `make -N`
+
+ 5. `make -N test`
 
  6. Build your program against this OpenSSL:
@@ -167,7 +171,7 @@
    - Perl, at least version 5.10.0, which usually comes pre-installed with MSYS2
 
-   - make, installed using "pacman -S make" into the MSYS2 environment
-
-   - MinGW[64] compiler: mingw-w64-i686-gcc and/or mingw-w64-x86_64-gcc.
+   - make, installed using `pacman -S make` into the MSYS2 environment
+
+   - MinGW[64] compiler: `mingw-w64-i686-gcc` and/or `mingw-w64-x86_64-gcc`.
      These compilers must be on your MSYS2 $PATH.
      A common error is to not have these on your $PATH.
@@ -177,20 +181,26 @@
 
        ./Configure mingw ...
+
    or
+
        ./Configure mingw64 ...
+
    or
+
        ./Configure ...
 
    for the default architecture.
 
-   Apart from that, follow the Unix / Linux instructions in INSTALL.md.
+   Apart from that, follow the Unix / Linux instructions in `INSTALL.md`.
 
  * It is also possible to build mingw[64] on Linux or Cygwin.
 
-   In this case configure with the corresponding --cross-compile-prefix= option.
-   For example
+   In this case configure with the corresponding `--cross-compile-prefix=`
+   option. For example
 
        ./Configure mingw --cross-compile-prefix=i686-w64-mingw32- ...
+
    or
+
        ./Configure mingw64 --cross-compile-prefix=x86_64-w64-mingw32- ...
 
@@ -204,16 +214,16 @@
 
 If you link with static OpenSSL libraries then you're expected to
-additionally link your application with WS2_32.LIB, GDI32.LIB,
-ADVAPI32.LIB, CRYPT32.LIB and USER32.LIB. Those developing
+additionally link your application with `WS2_32.LIB`, `GDI32.LIB`,
+`ADVAPI32.LIB`, `CRYPT32.LIB` and `USER32.LIB`. Those developing
 non-interactive service applications might feel concerned about
-linking with GDI32.LIB and USER32.LIB, as they are justly associated
+linking with `GDI32.LIB` and `USER32.LIB`, as they are justly associated
 with interactive desktop, which is not available to service
 processes. The toolkit is designed to detect in which context it's
 currently executed, GUI, console app or service, and act accordingly,
 namely whether or not to actually make GUI calls. Additionally those
-who wish to /DELAYLOAD:GDI32.DLL and /DELAYLOAD:USER32.DLL and
+who wish to `/DELAYLOAD:GDI32.DLL` and `/DELAYLOAD:USER32.DLL` and
 actually keep them off service process should consider implementing
-and exporting from .exe image in question own _OPENSSL_isservice not
-relying on USER32.DLL. E.g., on Windows Vista and later you could:
+and exporting from .exe image in question own `_OPENSSL_isservice` not
+relying on `USER32.DLL`. E.g., on Windows Vista and later you could:
 
        __declspec(dllexport) __cdecl BOOL _OPENSSL_isservice(void)
@@ -234,5 +244,5 @@
 ==========================
 
-Cygwin implements a POSIX/Unix runtime system (cygwin1.dll) on top of the
+Cygwin implements a POSIX/Unix runtime system (`cygwin1.dll`) on top of the
 Windows subsystem and provides a Bash shell and GNU tools environment.
 Consequently, a build of OpenSSL with Cygwin is virtually identical to the
@@ -250,6 +260,6 @@
 Apart from that, follow the Unix / Linux instructions in INSTALL.md.
 
-NOTE: "make test" and normal file operations may fail in directories
-mounted as text (i.e. mount -t c:\somewhere /home) due to Cygwin
+NOTE: `make test` and normal file operations may fail in directories
+mounted as text (i.e. `mount -t c:\somewhere /home`) due to Cygwin
 stripping of carriage returns. To avoid this ensure that a binary
-mount is used, e.g. mount -b c:\somewhere /home.
+mount is used, e.g. `mount -b c:\somewhere /home`.
Index: /trunk/src/libs/openssl-3.0.3/VERSION.dat
===================================================================
--- /trunk/src/libs/openssl-3.0.3/VERSION.dat	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/VERSION.dat	(revision 95219)
@@ -1,7 +1,7 @@
 MAJOR=3
 MINOR=0
-PATCH=2
+PATCH=3
 PRE_RELEASE_TAG=
 BUILD_METADATA=
-RELEASE_DATE="15 Mar 2022"
+RELEASE_DATE="3 May 2022"
 SHLIB_VERSION=3
Index: /trunk/src/libs/openssl-3.0.3/apps/ca.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/apps/ca.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/apps/ca.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -2368,5 +2368,5 @@
     case REV_CRL_REASON:
         for (i = 0; i < 8; i++) {
-            if (strcasecmp(rev_arg, crl_reasons[i]) == 0) {
+            if (OPENSSL_strcasecmp(rev_arg, crl_reasons[i]) == 0) {
                 reason = crl_reasons[i];
                 break;
@@ -2585,5 +2585,5 @@
     if (reason_str) {
         for (i = 0; i < NUM_REASONS; i++) {
-            if (strcasecmp(reason_str, crl_reasons[i]) == 0) {
+            if (OPENSSL_strcasecmp(reason_str, crl_reasons[i]) == 0) {
                 reason_code = i;
                 break;
Index: /trunk/src/libs/openssl-3.0.3/apps/cmp.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/apps/cmp.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/apps/cmp.c	(revision 95219)
@@ -1746,5 +1746,5 @@
     valptr++;
 
-    if (strncasecmp(valptr, "int:", 4) != 0) {
+    if (OPENSSL_strncasecmp(valptr, "int:", 4) != 0) {
         CMP_err("missing 'int:' in -geninfo option");
         return 0;
Index: /trunk/src/libs/openssl-3.0.3/apps/ecparam.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/apps/ecparam.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/apps/ecparam.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2002-2022 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
  *
@@ -230,5 +230,5 @@
         *p = OSSL_PARAM_construct_end();
 
-        if (strcasecmp(curve_name, "SM2") == 0)
+        if (OPENSSL_strcasecmp(curve_name, "SM2") == 0)
             gctx_params = EVP_PKEY_CTX_new_from_name(NULL, "sm2", NULL);
         else
Index: /trunk/src/libs/openssl-3.0.3/apps/lib/apps.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/apps/lib/apps.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/apps/lib/apps.c	(revision 95219)
@@ -689,6 +689,6 @@
     char *pass_string;
 
-    if (exclude_http && (strncasecmp(uri, "http://", 7) == 0
-                         || strncasecmp(uri, "https://", 8) == 0)) {
+    if (exclude_http && (OPENSSL_strncasecmp(uri, "http://", 7) == 0
+                         || OPENSSL_strncasecmp(uri, "https://", 8) == 0)) {
         BIO_printf(bio_err, "error: HTTP retrieval not allowed for %s\n", desc);
         return ret;
@@ -1183,7 +1183,7 @@
 int set_dateopt(unsigned long *dateopt, const char *arg)
 {
-    if (strcasecmp(arg, "rfc_822") == 0)
+    if (OPENSSL_strcasecmp(arg, "rfc_822") == 0)
         *dateopt = ASN1_DTFLGS_RFC822;
-    else if (strcasecmp(arg, "iso_8601") == 0)
+    else if (OPENSSL_strcasecmp(arg, "iso_8601") == 0)
         *dateopt = ASN1_DTFLGS_ISO8601;
     return 0;
@@ -1192,9 +1192,9 @@
 int set_ext_copy(int *copy_type, const char *arg)
 {
-    if (strcasecmp(arg, "none") == 0)
+    if (OPENSSL_strcasecmp(arg, "none") == 0)
         *copy_type = EXT_COPY_NONE;
-    else if (strcasecmp(arg, "copy") == 0)
+    else if (OPENSSL_strcasecmp(arg, "copy") == 0)
         *copy_type = EXT_COPY_ADD;
-    else if (strcasecmp(arg, "copyall") == 0)
+    else if (OPENSSL_strcasecmp(arg, "copyall") == 0)
         *copy_type = EXT_COPY_ALL;
     else
@@ -1276,5 +1276,5 @@
 
     for (ptbl = in_tbl; ptbl->name; ptbl++) {
-        if (strcasecmp(arg, ptbl->name) == 0) {
+        if (OPENSSL_strcasecmp(arg, ptbl->name) == 0) {
             *flags &= ~ptbl->mask;
             if (c)
Index: /trunk/src/libs/openssl-3.0.3/apps/lib/engine_loader.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/apps/lib/engine_loader.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/apps/lib/engine_loader.c	(revision 95219)
@@ -72,5 +72,5 @@
     OSSL_STORE_LOADER_CTX *ctx = NULL;
 
-    if (strncasecmp(p, ENGINE_SCHEME_COLON, sizeof(ENGINE_SCHEME_COLON) - 1)
+    if (OPENSSL_strncasecmp(p, ENGINE_SCHEME_COLON, sizeof(ENGINE_SCHEME_COLON) - 1)
         != 0)
         return NULL;
Index: /trunk/src/libs/openssl-3.0.3/apps/lib/http_server.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/apps/lib/http_server.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/apps/lib/http_server.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -454,8 +454,9 @@
         *line_end = '\0';
         /* https://tools.ietf.org/html/rfc7230#section-6.3 Persistence */
-        if (found_keep_alive != NULL && strcasecmp(key, "Connection") == 0) {
-            if (strcasecmp(value, "keep-alive") == 0)
+        if (found_keep_alive != NULL
+            && OPENSSL_strcasecmp(key, "Connection") == 0) {
+            if (OPENSSL_strcasecmp(value, "keep-alive") == 0)
                 *found_keep_alive = 1;
-            else if (strcasecmp(value, "close") == 0)
+            else if (OPENSSL_strcasecmp(value, "close") == 0)
                 *found_keep_alive = 0;
         }
Index: /trunk/src/libs/openssl-3.0.3/apps/lib/names.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/apps/lib/names.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/apps/lib/names.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -12,12 +12,9 @@
 #include <openssl/safestack.h>
 #include "names.h"
-
-#ifdef _WIN32
-# define strcasecmp _stricmp
-#endif
+#include "openssl/crypto.h"
 
 int name_cmp(const char * const *a, const char * const *b)
 {
-    return strcasecmp(*a, *b);
+    return OPENSSL_strcasecmp(*a, *b);
 }
 
Index: /trunk/src/libs/openssl-3.0.3/apps/lib/vms_term_sock.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/apps/lib/vms_term_sock.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/apps/lib/vms_term_sock.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright 2016 VMS Software, Inc. All Rights Reserved.
  *
@@ -134,5 +134,5 @@
 
     LogMessage ("Enter 'q' or 'Q' to quit ...");
-    while (strcasecmp (TermBuff, "Q")) {
+    while (OPENSSL_strcasecmp (TermBuff, "Q")) {
         /*
         ** Create the terminal socket
Index: /trunk/src/libs/openssl-3.0.3/apps/list.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/apps/list.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/apps/list.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -72,5 +72,5 @@
     if (select_name != NULL
         && (c == NULL
-            || strcasecmp(select_name,  EVP_CIPHER_get0_name(c)) != 0))
+            || OPENSSL_strcasecmp(select_name,  EVP_CIPHER_get0_name(c)) != 0))
         return;
     if (c != NULL) {
@@ -371,5 +371,5 @@
 static int rand_cmp(const EVP_RAND * const *a, const EVP_RAND * const *b)
 {
-    int ret = strcasecmp(EVP_RAND_get0_name(*a), EVP_RAND_get0_name(*b));
+    int ret = OPENSSL_strcasecmp(EVP_RAND_get0_name(*a), EVP_RAND_get0_name(*b));
 
     if (ret == 0)
@@ -405,5 +405,5 @@
 
         if (select_name != NULL
-            && strcasecmp(EVP_RAND_get0_name(m), select_name) != 0)
+            && OPENSSL_strcasecmp(EVP_RAND_get0_name(m), select_name) != 0)
             continue;
         BIO_printf(bio_out, "  %s", EVP_RAND_get0_name(m));
@@ -464,5 +464,5 @@
             for (; gettables->key != NULL; gettables++) {
                 /* State has been dealt with already, so ignore */
-                if (strcasecmp(gettables->key, OSSL_RAND_PARAM_STATE) == 0)
+                if (OPENSSL_strcasecmp(gettables->key, OSSL_RAND_PARAM_STATE) == 0)
                     continue;
                 /* Outside of verbose mode, we skip non-string values */
Index: /trunk/src/libs/openssl-3.0.3/apps/ocsp.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/apps/ocsp.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/apps/ocsp.c	(revision 95219)
@@ -1116,4 +1116,9 @@
                                             V_OCSP_CERTSTATUS_REVOKED,
                                             reason, revtm, thisupd, nextupd);
+            if (single == NULL) {
+                *resp = OCSP_response_create(OCSP_RESPONSE_STATUS_INTERNALERROR,
+                                             NULL);
+                goto end;
+            }
             if (invtm != NULL)
                 OCSP_SINGLERESP_add1_ext_i2d(single, NID_invalidity_date,
Index: /trunk/src/libs/openssl-3.0.3/apps/rehash.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/apps/rehash.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/apps/rehash.c	(revision 95219)
@@ -215,5 +215,5 @@
     for (type = OSSL_NELEM(suffixes) - 1; type > 0; type--) {
         const char *suffix = suffixes[type];
-        if (strncasecmp(suffix, &filename[i], strlen(suffix)) == 0)
+        if (OPENSSL_strncasecmp(suffix, &filename[i], strlen(suffix)) == 0)
             break;
     }
@@ -250,5 +250,5 @@
         goto end;
     for (i = 0; i < OSSL_NELEM(extensions); i++) {
-        if (strcasecmp(extensions[i], ext + 1) == 0)
+        if (OPENSSL_strcasecmp(extensions[i], ext + 1) == 0)
             break;
     }
Index: /trunk/src/libs/openssl-3.0.3/apps/req.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/apps/req.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/apps/req.c	(revision 95219)
@@ -993,5 +993,5 @@
         }
         fprintf(stdout, "Modulus=");
-        if (EVP_PKEY_is_a(tpubkey, "RSA")) {
+        if (EVP_PKEY_is_a(tpubkey, "RSA") || EVP_PKEY_is_a(tpubkey, "RSA-PSS")) {
             BIGNUM *n = NULL;
 
Index: /trunk/src/libs/openssl-3.0.3/apps/rsa.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/apps/rsa.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/apps/rsa.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -258,5 +258,5 @@
         goto end;
     }
-    if (!EVP_PKEY_is_a(pkey, "RSA")) {
+    if (!EVP_PKEY_is_a(pkey, "RSA") && !EVP_PKEY_is_a(pkey, "RSA-PSS")) {
         BIO_printf(bio_err, "Not an RSA key\n");
         goto end;
Index: /trunk/src/libs/openssl-3.0.3/apps/s_server.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/apps/s_server.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/apps/s_server.c	(revision 95219)
@@ -433,5 +433,5 @@
 
     if (servername != NULL) {
-        if (strcasecmp(servername, p->servername))
+        if (OPENSSL_strcasecmp(servername, p->servername))
             return p->extension_error;
         if (ctx2 != NULL) {
Index: /trunk/src/libs/openssl-3.0.3/apps/ts.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/apps/ts.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/apps/ts.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -977,4 +977,8 @@
 
     cert_ctx = X509_STORE_new();
+    if (cert_ctx == NULL) {
+        BIO_printf(bio_err, "memory allocation failure\n");
+        return NULL;
+    }
     X509_STORE_set_verify_cb(cert_ctx, verify_cb);
     if (CApath != NULL) {
Index: /trunk/src/libs/openssl-3.0.3/apps/x509.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/apps/x509.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/apps/x509.c	(revision 95219)
@@ -955,5 +955,5 @@
         } else if (i == modulus) {
             BIO_printf(out, "Modulus=");
-            if (EVP_PKEY_is_a(pkey, "RSA")) {
+            if (EVP_PKEY_is_a(pkey, "RSA") || EVP_PKEY_is_a(pkey, "RSA-PSS")) {
                 BIGNUM *n = NULL;
 
Index: /trunk/src/libs/openssl-3.0.3/crypto/LPdir_unix.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/LPdir_unix.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/LPdir_unix.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2004-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -142,5 +142,6 @@
         if (p > (*ctx)->entry_name && p[-1] == ';')
             p[-1] = '\0';
-        if (strcasecmp((*ctx)->entry_name, (*ctx)->previous_entry_name) == 0)
+        if (OPENSSL_strcasecmp((*ctx)->entry_name,
+                               (*ctx)->previous_entry_name) == 0)
             goto again;
     }
Index: /trunk/src/libs/openssl-3.0.3/crypto/asn1/ameth_lib.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/asn1/ameth_lib.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/asn1/ameth_lib.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -11,5 +11,4 @@
 #define OPENSSL_SUPPRESS_DEPRECATED
 
-#include "e_os.h"               /* for strncasecmp */
 #include "internal/cryptlib.h"
 #include <stdio.h>
@@ -135,5 +134,5 @@
             continue;
         if ((int)strlen(ameth->pem_str) == len
-            && strncasecmp(ameth->pem_str, str, len) == 0)
+            && OPENSSL_strncasecmp(ameth->pem_str, str, len) == 0)
             return ameth;
     }
Index: /trunk/src/libs/openssl-3.0.3/crypto/asn1/asn1_gen.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/asn1/asn1_gen.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/asn1/asn1_gen.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2002-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -11,5 +11,4 @@
 #include <openssl/asn1.h>
 #include <openssl/x509v3.h>
-#include "e_os.h" /* strncasecmp() */
 
 #define ASN1_GEN_FLAG           0x10000
@@ -566,5 +565,6 @@
     tntmp = tnst;
     for (i = 0; i < OSSL_NELEM(tnst); i++, tntmp++) {
-        if ((len == tntmp->len) && (strncasecmp(tntmp->strnam, tagstr, len) == 0))
+        if ((len == tntmp->len)
+            && (OPENSSL_strncasecmp(tntmp->strnam, tagstr, len) == 0))
             return tntmp->tag;
     }
Index: /trunk/src/libs/openssl-3.0.3/crypto/bn/bn_div.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/bn/bn_div.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/bn/bn_div.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -447,6 +447,8 @@
     snum->top = div_n;
     snum->flags |= BN_FLG_FIXED_TOP;
-    if (rm != NULL)
-        bn_rshift_fixed_top(rm, snum, norm_shift);
+
+    if (rm != NULL && bn_rshift_fixed_top(rm, snum, norm_shift) == 0)
+        goto err;
+
     BN_CTX_end(ctx);
     return 1;
Index: /trunk/src/libs/openssl-3.0.3/crypto/bn/bn_exp.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/bn/bn_exp.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/bn/bn_exp.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -188,4 +188,6 @@
     }
 
+    BN_RECP_CTX_init(&recp);
+
     BN_CTX_start(ctx);
     aa = BN_CTX_get(ctx);
@@ -194,5 +196,4 @@
         goto err;
 
-    BN_RECP_CTX_init(&recp);
     if (m->neg) {
         /* ignore sign of 'm' */
Index: /trunk/src/libs/openssl-3.0.3/crypto/camellia/camellia.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/camellia/camellia.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/camellia/camellia.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -500,8 +500,8 @@
 }
 
-void Camellia_DecryptBlock(int keyBitLength, const u8 plaintext[],
-                           const KEY_TABLE_TYPE keyTable, u8 ciphertext[])
+void Camellia_DecryptBlock(int keyBitLength, const u8 ciphertext[],
+                           const KEY_TABLE_TYPE keyTable, u8 plaintext[])
 {
     Camellia_DecryptBlock_Rounds(keyBitLength == 128 ? 3 : 4,
-                                 plaintext, keyTable, ciphertext);
+                                 ciphertext, keyTable, plaintext);
 }
Index: /trunk/src/libs/openssl-3.0.3/crypto/chacha/build.info
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/chacha/build.info	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/chacha/build.info	(revision 95219)
@@ -6,5 +6,5 @@
   $CHACHAASM_x86_64=chacha-x86_64.s
 
-  $CHACHAASM_ia64=chacha-ia64.S
+  $CHACHAASM_ia64=chacha-ia64.s
 
   $CHACHAASM_s390x=chacha-s390x.S
@@ -37,3 +37,3 @@
 GENERATE[chacha-c64xplus.S]=asm/chacha-c64xplus.pl
 GENERATE[chacha-s390x.S]=asm/chacha-s390x.pl
-GENERATE[chacha-ia64.S]=asm/chacha-ia64.pl
+GENERATE[chacha-ia64.s]=asm/chacha-ia64.pl
Index: /trunk/src/libs/openssl-3.0.3/crypto/cms/cms_io.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/cms/cms_io.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/cms/cms_io.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2008-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -42,6 +42,9 @@
                               ossl_cms_ctx_get0_libctx(ctx),
                               ossl_cms_ctx_get0_propq(ctx));
-    if (ci != NULL)
+    if (ci != NULL) {
+        ERR_set_mark();
         ossl_cms_resolve_libctx(ci);
+        ERR_pop_to_mark();
+    }
     return ci;
 }
@@ -105,6 +108,9 @@
                                                ossl_cms_ctx_get0_libctx(ctx),
                                                ossl_cms_ctx_get0_propq(ctx));
-    if (ci != NULL)
+    if (ci != NULL) {
+        ERR_set_mark();
         ossl_cms_resolve_libctx(ci);
+        ERR_pop_to_mark();
+    }
     return ci;
 }
Index: /trunk/src/libs/openssl-3.0.3/crypto/conf/conf_def.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/conf/conf_def.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/conf/conf_def.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -12,5 +12,5 @@
 #include <stdio.h>
 #include <string.h>
-#include "e_os.h" /* strcasecmp and struct stat */
+#include "e_os.h" /* struct stat */
 #ifdef __TANDEM
 # include <sys/types.h> /* needed for stat.h */
@@ -193,9 +193,9 @@
 static int parsebool(const char *pval, int *flag)
 {
-    if (strcasecmp(pval, "on") == 0
-            || strcasecmp(pval, "true") == 0) {
+    if (OPENSSL_strcasecmp(pval, "on") == 0
+            || OPENSSL_strcasecmp(pval, "true") == 0) {
         *flag = 1;
-    } else if (strcasecmp(pval, "off") == 0
-            || strcasecmp(pval, "false") == 0) {
+    } else if (OPENSSL_strcasecmp(pval, "off") == 0
+            || OPENSSL_strcasecmp(pval, "false") == 0) {
         *flag = 0;
     } else {
@@ -840,6 +840,8 @@
 
 
-        if ((namelen > 5 && strcasecmp(filename + namelen - 5, ".conf") == 0)
-            || (namelen > 4 && strcasecmp(filename + namelen - 4, ".cnf") == 0)) {
+        if ((namelen > 5
+             && OPENSSL_strcasecmp(filename + namelen - 5, ".conf") == 0)
+             || (namelen > 4
+                 && OPENSSL_strcasecmp(filename + namelen - 4, ".cnf") == 0)) {
             size_t newlen;
             char *newpath;
Index: /trunk/src/libs/openssl-3.0.3/crypto/context.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/context.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/context.c	(revision 95219)
@@ -15,4 +15,5 @@
 #include "internal/bio.h"
 #include "internal/provider.h"
+#include "crypto/ctype.h"
 
 struct ossl_lib_ctx_onfree_list_st {
@@ -151,5 +152,6 @@
 {
     return CRYPTO_THREAD_init_local(&default_context_thread_local, NULL)
-        && context_init(&default_context_int);
+        && context_init(&default_context_int)
+        && ossl_init_casecmp();
 }
 
Index: /trunk/src/libs/openssl-3.0.3/crypto/core_namemap.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/core_namemap.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/core_namemap.c	(revision 95219)
@@ -8,5 +8,4 @@
  */
 
-#include "e_os.h"                /* strcasecmp */
 #include "internal/namemap.h"
 #include <openssl/lhash.h>
@@ -50,5 +49,5 @@
 static int namenum_cmp(const NAMENUM_ENTRY *a, const NAMENUM_ENTRY *b)
 {
-    return strcasecmp(a->name, b->name);
+    return OPENSSL_strcasecmp(a->name, b->name);
 }
 
Index: /trunk/src/libs/openssl-3.0.3/crypto/ctype.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/ctype.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/ctype.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -12,4 +12,17 @@
 #include "crypto/ctype.h"
 #include <openssl/ebcdic.h>
+
+#include <openssl/crypto.h>
+#include "internal/core.h"
+#include "internal/thread_once.h"
+
+#ifndef OPENSSL_SYS_WINDOWS
+#include <strings.h>
+#endif
+#include <locale.h>
+
+#ifdef OPENSSL_SYS_MACOSX
+#include <xlocale.h>
+#endif
 
 /*
@@ -279,2 +292,89 @@
     return 0;
 }
+
+/* str[n]casecmp_l is defined in POSIX 2008-01. Value is taken accordingly
+ * https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html */
+
+#if (defined OPENSSL_SYS_WINDOWS) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L)
+
+# if defined OPENSSL_SYS_WINDOWS
+# define locale_t _locale_t
+# define freelocale _free_locale
+# define strcasecmp_l _stricmp_l
+# define strncasecmp_l _strnicmp_l
+# endif
+
+# ifndef FIPS_MODULE
+static locale_t loc;
+
+static int locale_base_inited = 0;
+static CRYPTO_ONCE locale_base = CRYPTO_ONCE_STATIC_INIT;
+static CRYPTO_ONCE locale_base_deinit = CRYPTO_ONCE_STATIC_INIT;
+
+void *ossl_c_locale() {
+    return (void *)loc;
+}
+
+DEFINE_RUN_ONCE_STATIC(ossl_init_locale_base)
+{
+# ifdef OPENSSL_SYS_WINDOWS
+    loc = _create_locale(LC_COLLATE, "C");
+# else
+    loc = newlocale(LC_COLLATE_MASK, "C", (locale_t) 0);
+# endif
+    locale_base_inited = 1;
+    return (loc == (locale_t) 0) ? 0 : 1;
+}
+
+DEFINE_RUN_ONCE_STATIC(ossl_deinit_locale_base)
+{
+    if (locale_base_inited && loc) {
+        freelocale(loc);
+        loc = NULL;
+    }
+    return 1;
+}
+
+int ossl_init_casecmp()
+{
+   return RUN_ONCE(&locale_base, ossl_init_locale_base);
+}
+
+void ossl_deinit_casecmp() {
+    (void)RUN_ONCE(&locale_base_deinit, ossl_deinit_locale_base);
+}
+# endif
+
+int OPENSSL_strcasecmp(const char *s1, const char *s2)
+{
+    return strcasecmp_l(s1, s2, (locale_t)ossl_c_locale());
+}
+
+int OPENSSL_strncasecmp(const char *s1, const char *s2, size_t n)
+{
+    return strncasecmp_l(s1, s2, n, (locale_t)ossl_c_locale());
+}
+#else
+# ifndef FIPS_MODULE
+void *ossl_c_locale() {
+    return NULL;
+}
+# endif
+
+int ossl_init_casecmp() {
+    return 1;
+}
+
+void ossl_deinit_casecmp() {
+}
+
+int OPENSSL_strcasecmp(const char *s1, const char *s2)
+{
+    return strcasecmp(s1, s2);
+}
+
+int OPENSSL_strncasecmp(const char *s1, const char *s2, size_t n)
+{
+    return strncasecmp(s1, s2, n);
+}
+#endif
Index: /trunk/src/libs/openssl-3.0.3/crypto/dh/dh_group_params.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/dh/dh_group_params.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/dh/dh_group_params.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -24,5 +24,4 @@
 #include "internal/nelem.h"
 #include "crypto/dh.h"
-#include "e_os.h" /* strcasecmp */
 
 static DH *dh_param_init(OSSL_LIB_CTX *libctx, const DH_NAMED_GROUP *group)
Index: /trunk/src/libs/openssl-3.0.3/crypto/dh/dh_kdf.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/dh/dh_kdf.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/dh/dh_kdf.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2013-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -40,4 +40,6 @@
 
     kdf = EVP_KDF_fetch(libctx, OSSL_KDF_NAME_X942KDF_ASN1, propq);
+    if (kdf == NULL)
+        return 0;
     kctx = EVP_KDF_CTX_new(kdf);
     if (kctx == NULL)
Index: /trunk/src/libs/openssl-3.0.3/crypto/ec/curve448/curve448.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/ec/curve448/curve448.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/ec/curve448/curve448.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright 2015-2016 Cryptography Research, Inc.
  *
@@ -587,4 +587,5 @@
 
             assert(position >= 0);
+            assert(pos < 32);       /* can't fail since current & 0xFFFF != 0 */
             if (odd & (1 << (table_bits + 1)))
                 delta -= (1 << (table_bits + 1));
Index: /trunk/src/libs/openssl-3.0.3/crypto/ec/ec_backend.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/ec/ec_backend.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/ec/ec_backend.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -55,5 +55,5 @@
 
     for (i = 0, sz = OSSL_NELEM(encoding_nameid_map); i < sz; i++) {
-        if (strcasecmp(name, encoding_nameid_map[i].ptr) == 0)
+        if (OPENSSL_strcasecmp(name, encoding_nameid_map[i].ptr) == 0)
             return encoding_nameid_map[i].id;
     }
@@ -92,5 +92,5 @@
 
     for (i = 0, sz = OSSL_NELEM(check_group_type_nameid_map); i < sz; i++) {
-        if (strcasecmp(name, check_group_type_nameid_map[i].ptr) == 0)
+        if (OPENSSL_strcasecmp(name, check_group_type_nameid_map[i].ptr) == 0)
             return check_group_type_nameid_map[i].id;
     }
@@ -137,5 +137,5 @@
 
     for (i = 0, sz = OSSL_NELEM(format_nameid_map); i < sz; i++) {
-        if (strcasecmp(name, format_nameid_map[i].ptr) == 0)
+        if (OPENSSL_strcasecmp(name, format_nameid_map[i].ptr) == 0)
             return format_nameid_map[i].id;
     }
Index: /trunk/src/libs/openssl-3.0.3/crypto/ec/ec_err.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/ec/ec_err.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/ec/ec_err.c	(revision 95219)
@@ -1,5 +1,5 @@
 /*
  * Generated by util/mkerr.pl DO NOT EDIT
- * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -36,4 +36,6 @@
     {ERR_PACK(ERR_LIB_EC, 0, EC_R_EC_GROUP_NEW_BY_NAME_FAILURE),
     "ec group new by name failure"},
+    {ERR_PACK(ERR_LIB_EC, 0, EC_R_EXPLICIT_PARAMS_NOT_SUPPORTED),
+    "explicit params not supported"},
     {ERR_PACK(ERR_LIB_EC, 0, EC_R_FAILED_MAKING_PUBLIC_KEY),
     "failed making public key"},
Index: /trunk/src/libs/openssl-3.0.3/crypto/ec/ec_lib.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/ec/ec_lib.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/ec/ec_lib.c	(revision 95219)
@@ -23,5 +23,4 @@
 #include "internal/nelem.h"
 #include "ec_local.h"
-#include "e_os.h" /* strcasecmp */
 
 /* functions for EC_GROUP objects */
@@ -1388,4 +1387,5 @@
 #endif
 
+#ifndef FIPS_MODULE
 /*
  * Check if the explicit parameters group matches any built-in curves.
@@ -1425,5 +1425,5 @@
          */
 
-#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+# ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
         /*
          * NID_wap_wsg_idm_ecid_wtls12 and NID_secp224r1 are both aliases for
@@ -1433,5 +1433,5 @@
         if (curve_name_nid == NID_wap_wsg_idm_ecid_wtls12)
             curve_name_nid = NID_secp224r1;
-#endif /* !def(OPENSSL_NO_EC_NISTP_64_GCC_128) */
+# endif /* !def(OPENSSL_NO_EC_NISTP_64_GCC_128) */
 
         ret_group = EC_GROUP_new_by_curve_name_ex(libctx, propq, curve_name_nid);
@@ -1468,4 +1468,5 @@
     return NULL;
 }
+#endif /* FIPS_MODULE */
 
 static EC_GROUP *group_new_from_name(const OSSL_PARAM *p,
@@ -1537,7 +1538,11 @@
                                    OSSL_LIB_CTX *libctx, const char *propq)
 {
-    const OSSL_PARAM *ptmp, *pa, *pb;
+    const OSSL_PARAM *ptmp;
+    EC_GROUP *group = NULL;
+
+#ifndef FIPS_MODULE
+    const OSSL_PARAM *pa, *pb;
     int ok = 0;
-    EC_GROUP *group = NULL, *named_group = NULL;
+    EC_GROUP *named_group = NULL;
     BIGNUM *p = NULL, *a = NULL, *b = NULL, *order = NULL, *cofactor = NULL;
     EC_POINT *point = NULL;
@@ -1547,4 +1552,5 @@
     const unsigned char *buf = NULL;
     int encoding_flag = -1;
+#endif
 
     /* This is the simple named group case */
@@ -1560,4 +1566,8 @@
         return group;
     }
+#ifdef FIPS_MODULE
+    ERR_raise(ERR_LIB_EC, EC_R_EXPLICIT_PARAMS_NOT_SUPPORTED);
+    return NULL;
+#else
     /* If it gets here then we are trying explicit parameters */
     bnctx = BN_CTX_new_ex(libctx);
@@ -1582,7 +1592,8 @@
         goto err;
     }
-    if (strcasecmp(ptmp->data, SN_X9_62_prime_field) == 0) {
+    if (OPENSSL_strcasecmp(ptmp->data, SN_X9_62_prime_field) == 0) {
         is_prime_field = 1;
-    } else if (strcasecmp(ptmp->data, SN_X9_62_characteristic_two_field) == 0) {
+    } else if (OPENSSL_strcasecmp(ptmp->data,
+                                  SN_X9_62_characteristic_two_field) == 0) {
         is_prime_field = 0;
     } else {
@@ -1624,8 +1635,8 @@
         group = EC_GROUP_new_curve_GFp(p, a, b, bnctx);
     } else {
-#ifdef OPENSSL_NO_EC2M
+# ifdef OPENSSL_NO_EC2M
         ERR_raise(ERR_LIB_EC, EC_R_GF2M_NOT_SUPPORTED);
         goto err;
-#else
+# else
         /* create the EC_GROUP structure */
         group = EC_GROUP_new_curve_GF2m(p, a, b, NULL);
@@ -1637,5 +1648,5 @@
             }
         }
-#endif /* OPENSSL_NO_EC2M */
+# endif /* OPENSSL_NO_EC2M */
     }
 
@@ -1734,3 +1745,4 @@
 
     return group;
-}
+#endif /* FIPS_MODULE */
+}
Index: /trunk/src/libs/openssl-3.0.3/crypto/ec/ecp_nistz256.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/ec/ecp_nistz256.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/ec/ecp_nistz256.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2014-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2014-2022 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright (c) 2014, Intel Corporation. All Rights Reserved.
  * Copyright (c) 2015, CloudFlare, Inc.
@@ -979,4 +979,5 @@
     }
 
+    memset(&p, 0, sizeof(p));
     BN_CTX_start(ctx);
 
Index: /trunk/src/libs/openssl-3.0.3/crypto/encode_decode/decoder_lib.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/encode_decode/decoder_lib.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/encode_decode/decoder_lib.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -790,5 +790,5 @@
         trace_data_structure = data_structure;
         if (data_type != NULL && data_structure != NULL
-            && strcasecmp(data_structure, "type-specific") == 0)
+            && OPENSSL_strcasecmp(data_structure, "type-specific") == 0)
             data_structure = NULL;
 
@@ -851,5 +851,5 @@
          */
         if (decoder == NULL && ctx->start_input_type != NULL
-            && strcasecmp(ctx->start_input_type, new_input_type) != 0) {
+            && OPENSSL_strcasecmp(ctx->start_input_type, new_input_type) != 0) {
             OSSL_TRACE_BEGIN(DECODER) {
                 BIO_printf(trc_out,
@@ -897,5 +897,6 @@
         if (data_structure != NULL
             && (new_input_structure == NULL
-                || strcasecmp(data_structure, new_input_structure) != 0)) {
+                || OPENSSL_strcasecmp(data_structure,
+                                      new_input_structure) != 0)) {
             OSSL_TRACE_BEGIN(DECODER) {
                 BIO_printf(trc_out,
@@ -916,5 +917,6 @@
             && new_input_structure != NULL) {
             data->flag_input_structure_checked = 1;
-            if (strcasecmp(new_input_structure, ctx->input_structure) != 0) {
+            if (OPENSSL_strcasecmp(new_input_structure,
+                                   ctx->input_structure) != 0) {
                 OSSL_TRACE_BEGIN(DECODER) {
                     BIO_printf(trc_out,
Index: /trunk/src/libs/openssl-3.0.3/crypto/encode_decode/decoder_pkey.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/encode_decode/decoder_pkey.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/encode_decode/decoder_pkey.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -19,5 +19,4 @@
 #include "crypto/decoder.h"
 #include "encoder_local.h"
-#include "e_os.h"                /* strcasecmp on Windows */
 
 int OSSL_DECODER_CTX_set_passphrase(OSSL_DECODER_CTX *ctx,
Index: /trunk/src/libs/openssl-3.0.3/crypto/encode_decode/encoder_lib.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/encode_decode/encoder_lib.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/encode_decode/encoder_lib.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -8,5 +8,4 @@
  */
 
-#include "e_os.h"                /* strcasecmp on Windows */
 #include <openssl/core_names.h>
 #include <openssl/bio.h>
@@ -454,6 +453,6 @@
         if (top) {
             if (data->ctx->output_type != NULL
-                && strcasecmp(current_output_type,
-                              data->ctx->output_type) != 0) {
+                && OPENSSL_strcasecmp(current_output_type,
+                                      data->ctx->output_type) != 0) {
                 OSSL_TRACE_BEGIN(ENCODER) {
                     BIO_printf(trc_out,
@@ -483,6 +482,6 @@
         if (data->ctx->output_structure != NULL
             && current_output_structure != NULL) {
-            if (strcasecmp(data->ctx->output_structure,
-                           current_output_structure) != 0) {
+            if (OPENSSL_strcasecmp(data->ctx->output_structure,
+                                   current_output_structure) != 0) {
                 OSSL_TRACE_BEGIN(ENCODER) {
                     BIO_printf(trc_out,
Index: /trunk/src/libs/openssl-3.0.3/crypto/encode_decode/encoder_pkey.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/encode_decode/encoder_pkey.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/encode_decode/encoder_pkey.c	(revision 95219)
@@ -8,5 +8,4 @@
  */
 
-#include "e_os.h"                /* strcasecmp on Windows */
 #include <openssl/err.h>
 #include <openssl/ui.h>
Index: /trunk/src/libs/openssl-3.0.3/crypto/engine/eng_dyn.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/engine/eng_dyn.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/engine/eng_dyn.c	(revision 95219)
@@ -402,4 +402,24 @@
 }
 
+/*
+ * Unfortunately the version checker does not distinguish between
+ * engines built for openssl 1.1.x and openssl 3.x, but loading
+ * an engine that is built for openssl 1.1.x will cause a fatal
+ * error.  Detect such engines, since EVP_PKEY_base_id is exported
+ * as a function in openssl 1.1.x, while it is named EVP_PKEY_get_base_id
+ * in openssl 3.x.  Therefore we take the presence of that symbol
+ * as an indication that the engine will be incompatible.
+ */
+static int using_libcrypto_11(dynamic_data_ctx *ctx)
+{
+    int ret;
+
+    ERR_set_mark();
+    ret = DSO_bind_func(ctx->dynamic_dso, "EVP_PKEY_base_id") != NULL;
+    ERR_pop_to_mark();
+
+    return ret;
+}
+
 static int dynamic_load(ENGINE *e, dynamic_data_ctx *ctx)
 {
@@ -451,16 +471,7 @@
          * We fail if the version checker veto'd the load *or* if it is
          * deferring to us (by returning its version) and we think it is too
-         * old.
-         * Unfortunately the version checker does not distinguish between
-         * engines built for openssl 1.1.x and openssl 3.x, but loading
-         * an engine that is built for openssl 1.1.x will cause a fatal
-         * error.  Detect such engines, since EVP_PKEY_base_id is exported
-         * as a function in openssl 1.1.x, while it is a macro in openssl 3.x,
-         * and therefore only the symbol EVP_PKEY_get_base_id is available
-         * in openssl 3.x.
+         * old. Also fail if this is engine for openssl 1.1.x.
          */
-        if (vcheck_res < OSSL_DYNAMIC_OLDEST
-                || DSO_bind_func(ctx->dynamic_dso,
-                                 "EVP_PKEY_base_id") != NULL) {
+        if (vcheck_res < OSSL_DYNAMIC_OLDEST || using_libcrypto_11(ctx)) {
             /* Fail */
             ctx->bind_engine = NULL;
Index: /trunk/src/libs/openssl-3.0.3/crypto/engine/tb_asnmth.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/engine/tb_asnmth.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/engine/tb_asnmth.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -153,5 +153,5 @@
         if (ameth != NULL
             && ((int)strlen(ameth->pem_str) == len)
-            && strncasecmp(ameth->pem_str, str, len) == 0)
+            && OPENSSL_strncasecmp(ameth->pem_str, str, len) == 0)
             return ameth;
     }
@@ -178,5 +178,5 @@
         if (ameth != NULL
                 && ((int)strlen(ameth->pem_str) == lk->len)
-                && strncasecmp(ameth->pem_str, lk->str, lk->len) == 0) {
+                && OPENSSL_strncasecmp(ameth->pem_str, lk->str, lk->len) == 0) {
             lk->e = e;
             lk->ameth = ameth;
Index: /trunk/src/libs/openssl-3.0.3/crypto/err/openssl.txt
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/err/openssl.txt	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/err/openssl.txt	(revision 95219)
@@ -1,3 +1,3 @@
-# Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 1999-2022 The OpenSSL Project Authors. All Rights Reserved.
 #
 # Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -538,4 +538,5 @@
 EC_R_DISCRIMINANT_IS_ZERO:118:discriminant is zero
 EC_R_EC_GROUP_NEW_BY_NAME_FAILURE:119:ec group new by name failure
+EC_R_EXPLICIT_PARAMS_NOT_SUPPORTED:127:explicit params not supported
 EC_R_FAILED_MAKING_PUBLIC_KEY:166:failed making public key
 EC_R_FIELD_TOO_LARGE:143:field too large
Index: /trunk/src/libs/openssl-3.0.3/crypto/evp/ctrl_params_translate.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/evp/ctrl_params_translate.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/evp/ctrl_params_translate.c	(revision 95219)
@@ -37,6 +37,4 @@
 #include "crypto/dh.h"
 #include "crypto/ec.h"
-
-#include "e_os.h"                /* strcasecmp() for Windows */
 
 struct translation_ctx_st;       /* Forwarding */
@@ -906,5 +904,5 @@
         /* Convert KDF type strings to numbers */
         for (; kdf_type_map->kdf_type_str != NULL; kdf_type_map++)
-            if (strcasecmp(ctx->p2, kdf_type_map->kdf_type_str) == 0) {
+            if (OPENSSL_strcasecmp(ctx->p2, kdf_type_map->kdf_type_str) == 0) {
                 ctx->p1 = kdf_type_map->kdf_type_num;
                 ret = 1;
@@ -1075,5 +1073,9 @@
 
     if (state == PRE_CTRL_STR_TO_PARAMS) {
-        ctx->p2 = (char *)ossl_dh_gen_type_id2name(atoi(ctx->p2));
+        if ((ctx->p2 = (char *)ossl_dh_gen_type_id2name(atoi(ctx->p2)))
+             == NULL) {
+            ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_VALUE);
+            return 0;
+        }
         ctx->p1 = strlen(ctx->p2);
     }
@@ -2470,8 +2472,9 @@
              */
             if (item->ctrl_str != NULL
-                && strcasecmp(tmpl->ctrl_str, item->ctrl_str) == 0)
+                && OPENSSL_strcasecmp(tmpl->ctrl_str, item->ctrl_str) == 0)
                 ctrl_str = tmpl->ctrl_str;
             else if (item->ctrl_hexstr != NULL
-                     && strcasecmp(tmpl->ctrl_hexstr, item->ctrl_hexstr) == 0)
+                     && OPENSSL_strcasecmp(tmpl->ctrl_hexstr,
+                                           item->ctrl_hexstr) == 0)
                 ctrl_hexstr = tmpl->ctrl_hexstr;
             else
@@ -2501,5 +2504,6 @@
                  && tmpl->action_type != item->action_type)
                 || (item->param_key != NULL
-                    && strcasecmp(tmpl->param_key, item->param_key) != 0))
+                    && OPENSSL_strcasecmp(tmpl->param_key,
+                                          item->param_key) != 0))
                 continue;
         } else {
Index: /trunk/src/libs/openssl-3.0.3/crypto/evp/ec_support.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/evp/ec_support.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/evp/ec_support.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -11,5 +11,5 @@
 #include <openssl/ec.h>
 #include "crypto/ec.h"
-#include "e_os.h" /* strcasecmp required by windows */
+#include "internal/nelem.h"
 
 typedef struct ec_name2nid_st {
@@ -140,5 +140,5 @@
 
         for (i = 0; i < OSSL_NELEM(curve_list); i++) {
-            if (strcasecmp(curve_list[i].name, name) == 0)
+            if (OPENSSL_strcasecmp(curve_list[i].name, name) == 0)
                 return curve_list[i].nid;
         }
Index: /trunk/src/libs/openssl-3.0.3/crypto/evp/evp_enc.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/evp/evp_enc.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/evp/evp_enc.c	(revision 95219)
@@ -345,6 +345,8 @@
         case EVP_CIPH_CBC_MODE:
             n = EVP_CIPHER_CTX_get_iv_length(ctx);
-            if (!ossl_assert(n >= 0 && n <= (int)sizeof(ctx->iv)))
-                    return 0;
+            if (n < 0 || n > (int)sizeof(ctx->iv)) {
+                ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_IV_LENGTH);
+                return 0;
+            }
             if (iv != NULL)
                 memcpy(ctx->oiv, iv, n);
@@ -356,6 +358,9 @@
             /* Don't reuse IV for CTR mode */
             if (iv != NULL) {
-                if ((n = EVP_CIPHER_CTX_get_iv_length(ctx)) <= 0)
+                n = EVP_CIPHER_CTX_get_iv_length(ctx);
+                if (n <= 0 || n > (int)sizeof(ctx->iv)) {
+                    ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_IV_LENGTH);
                     return 0;
+                }
                 memcpy(ctx->iv, iv, n);
             }
Index: /trunk/src/libs/openssl-3.0.3/crypto/evp/evp_lib.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/evp/evp_lib.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/evp/evp_lib.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -16,5 +16,4 @@
 #include <stdio.h>
 #include <string.h>
-#include "e_os.h" /* strcasecmp */
 #include "internal/cryptlib.h"
 #include <openssl/evp.h>
@@ -1171,15 +1170,15 @@
     va_start(args, type);
 
-    if (strcasecmp(type, "RSA") == 0) {
+    if (OPENSSL_strcasecmp(type, "RSA") == 0) {
         bits = va_arg(args, size_t);
         params[0] = OSSL_PARAM_construct_size_t(OSSL_PKEY_PARAM_RSA_BITS, &bits);
-    } else if (strcasecmp(type, "EC") == 0) {
+    } else if (OPENSSL_strcasecmp(type, "EC") == 0) {
         name = va_arg(args, char *);
         params[0] = OSSL_PARAM_construct_utf8_string(OSSL_PKEY_PARAM_GROUP_NAME,
                                                      name, 0);
-    } else if (strcasecmp(type, "ED25519") != 0
-               && strcasecmp(type, "X25519") != 0
-               && strcasecmp(type, "ED448") != 0
-               && strcasecmp(type, "X448") != 0) {
+    } else if (OPENSSL_strcasecmp(type, "ED25519") != 0
+               && OPENSSL_strcasecmp(type, "X25519") != 0
+               && OPENSSL_strcasecmp(type, "ED448") != 0
+               && OPENSSL_strcasecmp(type, "X448") != 0) {
         ERR_raise(ERR_LIB_EVP, ERR_R_PASSED_INVALID_ARGUMENT);
         goto end;
Index: /trunk/src/libs/openssl-3.0.3/crypto/evp/p5_crpt2.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/evp/p5_crpt2.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/evp/p5_crpt2.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1999-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -43,4 +43,6 @@
 
     kdf = EVP_KDF_fetch(libctx, OSSL_KDF_NAME_PBKDF2, propq);
+    if (kdf == NULL)
+         return 0;
     kctx = EVP_KDF_CTX_new(kdf);
     EVP_KDF_free(kdf);
Index: /trunk/src/libs/openssl-3.0.3/crypto/evp/p_lib.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/evp/p_lib.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/evp/p_lib.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -50,6 +50,4 @@
 #include "internal/provider.h"
 #include "evp_local.h"
-
-#include "e_os.h"                /* strcasecmp on Windows */
 
 static int pkey_set_type(EVP_PKEY *pkey, ENGINE *e, int type, const char *str,
@@ -1019,5 +1017,5 @@
 
     for (i = 0; i < OSSL_NELEM(standard_name2type); i++) {
-        if (strcasecmp(name, standard_name2type[i].ptr) == 0)
+        if (OPENSSL_strcasecmp(name, standard_name2type[i].ptr) == 0)
             return (int)standard_name2type[i].id;
     }
Index: /trunk/src/libs/openssl-3.0.3/crypto/evp/pmeth_lib.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/evp/pmeth_lib.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/evp/pmeth_lib.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -28,4 +28,5 @@
 # include "crypto/asn1.h"
 #endif
+#include "crypto/ctype.h"
 #include "crypto/evp.h"
 #include "crypto/dh.h"
@@ -200,4 +201,5 @@
 #ifndef FIPS_MODULE
             if (keytype != NULL) {
+                ossl_init_casecmp();
                 id = evp_pkey_name2type(keytype);
                 if (id == NID_undef)
Index: /trunk/src/libs/openssl-3.0.3/crypto/ffc/ffc_dh.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/ffc/ffc_dh.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/ffc/ffc_dh.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -11,5 +11,4 @@
 #include "internal/nelem.h"
 #include "crypto/bn_dh.h"
-#include "e_os.h" /* strcasecmp */
 
 #ifndef OPENSSL_NO_DH
@@ -85,5 +84,5 @@
 
     for (i = 0; i < OSSL_NELEM(dh_named_groups); ++i) {
-        if (strcasecmp(dh_named_groups[i].name, name) == 0)
+        if (OPENSSL_strcasecmp(dh_named_groups[i].name, name) == 0)
             return &dh_named_groups[i];
     }
Index: /trunk/src/libs/openssl-3.0.3/crypto/ffc/ffc_params.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/ffc/ffc_params.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/ffc/ffc_params.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -13,5 +13,4 @@
 #include "internal/param_build_set.h"
 #include "internal/nelem.h"
-#include "e_os.h" /* strcasecmp */
 
 #ifndef FIPS_MODULE
Index: /trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/poly1305-x86_64.S
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/poly1305-x86_64.S	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/poly1305-x86_64.S	(revision 95219)
@@ -38,4 +38,18 @@
 	lea	r10,[poly1305_blocks]
 	lea	r11,[poly1305_emit]
+	mov	r9,QWORD[((OPENSSL_ia32cap_P+4))]
+	lea	rax,[poly1305_blocks_avx]
+	lea	rcx,[poly1305_emit_avx]
+	bt	r9,28
+	cmovc	r10,rax
+	cmovc	r11,rcx
+	lea	rax,[poly1305_blocks_avx2]
+	bt	r9,37
+	cmovc	r10,rax
+	mov	rax,2149646336
+	shr	r9,32
+	and	r9,rax
+	cmp	r9,rax
+	je	NEAR $L$init_base2_44
 	mov	rax,0x0ffffffc0fffffff
 	mov	rcx,0x0ffffffc0ffffffc
@@ -212,4 +226,3438 @@
 
 $L$SEH_end_poly1305_emit:
+
+ALIGN	32
+__poly1305_block:
+
+	mul	r14
+	mov	r9,rax
+	mov	rax,r11
+	mov	r10,rdx
+
+	mul	r14
+	mov	r14,rax
+	mov	rax,r11
+	mov	r8,rdx
+
+	mul	rbx
+	add	r9,rax
+	mov	rax,r13
+	adc	r10,rdx
+
+	mul	rbx
+	mov	rbx,rbp
+	add	r14,rax
+	adc	r8,rdx
+
+	imul	rbx,r13
+	add	r9,rbx
+	mov	rbx,r8
+	adc	r10,0
+
+	imul	rbp,r11
+	add	rbx,r9
+	mov	rax,-4
+	adc	r10,rbp
+
+	and	rax,r10
+	mov	rbp,r10
+	shr	r10,2
+	and	rbp,3
+	add	rax,r10
+	add	r14,rax
+	adc	rbx,0
+	adc	rbp,0
+	DB	0F3h,0C3h		;repret
+
+
+
+
+ALIGN	32
+__poly1305_init_avx:
+
+	mov	r14,r11
+	mov	rbx,r12
+	xor	rbp,rbp
+
+	lea	rdi,[((48+64))+rdi]
+
+	mov	rax,r12
+	call	__poly1305_block
+
+	mov	eax,0x3ffffff
+	mov	edx,0x3ffffff
+	mov	r8,r14
+	and	eax,r14d
+	mov	r9,r11
+	and	edx,r11d
+	mov	DWORD[((-64))+rdi],eax
+	shr	r8,26
+	mov	DWORD[((-60))+rdi],edx
+	shr	r9,26
+
+	mov	eax,0x3ffffff
+	mov	edx,0x3ffffff
+	and	eax,r8d
+	and	edx,r9d
+	mov	DWORD[((-48))+rdi],eax
+	lea	eax,[rax*4+rax]
+	mov	DWORD[((-44))+rdi],edx
+	lea	edx,[rdx*4+rdx]
+	mov	DWORD[((-32))+rdi],eax
+	shr	r8,26
+	mov	DWORD[((-28))+rdi],edx
+	shr	r9,26
+
+	mov	rax,rbx
+	mov	rdx,r12
+	shl	rax,12
+	shl	rdx,12
+	or	rax,r8
+	or	rdx,r9
+	and	eax,0x3ffffff
+	and	edx,0x3ffffff
+	mov	DWORD[((-16))+rdi],eax
+	lea	eax,[rax*4+rax]
+	mov	DWORD[((-12))+rdi],edx
+	lea	edx,[rdx*4+rdx]
+	mov	DWORD[rdi],eax
+	mov	r8,rbx
+	mov	DWORD[4+rdi],edx
+	mov	r9,r12
+
+	mov	eax,0x3ffffff
+	mov	edx,0x3ffffff
+	shr	r8,14
+	shr	r9,14
+	and	eax,r8d
+	and	edx,r9d
+	mov	DWORD[16+rdi],eax
+	lea	eax,[rax*4+rax]
+	mov	DWORD[20+rdi],edx
+	lea	edx,[rdx*4+rdx]
+	mov	DWORD[32+rdi],eax
+	shr	r8,26
+	mov	DWORD[36+rdi],edx
+	shr	r9,26
+
+	mov	rax,rbp
+	shl	rax,24
+	or	r8,rax
+	mov	DWORD[48+rdi],r8d
+	lea	r8,[r8*4+r8]
+	mov	DWORD[52+rdi],r9d
+	lea	r9,[r9*4+r9]
+	mov	DWORD[64+rdi],r8d
+	mov	DWORD[68+rdi],r9d
+
+	mov	rax,r12
+	call	__poly1305_block
+
+	mov	eax,0x3ffffff
+	mov	r8,r14
+	and	eax,r14d
+	shr	r8,26
+	mov	DWORD[((-52))+rdi],eax
+
+	mov	edx,0x3ffffff
+	and	edx,r8d
+	mov	DWORD[((-36))+rdi],edx
+	lea	edx,[rdx*4+rdx]
+	shr	r8,26
+	mov	DWORD[((-20))+rdi],edx
+
+	mov	rax,rbx
+	shl	rax,12
+	or	rax,r8
+	and	eax,0x3ffffff
+	mov	DWORD[((-4))+rdi],eax
+	lea	eax,[rax*4+rax]
+	mov	r8,rbx
+	mov	DWORD[12+rdi],eax
+
+	mov	edx,0x3ffffff
+	shr	r8,14
+	and	edx,r8d
+	mov	DWORD[28+rdi],edx
+	lea	edx,[rdx*4+rdx]
+	shr	r8,26
+	mov	DWORD[44+rdi],edx
+
+	mov	rax,rbp
+	shl	rax,24
+	or	r8,rax
+	mov	DWORD[60+rdi],r8d
+	lea	r8,[r8*4+r8]
+	mov	DWORD[76+rdi],r8d
+
+	mov	rax,r12
+	call	__poly1305_block
+
+	mov	eax,0x3ffffff
+	mov	r8,r14
+	and	eax,r14d
+	shr	r8,26
+	mov	DWORD[((-56))+rdi],eax
+
+	mov	edx,0x3ffffff
+	and	edx,r8d
+	mov	DWORD[((-40))+rdi],edx
+	lea	edx,[rdx*4+rdx]
+	shr	r8,26
+	mov	DWORD[((-24))+rdi],edx
+
+	mov	rax,rbx
+	shl	rax,12
+	or	rax,r8
+	and	eax,0x3ffffff
+	mov	DWORD[((-8))+rdi],eax
+	lea	eax,[rax*4+rax]
+	mov	r8,rbx
+	mov	DWORD[8+rdi],eax
+
+	mov	edx,0x3ffffff
+	shr	r8,14
+	and	edx,r8d
+	mov	DWORD[24+rdi],edx
+	lea	edx,[rdx*4+rdx]
+	shr	r8,26
+	mov	DWORD[40+rdi],edx
+
+	mov	rax,rbp
+	shl	rax,24
+	or	r8,rax
+	mov	DWORD[56+rdi],r8d
+	lea	r8,[r8*4+r8]
+	mov	DWORD[72+rdi],r8d
+
+	lea	rdi,[((-48-64))+rdi]
+	DB	0F3h,0C3h		;repret
+
+
+
+
+ALIGN	32
+poly1305_blocks_avx:
+	mov	QWORD[8+rsp],rdi	;WIN64 prologue
+	mov	QWORD[16+rsp],rsi
+	mov	rax,rsp
+$L$SEH_begin_poly1305_blocks_avx:
+	mov	rdi,rcx
+	mov	rsi,rdx
+	mov	rdx,r8
+	mov	rcx,r9
+
+
+
+	mov	r8d,DWORD[20+rdi]
+	cmp	rdx,128
+	jae	NEAR $L$blocks_avx
+	test	r8d,r8d
+	jz	NEAR $L$blocks
+
+$L$blocks_avx:
+	and	rdx,-16
+	jz	NEAR $L$no_data_avx
+
+	vzeroupper
+
+	test	r8d,r8d
+	jz	NEAR $L$base2_64_avx
+
+	test	rdx,31
+	jz	NEAR $L$even_avx
+
+	push	rbx
+
+	push	rbp
+
+	push	r12
+
+	push	r13
+
+	push	r14
+
+	push	r15
+
+$L$blocks_avx_body:
+
+	mov	r15,rdx
+
+	mov	r8,QWORD[rdi]
+	mov	r9,QWORD[8+rdi]
+	mov	ebp,DWORD[16+rdi]
+
+	mov	r11,QWORD[24+rdi]
+	mov	r13,QWORD[32+rdi]
+
+
+	mov	r14d,r8d
+	and	r8,-2147483648
+	mov	r12,r9
+	mov	ebx,r9d
+	and	r9,-2147483648
+
+	shr	r8,6
+	shl	r12,52
+	add	r14,r8
+	shr	rbx,12
+	shr	r9,18
+	add	r14,r12
+	adc	rbx,r9
+
+	mov	r8,rbp
+	shl	r8,40
+	shr	rbp,24
+	add	rbx,r8
+	adc	rbp,0
+
+	mov	r9,-4
+	mov	r8,rbp
+	and	r9,rbp
+	shr	r8,2
+	and	rbp,3
+	add	r8,r9
+	add	r14,r8
+	adc	rbx,0
+	adc	rbp,0
+
+	mov	r12,r13
+	mov	rax,r13
+	shr	r13,2
+	add	r13,r12
+
+	add	r14,QWORD[rsi]
+	adc	rbx,QWORD[8+rsi]
+	lea	rsi,[16+rsi]
+	adc	rbp,rcx
+
+	call	__poly1305_block
+
+	test	rcx,rcx
+	jz	NEAR $L$store_base2_64_avx
+
+
+	mov	rax,r14
+	mov	rdx,r14
+	shr	r14,52
+	mov	r11,rbx
+	mov	r12,rbx
+	shr	rdx,26
+	and	rax,0x3ffffff
+	shl	r11,12
+	and	rdx,0x3ffffff
+	shr	rbx,14
+	or	r14,r11
+	shl	rbp,24
+	and	r14,0x3ffffff
+	shr	r12,40
+	and	rbx,0x3ffffff
+	or	rbp,r12
+
+	sub	r15,16
+	jz	NEAR $L$store_base2_26_avx
+
+	vmovd	xmm0,eax
+	vmovd	xmm1,edx
+	vmovd	xmm2,r14d
+	vmovd	xmm3,ebx
+	vmovd	xmm4,ebp
+	jmp	NEAR $L$proceed_avx
+
+ALIGN	32
+$L$store_base2_64_avx:
+	mov	QWORD[rdi],r14
+	mov	QWORD[8+rdi],rbx
+	mov	QWORD[16+rdi],rbp
+	jmp	NEAR $L$done_avx
+
+ALIGN	16
+$L$store_base2_26_avx:
+	mov	DWORD[rdi],eax
+	mov	DWORD[4+rdi],edx
+	mov	DWORD[8+rdi],r14d
+	mov	DWORD[12+rdi],ebx
+	mov	DWORD[16+rdi],ebp
+ALIGN	16
+$L$done_avx:
+	mov	r15,QWORD[rsp]
+
+	mov	r14,QWORD[8+rsp]
+
+	mov	r13,QWORD[16+rsp]
+
+	mov	r12,QWORD[24+rsp]
+
+	mov	rbp,QWORD[32+rsp]
+
+	mov	rbx,QWORD[40+rsp]
+
+	lea	rsp,[48+rsp]
+
+$L$no_data_avx:
+$L$blocks_avx_epilogue:
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
+	DB	0F3h,0C3h		;repret
+
+
+ALIGN	32
+$L$base2_64_avx:
+
+	push	rbx
+
+	push	rbp
+
+	push	r12
+
+	push	r13
+
+	push	r14
+
+	push	r15
+
+$L$base2_64_avx_body:
+
+	mov	r15,rdx
+
+	mov	r11,QWORD[24+rdi]
+	mov	r13,QWORD[32+rdi]
+
+	mov	r14,QWORD[rdi]
+	mov	rbx,QWORD[8+rdi]
+	mov	ebp,DWORD[16+rdi]
+
+	mov	r12,r13
+	mov	rax,r13
+	shr	r13,2
+	add	r13,r12
+
+	test	rdx,31
+	jz	NEAR $L$init_avx
+
+	add	r14,QWORD[rsi]
+	adc	rbx,QWORD[8+rsi]
+	lea	rsi,[16+rsi]
+	adc	rbp,rcx
+	sub	r15,16
+
+	call	__poly1305_block
+
+$L$init_avx:
+
+	mov	rax,r14
+	mov	rdx,r14
+	shr	r14,52
+	mov	r8,rbx
+	mov	r9,rbx
+	shr	rdx,26
+	and	rax,0x3ffffff
+	shl	r8,12
+	and	rdx,0x3ffffff
+	shr	rbx,14
+	or	r14,r8
+	shl	rbp,24
+	and	r14,0x3ffffff
+	shr	r9,40
+	and	rbx,0x3ffffff
+	or	rbp,r9
+
+	vmovd	xmm0,eax
+	vmovd	xmm1,edx
+	vmovd	xmm2,r14d
+	vmovd	xmm3,ebx
+	vmovd	xmm4,ebp
+	mov	DWORD[20+rdi],1
+
+	call	__poly1305_init_avx
+
+$L$proceed_avx:
+	mov	rdx,r15
+
+	mov	r15,QWORD[rsp]
+
+	mov	r14,QWORD[8+rsp]
+
+	mov	r13,QWORD[16+rsp]
+
+	mov	r12,QWORD[24+rsp]
+
+	mov	rbp,QWORD[32+rsp]
+
+	mov	rbx,QWORD[40+rsp]
+
+	lea	rax,[48+rsp]
+	lea	rsp,[48+rsp]
+
+$L$base2_64_avx_epilogue:
+	jmp	NEAR $L$do_avx
+
+
+ALIGN	32
+$L$even_avx:
+
+	vmovd	xmm0,DWORD[rdi]
+	vmovd	xmm1,DWORD[4+rdi]
+	vmovd	xmm2,DWORD[8+rdi]
+	vmovd	xmm3,DWORD[12+rdi]
+	vmovd	xmm4,DWORD[16+rdi]
+
+$L$do_avx:
+	lea	r11,[((-248))+rsp]
+	sub	rsp,0x218
+	vmovdqa	XMMWORD[80+r11],xmm6
+	vmovdqa	XMMWORD[96+r11],xmm7
+	vmovdqa	XMMWORD[112+r11],xmm8
+	vmovdqa	XMMWORD[128+r11],xmm9
+	vmovdqa	XMMWORD[144+r11],xmm10
+	vmovdqa	XMMWORD[160+r11],xmm11
+	vmovdqa	XMMWORD[176+r11],xmm12
+	vmovdqa	XMMWORD[192+r11],xmm13
+	vmovdqa	XMMWORD[208+r11],xmm14
+	vmovdqa	XMMWORD[224+r11],xmm15
+$L$do_avx_body:
+	sub	rdx,64
+	lea	rax,[((-32))+rsi]
+	cmovc	rsi,rax
+
+	vmovdqu	xmm14,XMMWORD[48+rdi]
+	lea	rdi,[112+rdi]
+	lea	rcx,[$L$const]
+
+
+
+	vmovdqu	xmm5,XMMWORD[32+rsi]
+	vmovdqu	xmm6,XMMWORD[48+rsi]
+	vmovdqa	xmm15,XMMWORD[64+rcx]
+
+	vpsrldq	xmm7,xmm5,6
+	vpsrldq	xmm8,xmm6,6
+	vpunpckhqdq	xmm9,xmm5,xmm6
+	vpunpcklqdq	xmm5,xmm5,xmm6
+	vpunpcklqdq	xmm8,xmm7,xmm8
+
+	vpsrlq	xmm9,xmm9,40
+	vpsrlq	xmm6,xmm5,26
+	vpand	xmm5,xmm5,xmm15
+	vpsrlq	xmm7,xmm8,4
+	vpand	xmm6,xmm6,xmm15
+	vpsrlq	xmm8,xmm8,30
+	vpand	xmm7,xmm7,xmm15
+	vpand	xmm8,xmm8,xmm15
+	vpor	xmm9,xmm9,XMMWORD[32+rcx]
+
+	jbe	NEAR $L$skip_loop_avx
+
+
+	vmovdqu	xmm11,XMMWORD[((-48))+rdi]
+	vmovdqu	xmm12,XMMWORD[((-32))+rdi]
+	vpshufd	xmm13,xmm14,0xEE
+	vpshufd	xmm10,xmm14,0x44
+	vmovdqa	XMMWORD[(-144)+r11],xmm13
+	vmovdqa	XMMWORD[rsp],xmm10
+	vpshufd	xmm14,xmm11,0xEE
+	vmovdqu	xmm10,XMMWORD[((-16))+rdi]
+	vpshufd	xmm11,xmm11,0x44
+	vmovdqa	XMMWORD[(-128)+r11],xmm14
+	vmovdqa	XMMWORD[16+rsp],xmm11
+	vpshufd	xmm13,xmm12,0xEE
+	vmovdqu	xmm11,XMMWORD[rdi]
+	vpshufd	xmm12,xmm12,0x44
+	vmovdqa	XMMWORD[(-112)+r11],xmm13
+	vmovdqa	XMMWORD[32+rsp],xmm12
+	vpshufd	xmm14,xmm10,0xEE
+	vmovdqu	xmm12,XMMWORD[16+rdi]
+	vpshufd	xmm10,xmm10,0x44
+	vmovdqa	XMMWORD[(-96)+r11],xmm14
+	vmovdqa	XMMWORD[48+rsp],xmm10
+	vpshufd	xmm13,xmm11,0xEE
+	vmovdqu	xmm10,XMMWORD[32+rdi]
+	vpshufd	xmm11,xmm11,0x44
+	vmovdqa	XMMWORD[(-80)+r11],xmm13
+	vmovdqa	XMMWORD[64+rsp],xmm11
+	vpshufd	xmm14,xmm12,0xEE
+	vmovdqu	xmm11,XMMWORD[48+rdi]
+	vpshufd	xmm12,xmm12,0x44
+	vmovdqa	XMMWORD[(-64)+r11],xmm14
+	vmovdqa	XMMWORD[80+rsp],xmm12
+	vpshufd	xmm13,xmm10,0xEE
+	vmovdqu	xmm12,XMMWORD[64+rdi]
+	vpshufd	xmm10,xmm10,0x44
+	vmovdqa	XMMWORD[(-48)+r11],xmm13
+	vmovdqa	XMMWORD[96+rsp],xmm10
+	vpshufd	xmm14,xmm11,0xEE
+	vpshufd	xmm11,xmm11,0x44
+	vmovdqa	XMMWORD[(-32)+r11],xmm14
+	vmovdqa	XMMWORD[112+rsp],xmm11
+	vpshufd	xmm13,xmm12,0xEE
+	vmovdqa	xmm14,XMMWORD[rsp]
+	vpshufd	xmm12,xmm12,0x44
+	vmovdqa	XMMWORD[(-16)+r11],xmm13
+	vmovdqa	XMMWORD[128+rsp],xmm12
+
+	jmp	NEAR $L$oop_avx
+
+ALIGN	32
+$L$oop_avx:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+	vpmuludq	xmm10,xmm14,xmm5
+	vpmuludq	xmm11,xmm14,xmm6
+	vmovdqa	XMMWORD[32+r11],xmm2
+	vpmuludq	xmm12,xmm14,xmm7
+	vmovdqa	xmm2,XMMWORD[16+rsp]
+	vpmuludq	xmm13,xmm14,xmm8
+	vpmuludq	xmm14,xmm14,xmm9
+
+	vmovdqa	XMMWORD[r11],xmm0
+	vpmuludq	xmm0,xmm9,XMMWORD[32+rsp]
+	vmovdqa	XMMWORD[16+r11],xmm1
+	vpmuludq	xmm1,xmm2,xmm8
+	vpaddq	xmm10,xmm10,xmm0
+	vpaddq	xmm14,xmm14,xmm1
+	vmovdqa	XMMWORD[48+r11],xmm3
+	vpmuludq	xmm0,xmm2,xmm7
+	vpmuludq	xmm1,xmm2,xmm6
+	vpaddq	xmm13,xmm13,xmm0
+	vmovdqa	xmm3,XMMWORD[48+rsp]
+	vpaddq	xmm12,xmm12,xmm1
+	vmovdqa	XMMWORD[64+r11],xmm4
+	vpmuludq	xmm2,xmm2,xmm5
+	vpmuludq	xmm0,xmm3,xmm7
+	vpaddq	xmm11,xmm11,xmm2
+
+	vmovdqa	xmm4,XMMWORD[64+rsp]
+	vpaddq	xmm14,xmm14,xmm0
+	vpmuludq	xmm1,xmm3,xmm6
+	vpmuludq	xmm3,xmm3,xmm5
+	vpaddq	xmm13,xmm13,xmm1
+	vmovdqa	xmm2,XMMWORD[80+rsp]
+	vpaddq	xmm12,xmm12,xmm3
+	vpmuludq	xmm0,xmm4,xmm9
+	vpmuludq	xmm4,xmm4,xmm8
+	vpaddq	xmm11,xmm11,xmm0
+	vmovdqa	xmm3,XMMWORD[96+rsp]
+	vpaddq	xmm10,xmm10,xmm4
+
+	vmovdqa	xmm4,XMMWORD[128+rsp]
+	vpmuludq	xmm1,xmm2,xmm6
+	vpmuludq	xmm2,xmm2,xmm5
+	vpaddq	xmm14,xmm14,xmm1
+	vpaddq	xmm13,xmm13,xmm2
+	vpmuludq	xmm0,xmm3,xmm9
+	vpmuludq	xmm1,xmm3,xmm8
+	vpaddq	xmm12,xmm12,xmm0
+	vmovdqu	xmm0,XMMWORD[rsi]
+	vpaddq	xmm11,xmm11,xmm1
+	vpmuludq	xmm3,xmm3,xmm7
+	vpmuludq	xmm7,xmm4,xmm7
+	vpaddq	xmm10,xmm10,xmm3
+
+	vmovdqu	xmm1,XMMWORD[16+rsi]
+	vpaddq	xmm11,xmm11,xmm7
+	vpmuludq	xmm8,xmm4,xmm8
+	vpmuludq	xmm9,xmm4,xmm9
+	vpsrldq	xmm2,xmm0,6
+	vpaddq	xmm12,xmm12,xmm8
+	vpaddq	xmm13,xmm13,xmm9
+	vpsrldq	xmm3,xmm1,6
+	vpmuludq	xmm9,xmm5,XMMWORD[112+rsp]
+	vpmuludq	xmm5,xmm4,xmm6
+	vpunpckhqdq	xmm4,xmm0,xmm1
+	vpaddq	xmm14,xmm14,xmm9
+	vmovdqa	xmm9,XMMWORD[((-144))+r11]
+	vpaddq	xmm10,xmm10,xmm5
+
+	vpunpcklqdq	xmm0,xmm0,xmm1
+	vpunpcklqdq	xmm3,xmm2,xmm3
+
+
+	vpsrldq	xmm4,xmm4,5
+	vpsrlq	xmm1,xmm0,26
+	vpand	xmm0,xmm0,xmm15
+	vpsrlq	xmm2,xmm3,4
+	vpand	xmm1,xmm1,xmm15
+	vpand	xmm4,xmm4,XMMWORD[rcx]
+	vpsrlq	xmm3,xmm3,30
+	vpand	xmm2,xmm2,xmm15
+	vpand	xmm3,xmm3,xmm15
+	vpor	xmm4,xmm4,XMMWORD[32+rcx]
+
+	vpaddq	xmm0,xmm0,XMMWORD[r11]
+	vpaddq	xmm1,xmm1,XMMWORD[16+r11]
+	vpaddq	xmm2,xmm2,XMMWORD[32+r11]
+	vpaddq	xmm3,xmm3,XMMWORD[48+r11]
+	vpaddq	xmm4,xmm4,XMMWORD[64+r11]
+
+	lea	rax,[32+rsi]
+	lea	rsi,[64+rsi]
+	sub	rdx,64
+	cmovc	rsi,rax
+
+
+
+
+
+
+
+
+
+
+	vpmuludq	xmm5,xmm9,xmm0
+	vpmuludq	xmm6,xmm9,xmm1
+	vpaddq	xmm10,xmm10,xmm5
+	vpaddq	xmm11,xmm11,xmm6
+	vmovdqa	xmm7,XMMWORD[((-128))+r11]
+	vpmuludq	xmm5,xmm9,xmm2
+	vpmuludq	xmm6,xmm9,xmm3
+	vpaddq	xmm12,xmm12,xmm5
+	vpaddq	xmm13,xmm13,xmm6
+	vpmuludq	xmm9,xmm9,xmm4
+	vpmuludq	xmm5,xmm4,XMMWORD[((-112))+r11]
+	vpaddq	xmm14,xmm14,xmm9
+
+	vpaddq	xmm10,xmm10,xmm5
+	vpmuludq	xmm6,xmm7,xmm2
+	vpmuludq	xmm5,xmm7,xmm3
+	vpaddq	xmm13,xmm13,xmm6
+	vmovdqa	xmm8,XMMWORD[((-96))+r11]
+	vpaddq	xmm14,xmm14,xmm5
+	vpmuludq	xmm6,xmm7,xmm1
+	vpmuludq	xmm7,xmm7,xmm0
+	vpaddq	xmm12,xmm12,xmm6
+	vpaddq	xmm11,xmm11,xmm7
+
+	vmovdqa	xmm9,XMMWORD[((-80))+r11]
+	vpmuludq	xmm5,xmm8,xmm2
+	vpmuludq	xmm6,xmm8,xmm1
+	vpaddq	xmm14,xmm14,xmm5
+	vpaddq	xmm13,xmm13,xmm6
+	vmovdqa	xmm7,XMMWORD[((-64))+r11]
+	vpmuludq	xmm8,xmm8,xmm0
+	vpmuludq	xmm5,xmm9,xmm4
+	vpaddq	xmm12,xmm12,xmm8
+	vpaddq	xmm11,xmm11,xmm5
+	vmovdqa	xmm8,XMMWORD[((-48))+r11]
+	vpmuludq	xmm9,xmm9,xmm3
+	vpmuludq	xmm6,xmm7,xmm1
+	vpaddq	xmm10,xmm10,xmm9
+
+	vmovdqa	xmm9,XMMWORD[((-16))+r11]
+	vpaddq	xmm14,xmm14,xmm6
+	vpmuludq	xmm7,xmm7,xmm0
+	vpmuludq	xmm5,xmm8,xmm4
+	vpaddq	xmm13,xmm13,xmm7
+	vpaddq	xmm12,xmm12,xmm5
+	vmovdqu	xmm5,XMMWORD[32+rsi]
+	vpmuludq	xmm7,xmm8,xmm3
+	vpmuludq	xmm8,xmm8,xmm2
+	vpaddq	xmm11,xmm11,xmm7
+	vmovdqu	xmm6,XMMWORD[48+rsi]
+	vpaddq	xmm10,xmm10,xmm8
+
+	vpmuludq	xmm2,xmm9,xmm2
+	vpmuludq	xmm3,xmm9,xmm3
+	vpsrldq	xmm7,xmm5,6
+	vpaddq	xmm11,xmm11,xmm2
+	vpmuludq	xmm4,xmm9,xmm4
+	vpsrldq	xmm8,xmm6,6
+	vpaddq	xmm2,xmm12,xmm3
+	vpaddq	xmm3,xmm13,xmm4
+	vpmuludq	xmm4,xmm0,XMMWORD[((-32))+r11]
+	vpmuludq	xmm0,xmm9,xmm1
+	vpunpckhqdq	xmm9,xmm5,xmm6
+	vpaddq	xmm4,xmm14,xmm4
+	vpaddq	xmm0,xmm10,xmm0
+
+	vpunpcklqdq	xmm5,xmm5,xmm6
+	vpunpcklqdq	xmm8,xmm7,xmm8
+
+
+	vpsrldq	xmm9,xmm9,5
+	vpsrlq	xmm6,xmm5,26
+	vmovdqa	xmm14,XMMWORD[rsp]
+	vpand	xmm5,xmm5,xmm15
+	vpsrlq	xmm7,xmm8,4
+	vpand	xmm6,xmm6,xmm15
+	vpand	xmm9,xmm9,XMMWORD[rcx]
+	vpsrlq	xmm8,xmm8,30
+	vpand	xmm7,xmm7,xmm15
+	vpand	xmm8,xmm8,xmm15
+	vpor	xmm9,xmm9,XMMWORD[32+rcx]
+
+
+
+
+
+	vpsrlq	xmm13,xmm3,26
+	vpand	xmm3,xmm3,xmm15
+	vpaddq	xmm4,xmm4,xmm13
+
+	vpsrlq	xmm10,xmm0,26
+	vpand	xmm0,xmm0,xmm15
+	vpaddq	xmm1,xmm11,xmm10
+
+	vpsrlq	xmm10,xmm4,26
+	vpand	xmm4,xmm4,xmm15
+
+	vpsrlq	xmm11,xmm1,26
+	vpand	xmm1,xmm1,xmm15
+	vpaddq	xmm2,xmm2,xmm11
+
+	vpaddq	xmm0,xmm0,xmm10
+	vpsllq	xmm10,xmm10,2
+	vpaddq	xmm0,xmm0,xmm10
+
+	vpsrlq	xmm12,xmm2,26
+	vpand	xmm2,xmm2,xmm15
+	vpaddq	xmm3,xmm3,xmm12
+
+	vpsrlq	xmm10,xmm0,26
+	vpand	xmm0,xmm0,xmm15
+	vpaddq	xmm1,xmm1,xmm10
+
+	vpsrlq	xmm13,xmm3,26
+	vpand	xmm3,xmm3,xmm15
+	vpaddq	xmm4,xmm4,xmm13
+
+	ja	NEAR $L$oop_avx
+
+$L$skip_loop_avx:
+
+
+
+	vpshufd	xmm14,xmm14,0x10
+	add	rdx,32
+	jnz	NEAR $L$ong_tail_avx
+
+	vpaddq	xmm7,xmm7,xmm2
+	vpaddq	xmm5,xmm5,xmm0
+	vpaddq	xmm6,xmm6,xmm1
+	vpaddq	xmm8,xmm8,xmm3
+	vpaddq	xmm9,xmm9,xmm4
+
+$L$ong_tail_avx:
+	vmovdqa	XMMWORD[32+r11],xmm2
+	vmovdqa	XMMWORD[r11],xmm0
+	vmovdqa	XMMWORD[16+r11],xmm1
+	vmovdqa	XMMWORD[48+r11],xmm3
+	vmovdqa	XMMWORD[64+r11],xmm4
+
+
+
+
+
+
+
+	vpmuludq	xmm12,xmm14,xmm7
+	vpmuludq	xmm10,xmm14,xmm5
+	vpshufd	xmm2,XMMWORD[((-48))+rdi],0x10
+	vpmuludq	xmm11,xmm14,xmm6
+	vpmuludq	xmm13,xmm14,xmm8
+	vpmuludq	xmm14,xmm14,xmm9
+
+	vpmuludq	xmm0,xmm2,xmm8
+	vpaddq	xmm14,xmm14,xmm0
+	vpshufd	xmm3,XMMWORD[((-32))+rdi],0x10
+	vpmuludq	xmm1,xmm2,xmm7
+	vpaddq	xmm13,xmm13,xmm1
+	vpshufd	xmm4,XMMWORD[((-16))+rdi],0x10
+	vpmuludq	xmm0,xmm2,xmm6
+	vpaddq	xmm12,xmm12,xmm0
+	vpmuludq	xmm2,xmm2,xmm5
+	vpaddq	xmm11,xmm11,xmm2
+	vpmuludq	xmm3,xmm3,xmm9
+	vpaddq	xmm10,xmm10,xmm3
+
+	vpshufd	xmm2,XMMWORD[rdi],0x10
+	vpmuludq	xmm1,xmm4,xmm7
+	vpaddq	xmm14,xmm14,xmm1
+	vpmuludq	xmm0,xmm4,xmm6
+	vpaddq	xmm13,xmm13,xmm0
+	vpshufd	xmm3,XMMWORD[16+rdi],0x10
+	vpmuludq	xmm4,xmm4,xmm5
+	vpaddq	xmm12,xmm12,xmm4
+	vpmuludq	xmm1,xmm2,xmm9
+	vpaddq	xmm11,xmm11,xmm1
+	vpshufd	xmm4,XMMWORD[32+rdi],0x10
+	vpmuludq	xmm2,xmm2,xmm8
+	vpaddq	xmm10,xmm10,xmm2
+
+	vpmuludq	xmm0,xmm3,xmm6
+	vpaddq	xmm14,xmm14,xmm0
+	vpmuludq	xmm3,xmm3,xmm5
+	vpaddq	xmm13,xmm13,xmm3
+	vpshufd	xmm2,XMMWORD[48+rdi],0x10
+	vpmuludq	xmm1,xmm4,xmm9
+	vpaddq	xmm12,xmm12,xmm1
+	vpshufd	xmm3,XMMWORD[64+rdi],0x10
+	vpmuludq	xmm0,xmm4,xmm8
+	vpaddq	xmm11,xmm11,xmm0
+	vpmuludq	xmm4,xmm4,xmm7
+	vpaddq	xmm10,xmm10,xmm4
+
+	vpmuludq	xmm2,xmm2,xmm5
+	vpaddq	xmm14,xmm14,xmm2
+	vpmuludq	xmm1,xmm3,xmm9
+	vpaddq	xmm13,xmm13,xmm1
+	vpmuludq	xmm0,xmm3,xmm8
+	vpaddq	xmm12,xmm12,xmm0
+	vpmuludq	xmm1,xmm3,xmm7
+	vpaddq	xmm11,xmm11,xmm1
+	vpmuludq	xmm3,xmm3,xmm6
+	vpaddq	xmm10,xmm10,xmm3
+
+	jz	NEAR $L$short_tail_avx
+
+	vmovdqu	xmm0,XMMWORD[rsi]
+	vmovdqu	xmm1,XMMWORD[16+rsi]
+
+	vpsrldq	xmm2,xmm0,6
+	vpsrldq	xmm3,xmm1,6
+	vpunpckhqdq	xmm4,xmm0,xmm1
+	vpunpcklqdq	xmm0,xmm0,xmm1
+	vpunpcklqdq	xmm3,xmm2,xmm3
+
+	vpsrlq	xmm4,xmm4,40
+	vpsrlq	xmm1,xmm0,26
+	vpand	xmm0,xmm0,xmm15
+	vpsrlq	xmm2,xmm3,4
+	vpand	xmm1,xmm1,xmm15
+	vpsrlq	xmm3,xmm3,30
+	vpand	xmm2,xmm2,xmm15
+	vpand	xmm3,xmm3,xmm15
+	vpor	xmm4,xmm4,XMMWORD[32+rcx]
+
+	vpshufd	xmm9,XMMWORD[((-64))+rdi],0x32
+	vpaddq	xmm0,xmm0,XMMWORD[r11]
+	vpaddq	xmm1,xmm1,XMMWORD[16+r11]
+	vpaddq	xmm2,xmm2,XMMWORD[32+r11]
+	vpaddq	xmm3,xmm3,XMMWORD[48+r11]
+	vpaddq	xmm4,xmm4,XMMWORD[64+r11]
+
+
+
+
+	vpmuludq	xmm5,xmm9,xmm0
+	vpaddq	xmm10,xmm10,xmm5
+	vpmuludq	xmm6,xmm9,xmm1
+	vpaddq	xmm11,xmm11,xmm6
+	vpmuludq	xmm5,xmm9,xmm2
+	vpaddq	xmm12,xmm12,xmm5
+	vpshufd	xmm7,XMMWORD[((-48))+rdi],0x32
+	vpmuludq	xmm6,xmm9,xmm3
+	vpaddq	xmm13,xmm13,xmm6
+	vpmuludq	xmm9,xmm9,xmm4
+	vpaddq	xmm14,xmm14,xmm9
+
+	vpmuludq	xmm5,xmm7,xmm3
+	vpaddq	xmm14,xmm14,xmm5
+	vpshufd	xmm8,XMMWORD[((-32))+rdi],0x32
+	vpmuludq	xmm6,xmm7,xmm2
+	vpaddq	xmm13,xmm13,xmm6
+	vpshufd	xmm9,XMMWORD[((-16))+rdi],0x32
+	vpmuludq	xmm5,xmm7,xmm1
+	vpaddq	xmm12,xmm12,xmm5
+	vpmuludq	xmm7,xmm7,xmm0
+	vpaddq	xmm11,xmm11,xmm7
+	vpmuludq	xmm8,xmm8,xmm4
+	vpaddq	xmm10,xmm10,xmm8
+
+	vpshufd	xmm7,XMMWORD[rdi],0x32
+	vpmuludq	xmm6,xmm9,xmm2
+	vpaddq	xmm14,xmm14,xmm6
+	vpmuludq	xmm5,xmm9,xmm1
+	vpaddq	xmm13,xmm13,xmm5
+	vpshufd	xmm8,XMMWORD[16+rdi],0x32
+	vpmuludq	xmm9,xmm9,xmm0
+	vpaddq	xmm12,xmm12,xmm9
+	vpmuludq	xmm6,xmm7,xmm4
+	vpaddq	xmm11,xmm11,xmm6
+	vpshufd	xmm9,XMMWORD[32+rdi],0x32
+	vpmuludq	xmm7,xmm7,xmm3
+	vpaddq	xmm10,xmm10,xmm7
+
+	vpmuludq	xmm5,xmm8,xmm1
+	vpaddq	xmm14,xmm14,xmm5
+	vpmuludq	xmm8,xmm8,xmm0
+	vpaddq	xmm13,xmm13,xmm8
+	vpshufd	xmm7,XMMWORD[48+rdi],0x32
+	vpmuludq	xmm6,xmm9,xmm4
+	vpaddq	xmm12,xmm12,xmm6
+	vpshufd	xmm8,XMMWORD[64+rdi],0x32
+	vpmuludq	xmm5,xmm9,xmm3
+	vpaddq	xmm11,xmm11,xmm5
+	vpmuludq	xmm9,xmm9,xmm2
+	vpaddq	xmm10,xmm10,xmm9
+
+	vpmuludq	xmm7,xmm7,xmm0
+	vpaddq	xmm14,xmm14,xmm7
+	vpmuludq	xmm6,xmm8,xmm4
+	vpaddq	xmm13,xmm13,xmm6
+	vpmuludq	xmm5,xmm8,xmm3
+	vpaddq	xmm12,xmm12,xmm5
+	vpmuludq	xmm6,xmm8,xmm2
+	vpaddq	xmm11,xmm11,xmm6
+	vpmuludq	xmm8,xmm8,xmm1
+	vpaddq	xmm10,xmm10,xmm8
+
+$L$short_tail_avx:
+
+
+
+	vpsrldq	xmm9,xmm14,8
+	vpsrldq	xmm8,xmm13,8
+	vpsrldq	xmm6,xmm11,8
+	vpsrldq	xmm5,xmm10,8
+	vpsrldq	xmm7,xmm12,8
+	vpaddq	xmm13,xmm13,xmm8
+	vpaddq	xmm14,xmm14,xmm9
+	vpaddq	xmm10,xmm10,xmm5
+	vpaddq	xmm11,xmm11,xmm6
+	vpaddq	xmm12,xmm12,xmm7
+
+
+
+
+	vpsrlq	xmm3,xmm13,26
+	vpand	xmm13,xmm13,xmm15
+	vpaddq	xmm14,xmm14,xmm3
+
+	vpsrlq	xmm0,xmm10,26
+	vpand	xmm10,xmm10,xmm15
+	vpaddq	xmm11,xmm11,xmm0
+
+	vpsrlq	xmm4,xmm14,26
+	vpand	xmm14,xmm14,xmm15
+
+	vpsrlq	xmm1,xmm11,26
+	vpand	xmm11,xmm11,xmm15
+	vpaddq	xmm12,xmm12,xmm1
+
+	vpaddq	xmm10,xmm10,xmm4
+	vpsllq	xmm4,xmm4,2
+	vpaddq	xmm10,xmm10,xmm4
+
+	vpsrlq	xmm2,xmm12,26
+	vpand	xmm12,xmm12,xmm15
+	vpaddq	xmm13,xmm13,xmm2
+
+	vpsrlq	xmm0,xmm10,26
+	vpand	xmm10,xmm10,xmm15
+	vpaddq	xmm11,xmm11,xmm0
+
+	vpsrlq	xmm3,xmm13,26
+	vpand	xmm13,xmm13,xmm15
+	vpaddq	xmm14,xmm14,xmm3
+
+	vmovd	DWORD[(-112)+rdi],xmm10
+	vmovd	DWORD[(-108)+rdi],xmm11
+	vmovd	DWORD[(-104)+rdi],xmm12
+	vmovd	DWORD[(-100)+rdi],xmm13
+	vmovd	DWORD[(-96)+rdi],xmm14
+	vmovdqa	xmm6,XMMWORD[80+r11]
+	vmovdqa	xmm7,XMMWORD[96+r11]
+	vmovdqa	xmm8,XMMWORD[112+r11]
+	vmovdqa	xmm9,XMMWORD[128+r11]
+	vmovdqa	xmm10,XMMWORD[144+r11]
+	vmovdqa	xmm11,XMMWORD[160+r11]
+	vmovdqa	xmm12,XMMWORD[176+r11]
+	vmovdqa	xmm13,XMMWORD[192+r11]
+	vmovdqa	xmm14,XMMWORD[208+r11]
+	vmovdqa	xmm15,XMMWORD[224+r11]
+	lea	rsp,[248+r11]
+$L$do_avx_epilogue:
+	vzeroupper
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
+	DB	0F3h,0C3h		;repret
+
+$L$SEH_end_poly1305_blocks_avx:
+
+
+ALIGN	32
+poly1305_emit_avx:
+	mov	QWORD[8+rsp],rdi	;WIN64 prologue
+	mov	QWORD[16+rsp],rsi
+	mov	rax,rsp
+$L$SEH_begin_poly1305_emit_avx:
+	mov	rdi,rcx
+	mov	rsi,rdx
+	mov	rdx,r8
+
+
+
+	cmp	DWORD[20+rdi],0
+	je	NEAR $L$emit
+
+	mov	eax,DWORD[rdi]
+	mov	ecx,DWORD[4+rdi]
+	mov	r8d,DWORD[8+rdi]
+	mov	r11d,DWORD[12+rdi]
+	mov	r10d,DWORD[16+rdi]
+
+	shl	rcx,26
+	mov	r9,r8
+	shl	r8,52
+	add	rax,rcx
+	shr	r9,12
+	add	r8,rax
+	adc	r9,0
+
+	shl	r11,14
+	mov	rax,r10
+	shr	r10,24
+	add	r9,r11
+	shl	rax,40
+	add	r9,rax
+	adc	r10,0
+
+	mov	rax,r10
+	mov	rcx,r10
+	and	r10,3
+	shr	rax,2
+	and	rcx,-4
+	add	rax,rcx
+	add	r8,rax
+	adc	r9,0
+	adc	r10,0
+
+	mov	rax,r8
+	add	r8,5
+	mov	rcx,r9
+	adc	r9,0
+	adc	r10,0
+	shr	r10,2
+	cmovnz	rax,r8
+	cmovnz	rcx,r9
+
+	add	rax,QWORD[rdx]
+	adc	rcx,QWORD[8+rdx]
+	mov	QWORD[rsi],rax
+	mov	QWORD[8+rsi],rcx
+
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
+	DB	0F3h,0C3h		;repret
+
+$L$SEH_end_poly1305_emit_avx:
+
+ALIGN	32
+poly1305_blocks_avx2:
+	mov	QWORD[8+rsp],rdi	;WIN64 prologue
+	mov	QWORD[16+rsp],rsi
+	mov	rax,rsp
+$L$SEH_begin_poly1305_blocks_avx2:
+	mov	rdi,rcx
+	mov	rsi,rdx
+	mov	rdx,r8
+	mov	rcx,r9
+
+
+
+	mov	r8d,DWORD[20+rdi]
+	cmp	rdx,128
+	jae	NEAR $L$blocks_avx2
+	test	r8d,r8d
+	jz	NEAR $L$blocks
+
+$L$blocks_avx2:
+	and	rdx,-16
+	jz	NEAR $L$no_data_avx2
+
+	vzeroupper
+
+	test	r8d,r8d
+	jz	NEAR $L$base2_64_avx2
+
+	test	rdx,63
+	jz	NEAR $L$even_avx2
+
+	push	rbx
+
+	push	rbp
+
+	push	r12
+
+	push	r13
+
+	push	r14
+
+	push	r15
+
+$L$blocks_avx2_body:
+
+	mov	r15,rdx
+
+	mov	r8,QWORD[rdi]
+	mov	r9,QWORD[8+rdi]
+	mov	ebp,DWORD[16+rdi]
+
+	mov	r11,QWORD[24+rdi]
+	mov	r13,QWORD[32+rdi]
+
+
+	mov	r14d,r8d
+	and	r8,-2147483648
+	mov	r12,r9
+	mov	ebx,r9d
+	and	r9,-2147483648
+
+	shr	r8,6
+	shl	r12,52
+	add	r14,r8
+	shr	rbx,12
+	shr	r9,18
+	add	r14,r12
+	adc	rbx,r9
+
+	mov	r8,rbp
+	shl	r8,40
+	shr	rbp,24
+	add	rbx,r8
+	adc	rbp,0
+
+	mov	r9,-4
+	mov	r8,rbp
+	and	r9,rbp
+	shr	r8,2
+	and	rbp,3
+	add	r8,r9
+	add	r14,r8
+	adc	rbx,0
+	adc	rbp,0
+
+	mov	r12,r13
+	mov	rax,r13
+	shr	r13,2
+	add	r13,r12
+
+$L$base2_26_pre_avx2:
+	add	r14,QWORD[rsi]
+	adc	rbx,QWORD[8+rsi]
+	lea	rsi,[16+rsi]
+	adc	rbp,rcx
+	sub	r15,16
+
+	call	__poly1305_block
+	mov	rax,r12
+
+	test	r15,63
+	jnz	NEAR $L$base2_26_pre_avx2
+
+	test	rcx,rcx
+	jz	NEAR $L$store_base2_64_avx2
+
+
+	mov	rax,r14
+	mov	rdx,r14
+	shr	r14,52
+	mov	r11,rbx
+	mov	r12,rbx
+	shr	rdx,26
+	and	rax,0x3ffffff
+	shl	r11,12
+	and	rdx,0x3ffffff
+	shr	rbx,14
+	or	r14,r11
+	shl	rbp,24
+	and	r14,0x3ffffff
+	shr	r12,40
+	and	rbx,0x3ffffff
+	or	rbp,r12
+
+	test	r15,r15
+	jz	NEAR $L$store_base2_26_avx2
+
+	vmovd	xmm0,eax
+	vmovd	xmm1,edx
+	vmovd	xmm2,r14d
+	vmovd	xmm3,ebx
+	vmovd	xmm4,ebp
+	jmp	NEAR $L$proceed_avx2
+
+ALIGN	32
+$L$store_base2_64_avx2:
+	mov	QWORD[rdi],r14
+	mov	QWORD[8+rdi],rbx
+	mov	QWORD[16+rdi],rbp
+	jmp	NEAR $L$done_avx2
+
+ALIGN	16
+$L$store_base2_26_avx2:
+	mov	DWORD[rdi],eax
+	mov	DWORD[4+rdi],edx
+	mov	DWORD[8+rdi],r14d
+	mov	DWORD[12+rdi],ebx
+	mov	DWORD[16+rdi],ebp
+ALIGN	16
+$L$done_avx2:
+	mov	r15,QWORD[rsp]
+
+	mov	r14,QWORD[8+rsp]
+
+	mov	r13,QWORD[16+rsp]
+
+	mov	r12,QWORD[24+rsp]
+
+	mov	rbp,QWORD[32+rsp]
+
+	mov	rbx,QWORD[40+rsp]
+
+	lea	rsp,[48+rsp]
+
+$L$no_data_avx2:
+$L$blocks_avx2_epilogue:
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
+	DB	0F3h,0C3h		;repret
+
+
+ALIGN	32
+$L$base2_64_avx2:
+
+	push	rbx
+
+	push	rbp
+
+	push	r12
+
+	push	r13
+
+	push	r14
+
+	push	r15
+
+$L$base2_64_avx2_body:
+
+	mov	r15,rdx
+
+	mov	r11,QWORD[24+rdi]
+	mov	r13,QWORD[32+rdi]
+
+	mov	r14,QWORD[rdi]
+	mov	rbx,QWORD[8+rdi]
+	mov	ebp,DWORD[16+rdi]
+
+	mov	r12,r13
+	mov	rax,r13
+	shr	r13,2
+	add	r13,r12
+
+	test	rdx,63
+	jz	NEAR $L$init_avx2
+
+$L$base2_64_pre_avx2:
+	add	r14,QWORD[rsi]
+	adc	rbx,QWORD[8+rsi]
+	lea	rsi,[16+rsi]
+	adc	rbp,rcx
+	sub	r15,16
+
+	call	__poly1305_block
+	mov	rax,r12
+
+	test	r15,63
+	jnz	NEAR $L$base2_64_pre_avx2
+
+$L$init_avx2:
+
+	mov	rax,r14
+	mov	rdx,r14
+	shr	r14,52
+	mov	r8,rbx
+	mov	r9,rbx
+	shr	rdx,26
+	and	rax,0x3ffffff
+	shl	r8,12
+	and	rdx,0x3ffffff
+	shr	rbx,14
+	or	r14,r8
+	shl	rbp,24
+	and	r14,0x3ffffff
+	shr	r9,40
+	and	rbx,0x3ffffff
+	or	rbp,r9
+
+	vmovd	xmm0,eax
+	vmovd	xmm1,edx
+	vmovd	xmm2,r14d
+	vmovd	xmm3,ebx
+	vmovd	xmm4,ebp
+	mov	DWORD[20+rdi],1
+
+	call	__poly1305_init_avx
+
+$L$proceed_avx2:
+	mov	rdx,r15
+	mov	r10d,DWORD[((OPENSSL_ia32cap_P+8))]
+	mov	r11d,3221291008
+
+	mov	r15,QWORD[rsp]
+
+	mov	r14,QWORD[8+rsp]
+
+	mov	r13,QWORD[16+rsp]
+
+	mov	r12,QWORD[24+rsp]
+
+	mov	rbp,QWORD[32+rsp]
+
+	mov	rbx,QWORD[40+rsp]
+
+	lea	rax,[48+rsp]
+	lea	rsp,[48+rsp]
+
+$L$base2_64_avx2_epilogue:
+	jmp	NEAR $L$do_avx2
+
+
+ALIGN	32
+$L$even_avx2:
+
+	mov	r10d,DWORD[((OPENSSL_ia32cap_P+8))]
+	vmovd	xmm0,DWORD[rdi]
+	vmovd	xmm1,DWORD[4+rdi]
+	vmovd	xmm2,DWORD[8+rdi]
+	vmovd	xmm3,DWORD[12+rdi]
+	vmovd	xmm4,DWORD[16+rdi]
+
+$L$do_avx2:
+	cmp	rdx,512
+	jb	NEAR $L$skip_avx512
+	and	r10d,r11d
+	test	r10d,65536
+	jnz	NEAR $L$blocks_avx512
+$L$skip_avx512:
+	lea	r11,[((-248))+rsp]
+	sub	rsp,0x1c8
+	vmovdqa	XMMWORD[80+r11],xmm6
+	vmovdqa	XMMWORD[96+r11],xmm7
+	vmovdqa	XMMWORD[112+r11],xmm8
+	vmovdqa	XMMWORD[128+r11],xmm9
+	vmovdqa	XMMWORD[144+r11],xmm10
+	vmovdqa	XMMWORD[160+r11],xmm11
+	vmovdqa	XMMWORD[176+r11],xmm12
+	vmovdqa	XMMWORD[192+r11],xmm13
+	vmovdqa	XMMWORD[208+r11],xmm14
+	vmovdqa	XMMWORD[224+r11],xmm15
+$L$do_avx2_body:
+	lea	rcx,[$L$const]
+	lea	rdi,[((48+64))+rdi]
+	vmovdqa	ymm7,YMMWORD[96+rcx]
+
+
+	vmovdqu	xmm9,XMMWORD[((-64))+rdi]
+	and	rsp,-512
+	vmovdqu	xmm10,XMMWORD[((-48))+rdi]
+	vmovdqu	xmm6,XMMWORD[((-32))+rdi]
+	vmovdqu	xmm11,XMMWORD[((-16))+rdi]
+	vmovdqu	xmm12,XMMWORD[rdi]
+	vmovdqu	xmm13,XMMWORD[16+rdi]
+	lea	rax,[144+rsp]
+	vmovdqu	xmm14,XMMWORD[32+rdi]
+	vpermd	ymm9,ymm7,ymm9
+	vmovdqu	xmm15,XMMWORD[48+rdi]
+	vpermd	ymm10,ymm7,ymm10
+	vmovdqu	xmm5,XMMWORD[64+rdi]
+	vpermd	ymm6,ymm7,ymm6
+	vmovdqa	YMMWORD[rsp],ymm9
+	vpermd	ymm11,ymm7,ymm11
+	vmovdqa	YMMWORD[(32-144)+rax],ymm10
+	vpermd	ymm12,ymm7,ymm12
+	vmovdqa	YMMWORD[(64-144)+rax],ymm6
+	vpermd	ymm13,ymm7,ymm13
+	vmovdqa	YMMWORD[(96-144)+rax],ymm11
+	vpermd	ymm14,ymm7,ymm14
+	vmovdqa	YMMWORD[(128-144)+rax],ymm12
+	vpermd	ymm15,ymm7,ymm15
+	vmovdqa	YMMWORD[(160-144)+rax],ymm13
+	vpermd	ymm5,ymm7,ymm5
+	vmovdqa	YMMWORD[(192-144)+rax],ymm14
+	vmovdqa	YMMWORD[(224-144)+rax],ymm15
+	vmovdqa	YMMWORD[(256-144)+rax],ymm5
+	vmovdqa	ymm5,YMMWORD[64+rcx]
+
+
+
+	vmovdqu	xmm7,XMMWORD[rsi]
+	vmovdqu	xmm8,XMMWORD[16+rsi]
+	vinserti128	ymm7,ymm7,XMMWORD[32+rsi],1
+	vinserti128	ymm8,ymm8,XMMWORD[48+rsi],1
+	lea	rsi,[64+rsi]
+
+	vpsrldq	ymm9,ymm7,6
+	vpsrldq	ymm10,ymm8,6
+	vpunpckhqdq	ymm6,ymm7,ymm8
+	vpunpcklqdq	ymm9,ymm9,ymm10
+	vpunpcklqdq	ymm7,ymm7,ymm8
+
+	vpsrlq	ymm10,ymm9,30
+	vpsrlq	ymm9,ymm9,4
+	vpsrlq	ymm8,ymm7,26
+	vpsrlq	ymm6,ymm6,40
+	vpand	ymm9,ymm9,ymm5
+	vpand	ymm7,ymm7,ymm5
+	vpand	ymm8,ymm8,ymm5
+	vpand	ymm10,ymm10,ymm5
+	vpor	ymm6,ymm6,YMMWORD[32+rcx]
+
+	vpaddq	ymm2,ymm9,ymm2
+	sub	rdx,64
+	jz	NEAR $L$tail_avx2
+	jmp	NEAR $L$oop_avx2
+
+ALIGN	32
+$L$oop_avx2:
+
+
+
+
+
+
+
+
+	vpaddq	ymm0,ymm7,ymm0
+	vmovdqa	ymm7,YMMWORD[rsp]
+	vpaddq	ymm1,ymm8,ymm1
+	vmovdqa	ymm8,YMMWORD[32+rsp]
+	vpaddq	ymm3,ymm10,ymm3
+	vmovdqa	ymm9,YMMWORD[96+rsp]
+	vpaddq	ymm4,ymm6,ymm4
+	vmovdqa	ymm10,YMMWORD[48+rax]
+	vmovdqa	ymm5,YMMWORD[112+rax]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+	vpmuludq	ymm13,ymm7,ymm2
+	vpmuludq	ymm14,ymm8,ymm2
+	vpmuludq	ymm15,ymm9,ymm2
+	vpmuludq	ymm11,ymm10,ymm2
+	vpmuludq	ymm12,ymm5,ymm2
+
+	vpmuludq	ymm6,ymm8,ymm0
+	vpmuludq	ymm2,ymm8,ymm1
+	vpaddq	ymm12,ymm12,ymm6
+	vpaddq	ymm13,ymm13,ymm2
+	vpmuludq	ymm6,ymm8,ymm3
+	vpmuludq	ymm2,ymm4,YMMWORD[64+rsp]
+	vpaddq	ymm15,ymm15,ymm6
+	vpaddq	ymm11,ymm11,ymm2
+	vmovdqa	ymm8,YMMWORD[((-16))+rax]
+
+	vpmuludq	ymm6,ymm7,ymm0
+	vpmuludq	ymm2,ymm7,ymm1
+	vpaddq	ymm11,ymm11,ymm6
+	vpaddq	ymm12,ymm12,ymm2
+	vpmuludq	ymm6,ymm7,ymm3
+	vpmuludq	ymm2,ymm7,ymm4
+	vmovdqu	xmm7,XMMWORD[rsi]
+	vpaddq	ymm14,ymm14,ymm6
+	vpaddq	ymm15,ymm15,ymm2
+	vinserti128	ymm7,ymm7,XMMWORD[32+rsi],1
+
+	vpmuludq	ymm6,ymm8,ymm3
+	vpmuludq	ymm2,ymm8,ymm4
+	vmovdqu	xmm8,XMMWORD[16+rsi]
+	vpaddq	ymm11,ymm11,ymm6
+	vpaddq	ymm12,ymm12,ymm2
+	vmovdqa	ymm2,YMMWORD[16+rax]
+	vpmuludq	ymm6,ymm9,ymm1
+	vpmuludq	ymm9,ymm9,ymm0
+	vpaddq	ymm14,ymm14,ymm6
+	vpaddq	ymm13,ymm13,ymm9
+	vinserti128	ymm8,ymm8,XMMWORD[48+rsi],1
+	lea	rsi,[64+rsi]
+
+	vpmuludq	ymm6,ymm2,ymm1
+	vpmuludq	ymm2,ymm2,ymm0
+	vpsrldq	ymm9,ymm7,6
+	vpaddq	ymm15,ymm15,ymm6
+	vpaddq	ymm14,ymm14,ymm2
+	vpmuludq	ymm6,ymm10,ymm3
+	vpmuludq	ymm2,ymm10,ymm4
+	vpsrldq	ymm10,ymm8,6
+	vpaddq	ymm12,ymm12,ymm6
+	vpaddq	ymm13,ymm13,ymm2
+	vpunpckhqdq	ymm6,ymm7,ymm8
+
+	vpmuludq	ymm3,ymm5,ymm3
+	vpmuludq	ymm4,ymm5,ymm4
+	vpunpcklqdq	ymm7,ymm7,ymm8
+	vpaddq	ymm2,ymm13,ymm3
+	vpaddq	ymm3,ymm14,ymm4
+	vpunpcklqdq	ymm10,ymm9,ymm10
+	vpmuludq	ymm4,ymm0,YMMWORD[80+rax]
+	vpmuludq	ymm0,ymm5,ymm1
+	vmovdqa	ymm5,YMMWORD[64+rcx]
+	vpaddq	ymm4,ymm15,ymm4
+	vpaddq	ymm0,ymm11,ymm0
+
+
+
+
+	vpsrlq	ymm14,ymm3,26
+	vpand	ymm3,ymm3,ymm5
+	vpaddq	ymm4,ymm4,ymm14
+
+	vpsrlq	ymm11,ymm0,26
+	vpand	ymm0,ymm0,ymm5
+	vpaddq	ymm1,ymm12,ymm11
+
+	vpsrlq	ymm15,ymm4,26
+	vpand	ymm4,ymm4,ymm5
+
+	vpsrlq	ymm9,ymm10,4
+
+	vpsrlq	ymm12,ymm1,26
+	vpand	ymm1,ymm1,ymm5
+	vpaddq	ymm2,ymm2,ymm12
+
+	vpaddq	ymm0,ymm0,ymm15
+	vpsllq	ymm15,ymm15,2
+	vpaddq	ymm0,ymm0,ymm15
+
+	vpand	ymm9,ymm9,ymm5
+	vpsrlq	ymm8,ymm7,26
+
+	vpsrlq	ymm13,ymm2,26
+	vpand	ymm2,ymm2,ymm5
+	vpaddq	ymm3,ymm3,ymm13
+
+	vpaddq	ymm2,ymm2,ymm9
+	vpsrlq	ymm10,ymm10,30
+
+	vpsrlq	ymm11,ymm0,26
+	vpand	ymm0,ymm0,ymm5
+	vpaddq	ymm1,ymm1,ymm11
+
+	vpsrlq	ymm6,ymm6,40
+
+	vpsrlq	ymm14,ymm3,26
+	vpand	ymm3,ymm3,ymm5
+	vpaddq	ymm4,ymm4,ymm14
+
+	vpand	ymm7,ymm7,ymm5
+	vpand	ymm8,ymm8,ymm5
+	vpand	ymm10,ymm10,ymm5
+	vpor	ymm6,ymm6,YMMWORD[32+rcx]
+
+	sub	rdx,64
+	jnz	NEAR $L$oop_avx2
+
+DB	0x66,0x90
+$L$tail_avx2:
+
+
+
+
+
+
+
+	vpaddq	ymm0,ymm7,ymm0
+	vmovdqu	ymm7,YMMWORD[4+rsp]
+	vpaddq	ymm1,ymm8,ymm1
+	vmovdqu	ymm8,YMMWORD[36+rsp]
+	vpaddq	ymm3,ymm10,ymm3
+	vmovdqu	ymm9,YMMWORD[100+rsp]
+	vpaddq	ymm4,ymm6,ymm4
+	vmovdqu	ymm10,YMMWORD[52+rax]
+	vmovdqu	ymm5,YMMWORD[116+rax]
+
+	vpmuludq	ymm13,ymm7,ymm2
+	vpmuludq	ymm14,ymm8,ymm2
+	vpmuludq	ymm15,ymm9,ymm2
+	vpmuludq	ymm11,ymm10,ymm2
+	vpmuludq	ymm12,ymm5,ymm2
+
+	vpmuludq	ymm6,ymm8,ymm0
+	vpmuludq	ymm2,ymm8,ymm1
+	vpaddq	ymm12,ymm12,ymm6
+	vpaddq	ymm13,ymm13,ymm2
+	vpmuludq	ymm6,ymm8,ymm3
+	vpmuludq	ymm2,ymm4,YMMWORD[68+rsp]
+	vpaddq	ymm15,ymm15,ymm6
+	vpaddq	ymm11,ymm11,ymm2
+
+	vpmuludq	ymm6,ymm7,ymm0
+	vpmuludq	ymm2,ymm7,ymm1
+	vpaddq	ymm11,ymm11,ymm6
+	vmovdqu	ymm8,YMMWORD[((-12))+rax]
+	vpaddq	ymm12,ymm12,ymm2
+	vpmuludq	ymm6,ymm7,ymm3
+	vpmuludq	ymm2,ymm7,ymm4
+	vpaddq	ymm14,ymm14,ymm6
+	vpaddq	ymm15,ymm15,ymm2
+
+	vpmuludq	ymm6,ymm8,ymm3
+	vpmuludq	ymm2,ymm8,ymm4
+	vpaddq	ymm11,ymm11,ymm6
+	vpaddq	ymm12,ymm12,ymm2
+	vmovdqu	ymm2,YMMWORD[20+rax]
+	vpmuludq	ymm6,ymm9,ymm1
+	vpmuludq	ymm9,ymm9,ymm0
+	vpaddq	ymm14,ymm14,ymm6
+	vpaddq	ymm13,ymm13,ymm9
+
+	vpmuludq	ymm6,ymm2,ymm1
+	vpmuludq	ymm2,ymm2,ymm0
+	vpaddq	ymm15,ymm15,ymm6
+	vpaddq	ymm14,ymm14,ymm2
+	vpmuludq	ymm6,ymm10,ymm3
+	vpmuludq	ymm2,ymm10,ymm4
+	vpaddq	ymm12,ymm12,ymm6
+	vpaddq	ymm13,ymm13,ymm2
+
+	vpmuludq	ymm3,ymm5,ymm3
+	vpmuludq	ymm4,ymm5,ymm4
+	vpaddq	ymm2,ymm13,ymm3
+	vpaddq	ymm3,ymm14,ymm4
+	vpmuludq	ymm4,ymm0,YMMWORD[84+rax]
+	vpmuludq	ymm0,ymm5,ymm1
+	vmovdqa	ymm5,YMMWORD[64+rcx]
+	vpaddq	ymm4,ymm15,ymm4
+	vpaddq	ymm0,ymm11,ymm0
+
+
+
+
+	vpsrldq	ymm8,ymm12,8
+	vpsrldq	ymm9,ymm2,8
+	vpsrldq	ymm10,ymm3,8
+	vpsrldq	ymm6,ymm4,8
+	vpsrldq	ymm7,ymm0,8
+	vpaddq	ymm12,ymm12,ymm8
+	vpaddq	ymm2,ymm2,ymm9
+	vpaddq	ymm3,ymm3,ymm10
+	vpaddq	ymm4,ymm4,ymm6
+	vpaddq	ymm0,ymm0,ymm7
+
+	vpermq	ymm10,ymm3,0x2
+	vpermq	ymm6,ymm4,0x2
+	vpermq	ymm7,ymm0,0x2
+	vpermq	ymm8,ymm12,0x2
+	vpermq	ymm9,ymm2,0x2
+	vpaddq	ymm3,ymm3,ymm10
+	vpaddq	ymm4,ymm4,ymm6
+	vpaddq	ymm0,ymm0,ymm7
+	vpaddq	ymm12,ymm12,ymm8
+	vpaddq	ymm2,ymm2,ymm9
+
+
+
+
+	vpsrlq	ymm14,ymm3,26
+	vpand	ymm3,ymm3,ymm5
+	vpaddq	ymm4,ymm4,ymm14
+
+	vpsrlq	ymm11,ymm0,26
+	vpand	ymm0,ymm0,ymm5
+	vpaddq	ymm1,ymm12,ymm11
+
+	vpsrlq	ymm15,ymm4,26
+	vpand	ymm4,ymm4,ymm5
+
+	vpsrlq	ymm12,ymm1,26
+	vpand	ymm1,ymm1,ymm5
+	vpaddq	ymm2,ymm2,ymm12
+
+	vpaddq	ymm0,ymm0,ymm15
+	vpsllq	ymm15,ymm15,2
+	vpaddq	ymm0,ymm0,ymm15
+
+	vpsrlq	ymm13,ymm2,26
+	vpand	ymm2,ymm2,ymm5
+	vpaddq	ymm3,ymm3,ymm13
+
+	vpsrlq	ymm11,ymm0,26
+	vpand	ymm0,ymm0,ymm5
+	vpaddq	ymm1,ymm1,ymm11
+
+	vpsrlq	ymm14,ymm3,26
+	vpand	ymm3,ymm3,ymm5
+	vpaddq	ymm4,ymm4,ymm14
+
+	vmovd	DWORD[(-112)+rdi],xmm0
+	vmovd	DWORD[(-108)+rdi],xmm1
+	vmovd	DWORD[(-104)+rdi],xmm2
+	vmovd	DWORD[(-100)+rdi],xmm3
+	vmovd	DWORD[(-96)+rdi],xmm4
+	vmovdqa	xmm6,XMMWORD[80+r11]
+	vmovdqa	xmm7,XMMWORD[96+r11]
+	vmovdqa	xmm8,XMMWORD[112+r11]
+	vmovdqa	xmm9,XMMWORD[128+r11]
+	vmovdqa	xmm10,XMMWORD[144+r11]
+	vmovdqa	xmm11,XMMWORD[160+r11]
+	vmovdqa	xmm12,XMMWORD[176+r11]
+	vmovdqa	xmm13,XMMWORD[192+r11]
+	vmovdqa	xmm14,XMMWORD[208+r11]
+	vmovdqa	xmm15,XMMWORD[224+r11]
+	lea	rsp,[248+r11]
+$L$do_avx2_epilogue:
+	vzeroupper
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
+	DB	0F3h,0C3h		;repret
+
+$L$SEH_end_poly1305_blocks_avx2:
+
+ALIGN	32
+poly1305_blocks_avx512:
+	mov	QWORD[8+rsp],rdi	;WIN64 prologue
+	mov	QWORD[16+rsp],rsi
+	mov	rax,rsp
+$L$SEH_begin_poly1305_blocks_avx512:
+	mov	rdi,rcx
+	mov	rsi,rdx
+	mov	rdx,r8
+	mov	rcx,r9
+
+
+
+$L$blocks_avx512:
+	mov	eax,15
+	kmovw	k2,eax
+	lea	r11,[((-248))+rsp]
+	sub	rsp,0x1c8
+	vmovdqa	XMMWORD[80+r11],xmm6
+	vmovdqa	XMMWORD[96+r11],xmm7
+	vmovdqa	XMMWORD[112+r11],xmm8
+	vmovdqa	XMMWORD[128+r11],xmm9
+	vmovdqa	XMMWORD[144+r11],xmm10
+	vmovdqa	XMMWORD[160+r11],xmm11
+	vmovdqa	XMMWORD[176+r11],xmm12
+	vmovdqa	XMMWORD[192+r11],xmm13
+	vmovdqa	XMMWORD[208+r11],xmm14
+	vmovdqa	XMMWORD[224+r11],xmm15
+$L$do_avx512_body:
+	lea	rcx,[$L$const]
+	lea	rdi,[((48+64))+rdi]
+	vmovdqa	ymm9,YMMWORD[96+rcx]
+
+
+	vmovdqu	xmm11,XMMWORD[((-64))+rdi]
+	and	rsp,-512
+	vmovdqu	xmm12,XMMWORD[((-48))+rdi]
+	mov	rax,0x20
+	vmovdqu	xmm7,XMMWORD[((-32))+rdi]
+	vmovdqu	xmm13,XMMWORD[((-16))+rdi]
+	vmovdqu	xmm8,XMMWORD[rdi]
+	vmovdqu	xmm14,XMMWORD[16+rdi]
+	vmovdqu	xmm10,XMMWORD[32+rdi]
+	vmovdqu	xmm15,XMMWORD[48+rdi]
+	vmovdqu	xmm6,XMMWORD[64+rdi]
+	vpermd	zmm16,zmm9,zmm11
+	vpbroadcastq	zmm5,QWORD[64+rcx]
+	vpermd	zmm17,zmm9,zmm12
+	vpermd	zmm21,zmm9,zmm7
+	vpermd	zmm18,zmm9,zmm13
+	vmovdqa64	ZMMWORD[rsp]{k2},zmm16
+	vpsrlq	zmm7,zmm16,32
+	vpermd	zmm22,zmm9,zmm8
+	vmovdqu64	ZMMWORD[rax*1+rsp]{k2},zmm17
+	vpsrlq	zmm8,zmm17,32
+	vpermd	zmm19,zmm9,zmm14
+	vmovdqa64	ZMMWORD[64+rsp]{k2},zmm21
+	vpermd	zmm23,zmm9,zmm10
+	vpermd	zmm20,zmm9,zmm15
+	vmovdqu64	ZMMWORD[64+rax*1+rsp]{k2},zmm18
+	vpermd	zmm24,zmm9,zmm6
+	vmovdqa64	ZMMWORD[128+rsp]{k2},zmm22
+	vmovdqu64	ZMMWORD[128+rax*1+rsp]{k2},zmm19
+	vmovdqa64	ZMMWORD[192+rsp]{k2},zmm23
+	vmovdqu64	ZMMWORD[192+rax*1+rsp]{k2},zmm20
+	vmovdqa64	ZMMWORD[256+rsp]{k2},zmm24
+
+
+
+
+
+
+
+
+
+
+	vpmuludq	zmm11,zmm16,zmm7
+	vpmuludq	zmm12,zmm17,zmm7
+	vpmuludq	zmm13,zmm18,zmm7
+	vpmuludq	zmm14,zmm19,zmm7
+	vpmuludq	zmm15,zmm20,zmm7
+	vpsrlq	zmm9,zmm18,32
+
+	vpmuludq	zmm25,zmm24,zmm8
+	vpmuludq	zmm26,zmm16,zmm8
+	vpmuludq	zmm27,zmm17,zmm8
+	vpmuludq	zmm28,zmm18,zmm8
+	vpmuludq	zmm29,zmm19,zmm8
+	vpsrlq	zmm10,zmm19,32
+	vpaddq	zmm11,zmm11,zmm25
+	vpaddq	zmm12,zmm12,zmm26
+	vpaddq	zmm13,zmm13,zmm27
+	vpaddq	zmm14,zmm14,zmm28
+	vpaddq	zmm15,zmm15,zmm29
+
+	vpmuludq	zmm25,zmm23,zmm9
+	vpmuludq	zmm26,zmm24,zmm9
+	vpmuludq	zmm28,zmm17,zmm9
+	vpmuludq	zmm29,zmm18,zmm9
+	vpmuludq	zmm27,zmm16,zmm9
+	vpsrlq	zmm6,zmm20,32
+	vpaddq	zmm11,zmm11,zmm25
+	vpaddq	zmm12,zmm12,zmm26
+	vpaddq	zmm14,zmm14,zmm28
+	vpaddq	zmm15,zmm15,zmm29
+	vpaddq	zmm13,zmm13,zmm27
+
+	vpmuludq	zmm25,zmm22,zmm10
+	vpmuludq	zmm28,zmm16,zmm10
+	vpmuludq	zmm29,zmm17,zmm10
+	vpmuludq	zmm26,zmm23,zmm10
+	vpmuludq	zmm27,zmm24,zmm10
+	vpaddq	zmm11,zmm11,zmm25
+	vpaddq	zmm14,zmm14,zmm28
+	vpaddq	zmm15,zmm15,zmm29
+	vpaddq	zmm12,zmm12,zmm26
+	vpaddq	zmm13,zmm13,zmm27
+
+	vpmuludq	zmm28,zmm24,zmm6
+	vpmuludq	zmm29,zmm16,zmm6
+	vpmuludq	zmm25,zmm21,zmm6
+	vpmuludq	zmm26,zmm22,zmm6
+	vpmuludq	zmm27,zmm23,zmm6
+	vpaddq	zmm14,zmm14,zmm28
+	vpaddq	zmm15,zmm15,zmm29
+	vpaddq	zmm11,zmm11,zmm25
+	vpaddq	zmm12,zmm12,zmm26
+	vpaddq	zmm13,zmm13,zmm27
+
+
+
+	vmovdqu64	zmm10,ZMMWORD[rsi]
+	vmovdqu64	zmm6,ZMMWORD[64+rsi]
+	lea	rsi,[128+rsi]
+
+
+
+
+	vpsrlq	zmm28,zmm14,26
+	vpandq	zmm14,zmm14,zmm5
+	vpaddq	zmm15,zmm15,zmm28
+
+	vpsrlq	zmm25,zmm11,26
+	vpandq	zmm11,zmm11,zmm5
+	vpaddq	zmm12,zmm12,zmm25
+
+	vpsrlq	zmm29,zmm15,26
+	vpandq	zmm15,zmm15,zmm5
+
+	vpsrlq	zmm26,zmm12,26
+	vpandq	zmm12,zmm12,zmm5
+	vpaddq	zmm13,zmm13,zmm26
+
+	vpaddq	zmm11,zmm11,zmm29
+	vpsllq	zmm29,zmm29,2
+	vpaddq	zmm11,zmm11,zmm29
+
+	vpsrlq	zmm27,zmm13,26
+	vpandq	zmm13,zmm13,zmm5
+	vpaddq	zmm14,zmm14,zmm27
+
+	vpsrlq	zmm25,zmm11,26
+	vpandq	zmm11,zmm11,zmm5
+	vpaddq	zmm12,zmm12,zmm25
+
+	vpsrlq	zmm28,zmm14,26
+	vpandq	zmm14,zmm14,zmm5
+	vpaddq	zmm15,zmm15,zmm28
+
+
+
+
+
+	vpunpcklqdq	zmm7,zmm10,zmm6
+	vpunpckhqdq	zmm6,zmm10,zmm6
+
+
+
+
+
+
+	vmovdqa32	zmm25,ZMMWORD[128+rcx]
+	mov	eax,0x7777
+	kmovw	k1,eax
+
+	vpermd	zmm16,zmm25,zmm16
+	vpermd	zmm17,zmm25,zmm17
+	vpermd	zmm18,zmm25,zmm18
+	vpermd	zmm19,zmm25,zmm19
+	vpermd	zmm20,zmm25,zmm20
+
+	vpermd	zmm16{k1},zmm25,zmm11
+	vpermd	zmm17{k1},zmm25,zmm12
+	vpermd	zmm18{k1},zmm25,zmm13
+	vpermd	zmm19{k1},zmm25,zmm14
+	vpermd	zmm20{k1},zmm25,zmm15
+
+	vpslld	zmm21,zmm17,2
+	vpslld	zmm22,zmm18,2
+	vpslld	zmm23,zmm19,2
+	vpslld	zmm24,zmm20,2
+	vpaddd	zmm21,zmm21,zmm17
+	vpaddd	zmm22,zmm22,zmm18
+	vpaddd	zmm23,zmm23,zmm19
+	vpaddd	zmm24,zmm24,zmm20
+
+	vpbroadcastq	zmm30,QWORD[32+rcx]
+
+	vpsrlq	zmm9,zmm7,52
+	vpsllq	zmm10,zmm6,12
+	vporq	zmm9,zmm9,zmm10
+	vpsrlq	zmm8,zmm7,26
+	vpsrlq	zmm10,zmm6,14
+	vpsrlq	zmm6,zmm6,40
+	vpandq	zmm9,zmm9,zmm5
+	vpandq	zmm7,zmm7,zmm5
+
+
+
+
+	vpaddq	zmm2,zmm9,zmm2
+	sub	rdx,192
+	jbe	NEAR $L$tail_avx512
+	jmp	NEAR $L$oop_avx512
+
+ALIGN	32
+$L$oop_avx512:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+	vpmuludq	zmm14,zmm17,zmm2
+	vpaddq	zmm0,zmm7,zmm0
+	vpmuludq	zmm15,zmm18,zmm2
+	vpandq	zmm8,zmm8,zmm5
+	vpmuludq	zmm11,zmm23,zmm2
+	vpandq	zmm10,zmm10,zmm5
+	vpmuludq	zmm12,zmm24,zmm2
+	vporq	zmm6,zmm6,zmm30
+	vpmuludq	zmm13,zmm16,zmm2
+	vpaddq	zmm1,zmm8,zmm1
+	vpaddq	zmm3,zmm10,zmm3
+	vpaddq	zmm4,zmm6,zmm4
+
+	vmovdqu64	zmm10,ZMMWORD[rsi]
+	vmovdqu64	zmm6,ZMMWORD[64+rsi]
+	lea	rsi,[128+rsi]
+	vpmuludq	zmm28,zmm19,zmm0
+	vpmuludq	zmm29,zmm20,zmm0
+	vpmuludq	zmm25,zmm16,zmm0
+	vpmuludq	zmm26,zmm17,zmm0
+	vpaddq	zmm14,zmm14,zmm28
+	vpaddq	zmm15,zmm15,zmm29
+	vpaddq	zmm11,zmm11,zmm25
+	vpaddq	zmm12,zmm12,zmm26
+
+	vpmuludq	zmm28,zmm18,zmm1
+	vpmuludq	zmm29,zmm19,zmm1
+	vpmuludq	zmm25,zmm24,zmm1
+	vpmuludq	zmm27,zmm18,zmm0
+	vpaddq	zmm14,zmm14,zmm28
+	vpaddq	zmm15,zmm15,zmm29
+	vpaddq	zmm11,zmm11,zmm25
+	vpaddq	zmm13,zmm13,zmm27
+
+	vpunpcklqdq	zmm7,zmm10,zmm6
+	vpunpckhqdq	zmm6,zmm10,zmm6
+
+	vpmuludq	zmm28,zmm16,zmm3
+	vpmuludq	zmm29,zmm17,zmm3
+	vpmuludq	zmm26,zmm16,zmm1
+	vpmuludq	zmm27,zmm17,zmm1
+	vpaddq	zmm14,zmm14,zmm28
+	vpaddq	zmm15,zmm15,zmm29
+	vpaddq	zmm12,zmm12,zmm26
+	vpaddq	zmm13,zmm13,zmm27
+
+	vpmuludq	zmm28,zmm24,zmm4
+	vpmuludq	zmm29,zmm16,zmm4
+	vpmuludq	zmm25,zmm22,zmm3
+	vpmuludq	zmm26,zmm23,zmm3
+	vpaddq	zmm14,zmm14,zmm28
+	vpmuludq	zmm27,zmm24,zmm3
+	vpaddq	zmm15,zmm15,zmm29
+	vpaddq	zmm11,zmm11,zmm25
+	vpaddq	zmm12,zmm12,zmm26
+	vpaddq	zmm13,zmm13,zmm27
+
+	vpmuludq	zmm25,zmm21,zmm4
+	vpmuludq	zmm26,zmm22,zmm4
+	vpmuludq	zmm27,zmm23,zmm4
+	vpaddq	zmm0,zmm11,zmm25
+	vpaddq	zmm1,zmm12,zmm26
+	vpaddq	zmm2,zmm13,zmm27
+
+
+
+
+	vpsrlq	zmm9,zmm7,52
+	vpsllq	zmm10,zmm6,12
+
+	vpsrlq	zmm3,zmm14,26
+	vpandq	zmm14,zmm14,zmm5
+	vpaddq	zmm4,zmm15,zmm3
+
+	vporq	zmm9,zmm9,zmm10
+
+	vpsrlq	zmm11,zmm0,26
+	vpandq	zmm0,zmm0,zmm5
+	vpaddq	zmm1,zmm1,zmm11
+
+	vpandq	zmm9,zmm9,zmm5
+
+	vpsrlq	zmm15,zmm4,26
+	vpandq	zmm4,zmm4,zmm5
+
+	vpsrlq	zmm12,zmm1,26
+	vpandq	zmm1,zmm1,zmm5
+	vpaddq	zmm2,zmm2,zmm12
+
+	vpaddq	zmm0,zmm0,zmm15
+	vpsllq	zmm15,zmm15,2
+	vpaddq	zmm0,zmm0,zmm15
+
+	vpaddq	zmm2,zmm2,zmm9
+	vpsrlq	zmm8,zmm7,26
+
+	vpsrlq	zmm13,zmm2,26
+	vpandq	zmm2,zmm2,zmm5
+	vpaddq	zmm3,zmm14,zmm13
+
+	vpsrlq	zmm10,zmm6,14
+
+	vpsrlq	zmm11,zmm0,26
+	vpandq	zmm0,zmm0,zmm5
+	vpaddq	zmm1,zmm1,zmm11
+
+	vpsrlq	zmm6,zmm6,40
+
+	vpsrlq	zmm14,zmm3,26
+	vpandq	zmm3,zmm3,zmm5
+	vpaddq	zmm4,zmm4,zmm14
+
+	vpandq	zmm7,zmm7,zmm5
+
+
+
+
+	sub	rdx,128
+	ja	NEAR $L$oop_avx512
+
+$L$tail_avx512:
+
+
+
+
+
+	vpsrlq	zmm16,zmm16,32
+	vpsrlq	zmm17,zmm17,32
+	vpsrlq	zmm18,zmm18,32
+	vpsrlq	zmm23,zmm23,32
+	vpsrlq	zmm24,zmm24,32
+	vpsrlq	zmm19,zmm19,32
+	vpsrlq	zmm20,zmm20,32
+	vpsrlq	zmm21,zmm21,32
+	vpsrlq	zmm22,zmm22,32
+
+
+
+	lea	rsi,[rdx*1+rsi]
+
+
+	vpaddq	zmm0,zmm7,zmm0
+
+	vpmuludq	zmm14,zmm17,zmm2
+	vpmuludq	zmm15,zmm18,zmm2
+	vpmuludq	zmm11,zmm23,zmm2
+	vpandq	zmm8,zmm8,zmm5
+	vpmuludq	zmm12,zmm24,zmm2
+	vpandq	zmm10,zmm10,zmm5
+	vpmuludq	zmm13,zmm16,zmm2
+	vporq	zmm6,zmm6,zmm30
+	vpaddq	zmm1,zmm8,zmm1
+	vpaddq	zmm3,zmm10,zmm3
+	vpaddq	zmm4,zmm6,zmm4
+
+	vmovdqu	xmm7,XMMWORD[rsi]
+	vpmuludq	zmm28,zmm19,zmm0
+	vpmuludq	zmm29,zmm20,zmm0
+	vpmuludq	zmm25,zmm16,zmm0
+	vpmuludq	zmm26,zmm17,zmm0
+	vpaddq	zmm14,zmm14,zmm28
+	vpaddq	zmm15,zmm15,zmm29
+	vpaddq	zmm11,zmm11,zmm25
+	vpaddq	zmm12,zmm12,zmm26
+
+	vmovdqu	xmm8,XMMWORD[16+rsi]
+	vpmuludq	zmm28,zmm18,zmm1
+	vpmuludq	zmm29,zmm19,zmm1
+	vpmuludq	zmm25,zmm24,zmm1
+	vpmuludq	zmm27,zmm18,zmm0
+	vpaddq	zmm14,zmm14,zmm28
+	vpaddq	zmm15,zmm15,zmm29
+	vpaddq	zmm11,zmm11,zmm25
+	vpaddq	zmm13,zmm13,zmm27
+
+	vinserti128	ymm7,ymm7,XMMWORD[32+rsi],1
+	vpmuludq	zmm28,zmm16,zmm3
+	vpmuludq	zmm29,zmm17,zmm3
+	vpmuludq	zmm26,zmm16,zmm1
+	vpmuludq	zmm27,zmm17,zmm1
+	vpaddq	zmm14,zmm14,zmm28
+	vpaddq	zmm15,zmm15,zmm29
+	vpaddq	zmm12,zmm12,zmm26
+	vpaddq	zmm13,zmm13,zmm27
+
+	vinserti128	ymm8,ymm8,XMMWORD[48+rsi],1
+	vpmuludq	zmm28,zmm24,zmm4
+	vpmuludq	zmm29,zmm16,zmm4
+	vpmuludq	zmm25,zmm22,zmm3
+	vpmuludq	zmm26,zmm23,zmm3
+	vpmuludq	zmm27,zmm24,zmm3
+	vpaddq	zmm3,zmm14,zmm28
+	vpaddq	zmm15,zmm15,zmm29
+	vpaddq	zmm11,zmm11,zmm25
+	vpaddq	zmm12,zmm12,zmm26
+	vpaddq	zmm13,zmm13,zmm27
+
+	vpmuludq	zmm25,zmm21,zmm4
+	vpmuludq	zmm26,zmm22,zmm4
+	vpmuludq	zmm27,zmm23,zmm4
+	vpaddq	zmm0,zmm11,zmm25
+	vpaddq	zmm1,zmm12,zmm26
+	vpaddq	zmm2,zmm13,zmm27
+
+
+
+
+	mov	eax,1
+	vpermq	zmm14,zmm3,0xb1
+	vpermq	zmm4,zmm15,0xb1
+	vpermq	zmm11,zmm0,0xb1
+	vpermq	zmm12,zmm1,0xb1
+	vpermq	zmm13,zmm2,0xb1
+	vpaddq	zmm3,zmm3,zmm14
+	vpaddq	zmm4,zmm4,zmm15
+	vpaddq	zmm0,zmm0,zmm11
+	vpaddq	zmm1,zmm1,zmm12
+	vpaddq	zmm2,zmm2,zmm13
+
+	kmovw	k3,eax
+	vpermq	zmm14,zmm3,0x2
+	vpermq	zmm15,zmm4,0x2
+	vpermq	zmm11,zmm0,0x2
+	vpermq	zmm12,zmm1,0x2
+	vpermq	zmm13,zmm2,0x2
+	vpaddq	zmm3,zmm3,zmm14
+	vpaddq	zmm4,zmm4,zmm15
+	vpaddq	zmm0,zmm0,zmm11
+	vpaddq	zmm1,zmm1,zmm12
+	vpaddq	zmm2,zmm2,zmm13
+
+	vextracti64x4	ymm14,zmm3,0x1
+	vextracti64x4	ymm15,zmm4,0x1
+	vextracti64x4	ymm11,zmm0,0x1
+	vextracti64x4	ymm12,zmm1,0x1
+	vextracti64x4	ymm13,zmm2,0x1
+	vpaddq	zmm3{k3}{z},zmm3,zmm14
+	vpaddq	zmm4{k3}{z},zmm4,zmm15
+	vpaddq	zmm0{k3}{z},zmm0,zmm11
+	vpaddq	zmm1{k3}{z},zmm1,zmm12
+	vpaddq	zmm2{k3}{z},zmm2,zmm13
+
+
+
+	vpsrlq	ymm14,ymm3,26
+	vpand	ymm3,ymm3,ymm5
+	vpsrldq	ymm9,ymm7,6
+	vpsrldq	ymm10,ymm8,6
+	vpunpckhqdq	ymm6,ymm7,ymm8
+	vpaddq	ymm4,ymm4,ymm14
+
+	vpsrlq	ymm11,ymm0,26
+	vpand	ymm0,ymm0,ymm5
+	vpunpcklqdq	ymm9,ymm9,ymm10
+	vpunpcklqdq	ymm7,ymm7,ymm8
+	vpaddq	ymm1,ymm1,ymm11
+
+	vpsrlq	ymm15,ymm4,26
+	vpand	ymm4,ymm4,ymm5
+
+	vpsrlq	ymm12,ymm1,26
+	vpand	ymm1,ymm1,ymm5
+	vpsrlq	ymm10,ymm9,30
+	vpsrlq	ymm9,ymm9,4
+	vpaddq	ymm2,ymm2,ymm12
+
+	vpaddq	ymm0,ymm0,ymm15
+	vpsllq	ymm15,ymm15,2
+	vpsrlq	ymm8,ymm7,26
+	vpsrlq	ymm6,ymm6,40
+	vpaddq	ymm0,ymm0,ymm15
+
+	vpsrlq	ymm13,ymm2,26
+	vpand	ymm2,ymm2,ymm5
+	vpand	ymm9,ymm9,ymm5
+	vpand	ymm7,ymm7,ymm5
+	vpaddq	ymm3,ymm3,ymm13
+
+	vpsrlq	ymm11,ymm0,26
+	vpand	ymm0,ymm0,ymm5
+	vpaddq	ymm2,ymm9,ymm2
+	vpand	ymm8,ymm8,ymm5
+	vpaddq	ymm1,ymm1,ymm11
+
+	vpsrlq	ymm14,ymm3,26
+	vpand	ymm3,ymm3,ymm5
+	vpand	ymm10,ymm10,ymm5
+	vpor	ymm6,ymm6,YMMWORD[32+rcx]
+	vpaddq	ymm4,ymm4,ymm14
+
+	lea	rax,[144+rsp]
+	add	rdx,64
+	jnz	NEAR $L$tail_avx2
+
+	vpsubq	ymm2,ymm2,ymm9
+	vmovd	DWORD[(-112)+rdi],xmm0
+	vmovd	DWORD[(-108)+rdi],xmm1
+	vmovd	DWORD[(-104)+rdi],xmm2
+	vmovd	DWORD[(-100)+rdi],xmm3
+	vmovd	DWORD[(-96)+rdi],xmm4
+	vzeroall
+	movdqa	xmm6,XMMWORD[80+r11]
+	movdqa	xmm7,XMMWORD[96+r11]
+	movdqa	xmm8,XMMWORD[112+r11]
+	movdqa	xmm9,XMMWORD[128+r11]
+	movdqa	xmm10,XMMWORD[144+r11]
+	movdqa	xmm11,XMMWORD[160+r11]
+	movdqa	xmm12,XMMWORD[176+r11]
+	movdqa	xmm13,XMMWORD[192+r11]
+	movdqa	xmm14,XMMWORD[208+r11]
+	movdqa	xmm15,XMMWORD[224+r11]
+	lea	rsp,[248+r11]
+$L$do_avx512_epilogue:
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
+	DB	0F3h,0C3h		;repret
+
+$L$SEH_end_poly1305_blocks_avx512:
+
+ALIGN	32
+poly1305_init_base2_44:
+	mov	QWORD[8+rsp],rdi	;WIN64 prologue
+	mov	QWORD[16+rsp],rsi
+	mov	rax,rsp
+$L$SEH_begin_poly1305_init_base2_44:
+	mov	rdi,rcx
+	mov	rsi,rdx
+	mov	rdx,r8
+
+
+
+	xor	rax,rax
+	mov	QWORD[rdi],rax
+	mov	QWORD[8+rdi],rax
+	mov	QWORD[16+rdi],rax
+
+$L$init_base2_44:
+	lea	r10,[poly1305_blocks_vpmadd52]
+	lea	r11,[poly1305_emit_base2_44]
+
+	mov	rax,0x0ffffffc0fffffff
+	mov	rcx,0x0ffffffc0ffffffc
+	and	rax,QWORD[rsi]
+	mov	r8,0x00000fffffffffff
+	and	rcx,QWORD[8+rsi]
+	mov	r9,0x00000fffffffffff
+	and	r8,rax
+	shrd	rax,rcx,44
+	mov	QWORD[40+rdi],r8
+	and	rax,r9
+	shr	rcx,24
+	mov	QWORD[48+rdi],rax
+	lea	rax,[rax*4+rax]
+	mov	QWORD[56+rdi],rcx
+	shl	rax,2
+	lea	rcx,[rcx*4+rcx]
+	shl	rcx,2
+	mov	QWORD[24+rdi],rax
+	mov	QWORD[32+rdi],rcx
+	mov	QWORD[64+rdi],-1
+	mov	QWORD[rdx],r10
+	mov	QWORD[8+rdx],r11
+	mov	eax,1
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
+	DB	0F3h,0C3h		;repret
+
+$L$SEH_end_poly1305_init_base2_44:
+
+ALIGN	32
+poly1305_blocks_vpmadd52:
+	mov	QWORD[8+rsp],rdi	;WIN64 prologue
+	mov	QWORD[16+rsp],rsi
+	mov	rax,rsp
+$L$SEH_begin_poly1305_blocks_vpmadd52:
+	mov	rdi,rcx
+	mov	rsi,rdx
+	mov	rdx,r8
+	mov	rcx,r9
+
+
+
+DB	243,15,30,250
+	shr	rdx,4
+	jz	NEAR $L$no_data_vpmadd52
+
+	shl	rcx,40
+	mov	r8,QWORD[64+rdi]
+
+
+
+
+
+
+	mov	rax,3
+	mov	r10,1
+	cmp	rdx,4
+	cmovae	rax,r10
+	test	r8,r8
+	cmovns	rax,r10
+
+	and	rax,rdx
+	jz	NEAR $L$blocks_vpmadd52_4x
+
+	sub	rdx,rax
+	mov	r10d,7
+	mov	r11d,1
+	kmovw	k7,r10d
+	lea	r10,[$L$2_44_inp_permd]
+	kmovw	k1,r11d
+
+	vmovq	xmm21,rcx
+	vmovdqa64	ymm19,YMMWORD[r10]
+	vmovdqa64	ymm20,YMMWORD[32+r10]
+	vpermq	ymm21,ymm21,0xcf
+	vmovdqa64	ymm22,YMMWORD[64+r10]
+
+	vmovdqu64	ymm16{k7}{z},[rdi]
+	vmovdqu64	ymm3{k7}{z},[40+rdi]
+	vmovdqu64	ymm4{k7}{z},[32+rdi]
+	vmovdqu64	ymm5{k7}{z},[24+rdi]
+
+	vmovdqa64	ymm23,YMMWORD[96+r10]
+	vmovdqa64	ymm24,YMMWORD[128+r10]
+
+	jmp	NEAR $L$oop_vpmadd52
+
+ALIGN	32
+$L$oop_vpmadd52:
+	vmovdqu32	xmm18,XMMWORD[rsi]
+	lea	rsi,[16+rsi]
+
+	vpermd	ymm18,ymm19,ymm18
+	vpsrlvq	ymm18,ymm18,ymm20
+	vpandq	ymm18,ymm18,ymm22
+	vporq	ymm18,ymm18,ymm21
+
+	vpaddq	ymm16,ymm16,ymm18
+
+	vpermq	ymm0{k7}{z},ymm16,0
+	vpermq	ymm1{k7}{z},ymm16,85
+	vpermq	ymm2{k7}{z},ymm16,170
+
+	vpxord	ymm16,ymm16,ymm16
+	vpxord	ymm17,ymm17,ymm17
+
+	vpmadd52luq	ymm16,ymm0,ymm3
+	vpmadd52huq	ymm17,ymm0,ymm3
+
+	vpmadd52luq	ymm16,ymm1,ymm4
+	vpmadd52huq	ymm17,ymm1,ymm4
+
+	vpmadd52luq	ymm16,ymm2,ymm5
+	vpmadd52huq	ymm17,ymm2,ymm5
+
+	vpsrlvq	ymm18,ymm16,ymm23
+	vpsllvq	ymm17,ymm17,ymm24
+	vpandq	ymm16,ymm16,ymm22
+
+	vpaddq	ymm17,ymm17,ymm18
+
+	vpermq	ymm17,ymm17,147
+
+	vpaddq	ymm16,ymm16,ymm17
+
+	vpsrlvq	ymm18,ymm16,ymm23
+	vpandq	ymm16,ymm16,ymm22
+
+	vpermq	ymm18,ymm18,147
+
+	vpaddq	ymm16,ymm16,ymm18
+
+	vpermq	ymm18{k1}{z},ymm16,147
+
+	vpaddq	ymm16,ymm16,ymm18
+	vpsllq	ymm18,ymm18,2
+
+	vpaddq	ymm16,ymm16,ymm18
+
+	dec	rax
+	jnz	NEAR $L$oop_vpmadd52
+
+	vmovdqu64	YMMWORD[rdi]{k7},ymm16
+
+	test	rdx,rdx
+	jnz	NEAR $L$blocks_vpmadd52_4x
+
+$L$no_data_vpmadd52:
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
+	DB	0F3h,0C3h		;repret
+
+$L$SEH_end_poly1305_blocks_vpmadd52:
+
+ALIGN	32
+poly1305_blocks_vpmadd52_4x:
+	mov	QWORD[8+rsp],rdi	;WIN64 prologue
+	mov	QWORD[16+rsp],rsi
+	mov	rax,rsp
+$L$SEH_begin_poly1305_blocks_vpmadd52_4x:
+	mov	rdi,rcx
+	mov	rsi,rdx
+	mov	rdx,r8
+	mov	rcx,r9
+
+
+
+	shr	rdx,4
+	jz	NEAR $L$no_data_vpmadd52_4x
+
+	shl	rcx,40
+	mov	r8,QWORD[64+rdi]
+
+$L$blocks_vpmadd52_4x:
+	vpbroadcastq	ymm31,rcx
+
+	vmovdqa64	ymm28,YMMWORD[$L$x_mask44]
+	mov	eax,5
+	vmovdqa64	ymm29,YMMWORD[$L$x_mask42]
+	kmovw	k1,eax
+
+	test	r8,r8
+	js	NEAR $L$init_vpmadd52
+
+	vmovq	xmm0,QWORD[rdi]
+	vmovq	xmm1,QWORD[8+rdi]
+	vmovq	xmm2,QWORD[16+rdi]
+
+	test	rdx,3
+	jnz	NEAR $L$blocks_vpmadd52_2x_do
+
+$L$blocks_vpmadd52_4x_do:
+	vpbroadcastq	ymm3,QWORD[64+rdi]
+	vpbroadcastq	ymm4,QWORD[96+rdi]
+	vpbroadcastq	ymm5,QWORD[128+rdi]
+	vpbroadcastq	ymm16,QWORD[160+rdi]
+
+$L$blocks_vpmadd52_4x_key_loaded:
+	vpsllq	ymm17,ymm5,2
+	vpaddq	ymm17,ymm17,ymm5
+	vpsllq	ymm17,ymm17,2
+
+	test	rdx,7
+	jz	NEAR $L$blocks_vpmadd52_8x
+
+	vmovdqu64	ymm26,YMMWORD[rsi]
+	vmovdqu64	ymm27,YMMWORD[32+rsi]
+	lea	rsi,[64+rsi]
+
+	vpunpcklqdq	ymm25,ymm26,ymm27
+	vpunpckhqdq	ymm27,ymm26,ymm27
+
+
+
+	vpsrlq	ymm26,ymm27,24
+	vporq	ymm26,ymm26,ymm31
+	vpaddq	ymm2,ymm2,ymm26
+	vpandq	ymm24,ymm25,ymm28
+	vpsrlq	ymm25,ymm25,44
+	vpsllq	ymm27,ymm27,20
+	vporq	ymm25,ymm25,ymm27
+	vpandq	ymm25,ymm25,ymm28
+
+	sub	rdx,4
+	jz	NEAR $L$tail_vpmadd52_4x
+	jmp	NEAR $L$oop_vpmadd52_4x
+	ud2
+
+ALIGN	32
+$L$init_vpmadd52:
+	vmovq	xmm16,QWORD[24+rdi]
+	vmovq	xmm2,QWORD[56+rdi]
+	vmovq	xmm17,QWORD[32+rdi]
+	vmovq	xmm3,QWORD[40+rdi]
+	vmovq	xmm4,QWORD[48+rdi]
+
+	vmovdqa	ymm0,ymm3
+	vmovdqa	ymm1,ymm4
+	vmovdqa	ymm5,ymm2
+
+	mov	eax,2
+
+$L$mul_init_vpmadd52:
+	vpxorq	ymm18,ymm18,ymm18
+	vpmadd52luq	ymm18,ymm16,ymm2
+	vpxorq	ymm19,ymm19,ymm19
+	vpmadd52huq	ymm19,ymm16,ymm2
+	vpxorq	ymm20,ymm20,ymm20
+	vpmadd52luq	ymm20,ymm17,ymm2
+	vpxorq	ymm21,ymm21,ymm21
+	vpmadd52huq	ymm21,ymm17,ymm2
+	vpxorq	ymm22,ymm22,ymm22
+	vpmadd52luq	ymm22,ymm3,ymm2
+	vpxorq	ymm23,ymm23,ymm23
+	vpmadd52huq	ymm23,ymm3,ymm2
+
+	vpmadd52luq	ymm18,ymm3,ymm0
+	vpmadd52huq	ymm19,ymm3,ymm0
+	vpmadd52luq	ymm20,ymm4,ymm0
+	vpmadd52huq	ymm21,ymm4,ymm0
+	vpmadd52luq	ymm22,ymm5,ymm0
+	vpmadd52huq	ymm23,ymm5,ymm0
+
+	vpmadd52luq	ymm18,ymm17,ymm1
+	vpmadd52huq	ymm19,ymm17,ymm1
+	vpmadd52luq	ymm20,ymm3,ymm1
+	vpmadd52huq	ymm21,ymm3,ymm1
+	vpmadd52luq	ymm22,ymm4,ymm1
+	vpmadd52huq	ymm23,ymm4,ymm1
+
+
+
+	vpsrlq	ymm30,ymm18,44
+	vpsllq	ymm19,ymm19,8
+	vpandq	ymm0,ymm18,ymm28
+	vpaddq	ymm19,ymm19,ymm30
+
+	vpaddq	ymm20,ymm20,ymm19
+
+	vpsrlq	ymm30,ymm20,44
+	vpsllq	ymm21,ymm21,8
+	vpandq	ymm1,ymm20,ymm28
+	vpaddq	ymm21,ymm21,ymm30
+
+	vpaddq	ymm22,ymm22,ymm21
+
+	vpsrlq	ymm30,ymm22,42
+	vpsllq	ymm23,ymm23,10
+	vpandq	ymm2,ymm22,ymm29
+	vpaddq	ymm23,ymm23,ymm30
+
+	vpaddq	ymm0,ymm0,ymm23
+	vpsllq	ymm23,ymm23,2
+
+	vpaddq	ymm0,ymm0,ymm23
+
+	vpsrlq	ymm30,ymm0,44
+	vpandq	ymm0,ymm0,ymm28
+
+	vpaddq	ymm1,ymm1,ymm30
+
+	dec	eax
+	jz	NEAR $L$done_init_vpmadd52
+
+	vpunpcklqdq	ymm4,ymm1,ymm4
+	vpbroadcastq	xmm1,xmm1
+	vpunpcklqdq	ymm5,ymm2,ymm5
+	vpbroadcastq	xmm2,xmm2
+	vpunpcklqdq	ymm3,ymm0,ymm3
+	vpbroadcastq	xmm0,xmm0
+
+	vpsllq	ymm16,ymm4,2
+	vpsllq	ymm17,ymm5,2
+	vpaddq	ymm16,ymm16,ymm4
+	vpaddq	ymm17,ymm17,ymm5
+	vpsllq	ymm16,ymm16,2
+	vpsllq	ymm17,ymm17,2
+
+	jmp	NEAR $L$mul_init_vpmadd52
+	ud2
+
+ALIGN	32
+$L$done_init_vpmadd52:
+	vinserti128	ymm4,ymm1,xmm4,1
+	vinserti128	ymm5,ymm2,xmm5,1
+	vinserti128	ymm3,ymm0,xmm3,1
+
+	vpermq	ymm4,ymm4,216
+	vpermq	ymm5,ymm5,216
+	vpermq	ymm3,ymm3,216
+
+	vpsllq	ymm16,ymm4,2
+	vpaddq	ymm16,ymm16,ymm4
+	vpsllq	ymm16,ymm16,2
+
+	vmovq	xmm0,QWORD[rdi]
+	vmovq	xmm1,QWORD[8+rdi]
+	vmovq	xmm2,QWORD[16+rdi]
+
+	test	rdx,3
+	jnz	NEAR $L$done_init_vpmadd52_2x
+
+	vmovdqu64	YMMWORD[64+rdi],ymm3
+	vpbroadcastq	ymm3,xmm3
+	vmovdqu64	YMMWORD[96+rdi],ymm4
+	vpbroadcastq	ymm4,xmm4
+	vmovdqu64	YMMWORD[128+rdi],ymm5
+	vpbroadcastq	ymm5,xmm5
+	vmovdqu64	YMMWORD[160+rdi],ymm16
+	vpbroadcastq	ymm16,xmm16
+
+	jmp	NEAR $L$blocks_vpmadd52_4x_key_loaded
+	ud2
+
+ALIGN	32
+$L$done_init_vpmadd52_2x:
+	vmovdqu64	YMMWORD[64+rdi],ymm3
+	vpsrldq	ymm3,ymm3,8
+	vmovdqu64	YMMWORD[96+rdi],ymm4
+	vpsrldq	ymm4,ymm4,8
+	vmovdqu64	YMMWORD[128+rdi],ymm5
+	vpsrldq	ymm5,ymm5,8
+	vmovdqu64	YMMWORD[160+rdi],ymm16
+	vpsrldq	ymm16,ymm16,8
+	jmp	NEAR $L$blocks_vpmadd52_2x_key_loaded
+	ud2
+
+ALIGN	32
+$L$blocks_vpmadd52_2x_do:
+	vmovdqu64	ymm5{k1}{z},[((128+8))+rdi]
+	vmovdqu64	ymm16{k1}{z},[((160+8))+rdi]
+	vmovdqu64	ymm3{k1}{z},[((64+8))+rdi]
+	vmovdqu64	ymm4{k1}{z},[((96+8))+rdi]
+
+$L$blocks_vpmadd52_2x_key_loaded:
+	vmovdqu64	ymm26,YMMWORD[rsi]
+	vpxorq	ymm27,ymm27,ymm27
+	lea	rsi,[32+rsi]
+
+	vpunpcklqdq	ymm25,ymm26,ymm27
+	vpunpckhqdq	ymm27,ymm26,ymm27
+
+
+
+	vpsrlq	ymm26,ymm27,24
+	vporq	ymm26,ymm26,ymm31
+	vpaddq	ymm2,ymm2,ymm26
+	vpandq	ymm24,ymm25,ymm28
+	vpsrlq	ymm25,ymm25,44
+	vpsllq	ymm27,ymm27,20
+	vporq	ymm25,ymm25,ymm27
+	vpandq	ymm25,ymm25,ymm28
+
+	jmp	NEAR $L$tail_vpmadd52_2x
+	ud2
+
+ALIGN	32
+$L$oop_vpmadd52_4x:
+
+	vpaddq	ymm0,ymm0,ymm24
+	vpaddq	ymm1,ymm1,ymm25
+
+	vpxorq	ymm18,ymm18,ymm18
+	vpmadd52luq	ymm18,ymm16,ymm2
+	vpxorq	ymm19,ymm19,ymm19
+	vpmadd52huq	ymm19,ymm16,ymm2
+	vpxorq	ymm20,ymm20,ymm20
+	vpmadd52luq	ymm20,ymm17,ymm2
+	vpxorq	ymm21,ymm21,ymm21
+	vpmadd52huq	ymm21,ymm17,ymm2
+	vpxorq	ymm22,ymm22,ymm22
+	vpmadd52luq	ymm22,ymm3,ymm2
+	vpxorq	ymm23,ymm23,ymm23
+	vpmadd52huq	ymm23,ymm3,ymm2
+
+	vmovdqu64	ymm26,YMMWORD[rsi]
+	vmovdqu64	ymm27,YMMWORD[32+rsi]
+	lea	rsi,[64+rsi]
+	vpmadd52luq	ymm18,ymm3,ymm0
+	vpmadd52huq	ymm19,ymm3,ymm0
+	vpmadd52luq	ymm20,ymm4,ymm0
+	vpmadd52huq	ymm21,ymm4,ymm0
+	vpmadd52luq	ymm22,ymm5,ymm0
+	vpmadd52huq	ymm23,ymm5,ymm0
+
+	vpunpcklqdq	ymm25,ymm26,ymm27
+	vpunpckhqdq	ymm27,ymm26,ymm27
+	vpmadd52luq	ymm18,ymm17,ymm1
+	vpmadd52huq	ymm19,ymm17,ymm1
+	vpmadd52luq	ymm20,ymm3,ymm1
+	vpmadd52huq	ymm21,ymm3,ymm1
+	vpmadd52luq	ymm22,ymm4,ymm1
+	vpmadd52huq	ymm23,ymm4,ymm1
+
+
+
+	vpsrlq	ymm30,ymm18,44
+	vpsllq	ymm19,ymm19,8
+	vpandq	ymm0,ymm18,ymm28
+	vpaddq	ymm19,ymm19,ymm30
+
+	vpsrlq	ymm26,ymm27,24
+	vporq	ymm26,ymm26,ymm31
+	vpaddq	ymm20,ymm20,ymm19
+
+	vpsrlq	ymm30,ymm20,44
+	vpsllq	ymm21,ymm21,8
+	vpandq	ymm1,ymm20,ymm28
+	vpaddq	ymm21,ymm21,ymm30
+
+	vpandq	ymm24,ymm25,ymm28
+	vpsrlq	ymm25,ymm25,44
+	vpsllq	ymm27,ymm27,20
+	vpaddq	ymm22,ymm22,ymm21
+
+	vpsrlq	ymm30,ymm22,42
+	vpsllq	ymm23,ymm23,10
+	vpandq	ymm2,ymm22,ymm29
+	vpaddq	ymm23,ymm23,ymm30
+
+	vpaddq	ymm2,ymm2,ymm26
+	vpaddq	ymm0,ymm0,ymm23
+	vpsllq	ymm23,ymm23,2
+
+	vpaddq	ymm0,ymm0,ymm23
+	vporq	ymm25,ymm25,ymm27
+	vpandq	ymm25,ymm25,ymm28
+
+	vpsrlq	ymm30,ymm0,44
+	vpandq	ymm0,ymm0,ymm28
+
+	vpaddq	ymm1,ymm1,ymm30
+
+	sub	rdx,4
+	jnz	NEAR $L$oop_vpmadd52_4x
+
+$L$tail_vpmadd52_4x:
+	vmovdqu64	ymm5,YMMWORD[128+rdi]
+	vmovdqu64	ymm16,YMMWORD[160+rdi]
+	vmovdqu64	ymm3,YMMWORD[64+rdi]
+	vmovdqu64	ymm4,YMMWORD[96+rdi]
+
+$L$tail_vpmadd52_2x:
+	vpsllq	ymm17,ymm5,2
+	vpaddq	ymm17,ymm17,ymm5
+	vpsllq	ymm17,ymm17,2
+
+
+	vpaddq	ymm0,ymm0,ymm24
+	vpaddq	ymm1,ymm1,ymm25
+
+	vpxorq	ymm18,ymm18,ymm18
+	vpmadd52luq	ymm18,ymm16,ymm2
+	vpxorq	ymm19,ymm19,ymm19
+	vpmadd52huq	ymm19,ymm16,ymm2
+	vpxorq	ymm20,ymm20,ymm20
+	vpmadd52luq	ymm20,ymm17,ymm2
+	vpxorq	ymm21,ymm21,ymm21
+	vpmadd52huq	ymm21,ymm17,ymm2
+	vpxorq	ymm22,ymm22,ymm22
+	vpmadd52luq	ymm22,ymm3,ymm2
+	vpxorq	ymm23,ymm23,ymm23
+	vpmadd52huq	ymm23,ymm3,ymm2
+
+	vpmadd52luq	ymm18,ymm3,ymm0
+	vpmadd52huq	ymm19,ymm3,ymm0
+	vpmadd52luq	ymm20,ymm4,ymm0
+	vpmadd52huq	ymm21,ymm4,ymm0
+	vpmadd52luq	ymm22,ymm5,ymm0
+	vpmadd52huq	ymm23,ymm5,ymm0
+
+	vpmadd52luq	ymm18,ymm17,ymm1
+	vpmadd52huq	ymm19,ymm17,ymm1
+	vpmadd52luq	ymm20,ymm3,ymm1
+	vpmadd52huq	ymm21,ymm3,ymm1
+	vpmadd52luq	ymm22,ymm4,ymm1
+	vpmadd52huq	ymm23,ymm4,ymm1
+
+
+
+
+	mov	eax,1
+	kmovw	k1,eax
+	vpsrldq	ymm24,ymm18,8
+	vpsrldq	ymm0,ymm19,8
+	vpsrldq	ymm25,ymm20,8
+	vpsrldq	ymm1,ymm21,8
+	vpaddq	ymm18,ymm18,ymm24
+	vpaddq	ymm19,ymm19,ymm0
+	vpsrldq	ymm26,ymm22,8
+	vpsrldq	ymm2,ymm23,8
+	vpaddq	ymm20,ymm20,ymm25
+	vpaddq	ymm21,ymm21,ymm1
+	vpermq	ymm24,ymm18,0x2
+	vpermq	ymm0,ymm19,0x2
+	vpaddq	ymm22,ymm22,ymm26
+	vpaddq	ymm23,ymm23,ymm2
+
+	vpermq	ymm25,ymm20,0x2
+	vpermq	ymm1,ymm21,0x2
+	vpaddq	ymm18{k1}{z},ymm18,ymm24
+	vpaddq	ymm19{k1}{z},ymm19,ymm0
+	vpermq	ymm26,ymm22,0x2
+	vpermq	ymm2,ymm23,0x2
+	vpaddq	ymm20{k1}{z},ymm20,ymm25
+	vpaddq	ymm21{k1}{z},ymm21,ymm1
+	vpaddq	ymm22{k1}{z},ymm22,ymm26
+	vpaddq	ymm23{k1}{z},ymm23,ymm2
+
+
+
+	vpsrlq	ymm30,ymm18,44
+	vpsllq	ymm19,ymm19,8
+	vpandq	ymm0,ymm18,ymm28
+	vpaddq	ymm19,ymm19,ymm30
+
+	vpaddq	ymm20,ymm20,ymm19
+
+	vpsrlq	ymm30,ymm20,44
+	vpsllq	ymm21,ymm21,8
+	vpandq	ymm1,ymm20,ymm28
+	vpaddq	ymm21,ymm21,ymm30
+
+	vpaddq	ymm22,ymm22,ymm21
+
+	vpsrlq	ymm30,ymm22,42
+	vpsllq	ymm23,ymm23,10
+	vpandq	ymm2,ymm22,ymm29
+	vpaddq	ymm23,ymm23,ymm30
+
+	vpaddq	ymm0,ymm0,ymm23
+	vpsllq	ymm23,ymm23,2
+
+	vpaddq	ymm0,ymm0,ymm23
+
+	vpsrlq	ymm30,ymm0,44
+	vpandq	ymm0,ymm0,ymm28
+
+	vpaddq	ymm1,ymm1,ymm30
+
+
+	sub	rdx,2
+	ja	NEAR $L$blocks_vpmadd52_4x_do
+
+	vmovq	QWORD[rdi],xmm0
+	vmovq	QWORD[8+rdi],xmm1
+	vmovq	QWORD[16+rdi],xmm2
+	vzeroall
+
+$L$no_data_vpmadd52_4x:
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
+	DB	0F3h,0C3h		;repret
+
+$L$SEH_end_poly1305_blocks_vpmadd52_4x:
+
+ALIGN	32
+poly1305_blocks_vpmadd52_8x:
+	mov	QWORD[8+rsp],rdi	;WIN64 prologue
+	mov	QWORD[16+rsp],rsi
+	mov	rax,rsp
+$L$SEH_begin_poly1305_blocks_vpmadd52_8x:
+	mov	rdi,rcx
+	mov	rsi,rdx
+	mov	rdx,r8
+	mov	rcx,r9
+
+
+
+	shr	rdx,4
+	jz	NEAR $L$no_data_vpmadd52_8x
+
+	shl	rcx,40
+	mov	r8,QWORD[64+rdi]
+
+	vmovdqa64	ymm28,YMMWORD[$L$x_mask44]
+	vmovdqa64	ymm29,YMMWORD[$L$x_mask42]
+
+	test	r8,r8
+	js	NEAR $L$init_vpmadd52
+
+	vmovq	xmm0,QWORD[rdi]
+	vmovq	xmm1,QWORD[8+rdi]
+	vmovq	xmm2,QWORD[16+rdi]
+
+$L$blocks_vpmadd52_8x:
+
+
+
+	vmovdqu64	ymm5,YMMWORD[128+rdi]
+	vmovdqu64	ymm16,YMMWORD[160+rdi]
+	vmovdqu64	ymm3,YMMWORD[64+rdi]
+	vmovdqu64	ymm4,YMMWORD[96+rdi]
+
+	vpsllq	ymm17,ymm5,2
+	vpaddq	ymm17,ymm17,ymm5
+	vpsllq	ymm17,ymm17,2
+
+	vpbroadcastq	ymm8,xmm5
+	vpbroadcastq	ymm6,xmm3
+	vpbroadcastq	ymm7,xmm4
+
+	vpxorq	ymm18,ymm18,ymm18
+	vpmadd52luq	ymm18,ymm16,ymm8
+	vpxorq	ymm19,ymm19,ymm19
+	vpmadd52huq	ymm19,ymm16,ymm8
+	vpxorq	ymm20,ymm20,ymm20
+	vpmadd52luq	ymm20,ymm17,ymm8
+	vpxorq	ymm21,ymm21,ymm21
+	vpmadd52huq	ymm21,ymm17,ymm8
+	vpxorq	ymm22,ymm22,ymm22
+	vpmadd52luq	ymm22,ymm3,ymm8
+	vpxorq	ymm23,ymm23,ymm23
+	vpmadd52huq	ymm23,ymm3,ymm8
+
+	vpmadd52luq	ymm18,ymm3,ymm6
+	vpmadd52huq	ymm19,ymm3,ymm6
+	vpmadd52luq	ymm20,ymm4,ymm6
+	vpmadd52huq	ymm21,ymm4,ymm6
+	vpmadd52luq	ymm22,ymm5,ymm6
+	vpmadd52huq	ymm23,ymm5,ymm6
+
+	vpmadd52luq	ymm18,ymm17,ymm7
+	vpmadd52huq	ymm19,ymm17,ymm7
+	vpmadd52luq	ymm20,ymm3,ymm7
+	vpmadd52huq	ymm21,ymm3,ymm7
+	vpmadd52luq	ymm22,ymm4,ymm7
+	vpmadd52huq	ymm23,ymm4,ymm7
+
+
+
+	vpsrlq	ymm30,ymm18,44
+	vpsllq	ymm19,ymm19,8
+	vpandq	ymm6,ymm18,ymm28
+	vpaddq	ymm19,ymm19,ymm30
+
+	vpaddq	ymm20,ymm20,ymm19
+
+	vpsrlq	ymm30,ymm20,44
+	vpsllq	ymm21,ymm21,8
+	vpandq	ymm7,ymm20,ymm28
+	vpaddq	ymm21,ymm21,ymm30
+
+	vpaddq	ymm22,ymm22,ymm21
+
+	vpsrlq	ymm30,ymm22,42
+	vpsllq	ymm23,ymm23,10
+	vpandq	ymm8,ymm22,ymm29
+	vpaddq	ymm23,ymm23,ymm30
+
+	vpaddq	ymm6,ymm6,ymm23
+	vpsllq	ymm23,ymm23,2
+
+	vpaddq	ymm6,ymm6,ymm23
+
+	vpsrlq	ymm30,ymm6,44
+	vpandq	ymm6,ymm6,ymm28
+
+	vpaddq	ymm7,ymm7,ymm30
+
+
+
+
+
+	vpunpcklqdq	ymm26,ymm8,ymm5
+	vpunpckhqdq	ymm5,ymm8,ymm5
+	vpunpcklqdq	ymm24,ymm6,ymm3
+	vpunpckhqdq	ymm3,ymm6,ymm3
+	vpunpcklqdq	ymm25,ymm7,ymm4
+	vpunpckhqdq	ymm4,ymm7,ymm4
+	vshufi64x2	zmm8,zmm26,zmm5,0x44
+	vshufi64x2	zmm6,zmm24,zmm3,0x44
+	vshufi64x2	zmm7,zmm25,zmm4,0x44
+
+	vmovdqu64	zmm26,ZMMWORD[rsi]
+	vmovdqu64	zmm27,ZMMWORD[64+rsi]
+	lea	rsi,[128+rsi]
+
+	vpsllq	zmm10,zmm8,2
+	vpsllq	zmm9,zmm7,2
+	vpaddq	zmm10,zmm10,zmm8
+	vpaddq	zmm9,zmm9,zmm7
+	vpsllq	zmm10,zmm10,2
+	vpsllq	zmm9,zmm9,2
+
+	vpbroadcastq	zmm31,rcx
+	vpbroadcastq	zmm28,xmm28
+	vpbroadcastq	zmm29,xmm29
+
+	vpbroadcastq	zmm16,xmm9
+	vpbroadcastq	zmm17,xmm10
+	vpbroadcastq	zmm3,xmm6
+	vpbroadcastq	zmm4,xmm7
+	vpbroadcastq	zmm5,xmm8
+
+	vpunpcklqdq	zmm25,zmm26,zmm27
+	vpunpckhqdq	zmm27,zmm26,zmm27
+
+
+
+	vpsrlq	zmm26,zmm27,24
+	vporq	zmm26,zmm26,zmm31
+	vpaddq	zmm2,zmm2,zmm26
+	vpandq	zmm24,zmm25,zmm28
+	vpsrlq	zmm25,zmm25,44
+	vpsllq	zmm27,zmm27,20
+	vporq	zmm25,zmm25,zmm27
+	vpandq	zmm25,zmm25,zmm28
+
+	sub	rdx,8
+	jz	NEAR $L$tail_vpmadd52_8x
+	jmp	NEAR $L$oop_vpmadd52_8x
+
+ALIGN	32
+$L$oop_vpmadd52_8x:
+
+	vpaddq	zmm0,zmm0,zmm24
+	vpaddq	zmm1,zmm1,zmm25
+
+	vpxorq	zmm18,zmm18,zmm18
+	vpmadd52luq	zmm18,zmm16,zmm2
+	vpxorq	zmm19,zmm19,zmm19
+	vpmadd52huq	zmm19,zmm16,zmm2
+	vpxorq	zmm20,zmm20,zmm20
+	vpmadd52luq	zmm20,zmm17,zmm2
+	vpxorq	zmm21,zmm21,zmm21
+	vpmadd52huq	zmm21,zmm17,zmm2
+	vpxorq	zmm22,zmm22,zmm22
+	vpmadd52luq	zmm22,zmm3,zmm2
+	vpxorq	zmm23,zmm23,zmm23
+	vpmadd52huq	zmm23,zmm3,zmm2
+
+	vmovdqu64	zmm26,ZMMWORD[rsi]
+	vmovdqu64	zmm27,ZMMWORD[64+rsi]
+	lea	rsi,[128+rsi]
+	vpmadd52luq	zmm18,zmm3,zmm0
+	vpmadd52huq	zmm19,zmm3,zmm0
+	vpmadd52luq	zmm20,zmm4,zmm0
+	vpmadd52huq	zmm21,zmm4,zmm0
+	vpmadd52luq	zmm22,zmm5,zmm0
+	vpmadd52huq	zmm23,zmm5,zmm0
+
+	vpunpcklqdq	zmm25,zmm26,zmm27
+	vpunpckhqdq	zmm27,zmm26,zmm27
+	vpmadd52luq	zmm18,zmm17,zmm1
+	vpmadd52huq	zmm19,zmm17,zmm1
+	vpmadd52luq	zmm20,zmm3,zmm1
+	vpmadd52huq	zmm21,zmm3,zmm1
+	vpmadd52luq	zmm22,zmm4,zmm1
+	vpmadd52huq	zmm23,zmm4,zmm1
+
+
+
+	vpsrlq	zmm30,zmm18,44
+	vpsllq	zmm19,zmm19,8
+	vpandq	zmm0,zmm18,zmm28
+	vpaddq	zmm19,zmm19,zmm30
+
+	vpsrlq	zmm26,zmm27,24
+	vporq	zmm26,zmm26,zmm31
+	vpaddq	zmm20,zmm20,zmm19
+
+	vpsrlq	zmm30,zmm20,44
+	vpsllq	zmm21,zmm21,8
+	vpandq	zmm1,zmm20,zmm28
+	vpaddq	zmm21,zmm21,zmm30
+
+	vpandq	zmm24,zmm25,zmm28
+	vpsrlq	zmm25,zmm25,44
+	vpsllq	zmm27,zmm27,20
+	vpaddq	zmm22,zmm22,zmm21
+
+	vpsrlq	zmm30,zmm22,42
+	vpsllq	zmm23,zmm23,10
+	vpandq	zmm2,zmm22,zmm29
+	vpaddq	zmm23,zmm23,zmm30
+
+	vpaddq	zmm2,zmm2,zmm26
+	vpaddq	zmm0,zmm0,zmm23
+	vpsllq	zmm23,zmm23,2
+
+	vpaddq	zmm0,zmm0,zmm23
+	vporq	zmm25,zmm25,zmm27
+	vpandq	zmm25,zmm25,zmm28
+
+	vpsrlq	zmm30,zmm0,44
+	vpandq	zmm0,zmm0,zmm28
+
+	vpaddq	zmm1,zmm1,zmm30
+
+	sub	rdx,8
+	jnz	NEAR $L$oop_vpmadd52_8x
+
+$L$tail_vpmadd52_8x:
+
+	vpaddq	zmm0,zmm0,zmm24
+	vpaddq	zmm1,zmm1,zmm25
+
+	vpxorq	zmm18,zmm18,zmm18
+	vpmadd52luq	zmm18,zmm9,zmm2
+	vpxorq	zmm19,zmm19,zmm19
+	vpmadd52huq	zmm19,zmm9,zmm2
+	vpxorq	zmm20,zmm20,zmm20
+	vpmadd52luq	zmm20,zmm10,zmm2
+	vpxorq	zmm21,zmm21,zmm21
+	vpmadd52huq	zmm21,zmm10,zmm2
+	vpxorq	zmm22,zmm22,zmm22
+	vpmadd52luq	zmm22,zmm6,zmm2
+	vpxorq	zmm23,zmm23,zmm23
+	vpmadd52huq	zmm23,zmm6,zmm2
+
+	vpmadd52luq	zmm18,zmm6,zmm0
+	vpmadd52huq	zmm19,zmm6,zmm0
+	vpmadd52luq	zmm20,zmm7,zmm0
+	vpmadd52huq	zmm21,zmm7,zmm0
+	vpmadd52luq	zmm22,zmm8,zmm0
+	vpmadd52huq	zmm23,zmm8,zmm0
+
+	vpmadd52luq	zmm18,zmm10,zmm1
+	vpmadd52huq	zmm19,zmm10,zmm1
+	vpmadd52luq	zmm20,zmm6,zmm1
+	vpmadd52huq	zmm21,zmm6,zmm1
+	vpmadd52luq	zmm22,zmm7,zmm1
+	vpmadd52huq	zmm23,zmm7,zmm1
+
+
+
+
+	mov	eax,1
+	kmovw	k1,eax
+	vpsrldq	zmm24,zmm18,8
+	vpsrldq	zmm0,zmm19,8
+	vpsrldq	zmm25,zmm20,8
+	vpsrldq	zmm1,zmm21,8
+	vpaddq	zmm18,zmm18,zmm24
+	vpaddq	zmm19,zmm19,zmm0
+	vpsrldq	zmm26,zmm22,8
+	vpsrldq	zmm2,zmm23,8
+	vpaddq	zmm20,zmm20,zmm25
+	vpaddq	zmm21,zmm21,zmm1
+	vpermq	zmm24,zmm18,0x2
+	vpermq	zmm0,zmm19,0x2
+	vpaddq	zmm22,zmm22,zmm26
+	vpaddq	zmm23,zmm23,zmm2
+
+	vpermq	zmm25,zmm20,0x2
+	vpermq	zmm1,zmm21,0x2
+	vpaddq	zmm18,zmm18,zmm24
+	vpaddq	zmm19,zmm19,zmm0
+	vpermq	zmm26,zmm22,0x2
+	vpermq	zmm2,zmm23,0x2
+	vpaddq	zmm20,zmm20,zmm25
+	vpaddq	zmm21,zmm21,zmm1
+	vextracti64x4	ymm24,zmm18,1
+	vextracti64x4	ymm0,zmm19,1
+	vpaddq	zmm22,zmm22,zmm26
+	vpaddq	zmm23,zmm23,zmm2
+
+	vextracti64x4	ymm25,zmm20,1
+	vextracti64x4	ymm1,zmm21,1
+	vextracti64x4	ymm26,zmm22,1
+	vextracti64x4	ymm2,zmm23,1
+	vpaddq	ymm18{k1}{z},ymm18,ymm24
+	vpaddq	ymm19{k1}{z},ymm19,ymm0
+	vpaddq	ymm20{k1}{z},ymm20,ymm25
+	vpaddq	ymm21{k1}{z},ymm21,ymm1
+	vpaddq	ymm22{k1}{z},ymm22,ymm26
+	vpaddq	ymm23{k1}{z},ymm23,ymm2
+
+
+
+	vpsrlq	ymm30,ymm18,44
+	vpsllq	ymm19,ymm19,8
+	vpandq	ymm0,ymm18,ymm28
+	vpaddq	ymm19,ymm19,ymm30
+
+	vpaddq	ymm20,ymm20,ymm19
+
+	vpsrlq	ymm30,ymm20,44
+	vpsllq	ymm21,ymm21,8
+	vpandq	ymm1,ymm20,ymm28
+	vpaddq	ymm21,ymm21,ymm30
+
+	vpaddq	ymm22,ymm22,ymm21
+
+	vpsrlq	ymm30,ymm22,42
+	vpsllq	ymm23,ymm23,10
+	vpandq	ymm2,ymm22,ymm29
+	vpaddq	ymm23,ymm23,ymm30
+
+	vpaddq	ymm0,ymm0,ymm23
+	vpsllq	ymm23,ymm23,2
+
+	vpaddq	ymm0,ymm0,ymm23
+
+	vpsrlq	ymm30,ymm0,44
+	vpandq	ymm0,ymm0,ymm28
+
+	vpaddq	ymm1,ymm1,ymm30
+
+
+
+	vmovq	QWORD[rdi],xmm0
+	vmovq	QWORD[8+rdi],xmm1
+	vmovq	QWORD[16+rdi],xmm2
+	vzeroall
+
+$L$no_data_vpmadd52_8x:
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
+	DB	0F3h,0C3h		;repret
+
+$L$SEH_end_poly1305_blocks_vpmadd52_8x:
+
+ALIGN	32
+poly1305_emit_base2_44:
+	mov	QWORD[8+rsp],rdi	;WIN64 prologue
+	mov	QWORD[16+rsp],rsi
+	mov	rax,rsp
+$L$SEH_begin_poly1305_emit_base2_44:
+	mov	rdi,rcx
+	mov	rsi,rdx
+	mov	rdx,r8
+
+
+
+DB	243,15,30,250
+	mov	r8,QWORD[rdi]
+	mov	r9,QWORD[8+rdi]
+	mov	r10,QWORD[16+rdi]
+
+	mov	rax,r9
+	shr	r9,20
+	shl	rax,44
+	mov	rcx,r10
+	shr	r10,40
+	shl	rcx,24
+
+	add	r8,rax
+	adc	r9,rcx
+	adc	r10,0
+
+	mov	rax,r8
+	add	r8,5
+	mov	rcx,r9
+	adc	r9,0
+	adc	r10,0
+	shr	r10,2
+	cmovnz	rax,r8
+	cmovnz	rcx,r9
+
+	add	rax,QWORD[rdx]
+	adc	rcx,QWORD[8+rdx]
+	mov	QWORD[rsi],rax
+	mov	QWORD[8+rsi],rcx
+
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
+	DB	0F3h,0C3h		;repret
+
+$L$SEH_end_poly1305_emit_base2_44:
+ALIGN	64
+$L$const:
+$L$mask24:
+	DD	0x0ffffff,0,0x0ffffff,0,0x0ffffff,0,0x0ffffff,0
+$L$129:
+	DD	16777216,0,16777216,0,16777216,0,16777216,0
+$L$mask26:
+	DD	0x3ffffff,0,0x3ffffff,0,0x3ffffff,0,0x3ffffff,0
+$L$permd_avx2:
+	DD	2,2,2,3,2,0,2,1
+$L$permd_avx512:
+	DD	0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7
+
+$L$2_44_inp_permd:
+	DD	0,1,1,2,2,3,7,7
+$L$2_44_inp_shift:
+	DQ	0,12,24,64
+$L$2_44_mask:
+	DQ	0xfffffffffff,0xfffffffffff,0x3ffffffffff,0xffffffffffffffff
+$L$2_44_shift_rgt:
+	DQ	44,44,42,64
+$L$2_44_shift_lft:
+	DQ	8,8,10,64
+
+ALIGN	64
+$L$x_mask44:
+	DQ	0xfffffffffff,0xfffffffffff,0xfffffffffff,0xfffffffffff
+	DQ	0xfffffffffff,0xfffffffffff,0xfffffffffff,0xfffffffffff
+$L$x_mask42:
+	DQ	0x3ffffffffff,0x3ffffffffff,0x3ffffffffff,0x3ffffffffff
+	DQ	0x3ffffffffff,0x3ffffffffff,0x3ffffffffff,0x3ffffffffff
 DB	80,111,108,121,49,51,48,53,32,102,111,114,32,120,56,54
 DB	95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32
@@ -462,4 +3910,33 @@
 	DD	$L$SEH_end_poly1305_emit wrt ..imagebase
 	DD	$L$SEH_info_poly1305_emit wrt ..imagebase
+	DD	$L$SEH_begin_poly1305_blocks_avx wrt ..imagebase
+	DD	$L$base2_64_avx wrt ..imagebase
+	DD	$L$SEH_info_poly1305_blocks_avx_1 wrt ..imagebase
+
+	DD	$L$base2_64_avx wrt ..imagebase
+	DD	$L$even_avx wrt ..imagebase
+	DD	$L$SEH_info_poly1305_blocks_avx_2 wrt ..imagebase
+
+	DD	$L$even_avx wrt ..imagebase
+	DD	$L$SEH_end_poly1305_blocks_avx wrt ..imagebase
+	DD	$L$SEH_info_poly1305_blocks_avx_3 wrt ..imagebase
+
+	DD	$L$SEH_begin_poly1305_emit_avx wrt ..imagebase
+	DD	$L$SEH_end_poly1305_emit_avx wrt ..imagebase
+	DD	$L$SEH_info_poly1305_emit_avx wrt ..imagebase
+	DD	$L$SEH_begin_poly1305_blocks_avx2 wrt ..imagebase
+	DD	$L$base2_64_avx2 wrt ..imagebase
+	DD	$L$SEH_info_poly1305_blocks_avx2_1 wrt ..imagebase
+
+	DD	$L$base2_64_avx2 wrt ..imagebase
+	DD	$L$even_avx2 wrt ..imagebase
+	DD	$L$SEH_info_poly1305_blocks_avx2_2 wrt ..imagebase
+
+	DD	$L$even_avx2 wrt ..imagebase
+	DD	$L$SEH_end_poly1305_blocks_avx2 wrt ..imagebase
+	DD	$L$SEH_info_poly1305_blocks_avx2_3 wrt ..imagebase
+	DD	$L$SEH_begin_poly1305_blocks_avx512 wrt ..imagebase
+	DD	$L$SEH_end_poly1305_blocks_avx512 wrt ..imagebase
+	DD	$L$SEH_info_poly1305_blocks_avx512 wrt ..imagebase
 section	.xdata rdata align=8
 ALIGN	8
@@ -478,2 +3955,39 @@
 	DD	se_handler wrt ..imagebase
 	DD	$L$SEH_begin_poly1305_emit wrt ..imagebase,$L$SEH_begin_poly1305_emit wrt ..imagebase
+$L$SEH_info_poly1305_blocks_avx_1:
+DB	9,0,0,0
+	DD	se_handler wrt ..imagebase
+	DD	$L$blocks_avx_body wrt ..imagebase,$L$blocks_avx_epilogue wrt ..imagebase
+
+$L$SEH_info_poly1305_blocks_avx_2:
+DB	9,0,0,0
+	DD	se_handler wrt ..imagebase
+	DD	$L$base2_64_avx_body wrt ..imagebase,$L$base2_64_avx_epilogue wrt ..imagebase
+
+$L$SEH_info_poly1305_blocks_avx_3:
+DB	9,0,0,0
+	DD	avx_handler wrt ..imagebase
+	DD	$L$do_avx_body wrt ..imagebase,$L$do_avx_epilogue wrt ..imagebase
+
+$L$SEH_info_poly1305_emit_avx:
+DB	9,0,0,0
+	DD	se_handler wrt ..imagebase
+	DD	$L$SEH_begin_poly1305_emit_avx wrt ..imagebase,$L$SEH_begin_poly1305_emit_avx wrt ..imagebase
+$L$SEH_info_poly1305_blocks_avx2_1:
+DB	9,0,0,0
+	DD	se_handler wrt ..imagebase
+	DD	$L$blocks_avx2_body wrt ..imagebase,$L$blocks_avx2_epilogue wrt ..imagebase
+
+$L$SEH_info_poly1305_blocks_avx2_2:
+DB	9,0,0,0
+	DD	se_handler wrt ..imagebase
+	DD	$L$base2_64_avx2_body wrt ..imagebase,$L$base2_64_avx2_epilogue wrt ..imagebase
+
+$L$SEH_info_poly1305_blocks_avx2_3:
+DB	9,0,0,0
+	DD	avx_handler wrt ..imagebase
+	DD	$L$do_avx2_body wrt ..imagebase,$L$do_avx2_epilogue wrt ..imagebase
+$L$SEH_info_poly1305_blocks_avx512:
+DB	9,0,0,0
+	DD	avx_handler wrt ..imagebase
+	DD	$L$do_avx512_body wrt ..imagebase,$L$do_avx512_epilogue wrt ..imagebase
Index: /trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/rsaz-avx2.S
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/rsaz-avx2.S	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/rsaz-avx2.S	(revision 95219)
@@ -6,25 +6,1976 @@
 
 
+global	rsaz_1024_sqr_avx2
+
+ALIGN	64
+rsaz_1024_sqr_avx2:
+	mov	QWORD[8+rsp],rdi	;WIN64 prologue
+	mov	QWORD[16+rsp],rsi
+	mov	rax,rsp
+$L$SEH_begin_rsaz_1024_sqr_avx2:
+	mov	rdi,rcx
+	mov	rsi,rdx
+	mov	rdx,r8
+	mov	rcx,r9
+	mov	r8,QWORD[40+rsp]
+
+
+
+	lea	rax,[rsp]
+
+	push	rbx
+
+	push	rbp
+
+	push	r12
+
+	push	r13
+
+	push	r14
+
+	push	r15
+
+	vzeroupper
+	lea	rsp,[((-168))+rsp]
+	vmovaps	XMMWORD[(-216)+rax],xmm6
+	vmovaps	XMMWORD[(-200)+rax],xmm7
+	vmovaps	XMMWORD[(-184)+rax],xmm8
+	vmovaps	XMMWORD[(-168)+rax],xmm9
+	vmovaps	XMMWORD[(-152)+rax],xmm10
+	vmovaps	XMMWORD[(-136)+rax],xmm11
+	vmovaps	XMMWORD[(-120)+rax],xmm12
+	vmovaps	XMMWORD[(-104)+rax],xmm13
+	vmovaps	XMMWORD[(-88)+rax],xmm14
+	vmovaps	XMMWORD[(-72)+rax],xmm15
+$L$sqr_1024_body:
+	mov	rbp,rax
+
+	mov	r13,rdx
+	sub	rsp,832
+	mov	r15,r13
+	sub	rdi,-128
+	sub	rsi,-128
+	sub	r13,-128
+
+	and	r15,4095
+	add	r15,32*10
+	shr	r15,12
+	vpxor	ymm9,ymm9,ymm9
+	jz	NEAR $L$sqr_1024_no_n_copy
+
+
+
+
+
+	sub	rsp,32*10
+	vmovdqu	ymm0,YMMWORD[((0-128))+r13]
+	and	rsp,-2048
+	vmovdqu	ymm1,YMMWORD[((32-128))+r13]
+	vmovdqu	ymm2,YMMWORD[((64-128))+r13]
+	vmovdqu	ymm3,YMMWORD[((96-128))+r13]
+	vmovdqu	ymm4,YMMWORD[((128-128))+r13]
+	vmovdqu	ymm5,YMMWORD[((160-128))+r13]
+	vmovdqu	ymm6,YMMWORD[((192-128))+r13]
+	vmovdqu	ymm7,YMMWORD[((224-128))+r13]
+	vmovdqu	ymm8,YMMWORD[((256-128))+r13]
+	lea	r13,[((832+128))+rsp]
+	vmovdqu	YMMWORD[(0-128)+r13],ymm0
+	vmovdqu	YMMWORD[(32-128)+r13],ymm1
+	vmovdqu	YMMWORD[(64-128)+r13],ymm2
+	vmovdqu	YMMWORD[(96-128)+r13],ymm3
+	vmovdqu	YMMWORD[(128-128)+r13],ymm4
+	vmovdqu	YMMWORD[(160-128)+r13],ymm5
+	vmovdqu	YMMWORD[(192-128)+r13],ymm6
+	vmovdqu	YMMWORD[(224-128)+r13],ymm7
+	vmovdqu	YMMWORD[(256-128)+r13],ymm8
+	vmovdqu	YMMWORD[(288-128)+r13],ymm9
+
+$L$sqr_1024_no_n_copy:
+	and	rsp,-1024
+
+	vmovdqu	ymm1,YMMWORD[((32-128))+rsi]
+	vmovdqu	ymm2,YMMWORD[((64-128))+rsi]
+	vmovdqu	ymm3,YMMWORD[((96-128))+rsi]
+	vmovdqu	ymm4,YMMWORD[((128-128))+rsi]
+	vmovdqu	ymm5,YMMWORD[((160-128))+rsi]
+	vmovdqu	ymm6,YMMWORD[((192-128))+rsi]
+	vmovdqu	ymm7,YMMWORD[((224-128))+rsi]
+	vmovdqu	ymm8,YMMWORD[((256-128))+rsi]
+
+	lea	rbx,[192+rsp]
+	vmovdqu	ymm15,YMMWORD[$L$and_mask]
+	jmp	NEAR $L$OOP_GRANDE_SQR_1024
+
+ALIGN	32
+$L$OOP_GRANDE_SQR_1024:
+	lea	r9,[((576+128))+rsp]
+	lea	r12,[448+rsp]
+
+
+
+
+	vpaddq	ymm1,ymm1,ymm1
+	vpbroadcastq	ymm10,QWORD[((0-128))+rsi]
+	vpaddq	ymm2,ymm2,ymm2
+	vmovdqa	YMMWORD[(0-128)+r9],ymm1
+	vpaddq	ymm3,ymm3,ymm3
+	vmovdqa	YMMWORD[(32-128)+r9],ymm2
+	vpaddq	ymm4,ymm4,ymm4
+	vmovdqa	YMMWORD[(64-128)+r9],ymm3
+	vpaddq	ymm5,ymm5,ymm5
+	vmovdqa	YMMWORD[(96-128)+r9],ymm4
+	vpaddq	ymm6,ymm6,ymm6
+	vmovdqa	YMMWORD[(128-128)+r9],ymm5
+	vpaddq	ymm7,ymm7,ymm7
+	vmovdqa	YMMWORD[(160-128)+r9],ymm6
+	vpaddq	ymm8,ymm8,ymm8
+	vmovdqa	YMMWORD[(192-128)+r9],ymm7
+	vpxor	ymm9,ymm9,ymm9
+	vmovdqa	YMMWORD[(224-128)+r9],ymm8
+
+	vpmuludq	ymm0,ymm10,YMMWORD[((0-128))+rsi]
+	vpbroadcastq	ymm11,QWORD[((32-128))+rsi]
+	vmovdqu	YMMWORD[(288-192)+rbx],ymm9
+	vpmuludq	ymm1,ymm1,ymm10
+	vmovdqu	YMMWORD[(320-448)+r12],ymm9
+	vpmuludq	ymm2,ymm2,ymm10
+	vmovdqu	YMMWORD[(352-448)+r12],ymm9
+	vpmuludq	ymm3,ymm3,ymm10
+	vmovdqu	YMMWORD[(384-448)+r12],ymm9
+	vpmuludq	ymm4,ymm4,ymm10
+	vmovdqu	YMMWORD[(416-448)+r12],ymm9
+	vpmuludq	ymm5,ymm5,ymm10
+	vmovdqu	YMMWORD[(448-448)+r12],ymm9
+	vpmuludq	ymm6,ymm6,ymm10
+	vmovdqu	YMMWORD[(480-448)+r12],ymm9
+	vpmuludq	ymm7,ymm7,ymm10
+	vmovdqu	YMMWORD[(512-448)+r12],ymm9
+	vpmuludq	ymm8,ymm8,ymm10
+	vpbroadcastq	ymm10,QWORD[((64-128))+rsi]
+	vmovdqu	YMMWORD[(544-448)+r12],ymm9
+
+	mov	r15,rsi
+	mov	r14d,4
+	jmp	NEAR $L$sqr_entry_1024
+ALIGN	32
+$L$OOP_SQR_1024:
+	vpbroadcastq	ymm11,QWORD[((32-128))+r15]
+	vpmuludq	ymm0,ymm10,YMMWORD[((0-128))+rsi]
+	vpaddq	ymm0,ymm0,YMMWORD[((0-192))+rbx]
+	vpmuludq	ymm1,ymm10,YMMWORD[((0-128))+r9]
+	vpaddq	ymm1,ymm1,YMMWORD[((32-192))+rbx]
+	vpmuludq	ymm2,ymm10,YMMWORD[((32-128))+r9]
+	vpaddq	ymm2,ymm2,YMMWORD[((64-192))+rbx]
+	vpmuludq	ymm3,ymm10,YMMWORD[((64-128))+r9]
+	vpaddq	ymm3,ymm3,YMMWORD[((96-192))+rbx]
+	vpmuludq	ymm4,ymm10,YMMWORD[((96-128))+r9]
+	vpaddq	ymm4,ymm4,YMMWORD[((128-192))+rbx]
+	vpmuludq	ymm5,ymm10,YMMWORD[((128-128))+r9]
+	vpaddq	ymm5,ymm5,YMMWORD[((160-192))+rbx]
+	vpmuludq	ymm6,ymm10,YMMWORD[((160-128))+r9]
+	vpaddq	ymm6,ymm6,YMMWORD[((192-192))+rbx]
+	vpmuludq	ymm7,ymm10,YMMWORD[((192-128))+r9]
+	vpaddq	ymm7,ymm7,YMMWORD[((224-192))+rbx]
+	vpmuludq	ymm8,ymm10,YMMWORD[((224-128))+r9]
+	vpbroadcastq	ymm10,QWORD[((64-128))+r15]
+	vpaddq	ymm8,ymm8,YMMWORD[((256-192))+rbx]
+$L$sqr_entry_1024:
+	vmovdqu	YMMWORD[(0-192)+rbx],ymm0
+	vmovdqu	YMMWORD[(32-192)+rbx],ymm1
+
+	vpmuludq	ymm12,ymm11,YMMWORD[((32-128))+rsi]
+	vpaddq	ymm2,ymm2,ymm12
+	vpmuludq	ymm14,ymm11,YMMWORD[((32-128))+r9]
+	vpaddq	ymm3,ymm3,ymm14
+	vpmuludq	ymm13,ymm11,YMMWORD[((64-128))+r9]
+	vpaddq	ymm4,ymm4,ymm13
+	vpmuludq	ymm12,ymm11,YMMWORD[((96-128))+r9]
+	vpaddq	ymm5,ymm5,ymm12
+	vpmuludq	ymm14,ymm11,YMMWORD[((128-128))+r9]
+	vpaddq	ymm6,ymm6,ymm14
+	vpmuludq	ymm13,ymm11,YMMWORD[((160-128))+r9]
+	vpaddq	ymm7,ymm7,ymm13
+	vpmuludq	ymm12,ymm11,YMMWORD[((192-128))+r9]
+	vpaddq	ymm8,ymm8,ymm12
+	vpmuludq	ymm0,ymm11,YMMWORD[((224-128))+r9]
+	vpbroadcastq	ymm11,QWORD[((96-128))+r15]
+	vpaddq	ymm0,ymm0,YMMWORD[((288-192))+rbx]
+
+	vmovdqu	YMMWORD[(64-192)+rbx],ymm2
+	vmovdqu	YMMWORD[(96-192)+rbx],ymm3
+
+	vpmuludq	ymm13,ymm10,YMMWORD[((64-128))+rsi]
+	vpaddq	ymm4,ymm4,ymm13
+	vpmuludq	ymm12,ymm10,YMMWORD[((64-128))+r9]
+	vpaddq	ymm5,ymm5,ymm12
+	vpmuludq	ymm14,ymm10,YMMWORD[((96-128))+r9]
+	vpaddq	ymm6,ymm6,ymm14
+	vpmuludq	ymm13,ymm10,YMMWORD[((128-128))+r9]
+	vpaddq	ymm7,ymm7,ymm13
+	vpmuludq	ymm12,ymm10,YMMWORD[((160-128))+r9]
+	vpaddq	ymm8,ymm8,ymm12
+	vpmuludq	ymm14,ymm10,YMMWORD[((192-128))+r9]
+	vpaddq	ymm0,ymm0,ymm14
+	vpmuludq	ymm1,ymm10,YMMWORD[((224-128))+r9]
+	vpbroadcastq	ymm10,QWORD[((128-128))+r15]
+	vpaddq	ymm1,ymm1,YMMWORD[((320-448))+r12]
+
+	vmovdqu	YMMWORD[(128-192)+rbx],ymm4
+	vmovdqu	YMMWORD[(160-192)+rbx],ymm5
+
+	vpmuludq	ymm12,ymm11,YMMWORD[((96-128))+rsi]
+	vpaddq	ymm6,ymm6,ymm12
+	vpmuludq	ymm14,ymm11,YMMWORD[((96-128))+r9]
+	vpaddq	ymm7,ymm7,ymm14
+	vpmuludq	ymm13,ymm11,YMMWORD[((128-128))+r9]
+	vpaddq	ymm8,ymm8,ymm13
+	vpmuludq	ymm12,ymm11,YMMWORD[((160-128))+r9]
+	vpaddq	ymm0,ymm0,ymm12
+	vpmuludq	ymm14,ymm11,YMMWORD[((192-128))+r9]
+	vpaddq	ymm1,ymm1,ymm14
+	vpmuludq	ymm2,ymm11,YMMWORD[((224-128))+r9]
+	vpbroadcastq	ymm11,QWORD[((160-128))+r15]
+	vpaddq	ymm2,ymm2,YMMWORD[((352-448))+r12]
+
+	vmovdqu	YMMWORD[(192-192)+rbx],ymm6
+	vmovdqu	YMMWORD[(224-192)+rbx],ymm7
+
+	vpmuludq	ymm12,ymm10,YMMWORD[((128-128))+rsi]
+	vpaddq	ymm8,ymm8,ymm12
+	vpmuludq	ymm14,ymm10,YMMWORD[((128-128))+r9]
+	vpaddq	ymm0,ymm0,ymm14
+	vpmuludq	ymm13,ymm10,YMMWORD[((160-128))+r9]
+	vpaddq	ymm1,ymm1,ymm13
+	vpmuludq	ymm12,ymm10,YMMWORD[((192-128))+r9]
+	vpaddq	ymm2,ymm2,ymm12
+	vpmuludq	ymm3,ymm10,YMMWORD[((224-128))+r9]
+	vpbroadcastq	ymm10,QWORD[((192-128))+r15]
+	vpaddq	ymm3,ymm3,YMMWORD[((384-448))+r12]
+
+	vmovdqu	YMMWORD[(256-192)+rbx],ymm8
+	vmovdqu	YMMWORD[(288-192)+rbx],ymm0
+	lea	rbx,[8+rbx]
+
+	vpmuludq	ymm13,ymm11,YMMWORD[((160-128))+rsi]
+	vpaddq	ymm1,ymm1,ymm13
+	vpmuludq	ymm12,ymm11,YMMWORD[((160-128))+r9]
+	vpaddq	ymm2,ymm2,ymm12
+	vpmuludq	ymm14,ymm11,YMMWORD[((192-128))+r9]
+	vpaddq	ymm3,ymm3,ymm14
+	vpmuludq	ymm4,ymm11,YMMWORD[((224-128))+r9]
+	vpbroadcastq	ymm11,QWORD[((224-128))+r15]
+	vpaddq	ymm4,ymm4,YMMWORD[((416-448))+r12]
+
+	vmovdqu	YMMWORD[(320-448)+r12],ymm1
+	vmovdqu	YMMWORD[(352-448)+r12],ymm2
+
+	vpmuludq	ymm12,ymm10,YMMWORD[((192-128))+rsi]
+	vpaddq	ymm3,ymm3,ymm12
+	vpmuludq	ymm14,ymm10,YMMWORD[((192-128))+r9]
+	vpbroadcastq	ymm0,QWORD[((256-128))+r15]
+	vpaddq	ymm4,ymm4,ymm14
+	vpmuludq	ymm5,ymm10,YMMWORD[((224-128))+r9]
+	vpbroadcastq	ymm10,QWORD[((0+8-128))+r15]
+	vpaddq	ymm5,ymm5,YMMWORD[((448-448))+r12]
+
+	vmovdqu	YMMWORD[(384-448)+r12],ymm3
+	vmovdqu	YMMWORD[(416-448)+r12],ymm4
+	lea	r15,[8+r15]
+
+	vpmuludq	ymm12,ymm11,YMMWORD[((224-128))+rsi]
+	vpaddq	ymm5,ymm5,ymm12
+	vpmuludq	ymm6,ymm11,YMMWORD[((224-128))+r9]
+	vpaddq	ymm6,ymm6,YMMWORD[((480-448))+r12]
+
+	vpmuludq	ymm7,ymm0,YMMWORD[((256-128))+rsi]
+	vmovdqu	YMMWORD[(448-448)+r12],ymm5
+	vpaddq	ymm7,ymm7,YMMWORD[((512-448))+r12]
+	vmovdqu	YMMWORD[(480-448)+r12],ymm6
+	vmovdqu	YMMWORD[(512-448)+r12],ymm7
+	lea	r12,[8+r12]
+
+	dec	r14d
+	jnz	NEAR $L$OOP_SQR_1024
+
+	vmovdqu	ymm8,YMMWORD[256+rsp]
+	vmovdqu	ymm1,YMMWORD[288+rsp]
+	vmovdqu	ymm2,YMMWORD[320+rsp]
+	lea	rbx,[192+rsp]
+
+	vpsrlq	ymm14,ymm8,29
+	vpand	ymm8,ymm8,ymm15
+	vpsrlq	ymm11,ymm1,29
+	vpand	ymm1,ymm1,ymm15
+
+	vpermq	ymm14,ymm14,0x93
+	vpxor	ymm9,ymm9,ymm9
+	vpermq	ymm11,ymm11,0x93
+
+	vpblendd	ymm10,ymm14,ymm9,3
+	vpblendd	ymm14,ymm11,ymm14,3
+	vpaddq	ymm8,ymm8,ymm10
+	vpblendd	ymm11,ymm9,ymm11,3
+	vpaddq	ymm1,ymm1,ymm14
+	vpaddq	ymm2,ymm2,ymm11
+	vmovdqu	YMMWORD[(288-192)+rbx],ymm1
+	vmovdqu	YMMWORD[(320-192)+rbx],ymm2
+
+	mov	rax,QWORD[rsp]
+	mov	r10,QWORD[8+rsp]
+	mov	r11,QWORD[16+rsp]
+	mov	r12,QWORD[24+rsp]
+	vmovdqu	ymm1,YMMWORD[32+rsp]
+	vmovdqu	ymm2,YMMWORD[((64-192))+rbx]
+	vmovdqu	ymm3,YMMWORD[((96-192))+rbx]
+	vmovdqu	ymm4,YMMWORD[((128-192))+rbx]
+	vmovdqu	ymm5,YMMWORD[((160-192))+rbx]
+	vmovdqu	ymm6,YMMWORD[((192-192))+rbx]
+	vmovdqu	ymm7,YMMWORD[((224-192))+rbx]
+
+	mov	r9,rax
+	imul	eax,ecx
+	and	eax,0x1fffffff
+	vmovd	xmm12,eax
+
+	mov	rdx,rax
+	imul	rax,QWORD[((-128))+r13]
+	vpbroadcastq	ymm12,xmm12
+	add	r9,rax
+	mov	rax,rdx
+	imul	rax,QWORD[((8-128))+r13]
+	shr	r9,29
+	add	r10,rax
+	mov	rax,rdx
+	imul	rax,QWORD[((16-128))+r13]
+	add	r10,r9
+	add	r11,rax
+	imul	rdx,QWORD[((24-128))+r13]
+	add	r12,rdx
+
+	mov	rax,r10
+	imul	eax,ecx
+	and	eax,0x1fffffff
+
+	mov	r14d,9
+	jmp	NEAR $L$OOP_REDUCE_1024
+
+ALIGN	32
+$L$OOP_REDUCE_1024:
+	vmovd	xmm13,eax
+	vpbroadcastq	ymm13,xmm13
+
+	vpmuludq	ymm10,ymm12,YMMWORD[((32-128))+r13]
+	mov	rdx,rax
+	imul	rax,QWORD[((-128))+r13]
+	vpaddq	ymm1,ymm1,ymm10
+	add	r10,rax
+	vpmuludq	ymm14,ymm12,YMMWORD[((64-128))+r13]
+	mov	rax,rdx
+	imul	rax,QWORD[((8-128))+r13]
+	vpaddq	ymm2,ymm2,ymm14
+	vpmuludq	ymm11,ymm12,YMMWORD[((96-128))+r13]
+DB	0x67
+	add	r11,rax
+DB	0x67
+	mov	rax,rdx
+	imul	rax,QWORD[((16-128))+r13]
+	shr	r10,29
+	vpaddq	ymm3,ymm3,ymm11
+	vpmuludq	ymm10,ymm12,YMMWORD[((128-128))+r13]
+	add	r12,rax
+	add	r11,r10
+	vpaddq	ymm4,ymm4,ymm10
+	vpmuludq	ymm14,ymm12,YMMWORD[((160-128))+r13]
+	mov	rax,r11
+	imul	eax,ecx
+	vpaddq	ymm5,ymm5,ymm14
+	vpmuludq	ymm11,ymm12,YMMWORD[((192-128))+r13]
+	and	eax,0x1fffffff
+	vpaddq	ymm6,ymm6,ymm11
+	vpmuludq	ymm10,ymm12,YMMWORD[((224-128))+r13]
+	vpaddq	ymm7,ymm7,ymm10
+	vpmuludq	ymm14,ymm12,YMMWORD[((256-128))+r13]
+	vmovd	xmm12,eax
+
+	vpaddq	ymm8,ymm8,ymm14
+
+	vpbroadcastq	ymm12,xmm12
+
+	vpmuludq	ymm11,ymm13,YMMWORD[((32-8-128))+r13]
+	vmovdqu	ymm14,YMMWORD[((96-8-128))+r13]
+	mov	rdx,rax
+	imul	rax,QWORD[((-128))+r13]
+	vpaddq	ymm1,ymm1,ymm11
+	vpmuludq	ymm10,ymm13,YMMWORD[((64-8-128))+r13]
+	vmovdqu	ymm11,YMMWORD[((128-8-128))+r13]
+	add	r11,rax
+	mov	rax,rdx
+	imul	rax,QWORD[((8-128))+r13]
+	vpaddq	ymm2,ymm2,ymm10
+	add	rax,r12
+	shr	r11,29
+	vpmuludq	ymm14,ymm14,ymm13
+	vmovdqu	ymm10,YMMWORD[((160-8-128))+r13]
+	add	rax,r11
+	vpaddq	ymm3,ymm3,ymm14
+	vpmuludq	ymm11,ymm11,ymm13
+	vmovdqu	ymm14,YMMWORD[((192-8-128))+r13]
+DB	0x67
+	mov	r12,rax
+	imul	eax,ecx
+	vpaddq	ymm4,ymm4,ymm11
+	vpmuludq	ymm10,ymm10,ymm13
+DB	0xc4,0x41,0x7e,0x6f,0x9d,0x58,0x00,0x00,0x00
+	and	eax,0x1fffffff
+	vpaddq	ymm5,ymm5,ymm10
+	vpmuludq	ymm14,ymm14,ymm13
+	vmovdqu	ymm10,YMMWORD[((256-8-128))+r13]
+	vpaddq	ymm6,ymm6,ymm14
+	vpmuludq	ymm11,ymm11,ymm13
+	vmovdqu	ymm9,YMMWORD[((288-8-128))+r13]
+	vmovd	xmm0,eax
+	imul	rax,QWORD[((-128))+r13]
+	vpaddq	ymm7,ymm7,ymm11
+	vpmuludq	ymm10,ymm10,ymm13
+	vmovdqu	ymm14,YMMWORD[((32-16-128))+r13]
+	vpbroadcastq	ymm0,xmm0
+	vpaddq	ymm8,ymm8,ymm10
+	vpmuludq	ymm9,ymm9,ymm13
+	vmovdqu	ymm11,YMMWORD[((64-16-128))+r13]
+	add	r12,rax
+
+	vmovdqu	ymm13,YMMWORD[((32-24-128))+r13]
+	vpmuludq	ymm14,ymm14,ymm12
+	vmovdqu	ymm10,YMMWORD[((96-16-128))+r13]
+	vpaddq	ymm1,ymm1,ymm14
+	vpmuludq	ymm13,ymm13,ymm0
+	vpmuludq	ymm11,ymm11,ymm12
+DB	0xc4,0x41,0x7e,0x6f,0xb5,0xf0,0xff,0xff,0xff
+	vpaddq	ymm13,ymm13,ymm1
+	vpaddq	ymm2,ymm2,ymm11
+	vpmuludq	ymm10,ymm10,ymm12
+	vmovdqu	ymm11,YMMWORD[((160-16-128))+r13]
+DB	0x67
+	vmovq	rax,xmm13
+	vmovdqu	YMMWORD[rsp],ymm13
+	vpaddq	ymm3,ymm3,ymm10
+	vpmuludq	ymm14,ymm14,ymm12
+	vmovdqu	ymm10,YMMWORD[((192-16-128))+r13]
+	vpaddq	ymm4,ymm4,ymm14
+	vpmuludq	ymm11,ymm11,ymm12
+	vmovdqu	ymm14,YMMWORD[((224-16-128))+r13]
+	vpaddq	ymm5,ymm5,ymm11
+	vpmuludq	ymm10,ymm10,ymm12
+	vmovdqu	ymm11,YMMWORD[((256-16-128))+r13]
+	vpaddq	ymm6,ymm6,ymm10
+	vpmuludq	ymm14,ymm14,ymm12
+	shr	r12,29
+	vmovdqu	ymm10,YMMWORD[((288-16-128))+r13]
+	add	rax,r12
+	vpaddq	ymm7,ymm7,ymm14
+	vpmuludq	ymm11,ymm11,ymm12
+
+	mov	r9,rax
+	imul	eax,ecx
+	vpaddq	ymm8,ymm8,ymm11
+	vpmuludq	ymm10,ymm10,ymm12
+	and	eax,0x1fffffff
+	vmovd	xmm12,eax
+	vmovdqu	ymm11,YMMWORD[((96-24-128))+r13]
+DB	0x67
+	vpaddq	ymm9,ymm9,ymm10
+	vpbroadcastq	ymm12,xmm12
+
+	vpmuludq	ymm14,ymm0,YMMWORD[((64-24-128))+r13]
+	vmovdqu	ymm10,YMMWORD[((128-24-128))+r13]
+	mov	rdx,rax
+	imul	rax,QWORD[((-128))+r13]
+	mov	r10,QWORD[8+rsp]
+	vpaddq	ymm1,ymm2,ymm14
+	vpmuludq	ymm11,ymm11,ymm0
+	vmovdqu	ymm14,YMMWORD[((160-24-128))+r13]
+	add	r9,rax
+	mov	rax,rdx
+	imul	rax,QWORD[((8-128))+r13]
+DB	0x67
+	shr	r9,29
+	mov	r11,QWORD[16+rsp]
+	vpaddq	ymm2,ymm3,ymm11
+	vpmuludq	ymm10,ymm10,ymm0
+	vmovdqu	ymm11,YMMWORD[((192-24-128))+r13]
+	add	r10,rax
+	mov	rax,rdx
+	imul	rax,QWORD[((16-128))+r13]
+	vpaddq	ymm3,ymm4,ymm10
+	vpmuludq	ymm14,ymm14,ymm0
+	vmovdqu	ymm10,YMMWORD[((224-24-128))+r13]
+	imul	rdx,QWORD[((24-128))+r13]
+	add	r11,rax
+	lea	rax,[r10*1+r9]
+	vpaddq	ymm4,ymm5,ymm14
+	vpmuludq	ymm11,ymm11,ymm0
+	vmovdqu	ymm14,YMMWORD[((256-24-128))+r13]
+	mov	r10,rax
+	imul	eax,ecx
+	vpmuludq	ymm10,ymm10,ymm0
+	vpaddq	ymm5,ymm6,ymm11
+	vmovdqu	ymm11,YMMWORD[((288-24-128))+r13]
+	and	eax,0x1fffffff
+	vpaddq	ymm6,ymm7,ymm10
+	vpmuludq	ymm14,ymm14,ymm0
+	add	rdx,QWORD[24+rsp]
+	vpaddq	ymm7,ymm8,ymm14
+	vpmuludq	ymm11,ymm11,ymm0
+	vpaddq	ymm8,ymm9,ymm11
+	vmovq	xmm9,r12
+	mov	r12,rdx
+
+	dec	r14d
+	jnz	NEAR $L$OOP_REDUCE_1024
+	lea	r12,[448+rsp]
+	vpaddq	ymm0,ymm13,ymm9
+	vpxor	ymm9,ymm9,ymm9
+
+	vpaddq	ymm0,ymm0,YMMWORD[((288-192))+rbx]
+	vpaddq	ymm1,ymm1,YMMWORD[((320-448))+r12]
+	vpaddq	ymm2,ymm2,YMMWORD[((352-448))+r12]
+	vpaddq	ymm3,ymm3,YMMWORD[((384-448))+r12]
+	vpaddq	ymm4,ymm4,YMMWORD[((416-448))+r12]
+	vpaddq	ymm5,ymm5,YMMWORD[((448-448))+r12]
+	vpaddq	ymm6,ymm6,YMMWORD[((480-448))+r12]
+	vpaddq	ymm7,ymm7,YMMWORD[((512-448))+r12]
+	vpaddq	ymm8,ymm8,YMMWORD[((544-448))+r12]
+
+	vpsrlq	ymm14,ymm0,29
+	vpand	ymm0,ymm0,ymm15
+	vpsrlq	ymm11,ymm1,29
+	vpand	ymm1,ymm1,ymm15
+	vpsrlq	ymm12,ymm2,29
+	vpermq	ymm14,ymm14,0x93
+	vpand	ymm2,ymm2,ymm15
+	vpsrlq	ymm13,ymm3,29
+	vpermq	ymm11,ymm11,0x93
+	vpand	ymm3,ymm3,ymm15
+	vpermq	ymm12,ymm12,0x93
+
+	vpblendd	ymm10,ymm14,ymm9,3
+	vpermq	ymm13,ymm13,0x93
+	vpblendd	ymm14,ymm11,ymm14,3
+	vpaddq	ymm0,ymm0,ymm10
+	vpblendd	ymm11,ymm12,ymm11,3
+	vpaddq	ymm1,ymm1,ymm14
+	vpblendd	ymm12,ymm13,ymm12,3
+	vpaddq	ymm2,ymm2,ymm11
+	vpblendd	ymm13,ymm9,ymm13,3
+	vpaddq	ymm3,ymm3,ymm12
+	vpaddq	ymm4,ymm4,ymm13
+
+	vpsrlq	ymm14,ymm0,29
+	vpand	ymm0,ymm0,ymm15
+	vpsrlq	ymm11,ymm1,29
+	vpand	ymm1,ymm1,ymm15
+	vpsrlq	ymm12,ymm2,29
+	vpermq	ymm14,ymm14,0x93
+	vpand	ymm2,ymm2,ymm15
+	vpsrlq	ymm13,ymm3,29
+	vpermq	ymm11,ymm11,0x93
+	vpand	ymm3,ymm3,ymm15
+	vpermq	ymm12,ymm12,0x93
+
+	vpblendd	ymm10,ymm14,ymm9,3
+	vpermq	ymm13,ymm13,0x93
+	vpblendd	ymm14,ymm11,ymm14,3
+	vpaddq	ymm0,ymm0,ymm10
+	vpblendd	ymm11,ymm12,ymm11,3
+	vpaddq	ymm1,ymm1,ymm14
+	vmovdqu	YMMWORD[(0-128)+rdi],ymm0
+	vpblendd	ymm12,ymm13,ymm12,3
+	vpaddq	ymm2,ymm2,ymm11
+	vmovdqu	YMMWORD[(32-128)+rdi],ymm1
+	vpblendd	ymm13,ymm9,ymm13,3
+	vpaddq	ymm3,ymm3,ymm12
+	vmovdqu	YMMWORD[(64-128)+rdi],ymm2
+	vpaddq	ymm4,ymm4,ymm13
+	vmovdqu	YMMWORD[(96-128)+rdi],ymm3
+	vpsrlq	ymm14,ymm4,29
+	vpand	ymm4,ymm4,ymm15
+	vpsrlq	ymm11,ymm5,29
+	vpand	ymm5,ymm5,ymm15
+	vpsrlq	ymm12,ymm6,29
+	vpermq	ymm14,ymm14,0x93
+	vpand	ymm6,ymm6,ymm15
+	vpsrlq	ymm13,ymm7,29
+	vpermq	ymm11,ymm11,0x93
+	vpand	ymm7,ymm7,ymm15
+	vpsrlq	ymm0,ymm8,29
+	vpermq	ymm12,ymm12,0x93
+	vpand	ymm8,ymm8,ymm15
+	vpermq	ymm13,ymm13,0x93
+
+	vpblendd	ymm10,ymm14,ymm9,3
+	vpermq	ymm0,ymm0,0x93
+	vpblendd	ymm14,ymm11,ymm14,3
+	vpaddq	ymm4,ymm4,ymm10
+	vpblendd	ymm11,ymm12,ymm11,3
+	vpaddq	ymm5,ymm5,ymm14
+	vpblendd	ymm12,ymm13,ymm12,3
+	vpaddq	ymm6,ymm6,ymm11
+	vpblendd	ymm13,ymm0,ymm13,3
+	vpaddq	ymm7,ymm7,ymm12
+	vpaddq	ymm8,ymm8,ymm13
+
+	vpsrlq	ymm14,ymm4,29
+	vpand	ymm4,ymm4,ymm15
+	vpsrlq	ymm11,ymm5,29
+	vpand	ymm5,ymm5,ymm15
+	vpsrlq	ymm12,ymm6,29
+	vpermq	ymm14,ymm14,0x93
+	vpand	ymm6,ymm6,ymm15
+	vpsrlq	ymm13,ymm7,29
+	vpermq	ymm11,ymm11,0x93
+	vpand	ymm7,ymm7,ymm15
+	vpsrlq	ymm0,ymm8,29
+	vpermq	ymm12,ymm12,0x93
+	vpand	ymm8,ymm8,ymm15
+	vpermq	ymm13,ymm13,0x93
+
+	vpblendd	ymm10,ymm14,ymm9,3
+	vpermq	ymm0,ymm0,0x93
+	vpblendd	ymm14,ymm11,ymm14,3
+	vpaddq	ymm4,ymm4,ymm10
+	vpblendd	ymm11,ymm12,ymm11,3
+	vpaddq	ymm5,ymm5,ymm14
+	vmovdqu	YMMWORD[(128-128)+rdi],ymm4
+	vpblendd	ymm12,ymm13,ymm12,3
+	vpaddq	ymm6,ymm6,ymm11
+	vmovdqu	YMMWORD[(160-128)+rdi],ymm5
+	vpblendd	ymm13,ymm0,ymm13,3
+	vpaddq	ymm7,ymm7,ymm12
+	vmovdqu	YMMWORD[(192-128)+rdi],ymm6
+	vpaddq	ymm8,ymm8,ymm13
+	vmovdqu	YMMWORD[(224-128)+rdi],ymm7
+	vmovdqu	YMMWORD[(256-128)+rdi],ymm8
+
+	mov	rsi,rdi
+	dec	r8d
+	jne	NEAR $L$OOP_GRANDE_SQR_1024
+
+	vzeroall
+	mov	rax,rbp
+
+$L$sqr_1024_in_tail:
+	movaps	xmm6,XMMWORD[((-216))+rax]
+	movaps	xmm7,XMMWORD[((-200))+rax]
+	movaps	xmm8,XMMWORD[((-184))+rax]
+	movaps	xmm9,XMMWORD[((-168))+rax]
+	movaps	xmm10,XMMWORD[((-152))+rax]
+	movaps	xmm11,XMMWORD[((-136))+rax]
+	movaps	xmm12,XMMWORD[((-120))+rax]
+	movaps	xmm13,XMMWORD[((-104))+rax]
+	movaps	xmm14,XMMWORD[((-88))+rax]
+	movaps	xmm15,XMMWORD[((-72))+rax]
+	mov	r15,QWORD[((-48))+rax]
+
+	mov	r14,QWORD[((-40))+rax]
+
+	mov	r13,QWORD[((-32))+rax]
+
+	mov	r12,QWORD[((-24))+rax]
+
+	mov	rbp,QWORD[((-16))+rax]
+
+	mov	rbx,QWORD[((-8))+rax]
+
+	lea	rsp,[rax]
+
+$L$sqr_1024_epilogue:
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
+	DB	0F3h,0C3h		;repret
+
+$L$SEH_end_rsaz_1024_sqr_avx2:
+global	rsaz_1024_mul_avx2
+
+ALIGN	64
+rsaz_1024_mul_avx2:
+	mov	QWORD[8+rsp],rdi	;WIN64 prologue
+	mov	QWORD[16+rsp],rsi
+	mov	rax,rsp
+$L$SEH_begin_rsaz_1024_mul_avx2:
+	mov	rdi,rcx
+	mov	rsi,rdx
+	mov	rdx,r8
+	mov	rcx,r9
+	mov	r8,QWORD[40+rsp]
+
+
+
+	lea	rax,[rsp]
+
+	push	rbx
+
+	push	rbp
+
+	push	r12
+
+	push	r13
+
+	push	r14
+
+	push	r15
+
+	vzeroupper
+	lea	rsp,[((-168))+rsp]
+	vmovaps	XMMWORD[(-216)+rax],xmm6
+	vmovaps	XMMWORD[(-200)+rax],xmm7
+	vmovaps	XMMWORD[(-184)+rax],xmm8
+	vmovaps	XMMWORD[(-168)+rax],xmm9
+	vmovaps	XMMWORD[(-152)+rax],xmm10
+	vmovaps	XMMWORD[(-136)+rax],xmm11
+	vmovaps	XMMWORD[(-120)+rax],xmm12
+	vmovaps	XMMWORD[(-104)+rax],xmm13
+	vmovaps	XMMWORD[(-88)+rax],xmm14
+	vmovaps	XMMWORD[(-72)+rax],xmm15
+$L$mul_1024_body:
+	mov	rbp,rax
+
+	vzeroall
+	mov	r13,rdx
+	sub	rsp,64
+
+
+
+
+
+
+DB	0x67,0x67
+	mov	r15,rsi
+	and	r15,4095
+	add	r15,32*10
+	shr	r15,12
+	mov	r15,rsi
+	cmovnz	rsi,r13
+	cmovnz	r13,r15
+
+	mov	r15,rcx
+	sub	rsi,-128
+	sub	rcx,-128
+	sub	rdi,-128
+
+	and	r15,4095
+	add	r15,32*10
+DB	0x67,0x67
+	shr	r15,12
+	jz	NEAR $L$mul_1024_no_n_copy
+
+
+
+
+
+	sub	rsp,32*10
+	vmovdqu	ymm0,YMMWORD[((0-128))+rcx]
+	and	rsp,-512
+	vmovdqu	ymm1,YMMWORD[((32-128))+rcx]
+	vmovdqu	ymm2,YMMWORD[((64-128))+rcx]
+	vmovdqu	ymm3,YMMWORD[((96-128))+rcx]
+	vmovdqu	ymm4,YMMWORD[((128-128))+rcx]
+	vmovdqu	ymm5,YMMWORD[((160-128))+rcx]
+	vmovdqu	ymm6,YMMWORD[((192-128))+rcx]
+	vmovdqu	ymm7,YMMWORD[((224-128))+rcx]
+	vmovdqu	ymm8,YMMWORD[((256-128))+rcx]
+	lea	rcx,[((64+128))+rsp]
+	vmovdqu	YMMWORD[(0-128)+rcx],ymm0
+	vpxor	ymm0,ymm0,ymm0
+	vmovdqu	YMMWORD[(32-128)+rcx],ymm1
+	vpxor	ymm1,ymm1,ymm1
+	vmovdqu	YMMWORD[(64-128)+rcx],ymm2
+	vpxor	ymm2,ymm2,ymm2
+	vmovdqu	YMMWORD[(96-128)+rcx],ymm3
+	vpxor	ymm3,ymm3,ymm3
+	vmovdqu	YMMWORD[(128-128)+rcx],ymm4
+	vpxor	ymm4,ymm4,ymm4
+	vmovdqu	YMMWORD[(160-128)+rcx],ymm5
+	vpxor	ymm5,ymm5,ymm5
+	vmovdqu	YMMWORD[(192-128)+rcx],ymm6
+	vpxor	ymm6,ymm6,ymm6
+	vmovdqu	YMMWORD[(224-128)+rcx],ymm7
+	vpxor	ymm7,ymm7,ymm7
+	vmovdqu	YMMWORD[(256-128)+rcx],ymm8
+	vmovdqa	ymm8,ymm0
+	vmovdqu	YMMWORD[(288-128)+rcx],ymm9
+$L$mul_1024_no_n_copy:
+	and	rsp,-64
+
+	mov	rbx,QWORD[r13]
+	vpbroadcastq	ymm10,QWORD[r13]
+	vmovdqu	YMMWORD[rsp],ymm0
+	xor	r9,r9
+DB	0x67
+	xor	r10,r10
+	xor	r11,r11
+	xor	r12,r12
+
+	vmovdqu	ymm15,YMMWORD[$L$and_mask]
+	mov	r14d,9
+	vmovdqu	YMMWORD[(288-128)+rdi],ymm9
+	jmp	NEAR $L$oop_mul_1024
+
+ALIGN	32
+$L$oop_mul_1024:
+	vpsrlq	ymm9,ymm3,29
+	mov	rax,rbx
+	imul	rax,QWORD[((-128))+rsi]
+	add	rax,r9
+	mov	r10,rbx
+	imul	r10,QWORD[((8-128))+rsi]
+	add	r10,QWORD[8+rsp]
+
+	mov	r9,rax
+	imul	eax,r8d
+	and	eax,0x1fffffff
+
+	mov	r11,rbx
+	imul	r11,QWORD[((16-128))+rsi]
+	add	r11,QWORD[16+rsp]
+
+	mov	r12,rbx
+	imul	r12,QWORD[((24-128))+rsi]
+	add	r12,QWORD[24+rsp]
+	vpmuludq	ymm0,ymm10,YMMWORD[((32-128))+rsi]
+	vmovd	xmm11,eax
+	vpaddq	ymm1,ymm1,ymm0
+	vpmuludq	ymm12,ymm10,YMMWORD[((64-128))+rsi]
+	vpbroadcastq	ymm11,xmm11
+	vpaddq	ymm2,ymm2,ymm12
+	vpmuludq	ymm13,ymm10,YMMWORD[((96-128))+rsi]
+	vpand	ymm3,ymm3,ymm15
+	vpaddq	ymm3,ymm3,ymm13
+	vpmuludq	ymm0,ymm10,YMMWORD[((128-128))+rsi]
+	vpaddq	ymm4,ymm4,ymm0
+	vpmuludq	ymm12,ymm10,YMMWORD[((160-128))+rsi]
+	vpaddq	ymm5,ymm5,ymm12
+	vpmuludq	ymm13,ymm10,YMMWORD[((192-128))+rsi]
+	vpaddq	ymm6,ymm6,ymm13
+	vpmuludq	ymm0,ymm10,YMMWORD[((224-128))+rsi]
+	vpermq	ymm9,ymm9,0x93
+	vpaddq	ymm7,ymm7,ymm0
+	vpmuludq	ymm12,ymm10,YMMWORD[((256-128))+rsi]
+	vpbroadcastq	ymm10,QWORD[8+r13]
+	vpaddq	ymm8,ymm8,ymm12
+
+	mov	rdx,rax
+	imul	rax,QWORD[((-128))+rcx]
+	add	r9,rax
+	mov	rax,rdx
+	imul	rax,QWORD[((8-128))+rcx]
+	add	r10,rax
+	mov	rax,rdx
+	imul	rax,QWORD[((16-128))+rcx]
+	add	r11,rax
+	shr	r9,29
+	imul	rdx,QWORD[((24-128))+rcx]
+	add	r12,rdx
+	add	r10,r9
+
+	vpmuludq	ymm13,ymm11,YMMWORD[((32-128))+rcx]
+	vmovq	rbx,xmm10
+	vpaddq	ymm1,ymm1,ymm13
+	vpmuludq	ymm0,ymm11,YMMWORD[((64-128))+rcx]
+	vpaddq	ymm2,ymm2,ymm0
+	vpmuludq	ymm12,ymm11,YMMWORD[((96-128))+rcx]
+	vpaddq	ymm3,ymm3,ymm12
+	vpmuludq	ymm13,ymm11,YMMWORD[((128-128))+rcx]
+	vpaddq	ymm4,ymm4,ymm13
+	vpmuludq	ymm0,ymm11,YMMWORD[((160-128))+rcx]
+	vpaddq	ymm5,ymm5,ymm0
+	vpmuludq	ymm12,ymm11,YMMWORD[((192-128))+rcx]
+	vpaddq	ymm6,ymm6,ymm12
+	vpmuludq	ymm13,ymm11,YMMWORD[((224-128))+rcx]
+	vpblendd	ymm12,ymm9,ymm14,3
+	vpaddq	ymm7,ymm7,ymm13
+	vpmuludq	ymm0,ymm11,YMMWORD[((256-128))+rcx]
+	vpaddq	ymm3,ymm3,ymm12
+	vpaddq	ymm8,ymm8,ymm0
+
+	mov	rax,rbx
+	imul	rax,QWORD[((-128))+rsi]
+	add	r10,rax
+	vmovdqu	ymm12,YMMWORD[((-8+32-128))+rsi]
+	mov	rax,rbx
+	imul	rax,QWORD[((8-128))+rsi]
+	add	r11,rax
+	vmovdqu	ymm13,YMMWORD[((-8+64-128))+rsi]
+
+	mov	rax,r10
+	vpblendd	ymm9,ymm9,ymm14,0xfc
+	imul	eax,r8d
+	vpaddq	ymm4,ymm4,ymm9
+	and	eax,0x1fffffff
+
+	imul	rbx,QWORD[((16-128))+rsi]
+	add	r12,rbx
+	vpmuludq	ymm12,ymm12,ymm10
+	vmovd	xmm11,eax
+	vmovdqu	ymm0,YMMWORD[((-8+96-128))+rsi]
+	vpaddq	ymm1,ymm1,ymm12
+	vpmuludq	ymm13,ymm13,ymm10
+	vpbroadcastq	ymm11,xmm11
+	vmovdqu	ymm12,YMMWORD[((-8+128-128))+rsi]
+	vpaddq	ymm2,ymm2,ymm13
+	vpmuludq	ymm0,ymm0,ymm10
+	vmovdqu	ymm13,YMMWORD[((-8+160-128))+rsi]
+	vpaddq	ymm3,ymm3,ymm0
+	vpmuludq	ymm12,ymm12,ymm10
+	vmovdqu	ymm0,YMMWORD[((-8+192-128))+rsi]
+	vpaddq	ymm4,ymm4,ymm12
+	vpmuludq	ymm13,ymm13,ymm10
+	vmovdqu	ymm12,YMMWORD[((-8+224-128))+rsi]
+	vpaddq	ymm5,ymm5,ymm13
+	vpmuludq	ymm0,ymm0,ymm10
+	vmovdqu	ymm13,YMMWORD[((-8+256-128))+rsi]
+	vpaddq	ymm6,ymm6,ymm0
+	vpmuludq	ymm12,ymm12,ymm10
+	vmovdqu	ymm9,YMMWORD[((-8+288-128))+rsi]
+	vpaddq	ymm7,ymm7,ymm12
+	vpmuludq	ymm13,ymm13,ymm10
+	vpaddq	ymm8,ymm8,ymm13
+	vpmuludq	ymm9,ymm9,ymm10
+	vpbroadcastq	ymm10,QWORD[16+r13]
+
+	mov	rdx,rax
+	imul	rax,QWORD[((-128))+rcx]
+	add	r10,rax
+	vmovdqu	ymm0,YMMWORD[((-8+32-128))+rcx]
+	mov	rax,rdx
+	imul	rax,QWORD[((8-128))+rcx]
+	add	r11,rax
+	vmovdqu	ymm12,YMMWORD[((-8+64-128))+rcx]
+	shr	r10,29
+	imul	rdx,QWORD[((16-128))+rcx]
+	add	r12,rdx
+	add	r11,r10
+
+	vpmuludq	ymm0,ymm0,ymm11
+	vmovq	rbx,xmm10
+	vmovdqu	ymm13,YMMWORD[((-8+96-128))+rcx]
+	vpaddq	ymm1,ymm1,ymm0
+	vpmuludq	ymm12,ymm12,ymm11
+	vmovdqu	ymm0,YMMWORD[((-8+128-128))+rcx]
+	vpaddq	ymm2,ymm2,ymm12
+	vpmuludq	ymm13,ymm13,ymm11
+	vmovdqu	ymm12,YMMWORD[((-8+160-128))+rcx]
+	vpaddq	ymm3,ymm3,ymm13
+	vpmuludq	ymm0,ymm0,ymm11
+	vmovdqu	ymm13,YMMWORD[((-8+192-128))+rcx]
+	vpaddq	ymm4,ymm4,ymm0
+	vpmuludq	ymm12,ymm12,ymm11
+	vmovdqu	ymm0,YMMWORD[((-8+224-128))+rcx]
+	vpaddq	ymm5,ymm5,ymm12
+	vpmuludq	ymm13,ymm13,ymm11
+	vmovdqu	ymm12,YMMWORD[((-8+256-128))+rcx]
+	vpaddq	ymm6,ymm6,ymm13
+	vpmuludq	ymm0,ymm0,ymm11
+	vmovdqu	ymm13,YMMWORD[((-8+288-128))+rcx]
+	vpaddq	ymm7,ymm7,ymm0
+	vpmuludq	ymm12,ymm12,ymm11
+	vpaddq	ymm8,ymm8,ymm12
+	vpmuludq	ymm13,ymm13,ymm11
+	vpaddq	ymm9,ymm9,ymm13
+
+	vmovdqu	ymm0,YMMWORD[((-16+32-128))+rsi]
+	mov	rax,rbx
+	imul	rax,QWORD[((-128))+rsi]
+	add	rax,r11
+
+	vmovdqu	ymm12,YMMWORD[((-16+64-128))+rsi]
+	mov	r11,rax
+	imul	eax,r8d
+	and	eax,0x1fffffff
+
+	imul	rbx,QWORD[((8-128))+rsi]
+	add	r12,rbx
+	vpmuludq	ymm0,ymm0,ymm10
+	vmovd	xmm11,eax
+	vmovdqu	ymm13,YMMWORD[((-16+96-128))+rsi]
+	vpaddq	ymm1,ymm1,ymm0
+	vpmuludq	ymm12,ymm12,ymm10
+	vpbroadcastq	ymm11,xmm11
+	vmovdqu	ymm0,YMMWORD[((-16+128-128))+rsi]
+	vpaddq	ymm2,ymm2,ymm12
+	vpmuludq	ymm13,ymm13,ymm10
+	vmovdqu	ymm12,YMMWORD[((-16+160-128))+rsi]
+	vpaddq	ymm3,ymm3,ymm13
+	vpmuludq	ymm0,ymm0,ymm10
+	vmovdqu	ymm13,YMMWORD[((-16+192-128))+rsi]
+	vpaddq	ymm4,ymm4,ymm0
+	vpmuludq	ymm12,ymm12,ymm10
+	vmovdqu	ymm0,YMMWORD[((-16+224-128))+rsi]
+	vpaddq	ymm5,ymm5,ymm12
+	vpmuludq	ymm13,ymm13,ymm10
+	vmovdqu	ymm12,YMMWORD[((-16+256-128))+rsi]
+	vpaddq	ymm6,ymm6,ymm13
+	vpmuludq	ymm0,ymm0,ymm10
+	vmovdqu	ymm13,YMMWORD[((-16+288-128))+rsi]
+	vpaddq	ymm7,ymm7,ymm0
+	vpmuludq	ymm12,ymm12,ymm10
+	vpaddq	ymm8,ymm8,ymm12
+	vpmuludq	ymm13,ymm13,ymm10
+	vpbroadcastq	ymm10,QWORD[24+r13]
+	vpaddq	ymm9,ymm9,ymm13
+
+	vmovdqu	ymm0,YMMWORD[((-16+32-128))+rcx]
+	mov	rdx,rax
+	imul	rax,QWORD[((-128))+rcx]
+	add	r11,rax
+	vmovdqu	ymm12,YMMWORD[((-16+64-128))+rcx]
+	imul	rdx,QWORD[((8-128))+rcx]
+	add	r12,rdx
+	shr	r11,29
+
+	vpmuludq	ymm0,ymm0,ymm11
+	vmovq	rbx,xmm10
+	vmovdqu	ymm13,YMMWORD[((-16+96-128))+rcx]
+	vpaddq	ymm1,ymm1,ymm0
+	vpmuludq	ymm12,ymm12,ymm11
+	vmovdqu	ymm0,YMMWORD[((-16+128-128))+rcx]
+	vpaddq	ymm2,ymm2,ymm12
+	vpmuludq	ymm13,ymm13,ymm11
+	vmovdqu	ymm12,YMMWORD[((-16+160-128))+rcx]
+	vpaddq	ymm3,ymm3,ymm13
+	vpmuludq	ymm0,ymm0,ymm11
+	vmovdqu	ymm13,YMMWORD[((-16+192-128))+rcx]
+	vpaddq	ymm4,ymm4,ymm0
+	vpmuludq	ymm12,ymm12,ymm11
+	vmovdqu	ymm0,YMMWORD[((-16+224-128))+rcx]
+	vpaddq	ymm5,ymm5,ymm12
+	vpmuludq	ymm13,ymm13,ymm11
+	vmovdqu	ymm12,YMMWORD[((-16+256-128))+rcx]
+	vpaddq	ymm6,ymm6,ymm13
+	vpmuludq	ymm0,ymm0,ymm11
+	vmovdqu	ymm13,YMMWORD[((-16+288-128))+rcx]
+	vpaddq	ymm7,ymm7,ymm0
+	vpmuludq	ymm12,ymm12,ymm11
+	vmovdqu	ymm0,YMMWORD[((-24+32-128))+rsi]
+	vpaddq	ymm8,ymm8,ymm12
+	vpmuludq	ymm13,ymm13,ymm11
+	vmovdqu	ymm12,YMMWORD[((-24+64-128))+rsi]
+	vpaddq	ymm9,ymm9,ymm13
+
+	add	r12,r11
+	imul	rbx,QWORD[((-128))+rsi]
+	add	r12,rbx
+
+	mov	rax,r12
+	imul	eax,r8d
+	and	eax,0x1fffffff
+
+	vpmuludq	ymm0,ymm0,ymm10
+	vmovd	xmm11,eax
+	vmovdqu	ymm13,YMMWORD[((-24+96-128))+rsi]
+	vpaddq	ymm1,ymm1,ymm0
+	vpmuludq	ymm12,ymm12,ymm10
+	vpbroadcastq	ymm11,xmm11
+	vmovdqu	ymm0,YMMWORD[((-24+128-128))+rsi]
+	vpaddq	ymm2,ymm2,ymm12
+	vpmuludq	ymm13,ymm13,ymm10
+	vmovdqu	ymm12,YMMWORD[((-24+160-128))+rsi]
+	vpaddq	ymm3,ymm3,ymm13
+	vpmuludq	ymm0,ymm0,ymm10
+	vmovdqu	ymm13,YMMWORD[((-24+192-128))+rsi]
+	vpaddq	ymm4,ymm4,ymm0
+	vpmuludq	ymm12,ymm12,ymm10
+	vmovdqu	ymm0,YMMWORD[((-24+224-128))+rsi]
+	vpaddq	ymm5,ymm5,ymm12
+	vpmuludq	ymm13,ymm13,ymm10
+	vmovdqu	ymm12,YMMWORD[((-24+256-128))+rsi]
+	vpaddq	ymm6,ymm6,ymm13
+	vpmuludq	ymm0,ymm0,ymm10
+	vmovdqu	ymm13,YMMWORD[((-24+288-128))+rsi]
+	vpaddq	ymm7,ymm7,ymm0
+	vpmuludq	ymm12,ymm12,ymm10
+	vpaddq	ymm8,ymm8,ymm12
+	vpmuludq	ymm13,ymm13,ymm10
+	vpbroadcastq	ymm10,QWORD[32+r13]
+	vpaddq	ymm9,ymm9,ymm13
+	add	r13,32
+
+	vmovdqu	ymm0,YMMWORD[((-24+32-128))+rcx]
+	imul	rax,QWORD[((-128))+rcx]
+	add	r12,rax
+	shr	r12,29
+
+	vmovdqu	ymm12,YMMWORD[((-24+64-128))+rcx]
+	vpmuludq	ymm0,ymm0,ymm11
+	vmovq	rbx,xmm10
+	vmovdqu	ymm13,YMMWORD[((-24+96-128))+rcx]
+	vpaddq	ymm0,ymm1,ymm0
+	vpmuludq	ymm12,ymm12,ymm11
+	vmovdqu	YMMWORD[rsp],ymm0
+	vpaddq	ymm1,ymm2,ymm12
+	vmovdqu	ymm0,YMMWORD[((-24+128-128))+rcx]
+	vpmuludq	ymm13,ymm13,ymm11
+	vmovdqu	ymm12,YMMWORD[((-24+160-128))+rcx]
+	vpaddq	ymm2,ymm3,ymm13
+	vpmuludq	ymm0,ymm0,ymm11
+	vmovdqu	ymm13,YMMWORD[((-24+192-128))+rcx]
+	vpaddq	ymm3,ymm4,ymm0
+	vpmuludq	ymm12,ymm12,ymm11
+	vmovdqu	ymm0,YMMWORD[((-24+224-128))+rcx]
+	vpaddq	ymm4,ymm5,ymm12
+	vpmuludq	ymm13,ymm13,ymm11
+	vmovdqu	ymm12,YMMWORD[((-24+256-128))+rcx]
+	vpaddq	ymm5,ymm6,ymm13
+	vpmuludq	ymm0,ymm0,ymm11
+	vmovdqu	ymm13,YMMWORD[((-24+288-128))+rcx]
+	mov	r9,r12
+	vpaddq	ymm6,ymm7,ymm0
+	vpmuludq	ymm12,ymm12,ymm11
+	add	r9,QWORD[rsp]
+	vpaddq	ymm7,ymm8,ymm12
+	vpmuludq	ymm13,ymm13,ymm11
+	vmovq	xmm12,r12
+	vpaddq	ymm8,ymm9,ymm13
+
+	dec	r14d
+	jnz	NEAR $L$oop_mul_1024
+	vpaddq	ymm0,ymm12,YMMWORD[rsp]
+
+	vpsrlq	ymm12,ymm0,29
+	vpand	ymm0,ymm0,ymm15
+	vpsrlq	ymm13,ymm1,29
+	vpand	ymm1,ymm1,ymm15
+	vpsrlq	ymm10,ymm2,29
+	vpermq	ymm12,ymm12,0x93
+	vpand	ymm2,ymm2,ymm15
+	vpsrlq	ymm11,ymm3,29
+	vpermq	ymm13,ymm13,0x93
+	vpand	ymm3,ymm3,ymm15
+
+	vpblendd	ymm9,ymm12,ymm14,3
+	vpermq	ymm10,ymm10,0x93
+	vpblendd	ymm12,ymm13,ymm12,3
+	vpermq	ymm11,ymm11,0x93
+	vpaddq	ymm0,ymm0,ymm9
+	vpblendd	ymm13,ymm10,ymm13,3
+	vpaddq	ymm1,ymm1,ymm12
+	vpblendd	ymm10,ymm11,ymm10,3
+	vpaddq	ymm2,ymm2,ymm13
+	vpblendd	ymm11,ymm14,ymm11,3
+	vpaddq	ymm3,ymm3,ymm10
+	vpaddq	ymm4,ymm4,ymm11
+
+	vpsrlq	ymm12,ymm0,29
+	vpand	ymm0,ymm0,ymm15
+	vpsrlq	ymm13,ymm1,29
+	vpand	ymm1,ymm1,ymm15
+	vpsrlq	ymm10,ymm2,29
+	vpermq	ymm12,ymm12,0x93
+	vpand	ymm2,ymm2,ymm15
+	vpsrlq	ymm11,ymm3,29
+	vpermq	ymm13,ymm13,0x93
+	vpand	ymm3,ymm3,ymm15
+	vpermq	ymm10,ymm10,0x93
+
+	vpblendd	ymm9,ymm12,ymm14,3
+	vpermq	ymm11,ymm11,0x93
+	vpblendd	ymm12,ymm13,ymm12,3
+	vpaddq	ymm0,ymm0,ymm9
+	vpblendd	ymm13,ymm10,ymm13,3
+	vpaddq	ymm1,ymm1,ymm12
+	vpblendd	ymm10,ymm11,ymm10,3
+	vpaddq	ymm2,ymm2,ymm13
+	vpblendd	ymm11,ymm14,ymm11,3
+	vpaddq	ymm3,ymm3,ymm10
+	vpaddq	ymm4,ymm4,ymm11
+
+	vmovdqu	YMMWORD[(0-128)+rdi],ymm0
+	vmovdqu	YMMWORD[(32-128)+rdi],ymm1
+	vmovdqu	YMMWORD[(64-128)+rdi],ymm2
+	vmovdqu	YMMWORD[(96-128)+rdi],ymm3
+	vpsrlq	ymm12,ymm4,29
+	vpand	ymm4,ymm4,ymm15
+	vpsrlq	ymm13,ymm5,29
+	vpand	ymm5,ymm5,ymm15
+	vpsrlq	ymm10,ymm6,29
+	vpermq	ymm12,ymm12,0x93
+	vpand	ymm6,ymm6,ymm15
+	vpsrlq	ymm11,ymm7,29
+	vpermq	ymm13,ymm13,0x93
+	vpand	ymm7,ymm7,ymm15
+	vpsrlq	ymm0,ymm8,29
+	vpermq	ymm10,ymm10,0x93
+	vpand	ymm8,ymm8,ymm15
+	vpermq	ymm11,ymm11,0x93
+
+	vpblendd	ymm9,ymm12,ymm14,3
+	vpermq	ymm0,ymm0,0x93
+	vpblendd	ymm12,ymm13,ymm12,3
+	vpaddq	ymm4,ymm4,ymm9
+	vpblendd	ymm13,ymm10,ymm13,3
+	vpaddq	ymm5,ymm5,ymm12
+	vpblendd	ymm10,ymm11,ymm10,3
+	vpaddq	ymm6,ymm6,ymm13
+	vpblendd	ymm11,ymm0,ymm11,3
+	vpaddq	ymm7,ymm7,ymm10
+	vpaddq	ymm8,ymm8,ymm11
+
+	vpsrlq	ymm12,ymm4,29
+	vpand	ymm4,ymm4,ymm15
+	vpsrlq	ymm13,ymm5,29
+	vpand	ymm5,ymm5,ymm15
+	vpsrlq	ymm10,ymm6,29
+	vpermq	ymm12,ymm12,0x93
+	vpand	ymm6,ymm6,ymm15
+	vpsrlq	ymm11,ymm7,29
+	vpermq	ymm13,ymm13,0x93
+	vpand	ymm7,ymm7,ymm15
+	vpsrlq	ymm0,ymm8,29
+	vpermq	ymm10,ymm10,0x93
+	vpand	ymm8,ymm8,ymm15
+	vpermq	ymm11,ymm11,0x93
+
+	vpblendd	ymm9,ymm12,ymm14,3
+	vpermq	ymm0,ymm0,0x93
+	vpblendd	ymm12,ymm13,ymm12,3
+	vpaddq	ymm4,ymm4,ymm9
+	vpblendd	ymm13,ymm10,ymm13,3
+	vpaddq	ymm5,ymm5,ymm12
+	vpblendd	ymm10,ymm11,ymm10,3
+	vpaddq	ymm6,ymm6,ymm13
+	vpblendd	ymm11,ymm0,ymm11,3
+	vpaddq	ymm7,ymm7,ymm10
+	vpaddq	ymm8,ymm8,ymm11
+
+	vmovdqu	YMMWORD[(128-128)+rdi],ymm4
+	vmovdqu	YMMWORD[(160-128)+rdi],ymm5
+	vmovdqu	YMMWORD[(192-128)+rdi],ymm6
+	vmovdqu	YMMWORD[(224-128)+rdi],ymm7
+	vmovdqu	YMMWORD[(256-128)+rdi],ymm8
+	vzeroupper
+
+	mov	rax,rbp
+
+$L$mul_1024_in_tail:
+	movaps	xmm6,XMMWORD[((-216))+rax]
+	movaps	xmm7,XMMWORD[((-200))+rax]
+	movaps	xmm8,XMMWORD[((-184))+rax]
+	movaps	xmm9,XMMWORD[((-168))+rax]
+	movaps	xmm10,XMMWORD[((-152))+rax]
+	movaps	xmm11,XMMWORD[((-136))+rax]
+	movaps	xmm12,XMMWORD[((-120))+rax]
+	movaps	xmm13,XMMWORD[((-104))+rax]
+	movaps	xmm14,XMMWORD[((-88))+rax]
+	movaps	xmm15,XMMWORD[((-72))+rax]
+	mov	r15,QWORD[((-48))+rax]
+
+	mov	r14,QWORD[((-40))+rax]
+
+	mov	r13,QWORD[((-32))+rax]
+
+	mov	r12,QWORD[((-24))+rax]
+
+	mov	rbp,QWORD[((-16))+rax]
+
+	mov	rbx,QWORD[((-8))+rax]
+
+	lea	rsp,[rax]
+
+$L$mul_1024_epilogue:
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
+	DB	0F3h,0C3h		;repret
+
+$L$SEH_end_rsaz_1024_mul_avx2:
+global	rsaz_1024_red2norm_avx2
+
+ALIGN	32
+rsaz_1024_red2norm_avx2:
+
+	sub	rdx,-128
+	xor	rax,rax
+	mov	r8,QWORD[((-128))+rdx]
+	mov	r9,QWORD[((-120))+rdx]
+	mov	r10,QWORD[((-112))+rdx]
+	shl	r8,0
+	shl	r9,29
+	mov	r11,r10
+	shl	r10,58
+	shr	r11,6
+	add	rax,r8
+	add	rax,r9
+	add	rax,r10
+	adc	r11,0
+	mov	QWORD[rcx],rax
+	mov	rax,r11
+	mov	r8,QWORD[((-104))+rdx]
+	mov	r9,QWORD[((-96))+rdx]
+	shl	r8,23
+	mov	r10,r9
+	shl	r9,52
+	shr	r10,12
+	add	rax,r8
+	add	rax,r9
+	adc	r10,0
+	mov	QWORD[8+rcx],rax
+	mov	rax,r10
+	mov	r11,QWORD[((-88))+rdx]
+	mov	r8,QWORD[((-80))+rdx]
+	shl	r11,17
+	mov	r9,r8
+	shl	r8,46
+	shr	r9,18
+	add	rax,r11
+	add	rax,r8
+	adc	r9,0
+	mov	QWORD[16+rcx],rax
+	mov	rax,r9
+	mov	r10,QWORD[((-72))+rdx]
+	mov	r11,QWORD[((-64))+rdx]
+	shl	r10,11
+	mov	r8,r11
+	shl	r11,40
+	shr	r8,24
+	add	rax,r10
+	add	rax,r11
+	adc	r8,0
+	mov	QWORD[24+rcx],rax
+	mov	rax,r8
+	mov	r9,QWORD[((-56))+rdx]
+	mov	r10,QWORD[((-48))+rdx]
+	mov	r11,QWORD[((-40))+rdx]
+	shl	r9,5
+	shl	r10,34
+	mov	r8,r11
+	shl	r11,63
+	shr	r8,1
+	add	rax,r9
+	add	rax,r10
+	add	rax,r11
+	adc	r8,0
+	mov	QWORD[32+rcx],rax
+	mov	rax,r8
+	mov	r9,QWORD[((-32))+rdx]
+	mov	r10,QWORD[((-24))+rdx]
+	shl	r9,28
+	mov	r11,r10
+	shl	r10,57
+	shr	r11,7
+	add	rax,r9
+	add	rax,r10
+	adc	r11,0
+	mov	QWORD[40+rcx],rax
+	mov	rax,r11
+	mov	r8,QWORD[((-16))+rdx]
+	mov	r9,QWORD[((-8))+rdx]
+	shl	r8,22
+	mov	r10,r9
+	shl	r9,51
+	shr	r10,13
+	add	rax,r8
+	add	rax,r9
+	adc	r10,0
+	mov	QWORD[48+rcx],rax
+	mov	rax,r10
+	mov	r11,QWORD[rdx]
+	mov	r8,QWORD[8+rdx]
+	shl	r11,16
+	mov	r9,r8
+	shl	r8,45
+	shr	r9,19
+	add	rax,r11
+	add	rax,r8
+	adc	r9,0
+	mov	QWORD[56+rcx],rax
+	mov	rax,r9
+	mov	r10,QWORD[16+rdx]
+	mov	r11,QWORD[24+rdx]
+	shl	r10,10
+	mov	r8,r11
+	shl	r11,39
+	shr	r8,25
+	add	rax,r10
+	add	rax,r11
+	adc	r8,0
+	mov	QWORD[64+rcx],rax
+	mov	rax,r8
+	mov	r9,QWORD[32+rdx]
+	mov	r10,QWORD[40+rdx]
+	mov	r11,QWORD[48+rdx]
+	shl	r9,4
+	shl	r10,33
+	mov	r8,r11
+	shl	r11,62
+	shr	r8,2
+	add	rax,r9
+	add	rax,r10
+	add	rax,r11
+	adc	r8,0
+	mov	QWORD[72+rcx],rax
+	mov	rax,r8
+	mov	r9,QWORD[56+rdx]
+	mov	r10,QWORD[64+rdx]
+	shl	r9,27
+	mov	r11,r10
+	shl	r10,56
+	shr	r11,8
+	add	rax,r9
+	add	rax,r10
+	adc	r11,0
+	mov	QWORD[80+rcx],rax
+	mov	rax,r11
+	mov	r8,QWORD[72+rdx]
+	mov	r9,QWORD[80+rdx]
+	shl	r8,21
+	mov	r10,r9
+	shl	r9,50
+	shr	r10,14
+	add	rax,r8
+	add	rax,r9
+	adc	r10,0
+	mov	QWORD[88+rcx],rax
+	mov	rax,r10
+	mov	r11,QWORD[88+rdx]
+	mov	r8,QWORD[96+rdx]
+	shl	r11,15
+	mov	r9,r8
+	shl	r8,44
+	shr	r9,20
+	add	rax,r11
+	add	rax,r8
+	adc	r9,0
+	mov	QWORD[96+rcx],rax
+	mov	rax,r9
+	mov	r10,QWORD[104+rdx]
+	mov	r11,QWORD[112+rdx]
+	shl	r10,9
+	mov	r8,r11
+	shl	r11,38
+	shr	r8,26
+	add	rax,r10
+	add	rax,r11
+	adc	r8,0
+	mov	QWORD[104+rcx],rax
+	mov	rax,r8
+	mov	r9,QWORD[120+rdx]
+	mov	r10,QWORD[128+rdx]
+	mov	r11,QWORD[136+rdx]
+	shl	r9,3
+	shl	r10,32
+	mov	r8,r11
+	shl	r11,61
+	shr	r8,3
+	add	rax,r9
+	add	rax,r10
+	add	rax,r11
+	adc	r8,0
+	mov	QWORD[112+rcx],rax
+	mov	rax,r8
+	mov	r9,QWORD[144+rdx]
+	mov	r10,QWORD[152+rdx]
+	shl	r9,26
+	mov	r11,r10
+	shl	r10,55
+	shr	r11,9
+	add	rax,r9
+	add	rax,r10
+	adc	r11,0
+	mov	QWORD[120+rcx],rax
+	mov	rax,r11
+	DB	0F3h,0C3h		;repret
+
+
+
+global	rsaz_1024_norm2red_avx2
+
+ALIGN	32
+rsaz_1024_norm2red_avx2:
+
+	sub	rcx,-128
+	mov	r8,QWORD[rdx]
+	mov	eax,0x1fffffff
+	mov	r9,QWORD[8+rdx]
+	mov	r11,r8
+	shr	r11,0
+	and	r11,rax
+	mov	QWORD[((-128))+rcx],r11
+	mov	r10,r8
+	shr	r10,29
+	and	r10,rax
+	mov	QWORD[((-120))+rcx],r10
+	shrd	r8,r9,58
+	and	r8,rax
+	mov	QWORD[((-112))+rcx],r8
+	mov	r10,QWORD[16+rdx]
+	mov	r8,r9
+	shr	r8,23
+	and	r8,rax
+	mov	QWORD[((-104))+rcx],r8
+	shrd	r9,r10,52
+	and	r9,rax
+	mov	QWORD[((-96))+rcx],r9
+	mov	r11,QWORD[24+rdx]
+	mov	r9,r10
+	shr	r9,17
+	and	r9,rax
+	mov	QWORD[((-88))+rcx],r9
+	shrd	r10,r11,46
+	and	r10,rax
+	mov	QWORD[((-80))+rcx],r10
+	mov	r8,QWORD[32+rdx]
+	mov	r10,r11
+	shr	r10,11
+	and	r10,rax
+	mov	QWORD[((-72))+rcx],r10
+	shrd	r11,r8,40
+	and	r11,rax
+	mov	QWORD[((-64))+rcx],r11
+	mov	r9,QWORD[40+rdx]
+	mov	r11,r8
+	shr	r11,5
+	and	r11,rax
+	mov	QWORD[((-56))+rcx],r11
+	mov	r10,r8
+	shr	r10,34
+	and	r10,rax
+	mov	QWORD[((-48))+rcx],r10
+	shrd	r8,r9,63
+	and	r8,rax
+	mov	QWORD[((-40))+rcx],r8
+	mov	r10,QWORD[48+rdx]
+	mov	r8,r9
+	shr	r8,28
+	and	r8,rax
+	mov	QWORD[((-32))+rcx],r8
+	shrd	r9,r10,57
+	and	r9,rax
+	mov	QWORD[((-24))+rcx],r9
+	mov	r11,QWORD[56+rdx]
+	mov	r9,r10
+	shr	r9,22
+	and	r9,rax
+	mov	QWORD[((-16))+rcx],r9
+	shrd	r10,r11,51
+	and	r10,rax
+	mov	QWORD[((-8))+rcx],r10
+	mov	r8,QWORD[64+rdx]
+	mov	r10,r11
+	shr	r10,16
+	and	r10,rax
+	mov	QWORD[rcx],r10
+	shrd	r11,r8,45
+	and	r11,rax
+	mov	QWORD[8+rcx],r11
+	mov	r9,QWORD[72+rdx]
+	mov	r11,r8
+	shr	r11,10
+	and	r11,rax
+	mov	QWORD[16+rcx],r11
+	shrd	r8,r9,39
+	and	r8,rax
+	mov	QWORD[24+rcx],r8
+	mov	r10,QWORD[80+rdx]
+	mov	r8,r9
+	shr	r8,4
+	and	r8,rax
+	mov	QWORD[32+rcx],r8
+	mov	r11,r9
+	shr	r11,33
+	and	r11,rax
+	mov	QWORD[40+rcx],r11
+	shrd	r9,r10,62
+	and	r9,rax
+	mov	QWORD[48+rcx],r9
+	mov	r11,QWORD[88+rdx]
+	mov	r9,r10
+	shr	r9,27
+	and	r9,rax
+	mov	QWORD[56+rcx],r9
+	shrd	r10,r11,56
+	and	r10,rax
+	mov	QWORD[64+rcx],r10
+	mov	r8,QWORD[96+rdx]
+	mov	r10,r11
+	shr	r10,21
+	and	r10,rax
+	mov	QWORD[72+rcx],r10
+	shrd	r11,r8,50
+	and	r11,rax
+	mov	QWORD[80+rcx],r11
+	mov	r9,QWORD[104+rdx]
+	mov	r11,r8
+	shr	r11,15
+	and	r11,rax
+	mov	QWORD[88+rcx],r11
+	shrd	r8,r9,44
+	and	r8,rax
+	mov	QWORD[96+rcx],r8
+	mov	r10,QWORD[112+rdx]
+	mov	r8,r9
+	shr	r8,9
+	and	r8,rax
+	mov	QWORD[104+rcx],r8
+	shrd	r9,r10,38
+	and	r9,rax
+	mov	QWORD[112+rcx],r9
+	mov	r11,QWORD[120+rdx]
+	mov	r9,r10
+	shr	r9,3
+	and	r9,rax
+	mov	QWORD[120+rcx],r9
+	mov	r8,r10
+	shr	r8,32
+	and	r8,rax
+	mov	QWORD[128+rcx],r8
+	shrd	r10,r11,61
+	and	r10,rax
+	mov	QWORD[136+rcx],r10
+	xor	r8,r8
+	mov	r10,r11
+	shr	r10,26
+	and	r10,rax
+	mov	QWORD[144+rcx],r10
+	shrd	r11,r8,55
+	and	r11,rax
+	mov	QWORD[152+rcx],r11
+	mov	QWORD[160+rcx],r8
+	mov	QWORD[168+rcx],r8
+	mov	QWORD[176+rcx],r8
+	mov	QWORD[184+rcx],r8
+	DB	0F3h,0C3h		;repret
+
+
+global	rsaz_1024_scatter5_avx2
+
+ALIGN	32
+rsaz_1024_scatter5_avx2:
+
+	vzeroupper
+	vmovdqu	ymm5,YMMWORD[$L$scatter_permd]
+	shl	r8d,4
+	lea	rcx,[r8*1+rcx]
+	mov	eax,9
+	jmp	NEAR $L$oop_scatter_1024
+
+ALIGN	32
+$L$oop_scatter_1024:
+	vmovdqu	ymm0,YMMWORD[rdx]
+	lea	rdx,[32+rdx]
+	vpermd	ymm0,ymm5,ymm0
+	vmovdqu	XMMWORD[rcx],xmm0
+	lea	rcx,[512+rcx]
+	dec	eax
+	jnz	NEAR $L$oop_scatter_1024
+
+	vzeroupper
+	DB	0F3h,0C3h		;repret
+
+
+
+global	rsaz_1024_gather5_avx2
+
+ALIGN	32
+rsaz_1024_gather5_avx2:
+
+	vzeroupper
+	mov	r11,rsp
+
+	lea	rax,[((-136))+rsp]
+$L$SEH_begin_rsaz_1024_gather5:
+
+DB	0x48,0x8d,0x60,0xe0
+DB	0xc5,0xf8,0x29,0x70,0xe0
+DB	0xc5,0xf8,0x29,0x78,0xf0
+DB	0xc5,0x78,0x29,0x40,0x00
+DB	0xc5,0x78,0x29,0x48,0x10
+DB	0xc5,0x78,0x29,0x50,0x20
+DB	0xc5,0x78,0x29,0x58,0x30
+DB	0xc5,0x78,0x29,0x60,0x40
+DB	0xc5,0x78,0x29,0x68,0x50
+DB	0xc5,0x78,0x29,0x70,0x60
+DB	0xc5,0x78,0x29,0x78,0x70
+	lea	rsp,[((-256))+rsp]
+	and	rsp,-32
+	lea	r10,[$L$inc]
+	lea	rax,[((-128))+rsp]
+
+	vmovd	xmm4,r8d
+	vmovdqa	ymm0,YMMWORD[r10]
+	vmovdqa	ymm1,YMMWORD[32+r10]
+	vmovdqa	ymm5,YMMWORD[64+r10]
+	vpbroadcastd	ymm4,xmm4
+
+	vpaddd	ymm2,ymm0,ymm5
+	vpcmpeqd	ymm0,ymm0,ymm4
+	vpaddd	ymm3,ymm1,ymm5
+	vpcmpeqd	ymm1,ymm1,ymm4
+	vmovdqa	YMMWORD[(0+128)+rax],ymm0
+	vpaddd	ymm0,ymm2,ymm5
+	vpcmpeqd	ymm2,ymm2,ymm4
+	vmovdqa	YMMWORD[(32+128)+rax],ymm1
+	vpaddd	ymm1,ymm3,ymm5
+	vpcmpeqd	ymm3,ymm3,ymm4
+	vmovdqa	YMMWORD[(64+128)+rax],ymm2
+	vpaddd	ymm2,ymm0,ymm5
+	vpcmpeqd	ymm0,ymm0,ymm4
+	vmovdqa	YMMWORD[(96+128)+rax],ymm3
+	vpaddd	ymm3,ymm1,ymm5
+	vpcmpeqd	ymm1,ymm1,ymm4
+	vmovdqa	YMMWORD[(128+128)+rax],ymm0
+	vpaddd	ymm8,ymm2,ymm5
+	vpcmpeqd	ymm2,ymm2,ymm4
+	vmovdqa	YMMWORD[(160+128)+rax],ymm1
+	vpaddd	ymm9,ymm3,ymm5
+	vpcmpeqd	ymm3,ymm3,ymm4
+	vmovdqa	YMMWORD[(192+128)+rax],ymm2
+	vpaddd	ymm10,ymm8,ymm5
+	vpcmpeqd	ymm8,ymm8,ymm4
+	vmovdqa	YMMWORD[(224+128)+rax],ymm3
+	vpaddd	ymm11,ymm9,ymm5
+	vpcmpeqd	ymm9,ymm9,ymm4
+	vpaddd	ymm12,ymm10,ymm5
+	vpcmpeqd	ymm10,ymm10,ymm4
+	vpaddd	ymm13,ymm11,ymm5
+	vpcmpeqd	ymm11,ymm11,ymm4
+	vpaddd	ymm14,ymm12,ymm5
+	vpcmpeqd	ymm12,ymm12,ymm4
+	vpaddd	ymm15,ymm13,ymm5
+	vpcmpeqd	ymm13,ymm13,ymm4
+	vpcmpeqd	ymm14,ymm14,ymm4
+	vpcmpeqd	ymm15,ymm15,ymm4
+
+	vmovdqa	ymm7,YMMWORD[((-32))+r10]
+	lea	rdx,[128+rdx]
+	mov	r8d,9
+
+$L$oop_gather_1024:
+	vmovdqa	ymm0,YMMWORD[((0-128))+rdx]
+	vmovdqa	ymm1,YMMWORD[((32-128))+rdx]
+	vmovdqa	ymm2,YMMWORD[((64-128))+rdx]
+	vmovdqa	ymm3,YMMWORD[((96-128))+rdx]
+	vpand	ymm0,ymm0,YMMWORD[((0+128))+rax]
+	vpand	ymm1,ymm1,YMMWORD[((32+128))+rax]
+	vpand	ymm2,ymm2,YMMWORD[((64+128))+rax]
+	vpor	ymm4,ymm1,ymm0
+	vpand	ymm3,ymm3,YMMWORD[((96+128))+rax]
+	vmovdqa	ymm0,YMMWORD[((128-128))+rdx]
+	vmovdqa	ymm1,YMMWORD[((160-128))+rdx]
+	vpor	ymm5,ymm3,ymm2
+	vmovdqa	ymm2,YMMWORD[((192-128))+rdx]
+	vmovdqa	ymm3,YMMWORD[((224-128))+rdx]
+	vpand	ymm0,ymm0,YMMWORD[((128+128))+rax]
+	vpand	ymm1,ymm1,YMMWORD[((160+128))+rax]
+	vpand	ymm2,ymm2,YMMWORD[((192+128))+rax]
+	vpor	ymm4,ymm4,ymm0
+	vpand	ymm3,ymm3,YMMWORD[((224+128))+rax]
+	vpand	ymm0,ymm8,YMMWORD[((256-128))+rdx]
+	vpor	ymm5,ymm5,ymm1
+	vpand	ymm1,ymm9,YMMWORD[((288-128))+rdx]
+	vpor	ymm4,ymm4,ymm2
+	vpand	ymm2,ymm10,YMMWORD[((320-128))+rdx]
+	vpor	ymm5,ymm5,ymm3
+	vpand	ymm3,ymm11,YMMWORD[((352-128))+rdx]
+	vpor	ymm4,ymm4,ymm0
+	vpand	ymm0,ymm12,YMMWORD[((384-128))+rdx]
+	vpor	ymm5,ymm5,ymm1
+	vpand	ymm1,ymm13,YMMWORD[((416-128))+rdx]
+	vpor	ymm4,ymm4,ymm2
+	vpand	ymm2,ymm14,YMMWORD[((448-128))+rdx]
+	vpor	ymm5,ymm5,ymm3
+	vpand	ymm3,ymm15,YMMWORD[((480-128))+rdx]
+	lea	rdx,[512+rdx]
+	vpor	ymm4,ymm4,ymm0
+	vpor	ymm5,ymm5,ymm1
+	vpor	ymm4,ymm4,ymm2
+	vpor	ymm5,ymm5,ymm3
+
+	vpor	ymm4,ymm4,ymm5
+	vextracti128	xmm5,ymm4,1
+	vpor	xmm5,xmm5,xmm4
+	vpermd	ymm5,ymm7,ymm5
+	vmovdqu	YMMWORD[rcx],ymm5
+	lea	rcx,[32+rcx]
+	dec	r8d
+	jnz	NEAR $L$oop_gather_1024
+
+	vpxor	ymm0,ymm0,ymm0
+	vmovdqu	YMMWORD[rcx],ymm0
+	vzeroupper
+	movaps	xmm6,XMMWORD[((-168))+r11]
+	movaps	xmm7,XMMWORD[((-152))+r11]
+	movaps	xmm8,XMMWORD[((-136))+r11]
+	movaps	xmm9,XMMWORD[((-120))+r11]
+	movaps	xmm10,XMMWORD[((-104))+r11]
+	movaps	xmm11,XMMWORD[((-88))+r11]
+	movaps	xmm12,XMMWORD[((-72))+r11]
+	movaps	xmm13,XMMWORD[((-56))+r11]
+	movaps	xmm14,XMMWORD[((-40))+r11]
+	movaps	xmm15,XMMWORD[((-24))+r11]
+	lea	rsp,[r11]
+
+	DB	0F3h,0C3h		;repret
+
+$L$SEH_end_rsaz_1024_gather5:
+
+EXTERN	OPENSSL_ia32cap_P
 global	rsaz_avx2_eligible
 
+ALIGN	32
 rsaz_avx2_eligible:
-	xor	eax,eax
+	mov	eax,DWORD[((OPENSSL_ia32cap_P+8))]
+	mov	ecx,524544
+	mov	edx,0
+	and	ecx,eax
+	cmp	ecx,524544
+	cmove	eax,edx
+	and	eax,32
+	shr	eax,5
 	DB	0F3h,0C3h		;repret
 
 
-global	rsaz_1024_sqr_avx2
-global	rsaz_1024_mul_avx2
-global	rsaz_1024_norm2red_avx2
-global	rsaz_1024_red2norm_avx2
-global	rsaz_1024_scatter5_avx2
-global	rsaz_1024_gather5_avx2
-
-rsaz_1024_sqr_avx2:
-rsaz_1024_mul_avx2:
-rsaz_1024_norm2red_avx2:
-rsaz_1024_red2norm_avx2:
-rsaz_1024_scatter5_avx2:
-rsaz_1024_gather5_avx2:
-DB	0x0f,0x0b
+ALIGN	64
+$L$and_mask:
+	DQ	0x1fffffff,0x1fffffff,0x1fffffff,0x1fffffff
+$L$scatter_permd:
+	DD	0,2,4,6,7,7,7,7
+$L$gather_permd:
+	DD	0,7,1,7,2,7,3,7
+$L$inc:
+	DD	0,0,0,0,1,1,1,1
+	DD	2,2,2,2,3,3,3,3
+	DD	4,4,4,4,4,4,4,4
+ALIGN	64
+EXTERN	__imp_RtlVirtualUnwind
+
+ALIGN	16
+rsaz_se_handler:
+	push	rsi
+	push	rdi
+	push	rbx
+	push	rbp
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	pushfq
+	sub	rsp,64
+
+	mov	rax,QWORD[120+r8]
+	mov	rbx,QWORD[248+r8]
+
+	mov	rsi,QWORD[8+r9]
+	mov	r11,QWORD[56+r9]
+
+	mov	r10d,DWORD[r11]
+	lea	r10,[r10*1+rsi]
+	cmp	rbx,r10
+	jb	NEAR $L$common_seh_tail
+
+	mov	r10d,DWORD[4+r11]
+	lea	r10,[r10*1+rsi]
+	cmp	rbx,r10
+	jae	NEAR $L$common_seh_tail
+
+	mov	rbp,QWORD[160+r8]
+
+	mov	r10d,DWORD[8+r11]
+	lea	r10,[r10*1+rsi]
+	cmp	rbx,r10
+	cmovc	rax,rbp
+
+	mov	r15,QWORD[((-48))+rax]
+	mov	r14,QWORD[((-40))+rax]
+	mov	r13,QWORD[((-32))+rax]
+	mov	r12,QWORD[((-24))+rax]
+	mov	rbp,QWORD[((-16))+rax]
+	mov	rbx,QWORD[((-8))+rax]
+	mov	QWORD[240+r8],r15
+	mov	QWORD[232+r8],r14
+	mov	QWORD[224+r8],r13
+	mov	QWORD[216+r8],r12
+	mov	QWORD[160+r8],rbp
+	mov	QWORD[144+r8],rbx
+
+	lea	rsi,[((-216))+rax]
+	lea	rdi,[512+r8]
+	mov	ecx,20
+	DD	0xa548f3fc
+
+$L$common_seh_tail:
+	mov	rdi,QWORD[8+rax]
+	mov	rsi,QWORD[16+rax]
+	mov	QWORD[152+r8],rax
+	mov	QWORD[168+r8],rsi
+	mov	QWORD[176+r8],rdi
+
+	mov	rdi,QWORD[40+r9]
+	mov	rsi,r8
+	mov	ecx,154
+	DD	0xa548f3fc
+
+	mov	rsi,r9
+	xor	rcx,rcx
+	mov	rdx,QWORD[8+rsi]
+	mov	r8,QWORD[rsi]
+	mov	r9,QWORD[16+rsi]
+	mov	r10,QWORD[40+rsi]
+	lea	r11,[56+rsi]
+	lea	r12,[24+rsi]
+	mov	QWORD[32+rsp],r10
+	mov	QWORD[40+rsp],r11
+	mov	QWORD[48+rsp],r12
+	mov	QWORD[56+rsp],rcx
+	call	QWORD[__imp_RtlVirtualUnwind]
+
+	mov	eax,1
+	add	rsp,64
+	popfq
+	pop	r15
+	pop	r14
+	pop	r13
+	pop	r12
+	pop	rbp
+	pop	rbx
+	pop	rdi
+	pop	rsi
 	DB	0F3h,0C3h		;repret
 
+
+section	.pdata rdata align=4
+ALIGN	4
+	DD	$L$SEH_begin_rsaz_1024_sqr_avx2 wrt ..imagebase
+	DD	$L$SEH_end_rsaz_1024_sqr_avx2 wrt ..imagebase
+	DD	$L$SEH_info_rsaz_1024_sqr_avx2 wrt ..imagebase
+
+	DD	$L$SEH_begin_rsaz_1024_mul_avx2 wrt ..imagebase
+	DD	$L$SEH_end_rsaz_1024_mul_avx2 wrt ..imagebase
+	DD	$L$SEH_info_rsaz_1024_mul_avx2 wrt ..imagebase
+
+	DD	$L$SEH_begin_rsaz_1024_gather5 wrt ..imagebase
+	DD	$L$SEH_end_rsaz_1024_gather5 wrt ..imagebase
+	DD	$L$SEH_info_rsaz_1024_gather5 wrt ..imagebase
+section	.xdata rdata align=8
+ALIGN	8
+$L$SEH_info_rsaz_1024_sqr_avx2:
+DB	9,0,0,0
+	DD	rsaz_se_handler wrt ..imagebase
+	DD	$L$sqr_1024_body wrt ..imagebase,$L$sqr_1024_epilogue wrt ..imagebase,$L$sqr_1024_in_tail wrt ..imagebase
+	DD	0
+$L$SEH_info_rsaz_1024_mul_avx2:
+DB	9,0,0,0
+	DD	rsaz_se_handler wrt ..imagebase
+	DD	$L$mul_1024_body wrt ..imagebase,$L$mul_1024_epilogue wrt ..imagebase,$L$mul_1024_in_tail wrt ..imagebase
+	DD	0
+$L$SEH_info_rsaz_1024_gather5:
+DB	0x01,0x36,0x17,0x0b
+DB	0x36,0xf8,0x09,0x00
+DB	0x31,0xe8,0x08,0x00
+DB	0x2c,0xd8,0x07,0x00
+DB	0x27,0xc8,0x06,0x00
+DB	0x22,0xb8,0x05,0x00
+DB	0x1d,0xa8,0x04,0x00
+DB	0x18,0x98,0x03,0x00
+DB	0x13,0x88,0x02,0x00
+DB	0x0e,0x78,0x01,0x00
+DB	0x09,0x68,0x00,0x00
+DB	0x04,0x01,0x15,0x00
+DB	0x00,0xb3,0x00,0x00
Index: /trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/rsaz-avx512.S
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/rsaz-avx512.S	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/rsaz-avx512.S	(revision 95219)
@@ -3,22 +3,1029 @@
 %define YMMWORD
 %define ZMMWORD
+EXTERN	OPENSSL_ia32cap_P
+global	ossl_rsaz_avx512ifma_eligible
+
+ALIGN	32
+ossl_rsaz_avx512ifma_eligible:
+	mov	ecx,DWORD[((OPENSSL_ia32cap_P+8))]
+	xor	eax,eax
+	and	ecx,2149777408
+	cmp	ecx,2149777408
+	cmove	eax,ecx
+	DB	0F3h,0C3h		;repret
+
 section	.text code align=64
 
 
-global	ossl_rsaz_avx512ifma_eligible
-
-ossl_rsaz_avx512ifma_eligible:
-	xor	eax,eax
+global	ossl_rsaz_amm52x20_x1_256
+
+ALIGN	32
+ossl_rsaz_amm52x20_x1_256:
+	mov	QWORD[8+rsp],rdi	;WIN64 prologue
+	mov	QWORD[16+rsp],rsi
+	mov	rax,rsp
+$L$SEH_begin_ossl_rsaz_amm52x20_x1_256:
+	mov	rdi,rcx
+	mov	rsi,rdx
+	mov	rdx,r8
+	mov	rcx,r9
+	mov	r8,QWORD[40+rsp]
+
+
+
+DB	243,15,30,250
+	push	rbx
+
+	push	rbp
+
+	push	r12
+
+	push	r13
+
+	push	r14
+
+	push	r15
+
+$L$rsaz_amm52x20_x1_256_body:
+
+
+	vpxord	ymm0,ymm0,ymm0
+	vmovdqa64	ymm1,ymm0
+	vmovdqa64	ymm16,ymm0
+	vmovdqa64	ymm17,ymm0
+	vmovdqa64	ymm18,ymm0
+	vmovdqa64	ymm19,ymm0
+
+	xor	r9d,r9d
+
+	mov	r11,rdx
+	mov	rax,0xfffffffffffff
+
+
+	mov	ebx,5
+
+ALIGN	32
+$L$loop5:
+	mov	r13,QWORD[r11]
+
+	vpbroadcastq	ymm3,r13
+	mov	rdx,QWORD[rsi]
+	mulx	r12,r13,r13
+	add	r9,r13
+	mov	r10,r12
+	adc	r10,0
+
+	mov	r13,r8
+	imul	r13,r9
+	and	r13,rax
+
+	vpbroadcastq	ymm4,r13
+	mov	rdx,QWORD[rcx]
+	mulx	r12,r13,r13
+	add	r9,r13
+	adc	r10,r12
+
+	shr	r9,52
+	sal	r10,12
+	or	r9,r10
+
+	vpmadd52luq	ymm1,ymm3,YMMWORD[rsi]
+	vpmadd52luq	ymm16,ymm3,YMMWORD[32+rsi]
+	vpmadd52luq	ymm17,ymm3,YMMWORD[64+rsi]
+	vpmadd52luq	ymm18,ymm3,YMMWORD[96+rsi]
+	vpmadd52luq	ymm19,ymm3,YMMWORD[128+rsi]
+
+	vpmadd52luq	ymm1,ymm4,YMMWORD[rcx]
+	vpmadd52luq	ymm16,ymm4,YMMWORD[32+rcx]
+	vpmadd52luq	ymm17,ymm4,YMMWORD[64+rcx]
+	vpmadd52luq	ymm18,ymm4,YMMWORD[96+rcx]
+	vpmadd52luq	ymm19,ymm4,YMMWORD[128+rcx]
+
+
+	valignq	ymm1,ymm16,ymm1,1
+	valignq	ymm16,ymm17,ymm16,1
+	valignq	ymm17,ymm18,ymm17,1
+	valignq	ymm18,ymm19,ymm18,1
+	valignq	ymm19,ymm0,ymm19,1
+
+	vmovq	r13,xmm1
+	add	r9,r13
+
+	vpmadd52huq	ymm1,ymm3,YMMWORD[rsi]
+	vpmadd52huq	ymm16,ymm3,YMMWORD[32+rsi]
+	vpmadd52huq	ymm17,ymm3,YMMWORD[64+rsi]
+	vpmadd52huq	ymm18,ymm3,YMMWORD[96+rsi]
+	vpmadd52huq	ymm19,ymm3,YMMWORD[128+rsi]
+
+	vpmadd52huq	ymm1,ymm4,YMMWORD[rcx]
+	vpmadd52huq	ymm16,ymm4,YMMWORD[32+rcx]
+	vpmadd52huq	ymm17,ymm4,YMMWORD[64+rcx]
+	vpmadd52huq	ymm18,ymm4,YMMWORD[96+rcx]
+	vpmadd52huq	ymm19,ymm4,YMMWORD[128+rcx]
+	mov	r13,QWORD[8+r11]
+
+	vpbroadcastq	ymm3,r13
+	mov	rdx,QWORD[rsi]
+	mulx	r12,r13,r13
+	add	r9,r13
+	mov	r10,r12
+	adc	r10,0
+
+	mov	r13,r8
+	imul	r13,r9
+	and	r13,rax
+
+	vpbroadcastq	ymm4,r13
+	mov	rdx,QWORD[rcx]
+	mulx	r12,r13,r13
+	add	r9,r13
+	adc	r10,r12
+
+	shr	r9,52
+	sal	r10,12
+	or	r9,r10
+
+	vpmadd52luq	ymm1,ymm3,YMMWORD[rsi]
+	vpmadd52luq	ymm16,ymm3,YMMWORD[32+rsi]
+	vpmadd52luq	ymm17,ymm3,YMMWORD[64+rsi]
+	vpmadd52luq	ymm18,ymm3,YMMWORD[96+rsi]
+	vpmadd52luq	ymm19,ymm3,YMMWORD[128+rsi]
+
+	vpmadd52luq	ymm1,ymm4,YMMWORD[rcx]
+	vpmadd52luq	ymm16,ymm4,YMMWORD[32+rcx]
+	vpmadd52luq	ymm17,ymm4,YMMWORD[64+rcx]
+	vpmadd52luq	ymm18,ymm4,YMMWORD[96+rcx]
+	vpmadd52luq	ymm19,ymm4,YMMWORD[128+rcx]
+
+
+	valignq	ymm1,ymm16,ymm1,1
+	valignq	ymm16,ymm17,ymm16,1
+	valignq	ymm17,ymm18,ymm17,1
+	valignq	ymm18,ymm19,ymm18,1
+	valignq	ymm19,ymm0,ymm19,1
+
+	vmovq	r13,xmm1
+	add	r9,r13
+
+	vpmadd52huq	ymm1,ymm3,YMMWORD[rsi]
+	vpmadd52huq	ymm16,ymm3,YMMWORD[32+rsi]
+	vpmadd52huq	ymm17,ymm3,YMMWORD[64+rsi]
+	vpmadd52huq	ymm18,ymm3,YMMWORD[96+rsi]
+	vpmadd52huq	ymm19,ymm3,YMMWORD[128+rsi]
+
+	vpmadd52huq	ymm1,ymm4,YMMWORD[rcx]
+	vpmadd52huq	ymm16,ymm4,YMMWORD[32+rcx]
+	vpmadd52huq	ymm17,ymm4,YMMWORD[64+rcx]
+	vpmadd52huq	ymm18,ymm4,YMMWORD[96+rcx]
+	vpmadd52huq	ymm19,ymm4,YMMWORD[128+rcx]
+	mov	r13,QWORD[16+r11]
+
+	vpbroadcastq	ymm3,r13
+	mov	rdx,QWORD[rsi]
+	mulx	r12,r13,r13
+	add	r9,r13
+	mov	r10,r12
+	adc	r10,0
+
+	mov	r13,r8
+	imul	r13,r9
+	and	r13,rax
+
+	vpbroadcastq	ymm4,r13
+	mov	rdx,QWORD[rcx]
+	mulx	r12,r13,r13
+	add	r9,r13
+	adc	r10,r12
+
+	shr	r9,52
+	sal	r10,12
+	or	r9,r10
+
+	vpmadd52luq	ymm1,ymm3,YMMWORD[rsi]
+	vpmadd52luq	ymm16,ymm3,YMMWORD[32+rsi]
+	vpmadd52luq	ymm17,ymm3,YMMWORD[64+rsi]
+	vpmadd52luq	ymm18,ymm3,YMMWORD[96+rsi]
+	vpmadd52luq	ymm19,ymm3,YMMWORD[128+rsi]
+
+	vpmadd52luq	ymm1,ymm4,YMMWORD[rcx]
+	vpmadd52luq	ymm16,ymm4,YMMWORD[32+rcx]
+	vpmadd52luq	ymm17,ymm4,YMMWORD[64+rcx]
+	vpmadd52luq	ymm18,ymm4,YMMWORD[96+rcx]
+	vpmadd52luq	ymm19,ymm4,YMMWORD[128+rcx]
+
+
+	valignq	ymm1,ymm16,ymm1,1
+	valignq	ymm16,ymm17,ymm16,1
+	valignq	ymm17,ymm18,ymm17,1
+	valignq	ymm18,ymm19,ymm18,1
+	valignq	ymm19,ymm0,ymm19,1
+
+	vmovq	r13,xmm1
+	add	r9,r13
+
+	vpmadd52huq	ymm1,ymm3,YMMWORD[rsi]
+	vpmadd52huq	ymm16,ymm3,YMMWORD[32+rsi]
+	vpmadd52huq	ymm17,ymm3,YMMWORD[64+rsi]
+	vpmadd52huq	ymm18,ymm3,YMMWORD[96+rsi]
+	vpmadd52huq	ymm19,ymm3,YMMWORD[128+rsi]
+
+	vpmadd52huq	ymm1,ymm4,YMMWORD[rcx]
+	vpmadd52huq	ymm16,ymm4,YMMWORD[32+rcx]
+	vpmadd52huq	ymm17,ymm4,YMMWORD[64+rcx]
+	vpmadd52huq	ymm18,ymm4,YMMWORD[96+rcx]
+	vpmadd52huq	ymm19,ymm4,YMMWORD[128+rcx]
+	mov	r13,QWORD[24+r11]
+
+	vpbroadcastq	ymm3,r13
+	mov	rdx,QWORD[rsi]
+	mulx	r12,r13,r13
+	add	r9,r13
+	mov	r10,r12
+	adc	r10,0
+
+	mov	r13,r8
+	imul	r13,r9
+	and	r13,rax
+
+	vpbroadcastq	ymm4,r13
+	mov	rdx,QWORD[rcx]
+	mulx	r12,r13,r13
+	add	r9,r13
+	adc	r10,r12
+
+	shr	r9,52
+	sal	r10,12
+	or	r9,r10
+
+	vpmadd52luq	ymm1,ymm3,YMMWORD[rsi]
+	vpmadd52luq	ymm16,ymm3,YMMWORD[32+rsi]
+	vpmadd52luq	ymm17,ymm3,YMMWORD[64+rsi]
+	vpmadd52luq	ymm18,ymm3,YMMWORD[96+rsi]
+	vpmadd52luq	ymm19,ymm3,YMMWORD[128+rsi]
+
+	vpmadd52luq	ymm1,ymm4,YMMWORD[rcx]
+	vpmadd52luq	ymm16,ymm4,YMMWORD[32+rcx]
+	vpmadd52luq	ymm17,ymm4,YMMWORD[64+rcx]
+	vpmadd52luq	ymm18,ymm4,YMMWORD[96+rcx]
+	vpmadd52luq	ymm19,ymm4,YMMWORD[128+rcx]
+
+
+	valignq	ymm1,ymm16,ymm1,1
+	valignq	ymm16,ymm17,ymm16,1
+	valignq	ymm17,ymm18,ymm17,1
+	valignq	ymm18,ymm19,ymm18,1
+	valignq	ymm19,ymm0,ymm19,1
+
+	vmovq	r13,xmm1
+	add	r9,r13
+
+	vpmadd52huq	ymm1,ymm3,YMMWORD[rsi]
+	vpmadd52huq	ymm16,ymm3,YMMWORD[32+rsi]
+	vpmadd52huq	ymm17,ymm3,YMMWORD[64+rsi]
+	vpmadd52huq	ymm18,ymm3,YMMWORD[96+rsi]
+	vpmadd52huq	ymm19,ymm3,YMMWORD[128+rsi]
+
+	vpmadd52huq	ymm1,ymm4,YMMWORD[rcx]
+	vpmadd52huq	ymm16,ymm4,YMMWORD[32+rcx]
+	vpmadd52huq	ymm17,ymm4,YMMWORD[64+rcx]
+	vpmadd52huq	ymm18,ymm4,YMMWORD[96+rcx]
+	vpmadd52huq	ymm19,ymm4,YMMWORD[128+rcx]
+	lea	r11,[32+r11]
+	dec	ebx
+	jne	NEAR $L$loop5
+
+	vmovdqa64	ymm4,YMMWORD[$L$mask52x4]
+
+	vpbroadcastq	ymm3,r9
+	vpblendd	ymm1,ymm1,ymm3,3
+
+
+
+	vpsrlq	ymm24,ymm1,52
+	vpsrlq	ymm25,ymm16,52
+	vpsrlq	ymm26,ymm17,52
+	vpsrlq	ymm27,ymm18,52
+	vpsrlq	ymm28,ymm19,52
+
+
+	valignq	ymm28,ymm28,ymm27,3
+	valignq	ymm27,ymm27,ymm26,3
+	valignq	ymm26,ymm26,ymm25,3
+	valignq	ymm25,ymm25,ymm24,3
+	valignq	ymm24,ymm24,ymm0,3
+
+
+	vpandq	ymm1,ymm1,ymm4
+	vpandq	ymm16,ymm16,ymm4
+	vpandq	ymm17,ymm17,ymm4
+	vpandq	ymm18,ymm18,ymm4
+	vpandq	ymm19,ymm19,ymm4
+
+
+	vpaddq	ymm1,ymm1,ymm24
+	vpaddq	ymm16,ymm16,ymm25
+	vpaddq	ymm17,ymm17,ymm26
+	vpaddq	ymm18,ymm18,ymm27
+	vpaddq	ymm19,ymm19,ymm28
+
+
+
+	vpcmpuq	k1,ymm4,ymm1,1
+	vpcmpuq	k2,ymm4,ymm16,1
+	vpcmpuq	k3,ymm4,ymm17,1
+	vpcmpuq	k4,ymm4,ymm18,1
+	vpcmpuq	k5,ymm4,ymm19,1
+	kmovb	r14d,k1
+	kmovb	r13d,k2
+	kmovb	r12d,k3
+	kmovb	r11d,k4
+	kmovb	r10d,k5
+
+
+	vpcmpuq	k1,ymm4,ymm1,0
+	vpcmpuq	k2,ymm4,ymm16,0
+	vpcmpuq	k3,ymm4,ymm17,0
+	vpcmpuq	k4,ymm4,ymm18,0
+	vpcmpuq	k5,ymm4,ymm19,0
+	kmovb	r9d,k1
+	kmovb	r8d,k2
+	kmovb	ebx,k3
+	kmovb	ecx,k4
+	kmovb	edx,k5
+
+
+
+	shl	r13b,4
+	or	r14b,r13b
+	shl	r11b,4
+	or	r12b,r11b
+
+	add	r14b,r14b
+	adc	r12b,r12b
+	adc	r10b,r10b
+
+	shl	r8b,4
+	or	r9b,r8b
+	shl	cl,4
+	or	bl,cl
+
+	add	r14b,r9b
+	adc	r12b,bl
+	adc	r10b,dl
+
+	xor	r14b,r9b
+	xor	r12b,bl
+	xor	r10b,dl
+
+	kmovb	k1,r14d
+	shr	r14b,4
+	kmovb	k2,r14d
+	kmovb	k3,r12d
+	shr	r12b,4
+	kmovb	k4,r12d
+	kmovb	k5,r10d
+
+
+	vpsubq	ymm1{k1},ymm1,ymm4
+	vpsubq	ymm16{k2},ymm16,ymm4
+	vpsubq	ymm17{k3},ymm17,ymm4
+	vpsubq	ymm18{k4},ymm18,ymm4
+	vpsubq	ymm19{k5},ymm19,ymm4
+
+	vpandq	ymm1,ymm1,ymm4
+	vpandq	ymm16,ymm16,ymm4
+	vpandq	ymm17,ymm17,ymm4
+	vpandq	ymm18,ymm18,ymm4
+	vpandq	ymm19,ymm19,ymm4
+
+	vmovdqu64	YMMWORD[rdi],ymm1
+	vmovdqu64	YMMWORD[32+rdi],ymm16
+	vmovdqu64	YMMWORD[64+rdi],ymm17
+	vmovdqu64	YMMWORD[96+rdi],ymm18
+	vmovdqu64	YMMWORD[128+rdi],ymm19
+
+	vzeroupper
+	mov	r15,QWORD[rsp]
+
+	mov	r14,QWORD[8+rsp]
+
+	mov	r13,QWORD[16+rsp]
+
+	mov	r12,QWORD[24+rsp]
+
+	mov	rbp,QWORD[32+rsp]
+
+	mov	rbx,QWORD[40+rsp]
+
+	lea	rsp,[48+rsp]
+
+$L$rsaz_amm52x20_x1_256_epilogue:
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
 	DB	0F3h,0C3h		;repret
 
-
-global	ossl_rsaz_amm52x20_x1_256
+$L$SEH_end_ossl_rsaz_amm52x20_x1_256:
+section	.data data align=8
+
+ALIGN	32
+$L$mask52x4:
+	DQ	0xfffffffffffff
+	DQ	0xfffffffffffff
+	DQ	0xfffffffffffff
+	DQ	0xfffffffffffff
+section	.text code align=64
+
+
 global	ossl_rsaz_amm52x20_x2_256
+
+ALIGN	32
+ossl_rsaz_amm52x20_x2_256:
+	mov	QWORD[8+rsp],rdi	;WIN64 prologue
+	mov	QWORD[16+rsp],rsi
+	mov	rax,rsp
+$L$SEH_begin_ossl_rsaz_amm52x20_x2_256:
+	mov	rdi,rcx
+	mov	rsi,rdx
+	mov	rdx,r8
+	mov	rcx,r9
+	mov	r8,QWORD[40+rsp]
+
+
+
+DB	243,15,30,250
+	push	rbx
+
+	push	rbp
+
+	push	r12
+
+	push	r13
+
+	push	r14
+
+	push	r15
+
+$L$rsaz_amm52x20_x2_256_body:
+
+
+	vpxord	ymm0,ymm0,ymm0
+	vmovdqa64	ymm1,ymm0
+	vmovdqa64	ymm16,ymm0
+	vmovdqa64	ymm17,ymm0
+	vmovdqa64	ymm18,ymm0
+	vmovdqa64	ymm19,ymm0
+	vmovdqa64	ymm2,ymm0
+	vmovdqa64	ymm20,ymm0
+	vmovdqa64	ymm21,ymm0
+	vmovdqa64	ymm22,ymm0
+	vmovdqa64	ymm23,ymm0
+
+	xor	r9d,r9d
+	xor	r15d,r15d
+
+	mov	r11,rdx
+	mov	rax,0xfffffffffffff
+
+	mov	ebx,20
+
+ALIGN	32
+$L$loop20:
+	mov	r13,QWORD[r11]
+
+	vpbroadcastq	ymm3,r13
+	mov	rdx,QWORD[rsi]
+	mulx	r12,r13,r13
+	add	r9,r13
+	mov	r10,r12
+	adc	r10,0
+
+	mov	r13,QWORD[r8]
+	imul	r13,r9
+	and	r13,rax
+
+	vpbroadcastq	ymm4,r13
+	mov	rdx,QWORD[rcx]
+	mulx	r12,r13,r13
+	add	r9,r13
+	adc	r10,r12
+
+	shr	r9,52
+	sal	r10,12
+	or	r9,r10
+
+	vpmadd52luq	ymm1,ymm3,YMMWORD[rsi]
+	vpmadd52luq	ymm16,ymm3,YMMWORD[32+rsi]
+	vpmadd52luq	ymm17,ymm3,YMMWORD[64+rsi]
+	vpmadd52luq	ymm18,ymm3,YMMWORD[96+rsi]
+	vpmadd52luq	ymm19,ymm3,YMMWORD[128+rsi]
+
+	vpmadd52luq	ymm1,ymm4,YMMWORD[rcx]
+	vpmadd52luq	ymm16,ymm4,YMMWORD[32+rcx]
+	vpmadd52luq	ymm17,ymm4,YMMWORD[64+rcx]
+	vpmadd52luq	ymm18,ymm4,YMMWORD[96+rcx]
+	vpmadd52luq	ymm19,ymm4,YMMWORD[128+rcx]
+
+
+	valignq	ymm1,ymm16,ymm1,1
+	valignq	ymm16,ymm17,ymm16,1
+	valignq	ymm17,ymm18,ymm17,1
+	valignq	ymm18,ymm19,ymm18,1
+	valignq	ymm19,ymm0,ymm19,1
+
+	vmovq	r13,xmm1
+	add	r9,r13
+
+	vpmadd52huq	ymm1,ymm3,YMMWORD[rsi]
+	vpmadd52huq	ymm16,ymm3,YMMWORD[32+rsi]
+	vpmadd52huq	ymm17,ymm3,YMMWORD[64+rsi]
+	vpmadd52huq	ymm18,ymm3,YMMWORD[96+rsi]
+	vpmadd52huq	ymm19,ymm3,YMMWORD[128+rsi]
+
+	vpmadd52huq	ymm1,ymm4,YMMWORD[rcx]
+	vpmadd52huq	ymm16,ymm4,YMMWORD[32+rcx]
+	vpmadd52huq	ymm17,ymm4,YMMWORD[64+rcx]
+	vpmadd52huq	ymm18,ymm4,YMMWORD[96+rcx]
+	vpmadd52huq	ymm19,ymm4,YMMWORD[128+rcx]
+	mov	r13,QWORD[160+r11]
+
+	vpbroadcastq	ymm3,r13
+	mov	rdx,QWORD[160+rsi]
+	mulx	r12,r13,r13
+	add	r15,r13
+	mov	r10,r12
+	adc	r10,0
+
+	mov	r13,QWORD[8+r8]
+	imul	r13,r15
+	and	r13,rax
+
+	vpbroadcastq	ymm4,r13
+	mov	rdx,QWORD[160+rcx]
+	mulx	r12,r13,r13
+	add	r15,r13
+	adc	r10,r12
+
+	shr	r15,52
+	sal	r10,12
+	or	r15,r10
+
+	vpmadd52luq	ymm2,ymm3,YMMWORD[160+rsi]
+	vpmadd52luq	ymm20,ymm3,YMMWORD[192+rsi]
+	vpmadd52luq	ymm21,ymm3,YMMWORD[224+rsi]
+	vpmadd52luq	ymm22,ymm3,YMMWORD[256+rsi]
+	vpmadd52luq	ymm23,ymm3,YMMWORD[288+rsi]
+
+	vpmadd52luq	ymm2,ymm4,YMMWORD[160+rcx]
+	vpmadd52luq	ymm20,ymm4,YMMWORD[192+rcx]
+	vpmadd52luq	ymm21,ymm4,YMMWORD[224+rcx]
+	vpmadd52luq	ymm22,ymm4,YMMWORD[256+rcx]
+	vpmadd52luq	ymm23,ymm4,YMMWORD[288+rcx]
+
+
+	valignq	ymm2,ymm20,ymm2,1
+	valignq	ymm20,ymm21,ymm20,1
+	valignq	ymm21,ymm22,ymm21,1
+	valignq	ymm22,ymm23,ymm22,1
+	valignq	ymm23,ymm0,ymm23,1
+
+	vmovq	r13,xmm2
+	add	r15,r13
+
+	vpmadd52huq	ymm2,ymm3,YMMWORD[160+rsi]
+	vpmadd52huq	ymm20,ymm3,YMMWORD[192+rsi]
+	vpmadd52huq	ymm21,ymm3,YMMWORD[224+rsi]
+	vpmadd52huq	ymm22,ymm3,YMMWORD[256+rsi]
+	vpmadd52huq	ymm23,ymm3,YMMWORD[288+rsi]
+
+	vpmadd52huq	ymm2,ymm4,YMMWORD[160+rcx]
+	vpmadd52huq	ymm20,ymm4,YMMWORD[192+rcx]
+	vpmadd52huq	ymm21,ymm4,YMMWORD[224+rcx]
+	vpmadd52huq	ymm22,ymm4,YMMWORD[256+rcx]
+	vpmadd52huq	ymm23,ymm4,YMMWORD[288+rcx]
+	lea	r11,[8+r11]
+	dec	ebx
+	jne	NEAR $L$loop20
+
+	vmovdqa64	ymm4,YMMWORD[$L$mask52x4]
+
+	vpbroadcastq	ymm3,r9
+	vpblendd	ymm1,ymm1,ymm3,3
+
+
+
+	vpsrlq	ymm24,ymm1,52
+	vpsrlq	ymm25,ymm16,52
+	vpsrlq	ymm26,ymm17,52
+	vpsrlq	ymm27,ymm18,52
+	vpsrlq	ymm28,ymm19,52
+
+
+	valignq	ymm28,ymm28,ymm27,3
+	valignq	ymm27,ymm27,ymm26,3
+	valignq	ymm26,ymm26,ymm25,3
+	valignq	ymm25,ymm25,ymm24,3
+	valignq	ymm24,ymm24,ymm0,3
+
+
+	vpandq	ymm1,ymm1,ymm4
+	vpandq	ymm16,ymm16,ymm4
+	vpandq	ymm17,ymm17,ymm4
+	vpandq	ymm18,ymm18,ymm4
+	vpandq	ymm19,ymm19,ymm4
+
+
+	vpaddq	ymm1,ymm1,ymm24
+	vpaddq	ymm16,ymm16,ymm25
+	vpaddq	ymm17,ymm17,ymm26
+	vpaddq	ymm18,ymm18,ymm27
+	vpaddq	ymm19,ymm19,ymm28
+
+
+
+	vpcmpuq	k1,ymm4,ymm1,1
+	vpcmpuq	k2,ymm4,ymm16,1
+	vpcmpuq	k3,ymm4,ymm17,1
+	vpcmpuq	k4,ymm4,ymm18,1
+	vpcmpuq	k5,ymm4,ymm19,1
+	kmovb	r14d,k1
+	kmovb	r13d,k2
+	kmovb	r12d,k3
+	kmovb	r11d,k4
+	kmovb	r10d,k5
+
+
+	vpcmpuq	k1,ymm4,ymm1,0
+	vpcmpuq	k2,ymm4,ymm16,0
+	vpcmpuq	k3,ymm4,ymm17,0
+	vpcmpuq	k4,ymm4,ymm18,0
+	vpcmpuq	k5,ymm4,ymm19,0
+	kmovb	r9d,k1
+	kmovb	r8d,k2
+	kmovb	ebx,k3
+	kmovb	ecx,k4
+	kmovb	edx,k5
+
+
+
+	shl	r13b,4
+	or	r14b,r13b
+	shl	r11b,4
+	or	r12b,r11b
+
+	add	r14b,r14b
+	adc	r12b,r12b
+	adc	r10b,r10b
+
+	shl	r8b,4
+	or	r9b,r8b
+	shl	cl,4
+	or	bl,cl
+
+	add	r14b,r9b
+	adc	r12b,bl
+	adc	r10b,dl
+
+	xor	r14b,r9b
+	xor	r12b,bl
+	xor	r10b,dl
+
+	kmovb	k1,r14d
+	shr	r14b,4
+	kmovb	k2,r14d
+	kmovb	k3,r12d
+	shr	r12b,4
+	kmovb	k4,r12d
+	kmovb	k5,r10d
+
+
+	vpsubq	ymm1{k1},ymm1,ymm4
+	vpsubq	ymm16{k2},ymm16,ymm4
+	vpsubq	ymm17{k3},ymm17,ymm4
+	vpsubq	ymm18{k4},ymm18,ymm4
+	vpsubq	ymm19{k5},ymm19,ymm4
+
+	vpandq	ymm1,ymm1,ymm4
+	vpandq	ymm16,ymm16,ymm4
+	vpandq	ymm17,ymm17,ymm4
+	vpandq	ymm18,ymm18,ymm4
+	vpandq	ymm19,ymm19,ymm4
+
+	vpbroadcastq	ymm3,r15
+	vpblendd	ymm2,ymm2,ymm3,3
+
+
+
+	vpsrlq	ymm24,ymm2,52
+	vpsrlq	ymm25,ymm20,52
+	vpsrlq	ymm26,ymm21,52
+	vpsrlq	ymm27,ymm22,52
+	vpsrlq	ymm28,ymm23,52
+
+
+	valignq	ymm28,ymm28,ymm27,3
+	valignq	ymm27,ymm27,ymm26,3
+	valignq	ymm26,ymm26,ymm25,3
+	valignq	ymm25,ymm25,ymm24,3
+	valignq	ymm24,ymm24,ymm0,3
+
+
+	vpandq	ymm2,ymm2,ymm4
+	vpandq	ymm20,ymm20,ymm4
+	vpandq	ymm21,ymm21,ymm4
+	vpandq	ymm22,ymm22,ymm4
+	vpandq	ymm23,ymm23,ymm4
+
+
+	vpaddq	ymm2,ymm2,ymm24
+	vpaddq	ymm20,ymm20,ymm25
+	vpaddq	ymm21,ymm21,ymm26
+	vpaddq	ymm22,ymm22,ymm27
+	vpaddq	ymm23,ymm23,ymm28
+
+
+
+	vpcmpuq	k1,ymm4,ymm2,1
+	vpcmpuq	k2,ymm4,ymm20,1
+	vpcmpuq	k3,ymm4,ymm21,1
+	vpcmpuq	k4,ymm4,ymm22,1
+	vpcmpuq	k5,ymm4,ymm23,1
+	kmovb	r14d,k1
+	kmovb	r13d,k2
+	kmovb	r12d,k3
+	kmovb	r11d,k4
+	kmovb	r10d,k5
+
+
+	vpcmpuq	k1,ymm4,ymm2,0
+	vpcmpuq	k2,ymm4,ymm20,0
+	vpcmpuq	k3,ymm4,ymm21,0
+	vpcmpuq	k4,ymm4,ymm22,0
+	vpcmpuq	k5,ymm4,ymm23,0
+	kmovb	r9d,k1
+	kmovb	r8d,k2
+	kmovb	ebx,k3
+	kmovb	ecx,k4
+	kmovb	edx,k5
+
+
+
+	shl	r13b,4
+	or	r14b,r13b
+	shl	r11b,4
+	or	r12b,r11b
+
+	add	r14b,r14b
+	adc	r12b,r12b
+	adc	r10b,r10b
+
+	shl	r8b,4
+	or	r9b,r8b
+	shl	cl,4
+	or	bl,cl
+
+	add	r14b,r9b
+	adc	r12b,bl
+	adc	r10b,dl
+
+	xor	r14b,r9b
+	xor	r12b,bl
+	xor	r10b,dl
+
+	kmovb	k1,r14d
+	shr	r14b,4
+	kmovb	k2,r14d
+	kmovb	k3,r12d
+	shr	r12b,4
+	kmovb	k4,r12d
+	kmovb	k5,r10d
+
+
+	vpsubq	ymm2{k1},ymm2,ymm4
+	vpsubq	ymm20{k2},ymm20,ymm4
+	vpsubq	ymm21{k3},ymm21,ymm4
+	vpsubq	ymm22{k4},ymm22,ymm4
+	vpsubq	ymm23{k5},ymm23,ymm4
+
+	vpandq	ymm2,ymm2,ymm4
+	vpandq	ymm20,ymm20,ymm4
+	vpandq	ymm21,ymm21,ymm4
+	vpandq	ymm22,ymm22,ymm4
+	vpandq	ymm23,ymm23,ymm4
+
+	vmovdqu64	YMMWORD[rdi],ymm1
+	vmovdqu64	YMMWORD[32+rdi],ymm16
+	vmovdqu64	YMMWORD[64+rdi],ymm17
+	vmovdqu64	YMMWORD[96+rdi],ymm18
+	vmovdqu64	YMMWORD[128+rdi],ymm19
+
+	vmovdqu64	YMMWORD[160+rdi],ymm2
+	vmovdqu64	YMMWORD[192+rdi],ymm20
+	vmovdqu64	YMMWORD[224+rdi],ymm21
+	vmovdqu64	YMMWORD[256+rdi],ymm22
+	vmovdqu64	YMMWORD[288+rdi],ymm23
+
+	vzeroupper
+	mov	r15,QWORD[rsp]
+
+	mov	r14,QWORD[8+rsp]
+
+	mov	r13,QWORD[16+rsp]
+
+	mov	r12,QWORD[24+rsp]
+
+	mov	rbp,QWORD[32+rsp]
+
+	mov	rbx,QWORD[40+rsp]
+
+	lea	rsp,[48+rsp]
+
+$L$rsaz_amm52x20_x2_256_epilogue:
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
+	DB	0F3h,0C3h		;repret
+
+$L$SEH_end_ossl_rsaz_amm52x20_x2_256:
+section	.text code align=64
+
+
+ALIGN	32
 global	ossl_extract_multiplier_2x20_win5
 
-ossl_rsaz_amm52x20_x1_256:
-ossl_rsaz_amm52x20_x2_256:
 ossl_extract_multiplier_2x20_win5:
-DB	0x0f,0x0b
+	mov	QWORD[8+rsp],rdi	;WIN64 prologue
+	mov	QWORD[16+rsp],rsi
+	mov	rax,rsp
+$L$SEH_begin_ossl_extract_multiplier_2x20_win5:
+	mov	rdi,rcx
+	mov	rsi,rdx
+	mov	rdx,r8
+	mov	rcx,r9
+
+
+
+DB	243,15,30,250
+	lea	rax,[rcx*4+rcx]
+	sal	rax,5
+	add	rsi,rax
+
+	vmovdqa64	ymm23,YMMWORD[$L$ones]
+	vpbroadcastq	ymm22,rdx
+	lea	rax,[10240+rsi]
+
+	vpxor	xmm4,xmm4,xmm4
+	vmovdqa64	ymm3,ymm4
+	vmovdqa64	ymm2,ymm4
+	vmovdqa64	ymm1,ymm4
+	vmovdqa64	ymm0,ymm4
+	vmovdqa64	ymm21,ymm4
+
+ALIGN	32
+$L$loop:
+	vpcmpq	k1,ymm22,ymm21,0
+	add	rsi,320
+	vpaddq	ymm21,ymm21,ymm23
+	vmovdqu64	ymm16,YMMWORD[((-320))+rsi]
+	vmovdqu64	ymm17,YMMWORD[((-288))+rsi]
+	vmovdqu64	ymm18,YMMWORD[((-256))+rsi]
+	vmovdqu64	ymm19,YMMWORD[((-224))+rsi]
+	vmovdqu64	ymm20,YMMWORD[((-192))+rsi]
+	vpblendmq	ymm0{k1},ymm0,ymm16
+	vpblendmq	ymm1{k1},ymm1,ymm17
+	vpblendmq	ymm2{k1},ymm2,ymm18
+	vpblendmq	ymm3{k1},ymm3,ymm19
+	vpblendmq	ymm4{k1},ymm4,ymm20
+	cmp	rax,rsi
+	jne	NEAR $L$loop
+
+	vmovdqu64	YMMWORD[rdi],ymm0
+	vmovdqu64	YMMWORD[32+rdi],ymm1
+	vmovdqu64	YMMWORD[64+rdi],ymm2
+	vmovdqu64	YMMWORD[96+rdi],ymm3
+	vmovdqu64	YMMWORD[128+rdi],ymm4
+
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
 	DB	0F3h,0C3h		;repret
 
+$L$SEH_end_ossl_extract_multiplier_2x20_win5:
+section	.data data align=8
+
+ALIGN	32
+$L$ones:
+	DQ	1,1,1,1
+EXTERN	__imp_RtlVirtualUnwind
+
+ALIGN	16
+rsaz_def_handler:
+	push	rsi
+	push	rdi
+	push	rbx
+	push	rbp
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	pushfq
+	sub	rsp,64
+
+	mov	rax,QWORD[120+r8]
+	mov	rbx,QWORD[248+r8]
+
+	mov	rsi,QWORD[8+r9]
+	mov	r11,QWORD[56+r9]
+
+	mov	r10d,DWORD[r11]
+	lea	r10,[r10*1+rsi]
+	cmp	rbx,r10
+	jb	NEAR $L$common_seh_tail
+
+	mov	rax,QWORD[152+r8]
+
+	mov	r10d,DWORD[4+r11]
+	lea	r10,[r10*1+rsi]
+	cmp	rbx,r10
+	jae	NEAR $L$common_seh_tail
+
+	lea	rax,[48+rax]
+
+	mov	rbx,QWORD[((-8))+rax]
+	mov	rbp,QWORD[((-16))+rax]
+	mov	r12,QWORD[((-24))+rax]
+	mov	r13,QWORD[((-32))+rax]
+	mov	r14,QWORD[((-40))+rax]
+	mov	r15,QWORD[((-48))+rax]
+	mov	QWORD[144+r8],rbx
+	mov	QWORD[160+r8],rbp
+	mov	QWORD[216+r8],r12
+	mov	QWORD[224+r8],r13
+	mov	QWORD[232+r8],r14
+	mov	QWORD[240+r8],r15
+
+$L$common_seh_tail:
+	mov	rdi,QWORD[8+rax]
+	mov	rsi,QWORD[16+rax]
+	mov	QWORD[152+r8],rax
+	mov	QWORD[168+r8],rsi
+	mov	QWORD[176+r8],rdi
+
+	mov	rdi,QWORD[40+r9]
+	mov	rsi,r8
+	mov	ecx,154
+	DD	0xa548f3fc
+
+	mov	rsi,r9
+	xor	rcx,rcx
+	mov	rdx,QWORD[8+rsi]
+	mov	r8,QWORD[rsi]
+	mov	r9,QWORD[16+rsi]
+	mov	r10,QWORD[40+rsi]
+	lea	r11,[56+rsi]
+	lea	r12,[24+rsi]
+	mov	QWORD[32+rsp],r10
+	mov	QWORD[40+rsp],r11
+	mov	QWORD[48+rsp],r12
+	mov	QWORD[56+rsp],rcx
+	call	QWORD[__imp_RtlVirtualUnwind]
+
+	mov	eax,1
+	add	rsp,64
+	popfq
+	pop	r15
+	pop	r14
+	pop	r13
+	pop	r12
+	pop	rbp
+	pop	rbx
+	pop	rdi
+	pop	rsi
+	DB	0F3h,0C3h		;repret
+
+
+section	.pdata rdata align=4
+ALIGN	4
+	DD	$L$SEH_begin_ossl_rsaz_amm52x20_x1_256 wrt ..imagebase
+	DD	$L$SEH_end_ossl_rsaz_amm52x20_x1_256 wrt ..imagebase
+	DD	$L$SEH_info_ossl_rsaz_amm52x20_x1_256 wrt ..imagebase
+
+	DD	$L$SEH_begin_ossl_rsaz_amm52x20_x2_256 wrt ..imagebase
+	DD	$L$SEH_end_ossl_rsaz_amm52x20_x2_256 wrt ..imagebase
+	DD	$L$SEH_info_ossl_rsaz_amm52x20_x2_256 wrt ..imagebase
+
+	DD	$L$SEH_begin_ossl_extract_multiplier_2x20_win5 wrt ..imagebase
+	DD	$L$SEH_end_ossl_extract_multiplier_2x20_win5 wrt ..imagebase
+	DD	$L$SEH_info_ossl_extract_multiplier_2x20_win5 wrt ..imagebase
+
+section	.xdata rdata align=8
+ALIGN	8
+$L$SEH_info_ossl_rsaz_amm52x20_x1_256:
+DB	9,0,0,0
+	DD	rsaz_def_handler wrt ..imagebase
+	DD	$L$rsaz_amm52x20_x1_256_body wrt ..imagebase,$L$rsaz_amm52x20_x1_256_epilogue wrt ..imagebase
+$L$SEH_info_ossl_rsaz_amm52x20_x2_256:
+DB	9,0,0,0
+	DD	rsaz_def_handler wrt ..imagebase
+	DD	$L$rsaz_amm52x20_x2_256_body wrt ..imagebase,$L$rsaz_amm52x20_x2_256_epilogue wrt ..imagebase
+$L$SEH_info_ossl_extract_multiplier_2x20_win5:
+DB	9,0,0,0
+	DD	rsaz_def_handler wrt ..imagebase
+	DD	$L$SEH_begin_ossl_extract_multiplier_2x20_win5 wrt ..imagebase,$L$SEH_begin_ossl_extract_multiplier_2x20_win5 wrt ..imagebase
Index: /trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/rsaz-x86_64.S
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/rsaz-x86_64.S	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/rsaz-x86_64.S	(revision 95219)
@@ -44,4 +44,8 @@
 	mov	rax,QWORD[8+rsi]
 	mov	QWORD[128+rsp],rcx
+	mov	r11d,0x80100
+	and	r11d,DWORD[((OPENSSL_ia32cap_P+8))]
+	cmp	r11d,0x80100
+	je	NEAR $L$oop_sqrx
 	jmp	NEAR $L$oop_sqr
 
@@ -414,4 +418,280 @@
 	dec	r8d
 	jnz	NEAR $L$oop_sqr
+	jmp	NEAR $L$sqr_tail
+
+ALIGN	32
+$L$oop_sqrx:
+	mov	DWORD[((128+8))+rsp],r8d
+DB	102,72,15,110,199
+
+	mulx	r9,r8,rax
+	mov	rbx,rax
+
+	mulx	r10,rcx,QWORD[16+rsi]
+	xor	rbp,rbp
+
+	mulx	r11,rax,QWORD[24+rsi]
+	adcx	r9,rcx
+
+DB	0xc4,0x62,0xf3,0xf6,0xa6,0x20,0x00,0x00,0x00
+	adcx	r10,rax
+
+DB	0xc4,0x62,0xfb,0xf6,0xae,0x28,0x00,0x00,0x00
+	adcx	r11,rcx
+
+	mulx	r14,rcx,QWORD[48+rsi]
+	adcx	r12,rax
+	adcx	r13,rcx
+
+	mulx	r15,rax,QWORD[56+rsi]
+	adcx	r14,rax
+	adcx	r15,rbp
+
+	mulx	rdi,rax,rdx
+	mov	rdx,rbx
+	xor	rcx,rcx
+	adox	r8,r8
+	adcx	r8,rdi
+	adox	rcx,rbp
+	adcx	rcx,rbp
+
+	mov	QWORD[rsp],rax
+	mov	QWORD[8+rsp],r8
+
+
+DB	0xc4,0xe2,0xfb,0xf6,0x9e,0x10,0x00,0x00,0x00
+	adox	r10,rax
+	adcx	r11,rbx
+
+	mulx	r8,rdi,QWORD[24+rsi]
+	adox	r11,rdi
+DB	0x66
+	adcx	r12,r8
+
+	mulx	rbx,rax,QWORD[32+rsi]
+	adox	r12,rax
+	adcx	r13,rbx
+
+	mulx	r8,rdi,QWORD[40+rsi]
+	adox	r13,rdi
+	adcx	r14,r8
+
+DB	0xc4,0xe2,0xfb,0xf6,0x9e,0x30,0x00,0x00,0x00
+	adox	r14,rax
+	adcx	r15,rbx
+
+DB	0xc4,0x62,0xc3,0xf6,0x86,0x38,0x00,0x00,0x00
+	adox	r15,rdi
+	adcx	r8,rbp
+	mulx	rdi,rax,rdx
+	adox	r8,rbp
+DB	0x48,0x8b,0x96,0x10,0x00,0x00,0x00
+
+	xor	rbx,rbx
+	adox	r9,r9
+
+	adcx	rax,rcx
+	adox	r10,r10
+	adcx	r9,rax
+	adox	rbx,rbp
+	adcx	r10,rdi
+	adcx	rbx,rbp
+
+	mov	QWORD[16+rsp],r9
+DB	0x4c,0x89,0x94,0x24,0x18,0x00,0x00,0x00
+
+
+	mulx	r9,rdi,QWORD[24+rsi]
+	adox	r12,rdi
+	adcx	r13,r9
+
+	mulx	rcx,rax,QWORD[32+rsi]
+	adox	r13,rax
+	adcx	r14,rcx
+
+DB	0xc4,0x62,0xc3,0xf6,0x8e,0x28,0x00,0x00,0x00
+	adox	r14,rdi
+	adcx	r15,r9
+
+DB	0xc4,0xe2,0xfb,0xf6,0x8e,0x30,0x00,0x00,0x00
+	adox	r15,rax
+	adcx	r8,rcx
+
+	mulx	r9,rdi,QWORD[56+rsi]
+	adox	r8,rdi
+	adcx	r9,rbp
+	mulx	rdi,rax,rdx
+	adox	r9,rbp
+	mov	rdx,QWORD[24+rsi]
+
+	xor	rcx,rcx
+	adox	r11,r11
+
+	adcx	rax,rbx
+	adox	r12,r12
+	adcx	r11,rax
+	adox	rcx,rbp
+	adcx	r12,rdi
+	adcx	rcx,rbp
+
+	mov	QWORD[32+rsp],r11
+	mov	QWORD[40+rsp],r12
+
+
+	mulx	rbx,rax,QWORD[32+rsi]
+	adox	r14,rax
+	adcx	r15,rbx
+
+	mulx	r10,rdi,QWORD[40+rsi]
+	adox	r15,rdi
+	adcx	r8,r10
+
+	mulx	rbx,rax,QWORD[48+rsi]
+	adox	r8,rax
+	adcx	r9,rbx
+
+	mulx	r10,rdi,QWORD[56+rsi]
+	adox	r9,rdi
+	adcx	r10,rbp
+	mulx	rdi,rax,rdx
+	adox	r10,rbp
+	mov	rdx,QWORD[32+rsi]
+
+	xor	rbx,rbx
+	adox	r13,r13
+
+	adcx	rax,rcx
+	adox	r14,r14
+	adcx	r13,rax
+	adox	rbx,rbp
+	adcx	r14,rdi
+	adcx	rbx,rbp
+
+	mov	QWORD[48+rsp],r13
+	mov	QWORD[56+rsp],r14
+
+
+	mulx	r11,rdi,QWORD[40+rsi]
+	adox	r8,rdi
+	adcx	r9,r11
+
+	mulx	rcx,rax,QWORD[48+rsi]
+	adox	r9,rax
+	adcx	r10,rcx
+
+	mulx	r11,rdi,QWORD[56+rsi]
+	adox	r10,rdi
+	adcx	r11,rbp
+	mulx	rdi,rax,rdx
+	mov	rdx,QWORD[40+rsi]
+	adox	r11,rbp
+
+	xor	rcx,rcx
+	adox	r15,r15
+
+	adcx	rax,rbx
+	adox	r8,r8
+	adcx	r15,rax
+	adox	rcx,rbp
+	adcx	r8,rdi
+	adcx	rcx,rbp
+
+	mov	QWORD[64+rsp],r15
+	mov	QWORD[72+rsp],r8
+
+
+DB	0xc4,0xe2,0xfb,0xf6,0x9e,0x30,0x00,0x00,0x00
+	adox	r10,rax
+	adcx	r11,rbx
+
+DB	0xc4,0x62,0xc3,0xf6,0xa6,0x38,0x00,0x00,0x00
+	adox	r11,rdi
+	adcx	r12,rbp
+	mulx	rdi,rax,rdx
+	adox	r12,rbp
+	mov	rdx,QWORD[48+rsi]
+
+	xor	rbx,rbx
+	adox	r9,r9
+
+	adcx	rax,rcx
+	adox	r10,r10
+	adcx	r9,rax
+	adcx	r10,rdi
+	adox	rbx,rbp
+	adcx	rbx,rbp
+
+	mov	QWORD[80+rsp],r9
+	mov	QWORD[88+rsp],r10
+
+
+DB	0xc4,0x62,0xfb,0xf6,0xae,0x38,0x00,0x00,0x00
+	adox	r12,rax
+	adox	r13,rbp
+
+	mulx	rdi,rax,rdx
+	xor	rcx,rcx
+	mov	rdx,QWORD[56+rsi]
+	adox	r11,r11
+
+	adcx	rax,rbx
+	adox	r12,r12
+	adcx	r11,rax
+	adox	rcx,rbp
+	adcx	r12,rdi
+	adcx	rcx,rbp
+
+DB	0x4c,0x89,0x9c,0x24,0x60,0x00,0x00,0x00
+DB	0x4c,0x89,0xa4,0x24,0x68,0x00,0x00,0x00
+
+
+	mulx	rdx,rax,rdx
+	xor	rbx,rbx
+	adox	r13,r13
+
+	adcx	rax,rcx
+	adox	rbx,rbp
+	adcx	rax,r13
+	adcx	rbx,rdx
+
+DB	102,72,15,126,199
+DB	102,72,15,126,205
+
+	mov	rdx,QWORD[128+rsp]
+	mov	r8,QWORD[rsp]
+	mov	r9,QWORD[8+rsp]
+	mov	r10,QWORD[16+rsp]
+	mov	r11,QWORD[24+rsp]
+	mov	r12,QWORD[32+rsp]
+	mov	r13,QWORD[40+rsp]
+	mov	r14,QWORD[48+rsp]
+	mov	r15,QWORD[56+rsp]
+
+	mov	QWORD[112+rsp],rax
+	mov	QWORD[120+rsp],rbx
+
+	call	__rsaz_512_reducex
+
+	add	r8,QWORD[64+rsp]
+	adc	r9,QWORD[72+rsp]
+	adc	r10,QWORD[80+rsp]
+	adc	r11,QWORD[88+rsp]
+	adc	r12,QWORD[96+rsp]
+	adc	r13,QWORD[104+rsp]
+	adc	r14,QWORD[112+rsp]
+	adc	r15,QWORD[120+rsp]
+	sbb	rcx,rcx
+
+	call	__rsaz_512_subtract
+
+	mov	rdx,r8
+	mov	rax,r9
+	mov	r8d,DWORD[((128+8))+rsp]
+	mov	rsi,rdi
+
+	dec	r8d
+	jnz	NEAR $L$oop_sqrx
+
+$L$sqr_tail:
 
 	lea	rax,[((128+24+48))+rsp]
@@ -472,4 +752,8 @@
 DB	102,72,15,110,201
 	mov	QWORD[128+rsp],r8
+	mov	r11d,0x80100
+	and	r11d,DWORD[((OPENSSL_ia32cap_P+8))]
+	cmp	r11d,0x80100
+	je	NEAR $L$mulx
 	mov	rbx,QWORD[rdx]
 	mov	rbp,rdx
@@ -489,4 +773,27 @@
 
 	call	__rsaz_512_reduce
+	jmp	NEAR $L$mul_tail
+
+ALIGN	32
+$L$mulx:
+	mov	rbp,rdx
+	mov	rdx,QWORD[rdx]
+	call	__rsaz_512_mulx
+
+DB	102,72,15,126,199
+DB	102,72,15,126,205
+
+	mov	rdx,QWORD[128+rsp]
+	mov	r8,QWORD[rsp]
+	mov	r9,QWORD[8+rsp]
+	mov	r10,QWORD[16+rsp]
+	mov	r11,QWORD[24+rsp]
+	mov	r12,QWORD[32+rsp]
+	mov	r13,QWORD[40+rsp]
+	mov	r14,QWORD[48+rsp]
+	mov	r15,QWORD[56+rsp]
+
+	call	__rsaz_512_reducex
+$L$mul_tail:
 	add	r8,QWORD[64+rsp]
 	adc	r9,QWORD[72+rsp]
@@ -620,4 +927,8 @@
 	pshufd	xmm9,xmm8,0x4e
 	por	xmm8,xmm9
+	mov	r11d,0x80100
+	and	r11d,DWORD[((OPENSSL_ia32cap_P+8))]
+	cmp	r11d,0x80100
+	je	NEAR $L$mulx_gather
 DB	102,76,15,126,195
 
@@ -800,4 +1111,140 @@
 
 	call	__rsaz_512_reduce
+	jmp	NEAR $L$mul_gather_tail
+
+ALIGN	32
+$L$mulx_gather:
+DB	102,76,15,126,194
+
+	mov	QWORD[128+rsp],r8
+	mov	QWORD[((128+8))+rsp],rdi
+	mov	QWORD[((128+16))+rsp],rcx
+
+	mulx	r8,rbx,QWORD[rsi]
+	mov	QWORD[rsp],rbx
+	xor	edi,edi
+
+	mulx	r9,rax,QWORD[8+rsi]
+
+	mulx	r10,rbx,QWORD[16+rsi]
+	adcx	r8,rax
+
+	mulx	r11,rax,QWORD[24+rsi]
+	adcx	r9,rbx
+
+	mulx	r12,rbx,QWORD[32+rsi]
+	adcx	r10,rax
+
+	mulx	r13,rax,QWORD[40+rsi]
+	adcx	r11,rbx
+
+	mulx	r14,rbx,QWORD[48+rsi]
+	adcx	r12,rax
+
+	mulx	r15,rax,QWORD[56+rsi]
+	adcx	r13,rbx
+	adcx	r14,rax
+DB	0x67
+	mov	rbx,r8
+	adcx	r15,rdi
+
+	mov	rcx,-7
+	jmp	NEAR $L$oop_mulx_gather
+
+ALIGN	32
+$L$oop_mulx_gather:
+	movdqa	xmm8,XMMWORD[rbp]
+	movdqa	xmm9,XMMWORD[16+rbp]
+	movdqa	xmm10,XMMWORD[32+rbp]
+	movdqa	xmm11,XMMWORD[48+rbp]
+	pand	xmm8,xmm0
+	movdqa	xmm12,XMMWORD[64+rbp]
+	pand	xmm9,xmm1
+	movdqa	xmm13,XMMWORD[80+rbp]
+	pand	xmm10,xmm2
+	movdqa	xmm14,XMMWORD[96+rbp]
+	pand	xmm11,xmm3
+	movdqa	xmm15,XMMWORD[112+rbp]
+	lea	rbp,[128+rbp]
+	pand	xmm12,xmm4
+	pand	xmm13,xmm5
+	pand	xmm14,xmm6
+	pand	xmm15,xmm7
+	por	xmm8,xmm10
+	por	xmm9,xmm11
+	por	xmm8,xmm12
+	por	xmm9,xmm13
+	por	xmm8,xmm14
+	por	xmm9,xmm15
+
+	por	xmm8,xmm9
+	pshufd	xmm9,xmm8,0x4e
+	por	xmm8,xmm9
+DB	102,76,15,126,194
+
+DB	0xc4,0x62,0xfb,0xf6,0x86,0x00,0x00,0x00,0x00
+	adcx	rbx,rax
+	adox	r8,r9
+
+	mulx	r9,rax,QWORD[8+rsi]
+	adcx	r8,rax
+	adox	r9,r10
+
+	mulx	r10,rax,QWORD[16+rsi]
+	adcx	r9,rax
+	adox	r10,r11
+
+DB	0xc4,0x62,0xfb,0xf6,0x9e,0x18,0x00,0x00,0x00
+	adcx	r10,rax
+	adox	r11,r12
+
+	mulx	r12,rax,QWORD[32+rsi]
+	adcx	r11,rax
+	adox	r12,r13
+
+	mulx	r13,rax,QWORD[40+rsi]
+	adcx	r12,rax
+	adox	r13,r14
+
+DB	0xc4,0x62,0xfb,0xf6,0xb6,0x30,0x00,0x00,0x00
+	adcx	r13,rax
+DB	0x67
+	adox	r14,r15
+
+	mulx	r15,rax,QWORD[56+rsi]
+	mov	QWORD[64+rcx*8+rsp],rbx
+	adcx	r14,rax
+	adox	r15,rdi
+	mov	rbx,r8
+	adcx	r15,rdi
+
+	inc	rcx
+	jnz	NEAR $L$oop_mulx_gather
+
+	mov	QWORD[64+rsp],r8
+	mov	QWORD[((64+8))+rsp],r9
+	mov	QWORD[((64+16))+rsp],r10
+	mov	QWORD[((64+24))+rsp],r11
+	mov	QWORD[((64+32))+rsp],r12
+	mov	QWORD[((64+40))+rsp],r13
+	mov	QWORD[((64+48))+rsp],r14
+	mov	QWORD[((64+56))+rsp],r15
+
+	mov	rdx,QWORD[128+rsp]
+	mov	rdi,QWORD[((128+8))+rsp]
+	mov	rbp,QWORD[((128+16))+rsp]
+
+	mov	r8,QWORD[rsp]
+	mov	r9,QWORD[8+rsp]
+	mov	r10,QWORD[16+rsp]
+	mov	r11,QWORD[24+rsp]
+	mov	r12,QWORD[32+rsp]
+	mov	r13,QWORD[40+rsp]
+	mov	r14,QWORD[48+rsp]
+	mov	r15,QWORD[56+rsp]
+
+	call	__rsaz_512_reducex
+
+$L$mul_gather_tail:
 	add	r8,QWORD[64+rsp]
 	adc	r9,QWORD[72+rsp]
@@ -886,4 +1333,8 @@
 
 	mov	rbp,rdi
+	mov	r11d,0x80100
+	and	r11d,DWORD[((OPENSSL_ia32cap_P+8))]
+	cmp	r11d,0x80100
+	je	NEAR $L$mulx_scatter
 	mov	rbx,QWORD[rdi]
 	call	__rsaz_512_mul
@@ -902,4 +1353,27 @@
 
 	call	__rsaz_512_reduce
+	jmp	NEAR $L$mul_scatter_tail
+
+ALIGN	32
+$L$mulx_scatter:
+	mov	rdx,QWORD[rdi]
+	call	__rsaz_512_mulx
+
+DB	102,72,15,126,199
+DB	102,72,15,126,205
+
+	mov	rdx,QWORD[128+rsp]
+	mov	r8,QWORD[rsp]
+	mov	r9,QWORD[8+rsp]
+	mov	r10,QWORD[16+rsp]
+	mov	r11,QWORD[24+rsp]
+	mov	r12,QWORD[32+rsp]
+	mov	r13,QWORD[40+rsp]
+	mov	r14,QWORD[48+rsp]
+	mov	r15,QWORD[56+rsp]
+
+	call	__rsaz_512_reducex
+
+$L$mul_scatter_tail:
 	add	r8,QWORD[64+rsp]
 	adc	r9,QWORD[72+rsp]
@@ -977,4 +1451,5 @@
 
 $L$mul_by_one_body:
+	mov	eax,DWORD[((OPENSSL_ia32cap_P+8))]
 	mov	rbp,rdx
 	mov	QWORD[128+rsp],rcx
@@ -997,5 +1472,14 @@
 	movdqa	XMMWORD[80+rsp],xmm0
 	movdqa	XMMWORD[96+rsp],xmm0
+	and	eax,0x80100
+	cmp	eax,0x80100
+	je	NEAR $L$by_one_callx
 	call	__rsaz_512_reduce
+	jmp	NEAR $L$by_one_tail
+ALIGN	32
+$L$by_one_callx:
+	mov	rdx,QWORD[128+rsp]
+	call	__rsaz_512_reducex
+$L$by_one_tail:
 	mov	QWORD[rdi],r8
 	mov	QWORD[8+rdi],r9
@@ -1110,4 +1594,62 @@
 	dec	ecx
 	jne	NEAR $L$reduction_loop
+
+	DB	0F3h,0C3h		;repret
+
+
+
+ALIGN	32
+__rsaz_512_reducex:
+
+
+	imul	rdx,r8
+	xor	rsi,rsi
+	mov	ecx,8
+	jmp	NEAR $L$reduction_loopx
+
+ALIGN	32
+$L$reduction_loopx:
+	mov	rbx,r8
+	mulx	r8,rax,QWORD[rbp]
+	adcx	rax,rbx
+	adox	r8,r9
+
+	mulx	r9,rax,QWORD[8+rbp]
+	adcx	r8,rax
+	adox	r9,r10
+
+	mulx	r10,rbx,QWORD[16+rbp]
+	adcx	r9,rbx
+	adox	r10,r11
+
+	mulx	r11,rbx,QWORD[24+rbp]
+	adcx	r10,rbx
+	adox	r11,r12
+
+DB	0xc4,0x62,0xe3,0xf6,0xa5,0x20,0x00,0x00,0x00
+	mov	rax,rdx
+	mov	rdx,r8
+	adcx	r11,rbx
+	adox	r12,r13
+
+	mulx	rdx,rbx,QWORD[((128+8))+rsp]
+	mov	rdx,rax
+
+	mulx	r13,rax,QWORD[40+rbp]
+	adcx	r12,rax
+	adox	r13,r14
+
+DB	0xc4,0x62,0xfb,0xf6,0xb5,0x30,0x00,0x00,0x00
+	adcx	r13,rax
+	adox	r14,r15
+
+	mulx	r15,rax,QWORD[56+rbp]
+	mov	rdx,rbx
+	adcx	r14,rax
+	adox	r15,rsi
+	adcx	r15,rsi
+
+	dec	ecx
+	jne	NEAR $L$reduction_loopx
 
 	DB	0F3h,0C3h		;repret
@@ -1313,4 +1855,126 @@
 	mov	QWORD[48+rdi],r14
 	mov	QWORD[56+rdi],r15
+
+	DB	0F3h,0C3h		;repret
+
+
+
+ALIGN	32
+__rsaz_512_mulx:
+
+	mulx	r8,rbx,QWORD[rsi]
+	mov	rcx,-6
+
+	mulx	r9,rax,QWORD[8+rsi]
+	mov	QWORD[8+rsp],rbx
+
+	mulx	r10,rbx,QWORD[16+rsi]
+	adc	r8,rax
+
+	mulx	r11,rax,QWORD[24+rsi]
+	adc	r9,rbx
+
+	mulx	r12,rbx,QWORD[32+rsi]
+	adc	r10,rax
+
+	mulx	r13,rax,QWORD[40+rsi]
+	adc	r11,rbx
+
+	mulx	r14,rbx,QWORD[48+rsi]
+	adc	r12,rax
+
+	mulx	r15,rax,QWORD[56+rsi]
+	mov	rdx,QWORD[8+rbp]
+	adc	r13,rbx
+	adc	r14,rax
+	adc	r15,0
+
+	xor	rdi,rdi
+	jmp	NEAR $L$oop_mulx
+
+ALIGN	32
+$L$oop_mulx:
+	mov	rbx,r8
+	mulx	r8,rax,QWORD[rsi]
+	adcx	rbx,rax
+	adox	r8,r9
+
+	mulx	r9,rax,QWORD[8+rsi]
+	adcx	r8,rax
+	adox	r9,r10
+
+	mulx	r10,rax,QWORD[16+rsi]
+	adcx	r9,rax
+	adox	r10,r11
+
+	mulx	r11,rax,QWORD[24+rsi]
+	adcx	r10,rax
+	adox	r11,r12
+
+DB	0x3e,0xc4,0x62,0xfb,0xf6,0xa6,0x20,0x00,0x00,0x00
+	adcx	r11,rax
+	adox	r12,r13
+
+	mulx	r13,rax,QWORD[40+rsi]
+	adcx	r12,rax
+	adox	r13,r14
+
+	mulx	r14,rax,QWORD[48+rsi]
+	adcx	r13,rax
+	adox	r14,r15
+
+	mulx	r15,rax,QWORD[56+rsi]
+	mov	rdx,QWORD[64+rcx*8+rbp]
+	mov	QWORD[((8+64-8))+rcx*8+rsp],rbx
+	adcx	r14,rax
+	adox	r15,rdi
+	adcx	r15,rdi
+
+	inc	rcx
+	jnz	NEAR $L$oop_mulx
+
+	mov	rbx,r8
+	mulx	r8,rax,QWORD[rsi]
+	adcx	rbx,rax
+	adox	r8,r9
+
+DB	0xc4,0x62,0xfb,0xf6,0x8e,0x08,0x00,0x00,0x00
+	adcx	r8,rax
+	adox	r9,r10
+
+DB	0xc4,0x62,0xfb,0xf6,0x96,0x10,0x00,0x00,0x00
+	adcx	r9,rax
+	adox	r10,r11
+
+	mulx	r11,rax,QWORD[24+rsi]
+	adcx	r10,rax
+	adox	r11,r12
+
+	mulx	r12,rax,QWORD[32+rsi]
+	adcx	r11,rax
+	adox	r12,r13
+
+	mulx	r13,rax,QWORD[40+rsi]
+	adcx	r12,rax
+	adox	r13,r14
+
+DB	0xc4,0x62,0xfb,0xf6,0xb6,0x30,0x00,0x00,0x00
+	adcx	r13,rax
+	adox	r14,r15
+
+DB	0xc4,0x62,0xfb,0xf6,0xbe,0x38,0x00,0x00,0x00
+	adcx	r14,rax
+	adox	r15,rdi
+	adcx	r15,rdi
+
+	mov	QWORD[((8+64-8))+rsp],rbx
+	mov	QWORD[((8+64))+rsp],r8
+	mov	QWORD[((8+64+8))+rsp],r9
+	mov	QWORD[((8+64+16))+rsp],r10
+	mov	QWORD[((8+64+24))+rsp],r11
+	mov	QWORD[((8+64+32))+rsp],r12
+	mov	QWORD[((8+64+40))+rsp],r13
+	mov	QWORD[((8+64+48))+rsp],r14
+	mov	QWORD[((8+64+56))+rsp],r15
 
 	DB	0F3h,0C3h		;repret
Index: /trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/x86_64-mont.S
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/x86_64-mont.S	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/x86_64-mont.S	(revision 95219)
@@ -32,4 +32,5 @@
 	cmp	r9d,8
 	jb	NEAR $L$mul_enter
+	mov	r11d,DWORD[((OPENSSL_ia32cap_P+8))]
 	cmp	rdx,rsi
 	jne	NEAR $L$mul4x_enter
@@ -294,4 +295,7 @@
 
 $L$mul4x_enter:
+	and	r11d,0x80100
+	cmp	r11d,0x80100
+	je	NEAR $L$mulx4x_enter
 	push	rbx
 
@@ -719,4 +723,5 @@
 
 $L$SEH_end_bn_mul4x_mont:
+EXTERN	bn_sqrx8x_internal
 EXTERN	bn_sqr8x_internal
 
@@ -814,4 +819,23 @@
 DB	102,72,15,110,207
 DB	102,73,15,110,218
+	mov	eax,DWORD[((OPENSSL_ia32cap_P+8))]
+	and	eax,0x80100
+	cmp	eax,0x80100
+	jne	NEAR $L$sqr8x_nox
+
+	call	bn_sqrx8x_internal
+
+
+
+
+	lea	rbx,[rcx*1+r8]
+	mov	r9,rcx
+	mov	rdx,rcx
+DB	102,72,15,126,207
+	sar	rcx,3+2
+	jmp	NEAR $L$sqr8x_sub
+
+ALIGN	32
+$L$sqr8x_nox:
 	call	bn_sqr8x_internal
 
@@ -903,4 +927,374 @@
 
 $L$SEH_end_bn_sqr8x_mont:
+
+ALIGN	32
+bn_mulx4x_mont:
+	mov	QWORD[8+rsp],rdi	;WIN64 prologue
+	mov	QWORD[16+rsp],rsi
+	mov	rax,rsp
+$L$SEH_begin_bn_mulx4x_mont:
+	mov	rdi,rcx
+	mov	rsi,rdx
+	mov	rdx,r8
+	mov	rcx,r9
+	mov	r8,QWORD[40+rsp]
+	mov	r9,QWORD[48+rsp]
+
+
+
+	mov	rax,rsp
+
+$L$mulx4x_enter:
+	push	rbx
+
+	push	rbp
+
+	push	r12
+
+	push	r13
+
+	push	r14
+
+	push	r15
+
+$L$mulx4x_prologue:
+
+	shl	r9d,3
+	xor	r10,r10
+	sub	r10,r9
+	mov	r8,QWORD[r8]
+	lea	rbp,[((-72))+r10*1+rsp]
+	and	rbp,-128
+	mov	r11,rsp
+	sub	r11,rbp
+	and	r11,-4096
+	lea	rsp,[rbp*1+r11]
+	mov	r10,QWORD[rsp]
+	cmp	rsp,rbp
+	ja	NEAR $L$mulx4x_page_walk
+	jmp	NEAR $L$mulx4x_page_walk_done
+
+ALIGN	16
+$L$mulx4x_page_walk:
+	lea	rsp,[((-4096))+rsp]
+	mov	r10,QWORD[rsp]
+	cmp	rsp,rbp
+	ja	NEAR $L$mulx4x_page_walk
+$L$mulx4x_page_walk_done:
+
+	lea	r10,[r9*1+rdx]
+
+
+
+
+
+
+
+
+
+
+
+
+	mov	QWORD[rsp],r9
+	shr	r9,5
+	mov	QWORD[16+rsp],r10
+	sub	r9,1
+	mov	QWORD[24+rsp],r8
+	mov	QWORD[32+rsp],rdi
+	mov	QWORD[40+rsp],rax
+
+	mov	QWORD[48+rsp],r9
+	jmp	NEAR $L$mulx4x_body
+
+ALIGN	32
+$L$mulx4x_body:
+	lea	rdi,[8+rdx]
+	mov	rdx,QWORD[rdx]
+	lea	rbx,[((64+32))+rsp]
+	mov	r9,rdx
+
+	mulx	rax,r8,QWORD[rsi]
+	mulx	r14,r11,QWORD[8+rsi]
+	add	r11,rax
+	mov	QWORD[8+rsp],rdi
+	mulx	r13,r12,QWORD[16+rsi]
+	adc	r12,r14
+	adc	r13,0
+
+	mov	rdi,r8
+	imul	r8,QWORD[24+rsp]
+	xor	rbp,rbp
+
+	mulx	r14,rax,QWORD[24+rsi]
+	mov	rdx,r8
+	lea	rsi,[32+rsi]
+	adcx	r13,rax
+	adcx	r14,rbp
+
+	mulx	r10,rax,QWORD[rcx]
+	adcx	rdi,rax
+	adox	r10,r11
+	mulx	r11,rax,QWORD[8+rcx]
+	adcx	r10,rax
+	adox	r11,r12
+DB	0xc4,0x62,0xfb,0xf6,0xa1,0x10,0x00,0x00,0x00
+	mov	rdi,QWORD[48+rsp]
+	mov	QWORD[((-32))+rbx],r10
+	adcx	r11,rax
+	adox	r12,r13
+	mulx	r15,rax,QWORD[24+rcx]
+	mov	rdx,r9
+	mov	QWORD[((-24))+rbx],r11
+	adcx	r12,rax
+	adox	r15,rbp
+	lea	rcx,[32+rcx]
+	mov	QWORD[((-16))+rbx],r12
+
+	jmp	NEAR $L$mulx4x_1st
+
+ALIGN	32
+$L$mulx4x_1st:
+	adcx	r15,rbp
+	mulx	rax,r10,QWORD[rsi]
+	adcx	r10,r14
+	mulx	r14,r11,QWORD[8+rsi]
+	adcx	r11,rax
+	mulx	rax,r12,QWORD[16+rsi]
+	adcx	r12,r14
+	mulx	r14,r13,QWORD[24+rsi]
+DB	0x67,0x67
+	mov	rdx,r8
+	adcx	r13,rax
+	adcx	r14,rbp
+	lea	rsi,[32+rsi]
+	lea	rbx,[32+rbx]
+
+	adox	r10,r15
+	mulx	r15,rax,QWORD[rcx]
+	adcx	r10,rax
+	adox	r11,r15
+	mulx	r15,rax,QWORD[8+rcx]
+	adcx	r11,rax
+	adox	r12,r15
+	mulx	r15,rax,QWORD[16+rcx]
+	mov	QWORD[((-40))+rbx],r10
+	adcx	r12,rax
+	mov	QWORD[((-32))+rbx],r11
+	adox	r13,r15
+	mulx	r15,rax,QWORD[24+rcx]
+	mov	rdx,r9
+	mov	QWORD[((-24))+rbx],r12
+	adcx	r13,rax
+	adox	r15,rbp
+	lea	rcx,[32+rcx]
+	mov	QWORD[((-16))+rbx],r13
+
+	dec	rdi
+	jnz	NEAR $L$mulx4x_1st
+
+	mov	rax,QWORD[rsp]
+	mov	rdi,QWORD[8+rsp]
+	adc	r15,rbp
+	add	r14,r15
+	sbb	r15,r15
+	mov	QWORD[((-8))+rbx],r14
+	jmp	NEAR $L$mulx4x_outer
+
+ALIGN	32
+$L$mulx4x_outer:
+	mov	rdx,QWORD[rdi]
+	lea	rdi,[8+rdi]
+	sub	rsi,rax
+	mov	QWORD[rbx],r15
+	lea	rbx,[((64+32))+rsp]
+	sub	rcx,rax
+
+	mulx	r11,r8,QWORD[rsi]
+	xor	ebp,ebp
+	mov	r9,rdx
+	mulx	r12,r14,QWORD[8+rsi]
+	adox	r8,QWORD[((-32))+rbx]
+	adcx	r11,r14
+	mulx	r13,r15,QWORD[16+rsi]
+	adox	r11,QWORD[((-24))+rbx]
+	adcx	r12,r15
+	adox	r12,QWORD[((-16))+rbx]
+	adcx	r13,rbp
+	adox	r13,rbp
+
+	mov	QWORD[8+rsp],rdi
+	mov	r15,r8
+	imul	r8,QWORD[24+rsp]
+	xor	ebp,ebp
+
+	mulx	r14,rax,QWORD[24+rsi]
+	mov	rdx,r8
+	adcx	r13,rax
+	adox	r13,QWORD[((-8))+rbx]
+	adcx	r14,rbp
+	lea	rsi,[32+rsi]
+	adox	r14,rbp
+
+	mulx	r10,rax,QWORD[rcx]
+	adcx	r15,rax
+	adox	r10,r11
+	mulx	r11,rax,QWORD[8+rcx]
+	adcx	r10,rax
+	adox	r11,r12
+	mulx	r12,rax,QWORD[16+rcx]
+	mov	QWORD[((-32))+rbx],r10
+	adcx	r11,rax
+	adox	r12,r13
+	mulx	r15,rax,QWORD[24+rcx]
+	mov	rdx,r9
+	mov	QWORD[((-24))+rbx],r11
+	lea	rcx,[32+rcx]
+	adcx	r12,rax
+	adox	r15,rbp
+	mov	rdi,QWORD[48+rsp]
+	mov	QWORD[((-16))+rbx],r12
+
+	jmp	NEAR $L$mulx4x_inner
+
+ALIGN	32
+$L$mulx4x_inner:
+	mulx	rax,r10,QWORD[rsi]
+	adcx	r15,rbp
+	adox	r10,r14
+	mulx	r14,r11,QWORD[8+rsi]
+	adcx	r10,QWORD[rbx]
+	adox	r11,rax
+	mulx	rax,r12,QWORD[16+rsi]
+	adcx	r11,QWORD[8+rbx]
+	adox	r12,r14
+	mulx	r14,r13,QWORD[24+rsi]
+	mov	rdx,r8
+	adcx	r12,QWORD[16+rbx]
+	adox	r13,rax
+	adcx	r13,QWORD[24+rbx]
+	adox	r14,rbp
+	lea	rsi,[32+rsi]
+	lea	rbx,[32+rbx]
+	adcx	r14,rbp
+
+	adox	r10,r15
+	mulx	r15,rax,QWORD[rcx]
+	adcx	r10,rax
+	adox	r11,r15
+	mulx	r15,rax,QWORD[8+rcx]
+	adcx	r11,rax
+	adox	r12,r15
+	mulx	r15,rax,QWORD[16+rcx]
+	mov	QWORD[((-40))+rbx],r10
+	adcx	r12,rax
+	adox	r13,r15
+	mulx	r15,rax,QWORD[24+rcx]
+	mov	rdx,r9
+	mov	QWORD[((-32))+rbx],r11
+	mov	QWORD[((-24))+rbx],r12
+	adcx	r13,rax
+	adox	r15,rbp
+	lea	rcx,[32+rcx]
+	mov	QWORD[((-16))+rbx],r13
+
+	dec	rdi
+	jnz	NEAR $L$mulx4x_inner
+
+	mov	rax,QWORD[rsp]
+	mov	rdi,QWORD[8+rsp]
+	adc	r15,rbp
+	sub	rbp,QWORD[rbx]
+	adc	r14,r15
+	sbb	r15,r15
+	mov	QWORD[((-8))+rbx],r14
+
+	cmp	rdi,QWORD[16+rsp]
+	jne	NEAR $L$mulx4x_outer
+
+	lea	rbx,[64+rsp]
+	sub	rcx,rax
+	neg	r15
+	mov	rdx,rax
+	shr	rax,3+2
+	mov	rdi,QWORD[32+rsp]
+	jmp	NEAR $L$mulx4x_sub
+
+ALIGN	32
+$L$mulx4x_sub:
+	mov	r11,QWORD[rbx]
+	mov	r12,QWORD[8+rbx]
+	mov	r13,QWORD[16+rbx]
+	mov	r14,QWORD[24+rbx]
+	lea	rbx,[32+rbx]
+	sbb	r11,QWORD[rcx]
+	sbb	r12,QWORD[8+rcx]
+	sbb	r13,QWORD[16+rcx]
+	sbb	r14,QWORD[24+rcx]
+	lea	rcx,[32+rcx]
+	mov	QWORD[rdi],r11
+	mov	QWORD[8+rdi],r12
+	mov	QWORD[16+rdi],r13
+	mov	QWORD[24+rdi],r14
+	lea	rdi,[32+rdi]
+	dec	rax
+	jnz	NEAR $L$mulx4x_sub
+
+	sbb	r15,0
+	lea	rbx,[64+rsp]
+	sub	rdi,rdx
+
+DB	102,73,15,110,207
+	pxor	xmm0,xmm0
+	pshufd	xmm1,xmm1,0
+	mov	rsi,QWORD[40+rsp]
+
+	jmp	NEAR $L$mulx4x_cond_copy
+
+ALIGN	32
+$L$mulx4x_cond_copy:
+	movdqa	xmm2,XMMWORD[rbx]
+	movdqa	xmm3,XMMWORD[16+rbx]
+	lea	rbx,[32+rbx]
+	movdqu	xmm4,XMMWORD[rdi]
+	movdqu	xmm5,XMMWORD[16+rdi]
+	lea	rdi,[32+rdi]
+	movdqa	XMMWORD[(-32)+rbx],xmm0
+	movdqa	XMMWORD[(-16)+rbx],xmm0
+	pcmpeqd	xmm0,xmm1
+	pand	xmm2,xmm1
+	pand	xmm3,xmm1
+	pand	xmm4,xmm0
+	pand	xmm5,xmm0
+	pxor	xmm0,xmm0
+	por	xmm4,xmm2
+	por	xmm5,xmm3
+	movdqu	XMMWORD[(-32)+rdi],xmm4
+	movdqu	XMMWORD[(-16)+rdi],xmm5
+	sub	rdx,32
+	jnz	NEAR $L$mulx4x_cond_copy
+
+	mov	QWORD[rbx],rdx
+
+	mov	rax,1
+	mov	r15,QWORD[((-48))+rsi]
+
+	mov	r14,QWORD[((-40))+rsi]
+
+	mov	r13,QWORD[((-32))+rsi]
+
+	mov	r12,QWORD[((-24))+rsi]
+
+	mov	rbp,QWORD[((-16))+rsi]
+
+	mov	rbx,QWORD[((-8))+rsi]
+
+	lea	rsp,[rsi]
+
+$L$mulx4x_epilogue:
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
+	DB	0F3h,0C3h		;repret
+
+$L$SEH_end_bn_mulx4x_mont:
 DB	77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105
 DB	112,108,105,99,97,116,105,111,110,32,102,111,114,32,120,56
@@ -1054,4 +1448,7 @@
 	DD	$L$SEH_end_bn_sqr8x_mont wrt ..imagebase
 	DD	$L$SEH_info_bn_sqr8x_mont wrt ..imagebase
+	DD	$L$SEH_begin_bn_mulx4x_mont wrt ..imagebase
+	DD	$L$SEH_end_bn_mulx4x_mont wrt ..imagebase
+	DD	$L$SEH_info_bn_mulx4x_mont wrt ..imagebase
 section	.xdata rdata align=8
 ALIGN	8
@@ -1069,2 +1466,7 @@
 	DD	$L$sqr8x_prologue wrt ..imagebase,$L$sqr8x_body wrt ..imagebase,$L$sqr8x_epilogue wrt ..imagebase
 ALIGN	8
+$L$SEH_info_bn_mulx4x_mont:
+DB	9,0,0,0
+	DD	sqr_handler wrt ..imagebase
+	DD	$L$mulx4x_prologue wrt ..imagebase,$L$mulx4x_body wrt ..imagebase,$L$mulx4x_epilogue wrt ..imagebase
+ALIGN	8
Index: /trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/x86_64-mont5.S
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/x86_64-mont5.S	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/x86_64-mont5.S	(revision 95219)
@@ -30,4 +30,5 @@
 	test	r9d,7
 	jnz	NEAR $L$mul_enter
+	mov	r11d,DWORD[((OPENSSL_ia32cap_P+8))]
 	jmp	NEAR $L$mul4x_enter
 
@@ -480,4 +481,7 @@
 
 $L$mul4x_enter:
+	and	r11d,0x80108
+	cmp	r11d,0x80108
+	je	NEAR $L$mulx4x_enter
 	push	rbx
 
@@ -1123,4 +1127,8 @@
 	mov	rax,rsp
 
+	mov	r11d,DWORD[((OPENSSL_ia32cap_P+8))]
+	and	r11d,0x80108
+	cmp	r11d,0x80108
+	je	NEAR $L$powerx5_enter
 	push	rbx
 
@@ -2226,4 +2234,19 @@
 	mov	rbp,rcx
 DB	102,73,15,110,218
+	mov	r11d,DWORD[((OPENSSL_ia32cap_P+8))]
+	and	r11d,0x80108
+	cmp	r11d,0x80108
+	jne	NEAR $L$from_mont_nox
+
+	lea	rdi,[r9*1+rax]
+	call	__bn_sqrx8x_reduction
+	call	__bn_postx4x_internal
+
+	pxor	xmm0,xmm0
+	lea	rax,[48+rsp]
+	jmp	NEAR $L$from_mont_zero
+
+ALIGN	32
+$L$from_mont_nox:
 	call	__bn_sqr8x_reduction
 	call	__bn_post4x_internal
@@ -2266,4 +2289,1374 @@
 
 $L$SEH_end_bn_from_mont8x:
+
+ALIGN	32
+bn_mulx4x_mont_gather5:
+	mov	QWORD[8+rsp],rdi	;WIN64 prologue
+	mov	QWORD[16+rsp],rsi
+	mov	rax,rsp
+$L$SEH_begin_bn_mulx4x_mont_gather5:
+	mov	rdi,rcx
+	mov	rsi,rdx
+	mov	rdx,r8
+	mov	rcx,r9
+	mov	r8,QWORD[40+rsp]
+	mov	r9,QWORD[48+rsp]
+
+
+
+	mov	rax,rsp
+
+$L$mulx4x_enter:
+	push	rbx
+
+	push	rbp
+
+	push	r12
+
+	push	r13
+
+	push	r14
+
+	push	r15
+
+$L$mulx4x_prologue:
+
+	shl	r9d,3
+	lea	r10,[r9*2+r9]
+	neg	r9
+	mov	r8,QWORD[r8]
+
+
+
+
+
+
+
+
+
+
+	lea	r11,[((-320))+r9*2+rsp]
+	mov	rbp,rsp
+	sub	r11,rdi
+	and	r11,4095
+	cmp	r10,r11
+	jb	NEAR $L$mulx4xsp_alt
+	sub	rbp,r11
+	lea	rbp,[((-320))+r9*2+rbp]
+	jmp	NEAR $L$mulx4xsp_done
+
+$L$mulx4xsp_alt:
+	lea	r10,[((4096-320))+r9*2]
+	lea	rbp,[((-320))+r9*2+rbp]
+	sub	r11,r10
+	mov	r10,0
+	cmovc	r11,r10
+	sub	rbp,r11
+$L$mulx4xsp_done:
+	and	rbp,-64
+	mov	r11,rsp
+	sub	r11,rbp
+	and	r11,-4096
+	lea	rsp,[rbp*1+r11]
+	mov	r10,QWORD[rsp]
+	cmp	rsp,rbp
+	ja	NEAR $L$mulx4x_page_walk
+	jmp	NEAR $L$mulx4x_page_walk_done
+
+$L$mulx4x_page_walk:
+	lea	rsp,[((-4096))+rsp]
+	mov	r10,QWORD[rsp]
+	cmp	rsp,rbp
+	ja	NEAR $L$mulx4x_page_walk
+$L$mulx4x_page_walk_done:
+
+
+
+
+
+
+
+
+
+
+
+
+
+	mov	QWORD[32+rsp],r8
+	mov	QWORD[40+rsp],rax
+
+$L$mulx4x_body:
+	call	mulx4x_internal
+
+	mov	rsi,QWORD[40+rsp]
+
+	mov	rax,1
+
+	mov	r15,QWORD[((-48))+rsi]
+
+	mov	r14,QWORD[((-40))+rsi]
+
+	mov	r13,QWORD[((-32))+rsi]
+
+	mov	r12,QWORD[((-24))+rsi]
+
+	mov	rbp,QWORD[((-16))+rsi]
+
+	mov	rbx,QWORD[((-8))+rsi]
+
+	lea	rsp,[rsi]
+
+$L$mulx4x_epilogue:
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
+	DB	0F3h,0C3h		;repret
+
+$L$SEH_end_bn_mulx4x_mont_gather5:
+
+
+ALIGN	32
+mulx4x_internal:
+
+	mov	QWORD[8+rsp],r9
+	mov	r10,r9
+	neg	r9
+	shl	r9,5
+	neg	r10
+	lea	r13,[128+r9*1+rdx]
+	shr	r9,5+5
+	movd	xmm5,DWORD[56+rax]
+	sub	r9,1
+	lea	rax,[$L$inc]
+	mov	QWORD[((16+8))+rsp],r13
+	mov	QWORD[((24+8))+rsp],r9
+	mov	QWORD[((56+8))+rsp],rdi
+	movdqa	xmm0,XMMWORD[rax]
+	movdqa	xmm1,XMMWORD[16+rax]
+	lea	r10,[((88-112))+r10*1+rsp]
+	lea	rdi,[128+rdx]
+
+	pshufd	xmm5,xmm5,0
+	movdqa	xmm4,xmm1
+DB	0x67
+	movdqa	xmm2,xmm1
+DB	0x67
+	paddd	xmm1,xmm0
+	pcmpeqd	xmm0,xmm5
+	movdqa	xmm3,xmm4
+	paddd	xmm2,xmm1
+	pcmpeqd	xmm1,xmm5
+	movdqa	XMMWORD[112+r10],xmm0
+	movdqa	xmm0,xmm4
+
+	paddd	xmm3,xmm2
+	pcmpeqd	xmm2,xmm5
+	movdqa	XMMWORD[128+r10],xmm1
+	movdqa	xmm1,xmm4
+
+	paddd	xmm0,xmm3
+	pcmpeqd	xmm3,xmm5
+	movdqa	XMMWORD[144+r10],xmm2
+	movdqa	xmm2,xmm4
+
+	paddd	xmm1,xmm0
+	pcmpeqd	xmm0,xmm5
+	movdqa	XMMWORD[160+r10],xmm3
+	movdqa	xmm3,xmm4
+	paddd	xmm2,xmm1
+	pcmpeqd	xmm1,xmm5
+	movdqa	XMMWORD[176+r10],xmm0
+	movdqa	xmm0,xmm4
+
+	paddd	xmm3,xmm2
+	pcmpeqd	xmm2,xmm5
+	movdqa	XMMWORD[192+r10],xmm1
+	movdqa	xmm1,xmm4
+
+	paddd	xmm0,xmm3
+	pcmpeqd	xmm3,xmm5
+	movdqa	XMMWORD[208+r10],xmm2
+	movdqa	xmm2,xmm4
+
+	paddd	xmm1,xmm0
+	pcmpeqd	xmm0,xmm5
+	movdqa	XMMWORD[224+r10],xmm3
+	movdqa	xmm3,xmm4
+	paddd	xmm2,xmm1
+	pcmpeqd	xmm1,xmm5
+	movdqa	XMMWORD[240+r10],xmm0
+	movdqa	xmm0,xmm4
+
+	paddd	xmm3,xmm2
+	pcmpeqd	xmm2,xmm5
+	movdqa	XMMWORD[256+r10],xmm1
+	movdqa	xmm1,xmm4
+
+	paddd	xmm0,xmm3
+	pcmpeqd	xmm3,xmm5
+	movdqa	XMMWORD[272+r10],xmm2
+	movdqa	xmm2,xmm4
+
+	paddd	xmm1,xmm0
+	pcmpeqd	xmm0,xmm5
+	movdqa	XMMWORD[288+r10],xmm3
+	movdqa	xmm3,xmm4
+DB	0x67
+	paddd	xmm2,xmm1
+	pcmpeqd	xmm1,xmm5
+	movdqa	XMMWORD[304+r10],xmm0
+
+	paddd	xmm3,xmm2
+	pcmpeqd	xmm2,xmm5
+	movdqa	XMMWORD[320+r10],xmm1
+
+	pcmpeqd	xmm3,xmm5
+	movdqa	XMMWORD[336+r10],xmm2
+
+	pand	xmm0,XMMWORD[64+rdi]
+	pand	xmm1,XMMWORD[80+rdi]
+	pand	xmm2,XMMWORD[96+rdi]
+	movdqa	XMMWORD[352+r10],xmm3
+	pand	xmm3,XMMWORD[112+rdi]
+	por	xmm0,xmm2
+	por	xmm1,xmm3
+	movdqa	xmm4,XMMWORD[((-128))+rdi]
+	movdqa	xmm5,XMMWORD[((-112))+rdi]
+	movdqa	xmm2,XMMWORD[((-96))+rdi]
+	pand	xmm4,XMMWORD[112+r10]
+	movdqa	xmm3,XMMWORD[((-80))+rdi]
+	pand	xmm5,XMMWORD[128+r10]
+	por	xmm0,xmm4
+	pand	xmm2,XMMWORD[144+r10]
+	por	xmm1,xmm5
+	pand	xmm3,XMMWORD[160+r10]
+	por	xmm0,xmm2
+	por	xmm1,xmm3
+	movdqa	xmm4,XMMWORD[((-64))+rdi]
+	movdqa	xmm5,XMMWORD[((-48))+rdi]
+	movdqa	xmm2,XMMWORD[((-32))+rdi]
+	pand	xmm4,XMMWORD[176+r10]
+	movdqa	xmm3,XMMWORD[((-16))+rdi]
+	pand	xmm5,XMMWORD[192+r10]
+	por	xmm0,xmm4
+	pand	xmm2,XMMWORD[208+r10]
+	por	xmm1,xmm5
+	pand	xmm3,XMMWORD[224+r10]
+	por	xmm0,xmm2
+	por	xmm1,xmm3
+	movdqa	xmm4,XMMWORD[rdi]
+	movdqa	xmm5,XMMWORD[16+rdi]
+	movdqa	xmm2,XMMWORD[32+rdi]
+	pand	xmm4,XMMWORD[240+r10]
+	movdqa	xmm3,XMMWORD[48+rdi]
+	pand	xmm5,XMMWORD[256+r10]
+	por	xmm0,xmm4
+	pand	xmm2,XMMWORD[272+r10]
+	por	xmm1,xmm5
+	pand	xmm3,XMMWORD[288+r10]
+	por	xmm0,xmm2
+	por	xmm1,xmm3
+	pxor	xmm0,xmm1
+	pshufd	xmm1,xmm0,0x4e
+	por	xmm0,xmm1
+	lea	rdi,[256+rdi]
+DB	102,72,15,126,194
+	lea	rbx,[((64+32+8))+rsp]
+
+	mov	r9,rdx
+	mulx	rax,r8,QWORD[rsi]
+	mulx	r12,r11,QWORD[8+rsi]
+	add	r11,rax
+	mulx	r13,rax,QWORD[16+rsi]
+	adc	r12,rax
+	adc	r13,0
+	mulx	r14,rax,QWORD[24+rsi]
+
+	mov	r15,r8
+	imul	r8,QWORD[((32+8))+rsp]
+	xor	rbp,rbp
+	mov	rdx,r8
+
+	mov	QWORD[((8+8))+rsp],rdi
+
+	lea	rsi,[32+rsi]
+	adcx	r13,rax
+	adcx	r14,rbp
+
+	mulx	r10,rax,QWORD[rcx]
+	adcx	r15,rax
+	adox	r10,r11
+	mulx	r11,rax,QWORD[8+rcx]
+	adcx	r10,rax
+	adox	r11,r12
+	mulx	r12,rax,QWORD[16+rcx]
+	mov	rdi,QWORD[((24+8))+rsp]
+	mov	QWORD[((-32))+rbx],r10
+	adcx	r11,rax
+	adox	r12,r13
+	mulx	r15,rax,QWORD[24+rcx]
+	mov	rdx,r9
+	mov	QWORD[((-24))+rbx],r11
+	adcx	r12,rax
+	adox	r15,rbp
+	lea	rcx,[32+rcx]
+	mov	QWORD[((-16))+rbx],r12
+	jmp	NEAR $L$mulx4x_1st
+
+ALIGN	32
+$L$mulx4x_1st:
+	adcx	r15,rbp
+	mulx	rax,r10,QWORD[rsi]
+	adcx	r10,r14
+	mulx	r14,r11,QWORD[8+rsi]
+	adcx	r11,rax
+	mulx	rax,r12,QWORD[16+rsi]
+	adcx	r12,r14
+	mulx	r14,r13,QWORD[24+rsi]
+DB	0x67,0x67
+	mov	rdx,r8
+	adcx	r13,rax
+	adcx	r14,rbp
+	lea	rsi,[32+rsi]
+	lea	rbx,[32+rbx]
+
+	adox	r10,r15
+	mulx	r15,rax,QWORD[rcx]
+	adcx	r10,rax
+	adox	r11,r15
+	mulx	r15,rax,QWORD[8+rcx]
+	adcx	r11,rax
+	adox	r12,r15
+	mulx	r15,rax,QWORD[16+rcx]
+	mov	QWORD[((-40))+rbx],r10
+	adcx	r12,rax
+	mov	QWORD[((-32))+rbx],r11
+	adox	r13,r15
+	mulx	r15,rax,QWORD[24+rcx]
+	mov	rdx,r9
+	mov	QWORD[((-24))+rbx],r12
+	adcx	r13,rax
+	adox	r15,rbp
+	lea	rcx,[32+rcx]
+	mov	QWORD[((-16))+rbx],r13
+
+	dec	rdi
+	jnz	NEAR $L$mulx4x_1st
+
+	mov	rax,QWORD[8+rsp]
+	adc	r15,rbp
+	lea	rsi,[rax*1+rsi]
+	add	r14,r15
+	mov	rdi,QWORD[((8+8))+rsp]
+	adc	rbp,rbp
+	mov	QWORD[((-8))+rbx],r14
+	jmp	NEAR $L$mulx4x_outer
+
+ALIGN	32
+$L$mulx4x_outer:
+	lea	r10,[((16-256))+rbx]
+	pxor	xmm4,xmm4
+DB	0x67,0x67
+	pxor	xmm5,xmm5
+	movdqa	xmm0,XMMWORD[((-128))+rdi]
+	movdqa	xmm1,XMMWORD[((-112))+rdi]
+	movdqa	xmm2,XMMWORD[((-96))+rdi]
+	pand	xmm0,XMMWORD[256+r10]
+	movdqa	xmm3,XMMWORD[((-80))+rdi]
+	pand	xmm1,XMMWORD[272+r10]
+	por	xmm4,xmm0
+	pand	xmm2,XMMWORD[288+r10]
+	por	xmm5,xmm1
+	pand	xmm3,XMMWORD[304+r10]
+	por	xmm4,xmm2
+	por	xmm5,xmm3
+	movdqa	xmm0,XMMWORD[((-64))+rdi]
+	movdqa	xmm1,XMMWORD[((-48))+rdi]
+	movdqa	xmm2,XMMWORD[((-32))+rdi]
+	pand	xmm0,XMMWORD[320+r10]
+	movdqa	xmm3,XMMWORD[((-16))+rdi]
+	pand	xmm1,XMMWORD[336+r10]
+	por	xmm4,xmm0
+	pand	xmm2,XMMWORD[352+r10]
+	por	xmm5,xmm1
+	pand	xmm3,XMMWORD[368+r10]
+	por	xmm4,xmm2
+	por	xmm5,xmm3
+	movdqa	xmm0,XMMWORD[rdi]
+	movdqa	xmm1,XMMWORD[16+rdi]
+	movdqa	xmm2,XMMWORD[32+rdi]
+	pand	xmm0,XMMWORD[384+r10]
+	movdqa	xmm3,XMMWORD[48+rdi]
+	pand	xmm1,XMMWORD[400+r10]
+	por	xmm4,xmm0
+	pand	xmm2,XMMWORD[416+r10]
+	por	xmm5,xmm1
+	pand	xmm3,XMMWORD[432+r10]
+	por	xmm4,xmm2
+	por	xmm5,xmm3
+	movdqa	xmm0,XMMWORD[64+rdi]
+	movdqa	xmm1,XMMWORD[80+rdi]
+	movdqa	xmm2,XMMWORD[96+rdi]
+	pand	xmm0,XMMWORD[448+r10]
+	movdqa	xmm3,XMMWORD[112+rdi]
+	pand	xmm1,XMMWORD[464+r10]
+	por	xmm4,xmm0
+	pand	xmm2,XMMWORD[480+r10]
+	por	xmm5,xmm1
+	pand	xmm3,XMMWORD[496+r10]
+	por	xmm4,xmm2
+	por	xmm5,xmm3
+	por	xmm4,xmm5
+	pshufd	xmm0,xmm4,0x4e
+	por	xmm0,xmm4
+	lea	rdi,[256+rdi]
+DB	102,72,15,126,194
+
+	mov	QWORD[rbx],rbp
+	lea	rbx,[32+rax*1+rbx]
+	mulx	r11,r8,QWORD[rsi]
+	xor	rbp,rbp
+	mov	r9,rdx
+	mulx	r12,r14,QWORD[8+rsi]
+	adox	r8,QWORD[((-32))+rbx]
+	adcx	r11,r14
+	mulx	r13,r15,QWORD[16+rsi]
+	adox	r11,QWORD[((-24))+rbx]
+	adcx	r12,r15
+	mulx	r14,rdx,QWORD[24+rsi]
+	adox	r12,QWORD[((-16))+rbx]
+	adcx	r13,rdx
+	lea	rcx,[rax*1+rcx]
+	lea	rsi,[32+rsi]
+	adox	r13,QWORD[((-8))+rbx]
+	adcx	r14,rbp
+	adox	r14,rbp
+
+	mov	r15,r8
+	imul	r8,QWORD[((32+8))+rsp]
+
+	mov	rdx,r8
+	xor	rbp,rbp
+	mov	QWORD[((8+8))+rsp],rdi
+
+	mulx	r10,rax,QWORD[rcx]
+	adcx	r15,rax
+	adox	r10,r11
+	mulx	r11,rax,QWORD[8+rcx]
+	adcx	r10,rax
+	adox	r11,r12
+	mulx	r12,rax,QWORD[16+rcx]
+	adcx	r11,rax
+	adox	r12,r13
+	mulx	r15,rax,QWORD[24+rcx]
+	mov	rdx,r9
+	mov	rdi,QWORD[((24+8))+rsp]
+	mov	QWORD[((-32))+rbx],r10
+	adcx	r12,rax
+	mov	QWORD[((-24))+rbx],r11
+	adox	r15,rbp
+	mov	QWORD[((-16))+rbx],r12
+	lea	rcx,[32+rcx]
+	jmp	NEAR $L$mulx4x_inner
+
+ALIGN	32
+$L$mulx4x_inner:
+	mulx	rax,r10,QWORD[rsi]
+	adcx	r15,rbp
+	adox	r10,r14
+	mulx	r14,r11,QWORD[8+rsi]
+	adcx	r10,QWORD[rbx]
+	adox	r11,rax
+	mulx	rax,r12,QWORD[16+rsi]
+	adcx	r11,QWORD[8+rbx]
+	adox	r12,r14
+	mulx	r14,r13,QWORD[24+rsi]
+	mov	rdx,r8
+	adcx	r12,QWORD[16+rbx]
+	adox	r13,rax
+	adcx	r13,QWORD[24+rbx]
+	adox	r14,rbp
+	lea	rsi,[32+rsi]
+	lea	rbx,[32+rbx]
+	adcx	r14,rbp
+
+	adox	r10,r15
+	mulx	r15,rax,QWORD[rcx]
+	adcx	r10,rax
+	adox	r11,r15
+	mulx	r15,rax,QWORD[8+rcx]
+	adcx	r11,rax
+	adox	r12,r15
+	mulx	r15,rax,QWORD[16+rcx]
+	mov	QWORD[((-40))+rbx],r10
+	adcx	r12,rax
+	adox	r13,r15
+	mov	QWORD[((-32))+rbx],r11
+	mulx	r15,rax,QWORD[24+rcx]
+	mov	rdx,r9
+	lea	rcx,[32+rcx]
+	mov	QWORD[((-24))+rbx],r12
+	adcx	r13,rax
+	adox	r15,rbp
+	mov	QWORD[((-16))+rbx],r13
+
+	dec	rdi
+	jnz	NEAR $L$mulx4x_inner
+
+	mov	rax,QWORD[((0+8))+rsp]
+	adc	r15,rbp
+	sub	rdi,QWORD[rbx]
+	mov	rdi,QWORD[((8+8))+rsp]
+	mov	r10,QWORD[((16+8))+rsp]
+	adc	r14,r15
+	lea	rsi,[rax*1+rsi]
+	adc	rbp,rbp
+	mov	QWORD[((-8))+rbx],r14
+
+	cmp	rdi,r10
+	jb	NEAR $L$mulx4x_outer
+
+	mov	r10,QWORD[((-8))+rcx]
+	mov	r8,rbp
+	mov	r12,QWORD[rax*1+rcx]
+	lea	rbp,[rax*1+rcx]
+	mov	rcx,rax
+	lea	rdi,[rax*1+rbx]
+	xor	eax,eax
+	xor	r15,r15
+	sub	r10,r14
+	adc	r15,r15
+	or	r8,r15
+	sar	rcx,3+2
+	sub	rax,r8
+	mov	rdx,QWORD[((56+8))+rsp]
+	dec	r12
+	mov	r13,QWORD[8+rbp]
+	xor	r8,r8
+	mov	r14,QWORD[16+rbp]
+	mov	r15,QWORD[24+rbp]
+	jmp	NEAR $L$sqrx4x_sub_entry
+
+
+
+ALIGN	32
+bn_powerx5:
+	mov	QWORD[8+rsp],rdi	;WIN64 prologue
+	mov	QWORD[16+rsp],rsi
+	mov	rax,rsp
+$L$SEH_begin_bn_powerx5:
+	mov	rdi,rcx
+	mov	rsi,rdx
+	mov	rdx,r8
+	mov	rcx,r9
+	mov	r8,QWORD[40+rsp]
+	mov	r9,QWORD[48+rsp]
+
+
+
+	mov	rax,rsp
+
+$L$powerx5_enter:
+	push	rbx
+
+	push	rbp
+
+	push	r12
+
+	push	r13
+
+	push	r14
+
+	push	r15
+
+$L$powerx5_prologue:
+
+	shl	r9d,3
+	lea	r10,[r9*2+r9]
+	neg	r9
+	mov	r8,QWORD[r8]
+
+
+
+
+
+
+
+
+	lea	r11,[((-320))+r9*2+rsp]
+	mov	rbp,rsp
+	sub	r11,rdi
+	and	r11,4095
+	cmp	r10,r11
+	jb	NEAR $L$pwrx_sp_alt
+	sub	rbp,r11
+	lea	rbp,[((-320))+r9*2+rbp]
+	jmp	NEAR $L$pwrx_sp_done
+
+ALIGN	32
+$L$pwrx_sp_alt:
+	lea	r10,[((4096-320))+r9*2]
+	lea	rbp,[((-320))+r9*2+rbp]
+	sub	r11,r10
+	mov	r10,0
+	cmovc	r11,r10
+	sub	rbp,r11
+$L$pwrx_sp_done:
+	and	rbp,-64
+	mov	r11,rsp
+	sub	r11,rbp
+	and	r11,-4096
+	lea	rsp,[rbp*1+r11]
+	mov	r10,QWORD[rsp]
+	cmp	rsp,rbp
+	ja	NEAR $L$pwrx_page_walk
+	jmp	NEAR $L$pwrx_page_walk_done
+
+$L$pwrx_page_walk:
+	lea	rsp,[((-4096))+rsp]
+	mov	r10,QWORD[rsp]
+	cmp	rsp,rbp
+	ja	NEAR $L$pwrx_page_walk
+$L$pwrx_page_walk_done:
+
+	mov	r10,r9
+	neg	r9
+
+
+
+
+
+
+
+
+
+
+
+
+	pxor	xmm0,xmm0
+DB	102,72,15,110,207
+DB	102,72,15,110,209
+DB	102,73,15,110,218
+DB	102,72,15,110,226
+	mov	QWORD[32+rsp],r8
+	mov	QWORD[40+rsp],rax
+
+$L$powerx5_body:
+
+	call	__bn_sqrx8x_internal
+	call	__bn_postx4x_internal
+	call	__bn_sqrx8x_internal
+	call	__bn_postx4x_internal
+	call	__bn_sqrx8x_internal
+	call	__bn_postx4x_internal
+	call	__bn_sqrx8x_internal
+	call	__bn_postx4x_internal
+	call	__bn_sqrx8x_internal
+	call	__bn_postx4x_internal
+
+	mov	r9,r10
+	mov	rdi,rsi
+DB	102,72,15,126,209
+DB	102,72,15,126,226
+	mov	rax,QWORD[40+rsp]
+
+	call	mulx4x_internal
+
+	mov	rsi,QWORD[40+rsp]
+
+	mov	rax,1
+
+	mov	r15,QWORD[((-48))+rsi]
+
+	mov	r14,QWORD[((-40))+rsi]
+
+	mov	r13,QWORD[((-32))+rsi]
+
+	mov	r12,QWORD[((-24))+rsi]
+
+	mov	rbp,QWORD[((-16))+rsi]
+
+	mov	rbx,QWORD[((-8))+rsi]
+
+	lea	rsp,[rsi]
+
+$L$powerx5_epilogue:
+	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
+	mov	rsi,QWORD[16+rsp]
+	DB	0F3h,0C3h		;repret
+
+$L$SEH_end_bn_powerx5:
+
+global	bn_sqrx8x_internal
+
+
+ALIGN	32
+bn_sqrx8x_internal:
+__bn_sqrx8x_internal:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+	lea	rdi,[((48+8))+rsp]
+	lea	rbp,[r9*1+rsi]
+	mov	QWORD[((0+8))+rsp],r9
+	mov	QWORD[((8+8))+rsp],rbp
+	jmp	NEAR $L$sqr8x_zero_start
+
+ALIGN	32
+DB	0x66,0x66,0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00
+$L$sqrx8x_zero:
+DB	0x3e
+	movdqa	XMMWORD[rdi],xmm0
+	movdqa	XMMWORD[16+rdi],xmm0
+	movdqa	XMMWORD[32+rdi],xmm0
+	movdqa	XMMWORD[48+rdi],xmm0
+$L$sqr8x_zero_start:
+	movdqa	XMMWORD[64+rdi],xmm0
+	movdqa	XMMWORD[80+rdi],xmm0
+	movdqa	XMMWORD[96+rdi],xmm0
+	movdqa	XMMWORD[112+rdi],xmm0
+	lea	rdi,[128+rdi]
+	sub	r9,64
+	jnz	NEAR $L$sqrx8x_zero
+
+	mov	rdx,QWORD[rsi]
+
+	xor	r10,r10
+	xor	r11,r11
+	xor	r12,r12
+	xor	r13,r13
+	xor	r14,r14
+	xor	r15,r15
+	lea	rdi,[((48+8))+rsp]
+	xor	rbp,rbp
+	jmp	NEAR $L$sqrx8x_outer_loop
+
+ALIGN	32
+$L$sqrx8x_outer_loop:
+	mulx	rax,r8,QWORD[8+rsi]
+	adcx	r8,r9
+	adox	r10,rax
+	mulx	rax,r9,QWORD[16+rsi]
+	adcx	r9,r10
+	adox	r11,rax
+DB	0xc4,0xe2,0xab,0xf6,0x86,0x18,0x00,0x00,0x00
+	adcx	r10,r11
+	adox	r12,rax
+DB	0xc4,0xe2,0xa3,0xf6,0x86,0x20,0x00,0x00,0x00
+	adcx	r11,r12
+	adox	r13,rax
+	mulx	rax,r12,QWORD[40+rsi]
+	adcx	r12,r13
+	adox	r14,rax
+	mulx	rax,r13,QWORD[48+rsi]
+	adcx	r13,r14
+	adox	rax,r15
+	mulx	r15,r14,QWORD[56+rsi]
+	mov	rdx,QWORD[8+rsi]
+	adcx	r14,rax
+	adox	r15,rbp
+	adc	r15,QWORD[64+rdi]
+	mov	QWORD[8+rdi],r8
+	mov	QWORD[16+rdi],r9
+	sbb	rcx,rcx
+	xor	rbp,rbp
+
+
+	mulx	rbx,r8,QWORD[16+rsi]
+	mulx	rax,r9,QWORD[24+rsi]
+	adcx	r8,r10
+	adox	r9,rbx
+	mulx	rbx,r10,QWORD[32+rsi]
+	adcx	r9,r11
+	adox	r10,rax
+DB	0xc4,0xe2,0xa3,0xf6,0x86,0x28,0x00,0x00,0x00
+	adcx	r10,r12
+	adox	r11,rbx
+DB	0xc4,0xe2,0x9b,0xf6,0x9e,0x30,0x00,0x00,0x00
+	adcx	r11,r13
+	adox	r12,r14
+DB	0xc4,0x62,0x93,0xf6,0xb6,0x38,0x00,0x00,0x00
+	mov	rdx,QWORD[16+rsi]
+	adcx	r12,rax
+	adox	r13,rbx
+	adcx	r13,r15
+	adox	r14,rbp
+	adcx	r14,rbp
+
+	mov	QWORD[24+rdi],r8
+	mov	QWORD[32+rdi],r9
+
+	mulx	rbx,r8,QWORD[24+rsi]
+	mulx	rax,r9,QWORD[32+rsi]
+	adcx	r8,r10
+	adox	r9,rbx
+	mulx	rbx,r10,QWORD[40+rsi]
+	adcx	r9,r11
+	adox	r10,rax
+DB	0xc4,0xe2,0xa3,0xf6,0x86,0x30,0x00,0x00,0x00
+	adcx	r10,r12
+	adox	r11,r13
+DB	0xc4,0x62,0x9b,0xf6,0xae,0x38,0x00,0x00,0x00
+DB	0x3e
+	mov	rdx,QWORD[24+rsi]
+	adcx	r11,rbx
+	adox	r12,rax
+	adcx	r12,r14
+	mov	QWORD[40+rdi],r8
+	mov	QWORD[48+rdi],r9
+	mulx	rax,r8,QWORD[32+rsi]
+	adox	r13,rbp
+	adcx	r13,rbp
+
+	mulx	rbx,r9,QWORD[40+rsi]
+	adcx	r8,r10
+	adox	r9,rax
+	mulx	rax,r10,QWORD[48+rsi]
+	adcx	r9,r11
+	adox	r10,r12
+	mulx	r12,r11,QWORD[56+rsi]
+	mov	rdx,QWORD[32+rsi]
+	mov	r14,QWORD[40+rsi]
+	adcx	r10,rbx
+	adox	r11,rax
+	mov	r15,QWORD[48+rsi]
+	adcx	r11,r13
+	adox	r12,rbp
+	adcx	r12,rbp
+
+	mov	QWORD[56+rdi],r8
+	mov	QWORD[64+rdi],r9
+
+	mulx	rax,r9,r14
+	mov	r8,QWORD[56+rsi]
+	adcx	r9,r10
+	mulx	rbx,r10,r15
+	adox	r10,rax
+	adcx	r10,r11
+	mulx	rax,r11,r8
+	mov	rdx,r14
+	adox	r11,rbx
+	adcx	r11,r12
+
+	adcx	rax,rbp
+
+	mulx	rbx,r14,r15
+	mulx	r13,r12,r8
+	mov	rdx,r15
+	lea	rsi,[64+rsi]
+	adcx	r11,r14
+	adox	r12,rbx
+	adcx	r12,rax
+	adox	r13,rbp
+
+DB	0x67,0x67
+	mulx	r14,r8,r8
+	adcx	r13,r8
+	adcx	r14,rbp
+
+	cmp	rsi,QWORD[((8+8))+rsp]
+	je	NEAR $L$sqrx8x_outer_break
+
+	neg	rcx
+	mov	rcx,-8
+	mov	r15,rbp
+	mov	r8,QWORD[64+rdi]
+	adcx	r9,QWORD[72+rdi]
+	adcx	r10,QWORD[80+rdi]
+	adcx	r11,QWORD[88+rdi]
+	adc	r12,QWORD[96+rdi]
+	adc	r13,QWORD[104+rdi]
+	adc	r14,QWORD[112+rdi]
+	adc	r15,QWORD[120+rdi]
+	lea	rbp,[rsi]
+	lea	rdi,[128+rdi]
+	sbb	rax,rax
+
+	mov	rdx,QWORD[((-64))+rsi]
+	mov	QWORD[((16+8))+rsp],rax
+	mov	QWORD[((24+8))+rsp],rdi
+
+
+	xor	eax,eax
+	jmp	NEAR $L$sqrx8x_loop
+
+ALIGN	32
+$L$sqrx8x_loop:
+	mov	rbx,r8
+	mulx	r8,rax,QWORD[rbp]
+	adcx	rbx,rax
+	adox	r8,r9
+
+	mulx	r9,rax,QWORD[8+rbp]
+	adcx	r8,rax
+	adox	r9,r10
+
+	mulx	r10,rax,QWORD[16+rbp]
+	adcx	r9,rax
+	adox	r10,r11
+
+	mulx	r11,rax,QWORD[24+rbp]
+	adcx	r10,rax
+	adox	r11,r12
+
+DB	0xc4,0x62,0xfb,0xf6,0xa5,0x20,0x00,0x00,0x00
+	adcx	r11,rax
+	adox	r12,r13
+
+	mulx	r13,rax,QWORD[40+rbp]
+	adcx	r12,rax
+	adox	r13,r14
+
+	mulx	r14,rax,QWORD[48+rbp]
+	mov	QWORD[rcx*8+rdi],rbx
+	mov	ebx,0
+	adcx	r13,rax
+	adox	r14,r15
+
+DB	0xc4,0x62,0xfb,0xf6,0xbd,0x38,0x00,0x00,0x00
+	mov	rdx,QWORD[8+rcx*8+rsi]
+	adcx	r14,rax
+	adox	r15,rbx
+	adcx	r15,rbx
+
+DB	0x67
+	inc	rcx
+	jnz	NEAR $L$sqrx8x_loop
+
+	lea	rbp,[64+rbp]
+	mov	rcx,-8
+	cmp	rbp,QWORD[((8+8))+rsp]
+	je	NEAR $L$sqrx8x_break
+
+	sub	rbx,QWORD[((16+8))+rsp]
+DB	0x66
+	mov	rdx,QWORD[((-64))+rsi]
+	adcx	r8,QWORD[rdi]
+	adcx	r9,QWORD[8+rdi]
+	adc	r10,QWORD[16+rdi]
+	adc	r11,QWORD[24+rdi]
+	adc	r12,QWORD[32+rdi]
+	adc	r13,QWORD[40+rdi]
+	adc	r14,QWORD[48+rdi]
+	adc	r15,QWORD[56+rdi]
+	lea	rdi,[64+rdi]
+DB	0x67
+	sbb	rax,rax
+	xor	ebx,ebx
+	mov	QWORD[((16+8))+rsp],rax
+	jmp	NEAR $L$sqrx8x_loop
+
+ALIGN	32
+$L$sqrx8x_break:
+	xor	rbp,rbp
+	sub	rbx,QWORD[((16+8))+rsp]
+	adcx	r8,rbp
+	mov	rcx,QWORD[((24+8))+rsp]
+	adcx	r9,rbp
+	mov	rdx,QWORD[rsi]
+	adc	r10,0
+	mov	QWORD[rdi],r8
+	adc	r11,0
+	adc	r12,0
+	adc	r13,0
+	adc	r14,0
+	adc	r15,0
+	cmp	rdi,rcx
+	je	NEAR $L$sqrx8x_outer_loop
+
+	mov	QWORD[8+rdi],r9
+	mov	r9,QWORD[8+rcx]
+	mov	QWORD[16+rdi],r10
+	mov	r10,QWORD[16+rcx]
+	mov	QWORD[24+rdi],r11
+	mov	r11,QWORD[24+rcx]
+	mov	QWORD[32+rdi],r12
+	mov	r12,QWORD[32+rcx]
+	mov	QWORD[40+rdi],r13
+	mov	r13,QWORD[40+rcx]
+	mov	QWORD[48+rdi],r14
+	mov	r14,QWORD[48+rcx]
+	mov	QWORD[56+rdi],r15
+	mov	r15,QWORD[56+rcx]
+	mov	rdi,rcx
+	jmp	NEAR $L$sqrx8x_outer_loop
+
+ALIGN	32
+$L$sqrx8x_outer_break:
+	mov	QWORD[72+rdi],r9
+DB	102,72,15,126,217
+	mov	QWORD[80+rdi],r10
+	mov	QWORD[88+rdi],r11
+	mov	QWORD[96+rdi],r12
+	mov	QWORD[104+rdi],r13
+	mov	QWORD[112+rdi],r14
+	lea	rdi,[((48+8))+rsp]
+	mov	rdx,QWORD[rcx*1+rsi]
+
+	mov	r11,QWORD[8+rdi]
+	xor	r10,r10
+	mov	r9,QWORD[((0+8))+rsp]
+	adox	r11,r11
+	mov	r12,QWORD[16+rdi]
+	mov	r13,QWORD[24+rdi]
+
+
+ALIGN	32
+$L$sqrx4x_shift_n_add:
+	mulx	rbx,rax,rdx
+	adox	r12,r12
+	adcx	rax,r10
+DB	0x48,0x8b,0x94,0x0e,0x08,0x00,0x00,0x00
+DB	0x4c,0x8b,0x97,0x20,0x00,0x00,0x00
+	adox	r13,r13
+	adcx	rbx,r11
+	mov	r11,QWORD[40+rdi]
+	mov	QWORD[rdi],rax
+	mov	QWORD[8+rdi],rbx
+
+	mulx	rbx,rax,rdx
+	adox	r10,r10
+	adcx	rax,r12
+	mov	rdx,QWORD[16+rcx*1+rsi]
+	mov	r12,QWORD[48+rdi]
+	adox	r11,r11
+	adcx	rbx,r13
+	mov	r13,QWORD[56+rdi]
+	mov	QWORD[16+rdi],rax
+	mov	QWORD[24+rdi],rbx
+
+	mulx	rbx,rax,rdx
+	adox	r12,r12
+	adcx	rax,r10
+	mov	rdx,QWORD[24+rcx*1+rsi]
+	lea	rcx,[32+rcx]
+	mov	r10,QWORD[64+rdi]
+	adox	r13,r13
+	adcx	rbx,r11
+	mov	r11,QWORD[72+rdi]
+	mov	QWORD[32+rdi],rax
+	mov	QWORD[40+rdi],rbx
+
+	mulx	rbx,rax,rdx
+	adox	r10,r10
+	adcx	rax,r12
+	jrcxz	$L$sqrx4x_shift_n_add_break
+DB	0x48,0x8b,0x94,0x0e,0x00,0x00,0x00,0x00
+	adox	r11,r11
+	adcx	rbx,r13
+	mov	r12,QWORD[80+rdi]
+	mov	r13,QWORD[88+rdi]
+	mov	QWORD[48+rdi],rax
+	mov	QWORD[56+rdi],rbx
+	lea	rdi,[64+rdi]
+	nop
+	jmp	NEAR $L$sqrx4x_shift_n_add
+
+ALIGN	32
+$L$sqrx4x_shift_n_add_break:
+	adcx	rbx,r13
+	mov	QWORD[48+rdi],rax
+	mov	QWORD[56+rdi],rbx
+	lea	rdi,[64+rdi]
+DB	102,72,15,126,213
+__bn_sqrx8x_reduction:
+	xor	eax,eax
+	mov	rbx,QWORD[((32+8))+rsp]
+	mov	rdx,QWORD[((48+8))+rsp]
+	lea	rcx,[((-64))+r9*1+rbp]
+
+	mov	QWORD[((0+8))+rsp],rcx
+	mov	QWORD[((8+8))+rsp],rdi
+
+	lea	rdi,[((48+8))+rsp]
+	jmp	NEAR $L$sqrx8x_reduction_loop
+
+ALIGN	32
+$L$sqrx8x_reduction_loop:
+	mov	r9,QWORD[8+rdi]
+	mov	r10,QWORD[16+rdi]
+	mov	r11,QWORD[24+rdi]
+	mov	r12,QWORD[32+rdi]
+	mov	r8,rdx
+	imul	rdx,rbx
+	mov	r13,QWORD[40+rdi]
+	mov	r14,QWORD[48+rdi]
+	mov	r15,QWORD[56+rdi]
+	mov	QWORD[((24+8))+rsp],rax
+
+	lea	rdi,[64+rdi]
+	xor	rsi,rsi
+	mov	rcx,-8
+	jmp	NEAR $L$sqrx8x_reduce
+
+ALIGN	32
+$L$sqrx8x_reduce:
+	mov	rbx,r8
+	mulx	r8,rax,QWORD[rbp]
+	adcx	rax,rbx
+	adox	r8,r9
+
+	mulx	r9,rbx,QWORD[8+rbp]
+	adcx	r8,rbx
+	adox	r9,r10
+
+	mulx	r10,rbx,QWORD[16+rbp]
+	adcx	r9,rbx
+	adox	r10,r11
+
+	mulx	r11,rbx,QWORD[24+rbp]
+	adcx	r10,rbx
+	adox	r11,r12
+
+DB	0xc4,0x62,0xe3,0xf6,0xa5,0x20,0x00,0x00,0x00
+	mov	rax,rdx
+	mov	rdx,r8
+	adcx	r11,rbx
+	adox	r12,r13
+
+	mulx	rdx,rbx,QWORD[((32+8))+rsp]
+	mov	rdx,rax
+	mov	QWORD[((64+48+8))+rcx*8+rsp],rax
+
+	mulx	r13,rax,QWORD[40+rbp]
+	adcx	r12,rax
+	adox	r13,r14
+
+	mulx	r14,rax,QWORD[48+rbp]
+	adcx	r13,rax
+	adox	r14,r15
+
+	mulx	r15,rax,QWORD[56+rbp]
+	mov	rdx,rbx
+	adcx	r14,rax
+	adox	r15,rsi
+	adcx	r15,rsi
+
+DB	0x67,0x67,0x67
+	inc	rcx
+	jnz	NEAR $L$sqrx8x_reduce
+
+	mov	rax,rsi
+	cmp	rbp,QWORD[((0+8))+rsp]
+	jae	NEAR $L$sqrx8x_no_tail
+
+	mov	rdx,QWORD[((48+8))+rsp]
+	add	r8,QWORD[rdi]
+	lea	rbp,[64+rbp]
+	mov	rcx,-8
+	adcx	r9,QWORD[8+rdi]
+	adcx	r10,QWORD[16+rdi]
+	adc	r11,QWORD[24+rdi]
+	adc	r12,QWORD[32+rdi]
+	adc	r13,QWORD[40+rdi]
+	adc	r14,QWORD[48+rdi]
+	adc	r15,QWORD[56+rdi]
+	lea	rdi,[64+rdi]
+	sbb	rax,rax
+
+	xor	rsi,rsi
+	mov	QWORD[((16+8))+rsp],rax
+	jmp	NEAR $L$sqrx8x_tail
+
+ALIGN	32
+$L$sqrx8x_tail:
+	mov	rbx,r8
+	mulx	r8,rax,QWORD[rbp]
+	adcx	rbx,rax
+	adox	r8,r9
+
+	mulx	r9,rax,QWORD[8+rbp]
+	adcx	r8,rax
+	adox	r9,r10
+
+	mulx	r10,rax,QWORD[16+rbp]
+	adcx	r9,rax
+	adox	r10,r11
+
+	mulx	r11,rax,QWORD[24+rbp]
+	adcx	r10,rax
+	adox	r11,r12
+
+DB	0xc4,0x62,0xfb,0xf6,0xa5,0x20,0x00,0x00,0x00
+	adcx	r11,rax
+	adox	r12,r13
+
+	mulx	r13,rax,QWORD[40+rbp]
+	adcx	r12,rax
+	adox	r13,r14
+
+	mulx	r14,rax,QWORD[48+rbp]
+	adcx	r13,rax
+	adox	r14,r15
+
+	mulx	r15,rax,QWORD[56+rbp]
+	mov	rdx,QWORD[((72+48+8))+rcx*8+rsp]
+	adcx	r14,rax
+	adox	r15,rsi
+	mov	QWORD[rcx*8+rdi],rbx
+	mov	rbx,r8
+	adcx	r15,rsi
+
+	inc	rcx
+	jnz	NEAR $L$sqrx8x_tail
+
+	cmp	rbp,QWORD[((0+8))+rsp]
+	jae	NEAR $L$sqrx8x_tail_done
+
+	sub	rsi,QWORD[((16+8))+rsp]
+	mov	rdx,QWORD[((48+8))+rsp]
+	lea	rbp,[64+rbp]
+	adc	r8,QWORD[rdi]
+	adc	r9,QWORD[8+rdi]
+	adc	r10,QWORD[16+rdi]
+	adc	r11,QWORD[24+rdi]
+	adc	r12,QWORD[32+rdi]
+	adc	r13,QWORD[40+rdi]
+	adc	r14,QWORD[48+rdi]
+	adc	r15,QWORD[56+rdi]
+	lea	rdi,[64+rdi]
+	sbb	rax,rax
+	sub	rcx,8
+
+	xor	rsi,rsi
+	mov	QWORD[((16+8))+rsp],rax
+	jmp	NEAR $L$sqrx8x_tail
+
+ALIGN	32
+$L$sqrx8x_tail_done:
+	xor	rax,rax
+	add	r8,QWORD[((24+8))+rsp]
+	adc	r9,0
+	adc	r10,0
+	adc	r11,0
+	adc	r12,0
+	adc	r13,0
+	adc	r14,0
+	adc	r15,0
+	adc	rax,0
+
+	sub	rsi,QWORD[((16+8))+rsp]
+$L$sqrx8x_no_tail:
+	adc	r8,QWORD[rdi]
+DB	102,72,15,126,217
+	adc	r9,QWORD[8+rdi]
+	mov	rsi,QWORD[56+rbp]
+DB	102,72,15,126,213
+	adc	r10,QWORD[16+rdi]
+	adc	r11,QWORD[24+rdi]
+	adc	r12,QWORD[32+rdi]
+	adc	r13,QWORD[40+rdi]
+	adc	r14,QWORD[48+rdi]
+	adc	r15,QWORD[56+rdi]
+	adc	rax,0
+
+	mov	rbx,QWORD[((32+8))+rsp]
+	mov	rdx,QWORD[64+rcx*1+rdi]
+
+	mov	QWORD[rdi],r8
+	lea	r8,[64+rdi]
+	mov	QWORD[8+rdi],r9
+	mov	QWORD[16+rdi],r10
+	mov	QWORD[24+rdi],r11
+	mov	QWORD[32+rdi],r12
+	mov	QWORD[40+rdi],r13
+	mov	QWORD[48+rdi],r14
+	mov	QWORD[56+rdi],r15
+
+	lea	rdi,[64+rcx*1+rdi]
+	cmp	r8,QWORD[((8+8))+rsp]
+	jb	NEAR $L$sqrx8x_reduction_loop
+	DB	0F3h,0C3h		;repret
+
+
+ALIGN	32
+__bn_postx4x_internal:
+
+	mov	r12,QWORD[rbp]
+	mov	r10,rcx
+	mov	r9,rcx
+	neg	rax
+	sar	rcx,3+2
+
+DB	102,72,15,126,202
+DB	102,72,15,126,206
+	dec	r12
+	mov	r13,QWORD[8+rbp]
+	xor	r8,r8
+	mov	r14,QWORD[16+rbp]
+	mov	r15,QWORD[24+rbp]
+	jmp	NEAR $L$sqrx4x_sub_entry
+
+ALIGN	16
+$L$sqrx4x_sub:
+	mov	r12,QWORD[rbp]
+	mov	r13,QWORD[8+rbp]
+	mov	r14,QWORD[16+rbp]
+	mov	r15,QWORD[24+rbp]
+$L$sqrx4x_sub_entry:
+	andn	r12,r12,rax
+	lea	rbp,[32+rbp]
+	andn	r13,r13,rax
+	andn	r14,r14,rax
+	andn	r15,r15,rax
+
+	neg	r8
+	adc	r12,QWORD[rdi]
+	adc	r13,QWORD[8+rdi]
+	adc	r14,QWORD[16+rdi]
+	adc	r15,QWORD[24+rdi]
+	mov	QWORD[rdx],r12
+	lea	rdi,[32+rdi]
+	mov	QWORD[8+rdx],r13
+	sbb	r8,r8
+	mov	QWORD[16+rdx],r14
+	mov	QWORD[24+rdx],r15
+	lea	rdx,[32+rdx]
+
+	inc	rcx
+	jnz	NEAR $L$sqrx4x_sub
+
+	neg	r9
+
+	DB	0F3h,0C3h		;repret
+
+
 global	bn_get_bits5
 
@@ -2602,4 +3995,11 @@
 	DD	$L$SEH_end_bn_from_mont8x wrt ..imagebase
 	DD	$L$SEH_info_bn_from_mont8x wrt ..imagebase
+	DD	$L$SEH_begin_bn_mulx4x_mont_gather5 wrt ..imagebase
+	DD	$L$SEH_end_bn_mulx4x_mont_gather5 wrt ..imagebase
+	DD	$L$SEH_info_bn_mulx4x_mont_gather5 wrt ..imagebase
+
+	DD	$L$SEH_begin_bn_powerx5 wrt ..imagebase
+	DD	$L$SEH_end_bn_powerx5 wrt ..imagebase
+	DD	$L$SEH_info_bn_powerx5 wrt ..imagebase
 	DD	$L$SEH_begin_bn_gather5 wrt ..imagebase
 	DD	$L$SEH_end_bn_gather5 wrt ..imagebase
@@ -2628,4 +4028,14 @@
 	DD	$L$from_prologue wrt ..imagebase,$L$from_body wrt ..imagebase,$L$from_epilogue wrt ..imagebase
 ALIGN	8
+$L$SEH_info_bn_mulx4x_mont_gather5:
+DB	9,0,0,0
+	DD	mul_handler wrt ..imagebase
+	DD	$L$mulx4x_prologue wrt ..imagebase,$L$mulx4x_body wrt ..imagebase,$L$mulx4x_epilogue wrt ..imagebase
+ALIGN	8
+$L$SEH_info_bn_powerx5:
+DB	9,0,0,0
+	DD	mul_handler wrt ..imagebase
+	DD	$L$powerx5_prologue wrt ..imagebase,$L$powerx5_body wrt ..imagebase,$L$powerx5_epilogue wrt ..imagebase
+ALIGN	8
 $L$SEH_info_bn_gather5:
 DB	0x01,0x0b,0x03,0x0a
Index: /trunk/src/libs/openssl-3.0.3/crypto/http/http_client.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/http/http_client.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/http/http_client.c	(revision 95219)
@@ -323,5 +323,5 @@
     for (i = 0; i < sk_CONF_VALUE_num(headers); i++) {
         hdr = sk_CONF_VALUE_value(headers, i);
-        if (add_host && strcasecmp("host", hdr->name) == 0)
+        if (add_host && OPENSSL_strcasecmp("host", hdr->name) == 0)
             add_host = 0;
         if (!OSSL_HTTP_REQ_CTX_add1_header(rctx, hdr->name, hdr->value))
@@ -667,11 +667,11 @@
         if (value != NULL && line_end != NULL) {
             if (rctx->state == OHS_REDIRECT
-                    && strcasecmp(key, "Location") == 0) {
+                    && OPENSSL_strcasecmp(key, "Location") == 0) {
                 rctx->redirection_url = value;
                 return 0;
             }
-            if (rctx->expected_ct != NULL
-                    && strcasecmp(key, "Content-Type") == 0) {
-                if (strcasecmp(rctx->expected_ct, value) != 0) {
+            if (rctx->state == OHS_HEADERS && rctx->expected_ct != NULL
+                    && OPENSSL_strcasecmp(key, "Content-Type") == 0) {
+                if (OPENSSL_strcasecmp(rctx->expected_ct, value) != 0) {
                     ERR_raise_data(ERR_LIB_HTTP, HTTP_R_UNEXPECTED_CONTENT_TYPE,
                                    "expected=%s, actual=%s",
@@ -683,10 +683,10 @@
 
             /* https://tools.ietf.org/html/rfc7230#section-6.3 Persistence */
-            if (strcasecmp(key, "Connection") == 0) {
-                if (strcasecmp(value, "keep-alive") == 0)
+            if (OPENSSL_strcasecmp(key, "Connection") == 0) {
+                if (OPENSSL_strcasecmp(value, "keep-alive") == 0)
                     found_keep_alive = 1;
-                else if (strcasecmp(value, "close") == 0)
+                else if (OPENSSL_strcasecmp(value, "close") == 0)
                     found_keep_alive = 0;
-            } else if (strcasecmp(key, "Content-Length") == 0) {
+            } else if (OPENSSL_strcasecmp(key, "Content-Length") == 0) {
                 resp_len = (size_t)strtoul(value, &line_end, 10);
                 if (line_end == value || *line_end != '\0') {
Index: /trunk/src/libs/openssl-3.0.3/crypto/init.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/init.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/init.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -33,4 +33,5 @@
 #include <openssl/cmp_util.h> /* for OSSL_CMP_log_close() */
 #include <openssl/trace.h>
+#include "crypto/ctype.h"
 
 static int stopped = 0;
@@ -448,4 +449,7 @@
     ossl_trace_cleanup();
 
+    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_deinit_casecmp()\n");
+    ossl_deinit_casecmp();
+
     base_inited = 0;
 }
@@ -460,4 +464,7 @@
     uint64_t tmp;
     int aloaddone = 0;
+
+    if (!ossl_init_casecmp())
+        return 0;
 
    /* Applications depend on 0 being returned when cleanup was already done */
Index: /trunk/src/libs/openssl-3.0.3/crypto/lhash/lh_stats.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/lhash/lh_stats.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/lhash/lh_stats.c	(revision 95219)
@@ -62,35 +62,20 @@
 void OPENSSL_LH_stats_bio(const OPENSSL_LHASH *lh, BIO *out)
 {
-    int omit_tsan = 0;
-
-#ifdef TSAN_REQUIRES_LOCKING
-    if (!CRYPTO_THREAD_read_lock(lh->tsan_lock)) {
-        BIO_printf(out, "unable to lock table, omitting TSAN counters\n");
-        omit_tsan = 1;
-    }
-#endif
     BIO_printf(out, "num_items             = %lu\n", lh->num_items);
     BIO_printf(out, "num_nodes             = %u\n",  lh->num_nodes);
     BIO_printf(out, "num_alloc_nodes       = %u\n",  lh->num_alloc_nodes);
-    BIO_printf(out, "num_expands           = %lu\n", lh->num_expands);
-    BIO_printf(out, "num_expand_reallocs   = %lu\n", lh->num_expand_reallocs);
-    BIO_printf(out, "num_contracts         = %lu\n", lh->num_contracts);
-    BIO_printf(out, "num_contract_reallocs = %lu\n", lh->num_contract_reallocs);
-    if (!omit_tsan) {
-        BIO_printf(out, "num_hash_calls        = %lu\n", lh->num_hash_calls);
-        BIO_printf(out, "num_comp_calls        = %lu\n", lh->num_comp_calls);
-    }
-    BIO_printf(out, "num_insert            = %lu\n", lh->num_insert);
-    BIO_printf(out, "num_replace           = %lu\n", lh->num_replace);
-    BIO_printf(out, "num_delete            = %lu\n", lh->num_delete);
-    BIO_printf(out, "num_no_delete         = %lu\n", lh->num_no_delete);
-    if (!omit_tsan) {
-        BIO_printf(out, "num_retrieve          = %lu\n", lh->num_retrieve);
-        BIO_printf(out, "num_retrieve_miss     = %lu\n", lh->num_retrieve_miss);
-        BIO_printf(out, "num_hash_comps        = %lu\n", lh->num_hash_comps);
-#ifdef TSAN_REQUIRES_LOCKING
-        CRYPTO_THREAD_unlock(lh->tsan_lock);
-#endif
-    }
+    BIO_printf(out, "num_expands           = 0\n");
+    BIO_printf(out, "num_expand_reallocs   = 0\n");
+    BIO_printf(out, "num_contracts         = 0\n");
+    BIO_printf(out, "num_contract_reallocs = 0\n");
+    BIO_printf(out, "num_hash_calls        = 0\n");
+    BIO_printf(out, "num_comp_calls        = 0\n");
+    BIO_printf(out, "num_insert            = 0\n");
+    BIO_printf(out, "num_replace           = 0\n");
+    BIO_printf(out, "num_delete            = 0\n");
+    BIO_printf(out, "num_no_delete         = 0\n");
+    BIO_printf(out, "num_retrieve          = 0\n");
+    BIO_printf(out, "num_retrieve_miss     = 0\n");
+    BIO_printf(out, "num_hash_comps        = 0\n");
 }
 
Index: /trunk/src/libs/openssl-3.0.3/crypto/lhash/lhash.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/lhash/lhash.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/lhash/lhash.c	(revision 95219)
@@ -45,20 +45,4 @@
 static OPENSSL_LH_NODE **getrn(OPENSSL_LHASH *lh, const void *data, unsigned long *rhash);
 
-static ossl_inline int tsan_lock(const OPENSSL_LHASH *lh)
-{
-#ifdef TSAN_REQUIRES_LOCKING
-    if (!CRYPTO_THREAD_write_lock(lh->tsan_lock))
-        return 0;
-#endif
-    return 1;
-}
-
-static ossl_inline void tsan_unlock(const OPENSSL_LHASH *lh)
-{
-#ifdef TSAN_REQUIRES_LOCKING
-    CRYPTO_THREAD_unlock(lh->tsan_lock);
-#endif
-}
-
 OPENSSL_LHASH *OPENSSL_LH_new(OPENSSL_LH_HASHFUNC h, OPENSSL_LH_COMPFUNC c)
 {
@@ -75,8 +59,4 @@
     if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
         goto err;
-#ifdef TSAN_REQUIRES_LOCKING
-    if ((ret->tsan_lock = CRYPTO_THREAD_lock_new()) == NULL)
-        goto err;
-#endif
     ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c);
     ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h);
@@ -100,7 +80,4 @@
 
     OPENSSL_LH_flush(lh);
-#ifdef TSAN_REQUIRES_LOCKING
-    CRYPTO_THREAD_lock_free(lh->tsan_lock);
-#endif
     OPENSSL_free(lh->b);
     OPENSSL_free(lh);
@@ -124,4 +101,6 @@
         lh->b[i] = NULL;
     }
+
+    lh->num_items = 0;
 }
 
@@ -148,10 +127,8 @@
         *rn = nn;
         ret = NULL;
-        lh->num_insert++;
         lh->num_items++;
     } else {                    /* replace same key */
         ret = (*rn)->data;
         (*rn)->data = data;
-        lh->num_replace++;
     }
     return ret;
@@ -168,5 +145,4 @@
 
     if (*rn == NULL) {
-        lh->num_no_delete++;
         return NULL;
     } else {
@@ -175,5 +151,4 @@
         ret = nn->data;
         OPENSSL_free(nn);
-        lh->num_delete++;
     }
 
@@ -191,16 +166,9 @@
     OPENSSL_LH_NODE **rn;
 
-    /*-
-     * This should be atomic without tsan.
-     * It's not clear why it was done this way and not elsewhere.
-     */
-    tsan_store((TSAN_QUALIFIER int *)&lh->error, 0);
+    if (lh->error != 0)
+        lh->error = 0;
 
     rn = getrn(lh, data, &hash);
 
-    if (tsan_lock(lh)) {
-        tsan_counter(*rn == NULL ? &lh->num_retrieve_miss : &lh->num_retrieve);
-        tsan_unlock(lh);
-    }
     return *rn == NULL ? NULL : (*rn)->data;
 }
@@ -263,5 +231,4 @@
         lh->pmax = nni;
         lh->num_alloc_nodes = j;
-        lh->num_expand_reallocs++;
         lh->p = 0;
     } else {
@@ -270,5 +237,4 @@
 
     lh->num_nodes++;
-    lh->num_expands++;
     n1 = &(lh->b[p]);
     n2 = &(lh->b[p + pmax]);
@@ -303,5 +269,4 @@
             return;
         }
-        lh->num_contract_reallocs++;
         lh->num_alloc_nodes /= 2;
         lh->pmax /= 2;
@@ -312,5 +277,4 @@
 
     lh->num_nodes--;
-    lh->num_contracts++;
 
     n1 = lh->b[(int)lh->p];
@@ -330,12 +294,6 @@
     unsigned long hash, nn;
     OPENSSL_LH_COMPFUNC cf;
-    int do_tsan = 1;
-
-#ifdef TSAN_REQUIRES_LOCKING
-    do_tsan = tsan_lock(lh);
-#endif
+
     hash = (*(lh->hash)) (data);
-    if (do_tsan)
-        tsan_counter(&lh->num_hash_calls);
     *rhash = hash;
 
@@ -347,18 +305,12 @@
     ret = &(lh->b[(int)nn]);
     for (n1 = *ret; n1 != NULL; n1 = n1->next) {
-        if (do_tsan)
-            tsan_counter(&lh->num_hash_comps);
         if (n1->hash != hash) {
             ret = &(n1->next);
             continue;
         }
-        if (do_tsan)
-            tsan_counter(&lh->num_comp_calls);
         if (cf(n1->data, data) == 0)
             break;
         ret = &(n1->next);
     }
-    if (do_tsan)
-        tsan_unlock(lh);
     return ret;
 }
Index: /trunk/src/libs/openssl-3.0.3/crypto/lhash/lhash_local.h
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/lhash/lhash_local.h	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/lhash/lhash_local.h	(revision 95219)
@@ -28,20 +28,4 @@
     unsigned long down_load;    /* load times 256 */
     unsigned long num_items;
-    unsigned long num_expands;
-    unsigned long num_expand_reallocs;
-    unsigned long num_contracts;
-    unsigned long num_contract_reallocs;
-    TSAN_QUALIFIER unsigned long num_hash_calls;
-    TSAN_QUALIFIER unsigned long num_comp_calls;
-    unsigned long num_insert;
-    unsigned long num_replace;
-    unsigned long num_delete;
-    unsigned long num_no_delete;
-    TSAN_QUALIFIER unsigned long num_retrieve;
-    TSAN_QUALIFIER unsigned long num_retrieve_miss;
-    TSAN_QUALIFIER unsigned long num_hash_comps;
     int error;
-#ifdef TSAN_REQUIRES_LOCKING
-    CRYPTO_RWLOCK *tsan_lock;
-#endif
 };
Index: /trunk/src/libs/openssl-3.0.3/crypto/objects/o_names.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/objects/o_names.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/objects/o_names.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 1998-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1998-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -23,21 +23,4 @@
 
 /*
- * We define this wrapper for two reasons. Firstly, later versions of
- * DEC C add linkage information to certain functions, which makes it
- * tricky to use them as values to regular function pointers.
- * Secondly, in the EDK2 build environment, the strcasecmp function is
- * actually an external function with the Microsoft ABI, so we can't
- * transparently assign function pointers to it.
- */
-#if defined(OPENSSL_SYS_VMS_DECC) || defined(OPENSSL_SYS_UEFI)
-static int obj_strcasecmp(const char *a, const char *b)
-{
-    return strcasecmp(a, b);
-}
-#else
-#define obj_strcasecmp strcasecmp
-#endif
-
-/*
  * I use the ex_data stuff to manage the identifiers for the obj_name_types
  * that applications may define.  I only really use the free function field.
@@ -112,5 +95,5 @@
         }
         name_funcs->hash_func = ossl_lh_strcasehash;
-        name_funcs->cmp_func = obj_strcasecmp;
+        name_funcs->cmp_func = OPENSSL_strcasecmp;
         push = sk_NAME_FUNCS_push(name_funcs_stack, name_funcs);
 
@@ -146,5 +129,5 @@
                                       a->type)->cmp_func(a->name, b->name);
         } else
-            ret = strcasecmp(a->name, b->name);
+            ret = OPENSSL_strcasecmp(a->name, b->name);
     }
     return ret;
Index: /trunk/src/libs/openssl-3.0.3/crypto/ocsp/ocsp_vfy.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/ocsp/ocsp_vfy.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/ocsp/ocsp_vfy.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -60,7 +60,8 @@
     ret = X509_verify_cert(ctx);
     if (ret <= 0) {
-        ret = X509_STORE_CTX_get_error(ctx);
+        int err = X509_STORE_CTX_get_error(ctx);
+
         ERR_raise_data(ERR_LIB_OCSP, OCSP_R_CERTIFICATE_VERIFY_ERROR,
-                       "Verify error: %s", X509_verify_cert_error_string(ret));
+                       "Verify error: %s", X509_verify_cert_error_string(err));
         goto end;
     }
Index: /trunk/src/libs/openssl-3.0.3/crypto/params_dup.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/params_dup.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/params_dup.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -12,5 +12,4 @@
 #include <openssl/param_build.h>
 #include "internal/param_build_set.h"
-#include "e_os.h" /* strcasecmp */
 
 #define OSSL_PARAM_ALLOCATED_END    127
@@ -143,5 +142,5 @@
     const OSSL_PARAM *r = *(const OSSL_PARAM **)right;
 
-    return strcasecmp(l->key, r->key);
+    return OPENSSL_strcasecmp(l->key, r->key);
 }
 
@@ -206,5 +205,5 @@
         }
         /* consume the list element with the smaller key */
-        diff = strcasecmp((*p1cur)->key, (*p2cur)->key);
+        diff = OPENSSL_strcasecmp((*p1cur)->key, (*p2cur)->key);
         if (diff == 0) {
             /* If the keys are the same then throw away the list1 element */
Index: unk/src/libs/openssl-3.0.3/crypto/poly1305/asm/poly1305-ia64.S
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/poly1305/asm/poly1305-ia64.S	(revision 95218)
+++ 	(revision )
@@ -1,365 +1,0 @@
-// ====================================================================
-// Written by Andy Polyakov, @dot-asm, initially for use in the OpenSSL
-// project.
-// ====================================================================
-//
-// Poly1305 for Itanium.
-//
-// January 2019
-//
-// Performance was reported to be ~2.1 cycles per byte on Itanium 2.
-// With exception for processors in 95xx family, which have higher
-// floating-point instructions' latencies and deliver ~2.6 cpb.
-// Comparison to compiler-generated code is not exactly fair, because
-// of different radixes. But just for reference, it was observed to be
-// >3x faster. Originally it was argued that floating-point base 2^32
-// implementation would be optimal. Upon closer look estimate for below
-// integer base 2^64 implementation turned to be approximately same on
-// Itanium 2. But floating-point code would be larger, and have higher
-// overhead, which would negatively affect small-block performance...
-
-#if defined(_HPUX_SOURCE)
-# if !defined(_LP64)
-#  define ADDP  addp4
-# else
-#  define ADDP  add
-# endif
-# define RUM    rum
-# define SUM    sum
-#else
-# define ADDP   add
-# define RUM    nop
-# define SUM    nop
-#endif
-
-.text
-.explicit
-
-.global	poly1305_init#
-.proc	poly1305_init#
-.align	64
-poly1305_init:
-	.prologue
-	.save		ar.pfs,r2
-{ .mmi;	alloc		r2=ar.pfs,2,0,0,0
-	cmp.eq		p6,p7=0,r33		}	// key == NULL?
-{ .mmi;	ADDP		r9=8,r32
-	ADDP		r10=16,r32
-	ADDP		r32=0,r32		};;
-	.body
-{ .mmi;	st8		[r32]=r0,24			// ctx->h0 = 0
-	st8		[r9]=r0				// ctx->h1 = 0
-(p7)	ADDP		r8=0,r33		}
-{ .mib;	st8		[r10]=r0			// ctx->h2 = 0
-(p6)	mov		r8=0
-(p6)	br.ret.spnt	b0			};;
-
-{ .mmi;	ADDP		r9=1,r33
-	ADDP		r10=2,r33
-	ADDP		r11=3,r33		};;
-{ .mmi;	ld1		r16=[r8],4			// load key, little-endian
-	ld1		r17=[r9],4		}
-{ .mmi;	ld1		r18=[r10],4
-	ld1		r19=[r11],4		};;
-{ .mmi;	ld1		r20=[r8],4
-	ld1		r21=[r9],4		}
-{ .mmi;	ld1		r22=[r10],4
-	ld1		r23=[r11],4
-	and		r19=15,r19		};;
-{ .mmi;	ld1		r24=[r8],4
-	ld1		r25=[r9],4
-	and		r20=-4,r20		}
-{ .mmi;	ld1		r26=[r10],4
-	ld1		r27=[r11],4
-	and		r23=15,r23		};;
-{ .mmi;	ld1		r28=[r8],4
-	ld1		r29=[r9],4
-	and		r24=-4,r24		}
-{ .mmi;	ld1		r30=[r10],4
-	ld1		r31=[r11],4
-	and		r27=15,r27		};;
-
-{ .mii;	and		r28=-4,r28
-	dep		r16=r17,r16,8,8
-	dep		r18=r19,r18,8,8		};;
-{ .mii;	and		r31=15,r31
-	dep		r16=r18,r16,16,16
-	dep		r20=r21,r20,8,8		};;
-{ .mii;	dep		r16=r20,r16,32,16
-	dep		r22=r23,r22,8,8		};;
-{ .mii;	dep		r16=r22,r16,48,16
-	dep		r24=r25,r24,8,8		};;
-{ .mii;	dep		r26=r27,r26,8,8
-	dep		r28=r29,r28,8,8		};;
-{ .mii;	dep		r24=r26,r24,16,16
-	dep		r30=r31,r30,8,8		};;
-{ .mii;	st8		[r32]=r16,8			// ctx->r0
-	dep		r24=r28,r24,32,16;;
-	dep		r24=r30,r24,48,16	};;
-{ .mii;	st8		[r32]=r24,8			// ctx->r1
-	shr.u		r25=r24,2;;
-	add		r25=r25,r24		};;
-{ .mib; st8		[r32]=r25			// ctx->s1
-	mov		r8=0
-	br.ret.sptk	b0			};;
-.endp	poly1305_init#
-
-h0=r17;  h1=r18;  h2=r19;
-i0=r20;  i1=r21;
-HF0=f8;  HF1=f9;  HF2=f10;
-RF0=f11; RF1=f12; SF1=f13;
-
-.global	poly1305_blocks#
-.proc	poly1305_blocks#
-.align	64
-poly1305_blocks:
-	.prologue
-	.save		ar.pfs,r2
-{ .mii;	alloc		r2=ar.pfs,4,1,0,0
-	.save		ar.lc,r3
-	mov		r3=ar.lc
-	.save		pr,r36
-	mov		r36=pr			}
-
-	.body
-{ .mmi;	ADDP		r8=0,r32
-	ADDP		r9=8,r32
-	and		r29=7,r33		};;
-{ .mmi;	ld8		h0=[r8],16
-	ld8		h1=[r9],16
-	and		r33=-8,r33		};;
-{ .mmi;	ld8		h2=[r8],16
-	ldf8		RF0=[r9],16
-	shr.u		r34=r34,4		};;
-{ .mmi;	ldf8		RF1=[r8],-32
-	ldf8		SF1=[r9],-32
-	cmp.ltu		p16,p17=1,r34		};;
-{ .mmi;
-(p16)	add		r34=-2,r34
-(p17)	mov		r34=0
-	ADDP		r10=0,r33		}
-{ .mii;	ADDP		r11=8,r33
-(p16)	mov		ar.ec=2
-(p17)	mov		ar.ec=1			};;
-{ .mib;	RUM		1<<1				// go little-endian
-	mov		ar.lc=r34
-	brp.loop.imp	.Loop,.Lcend-16		}
-
-{ .mmi;	cmp.eq		p8,p7=0,r29
-	cmp.eq		p9,p0=1,r29
-	cmp.eq		p10,p0=2,r29		}
-{ .mmi;	cmp.eq		p11,p0=3,r29
-	cmp.eq		p12,p0=4,r29
-	cmp.eq		p13,p0=5,r29		}
-{ .mmi;	cmp.eq		p14,p0=6,r29
-	cmp.eq		p15,p0=7,r29
-	add		r16=16,r10		};;
-
-{ .mmb;
-(p8)	ld8		i0=[r10],16			// aligned input
-(p8)	ld8		i1=[r11],16
-(p8)	br.cond.sptk	.Loop			};;
-
-	// align first block
-	.pred.rel	"mutex",p8,p9,p10,p11,p12,p13,p14,p15
-{ .mmi;	(p7)	ld8		r14=[r10],24
-	(p7)	ld8		r15=[r11],24		}
-
-{ .mii;	(p7)	ld8		r16=[r16]
-		nop.i		0;;
-	(p15)	shrp		i0=r15,r14,56		}
-{ .mii;	(p15)	shrp		i1=r16,r15,56
-	(p14)	shrp		i0=r15,r14,48		}
-{ .mii;	(p14)	shrp		i1=r16,r15,48
-	(p13)	shrp		i0=r15,r14,40		}
-{ .mii;	(p13)	shrp		i1=r16,r15,40
-	(p12)	shrp		i0=r15,r14,32		}
-{ .mii;	(p12)	shrp		i1=r16,r15,32
-	(p11)	shrp		i0=r15,r14,24		}
-{ .mii;	(p11)	shrp		i1=r16,r15,24
-	(p10)	shrp		i0=r15,r14,16		}
-{ .mii;	(p10)	shrp		i1=r16,r15,16
-	(p9)	shrp		i0=r15,r14,8		}
-{ .mii;	(p9)	shrp		i1=r16,r15,8
-		mov		r14=r16			};;
-
-.Loop:
-		.pred.rel	"mutex",p8,p9,p10,p11,p12,p13,p14,p15
-{ .mmi;		add		h0=h0,i0
-		add		h1=h1,i1
-		add		h2=h2,r35		};;
-{ .mmi;		setf.sig	HF0=h0
-		cmp.ltu		p6,p0=h0,i0
-		cmp.ltu		p7,p0=h1,i1		};;
-{ .mmi;	(p6)	add		h1=1,h1;;
-		setf.sig	HF1=h1
-	(p6)	cmp.eq.or	p7,p0=0,h1		};;
-{ .mmi;	(p7)	add		h2=1,h2;;
-		setf.sig	HF2=h2			};;
-
-{ .mfi;	(p16)	ld8		r15=[r10],16
-		xmpy.lu		f32=HF0,RF0		}
-{ .mfi;	(p16)	ld8		r16=[r11],16
-		xmpy.hu		f33=HF0,RF0		}
-{ .mfi;		xmpy.lu		f36=HF0,RF1		}
-{ .mfi;		xmpy.hu		f37=HF0,RF1		};;
-{ .mfi;		xmpy.lu		f34=HF1,SF1
-	(p15)	shrp		i0=r15,r14,56		}
-{ .mfi;		xmpy.hu		f35=HF1,SF1		}
-{ .mfi;		xmpy.lu		f38=HF1,RF0
-	(p15)	shrp		i1=r16,r15,56		}
-{ .mfi;		xmpy.hu		f39=HF1,RF0		}
-{ .mfi;		xmpy.lu		f40=HF2,SF1
-	(p14)	shrp		i0=r15,r14,48		}
-{ .mfi;		xmpy.lu		f41=HF2,RF0		};;
-
-{ .mmi;		getf.sig	r22=f32
-		getf.sig	r23=f33
-	(p14)	shrp		i1=r16,r15,48		}
-{ .mmi;		getf.sig	r24=f34
-		getf.sig	r25=f35
-	(p13)	shrp		i0=r15,r14,40		}
-{ .mmi;		getf.sig	r26=f36
-		getf.sig	r27=f37
-	(p13)	shrp		i1=r16,r15,40		}
-{ .mmi;		getf.sig	r28=f38
-		getf.sig	r29=f39
-	(p12)	shrp		i0=r15,r14,32		}
-{ .mmi;		getf.sig	r30=f40
-		getf.sig	r31=f41			};;
-
-{ .mmi;		add		h0=r22,r24
-		add		r23=r23,r25
-	(p12)	shrp		i1=r16,r15,32		}
-{ .mmi;		add		h1=r26,r28
-		add		r27=r27,r29
-	(p11)	shrp		i0=r15,r14,24		};;
-{ .mmi;		cmp.ltu		p6,p0=h0,r24
-		cmp.ltu		p7,p0=h1,r28
-		add		r23=r23,r30		};;
-{ .mmi;	(p6)	add		r23=1,r23
-	(p7)	add		r27=1,r27
-	(p11)	shrp		i1=r16,r15,24		};;
-{ .mmi;		add		h1=h1,r23;;
-		cmp.ltu		p6,p7=h1,r23
-	(p10)	shrp		i0=r15,r14,16		};;
-{ .mmi;	(p6)	add		h2=r31,r27,1
-	(p7)	add		h2=r31,r27
-	(p10)	shrp		i1=r16,r15,16		};;
-
-{ .mmi;	(p8)	mov		i0=r15
-		and		r22=-4,h2
-		shr.u		r23=h2,2		};;
-{ .mmi;		add		r22=r22,r23
-		and		h2=3,h2
-	(p9)	shrp		i0=r15,r14,8		};;
-
-{ .mmi;		add		h0=h0,r22;;
-		cmp.ltu		p6,p0=h0,r22
-	(p9)	shrp		i1=r16,r15,8		};;
-{ .mmi;	(p8)	mov		i1=r16
-	(p6)	cmp.eq.unc	p7,p0=-1,h1
-	(p6)	add		h1=1,h1			};;
-{ .mmb;	(p7)	add		h2=1,h2
-		mov		r14=r16
-		br.ctop.sptk	.Loop			};;
-.Lcend:
-
-{ .mii;	SUM		1<<1				// back to big-endian
-	mov		ar.lc=r3		};;
-
-{ .mmi;	st8		[r8]=h0,16
-	st8		[r9]=h1
-	mov		pr=r36,0x1ffff		};;
-{ .mmb;	st8		[r8]=h2
-	rum		1<<5
-	br.ret.sptk	b0			};;
-.endp	poly1305_blocks#
-
-.global	poly1305_emit#
-.proc	poly1305_emit#
-.align	64
-poly1305_emit:
-	.prologue
-	.save		ar.pfs,r2
-{ .mmi;	alloc		r2=ar.pfs,3,0,0,0
-	ADDP		r8=0,r32
-	ADDP		r9=8,r32		};;
-
-	.body
-{ .mmi;	ld8		r16=[r8],16			// load hash
-	ld8		r17=[r9]
-	ADDP		r10=0,r34		};;
-{ .mmi;	ld8		r18=[r8]
-	ld4		r24=[r10],8			// load nonce
-	ADDP		r11=4,r34		};;
-
-{ .mmi;	ld4		r25=[r11],8
-	ld4		r26=[r10]
-	add		r20=5,r16		};;
-
-{ .mmi;	ld4		r27=[r11]
-	cmp.ltu		p6,p7=r20,r16
-	shl		r25=r25,32		};;
-{ .mmi;
-(p6)	add		r21=1,r17
-(p7)	add		r21=0,r17
-(p6)	cmp.eq.or.andcm	p6,p7=-1,r17		};;
-{ .mmi;
-(p6)	add		r22=1,r18
-(p7)	add		r22=0,r18
-	shl		r27=r27,32		};;
-{ .mmi;	or		r24=r24,r25
-	or		r26=r26,r27
-	cmp.leu		p6,p7=4,r22		};;
-{ .mmi;
-(p6)	add		r16=r20,r24
-(p7)	add		r16=r16,r24
-(p6)	add		r17=r21,r26		};;
-{ .mii;
-(p7)	add		r17=r17,r26
-	cmp.ltu		p6,p7=r16,r24;;
-(p6)	add		r17=1,r17		};;
-
-{ .mmi;	ADDP		r8=0,r33
-	ADDP		r9=4,r33
-	shr.u		r20=r16,32		}
-{ .mmi;	ADDP		r10=8,r33
-	ADDP		r11=12,r33
-	shr.u		r21=r17,32		};;
-
-{ .mmi;	st1		[r8]=r16,1			// write mac, little-endian
-	st1		[r9]=r20,1
-	shr.u		r16=r16,8		}
-{ .mii;	st1		[r10]=r17,1
-	shr.u		r20=r20,8
-	shr.u		r17=r17,8		}
-{ .mmi;	st1		[r11]=r21,1
-	shr.u		r21=r21,8		};;
-
-{ .mmi;	st1		[r8]=r16,1
-	st1		[r9]=r20,1
-	shr.u		r16=r16,8		}
-{ .mii;	st1		[r10]=r17,1
-	shr.u		r20=r20,8
-	shr.u		r17=r17,8		}
-{ .mmi;	st1		[r11]=r21,1
-	shr.u		r21=r21,8		};;
-
-{ .mmi;	st1		[r8]=r16,1
-	st1		[r9]=r20,1
-	shr.u		r16=r16,8		}
-{ .mii;	st1		[r10]=r17,1
-	shr.u		r20=r20,8
-	shr.u		r17=r17,8		}
-{ .mmi;	st1		[r11]=r21,1
-	shr.u		r21=r21,8		};;
-
-{ .mmi;	st1		[r8]=r16
-	st1		[r9]=r20		}
-{ .mmb;	st1		[r10]=r17
-	st1		[r11]=r21
-	br.ret.sptk	b0			};;
-.endp	poly1305_emit#
-
-stringz	"Poly1305 for IA64, CRYPTOGAMS by \@dot-asm"
Index: /trunk/src/libs/openssl-3.0.3/crypto/poly1305/build.info
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/poly1305/build.info	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/poly1305/build.info	(revision 95219)
@@ -6,5 +6,5 @@
   $POLY1305ASM_x86_64=poly1305-x86_64.s
 
-  $POLY1305ASM_ia64=asm/poly1305-ia64.S
+  $POLY1305ASM_ia64=asm/poly1305-ia64.s
 
   $POLY1305ASM_sparcv9=poly1305-sparcv9.S
Index: /trunk/src/libs/openssl-3.0.3/crypto/property/property_parse.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/property/property_parse.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/property/property_parse.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright (c) 2019, Oracle and/or its affiliates.  All rights reserved.
  *
@@ -46,5 +46,5 @@
     const char *s = *t;
 
-    if (strncasecmp(s, m, m_len) == 0) {
+    if (OPENSSL_strncasecmp(s, m, m_len) == 0) {
         *t = skip_space(s + m_len);
         return 1;
Index: /trunk/src/libs/openssl-3.0.3/crypto/rand/rand_lib.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/rand/rand_lib.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/rand/rand_lib.c	(revision 95219)
@@ -769,20 +769,20 @@
     for (i = 0; i < sk_CONF_VALUE_num(elist); i++) {
         cval = sk_CONF_VALUE_value(elist, i);
-        if (strcasecmp(cval->name, "random") == 0) {
+        if (OPENSSL_strcasecmp(cval->name, "random") == 0) {
             if (!random_set_string(&dgbl->rng_name, cval->value))
                 return 0;
-        } else if (strcasecmp(cval->name, "cipher") == 0) {
+        } else if (OPENSSL_strcasecmp(cval->name, "cipher") == 0) {
             if (!random_set_string(&dgbl->rng_cipher, cval->value))
                 return 0;
-        } else if (strcasecmp(cval->name, "digest") == 0) {
+        } else if (OPENSSL_strcasecmp(cval->name, "digest") == 0) {
             if (!random_set_string(&dgbl->rng_digest, cval->value))
                 return 0;
-        } else if (strcasecmp(cval->name, "properties") == 0) {
+        } else if (OPENSSL_strcasecmp(cval->name, "properties") == 0) {
             if (!random_set_string(&dgbl->rng_propq, cval->value))
                 return 0;
-        } else if (strcasecmp(cval->name, "seed") == 0) {
+        } else if (OPENSSL_strcasecmp(cval->name, "seed") == 0) {
             if (!random_set_string(&dgbl->seed_name, cval->value))
                 return 0;
-        } else if (strcasecmp(cval->name, "seed_properties") == 0) {
+        } else if (OPENSSL_strcasecmp(cval->name, "seed_properties") == 0) {
             if (!random_set_string(&dgbl->seed_propq, cval->value))
                 return 0;
Index: /trunk/src/libs/openssl-3.0.3/crypto/rsa/rsa_backend.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/rsa/rsa_backend.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/rsa/rsa_backend.c	(revision 95219)
@@ -27,6 +27,4 @@
 #include "crypto/rsa.h"
 #include "rsa_local.h"
-
-#include "e_os.h"                /* strcasecmp for Windows() */
 
 /*
@@ -276,6 +274,6 @@
             return 0;
 
-        if (strcasecmp(param_mgf->data,
-                       ossl_rsa_mgf_nid2name(default_maskgenalg_nid)) != 0)
+        if (OPENSSL_strcasecmp(param_mgf->data,
+                               ossl_rsa_mgf_nid2name(default_maskgenalg_nid)) != 0)
             return 0;
     }
Index: /trunk/src/libs/openssl-3.0.3/crypto/s390x_arch.h
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/s390x_arch.h	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/s390x_arch.h	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -73,4 +73,7 @@
 };
 
+#if defined(__GNUC__) && defined(__linux)
+__attribute__ ((visibility("hidden")))
+#endif
 extern struct OPENSSL_s390xcap_st OPENSSL_s390xcap_P;
 
Index: /trunk/src/libs/openssl-3.0.3/crypto/s390xcap.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/s390xcap.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/s390xcap.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2010-2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2010-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -75,4 +75,7 @@
 struct OPENSSL_s390xcap_st OPENSSL_s390xcap_P;
 
+#if defined(__GNUC__) && defined(__linux)
+__attribute__ ((visibility("hidden")))
+#endif
 void OPENSSL_cpuid_setup(void)
 {
Index: /trunk/src/libs/openssl-3.0.3/crypto/siphash/siphash.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/siphash/siphash.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/siphash/siphash.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -205,5 +205,5 @@
     uint64_t v3 = ctx->v3;
 
-    if (outlen != (size_t)ctx->hash_size)
+    if (ctx->crounds == 0 || outlen == 0 || outlen != (size_t)ctx->hash_size)
         return 0;
 
Index: /trunk/src/libs/openssl-3.0.3/crypto/sparse_array.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/sparse_array.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/sparse_array.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright (c) 2019, Oracle and/or its affiliates.  All rights reserved.
  *
@@ -20,22 +20,17 @@
  * direct space versus time tradeoff.
  *
- * The large memory model uses twelve bits which means that the are 4096
- * pointers in each tree node.  This is more than sufficient to hold the
- * largest defined NID (as of Feb 2019).  This means that using a NID to
- * index a sparse array becomes a constant time single array look up.
- *
- * The small memory model uses four bits which means the tree nodes contain
- * sixteen pointers.  This reduces the amount of unused space significantly
- * at a cost in time.
+ * The default is to use four bits which means that the are 16
+ * pointers in each tree node.
  *
  * The library builder is also permitted to define other sizes in the closed
- * interval [2, sizeof(ossl_uintmax_t) * 8].
+ * interval [2, sizeof(ossl_uintmax_t) * 8].  Space use generally scales
+ * exponentially with the block size, although the implementation only
+ * creates enough blocks to support the largest used index.  The depth is:
+ *      ceil(log_2(largest index) / 2^{block size})
+ * E.g. with a block size of 4, and a largest index of 1000, the depth
+ * will be three.
  */
 #ifndef OPENSSL_SA_BLOCK_BITS
-# ifdef OPENSSL_SMALL_FOOTPRINT
-#  define OPENSSL_SA_BLOCK_BITS           4
-# else
-#  define OPENSSL_SA_BLOCK_BITS           12
-# endif
+# define OPENSSL_SA_BLOCK_BITS           4
 #elif OPENSSL_SA_BLOCK_BITS < 2 || OPENSSL_SA_BLOCK_BITS > (BN_BITS2 - 1)
 # error OPENSSL_SA_BLOCK_BITS is out of range
Index: /trunk/src/libs/openssl-3.0.3/crypto/store/store_lib.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/store/store_lib.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/store/store_lib.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -94,5 +94,5 @@
     if ((p = strchr(scheme_copy, ':')) != NULL) {
         *p++ = '\0';
-        if (strcasecmp(scheme_copy, "file") != 0) {
+        if (OPENSSL_strcasecmp(scheme_copy, "file") != 0) {
             if (strncmp(p, "//", 2) == 0)
                 schemes_n--;         /* Invalidate the file scheme */
Index: /trunk/src/libs/openssl-3.0.3/crypto/store/store_result.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/store/store_result.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/store/store_result.c	(revision 95219)
@@ -458,5 +458,5 @@
         /* If we have a data type, it should be a PEM name */
         if (data->data_type != NULL
-            && (strcasecmp(data->data_type, PEM_STRING_X509_TRUSTED) == 0))
+            && (OPENSSL_strcasecmp(data->data_type, PEM_STRING_X509_TRUSTED) == 0))
             ignore_trusted = 0;
 
Index: /trunk/src/libs/openssl-3.0.3/crypto/threads_pthread.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/threads_pthread.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/threads_pthread.c	(revision 95219)
@@ -16,4 +16,16 @@
 #if defined(__sun)
 # include <atomic.h>
+#endif
+
+#if defined(__apple_build_version__) && __apple_build_version__ < 6000000
+/*
+ * OS/X 10.7 and 10.8 had a weird version of clang which has __ATOMIC_ACQUIRE and
+ * __ATOMIC_ACQ_REL but which expects only one parameter for __atomic_is_lock_free()
+ * rather than two which has signature __atomic_is_lock_free(sizeof(_Atomic(T))).
+ * All of this makes impossible to use __atomic_is_lock_free here.
+ *
+ * See: https://github.com/llvm/llvm-project/commit/a4c2602b714e6c6edb98164550a5ae829b2de760
+ */
+#define BROKEN_CLANG_ATOMICS
 #endif
 
@@ -189,5 +201,5 @@
 int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock)
 {
-# if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL)
+# if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) && !defined(BROKEN_CLANG_ATOMICS)
     if (__atomic_is_lock_free(sizeof(*val), val)) {
         *ret = __atomic_add_fetch(val, amount, __ATOMIC_ACQ_REL);
@@ -216,5 +228,5 @@
                      CRYPTO_RWLOCK *lock)
 {
-# if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL)
+# if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) && !defined(BROKEN_CLANG_ATOMICS)
     if (__atomic_is_lock_free(sizeof(*val), val)) {
         *ret = __atomic_or_fetch(val, op, __ATOMIC_ACQ_REL);
@@ -241,5 +253,5 @@
 int CRYPTO_atomic_load(uint64_t *val, uint64_t *ret, CRYPTO_RWLOCK *lock)
 {
-# if defined(__GNUC__) && defined(__ATOMIC_ACQUIRE)
+# if defined(__GNUC__) && defined(__ATOMIC_ACQUIRE) && !defined(BROKEN_CLANG_ATOMICS)
     if (__atomic_is_lock_free(sizeof(*val), val)) {
         __atomic_load(val, ret, __ATOMIC_ACQUIRE);
Index: /trunk/src/libs/openssl-3.0.3/crypto/trace.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/trace.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/trace.c	(revision 95219)
@@ -19,6 +19,4 @@
 #include "internal/refcount.h"
 #include "crypto/cryptlib.h"
-
-#include "e_os.h"                /* strcasecmp for Windows */
 
 #ifndef OPENSSL_NO_TRACE
@@ -159,5 +157,5 @@
 
     for (i = 0; i < OSSL_NELEM(trace_categories); i++)
-        if (strcasecmp(name, trace_categories[i].name) == 0)
+        if (OPENSSL_strcasecmp(name, trace_categories[i].name) == 0)
             return trace_categories[i].num;
     return -1; /* not found */
Index: /trunk/src/libs/openssl-3.0.3/crypto/x509/v3_tlsf.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/x509/v3_tlsf.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/x509/v3_tlsf.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -109,5 +109,5 @@
 
         for (j = 0; j < OSSL_NELEM(tls_feature_tbl); j++)
-            if (strcasecmp(extval, tls_feature_tbl[j].name) == 0)
+            if (OPENSSL_strcasecmp(extval, tls_feature_tbl[j].name) == 0)
                 break;
         if (j < OSSL_NELEM(tls_feature_tbl))
Index: /trunk/src/libs/openssl-3.0.3/crypto/x509/v3_utl.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/crypto/x509/v3_utl.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/crypto/x509/v3_utl.c	(revision 95219)
@@ -350,5 +350,7 @@
                     goto err;
                 }
-                X509V3_add_value(ntmp, NULL, &values);
+                if (!X509V3_add_value(ntmp, NULL, &values)) {
+                    goto err;
+                }
             }
             break;
@@ -363,5 +365,7 @@
                     goto err;
                 }
-                X509V3_add_value(ntmp, vtmp, &values);
+                if (!X509V3_add_value(ntmp, vtmp, &values)) {
+                    goto err;
+                }
                 ntmp = NULL;
                 q = p + 1;
@@ -377,5 +381,7 @@
             goto err;
         }
-        X509V3_add_value(ntmp, vtmp, &values);
+        if (!X509V3_add_value(ntmp, vtmp, &values)) {
+            goto err;
+        }
     } else {
         ntmp = strip_spaces(q);
@@ -384,5 +390,7 @@
             goto err;
         }
-        X509V3_add_value(ntmp, NULL, &values);
+        if (!X509V3_add_value(ntmp, NULL, &values)) {
+            goto err;
+        }
     }
     OPENSSL_free(linebuf);
@@ -708,5 +716,5 @@
     /* IDNA labels cannot match partial wildcards */
     if (!allow_idna &&
-        subject_len >= 4 && strncasecmp((char *)subject, "xn--", 4) == 0)
+        subject_len >= 4 && OPENSSL_strncasecmp((char *)subject, "xn--", 4) == 0)
         return 0;
     /* The wildcard may match a literal '*' */
@@ -768,5 +776,5 @@
                    || ('0' <= p[i] && p[i] <= '9')) {
             if ((state & LABEL_START) != 0
-                && len - i >= 4 && strncasecmp((char *)&p[i], "xn--", 4) == 0)
+                && len - i >= 4 && OPENSSL_strncasecmp((char *)&p[i], "xn--", 4) == 0)
                 state |= LABEL_IDNA;
             state &= ~(LABEL_HYPHEN | LABEL_START);
Index: /trunk/src/libs/openssl-3.0.3/doc/build.info
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/build.info	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/build.info	(revision 95219)
@@ -1532,4 +1532,8 @@
 DEPEND[man/man3/OPENSSL_secure_malloc.3]=man3/OPENSSL_secure_malloc.pod
 GENERATE[man/man3/OPENSSL_secure_malloc.3]=man3/OPENSSL_secure_malloc.pod
+DEPEND[html/man3/OPENSSL_strcasecmp.html]=man3/OPENSSL_strcasecmp.pod
+GENERATE[html/man3/OPENSSL_strcasecmp.html]=man3/OPENSSL_strcasecmp.pod
+DEPEND[man/man3/OPENSSL_strcasecmp.3]=man3/OPENSSL_strcasecmp.pod
+GENERATE[man/man3/OPENSSL_strcasecmp.3]=man3/OPENSSL_strcasecmp.pod
 DEPEND[html/man3/OSSL_CMP_CTX_new.html]=man3/OSSL_CMP_CTX_new.pod
 GENERATE[html/man3/OSSL_CMP_CTX_new.html]=man3/OSSL_CMP_CTX_new.pod
@@ -3111,4 +3115,5 @@
 html/man3/OPENSSL_s390xcap.html \
 html/man3/OPENSSL_secure_malloc.html \
+html/man3/OPENSSL_strcasecmp.html \
 html/man3/OSSL_CMP_CTX_new.html \
 html/man3/OSSL_CMP_HDR_get0_transactionID.html \
@@ -3705,4 +3710,5 @@
 man/man3/OPENSSL_s390xcap.3 \
 man/man3/OPENSSL_secure_malloc.3 \
+man/man3/OPENSSL_strcasecmp.3 \
 man/man3/OSSL_CMP_CTX_new.3 \
 man/man3/OSSL_CMP_HDR_get0_transactionID.3 \
Index: /trunk/src/libs/openssl-3.0.3/doc/fingerprints.txt
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/fingerprints.txt	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/fingerprints.txt	(revision 95219)
@@ -20,3 +20,6 @@
 
 Paul Dale:
-1B72 6772 1033 CC88 A531 5EF5 5359 C4D8 443B 383B
+B7C1 C143 60F3 53A3 6862 E4D5 231C 84CD DCC6 9C45
+
+Tomáš Mráz:
+A21F AB74 B008 8AA3 6115 2586 B8EF 1A6B A9DA 2D5C
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/BIO_meth_new.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/BIO_meth_new.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/BIO_meth_new.pod	(revision 95219)
@@ -119,5 +119,8 @@
 in a pointer to the current BIO_METHOD. The BIO_new() function will allocate the
 memory for the new BIO, and a pointer to this newly allocated structure will
-be passed as a parameter to the function.
+be passed as a parameter to the function. If a create function is set,
+BIO_new() will not mark the BIO as initialised on allocation.
+L<BIO_set_init(3)> must then be called either by the create function, or later,
+by a BIO ctrl function, once BIO initialisation is complete.
 
 BIO_meth_get_destroy() and BIO_meth_set_destroy() get and set the function used
@@ -155,5 +158,5 @@
 =head1 COPYRIGHT
 
-Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_blake2b512.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_blake2b512.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_blake2b512.pod	(revision 95219)
@@ -35,5 +35,5 @@
 
 These functions return a B<EVP_MD> structure that contains the
-implementation of the symmetric cipher. See L<EVP_MD_meth_new(3)> for
+implementation of the message digest. See L<EVP_MD_meth_new(3)> for
 details of the B<EVP_MD> structure.
 
@@ -55,5 +55,5 @@
 =head1 COPYRIGHT
 
-Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_md2.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_md2.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_md2.pod	(revision 95219)
@@ -29,5 +29,5 @@
 
 These functions return a B<EVP_MD> structure that contains the
-implementation of the symmetric cipher. See L<EVP_MD_meth_new(3)> for
+implementation of the message digest. See L<EVP_MD_meth_new(3)> for
 details of the B<EVP_MD> structure.
 
@@ -44,5 +44,5 @@
 =head1 COPYRIGHT
 
-Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_md4.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_md4.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_md4.pod	(revision 95219)
@@ -30,5 +30,5 @@
 
 These functions return a B<EVP_MD> structure that contains the
-implementation of the symmetric cipher. See L<EVP_MD_meth_new(3)> for
+implementation of the message digest. See L<EVP_MD_meth_new(3)> for
 details of the B<EVP_MD> structure.
 
@@ -45,5 +45,5 @@
 =head1 COPYRIGHT
 
-Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_md5.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_md5.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_md5.pod	(revision 95219)
@@ -41,5 +41,5 @@
 
 These functions return a B<EVP_MD> structure that contains the
-implementation of the symmetric cipher. See L<EVP_MD_meth_new(3)> for
+implementation of the message digest. See L<EVP_MD_meth_new(3)> for
 details of the B<EVP_MD> structure.
 
@@ -55,5 +55,5 @@
 =head1 COPYRIGHT
 
-Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_mdc2.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_mdc2.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_mdc2.pod	(revision 95219)
@@ -30,5 +30,5 @@
 
 These functions return a B<EVP_MD> structure that contains the
-implementation of the symmetric cipher. See L<EVP_MD_meth_new(3)> for
+implementation of the message digest. See L<EVP_MD_meth_new(3)> for
 details of the B<EVP_MD> structure.
 
@@ -45,5 +45,5 @@
 =head1 COPYRIGHT
 
-Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_ripemd160.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_ripemd160.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_ripemd160.pod	(revision 95219)
@@ -29,5 +29,5 @@
 
 These functions return a B<EVP_MD> structure that contains the
-implementation of the symmetric cipher. See L<EVP_MD_meth_new(3)> for
+implementation of the message digest. See L<EVP_MD_meth_new(3)> for
 details of the B<EVP_MD> structure.
 
@@ -44,5 +44,5 @@
 =head1 COPYRIGHT
 
-Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_sha1.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_sha1.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_sha1.pod	(revision 95219)
@@ -30,5 +30,5 @@
 
 These functions return a B<EVP_MD> structure that contains the
-implementation of the symmetric cipher. See L<EVP_MD_meth_new(3)> for
+implementation of the message digest. See L<EVP_MD_meth_new(3)> for
 details of the B<EVP_MD> structure.
 
@@ -44,5 +44,5 @@
 =head1 COPYRIGHT
 
-Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_sha224.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_sha224.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_sha224.pod	(revision 95219)
@@ -50,5 +50,5 @@
 
 These functions return a B<EVP_MD> structure that contains the
-implementation of the symmetric cipher. See L<EVP_MD_meth_new(3)> for
+implementation of the message digest. See L<EVP_MD_meth_new(3)> for
 details of the B<EVP_MD> structure.
 
@@ -64,5 +64,5 @@
 =head1 COPYRIGHT
 
-Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_sha3_224.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_sha3_224.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_sha3_224.pod	(revision 95219)
@@ -55,5 +55,5 @@
 
 These functions return a B<EVP_MD> structure that contains the
-implementation of the symmetric cipher. See L<EVP_MD_meth_new(3)> for
+implementation of the message digest. See L<EVP_MD_meth_new(3)> for
 details of the B<EVP_MD> structure.
 
@@ -69,5 +69,5 @@
 =head1 COPYRIGHT
 
-Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_sm3.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_sm3.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_sm3.pod	(revision 95219)
@@ -29,5 +29,5 @@
 
 These functions return a B<EVP_MD> structure that contains the
-implementation of the symmetric cipher. See L<EVP_MD_meth_new(3)> for
+implementation of the message digest. See L<EVP_MD_meth_new(3)> for
 details of the B<EVP_MD> structure.
 
@@ -43,5 +43,5 @@
 =head1 COPYRIGHT
 
-Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
 Copyright 2017 Ribose Inc. All Rights Reserved.
 
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_whirlpool.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_whirlpool.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/EVP_whirlpool.pod	(revision 95219)
@@ -31,5 +31,5 @@
 
 These functions return a B<EVP_MD> structure that contains the
-implementation of the symmetric cipher. See L<EVP_MD_meth_new(3)> for
+implementation of the message digest. See L<EVP_MD_meth_new(3)> for
 details of the B<EVP_MD> structure.
 
@@ -46,5 +46,5 @@
 =head1 COPYRIGHT
 
-Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/OPENSSL_LH_stats.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/OPENSSL_LH_stats.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/OPENSSL_LH_stats.pod	(revision 95219)
@@ -24,7 +24,8 @@
 accessing the hash table.
 
-OPENSSL_LH_stats() prints out statistics on the size of the hash table, how
-many entries are in it, and the number and result of calls to the
-routines in this library.
+OPENSSL_LH_stats() prints out statistics on the size of the hash table and how
+many entries are in it. For historical reasons, this function also outputs a
+number of additional statistics, but the tracking of these statistics is no
+longer supported and these statistics are always reported as zero.
 
 OPENSSL_LH_node_stats() prints the number of entries for each 'bucket' in the
@@ -59,5 +60,5 @@
 =head1 COPYRIGHT
 
-Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/OSSL_CMP_CTX_new.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/OSSL_CMP_CTX_new.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/OSSL_CMP_CTX_new.pod	(revision 95219)
@@ -245,5 +245,5 @@
 
         Note that a signature-based POPO can only be produced if a private key
-        is provided as the newPkey or client pkey component of the CMP context.
+        is provided as the newPkey or client's pkey component of the CMP context.
 
 =item B<OSSL_CMP_OPT_DIGEST_ALGNID>
@@ -442,5 +442,5 @@
 list of untrusted certs, which may be empty if unset.
 
-OSSL_CMP_CTX_set1_cert() sets the certificate related to the private key
+OSSL_CMP_CTX_set1_cert() sets the certificate related to the client's private key
 used for CMP message protection.
 Therefore the public key of this I<cert> must correspond to
@@ -469,5 +469,5 @@
 with the I<candidates> and I<own_trusted> arguments being NULL.
 
-OSSL_CMP_CTX_set1_pkey() sets the private key corresponding to the
+OSSL_CMP_CTX_set1_pkey() sets the client's private key corresponding to the
 CMP signer certificate set via OSSL_CMP_CTX_set1_cert().
 This key is used create signature-based protection (protectionAlg = MSG_SIG_ALG)
@@ -520,5 +520,5 @@
 dependent on fields of the CMP context structure:
 the newPkey (which may be a private or public key) if present,
-else the public key in the p10CSR if present, else the client private key.
+else the public key in the p10CSR if present, else the client's private key.
 If the I<priv> parameter is not 0 and the selected key does not have a
 private component then NULL is returned.
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/OSSL_CMP_MSG_get0_header.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/OSSL_CMP_MSG_get0_header.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/OSSL_CMP_MSG_get0_header.pod	(revision 95219)
@@ -41,17 +41,33 @@
 The I<rid> argument defines the request identifier to use, which typically is 0.
 
-The subject DN to include in the certificate template is determined as follows.
-If I<ctx> includes a subject name set via L<OSSL_CMP_CTX_set1_subjectName(3)>,
-this name is used.
-Otherwise, if a PKCS#10 CSR is given in I<ctx>, its subject is used.
-Otherwise, if a reference certificate is given in I<ctx>
-(see L<OSSL_CMP_CTX_set1_oldCert(3)>), its subject is used if I<for_KUR>
-is nonzero or the I<ctx> does not include a Subject Alternative Name.
+The subject DN included in the certificate template is
+the first available value of these:
 
-The public key to include is taken from any value set via
-L<OSSL_CMP_CTX_set0_newPkey(3)>,
-otherwise the public key of any PKCS#10 CSR is given in I<ctx>,
-otherwise the public key of any reference certificate given in I<ctx>,
-otherwise it is derived from the client private key if given in I<ctx>.
+=over 4
+
+=item any subject name in I<ctx> set via L<OSSL_CMP_CTX_set1_subjectName(3)>,
+
+=item the subject field of any PKCS#10 CSR is given in I<ctx>, or
+
+=item the subject field of any reference certificate given in I<ctx>
+(see L<OSSL_CMP_CTX_set1_oldCert(3)>), if I<for_KUR> is nonzero
+or the I<ctx> does not include a Subject Alternative Name.
+
+=back
+
+The public key included is the first available value of these:
+
+=over 4
+
+=item the public key derived from any key set via L<OSSL_CMP_CTX_set0_newPkey(3)>,
+
+=item the public key of any PKCS#10 CSR is given in I<ctx>,
+
+=item the public key of any reference certificate given in I<ctx>, or
+
+=item the public key derived from any client's private key
+set via L<OSSL_CMP_CTX_set1_pkey(3)>.
+
+=back
 
 The set of X.509 extensions to include is computed as follows.
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/PEM_read_bio_PrivateKey.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/PEM_read_bio_PrivateKey.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/PEM_read_bio_PrivateKey.pod	(revision 95219)
@@ -194,6 +194,6 @@
 
 All of the functions described on this page that have a I<TYPE> of B<DH>, B<DSA>
-and B<RSA> are deprecated. Applications should use OSSL_ENCODER_to_bio() and
-OSSL_DECODER_from_bio() instead.
+and B<RSA> are deprecated. Applications should use L<OSSL_ENCODER_to_bio(3)> and
+L<OSSL_DECODER_from_bio(3)> instead.
 
 The PEM functions read or write structures in PEM format. In
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_CONF_cmd.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_CONF_cmd.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_CONF_cmd.pod	(revision 95219)
@@ -65,5 +65,5 @@
 Only used by servers.
 
-=item B<-legacyrenegotiation>
+=item B<-legacy_renegotiation>
 
 Permits the use of unsafe legacy renegotiation. Equivalent to setting
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_CTX_get0_param.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_CTX_get0_param.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_CTX_get0_param.pod	(revision 95219)
@@ -3,5 +3,6 @@
 =head1 NAME
 
-SSL_CTX_get0_param, SSL_get0_param, SSL_CTX_set1_param, SSL_set1_param -
+SSL_CTX_get0_param, SSL_get0_param, SSL_CTX_set1_param, SSL_set1_param,
+SSL_CTX_set_purpose, SSL_CTX_set_trust, SSL_set_purpose, SSL_set_trust -
 get and set verification parameters
 
@@ -15,4 +16,10 @@
  int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm);
 
+ int SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose);
+ int SSL_set_purpose(SSL *ssl, int purpose);
+
+ int SSL_CTX_set_trust(SSL_CTX *ctx, int trust);
+ int SSL_set_trust(SSL *ssl, int trust);
+
 =head1 DESCRIPTION
 
@@ -23,4 +30,12 @@
 SSL_CTX_set1_param() and SSL_set1_param() set the verification parameters
 to B<vpm> for B<ctx> or B<ssl>.
+
+The functions SSL_CTX_set_purpose() and SSL_set_purpose() are shorthands which
+set the purpose parameter on the verification parameters object. These functions
+are equivalent to calling X509_VERIFY_PARAM_set_purpose() directly.
+
+The functions SSL_CTX_set_trust() and SSL_set_trust() are similarly shorthands
+which set the trust parameter on the verification parameters object. These
+functions are equivalent to calling X509_VERIFY_PARAM_set_trust() directly.
 
 =head1 NOTES
@@ -35,6 +50,7 @@
 B<X509_VERIFY_PARAM> structure.
 
-SSL_CTX_set1_param() and SSL_set1_param() return 1 for success and 0
-for failure.
+SSL_CTX_set1_param(), SSL_set1_param(), SSL_CTX_set_purpose(),
+SSL_set_purpose(), SSL_CTX_set_trust() and SSL_set_trust() return 1 for success
+and 0 for failure.
 
 =head1 EXAMPLES
@@ -56,5 +72,5 @@
 =head1 COPYRIGHT
 
-Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_CTX_set1_verify_cert_store.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_CTX_set1_verify_cert_store.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_CTX_set1_verify_cert_store.pod	(revision 95219)
@@ -6,5 +6,7 @@
 SSL_CTX_set0_chain_cert_store, SSL_CTX_set1_chain_cert_store,
 SSL_set0_verify_cert_store, SSL_set1_verify_cert_store,
-SSL_set0_chain_cert_store, SSL_set1_chain_cert_store - set certificate
+SSL_set0_chain_cert_store, SSL_set1_chain_cert_store,
+SSL_CTX_get0_verify_cert_store, SSL_CTX_get0_chain_cert_store,
+SSL_get0_verify_cert_store, SSL_get0_chain_cert_store - set certificate
 verification or chain store
 
@@ -17,4 +19,6 @@
  int SSL_CTX_set0_chain_cert_store(SSL_CTX *ctx, X509_STORE *st);
  int SSL_CTX_set1_chain_cert_store(SSL_CTX *ctx, X509_STORE *st);
+ int SSL_CTX_get0_verify_cert_store(SSL_CTX *ctx, X509_STORE **st);
+ int SSL_CTX_get0_chain_cert_store(SSL_CTX *ctx, X509_STORE **st);
 
  int SSL_set0_verify_cert_store(SSL *ctx, X509_STORE *st);
@@ -22,4 +26,6 @@
  int SSL_set0_chain_cert_store(SSL *ctx, X509_STORE *st);
  int SSL_set1_chain_cert_store(SSL *ctx, X509_STORE *st);
+ int SSL_get0_verify_cert_store(SSL *ctx, X509_STORE **st);
+ int SSL_get0_chain_cert_store(SSL *ctx, X509_STORE **st);
 
 =head1 DESCRIPTION
@@ -34,4 +40,9 @@
 SSL_set0_chain_cert_store() and SSL_set1_chain_cert_store() are similar
 except they apply to SSL structure B<ssl>.
+
+SSL_CTX_get0_verify_chain_store(), SSL_get0_verify_chain_store(),
+SSL_CTX_get0_chain_cert_store() and SSL_get0_chain_cert_store() retrieve the
+objects previously set via the above calls. A pointer to the object (or NULL if
+no such object has been set) is written to B<*st>.
 
 All these functions are implemented as macros. Those containing a B<1>
@@ -95,5 +106,5 @@
 =head1 COPYRIGHT
 
-Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2013-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_CTX_set_ssl_version.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_CTX_set_ssl_version.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_CTX_set_ssl_version.pod	(revision 95219)
@@ -3,5 +3,5 @@
 =head1 NAME
 
-SSL_CTX_set_ssl_version, SSL_set_ssl_method, SSL_get_ssl_method
+SSL_CTX_set_ssl_version, SSL_CTX_get_ssl_method, SSL_set_ssl_method, SSL_get_ssl_method
 - choose a new TLS/SSL method
 
@@ -11,4 +11,6 @@
 
  int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *method);
+ const SSL_METHOD *SSL_CTX_get_ssl_method(const SSL_CTX *ctx);
+
  int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);
  const SSL_METHOD *SSL_get_ssl_method(const SSL *ssl);
@@ -23,8 +25,11 @@
 being called, as described below.
 
+SSL_CTX_get_ssl_method() returns the SSL_METHOD which was used to construct the
+SSL_CTX.
+
 SSL_set_ssl_method() sets a new TLS/SSL B<method> for a particular B<ssl>
 object. It may be reset, when SSL_clear() is called.
 
-SSL_get_ssl_method() returns a function pointer to the TLS/SSL method
+SSL_get_ssl_method() returns a pointer to the TLS/SSL method
 set in B<ssl>.
 
@@ -60,4 +65,7 @@
 =back
 
+SSL_CTX_get_ssl_method() and SSL_get_ssl_method() always return non-NULL
+pointers.
+
 =head1 SEE ALSO
 
@@ -72,5 +80,5 @@
 =head1 COPYRIGHT
 
-Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_CTX_set_timeout.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_CTX_set_timeout.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_CTX_set_timeout.pod	(revision 95219)
@@ -43,4 +43,14 @@
 of 300 seconds.
 
+This timeout value is used as the ticket lifetime hint for stateless session
+tickets. It is also used as the timeout value within the ticket itself.
+
+For TLSv1.3, RFC8446 limits transmission of this value to 1 week (604800
+seconds).
+
+For TLSv1.2, tickets generated during an initial handshake use the value
+as specified. Tickets generated during a resumed handshake have a value
+of 0 for the ticket lifetime hint.
+
 =head1 RETURN VALUES
 
@@ -59,5 +69,5 @@
 =head1 COPYRIGHT
 
-Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_CTX_set_verify.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_CTX_set_verify.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_CTX_set_verify.pod	(revision 95219)
@@ -54,9 +54,9 @@
 The application can for instance fetch further certificates or cert status
 information needed for the verification.
-Note that the handshake may still be aborted if a subsequent invocation of the
-callback (e.g. at a lower depth, or for a separate error condition) returns 0.
 Calling L<SSL_connect(3)> again resumes the connection attempt by retrying the
 server certificate verification step.
 This process may even be repeated if need be.
+Note that the handshake may still be aborted if a subsequent invocation of the
+callback (e.g., at a lower depth, or for a separate error condition) returns 0.
 
 SSL_CTX_set_verify_depth() sets the maximum B<depth> for the certificate chain
Index: /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_set_session.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_set_session.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man3/SSL_set_session.pod	(revision 95219)
@@ -22,5 +22,6 @@
 If there is already a session set inside B<ssl> (because it was set with
 SSL_set_session() before or because the same B<ssl> was already used for
-a connection), SSL_SESSION_free() will be called for that session. If that old
+a connection), SSL_SESSION_free() will be called for that session.
+This is also the case when B<session> is a NULL pointer. If that old
 session is still B<open>, it is considered bad and will be removed from the
 session cache (if used). A session is considered open, if L<SSL_shutdown(3)> was
@@ -61,5 +62,5 @@
 =head1 COPYRIGHT
 
-Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man7/EVP_KDF-SSHKDF.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man7/EVP_KDF-SSHKDF.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man7/EVP_KDF-SSHKDF.pod	(revision 95219)
@@ -104,5 +104,5 @@
  EVP_KDF *kdf;
  EVP_KDF_CTX *kctx;
- const char type = EVP_KDF_SSHKDF_TYPE_INITIAL_IV_CLI_TO_SRV;
+ char type = EVP_KDF_SSHKDF_TYPE_INITIAL_IV_CLI_TO_SRV;
  unsigned char key[1024] = "01234...";
  unsigned char xcghash[32] = "012345...";
@@ -127,5 +127,5 @@
                                          &type, sizeof(type));
  *p = OSSL_PARAM_construct_end();
- if (EVP_KDF_derive(kctx, out, &outlen, params) <= 0)
+ if (EVP_KDF_derive(kctx, out, outlen, params) <= 0)
      /* Error */
 
@@ -147,5 +147,5 @@
 =head1 COPYRIGHT
 
-Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man7/provider-signature.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man7/provider-signature.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man7/provider-signature.pod	(revision 95219)
@@ -44,5 +44,5 @@
  /* Digest Sign */
  int OSSL_FUNC_signature_digest_sign_init(void *ctx, const char *mdname,
-                                          const char *props, void *provkey,
+                                          void *provkey,
                                           const OSSL_PARAM params[]);
  int OSSL_FUNC_signature_digest_sign_update(void *ctx, const unsigned char *data,
@@ -57,5 +57,5 @@
  /* Digest Verify */
  int OSSL_FUNC_signature_digest_verify_init(void *ctx, const char *mdname,
-                                            const char *props, void *provkey,
+                                            void *provkey,
                                             const OSSL_PARAM params[]);
  int OSSL_FUNC_signature_digest_verify_update(void *ctx,
@@ -267,7 +267,5 @@
 previously generated, loaded or imported into the provider using the
 key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>.
-The name of the digest to be used will be in the I<mdname> parameter. There may
-also be properties to be used in fetching the digest in the I<props> parameter,
-although this may be ignored by providers.
+The name of the digest to be used will be in the I<mdname> parameter.
 
 OSSL_FUNC_signature_digest_sign_update() provides data to be signed in the I<data>
@@ -306,7 +304,5 @@
 previously generated, loaded or imported into the provider using the
 key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>.
-The name of the digest to be used will be in the I<mdname> parameter. There may
-also be properties to be used in fetching the digest in the I<props> parameter,
-although this may be ignored by providers.
+The name of the digest to be used will be in the I<mdname> parameter.
 
 OSSL_FUNC_signature_digest_verify_update() provides data to be verified in the I<data>
@@ -436,5 +432,5 @@
 =head1 COPYRIGHT
 
-Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/doc/man7/provider.pod
===================================================================
--- /trunk/src/libs/openssl-3.0.3/doc/man7/provider.pod	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/doc/man7/provider.pod	(revision 95219)
@@ -116,5 +116,5 @@
 The number for this operation is B<OSSL_OP_DIGEST>.
 The functions the provider can offer are described in
-L<provider-digest(7)>
+L<provider-digest(7)>.
 
 =item Symmetric ciphers
@@ -124,5 +124,5 @@
 The number for this operation is B<OSSL_OP_CIPHER>.
 The functions the provider can offer are described in
-L<provider-cipher(7)>
+L<provider-cipher(7)>.
 
 =item Message Authentication Code (MAC)
@@ -132,5 +132,5 @@
 The number for this operation is B<OSSL_OP_MAC>.
 The functions the provider can offer are described in
-L<provider-mac(7)>
+L<provider-mac(7)>.
 
 =item Key Derivation Function (KDF)
@@ -140,5 +140,5 @@
 The number for this operation is B<OSSL_OP_KDF>.
 The functions the provider can offer are described in
-L<provider-kdf(7)>
+L<provider-kdf(7)>.
 
 =item Key Exchange
@@ -148,5 +148,5 @@
 The number for this operation is B<OSSL_OP_KEYEXCH>.
 The functions the provider can offer are described in
-L<provider-keyexch(7)>
+L<provider-keyexch(7)>.
 
 =item Asymmetric Ciphers
@@ -156,5 +156,5 @@
 The number for this operation is B<OSSL_OP_ASYM_CIPHER>.
 The functions the provider can offer are described in
-L<provider-asym_cipher(7)>
+L<provider-asym_cipher(7)>.
 
 =item Asymmetric Key Encapsulation
@@ -162,5 +162,5 @@
 In the OpenSSL libraries, the corresponding method object is B<EVP_KEM>.
 The number for this operation is B<OSSL_OP_KEM>.
-The functions the provider can offer are described in L<provider-kem(7)>
+The functions the provider can offer are described in L<provider-kem(7)>.
 
 =item Encoding
@@ -170,5 +170,37 @@
 The number for this operation is B<OSSL_OP_ENCODER>.
 The functions the provider can offer are described in
-L<provider-encoder(7)>
+L<provider-encoder(7)>.
+
+=item Decoding
+
+In the OpenSSL libraries, the corresponding method object is
+B<OSSL_DECODER>.
+The number for this operation is B<OSSL_OP_DECODER>.
+The functions the provider can offer are described in
+L<provider-decoder(7)>.
+
+=item Random Number Generation
+
+The number for this operation is B<OSSL_OP_RAND>.
+The functions the provider can offer for random number generation are described
+in L<provider-rand(7)>.
+
+=item Key Management
+
+The number for this operation is B<OSSL_OP_KEYMGMT>.
+The functions the provider can offer for key management are described in
+L<provider-keymgmt(7)>.
+
+=item Signing and Signature Verification
+
+The number for this operation is B<OSSL_OP_SIGNATURE>.
+The functions the provider can offer for digital signatures are described in
+L<provider-signature(7)>.
+
+=item Store Management
+
+The number for this operation is B<OSSL_OP_STORE>.
+The functions the provider can offer for store management are described in
+L<provider-storemgmt(7)>.
 
 =back
@@ -223,5 +255,5 @@
 =head1 COPYRIGHT
 
-Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/e_os.h
===================================================================
--- /trunk/src/libs/openssl-3.0.3/e_os.h	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/e_os.h	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -264,6 +264,4 @@
 
 # if defined(OPENSSL_SYS_WINDOWS)
-#  define strcasecmp _stricmp
-#  define strncasecmp _strnicmp
 #  if (_MSC_VER >= 1310) && !defined(_WIN32_WCE)
 #   define open _open
Index: /trunk/src/libs/openssl-3.0.3/engines/e_devcrypto.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/engines/e_devcrypto.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/engines/e_devcrypto.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -1160,7 +1160,7 @@
         if (p == NULL)
             return 1;
-        if (strcasecmp((const char *)p, "ALL") == 0) {
+        if (OPENSSL_strcasecmp((const char *)p, "ALL") == 0) {
             devcrypto_select_all_ciphers(selected_ciphers);
-        } else if (strcasecmp((const char*)p, "NONE") == 0) {
+        } else if (OPENSSL_strcasecmp((const char*)p, "NONE") == 0) {
             memset(selected_ciphers, 0, sizeof(selected_ciphers));
         } else {
@@ -1180,7 +1180,7 @@
         if (p == NULL)
             return 1;
-        if (strcasecmp((const char *)p, "ALL") == 0) {
+        if (OPENSSL_strcasecmp((const char *)p, "ALL") == 0) {
             devcrypto_select_all_digests(selected_digests);
-        } else if (strcasecmp((const char*)p, "NONE") == 0) {
+        } else if (OPENSSL_strcasecmp((const char*)p, "NONE") == 0) {
             memset(selected_digests, 0, sizeof(selected_digests));
         } else {
Index: /trunk/src/libs/openssl-3.0.3/engines/e_loader_attic.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/engines/e_loader_attic.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/engines/e_loader_attic.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -15,5 +15,4 @@
 #define OPENSSL_SUPPRESS_DEPRECATED
 
-/* #include "e_os.h" */
 #include <string.h>
 #include <sys/stat.h>
@@ -45,5 +44,4 @@
 #ifdef _WIN32
 # define stat _stat
-# define strncasecmp _strnicmp
 #endif
 
@@ -972,10 +970,10 @@
      * the full URI shouldn't be used as a path anywhere.
      */
-    if (strncasecmp(uri, "file:", 5) == 0) {
+    if (OPENSSL_strncasecmp(uri, "file:", 5) == 0) {
         const char *p = &uri[5];
 
         if (strncmp(&uri[5], "//", 2) == 0) {
             path_data_n--;           /* Invalidate using the full URI */
-            if (strncasecmp(&uri[7], "localhost/", 10) == 0) {
+            if (OPENSSL_strncasecmp(&uri[7], "localhost/", 10) == 0) {
                 p = &uri[16];
             } else if (uri[7] == '/') {
@@ -1467,5 +1465,6 @@
      * First, check the basename
      */
-    if (strncasecmp(name, ctx->_.dir.search_name, len) != 0 || name[len] != '.')
+    if (OPENSSL_strncasecmp(name, ctx->_.dir.search_name, len) != 0
+        || name[len] != '.')
         return 0;
     p = &name[len + 1];
Index: /trunk/src/libs/openssl-3.0.3/engines/e_ossltest.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/engines/e_ossltest.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/engines/e_ossltest.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -42,8 +42,4 @@
 
 #include "e_ossltest_err.c"
-
-#ifdef _WIN32
-# define strncasecmp _strnicmp
-#endif
 
 /* Engine Id and Name */
@@ -384,5 +380,5 @@
     EVP_PKEY *key;
 
-    if (strncasecmp(key_id, "ot:", 3) != 0)
+    if (OPENSSL_strncasecmp(key_id, "ot:", 3) != 0)
         return NULL;
     key_id += 3;
Index: /trunk/src/libs/openssl-3.0.3/fuzz/client.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/fuzz/client.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/fuzz/client.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License");
@@ -56,5 +56,5 @@
 int FuzzerTestOneInput(const uint8_t *buf, size_t len)
 {
-    SSL *client;
+    SSL *client = NULL;
     BIO *in;
     BIO *out;
@@ -66,11 +66,21 @@
     /* This only fuzzes the initial flow from the client so far. */
     ctx = SSL_CTX_new(SSLv23_method());
+    if (ctx == NULL)
+        goto end;
 
     client = SSL_new(ctx);
+    if (client == NULL)
+        goto end;
     OPENSSL_assert(SSL_set_min_proto_version(client, 0) == 1);
     OPENSSL_assert(SSL_set_cipher_list(client, "ALL:eNULL:@SECLEVEL=0") == 1);
     SSL_set_tlsext_host_name(client, "localhost");
     in = BIO_new(BIO_s_mem());
+    if (in == NULL)
+        goto end;
     out = BIO_new(BIO_s_mem());
+    if (out == NULL) {
+        BIO_free(in);
+        goto end;
+    }
     SSL_set_bio(client, in, out);
     SSL_set_connect_state(client);
@@ -85,4 +95,5 @@
         }
     }
+ end:
     SSL_free(client);
     ERR_clear_error();
Index: /trunk/src/libs/openssl-3.0.3/gen-includes/openssl/crypto.h
===================================================================
--- /trunk/src/libs/openssl-3.0.3/gen-includes/openssl/crypto.h	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/gen-includes/openssl/crypto.h	(revision 95219)
@@ -133,4 +133,6 @@
 unsigned char *OPENSSL_hexstr2buf(const char *str, long *buflen);
 int OPENSSL_hexchar2int(unsigned char c);
+int OPENSSL_strcasecmp(const char *s1, const char *s2);
+int OPENSSL_strncasecmp(const char *s1, const char *s2, size_t n);
 
 # define OPENSSL_MALLOC_MAX_NELEMS(type)  (((1U<<(sizeof(int)*8-1))-1)/sizeof(type))
Index: /trunk/src/libs/openssl-3.0.3/gen-includes/openssl/ssl.h
===================================================================
--- /trunk/src/libs/openssl-3.0.3/gen-includes/openssl/ssl.h	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/gen-includes/openssl/ssl.h	(revision 95219)
@@ -1382,4 +1382,6 @@
 # define SSL_CTRL_GET_NEGOTIATED_GROUP           134
 # define SSL_CTRL_SET_RETRY_VERIFY               136
+# define SSL_CTRL_GET_VERIFY_CERT_STORE          137
+# define SSL_CTRL_GET_CHAIN_CERT_STORE           138
 # define SSL_CERT_SET_FIRST                      1
 # define SSL_CERT_SET_NEXT                       2
@@ -1443,8 +1445,12 @@
 # define SSL_CTX_set1_verify_cert_store(ctx,st) \
         SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st))
+# define SSL_CTX_get0_verify_cert_store(ctx,st) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_GET_VERIFY_CERT_STORE,0,(char *)(st))
 # define SSL_CTX_set0_chain_cert_store(ctx,st) \
         SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st))
 # define SSL_CTX_set1_chain_cert_store(ctx,st) \
         SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st))
+# define SSL_CTX_get0_chain_cert_store(ctx,st) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_GET_CHAIN_CERT_STORE,0,(char *)(st))
 # define SSL_set0_chain(s,sk) \
         SSL_ctrl(s,SSL_CTRL_CHAIN,0,(char *)(sk))
@@ -1469,8 +1475,13 @@
 # define SSL_set1_verify_cert_store(s,st) \
         SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st))
+#define SSL_get0_verify_cert_store(s,st) \
+        SSL_ctrl(s,SSL_CTRL_GET_VERIFY_CERT_STORE,0,(char *)(st))
 # define SSL_set0_chain_cert_store(s,st) \
         SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st))
 # define SSL_set1_chain_cert_store(s,st) \
         SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st))
+#define SSL_get0_chain_cert_store(s,st) \
+        SSL_ctrl(s,SSL_CTRL_GET_CHAIN_CERT_STORE,0,(char *)(st))
+
 # define SSL_get1_groups(s, glist) \
         SSL_ctrl(s,SSL_CTRL_GET_GROUPS,0,(int*)(glist))
Index: /trunk/src/libs/openssl-3.0.3/gen-includes/openssl/x509.h
===================================================================
--- /trunk/src/libs/openssl-3.0.3/gen-includes/openssl/x509.h	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/gen-includes/openssl/x509.h	(revision 95219)
@@ -3,5 +3,5 @@
  * Generated by Makefile from x509.h.in
  *
- * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
  *
@@ -553,9 +553,9 @@
 X509_CRL *X509_CRL_load_http(const char *url, BIO *bio, BIO *rbio, int timeout);
 # ifndef OPENSSL_NO_DEPRECATED_3_0
-#  include <openssl/ocsp.h> /* OCSP_REQ_CTX_nbio_d2i */
+#  include <openssl/http.h> /* OSSL_HTTP_REQ_CTX_nbio_d2i */
 #  define X509_http_nbio(rctx, pcert) \
-      OCSP_REQ_CTX_nbio_d2i(rctx, pcert, ASN1_ITEM_rptr(X509))
+      OSSL_HTTP_REQ_CTX_nbio_d2i(rctx, pcert, ASN1_ITEM_rptr(X509))
 #  define X509_CRL_http_nbio(rctx, pcrl) \
-      OCSP_REQ_CTX_nbio_d2i(rctx, pcrl, ASN1_ITEM_rptr(X509_CRL))
+      OSSL_HTTP_REQ_CTX_nbio_d2i(rctx, pcrl, ASN1_ITEM_rptr(X509_CRL))
 # endif
 
Index: /trunk/src/libs/openssl-3.0.3/include/crypto/ctype.h
===================================================================
--- /trunk/src/libs/openssl-3.0.3/include/crypto/ctype.h	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/include/crypto/ctype.h	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -85,3 +85,5 @@
 # define ossl_isasn1print(c)    (ossl_ctype_check((c), CTYPE_MASK_asn1print))
 
+int ossl_init_casecmp(void);
+void ossl_deinit_casecmp(void);
 #endif
Index: /trunk/src/libs/openssl-3.0.3/include/crypto/ecerr.h
===================================================================
--- /trunk/src/libs/openssl-3.0.3/include/crypto/ecerr.h	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/include/crypto/ecerr.h	(revision 95219)
@@ -1,5 +1,5 @@
 /*
  * Generated by util/mkerr.pl DO NOT EDIT
- * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
Index: /trunk/src/libs/openssl-3.0.3/include/internal/core.h
===================================================================
--- /trunk/src/libs/openssl-3.0.3/include/internal/core.h	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/include/internal/core.h	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -64,3 +64,5 @@
 int ossl_lib_ctx_is_child(OSSL_LIB_CTX *ctx);
 
+void *ossl_c_locale(void);
+
 #endif
Index: /trunk/src/libs/openssl-3.0.3/include/openssl/crypto.h.in
===================================================================
--- /trunk/src/libs/openssl-3.0.3/include/openssl/crypto.h.in	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/include/openssl/crypto.h.in	(revision 95219)
@@ -134,4 +134,6 @@
 unsigned char *OPENSSL_hexstr2buf(const char *str, long *buflen);
 int OPENSSL_hexchar2int(unsigned char c);
+int OPENSSL_strcasecmp(const char *s1, const char *s2);
+int OPENSSL_strncasecmp(const char *s1, const char *s2, size_t n);
 
 # define OPENSSL_MALLOC_MAX_NELEMS(type)  (((1U<<(sizeof(int)*8-1))-1)/sizeof(type))
Index: /trunk/src/libs/openssl-3.0.3/include/openssl/ecerr.h
===================================================================
--- /trunk/src/libs/openssl-3.0.3/include/openssl/ecerr.h	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/include/openssl/ecerr.h	(revision 95219)
@@ -1,5 +1,5 @@
 /*
  * Generated by util/mkerr.pl DO NOT EDIT
- * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -36,4 +36,5 @@
 #  define EC_R_DISCRIMINANT_IS_ZERO                        118
 #  define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE                119
+#  define EC_R_EXPLICIT_PARAMS_NOT_SUPPORTED               127
 #  define EC_R_FAILED_MAKING_PUBLIC_KEY                    166
 #  define EC_R_FIELD_TOO_LARGE                             143
Index: /trunk/src/libs/openssl-3.0.3/include/openssl/ssl.h.in
===================================================================
--- /trunk/src/libs/openssl-3.0.3/include/openssl/ssl.h.in	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/include/openssl/ssl.h.in	(revision 95219)
@@ -1310,4 +1310,6 @@
 # define SSL_CTRL_GET_NEGOTIATED_GROUP           134
 # define SSL_CTRL_SET_RETRY_VERIFY               136
+# define SSL_CTRL_GET_VERIFY_CERT_STORE          137
+# define SSL_CTRL_GET_CHAIN_CERT_STORE           138
 # define SSL_CERT_SET_FIRST                      1
 # define SSL_CERT_SET_NEXT                       2
@@ -1371,8 +1373,12 @@
 # define SSL_CTX_set1_verify_cert_store(ctx,st) \
         SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st))
+# define SSL_CTX_get0_verify_cert_store(ctx,st) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_GET_VERIFY_CERT_STORE,0,(char *)(st))
 # define SSL_CTX_set0_chain_cert_store(ctx,st) \
         SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st))
 # define SSL_CTX_set1_chain_cert_store(ctx,st) \
         SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st))
+# define SSL_CTX_get0_chain_cert_store(ctx,st) \
+        SSL_CTX_ctrl(ctx,SSL_CTRL_GET_CHAIN_CERT_STORE,0,(char *)(st))
 # define SSL_set0_chain(s,sk) \
         SSL_ctrl(s,SSL_CTRL_CHAIN,0,(char *)(sk))
@@ -1397,8 +1403,13 @@
 # define SSL_set1_verify_cert_store(s,st) \
         SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st))
+#define SSL_get0_verify_cert_store(s,st) \
+        SSL_ctrl(s,SSL_CTRL_GET_VERIFY_CERT_STORE,0,(char *)(st))
 # define SSL_set0_chain_cert_store(s,st) \
         SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st))
 # define SSL_set1_chain_cert_store(s,st) \
         SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st))
+#define SSL_get0_chain_cert_store(s,st) \
+        SSL_ctrl(s,SSL_CTRL_GET_CHAIN_CERT_STORE,0,(char *)(st))
+
 # define SSL_get1_groups(s, glist) \
         SSL_ctrl(s,SSL_CTRL_GET_GROUPS,0,(int*)(glist))
Index: /trunk/src/libs/openssl-3.0.3/include/openssl/x509.h.in
===================================================================
--- /trunk/src/libs/openssl-3.0.3/include/openssl/x509.h.in	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/include/openssl/x509.h.in	(revision 95219)
@@ -2,5 +2,5 @@
  * {- join("\n * ", @autowarntext) -}
  *
- * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
  *
@@ -359,9 +359,9 @@
 X509_CRL *X509_CRL_load_http(const char *url, BIO *bio, BIO *rbio, int timeout);
 # ifndef OPENSSL_NO_DEPRECATED_3_0
-#  include <openssl/ocsp.h> /* OCSP_REQ_CTX_nbio_d2i */
+#  include <openssl/http.h> /* OSSL_HTTP_REQ_CTX_nbio_d2i */
 #  define X509_http_nbio(rctx, pcert) \
-      OCSP_REQ_CTX_nbio_d2i(rctx, pcert, ASN1_ITEM_rptr(X509))
+      OSSL_HTTP_REQ_CTX_nbio_d2i(rctx, pcert, ASN1_ITEM_rptr(X509))
 #  define X509_CRL_http_nbio(rctx, pcrl) \
-      OCSP_REQ_CTX_nbio_d2i(rctx, pcrl, ASN1_ITEM_rptr(X509_CRL))
+      OSSL_HTTP_REQ_CTX_nbio_d2i(rctx, pcrl, ASN1_ITEM_rptr(X509_CRL))
 # endif
 
Index: /trunk/src/libs/openssl-3.0.3/openssl-mangling.h
===================================================================
--- /trunk/src/libs/openssl-3.0.3/openssl-mangling.h	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/openssl-mangling.h	(revision 95219)
@@ -11366,4 +11366,13 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
+# ifndef DTLSv1_2_client_method
+#  define DTLSv1_2_client_method OPENSSL_MANGLER(DTLSv1_2_client_method)
+# endif
+#else
+# ifndef _DTLSv1_2_client_method
+#  define _DTLSv1_2_client_method OPENSSL_MANGLER_ASM(DTLSv1_2_client_method)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
 # ifndef DTLSv1_2_enc_data
 #  define DTLSv1_2_enc_data OPENSSL_MANGLER(DTLSv1_2_enc_data)
@@ -11375,4 +11384,31 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
+# ifndef DTLSv1_2_method
+#  define DTLSv1_2_method OPENSSL_MANGLER(DTLSv1_2_method)
+# endif
+#else
+# ifndef _DTLSv1_2_method
+#  define _DTLSv1_2_method OPENSSL_MANGLER_ASM(DTLSv1_2_method)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
+# ifndef DTLSv1_2_server_method
+#  define DTLSv1_2_server_method OPENSSL_MANGLER(DTLSv1_2_server_method)
+# endif
+#else
+# ifndef _DTLSv1_2_server_method
+#  define _DTLSv1_2_server_method OPENSSL_MANGLER_ASM(DTLSv1_2_server_method)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
+# ifndef DTLSv1_client_method
+#  define DTLSv1_client_method OPENSSL_MANGLER(DTLSv1_client_method)
+# endif
+#else
+# ifndef _DTLSv1_client_method
+#  define _DTLSv1_client_method OPENSSL_MANGLER_ASM(DTLSv1_client_method)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
 # ifndef DTLSv1_enc_data
 #  define DTLSv1_enc_data OPENSSL_MANGLER(DTLSv1_enc_data)
@@ -11393,4 +11429,22 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
+# ifndef DTLSv1_method
+#  define DTLSv1_method OPENSSL_MANGLER(DTLSv1_method)
+# endif
+#else
+# ifndef _DTLSv1_method
+#  define _DTLSv1_method OPENSSL_MANGLER_ASM(DTLSv1_method)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
+# ifndef DTLSv1_server_method
+#  define DTLSv1_server_method OPENSSL_MANGLER(DTLSv1_server_method)
+# endif
+#else
+# ifndef _DTLSv1_server_method
+#  define _DTLSv1_server_method OPENSSL_MANGLER_ASM(DTLSv1_server_method)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
 # ifndef ECDH_KDF_X9_62
 #  define ECDH_KDF_X9_62 OPENSSL_MANGLER(ECDH_KDF_X9_62)
@@ -25532,13 +25586,4 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
-# ifndef OPENSSL_cleanse
-#  define OPENSSL_cleanse OPENSSL_MANGLER(OPENSSL_cleanse)
-# endif
-#else
-# ifndef _OPENSSL_cleanse
-#  define _OPENSSL_cleanse OPENSSL_MANGLER_ASM(OPENSSL_cleanse)
-# endif
-#endif
-#ifndef OPENSSL_MANGLE_ASM
 # ifndef OPENSSL_cleanup
 #  define OPENSSL_cleanup OPENSSL_MANGLER(OPENSSL_cleanup)
@@ -25982,4 +26027,13 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
+# ifndef OPENSSL_strcasecmp
+#  define OPENSSL_strcasecmp OPENSSL_MANGLER(OPENSSL_strcasecmp)
+# endif
+#else
+# ifndef _OPENSSL_strcasecmp
+#  define _OPENSSL_strcasecmp OPENSSL_MANGLER_ASM(OPENSSL_strcasecmp)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
 # ifndef OPENSSL_strlcat
 #  define OPENSSL_strlcat OPENSSL_MANGLER(OPENSSL_strlcat)
@@ -26000,4 +26054,13 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
+# ifndef OPENSSL_strncasecmp
+#  define OPENSSL_strncasecmp OPENSSL_MANGLER(OPENSSL_strncasecmp)
+# endif
+#else
+# ifndef _OPENSSL_strncasecmp
+#  define _OPENSSL_strncasecmp OPENSSL_MANGLER_ASM(OPENSSL_strncasecmp)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
 # ifndef OPENSSL_strnlen
 #  define OPENSSL_strnlen OPENSSL_MANGLER(OPENSSL_strnlen)
@@ -41057,4 +41120,13 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
+# ifndef SSL_set_debug
+#  define SSL_set_debug OPENSSL_MANGLER(SSL_set_debug)
+# endif
+#else
+# ifndef _SSL_set_debug
+#  define _SSL_set_debug OPENSSL_MANGLER_ASM(SSL_set_debug)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
 # ifndef SSL_set_default_passwd_cb
 #  define SSL_set_default_passwd_cb OPENSSL_MANGLER(SSL_set_default_passwd_cb)
@@ -41876,4 +41948,13 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
+# ifndef TLSv1_1_client_method
+#  define TLSv1_1_client_method OPENSSL_MANGLER(TLSv1_1_client_method)
+# endif
+#else
+# ifndef _TLSv1_1_client_method
+#  define _TLSv1_1_client_method OPENSSL_MANGLER_ASM(TLSv1_1_client_method)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
 # ifndef TLSv1_1_enc_data
 #  define TLSv1_1_enc_data OPENSSL_MANGLER(TLSv1_1_enc_data)
@@ -41885,4 +41966,31 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
+# ifndef TLSv1_1_method
+#  define TLSv1_1_method OPENSSL_MANGLER(TLSv1_1_method)
+# endif
+#else
+# ifndef _TLSv1_1_method
+#  define _TLSv1_1_method OPENSSL_MANGLER_ASM(TLSv1_1_method)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
+# ifndef TLSv1_1_server_method
+#  define TLSv1_1_server_method OPENSSL_MANGLER(TLSv1_1_server_method)
+# endif
+#else
+# ifndef _TLSv1_1_server_method
+#  define _TLSv1_1_server_method OPENSSL_MANGLER_ASM(TLSv1_1_server_method)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
+# ifndef TLSv1_2_client_method
+#  define TLSv1_2_client_method OPENSSL_MANGLER(TLSv1_2_client_method)
+# endif
+#else
+# ifndef _TLSv1_2_client_method
+#  define _TLSv1_2_client_method OPENSSL_MANGLER_ASM(TLSv1_2_client_method)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
 # ifndef TLSv1_2_enc_data
 #  define TLSv1_2_enc_data OPENSSL_MANGLER(TLSv1_2_enc_data)
@@ -41894,4 +42002,22 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
+# ifndef TLSv1_2_method
+#  define TLSv1_2_method OPENSSL_MANGLER(TLSv1_2_method)
+# endif
+#else
+# ifndef _TLSv1_2_method
+#  define _TLSv1_2_method OPENSSL_MANGLER_ASM(TLSv1_2_method)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
+# ifndef TLSv1_2_server_method
+#  define TLSv1_2_server_method OPENSSL_MANGLER(TLSv1_2_server_method)
+# endif
+#else
+# ifndef _TLSv1_2_server_method
+#  define _TLSv1_2_server_method OPENSSL_MANGLER_ASM(TLSv1_2_server_method)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
 # ifndef TLSv1_3_enc_data
 #  define TLSv1_3_enc_data OPENSSL_MANGLER(TLSv1_3_enc_data)
@@ -41903,4 +42029,13 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
+# ifndef TLSv1_client_method
+#  define TLSv1_client_method OPENSSL_MANGLER(TLSv1_client_method)
+# endif
+#else
+# ifndef _TLSv1_client_method
+#  define _TLSv1_client_method OPENSSL_MANGLER_ASM(TLSv1_client_method)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
 # ifndef TLSv1_enc_data
 #  define TLSv1_enc_data OPENSSL_MANGLER(TLSv1_enc_data)
@@ -41912,4 +42047,22 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
+# ifndef TLSv1_method
+#  define TLSv1_method OPENSSL_MANGLER(TLSv1_method)
+# endif
+#else
+# ifndef _TLSv1_method
+#  define _TLSv1_method OPENSSL_MANGLER_ASM(TLSv1_method)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
+# ifndef TLSv1_server_method
+#  define TLSv1_server_method OPENSSL_MANGLER(TLSv1_server_method)
+# endif
+#else
+# ifndef _TLSv1_server_method
+#  define _TLSv1_server_method OPENSSL_MANGLER_ASM(TLSv1_server_method)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
 # ifndef TS_ACCURACY_dup
 #  define TS_ACCURACY_dup OPENSSL_MANGLER(TS_ACCURACY_dup)
@@ -50840,13 +50993,4 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
-# ifndef bn_add_words
-#  define bn_add_words OPENSSL_MANGLER(bn_add_words)
-# endif
-#else
-# ifndef _bn_add_words
-#  define _bn_add_words OPENSSL_MANGLER_ASM(bn_add_words)
-# endif
-#endif
-#ifndef OPENSSL_MANGLE_ASM
 # ifndef bn_cmp_part_words
 #  define bn_cmp_part_words OPENSSL_MANGLER(bn_cmp_part_words)
@@ -50912,13 +51056,4 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
-# ifndef bn_div_words
-#  define bn_div_words OPENSSL_MANGLER(bn_div_words)
-# endif
-#else
-# ifndef _bn_div_words
-#  define _bn_div_words OPENSSL_MANGLER_ASM(bn_div_words)
-# endif
-#endif
-#ifndef OPENSSL_MANGLE_ASM
 # ifndef bn_expand2
 #  define bn_expand2 OPENSSL_MANGLER(bn_expand2)
@@ -51038,13 +51173,4 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
-# ifndef bn_mul_add_words
-#  define bn_mul_add_words OPENSSL_MANGLER(bn_mul_add_words)
-# endif
-#else
-# ifndef _bn_mul_add_words
-#  define _bn_mul_add_words OPENSSL_MANGLER_ASM(bn_mul_add_words)
-# endif
-#endif
-#ifndef OPENSSL_MANGLE_ASM
 # ifndef bn_mul_comba4
 #  define bn_mul_comba4 OPENSSL_MANGLER(bn_mul_comba4)
@@ -51056,13 +51182,4 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
-# ifndef bn_mul_comba4
-#  define bn_mul_comba4 OPENSSL_MANGLER(bn_mul_comba4)
-# endif
-#else
-# ifndef _bn_mul_comba4
-#  define _bn_mul_comba4 OPENSSL_MANGLER_ASM(bn_mul_comba4)
-# endif
-#endif
-#ifndef OPENSSL_MANGLE_ASM
 # ifndef bn_mul_comba8
 #  define bn_mul_comba8 OPENSSL_MANGLER(bn_mul_comba8)
@@ -51074,13 +51191,4 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
-# ifndef bn_mul_comba8
-#  define bn_mul_comba8 OPENSSL_MANGLER(bn_mul_comba8)
-# endif
-#else
-# ifndef _bn_mul_comba8
-#  define _bn_mul_comba8 OPENSSL_MANGLER_ASM(bn_mul_comba8)
-# endif
-#endif
-#ifndef OPENSSL_MANGLE_ASM
 # ifndef bn_mul_fixed_top
 #  define bn_mul_fixed_top OPENSSL_MANGLER(bn_mul_fixed_top)
@@ -51173,13 +51281,4 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
-# ifndef bn_mul_words
-#  define bn_mul_words OPENSSL_MANGLER(bn_mul_words)
-# endif
-#else
-# ifndef _bn_mul_words
-#  define _bn_mul_words OPENSSL_MANGLER_ASM(bn_mul_words)
-# endif
-#endif
-#ifndef OPENSSL_MANGLE_ASM
 # ifndef bn_power5
 #  define bn_power5 OPENSSL_MANGLER(bn_power5)
@@ -51254,13 +51353,4 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
-# ifndef bn_sqr_comba4
-#  define bn_sqr_comba4 OPENSSL_MANGLER(bn_sqr_comba4)
-# endif
-#else
-# ifndef _bn_sqr_comba4
-#  define _bn_sqr_comba4 OPENSSL_MANGLER_ASM(bn_sqr_comba4)
-# endif
-#endif
-#ifndef OPENSSL_MANGLE_ASM
 # ifndef bn_sqr_comba8
 #  define bn_sqr_comba8 OPENSSL_MANGLER(bn_sqr_comba8)
@@ -51272,13 +51362,4 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
-# ifndef bn_sqr_comba8
-#  define bn_sqr_comba8 OPENSSL_MANGLER(bn_sqr_comba8)
-# endif
-#else
-# ifndef _bn_sqr_comba8
-#  define _bn_sqr_comba8 OPENSSL_MANGLER_ASM(bn_sqr_comba8)
-# endif
-#endif
-#ifndef OPENSSL_MANGLE_ASM
 # ifndef bn_sqr_fixed_top
 #  define bn_sqr_fixed_top OPENSSL_MANGLER(bn_sqr_fixed_top)
@@ -51317,13 +51398,4 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
-# ifndef bn_sqr_words
-#  define bn_sqr_words OPENSSL_MANGLER(bn_sqr_words)
-# endif
-#else
-# ifndef _bn_sqr_words
-#  define _bn_sqr_words OPENSSL_MANGLER_ASM(bn_sqr_words)
-# endif
-#endif
-#ifndef OPENSSL_MANGLE_ASM
 # ifndef bn_sub_part_words
 #  define bn_sub_part_words OPENSSL_MANGLER(bn_sub_part_words)
@@ -51344,13 +51416,4 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
-# ifndef bn_sub_words
-#  define bn_sub_words OPENSSL_MANGLER(bn_sub_words)
-# endif
-#else
-# ifndef _bn_sub_words
-#  define _bn_sub_words OPENSSL_MANGLER_ASM(bn_sub_words)
-# endif
-#endif
-#ifndef OPENSSL_MANGLE_ASM
 # ifndef bn_to_mont_fixed_top
 #  define bn_to_mont_fixed_top OPENSSL_MANGLER(bn_to_mont_fixed_top)
@@ -60902,4 +60965,13 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
+# ifndef ossl_c_locale
+#  define ossl_c_locale OPENSSL_MANGLER(ossl_c_locale)
+# endif
+#else
+# ifndef _ossl_c_locale
+#  define _ossl_c_locale OPENSSL_MANGLER_ASM(ossl_c_locale)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
 # ifndef ossl_camellia128cbc_cts_functions
 #  define ossl_camellia128cbc_cts_functions OPENSSL_MANGLER(ossl_camellia128cbc_cts_functions)
@@ -63404,4 +63476,13 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
+# ifndef ossl_deinit_casecmp
+#  define ossl_deinit_casecmp OPENSSL_MANGLER(ossl_deinit_casecmp)
+# endif
+#else
+# ifndef _ossl_deinit_casecmp
+#  define _ossl_deinit_casecmp OPENSSL_MANGLER_ASM(ossl_deinit_casecmp)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
 # ifndef ossl_des_cbc_functions
 #  define ossl_des_cbc_functions OPENSSL_MANGLER(ossl_des_cbc_functions)
@@ -64070,13 +64151,4 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
-# ifndef ossl_digest_rsa_sign_get_md_nid
-#  define ossl_digest_rsa_sign_get_md_nid OPENSSL_MANGLER(ossl_digest_rsa_sign_get_md_nid)
-# endif
-#else
-# ifndef _ossl_digest_rsa_sign_get_md_nid
-#  define _ossl_digest_rsa_sign_get_md_nid OPENSSL_MANGLER_ASM(ossl_digest_rsa_sign_get_md_nid)
-# endif
-#endif
-#ifndef OPENSSL_MANGLE_ASM
 # ifndef ossl_do_PVK_header
 #  define ossl_do_PVK_header OPENSSL_MANGLER(ossl_do_PVK_header)
@@ -67400,4 +67472,13 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
+# ifndef ossl_init_casecmp
+#  define ossl_init_casecmp OPENSSL_MANGLER(ossl_init_casecmp)
+# endif
+#else
+# ifndef _ossl_init_casecmp
+#  define _ossl_init_casecmp OPENSSL_MANGLER_ASM(ossl_init_casecmp)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
 # ifndef ossl_init_thread
 #  define ossl_init_thread OPENSSL_MANGLER(ossl_init_thread)
@@ -71567,13 +71648,4 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
-# ifndef ossl_securitycheck_enabled
-#  define ossl_securitycheck_enabled OPENSSL_MANGLER(ossl_securitycheck_enabled)
-# endif
-#else
-# ifndef _ossl_securitycheck_enabled
-#  define _ossl_securitycheck_enabled OPENSSL_MANGLER_ASM(ossl_securitycheck_enabled)
-# endif
-#endif
-#ifndef OPENSSL_MANGLE_ASM
 # ifndef ossl_seed128cbc_functions
 #  define ossl_seed128cbc_functions OPENSSL_MANGLER(ossl_seed128cbc_functions)
@@ -74393,4 +74465,13 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
+# ifndef ssl_cert_get_cert_store
+#  define ssl_cert_get_cert_store OPENSSL_MANGLER(ssl_cert_get_cert_store)
+# endif
+#else
+# ifndef _ssl_cert_get_cert_store
+#  define _ssl_cert_get_cert_store OPENSSL_MANGLER_ASM(ssl_cert_get_cert_store)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
 # ifndef ssl_cert_is_disabled
 #  define ssl_cert_is_disabled OPENSSL_MANGLER(ssl_cert_is_disabled)
@@ -75581,4 +75662,13 @@
 #endif
 #ifndef OPENSSL_MANGLE_ASM
+# ifndef tls13_set_encoded_pub_key
+#  define tls13_set_encoded_pub_key OPENSSL_MANGLER(tls13_set_encoded_pub_key)
+# endif
+#else
+# ifndef _tls13_set_encoded_pub_key
+#  define _tls13_set_encoded_pub_key OPENSSL_MANGLER_ASM(tls13_set_encoded_pub_key)
+# endif
+#endif
+#ifndef OPENSSL_MANGLE_ASM
 # ifndef tls13_setup_key_block
 #  define tls13_setup_key_block OPENSSL_MANGLER(tls13_setup_key_block)
Index: /trunk/src/libs/openssl-3.0.3/providers/common/capabilities.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/common/capabilities.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/common/capabilities.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -218,5 +218,5 @@
                                OSSL_CALLBACK *cb, void *arg)
 {
-    if (strcasecmp(capability, "TLS-GROUP") == 0)
+    if (OPENSSL_strcasecmp(capability, "TLS-GROUP") == 0)
         return tls_group_capability(cb, arg);
 
Index: /trunk/src/libs/openssl-3.0.3/providers/fips-sources.checksums
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/fips-sources.checksums	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/fips-sources.checksums	(revision 95219)
@@ -73,6 +73,6 @@
 2893b6d03d4850d09c15959941b0759bbb50d8c20e873bed088e7cde4e15a65a  crypto/bn/bn_ctx.c
 d94295953ab91469fe2b9da2a542b8ea11ac38551ecde8f8202b7f645c2dea16  crypto/bn/bn_dh.c
-a837ba52750ab30a57b6dd2fd4cf901e18a891a189b089f83add2f5dc8138eb7  crypto/bn/bn_div.c
-160ea2c916774d6a7f8130e0a05cad7c0a954b4726c15017b3df67e3285231f3  crypto/bn/bn_exp.c
+74b63a4515894592b7241fb30b91b21510beaa3d397809e3d74bc9a73e879d18  crypto/bn/bn_div.c
+692e200e66389991eb2e6fe9d9a62eda5fe9005cda834b8af1a435a811b6b3c9  crypto/bn/bn_exp.c
 ec2b6e3af6df473a23e7f1a8522f2554cb0eb5d34e3282458c4a66d242278434  crypto/bn/bn_exp2.c
 b32d83cee8c00d837a7e4fb8af3f5cf17cb8d2419302e8f5fbcf62119092e874  crypto/bn/bn_gcd.c
@@ -102,11 +102,11 @@
 c39334b70e1394e43f378ae8d31b6e6dc125e4d9181e6536d38e649c4eaadb75  crypto/buffer/buffer.c
 23d46ae37a8d9452c0c88418d2cb8350153f8c2c6060234130a2e429da2370e0  crypto/cmac/cmac.c
-7f24e4937e0af857e233afbb6a7f25b09b1e5674185242a5cc8f579a45bbf1da  crypto/context.c
+58068d6533fed9359b164ddc9711b2dd7b2a76f32ad94103d91dbe3462ac95d8  crypto/context.c
 83b8912fb01bacfe0b5269c7afa69db7e1718530cce1ed27870abef1407951d6  crypto/core_algorithm.c
 60321d1af7bf9697d969438f6b319fbcb4fdc1a47a0b056d02b971973a8550ca  crypto/core_fetch.c
-7d090f71175f28fdc400455fdbc68340a545556d16cb1f6251ac92ebb63a38c1  crypto/core_namemap.c
+02670d631bf0f34cca1e3477079d7fe5de4e03c391cf3992986f44f55319597c  crypto/core_namemap.c
 469e2f53b5f76cd487a60d3d4c44c8fc3a6c4d08405597ba664661ba485508d3  crypto/cpuid.c
 71f0fff881eb4c5505fb17662f0ea4bbff24c6858c045a013ad8f786b07da5c4  crypto/cryptlib.c
-a3d146afa1d66cc3bbfdc7c106f262b679bb5aecce54e8dee732ae9b3e3333db  crypto/ctype.c
+7e8c8c0b43af045fb31c38a0eb643d5db1316fb832b3b0494809f7c288630ec8  crypto/ctype.c
 8e61d79299003917ac409d129d291f0a63e4ed417811a8b21169b2b918355335  crypto/der_writer.c
 fea3ba4225df97aee90690adf387625b746d8edfdc5af2357ee65151a3d236ac  crypto/des/des_enc.c
@@ -120,6 +120,6 @@
 832e5a1caf9cb0dacfd937fc59252aaac7c5c1bf0ae1a9ebf3c3af6e59dcf4c0  crypto/dh/dh_check.c
 7838e9a35870b0fbcba0aff2f52a2439f64d026e9922bce6e5978c2f22c51120  crypto/dh/dh_gen.c
-70f4cf3485a38cd7d22aa3e965bfe950905f8efec1622e832592a6728498fd78  crypto/dh/dh_group_params.c
-7809cbfd5570db17dcb4bd8f0cf9c5f94337096d39da453d0624c08f071e809f  crypto/dh/dh_kdf.c
+129ee295875e68ad444070b0676f1021eb254cbd87ab22d6baaf7e4e6e59a40b  crypto/dh/dh_group_params.c
+a5cf5cb464b40f1bc5457dc2a6f2c5ec0f050196603cd2ba7037a23ab64adbf7  crypto/dh/dh_kdf.c
 0afa7dd237f9b21b0cfb0de10505facd57eb07ded905d888d43a1de2356d4002  crypto/dh/dh_key.c
 b0046b2c4e1d74ff4e93f2486a00f63728909b8a75cbdd29b9100e607f97995c  crypto/dh/dh_lib.c
@@ -148,5 +148,5 @@
 43423b7ee85a5c740c1d81499ee06f4a17732c7731a598e7429d5e402ee77cf4  crypto/ec/curve448/arch_64/f_impl.h
 1689097ae10e4982a8cbe50c2f6eddb03c83436f331f0b67edb98d6b58adc962  crypto/ec/curve448/arch_64/f_impl64.c
-b35976955a49414313e3823144a898bc58873b755f4e3a772d520cdd63099581  crypto/ec/curve448/curve448.c
+9b408ec0d43f3b6d714ef5963147e2c2abaddc88633db7dd759193d3c56ed727  crypto/ec/curve448/curve448.c
 3c12d90e3fdd59b5d32d63186f1a6f15c75eb73f5035b844a2054356a9459780  crypto/ec/curve448/curve448_local.h
 178fb9863c33174b633c2e7607160b1bedb506d66cc06d53382d87431441f306  crypto/ec/curve448/curve448_tables.c
@@ -162,5 +162,5 @@
 6bbbf570ce31f5b579f7e03ec9f8a774663c7c1eb5e475bd31f8fee94a021ffc  crypto/ec/ec2_smpl.c
 2a71bd8dbe4f427c117d990581709a4ddce07fa8e530794b5a9574fef7c48a0c  crypto/ec/ec_asn1.c
-c07fa05c6885e59913e2ce345ff52ef9dfb0418842de3affa6163ad3e71f9c1b  crypto/ec/ec_backend.c
+88e19ca6b892a3afefb25dab0f9cf8796e2eb8504022dcc10b29d5d3923ce73d  crypto/ec/ec_backend.c
 86e2becf9b3870979e2abefa1bd318e1a31820d275e2b50e03b17fc287abb20a  crypto/ec/ec_check.c
 265f911b9d4aada326a2d52cd8a589b556935c8b641598dcd36c6f85d29ce655  crypto/ec/ec_curve.c
@@ -168,5 +168,5 @@
 28726bc957ea821639b1023e5bff0e77ced61bae31f96c165e33aadfe0bc5c9a  crypto/ec/ec_key.c
 7e40fc646863e0675bbb90f075b809f61bdf0600d8095c8366858d9533ab7700  crypto/ec/ec_kmeth.c
-074a5345ea71ff3fdfb8e0be360391a7640719f1a8a4eae8580c8f02e57af880  crypto/ec/ec_lib.c
+f520a41732e4ca96a74d047b6e8bdca8bdfdc4517c18d27410de33969646abef  crypto/ec/ec_lib.c
 a8a4690e42b4af60aad822aa8b16196df337906af53ea4db926707f7b596ff27  crypto/ec/ec_local.h
 fa901b996eb0e460359cd470843bdb03af7a77a2f1136c5e1d30daef70f3e4d2  crypto/ec/ec_mult.c
@@ -179,5 +179,5 @@
 141cfc1459214555b623517a054a9e8d5e4065a11301237b7247be2c6f397a0a  crypto/ec/ecp_mont.c
 13b30f34aeeb0c98747239bfe91b5f0f14e91b2c1f11db62ebb5950c7219daa0  crypto/ec/ecp_nist.c
-c016eb9412aad8cd1213a2f5b1083df1a1a9cb734dc6cc19d99e706935c81ef2  crypto/ec/ecp_nistz256.c
+f288c23b6f83740956886b2303c64d5a3098c98b530859c3bb4b698c01c1643b  crypto/ec/ecp_nistz256.c
 51cb98e7e9c241e33261589f0d74103238baaa850e333c61ff1da360e127518a  crypto/ec/ecp_oct.c
 b4b7c683279454ba41438f50a015cb63ef056ccb9be0168918dfbae00313dc68  crypto/ec/ecp_smpl.c
@@ -188,8 +188,8 @@
 0e75a058dcbbb62cfe39fec6c4a85385dc1a8fce794e4278ce6cebb29763b82b  crypto/evp/dh_support.c
 7fca5ec7c5723b799a7d84d5803071b8f495511e1baf89d430e6800a5228cdad  crypto/evp/digest.c
-5e2c5d865029ae86855f15e162360d091f28ca0d4c67260700c90aa25faf308b  crypto/evp/ec_support.c
-2724dc804304135bc874bd305e14b811169a9e4a62176220a0d5e83f152c2546  crypto/evp/evp_enc.c
+838277f228cd3025cf95a9cd435e5606ad1fb5d207bbb057aa29892e6a657c55  crypto/evp/ec_support.c
+cfccc525e3806d0932254a94ca1a895fe086da84ae8ad2bf2972e96a12d649d2  crypto/evp/evp_enc.c
 0cd2765bf33d998f96d6e8193b2bf27293bcc6a37b7bef7dfd6ec54952ad3c8f  crypto/evp/evp_fetch.c
-029df8bb80a2fb45c22765234b9041ffce82735108e0b11580fd3fbd805362dd  crypto/evp/evp_lib.c
+c9c399b7848f64832deb6e1704e957423ea93827edb4917fafbb0ff911892a2b  crypto/evp/evp_lib.c
 9ac3d97d756ec008db16dd1952115b551f32b2d0590d9a85e1c87d1c78620257  crypto/evp/evp_local.h
 e822c16fc4dc30f2c86e8598c721a9ddfe46d318ce78f4e8e883cdcf8b936221  crypto/evp/evp_rand.c
@@ -204,15 +204,15 @@
 5b8b0bcd4b720b66ce6bc54090ec333891126bb7f6cce4502daf2333668c3db9  crypto/evp/mac_lib.c
 e7e8eb5683cd3fbd409df888020dc353b65ac291361829cc4131d5bc86c9fcb3  crypto/evp/mac_meth.c
-b976077a1f880768f2f0a1c996a53dfdd363605e4977c56fb37e9c1f84f35aa6  crypto/evp/p_lib.c
+ee87cce7ee44b6f3121d21fd20f00d0c91c494a1a9804319981987f3d093923d  crypto/evp/p_lib.c
 3b4228b92eebd04616ecc3ee58684095313dd5ffd1b43cf698a7d6c202cb4622  crypto/evp/pmeth_check.c
 1f0e9e94e9b0ad322956521b438b78d44cfcd8eb974e8921d05f9e21ba1c05cf  crypto/evp/pmeth_gn.c
-76511fba789089a50ef87774817a5482c33633a76a94ecf7b6e8eb915585575d  crypto/evp/pmeth_lib.c
+ef2f789091e4e3f77fea3b4643ff36d9659b18bf7a8c59929ce3305480a3baef  crypto/evp/pmeth_lib.c
 f3a5cbbccb1078cf1fafd74c4caa9f30827081832fbe6dfa5579b17ef809776c  crypto/evp/signature.c
 b06cb8fd4bd95aae1f66e1e145269c82169257f1a60ef0f78f80a3d4c5131fac  crypto/ex_data.c
 324feb067d0f8deb4334f3e6518f570114cb388c85b24f9232bd931a64ff0a9e  crypto/ffc/ffc_backend.c
-ead786b4f5689ab69d6cca5d49e513e0f90cb558b67e6c5898255f2671f1393d  crypto/ffc/ffc_dh.c
+5fe89ce2ce34848b832a2b5a7ac42c161d7ec214a641b7fb11fb1153f2186f74  crypto/ffc/ffc_dh.c
 82abf1f9645336b7dff5e3fa153899280ecaa27b3dad50e6a9ba94d871961888  crypto/ffc/ffc_key_generate.c
 084ae8e68a9df5785376bb961a998036336ed13092ffd1c4258b56e6a7e0478b  crypto/ffc/ffc_key_validate.c
-67fdf1a07ea118963a55540be2ee21c98b7a5eb8149c8caa26e19d922bf60346  crypto/ffc/ffc_params.c
+ecc0d737ccece492f86262dd45f8f03eef2beacafce8022f91939a372f68ac90  crypto/ffc/ffc_params.c
 5174e008f44909724e0ee7109095ee353e67e9ba77e1ab3bedfcf6eaecab7b6c  crypto/ffc/ffc_params_generate.c
 73dac805abab36cd9df53a421221c71d06a366a4ce479fa788be777f11b47159  crypto/ffc/ffc_params_validate.c
@@ -220,6 +220,6 @@
 0395c1b0834f2f4a0ca1756385f4dc1a4ef6fb925b2db3743df7f57256c5166f  crypto/hmac/hmac_local.h
 f897493b50f4e9dd4cacb2a7accda6683c10ece602641874cdff1dac7128a751  crypto/initthread.c
-f0782ee92b6ebf5a0e66b970ecfbd9c9c6fc4a35ccd055967fbb402577c234ab  crypto/lhash/lhash.c
-73d63f91fbaba47649231636c5afdf76d049a46436fde9fbb2e107cf16bb879e  crypto/lhash/lhash_local.h
+5482c47c266523129980302426d25839fda662f1544f4b684707e6b272a952c9  crypto/lhash/lhash.c
+5d49ce00fc06df1b64cbc139ef45c71e0faf08a33f966bc608c82d574521a49e  crypto/lhash/lhash_local.h
 f866aafae928db1b439ac950dc90744a2397dfe222672fe68b3798396190c8b0  crypto/mem_clr.c
 183bdca6f855182d7d2c78a5c961b34283f85ea69ac828b700605ee82546397d  crypto/modes/asm/aes-gcm-armv8_64.pl
@@ -249,10 +249,10 @@
 c2fe815fb3fd5efe9a6544cae55f9469063a0f6fb728361737b927f6182ae0bb  crypto/param_build_set.c
 02dfeb286c85567bb1b6323a53c089ba66447db97695cc78eceb6677fbc76bf9  crypto/params.c
-4f2a8c9acf5898fdc1e4bf98813049947221cd9a1db04faaa490250591f54cb4  crypto/params_dup.c
+4fda13f6af05d80b0ab89ec4f5813c274a21a9b4565be958a02d006236cef05c  crypto/params_dup.c
 a0097ff2da8955fe15ba204cb54f3fd48a06f846e2b9826f507b26acf65715c3  crypto/params_from_text.c
 2140778d5f35e503e22b173736e18ff84406f6657463e8ff9e7b91a78aa686d3  crypto/property/defn_cache.c
 9153343b26e5c2c4f6009d37a12d6af85681ed0c7d3f58de2ace44dfd789a59b  crypto/property/property.c
 a2c69527b60692a8b07cfdfe7e75f654daa092411d5de5e02b446a4ef3752855  crypto/property/property_local.h
-c3217b73871d93d81ab9f15e9f1fc37ea609bbe4bbc0c1b84ec62a99c91f6756  crypto/property/property_parse.c
+b87bfb053457cbe1cedad3a53cce044375d2f429c75d0c97c2a61def59080644  crypto/property/property_parse.c
 a7cefda6a117550e2c76e0f307565ce1e11640b11ba10c80e469a837fd1212a3  crypto/property/property_query.c
 065698c8d88a5facc0cbc02a3bd0c642c94687a8c5dd79901c942138b406067d  crypto/property/property_string.c
@@ -263,5 +263,5 @@
 fd03b9bb2c23470fa40880ed3bf9847bb17d50592101a78c0ad7a0f121209788  crypto/rand/rand_local.h
 f0c8792a99132e0b9c027cfa7370f45594a115934cdc9e8f23bdd64abecaf7fd  crypto/rsa/rsa_acvp_test_params.c
-054f8e32eabb218d219a5fa8cb40f6e76bc5a395d03e4f83c5f2b703a5a476b9  crypto/rsa/rsa_backend.c
+b89d28722134386072670ddc4d5cbff736d1649c114f38d964892f21420c13bf  crypto/rsa/rsa_backend.c
 38a102cd1da1f6ca5a46e6a22f018237964336274385f5c70cbedcaa6997647e  crypto/rsa/rsa_chk.c
 e32cfa04221a2a3ea33f7bcb93ee51b84cbeba97e94c1fbf6e420b24f97fc9ce  crypto/rsa/rsa_crpt.c
@@ -329,12 +329,12 @@
 8038a5a97f826f519424db634be5b082b3f7eca3ccb89875ca40fa6bd7dfdcfd  crypto/sha/sha512.c
 6c6f0e6069ac98e407a5810b84deace2d1396d252c584703bcd154d1a015c3ea  crypto/sha/sha_local.h
-86913a593b55c759a3824eeede398f966278d79c148bef41986c5ac4e48f0bd7  crypto/sparse_array.c
+4f6b66f811144648d6cb6bc26e08779529acbbd563519590c726d0e51699fe96  crypto/sparse_array.c
 b39e5ba863af36e455cc5864fe8c5d0fc05a6aaef0d528a115951d1248e8fa8b  crypto/stack/stack.c
 7b4efa594d8d1f3ecbf4605cf54f72fb296a3b1d951bdc69e415aaa08f34e5c8  crypto/threads_lib.c
 a41ae93a755e2ec89b3cb5b4932e2b508fdda92ace2e025a2650a6da0e9e972c  crypto/threads_none.c
-ebb210a22c280839853920bee245eb769c713ab99cb35a468ed2b1df0d112a7f  crypto/threads_pthread.c
+2637a8727dee790812b000f2e02b336f7907949df633dda72938bbaafdb204fe  crypto/threads_pthread.c
 68e1cdeb948d3a106b5a27b76bcddbae6bb053b2bdc4a21a1fec9797a00cd904  crypto/threads_win.c
 fd6c27cf7c6b5449b17f2b725f4203c4c10207f1973db09fd41571efe5de08fd  crypto/x86_64cpuid.pl
-d13560a5f8a66d7b956d54cd6bf24eade529d686992d243bfb312376a57b475e  e_os.h
+84c4331bbe99471706fadf97299c660dca46f663c2526f33c3424656215aa0c5  e_os.h
 6f353dc7c8c4d8f24f7ffbf920668ccb224ebb5810805a7c80d96770cd858005  include/crypto/aes_platform.h
 8c6f308c1ca774e6127e325c3b80511dbcdc99631f032694d8db53a5c02364ee  include/crypto/asn1_dsa.h
@@ -343,5 +343,5 @@
 7a43a4898fcc8446065e6c99249bcc14e475716e8c1d40d50408c0ab179520e6  include/crypto/bn_dh.h
 e69b2b20fb415e24b970941c84a62b752b5d0175bc68126e467f7cc970495504  include/crypto/cryptlib.h
-5ee1ea30382bef9869f29b6610665ca304f3b9cf3653746a2d02c64b1a24f103  include/crypto/ctype.h
+cf1d91147fb3f6cd02387c7fe219ff2efd8c060e9a8501d1c2245fbdb21bf7a6  include/crypto/ctype.h
 89693e0a7528a9574e1d2f80644b29e3b895d3684111dd07c18cc5bed28b45b7  include/crypto/des_platform.h
 daf508bb7ed5783f1c8c622f0c230e179244dd3f584e1223a19ab95930fbcb4f  include/crypto/dh.h
@@ -362,5 +362,5 @@
 782a83d4e489fd865e2768a20bfa31e78c2071fd0ceeb9eb077276ae2bcc6590  include/internal/bio.h
 92aacb3e49288f91b44f97e41933e88fe455706e1dd21a365683c2ab545db131  include/internal/constant_time.h
-71ddae419297069056065ab71f32fe88b09ddbe4db2200a759fedd8ad4349628  include/internal/core.h
+1f92626d81730616fb459849c1c7fb0ec105f2ffb0e51edaa0a64307bc1e1027  include/internal/core.h
 d7ddeab97434a21cb2cad1935a3cb130f6cd0b3c75322463d431c5eab3ab1ae1  include/internal/cryptlib.h
 9571cfd3d5666749084b354a6d65adee443deeb5713a58c098c7b03bc69dbc63  include/internal/deprecated.h
@@ -403,5 +403,5 @@
 00110e80b9b4f621c604ea99f05e7a75d3db4721fc2779224e6fa7e52f06e345  include/openssl/core_dispatch.h
 cbd9d7855ca3ba4240207fc025c22bbfef7411116446ff63511e336a0559bed0  include/openssl/core_names.h
-8880892256a4d2dd7a9be91f23518f71e5037dbd377cd41bdb4c1f3cb3c7ee2d  include/openssl/crypto.h.in
+194f96a30bdc4dab3f65693c09326ef53c54ebfd613c2513d8258a0aa35a6996  include/openssl/crypto.h.in
 1d1697bd3e35920ff9eaec23c29472d727a7fc4d108150957f41f6f5ecf80f1a  include/openssl/cryptoerr.h
 bbc82260cbcadd406091f39b9e3b5ea63146d9a4822623ead16fa12c43ab9fc6  include/openssl/cryptoerr_legacy.h
@@ -414,5 +414,5 @@
 bc9ec2be442a4f49980ba2c63c8f0da701de1f6e23d7db35d781658f833dd7b9  include/openssl/ebcdic.h
 33b6321d1c6b7b1621198346946401bb81472054aa236b03c6f22f247248d2ad  include/openssl/ec.h
-cbbf74efc7fdb020f06840c856ad7fe97553944f4cc3c197fbb004de38158048  include/openssl/ecerr.h
+dad1943d309aaadb800be4a3056096abec611d81982b83c601b482405e11d5c0  include/openssl/ecerr.h
 61c76ee3f12ed0e42503a56421ca00f1cb9a0f4caa5f9c4421c374bcd45917d7  include/openssl/encoder.h
 69dd983f45b8ccd551f084796519446552963a18c52b70470d978b597c81b2dc  include/openssl/encodererr.h
@@ -449,5 +449,5 @@
 873d2ec2054ec24c52df4abe830cb2b9666fe4e75cc62b4de0f50ef9d20c5812  include/openssl/types.h
 c0a9551efccf43f3dd748d4fd8ec897ddaabbc629c00ec1ad76ce983e1195a13  providers/common/bio_prov.c
-e7c39ef7b76668dae1470ce0edd7254da2937569762cebbf20e08fb97cb3324c  providers/common/capabilities.c
+4546387d6642603c81ec4cd8d5fc4af8ba60ac7359eb6f31e7d24827031e68ad  providers/common/capabilities.c
 f94b7435d4ec888ec30df1c611afa8b9eedbb59e905a2c7cb17cfc8c4b9b85b8  providers/common/der/der_digests_gen.c.in
 424d7b2ece984a0904b80c73e541400c6e2d50a285c397dd323b440a4f2a8d8e  providers/common/der/der_dsa_gen.c.in
@@ -483,6 +483,6 @@
 527eda471e26763a5fcf123b2d290234d5c836de7b8ef6eef2166ef439919d82  providers/common/securitycheck_fips.c
 abd5997bc33b681a4ab275978b92aebca0806a4a3f0c2f41dacf11b3b6f4e101  providers/fips/fips_entry.c
-a4dc9bf2d77e34175737b7b8d28fbe90815ac0e2904e3ac2d9e2a271f345ef20  providers/fips/fipsprov.c
-fdbaf748044ce54f13e673b92db876e32436e4d5644f443cc43d063112a89676  providers/fips/self_test.c
+c458e4830c0cd31e4aabef0e33c2011079f201c6bbaee59b59cefab70eb9c7b4  providers/fips/fipsprov.c
+24a2e1a855de57b9d970727fcc11ebe7e06c0d4884d3cedbacf59fa471f91e72  providers/fips/self_test.c
 f822a03138e8b83ccaa910b89d72f31691da6778bf6638181f993ec7ae1167e3  providers/fips/self_test.h
 5b3379a3d382c4dad37841dbd58b77ed5ff712b0a37c485771b828fa9b39c351  providers/fips/self_test_data.inc
@@ -514,5 +514,5 @@
 281157d1da4d7285d878978e6d42d0d33b3a6bc16e3bc5b6879e39093a7d70da  providers/implementations/ciphers/cipher_aes_xts_fips.c
 f358c4121a8a223e2c6cf009fd28b8a195520279016462890214e8858880f632  providers/implementations/ciphers/cipher_aes_xts_hw.c
-f2e7404005e0602c4cc90b49b7af7453aa5b8644720ca1028d93e78bc28a7c09  providers/implementations/ciphers/cipher_cts.c
+46ba8271917b53fd8fdf77aee19cc326a219c950b94e043d6d118dcac25ad7ad  providers/implementations/ciphers/cipher_cts.c
 74640ce402acc704af72e055fb7f27e6aa8efd417babc56f710478e571d8631c  providers/implementations/ciphers/cipher_cts.h
 fcc3bb0637864252402aaa9d543209909df9a39611127f777b168bc888498dc0  providers/implementations/ciphers/cipher_tdes.c
@@ -545,29 +545,29 @@
 29d1a112b799e1f45fdf8bcee8361c2ed67428c250c1cdf408a9fbb7ebf4cce1  providers/implementations/include/prov/names.h
 2187713b446d8b6d24ee986748b941ac3e24292c71e07ff9fb53a33021decdda  providers/implementations/include/prov/seeding.h
-432e2d5e467a50bd031a6b94b27072f5d66f4fadb6d62c9bfd9453d444c2aedf  providers/implementations/kdfs/hkdf.c
-06c93b62806819ee51f69c899413fda5be2435d43a70ef467b77a7296cd9528a  providers/implementations/kdfs/kbkdf.c
+86026710ea733f0dd44e400c43e7dab745526f2255816f48a6b00dd8b8009879  providers/implementations/kdfs/hkdf.c
+a62e3af09f5af84dcf36f951ba4ac90ca1694adaf3747126186020b155f94186  providers/implementations/kdfs/kbkdf.c
 e0644e727aacfea4da3cf2c4d2602d7ef0626ebb760b6467432ffd54d5fbb24d  providers/implementations/kdfs/pbkdf2.c
 c0778565abff112c0c5257329a7750ec4605e62f26cc36851fa1fbee6e03c70c  providers/implementations/kdfs/pbkdf2.h
 abe2b0f3711eaa34846e155cffc9242e4051c45de896f747afd5ac9d87f637dc  providers/implementations/kdfs/pbkdf2_fips.c
-66d30c754c1e16d97a8e989f7f2e89eab59ec40ca3731dea664ba56ec38c4002  providers/implementations/kdfs/sshkdf.c
+9cc42a4b0a8089e6d1be64637dbb9e41bd21ae5e3386022a27a8f29308ad25c9  providers/implementations/kdfs/sshkdf.c
 7c692170729ab1d648564abdbf9bcbba5071f9a81a25fab9eae66899316bcd4a  providers/implementations/kdfs/sskdf.c
-3c46ec0e14be09a133d709c3a1c3d5ab05a4f1ed5385c3e7a1afb2f0ee47ef7a  providers/implementations/kdfs/tls1_prf.c
+7d258a469fac4d5ae99c785bae5f490044c593ed13a02a861b1d33339ee167e0  providers/implementations/kdfs/tls1_prf.c
 27bb6ee5e2d00c545635c0c29402b10e74a1831adbc9800c159cbe04f2bfa2f7  providers/implementations/kdfs/x942kdf.c
-f419a9f6b17cfba1543a3690326188ac8335db66807c58de211a3d69e18f7d4d  providers/implementations/kem/rsa_kem.c
+6b6c776b12664164f3cb54c21df61e1c4477c7855d89431a16fb338cdae58d43  providers/implementations/kem/rsa_kem.c
 7628cfd7c88f37faa557c671a78ff56266691d64075104a514a28cb6fb9a6816  providers/implementations/keymgmt/dh_kmgmt.c
-68d5cad49334ad0ee6948329b3784bb43eede84c3bc59ff22cbbe7aed9292672  providers/implementations/keymgmt/dsa_kmgmt.c
-3e2798d299d6571c973fc75468e2ac025b7c893ae2f15f14e057430325622a69  providers/implementations/keymgmt/ec_kmgmt.c
+9dc19fb4e9775e93b233fa93212e60f0959faa61248f853db75f3281e2535e95  providers/implementations/keymgmt/dsa_kmgmt.c
+c68b2331f2863d0d92725367c16a6a68b1243c672c14dde13768ed4afd9c7418  providers/implementations/keymgmt/ec_kmgmt.c
 258ae17bb2dd87ed1511a8eb3fe99eed9b77f5c2f757215ff6b3d0e8791fc251  providers/implementations/keymgmt/ec_kmgmt_imexport.inc
-8871260c1b05832efa8363e5546210004da1683fee74da6c749ebba802b40f2b  providers/implementations/keymgmt/ecx_kmgmt.c
+d77ece2494e6b12a6201a2806ee5fb24a6dc2fa3e1891a46012a870e0b781ab1  providers/implementations/keymgmt/ecx_kmgmt.c
 053a2be39a87f50b877ebdbbf799cf5faf8b2de33b04311d819d212ee1ea329b  providers/implementations/keymgmt/kdf_legacy_kmgmt.c
-260c560930c5aca61225a40ed49dfbb905f2b1fa50728d1388e946358f9d5e18  providers/implementations/keymgmt/mac_legacy_kmgmt.c
+e30357311e4a3e1c78266af6315fd1fc99584bfb09f4a7cd0ddc7261cf1e17e1  providers/implementations/keymgmt/mac_legacy_kmgmt.c
 d469be20a6d1a3744c1a2d5c26cb3b8ff6339a2242d4ef6e5ed9531551f717c1  providers/implementations/keymgmt/rsa_kmgmt.c
-79da66d4b696388d7eab6b2126bccc88908915813d79c4305b8b4d545a500469  providers/implementations/macs/cmac_prov.c
-41464d1e640434bb3ff9998f093829d5e2c1963d68033dca7d31e5ab75365fb1  providers/implementations/macs/gmac_prov.c
-282c1065f18c87073529ed1bdc2c0b3a1967701728084de6632ddc72c671d209  providers/implementations/macs/hmac_prov.c
+aeb42590728ca87b916b8a3d337351b1c82ee0747213e5ce740c2350b3db7185  providers/implementations/macs/cmac_prov.c
+93fa712c692bd5c93d3802b2554d5df33ea9d0b8987f9c92aa88358089a4bdfa  providers/implementations/macs/gmac_prov.c
+400a054d449cdee1f308644f1314bdc044fd0fdf793ae58ffa4e4aac6c0498d3  providers/implementations/macs/hmac_prov.c
 aa7ba1d39ea4e3347294eb50b4dfcb895ef1a22bd6117d3b076a74e9ff11c242  providers/implementations/macs/kmac_prov.c
 bf30274dd6b528ae913984775bd8f29c6c48c0ef06d464d0f738217727b7aa5c  providers/implementations/rands/crngt.c
 c7236e6e2e8adce14f8206da0ceef63c7974d4ba1a7dd71b94fa100cac6b46ba  providers/implementations/rands/drbg.c
-b1e7a0b2610aaab5800af7ede0df13a184f4a321a4084652cdb509357c55783b  providers/implementations/rands/drbg_ctr.c
+bb5f8161a80d0d1a7ee919af2b167972b00afd62e326252ca6aa93101f315f19  providers/implementations/rands/drbg_ctr.c
 a05adc3f6d9d6f948e5ead75f0522ed3164cb5b2d301169242f3cb97c4a7fac3  providers/implementations/rands/drbg_hash.c
 0876dfae991028c569631938946e458e6829cacf4cfb673d2b144ae50a3160bb  providers/implementations/rands/drbg_hmac.c
@@ -578,5 +578,5 @@
 b057870cf8be1fd28834670fb092f0e6f202424c7ae19282fe9df4e52c9ce036  providers/implementations/signature/eddsa_sig.c
 3bb0f342b4cc1b4594ed0986adc47791c0a7b5c1ae7b1888c1fb5edb268a78d9  providers/implementations/signature/mac_legacy_sig.c
-cee0e3304cc365ef76b422363ef12affc4d03670fd2ab2c8f3babc38f9d5db37  providers/implementations/signature/rsa_sig.c
+2334c8bba705032b8c1db5dd28e024a45a73b72cae82a2d815fe855445a49d10  providers/implementations/signature/rsa_sig.c
 c8df17850314b145ca83d4037207d6bf0994f9c34e6e55116860cf575df58e81  ssl/record/tls_pad.c
 3f2e01a98d9e3fda6cc5cb4b44dd43f6cae4ec34994e8f734d11b1e643e58636  ssl/s3_cbc.c
Index: /trunk/src/libs/openssl-3.0.3/providers/fips.checksum
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/fips.checksum	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/fips.checksum	(revision 95219)
@@ -1,1 +1,1 @@
-0223646a9f0ba5ca3bd4dc320fe5a647c8b4d48cc1e273b09acceeabc035c19e  providers/fips-sources.checksums
+d0e2cb7b2818aed1f4d89da6323f20372c8834c3f57f9dfd1c5e9f908d7e420a  providers/fips-sources.checksums
Index: /trunk/src/libs/openssl-3.0.3/providers/fips/fipsprov.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/fips/fipsprov.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/fips/fipsprov.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -23,4 +23,5 @@
 #include "prov/seeding.h"
 #include "self_test.h"
+#include "internal/core.h"
 
 static const char FIPS_DEFAULT_PROPERTIES[] = "provider=fips,fips=yes";
@@ -35,4 +36,20 @@
 static OSSL_FUNC_provider_get_params_fn fips_get_params;
 static OSSL_FUNC_provider_query_operation_fn fips_query;
+
+/* Locale object accessor functions */
+#ifdef OPENSSL_SYS_MACOSX
+# include <xlocale.h>
+#else
+# include <locale.h>
+#endif
+
+#if defined OPENSSL_SYS_WINDOWS
+# define locale_t _locale_t
+# define freelocale _free_locale
+#endif
+static locale_t loc;
+
+static int fips_init_casecmp(void);
+static void fips_deinit_casecmp(void);
 
 #define ALGC(NAMES, FUNC, CHECK) { { NAMES, FIPS_DEFAULT_PROPERTIES, FUNC }, CHECK }
@@ -487,4 +504,21 @@
 }
 
+void *ossl_c_locale() {
+    return (void *)loc;
+}
+
+static int fips_init_casecmp(void) {
+# ifdef OPENSSL_SYS_WINDOWS
+    loc = _create_locale(LC_COLLATE, "C");
+# else
+    loc = newlocale(LC_COLLATE_MASK, "C", (locale_t) 0);
+# endif
+    return (loc == (locale_t) 0) ? 0 : 1;
+}
+
+static void fips_deinit_casecmp(void) {
+    freelocale(loc);
+}
+
 static void fips_teardown(void *provctx)
 {
@@ -499,4 +533,5 @@
      * so no need to destroy it here.
      */
+    fips_deinit_casecmp();
     ossl_prov_ctx_free(provctx);
 }
@@ -548,4 +583,6 @@
     memset(&selftest_params, 0, sizeof(selftest_params));
 
+    if (!fips_init_casecmp())
+        return 0;
     if (!ossl_prov_seeding_from_dispatch(in))
         return 0;
Index: /trunk/src/libs/openssl-3.0.3/providers/fips/self_test.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/fips/self_test.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/fips/self_test.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -104,4 +104,11 @@
     return TRUE;
 }
+
+#elif defined(__GNUC__)
+# undef DEP_INIT_ATTRIBUTE
+# undef DEP_FINI_ATTRIBUTE
+# define DEP_INIT_ATTRIBUTE static __attribute__((constructor))
+# define DEP_FINI_ATTRIBUTE static __attribute__((destructor))
+
 #elif defined(__sun)
 # pragma init(init)
@@ -125,10 +132,4 @@
 # pragma init "init"
 # pragma fini "cleanup"
-
-#elif defined(__GNUC__)
-# undef DEP_INIT_ATTRIBUTE
-# undef DEP_FINI_ATTRIBUTE
-# define DEP_INIT_ATTRIBUTE static __attribute__((constructor))
-# define DEP_FINI_ATTRIBUTE static __attribute__((destructor))
 
 #elif defined(__TANDEM)
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/ciphers/cipher_cts.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/ciphers/cipher_cts.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/ciphers/cipher_cts.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -47,5 +47,4 @@
  */
 
-#include "e_os.h" /* strcasecmp */
 #include <openssl/core_names.h>
 #include "prov/ciphercommon.h"
@@ -93,5 +92,5 @@
 
     for (i = 0; i < OSSL_NELEM(cts_modes); ++i) {
-        if (strcasecmp(name, cts_modes[i].name) == 0)
+        if (OPENSSL_strcasecmp(name, cts_modes[i].name) == 0)
             return (int)cts_modes[i].id;
     }
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/ciphers/cipher_rc4_hmac_md5.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/ciphers/cipher_rc4_hmac_md5.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/ciphers/cipher_rc4_hmac_md5.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -184,5 +184,5 @@
         ctx->tls_aad_pad_sz = sz;
     }
-    p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_AEAD_TLS1_AAD);
+    p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_AEAD_MAC_KEY);
     if (p != NULL) {
         if (p->data_type != OSSL_PARAM_OCTET_STRING) {
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/kdfs/hkdf.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/kdfs/hkdf.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/kdfs/hkdf.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -200,9 +200,9 @@
     if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_MODE)) != NULL) {
         if (p->data_type == OSSL_PARAM_UTF8_STRING) {
-            if (strcasecmp(p->data, "EXTRACT_AND_EXPAND") == 0) {
+            if (OPENSSL_strcasecmp(p->data, "EXTRACT_AND_EXPAND") == 0) {
                 ctx->mode = EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND;
-            } else if (strcasecmp(p->data, "EXTRACT_ONLY") == 0) {
+            } else if (OPENSSL_strcasecmp(p->data, "EXTRACT_ONLY") == 0) {
                 ctx->mode = EVP_KDF_HKDF_MODE_EXTRACT_ONLY;
-            } else if (strcasecmp(p->data, "EXPAND_ONLY") == 0) {
+            } else if (OPENSSL_strcasecmp(p->data, "EXPAND_ONLY") == 0) {
                 ctx->mode = EVP_KDF_HKDF_MODE_EXPAND_ONLY;
             } else {
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/kdfs/kbkdf.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/kdfs/kbkdf.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/kdfs/kbkdf.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright 2019 Red Hat, Inc.
  *
@@ -299,8 +299,9 @@
 
     p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_MODE);
-    if (p != NULL && strncasecmp("counter", p->data, p->data_size) == 0) {
+    if (p != NULL
+        && OPENSSL_strncasecmp("counter", p->data, p->data_size) == 0) {
         ctx->mode = COUNTER;
     } else if (p != NULL
-               && strncasecmp("feedback", p->data, p->data_size) == 0) {
+               && OPENSSL_strncasecmp("feedback", p->data, p->data_size) == 0) {
         ctx->mode = FEEDBACK;
     } else if (p != NULL) {
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/kdfs/sshkdf.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/kdfs/sshkdf.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/kdfs/sshkdf.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -60,5 +60,6 @@
     if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL)
         ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
-    ctx->provctx = provctx;
+    else
+        ctx->provctx = provctx;
     return ctx;
 }
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/kdfs/tls1_prf.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/kdfs/tls1_prf.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/kdfs/tls1_prf.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -173,5 +173,5 @@
 
     if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_DIGEST)) != NULL) {
-        if (strcasecmp(p->data, SN_md5_sha1) == 0) {
+        if (OPENSSL_strcasecmp(p->data, SN_md5_sha1) == 0) {
             if (!ossl_prov_macctx_load_from_params(&ctx->P_hash, params,
                                                    OSSL_MAC_NAME_HMAC,
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/kem/rsa_kem.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/kem/rsa_kem.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/kem/rsa_kem.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -13,6 +13,6 @@
  */
 #include "internal/deprecated.h"
-
-#include "e_os.h"  /* strcasecmp */
+#include "internal/nelem.h"
+
 #include <openssl/crypto.h>
 #include <openssl/evp.h>
@@ -70,5 +70,5 @@
 
     for (i = 0; i < sz; ++i) {
-        if (strcasecmp(map[i].ptr, name) == 0)
+        if (OPENSSL_strcasecmp(map[i].ptr, name) == 0)
             return map[i].id;
     }
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/keymgmt/dsa_kmgmt.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/keymgmt/dsa_kmgmt.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/keymgmt/dsa_kmgmt.c	(revision 95219)
@@ -14,5 +14,4 @@
 #include "internal/deprecated.h"
 
-#include "e_os.h" /* strcasecmp */
 #include <openssl/core_dispatch.h>
 #include <openssl/core_names.h>
@@ -91,5 +90,5 @@
 
     for (i = 0; i < OSSL_NELEM(dsatype2id); ++i) {
-        if (strcasecmp(dsatype2id[i].name, name) == 0)
+        if (OPENSSL_strcasecmp(dsatype2id[i].name, name) == 0)
             return dsatype2id[i].id;
     }
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/keymgmt/ec_kmgmt.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/keymgmt/ec_kmgmt.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/keymgmt/ec_kmgmt.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -14,5 +14,4 @@
 #include "internal/deprecated.h"
 
-#include "e_os.h" /* strcasecmp */
 #include <string.h>
 #include <openssl/core_dispatch.h>
@@ -471,7 +470,4 @@
             && (selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) == 0)
         return 0;
-    if ((selection & OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS) != 0
-            && (selection & OSSL_KEYMGMT_SELECT_KEYPAIR) == 0)
-        return 0;
 
     tmpl = OSSL_PARAM_BLD_new();
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/keymgmt/ecx_kmgmt.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/keymgmt/ecx_kmgmt.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/keymgmt/ecx_kmgmt.c	(revision 95219)
@@ -10,6 +10,4 @@
 #include <assert.h>
 #include <string.h>
-/* For strcasecmp on Windows */
-#include "e_os.h"
 #include <openssl/core_dispatch.h>
 #include <openssl/core_names.h>
@@ -547,5 +545,5 @@
         if (p->data_type != OSSL_PARAM_UTF8_STRING
                 || groupname == NULL
-                || strcasecmp(p->data, groupname) != 0) {
+                || OPENSSL_strcasecmp(p->data, groupname) != 0) {
             ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);
             return 0;
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/keymgmt/mac_legacy_kmgmt.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/keymgmt/mac_legacy_kmgmt.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/keymgmt/mac_legacy_kmgmt.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -27,5 +27,4 @@
 #include "prov/provider_ctx.h"
 #include "prov/macsignature.h"
-#include "e_os.h" /* strcasecmp */
 
 static OSSL_FUNC_keymgmt_new_fn mac_new;
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/macs/cmac_prov.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/macs/cmac_prov.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/macs/cmac_prov.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -123,5 +123,6 @@
     if (key != NULL)
         return cmac_setkey(macctx, key, keylen);
-    return 1;
+    /* Reinitialize the CMAC context */
+    return CMAC_Init(macctx->ctx, NULL, 0, NULL, NULL);
 }
 
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/macs/gmac_prov.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/macs/gmac_prov.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/macs/gmac_prov.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -121,5 +121,5 @@
     if (key != NULL)
         return gmac_setkey(macctx, key, keylen);
-    return 1;
+    return EVP_EncryptInit_ex(macctx->ctx, NULL, NULL, NULL, NULL);
 }
 
@@ -210,17 +210,20 @@
     if (params == NULL)
         return 1;
-    if (ctx == NULL
-        || !ossl_prov_cipher_load_from_params(&macctx->cipher, params, provctx))
-        return 0;
-
-    if (EVP_CIPHER_get_mode(ossl_prov_cipher_cipher(&macctx->cipher))
-        != EVP_CIPH_GCM_MODE) {
-        ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_MODE);
-        return 0;
-    }
-    if (!EVP_EncryptInit_ex(ctx, ossl_prov_cipher_cipher(&macctx->cipher),
-                            ossl_prov_cipher_engine(&macctx->cipher), NULL,
-                            NULL))
-        return 0;
+    if (ctx == NULL)
+        return 0;
+
+    if ((p = OSSL_PARAM_locate_const(params, OSSL_MAC_PARAM_CIPHER)) != NULL) {
+        if (!ossl_prov_cipher_load_from_params(&macctx->cipher, params, provctx))
+            return 0;
+        if (EVP_CIPHER_get_mode(ossl_prov_cipher_cipher(&macctx->cipher))
+            != EVP_CIPH_GCM_MODE) {
+            ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_MODE);
+            return 0;
+        }
+        if (!EVP_EncryptInit_ex(ctx, ossl_prov_cipher_cipher(&macctx->cipher),
+                                ossl_prov_cipher_engine(&macctx->cipher), NULL,
+                                NULL))
+            return 0;
+    }
 
     if ((p = OSSL_PARAM_locate_const(params, OSSL_MAC_PARAM_KEY)) != NULL)
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/macs/hmac_prov.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/macs/hmac_prov.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/macs/hmac_prov.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -153,5 +153,5 @@
     const EVP_MD *digest;
 
-    if (macctx->keylen > 0)
+    if (macctx->key != NULL)
         OPENSSL_secure_clear_free(macctx->key, macctx->keylen);
     /* Keep a copy of the key in case we need it for TLS HMAC */
@@ -178,7 +178,9 @@
         return 0;
 
-    if (key != NULL && !hmac_setkey(macctx, key, keylen))
-        return 0;
-    return 1;
+    if (key != NULL)
+        return hmac_setkey(macctx, key, keylen);
+
+    /* Just reinit the HMAC context */
+    return HMAC_Init_ex(macctx->ctx, NULL, 0, NULL, NULL);
 }
 
@@ -326,20 +328,8 @@
         if (p->data_type != OSSL_PARAM_OCTET_STRING)
             return 0;
-
-        if (macctx->keylen > 0)
-            OPENSSL_secure_clear_free(macctx->key, macctx->keylen);
-        /* Keep a copy of the key if we need it for TLS HMAC */
-        macctx->key = OPENSSL_secure_malloc(p->data_size > 0 ? p->data_size : 1);
-        if (macctx->key == NULL)
-            return 0;
-        memcpy(macctx->key, p->data, p->data_size);
-        macctx->keylen = p->data_size;
-
-        if (!HMAC_Init_ex(macctx->ctx, p->data, p->data_size,
-                          ossl_prov_digest_md(&macctx->digest),
-                          NULL /* ENGINE */))
-            return 0;
-
-    }
+        if (!hmac_setkey(macctx, p->data, p->data_size))
+            return 0;
+    }
+
     if ((p = OSSL_PARAM_locate_const(params,
                                      OSSL_MAC_PARAM_TLS_DATA_SIZE)) != NULL) {
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/macs/poly1305_prov.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/macs/poly1305_prov.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/macs/poly1305_prov.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -38,4 +38,5 @@
 struct poly1305_data_st {
     void *provctx;
+    int updated;
     POLY1305 poly1305;           /* Poly1305 data */
 };
@@ -65,9 +66,9 @@
     if (!ossl_prov_is_running())
         return NULL;
-    dst = poly1305_new(src->provctx);
+    dst = OPENSSL_malloc(sizeof(*dst));
     if (dst == NULL)
         return NULL;
 
-    dst->poly1305 = src->poly1305;
+    *dst = *src;
     return dst;
 }
@@ -86,4 +87,5 @@
     }
     Poly1305_Init(&ctx->poly1305, key);
+    ctx->updated = 0;
     return 1;
 }
@@ -99,5 +101,6 @@
     if (key != NULL)
         return poly1305_setkey(ctx, key, keylen);
-    return 1;
+    /* no reinitialization of context with the same key is allowed */
+    return ctx->updated == 0;
 }
 
@@ -107,4 +110,5 @@
     struct poly1305_data_st *ctx = vmacctx;
 
+    ctx->updated = 1;
     if (datalen == 0)
         return 1;
@@ -122,4 +126,5 @@
     if (!ossl_prov_is_running())
         return 0;
+    ctx->updated = 1;
     Poly1305_Final(&ctx->poly1305, out);
     *outl = poly1305_size();
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/macs/siphash_prov.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/macs/siphash_prov.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/macs/siphash_prov.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -40,4 +40,5 @@
     void *provctx;
     SIPHASH siphash;             /* Siphash data */
+    SIPHASH sipcopy;             /* Siphash data copy for reinitialization */
     unsigned int crounds, drounds;
 };
@@ -77,9 +78,9 @@
     if (!ossl_prov_is_running())
         return NULL;
-    sdst = siphash_new(ssrc->provctx);
+    sdst = OPENSSL_malloc(sizeof(*sdst));
     if (sdst == NULL)
         return NULL;
 
-    sdst->siphash = ssrc->siphash;
+    *sdst = *ssrc;
     return sdst;
 }
@@ -95,7 +96,12 @@
                           const unsigned char *key, size_t keylen)
 {
+    int ret;
+
     if (keylen != SIPHASH_KEY_SIZE)
         return 0;
-    return SipHash_Init(&ctx->siphash, key, crounds(ctx), drounds(ctx));
+    ret = SipHash_Init(&ctx->siphash, key, crounds(ctx), drounds(ctx));
+    if (ret)
+        ctx->sipcopy = ctx->siphash;
+    return ret;
 }
 
@@ -107,9 +113,12 @@
     if (!ossl_prov_is_running() || !siphash_set_params(ctx, params))
         return 0;
-    /* Without a key, there is not much to do here,
+    /*
+     * Without a key, there is not much to do here,
      * The actual initialization happens through controls.
      */
-    if (key == NULL)
+    if (key == NULL) {
+        ctx->siphash = ctx->sipcopy;
         return 1;
+    }
     return siphash_setkey(ctx, key, keylen);
 }
@@ -195,5 +204,6 @@
     if ((p = OSSL_PARAM_locate_const(params, OSSL_MAC_PARAM_SIZE)) != NULL) {
         if (!OSSL_PARAM_get_size_t(p, &size)
-            || !SipHash_set_hash_size(&ctx->siphash, size))
+            || !SipHash_set_hash_size(&ctx->siphash, size)
+            || !SipHash_set_hash_size(&ctx->sipcopy, size))
             return 0;
     }
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/rands/drbg_ctr.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/rands/drbg_ctr.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/rands/drbg_ctr.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2011-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2011-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -15,5 +15,4 @@
 #include <openssl/aes.h>
 #include <openssl/proverr.h>
-#include "e_os.h" /* strcasecmp */
 #include "crypto/modes.h"
 #include "internal/thread_once.h"
@@ -691,5 +690,5 @@
                 || p->data_size < ctr_str_len)
             return 0;
-        if (strcasecmp("CTR", base + p->data_size - ctr_str_len) != 0) {
+        if (OPENSSL_strcasecmp("CTR", base + p->data_size - ctr_str_len) != 0) {
             ERR_raise(ERR_LIB_PROV, PROV_R_REQUIRE_CTR_MODE_CIPHER);
             return 0;
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/signature/rsa_sig.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/signature/rsa_sig.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/signature/rsa_sig.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -14,5 +14,4 @@
 #include "internal/deprecated.h"
 
-#include "e_os.h" /* strcasecmp */
 #include <string.h>
 #include <openssl/crypto.h>
@@ -855,5 +854,5 @@
     if (mdname != NULL
         /* was rsa_setup_md already called in rsa_signverify_init()? */
-        && (mdname[0] == '\0' || strcasecmp(prsactx->mdname, mdname) != 0)
+        && (mdname[0] == '\0' || OPENSSL_strcasecmp(prsactx->mdname, mdname) != 0)
         && !rsa_setup_md(prsactx, mdname, prsactx->propq))
         return 0;
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/signature/sm2_sig.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/signature/sm2_sig.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/signature/sm2_sig.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -431,5 +431,5 @@
     if (p != NULL) {
         void *tmp_id = NULL;
-        size_t tmp_idlen;
+        size_t tmp_idlen = 0;
 
         /*
@@ -439,5 +439,6 @@
             return 0;
 
-        if (!OSSL_PARAM_get_octet_string(p, &tmp_id, 0, &tmp_idlen))
+        if (p->data_size != 0
+            && !OSSL_PARAM_get_octet_string(p, &tmp_id, 0, &tmp_idlen))
             return 0;
         OPENSSL_free(psm2ctx->id);
Index: /trunk/src/libs/openssl-3.0.3/providers/implementations/storemgmt/file_store.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/providers/implementations/storemgmt/file_store.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/providers/implementations/storemgmt/file_store.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -9,6 +9,4 @@
 
 /* This file has quite some overlap with engines/e_loader_attic.c */
-
-#include "e_os.h"                /* To get strncasecmp() on Windows */
 
 #include <string.h>
@@ -221,10 +219,10 @@
      * the full URI shouldn't be used as a path anywhere.
      */
-    if (strncasecmp(uri, "file:", 5) == 0) {
+    if (OPENSSL_strncasecmp(uri, "file:", 5) == 0) {
         const char *p = &uri[5];
 
         if (strncmp(&uri[5], "//", 2) == 0) {
             path_data_n--;           /* Invalidate using the full URI */
-            if (strncasecmp(&uri[7], "localhost/", 10) == 0) {
+            if (OPENSSL_strncasecmp(&uri[7], "localhost/", 10) == 0) {
                 p = &uri[16];
             } else if (uri[7] == '/') {
@@ -593,5 +591,6 @@
      * First, check the basename
      */
-    if (strncasecmp(name, ctx->_.dir.search_name, len) != 0 || name[len] != '.')
+    if (OPENSSL_strncasecmp(name, ctx->_.dir.search_name, len) != 0
+        || name[len] != '.')
         return 0;
     p = &name[len + 1];
Index: /trunk/src/libs/openssl-3.0.3/ssl/s3_lib.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/ssl/s3_lib.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/ssl/s3_lib.c	(revision 95219)
@@ -3686,4 +3686,10 @@
     case SSL_CTRL_SET_CHAIN_CERT_STORE:
         return ssl_cert_set_cert_store(s->cert, parg, 1, larg);
+
+    case SSL_CTRL_GET_VERIFY_CERT_STORE:
+        return ssl_cert_get_cert_store(s->cert, parg, 0);
+
+    case SSL_CTRL_GET_CHAIN_CERT_STORE:
+        return ssl_cert_get_cert_store(s->cert, parg, 1);
 
     case SSL_CTRL_GET_PEER_SIGNATURE_NID:
@@ -3932,4 +3938,10 @@
         return ssl_cert_set_cert_store(ctx->cert, parg, 1, larg);
 
+    case SSL_CTRL_GET_VERIFY_CERT_STORE:
+        return ssl_cert_get_cert_store(ctx->cert, parg, 0);
+
+    case SSL_CTRL_GET_CHAIN_CERT_STORE:
+        return ssl_cert_get_cert_store(ctx->cert, parg, 1);
+
         /* A Thawte special :-) */
     case SSL_CTRL_EXTRA_CHAIN_CERT:
Index: /trunk/src/libs/openssl-3.0.3/ssl/ssl_cert.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/ssl/ssl_cert.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/ssl/ssl_cert.c	(revision 95219)
@@ -969,4 +969,10 @@
     if (ref && store)
         X509_STORE_up_ref(store);
+    return 1;
+}
+
+int ssl_cert_get_cert_store(CERT *c, X509_STORE **pstore, int chain)
+{
+    *pstore = (chain ? c->chain_store : c->verify_store);
     return 1;
 }
Index: /trunk/src/libs/openssl-3.0.3/ssl/ssl_conf.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/ssl/ssl_conf.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/ssl/ssl_conf.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2012-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2012-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -149,5 +149,6 @@
         if (strcmp(tbl->name, name))
             return 0;
-    } else if (tbl->namelen != namelen || strncasecmp(tbl->name, name, namelen))
+    } else if (tbl->namelen != namelen
+               || OPENSSL_strncasecmp(tbl->name, name, namelen))
         return 0;
     ssl_set_option(cctx, tbl->name_flags, tbl->option_value, onoff);
@@ -233,6 +234,6 @@
     /* Ignore values supported by 1.0.2 for the automatic selection */
     if ((cctx->flags & SSL_CONF_FLAG_FILE)
-            && (strcasecmp(value, "+automatic") == 0
-                || strcasecmp(value, "automatic") == 0))
+            && (OPENSSL_strcasecmp(value, "+automatic") == 0
+                || OPENSSL_strcasecmp(value, "automatic") == 0))
         return 1;
     if ((cctx->flags & SSL_CONF_FLAG_CMDLINE) &&
@@ -598,13 +599,17 @@
                                             OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS,
                                             sslctx->libctx, sslctx->propq);
-        if (decoderctx == NULL
-                || !OSSL_DECODER_from_bio(decoderctx, in)) {
-            OSSL_DECODER_CTX_free(decoderctx);
+        if (decoderctx == NULL)
+            goto end;
+        ERR_set_mark();
+        while (!OSSL_DECODER_from_bio(decoderctx, in)
+               && dhpkey == NULL
+               && !BIO_eof(in));
+        OSSL_DECODER_CTX_free(decoderctx);
+
+        if (dhpkey == NULL) {
+            ERR_clear_last_mark();
             goto end;
         }
-        OSSL_DECODER_CTX_free(decoderctx);
-
-        if (dhpkey == NULL)
-            goto end;
+        ERR_pop_to_mark();
     } else {
         return 1;
@@ -809,5 +814,5 @@
             return 0;
         if (cctx->flags & SSL_CONF_FLAG_FILE &&
-            strncasecmp(*pcmd, cctx->prefix, cctx->prefixlen))
+            OPENSSL_strncasecmp(*pcmd, cctx->prefix, cctx->prefixlen))
             return 0;
         *pcmd += cctx->prefixlen;
@@ -851,5 +856,5 @@
             }
             if (cctx->flags & SSL_CONF_FLAG_FILE) {
-                if (t->str_file && strcasecmp(t->str_file, cmd) == 0)
+                if (t->str_file && OPENSSL_strcasecmp(t->str_file, cmd) == 0)
                     return t;
             }
Index: /trunk/src/libs/openssl-3.0.3/ssl/ssl_lib.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/ssl/ssl_lib.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/ssl/ssl_lib.c	(revision 95219)
@@ -2233,4 +2233,5 @@
             struct ssl_async_args args;
 
+            memset(&args, 0, sizeof(args));
             args.s = s;
             args.type = OTHERFUNC;
@@ -3915,4 +3916,5 @@
             struct ssl_async_args args;
 
+            memset(&args, 0, sizeof(args));
             args.s = s;
 
Index: /trunk/src/libs/openssl-3.0.3/ssl/ssl_local.h
===================================================================
--- /trunk/src/libs/openssl-3.0.3/ssl/ssl_local.h	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/ssl/ssl_local.h	(revision 95219)
@@ -2431,4 +2431,5 @@
 __owur int ssl_cert_set_cert_store(CERT *c, X509_STORE *store, int chain,
                                    int ref);
+__owur int ssl_cert_get_cert_store(CERT *c, X509_STORE **pstore, int chain);
 
 __owur int ssl_security(const SSL *s, int op, int bits, int nid, void *other);
Index: /trunk/src/libs/openssl-3.0.3/ssl/ssl_txt.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/ssl/ssl_txt.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/ssl/ssl_txt.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright 2005 Nokia. All rights reserved.
  *
@@ -130,9 +130,9 @@
 #endif
     if (x->time != 0L) {
-        if (BIO_printf(bp, "\n    Start Time: %ld", x->time) <= 0)
+        if (BIO_printf(bp, "\n    Start Time: %lld", (long long)x->time) <= 0)
             goto err;
     }
     if (x->timeout != 0L) {
-        if (BIO_printf(bp, "\n    Timeout   : %ld (sec)", x->timeout) <= 0)
+        if (BIO_printf(bp, "\n    Timeout   : %lld (sec)", (long long)x->timeout) <= 0)
             goto err;
     }
Index: /trunk/src/libs/openssl-3.0.3/ssl/statem/statem_clnt.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/ssl/statem/statem_clnt.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/ssl/statem/statem_clnt.c	(revision 95219)
@@ -1396,4 +1396,8 @@
             && PACKET_remaining(pkt) >= SSL3_RANDOM_SIZE
             && memcmp(hrrrandom, PACKET_data(pkt), SSL3_RANDOM_SIZE) == 0) {
+        if (s->hello_retry_request != SSL_HRR_NONE) {
+            SSLfatal(s, SSL_AD_UNEXPECTED_MESSAGE, SSL_R_UNEXPECTED_MESSAGE);
+            goto err;
+        }
         s->hello_retry_request = SSL_HRR_PENDING;
         hrr = 1;
Index: /trunk/src/libs/openssl-3.0.3/ssl/statem/statem_dtls.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/ssl/statem/statem_dtls.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/ssl/statem/statem_dtls.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2005-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2005-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -219,6 +219,6 @@
             len = s->init_num;
 
-        if (len > s->max_send_fragment)
-            len = s->max_send_fragment;
+        if (len > ssl_get_max_send_fragment(s))
+            len = ssl_get_max_send_fragment(s);
 
         /*
@@ -242,5 +242,5 @@
         ret = dtls1_write_bytes(s, type, &s->init_buf->data[s->init_off], len,
                                 &written);
-        if (ret < 0) {
+        if (ret <= 0) {
             /*
              * might need to update MTU here, but we don't know which
Index: /trunk/src/libs/openssl-3.0.3/ssl/statem/statem_srvr.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/ssl/statem/statem_srvr.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/ssl/statem/statem_srvr.c	(revision 95219)
@@ -3622,13 +3622,22 @@
                                  unsigned char *tick_nonce)
 {
+    uint32_t timeout = (uint32_t)s->session->timeout;
+
     /*
-     * Ticket lifetime hint: For TLSv1.2 this is advisory only and we leave this
-     * unspecified for resumed session (for simplicity).
+     * Ticket lifetime hint:
      * In TLSv1.3 we reset the "time" field above, and always specify the
-     * timeout.
+     * timeout, limited to a 1 week period per RFC8446.
+     * For TLSv1.2 this is advisory only and we leave this unspecified for
+     * resumed session (for simplicity).
      */
-    if (!WPACKET_put_bytes_u32(pkt,
-                               (s->hit && !SSL_IS_TLS13(s))
-                               ? 0 : (uint32_t)s->session->timeout)) {
+#define ONE_WEEK_SEC (7 * 24 * 60 * 60)
+
+    if (SSL_IS_TLS13(s)) {
+        if (s->session->timeout > ONE_WEEK_SEC)
+            timeout = ONE_WEEK_SEC;
+    } else if (s->hit)
+        timeout = 0;
+
+    if (!WPACKET_put_bytes_u32(pkt, timeout)) {
         SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
         return 0;
Index: /trunk/src/libs/openssl-3.0.3/test/bntest.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/bntest.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/bntest.c	(revision 95219)
@@ -11,7 +11,4 @@
 #include <stdio.h>
 #include <string.h>
-#ifdef __TANDEM
-# include <strings.h> /* strcasecmp */
-#endif
 #include <ctype.h>
 
@@ -24,8 +21,4 @@
 #include "testutil.h"
 
-#ifdef OPENSSL_SYS_WINDOWS
-# define strcasecmp _stricmp
-#endif
-
 /*
  * Things in boring, not in openssl.
@@ -65,5 +58,5 @@
 
     for ( ; --i >= 0; pp++)
-        if (strcasecmp(pp->key, key) == 0)
+        if (OPENSSL_strcasecmp(pp->key, key) == 0)
             return pp->value;
     return NULL;
Index: /trunk/src/libs/openssl-3.0.3/test/build.info
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/build.info	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/build.info	(revision 95219)
@@ -38,5 +38,5 @@
           ecstresstest gmdifftest pbelutest \
           destest mdc2test sha_test \
-          exptest pbetest \
+          exptest pbetest localetest evp_pkey_ctx_new_from_name\
           evp_pkey_provided_test evp_test evp_extra_test evp_extra_test2 \
           evp_fetch_prov_test evp_libctx_test ossl_store_test \
@@ -136,4 +136,12 @@
   DEPEND[exptest]=../libcrypto libtestutil.a
 
+  SOURCE[localetest]=localetest.c
+  INCLUDE[localetest]=../include ../apps/include
+  DEPEND[localetest]=../libcrypto libtestutil.a
+
+  SOURCE[evp_pkey_ctx_new_from_name]=evp_pkey_ctx_new_from_name.c
+  INCLUDE[evp_pkey_ctx_new_from_name]=../include ../apps/include
+  DEPEND[evp_pkey_ctx_new_from_name]=../libcrypto
+
   SOURCE[pbetest]=pbetest.c
   INCLUDE[pbetest]=../include ../apps/include
Index: /trunk/src/libs/openssl-3.0.3/test/cmsapitest.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/cmsapitest.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/cmsapitest.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -19,4 +19,5 @@
 static X509 *cert = NULL;
 static EVP_PKEY *privkey = NULL;
+static char *derin = NULL;
 
 static int test_encrypt_decrypt(const EVP_CIPHER *cipher)
@@ -289,5 +290,28 @@
 }
 
-OPT_TEST_DECLARE_USAGE("certfile privkeyfile\n")
+static int test_d2i_CMS_bio_file_encrypted_data(void)
+{
+    BIO *bio = NULL;
+    CMS_ContentInfo *cms = NULL;
+    int ret = 0;
+
+    ERR_clear_error();
+
+    if (!TEST_ptr(bio = BIO_new_file(derin, "r"))
+      || !TEST_ptr(cms = d2i_CMS_bio(bio, NULL)))
+      goto end;
+
+    if (!TEST_int_eq(ERR_peek_error(), 0))
+        goto end;
+
+    ret = 1;
+end:
+    CMS_ContentInfo_free(cms);
+    BIO_free(bio);
+
+    return ret;
+}
+
+OPT_TEST_DECLARE_USAGE("certfile privkeyfile derfile\n")
 
 int setup_tests(void)
@@ -302,5 +326,6 @@
 
     if (!TEST_ptr(certin = test_get_argument(0))
-            || !TEST_ptr(privkeyin = test_get_argument(1)))
+            || !TEST_ptr(privkeyin = test_get_argument(1))
+            || !TEST_ptr(derin = test_get_argument(2)))
         return 0;
 
@@ -333,4 +358,5 @@
     ADD_TEST(test_encrypt_decrypt_aes_256_gcm);
     ADD_TEST(test_d2i_CMS_bio_NULL);
+    ADD_TEST(test_d2i_CMS_bio_file_encrypted_data);
     return 1;
 }
Index: /trunk/src/libs/openssl-3.0.3/test/dtls_mtu_test.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/dtls_mtu_test.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/dtls_mtu_test.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -186,11 +186,57 @@
  end:
     SSL_CTX_free(ctx);
+    return ret;
+}
+
+static int test_server_mtu_larger_than_max_fragment_length(void)
+{
+    SSL_CTX *ctx = NULL;
+    SSL *srvr_ssl = NULL, *clnt_ssl = NULL;
+    int rv = 0;
+
+    if (!TEST_ptr(ctx = SSL_CTX_new(DTLS_method())))
+        goto end;
+
+    SSL_CTX_set_psk_server_callback(ctx, srvr_psk_callback);
+    SSL_CTX_set_psk_client_callback(ctx, clnt_psk_callback);
+
+#ifndef OPENSSL_NO_DH
+    if (!TEST_true(SSL_CTX_set_dh_auto(ctx, 1)))
+        goto end;
+#endif
+
+    if (!TEST_true(create_ssl_objects(ctx, ctx, &srvr_ssl, &clnt_ssl,
+                                      NULL, NULL)))
+        goto end;
+
+    SSL_set_options(srvr_ssl, SSL_OP_NO_QUERY_MTU);
+    if (!TEST_true(DTLS_set_link_mtu(srvr_ssl, 1500)))
+        goto end;
+
+    SSL_set_tlsext_max_fragment_length(clnt_ssl,
+                                       TLSEXT_max_fragment_length_512);
+
+    if (!TEST_true(create_ssl_connection(srvr_ssl, clnt_ssl,
+                                         SSL_ERROR_NONE)))
+        goto end;
+
+    rv = 1;
+
+ end:
+    SSL_free(clnt_ssl);
+    SSL_free(srvr_ssl);
+    SSL_CTX_free(ctx);
+    return rv;
+}
+
+int setup_tests(void)
+{
+    ADD_TEST(run_mtu_tests);
+    ADD_TEST(test_server_mtu_larger_than_max_fragment_length);
+    return 1;
+}
+
+void cleanup_tests(void)
+{
     bio_s_mempacket_test_free();
-    return ret;
-}
-
-int setup_tests(void)
-{
-    ADD_TEST(run_mtu_tests);
-    return 1;
-}
+}
Index: /trunk/src/libs/openssl-3.0.3/test/endecode_test.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/endecode_test.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/endecode_test.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -144,4 +144,5 @@
 
 #define FLAG_DECODE_WITH_TYPE   0x0001
+#define FLAG_FAIL_IF_FIPS       0x0002
 
 static int test_encode_decode(const char *file, const int line,
@@ -167,6 +168,17 @@
      */
     if (!TEST_true(encode_cb(file, line, &encoded, &encoded_len, pkey, selection,
-                             output_type, output_structure, pass, pcipher))
-        || !TEST_true(check_cb(file, line, type, encoded, encoded_len))
+                             output_type, output_structure, pass, pcipher)))
+        goto end;
+
+    if ((flags & FLAG_FAIL_IF_FIPS) != 0 && is_fips) {
+        if (TEST_false(decode_cb(file, line, (void **)&pkey2, encoded,
+                                  encoded_len, output_type, output_structure,
+                                  (flags & FLAG_DECODE_WITH_TYPE ? type : NULL),
+                                  selection, pass)))
+            ok = 1;
+        goto end;
+    }
+
+    if (!TEST_true(check_cb(file, line, type, encoded, encoded_len))
         || !TEST_true(decode_cb(file, line, (void **)&pkey2, encoded, encoded_len,
                                 output_type, output_structure,
@@ -522,5 +534,5 @@
 }
 
-static int test_unprotected_via_DER(const char *type, EVP_PKEY *key)
+static int test_unprotected_via_DER(const char *type, EVP_PKEY *key, int fips)
 {
     return test_encode_decode(__FILE__, __LINE__, type, key,
@@ -530,5 +542,5 @@
                               encode_EVP_PKEY_prov, decode_EVP_PKEY_prov,
                               test_mem, check_unprotected_PKCS8_DER,
-                              dump_der, 0);
+                              dump_der, fips ? 0 : FLAG_FAIL_IF_FIPS);
 }
 
@@ -544,5 +556,5 @@
 }
 
-static int test_unprotected_via_PEM(const char *type, EVP_PKEY *key)
+static int test_unprotected_via_PEM(const char *type, EVP_PKEY *key, int fips)
 {
     return test_encode_decode(__FILE__, __LINE__, type, key,
@@ -552,5 +564,5 @@
                               encode_EVP_PKEY_prov, decode_EVP_PKEY_prov,
                               test_text, check_unprotected_PKCS8_PEM,
-                              dump_pem, 0);
+                              dump_pem, fips ? 0 : FLAG_FAIL_IF_FIPS);
 }
 
@@ -699,5 +711,5 @@
 }
 
-static int test_protected_via_DER(const char *type, EVP_PKEY *key)
+static int test_protected_via_DER(const char *type, EVP_PKEY *key, int fips)
 {
     return test_encode_decode(__FILE__, __LINE__, type, key,
@@ -708,5 +720,5 @@
                               encode_EVP_PKEY_prov, decode_EVP_PKEY_prov,
                               test_mem, check_protected_PKCS8_DER,
-                              dump_der, 0);
+                              dump_der, fips ? 0 : FLAG_FAIL_IF_FIPS);
 }
 
@@ -722,5 +734,5 @@
 }
 
-static int test_protected_via_PEM(const char *type, EVP_PKEY *key)
+static int test_protected_via_PEM(const char *type, EVP_PKEY *key, int fips)
 {
     return test_encode_decode(__FILE__, __LINE__, type, key,
@@ -731,5 +743,5 @@
                               encode_EVP_PKEY_prov, decode_EVP_PKEY_prov,
                               test_text, check_protected_PKCS8_PEM,
-                              dump_pem, 0);
+                              dump_pem, fips ? 0 : FLAG_FAIL_IF_FIPS);
 }
 
@@ -792,5 +804,5 @@
 }
 
-static int test_public_via_DER(const char *type, EVP_PKEY *key)
+static int test_public_via_DER(const char *type, EVP_PKEY *key, int fips)
 {
     return test_encode_decode(__FILE__, __LINE__, type, key,
@@ -799,5 +811,6 @@
                               "DER", "SubjectPublicKeyInfo", NULL, NULL,
                               encode_EVP_PKEY_prov, decode_EVP_PKEY_prov,
-                              test_mem, check_public_DER, dump_der, 0);
+                              test_mem, check_public_DER, dump_der,
+                              fips ? 0 : FLAG_FAIL_IF_FIPS);
 }
 
@@ -813,5 +826,5 @@
 }
 
-static int test_public_via_PEM(const char *type, EVP_PKEY *key)
+static int test_public_via_PEM(const char *type, EVP_PKEY *key, int fips)
 {
     return test_encode_decode(__FILE__, __LINE__, type, key,
@@ -820,5 +833,6 @@
                               "PEM", "SubjectPublicKeyInfo", NULL, NULL,
                               encode_EVP_PKEY_prov, decode_EVP_PKEY_prov,
-                              test_text, check_public_PEM, dump_pem, 0);
+                              test_text, check_public_PEM, dump_pem,
+                              fips ? 0 : FLAG_FAIL_IF_FIPS);
 }
 
@@ -865,28 +879,28 @@
     EVP_PKEY_free(key_##KEYTYPE)
 
-#define IMPLEMENT_TEST_SUITE(KEYTYPE, KEYTYPEstr)                       \
+#define IMPLEMENT_TEST_SUITE(KEYTYPE, KEYTYPEstr, fips)                 \
     static int test_unprotected_##KEYTYPE##_via_DER(void)               \
     {                                                                   \
-        return test_unprotected_via_DER(KEYTYPEstr, key_##KEYTYPE);     \
+        return test_unprotected_via_DER(KEYTYPEstr, key_##KEYTYPE, fips); \
     }                                                                   \
     static int test_unprotected_##KEYTYPE##_via_PEM(void)               \
     {                                                                   \
-        return test_unprotected_via_PEM(KEYTYPEstr, key_##KEYTYPE);     \
+        return test_unprotected_via_PEM(KEYTYPEstr, key_##KEYTYPE, fips); \
     }                                                                   \
     static int test_protected_##KEYTYPE##_via_DER(void)                 \
     {                                                                   \
-        return test_protected_via_DER(KEYTYPEstr, key_##KEYTYPE);       \
+        return test_protected_via_DER(KEYTYPEstr, key_##KEYTYPE, fips); \
     }                                                                   \
     static int test_protected_##KEYTYPE##_via_PEM(void)                 \
     {                                                                   \
-        return test_protected_via_PEM(KEYTYPEstr, key_##KEYTYPE);       \
+        return test_protected_via_PEM(KEYTYPEstr, key_##KEYTYPE, fips); \
     }                                                                   \
     static int test_public_##KEYTYPE##_via_DER(void)                    \
     {                                                                   \
-        return test_public_via_DER(KEYTYPEstr, key_##KEYTYPE);          \
+        return test_public_via_DER(KEYTYPEstr, key_##KEYTYPE, fips);    \
     }                                                                   \
     static int test_public_##KEYTYPE##_via_PEM(void)                    \
     {                                                                   \
-        return test_public_via_PEM(KEYTYPEstr, key_##KEYTYPE);          \
+        return test_public_via_PEM(KEYTYPEstr, key_##KEYTYPE, fips);    \
     }
 
@@ -962,8 +976,8 @@
 #ifndef OPENSSL_NO_DH
 DOMAIN_KEYS(DH);
-IMPLEMENT_TEST_SUITE(DH, "DH")
+IMPLEMENT_TEST_SUITE(DH, "DH", 1)
 IMPLEMENT_TEST_SUITE_PARAMS(DH, "DH")
 DOMAIN_KEYS(DHX);
-IMPLEMENT_TEST_SUITE(DHX, "X9.42 DH")
+IMPLEMENT_TEST_SUITE(DHX, "X9.42 DH", 1)
 IMPLEMENT_TEST_SUITE_PARAMS(DHX, "X9.42 DH")
 /*
@@ -974,5 +988,5 @@
 #ifndef OPENSSL_NO_DSA
 DOMAIN_KEYS(DSA);
-IMPLEMENT_TEST_SUITE(DSA, "DSA")
+IMPLEMENT_TEST_SUITE(DSA, "DSA", 1)
 IMPLEMENT_TEST_SUITE_PARAMS(DSA, "DSA")
 IMPLEMENT_TEST_SUITE_LEGACY(DSA, "DSA")
@@ -985,29 +999,29 @@
 #ifndef OPENSSL_NO_EC
 DOMAIN_KEYS(EC);
-IMPLEMENT_TEST_SUITE(EC, "EC")
+IMPLEMENT_TEST_SUITE(EC, "EC", 1)
 IMPLEMENT_TEST_SUITE_PARAMS(EC, "EC")
 IMPLEMENT_TEST_SUITE_LEGACY(EC, "EC")
 DOMAIN_KEYS(ECExplicitPrimeNamedCurve);
-IMPLEMENT_TEST_SUITE(ECExplicitPrimeNamedCurve, "EC")
+IMPLEMENT_TEST_SUITE(ECExplicitPrimeNamedCurve, "EC", 1)
 IMPLEMENT_TEST_SUITE_LEGACY(ECExplicitPrimeNamedCurve, "EC")
 DOMAIN_KEYS(ECExplicitPrime2G);
-IMPLEMENT_TEST_SUITE(ECExplicitPrime2G, "EC")
+IMPLEMENT_TEST_SUITE(ECExplicitPrime2G, "EC", 0)
 IMPLEMENT_TEST_SUITE_LEGACY(ECExplicitPrime2G, "EC")
 # ifndef OPENSSL_NO_EC2M
 DOMAIN_KEYS(ECExplicitTriNamedCurve);
-IMPLEMENT_TEST_SUITE(ECExplicitTriNamedCurve, "EC")
+IMPLEMENT_TEST_SUITE(ECExplicitTriNamedCurve, "EC", 1)
 IMPLEMENT_TEST_SUITE_LEGACY(ECExplicitTriNamedCurve, "EC")
 DOMAIN_KEYS(ECExplicitTri2G);
-IMPLEMENT_TEST_SUITE(ECExplicitTri2G, "EC")
+IMPLEMENT_TEST_SUITE(ECExplicitTri2G, "EC", 0)
 IMPLEMENT_TEST_SUITE_LEGACY(ECExplicitTri2G, "EC")
 # endif
 KEYS(ED25519);
-IMPLEMENT_TEST_SUITE(ED25519, "ED25519")
+IMPLEMENT_TEST_SUITE(ED25519, "ED25519", 1)
 KEYS(ED448);
-IMPLEMENT_TEST_SUITE(ED448, "ED448")
+IMPLEMENT_TEST_SUITE(ED448, "ED448", 1)
 KEYS(X25519);
-IMPLEMENT_TEST_SUITE(X25519, "X25519")
+IMPLEMENT_TEST_SUITE(X25519, "X25519", 1)
 KEYS(X448);
-IMPLEMENT_TEST_SUITE(X448, "X448")
+IMPLEMENT_TEST_SUITE(X448, "X448", 1)
 /*
  * ED25519, ED448, X25519 and X448 have no support for
@@ -1016,8 +1030,8 @@
 #endif
 KEYS(RSA);
-IMPLEMENT_TEST_SUITE(RSA, "RSA")
+IMPLEMENT_TEST_SUITE(RSA, "RSA", 1)
 IMPLEMENT_TEST_SUITE_LEGACY(RSA, "RSA")
 KEYS(RSA_PSS);
-IMPLEMENT_TEST_SUITE(RSA_PSS, "RSA-PSS")
+IMPLEMENT_TEST_SUITE(RSA_PSS, "RSA-PSS", 1)
 /*
  * RSA-PSS has no support for PEM_write_bio_PrivateKey_traditional(),
Index: /trunk/src/libs/openssl-3.0.3/test/evp_extra_test.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/evp_extra_test.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/evp_extra_test.c	(revision 95219)
@@ -36,5 +36,4 @@
 #include "internal/sizes.h"
 #include "crypto/evp.h"
-#include "../e_os.h" /* strcasecmp */
 
 static OSSL_LIB_CTX *testctx = NULL;
@@ -1740,5 +1739,5 @@
 
     for (i = 0; i < OSSL_NELEM(ec_encodings); i++) {
-        if (strcasecmp(enc_name, ec_encodings[i].encoding_name) == 0) {
+        if (OPENSSL_strcasecmp(enc_name, ec_encodings[i].encoding_name) == 0) {
             *enc = ec_encodings[i].encoding;
             break;
@@ -1962,4 +1961,22 @@
 
     if (!TEST_int_gt(EVP_DigestVerifyFinal(md_ctx_verify, sig, sig_len), 0))
+        goto done;
+
+    /*
+     * Try verify again with non-matching 0 length id but ensure that it can
+     * be set on the context and overrides the previous value.
+     */
+
+    if (!TEST_true(EVP_DigestVerifyInit(md_ctx_verify, NULL, check_md, NULL,
+                                        pkey)))
+        goto done;
+
+    if (!TEST_int_gt(EVP_PKEY_CTX_set1_id(sctx, NULL, 0), 0))
+        goto done;
+
+    if (!TEST_true(EVP_DigestVerifyUpdate(md_ctx_verify, kMsg, sizeof(kMsg))))
+        goto done;
+
+    if (!TEST_int_eq(EVP_DigestVerifyFinal(md_ctx_verify, sig, sig_len), 0))
         goto done;
 
Index: /trunk/src/libs/openssl-3.0.3/test/evp_libctx_test.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/evp_libctx_test.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/evp_libctx_test.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -34,5 +34,4 @@
 #include "internal/nelem.h"
 #include "crypto/bn_dh.h"   /* _bignum_ffdhe2048_p */
-#include "../e_os.h"        /* strcasecmp */
 
 static OSSL_LIB_CTX *libctx = NULL;
@@ -479,5 +478,5 @@
 static int name_cmp(const char * const *a, const char * const *b)
 {
-    return strcasecmp(*a, *b);
+    return OPENSSL_strcasecmp(*a, *b);
 }
 
Index: /trunk/src/libs/openssl-3.0.3/test/evp_test.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/evp_test.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/evp_test.c	(revision 95219)
@@ -13,5 +13,4 @@
 #include <stdlib.h>
 #include <ctype.h>
-#include "../e_os.h" /* strcasecmp */
 #include <openssl/evp.h>
 #include <openssl/pem.h>
@@ -1134,4 +1133,6 @@
     /* XOF mode? */
     int xof;
+    /* Reinitialization fails */
+    int no_reinit;
     /* Collection of controls */
     STACK_OF(OPENSSL_STRING) *controls;
@@ -1246,4 +1247,6 @@
     if (strcmp(keyword, "XOF") == 0)
         return mdata->xof = 1;
+    if (strcmp(keyword, "NoReinit") == 0)
+        return mdata->no_reinit = 1;
     if (strcmp(keyword, "Ctrl") == 0)
         return sk_OPENSSL_STRING_push(mdata->controls,
@@ -1409,4 +1412,5 @@
         EVP_MAC_settable_ctx_params(expected->mac);
     int xof;
+    int reinit = 1;
 
     if (expected->alg == NULL)
@@ -1519,4 +1523,5 @@
         }
     }
+ retry:
     if (!EVP_MAC_update(ctx, expected->input, expected->input_len)) {
         t->err = "MAC_UPDATE_ERROR";
@@ -1552,4 +1557,37 @@
             goto err;
         }
+    }
+    if (reinit--) {
+        OSSL_PARAM ivparams[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
+        int ret;
+
+        /* If the MAC uses IV, we have to set it again */
+        if (expected->iv != NULL) {
+            ivparams[0] =
+                OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_IV,
+                                                  expected->iv,
+                                                  expected->iv_len);
+            ivparams[1] = OSSL_PARAM_construct_end();
+        }
+        ERR_set_mark();
+        ret = EVP_MAC_init(ctx, NULL, 0, ivparams);
+        if (expected->no_reinit) {
+            if (ret) {
+                ERR_clear_last_mark();
+                t->err = "MAC_REINIT_SHOULD_FAIL";
+                goto err;
+            }
+        } else if (ret) {
+            ERR_clear_last_mark();
+            OPENSSL_free(got);
+            got = NULL;
+            goto retry;
+        } else {
+            ERR_clear_last_mark();
+            t->err = "MAC_REINIT_ERROR";
+            goto err;
+        }
+        /* If reinitialization fails, it is unsupported by the algorithm */
+        ERR_pop_to_mark();
     }
     t->err = NULL;
@@ -3887,7 +3925,7 @@
 }
 
-#define STR_STARTS_WITH(str, pre) strncasecmp(pre, str, strlen(pre)) == 0
+#define STR_STARTS_WITH(str, pre) OPENSSL_strncasecmp(pre, str, strlen(pre)) == 0
 #define STR_ENDS_WITH(str, pre)                                                \
-strlen(str) < strlen(pre) ? 0 : (strcasecmp(pre, str + strlen(str) - strlen(pre)) == 0)
+strlen(str) < strlen(pre) ? 0 : (OPENSSL_strcasecmp(pre, str + strlen(str) - strlen(pre)) == 0)
 
 static int is_digest_disabled(const char *name)
@@ -3898,29 +3936,29 @@
 #endif
 #ifdef OPENSSL_NO_MD2
-    if (strcasecmp(name, "MD2") == 0)
+    if (OPENSSL_strcasecmp(name, "MD2") == 0)
         return 1;
 #endif
 #ifdef OPENSSL_NO_MDC2
-    if (strcasecmp(name, "MDC2") == 0)
+    if (OPENSSL_strcasecmp(name, "MDC2") == 0)
         return 1;
 #endif
 #ifdef OPENSSL_NO_MD4
-    if (strcasecmp(name, "MD4") == 0)
+    if (OPENSSL_strcasecmp(name, "MD4") == 0)
         return 1;
 #endif
 #ifdef OPENSSL_NO_MD5
-    if (strcasecmp(name, "MD5") == 0)
+    if (OPENSSL_strcasecmp(name, "MD5") == 0)
         return 1;
 #endif
 #ifdef OPENSSL_NO_RMD160
-    if (strcasecmp(name, "RIPEMD160") == 0)
+    if (OPENSSL_strcasecmp(name, "RIPEMD160") == 0)
         return 1;
 #endif
 #ifdef OPENSSL_NO_SM3
-    if (strcasecmp(name, "SM3") == 0)
+    if (OPENSSL_strcasecmp(name, "SM3") == 0)
         return 1;
 #endif
 #ifdef OPENSSL_NO_WHIRLPOOL
-    if (strcasecmp(name, "WHIRLPOOL") == 0)
+    if (OPENSSL_strcasecmp(name, "WHIRLPOOL") == 0)
         return 1;
 #endif
Index: /trunk/src/libs/openssl-3.0.3/test/helpers/handshake.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/helpers/handshake.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/helpers/handshake.c	(revision 95219)
@@ -1433,4 +1433,5 @@
                                  &server2_ctx_data, &client_ctx_data)) {
         TEST_note("configure_handshake_ctx");
+        HANDSHAKE_RESULT_free(ret);
         return NULL;
     }
Index: /trunk/src/libs/openssl-3.0.3/test/helpers/ssl_test_ctx.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/helpers/ssl_test_ctx.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/helpers/ssl_test_ctx.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -17,8 +17,4 @@
 #include "../testutil.h"
 
-#ifdef OPENSSL_SYS_WINDOWS
-# define strcasecmp _stricmp
-#endif
-
 static const int default_app_data_size = 256;
 /* Default set to be as small as possible to exercise fragmentation. */
@@ -27,9 +23,9 @@
 static int parse_boolean(const char *value, int *result)
 {
-    if (strcasecmp(value, "Yes") == 0) {
+    if (OPENSSL_strcasecmp(value, "Yes") == 0) {
         *result = 1;
         return 1;
     }
-    else if (strcasecmp(value, "No") == 0) {
+    else if (OPENSSL_strcasecmp(value, "No") == 0) {
         *result = 0;
         return 1;
Index: /trunk/src/libs/openssl-3.0.3/test/params_conversion_test.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/params_conversion_test.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/params_conversion_test.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright (c) 2019, Oracle and/or its affiliates.  All rights reserved.
  *
@@ -15,8 +15,4 @@
 /* On machines that dont support <inttypes.h> just disable the tests */
 #if !defined(OPENSSL_NO_INTTYPES_H)
-
-# ifdef OPENSSL_SYS_WINDOWS
-#  define strcasecmp _stricmp
-# endif
 
 # ifdef OPENSSL_SYS_VMS
@@ -63,5 +59,5 @@
     for (i = 0; i < s->numpairs; i++, pp++) {
         p = "";
-        if (strcasecmp(pp->key, "type") == 0) {
+        if (OPENSSL_strcasecmp(pp->key, "type") == 0) {
             if (type != NULL) {
                 TEST_info("Line %d: multiple type lines", s->curr);
@@ -73,46 +69,46 @@
                 return 0;
             }
-        } else if (strcasecmp(pp->key, "int32") == 0) {
+        } else if (OPENSSL_strcasecmp(pp->key, "int32") == 0) {
             if (def_i32++) {
                 TEST_info("Line %d: multiple int32 lines", s->curr);
                 return 0;
             }
-            if (strcasecmp(pp->value, "invalid") != 0) {
+            if (OPENSSL_strcasecmp(pp->value, "invalid") != 0) {
                 pc->valid_i32 = 1;
                 pc->i32 = (int32_t)strtoimax(pp->value, &p, 10);
             }
-        } else if (strcasecmp(pp->key, "int64") == 0) {
+        } else if (OPENSSL_strcasecmp(pp->key, "int64") == 0) {
             if (def_i64++) {
                 TEST_info("Line %d: multiple int64 lines", s->curr);
                 return 0;
             }
-            if (strcasecmp(pp->value, "invalid") != 0) {
+            if (OPENSSL_strcasecmp(pp->value, "invalid") != 0) {
                 pc->valid_i64 = 1;
                 pc->i64 = (int64_t)strtoimax(pp->value, &p, 10);
             }
-        } else if (strcasecmp(pp->key, "uint32") == 0) {
+        } else if (OPENSSL_strcasecmp(pp->key, "uint32") == 0) {
             if (def_u32++) {
                 TEST_info("Line %d: multiple uint32 lines", s->curr);
                 return 0;
             }
-            if (strcasecmp(pp->value, "invalid") != 0) {
+            if (OPENSSL_strcasecmp(pp->value, "invalid") != 0) {
                 pc->valid_u32 = 1;
                 pc->u32 = (uint32_t)strtoumax(pp->value, &p, 10);
             }
-        } else if (strcasecmp(pp->key, "uint64") == 0) {
+        } else if (OPENSSL_strcasecmp(pp->key, "uint64") == 0) {
             if (def_u64++) {
                 TEST_info("Line %d: multiple uint64 lines", s->curr);
                 return 0;
             }
-            if (strcasecmp(pp->value, "invalid") != 0) {
+            if (OPENSSL_strcasecmp(pp->value, "invalid") != 0) {
                 pc->valid_u64 = 1;
                 pc->u64 = (uint64_t)strtoumax(pp->value, &p, 10);
             }
-        } else if (strcasecmp(pp->key, "double") == 0) {
+        } else if (OPENSSL_strcasecmp(pp->key, "double") == 0) {
             if (def_d++) {
                 TEST_info("Line %d: multiple double lines", s->curr);
                 return 0;
             }
-            if (strcasecmp(pp->value, "invalid") != 0) {
+            if (OPENSSL_strcasecmp(pp->value, "invalid") != 0) {
                 pc->valid_d = 1;
                 pc->d = strtod(pp->value, &p);
@@ -134,5 +130,5 @@
     }
 
-    if (strcasecmp(type, "int32") == 0) {
+    if (OPENSSL_strcasecmp(type, "int32") == 0) {
         if (!TEST_true(def_i32) || !TEST_true(pc->valid_i32)) {
             TEST_note("errant int32 on line %d", s->curr);
@@ -143,5 +139,5 @@
         pc->ref = &ref_i32;
         pc->size = sizeof(ref_i32);
-    } else if (strcasecmp(type, "int64") == 0) {
+    } else if (OPENSSL_strcasecmp(type, "int64") == 0) {
         if (!TEST_true(def_i64) || !TEST_true(pc->valid_i64)) {
             TEST_note("errant int64 on line %d", s->curr);
@@ -152,5 +148,5 @@
         pc->ref = &ref_i64;
         pc->size = sizeof(ref_i64);
-    } else if (strcasecmp(type, "uint32") == 0) {
+    } else if (OPENSSL_strcasecmp(type, "uint32") == 0) {
         if (!TEST_true(def_u32) || !TEST_true(pc->valid_u32)) {
             TEST_note("errant uint32 on line %d", s->curr);
@@ -161,5 +157,5 @@
         pc->ref = &ref_u32;
         pc->size = sizeof(ref_u32);
-    } else if (strcasecmp(type, "uint64") == 0) {
+    } else if (OPENSSL_strcasecmp(type, "uint64") == 0) {
         if (!TEST_true(def_u64) || !TEST_true(pc->valid_u64)) {
             TEST_note("errant uint64 on line %d", s->curr);
@@ -170,5 +166,5 @@
         pc->ref = &ref_u64;
         pc->size = sizeof(ref_u64);
-    } else if (strcasecmp(type, "double") == 0) {
+    } else if (OPENSSL_strcasecmp(type, "double") == 0) {
         if (!TEST_true(def_d) || !TEST_true(pc->valid_d)) {
             TEST_note("errant double on line %d", s->curr);
Index: /trunk/src/libs/openssl-3.0.3/test/provider_test.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/provider_test.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/provider_test.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -192,10 +192,13 @@
          * this test (there is no OPENSSL_NO_LEGACY)
          */
+        OSSL_LIB_CTX_free(libctx);
         return 1;
     }
 
     if (!TEST_true(OSSL_PROVIDER_add_builtin(libctx, name,
-                                             PROVIDER_INIT_FUNCTION_NAME)))
+                                             PROVIDER_INIT_FUNCTION_NAME))) {
+        OSSL_LIB_CTX_free(libctx);
         return 0;
+    }
 
     /* test_provider will free libctx and unload legacy as part of the test */
Index: /trunk/src/libs/openssl-3.0.3/test/recipes/03-test_fipsinstall.t
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/recipes/03-test_fipsinstall.t	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/recipes/03-test_fipsinstall.t	(revision 95219)
@@ -1,4 +1,4 @@
 #! /usr/bin/env perl
-# Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
 #
 # Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -28,5 +28,5 @@
 
 my $infile = bldtop_file('providers', platform->dso('fips'));
-my $fipskey = $ENV{FIPSKEY} // '00';
+my $fipskey = $ENV{FIPSKEY} // config('FIPSKEY') // '00';
 
 # Read in a text $infile and replace the regular expression in $srch with the
Index: /trunk/src/libs/openssl-3.0.3/test/recipes/15-test_ecparam.t
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/recipes/15-test_ecparam.t	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/recipes/15-test_ecparam.t	(revision 95219)
@@ -1,4 +1,4 @@
 #! /usr/bin/env perl
-# Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
 #
 # Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -14,5 +14,5 @@
 use File::Compare qw/compare_text/;
 use OpenSSL::Glob;
-use OpenSSL::Test qw/:DEFAULT data_file/;
+use OpenSSL::Test qw/:DEFAULT data_file srctop_file bldtop_dir/;
 use OpenSSL::Test::Utils;
 
@@ -26,5 +26,5 @@
 my @invalid = glob(data_file("invalid", "*.pem"));
 
-plan tests => 11;
+plan tests => 12;
 
 sub checkload {
@@ -59,4 +59,6 @@
     }
 }
+
+my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
 
 subtest "Check loading valid parameters by ecparam with -check" => sub {
@@ -114,2 +116,30 @@
     checkcompare(\@valid, "pkeyparam");
 };
+
+subtest "Check loading of fips and non-fips params" => sub {
+    plan skip_all => "FIPS is disabled"
+        if $no_fips;
+    plan tests => 3;
+
+    my $fipsconf = srctop_file("test", "fips-and-base.cnf");
+    my $defaultconf = srctop_file("test", "default.cnf");
+
+    $ENV{OPENSSL_CONF} = $fipsconf;
+
+    ok(run(app(['openssl', 'ecparam',
+                '-in', data_file('valid', 'secp384r1-explicit.pem'),
+                '-check'])),
+       "Loading explicitly encoded valid curve");
+
+    ok(run(app(['openssl', 'ecparam',
+                '-in', data_file('valid', 'secp384r1-named.pem'),
+                '-check'])),
+       "Loading named valid curve");
+
+    ok(!run(app(['openssl', 'ecparam',
+                '-in', data_file('valid', 'secp112r1-named.pem'),
+                '-check'])),
+       "Fail loading named non-fips curve");
+
+    $ENV{OPENSSL_CONF} = $defaultconf;
+};
Index: /trunk/src/libs/openssl-3.0.3/test/recipes/15-test_rsapss.t
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/recipes/15-test_rsapss.t	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/recipes/15-test_rsapss.t	(revision 95219)
@@ -1,4 +1,4 @@
 #! /usr/bin/env perl
-# Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
 #
 # Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -17,5 +17,5 @@
 setup("test_rsapss");
 
-plan tests => 7;
+plan tests => 9;
 
 #using test/testrsa.pem which happens to be a 512 bit RSA
@@ -65,2 +65,12 @@
             srctop_file('test', 'testrsa.pem')])),
    "openssl dgst -prverify [plain RSA key, PSS padding mode, no PSS restrictions]");
+
+# Test that RSA-PSS keys are supported by genpkey and rsa commands.
+{
+   my $rsapss = "rsapss.key";
+   ok(run(app(['openssl', 'genpkey', '-algorithm', 'RSA-PSS',
+               '-pkeyopt', 'rsa_keygen_bits:1024',
+               '--out', $rsapss])));
+   ok(run(app(['openssl', 'rsa', '-check',
+               '-in', $rsapss])));
+}
Index: /trunk/src/libs/openssl-3.0.3/test/recipes/30-test_evp_data/evpciph_aes_stitched.txt
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/recipes/30-test_evp_data/evpciph_aes_stitched.txt	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/recipes/30-test_evp_data/evpciph_aes_stitched.txt	(revision 95219)
@@ -125,24 +125,2 @@
 Ciphertext = 261cd0c88a4d4e6db7fc263257a9f6d0ce83c1ff5f2680dc57ffd8eefdbb9c00d3d507672d105a990b2b78509978625b9d93c2bd41e3fb721abd1496553c583c67dad9b662b3d58c8540e10ed9c5ed1a7f33ce9e9a41c30836651d73ee2c003af03a919eb41a6d70ef814e184e740f8a96221b924d9d025ef5e7150d4ca76921a025dd146fef87da738877313f11ec8f4c558b878c28ce6a9a5011d70f58c5dbd3412cf0a32154f5a4286958a5a50a86f15119835ceccf432601e4cc688cdd682ac9620500b60c0760bb93209859823778a7f2b5bab1af259bda13d84f952af9d2f07f500dadedc41a2b6a737a1296e0b2fb96ac4da4bf71fe2f0c4a1b6fc4dd251087e4c03d2e28c85a9b4a835ef166b48e5b7690f332a1d8db7bd9380221891f31ee82f4b8dd9ebf540cab583a0f33
 NextIV = 1f31ee82f4b8dd9ebf540cab583a0f33
-
-Title = RC4-HMAC-MD5 test vectors
-
-Availablein = legacy
-Cipher = RC4-HMAC-MD5
-Key = d48ecc0a163a06626bd1b7e172dfb5b3
-MACKey = 5973581f63768353af37d3f51ec9f6ef
-TLSAAD = 90a1b2c3e4f506172803010050
-TLSVersion = 0x0301
-Plaintext = 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
-Ciphertext = eea8eba927d9b16c640958f922b3ca43b197eea520674aa1d059156dfd4c12249e2890e8f3c72676e20fe4a30848c1cc6c12f4596d6e290b5f84745ac36959645ea4acabc84e748b2fd5e4228a2fe4f8d44460dfb9a0fce1faf00f1fc7159c3c
-Operation = ENCRYPT
-
-Availablein = legacy
-Cipher = RC4-HMAC-MD5
-Key = d48ecc0a163a06626bd1b7e172dfb5b3
-MACKey = 5973581f63768353af37d3f51ec9f6ef
-TLSAAD = 90a1b2c3e4f506172803010060
-TLSVersion = 0x0301
-Plaintext = 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
-Ciphertext = eea8eba927d9b16c640958f922b3ca43b197eea520674aa1d059156dfd4c12249e2890e8f3c72676e20fe4a30848c1cc6c12f4596d6e290b5f84745ac36959645ea4acabc84e748b2fd5e4228a2fe4f8d44460dfb9a0fce1faf00f1fc7159c3c
-Operation = DECRYPT
Index: /trunk/src/libs/openssl-3.0.3/test/recipes/30-test_evp_data/evpciph_rc4_stitched.txt
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/recipes/30-test_evp_data/evpciph_rc4_stitched.txt	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/recipes/30-test_evp_data/evpciph_rc4_stitched.txt	(revision 95219)
@@ -8,5 +8,5 @@
 TLSVersion = 0x0301
 Plaintext = 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
-Ciphertext = eea8eba927d9b16c640958f922b3ca43b197eea520674aa1d059156dfd4c12249e2890e8f3c72676e20fe4a30848c1cc6c12f4596d6e290b5f84745ac36959645ea4acabc84e748b2fd5e4228a2fe4f8d44460dfb9a0fce1faf00f1fc7159c3c
+Ciphertext = eea8eba927d9b16c640958f922b3ca43b197eea520674aa1d059156dfd4c12249e2890e8f3c72676e20fe4a30848c1cc6c12f4596d6e290b5f84745ac36959645ea4acabc84e748b2fd5e4228a2fe4f8c5792501fca9d8455160d626dc1a9716
 # DECRYPT must be a separate entry due to change in TLSAAD value
 Operation = ENCRYPT
@@ -19,4 +19,4 @@
 TLSVersion = 0x0301
 Plaintext = 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
-Ciphertext = eea8eba927d9b16c640958f922b3ca43b197eea520674aa1d059156dfd4c12249e2890e8f3c72676e20fe4a30848c1cc6c12f4596d6e290b5f84745ac36959645ea4acabc84e748b2fd5e4228a2fe4f8d44460dfb9a0fce1faf00f1fc7159c3c
+Ciphertext = eea8eba927d9b16c640958f922b3ca43b197eea520674aa1d059156dfd4c12249e2890e8f3c72676e20fe4a30848c1cc6c12f4596d6e290b5f84745ac36959645ea4acabc84e748b2fd5e4228a2fe4f8c5792501fca9d8455160d626dc1a9716
 Operation = DECRYPT
Index: /trunk/src/libs/openssl-3.0.3/test/recipes/30-test_evp_data/evpmac_poly1305.txt
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/recipes/30-test_evp_data/evpmac_poly1305.txt	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/recipes/30-test_evp_data/evpmac_poly1305.txt	(revision 95219)
@@ -1,4 +1,4 @@
 #
-# Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.
 #
 # Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -18,4 +18,5 @@
 Input = 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 Output = 00000000000000000000000000000000
+NoReinit = 1
 
 MAC = Poly1305
@@ -23,4 +24,5 @@
 Input = 416e79207375626d697373696f6e20746f20746865204945544620696e74656e6465642062792074686520436f6e7472696275746f7220666f72207075626c69636174696f6e20617320616c6c206f722070617274206f6620616e204945544620496e7465726e65742d4472616674206f722052464320616e6420616e792073746174656d656e74206d6164652077697468696e2074686520636f6e74657874206f6620616e204945544620616374697669747920697320636f6e7369646572656420616e20224945544620436f6e747269627574696f6e222e20537563682073746174656d656e747320696e636c756465206f72616c2073746174656d656e747320696e20494554462073657373696f6e732c2061732077656c6c206173207772697474656e20616e6420656c656374726f6e696320636f6d6d756e69636174696f6e73206d61646520617420616e792074696d65206f7220706c6163652c207768696368206172652061646472657373656420746f
 Output = 36e5f6b5c5e06070f0efca96227a863e
+NoReinit = 1
 
 MAC = Poly1305
@@ -28,4 +30,5 @@
 Input = 416e79207375626d697373696f6e20746f20746865204945544620696e74656e6465642062792074686520436f6e7472696275746f7220666f72207075626c69636174696f6e20617320616c6c206f722070617274206f6620616e204945544620496e7465726e65742d4472616674206f722052464320616e6420616e792073746174656d656e74206d6164652077697468696e2074686520636f6e74657874206f6620616e204945544620616374697669747920697320636f6e7369646572656420616e20224945544620436f6e747269627574696f6e222e20537563682073746174656d656e747320696e636c756465206f72616c2073746174656d656e747320696e20494554462073657373696f6e732c2061732077656c6c206173207772697474656e20616e6420656c656374726f6e696320636f6d6d756e69636174696f6e73206d61646520617420616e792074696d65206f7220706c6163652c207768696368206172652061646472657373656420746f
 Output = f3477e7cd95417af89a6b8794c310cf0
+NoReinit = 1
 
 MAC = Poly1305
@@ -33,4 +36,5 @@
 Input = 2754776173206272696c6c69672c20616e642074686520736c6974687920746f7665730a446964206779726520616e642067696d626c6520696e2074686520776162653a0a416c6c206d696d737920776572652074686520626f726f676f7665732c0a416e6420746865206d6f6d65207261746873206f757467726162652e
 Output = 4541669a7eaaee61e708dc7cbcc5eb62
+NoReinit = 1
 
 # If one uses 130-bit partial reduction, does the code handle the case where partially reduced final result is not fully reduced?
@@ -39,4 +43,5 @@
 Input = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
 Output = 03000000000000000000000000000000
+NoReinit = 1
 
 # What happens if addition of s overflows modulo 2^128?
@@ -45,4 +50,5 @@
 Input = 02000000000000000000000000000000
 Output = 03000000000000000000000000000000
+NoReinit = 1
 
 # What happens if data limb is all ones and there is carry from lower limb?
@@ -51,4 +57,5 @@
 Input = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF11000000000000000000000000000000
 Output = 05000000000000000000000000000000
+NoReinit = 1
 
 # What happens if final result from polynomial part is exactly 2^130-5?
@@ -57,4 +64,5 @@
 Input = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFEFEFEFEFEFEFEFEFEFEFEFEFEFEFE01010101010101010101010101010101
 Output = 00000000000000000000000000000000
+NoReinit = 1
 
 # What happens if final result from polynomial part is exactly 2^130-6?
@@ -63,4 +71,5 @@
 Input = FDFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
 Output = FAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+NoReinit = 1
 
 # Taken from poly1305_internal_test.c
@@ -71,4 +80,5 @@
 Key = 85d6be7857556d337f4452fe42d506a80103808afb0db2fd4abff6af4149f51b
 Output = a8061dc1305136c6c22b8baf0c0127a9
+NoReinit = 1
 
 # test vectors from "The Poly1305-AES message-authentication code"
@@ -78,4 +88,5 @@
 Key = 851fc40c3467ac0be05cc20404f3f700580b3b0f9447bb1e69d095b5928b6dbc
 Output = f4c633c3044fc145f84f335cb81953de
+NoReinit = 1
 
 # No input?
@@ -84,4 +95,5 @@
 # Key = a0f3080000f46400d0c7e9076c834403dd3fab2251f11ac759f0887129cc2ee7
 # Output = dd3fab2251f11ac759f0887129cc2ee7
+# NoReinit = 1
 
 MAC = Poly1305
@@ -89,4 +101,5 @@
 Key = 48443d0bb0d21109c89a100b5ce2c20883149c69b561dd88298a1798b10716ef
 Output = 0ee1c16bb73f0f4fd19881753c01cdbe
+NoReinit = 1
 
 MAC = Poly1305
@@ -94,4 +107,5 @@
 Key = 12976a08c4426d0ce8a82407c4f4820780f8c20aa71202d1e29179cbcb555a57
 Output = 5154ad0d2cb26e01274fc51148491f1b
+NoReinit = 1
 
 # self-generated vectors exercise "significant" length such that* are handled by different code paths
@@ -101,4 +115,5 @@
 Key = 12976a08c4426d0ce8a82407c4f4820780f8c20aa71202d1e29179cbcb555a57
 Output = 812059a5da198637cac7c4a631bee466
+NoReinit = 1
 
 MAC = Poly1305
@@ -106,4 +121,5 @@
 Key = 12976a08c4426d0ce8a82407c4f4820780f8c20aa71202d1e29179cbcb555a57
 Output = 5b88d7f6228b11e2e28579a5c0c1f761
+NoReinit = 1
 
 MAC = Poly1305
@@ -111,4 +127,5 @@
 Key = 12976a08c4426d0ce8a82407c4f4820780f8c20aa71202d1e29179cbcb555a57
 Output = bbb613b2b6d753ba07395b916aaece15
+NoReinit = 1
 
 MAC = Poly1305
@@ -116,4 +133,5 @@
 Key = 12976a08c4426d0ce8a82407c4f4820780f8c20aa71202d1e29179cbcb555a57
 Output = c794d7057d1778c4bbee0a39b3d97342
+NoReinit = 1
 
 MAC = Poly1305
@@ -121,4 +139,5 @@
 Key = 12976a08c4426d0ce8a82407c4f4820780f8c20aa71202d1e29179cbcb555a57
 Output = ffbcb9b371423152d7fca5ad042fbaa9
+NoReinit = 1
 
 MAC = Poly1305
@@ -126,4 +145,5 @@
 Key = 12976a08c4426d0ce8a82407c4f4820780f8c20aa71202d1e29179cbcb555a57
 Output = 069ed6b8ef0f207b3e243bb1019fe632
+NoReinit = 1
 
 MAC = Poly1305
@@ -131,4 +151,5 @@
 Key = 12976a08c4426d0ce8a82407c4f4820780f8c20aa71202d1e29179cbcb555a57
 Output = cca339d9a45fa2368c2c68b3a4179133
+NoReinit = 1
 
 MAC = Poly1305
@@ -136,4 +157,5 @@
 Key = 12976a08c4426d0ce8a82407c4f4820780f8c20aa71202d1e29179cbcb555a57
 Output = 53f6e828a2f0fe0ee815bf0bd5841a34
+NoReinit = 1
 
 MAC = Poly1305
@@ -141,4 +163,5 @@
 Key = 12976a08c4426d0ce8a82407c4f4820780f8c20aa71202d1e29179cbcb555a57
 Output = b846d44e9bbd53cedffbfbb6b7fa4933
+NoReinit = 1
 
 # 4th power of the key spills to 131th bit in SIMD key setup
@@ -148,4 +171,5 @@
 Key = ad628107e8351d0f2c231a05dc4a410600000000000000000000000000000000
 Output = 07145a4c02fe5fa32036de68fabe9066
+NoReinit = 1
 
 # poly1305_ieee754.c failed this in final stage
@@ -155,4 +179,5 @@
 Key = 95d5c005503e510d8cd0aa072c4a4d066eabc52d11653df47fbf63ab198bcc26
 Output = f248312e578d9d58f8b7bb4d19105431
+NoReinit = 1
 
 # AVX2 in poly1305-x86.pl failed this with 176+32 split
@@ -162,4 +187,5 @@
 Key = 000102030405060708090a0b0c0d0e0f00000000000000000000000000000000
 Output = bc939bc5281480fa99c6d68c258ec42f
+NoReinit = 1
 
 # test vectors from Google
@@ -170,4 +196,5 @@
 # Key = c8afaac331ee372cd6082de134943b174710130e9f6fea8d72293850a667d86c
 # Output = 4710130e9f6fea8d72293850a667d86c
+# NoReinit = 1
 
 MAC = Poly1305
@@ -175,4 +202,5 @@
 Key = 746869732069732033322d62797465206b657920666f7220506f6c7931333035
 Output = a6f745008f81c916a20dcc74eef2b2f0
+NoReinit = 1
 
 MAC = Poly1305
@@ -180,4 +208,5 @@
 Key = 746869732069732033322d62797465206b657920666f7220506f6c7931333035
 Output = 49ec78090e481ec6c26b33b91ccc0307
+NoReinit = 1
 
 MAC = Poly1305
@@ -185,4 +214,5 @@
 Key = 2d773be37adb1e4d683bf0075e79c4ee037918535a7f99ccb7040fb5f5f43aea
 Output = c85d15ed44c378d6b00e23064c7bcd51
+NoReinit = 1
 
 MAC = Poly1305
@@ -190,4 +220,5 @@
 Key = 99e5822dd4173c995e3dae0ddefb97743fde3b080134b39f76e9bf8d0e88d546
 Output = 2637408fe13086ea73f971e3425e2820
+NoReinit = 1
 
 # test vectors from Hanno Bock
@@ -197,4 +228,5 @@
 Key = 7f1b02640000000000000000000000000000000000000000cccccccccccccccc
 Output = 8559b876eceed66eb37798c0457baff9
+NoReinit = 1
 
 MAC = Poly1305
@@ -202,4 +234,5 @@
 Key = e00016000000000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaa
 Output = 00bd1258978e205444c9aaaa82006fed
+NoReinit = 1
 
 MAC = Poly1305
@@ -207,4 +240,5 @@
 Key = 0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c
 Output = 06120c0c0c0c0c0c0c0c0c0c0c0c0c0c
+NoReinit = 1
 
 MAC = Poly1305
@@ -212,4 +246,5 @@
 Key = 00ff000000000000000000000000000000000000001e00000000000000007b7b
 Output = 33205bbf9e9f8f7212ab9e2ab9b7e4a5
+NoReinit = 1
 
 MAC = Poly1305
@@ -217,4 +252,5 @@
 Key = 0000007f0000007f01000020000000000000cf77777777777777777777777777
 Output = 02ee7c8c546ddeb1a467e4c3981158b9
+NoReinit = 1
 
 # test vectors from Andrew Moon - nacl
@@ -224,4 +260,5 @@
 Key = eea6a7251c1e72916d11c2cb214d3c252539121d8e234e652d651fa4c8cff880
 Output = f3ffc7703f9400e52a7dfb4b3d3305d9
+NoReinit = 1
 
 # wrap 2^130-5
@@ -230,4 +267,5 @@
 Key = 0200000000000000000000000000000000000000000000000000000000000000
 Output = 03000000000000000000000000000000
+NoReinit = 1
 
 # wrap 2^128
@@ -236,4 +274,5 @@
 Key = 02000000000000000000000000000000ffffffffffffffffffffffffffffffff
 Output = 03000000000000000000000000000000
+NoReinit = 1
 
 # limb carry
@@ -242,4 +281,5 @@
 Key = 0100000000000000000000000000000000000000000000000000000000000000
 Output = 05000000000000000000000000000000
+NoReinit = 1
 
 # 2^130-5
@@ -248,4 +288,5 @@
 Key = 0100000000000000000000000000000000000000000000000000000000000000
 Output = 00000000000000000000000000000000
+NoReinit = 1
 
 # 2^130-6
@@ -254,4 +295,5 @@
 Key = 0200000000000000000000000000000000000000000000000000000000000000
 Output = faffffffffffffffffffffffffffffff
+NoReinit = 1
 
 # 5*H+L reduction intermediate
@@ -260,4 +302,5 @@
 Key = 0100000000000000040000000000000000000000000000000000000000000000
 Output = 14000000000000005500000000000000
+NoReinit = 1
 
 # 5*H+L reduction final
@@ -266,4 +309,5 @@
 Key = 0100000000000000040000000000000000000000000000000000000000000000
 Output = 13000000000000000000000000000000
+NoReinit = 1
 
 # Here are 4 duplicated cases for Poly1305 by EVP_PKEY
Index: /trunk/src/libs/openssl-3.0.3/test/recipes/70-test_tls13hrr.t
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/recipes/70-test_tls13hrr.t	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/recipes/70-test_tls13hrr.t	(revision 95219)
@@ -1,4 +1,4 @@
 #! /usr/bin/env perl
-# Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
 #
 # Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -38,5 +38,6 @@
 use constant {
     CHANGE_HRR_CIPHERSUITE => 0,
-    CHANGE_CH1_CIPHERSUITE => 1
+    CHANGE_CH1_CIPHERSUITE => 1,
+    DUPLICATE_HRR => 2
 };
 
@@ -51,5 +52,5 @@
 my $testtype = CHANGE_HRR_CIPHERSUITE;
 $proxy->start() or plan skip_all => "Unable to start up Proxy for tests";
-plan tests => 2;
+plan tests => 3;
 ok(TLSProxy::Message->fail(), "Server ciphersuite changes");
 
@@ -66,4 +67,17 @@
 $proxy->start();
 ok(TLSProxy::Message->fail(), "Client ciphersuite changes");
+
+#Test 3: A client should fail with unexpected_message alert if the server
+#        sends more than 1 HRR
+my $fatal_alert = 0;
+$proxy->clear();
+if (disabled("ec")) {
+    $proxy->serverflags("-curves ffdhe3072");
+} else {
+    $proxy->serverflags("-curves P-256");
+}
+$testtype = DUPLICATE_HRR;
+$proxy->start();
+ok($fatal_alert, "Server duplicated HRR");
 
 sub hrr_filter
@@ -87,4 +101,37 @@
     }
 
+    if ($testtype == DUPLICATE_HRR) {
+        # We're only interested in the HRR
+        # and the unexpected_message alert from client
+        if ($proxy->flight == 4) {
+            $fatal_alert = 1
+                if @{$proxy->record_list}[-1]->is_fatal_alert(0) == 10;
+            return;
+        }
+        if ($proxy->flight != 3) {
+            return;
+        }
+
+        # Find ServerHello record (HRR actually) and insert after that
+        my $i;
+        for ($i = 0; ${$proxy->record_list}[$i]->flight() < 1; $i++) {
+            next;
+        }
+        my $hrr_record = ${$proxy->record_list}[$i];
+        my $dup_hrr = TLSProxy::Record->new(3,
+            $hrr_record->content_type(),
+            $hrr_record->version(),
+            $hrr_record->len(),
+            $hrr_record->sslv2(),
+            $hrr_record->len_real(),
+            $hrr_record->decrypt_len(),
+            $hrr_record->data(),
+            $hrr_record->decrypt_data());
+
+        $i++;
+        splice @{$proxy->record_list}, $i, 0, $dup_hrr;
+        return;
+    }
+
     # CHANGE_CH1_CIPHERSUITE
     if ($proxy->flight != 0) {
Index: /trunk/src/libs/openssl-3.0.3/test/recipes/80-test_cmsapi.t
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/recipes/80-test_cmsapi.t	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/recipes/80-test_cmsapi.t	(revision 95219)
@@ -1,4 +1,4 @@
 #! /usr/bin/env perl
-# Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.
 #
 # Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -18,4 +18,5 @@
 
 ok(run(test(["cmsapitest", srctop_file("test", "certs", "servercert.pem"),
-             srctop_file("test", "certs", "serverkey.pem")])),
+             srctop_file("test", "certs", "serverkey.pem"),
+             srctop_file("test", "recipes", "80-test_cmsapi_data", "encryptedData.der")])),
              "running cmsapitest");
Index: /trunk/src/libs/openssl-3.0.3/test/recipes/80-test_ocsp.t
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/recipes/80-test_ocsp.t	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/recipes/80-test_ocsp.t	(revision 95219)
@@ -1,4 +1,4 @@
 #! /usr/bin/env perl
-# Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.
 #
 # Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -36,4 +36,5 @@
     }
     my $expected_exit = shift;
+    my $nochecks = shift;
     my $outputfile = basename($inputfile, '.ors') . '.dat';
 
@@ -46,5 +47,6 @@
                            "-CAfile", catfile($ocspdir, $CAfile),
                            "-verify_other", catfile($ocspdir, $untrusted),
-                           "-no-CApath", "-no-CAstore"])),
+                           "-no-CApath", "-no-CAstore",
+                           $nochecks ? "-no_cert_checks" : ()])),
                   $title); });
 }
@@ -56,17 +58,17 @@
 
     test_ocsp("NON-DELEGATED; Intermediate CA -> EE",
-              "ND1.ors", "ND1_Issuer_ICA.pem", "", 0);
-    test_ocsp("NON-DELEGATED; Root CA -> Intermediate CA",
-              "ND2.ors", "ND2_Issuer_Root.pem", "", 0);
-    test_ocsp("NON-DELEGATED; Root CA -> EE",
-              "ND3.ors", "ND3_Issuer_Root.pem", "", 0);
+              "ND1.ors", "ND1_Issuer_ICA.pem", "", 0, 0);
+    test_ocsp("NON-DELEGATED; Root CA -> Intermediate CA",
+              "ND2.ors", "ND2_Issuer_Root.pem", "", 0, 0);
+    test_ocsp("NON-DELEGATED; Root CA -> EE",
+              "ND3.ors", "ND3_Issuer_Root.pem", "", 0, 0);
     test_ocsp("NON-DELEGATED; 3-level CA hierarchy",
-              "ND1.ors", "ND1_Cross_Root.pem", "ND1_Issuer_ICA-Cross.pem", 0);
-    test_ocsp("DELEGATED; Intermediate CA -> EE",
-              "D1.ors", "D1_Issuer_ICA.pem", "", 0);
-    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
-              "D2.ors", "D2_Issuer_Root.pem", "", 0);
-    test_ocsp("DELEGATED; Root CA -> EE",
-              "D3.ors", "D3_Issuer_Root.pem", "", 0);
+              "ND1.ors", "ND1_Cross_Root.pem", "ND1_Issuer_ICA-Cross.pem", 0, 0);
+    test_ocsp("DELEGATED; Intermediate CA -> EE",
+              "D1.ors", "D1_Issuer_ICA.pem", "", 0, 0);
+    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
+              "D2.ors", "D2_Issuer_Root.pem", "", 0, 0);
+    test_ocsp("DELEGATED; Root CA -> EE",
+              "D3.ors", "D3_Issuer_Root.pem", "", 0, 0);
 };
 
@@ -75,15 +77,15 @@
 
     test_ocsp("NON-DELEGATED; Intermediate CA -> EE",
-              "ISOP_ND1.ors", "ND1_Issuer_ICA.pem", "", 1);
-    test_ocsp("NON-DELEGATED; Root CA -> Intermediate CA",
-              "ISOP_ND2.ors", "ND2_Issuer_Root.pem", "", 1);
-    test_ocsp("NON-DELEGATED; Root CA -> EE",
-              "ISOP_ND3.ors", "ND3_Issuer_Root.pem", "", 1);
-    test_ocsp("DELEGATED; Intermediate CA -> EE",
-              "ISOP_D1.ors", "D1_Issuer_ICA.pem", "", 1);
-    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
-              "ISOP_D2.ors", "D2_Issuer_Root.pem", "", 1);
-    test_ocsp("DELEGATED; Root CA -> EE",
-              "ISOP_D3.ors", "D3_Issuer_Root.pem", "", 1);
+              "ISOP_ND1.ors", "ND1_Issuer_ICA.pem", "", 1, 0);
+    test_ocsp("NON-DELEGATED; Root CA -> Intermediate CA",
+              "ISOP_ND2.ors", "ND2_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("NON-DELEGATED; Root CA -> EE",
+              "ISOP_ND3.ors", "ND3_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Intermediate CA -> EE",
+              "ISOP_D1.ors", "D1_Issuer_ICA.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
+              "ISOP_D2.ors", "D2_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Root CA -> EE",
+              "ISOP_D3.ors", "D3_Issuer_Root.pem", "", 1, 0);
 };
 
@@ -92,15 +94,15 @@
 
     test_ocsp("NON-DELEGATED; Intermediate CA -> EE",
-              "WRID_ND1.ors", "ND1_Issuer_ICA.pem", "", 1);
-    test_ocsp("NON-DELEGATED; Root CA -> Intermediate CA",
-              "WRID_ND2.ors", "ND2_Issuer_Root.pem", "", 1);
-    test_ocsp("NON-DELEGATED; Root CA -> EE",
-              "WRID_ND3.ors", "ND3_Issuer_Root.pem", "", 1);
-    test_ocsp("DELEGATED; Intermediate CA -> EE",
-              "WRID_D1.ors", "D1_Issuer_ICA.pem", "", 1);
-    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
-              "WRID_D2.ors", "D2_Issuer_Root.pem", "", 1);
-    test_ocsp("DELEGATED; Root CA -> EE",
-              "WRID_D3.ors", "D3_Issuer_Root.pem", "", 1);
+              "WRID_ND1.ors", "ND1_Issuer_ICA.pem", "", 1, 0);
+    test_ocsp("NON-DELEGATED; Root CA -> Intermediate CA",
+              "WRID_ND2.ors", "ND2_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("NON-DELEGATED; Root CA -> EE",
+              "WRID_ND3.ors", "ND3_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Intermediate CA -> EE",
+              "WRID_D1.ors", "D1_Issuer_ICA.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
+              "WRID_D2.ors", "D2_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Root CA -> EE",
+              "WRID_D3.ors", "D3_Issuer_Root.pem", "", 1, 0);
 };
 
@@ -109,15 +111,15 @@
 
     test_ocsp("NON-DELEGATED; Intermediate CA -> EE",
-              "WINH_ND1.ors", "ND1_Issuer_ICA.pem", "", 1);
-    test_ocsp("NON-DELEGATED; Root CA -> Intermediate CA",
-              "WINH_ND2.ors", "ND2_Issuer_Root.pem", "", 1);
-    test_ocsp("NON-DELEGATED; Root CA -> EE",
-              "WINH_ND3.ors", "ND3_Issuer_Root.pem", "", 1);
-    test_ocsp("DELEGATED; Intermediate CA -> EE",
-              "WINH_D1.ors", "D1_Issuer_ICA.pem", "", 1);
-    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
-              "WINH_D2.ors", "D2_Issuer_Root.pem", "", 1);
-    test_ocsp("DELEGATED; Root CA -> EE",
-              "WINH_D3.ors", "D3_Issuer_Root.pem", "", 1);
+              "WINH_ND1.ors", "ND1_Issuer_ICA.pem", "", 1, 0);
+    test_ocsp("NON-DELEGATED; Root CA -> Intermediate CA",
+              "WINH_ND2.ors", "ND2_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("NON-DELEGATED; Root CA -> EE",
+              "WINH_ND3.ors", "ND3_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Intermediate CA -> EE",
+              "WINH_D1.ors", "D1_Issuer_ICA.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
+              "WINH_D2.ors", "D2_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Root CA -> EE",
+              "WINH_D3.ors", "D3_Issuer_Root.pem", "", 1, 0);
 };
 
@@ -126,15 +128,15 @@
 
     test_ocsp("NON-DELEGATED; Intermediate CA -> EE",
-              "WIKH_ND1.ors", "ND1_Issuer_ICA.pem", "", 1);
-    test_ocsp("NON-DELEGATED; Root CA -> Intermediate CA",
-              "WIKH_ND2.ors", "ND2_Issuer_Root.pem", "", 1);
-    test_ocsp("NON-DELEGATED; Root CA -> EE",
-              "WIKH_ND3.ors", "ND3_Issuer_Root.pem", "", 1);
-    test_ocsp("DELEGATED; Intermediate CA -> EE",
-              "WIKH_D1.ors", "D1_Issuer_ICA.pem", "", 1);
-    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
-              "WIKH_D2.ors", "D2_Issuer_Root.pem", "", 1);
-    test_ocsp("DELEGATED; Root CA -> EE",
-              "WIKH_D3.ors", "D3_Issuer_Root.pem", "", 1);
+              "WIKH_ND1.ors", "ND1_Issuer_ICA.pem", "", 1, 0);
+    test_ocsp("NON-DELEGATED; Root CA -> Intermediate CA",
+              "WIKH_ND2.ors", "ND2_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("NON-DELEGATED; Root CA -> EE",
+              "WIKH_ND3.ors", "ND3_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Intermediate CA -> EE",
+              "WIKH_D1.ors", "D1_Issuer_ICA.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
+              "WIKH_D2.ors", "D2_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Root CA -> EE",
+              "WIKH_D3.ors", "D3_Issuer_Root.pem", "", 1, 0);
 };
 
@@ -143,20 +145,26 @@
 
     test_ocsp("DELEGATED; Intermediate CA -> EE",
-              "WKDOSC_D1.ors", "D1_Issuer_ICA.pem", "", 1);
-    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
-              "WKDOSC_D2.ors", "D2_Issuer_Root.pem", "", 1);
-    test_ocsp("DELEGATED; Root CA -> EE",
-              "WKDOSC_D3.ors", "D3_Issuer_Root.pem", "", 1);
+              "WKDOSC_D1.ors", "D1_Issuer_ICA.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
+              "WKDOSC_D2.ors", "D2_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Root CA -> EE",
+              "WKDOSC_D3.ors", "D3_Issuer_Root.pem", "", 1, 0);
 };
 
 subtest "=== INVALID SIGNATURE on the DELEGATED OCSP SIGNING CERTIFICATE ===" => sub {
-    plan tests => 3;
-
-    test_ocsp("DELEGATED; Intermediate CA -> EE",
-              "ISDOSC_D1.ors", "D1_Issuer_ICA.pem", "", 1);
-    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
-              "ISDOSC_D2.ors", "D2_Issuer_Root.pem", "", 1);
-    test_ocsp("DELEGATED; Root CA -> EE",
-              "ISDOSC_D3.ors", "D3_Issuer_Root.pem", "", 1);
+    plan tests => 6;
+
+    test_ocsp("DELEGATED; Intermediate CA -> EE",
+              "ISDOSC_D1.ors", "D1_Issuer_ICA.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
+              "ISDOSC_D2.ors", "D2_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Root CA -> EE",
+              "ISDOSC_D3.ors", "D3_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Intermediate CA -> EE",
+              "ISDOSC_D1.ors", "D1_Issuer_ICA.pem", "", 1, 1);
+    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
+              "ISDOSC_D2.ors", "D2_Issuer_Root.pem", "", 1, 1);
+    test_ocsp("DELEGATED; Root CA -> EE",
+              "ISDOSC_D3.ors", "D3_Issuer_Root.pem", "", 1, 1);
 };
 
@@ -165,15 +173,15 @@
 
     test_ocsp("NON-DELEGATED; Intermediate CA -> EE",
-              "ND1.ors", "WSNIC_ND1_Issuer_ICA.pem", "", 1);
-    test_ocsp("NON-DELEGATED; Root CA -> Intermediate CA",
-              "ND2.ors", "WSNIC_ND2_Issuer_Root.pem", "", 1);
-    test_ocsp("NON-DELEGATED; Root CA -> EE",
-              "ND3.ors", "WSNIC_ND3_Issuer_Root.pem", "", 1);
-    test_ocsp("DELEGATED; Intermediate CA -> EE",
-              "D1.ors", "WSNIC_D1_Issuer_ICA.pem", "", 1);
-    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
-              "D2.ors", "WSNIC_D2_Issuer_Root.pem", "", 1);
-    test_ocsp("DELEGATED; Root CA -> EE",
-              "D3.ors", "WSNIC_D3_Issuer_Root.pem", "", 1);
+              "ND1.ors", "WSNIC_ND1_Issuer_ICA.pem", "", 1, 0);
+    test_ocsp("NON-DELEGATED; Root CA -> Intermediate CA",
+              "ND2.ors", "WSNIC_ND2_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("NON-DELEGATED; Root CA -> EE",
+              "ND3.ors", "WSNIC_ND3_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Intermediate CA -> EE",
+              "D1.ors", "WSNIC_D1_Issuer_ICA.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
+              "D2.ors", "WSNIC_D2_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Root CA -> EE",
+              "D3.ors", "WSNIC_D3_Issuer_Root.pem", "", 1, 0);
 };
 
@@ -182,15 +190,15 @@
 
     test_ocsp("NON-DELEGATED; Intermediate CA -> EE",
-              "ND1.ors", "WKIC_ND1_Issuer_ICA.pem", "", 1);
-    test_ocsp("NON-DELEGATED; Root CA -> Intermediate CA",
-              "ND2.ors", "WKIC_ND2_Issuer_Root.pem", "", 1);
-    test_ocsp("NON-DELEGATED; Root CA -> EE",
-              "ND3.ors", "WKIC_ND3_Issuer_Root.pem", "", 1);
-    test_ocsp("DELEGATED; Intermediate CA -> EE",
-              "D1.ors", "WKIC_D1_Issuer_ICA.pem", "", 1);
-    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
-              "D2.ors", "WKIC_D2_Issuer_Root.pem", "", 1);
-    test_ocsp("DELEGATED; Root CA -> EE",
-              "D3.ors", "WKIC_D3_Issuer_Root.pem", "", 1);
+              "ND1.ors", "WKIC_ND1_Issuer_ICA.pem", "", 1, 0);
+    test_ocsp("NON-DELEGATED; Root CA -> Intermediate CA",
+              "ND2.ors", "WKIC_ND2_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("NON-DELEGATED; Root CA -> EE",
+              "ND3.ors", "WKIC_ND3_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Intermediate CA -> EE",
+              "D1.ors", "WKIC_D1_Issuer_ICA.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
+              "D2.ors", "WKIC_D2_Issuer_Root.pem", "", 1, 0);
+    test_ocsp("DELEGATED; Root CA -> EE",
+              "D3.ors", "WKIC_D3_Issuer_Root.pem", "", 1, 0);
 };
 
@@ -200,15 +208,15 @@
     # Expect success, because we're explicitly trusting the issuer certificate.
     test_ocsp("NON-DELEGATED; Intermediate CA -> EE",
-              "ND1.ors", "ISIC_ND1_Issuer_ICA.pem", "", 0);
-    test_ocsp("NON-DELEGATED; Root CA -> Intermediate CA",
-              "ND2.ors", "ISIC_ND2_Issuer_Root.pem", "", 0);
-    test_ocsp("NON-DELEGATED; Root CA -> EE",
-              "ND3.ors", "ISIC_ND3_Issuer_Root.pem", "", 0);
-    test_ocsp("DELEGATED; Intermediate CA -> EE",
-              "D1.ors", "ISIC_D1_Issuer_ICA.pem", "", 0);
-    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
-              "D2.ors", "ISIC_D2_Issuer_Root.pem", "", 0);
-    test_ocsp("DELEGATED; Root CA -> EE",
-              "D3.ors", "ISIC_D3_Issuer_Root.pem", "", 0);
+              "ND1.ors", "ISIC_ND1_Issuer_ICA.pem", "", 0, 0);
+    test_ocsp("NON-DELEGATED; Root CA -> Intermediate CA",
+              "ND2.ors", "ISIC_ND2_Issuer_Root.pem", "", 0, 0);
+    test_ocsp("NON-DELEGATED; Root CA -> EE",
+              "ND3.ors", "ISIC_ND3_Issuer_Root.pem", "", 0, 0);
+    test_ocsp("DELEGATED; Intermediate CA -> EE",
+              "D1.ors", "ISIC_D1_Issuer_ICA.pem", "", 0, 0);
+    test_ocsp("DELEGATED; Root CA -> Intermediate CA",
+              "D2.ors", "ISIC_D2_Issuer_Root.pem", "", 0, 0);
+    test_ocsp("DELEGATED; Root CA -> EE",
+              "D3.ors", "ISIC_D3_Issuer_Root.pem", "", 0, 0);
 };
 
Index: /trunk/src/libs/openssl-3.0.3/test/recipes/90-test_sslapi.t
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/recipes/90-test_sslapi.t	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/recipes/90-test_sslapi.t	(revision 95219)
@@ -1,4 +1,4 @@
 #! /usr/bin/env perl
-# Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
 #
 # Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -33,5 +33,9 @@
              srctop_file("test", "recipes", "90-test_sslapi_data",
                          "passwd.txt"), $tmpfilename, "default",
-             srctop_file("test", "default.cnf")])),
+             srctop_file("test", "default.cnf"),
+             srctop_file("test",
+                         "recipes",
+                         "90-test_sslapi_data",
+                         "dhparams.pem")])),
              "running sslapitest");
 
@@ -40,5 +44,9 @@
                  srctop_file("test", "recipes", "90-test_sslapi_data",
                              "passwd.txt"), $tmpfilename, "fips",
-                 srctop_file("test", "fips-and-base.cnf")])),
+                 srctop_file("test", "fips-and-base.cnf"),
+                 srctop_file("test",
+                             "recipes",
+                             "90-test_sslapi_data",
+                             "dhparams.pem")])),
                  "running sslapitest");
 }
Index: /trunk/src/libs/openssl-3.0.3/test/siphash_internal_test.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/siphash_internal_test.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/siphash_internal_test.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -263,6 +263,8 @@
     /* Use invalid hash size */
     return TEST_int_eq(SipHash_set_hash_size(&siphash, 4), 0)
+           && TEST_false(SipHash_Final(&siphash, output, 0))
            /* Use hash size = 8 */
            && TEST_true(SipHash_set_hash_size(&siphash, 8))
+           && TEST_false(SipHash_Final(&siphash, output, 8))
            && TEST_true(SipHash_Init(&siphash, key, 0, 0))
            && TEST_true(SipHash_Final(&siphash, output, 8))
Index: /trunk/src/libs/openssl-3.0.3/test/ssl_old_test.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/ssl_old_test.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/ssl_old_test.c	(revision 95219)
@@ -217,5 +217,5 @@
     if (servername) {
         if (s_ctx2 != NULL && sn_server2 != NULL &&
-            !strcasecmp(servername, sn_server2)) {
+            !OPENSSL_strcasecmp(servername, sn_server2)) {
             BIO_printf(bio_stdout, "Switching server context.\n");
             SSL_set_SSL_CTX(s, s_ctx2);
Index: /trunk/src/libs/openssl-3.0.3/test/sslapitest.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/sslapitest.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/sslapitest.c	(revision 95219)
@@ -95,4 +95,5 @@
 static char *srpvfile = NULL;
 static char *tmpfilename = NULL;
+static char *dhfile = NULL;
 
 static int is_fips = 0;
@@ -9385,4 +9386,66 @@
     return testresult;
 }
+
+/*
+ * Test that the lifetime hint of a TLSv1.3 ticket is no more than 1 week
+ * 0 = TLSv1.2
+ * 1 = TLSv1.3
+ */
+static int test_ticket_lifetime(int idx)
+{
+    SSL_CTX *cctx = NULL, *sctx = NULL;
+    SSL *clientssl = NULL, *serverssl = NULL;
+    int testresult = 0;
+    int version = TLS1_3_VERSION;
+
+#define ONE_WEEK_SEC (7 * 24 * 60 * 60)
+#define TWO_WEEK_SEC (2 * ONE_WEEK_SEC)
+
+    if (idx == 0) {
+#ifdef OPENSSL_NO_TLS1_2
+        return TEST_skip("TLS 1.2 is disabled.");
+#else
+        version = TLS1_2_VERSION;
+#endif
+    }
+
+    if (!TEST_true(create_ssl_ctx_pair(libctx, TLS_server_method(),
+                                       TLS_client_method(), version, version,
+                                       &sctx, &cctx, cert, privkey)))
+        goto end;
+
+    if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl,
+                                      &clientssl, NULL, NULL)))
+        goto end;
+
+    /*
+     * Set the timeout to be more than 1 week
+     * make sure the returned value is the default
+     */
+    if (!TEST_long_eq(SSL_CTX_set_timeout(sctx, TWO_WEEK_SEC),
+                      SSL_get_default_timeout(serverssl)))
+        goto end;
+
+    if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)))
+        goto end;
+
+    if (idx == 0) {
+        /* TLSv1.2 uses the set value */
+        if (!TEST_ulong_eq(SSL_SESSION_get_ticket_lifetime_hint(SSL_get_session(clientssl)), TWO_WEEK_SEC))
+            goto end;
+    } else {
+        /* TLSv1.3 uses the limited value */
+        if (!TEST_ulong_le(SSL_SESSION_get_ticket_lifetime_hint(SSL_get_session(clientssl)), ONE_WEEK_SEC))
+            goto end;
+    }
+    testresult = 1;
+
+end:
+    SSL_free(serverssl);
+    SSL_free(clientssl);
+    SSL_CTX_free(sctx);
+    SSL_CTX_free(cctx);
+    return testresult;
+}
 #endif
 /*
@@ -9458,4 +9521,170 @@
 }
 
+/*
+ * Test SSL_CTX_set1_verify/chain_cert_store and SSL_CTX_get_verify/chain_cert_store.
+ */
+static int test_set_verify_cert_store_ssl_ctx(void)
+{
+   SSL_CTX *ctx = NULL;
+   int testresult = 0;
+   X509_STORE *store = NULL, *new_store = NULL,
+              *cstore = NULL, *new_cstore = NULL;
+
+   /* Create an initial SSL_CTX. */
+   ctx = SSL_CTX_new_ex(libctx, NULL, TLS_server_method());
+   if (!TEST_ptr(ctx))
+       goto end;
+
+   /* Retrieve verify store pointer. */
+   if (!TEST_true(SSL_CTX_get0_verify_cert_store(ctx, &store)))
+       goto end;
+
+   /* Retrieve chain store pointer. */
+   if (!TEST_true(SSL_CTX_get0_chain_cert_store(ctx, &cstore)))
+       goto end;
+
+   /* We haven't set any yet, so this should be NULL. */
+   if (!TEST_ptr_null(store) || !TEST_ptr_null(cstore))
+       goto end;
+
+   /* Create stores. We use separate stores so pointers are different. */
+   new_store = X509_STORE_new();
+   if (!TEST_ptr(new_store))
+       goto end;
+
+   new_cstore = X509_STORE_new();
+   if (!TEST_ptr(new_cstore))
+       goto end;
+
+   /* Set stores. */
+   if (!TEST_true(SSL_CTX_set1_verify_cert_store(ctx, new_store)))
+       goto end;
+
+   if (!TEST_true(SSL_CTX_set1_chain_cert_store(ctx, new_cstore)))
+       goto end;
+
+   /* Should be able to retrieve the same pointer. */
+   if (!TEST_true(SSL_CTX_get0_verify_cert_store(ctx, &store)))
+       goto end;
+
+   if (!TEST_true(SSL_CTX_get0_chain_cert_store(ctx, &cstore)))
+       goto end;
+
+   if (!TEST_ptr_eq(store, new_store) || !TEST_ptr_eq(cstore, new_cstore))
+       goto end;
+
+   /* Should be able to unset again. */
+   if (!TEST_true(SSL_CTX_set1_verify_cert_store(ctx, NULL)))
+       goto end;
+
+   if (!TEST_true(SSL_CTX_set1_chain_cert_store(ctx, NULL)))
+       goto end;
+
+   /* Should now be NULL. */
+   if (!TEST_true(SSL_CTX_get0_verify_cert_store(ctx, &store)))
+       goto end;
+
+   if (!TEST_true(SSL_CTX_get0_chain_cert_store(ctx, &cstore)))
+       goto end;
+
+   if (!TEST_ptr_null(store) || !TEST_ptr_null(cstore))
+       goto end;
+
+   testresult = 1;
+
+end:
+   X509_STORE_free(new_store);
+   X509_STORE_free(new_cstore);
+   SSL_CTX_free(ctx);
+   return testresult;
+}
+
+/*
+ * Test SSL_set1_verify/chain_cert_store and SSL_get_verify/chain_cert_store.
+ */
+static int test_set_verify_cert_store_ssl(void)
+{
+   SSL_CTX *ctx = NULL;
+   SSL *ssl = NULL;
+   int testresult = 0;
+   X509_STORE *store = NULL, *new_store = NULL,
+              *cstore = NULL, *new_cstore = NULL;
+
+   /* Create an initial SSL_CTX. */
+   ctx = SSL_CTX_new_ex(libctx, NULL, TLS_server_method());
+   if (!TEST_ptr(ctx))
+       goto end;
+
+   /* Create an SSL object. */
+   ssl = SSL_new(ctx);
+   if (!TEST_ptr(ssl))
+       goto end;
+
+   /* Retrieve verify store pointer. */
+   if (!TEST_true(SSL_get0_verify_cert_store(ssl, &store)))
+       goto end;
+
+   /* Retrieve chain store pointer. */
+   if (!TEST_true(SSL_get0_chain_cert_store(ssl, &cstore)))
+       goto end;
+
+   /* We haven't set any yet, so this should be NULL. */
+   if (!TEST_ptr_null(store) || !TEST_ptr_null(cstore))
+       goto end;
+
+   /* Create stores. We use separate stores so pointers are different. */
+   new_store = X509_STORE_new();
+   if (!TEST_ptr(new_store))
+       goto end;
+
+   new_cstore = X509_STORE_new();
+   if (!TEST_ptr(new_cstore))
+       goto end;
+
+   /* Set stores. */
+   if (!TEST_true(SSL_set1_verify_cert_store(ssl, new_store)))
+       goto end;
+
+   if (!TEST_true(SSL_set1_chain_cert_store(ssl, new_cstore)))
+       goto end;
+
+   /* Should be able to retrieve the same pointer. */
+   if (!TEST_true(SSL_get0_verify_cert_store(ssl, &store)))
+       goto end;
+
+   if (!TEST_true(SSL_get0_chain_cert_store(ssl, &cstore)))
+       goto end;
+
+   if (!TEST_ptr_eq(store, new_store) || !TEST_ptr_eq(cstore, new_cstore))
+       goto end;
+
+   /* Should be able to unset again. */
+   if (!TEST_true(SSL_set1_verify_cert_store(ssl, NULL)))
+       goto end;
+
+   if (!TEST_true(SSL_set1_chain_cert_store(ssl, NULL)))
+       goto end;
+
+   /* Should now be NULL. */
+   if (!TEST_true(SSL_get0_verify_cert_store(ssl, &store)))
+       goto end;
+
+   if (!TEST_true(SSL_get0_chain_cert_store(ssl, &cstore)))
+       goto end;
+
+   if (!TEST_ptr_null(store) || !TEST_ptr_null(cstore))
+       goto end;
+
+   testresult = 1;
+
+end:
+   X509_STORE_free(new_store);
+   X509_STORE_free(new_cstore);
+   SSL_free(ssl);
+   SSL_CTX_free(ctx);
+   return testresult;
+}
+
+
 static int test_inherit_verify_param(void)
 {
@@ -9499,5 +9728,40 @@
 }
 
-OPT_TEST_DECLARE_USAGE("certfile privkeyfile srpvfile tmpfile provider config\n")
+static int test_load_dhfile(void)
+{
+#ifndef OPENSSL_NO_DH
+    int testresult = 0;
+
+    SSL_CTX *ctx = NULL;
+    SSL_CONF_CTX *cctx = NULL;
+
+    if (dhfile == NULL)
+        return 1;
+
+    if (!TEST_ptr(ctx = SSL_CTX_new_ex(libctx, NULL, TLS_client_method()))
+        || !TEST_ptr(cctx = SSL_CONF_CTX_new()))
+        goto end;
+
+    SSL_CONF_CTX_set_ssl_ctx(cctx, ctx);
+    SSL_CONF_CTX_set_flags(cctx,
+                           SSL_CONF_FLAG_CERTIFICATE
+                           | SSL_CONF_FLAG_SERVER
+                           | SSL_CONF_FLAG_FILE);
+
+    if (!TEST_int_eq(SSL_CONF_cmd(cctx, "DHParameters", dhfile), 2))
+        goto end;
+
+    testresult = 1;
+end:
+    SSL_CONF_CTX_free(cctx);
+    SSL_CTX_free(ctx);
+
+    return testresult;
+#else
+    return TEST_skip("DH not supported by this build");
+#endif
+}
+
+OPT_TEST_DECLARE_USAGE("certfile privkeyfile srpvfile tmpfile provider config dhfile\n")
 
 int setup_tests(void)
@@ -9529,5 +9793,6 @@
             || !TEST_ptr(tmpfilename = test_get_argument(2))
             || !TEST_ptr(modulename = test_get_argument(3))
-            || !TEST_ptr(configfile = test_get_argument(4)))
+            || !TEST_ptr(configfile = test_get_argument(4))
+            || !TEST_ptr(dhfile = test_get_argument(5)))
         return 0;
 
@@ -9755,8 +10020,12 @@
 #ifndef OSSL_NO_USABLE_TLS1_3
     ADD_TEST(test_sni_tls13);
+    ADD_ALL_TESTS(test_ticket_lifetime, 2);
 #endif
     ADD_TEST(test_inherit_verify_param);
     ADD_TEST(test_set_alpn);
+    ADD_TEST(test_set_verify_cert_store_ssl_ctx);
+    ADD_TEST(test_set_verify_cert_store_ssl);
     ADD_ALL_TESTS(test_session_timeout, 1);
+    ADD_TEST(test_load_dhfile);
     return 1;
 
Index: /trunk/src/libs/openssl-3.0.3/test/v3nametest.c
===================================================================
--- /trunk/src/libs/openssl-3.0.3/test/v3nametest.c	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/test/v3nametest.c	(revision 95219)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2012-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2012-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -15,8 +15,4 @@
 #include "internal/nelem.h"
 #include "testutil.h"
-
-#ifdef OPENSSL_SYS_WINDOWS
-# define strcasecmp _stricmp
-#endif
 
 static const char *const names[] = {
@@ -288,5 +284,5 @@
 
     for (; *pname != NULL; ++pname) {
-        int samename = strcasecmp(nameincert, *pname) == 0;
+        int samename = OPENSSL_strcasecmp(nameincert, *pname) == 0;
         size_t namelen = strlen(*pname);
         char *name = OPENSSL_malloc(namelen + 1);
Index: /trunk/src/libs/openssl-3.0.3/tools/c_rehash.in
===================================================================
--- /trunk/src/libs/openssl-3.0.3/tools/c_rehash.in	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/tools/c_rehash.in	(revision 95219)
@@ -2,5 +2,5 @@
 {- use OpenSSL::Util; -}
 # {- join("\n# ", @autowarntext) -}
-# Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 1999-2022 The OpenSSL Project Authors. All Rights Reserved.
 #
 # Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -153,4 +153,21 @@
 }
 
+sub compute_hash {
+    my $fh;
+    if ( $^O eq "VMS" ) {
+        # VMS uses the open through shell
+        # The file names are safe there and list form is unsupported
+        if (!open($fh, "-|", join(' ', @_))) {
+            print STDERR "Cannot compute hash on '$fname'\n";
+            return;
+        }
+    } else {
+        if (!open($fh, "-|", @_)) {
+            print STDERR "Cannot compute hash on '$fname'\n";
+            return;
+        }
+    }
+    return (<$fh>, <$fh>);
+}
 
 # Link a certificate to its subject name hash value, each hash is of
@@ -162,8 +179,10 @@
 sub link_hash_cert {
     my $fname = $_[0];
-    $fname =~ s/\"/\\\"/g;
-    my ($hash, $fprint) = `"$openssl" x509 $x509hash -fingerprint -noout -in "$fname"`;
+    my ($hash, $fprint) = compute_hash($openssl, "x509", $x509hash,
+                                       "-fingerprint", "-noout",
+                                       "-in", $fname);
     chomp $hash;
     chomp $fprint;
+    return if !$hash;
     $fprint =~ s/^.*=//;
     $fprint =~ tr/://d;
@@ -203,8 +222,10 @@
 sub link_hash_crl {
     my $fname = $_[0];
-    $fname =~ s/'/'\\''/g;
-    my ($hash, $fprint) = `"$openssl" crl $crlhash -fingerprint -noout -in '$fname'`;
+    my ($hash, $fprint) = compute_hash($openssl, "crl", $crlhash,
+                                       "-fingerprint", "-noout",
+                                       "-in", $fname);
     chomp $hash;
     chomp $fprint;
+    return if !$hash;
     $fprint =~ s/^.*=//;
     $fprint =~ tr/://d;
Index: /trunk/src/libs/openssl-3.0.3/util/libcrypto.num
===================================================================
--- /trunk/src/libs/openssl-3.0.3/util/libcrypto.num	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/util/libcrypto.num	(revision 95219)
@@ -5426,2 +5426,4 @@
 EVP_PKEY_get0_provider                  5554	3_0_0	EXIST::FUNCTION:
 EVP_PKEY_CTX_get0_provider              5555	3_0_0	EXIST::FUNCTION:
+OPENSSL_strcasecmp                      5556	3_0_3	EXIST::FUNCTION:
+OPENSSL_strncasecmp                     5557	3_0_3	EXIST::FUNCTION:
Index: /trunk/src/libs/openssl-3.0.3/util/markdownlint.rb
===================================================================
--- /trunk/src/libs/openssl-3.0.3/util/markdownlint.rb	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/util/markdownlint.rb	(revision 95219)
@@ -6,6 +6,7 @@
 # Use --- and === for H1 and H2.
 rule 'MD003', :style => :setext_with_atx
-# Code blocks are indented
-rule 'MD046', :style => :indented
+# Code blocks may be fenced or indented, both are OK...
+# but they must be consistent throughout each file.
+rule 'MD046', :style => :consistent
 
 # Bug in mdl, https://github.com/markdownlint/markdownlint/issues/313
Index: /trunk/src/libs/openssl-3.0.3/util/missingssl.txt
===================================================================
--- /trunk/src/libs/openssl-3.0.3/util/missingssl.txt	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/util/missingssl.txt	(revision 95219)
@@ -10,10 +10,7 @@
 SSL_CTX_get0_ctlog_store(3)
 SSL_CTX_get0_privatekey(3)
-SSL_CTX_get_ssl_method(3)
 SSL_CTX_set0_ctlog_store(3)
 SSL_CTX_set_client_cert_engine(3)
 SSL_CTX_set_not_resumable_session_callback(3)
-SSL_CTX_set_purpose(3)
-SSL_CTX_set_trust(3)
 SSL_SRP_CTX_free(3)
 SSL_SRP_CTX_init(3)
@@ -30,9 +27,7 @@
 SSL_set_debug(3)
 SSL_set_not_resumable_session_callback(3)
-SSL_set_purpose(3)
 SSL_set_session_secret_cb(3)
 SSL_set_session_ticket_ext(3)
 SSL_set_session_ticket_ext_cb(3)
-SSL_set_trust(3)
 SSL_srp_server_param_with_username(3)
 SSL_test_functions(3)
Index: /trunk/src/libs/openssl-3.0.3/util/other.syms
===================================================================
--- /trunk/src/libs/openssl-3.0.3/util/other.syms	(revision 95218)
+++ /trunk/src/libs/openssl-3.0.3/util/other.syms	(revision 95219)
@@ -460,4 +460,6 @@
 SSL_CTX_generate_session_ticket_fn      define
 SSL_CTX_get0_chain_certs                define
+SSL_CTX_get0_chain_cert_store           define
+SSL_CTX_get0_verify_cert_store          define
 SSL_CTX_get_default_read_ahead          define
 SSL_CTX_get_extra_chain_certs           define
@@ -532,4 +534,6 @@
 SSL_get0_chain_certs                    define
 SSL_get0_session                        define
+SSL_get0_chain_cert_store               define
+SSL_get0_verify_cert_store              define
 SSL_get1_curves                         define
 SSL_get1_groups                         define
