Commit Graph

12471 Commits

Author SHA1 Message Date
Dr. Stephen Henson e93f7d9c98 Use correct signature algorithm list when sending or checking.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2298)
2017-01-26 17:56:31 +00:00
Matt Caswell f24fcf2912 Prepare for 1.0.2l-dev
Reviewed-by: Richard Levitte <levitte@openssl.org>
2017-01-26 13:23:37 +00:00
Matt Caswell 081314d077 Prepare for 1.0.2k release
Reviewed-by: Richard Levitte <levitte@openssl.org>
2017-01-26 13:22:36 +00:00
Matt Caswell 06f87e9685 Update CHANGES and NEWS for new release
Reviewed-by: Richard Levitte <levitte@openssl.org>
2017-01-26 11:02:44 +00:00
Richard Levitte 918d8eadb3 Better check of DH parameters in TLS data
When the client reads DH parameters from the TLS stream, we only
checked that they all are non-zero.  This change updates the check
as follows:

    check that p is odd
    check that 1 < g < p - 1

Reviewed-by: Matt Caswell <matt@openssl.org>
2017-01-26 10:56:29 +00:00
Andy Polyakov 760d04342a bn/asm/x86_64-mont5.pl: fix carry bug in bn_sqr8x_internal.
CVE-2017-3732

Reviewed-by: Rich Salz <rsalz@openssl.org>
2017-01-26 10:55:03 +00:00
Andy Polyakov 51d0090436 crypto/evp: harden RC4_MD5 cipher.
Originally a crash in 32-bit build was reported CHACHA20-POLY1305
cipher. The crash is triggered by truncated packet and is result
of excessive hashing to the edge of accessible memory (or bogus
MAC value is produced if x86 MD5 assembly module is involved). Since
hash operation is read-only it is not considered to be exploitable
beyond a DoS condition.

Thanks to Robert Święcki for report.

CVE-2017-3731

Reviewed-by: Rich Salz <rsalz@openssl.org>
2017-01-26 10:55:03 +00:00
Bernd Edlinger 8957adda16 Fix error handling in compute_key, BN_CTX_get can return NULL
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2132)
(cherry picked from commit 7928ee4d68)
2017-01-24 18:27:10 +01:00
Bernd Edlinger cb00d4ff17 Fix a ssl session leak due to OOM in lh_SSL_SESSION_insert
- s == NULL can mean c is a new session *or* lh_insert was
  unable to create a hash entry.
- use lh_SSL_SESSION_retrieve to check for this error condition.
- If it happens simply remove the extra reference again.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2138)
(cherry picked from commit 38088ce993)
2017-01-24 15:07:33 +01:00
Matt Caswell e203f493f6 Fix SSL_VERIFY_CLIENT_ONCE
The flag SSL_VERIFY_CLIENT_ONCE is documented as follows:

  B<Server mode:> only request a client certificate on the initial TLS/SSL
  handshake. Do not ask for a client certificate again in case of a
  renegotiation. This flag must be used together with SSL_VERIFY_PEER.

  B<Client mode:> ignored

But the implementation actually did nothing. After the server sends its
ServerKeyExchange message, the code was checking s->session->peer to see if
it is NULL. If it was set then it did not ask for another client
certificate. However s->session->peer will only be set in the event of a
resumption, but a ServerKeyExchange message is only sent in the event of a
full handshake (i.e. no resumption).

The documentation suggests that the original intention was for this to
have an effect on renegotiation, and resumption doesn't come into it.

The fix is to properly check for renegotiation, not whether there is already
a client certificate in the session.

As far as I can tell this has been broken for a *long* time.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1984)
2017-01-23 14:13:14 +00:00
Rich Salz 149e98dc5f Add missing va_end
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2267)
2017-01-20 13:37:52 -05:00
Richard Levitte 16f013fa70 Fix DSA parameter generation control error
When setting the digest parameter for DSA parameter generation, the
signature MD was set instead of the parameter generation one.
Fortunately, that's also the one that was used for parameter
generation, but it ultimately meant the parameter generator MD and the
signature MD would always be the same.

