oweals/openssl.git
6 years agoOpenSSL-II style for emacs: don't indent because of extern block
Richard Levitte [Fri, 22 Jun 2018 07:33:29 +0000 (09:33 +0200)]
OpenSSL-II style for emacs: don't indent because of extern block

We don't want an indentation step inside a 'extern "C" {' .. '}'
block.  Apparently, cc-mode has a c-offsets-alist keyword to allow
exactly this.

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/6557)

6 years agoecdsa_ossl: address coverity nit
Benjamin Kaduk [Mon, 18 Jun 2018 01:00:02 +0000 (20:00 -0500)]
ecdsa_ossl: address coverity nit

BN_CTX_end() does not handle NULL input, so we must manually check
before calling from the cleanup handler.

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

6 years agoFix negative test result in sm2 test
Bernd Edlinger [Thu, 21 Jun 2018 06:07:48 +0000 (08:07 +0200)]
Fix negative test result in sm2 test

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/6548)

6 years agosha/asm/sha{256|512}-armv4.pl: harmonize thumb2 support with the rest.
Andy Polyakov [Thu, 21 Jun 2018 11:52:04 +0000 (13:52 +0200)]
sha/asm/sha{256|512}-armv4.pl: harmonize thumb2 support with the rest.

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agoAdd a high level note about the various SCA mitigations
Matt Caswell [Thu, 21 Jun 2018 09:37:54 +0000 (10:37 +0100)]
Add a high level note about the various SCA mitigations

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

6 years agoRemove __cplusplus preamble from internal headers
Nicola Tuveri [Thu, 21 Jun 2018 20:24:34 +0000 (23:24 +0300)]
Remove __cplusplus preamble from internal headers

These headers are internal and never exposed to a cpp compiler, hence no
need for the preamble.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/6554)

6 years agoConfigure,util/shlib_wrap.sh: harmonize -Wl and -rpath handling.
Andy Polyakov [Mon, 18 Jun 2018 17:08:50 +0000 (19:08 +0200)]
Configure,util/shlib_wrap.sh: harmonize -Wl and -rpath handling.

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

6 years agoCHANGES: mention AIX shared library support overhaul.
Andy Polyakov [Tue, 19 Jun 2018 16:25:19 +0000 (18:25 +0200)]
CHANGES: mention AIX shared library support overhaul.

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

6 years agorecipes/90-test_shlibload.t: disable tests on AIX till further notice.
Andy Polyakov [Fri, 15 Jun 2018 13:41:07 +0000 (15:41 +0200)]
recipes/90-test_shlibload.t: disable tests on AIX till further notice.

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

6 years agoConfigurations/10-main.conf: always pass -bsrv4 to AIX linker.
Andy Polyakov [Fri, 15 Jun 2018 13:24:14 +0000 (15:24 +0200)]
Configurations/10-main.conf: always pass -bsrv4 to AIX linker.

This makes AIX build procedure behave more like e.g. Solaris. Most
notably this makes it possible to pass -Wl,-R,'$(LIBRPATH)' at config
time to embed installation destination as library search path into
openssl binary. This doesn't imply that other applications have to be
linked with -bsvr4, they are free to choose whatever appropriate for
given circumstances.

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

6 years agoConfigurations/unix-Makefile.tmpl: switch to "natural" AIX shared libraries.
Andy Polyakov [Thu, 14 Jun 2018 09:45:15 +0000 (11:45 +0200)]
Configurations/unix-Makefile.tmpl: switch to "natural" AIX shared libraries.

AIX treats its shared libraries in unique manner, by placing multiple
shared objects of different versions and bitnesses, into .a file.
So far we have been naively linking with version-less libcrypto|ssl.so,
which poses long-term maintenance problems. One could choose to link
straight with libcrypto.so.X.Y [or libcrypto.X.Y.so], but it would be
inconsistent with the way AIX [or Unix] does things.

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

6 years agoConfigure: allow some file extensions to be overridden by target config.
Andy Polyakov [Thu, 14 Jun 2018 20:07:48 +0000 (22:07 +0200)]
Configure: allow some file extensions to be overridden by target config.

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

6 years agoenable-ec_nistp_64_gcc_128: Fix function prototype warning [-Wstrict-prototypes]
Nicola Tuveri [Thu, 21 Jun 2018 21:59:58 +0000 (00:59 +0300)]
enable-ec_nistp_64_gcc_128: Fix function prototype warning [-Wstrict-prototypes]

