summaryrefslogtreecommitdiffstats
path: root/crypto (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add missing EVP_CTRL_CCM_SET_L controlShane Lontis2021-05-281-0/+6
| | | | | Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15416)
* Fix PKCS12_create() so that a fetch error is not added to the error stack.Shane Lontis2021-05-281-0/+2
| | | | | | | | | | | | | Fixes #15392 PBE algorithms such as NID_pbe_WithSHA1And3_Key_TripleDES_CBC will currently always fail to the EVP_CIPHER_fetch() call, so the fallback to a legacy algorithm always happens. In this case the error stack should ignore the fetch error. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15473)
* Fix memory leak in OSSL_CMP_CTXPetr Gotthard2021-05-282-1/+2
| | | | | | | | The ctx->propq is strdup'ed, so it must be free'd too. Reviewed-by: Ben Kaduk <kaduk@mit.edu> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15458)
* Rework and make DEBUG macros consistent.Rich Salz2021-05-2814-39/+44
| | | | | | | | | | | | | | | | | | | | Remove unused -DCONF_DEBUG and -DBN_CTX_DEBUG. Rename REF_PRINT to REF_DEBUG for consistency, and add a new tracing category and use it for printing reference counts. Rename -DDEBUG_UNUSED to -DUNUSED_RESULT_DEBUG Fix BN_DEBUG_RAND so it compiles and, when set, force DEBUG_RAND to be set also. Rename engine_debug_ref to be ENGINE_REF_PRINT also for consistency. Fixes #15357 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15353)
* Initialise OPENSSL_armcap_P to 0 before setting it based on capabilities, ↵Tom Cosgrove2021-05-281-2/+2
| | | | | | | | | | | not after Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15486)
* coverity 1484912: Null pointer dereferences (NULL_RETURNS)Pauli2021-05-271-0/+3
| | | | | Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15425)
* coverity 1484913: Null pointer dereferences (REVERSE_INULL)Pauli2021-05-271-3/+8
| | | | | Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15425)
* errors: update error message (to be squashed)Pauli2021-05-272-1/+5
| | | | | | Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15472)
* rsa: check that the RNG is capable of producing a key of the specified sizePauli2021-05-271-0/+22
| | | | | | | | | | | During key generation, any sized key can be asked for. Attempting to generate a key with a security strength larger than the RNG strength now fails. Fixes #15421 Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15472)
* rsa: remove the limit on the maximum key strengthPauli2021-05-271-3/+1
| | | | | | Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15472)
* Use "" for include crypto/xxxRich Salz2021-05-272-2/+2
| | | | | | Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15468)
* Use "" for include internal/xxxRich Salz2021-05-273-3/+3
| | | | | | Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15468)
* Use <> for #include openssl/xxxRich Salz2021-05-279-11/+9
| | | | | | Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15468)
* rsa: rename global rsaz_ sumbols so they are in namespacePauli2021-05-274-85/+85
| | | | | | | | | | | | | | The symbols renamed are: RSAZ_amm52x20_x1_256 RSAZ_amm52x20_x2_256 rsaz_avx512ifma_eligible RSAZ_mod_exp_avx512_x2 Additionally, RSAZ_exp52x20_x2_256 was made static Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/15445)
* aes: rename new bsaes_ symbols -> ossl_bsaes_ onesPauli2021-05-273-36/+36
| | | | | | | | | | bsaes_cbc_encrypt -> ossl_bsaes_cbc_encrypt bsaes_ctr32_encrypt_blocks -> ossl_bsaes_ctr32_encrypt_blocks bsaes_xts_decrypt -> ossl_bsaes_xts_decrypt bsaes_xts_encrypt -> ossl_bsaes_xts_encrypt Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/15445)
* bn: rename extract_multiplier_2x20_win5 -> ossl_extract_multiplier_2x20_win5Pauli2021-05-272-22/+28
| | | | | Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/15445)
* bn: rename bn_check_prime_int -> ossl_bn_check_primtPauli2021-05-273-9/+9
| | | | | Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/15445)
* Deprecate old style BIO callback callsTomas Mraz2021-05-265-49/+104
| | | | | | | | New style BIO_debug_callback_ex() function added to provide replacement for BIO_debug_callback(). Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15440)
* OSSL_DECODER_from_bio: Report an unsupported error when there is noneTomas Mraz2021-05-261-2/+3
| | | | | | | | | | When nothing was decoded and there is no error on the stack report something. Fixes #15442 Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15441)
* Fix possible infinite loop in pem_read_bio_key_decoder()Tomas Mraz2021-05-261-1/+8
| | | | | | | | | There could be an infinite loop if no read happened. Fixes #15426 Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15441)
* rsa: special case the strengths of RSA with 7680 and 15360 bitsPauli2021-05-261-8/+32
| | | | | | | | | | | | | Also cap the strengths for values under these two because the formula overestimates around them. The formula NIST gives doesn't match the table also presented in IG 7.5 Partial fix for #15421 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Kurt Roeckx <kurt@roeckx.be> (Merged from https://github.com/openssl/openssl/pull/15428)
* Fix buffer overflow when generating large RSA keys in FIPS mode.Shane Lontis2021-05-261-2/+7
| | | | | | | | | | | | | | | | | | A pairwise test runs only in FIPS mode. An assumption about the size of the 'to' buffer passed to RSA_private_decrypt() was incorrect. It needs to be up to RSA_size() bytes long - so a fixed buffer of 256 bytes was not large enough. An exiting malloc has increased in size to allocate buffer space for both the encrypt and decrypt buffer. The existing test used 2080 bits which was not quite large enough to trigger the issue. A test using 3072 bits has been added. Reported by Mark Powers from Acumen. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15447)
* err: rename err_load_xxx_strings_int functionsPauli2021-05-2640-81/+81
| | | | | | | | The new names are ossl_err_load_xxx_strings. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15446)
* mac: add a getter for the MAC block size.Pauli2021-05-251-2/+12
| | | | | | | | Fixes #12342 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15427)
* Remove engine_table_select_intRich Salz2021-05-2511-15/+22
| | | | | | | | Add missing file/line args and call it engine_table_select Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15419)
* Fix warning in gf_serializeJuergen Christ2021-05-241-1/+1
| | | | | | | | | | | | | | | | | | | Compiling under -Werror fails in gf_serialize: crypto/ec/curve448/f_generic.c:21:27: error: argument 1 of type 'uint8_t[56]' {aka 'unsigned char[56]'} with mismatched bound [-Werror=array-parameter=] 21 | void gf_serialize(uint8_t serial[SER_BYTES], const gf x, int with_hibit) | ~~~~~~~~^~~~~~~~~~~~~~~~~ In file included from crypto/ec/curve448/f_generic.c:12: crypto/ec/curve448/field.h:65:28: note: previously declared as 'uint8_t *' {aka 'unsigned char *'} void gf_serialize(uint8_t *serial, const gf x, int with_highbit); ~~~~~~~~~^~~~~~ Changed parameter to pointer to fix this warning. Signed-off-by: Juergen Christ <jchrist@linux.ibm.com> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15376)
* Don't try the same decoder multiple timesMatt Caswell2021-05-241-26/+42
| | | | | | | | | | | | | The function collect_decoder decides whether a given decoder should be tried or not. It loops through all the names for matching keymgmts to see if any are a match or not. If there is a match then the decoder gets added. However, each keymgmt may have multiple aliases and a decoder was being added for each one. For example DHX has 4 alias names, and therefore 4 instances of the DHX decoder were added and being tried. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15404)
* Added PKCS5_PBE_keyivgen_ex() to allow PBKDF1 algorithms to be fetched for a ↵Jon Spillett2021-05-242-21/+36
| | | | | | | | specific library context Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14326)
* Add PBKDF1 to the legacy providerJon Spillett2021-05-241-44/+34
| | | | | | Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14326)
* Remove some perl 5.14 use from rsaz-avx512.plMatt Caswell2021-05-241-2/+4
| | | | | | | | | | | | The non-destructive substitution syntax (s///r), was introduced in perl 5.14. We need to support 5.10 and above. Fixes #15378 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15379)
* Rename the field 'provctx and data' to 'algctx' inside some objects containingShane Lontis2021-05-2417-275/+291
| | | | | | | | | | | | | | | | | | | pointers to provider size algorithm contexts. Fixes #14284 The gettable_ctx_params methods were confusingly passing a 'provctx' and a provider context which are completely different objects. Some objects such as EVP_KDF used 'data' while others such as EVP_MD used 'provctx'. For libcrypto this 'ctx' is an opaque ptr returned when a providers algorithm implementation creates an internal context using a new_ctx() method. Hence the new name 'algctx'. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15275)
* Fix a memleak in the FIPS providerMatt Caswell2021-05-242-7/+13
| | | | | | | | | | | | | | | | If the DRBG is used within the scope of the FIPS OSSL_provider_init function then it attempts to register a thread callback via c_thread_start. However the implementation of c_thread_start assumed that the provider's provctx was already present. However because OSSL_provider_init is still running it was actually NULL. This means the thread callback fail to work correctly and a memory leak resulted. Instead of having c_thread_start use the provctx as the callback argument we change the definition of c_thread_start to have an explicit callback argument to use. Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15278)
* core: condition out more in FIPS buildsPauli2021-05-241-0/+4
| | | | | Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15278)
* property: convert integers to strings properly.Pauli2021-05-221-3/+7
| | | | | | | | | | The int64_t type was converted to int (truncation). Negative values were not handled at all. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15396)
* Properly restore XMM registers in ChaCha20's AVX-512(VL) assemblyJean-Philippe Boivin2021-05-211-10/+42
| | | | | | Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15315)
* pem_read_bio_key_legacy: Do not obscure real error if there is oneTomas Mraz2021-05-211-1/+2
| | | | | | | | Fixes #15170 Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15355)
* Update copyright yearMatt Caswell2021-05-2016-16/+16
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15381)
* EVP: Modify EVP_PKEY_export() to handle legacy EVP_PKEYsRichard Levitte2021-05-201-0/+35
| | | | | | | | | | | | | We use a fake EVP_KEYMGMT import function with the newly modified EVP_PKEY_ASN1_METHOD export_to function to pass the exported OSSL_PARAM array directly to the EVP_PKEY_export() callback instead of exporting to an actual provided key and then getting the OSSL_PARAM array from there, just to throw away that key again. Fixes #15290 Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15293)
* Modify EVP_PKEY_ASN1_METHOD's export_to function to take an importerRichard Levitte2021-05-206-21/+23
| | | | | | | | | | | We previously took an EVP_KEYMGMT pointer, but now found it necessary to use a different import function in some cases. Since that's the only thing we use from EVP_KEYMGMT, we might as well pass the import function directly, allowing for some flexibility in how export_to is used. Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15293)
* Update documentation for global properties mirroringMatt Caswell2021-05-201-4/+4
| | | | | Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15242)
* Ensure mirroring of properties works for subsequent updatesMatt Caswell2021-05-204-17/+62
| | | | | | | | | If the global properties are updated after a provider with a child libctx has already started we need to make sure those updates are mirrored in that child. Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15242)
* Add a callback for providers to know about global properties changesMatt Caswell2021-05-203-2/+88
| | | | | | | | Where a child libctx is in use it needs to know what the current global properties are. Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15242)
* Implement the ability to convert a PROPERTY_LIST to a stringMatt Caswell2021-05-204-2/+186
| | | | | | | | We have the ability to parse a string into a PROPERTY_LIST already. Now we have the ability to go the other way. Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15242)
* todo: remove TODO(3.0) from the sources.Pauli2021-05-207-29/+0
| | | | | | | | | | Almost all were notes about wanting to deprecate CTRLs/utility functions. Fixes #15325 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/15328)
* Revert "ARM assembly pack: translate bit-sliced AES implementation to AArch64"Pauli2021-05-202-2341/+2
| | | | | | | | | This reverts commit da51566b256e0c0536d5b986e676863b0526bf5e. Fixes #15321 Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15364)
* X509_STORE_CTX_get1_issuer(): Simplify code, reducing risk of failureDr. David von Oheimb2021-05-191-6/+3
| | | | | Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14422)
* X509 build_chain(): Fix two potential memory leaks on issuer variableDr. David von Oheimb2021-05-191-6/+8
| | | | | | | This also removes an inadequate guard: if (num == ctx->num_untrusted) Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14422)
* X509 build_chain(): Make the variable 'curr' local to the loop bodyDr. David von Oheimb2021-05-191-9/+4
| | | | | | | This increases readability and maintainability. Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14422)
* X509 build_chain(): Rename variable 'depth' to 'max_depth'Dr. David von Oheimb2021-05-191-7/+7
| | | | | | | This should increase readability and maintainability. Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14422)
* X509 build_chain(): Restrict scope of 'self_signed' variableDr. David von Oheimb2021-05-191-10/+9
| | | | | | | This should increase readability and maintainability. Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14422)