Fixes github issue #2016

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2250)
(cherry picked from commit 8a05c4d3b5)
2017-01-20 08:30:41 +01:00
FdaSilvaYY 52b703f81c Clean one unused variable, plus an useless one.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1906)
(cherry picked from commit 2191dc846a)
2017-01-18 15:24:23 +01:00
Rich Salz 1f234f7135 GH1986: Document -header flag.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2209)
2017-01-10 20:11:08 -05:00
Bernd Edlinger 0ecb682a67 Fix error handling in SSL_CTX_new
Dont free rbuf_freelist here, SSL_CTX_free will do that.

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #2129
2017-01-10 22:34:17 +01:00
Bernd Edlinger 2045c58116 Fix a memory leak in RSA_padding_add_PKCS1_OAEP_mgf1
Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matt Caswell <matt@openssl.org>
GH: #2140
(cherry picked from commit c6d215e0d2)
2017-01-09 22:36:43 +01:00
Markus Triska 18b8431f3b replace "will lookup up" by "will look up"
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
CLA: trivial
(Merged from https://github.com/openssl/openssl/pull/2145)
(cherry picked from commit 67adf0a7c2)
2016-12-29 02:18:45 +01:00
Richard Levitte 58c81e7e0b Reformat M_check_autoarg to match our coding style
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2121)
(cherry picked from commit 2629440d42)
2016-12-20 23:22:39 +01:00
Richard Levitte 222333cf01 M_check_autoarg: sanity check the key
For now, checking that the size is non-zero will suffice.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2120)
(cherry picked from commit d7c8f142ea)
2016-12-20 23:03:45 +01:00
Finn Hakansson 3fb9f875e7 Fix typo.
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
CLA: trivial
(Merged from https://github.com/openssl/openssl/pull/2086)
(cherry picked from commit 0b742f93ea)

(cherry picked from commit f7a2da1d58)
2016-12-18 21:48:46 +01:00
russor 5bbedd3cc1 zero pad DHE public key in ServerKeyExchange message for interop
Some versions of the Microsoft TLS stack have problems when the DHE public key
is encoded with fewer bytes than the DHE prime. (Backported from master)

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1350)
2016-12-14 12:52:44 -05:00
Richard Levitte 70705b291c Fix ssl_cert_dup: change one 'return NULL' to 'goto err'
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2082)
2016-12-14 14:19:01 +01:00
Richard Levitte 3b584efe91 Make 'err' lable in ssl_cert_dup unconditional
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2082)
2016-12-14 14:19:01 +01:00
Benjamin Kaduk 292bb56846 Fix a bug in clienthello processing
- Always process ALPN (previously there was an early return in the
  certificate status handling)

1.0.2 did not have the double-alert issue from master, but it seems
cleanest to pull in the structural change to alert handling anyway
and jump to f_err instead of err to send the alert in the caller.

(cherry picked from commit 70c22888c1)

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
2016-12-13 14:41:20 +00:00
Andy Polyakov 7624a318ce perlasm/x86_64-xlate.pl: refine sign extension in ea package.
$1<<32>>32 worked fine with either 32- or 64-bit perl for a good while,
relying on quirk that [pure] 32-bit perl performed it as $1<<0>>0. But
this apparently changed in some version past minimally required 5.10,
and operation result became 0. Yet, it went unnoticed for another while,
because most perl package providers configure their packages with
-Duse64bitint option.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 82e089308b)
2016-12-12 11:03:30 +01:00
Richard Levitte 10a50374bf UI_OpenSSL()'s session opener fails on MacOS X
If on a non-tty stdin, TTY_get() will fail with errno == ENODEV.
We didn't catch that.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2039)
(cherry picked from commit c901bccec6)
2016-12-10 10:22:10 +01:00
Richard Levitte 78a3e80a31 VMS UI_OpenSSL: if the TT device isn't a tty, flag instead of error
On all platforms, if the controlling tty isn't an actual tty, this is
flagged by setting is_a_tty to zero...  except on VMS, where this was
treated as an error.  Change this to behave like the other platforms.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2064)
2016-12-10 10:19:15 +01:00
Dr. Stephen Henson fecd4c2655 Check input length to pkey_rsa_verify()
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2065)
(cherry picked from commit 71bbc79b7d)

Conflicts:
	crypto/rsa/rsa_err.c
	include/openssl/rsa.h
2016-12-10 02:53:52 +00:00
Richard Levitte 5ae285ecb5 Remove extra bang
A bang (!) slipped through in the recent UI cleanup

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2051)
(cherry picked from commit 949320c567)
2016-12-08 21:42:23 +01:00
Richard Levitte 59ba83c989 UI code style cleanup
Mostly condition check changes.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2047)
(cherry picked from commit 120fb9e436)
2016-12-08 19:38:24 +01:00
Matt Caswell 748a2d94c0 Revert "Fix heartbeat_test"
Commit fa4c37457 got reverted, so this one also needs to be reverted as
a result.

This reverts commit ad69a30323.

Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-11-29 09:54:58 +00:00
Vitezslav Cizek be3a7ddef6 apps/speed.c: Fix crash when config loading fails
Move rsa_key initialization in front of load_config().
If loading the config fails, rsa_key isn't initialized and may
cause invalid free() in the end: cleanup.
Remove superfluous memset.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-11-26 20:09:00 -05:00
Andy Polyakov c477f8e716 INSTALL: clarify 386 and no-sse2 options.
This is 1.0.2-specific reformat of 5ae5dc9661.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-11-26 22:24:10 +01:00
Andy Polyakov f47201b327 modes/ctr128.c: fix false carry in counter increment procedure.
GH issue #1916 affects only big-endian platforms. TLS is not affected,
because TLS fragment is never big enough.

Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 76f572ed04)
2016-11-25 17:24:18 +01:00
Richard Levitte c4c71650bb Clarify what X509_NAME_online does with the given buffer and size
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1980)
(cherry picked from commit 19cb71ef6e)

