openssl.git
5 years agoDSA: Check for sanity of input parameters
Vitezslav Cizek [Thu, 25 Oct 2018 11:53:26 +0000 (13:53 +0200)]
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>
(Merged from https://github.com/openssl/openssl/pull/7493)

5 years agotest/evp_test.c: Fixed strcmp() fault in mac_test_init()
Richard Levitte [Mon, 29 Oct 2018 15:27:43 +0000 (16:27 +0100)]
test/evp_test.c: Fixed strcmp() fault in mac_test_init()

When wanting to compare the end of a string with another string, make
sure not to start somewhere before the start of the first string.

[extended tests]

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

5 years agotest/evp_test.c: don't misuse pkey_test_ctrl() in mac_test_run()
Richard Levitte [Fri, 26 Oct 2018 11:42:40 +0000 (13:42 +0200)]
test/evp_test.c: don't misuse pkey_test_ctrl() in mac_test_run()

pkey_test_ctrl() was designed for parsing values, not for using in
test runs.  Relying on its returned value when it returned 1 even for
control errors made it particularly useless for mac_test_run().

Here, it gets replaced with a MAC specific control function, that
parses values the same way but is designed for use in a _run() rather
than a _parse() function.

This uncovers a SipHash test with an invalid control that wasn't
caught properly.  After all, that stanza is supposed to test that
invalid control values do generate an error.  Now we catch that.

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

5 years agoAdd a test where we reuse the EVP_PKEY_CTX for two HKDF test runs
Matt Caswell [Fri, 26 Oct 2018 11:45:27 +0000 (12:45 +0100)]
Add a test where we reuse the EVP_PKEY_CTX for two HKDF test runs

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

5 years agoReset the HKDF state between operations
Matt Caswell [Fri, 26 Oct 2018 11:19:43 +0000 (12:19 +0100)]
Reset the HKDF state between operations

Fixes #7497

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

5 years agoWindows build: build foo.d after foo.obj
Richard Levitte [Tue, 23 Oct 2018 08:35:48 +0000 (10:35 +0200)]
Windows build: build foo.d after foo.obj

We made the build of foo.obj depend on foo.d, meaning the latter gets
built first.  Unfortunately, the way the compiler works, we are forced
to redirect all output to foo.d, meaning that if the source contains
an error, the build fails without showing those errors.

We therefore remove the dependency and force the build of foo.d to
always happen after build of foo.obj.

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

5 years agossl/statem: Don't compare size_t with less than zero
Richard Levitte [Wed, 12 Sep 2018 00:31:10 +0000 (02:31 +0200)]
ssl/statem: Don't compare size_t with less than zero

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

5 years agoVMS & cryptoerr.h: include symhacks.h
Richard Levitte [Wed, 12 Sep 2018 00:30:25 +0000 (02:30 +0200)]
VMS & cryptoerr.h: include symhacks.h

Needed to clear a clash between ERR_load_CRYPTO_strings and
ERR_load_crypto_strings

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

5 years agoapps/rehash.c: Convert ISO-8859-1 to UTF-8
Richard Levitte [Wed, 12 Sep 2018 00:28:35 +0000 (02:28 +0200)]
apps/rehash.c: Convert ISO-8859-1 to UTF-8

Believe it or not, the VMS C compiler is remarking on this

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

5 years agoAdd convenience functions EVP_str2ctrl() and EVP_hex2ctrl()
Richard Levitte [Wed, 24 Oct 2018 18:20:00 +0000 (20:20 +0200)]
Add convenience functions EVP_str2ctrl() and EVP_hex2ctrl()

These functions are generalizations of EVP_PKEY_CTX_str2ctrl() and
EVP_PKEY_CTX_hex2ctrl().  They will parse the value, and then pass the
parsed result and length to a callback that knows exactly how to pass
them on to a main _ctrl function, along with a context structure
pointer.

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

5 years agoAdapt test/evp_test.c to deal with available EVP_MACs
Richard Levitte [Wed, 24 Oct 2018 16:36:31 +0000 (18:36 +0200)]
Adapt test/evp_test.c to deal with available EVP_MACs

If a MAC isn't available as an EVP_MAC, the MAC test falls back to the
corresponding EVP_PKEY method.

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

5 years agoAdd generic EVP_PKEY_METHOD for EVP_MACs
Richard Levitte [Wed, 24 Oct 2018 16:35:32 +0000 (18:35 +0200)]
Add generic EVP_PKEY_METHOD for EVP_MACs

The MAC EVP_PKEY implementations are currently implemented for each
MAC.  However, with the EVP_MAC API, only one such implementation is
needed.

This implementation takes into account the differences between HMAC
and CMAC implementations, and observes that all other current MAC
implementations seem to follow the HMAC model.

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

5 years agoAdd automatic initializations support for EVP_MAC objects
Richard Levitte [Wed, 24 Oct 2018 16:34:53 +0000 (18:34 +0200)]
Add automatic initializations support for EVP_MAC objects

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

5 years agoAdd EVP_MAC API
Richard Levitte [Fri, 12 Oct 2018 20:27:18 +0000 (22:27 +0200)]
Add EVP_MAC API

We currently implement EVP MAC methods as EVP_PKEY methods.  This
change creates a separate EVP API for MACs, to replace the current
EVP_PKEY ones.

A note about this EVP API and how it interfaces with underlying MAC
implementations:

Other EVP APIs pass the EVP API context down to implementations, and
it can be observed that the implementations use the pointer to their
own private data almost exclusively.  The EVP_MAC API deviates from
that pattern by passing the pointer to the implementation's private
data directly, and thereby deny the implementations access to the
EVP_MAC context structure.  This change is made to provide a clearer
separation between the EVP library itself and the implementations of
its supported algorithm classes.

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

5 years agoRework and simplify resource flow in drbg_add
Bernd Edlinger [Fri, 26 Oct 2018 19:06:14 +0000 (21:06 +0200)]
Rework and simplify resource flow in drbg_add

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7504)

