summaryrefslogtreecommitdiffstats
path: root/test/evp_test.c
AgeCommit message (Collapse)Author
2019-09-12Modernise the ERR functionality further (new functions and deprecations)Richard Levitte
ERR_func_error_string() essentially returns NULL, and since all function codes are now removed for all intents and purposes, this function has fallen out of use and cannot be modified to suit the data, since its only function is to interpret an error code. To compensate for the loss of error code, we instead provide new functions that extracts the function name strings from an error record: - ERR_get_error_func() - ERR_peek_error_func() - ERR_peek_last_error_func() Similarly, the once all encompasing functions ERR_peek_last_error_line_data(), ERR_peek_error_line_data() and ERR_get_error_line_data() lack the capability of getting the function name string, so we deprecate those and add these functions to replace them: - ERR_get_error_all() - ERR_peek_error_all() - ERR_peek_last_error_all() Finally, we adjust a few lines of code that used the now deprecated functions. Fixes #9756 Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9756)
2019-09-12test/evp_test.c: try fetching algorithmsRichard Levitte
Instead of relying on implicit fetches, try explicit fetches when available. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9121)
2019-09-12Fix test error if scrypt is disabledPaul Yang
Fix no-scrypt. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9840)
2019-09-11Coverity 1453632 & 1453635: Null pointer dereferences (FORWARD_NULL)Pauli
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/9805)
2019-09-11Coverity 1414465: Resource leaks (RESOURCE_LEAK)Pauli
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/9805)
2019-09-06Test updates in light of the KDF switchoverPauli
Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9662)
2019-09-04OSSL_PARAM_construct_utf8_string computes the string length.Pauli
If the passed string length is zero, the function computes the string length from the passed string. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9760)
2019-08-27Coverty fixes for MACsRichard Levitte
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9700)
2019-08-24Get rid of the diversity of names for MAC parametersRichard Levitte
The EVP_PKEY MAC implementations had a diversity of controls that were really the same thing. We did reproduce that for the provider based MACs, but are changing our minds on this. Instead of that, we now use one parameter name for passing the name of the underlying ciphers or digests to a MAC implementation, "cipher" and "digest", and one parameter name for passing the output size of the MAC, "size". Then we leave it to the EVP_PKEY->EVP_MAC bridge to translate "md" to "digest", and "digestsize" to "size". Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9667)
2019-08-23test/evp_test.c: distinguish parsing errors from processing errorsRichard Levitte
Parsing functions are at liberty to return: 1: when parsing on processing of the parsed value succeeded 0: when the parsed keyword is unknown -1: when the parsed value processing failed Some parsing functions didn't do this quite right, they returned 0 when they should have returned -1, causing a message like this: Line 123: unknown keyword PeerKey When this message (which is displayed when the parsing function returns -1) would have been more appropriate: Line 123: error processing keyword PeerKey = ffdhe2048-2-pub Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/9682)
2019-08-18Test for out-of-bounds write when requesting zero bytes from shakePatrick Steuer
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9433)
2019-08-15Adapt the MAC tests, and tests for other things that use EVP_MACRichard Levitte
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/8877)
2019-08-01Properly process the "Availablein" keyword for evp_testMatt Caswell
The "Availablein" keyword is supposed to indicate which providers are required in evp_test in order for a particular test to pass. Unfortunately this didn't work. If the provider was available then the test failed. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9492)
2019-07-26test/evp_test.c: modify to use OSSL_PROVIDER_available()Richard Levitte
This changes the stanza format used so far. Some test stanza had the following line, only possible for digests: Legacy = 1 These have been traded for the following: Availablein = legacy That line is globally available in all test stanza and can be used to tell what providers a certain algorithm may be available in. Only one provider needs to match, so one might have something like this for some tests: Availablein = default fips This means that one of those providers must be available for the test stanza to be performed. If the providers mentioned for a stanza aren't available, the test is skipped. If this line isn't used in a stanza, the algorithm is assumed to be available unconditionally (either by fallback providers, or providers loaded by the config file). Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9398)
2019-07-16Remove function name from errorsRich Salz
Deprecate all xxx_F_ defines. Removed some places that tested for a specific function. Use empty field for the function names in output. Update documentation. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9058)
2019-07-11test/evp_test.c: [ciphers] Test that we get back the same IV we gaveRichard Levitte
Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9328)
2019-07-09Add X9.42 KDF.Shane Lontis
Move the KDF code for CMS DH key agreement into an EVP_KDF object. There are 2 specifications for X9.42 KDF. This implementation uses DER for otherinfo which embeds the KDF loop counter inside the DER object. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/8898)
2019-07-01Fix a leak in evp_testMatt Caswell
If evp_test fails to load the legacy provider then it leaks a reference to the default provider. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9270)
2019-06-04Move digests to providersShane Lontis
Move digest code into the relevant providers (fips, default, legacy). The headers are temporarily moved to be internal, and will be moved into providers after all external references are resolved. The deprecated digest code can not be removed until EVP_PKEY (signing) is supported by providers. EVP_MD data can also not yet be cleaned up for the same reasons. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/8763)
2019-05-08Allow specifying the tag after AAD in CCM modeTobias Nießen
This change allows to pass the authentication tag after specifying the AAD in CCM mode. This is already true for the other two supported AEAD modes (GCM and OCB) and it seems appropriate to match the behavior. GCM and OCB also support to set the tag at any point before the call to `EVP_*Final`, but this won't work for CCM due to a restriction imposed by section 2.6 of RFC3610: The tag must be set before actually decrypting data. This commit also adds a test case for setting the tag after supplying plaintext length and AAD. Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7243)
2019-05-03Added EVP_KDF (similiar to the EVP_MAC)Shane Lontis
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/8808)
2019-04-26Copy RSA-PSS saltlen in EVP_PKEY_CTX_dup.David Benjamin
pkey_rsa_copy was missing a field. Test this by repeating the operation through an EVP_PKEY_CTX_dup copy in evp_test. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/8759)
2019-02-13Added new EVP/KDF API.David Makepeace
Changed PKEY/KDF API to call the new API. Added wrappers for PKCS5_PBKDF2_HMAC() and EVP_PBE_scrypt() to call the new EVP KDF APIs. Documentation updated. Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6674)
2019-02-11Updated test command line parsing to support commmon commandsShane Lontis
Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6975)
2019-02-06blake2: add evpmac test vectorsAntoine Salon
Signed-off-by: Antoine Salon <asalon@vmware.com> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7726)
2019-01-08Fix CID 1434549: Unchecked return value in test/evp_test.cFdaSilvaYY
5. check_return: Calling EVP_EncodeUpdate without checking return value (as is done elsewhere 4 out of 5 times). Fix CID 1371695, 1371698: Resource leak in test/evp_test.c - leaked_storage: Variable edata going out of scope leaks the storage it points to. - leaked_storage: Variable encode_ctx going out of scope leaks the storage it points to Fix CID 1430437, 1430426, 1430429 : Dereference before null check in test/drbg_cavs_test.c check_after_deref: Null-checking drbg suggests that it may be null, but it has already been dereferenced on all paths leading to the check Fix CID 1440765: Dereference before null check in test/ssltestlib.c check_after_deref: Null-checking ctx suggests that it may be null, but it has already been dereferenced on all paths leading to the check. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/7993)
2018-12-12Add RFC5297 AES-SIV supportTodd Short
Based originally on github.com/dfoxfranke/libaes_siv This creates an SIV128 mode that uses EVP interfaces for the CBC, CTR and CMAC code to reduce complexity at the cost of perfomance. The expected use is for short inputs, not TLS-sized records. Add multiple AAD input capacity in the EVP tests. Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/3540)
2018-12-06Following the license change, modify the boilerplates in test/Richard Levitte
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7767)
2018-11-14KMAC implementation using EVP_MACShane Lontis
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/7597)
2018-11-05GMAC implementationPauli
Remove GMAC demo program because it has been superceded by the EVP MAC one Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7548)
2018-10-29test/evp_test.c: Fixed strcmp() fault in mac_test_init()Richard Levitte
When wanting to compare the end of a string with another string, make sure not to start somewhere before the start of the first string. [extended tests] Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7520)
2018-10-29test/evp_test.c: don't misuse pkey_test_ctrl() in mac_test_run()Richard Levitte
pkey_test_ctrl() was designed for parsing values, not for using in test runs. Relying on its returned value when it returned 1 even for control errors made it particularly useless for mac_test_run(). Here, it gets replaced with a MAC specific control function, that parses values the same way but is designed for use in a _run() rather than a _parse() function. This uncovers a SipHash test with an invalid control that wasn't caught properly. After all, that stanza is supposed to test that invalid control values do generate an error. Now we catch that. Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7500)
2018-10-29Adapt test/evp_test.c to deal with available EVP_MACsRichard Levitte
If a MAC isn't available as an EVP_MAC, the MAC test falls back to the corresponding EVP_PKEY method. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/7393)
2018-09-18Trivial test improvementsTobias Nießen
This commit reuses a variable instead of reevaluating the expression and updates an outdated comment in the EVP test. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/7242)
2018-09-09test/evp_test.c: make it possible to use controls with MAC testsRichard Levitte
Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7154)
2018-08-20Add a helper routine so that evp_test can compare memory without producingPauli
spurious output when checking for error conditions. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/6899)
2018-06-20Fix no-sm2Matt Caswell
Fixes #6525 Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6531)
2018-06-19Move SM2 algos to SM2 specific PKEY methodJack Lloyd
Use EVP_PKEY_set_alias_type to access Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6443)
2018-05-11Use void in all function definitions that do not take any argumentsKurt Roeckx
Reviewed-by: Rich Salz <rsalz@openssl.org> GH: #6208
2018-03-20Update copyright yearMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5689)
2018-03-19Fix no-sm2Matt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5673)
2018-03-19Fix no-ecMatt Caswell
Raw private/public key loading may fail for X25519/X448 if ec has been disabled. Also fixed a missing blank line in evppkey.txt resulting in a warning in the test output. Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5664)
2018-03-15Rename EVP_PKEY_new_private_key()/EVP_PKEY_new_public_key()Matt Caswell
Renamed to EVP_PKEY_new_raw_private_key()/EVP_new_raw_public_key() as per feedback. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5520)
2018-03-15Add PrivateKeyRaw and PublicKeyRaw support to evp_testMatt Caswell
Previously private and public keys had to be pem encoded to be read by evp_test. This enables us to embed the raw private/public key values in the test file. The algorithm has to support EVP_PKEY_new_private_key() and EVP_PKEY_new_public_key() for this to work. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5520)
2018-03-15Update the tests to use the new EVP_PKEY_new_private_key() functionMatt Caswell
Also to use the new EVP_PKEY_new_CMAC_key() Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5520)
2017-10-12Don't assume shared key length matches expected lengthDr. Stephen Henson
Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4485)
2017-08-25Fix no-scryptMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4252)
2017-08-22Fix ctype arguments.Pauli
Cast arguments to the various ctype functions to unsigned char to match their documentation. Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4203)
2017-08-12Add EVP_DigestFinalXOF, interface to extendable-output functions, XOFs.Andy Polyakov
Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4137)
2017-08-03Allow use of long name for KDFsDr. Stephen Henson
Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/4079)