(cherry picked from commit 793d9b7903)
2016-11-23 00:37:53 +01:00
Kurt Roeckx 31b430700a Make SSL_read and SSL_write return the old behaviour and document it.
Backport of beacb0f0c1, revert of
fa4c374572

Fixes: #1903

Reviewed-by: Matt Caswell <matt@openssl.org>

GH: #1967
2016-11-21 22:00:43 +01:00
Beat Bolli 09b894b512 Use consistent variable names
In the X509_NAME_get_index_by_NID.pod example, the initialized variable is called
"loc", but the one used in the for loop is called "lastpos". Make the names match.

CLA: trivial
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1949)

(cherry picked from commit 4b9c2669f3)
2016-11-18 07:35:01 -05:00
Orgad Shaneh f4ef1c5348 domd: Preserve Makefile time when it is unchanged
also on systems with makedepend that does not report its version, or that
its version does not contain "gcc" or "clang".

Some versions of makedepends just overwrite Makefile. Preserve the
timestamp of the previous Makefile, and copy it back if it is unchanged.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1370)
2016-11-16 09:08:27 +02:00
Orgad Shaneh 7a9d7128d8 mklink: Do not needlessly overwrite linked files...
... on systems with symlinks.

Creating or overwriting a symlink sets the file ctime to the current time.
This causes needless rebuilds because the time of all the headers is
changed, and apparently make considers the link's time rather than the
time of the target.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1370)
2016-11-16 09:08:27 +02:00
Orgad Shaneh 62f16de2d1 domd: Do not needlessly overwrite Makefiles
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1370)
2016-11-16 09:08:27 +02:00
Orgad Shaneh 22cc44d6b6 mklink: Do not needlessly overwrite linked files...
... on systems without symlinks.

Overwriting all the headers on each Configure causes full rebuild even if
nothing has changed.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1370)
2016-11-16 09:08:27 +02:00
Orgad Shaneh ecc955157a Configure: Improve incremental build time
When Makefile/opensslconf.h is unchanged, don't write it at all.

Currently every time Configure is executed, these files are overwritten.
Makefile leads to regeneration of buildinf.h, and opensslconf.h is itself
a central header.

As a result, Configure triggers full rebuild, even if nothing is changed.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1370)
2016-11-16 09:08:27 +02:00
Rich Salz 8ac70bef69 Check return value of some BN functions.
Factorise multiple bn_get_top(group->field) calls
Add missing checks on some conditional BN_copy return value
Add missing checks on some BN_copy return value
Add missing checks on a few bn_wexpand return value

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1626)
(cherry picked from commit 78e09b53a4)
2016-11-15 19:16:13 -05:00
Matthias Kraft 3201a1d681 Solution proposal for issue #1647.
Avoid a memory alignment issue.

Signed-off-by: Matthias Kraft <Matthias.Kraft@softwareag.com>
CLA: trivial
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1650)
2016-11-12 22:22:21 -05:00
Matt Caswell 19e1de548e Update CHANGES and NEWS
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-11-10 12:18:21 +00:00
Andy Polyakov 57c4b9f6a2 bn/asm/x86_64-mont.pl: fix for CVE-2016-7055 (Low severity).
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 2fac86d9ab)
2016-11-10 10:38:15 +00:00
Andy Polyakov c210840d06 Makefile.org: clear APPS environment variable.
Build failure was reported in GH#1818 if APPS environment was defined.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1864)
2016-11-08 11:55:21 +01:00
Rich Salz 95873c51ed Missed a mention of RT
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1849)
(cherry picked from commit 1e62cc12f3)
2016-11-04 10:44:56 -04:00
Matt Caswell 563a34e18e Add a CHANGES entry for the unrecognised record type change
Reviewed-by: Tim Hudson <tjh@openssl.org>
2016-11-02 22:27:22 +00:00
Matt Caswell f118539218 Fail if an unrecognised record type is received
TLS1.0 and TLS1.1 say you SHOULD ignore unrecognised record types, but
TLS 1.2 says you MUST send an unexpected message alert. We swap to the
TLS 1.2 behaviour for all protocol versions to prevent issues where no
progress is being made and the peer continually sends unrecognised record
types, using up resources processing them.

Issue reported by 郭志攀

Reviewed-by: Tim Hudson <tjh@openssl.org>
2016-11-02 22:26:17 +00:00