summaryrefslogtreecommitdiffstats
path: root/crypto
AgeCommit message (Collapse)Author
2023-09-11Bad function definitionDimitri Papadopoulos
void f() should probably be void f(void) Found by running the checkpatch.pl Linux script to enforce coding style. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21468)
2023-09-11"foo * bar" should be "foo *bar"Dimitri Papadopoulos
Found by running the checkpatch.pl Linux script to enforce coding style. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21468)
2023-09-11Remove repeated wordsDimitri Papadopoulos
Found by running the checkpatch.pl Linux script to enforce coding style. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21468)
2023-09-11Fix a build failure where recvmmsg is available but not sendmmsgMatt Caswell
Some old glibc versions have recvmmsg but not sendmmsg. We require both to use that functionality. Introduce a test to check we have a sufficiently recent version of glibc. Fixes #22021 Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> (Merged from https://github.com/openssl/openssl/pull/22036)
2023-09-11LoongArch64 assembly pack: add ChaCha20 modulesMin Zhou
This assembly implementation for ChaCha20 includes three code paths: scalar path, 128-bit LSX path and 256-bit LASX path. We prefer the LASX path or LSX path if the hardware and system support these extensions. There are 32 vector registers avaialable in the LSX and LASX extensions. So, we can load the 16 initial states and the 16 intermediate states of ChaCha into the 32 vector registers for calculating in the implementation. The test results on the 3A5000 and 3A6000 show that this assembly implementation significantly improves the performance of ChaCha20 on LoongArch based machines. The detailed test results are as following. Test with: $ openssl speed -evp chacha20 3A5000 type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes C code 178484.53k 282789.93k 311793.70k 322234.99k 324405.93k 324659.88k assembly code 223152.28k 407863.65k 989520.55k 2049192.96k 2127248.70k 2131749.55k +25% +44% +217% +536% +556% +557% 3A6000 type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes C code 214945.33k 310041.75k 340724.22k 349949.27k 352925.01k 353140.74k assembly code 299151.34k 492766.34k 2070166.02k 4300909.91k 4473978.88k 4499084.63k +39% +59% +508% +1129% +1168% +1174% Signed-off-by: Min Zhou <zhoumin@loongson.cn> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21998)
2023-09-08Fix a possible memleak in SRP_VBASE_newBernd Edlinger
In the error handling case the memory in vb->users_pwd was accidentally not released. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21981)
2023-09-08OSSL_STORE: Fix error flag clearing and setting (provider path only)Richard Levitte
When the provider's load function returned with an error, the libcrypto error flag was only set if EOF hadn't been reached. This is troublesome, as an error can very well occur during the last load before EOF is reached! Also, the error flag was never reset, even though documentation specifies that it should indicate an error in the last load (i.e. not the one before that). Fixes #21968 Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21976)
2023-09-08Check error return from cms_sd_asn1_ctrl() correctly.Pauli
Fixes #21986 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/21988)
2023-09-07Copyright year updatesMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org> Release: yes
2023-09-06win32: Support condition variable broadcasting on XPHugo Landau
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21827)
2023-09-05CMP: generalize ossl_cmp_calc_protection() to handle Edwards curves correctlyDr. David von Oheimb
Fixes #21564 Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21884)
2023-09-05Fix internal memory leaks from OPENSSL_MALLOC_FAILURESBernd Edlinger
There is a rarely used feature that can be enabled with `./config enable-crypto-mdebug` when additionally the environment variable OPENSSL_MALLOC_FAILURES is used. It turns out to be possible that CRYPTO_zalloc may create a leak when the memory is allocated and then the shouldfail happens, then the memory is lost. Likewise when OPENSSL_realloc is used with size=0, then the memory is to be free'd but here the shouldfail check is too early, and the failure may prevent the memory to be freed thus creating a bogus memory leak. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21944)
2023-09-05OSSL_PARAM_BLD_push_BN_pad(): Allow NULL BIGNUMTomas Mraz
This was supported previously and regressed with commit 17898ec6011cc583c5af69ca8f25f5d165ff3e6a Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21945)
2023-09-05MUTEX: Assert on locking failureHugo Landau
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21919)
2023-09-05Use armv8 .quad instead of .dwordKai Pastor
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21939)
2023-09-04Change PBES2 KDF default salt length to 16 bytes.slontis
The PKCS5 (RFC 8018) standard uses a 64 bit salt length for PBE, and recommends a minimum of 64 bits for PBES2. For FIPS compliance PBKDF2 requires a salt length of 128 bits. This affects OpenSSL command line applications such as "genrsa" and "pkcs8" and API's such as PEM_write_bio_PrivateKey() that are reliant on the default salt length. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21858)
2023-09-04Move ALIGN32 and ALIGN64 into common.h, and fix for clang-cl.exeTom Cosgrove
clang-cl.exe defines __clang__ and _MSC_VER but not __GNUC__, so a clang- specific guard is needed to get the correct ALIGNxx versions. Fixes #21914 Change-Id: Icdc047b182ad1ba61c7b1b06a1e951eda1a0c33d Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21921)
2023-09-02Avoid clobbering non-volatile XMM registersBernd Edlinger
This affects some Poly1305 assembler functions which are only used for certain CPU types. Remove those functions for Windows targets, as a simple interim solution. Fixes #21522 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21808)
2023-09-01Minor fixesHugo Landau
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21715)
2023-09-01Minor updatesHugo Landau
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21715)
2023-09-01BIO_s_dgram_pair: Correct implementation of BIO_CTRL_DGRAM_GET_LOCAL_ADDR_ENABLEHugo Landau
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21715)
2023-09-01BIO_s_datagram: Wire capability negotiation for BIO_s_datagramHugo Landau
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21715)
2023-09-01BIO: Add BIO_dgram_detect_peer_addr APIHugo Landau
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21715)
2023-09-01BIO_s_datagram: Support configuring non-blocking modeHugo Landau
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21715)
2023-09-01BIO_s_connect: Support configuration of non-blocking mode in datagram modeHugo Landau
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21715)
2023-09-01BIO_s_connect: Add support for datagram modeHugo Landau
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21715)
2023-09-01BIO_s_connect: Make internal functions staticHugo Landau
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21715)
2023-09-01Remove a redundant point mul from ossl_ec_key_public_check()Matt Caswell
This code was added in error and is entirely redundant. It is also an expensive operation (e.g. see #21833). Fixes #21834 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@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/21902)
2023-09-01powerpc: ecc: Fix stack allocation secp384r1 asmRohan McLure
Assembly acceleration secp384r1 opts to not use any callee-save VSRs, as VSX enabled systems make extensive use of renaming, and so writebacks in felem_{mul,square}() can be reordered for best cache effects. Remove stack allocations. This in turn fixes unmatched push/pops in felem_{mul,square}(). Signed-off-by: Rohan McLure <rohan.mclure@linux.ibm.com> Reviewed-by: Tomas Mraz <tomas@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/21749)
2023-09-01ecc: Remove extraneous parentheses in secp384r1Rohan McLure
Substitutions in the felem_reduce() method feature unecessary parentheses, remove them. Signed-off-by: Rohan McLure <rohan.mclure@linux.ibm.com> Reviewed-by: Tomas Mraz <tomas@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/21749)
2023-08-31OPENSSL_init_crypto load config into initial global default library contextIngo Franzki
OPENSSL_init_crypto() with OPENSSL_INIT_LOAD_CONFIG must load the configuration into the initial global default library context, not the currently set default library context. OPENSSL_init_crypto() with OPENSSL_INIT_LOAD_CONFIG may be called within other OpenSSL API functions, e.g. from within EVP_PKEY_CTX_new_xxx() when initializing a pkey context, to perform implicit initialization, if it has not been initialized yet. This implicit initialization may happen at a time when an application has already create its own library context and made it the default library context. So loading the config into the current default library context would load it into the applications library context. Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21897)
2023-08-31ecp_sm2p256-armv8.pl: Copy the argument handling from ecp_nistz256-armv8.plTomas Mraz
Popping the $output argument is more robust and it also needs to be placed in double quotes to handle spaces in paths. Fixes #21874 Fixes #21876 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> (Merged from https://github.com/openssl/openssl/pull/21877)
2023-08-30OSSL_PROVIDER_load_exDmitry Belyavskiy
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21604)
2023-08-30Correct the fixed size handling for dgram_pair and dgram_memTomas Mraz
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21866)
2023-08-30make updateHugo Landau
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21815)
2023-08-30QUIC APL: Implement backpressure on stream creationHugo Landau
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21815)
2023-08-28Resolve assembler complains when including loongarch_arch.hMin Zhou
The assembler will complain when we include loongarch_arch.h in an assembly file as following: crypto/loongarch_arch.h: Assembler messages: crypto/loongarch_arch.h:12: Fatal error: no match insn: extern unsigned int OPENSSL_loongarch_hwcap_P So, the sentence of `extern unsigned int OPENSSL_loongarch_hwcap_P` should be guarded with "#ifndef __ASSEMBLER__". Fixes #21838. Signed-off-by: Min Zhou <zhoumin@loongson.cn> Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21839)
2023-08-25QUIC APL: Fix stream backpressure conditions to use non-I/O errorsHugo Landau
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21811)
2023-08-25QUIC APL: Implement backpressure on stream creationHugo Landau
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21811)
2023-08-25Changed the default value of the "ess_cert_id_alg" optionolszomal
This is used to calculate the TSA's public key certificate identifier. The default algorithm is changed from sha1 to sha256. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21794)
2023-08-24Allow RSA-PSS also in EVP_PKEY_assign() and EVP_PKEY_can_sign()Ingo Franzki
Treat keys with EVP_PKEY_RSA_PSS the same as EVP_PKEY_RSA in EVP_PKEY_can_sign() and detect_foreign_key() which is called by EVP_PKEY_assign(). Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21819)
2023-08-24ctrl_params_translate: Allow get_rsa_payload_x() also for RSA-PSSIngo Franzki
The get_rsa_payload_x() functions should also allow to get the payload for RSA-PSS keys. Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21818)
2023-08-24ctrl_params_translate: Allow RSA controls also for RSA-PSSIngo Franzki
Controls 'rsa_keygen_pubexp' and 'rsa_keygen_primes' should also be allowed for RSA-PSS keys. Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21818)
2023-08-24Optimize SM2 on aarch64Xu Yizhou
Signed-off-by: Xu Yizhou <xuyizhou1@huawei.com> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20754)
2023-08-23QUIC: Add ERR_raise() calls for EVP call failuresTomas Mraz
This improves tracking where the failure was triggered. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21700)
2023-08-23Fix a leak in ossl_encode_ctx_setup_for_pkeyMatt Caswell
Make sure we free the stack of names we allocated in an error path. Found by the reproducible error patch in #21668 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/21796)
2023-08-18ossl_x509_store_ctx_get_by_subject(): Check return value of X509_STORE_lock()Tomas Mraz
Fixes Coverity 1539148 Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21755)
2023-08-18cmp_genm.c: Remove superfluous store_ctx != 0 checkTomas Mraz
This really cannot be ever called with NULL store_ctx and the check confuses Coverity. Fixes Coverity 1538865 Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21755)
2023-08-18Add two missing entries to the OCSP CRLReason tableRob Stradling
CLA: trivial Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21743)
2023-08-17Add X509_STORE_CTX_set_get_crl and X509_STORE_CTX_set_current_reasonsvl-loz
This change is for feature request #21679. Adds a couple of setters to aid with custom CRL validation. Reviewed-by: Todd Short <todd.short@me.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21737)