summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* AES CTR-DRGB: add test for 32-bit counter overflowPatrick Steuer2020-03-114-2/+289
| | | | | | | Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/10457)
* AES CTR-DRGB: performance improvementPatrick Steuer2020-03-112-82/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optimize the the AES-based implementation of the CTR_DRBG construction, see 10.2.1 in [1]. Due to the optimizations, the code may deviate (more) from the pseudocode in [1], but it is functional equivalence being decisive for compliance: "All DRBG mechanisms and algorithms are described in this document in pseudocode, which is intended to explain functionality. The pseudocode is not intended to constrain real-world implementations." [9 in [1]]. The following optimizations are done: - Replace multiple plain AES encryptions by a single AES-ECB encryption of a corresponding pre-initialized buffer, where possible. This allows platform-specific AES-ECB support to be used and reduces the overhead of multiple EVP calls. - Replace the generate operation loop (which is a counter increment followed by a plain AES encryption) by a loop which does a plain AES encryption followed by a counter increment. The latter loop is just a description of AES-CTR, so we replace it by a single AES-CTR encryption. This allows for platform-specific AES-CTR support to be used and reduces the overhead of multiple EVP calls. This change, that is, going from a pre- to a post- counter increment, requires the counter in the internal state to be kept at "+1" (compared to the pseudocode in [1]) such that it is in the correct state, when a generate operation is called. That in turn also requires all other operations to be changed from pre- to post-increment to keep functional equivalence. [1] NIST SP 800-90A Revision 1 Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/10457)
* DOCS: Use "command" not "tool" or "utility"Rich Salz2020-03-1124-38/+46
| | | | | | Reviewed-by: Paul Yang <kaishen.yy@antfin.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11123)
* Move OSSL_CMP_X509_digest() to x_all.c, renaming it to X509_digest_sig()Dr. David von Oheimb2020-03-109-79/+48
| | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/11142)
* Fix handling of CMP msg senderKID and improve doc of related CTX functionsDr. David von Oheimb2020-03-107-49/+93
| | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/11142)
* Fix error in case CMP msg POPO is not provided in OSSL_CRMF_MSGS_verify_popo()Dr. David von Oheimb2020-03-104-5/+10
| | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/11142)
* Chunk 8 of CMP contribution to OpenSSL: CMP server and cmp_mock_srv.c for ↵Dr. David von Oheimb2020-03-1041-351/+2102
| | | | | | | | | | | | | testing Certificate Management Protocol (CMP, RFC 4210) extension to OpenSSL Also includes CRMF (RFC 4211) and HTTP transfer (RFC 6712). Adds the CMP and CRMF API to libcrypto and the "cmp" app to the CLI. Adds extensive documentation and tests. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/11142)
* Extract sk_ASN1_UTF8STRING2text() from ts_get_status_text() in ↵Dr. David von Oheimb2020-03-103-53/+76
| | | | | | | | ts_rsp_verify.c to asn1_lib.c Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/11142)
* fix coding style nits w.r.t. 'defined' in http_local.h, http.h, and ocsp.hDr. David von Oheimb2020-03-103-3/+3
| | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/11142)
* fix two mistakes w.r.t. ERR_LIB_* parameters in ERR_add_error_txt()Dr. David von Oheimb2020-03-101-2/+2
| | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/11142)
* DOCS: Clean up doc/man3/EVP_DigestInit.podRichard Levitte2020-03-101-36/+36
| | | | | | | | We touch it, we clean it up! Accordding to common man-pages(7) guidelines. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11270)
* DOCS: Add translation information for EVP_MD_CTX_ctrl()Richard Levitte2020-03-101-3/+17
| | | | | | | | | | | EVP_MD_CTX_ctrl() translates some known control commands when faced with a fetched EVP_MD, so we need to document it. This also ensures that we don't drop the information on the "micalg" parameter entirely. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11270)
* DOCS: Add missing documentation in util/missingcrypto.txtRichard Levitte2020-03-101-0/+39
| | | | | | | | These lines will be taken away as documentation moves from diverse provider operation interface manuals to implementation specific docs. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11270)
* DOCS: Move implementation specific docs away from provider-digest(7)Richard Levitte2020-03-1016-40/+678
| | | | | | | | | | | | | | | | The provider- manuals are meant to describe the general interface for their respective operation. This is not the place to describe implementation specific details. This change creates a number of doc/man7/EVP_MD manuals, one for each algorithm or set of algorithms, as well as doc/man7/EVP_MD-common.pod to describe what's common to them all. While we're at it, correct the SHA3 settable context params array to match what's actually settable. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11270)
* DOCS: Start restructuring our provider and implementation documentationRichard Levitte2020-03-103-4/+445
| | | | | | | | | | This adds doc/man7/OSSL_PROVIDER-default.pod and OSSL_PROVIDER-legacy.pod, and fills in currently implemented operations and algorithms in them, as well as in doc/man7/OSSL_PROVIDER-FIPS.pod, with links to documentation to come. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11270)
* Renew and extend the tool for checking adherence to C coding style rulesDr. David von Oheimb2020-03-094-175/+2141
| | | | | | | | | | | | | aims at checking most of https://www.openssl.org/policies/codingstyle.html and various requirements not yet explicitly stated there - see also #10725 add util/check-format.pl and its self-tests in util/check-format-test-{positives,negatives}.c remove util/openssl-format-source Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/10363)
* DH: add internal dh_get_method()Richard Levitte2020-03-092-0/+7
| | | | | | | | | | This should have been publically present a long time ago, to be consistent with the RSA, DSA and EC_KEY APIs. However, since we've now deprecated that kind of function for the other key types, there's no point in adding a public function, but we still need it internally. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11193)
* EVP: Check that key methods aren't foreign when exportingRichard Levitte2020-03-097-3/+32
| | | | | | | | | | | | | | | | | | | | | The EVP_PKEY_ASN1_METHOD function export_to() must check that the key we're trying to export has a known libcrypto method, i.e. is a built in RSA_METHOD, DSA_METHOD, etc. Otherwise, the method may be defined by the calling application, by an engine, by another library, and we simply cannot know all the quirks hidden behind that method, if we have access to the key data, or much anything. Such keys are simply deemed impossible to export to provider keys, i.e. have export_to() return 0. This cascades back to functions like evp_pkey_export_to_provider() and evp_pkey_upgrade_to_provider() and their callers. In most cases, this is fine, but if these get mixed in with provider side keys in any function, that function will fail. Fixes #11179 Fixes #9915 Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11193)
* DOCS: Fix documentation on asymmetric keydata typesRichard Levitte2020-03-091-12/+12
| | | | | | | Some type specs didn't correspond to actual use. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/11275)
* docs: fix typo in SSL functionsJames Peach2020-03-093-6/+6
| | | | | | | | | CLA: trivial Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> Reviewed-by: Paul Yang <kaishen.yy@antfin.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11253)
* util/wrap.pl: do not look at EXE_SHELLRichard Levitte2020-03-091-5/+1
| | | | | | | | | | | | | Acting on EXE_SHELL was a bit over the top, especially in light of instructions like this (from NOTES.VALGRIND): EXE_SHELL="`/bin/pwd`/util/wrap.pl valgrind --error-exitcode=1 --leak-check=full -q" Fixes #11255 Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11258)
* Remove double fetch of "OSSL_EX_DATA_GLOBAL" for global lockDavide Galassi2020-03-091-23/+26
| | | | | | | | | | | | | Fetch once and just pass the global ex_data to the "get_and_lock" static function. Removed a redundant null pointer check within the "get_and_lock" static function (control already performed by the caller). Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11152)
* spkac: Check return values of NETSCAPE_SPKI functionsVladimir Panteleev2020-03-091-2/+9
| | | | | | | | Fixes silently producing an invalid SPKAC with non-RSA keys. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/11224)
* Document the new DigestSign provider functionsMatt Caswell2020-03-091-6/+160
| | | | | | | | | As well as the newly added "one shot" functions, we also document a number of the other other digestsign functions which were missing documentation in provider-signature.pod. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/11261)
* Implement provider support for Ed25519 annd Ed448Matt Caswell2020-03-0913-13/+246
| | | | | | | | | At the moment we only provider support for these algorithms in the default provider. These algorithms only support "one shot" EVP_DigestSign() and EVP_DigestVerify() as per the existing libcrypto versions. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/11261)
* Add provider awareness of EVP_DigestSign() and EVP_DigestVerify()Matt Caswell2020-03-093-25/+103
| | | | | | | | | These "one-shot" functions are the only ones supported by Ed25519 and Ed448, so we need to ensure that libcrypto can handle provider based implementations of these functions. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/11261)
* Add Key Management support for EdDSA keysMatt Caswell2020-03-094-36/+62
| | | | | | | Support added for Ed25519 and Ed448 Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/11261)
* Refactor CRMF_poposigningkey_init() to work with provider keysRichard Levitte2020-03-091-47/+12
| | | | | | | | | | The code in this function was almost entirely a copy of the functionality in ASN1_item_sign(), so it gets refactored to actually call ASN1_item_sign(), and thereby automatically gets support for EVP_PKEYs with only provider side keys. Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/11126)
* doc: slightly reformulate 'openssl(1)/Random State Options' sectionDr. Matthias St. Pierre2020-03-081-3/+3
| | | | | Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11252)
* Improve small block cipher performanceKurt Roeckx2020-03-083-14/+21
| | | | | | | | | | | | | | | | Avoid function calls we don't need to do. In 1.1.1 we have: aes-128-cbc 572267.80k 681197.08k 715430.74k 720508.59k 722359.64k 723004.07k Current master: aes-128-cbc 460663.70k 631125.66k 701283.58k 719794.52k 724732.59k 726668.63k new: aes-128-cbc 582057.64k 684288.62k 715721.90k 724856.15k 717578.24k 727176.53k Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11102)
* Add -section option to 'req' commandRich Salz2020-03-076-42/+84
| | | | | | | | | This removes "req" as the hardwired section for the req command. Doing this will let us merge some test configs. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/11249)
* cmdline app: add provider commandline options.Pauli2020-03-0797-47/+587
| | | | | | | | | | Add a -provider option to allow providers to be loaded. This option can be specified multiple times. Add a -provider_path option to allow the path to providers to be specified. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11167)
* man1: make all openssl command line tool documentation generated.Pauli2020-03-0719-53/+84
| | | | | | | | | | With the introduction of provider command line options which are applicable to almost all of the command line tools, it seemed reasonable to make them all generated. This simplifes the .gitignore and avoids having to keep two lists in sync. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11167)
* Change DH_get_nid() to set the value of q if it is not already setShane Lontis2020-03-0711-102/+230
| | | | | | | | | | | | | Fixes #11108. It only sets q if a valid named group is found. The function signature was recently changed to pass a non const DH pointer in order to allow the nid to be cached internally. As an extension of this the value of q can now also be set as q is always known for named groups. The length field is also set if q is set. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11114)
* Clarify the usage of EVP_PKEY_get_raw_[private|public]_key()Matt Caswell2020-03-061-13/+16
| | | | | | | | | | | EVP_PKEY_get_raw_private_key() and EVP_PKEY_get_raw_public_key() expect the size of the key buffer to be populated in the |*len| parameter on entry - but the docs made no mention of this. Fixes #11245 Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11254)
* Use .cnf for config files, not .confRich Salz2020-03-0695-117/+101
| | | | | | | | | | | | | The default is openssl.cnf The project seems to prefer xxx.conf these days, but we should use the default convention. Rename all foo.conf (except for Configurations) to foo.cnf Fixes #11174 Reviewed-by: Paul Yang <kaishen.yy@antfin.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11176)
* Remove unused filesRich Salz2020-03-065-114/+0
| | | | | | Reviewed-by: Paul Yang <kaishen.yy@antfin.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11176)
* fix a minor bug of s_clientRoger Ning2020-03-051-2/+2
| | | | | | | | | | | CLA: trivial -CAstore's option should be OPT_CASTORE, instead of OPT_CAFILE correct also -no-CAstore option from OPT_NOCAPATH to OPT_NOCASTORE Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/11215)
* Add CIFuzz actionLeo Neat2020-03-051-0/+23
| | | | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11140)
* crypto/ec/curve448/eddsa.c: fix EBCDIC platformsPatrick Steuer2020-03-051-1/+6
| | | | | | | Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11229)
* aes-s390x.pl: fix stg offset caused by typo in perlasmPatrick Steuer2020-03-051-2/+2
| | | | | | | 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/11234)
* .github/PULL_REQUEST_TEMPLATE.md: Fix link to contributors guideVladimir Panteleev2020-03-051-1/+1
| | | | | | | | | | | The file was converted to Markdown and renamed appropriately in 2e07506a12e126894cd820304465162bc0e732b4. CLA: trivial Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11223)
* Add DSA Key validation to default providerShane Lontis2020-03-053-6/+56
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10912)
* Add DH key validation to default providerShane Lontis2020-03-053-6/+57
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10911)
* config, Configure: move the check of removed crypto/ sub-systemsRichard Levitte2020-03-042-8/+13
| | | | | | | | | | | | | | | | The 'config' script checked for a bunch of crypto/ sub-system directories, and added 'no-' options if they weren't there. We move it to 'Configure' in an effort to simplify 'config' for further work. Note: this is pretty much a historical thing. In modern OpenSSL, it's much simpler to edit the SUBDIRS statement in crypto/build.info. However, it's been claimed the there are those who still remove some of these sub-system sources. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11217)
* .travis.yml: where it matters, have build and source nesting levels differRichard Levitte2020-03-041-5/+5
| | | | | | | | | | | | | Where we build out of source, the source directory was _srcdist and the build directory was _build. That gives the same nesting level for both, which doesn't quite exercise all aspects of relative back references from build to source tree. Changing the build tree to be in _build/tree will challenge back references a bit more, and ensure a bit more that we got it right. Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com> (Merged from https://github.com/openssl/openssl/pull/11186)
* Add some missing env var documentationRich Salz2020-03-042-6/+20
| | | | | | Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11189)
* .gitignore: Add /apps/progs.{c,h}Vladimir Panteleev2020-03-041-0/+2
| | | | | | | | | | | | These files were removed from the source tree in fe909ee4aeb6eb64f6f31a1544c5d3c81c5fe1f1. CLA: trivial Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/11222)
* Add Serializers for ECShane Lontis2020-03-0426-68/+955
| | | | | | | | | | | | | | | | | | | | | | | Provide EC serializers for text, pem and der. EC parameters use ANS1 'CHOICE' - which means they are more embedded than other parameters used by other KEY types (which normally have a SEQUENCE at the top level). For this reason the ANS1_STRING type that was being passed around has been changed to a void so that the code can still be shared with EC. The EC serializer only supports named curves currently. NOTE the serializer code assumes PKCS8 format - if the older encode methods are needed they will need to be added in another PR. (Probably when deserialization is considered). EVP_PKEY_key_fromdata_init was changed from using a keypair selection to all bits of a key. A side effect of this was that the very restrictive checks in the ecx code needed to be relaxed as it was assuming all selection flags were non optional. As this is not the case for any other key the code has been modified. Fixed a bug in legacy_ctrl_str_to_params() - "ecdh_cofactor_mode" was being incorrectly converted to the wrong keyname. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11107)
* Correct two small documentation issuesTomas Mraz2020-03-032-1/+2
| | | | | | | | | The find-doc-nits complains about non-zero word and about missing line before =head1 which causes build failure. Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11231)