Fix prototype warnings triggered by -Wstrict-prototypes when configuring
with `enable-ec_nistp_64_gcc_128`

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/6556)

6 years agotestutil/driver.c: Fix function prototype warning [-Wstrict-prototypes]
Dr. Matthias St. Pierre [Thu, 21 Jun 2018 21:32:38 +0000 (23:32 +0200)]
testutil/driver.c: Fix function prototype warning [-Wstrict-prototypes]

(introduced by commit 91860165820d, which added -Wstrict-prototypes)

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/6555)

6 years agoFixed range of random produced in BN_is_prime_fasttest_ex() to be 1 < rand < w-1...
Shane Lontis [Thu, 21 Jun 2018 03:37:52 +0000 (13:37 +1000)]
Fixed range of random produced in BN_is_prime_fasttest_ex() to be 1 < rand < w-1. It was using 1<= rand < w (which is wrong by 1 on both ends)

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6547)

6 years agoadd documentation for OCSP_basic_verify()
David von Oheimb [Sat, 10 Feb 2018 14:45:11 +0000 (15:45 +0100)]
add documentation for OCSP_basic_verify()

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6227)

6 years ago[fixup] Add CHANGES entry
Nicola Tuveri [Tue, 19 Jun 2018 13:55:29 +0000 (16:55 +0300)]
[fixup] Add CHANGES entry

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6116)

6 years ago[crypto/ec] default to FLT or error
Billy Brumley [Tue, 8 May 2018 11:00:30 +0000 (14:00 +0300)]
[crypto/ec] default to FLT or error

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6116)

6 years ago[crypto/ec] remove blinding to support even orders
Billy Brumley [Sat, 5 May 2018 08:03:02 +0000 (11:03 +0300)]
[crypto/ec] remove blinding to support even orders

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6116)

6 years agomake EC_GROUP_do_inverse_ord more robust
Billy Brumley [Fri, 27 Apr 2018 14:45:51 +0000 (17:45 +0300)]
make EC_GROUP_do_inverse_ord more robust

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6116)

6 years agoAdd -Wstrict-prototypes option to --strict-warnings
Bernd Edlinger [Wed, 20 Jun 2018 19:41:05 +0000 (21:41 +0200)]
Add -Wstrict-prototypes option to --strict-warnings

[extended tests]

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

6 years agoapps/ca: fix useless get before delete.
FdaSilvaYY [Tue, 8 May 2018 07:47:26 +0000 (09:47 +0200)]
apps/ca: fix useless get before delete.

Small simplification by skipping effectively redundant step and
not resuming search from point past deletion.

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

6 years agoConfigurations/10-main.conf: IRIX configs unification.
Andy Polyakov [Wed, 20 Jun 2018 12:14:11 +0000 (14:14 +0200)]
Configurations/10-main.conf: IRIX configs unification.

Add irix-common template that covers even irix-shared from shared-info.pl.

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

6 years agoRemove some inline assembler and non-standard constructs.
Andy Polyakov [Mon, 18 Jun 2018 10:50:53 +0000 (12:50 +0200)]
Remove some inline assembler and non-standard constructs.

The goal is to minimize maintenance burden by eliminating somewhat
obscure platform-specific tweaks that are not viewed as critical for
contemporary applications. This affects Camellia and digest
implementations that rely on md32_common.h, MD4, MD5, SHA1, SHA256.
SHA256 is the only one that can be viewed as critical, but given
the assembly coverage, the omission is considered appropriate.

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

6 years ago[crypto/ec] don't assume points are of order group->order
Billy Brumley [Wed, 20 Jun 2018 07:56:37 +0000 (10:56 +0300)]
[crypto/ec] don't assume points are of order group->order

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6535)

6 years agoDon't use OPENSSL_strdup() for copying alpn_selected
Matt Caswell [Mon, 18 Jun 2018 10:30:21 +0000 (11:30 +0100)]
Don't use OPENSSL_strdup() for copying alpn_selected

An alpn_selected value containing NUL bytes in it will result in
ext.alpn_selected_len having a larger value than the number of bytes
allocated in ext.alpn_selected.

Issue found by OSS-fuzz.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6507)

6 years agoUse DEPRECATEDIN_1_2_0 macro for DSA_sign_setup declaration
Nicola Tuveri [Tue, 12 Jun 2018 14:42:31 +0000 (17:42 +0300)]
Use DEPRECATEDIN_1_2_0 macro for DSA_sign_setup declaration

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