5 years agorandfile.c: fix a Coverity warning
Dr. Matthias St. Pierre [Sun, 28 Oct 2018 12:32:11 +0000 (13:32 +0100)]
randfile.c: fix a Coverity warning

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

5 years agoTiming vulnerability in ECDSA signature generation (CVE-2018-0735)
Pauli [Fri, 26 Oct 2018 00:54:58 +0000 (10:54 +1000)]
Timing vulnerability in ECDSA signature generation (CVE-2018-0735)

Preallocate an extra limb for some of the big numbers to avoid a reallocation
that can potentially provide a side channel.

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

5 years agoTiming vulnerability in DSA signature generation (CVE-2018-0734).
Pauli [Tue, 23 Oct 2018 21:42:46 +0000 (07:42 +1000)]
Timing vulnerability in DSA signature generation (CVE-2018-0734).

Avoid a timing attack that leaks information via a side channel that
triggers when a BN is resized.  Increasing the size of the BNs
prior to doing anything with them suppresses the attack.

Thanks due to Samuel Weiser for finding and locating this.

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

5 years agoDSA mod inverse fix
Pauli [Sun, 28 Oct 2018 20:50:51 +0000 (06:50 +1000)]
DSA mod inverse fix

There is a side channel attack against the division used to calculate one of
the modulo inverses in the DSA algorithm.  This change takes advantage of the
primality of the modulo and Fermat's little theorem to calculate the inverse
without leaking information.

Thanks to Samuel Weiser for finding and reporting this.

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/7487)

5 years agodrbg_lib: avoid NULL pointer dereference in drbg_add
Dr. Matthias St. Pierre [Sun, 28 Oct 2018 12:46:35 +0000 (13:46 +0100)]
drbg_lib: avoid NULL pointer dereference in drbg_add

Found by Coverity Scan

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

5 years agoiOS config targets: disable "async" by default
Richard Levitte [Mon, 15 Oct 2018 16:37:18 +0000 (18:37 +0200)]
iOS config targets: disable "async" by default

This also gave enough reason to collect the stuff that's common for
all iOS config targets into the template "ios-common".

Fixes #7318

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

5 years agoConfigure: Improve warning if no random seed source was configured
Dr. Matthias St. Pierre [Sun, 28 Oct 2018 11:38:49 +0000 (12:38 +0100)]
Configure: Improve warning if no random seed source was configured

The new Configure summary box (41349b5e6db) now hides the warning
about the missing seed source (2805ee1e095) too much. To make it
more visible again, add warning markers.

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

5 years agoSupport GeneralSubtrees with minimum = 0
Fraser Tweedale [Sat, 27 Oct 2018 04:11:41 +0000 (12:11 +0800)]
Support GeneralSubtrees with minimum = 0

The Name Constraints extension contains GeneralSubtree values
indicating included or excluded subtrees.  It is defined as:

  GeneralSubtree ::= SEQUENCE {
    base                    GeneralName,
    minimum         [0]     BaseDistance DEFAULT 0,
    maximum         [1]     BaseDistance OPTIONAL }

RFC 5280 further specifies:

  Within this profile, the minimum and maximum fields are not used with
  any name forms, thus, the minimum MUST be zero, and maximum MUST be
  absent.

Because the minimum fields has DEFAULT 0, and certificates should be
encoded using DER, the situation where minimum = 0 occurs in a
certificate should not arise.  Nevertheless, it does arise.  For
example, I have seen certificates issued by Microsoft programs that
contain GeneralSubtree values encoded thus.

Enhance the Name Constraints matching routine to handle the case
where minimum is specified.  If present, it must be zero.  The
maximum field remains prohibited.

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

5 years agoFix data race in RAND_DRBG_generate
Bernd Edlinger [Sun, 14 Oct 2018 10:35:19 +0000 (12:35 +0200)]
Fix data race in RAND_DRBG_generate

Fixes #7394

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

5 years agoAdd a test for duplicated DTLS records
Matt Caswell [Tue, 16 Oct 2018 16:03:39 +0000 (17:03 +0100)]
Add a test for duplicated DTLS records

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

5 years agoProperly handle duplicated messages from the next epoch
Matt Caswell [Tue, 16 Oct 2018 16:08:11 +0000 (17:08 +0100)]
Properly handle duplicated messages from the next epoch

Since 1fb9fdc30 we may attempt to buffer a record from the next epoch
that has already been buffered. Prior to that this never occurred.

We simply ignore a failure to buffer a duplicated record.

Fixes #6902

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

5 years agoFix a possible crash in rand_drbg_get_entropy
Bernd Edlinger [Tue, 23 Oct 2018 14:30:20 +0000 (16:30 +0200)]
Fix a possible crash in rand_drbg_get_entropy

Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7474)

