summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2018-03-27Update copyright yearMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2018-03-27Update CHANGES and NEWS for the new releaseMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2018-03-26Limit ASN.1 constructed types recursive definition depthMatt Caswell
Constructed types with a recursive definition (such as can be found in PKCS7) could eventually exceed the stack given malicious input with excessive recursion. Therefore we limit the stack depth. CVE-2018-0739 Credit to OSSFuzz for finding this issue. Reviewed-by: Rich Salz <rsalz@openssl.org>
2018-03-26Fix dsaparam -genkey with DER outformBernd Edlinger
Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5744) (cherry picked from commit 5281435258b5d8201a00b4a9781bb724d99630f0)
2018-03-25Fix ecparam -genkey with point compression or DER outformBernd Edlinger
Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5741) (cherry picked from commit 4bdc25b07f007d9c383fbad159f81543f2e95965)
2018-03-21The default conv_form is uncompressedMatt Caswell
Fixes #5711 Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5712) (cherry picked from commit ab0a3914a64d8f1fce22795c02269e1288df52b1)
2018-03-21consttime flag changedSamuel Weiser
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5170) (cherry picked from commit 7150a4720af7913cae16f2e4eaf768b578c0b298)
2018-03-21used ERR set/pop markSamuel Weiser
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5170) (cherry picked from commit 011f82e66f4bf131c733fd41a8390039859aafb2)
2018-03-21Replaced variable-time GCD with consttime inversion to avoid side-channel ↵Samuel Weiser
attacks on RSA key generation Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5170) (cherry picked from commit 9db724cfede4ba7a3668bff533973ee70145ec07)
2018-03-20Fix some bugs with the cfb1 bitsize handlingBernd Edlinger
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5450)
2018-03-15Fix a memory leak in the ca applicationMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5445)
2018-03-15Allow multiple entries without a Subject even if unique_subject == yesMatt Caswell
It is quite likely for there to be multiple certificates with empty subjects, which are still distinct because of subjectAltName. Therefore we allow multiple certificates with an empty Subject even if unique_subject is set to yes. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5445)
2018-03-15Report a readable error on a duplicate cert in ca appMatt Caswell
Commit 87e8fec (16 years ago!) introduced a bug where if we are attempting to insert a cert with a duplicate subject name, and duplicate subject names are not allowed (which is the default), then we get an unhelpful error message back (error number 2). Prior to that commit we got a helpful error message which displayed details of the conflicting entry in the database. That commit was itself attempting to fix a bug with the noemailDN option where we were setting the subject field in the database too early (before extensions had made any amendments to it). This PR moves the check for a conflicting Subject name until after all changes to the Subject have been made by extensions etc. This also, co-incidentally Fixes the ca crashing bug described in issue 5109. Fixes #5109 Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5445)
2018-03-15Revert "Don't crash on a missing Subject in index.txt"Matt Caswell
This reverts commit a3d684ffca282796511cb8f3593a59a80109eed8. Empty Subjects are permissible Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5445)
2018-03-15Revert "Don't allow an empty Subject when creating a Certificate"Matt Caswell
This reverts commit dd37f6f12cc14cc4710289746b112eb0fed3b0b7. Empty Subjects are permissible. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5445)
2018-03-14crypto/engine/eng_cryptodev.c: don't treat a void* like an arrayRichard Levitte
The void* needs to be cast to a char* first. Fixes #5614 Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5615)
2018-03-12Free the correct type in OBJ_add_object()Matt Caswell
We should be using ASN1_OBJECT_free() not OPENSSL_free(). Fixes #5568 Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5599)
2018-03-12Improve error handling in pk7_doitMatt Caswell
If a mem allocation failed we would ignore it. This commit fixes it to always check. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5596) (cherry picked from commit 4718f449a3ecd5efac62b22d0fa9a759a7895dbc)
2018-03-11Fix propotype to include the const qualifierKurt Roeckx
Reviewed-by: Andy Polyakov <appro@openssl.org> GH: #5582
2018-03-08Remove useless -D_ENDIAN from MPE/iX-gcc configRichard Levitte
Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5566)
2018-03-07BIO_s_mem.pod: fix indirection for out parameter **ppDr. Matthias St. Pierre
BIO_get_mem_data() and BIO_get_mem_ptr() assign to *pp, not pp Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5544)
2018-03-05Minor style fixup on recent commitBernd Edlinger
99bb59d at ssl_scan_clienthello_tlsext Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Kurt Roeckx <kurt@roeckx.be> (Merged from https://github.com/openssl/openssl/pull/5507)
2018-03-04Fix credit for SRP codeRich Salz
Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5504)
2018-03-03Fix a possible memory leak in engine_table_registerBernd Edlinger
Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5489) (cherry picked from commit 55a7f77d72930f9aee1a51e0af9658b2728be127)
2018-03-02Fix wrong case in documentation of -CRLfile optionViktor Dukhovni
Reviewed-by: Rich Salz <rsalz@openssl.org>
2018-03-01Fix typo in ASN1_STRING_length docIvan Filenko
CLA: trivial Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/5458)
2018-02-26bio_b64.c: prevent base64 filter BIO from decoding out-of-bound dataDr. Matthias St. Pierre
Fixes #5405, #1381 The base64 filter BIO reads its input in chunks of B64_BLOCK_SIZE bytes. When processing input in PEM format it can happen in rare cases that - the trailing PEM marker crosses the boundary of a chunk, and - the beginning of the following chunk contains valid base64 encoded data. This happened in issue #5405, where the PEM marker was split into "-----END CER" and "TIFICATE-----" at the end of the first chunk. The decoding of the first chunk terminated correctly at the '-' character, which is treated as an EOF marker, and b64_read() returned. However, when called the second time, b64_read() read the next chunk and interpreted the string "TIFICATE" as valid base64 encoded data, adding 6 extra bytes '4c 81 48 08 04 c4'. This patch restores the assignment of the error code to 'ctx->cont', which was deleted accidentally in commit 5562cfaca4f3 and which prevents b64_read() from reading additional data on subsequent calls. This issue was observed and reported by Annie Yousar. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5422)
2018-02-22Update s_client doc adding xmpp as value for -starttlsWhite_Rabbit
CLA: trivial Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5407)
2018-02-22Checks ec_points_format extension sizePhilippe Antoine
Before reading first byte as length Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5410)
2018-02-21do_body: fix heap-use-after-free.Pavel Kopyl
The memory pointed to by the 'push' is freed by the X509_NAME_ENTRY_free() in do_body(). The second time it is referenced to (indirectly) in certify_cert:X509_REQ_free(). Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4896)
2018-02-21X509V3_EXT_add_nconf_sk, X509v3_add_ext: fix errors handlingPavel Kopyl
X509v3_add_ext: free 'sk' if the memory pointed to by it was malloc-ed inside this function. X509V3_EXT_add_nconf_sk: return an error if X509v3_add_ext() fails. This prevents use of a freed memory in do_body:sk_X509_EXTENSION_num(). Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4896)
2018-02-21Sanity check the ticket length before using key name/IVMatt Caswell
This could in theory result in an overread - but due to the over allocation of the underlying buffer does not represent a security issue. Thanks to Fedor Indutny for reporting this issue. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5417)
2018-02-13Remove code that prints "<SPACES/NULS>" in hexdumpsBernd Edlinger
when the data block ends with SPACEs or NULs. The problem is, you can't see if the data ends with SPACE or NUL or a combination of both. This can happen for instance with openssl rsautl -decrypt -hexdump Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5332) (cherry picked from commit 751485c6522f10006ba9f6cf90d719ea190e2201)
2018-02-09Swap the check in ssl3_write_pending to avoid usingBernd Edlinger
the possibly indeterminate pointer value in wpend_buf. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5309)
2018-02-02Fix timing leak in BN_from_montgomery_word.Andy Polyakov
BN_from_montgomery_word doesn't have a constant memory access pattern. Replace the pointer trick with a constant-time select. There is, of course, still the bn_correct_top leak pervasive in BIGNUM itself. See also https://boringssl-review.googlesource.com/22904 from BoringSSL. (backport from f345b1f39d9b4e4c9ef07e7522e9b2a870c9ca09 signed off by David Benjamin <davidben@google.com>) Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
2018-02-01Don't leak the exponent bit width in BN_mod_exp_mont_consttime.David Benjamin
The exponent here is one of d, dmp1, or dmq1 for RSA. This value and its bit length are both secret. The only public upper bound is the bit width of the corresponding modulus (RSA n, p, and q, respectively). Although BN_num_bits is constant-time (sort of; see bn_correct_top notes in preceding patch), this does not fix the root problem, which is that the windows are based on the minimal bit width, not the upper bound. We could use BN_num_bits(m), but BN_mod_exp_mont_consttime is public API and may be called with larger exponents. Instead, use all top*BN_BITS2 bits in the BIGNUM. This is still sensitive to the long-standing bn_correct_top leak, but we need to fix that regardless. This may cause us to do a handful of extra multiplications for RSA keys which are just above a whole number of words, but that is not a standard RSA key size. Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5154) (cherry picked from commit 39eeb64f59ff838f976ad305de7d15747d47a41c)
2018-02-01Make BN_num_bits_word constant-time.David Benjamin
(This patch was written by Andy Polyakov. I only wrote the commit message. Mistakes in the analysis are my fault.) BN_num_bits, by way of BN_num_bits_word, currently leaks the most-significant word of its argument via branching and memory access pattern. BN_num_bits is called on RSA prime factors in various places. These have public bit lengths, but all bits beyond the high bit are secret. This fully resolves those cases. There are a few places where BN_num_bits is called on an input where the bit length is also secret. This does *not* fully resolve those cases as we still only look at the top word. Today, that is guaranteed to be non-zero, but only because of the long-standing bn_correct_top timing leak. Once that is fixed, a constant-time BN_num_bits on such inputs must count bits on each word. Instead, those cases should not call BN_num_bits at all. In particular, BN_mod_exp_mont_consttime uses the exponent bit width to pick windows, but it should be using the maximum bit width. The next patch will fix this. Thanks to Dinghao Wu, Danfeng Zhang, Shuai Wang, Pei Wang, and Xiao Liu for reporting this issue. Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5154) (cherry picked from commit 972c87dfc7e765bd28a4964519c362f0d3a58ca4)
2018-01-30Make sure we check an incoming reneg ClientHello in DTLSMatt Caswell
In TLS we have a check to make sure an incoming reneg ClientHello is acceptable. The equivalent check is missing in the DTLS code. This means that if a client does not signal the ability to handle secure reneg in the initial handshake, then a subsequent reneg handshake should be rejected by the server. In the DTLS case the reneg was being allowed if the the 2nd ClientHello had a renegotiation_info extension. This is incorrect. While incorrect, this does not represent a security issue because if the renegotiation_info extension is present in the second ClientHello it also has to be *correct*. Therefore this will only work if both the client and server believe they are renegotiating, and both know the previous Finished result. This is not the case in an insecure rengotiation attack. I have also tidied up the check in the TLS code and given a better check for determining whether we are renegotiating or not. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5192)
2018-01-24Add warnings to thread doc.Rich Salz
Thanks to Yun Jiang for pointing this out. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5164)
2018-01-24Fix BN docRich Salz
Backport from https://github.com/openssl/openssl/pull/5141 Reviewed-by: Viktor Dukhovni <viktor@openssl.org> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/5151) (cherry picked from commit 8b2124aba357a928fec6d7a3bafe186fc83080fc)
2018-01-24Fix error-path memory leak in asn_mime.cTodd Short
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5142) (cherry picked from commit a26dd465b21d8def440c16b6bd90227b03e12e02)
2018-01-24Changed OPENSSL_gmtime so macOS uses threadsafe gmtime_r instead of gmtime.Jonathan Scalise
Updated uses of gmtime to now call OPENSSL_gmtime instead. Used similar preprocessor logic to make sure localtime_r is called instead of localtime when applicable. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3609)
2018-01-24Cleanup ctxs if callback fail to retrieve session ticketJ Mohan Rao Arisankala
If tlsext ticket decrypt callback returns error, cleanup ctxs Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3273)
2018-01-23fix several typos in README.gostCristian Stoica
CLA: trivial Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com> Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1449)
2018-01-23merge two mutual exclusive #ifdefs to improve clarityCristian Stoica
CLA: trivial Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com> Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1449)
2018-01-22Don't crash on a missing Subject in index.txtMatt Caswell
An index.txt entry which has an empty Subject name field will cause ca to crash. Therefore check it when we load it to make sure its not empty. Fixes #5109 Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5115)
2018-01-22Don't allow an empty Subject when creating a CertificateMatt Caswell
Misconfiguration (e.g. an empty policy section in the config file) can lead to an empty Subject. Since certificates should have unique Subjects this should not be allowed. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5115)
2018-01-21Update the license end yearRichard Levitte
Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5121) (cherry picked from commit 7c24f9d21cddd2bb30167153b05168fee7e3cf0b)
2018-01-16Revert BN_copy() flag copy semantics changeMatt Caswell
Commit 9f9442918a changed the semantics of BN_copy() to additionally copy the BN_FLG_CONSTTIME flag if it is set. This turns out to be ill advised as it has unintended consequences. For example calling BN_mod_inverse_no_branch() can sometimes return a result with the flag set and sometimes not as a result. This can lead to later failures if we go down code branches that do not support constant time, but check for the presence of the flag. The original commit was made due to an issue in BN_MOD_CTX_set(). The original PR fixed the problem in that function, but it was changed in review to fix it in BN_copy() instead. The solution seems to be to revert the BN_copy() change and go back to the originally proposed way. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/5080) (cherry picked from commit 7d461736f7bd3af3c2f266f8541034ecf6f41ed9)
2018-01-09Tolerate DTLS alerts with an incorrect version numberMatt Caswell
In the case of a protocol version alert being sent by a peer the record version number may not be what we are expecting. In DTLS records with an unexpected version number are silently discarded. This probably isn't appropriate for alerts, so we tolerate a mismatch in the minor version number. This resolves an issue reported on openssl-users where an OpenSSL server chose DTLS1.0 but the client was DTLS1.2 only and sent a protocol_version alert with a 1.2 record number. This was silently ignored by the server. Reviewed-by: Viktor Dukhovni <viktor@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5019)