6 years agoAdd blinding to a DSA signature
Matt Caswell [Tue, 19 Jun 2018 14:07:02 +0000 (15:07 +0100)]
Add blinding to a DSA signature

This extends the recently added ECDSA signature blinding to blind DSA too.

This is based on side channel attacks demonstrated by Keegan Ryan (NCC
Group) for ECDSA which are likely to be able to be applied to DSA.

Normally, as in ECDSA, during signing the signer calculates:

s:= k^-1 * (m + r * priv_key) mod order

In ECDSA, the addition operation above provides a sufficient signal for a
flush+reload attack to derive the private key given sufficient signature
operations.

As a mitigation (based on a suggestion from Keegan) we add blinding to
the operation so that:

s := k^-1 * blind^-1 (blind * m + blind * r * priv_key) mod order

Since this attack is a localhost side channel only no CVE is assigned.

This commit also tweaks the previous ECDSA blinding so that blinding is
only removed at the last possible step.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6522)

6 years agoDocument no-sm2
Matt Caswell [Tue, 19 Jun 2018 20:41:49 +0000 (21:41 +0100)]
Document no-sm2

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6532)

6 years agoopenssl ca: open the output file as late as possible
Richard Levitte [Thu, 21 Jun 2018 04:24:33 +0000 (06:24 +0200)]
openssl ca: open the output file as late as possible

Fixes #6544

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

6 years agoFix spelling errors in documentation.
Pauli [Thu, 21 Jun 2018 03:39:23 +0000 (13:39 +1000)]
Fix spelling errors in documentation.
Also fix some clumsy wording.

[skip_ci]

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

6 years agoNOTES.UNIX: expand the description of RPATHs
Richard Levitte [Tue, 19 Jun 2018 11:03:55 +0000 (13:03 +0200)]
NOTES.UNIX: expand the description of RPATHs

Hopefully, this will make it more clear that it isn't only ELF
specific, even though there is a part that is (or even more
restrictively GNU ld.so specific).

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6520)

6 years agoPrepare for 1.1.1-pre9-dev
Matt Caswell [Wed, 20 Jun 2018 14:49:35 +0000 (15:49 +0100)]
Prepare for 1.1.1-pre9-dev

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agoPrepare for 1.1.1-pre8 release OpenSSL_1_1_1-pre8
Matt Caswell [Wed, 20 Jun 2018 14:48:08 +0000 (15:48 +0100)]
Prepare for 1.1.1-pre8 release

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agoUpdate copyright year
Matt Caswell [Wed, 20 Jun 2018 14:25:43 +0000 (15:25 +0100)]
Update copyright year

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

6 years agoupdate pyca/cryptography submodule
Paul Kehrer [Tue, 19 Jun 2018 17:49:19 +0000 (12:49 -0500)]
update pyca/cryptography submodule

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

6 years agoFix no-sm2
Matt Caswell [Tue, 19 Jun 2018 20:36:42 +0000 (21:36 +0100)]
Fix no-sm2

Fixes #6525

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

6 years agoFix test sm2 test failure with ec blinding
Bernd Edlinger [Tue, 19 Jun 2018 18:08:59 +0000 (20:08 +0200)]
Fix test sm2 test failure with ec blinding

[extended tests]

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6529)

6 years agoFix enable-ssl3 enable-ssl3-method
Matt Caswell [Mon, 18 Jun 2018 11:06:52 +0000 (12:06 +0100)]
Fix enable-ssl3 enable-ssl3-method

Commit 4aa5a5669 accidentally missed off the catch all case of ignoring all
warning alerts that are otherwise unhandled. This breaks the SSLv3 tests
which send a "no certificate" warning alert.

Fixes #6496

[extended tests]

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/6509)

6 years agoImprove the output of `make doc-nits`
Dr. Matthias St. Pierre [Mon, 18 Jun 2018 20:09:20 +0000 (22:09 +0200)]
Improve the output of `make doc-nits`

- Print positive feedback in the case when 'make doc-nits' finds no errors.
- Other than before, keep the 'doc-nits' output file only in case of errors
  and remove it if it is empty.
- Declare 'doc-nits' as a phony make target to facilitate rerunning
  'make doc-nits' without having to remove the output file first.

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

6 years agoFix & update documentation about RAND_priv_bytes()
Nicola Tuveri [Mon, 18 Jun 2018 16:13:36 +0000 (19:13 +0300)]
Fix & update documentation about RAND_priv_bytes()

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/6514)

