4
0
mirror of https://github.com/QuasarApp/openssl.git synced 2025-05-12 01:19:41 +00:00

12948 Commits

Author SHA1 Message Date
Richard Levitte
ec36b32985 Prepare for 1.0.2t-dev
Reviewed-by: Matt Caswell <matt@openssl.org>
2019-05-28 14:56:42 +02:00
Richard Levitte
cf9143f945 Prepare for 1.0.2s release
Reviewed-by: Matt Caswell <matt@openssl.org>
OpenSSL_1_0_2s
2019-05-28 14:56:29 +02:00
Richard Levitte
66c236c440 Update copyright year
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9032)
2019-05-28 14:41:38 +02:00
Richard Levitte
bb36ec5f5b Add CHANGES for 1.0.2s
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9019)
2019-05-28 10:07:44 +02:00
Kurt Roeckx
0f283c9a66 Change default RSA, DSA and DH size to 2048 bit
Fixes: 

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Richard Levitte <levitte@openssl.org>
GH: 
(cherry picked from commit 70b0b977f73cd70e17538af3095d18e0cf59132e)
2019-05-21 16:58:42 +02:00
Emilia Kasper
cea83f9f78 RT 4242: reject invalid EC point coordinates
This is a backport of commit 1e2012b7 to 1.0.2. This hardening change
was made to 1.1.0 but was not backported to 1.0.2. Recent CVEs in user
applications have shown this additional hardening in 1.0.2 would be
beneficial.

E.g. see the patch for CVE-2019-9498
https://w1.fi/security/2019-4/0011-EAP-pwd-server-Verify-received-scalar-and-element.patch

and CVE-2019-9499
https://w1.fi/security/2019-4/0013-EAP-pwd-client-Verify-received-scalar-and-element.patch

The original commit had this description:

We already test in EC_POINT_oct2point that points are on the curve. To
be on the safe side, move this check to
EC_POINT_set_affine_coordinates_* so as to also check point coordinates
received through some other method.

We do not check projective coordinates, though, as
- it's unlikely that applications would be receiving this primarily
  internal representation from untrusted sources, and
- it's possible that the projective setters are used in a setting where
  performance matters.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8750)
2019-04-25 13:09:22 +01:00
Dr. Matthias St. Pierre
f937540ec4 Add FIPS support for Android Arm 64-bit
Fixes 
Fixes 

In commit 6db8e3bdc9e, support for Android Arm 64-bit was added to
the OpenSSL FIPS Object Module. For some reason, the corresponding
target 'android64-aarch64' was missing OpenSSL 1.0.2, whence it
could not be built with FIPS support on Android Arm 64-bit.
This commit adds the missing target.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8713)
2019-04-17 01:58:26 +02:00
Shane Lontis
d3299a33e5 fixed public range check in ec_GF2m_simple_oct2point
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/8607)

(cherry picked from commit cad8347be23c5e0c0d9eea02d090d42daf2dd7a9)
2019-03-30 15:12:07 +01:00
Bernd Edlinger
c3e7beab2a Modify the RSA_private_decrypt functions to check the padding in
constant time with a memory access pattern that does not depend
on secret information.

[extended tests]

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/8543)

(cherry picked from commit 9c0cf214e7836eb5aaf1ea5d3cbf6720533f86b5)
2019-03-22 14:48:37 +01:00
Bernd Edlinger
d284d27770 Make err_clear_constant_time really constant time
[extended tests]

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/8558)
2019-03-22 14:39:02 +01:00
Bernd Edlinger
94eb7d07c0 Clear the point S before freeing in ec_mul_consttime
The secret point R can be recovered from S using the equation R = S - P.
The X and Z coordinates should be sufficient for that.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/8505)

(cherry picked from commit 502b871ad4eacc96a31f89d9a9470ca2858da998)
2019-03-18 22:50:08 +01:00
Bernd Edlinger
dbf71ae457 Clear the secret point in ecdh_compute_key
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/8502)
2019-03-17 10:02:07 +01:00
Bernd Edlinger
6555a8941b Fix memory overrun in rsa padding check functions
Backported from d7f5e5ae6d5

Fixes  and 

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/8438)
2019-03-07 23:36:55 +01:00
Matt Caswell
d5e37fc871 Avoid an underflow in ecp_nistp521.c
The function felem_diff_128_64 in ecp_nistp521.c substracts the number |in|
from |out| mod p. In order to avoid underflow it first adds 32p mod p
(which is equivalent to 0 mod p) to |out|. The comments and variable naming
suggest that the original author intended to add 64p mod p. In fact it
has been shown that with certain unusual co-ordinates it is possible to
cause an underflow in this function when only adding 32p mod p while
performing a point double operation. By changing this to 64p mod p the
underflow is avoided.

