aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
Commit message (Collapse)AuthorAgeFilesLines
...
* Add "random malloc failure" toolingRich Salz2017-01-123-0/+93
| | | | | | | | | | | | | | | | | | | | Still needs to be documented, somehow/somewhere. The env var OPENSSL_MALLOC_FAILURES controls how often malloc/realloc should fail. It's a set of fields separated by semicolons. Each field is a count and optional percentage (separated by @) which defaults to 100. If count is zero then it lasts "forever." For example: 100;@25 means the first 100 allocations pass, then the rest have a 25% chance of failing until the program exits or crashes. If env var OPENSSL_MALLOC_FD parses as a positive integer, a record of all malloc "shouldfail" tests is written to that file descriptor. If a malloc will fail, and OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE is not set (platform specific), then a backtrace will be written to the descriptor when a malloc fails. This can be useful because a malloc may fail but not be checked, and problems will only occur later. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1252)
* GH2176: Add X509_VERIFY_PARAM_get_timeRich Salz2017-01-121-0/+5
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2208)
* Add a UI utility function with which to wrap pem_callback_cb in a UI_METHODRichard Levitte2017-01-111-0/+111
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2204)
* Add an application data field in the UI_METHODRichard Levitte2017-01-112-9/+29
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2204)
* Constify the input parameter to UI_method_get_*Richard Levitte2017-01-111-8/+7
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2204)
* Print the X509 version signed, and convert to unsigned for the hex version.Kurt Roeckx2017-01-101-2/+7
| | | | | | | Found by tis-interpreter Reviewed-by: Rich Salz <rsalz@openssl.org> GH: #1754
* Only enable CRYPTO_3DES_ECB if that name is an existing macroRichard Levitte2017-01-101-2/+10
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2203)
* Small fixes of cryptodev engineRichard Levitte2017-01-101-1/+3
| | | | | | | - guard CRYPTO_3DES_CBC - add a missing cast Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2203)
* use EVP_CIPHER_CTX_ functions instead of accessing EVP_CIPHER_CTX internalsIaroslav Gridin2017-01-101-2/+3
| | | | | | | by levitte Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1784)
* fix for BSD cryptodevIaroslav Gridin2017-01-101-0/+14
| | | | | | | by levitte Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1784)
* Remove commented-out HMAC codeIaroslav Gridin2017-01-101-5/+0
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1784)
* Style the codeIaroslav Gridin2017-01-101-182/+169
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1784)
* Remove unused ret variableIaroslav Gridin2017-01-101-3/+1
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1784)
* Remove non-functional CRYPTO_AES_CTR ifdef disabling AES-CTR in cryptodevIaroslav Gridin2017-01-101-8/+0
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1784)
* Add AES-ECB and 3DES-ECB to cryptodevIaroslav Gridin2017-01-101-3/+131
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1784)
* cryptodev: allow copying EVP contextsNikos Mavrogiannopoulos2017-01-101-11/+46
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1784)
* cryptodev: Fix issue with signature generationNikos Mavrogiannopoulos2017-01-101-55/+178
| | | | | | | | | That patch also enables support for SHA2 hashes, and removes support for hashes that were never supported by cryptodev. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1784)
* Fix a memory leak in RSA_padding_add_PKCS1_OAEP_mgf1Bernd Edlinger2017-01-091-2/+6
| | | | | | Signed-off-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Matt Caswell <matt@openssl.org> GH: #2140
* fix a few more style issuesDr. Stephen Henson2017-01-083-3/+6
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Remove unnecessary frees and style fixes.Dr. Stephen Henson2017-01-082-10/+5
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Use more desciptive macro name rsa_pss_restricted()Dr. Stephen Henson2017-01-081-4/+4
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* style issuesDr. Stephen Henson2017-01-081-2/+2
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* free str on errorDr. Stephen Henson2017-01-081-0/+2
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* clarify commentDr. Stephen Henson2017-01-081-1/+5
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* fix various style issuesDr. Stephen Henson2017-01-083-12/+38
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* make errorsDr. Stephen Henson2017-01-081-1/+2
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* add parameter errorDr. Stephen Henson2017-01-081-1/+3
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Set EVP_PKEY_CTX in SignerInfoDr. Stephen Henson2017-01-081-0/+1
| | | | | | | | If we aren't setting public key parameters make EVP_PKEY_CTX available in SignerInfo so PSS mode and parameters are automatically selected. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Only allow PSS padding for PSS keys.Dr. Stephen Henson2017-01-082-2/+8
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Decode parameters properly.Dr. Stephen Henson2017-01-081-1/+3
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Return errors PKCS#7/CMS enveloped data ctrls and PSSDr. Stephen Henson2017-01-081-3/+7
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Add PSS parameter restrictions.Dr. Stephen Henson2017-01-081-2/+39
| | | | | | | | | | | | | | If a key contains any PSS parameter restrictions set them during sign or verification initialisation. Parameters now become the default values for sign/verify. Digests are fixed and any attempt to change them is an error. The salt length can be modified but must not be less than the minimum value. If the key parameters are invalid then verification or signing initialisation returns an error. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Initial parameter restrictions.Dr. Stephen Henson2017-01-082-3/+29
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Add rsa_pss_get_param.Dr. Stephen Henson2017-01-083-31/+36
| | | | | | | New function rsa_pss_get_param to extract and sanity check PSS parameters. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Don't allow PKCS#7/CMS encrypt with PSS.Dr. Stephen Henson2017-01-081-0/+6
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Add macros to determine if key or ctx is PSS.Dr. Stephen Henson2017-01-083-7/+10
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Support pad mode get/set for PSS keys.Dr. Stephen Henson2017-01-081-0/+2
| | | | | | | Pad mode setting returns an error if the mode is anything other then PSS. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Key gen param support.Dr. Stephen Henson2017-01-081-5/+33
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Set PSS padding mode for PSS keys.Dr. Stephen Henson2017-01-081-1/+4
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Digest string helper function.Dr. Stephen Henson2017-01-083-17/+23
| | | | | | | | New function EVP_PKEY_CTX_md() which takes a string and passes a digest to a ctrl. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Support RSA operations in PSS.Dr. Stephen Henson2017-01-081-0/+12
| | | | | | | | | Add support for common operations in PSS by adding a new function RSA_pkey_ctx_ctrl() which calls EVP_PKEY_CTX_ctrl if the key type is RSA or PSS. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* PSS EVP_PKEY methodDr. Stephen Henson2017-01-083-0/+28
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* RSA-PSS key printing.Dr. Stephen Henson2017-01-081-85/+109
| | | | | | | Print out RSA-PSS key parameters if present. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* PSS parameter encode and decode.Dr. Stephen Henson2017-01-082-6/+79
| | | | | | | | For RSA PSS keys encode and decode parameters when handling public and private keys. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Split PSS parameter creation.Dr. Stephen Henson2017-01-082-20/+39
| | | | | | | | | Split PSS parameter creation. This adds a new function rsa_pss_params_create which creates PSS parameters from digest and salt values. This will be used for PSS key generation. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Use method key type instead of EVP_PKEY_RSADr. Stephen Henson2017-01-082-4/+4
| | | | | | | | | Make RSA method more flexible by using the key type from the method instead of hard coding EVP_PKEY_RSA: by doing this the same code supports both RSA and RSA-PSS. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* PSS ASN.1 methodDr. Stephen Henson2017-01-083-0/+35
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* add EVP_PKEY_RSA_PSSDr. Stephen Henson2017-01-081-7/+7
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Add pss field to RSA structure and free it.Dr. Stephen Henson2017-01-082-0/+3
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)
* Cache maskHash parameterDr. Stephen Henson2017-01-082-62/+56
| | | | | | | | | Store hash algorithm used for MGF1 masks in PSS and OAEP modes in PSS and OAEP parameter structure: this avoids the need to decode part of the ASN.1 structure every time it is used. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2177)