summaryrefslogtreecommitdiffstats
path: root/crypto
AgeCommit message (Collapse)Author
2023-12-04After initializing a provider, check if its output dispatch table is NULLRichard Levitte
If the provider's output dispatch table is NULL, trying to parse it causes a crash. Let's not do that. Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Todd Short <todd.short@me.com> (Merged from https://github.com/openssl/openssl/pull/22866)
2023-12-04Fix loading more than one certificate in PEM format in X509_load_cert_file_ex()olszomal
Fixes #22895 Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22885)
2023-12-01Add locking to CRYPTO_secure_usedNeil Horman
Coverity issue 1551719 noted CRYPTO_secure_used referenced a shared variable without taking the appropriate read lock. Add that. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Todd Short <todd.short@me.com> (Merged from https://github.com/openssl/openssl/pull/22802)
2023-12-01Fix a possible use after free in X509v3_asid_add_id_or_rangeBernd Edlinger
And clean up partially created choice objects, which have still the default type = -1 from ASIdentifierChoice_new(). Fixes #22700 Reviewed-by: Todd Short <todd.short@me.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22745)
2023-11-30bn_nist: Fix strict-aliasing violations in little-endian optimizationsXi Ruoyao
The little-endian optimization is doing some type-punning in a way violating the C standard aliasing rule by loading or storing through a lvalue with type "unsigned int" but the memory location has effective type "unsigned long" or "unsigned long long" (BN_ULONG). Convert these accesses to use memcpy instead, as memcpy is defined as-is "accessing through the lvalues with type char" and char is aliasing with all types. GCC does a good job to optimize away the temporary copies introduced with the change. Ideally copying to a temporary unsigned int array, doing the calculation, and then copying back to `r_d` will make the code look better, but unfortunately GCC would fail to optimize away this temporary array then. I've not touched the LE optimization in BN_nist_mod_224 because it's guarded by BN_BITS2!=64, then BN_BITS2 must be 32 and BN_ULONG must be unsigned int, thus there is no aliasing issue in BN_nist_mod_224. Fixes #12247. Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22816)
2023-11-29Optimize AES-CTR for ARM Neoverse V1 and V2.fisher.yu
Unroll AES-CTR loops to a maximum 12 blocks for ARM Neoverse V1 and V2, to fully utilize their AES pipeline resources. Improvement on ARM Neoverse V1. Package Size(Bytes) 16 32 64 128 256 1024 Improvement(%) 3.93 -0.45 11.30 4.31 12.48 37.66 Package Size(Bytes) 1500 8192 16384 61440 65536 Improvement(%) 37.16 38.90 39.89 40.55 40.41 Change-Id: Ifb8fad9af22476259b9ba75132bc3d8010a7fdbd Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22733)
2023-11-24x86_64-xlate.pl: Fix build with icx and nvc compilersTomas Mraz
Fixes #22594 Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22714)
2023-11-23SHA3_squeeze(): The next argument is intTomas Mraz
Amend the assembler so it uses only 32bit value. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22750)
2023-11-23keccak1600-armv4.pl: Further fix for the DigestSqueeze() supportTomas Mraz
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22750)
2023-11-22Fix possible memleak in PKCS7_add0_attrib_signing_timeBernd Edlinger
When PKCS7_add_signed_attribute fails, the ASN1_TIME object may be leaked when it was not passed in as input parameter. Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22772)
2023-11-22Fix a possible memleak in CMS_sign_receiptBernd Edlinger
When an error happens after cms_encode_Receipt the ASN1_OCTET_STRING object "os" may be leaked. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22758)
2023-11-22Fix a possible memleak in PKCS7_add_attrib_smimecapBernd Edlinger
When PKCS7_add_signed_attribute fails, the ASN1_STRING object may be leaked. Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22744)
2023-11-15Fix SHA3_squeeze on armv4.slontis
For armv4 - Only the first 4 parameters can be passed via registers (r0..r3). As all of the general registers are already used, r11 was used to store the 'next' param. R11 is now pushed/poped on entry/exit. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22719)
2023-11-15ppc64: Fix SHA3_squeezeRohan McLure
Fix the conditional on the 'next' parameter passed into SHA3_squeeze. Reported-by: David Benjamin <davidben@davidben.net> Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22722)
2023-11-14Enable AES and SHA3 optimisations on Apple Silicon M3-based macOS systemsTom Cosgrove
AES gets a performance enhancement of 19-36%, similar to the M1 and M2. SHA3 gets an improvement of 4-7% on buffers 256 bytes or larger. Tested on an M3 Pro, but the CPU cores are the same on M3 and M3 Max. Change-Id: I2bf40bbde824823bb8cf2efd1bd945da9f23a703 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22685)
2023-11-14Force Nonstop to use fcntl(F_GETFL) in BIO_sock_nbioNeil Horman
In tracking down a hang, we found that nonstop platforms were falling into the if #ifdef FIONBIO clause in the implementation of BIO_sock_nbio. While the platform defines this macro, sockets set with this continued to operate in blocking mode. Given that the platform also support O_NONBLOCK, adjust the ifdef to have the nonstop platform use that method to ensure that sockets enter blocking mode Related-To #22588 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22696)
2023-11-10Support multiple calls of low level SHA3_squeeze() for s390x.Holger Dengler
The low level SHA3_Squeeze() function needed to change slightly so that it can handle multiple squeezes. Support this on s390x architecture as well. Signed-off-by: Holger Dengler <dengler@linux.ibm.com> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Todd Short <todd.short@me.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22221)
2023-11-10Add EVP_DigestSqueeze() API.slontis
Fixes #7894 This allows SHAKE to squeeze multiple times with different output sizes. The existing EVP_DigestFinalXOF() API has been left as a one shot operation. A similar interface is used by another toolkit. The low level SHA3_Squeeze() function needed to change slightly so that it can handle multiple squeezes. This involves changing the assembler code so that it passes a boolean to indicate whether the Keccak function should be called on entry. At the provider level, the squeeze is buffered, so that it only requests a multiple of the blocksize when SHA3_Squeeze() is called. On the first call the value is zero, on subsequent calls the value passed is 1. This PR is derived from the excellent work done by @nmathewson in https://github.com/openssl/openssl/pull/7921 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21511)
2023-11-06Make DH_check_pub_key() and DH_generate_key() safer yetRichard Levitte
We already check for an excessively large P in DH_generate_key(), but not in DH_check_pub_key(), and none of them check for an excessively large Q. This change adds all the missing excessive size checks of P and Q. It's to be noted that behaviours surrounding excessively sized P and Q differ. DH_check() raises an error on the excessively sized P, but only sets a flag for the excessively sized Q. This behaviour is mimicked in DH_check_pub_key(). Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22453)
2023-11-03internal/common.h: rename macro `(un)likely` to `ossl_(un)likely`Matthias St. Pierre
The macro was introduced in commit ed6dfd1e3694 without an openssl-specific prefix as mandated by the coding style. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> (Merged from https://github.com/openssl/openssl/pull/22603)
2023-11-03rand uniform: fix likely usagePauli
@mspncp noted that the condition should have been likely not unlikely. Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22593)
2023-11-03Add additional internal HPKE hardening checks resulting from code audit.Stephen Farrell
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22493)
2023-11-01Correct comment in crypto/ec/curve448/ed448.hChristian Schmidt
Obvious Copy&Paste&not edit error. CLA: trivial Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22573)
2023-11-01rand uniform: add comments outlining the algorithmPauli
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22499)
2023-11-01rand: implement an unbiased random integer from a rangePauli
Refer: https://github.com/apple/swift/pull/39143 for a description of the algorithm. It is optimal in the sense of having: * no divisions * minimal number of blocks of random bits from the generator Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22499)
2023-10-30free oaep label-octet-string on errorJames Muir
When successful, ossl_X509_ALGOR_from_nid() returns a pointer to an X509_ALGOR object. Inside ossl_X509_ALGOR_from_nid(), X509_ALGOR_set0() is called, and this passes ownership of the ASN1 object "los" (label octet string) to the X509_ALGOR object. When ossl_X509_ALGOR_from_nid() fails, ownership has not been passed on and we need to free "los". Change the scope of "los" and ensure it is freed on failure (on success, set it to NULL so it is not freed inside the function). Fixes #22336 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22495)
2023-10-26EVP_PKEY_get_{bits,security_bits,size}(): add missing error queue entry on ↵Dr. David von Oheimb
failure Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22459)
2023-10-26CMS and PKCS7: fix handlling of EVP_PKEY_get_size() failureDr. David von Oheimb
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22459)
2023-10-26riscv: Provide vector crypto implementation of AES-ECB mode.Phoebe Chen
This patch provides stream and multi-block implementations for AES-128-ECB, AES-192-ECB, and AES-256-ECB to accelerate AES-ECB. Also, refactor functions to share the same variable declaration in aes-riscv64-zvkned.pl. Signed-off-by: Phoebe Chen <phoebe.chen@sifive.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26riscv: Support sm3 on platforms with vlen >= 128.Jerry Shih
This patch updates the OSSSL_HWSM3_block_data_order_zvksh and enables SM3 on platforms with VLEN >= 128. Signed-off-by: Jerry Shih <jerry.shih@sifive.com> Signed-off-by: Phoebe Chen <phoebe.chen@sifive.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26riscv: Provide vector crypto implementation of AES-128/256-XTS mode.Jerry Shih
To accelerate the performance of the AES-XTS mode, in this patch, we have the specialized multi-block implementation for AES-128-XTS and AES-256-XTS. Signed-off-by: Jerry Shih <jerry.shih@sifive.com> Signed-off-by: Phoebe Chen <phoebe.chen@sifive.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26Provide additional AES-GCM test patterns to enhance test coverage.Phoebe Chen
To enhance test coverage for AES-GCM mode, we provided longer additional testing patterns for AES-GCM testing. Signed-off-by: Phoebe Chen <phoebe.chen@sifive.com> Signed-off-by: Jerry Shih <jerry.shih@sifive.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26riscv: Provide vector crypto implementation of AES-GCM mode.Jerry Shih
To accelerate the performance of the AES-GCM mode, in this patch, we have the specialized multi-block implementations for AES-128-GCM, AES-192-GCM and AES-256-GCM. Signed-off-by: Phoebe Chen <phoebe.chen@sifive.com> Signed-off-by: Jerry Shih <jerry.shih@sifive.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26riscv: Provide vector crypto implementation of AES-CTR mode.Phoebe Chen
Support zvbb-zvkned based rvv AES-128/192/256-CTR encryption. Signed-off-by: Phoebe Chen <phoebe.chen@sifive.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26riscv: Support SHA-512 family on platforms with vlen >= 128.Phoebe Chen
This patch supports SHA-512, SHA-512/224, SHA-512/256 on platforms with vlen greater than 128, Signed-off-by: Phoebe Chen <phoebe.chen@sifive.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26riscv: Code optimization for SHA-256.Phoebe Chen
Keep SHA-256 constant values in registers to save the loading time. Move the constant loading for sha256 into a separate subroutine. By creating a dedicated sub routine for loading sha256 constants, the code can be made more modular and easier to modify in the future. Relaxing the SHA256 constraint, zvknhb also supports SHA256. Simplify the H and mask initialization flows. Signed-off-by: Phoebe Chen <phoebe.chen@sifive.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26riscv: Provide a vector implementation of CHACHA20 cipher.Jerry Shih
Use rvv and zvbb extensions for CHACHA20 cipher. Signed-off-by: Jerry Shih <jerry.shih@sifive.com> Signed-off-by: Phoebe Chen <phoebe.chen@sifive.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26riscv: Provide vector crypto implementation of AES-CBC mode.Phoebe Chen
To accelerate the performance of the AES-128/192/256-CBC block cipher encryption, we used the vaesz, vaesem and vaesef instructions, which implement a single round of AES encryption. Similarly, to optimize the performance of AES-128/192/256-CBC block cipher decryption, we have utilized the vaesz, vaesdm, and vaesdf instructions, which facilitate a single round of AES decryption. Furthermore, we optimize the key and initialization vector (IV) step by keeping the rounding key in vector registers. Signed-off-by: Phoebe Chen <phoebe.chen@sifive.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26Update for Zvkb extension.Jerry Shih
https://github.com/riscv/riscv-crypto/blob/c8ddeb7e64a3444dda0438316af1238aeed72041/doc/vector/riscv-crypto-vector-zvkb.adoc Create `RISCV_HAS_ZVKB()` macro. Use zvkb for SM4 instead of zvbb. Use zvkb for ghash instead of zvbb. We could just use the zvbb's subset `zvkb` for flexibility. Signed-off-by: Jerry Shih <jerry.shih@sifive.com> Signed-off-by: Phoebe Chen <phoebe.chen@sifive.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26riscv: Further optimization for single block aes-zvkned decryption.Phoebe Chen
Interleave key loading and aes decrypt computing for single block aes. Signed-off-by: Phoebe Chen <phoebe.chen@sifive.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26riscv: Further optimization for single block aes-zvkned encryption.Phoebe Chen
Interleave key loading and aes encrypt computing for single block aes. Signed-off-by: Phoebe Chen <phoebe.chen@sifive.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26riscv: Add RISC-V Vector opcode in riscv.pmPhoebe Chen
Added helper functions and opcode encoding functions in riscv.pm perl module to avoid pointless code duplication. Signed-off-by: Phoebe Chen <phoebe.chen@sifive.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26Fix typo in ghash-riscv64*.plPhoebe Chen
Changed "mutiple" to "multiple" for improved clarity and correctness. Signed-off-by: Phoebe Chen <phoebe.chen@sifive.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26riscv: Implement AES-192Ard Biesheuvel
Even though the RISC-V vector instructions only support AES-128 and AES-256 for key generation, the round instructions themselves can easily be used to implement AES-192 too - we just need to fallback to the generic key generation routines in this case. Note that the vector instructions use the encryption key schedule (but in reverse order) so we need to generate the encryption key schedule even when doing decryption using the vector instructions. Signed-off-by: Ard Biesheuvel <ardb@google.com> Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26riscv: SM3: Provide a Zvksh-based implementationCharalampos Mitrodimas
The upcoming RISC-V vector crypto extensions feature a Zvksh extension, that provides SM3-specific istructions. This patch provides an implementation that utilizes this extension if available. Tested on QEMU and no regressions observed. Signed-off-by: Charalampos Mitrodimas <charalampos.mitrodimas@vrull.eu> Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26riscv: SM4: Provide a Zvksed-based implementationChristoph Müllner
The upcoming RISC-V vector crypto extensions feature a Zvksed extension, that provides SM4-specific instructions. This patch provides an implementation that utilizes this extension if available. Tested on QEMU and no regressions observed. Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26riscv: sha512: Provide a Zvknhb-based implementationCharalampos Mitrodimas
The upcoming RISC-V vector crypto extensions feature a Zvknhb extension, that provides sha512-specific istructions. This patch provides an implementation that utilizes this extension if available. Tested on QEMU and no regressions observed. Signed-off-by: Charalampos Mitrodimas <charalampos.mitrodimas@vrull.eu> Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26crypto: sha512: Add mechanism to keep C code as fallback for SHA512_ASMCharalampos Mitrodimas
Currently, architectures have to decide if they want the C code or an arch-specific implementation. Let's add a macro, that allows to keep the C code even if SHA512_ASM is defined (but rename it from sha512_block_data_order to sha512_block_data_order_c). The macro INCLUDE_C_SHA512 can be used by architectures, that want the C code as fallback code. Signed-off-by: Charalampos Mitrodimas <charalampos.mitrodimas@vrull.eu> Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26riscv: sha256: Provide a Zvknha-based implementationCharalampos Mitrodimas
The upcoming RISC-V vector crypto extensions feature a Zvknha extension, that provides sha256-specific instructions. This patch provides an implementation that utilizes this extension if available. Tested on QEMU and no regressions observed. Signed-off-by: Charalampos Mitrodimas <charalampos.mitrodimas@vrull.eu> Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)
2023-10-26crypto: sha256: Add mechanism to keep C code as fallback for SHA256_ASMCharalampos Mitrodimas
Currently, architectures have to decide if they want the C code or an arch-specific implementation. Let's add a macro, that allows to keep the C code even if SHA256_ASM is defined (but rename it from sha256_block_data_order to sha256_block_data_order_c). The macro INCLUDE_C_SHA256 can be used by architectures, that want the C code as fallback code. Signed-off-by: Charalampos Mitrodimas <charalampos.mitrodimas@vrull.eu> Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21923)