It turns out to be quite difficult to construct points that satisfy the
underflow criteria although this has been done and the underflow
demonstrated. However none of these points are actually on the curve.
Finding points that satisfy the underflow criteria and are also *on* the
curve is considered significantly more difficult. For this reason we do
not believe that this issue is currently practically exploitable and
therefore no CVE has been assigned.

This only impacts builds using the enable-ec_nistp_64_gcc_128 Configure
option.

With thanks to Bo-Yin Yang, Billy Brumley and Dr Liu for their significant
help in investigating this issue.

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/8405)

(cherry picked from commit 13fbce17fc9f02e2401fc3868f3f8e02d6647e5f)
2019-03-07 14:53:28 +00:00
Matt Caswell
56ff0f6434 Prepare for 1.0.2s-dev
Reviewed-by: Richard Levitte <levitte@openssl.org>
2019-02-26 14:21:45 +00:00
Matt Caswell
b34cf4eb61 Prepare for 1.0.2r release
Reviewed-by: Richard Levitte <levitte@openssl.org>
OpenSSL_1_0_2r
2019-02-26 14:20:55 +00:00
Matt Caswell
28c43df928 Updates CHANGES and NEWS for the new release
Reviewed-by: Richard Levitte <levitte@openssl.org>
2019-02-26 14:13:05 +00:00
Matt Caswell
48c8bcf5bc Clarify that SSL_shutdown() must not be called after a fatal error
Follow on from CVE-2019-1559

Reviewed-by: Richard Levitte <levitte@openssl.org>
2019-02-26 14:13:05 +00:00
Matt Caswell
e9bbefbf0f Go into the error state if a fatal alert is sent or received
If an application calls SSL_shutdown after a fatal alert has occured and
then behaves different based on error codes from that function then the
application may be vulnerable to a padding oracle.

CVE-2019-1559

Reviewed-by: Richard Levitte <levitte@openssl.org>
2019-02-26 14:13:05 +00:00
Matt Caswell
c81f16952b Update copyright year
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8348)
2019-02-26 14:11:34 +00:00
Matt Caswell
b250f2a431 Ensure bn_cmp_words can handle the case where n == 0
Thanks to David Benjamin who reported this, performed the analysis and
suggested the patch. I have incorporated some of his analysis in the
comments below.

This issue can cause an out-of-bounds read. It is believed that this was
not reachable until the recent "fixed top" changes. Analysis has so far
only identified one code path that can encounter this - although it is
possible that others may be found. The one code path only impacts 1.0.2 in
certain builds. The fuzzer found a path in RSA where iqmp is too large. If
the input is all zeros, the RSA CRT logic will multiply a padded zero by
iqmp. Two mitigating factors:

- Private keys which trip this are invalid (iqmp is not reduced mod p).
Only systems which take untrusted private keys care.
- In OpenSSL 1.1.x, there is a check which rejects the oversize iqmp,
so the bug is only reproducible in 1.0.2 so far.

Fortunately, the bug appears to be relatively harmless. The consequences of
bn_cmp_word's misbehavior are:

- OpenSSL may crash if the buffers are page-aligned and the previous page is
non-existent.
- OpenSSL will incorrectly treat two BN_ULONG buffers as not equal when they
are equal.
- Side channel concerns.

The first is indeed a concern and is a DoS bug. The second is fine in this
context. bn_cmp_word and bn_cmp_part_words are used to compute abs(a0 - a1)
in Karatsuba. If a0 = a1, it does not matter whether we use a0 - a1 or
a1 - a0. The third would be worth thinking about, but it is overshadowed
by the entire Karatsuba implementation not being constant time.

Due to the difficulty of tripping this and the low impact no CVE is felt
necessary for this issue.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8326)

(cherry picked from commit 576129cd72ae054d246221f111aabf42b9c6d76d)
2019-02-25 16:37:52 +00:00
Nicola Tuveri
9acdddf1ac Clear BN_FLG_CONSTTIME on BN_CTX_get()
(cherry picked from commit c8147d37ccaaf28c430d3fb45a14af36597e48b8)

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8295)
2019-02-20 23:02:09 +02:00
Nicola Tuveri
d769ce09b6 Test for constant-time flag leakage in BN_CTX
This commit adds a simple unit test to make sure that the constant-time
flag does not "leak" among BN_CTX frames:

- test_ctx_consttime_flag() initializes (and later frees before
  returning) a BN_CTX object, then it calls in sequence
  test_ctx_set_ct_flag() and test_ctx_check_ct_flag() using the same
  BN_CTX object.
- test_ctx_set_ct_flag() starts a frame in the given BN_CTX and sets the
  BN_FLG_CONSTTIME flag on some of the BIGNUMs obtained from the frame
  before ending it.
- test_ctx_check_ct_flag() then starts a new frame and gets a number of
  BIGNUMs from it. In absence of leaks, none of the BIGNUMs in the new
  frame should have BN_FLG_CONSTTIME set.

In actual BN_CTX usage inside libcrypto the leak could happen at any
depth level in the BN_CTX stack, with varying results depending on the
patterns of sibling trees of nested function calls sharing the same
BN_CTX object, and the effect of unintended BN_FLG_CONSTTIME on the
called BN_* functions.

This simple unit test abstracts away this complexity and verifies that
the leak does not happen between two sibling functions sharing the same
BN_CTX object at the same level of nesting.

(manually cherry picked from commit fe16ae5f95fa86ddb049a8d1e2caee0b80b32282)

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8295)
2019-02-20 22:57:19 +02:00
Richard Levitte
e30dfbebe7 Move stray POD file into the fold
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/8273)
2019-02-18 21:47:33 +01:00
Corinna Vinschen
3077dd4058 cygwin: drop explicit O_TEXT
Cygwin binaries should not enforce text mode these days, just
use text mode if the underlying mount point requests it

CLA: trivial

Signed-off-by: Corinna Vinschen <vinschen@redhat.com>

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8249)
2019-02-15 17:44:28 +01:00
Richard Levitte
fff469b269 test/evp_test.c: use EVP_DecryptUpdate when decrypting, even for AAD
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/7856)
2019-01-15 18:32:36 +01:00
Richard Levitte
7ab24d9508 make update
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/7856)
2019-01-15 18:32:36 +01:00
Richard Levitte
cfa9a7cd53 Prevent calling decryption in an encryption context and vice versa
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/7856)
2019-01-15 18:32:36 +01:00
Matt Caswell
eed51aa827 make update
Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
(Merged from https://github.com/openssl/openssl/pull/7974)
2019-01-03 09:33:25 +00:00
Richard Levitte
668d643eab Makefile.org: prevent .bak files to become part of the tarball
Fixes 

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7910)
2018-12-15 11:12:45 +01:00
Dr. Matthias St. Pierre
ab061e75b7 doc/man3: remove copy&paste leftover
Fixes 

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7884)

(cherry picked from commit 00eb879f74971e3c048286ef44f6f544676f90d7)
2018-12-12 20:05:14 +01:00
Tobias Stoeckmann
4960e84b7b Fixed typo (vi leftover).
There was a trailing :w at a line, which didn't make sense in context
of the sentence/styling. Removed it, because I think it's a leftover
vi command.

CLA: trivial
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7875)

(cherry picked from commit 143b631639f95822e5e00768254fa35c787f6396)
2018-12-12 10:41:32 +01:00
Richard Levitte
e42e531846 Make EVP_PKEY_asn1_add0() stricter about its input
It turns out that the strictness that was implemented in
EVP_PKEY_asn1_new() (see Github openssl/openssl#6880) was badly placed
for some usages, and that it's better to do this check only when the
method is getting registered.

Fixes 

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7847)

(cherry picked from commit a86003162138031137727147c9b642d99db434b1)
2018-12-07 12:06:04 +01:00
Andy Polyakov
110ef88b99 rsa/rsa_ssl.c: make RSA_padding_check_SSLv23 constant-time.
Copy of RSA_padding_check_PKCS1_type_2 with a twist that rejects padding
if nul delimiter is preceded by 8 consecutive 0x03 bytes.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 603221407ddc6404f8c417c6beadebf84449074c)

Resolved conflicts:
	crypto/rsa/rsa_ssl.c

(Merged from https://github.com/openssl/openssl/pull/7737)
2018-12-06 11:18:35 +00:00
Andy Polyakov
b29b91bc7e rsa/rsa_oaep.c: remove memcpy calls from RSA_padding_check_PKCS1_OAEP.
And make RSAErr call unconditional.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 75f5e944be97f28867e7c489823c889d89d0bd06)

Resolved conflicts:
	crypto/rsa/rsa_oaep.c