5 years agoConfigure: Reword the summary output
Dr. Matthias St. Pierre [Thu, 25 Oct 2018 21:31:24 +0000 (23:31 +0200)]
Configure: Reword the summary output

In commit 820e414d2830 (pr #5247) the summary output of the
Configure command was optimized towards instructing people
how to create issue reports.

It turned out that the wording of this message can confuse new
OpenSSL users and make them think that they are seeing an error
message. This commit makes the summary output start with a success
to prevent a misunderstanding. Also it gives more hints to new
OpenSSL users.

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

5 years agoRAND_add()/RAND_seed(): fix failure on short input or low entropy
Dr. Matthias St. Pierre [Sun, 21 Oct 2018 13:45:34 +0000 (15:45 +0200)]
RAND_add()/RAND_seed(): fix failure on short input or low entropy

Commit 5b4cb385c18a (#7382) introduced a bug which had the effect
that RAND_add()/RAND_seed() failed for buffer sizes less than
32 bytes. The reason was that now the added random data was used
exlusively as entropy source for reseeding. When the random input
was too short or contained not enough entropy, the DRBG failed
without querying the available entropy sources.

This commit makes drbg_add() act smarter: it checks the entropy
requirements explicitely. If the random input fails this check,
it won't be added as entropy input, but only as additional data.
More precisely, the behaviour depends on whether an os entropy
source was configured (which is the default on most os):

- If an os entropy source is avaible then we declare the buffer
  content as additional data by setting randomness to zero and
  trigger a regular   reseeding.

- If no os entropy source is available, a reseeding will fail
  inevitably. So drbg_add() uses a trick to mix the buffer contents
  into the DRBG state without forcing a reseeding: it generates a
  dummy random byte, using the buffer content as additional data.

Related-to: #7449
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7456)

5 years agoRAND_load_file(): avoid adding small chunks to RAND_add()
Dr. Matthias St. Pierre [Sun, 21 Oct 2018 16:49:19 +0000 (18:49 +0200)]
RAND_load_file(): avoid adding small chunks to RAND_add()

Increase the load buffer size such that it exceeds the chunk
size by a comfortable amount. This is done to avoid calling
RAND_add() with a small final chunk. Instead, such a small
final chunk will be added together with the previous chunk
(unless it's the only one).

Related-to: #7449
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7456)

5 years agoRAND_load_file(): return error if reseeding failed
Dr. Matthias St. Pierre [Sat, 20 Oct 2018 14:53:57 +0000 (16:53 +0200)]
RAND_load_file(): return error if reseeding failed

The failure of RAND_load_file was only noticed because of the
heap corruption which was reported in #7499 and fixed in commit
5b4cb385c18a. To prevent this in the future, RAND_load_file()
now explicitly checks RAND_status() and reports an error if it
fails.

Related-to: #7449
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7456)

5 years agoWindows: Produce a static version of the public libraries, always
Richard Levitte [Thu, 25 Oct 2018 13:55:15 +0000 (15:55 +0200)]
Windows: Produce a static version of the public libraries, always

When building shared libraries on Windows, we had a clash between
'libcrypto.lib' the static routine library and 'libcrypto.lib' the
import library.

We now change it so the static versions of our libraries get '_static'
appended to their names.  These will never get installed, but can
still be used for our internal purposes, such as internal tests.

When building non-shared, the renaming mechanism doesn't come into
play.  In that case, the static libraries 'libcrypto.lib' and
'libssl.lib' are installed, just as always.

Fixes #7492

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

5 years agoRAND: ensure INT32_MAX is defined
Richard Levitte [Tue, 23 Oct 2018 08:15:12 +0000 (10:15 +0200)]
RAND: ensure INT32_MAX is defined

This value is used to set DRBG_MAX_LENGTH

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/7467)

5 years agoRSA security bits calculation
Pauli [Thu, 4 Oct 2018 23:19:30 +0000 (09:19 +1000)]
RSA security bits calculation

NIST has updated their guidelines in appendix D of SP 800-56B rev2 (draft)
providing a formula for the number of security bits it terms of the length
of the RSA key.

This is an implementation of this formula using fixed point arithmetic.
For integers 1 .. 100,000 it rounds down to the next smaller 8 bit strength
270 times.  It never errs to the high side.  None of the rounded values occur
near any of the commonly selected lengths.

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

5 years agoRAND_add(): fix heap corruption in error path
Dr. Matthias St. Pierre [Sat, 20 Oct 2018 14:53:09 +0000 (16:53 +0200)]
RAND_add(): fix heap corruption in error path

This bug was introduced by #7382 which enhanced RAND_add() to
accept large buffer sizes. As a consequence, RAND_add() now fails
for buffer sizes less than 32 bytes (i.e. less than 256 bits).
In addition, rand_drbg_get_entropy() forgets to reset the attached
drbg->pool in the case of an error, which leads to the heap corruption.

The problem occurred with RAND_load_file(), which reads the file in
chunks of 1024 bytes each. If the size of the final chunk is less than
32 bytes, then RAND_add() fails, whence RAND_load_file() fails
silently for buffer sizes n = k * 1024 + r with r = 1,...,31.

This commit fixes the heap corruption only. The other issues will
be addressed in a separate pull request.

Thanks to Gisle Vanem for reporting this issue.

Fixes #7449

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

5 years agobuild file templates: have targets for all shared library names
Richard Levitte [Sun, 21 Oct 2018 09:03:02 +0000 (11:03 +0200)]
build file templates: have targets for all shared library names