6 years agoImplement coordinate blinding for EC_POINT
Sohaib ul Hassan [Sat, 16 Jun 2018 14:07:40 +0000 (17:07 +0300)]
Implement coordinate blinding for EC_POINT

This commit implements coordinate blinding, i.e., it randomizes the
representative of an elliptic curve point in its equivalence class, for
prime curves implemented through EC_GFp_simple_method,
EC_GFp_mont_method, and EC_GFp_nist_method.

This commit is derived from the patch
https://marc.info/?l=openssl-dev&m=131194808413635 by Billy Brumley.

Coordinate blinding is a generally useful side-channel countermeasure
and is (mostly) free. The function itself takes a few field
multiplicationss, but is usually only necessary at the beginning of a
scalar multiplication (as implemented in the patch). When used this way,
it makes the values that variables take (i.e., field elements in an
algorithm state) unpredictable.

For instance, this mitigates chosen EC point side-channel attacks for
settings such as ECDH and EC private key decryption, for the
aforementioned curves.

For EC_METHODs using different coordinate representations this commit
does nothing, but the corresponding coordinate blinding function can be
easily added in the future to extend these changes to such curves.

Co-authored-by: Nicola Tuveri <nic.tuv@gmail.com>
Co-authored-by: Billy Brumley <bbrumley@gmail.com>
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6501)

6 years agoMove SM2 algos to SM2 specific PKEY method
Jack Lloyd [Mon, 18 Jun 2018 19:51:56 +0000 (15:51 -0400)]
Move SM2 algos to SM2 specific PKEY method

Use EVP_PKEY_set_alias_type to access

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6443)

6 years agoAdd EVP_PKEY_set_alias_type
Jack Lloyd [Mon, 18 Jun 2018 19:49:15 +0000 (15:49 -0400)]
Add EVP_PKEY_set_alias_type

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6443)

6 years agoConvert our own check of OPENSSL_NO_DEPRECATED
Richard Levitte [Tue, 12 Jun 2018 16:31:57 +0000 (18:31 +0200)]
Convert our own check of OPENSSL_NO_DEPRECATED

... to the check OPENSSL_API_COMPAT < 0x10100000L, to correspond with
how it's declared.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6470)

6 years agoConfigure option 'no-deprecated' means '-DOPENSSL_API_COMPAT=0x10100000L'
Richard Levitte [Tue, 12 Jun 2018 16:26:37 +0000 (18:26 +0200)]
Configure option 'no-deprecated' means '-DOPENSSL_API_COMPAT=0x10100000L'

(that is, until 1.2.0 comes along)

Since we allow future deprecation (and that shouldn't be affected
by 'no-deprecated'), we need to distinguish what to have deprecated
on the value of OPENSSL_API_COMPAT, not the existence of
OPENSSL_NO_DEPRECATED.

Note that the macro OPENSSL_NO_DEPRECATED still exists, in case
someone still uses it.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6470)

6 years agoec/asm/ecp_nistz256-avx2.pl: harmonize clang version detection.
Andy Polyakov [Sat, 16 Jun 2018 14:25:40 +0000 (16:25 +0200)]
ec/asm/ecp_nistz256-avx2.pl: harmonize clang version detection.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6499)