(Merged from https://github.com/openssl/openssl/pull/7737)
2018-12-06 11:18:35 +00:00
Andy Polyakov
47f8fba643 rsa/rsa_pk1.c: remove memcpy calls from RSA_padding_check_PKCS1_type_2.
And make RSAErr call unconditional.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit e875b0cf2f10bf2adf73e0c2ec81428290f4660c)

Resolved conflicts:
	crypto/rsa/rsa_pk1.c

(Merged from https://github.com/openssl/openssl/pull/7737)
2018-12-06 11:18:35 +00:00
Andy Polyakov
3b776fd785 rsa/rsa_eay.c: make RSAerr call in rsa_ossl_private_decrypt unconditional.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 89072e0c2a483f2ad678e723e112712567b0ceb1)

(Merged from https://github.com/openssl/openssl/pull/7737)
2018-12-06 11:18:35 +00:00
Andy Polyakov
8db50d6daf err/err.c: add err_clear_last_constant_time.
Expected usage pattern is to unconditionally set error and then
wipe it if there was no actual error.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit f658a3b64d8750642f4975090740865f770c2a1b)

Resolved conflicts:
	crypto/err/err.c
	crypto/constant_time_locl.h

(Merged from https://github.com/openssl/openssl/pull/7737)
2018-12-06 11:18:35 +00:00
Richard Levitte
02354431e2 Docs fixup: some man3 pages had unindented code in SYNOPSIS
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/7744)

(cherry picked from commit 7b4a3515a4ddb567d48000e61d7cb640d0c5f261)
2018-12-03 11:50:27 +01:00
David Woodhouse
63262bd276 Honour mandatory digest on private key in tls1_process_sigalgs()
If the private key says it can only support one specific digest, then
don't ask it to perform a different one.

Fixes: 

(cherry picked from commit 2d263a4a73f852005b16359873475d48755999ad
 and reworked for 1.0.2)

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/7610)
2018-11-24 09:01:07 +02:00
David Woodhouse
cf68eb3687 Stop marking default digest for EC keys as mandatory
ASN1_PKEY_CTRL_DEFAULT_MD_NID is documented to return 2 for a mandatory
digest algorithm, when the key can't support any others. That isn't true
here, so return 1 instead.

Partially fixes 

(cherry picked from commit eb7eb1378cd15c4652884b3701d4c0ef27b5b8a6)

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/7610)
2018-11-24 09:00:25 +02:00
Andy Polyakov
23bfb5b556 rsa/rsa_eay.c: cache MONT_CTX for public modulus earlier.
Blinding is performed more efficiently and securely if MONT_CTX for public
modulus is available by the time blinding parameter are instantiated. So
make sure it's the case.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>

(manually cherry picked from commit 2cc3f68cde77af23c61fbad65470602ee86f2575)

(Merged from https://github.com/openssl/openssl/pull/7586)
2018-11-23 13:05:16 +01:00
Richard Levitte
8bfde2578c VMS: ensure x509_time_test is built
A lacking DCL variable to indicate where it's located was missing.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7685)
2018-11-22 11:05:31 +01:00
Matt Caswell
49d07eb3cc Prepare for 1.0.2r-dev
Reviewed-by: Richard Levitte <levitte@openssl.org>
2018-11-20 13:46:11 +00:00
Matt Caswell
5707219a6a Prepare for 1.0.2q release
Reviewed-by: Richard Levitte <levitte@openssl.org>
OpenSSL_1_0_2q
2018-11-20 13:45:20 +00:00
Matt Caswell
d98ff540df make update
Reviewed-by: Richard Levitte <levitte@openssl.org>
2018-11-20 13:45:20 +00:00
Matt Caswell
8ea167207d Update copyright year
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7671)
2018-11-20 13:29:53 +00:00
Matt Caswell
548cce63dd Update CHANGES and NEWS for new release
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/7667)
2018-11-20 11:57:17 +00:00
Richard Levitte
d88ff8962c VMS: ensure crypto/getenv.c is included in the build
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7665)
2018-11-20 11:47:40 +00:00
Vitezslav Cizek
84b4759dbd DSA: Check for sanity of input parameters
dsa_builtin_paramgen2 expects the L parameter to be greater than N,
otherwise the generation will get stuck in an infinite loop.

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>

(cherry picked from commit 3afd38b277a806b901e039c6ad281c5e5c97ef67)

(Merged from https://github.com/openssl/openssl/pull/7493)
2018-11-14 13:09:41 +01:00