We only had targets for the "simple" shared library names (libfoo.so
and not libfoo.so.x.y on Unix, import library libfoo.lib but not
libfoo.dll on Windows).  This has created some confusion why it wasn't
possible to rebuild the less "simple" name directly (just as an
example, someone who mistook the import library on Windows for a
static library, removed the DLL and then found it was difficult to
rebuild directly), so we change the target to include all possible
names.

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

5 years agoDon't complain and fail about unknown TLSv1.3 PSK identities in s_server
Matt Caswell [Thu, 18 Oct 2018 13:45:59 +0000 (14:45 +0100)]
Don't complain and fail about unknown TLSv1.3 PSK identities in s_server

An unknown PSK identity could be because its actually a session resumption
attempt. Sessions resumptions and external PSKs are indistinguishable so
the callbacks need to fail gracefully if they don't recognise the identity.

Fixes #7433

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

5 years agoBuffer a ClientHello with a cookie received via DTLSv1_listen
Matt Caswell [Tue, 9 Oct 2018 09:22:06 +0000 (10:22 +0100)]
Buffer a ClientHello with a cookie received via DTLSv1_listen

Previously when a ClientHello arrives with a valid cookie using
DTLSv1_listen() we only "peeked" at the message and left it on the
underlying fd. This works fine for single threaded applications but for
multi-threaded apps this does not work since the fd is typically reused for
the server thread, while a new fd is created and connected for the client.
By "peeking" we leave the message on the server fd, and consequently we
think we've received another valid ClientHello and so we create yet another
fd for the client, and so on until we run out of fds.

In this new approach we remove the ClientHello and buffer it in the SSL
object.

Fixes #6934

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/7375)

5 years agoUse the read and write buffers in DTLSv1_listen()
Matt Caswell [Mon, 8 Oct 2018 14:46:51 +0000 (15:46 +0100)]
Use the read and write buffers in DTLSv1_listen()

Rather than using init_buf we use the record layer read and write buffers
in DTLSv1_listen(). These seem more appropriate anyway and will help with
the next commit.

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/7375)

5 years agoTest DTLS cookie generation and verification
Matt Caswell [Thu, 18 Oct 2018 09:12:20 +0000 (10:12 +0100)]
Test DTLS cookie generation and verification

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

5 years agoFix a DTLS memory leak
Matt Caswell [Thu, 18 Oct 2018 09:12:07 +0000 (10:12 +0100)]
Fix a DTLS memory leak

Fixes #7428

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

5 years agosha/asm/keccak1600-armv8.pl: halve the size of hw-assisted subroutine.
Andy Polyakov [Sat, 22 Sep 2018 12:39:51 +0000 (14:39 +0200)]
sha/asm/keccak1600-armv8.pl: halve the size of hw-assisted subroutine.

Yes, it's second halving, i.e. it's now 1/4 of original size, or more
specifically inner loop. The challenge with Keccak is that you need
more temporary registers than there are available. By reversing the
order in which columns are assigned in Chi, it's possible to use
three of A[][] registers as temporary prior their assigment.

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

5 years agoConfigurations/15-android.conf: add support for "standalone toolchain".
Andy Polyakov [Sun, 14 Oct 2018 13:19:41 +0000 (15:19 +0200)]
Configurations/15-android.conf: add support for "standalone toolchain".

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

5 years agoarch/async_posix.h: improve portability.
Andy Polyakov [Wed, 17 Oct 2018 08:09:33 +0000 (10:09 +0200)]
arch/async_posix.h: improve portability.

{make|swap|get|set}context are removed in POSIX.1-2008, but glibc
apparently keeps providing it.

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

5 years agoFix tls_cbc_digest_record is slow using SHA-384 and short messages
armfazh [Thu, 18 Oct 2018 22:26:58 +0000 (08:26 +1000)]
Fix tls_cbc_digest_record is slow using SHA-384 and short messages

The formula used for this is now

kVarianceBlocks = ((255 + 1 + md_size + md_block_size - 1) / md_block_size) + 1

Notice that md_block_size=64 for SHA256, which results on the
magic constant kVarianceBlocks = 6.
However, md_block_size=128 for SHA384 leading to kVarianceBlocks = 4.

CLA:trivial

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

5 years agoApply self-imposed path length also to root CAs
Viktor Dukhovni [Mon, 8 Oct 2018 16:05:14 +0000 (12:05 -0400)]
Apply self-imposed path length also to root CAs

Also, some readers of the code find starting the count at 1 for EE
cert confusing (since RFC5280 counts only non-self-issued intermediate
CAs, but we also counted the leaf).  Therefore, never count the EE
cert, and adjust the path length comparison accordinly.  This may
be more clear to the reader.

Reviewed-by: Matt Caswell <matt@openssl.org>
5 years agoOnly CA certificates can be self-issued
Viktor Dukhovni [Fri, 5 Oct 2018 03:53:01 +0000 (23:53 -0400)]
Only CA certificates can be self-issued