6 years ago{chacha|poly1305}/asm/*-x64.pl: harmonize clang version detection.
Andy Polyakov [Sat, 16 Jun 2018 14:24:55 +0000 (16:24 +0200)]
{chacha|poly1305}/asm/*-x64.pl: harmonize clang version detection.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6499)

6 years agosha/asm/sha{1|256}-586.pl: harmonize clang version detection.
Andy Polyakov [Sat, 16 Jun 2018 14:23:34 +0000 (16:23 +0200)]
sha/asm/sha{1|256}-586.pl: harmonize clang version detection.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6499)

6 years agobn/asm/rsaz-avx2.pl: harmonize clang version detection.
Andy Polyakov [Sat, 16 Jun 2018 14:22:19 +0000 (16:22 +0200)]
bn/asm/rsaz-avx2.pl: harmonize clang version detection.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6499)

6 years agoFix error number clash
Matt Caswell [Mon, 18 Jun 2018 12:13:20 +0000 (13:13 +0100)]
Fix error number clash

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6511)

6 years agoadd cast in test/x509aux.c preventing compiler warning for VC-WIN64A architecture
David von Oheimb [Thu, 10 May 2018 19:15:56 +0000 (21:15 +0200)]
add cast in test/x509aux.c preventing compiler warning for VC-WIN64A architecture

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6217)

6 years agoadd 'unsupported cipher mode' diagnostics to evp_lib.c and genpkey.c
David von Oheimb [Thu, 10 May 2018 19:14:12 +0000 (21:14 +0200)]
add 'unsupported cipher mode' diagnostics to evp_lib.c and genpkey.c

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6217)

6 years agoremove needless and misleading malloc failure error messages of PKCS12_SAFEBAG_create...
David von Oheimb [Thu, 10 May 2018 19:10:03 +0000 (21:10 +0200)]
remove needless and misleading malloc failure error messages of PKCS12_SAFEBAG_create_pkcs8_encrypt

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6217)

6 years agoRAND_POOL: Add missing implementations for djgpp
Dr. Matthias St. Pierre [Tue, 5 Jun 2018 21:22:06 +0000 (23:22 +0200)]
RAND_POOL: Add missing implementations for djgpp

Calling the functions rand_pool_add_{additional,nonce}_data()
in crypto/rand/rand_lib.c with no implementation for djgpp/MSDOS
causees unresolved symbols when linking with djgpp.

Reported and fixed by Gisle Vanem

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6421)

6 years agoRepair broken C syntax (missing close parens) in a manual page.
Eric S. Raymond [Fri, 15 Jun 2018 00:16:45 +0000 (20:16 -0400)]
Repair broken C syntax (missing close parens) in a manual page.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/6491)

6 years agoUpdate certificates in demos/bio, demos/cms, demos/smime
David Cooper [Thu, 14 Jun 2018 23:10:30 +0000 (09:10 +1000)]
Update certificates in demos/bio, demos/cms, demos/smime

This commit replaces the certificates in demos/bio with new certificates that don't expire until 2118.
The same certificates appear in both demos/smime and demos/cms. This commit copies the new certificates and keys from demos/smime to demos/cms.
This PR Fixes #6412 by updating cacert.pem and signer.pem in the openssl/demos/smime/ directory. It also updates all of the keys with longer key lengths.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6483)

6 years agobn/bn_exp.c: harmonize all code paths with last commit.
Andy Polyakov [Wed, 13 Jun 2018 12:00:04 +0000 (14:00 +0200)]
bn/bn_exp.c: harmonize all code paths with last commit.

848113a30b431c2fe21ae8de2a366b9b6146fb92 added mitigation for a
side-channel attack. This commit extends approach to all code
paths for consistency.

[It also removes redundant white spaces introduced in last commit.]

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6480)

6 years agoConfigurations/10-main.conf: improve Makefile readability on AIX and Solaris.
Andy Polyakov [Wed, 13 Jun 2018 09:10:27 +0000 (11:10 +0200)]
Configurations/10-main.conf: improve Makefile readability on AIX and Solaris.

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

6 years agoConfigurations/10-main.conf: move hpux-shared flags to hpux-common.
Andy Polyakov [Wed, 13 Jun 2018 08:57:51 +0000 (10:57 +0200)]
Configurations/10-main.conf: move hpux-shared flags to hpux-common.

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

6 years agoFix manpage problems
Eric S. Raymond [Tue, 12 Jun 2018 19:46:50 +0000 (21:46 +0200)]
Fix manpage problems

CLA: trivial

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
GH: #6472

6 years agoAdd blinding to an ECDSA signature
Matt Caswell [Fri, 25 May 2018 11:10:13 +0000 (12:10 +0100)]
Add blinding to an ECDSA signature

Keegan Ryan (NCC Group) has demonstrated a side channel attack on an
ECDSA signature operation. During signing the signer calculates:

s:= k^-1 * (m + r * priv_key) mod order

The addition operation above provides a sufficient signal for a
flush+reload attack to derive the private key given sufficient signature
operations.

As a mitigation (based on a suggestion from Keegan) we add blinding to
the operation so that:

s := k^-1 * blind^-1 (blind * m + blind * r * priv_key) mod order

Since this attack is a localhost side channel only no CVE is assigned.

Reviewed-by: Rich Salz <rsalz@openssl.org>
6 years agoConfigurations/10-main.conf: replace -bexpall with explicit list on AIX.
Andy Polyakov [Mon, 11 Jun 2018 10:50:25 +0000 (12:50 +0200)]
Configurations/10-main.conf: replace -bexpall with explicit list on AIX.

[omit even -b:SRE, as it's implied by -G flag.]

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6453)

6 years agoConfigurations/10-main.conf: AIX configs unification.
Andy Polyakov [Mon, 11 Jun 2018 10:43:50 +0000 (12:43 +0200)]
Configurations/10-main.conf: AIX configs unification.

Add aix-common template that covers even aix-shared from shared-info.pl,
add -bsymbolic to shared_ldflags.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6453)

6 years agoConfigure: add shared() to facilitate shared-specific flags.
Andy Polyakov [Mon, 11 Jun 2018 10:22:29 +0000 (12:22 +0200)]
Configure: add shared() to facilitate shared-specific flags.

This allows to specify flags specific to shared build, e.g.
'bin_lflags => shared("-Wl,-bsvr4")'.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6453)

6 years agoConfigurations/10-main.conf: reinstate soname on Solaris.
Andy Polyakov [Sun, 10 Jun 2018 16:06:15 +0000 (18:06 +0200)]
Configurations/10-main.conf: reinstate soname on Solaris.

The flag was apparently omitted in switch from Makefile.shared to
shared-info.pl. Do put it back! And in the process move all
solaris-shared flags from shared-info.pl to solaris-common.

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

6 years agodoc/man7/passphrase-encoding.pod: Make consistent
Richard Levitte [Tue, 12 Jun 2018 22:29:48 +0000 (00:29 +0200)]
doc/man7/passphrase-encoding.pod: Make consistent

The man name didn't match the file name, and some places had
'password' instead of 'pass phrase'.

Fixes #6474

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6476)

6 years agoDocument return value of X509_add_ext
Viktor Dukhovni [Tue, 12 Jun 2018 15:51:53 +0000 (11:51 -0400)]
Document return value of X509_add_ext

and also X509_delete_ext()

Reviewed-by: Matt Caswell <matt@openssl.org>
6 years agoDeprecate DSA_sign_setup() in the documentation
Nicola Tuveri [Tue, 12 Jun 2018 01:27:28 +0000 (04:27 +0300)]
Deprecate DSA_sign_setup() in the documentation

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6460)

6 years agoMake ck_errf.pl ignore commented out error generation
Richard Levitte [Tue, 12 Jun 2018 07:27:18 +0000 (09:27 +0200)]
Make ck_errf.pl ignore commented out error generation

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

6 years ago.travis.yml: give make update exit code meaning again
Richard Levitte [Tue, 12 Jun 2018 06:57:43 +0000 (08:57 +0200)]
.travis.yml: give make update exit code meaning again

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

6 years agomake errors: use the new util/ck_errf.pl options
Richard Levitte [Tue, 12 Jun 2018 06:56:21 +0000 (08:56 +0200)]
make errors: use the new util/ck_errf.pl options

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

6 years agoutil/ck_errf.pl: add functionality that brings it closer to util/mkerr.pl
Richard Levitte [Tue, 12 Jun 2018 06:53:14 +0000 (08:53 +0200)]
util/ck_errf.pl: add functionality that brings it closer to util/mkerr.pl

There was no option to give other config files than the default
crypto/err/openssl.ec, and yet it tried to check the errors generated
in engines (and failing, of course).

Also added the same '-internal' option as util/mkerr.pl.

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

6 years agoReject excessively large primes in DH key generation.
Guido Vranken [Mon, 11 Jun 2018 17:38:54 +0000 (19:38 +0200)]
Reject excessively large primes in DH key generation.

CVE-2018-0732

Signed-off-by: Guido Vranken <guidovranken@gmail.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6457)

6 years agoutil/ck_errf.pl: add detection of unknown libcrypto and libssl libs
Richard Levitte [Mon, 11 Jun 2018 14:26:19 +0000 (16:26 +0200)]
util/ck_errf.pl: add detection of unknown libcrypto and libssl libs

The list of known libs are readily available in crypto/err/openssl.ec,
so lets use it to figure out if all error function codes belong to
known libs.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6455)

6 years agoexport data_dir of Test.pm, which was forgotten in #5928
David von Oheimb [Mon, 11 Jun 2018 09:02:57 +0000 (11:02 +0200)]
export data_dir of Test.pm, which was forgotten in #5928

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

6 years agoRemodel the if sequence for handling alerts
Matt Caswell [Fri, 8 Jun 2018 16:18:03 +0000 (17:18 +0100)]
Remodel the if sequence for handling alerts

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6370)

6 years agoDon't send a warning alert in TLSv1.3
Matt Caswell [Fri, 18 May 2018 08:08:19 +0000 (09:08 +0100)]
Don't send a warning alert in TLSv1.3

TLSv1.3 ignores the alert level, so we should suppress sending of
warning only alerts.

Fixes #6211

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6370)

6 years agoFix TLSv1.3 alert handling
Matt Caswell [Fri, 18 May 2018 08:07:42 +0000 (09:07 +0100)]
Fix TLSv1.3 alert handling

In TLSv1.3 we should ignore the severity level of an alert according to
the spec.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6370)

6 years agoVMS: have mkdef.pl parse lettered versions properly
Richard Levitte [Mon, 11 Jun 2018 08:33:09 +0000 (10:33 +0200)]
VMS: have mkdef.pl parse lettered versions properly

Fixes #6449

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6450)

(cherry picked from commit 9a236d5a7158d38b933656cacc31dfd4ff4fcc08)

6 years agoAdd support for RSA-PSS to X509_certificate_type()
Todd Short [Wed, 6 Jun 2018 21:28:13 +0000 (17:28 -0400)]
Add support for RSA-PSS to X509_certificate_type()

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6430)

6 years agobn/asm/sparcv9-mont.pl: iron another glitch in squaring code path.
Andy Polyakov [Fri, 8 Jun 2018 13:02:39 +0000 (15:02 +0200)]
bn/asm/sparcv9-mont.pl: iron another glitch in squaring code path.

This module is used only with odd input lengths, i.e. not used in normal
PKI cases, on contemporary processors. The problem was "illuminated" by
fuzzing tests.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6440)

6 years agorand/rand_unix.c: bypass DSO_global_lookup on ELF systems.
Andy Polyakov [Fri, 8 Jun 2018 09:38:22 +0000 (11:38 +0200)]
rand/rand_unix.c: bypass DSO_global_lookup on ELF systems.

If built with no-dso, syscall_random remains "blind" to getentropy.
Since it's possible to detect symbol availability on ELF-based systems
without involving DSO module, bypass it.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/6436)

6 years agorand/rand_unix.c: omit error from DSO_global_lookup.
Andy Polyakov [Fri, 8 Jun 2018 09:03:32 +0000 (11:03 +0200)]
rand/rand_unix.c: omit error from DSO_global_lookup.

If built with no-dso, DSO_global_lookup leaves "unsupported" message
in error queue. Since there is a fall-back code, it's unnecessary
distraction.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/6436)

6 years agoNew GOST identificators
Dmitry Belyavskiy [Fri, 8 Jun 2018 13:14:16 +0000 (09:14 -0400)]
New GOST identificators

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6438)

6 years agoDocumentation for missing s_client/s_server options
Dmitry Belyavskiy [Wed, 9 May 2018 15:30:41 +0000 (18:30 +0300)]
Documentation for missing s_client/s_server options

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6209)

6 years agoFix no-ec
Matt Caswell [Fri, 8 Jun 2018 10:20:34 +0000 (11:20 +0100)]
Fix no-ec

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6437)

6 years agoConfigurations/*.conf: ios targets face-lift.
Andy Polyakov [Sun, 3 Jun 2018 18:47:54 +0000 (20:47 +0200)]
Configurations/*.conf: ios targets face-lift.

Move ios targets to 15-ios.conf and modernize by deploying xcrun.
This excuses user from looking for paths and setting environment
variables. [Thanks to @0neday for hint.]

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

6 years agomodes/ocb128.c: Reset nonce-dependent variables on setiv
Mingtao Yang [Wed, 6 Jun 2018 16:34:18 +0000 (09:34 -0700)]
modes/ocb128.c: Reset nonce-dependent variables on setiv

Upon a call to CRYPTO_ocb128_setiv, either directly on an OCB_CTX or
indirectly with EVP_CTRL_AEAD_SET_IVLEN, reset the nonce-dependent
variables in the OCB_CTX.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/6420)

6 years agochacha/asm/chacha-ppc.pl: fix big-endian build.
Andy Polyakov [Thu, 7 Jun 2018 12:04:34 +0000 (14:04 +0200)]
chacha/asm/chacha-ppc.pl: fix big-endian build.

It's kind of a "brown-bag" bug, as I did recognize the problem and
verified an ad-hoc solution, but failed to follow up with cross-checks
prior filing previous merge request.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6435)

6 years agoAdd a test for the raw private/public key getters
Matt Caswell [Fri, 1 Jun 2018 14:06:52 +0000 (15:06 +0100)]
Add a test for the raw private/public key getters

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

6 years agoAdd function for setting the EVP_PKEY_ASN1_METHOD raw key getter functions
Matt Caswell [Fri, 1 Jun 2018 13:30:50 +0000 (14:30 +0100)]
Add function for setting the EVP_PKEY_ASN1_METHOD raw key getter functions

EVP_PKEY_asn1_set_get_priv_key() and EVP_PKEY_asn1_set_get_pub_key()

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

6 years agoDocument the raw key getter functions
Matt Caswell [Fri, 1 Jun 2018 13:14:09 +0000 (14:14 +0100)]
Document the raw key getter functions

EVP_PKEY_get_raw_private_key() and EVP_PKEY_get_raw_public_key()

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

6 years agoAdd support getting raw private/public keys
Matt Caswell [Fri, 1 Jun 2018 11:22:28 +0000 (12:22 +0100)]
Add support getting raw private/public keys

Only applies to algorithms that support it. Both raw private and public
keys can be obtained for X25519, Ed25519, X448, Ed448. Raw private keys
only can be obtained for HMAC, Poly1305 and SipHash

Fixes #6259

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

6 years agoDo not free a session before calling the remove_session_cb
Marcus Huewe [Fri, 11 May 2018 10:24:56 +0000 (12:24 +0200)]
Do not free a session before calling the remove_session_cb

If the remove_session_cb accesses the session's data (for instance,
via SSL_SESSION_get_protocol_version), a potential use after free
can occur. For this, consider the following scenario when adding
a new session via SSL_CTX_add_session:

- The session cache is full
  (SSL_CTX_sess_number(ctx) > SSL_CTX_sess_get_cache_size(ctx))
- Only the session cache has a reference to ctx->session_cache_tail
  (that is, ctx->session_cache_tail->references == 1)

Since the cache is full, remove_session_lock is called to remove
ctx->session_cache_tail from the cache. That is, it
SSL_SESSION_free()s the session, which free()s the data. Afterwards,
the free()d session is passed to the remove_session_cb. If the callback
accesses the session's data, we have a use after free.

The free before calling the callback behavior was introduced in
commit e4612d02c53cccd24fa97b08fc01250d1238cca1 ("Remove sessions
from external cache, even if internal cache not used.").

CLA: trivial

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6222)

6 years agoDocument UTF-8 expectation for pass phrases passed to OSSL_STORE
Richard Levitte [Tue, 5 Jun 2018 13:58:43 +0000 (15:58 +0200)]
Document UTF-8 expectation for pass phrases passed to OSSL_STORE

After some discussion, it was concluded that the better idea is to
stipulate that the pass phrases passed to the OSSL_STORE API are
expected to be UTF-8 encoded, and that all objects made accessible
through OSSL_STORE URIs should adhere to this expectation (at the
discretion of the loaders).

Email ref:
https://mta.openssl.org/pipermail/openssl-project/2018-June/000771.html

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6416)

6 years agoReformulate the if condition in tls_process_new_session_ticket
Matt Caswell [Thu, 7 Jun 2018 09:00:44 +0000 (10:00 +0100)]
Reformulate the if condition in tls_process_new_session_ticket

Improves readability

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6415)

6 years agoDon't store the ticket nonce in the session
Matt Caswell [Tue, 5 Jun 2018 11:23:28 +0000 (12:23 +0100)]
Don't store the ticket nonce in the session

We generate the secrets based on the nonce immediately so there is no
need to keep the nonce.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6415)

6 years agoFix TLSv1.3 ticket nonces
Matt Caswell [Fri, 1 Jun 2018 15:52:34 +0000 (16:52 +0100)]
Fix TLSv1.3 ticket nonces

All tickets on a connection need to have a unique nonce. When this was
originally implemented we only ever sent one ticket on the conneciton so
this didn't matter. We were just using the value 0. Now we can get multiple
tickets to we need to start doing the ticket nonce properly.

Fixes #6387

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6415)

6 years agoFix EAP-FAST
Matt Caswell [Wed, 6 Jun 2018 10:54:32 +0000 (11:54 +0100)]
Fix EAP-FAST

Commit 61fb59238d broke EAP-FAST support. This fixes it.

Fixes #6395

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6428)