aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
Commit message (Collapse)AuthorAgeFilesLines
* Add rc2 ciphers to default providerShane Lontis2019-10-082-0/+13
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9991)
* Move cipher ctx 'original iv' parameter into the providerShane Lontis2019-10-082-15/+13
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10026)
* EVP_{CIPHER,MD}_CTX_ctrl(): make sure to return 0 or 1Richard Levitte2019-10-062-2/+5
| | | | | | | | | | | | Even thought the underlying calls might return something other than 0 or 1, EVP_CIPHER_CTX_ctrl() and EVP_MD_CTX_ctrl() were made to only return those values regardless. That behaviour was recently lost, so we need to restore it. Fixes #10106 Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/10108)
* Deprecate NCONF_WIN32() functionRich Salz2019-10-063-5/+15
| | | | | | | | Extensive documentation added in HISTORY section in doc/man5/config.pod Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9578)
* Move MD5-SHA1 digest completely to the default providerRichard Levitte2019-10-043-31/+9
| | | | | | | | This leaves minimal implementations of EVP_md5_sha1, which is now only there to provide a name for implicit fetches. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9076)
* Remove unused fields in method store structure.Pauli2019-10-031-2/+0
| | | | | | | The random bit caching was a residue of earlier code and isn't used any more. Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/10089)
* Move all SHA digests completely to the default providerRichard Levitte2019-10-044-566/+188
| | | | | | | | This leaves minimal implementations of EVP_sha* and EVP_shake*, which is now only there to provide a name for implicit fetches. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10059)
* Replumbing: make it possible for providers to specify multiple namesRichard Levitte2019-10-036-24/+123
| | | | | | | | This modifies the treatment of algorithm name strings to allow multiple names separated with colons. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/8985)
* rsa: replace magic number '11' by RSA_PKCS1_PADDING_SIZEDr. Matthias St. Pierre2019-10-032-21/+21
| | | | | | | Suggested by Matt Hart Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10084)
* Don't follow legacy path if ctx->pctx is setMatt Caswell2019-10-031-3/+2
| | | | | | | | | | | | | | | EVP_DigestInit_ex forced following of the legacy path if ctx->pctx is set (meaning we've actually been called via EVP_DigestSignInit_ex). There is some code in the legacy path that calls the EVP_PKEY_CTRL_DIGESTINIT ctrl on the pctx. Not going down the legacy path if ctx->pctx is set means that ctrl message will neve get sent. However, it turns out that all algs that understand that ctrl also set the EVP_MD_CTX_FLAG_NO_INIT flag which forces legacy anyway. Therefore the ctx->pctx check is not required and can be removed. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10082)
* Free a fetched digest during EVP_MD_CTX_reset() not EVP_MD_free()Matt Caswell2019-10-031-13/+6
| | | | | | | | Otherwise a mem leak can occur since EVP_MD_free() calls EVP_MD_CTX_reset() which then clears the contents of the ctx. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/10013)
* Don't call EVP_MD_CTX_reset during EVP_DigestFinalMatt Caswell2019-10-032-1/+20
| | | | | | | | This resets the fields of the EVP_MD_CTX and means we can no longer make calls using the EVP_MD_CTX, such as to query parameters. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/10013)
* Update EVP_MD_CTX_get_params() et al to be EVP_DigestSign*() awareMatt Caswell2019-10-031-3/+49
| | | | | | | | | If doing an EVP_DigestSign*() or EVP_DigestVerify*() operation we use the embedded pctx for communication with the provider. Any MD params need to use that ctx instead. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/10013)
* Ensure we look at EVP_MD_CTX_FLAG_KEEP_PKEY_CTX in non-legacy codeMatt Caswell2019-10-031-10/+11
| | | | | | | | This flag is still relevant even for non-legacy code so we should check it where appropriate. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/10013)
* Add EVP_DigestSign/EVP_DigestVerify support for DSAMatt Caswell2019-10-031-0/+2
| | | | | Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/10013)
* Add the provider function signatures for DigestSign*Matt Caswell2019-10-034-25/+283
| | | | | Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/10013)
* Add rc5 ciphers to default providerShane Lontis2019-10-032-1/+15
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10006)
* Fix long name of some Microsoft objectsMichael Osipov2019-10-032-6/+6
| | | | | | | | | CLA: trivial Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/10029)
* Make EVP_CIPHER_is_a() work with legacy cipher implementations tooRichard Levitte2019-10-011-0/+7
| | | | | Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10008)
* Adapt EVP_CIPHER_{param_to_asn1,asn1_to_param} for use with provider.Richard Levitte2019-10-011-37/+91
| | | | | | | | | | | | | | | | | | | | | | | | | So far, these two funtions have depended on legacy EVP_CIPHER implementations to be able to do their work. This change adapts them to work with provided implementations as well, in one of two possible ways: 1. If the implementation's set_asn1_parameters or get_asn1_parameters function pointers are non-NULL, this is a legacy implementation, and that function is called. 2. Otherwise, if the cipher doesn't have EVP_CIPH_FLAG_CUSTOM_ASN1 set, the default AlgorithmIdentifier parameter code in libcrypto is executed. 3. Otherwise, if the cipher is a provided implementation, the ASN1 type structure is converted to a DER blob which is then passed to the implementation as a parameter (param_to_asn1) or the DER blob is retrieved from the implementation as a parameter and converted locally to a ASN1_TYPE (asn1_to_param). With this, the old flag EVP_CIPH_FLAG_DEFAULT_ASN1 has become irrelevant and is simply ignored. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10008)
* Add defines for __NR_getrandom for all Linux architecturesKurt Roeckx2019-09-301-3/+49
| | | | | | | Fixes: #10015 Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> GH: #10044
* Fix a bundle of mischecks of return valuesPaul Yang2019-09-301-1/+1
| | | | | | | | | Several EVP_PKEY_xxxx functions return 0 and a negative value for indicating errors. Some places call these functions with a zero return value check only, which misses the check for the negative scenarios. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10055)
* Make default values by ERR_get_error_all() and friends more consistentDr. David von Oheimb2019-09-301-16/+11
| | | | | | | | Unset data defaults to the empty string ("") or 0. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9948)
* Consistent naming for context gettable param queries .Pauli2019-09-275-8/+8
| | | | | | | | | | | | All instances of EVP_*_CTX_gettable_params functions have been renamed to EVP_*_gettable_ctx_params. Except for the EVP_MD ones which were changed already. These functions do not take EVP_*_CTX arguments so their prior naming was misleading. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10052)
* Fix header file include guard namesDr. Matthias St. Pierre2019-09-2832-79/+79
| | | | | | | | | | | | | Make the include guards consistent by renaming them systematically according to the naming conventions below For the public header files (in the 'include/openssl' directory), the guard names try to match the path specified in the include directives, with all letters converted to upper case and '/' and '.' replaced by '_'. For the private header files files, an extra 'OSSL_' is added as prefix. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9333)
* Reorganize public header files (part 1)Dr. Matthias St. Pierre2019-09-287-7/+7
| | | | | | | Rename <openssl/ossl_typ.h> to <openssl/types.h>. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9333)
* Reorganize local header filesDr. Matthias St. Pierre2019-09-28421-399/+399
| | | | | | | | | | | | | Apart from public and internal header files, there is a third type called local header files, which are located next to source files in the source directory. Currently, they have different suffixes like '*_lcl.h', '*_local.h', or '*_int.h' This commit changes the different suffixes to '*_local.h' uniformly. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9333)
* Reorganize private crypto header filesDr. Matthias St. Pierre2019-09-28285-3570/+338
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, there are two different directories which contain internal header files of libcrypto which are meant to be shared internally: While header files in 'include/internal' are intended to be shared between libcrypto and libssl, the files in 'crypto/include/internal' are intended to be shared inside libcrypto only. To make things complicated, the include search path is set up in such a way that the directive #include "internal/file.h" could refer to a file in either of these two directoroes. This makes it necessary in some cases to add a '_int.h' suffix to some files to resolve this ambiguity: #include "internal/file.h" # located in 'include/internal' #include "internal/file_int.h" # located in 'crypto/include/internal' This commit moves the private crypto headers from 'crypto/include/internal' to 'include/crypto' As a result, the include directives become unambiguous #include "internal/file.h" # located in 'include/internal' #include "crypto/file.h" # located in 'include/crypto' hence the superfluous '_int.h' suffixes can be stripped. The files 'store_int.h' and 'store.h' need to be treated specially; they are joined into a single file. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9333)
* [KDF] Add KBKDF implementation for counter-mode HMACRobbie Harwood2019-09-271-0/+2
| | | | | | | | | | | | | Implement SP800-108 section 5.1 with HMAC intended for use in Kerberos. Add test vectors from RFC 8009. Adds error codes PROV_R_INVALID_MAC and PROV_R_MISSING_MAC. Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9924)
* OSSL_PARAM functions: change to allow the data field to be NULLRichard Levitte2019-09-271-1/+34
| | | | | Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/10025)
* Certificate Management Protocol (CMP, RFC 4210) extension to OpenSSLDr. David von Oheimb2019-09-2711-122/+1808
| | | | | | | | | | | | | | | | Also includes CRMF (RFC 4211) and HTTP transfer (RFC 6712) CMP and CRMF API is added to libcrypto, and the "cmp" app to the openssl CLI. Adds extensive man pages and tests. Integration into build scripts. Incremental pull request based on OpenSSL commit 8869ad4a39f of 2019-04-02 4th chunk: CMP context/parameters and utilities in crypto/cmp/cmp_ctx.c, crypto/cmp/cmp_util.c, and related files Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9107)
* When building of modules is disabled, build the legacy provider into libcryptoRichard Levitte2019-09-261-1/+6
| | | | | | | This makes the legacy provider available regardless of building conditions. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9637)
* s390x assembly pack: accelerate X25519, X448, Ed25519 and Ed448Patrick Steuer2019-09-2517-76/+896
| | | | | | | | | using PCC and KDSA instructions. 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/10004)
* s390x assembly pack: cleanse only sensitive fieldsPatrick Steuer2019-09-251-2/+2
| | | | | | | | | of instruction parameter blocks. 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/10004)
* s390x assembly pack: fix OPENSSL_s390xcap z15 cpu maskPatrick Steuer2019-09-251-5/+5
| | | | | | | 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/10004)
* s390x assembly pack: fix msa3 stfle bit detectionPatrick Steuer2019-09-251-1/+1
| | | | | | | 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/10004)
* Make EVP_MD_CTX_[gettable|settable]_params() take an EVP_MD_CTXMatt Caswell2019-09-251-6/+26
| | | | | | | | | | | | EVP_MD_CTX_gettable_params() and EVP_MD_CTX_settable_params() were confusingly named because they did not take an EVP_MD_CTX parameter. In addition we add the functions EVP_MD_gettable_ctx_params() and EVP_MD_settable_ctx_params() which do the same thing but are passed an EVP_MD object instead. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9998)
* Remove engine param macros from wrapper APIsPauli2019-09-252-8/+4
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9971)
* Add rc4 cipher to default providerShane Lontis2019-09-251-1/+3
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9992)
* fix for dsa key size feature request issue: pkey -text or -text_pub should ↵jayaram2019-09-241-0/+7
| | | | | | | | show dsa key size Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/9983)
* Support printing out some otherName variantsDmitry Belyavskiy2019-09-244-8/+65
| | | | | | | | | | | The supported variants are - SmtpUTF8Name - xmppAddr - MS UPN - SRVName Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9965)
* Rework cipher / digest fetching for legacy nids with multiple name supportRichard Levitte2019-09-234-20/+81
| | | | | | | | | | | | | | | | With multiple names, it's no longer viable to just grab the "first" in the set and use that to find the legacy NID. Instead, all names for an algorithm must be checked, and if we encounter more than one NID asssociated with those names, we consider it an error and make that method unloadable. This ensures that all methods that do have an internal NID associated will get that NID in their structure, thereby ensuring that other parts of libcrypto that haven't gone away from using NIDs for comparison will continue to work as expected. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9969)
* Add des ciphers to default providerShane Lontis2019-09-232-0/+10
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9954)
* Configure: add missing dependency to fix parallel builds on WindowsDr. Matthias St. Pierre2019-09-211-0/+1
| | | | | | | | | | | | | | | | | | The issue was encountered when testing parallel builds of OpenSSL on Windows using `jom` instead of `nmake`. The builds persistently failed with the following error message because the generated file "buildinf.h" did not exist yet. crypto\info.c(15): fatal error C1083: cannot open include file: "buildinf.h": No such file or directory Apparently this error does not occur on Linux because `make` parallelizes the builds differently such that `crypto\cversion.c`, which has an explicit dependency on `buildinf.h`, gets compiled first. Also, the include dependency was added only recently in commit 096978f0990. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9960)
* Use the correct maximum indentKurt Roeckx2019-09-211-2/+2
| | | | | | | | | Found by OSS-Fuzz Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> GH: #9959
* Add aes_wrap cipher to providersShane Lontis2019-09-202-2/+9
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9406)
* Fix missing bn_mul_mont symbol in solaris fips moduleShane Lontis2019-09-201-6/+0
| | | | | Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9943)
* Avoid ?: construct in XXXerr callsRich Salz2019-09-193-13/+14
| | | | | | | | | It either makes the flow of control simpler and more obvious, or it is just a "cleanup" so that the editing scripts will find and fixup things. Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9441)
* Modify providers that keep track of underlying algorithmsRichard Levitte2019-09-195-2/+21
| | | | | | | | | | | | | | | | | | | | | With some provider implementations, there are underlying ciphers, digests and macs. For some of them, the name was retrieved from the method, but since the methods do not store those any more, we add different mechanics. For code that needs to pass on the name of a cipher or diges via parameters, we simply locally store the name that was used when fetching said cipher or digest. This will ensure that any underlying code that needs to fetch that same cipher or digest does so with the exact same name instead of any random name from the set of names associated with the algorithm. For code that needs to check what kind of algorithm was passed, we provide EVP_{type}_is_a(), that returns true if the given method has the given name as one of its names. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9897)
* In provider implemented methods, save the name number, not the name stringRichard Levitte2019-09-1914-129/+282
| | | | | | | | | | | | | | | | | | | | | | | | | Multiple names per implementation is already supported in the namemap, but hasn't been used yet. However, as soon as we have multiple names, we will get an issue with what name should be saved in the method. The solution is to not save the name itself, but rather the number it's associated with. This number is supposed to be unique for each set of names, and we assume that algorithm names are globally unique, i.e. there can be no name overlap between different algorithm types. Incidently, it was also found that the 'get' function used by ossl_construct_method() doesn't need all the parameters it was given; most of what it needs, it can now get through the data structure given by the caller of ossl_construct_method(). As a consequence, ossl_construct_method() itself doesn't need all the parameters it was given either. There are some added internal functions that are expected to disappear as soon as legacy code is removed, such as evp_first_name() and ossl_namemap_num2name(). Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9897)