At the bottom of https://tools.ietf.org/html/rfc5280#page-12 and
top of https://tools.ietf.org/html/rfc5280#page-13 (last paragraph
of above https://tools.ietf.org/html/rfc5280#section-3.3), we see:

   This specification covers two classes of certificates: CA
   certificates and end entity certificates.  CA certificates may be
   further divided into three classes: cross-certificates, self-issued
   certificates, and self-signed certificates.  Cross-certificates are
   CA certificates in which the issuer and subject are different
   entities.  Cross-certificates describe a trust relationship between
   the two CAs.  Self-issued certificates are CA certificates in which
   the issuer and subject are the same entity.  Self-issued certificates
   are generated to support changes in policy or operations.  Self-
   signed certificates are self-issued certificates where the digital
   signature may be verified by the public key bound into the
   certificate.  Self-signed certificates are used to convey a public
   key for use to begin certification paths.  End entity certificates
   are issued to subjects that are not authorized to issue certificates.

that the term "self-issued" is only applicable to CAs, not end-entity
certificates.  In https://tools.ietf.org/html/rfc5280#section-4.2.1.9
the description of path length constraints says:

   The pathLenConstraint field is meaningful only if the cA boolean is
   asserted and the key usage extension, if present, asserts the
   keyCertSign bit (Section 4.2.1.3).  In this case, it gives the
   maximum number of non-self-issued intermediate certificates that may
   follow this certificate in a valid certification path.  (Note: The
   last certificate in the certification path is not an intermediate
   certificate, and is not included in this limit.  Usually, the last
   certificate is an end entity certificate, but it can be a CA
   certificate.)

This makes it clear that exclusion of self-issued certificates from
the path length count applies only to some *intermediate* CA
certificates.  A leaf certificate whether it has identical issuer
and subject or whether it is a CA or not is never part of the
intermediate certificate count.  The handling of all leaf certificates
must be the same, in the case of our code to post-increment the
path count by 1, so that we ultimately reach a non-self-issued
intermediate it will be the first one (not zeroth) in the chain
of intermediates.

Reviewed-by: Matt Caswell <matt@openssl.org>
5 years agos390x assembly pack: add OPENSSL_s390xcap man page.
Patrick Steuer [Tue, 31 Jan 2017 11:43:35 +0000 (12:43 +0100)]
s390x assembly pack: add OPENSSL_s390xcap man page.

Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6813)

5 years agos390x assembly pack: add OPENSSL_s390xcap environment variable.
Patrick Steuer [Mon, 30 Jan 2017 16:37:54 +0000 (17:37 +0100)]
s390x assembly pack: add OPENSSL_s390xcap environment variable.

The OPENSSL_s390xcap environment variable is used to set bits in the s390x
capability vector to zero. This simplifies testing of different code paths.

Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6813)

5 years agoDeprecate ECDH_KDF_X9_62()
Antoine Salon [Tue, 16 Oct 2018 17:54:26 +0000 (10:54 -0700)]
Deprecate ECDH_KDF_X9_62()

Signed-off-by: Antoine Salon <asalon@vmware.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/7345)

5 years agoEVP module documentation pass
Antoine Salon [Mon, 1 Oct 2018 21:11:57 +0000 (14:11 -0700)]
EVP module documentation pass

Replace ECDH_KDF_X9_62() with internal ecdh_KDF_X9_63()

Signed-off-by: Antoine Salon <asalon@vmware.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/7345)

5 years agoFix: 'openssl ca' command crashes when used with 'rand_serial' option
Dr. Matthias St. Pierre [Tue, 16 Oct 2018 21:50:16 +0000 (23:50 +0200)]
Fix: 'openssl ca' command crashes when used with 'rand_serial' option

Commit ffb46830e2df introduced the 'rand_serial' option. When it is used,
the 'serialfile' does not get initialized, i.e. it remains a NULL pointer.
This causes a crash when the NULL pointer is passed to the rotate_serial()
call.

This commit fixes the crash and unifies the pointer checking before
calling the rotate_serial() and save_serial() commands.

Fixes #7412

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

5 years agoBuild file templates: look at *all* defines
Richard Levitte [Mon, 15 Oct 2018 15:38:26 +0000 (17:38 +0200)]
Build file templates: look at *all* defines

When looking at configured macro definitions, we must look at both
what comes from the config target AND what comes from user
configuration.

Fixes #7396

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/7402)

5 years agoAdd a missing check on s->s3->tmp.pkey
Mansour Ahmadi [Mon, 15 Oct 2018 19:11:24 +0000 (15:11 -0400)]
Add a missing check on s->s3->tmp.pkey

Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7405)

5 years agoprint() is a function in Python 3
cclauss [Tue, 16 Oct 2018 04:57:41 +0000 (06:57 +0200)]
print() is a function in Python 3

CLA: trivial

Discovered via #7410 @ https://travis-ci.org/openssl/openssl/jobs/442003489#L440

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

5 years agoDRBG: fix reseeding via RAND_add()/RAND_seed() with large input
Dr. Matthias St. Pierre [Tue, 9 Oct 2018 23:53:29 +0000 (01:53 +0200)]
DRBG: fix reseeding via RAND_add()/RAND_seed() with large input

In pull request #4328 the seeding of the DRBG via RAND_add()/RAND_seed()
was implemented by buffering the data in a random pool where it is
picked up later by the rand_drbg_get_entropy() callback. This buffer
was limited to the size of 4096 bytes.

When a larger input was added via RAND_add() or RAND_seed() to the DRBG,
the reseeding failed, but the error returned by the DRBG was ignored
by the two calling functions, which both don't return an error code.
As a consequence, the data provided by the application was effectively
ignored.

