summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Fix common test framework optionsMatt Caswell2020-02-0328-4/+160
| | | | | | | | | | | | | | | | | | | | | PR#6975 added the ability to our test framework to have common options to all tests. For example providing the option "-test 5" to one of our test programs will just run test number 5. This can be useful when debugging tests. Unforuntately this does not work well for a number of tests. In particular those tests that call test_get_argument() without first skipping over these common test options will not get the expected value. Some tests did this correctly but a large number did not. A helper function is introduced, test_skip_common_options(), to make this easier for those tests which do not have their own specialised test option handling, but yet still need to call test_get_argument(). This function call is then added to all those tests that need it. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/10975)
* Fix no-ecMatt Caswell2020-02-031-0/+5
| | | | | | | | | The cmp_protect_test cert chain tests use some EC certs which breaks in a no-ec build. The fix is to just skip those tests if no-ec has been configured. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10991)
* Revert "Legacy digests can have custom control values"Matt Caswell2020-02-031-1/+1
| | | | | | | | | | | | This reverts commit 1f457256ce6a1b2fd7e3f62eee8faa74cd5c835e. This is causing Travis failures. [extended tests] Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/10989)
* CHANGES: Add note about the refactoring of SM2 EVP_PKEYsRichard Levitte2020-02-021-0/+13
| | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/10942)
* Adapt some 'openssl' commands for SM2 changes.Richard Levitte2020-02-022-85/+30
| | | | | | | | | There's no longer any need to make an EVP_PKEY type change for SM2 keys, so we trim away that code. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/10942)
* Adapt tests for SM2 changes.Richard Levitte2020-02-022-26/+79
| | | | | | | | | | | | | | | | With test/ecdsatest.c, we test all the curves once for each EC key type we have, i.e. one round trip with EVP_PKEY_EC and one with EVP_PKEY_SM2. This shows that we can use "normal" EC computations on keys with the SM2 curve (which have the type EVP_PKEY_SM2 by default) and SM2 computations with any other curve (which have the type EVP_PKEY_EC by default) test/evp_test.c, on the other hand, doesn't need to explicitly set the EVP_PKEY_SM2 alias type, as that now happens automatically. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/10942)
* Make SM3 a mandatory hash function for SM2.Richard Levitte2020-02-021-2/+2
| | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/10942)
* X509: Refactor X509_verify() and X509_REQ_verify() for better streamliningRichard Levitte2020-02-024-164/+89
| | | | | | | | | | | | | | | | | | | | | The solution to incorporate the SM2 identity processing was an off the side hack that more or less duplicated the ASN1_item_verify() code with just a few lines being different. We replace this with a new function ASN1_item_verify_ctx(), which takes an EVP_MD_CTX pointer instead of an EVP_PKEY pointer, just like its sibling ASN1_item_sign_ctx(). This allows us to refactor X509_verify() and X509_REQ_verify() to simply create a local EVP_MD_CTX and an attached EVP_PKEY_CTX, which gets to hold the SM2 identity, if there is one, and then let ASN1_item_verify_ctx() to its job. This will also make it easier to adapt ASN1_item_verify_ctx() for provider based keys. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/10942)
* Add SM2 specific parameter and key generationRichard Levitte2020-02-021-25/+42
| | | | | | | | | | | | | | This makes it possible to generate SM2 parameters and keys like this: EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_SM2); EVP_PKEY *pkey = EVP_PKEY_new(); EVP_PKEY_keygen_init(pctx); EVP_PKEY_keygen(pctx, pkey); Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/10942)
* EVP_PKEY_assign_EC_KEY(): detect SM2 curve and set EVP_PKEY type accordinglyRichard Levitte2020-02-023-20/+30
| | | | | | | | | | | | | | This means that when loaded or created, EC EVP_PKEYs with the SM2 curve will be regarded as EVP_PKEY_SM2 type keys by default. Applications are no longer forced to check and fix this. It's still possible, for those who want this, to set the key type to EVP_PKEY_EC and thereby run the normal EC computations with the SM2 curve. This has to be done explicitly. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/10942)
* EVP: Small refactor of keymgmt library codeRichard Levitte2020-02-021-11/+14
| | | | | | | | | | | Some functions went directly on keymgmt function pointers instead of going through the internal KEYMGMT API, which makes for a confusing read. Related to #10962 Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10963)
* config: ensure the perl Configure run is the last statementRichard Levitte2020-02-021-6/+7
| | | | | | | | | Running any statement after Configure means we lose its exit code Fixes #10951 Reviewed-by: Ben Kaduk <kaduk@mit.edu> (Merged from https://github.com/openssl/openssl/pull/10953)
* Fix "ts" no-XXX options, document two TLS optionsRich Salz2020-01-312-2/+9
| | | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/10191)
* Update the SSL/TLS connection optionsRich Salz2020-01-313-174/+185
| | | | | | | | | | | | | Refactor common flags for SSL/TLS connection options. Update SSL_CONF_cmd.pod to match ordering. Rewrite much of the documentation. Fixes #10160 Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/10191)
* evp_pmeth: free the MD reference correctly.Pauli2020-01-311-1/+1
| | | | | | | | The code was calling EVP_MD_meth_free which is incorrect. It should call EVP_MD_free. It happened to work but by luck rather than design. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10973)
* scrypt: free the MD reference correctly.Pauli2020-01-311-1/+1
| | | | | | | | The code was calling EVP_MD_meth_free which is incorrect. It should call EVP_MD_free. It happened to work but by luck rather than design. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10973)
* Add support for DH 'modp' group parameters (RFC 3526)Shane Lontis2020-01-3020-931/+829
| | | | | Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10897)
* Don't acknowledge a servername following warning alert in servername cbMatt Caswell2020-01-301-0/+1
| | | | | | | | | If the servername cb decides to send back a warning alert then the handshake continues, but we should not signal to the client that the servername has been accepted. Reviewed-by: Ben Kaduk <kaduk@mit.edu> (Merged from https://github.com/openssl/openssl/pull/10018)
* Provide better documentation for SSL_get_servername()Matt Caswell2020-01-302-10/+115
| | | | | | | | | | | | The behaviour of SSL_get_servername() is quite complicated and depends on numerous factors such as whether it is called on the client or the server, whether it is called before or after the handshake, what protocol version was negotiated, and whether a resumption was attempted or was successful. We attempt to document the behavior more clearly. Reviewed-by: Ben Kaduk <kaduk@mit.edu> (Merged from https://github.com/openssl/openssl/pull/10018)
* Test that SSL_get_servername returns what we expectMatt Caswell2020-01-301-5/+161
| | | | | | | | | | Test this on both the client and the server after a normal handshake, and after a resumption handshake. We also test what happens if an inconsistent SNI is set between the original handshake and the resumption handshake. Finally all of this is also tested in TLSv1.2 and TLSv1.3. Reviewed-by: Ben Kaduk <kaduk@mit.edu> (Merged from https://github.com/openssl/openssl/pull/10018)
* Fix SSL_get_servername() and SNI behaviourMatt Caswell2020-01-303-22/+86
| | | | | | | | | | | | | | | | | | | | | | | | | The SNI behaviour for TLSv1.3 and the behaviour of SSL_get_servername() was not quite right, and not entirely consistent with the RFC. The TLSv1.3 RFC explicitly says that SNI is negotiated on each handshake and the server is not required to associate it with the session. This was not quite reflected in the code so we fix that. Additionally there were some additional checks around early_data checking that the SNI between the original session and this session were consistent. In fact the RFC does not require any such checks, so they are removed. Finally the behaviour of SSL_get_servername() was not quite right. The behaviour was not consistent between resumption and normal handshakes, and also not quite consistent with historical behaviour. We clarify the behaviour in various scenarios and also attempt to make it match historical behaviour as closely as possible. Fixes #8822 Reviewed-by: Ben Kaduk <kaduk@mit.edu> (Merged from https://github.com/openssl/openssl/pull/10018)
* Fix type name typo in d2i/i2d documentation.David Makepeace2020-01-301-1/+1
| | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/10933)
* Add -issuer_checks to verify optionsRich Salz2020-01-292-2/+4
| | | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/10873)
* Document most missing optionsRich Salz2020-01-2931-79/+385
| | | | | | | | | | | | | | | | | | | | | Add cmd-nits make target. Listing options should stop when it hits the "parameters" separator. Add missing .pod.in files to doc/man1/build.info Tweak find-doc-nits to try openssl-XXX before XXX for POD files and change an error messavge to be more useful. Fix the following pages: ca, cms, crl, dgst, enc, engine, errstr, gendsa, genrsa, list, ocsp, passwd, pkcs7, pkcs12, rand, rehash, req, rsautil, s_server, speed, s_time, sess_id, smime, srp, ts, x509. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/10873)
* Add more generated man1 doc filesRich Salz2020-01-292-11/+9
| | | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/10873)
* Add RSA key validation to default providerShane Lontis2020-01-2919-139/+439
| | | | | Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10780)
* TLS: use EVP for HMAC throughout libssl.Pauli2020-01-2911-69/+375
| | | | | | | | Backwards compatibility with the old ticket key call back is maintained. This will be removed when the low level HMAC APIs are finally removed. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10836)
* Deprecate the low level HMAC functionsPauli2020-01-2915-41/+166
| | | | | | | | | | | Use of the low level HMAC functions has been informally discouraged for a long time. We now formally deprecate them. Applications should instead use EVP_MAC_CTX_new(3), EVP_MAC_CTX_free(3), EVP_MAC_init(3), EVP_MAC_update(3) and EVP_MAC_final(3). Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10836)
* hmac: preprocessor indentation fixesPauli2020-01-291-4/+4
| | | | | Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10836)
* Deprecate the low level CMAC functionsPauli2020-01-297-26/+57
| | | | | | | | | | | Use of the low level CMAC functions has been informally discouraged for a long time. We now formally deprecate them. Applications should instead use EVP_MAC_CTX_new(3), EVP_MAC_CTX_free(3), EVP_MAC_init(3), EVP_MAC_update(3) and EVP_MAC_final(3). Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10836)
* cmac: preprocessor indentation fixesPauli2020-01-291-5/+5
| | | | | Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10836)
* Adapt X509_PUBKEY_set() for use with provided implementationsRichard Levitte2020-01-281-8/+35
| | | | | | | | | | We do this by letting a serializer serialize the provider side key to a DER blob formatted according to the SubjectPublicKeyInfo structure (see RFC 5280), and deserialize it in libcrypto using the usual d2i function. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10851)
* test_evp_extra_test.c: don't rely on exact parameter positionRichard Levitte2020-01-281-13/+10
| | | | | Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/10920)
* PROV: Adapt the DSA signature implementation to provide AlgorithmidentifiersRichard Levitte2020-01-286-11/+165
| | | | | Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/10920)
* Adapt ASN1_item_sign_ctx() for use with provided keypairsRichard Levitte2020-01-282-7/+51
| | | | | | | | | The mechanism to do this is to ask the signature operation for the DER encoded AlgorithmIdentifier that corresponds to the combination of signature algorithm and digest algorithm. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/10920)
* Modify EVP_PKEY_CTX_new_from_pkey() to add a propquery parameterMatt Caswell2020-01-275-20/+10
| | | | | | | | | | The function EVP_PKEY_CTX_new_from_pkey() infers the name of the algorithm to fetch from the EVP_PKEY that has been supplied as an argument. But there was no way to specify properties to be used during that fetch. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10926)
* OpenSSL::Test: bring back the relative pathsRichard Levitte2020-01-271-5/+5
| | | | | | | | | | | | | | | | | | | Because there was a bug in File::Spec::Unix' abs2rel when it was given relative paths as both PATH and BASE arguments, the directories we deal with were made to be all absolute. Unfortunately, this meant getting paths in our verbose test output which are difficult to use anywhere else (such as a separate test build made for comparison), due to the constant need to edit all the paths all the time. We're therefore getting back the relative paths, by doing an extra abs2rel() in __srctop_file, __srctop_dir, __bldtop_file and __bldtop_dir, with a 'Cwd::getcwd' call as BASE argument. Fixes #10628 Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/10913)
* test/recipes/30-test_evp.t: Fix multiple definition of @bffilesRichard Levitte2020-01-261-4/+4
| | | | | | | | | Curiously enough, perl only warned about the shadowing. However, the following 'plan' statement got disturbed somehow, as one could notice the test counter say "11/?" instead of "11/25". Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/10944)
* Check that the default signature type is allowedKurt Roeckx2020-01-253-23/+52
| | | | | | | | | | | | TLS < 1.2 has fixed signature algorithms: MD5+SHA1 for RSA and SHA1 for the others. TLS 1.2 sends a list of supported ciphers, but allows not sending it in which case SHA1 is used. TLS 1.3 makes sending the list mandatory. When we didn't receive a list from the client, we always used the defaults without checking that they are allowed by the configuration. Reviewed-by: Paul Dale <paul.dale@oracle.com> GH: #10784
* Replace apps/server.pem with certificate with a sha256 signature.Kurt Roeckx2020-01-252-51/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It replaces apps/server.pem that used a sha1 signature with a copy of test/certs/servercert.pem that is uses sha256. This caused the dtlstest to start failing. It's testing connection sbetween a dtls client and server. In particular it was checking that if we drop a record that the handshake recovers and still completes successfully. The test iterates a number of times. The first time through it drops the first record. The second time it drops the second one, and so on. In order to do this it has a hard-coded value for the expected number of records it should see in a handshake. That's ok because we completely control both sides of the handshake and know what records we expect to see. Small changes in message size would be tolerated because that is unlikely to have an impact on the number of records. Larger changes in message size however could increase or decrease the number of records and hence cause the test to fail. This particular test uses a mem bio which doesn't have all the CTRLs that the dgram BIO has. When we are using a dgram BIO we query that BIO to determine the MTU size. The smaller the MTU the more fragmented handshakes become. Since the mem BIO doesn't report an MTU we use a rather small default value and get quite a lot of records in our handshake. This has the tendency to increase the likelihood of the number of records changing in the test if the message size changes. It so happens that the new server certificate is smaller than the old one. AFAICT this is probably because the DNs for the Subject and Issuer are significantly shorter than previously. The result is that the number of records used to transmit the Certificate message is one less than it was before. This actually has a knock on impact for subsequent messages and how we fragment them resulting in one less ServerKeyExchange record too (the actual size of the ServerKeyExchange message hasn't changed, but where in that message it gets fragmented has). In total the number of records used in the handshake has decreased by 2 with the new server.pem file. Reviewed-by: Paul Dale <paul.dale@oracle.com> GH: #10784
* EVP: Adapt EVP_PKEY Seal and Open for provider keysRichard Levitte2020-01-256-29/+50
| | | | | | | | | | | This affects the following function, which can now deal with provider side keys: - EVP_SealInit() - EVP_OpenInit() Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/10808)
* openssl-config: add example libssl system-defaultsBenjamin Kaduk2020-01-251-0/+16
| | | | | | | | | Provide a "simple" example for affecting the systemwide default behavior of libssl. The large number of mandatory nested sections makes this less simple than the main description might suggest. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10937)
* Deprecate the low level DES functions.Pauli2020-01-2543-148/+393
| | | | | | | | | | | | Use of the low level DES functions has been informally discouraged for a long time. We now formally deprecate them. Applications should instead use the EVP APIs, e.g. EVP_EncryptInit_ex, EVP_EncryptUpdate, EVP_EncryptFinal_ex, and the equivalently named decrypt functions. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/10858)
* des: fix header file preprocessor indentationPauli2020-01-251-20/+20
| | | | | Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/10858)
* Make sure we use RAND_bytes_ex and RAND_priv_bytes_ex in libsslMatt Caswell2020-01-246-18/+22
| | | | | | | | | Now that libssl knows about libctx we should use it wherever we generate a random number. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/10927)
* New functions for PKCS8 attributes management - documentationDmitry Belyavskiy2020-01-242-2/+54
| | | | | | Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/10900)
* New functions for PKCS8 attributes managementDmitry Belyavskiy2020-01-243-0/+17
| | | | | | | | This commit introduces functions PKCS8_pkey_add1_attr_by_OBJ and PKCS8_pkey_add1_attr Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/10900)
* Modify DSA and DH keys to use a shared FFC_PARAMS structShane Lontis2020-01-2422-375/+523
| | | | | | | | This is required in order to share code for FIPS related parameter generation and validation routinues. Note the 'counter' field is now stored as a integer (as that is the form required for generation/validation functions). Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10860)
* Update man3/verify documentation, error textRich Salz2020-01-2314-966/+514
| | | | | | | | | | | | Move the x509_V_ERR_xxx definitions from openssl-verify to X509_STORE_CTX_get_error.pod. Add some missing ones. Consistently start with a lowercase letter, unless it's an acronym. Fix some markup mistakes in X509_verify_cert. Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/10132)
* Configure: Better detection of '-static' in @{$config{LDFLAGS}}Richard Levitte2020-01-231-1/+1
| | | | | | | | | | | @{$config{LDFLAGS}} isn't necessarily split up in pieces, so we need to check for '-static' with a regexp rather than with an exact string match. Fixes #10867 Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/10878)