summaryrefslogtreecommitdiffstats
path: root/test/endecode_test.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Copyright year updatesTomas Mraz2024-09-051-1/+1
| | | | | Reviewed-by: Neil Horman <nhorman@openssl.org> Release: yes
* endecode_test.c: Fix !fips v3.0.0 checkPauli2024-08-301-3/+1
| | | | | | | | | | | | The fips_provider_version_* functions return true if the FIPS provider isn't loaded. This is somewhat counterintuitive and the fix in #25327 neglected this nuance resulting in not running the SM2 tests when the FIPS provider wasn't being loaded. Reviewed-by: Viktor Dukhovni <viktor@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/25331)
* endecode_test.c: Avoid running the SM2 tests with 3.0.0 FIPS providerTomas Mraz2024-08-291-1/+4
| | | | | | | | Fixes #25326 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Neil Horman <nhorman@openssl.org> (Merged from https://github.com/openssl/openssl/pull/25327)
* Fix decoder error on SM2 private keyJamie Cui2024-08-291-0/+13
| | | | | | | | Added sm2 testcases to endecode_test.c. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/25266)
* Copyright year updatesMatt Caswell2023-09-071-1/+1
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> Release: yes
* endecode_test.c: Add tests for decoding with 0 selectionTomas Mraz2023-08-041-2/+14
| | | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Todd Short <todd.short@me.com> (Merged from https://github.com/openssl/openssl/pull/21519)
* With fips provider 3.0.0 skip tests related to explicit curves handlingTomas Mraz2022-09-161-1/+7
| | | | | | | Reviewed-by: Matt Caswell <matt@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/19201)
* Update copyright yearMatt Caswell2022-05-031-1/+1
| | | | | Reviewed-by: Tomas Mraz <tomas@openssl.org> Release: yes
* endecode_test: Handle expected failures for non-fips ec keysTomas Mraz2022-04-141-35/+49
| | | | | | Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17998)
* Statically link the legacy provider to endecode_testMatt Caswell2022-01-111-0/+14
| | | | | | | | | | | | We already statically link libcrypto to endecode_test even in a "shared" build. This can cause problems on some platforms with tests that load the legacy provider which is dynamically linked to libcrypto. Two versions of libcrypto are then linked to the same executable which can lead to crashes. Fixes #17059 Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17345)
* Adjust test/endecoder_test.cRichard Levitte2021-09-051-2/+2
| | | | | | | | The protected tests need to specify the structure EncryptedPrivateKeyInfo rather than PrivateKeyInfo, since that's the outermost structure. Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16466)
* Decoding PKCS#8: separate decoding of encrypted and unencrypted PKCS#8Richard Levitte2021-06-091-4/+6
| | | | | | | | | | | | | | | | | | | This has us switch from the 'structure' "pkcs8" to "PrivateKeyInfo", which is sensible considering we already have "SubjectPublicKeyInfo". We also add "EncryptedPrivateKeyInfo", and use it for a special decoder that detects and decrypts an EncryptedPrivateKeyInfo structured DER blob into a PrivateKeyInfo structured DER blob and passes that on to the next decoder implementation. The result of this change is that PKCS#8 decryption should only happen once per decoding instead of once for every expected key type. Furthermore, this new decoder implementation sets the data type to the OID of the algorithmIdentifier field, thus reducing how many decoder implementations are tentativaly run further down the call chain. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15498)
* Enhance the encoder/decoder tests to allow testing with a non-default ↵Jon Spillett2021-06-011-38/+128
| | | | | | | | | library context and configurable providers 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/14587)
* TEST: Prefer using precomputed RSA and DH keys for more efficient testsDr. David von Oheimb2021-05-271-13/+21
| | | | | | Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13715)
* Add convenience functions and macros for asymmetric key generationDr. David von Oheimb2021-05-111-1/+1
| | | | | | | | | Add EVP_PKEY_gen(), EVP_PKEY_Q_gen(), EVP_RSA_gen(), and EVP_EC_gen(). Also export auxiliary function OSSL_EC_curve_nid2name() and improve deprecation info on RSA and EC key generation/management functions. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14695)
* Rename EVP_PKEY_get0_first_alg_name to EVP_PKEY_get0_type_nameTomas Mraz2021-04-151-1/+1
| | | | | | | | | | | | | | | We use type elsewhere and documenting the 'first' in the name of the call is a little bit superfluous making the name too mouthful. Also rename EVP_PKEY_typenames_do_all to EVP_PKEY_type_names_do_all to keep the words separated by underscore. Fixes #14701 Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14868)
* Replace OSSL_PARAM_BLD_free_params() with OSSL_PARAM_free().Shane Lontis2021-04-121-4/+4
| | | | | Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14785)
* EVP_PKCS82PKEY: Create provided keys if possibleTomas Mraz2021-03-251-0/+2
| | | | | | | | | | | Use OSSL_DECODER to decode the PKCS8 data to create provided keys. If that fails fallback to the legacy implementation. Fixes #14302 Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14659)
* endecode_test: Add file and line arguments to test callbacksJon Spillett2021-03-231-104/+133
| | | | | | | | | | | To improve debug information in case of test failures source file and line arguments are added to test callbacks. Fixes #14331 Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14567)
* TEST: Modify test/endecode_test.c to give the decoder callback the structureRichard Levitte2021-03-191-6/+9
| | | | | Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14314)
* Update copyright yearMatt Caswell2021-02-181-1/+1
| | | | | Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14235)
* Rename OSSL_ENCODER_CTX_new_by_EVP_PKEY and OSSL_DECODER_CTX_new_by_EVP_PKEYTomas Mraz2021-02-171-10/+10
| | | | | | | | | | Additional renames done in encoder and decoder implementation to follow the style. Fixes #13622 Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14155)
* TEST: Fix test/endecode_test.c for 'no-legacy'Richard Levitte2020-12-191-19/+30
| | | | | | | | | This adds an additional check that the legacy provider is available when wanting to add tests for protected PVK, since that depends on the availability of RC4. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13705)
* Add necessary checks of OPENSSL_NO_DH, OPENSSL_NO_DSA and OPENSSL_NO_ECRichard Levitte2020-12-161-5/+7
| | | | | | | | | When OpenSSL is configured with 'no-dh', 'no-dsa' and 'no-ec' combined, some static functions have no use, which the compiler may complain about. We therefore add extra guards to silence it. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13589)
* Remove unnecessary guards around MSBLOB and PVK readers and writersRichard Levitte2020-12-131-34/+19
| | | | | | | | The OPENSSL_NO_RC4 guard remain around protected PVK tests in test/endecoder_test.c. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13648)
* endecode_test.c: Fix build errors on OPENSSL_NO_{DH,DSA,EC,EC2M}Dr. David von Oheimb2020-12-041-2/+8
| | | | | Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13110)
* Adapt everything else to the updated OSSL_ENCODER_CTX_new_by_EVP_PKEY()Richard Levitte2020-12-021-1/+1
| | | | | Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13545)
* endecode_test.c: Add warning that 512-bit DH key size is for testing onlyDr. David von Oheimb2020-12-011-1/+4
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13568)
* test cleanup: move helper .c and .h files to test/helpers/Dr. David von Oheimb2020-12-011-1/+1
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13568)
* endecode_test.c: Significant speedup in generating DH and DHX keysDr. David von Oheimb2020-11-291-3/+16
| | | | | | | Fixes #13495 Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13552)
* test/endecode_test.c: Update to specify output structuresRichard Levitte2020-11-111-82/+65
| | | | | Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13167)
* TEST: Adapt test/endecoder_test.cRichard Levitte2020-11-111-0/+2
| | | | | Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13248)
* Unexport internal MSBLOB and PVK functionsRichard Levitte2020-10-211-1/+1
| | | | | | | | | | | | | | | | The following internal functions are affected: ossl_do_blob_header ossl_do_PVK_header ossl_b2i ossl_b2i_bio This is reflected by moving include/internal/pem.h to include/crypto/pem.h engines/e_loader_attic gets the source code added to it to have continued access to those functions. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13195)
* Add a test for encoding and decoding of parameters filesMatt Caswell2020-10-081-32/+167
| | | | | Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13050)
* DECODER: Allow precise result type for OSSL_DECODER_CTX_new_by_EVP_PKEY()Richard Levitte2020-10-041-1/+1
| | | | | | | | | | | | | | There is some data that is very difficult to guess. For example, DSA parameters and X9.42 DH parameters look exactly the same, a SEQUENCE of 3 INTEGER. Therefore, callers may need the possibility to select the exact keytype that they expect to get. This will also allow use to translate d2i_TYPEPrivateKey(), d2i_TYPEPublicKey() and d2i_TYPEParams() into OSSL_DECODER terms much more smoothly. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13061)
* TEST: Adapt applicable tests to the changed OSSL_ENCODER_CTX_new_by_EVP_PKEY()Richard Levitte2020-09-201-88/+168
| | | | | | | | | | This adds the convenience function EVP_PKEY_typenames_do_all(), which does the same as EVP_KEYMGMT_names_do_all(), but without having to expose all the internal ways to find out if the internal EVP_PKEY key is legacy or provider-native. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/12873)
* TEST: modify test/endecode_test.c to not use legacy keysRichard Levitte2020-09-081-142/+79
| | | | | | | | | Now that PEM_write_bio_PrivateKey_traditional() can handle provider-native EVP_PKEYs, we don't need to use explicitly legacy ones. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/12738)
* TEST: Adapt some tests for a stricter PEM_write_bio_PrivateKey_traditional()Richard Levitte2020-08-281-12/+54
| | | | | | | - test/endecode_test.c Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/12728)
* Add Explicit EC parameter support to providers.Shane Lontis2020-08-221-1/+263
| | | | | | | | | | This was added for backward compatability. Added EC_GROUP_new_from_params() that supports explicit curve parameters. This fixes the 15-test_genec.t TODO. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12604)
* Rename OSSL_SERIALIZER / OSSL_DESERIALIZER to OSSL_ENCODE / OSSL_DECODERichard Levitte2020-08-211-0/+875
Fixes #12455 Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/12660)