This commit fixes the problem by a more efficient implementation which
does not copy the data in memory and by raising the buffer the size limit
to INT32_MAX (2 gigabytes). This is less than the NIST limit of 2^35 bits
but it was chosen intentionally to avoid platform dependent problems
like integer sizes and/or signed/unsigned conversion.

Additionally, the DRBG is now less permissive on errors: In addition to
pushing a message to the openssl error stack, it enters the error state,
which forces a reinstantiation on next call.

Thanks go to Dr. Falko Strenzke for reporting this issue to the
openssl-security mailing list. After internal discussion the issue
has been categorized as not being security relevant, because the DRBG
reseeds automatically and is fully functional even without additional
randomness provided by the application.

Fixes #7381

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

5 years agoFix copy&paste error found in Coverity scan
Tomas Mraz [Tue, 9 Oct 2018 16:37:10 +0000 (18:37 +0200)]
Fix copy&paste error found in Coverity scan

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7377)

5 years agorsa/rsa_ossl.c: fix and extend commentary [skip ci].
Andy Polyakov [Wed, 5 Sep 2018 12:33:21 +0000 (14:33 +0200)]
rsa/rsa_ossl.c: fix and extend commentary [skip ci].

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/7123)

5 years agossl/s3_enc.c: fix logical errors in ssl3_final_finish_mac.
Andy Polyakov [Sun, 2 Sep 2018 11:07:58 +0000 (13:07 +0200)]
ssl/s3_enc.c: fix logical errors in ssl3_final_finish_mac.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7085)

5 years agosha/asm/keccak1600-s390x.pl: resolve -march=z900 portability issue.
Andy Polyakov [Mon, 17 Sep 2018 10:36:37 +0000 (12:36 +0200)]
sha/asm/keccak1600-s390x.pl: resolve -march=z900 portability issue.

Negative displacement in memory references was not originally specified,
so that for maximum coverage one should abstain from it, just like with
any other extension. [Unless it's guarded by run-time switch, but there
is no switch in keccak1600-s390x.]

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

5 years agoFix a typo in a macro
Matt Caswell [Thu, 11 Oct 2018 10:59:57 +0000 (11:59 +0100)]
Fix a typo in a macro

Fixes #7385

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

5 years agoSafer memory cleanup in (crypto/rsa/rsa_lib.c)
Mykola Baibuz [Thu, 11 Oct 2018 04:07:26 +0000 (12:07 +0800)]
Safer memory cleanup in (crypto/rsa/rsa_lib.c)

We don't need to use secure clean for public key.

CLA: trivial

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

5 years agoFix compiling warnings in example code
Paul Yang [Mon, 8 Oct 2018 08:36:49 +0000 (16:36 +0800)]
Fix compiling warnings in example code

The example code in EVP_DigestInit.pod generates warnings if users try
to compile it.

[skip ci]

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

5 years agocrypto/rand: fix some style nit's
FdaSilvaYY [Fri, 15 Sep 2017 19:14:34 +0000 (21:14 +0200)]
crypto/rand: fix some style nit's

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

5 years agorand_unix.c: fix --with-rand-seed=none build
Dr. Matthias St. Pierre [Wed, 10 Oct 2018 00:31:37 +0000 (02:31 +0200)]
rand_unix.c: fix --with-rand-seed=none build

Fixes a compiler warning about an unused syscall_random()
and cleans up the OPENSSL_RAND_SEED preprocessor logic.

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

5 years agoFix no-engine
Matt Caswell [Mon, 8 Oct 2018 11:16:22 +0000 (12:16 +0100)]
Fix no-engine

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

5 years agomkdef: bsd-gcc uses solaris symbol version scripts
Benjamin Kaduk [Tue, 9 Oct 2018 14:27:11 +0000 (09:27 -0500)]
mkdef: bsd-gcc uses solaris symbol version scripts

As for linux, make bsd-gcc an alias to the solaris semantics for
shared library symbol version handling.

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

5 years agoFix a nit of copyright date range
Paul Yang [Mon, 8 Oct 2018 09:04:14 +0000 (17:04 +0800)]
Fix a nit of copyright date range

Should be 2018 instead of 20018.

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

5 years agoapps: allow empty attribute values with -subj
Benjamin Kaduk [Thu, 4 Oct 2018 18:49:21 +0000 (13:49 -0500)]
apps: allow empty attribute values with -subj

Historically (i.e., OpenSSL 1.0.x), the openssl applications would
allow for empty subject attributes to be passed via the -subj argument,
e.g., `opensl req -subj '/CN=joe/O=/OU=local' ...`.  Commit
db4c08f0194d58c6192f0d8311bf3f20e251cf4f applied a badly needed rewrite
to the parse_name() helper function that parses these strings, but
in the process dropped a check that would skip attributes with no
associated value.  As a result, such strings are now treated as
hard errors and the operation fails.

Restore the check to skip empty attribute values and restore
the historical behavior.

Document the behavior for empty subject attribute values in the
corresponding applications' manual pages.

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

5 years agoCleanup typos and grammar in DES_random_key.pod
Ԝеѕ [Fri, 5 Oct 2018 18:58:30 +0000 (14:58 -0400)]
Cleanup typos and grammar in DES_random_key.pod

CLA: trivial

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

5 years agoIndentation fixes.
Pauli [Sun, 7 Oct 2018 21:23:44 +0000 (07:23 +1000)]
Indentation fixes.

The PR #7329 left some indentation slightly off.  This fixes it.

Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
(Merged from https://github.com/openssl/openssl/pull/7360)

5 years agoRemove useless check.
Mykola Baibuz [Sun, 7 Oct 2018 21:14:08 +0000 (07:14 +1000)]
Remove useless check.
Hash can be longer than EC group degree and it will be truncated.

CLA: trivial

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

5 years ago/dev/crypto engine: give CIOCFSESSION the actual sess-id
Richard Levitte [Mon, 24 Sep 2018 10:18:31 +0000 (12:18 +0200)]
/dev/crypto engine: give CIOCFSESSION the actual sess-id

We passed that ioctl a pointer to the whole session_op structure,
which wasn't quite right.

Notified by David Legault.

Fixes #7302

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/7304)

5 years agotest/secmemtest: test secure memory only if it is implemented
Dr. Matthias St. Pierre [Thu, 4 Oct 2018 23:05:54 +0000 (01:05 +0200)]
test/secmemtest: test secure memory only if it is implemented

Fixes #7322

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/7351)

5 years agoutil/mkdef.pl: for VMS, allow generation of case insensitive symbol vector
Richard Levitte [Thu, 4 Oct 2018 22:10:35 +0000 (00:10 +0200)]
util/mkdef.pl: for VMS, allow generation of case insensitive symbol vector

Some modules are built with case insensitive (uppercase) symbols on
VMS.  This needs to be reflected in the export symbol vector.

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

5 years agoConfigure: use correct variable to infer the .ld file location
Richard Levitte [Thu, 4 Oct 2018 15:41:51 +0000 (17:41 +0200)]
Configure: use correct variable to infer the .ld file location

We didn't notice the error because it all happened in the top directory.
Now that we use .ld files in subdirectories, the bug became apparent.

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

5 years agoAdd build file support for generic symbol exports with DSOs
Richard Levitte [Thu, 4 Oct 2018 15:41:12 +0000 (17:41 +0200)]
Add build file support for generic symbol exports with DSOs

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

5 years agoChange the build of engines to use ordinal files for symbol export
Richard Levitte [Thu, 4 Oct 2018 15:40:33 +0000 (17:40 +0200)]
Change the build of engines to use ordinal files for symbol export

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

5 years agoutil/mkdef.pl: Produce version scripts from unversioned symbols
Richard Levitte [Thu, 4 Oct 2018 15:14:13 +0000 (17:14 +0200)]
util/mkdef.pl: Produce version scripts from unversioned symbols

This allows setting up export maps for DSOs as well in a uniform way.
This also means that util/mkdef.pl no longer picks up the target
version from configdata.pm, and it has to be given on the command line
instead.  This may be used to give modules separate versions as well,
if desirable.

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

5 years agoExtend the BIO callback tests to check the return value semantics
Matt Caswell [Wed, 3 Oct 2018 14:29:47 +0000 (15:29 +0100)]
Extend the BIO callback tests to check the return value semantics

Check that different return values passed to the BIO callback are
correctly handled.

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

5 years agoFix the BIO callback return code handling
Matt Caswell [Wed, 3 Oct 2018 14:27:31 +0000 (15:27 +0100)]
Fix the BIO callback return code handling

The BIO callback handling incorrectly wrote over the return code passed
to the callback, meaning that an incorrect result was (eventually) returned
to the caller.

Fixes #7343

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

5 years agoRefactor util/mknum.pl for clearer separation of functionality
Richard Levitte [Fri, 14 Sep 2018 13:28:39 +0000 (15:28 +0200)]
Refactor util/mknum.pl for clearer separation of functionality

Rewrite util/mknum.pl to become cleaner, and to use the separate
generic C header parsing module, as well as the separate ordinals
manipulation module.
Adapt the build files.

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

5 years agoAdd code to manipulate the items in OpenSSL::Ordinals
Richard Levitte [Wed, 3 Oct 2018 15:44:59 +0000 (17:44 +0200)]
Add code to manipulate the items in OpenSSL::Ordinals

This means adding the capability to add new items, to invalidate and
revalidate all the items, and to update the file it came from, as well
as the possibility to create new items from other data than a line
from said file.

While we're at it, we throw in a couple of useful filters.

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

5 years agoA perl module to parse through C headers
Richard Levitte [Wed, 3 Oct 2018 15:43:48 +0000 (17:43 +0200)]
A perl module to parse through C headers

OpenSSL::ParseC is a module that parses through a C header file and
returns a list with information on what it found.  Currently, the
information it returns covers function and variable declarations,
macro definitions, struct declarations/definitions and typedef
definitions.

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

5 years agoMove ZLIB from 'platforms' to 'features'
Richard Levitte [Fri, 14 Sep 2018 13:19:37 +0000 (15:19 +0200)]
Move ZLIB from 'platforms' to 'features'

Having it as a 'platform' was conceptually wrong from from the
beginning, and makes decoding more complicated than necessary.

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

5 years agoRefactor util/mkdef.pl for clearer separation of functionality
Richard Levitte [Fri, 14 Sep 2018 12:59:40 +0000 (14:59 +0200)]
Refactor util/mkdef.pl for clearer separation of functionality

Move the .num updating functionality to util/mknum.pl.
Rewrite util/mkdef.pl to create .def / .map / .opt files exclusively,
using the separate ordinals reading module.
Adapt the build files.
Adapt the symbol presence test.

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

5 years agoAdd a perl module that deals with ordinals files
Richard Levitte [Fri, 14 Sep 2018 12:58:11 +0000 (14:58 +0200)]
Add a perl module that deals with ordinals files

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

5 years agoRemove SSL_version_str
Richard Levitte [Tue, 2 Oct 2018 16:57:39 +0000 (18:57 +0200)]
Remove SSL_version_str

I was never exported in our shared libraries and no one noticed, and
we don't seem to use it ourselves, so clean it away.

In all likelyhood, this is a remain from the 90's, when it was in
fashion to litter library modules with these kinds of strings.

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

5 years agoFix the drbgtest with randomized ordering
Matt Caswell [Tue, 2 Oct 2018 12:44:17 +0000 (13:44 +0100)]
Fix the drbgtest with randomized ordering

In drbgtest, test_set_defaults changes the default DRBGs. This works fine
when tests are run in the normal order. However if
OPENSSL_TEST_RAND_ORDER is defined then it may fail (dependent on the
ordering). This environment variable is defined for one of the Travis
tests, so this issue was causing intermittent travis test failures.

[extended tests]

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7338)

5 years agoIgnore libcrypto.ld and libssl.ld
Matt Caswell [Tue, 2 Oct 2018 13:05:14 +0000 (14:05 +0100)]
Ignore libcrypto.ld and libssl.ld

These are auto generated files that should not be checked into git

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

5 years agoFix some Coverity warnings
Matt Caswell [Mon, 1 Oct 2018 12:16:55 +0000 (13:16 +0100)]
Fix some Coverity warnings

Check some return values on some functions.

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

5 years agoFix a mem leak in the ocsp app
Matt Caswell [Mon, 1 Oct 2018 11:06:06 +0000 (12:06 +0100)]
Fix a mem leak in the ocsp app

Free memory allocated in the parent process that is not needed in the
child. We also free it in the parent. Technically this isn't really
required since we end up calling exit() soon afterwards - but to
prevent false positives we free it anyway.

Fixes a Coverity issue.

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

5 years agoChange DRBG's to DRBGs
Shane Lontis [Mon, 1 Oct 2018 23:25:59 +0000 (09:25 +1000)]
Change DRBG's to DRBGs

Minor change to documentation of RAND_DRBG_set_defaults()

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

5 years ago'openssl list': add option -objects to list built in objects
Richard Levitte [Thu, 12 Jul 2018 12:22:43 +0000 (14:22 +0200)]
'openssl list': add option -objects to list built in objects

Related to #6696

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

5 years agoRefactor linker script generation
Richard Levitte [Sun, 30 Sep 2018 12:44:59 +0000 (14:44 +0200)]
Refactor linker script generation

The generation of linker scripts was badly balanced, as all sorts of
platform dependent stuff went into the top build.info, when that part
should really be made as simply and generic as possible.

Therefore, we move a lot of the "magic" to the build files templates,
since they are the place for platform dependent things.  What remains
is to parametrize just enough in the build.info file to generate the
linker scripts correctly for each associated library.

"linker script" is a term usually reserved for certain Unix linkers.
However, we only use them to say what symbols should be exported, so
we use the term loosely for all platforms.  The internal extension is
'.ld', and is changed by the build file templates as appropriate for
each target platform.

Note that this adds extra meaning to the value of the shared_target
attribute.

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

5 years agoClean out aliases in include/openssl/symhacks.h
Richard Levitte [Sun, 30 Sep 2018 00:18:47 +0000 (02:18 +0200)]
Clean out aliases in include/openssl/symhacks.h

Only a few clashing ones remain

Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
(Merged from https://github.com/openssl/openssl/pull/7331)

5 years agoSmall cleanup (util/mkdef.pl, crypto/bio/bss_log.c, include/openssl/ocsp.h)
Richard Levitte [Sat, 29 Sep 2018 23:59:11 +0000 (01:59 +0200)]
Small cleanup (util/mkdef.pl, crypto/bio/bss_log.c, include/openssl/ocsp.h)

BIO_s_log() is declared for everyone, so should return NULL when not
actually implemented.  Also, it had explicit platform limitations in
util/mkdef.pl that didn't correspond to what was actually in code.
While at it, a few other hard coded things that have lost their
relevance were removed.

include/openssl/ocsp.h had a few duplicate declarations.

Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
(Merged from https://github.com/openssl/openssl/pull/7331)

5 years agoAdded DRBG_HMAC & DRBG_HASH + Added defaults for setting DRBG for master/public/priva...
Shane Lontis [Tue, 24 Jul 2018 01:16:38 +0000 (11:16 +1000)]
Added DRBG_HMAC & DRBG_HASH + Added defaults for setting DRBG for master/public/private + renamed generate_counter back to reseed_counter + generated new cavs data tests

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

5 years agoAdd missing cipher aliases to openssl(1)
Antoine Salon [Wed, 26 Sep 2018 08:56:05 +0000 (16:56 +0800)]
Add missing cipher aliases to openssl(1)

And references to other manpages are also added in openssl(1).

Signed-off-by: Antoine Salon <asalon@vmware.com>
Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7314)

5 years agodoc/man3/SSL_set_bio.pod: Fix wrong function name in return values section
James Callahan [Thu, 23 Aug 2018 02:12:05 +0000 (12:12 +1000)]
doc/man3/SSL_set_bio.pod: Fix wrong function name in return values section

Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7035)