oweals/openssl.git
6 years agoChange the "offset too large" message to more generic wording
Bernd Edlinger [Mon, 2 Apr 2018 08:54:52 +0000 (10:54 +0200)]
Change the "offset too large" message to more generic wording

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

(cherry picked from commit 1518c55a796b058eff01f3cbf177f4b726c01d7c)

6 years agoRemove an unnecessary cast in the param to BUF_MEM_grow
Bernd Edlinger [Mon, 2 Apr 2018 08:35:29 +0000 (10:35 +0200)]
Remove an unnecessary cast in the param to BUF_MEM_grow

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

(cherry picked from commit 21db0e1afdcf17a189ebe49af3506551b108a2f2)

6 years agoFix range checks with -offset and -length in asn1parse
Bernd Edlinger [Mon, 2 Apr 2018 07:13:49 +0000 (09:13 +0200)]
Fix range checks with -offset and -length in asn1parse

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

(cherry picked from commit 16e1eea6a67c85c9d786f3c4448182b1aca101b8)

6 years agoUse strtol instead of atoi in asn1parse
Bernd Edlinger [Sun, 1 Apr 2018 09:02:39 +0000 (11:02 +0200)]
Use strtol instead of atoi in asn1parse

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

(cherry picked from commit 18ada952d1dcea8dfc5008df9f317b3eb47c13fa)

6 years agoImprove diagnostics for invalid arguments in asn1parse -strparse
Bernd Edlinger [Sat, 31 Mar 2018 22:46:49 +0000 (00:46 +0200)]
Improve diagnostics for invalid arguments in asn1parse -strparse

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

(cherry picked from commit b998745a4596c05f673ed8acdcaedcb4c5e208ad)

6 years agoFix a crash in the asn1parse command
Bernd Edlinger [Sat, 31 Mar 2018 19:09:32 +0000 (21:09 +0200)]
Fix a crash in the asn1parse command

Thanks to Sem Voigtländer for reporting this issue.

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

(cherry picked from commit 752837e0664e990b5edf6f0b69e1b4612efadce0)

6 years agoEVP,KDF: Add more error code along some return 0
FdaSilvaYY [Thu, 29 Mar 2018 18:59:58 +0000 (20:59 +0200)]
EVP,KDF: Add more error code along some return 0

in methods :
- EVP_PBE_scrypt
- EVP_PKEY_meth_add0
- EVP_PKEY_meth_new
- EVP_PKEY_CTX_dup

Backport of 3484236d8d7afedd3e5c7771bd49d3385340e3bf

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
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/5803)

6 years agoRemove import/use of File::Spec::Function
Daniel Bevenius [Sun, 1 Apr 2018 14:17:52 +0000 (16:17 +0200)]
Remove import/use of File::Spec::Function

It looks like the usage of these functions were removed in
in commit 0a4edb931b883b9973721ae012e60c028387dd50 ("Unified - adapt
the generation of cpuid, uplink and buildinf to use GENERATE").

This commit removes the import/use of File::Spec::Functions module as it
is no longer needed by crypto/build.info.

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

(cherry picked from commit 0e34f37fb1b7474c86ac9a170dfda5226351ecc9)

6 years agoVMS: Copy DECC inclusion epi- and prologues to internals
Richard Levitte [Thu, 20 Apr 2017 08:14:03 +0000 (10:14 +0200)]
VMS: Copy DECC inclusion epi- and prologues to internals

Because many of our test programs use internal headers, we need to make
sure they know how, exactly, to mangle the symbols.  So far, we've done
so by specifying it in the affected test programs, but as things change,
that will develop into a goose chase.  Better then to declare once and
for all how symbols belonging in our libraries are meant to be treated,
internally as well as publically.

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

(cherry picked from commit f46f69f4092768ec4b911ced45c8cc73cc008739)

6 years agoRefuse to run test_cipherlist unless shared library matches build
Richard Levitte [Mon, 26 Mar 2018 09:00:05 +0000 (11:00 +0200)]
Refuse to run test_cipherlist unless shared library matches build

test/cipherlist_test.c is an internal consistency check, and therefore
requires that the shared library it runs against matches what it was
built for.  test/recipes/test_cipherlist.t is made to refuse running
unless library version and build version match.

This adds a helper program test/versions.c, that simply displays the
library and the build version.

Partially fixes #5751

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

6 years ago.travis.yml: with fast fuzz testing, there is no point avoiding it
Richard Levitte [Thu, 29 Mar 2018 08:21:54 +0000 (10:21 +0200)]
.travis.yml: with fast fuzz testing, there is no point avoiding it

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

6 years agoFaster fuzz test: teach the fuzz test programs to handle directories
Richard Levitte [Wed, 28 Mar 2018 13:46:28 +0000 (15:46 +0200)]
Faster fuzz test: teach the fuzz test programs to handle directories

Instead of invoking the fuzz test programs once for every corpora
file, we invoke them once for each directory of corpora files.  This
dramatically reduces the number of program invokations, as well as the
time 90-test_fuzz.t takes to complete.

fuzz/test-corpus.c was enhanced to handle directories as well as
regular files.

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

6 years agoRevert "util/dofile.pl: only quote stuff that actually needs quoting"
Richard Levitte [Wed, 28 Mar 2018 12:46:27 +0000 (14:46 +0200)]
Revert "util/dofile.pl: only quote stuff that actually needs quoting"

This wasn't a good solution, too many things depend on the quotes being
there consistently.

This reverts commit 49cd47eaababc8c57871b929080fc1357e2ad7b8.

Fixes #5772

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

(cherry picked from commit 00701e5ea84861b74d9d624f21a6b3fcb12e8acd)

6 years agoTolerate a Certificate using a non-supported group on server side
Matt Caswell [Tue, 13 Mar 2018 17:23:10 +0000 (17:23 +0000)]
Tolerate a Certificate using a non-supported group on server side

If a server has been configured to use an ECDSA certificate, we should
allow it regardless of whether the server's own supported groups list
includes the certificate's group.

Fixes #2033

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

6 years agoAdds multiple checks to avoid buffer over reads
Philippe Antoine [Mon, 26 Mar 2018 08:23:51 +0000 (10:23 +0200)]
Adds multiple checks to avoid buffer over reads

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

6 years agoo_time.c: use gmtime_s with MSVC
Miroslav Suk [Thu, 22 Mar 2018 08:20:43 +0000 (09:20 +0100)]
o_time.c: use gmtime_s with MSVC
ts/ts_rsp_sign.c: change to OPENSSL_gmtime.

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

(cherry picked from commit 98c03302fb7b855647aa14022f61f5fb272e514a)

6 years agoFix typo in OPENSSL_LH_new compat API
Rich Salz [Tue, 25 Apr 2017 00:24:38 +0000 (20:24 -0400)]
Fix typo in OPENSSL_LH_new compat API

CLA: trivial

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

6 years agoDon't write out a bad OID
Matt Caswell [Thu, 22 Mar 2018 14:33:05 +0000 (14:33 +0000)]
Don't write out a bad OID

If we don't have OID data for an object then we should fail if we
are asked to encode the ASN.1 for that OID.

Fixes #5723

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

(cherry picked from commit 53c9818e970fc0c22d77e19fda3b3e6f6c9e759d)

6 years agoPrepare for 1.1.0i-dev
Matt Caswell [Tue, 27 Mar 2018 13:51:46 +0000 (14:51 +0100)]
Prepare for 1.1.0i-dev

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agoPrepare for 1.1.0h release OpenSSL_1_1_0h
Matt Caswell [Tue, 27 Mar 2018 13:50:36 +0000 (14:50 +0100)]
Prepare for 1.1.0h release

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agoUpdate copyright year
Matt Caswell [Tue, 27 Mar 2018 12:43:23 +0000 (13:43 +0100)]
Update copyright year

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agoUpdate CHANGES and NEWS for the new release
Matt Caswell [Tue, 27 Mar 2018 09:58:34 +0000 (10:58 +0100)]
Update CHANGES and NEWS for the new release

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agopariscid.pl: fix nasty typo in CRYPTO_memcmp.
Andy Polyakov [Wed, 21 Mar 2018 22:48:10 +0000 (23:48 +0100)]
pariscid.pl: fix nasty typo in CRYPTO_memcmp.

Comparison was effectively reduced to least significant bits.

CVE-2018-0733

Reviewed-by: Matt Caswell <matt@openssl.org>
6 years agoAdd fuzz corpora file that found the ASN.1 stack depth issue
Matt Caswell [Fri, 26 Jan 2018 16:23:03 +0000 (16:23 +0000)]
Add fuzz corpora file that found the ASN.1 stack depth issue

Reviewed-by: Rich Salz <rsalz@openssl.org>
6 years agoLimit ASN.1 constructed types recursive definition depth
Matt Caswell [Thu, 22 Mar 2018 09:39:53 +0000 (09:39 +0000)]
Limit ASN.1 constructed types recursive definition depth

Constructed types with a recursive definition (such as can be found in
PKCS7) could eventually exceed the stack given malicious input with
excessive recursion. Therefore we limit the stack depth.

CVE-2018-0739

Credit to OSSFuzz for finding this issue.

Reviewed-by: Rich Salz <rsalz@openssl.org>
6 years agoCopy the produced .dll files to fuzz/ as well (Cygwin & mingw)
Richard Levitte [Tue, 27 Mar 2018 09:10:15 +0000 (11:10 +0200)]
Copy the produced .dll files to fuzz/ as well (Cygwin & mingw)

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

6 years agoPreviously this x509 command line was working, restore that
Bernd Edlinger [Sun, 25 Mar 2018 11:47:48 +0000 (13:47 +0200)]
Previously this x509 command line was working, restore that

openssl x509 -in server.pem -signkey privkey.pem -out server.pem

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

6 years agoFix dsaparam -genkey with DER outform
Bernd Edlinger [Sun, 25 Mar 2018 10:50:17 +0000 (12:50 +0200)]
Fix dsaparam -genkey with DER outform

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

(cherry picked from commit 5281435258b5d8201a00b4a9781bb724d99630f0)

6 years agoFix ecparam -genkey with point compression or DER outform
Bernd Edlinger [Sat, 24 Mar 2018 14:17:11 +0000 (15:17 +0100)]
Fix ecparam -genkey with point compression or DER outform

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

(cherry picked from commit 4bdc25b07f007d9c383fbad159f81543f2e95965)

6 years agoHandle partial messages in TLSProxy
Bernd Edlinger [Thu, 22 Mar 2018 16:28:39 +0000 (17:28 +0100)]
Handle partial messages in TLSProxy

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

6 years agoThe default conv_form is uncompressed
Matt Caswell [Wed, 21 Mar 2018 16:27:55 +0000 (16:27 +0000)]
The default conv_form is uncompressed

Fixes #5711

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

(cherry picked from commit ab0a3914a64d8f1fce22795c02269e1288df52b1)

6 years agoconsttime flag changed
Samuel Weiser [Fri, 9 Feb 2018 13:11:47 +0000 (14:11 +0100)]
consttime flag changed

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

6 years agoused ERR set/pop mark
Samuel Weiser [Wed, 31 Jan 2018 12:10:55 +0000 (13:10 +0100)]
used ERR set/pop mark

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

6 years agoReplaced variable-time GCD with consttime inversion to avoid side-channel attacks...
Samuel Weiser [Tue, 5 Dec 2017 14:55:17 +0000 (15:55 +0100)]
Replaced variable-time GCD with consttime inversion to avoid side-channel attacks on RSA key generation

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

6 years agoCleanup the s_time command.
Bernd Edlinger [Wed, 21 Mar 2018 16:27:44 +0000 (17:27 +0100)]
Cleanup the s_time command.

Various code-cleanups.
Use SSL_CTX_set_mode(ctx, SSL_MODE_AUTO_RETRY) insead of handling
SSL_ERROR_WANT_READ everywhere.
Turn off the linger option on connected sockets to avoid failure.
Add BIO_set_conn_mode(conn, BIO_SOCK_NODELAY) to improve thruput.
Continue test even without -cipher option as in 1.0.2.

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

6 years agoDon't wait for dry at the end of a handshake
Matt Caswell [Tue, 16 Jan 2018 11:26:50 +0000 (11:26 +0000)]
Don't wait for dry at the end of a handshake

For DTLS/SCTP we were waiting for a dry event during the call to
tls_finish_handshake(). This function just tidies up various internal
things, and after it completes the handshake is over. I can find no good
reason for waiting for a dry event here, and nothing in RFC6083 suggests
to me that we should need to. More importantly though it seems to be
wrong. It is perfectly possible for a peer to send app data/alerts/new
handshake while we are still cleaning up our handshake. If this happens
then we will never get the dry event and so we cannot continue.

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

6 years agoCheck for alerts while waiting for a dry event
Matt Caswell [Tue, 16 Jan 2018 10:48:01 +0000 (10:48 +0000)]
Check for alerts while waiting for a dry event

At a couple of points in a DTLS/SCTP handshake we need to wait for a dry
event before continuing. However if an alert has been sent by the peer
then we will never receive that dry event and an infinite loop results.

This commit changes things so that we attempt to read a message if we
are waiting for a dry event but haven't got one yet. This should never
succeed, but any alerts will be processed.

Fixes #4763

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

6 years agoDo not cache sessions with zero sid_ctx_length when SSL_VERIFY_PEER
Benjamin Kaduk [Fri, 26 Jan 2018 17:16:21 +0000 (11:16 -0600)]
Do not cache sessions with zero sid_ctx_length when SSL_VERIFY_PEER

The sid_ctx is something of a "certificate request context" or a
"session ID context" -- something from the application that gives
extra indication of what sort of thing this session is/was for/from.
Without a sid_ctx, we only know that there is a session that we
issued, but it could have come from a number of things, especially
with an external (shared) session cache.  Accordingly, when resuming,
we will hard-error the handshake when presented with a session with
zero-length sid_ctx and SSL_VERIFY_PEER is set -- we simply have no
information about the peer to verify, so the verification must fail.

In order to prevent these future handshake failures, proactively
decline to add the problematic sessions to the session cache.

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

(cherry picked from commit d316cdcf6d8d6934663278145fe0a8191e14a8c5)

6 years agoRemove mentioned link between message digests and public key algorithms.
Pauli [Tue, 20 Mar 2018 01:09:38 +0000 (11:09 +1000)]
Remove mentioned link between message digests and public key algorithms.

Refer #5682 This is the same but for 1.1.0

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

6 years agoMake pkeyutl a bit more user-friendly
Johannes Bauer [Tue, 20 Mar 2018 19:34:41 +0000 (20:34 +0100)]
Make pkeyutl a bit more user-friendly

Give meaningful error messages when the user incorrectly uses pkeyutl;
backport to OpenSSL_1_1_0-stable, cherrypicked from
f6add6ac2c42df37d63b36dbef43e701875893d7.

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

6 years agos_client, s_server: do generic SSL configuration first, specialization after
Richard Levitte [Mon, 19 Mar 2018 19:33:50 +0000 (20:33 +0100)]
s_client, s_server: do generic SSL configuration first, specialization after

We did the SSL_CONF_cmd() pass last of all things that could affect
the SSL ctx.  However, the results of this, for example:

    -max_protocol TLSv1.3 -tls1_2

... would mean that the protocol min got set to TLSv1.2 and the
protocol max to TLSv1.3, when they should clearly both be TLSv1.2.

However, if we see the SSL_CONF_cmd() switches as generic and those
internal to s_client and s_server as specialisations, we get something
that makes a little more sense.

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

(cherry picked from commit 8f8be103fd7d8b5992724d618c99cbddd7dd00d7)

6 years agoEnhance ssltestlib's create_ssl_ctx_pair to take min and max proto version
Richard Levitte [Mon, 19 Mar 2018 08:08:06 +0000 (09:08 +0100)]
Enhance ssltestlib's create_ssl_ctx_pair to take min and max proto version

Have all test programs using that function specify those versions.
Additionally, have the remaining test programs that use SSL_CTX_new
directly specify at least the maximum protocol version.

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

6 years agoIn TLSProxy::Proxy, specify TLSv1.2 as maximum allowable protocol
Richard Levitte [Mon, 19 Mar 2018 07:06:22 +0000 (08:06 +0100)]
In TLSProxy::Proxy, specify TLSv1.2 as maximum allowable protocol

Partially fixes #5661

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

6 years agoSupport "-min_protocol" and "-max_protocol" in s_server and s_client
Richard Levitte [Mon, 19 Mar 2018 06:48:33 +0000 (07:48 +0100)]
Support "-min_protocol" and "-max_protocol" in s_server and s_client

If for nothing else, they are needed when doing a regression test

Partially fixes #5661

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

6 years agoStop test/shlibloadtest.c from failing in a regression test
Richard Levitte [Wed, 14 Mar 2018 16:31:20 +0000 (17:31 +0100)]
Stop test/shlibloadtest.c from failing in a regression test

When doing a regression test, it's obvious that the version
test/shlibloadtest is built for will not be the same as the library
version.  So we change the test to check for assumed compatibility.

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

6 years agoAdd a simple method to run regression tests
Richard Levitte [Wed, 14 Mar 2018 16:25:37 +0000 (17:25 +0100)]
Add a simple method to run regression tests

This is only useful when building shared libraries.  This allows us to
run our tests against newer libraries when the time comes.  Simply do
this:

    OPENSSL_REGRESSION=/other/OpenSSL/build/tree make test

($OPENSSL_REGRESSION *must* be an absolute path)

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

6 years agoFix a memory leak in tls1_mac
Bernd Edlinger [Fri, 16 Mar 2018 20:36:48 +0000 (21:36 +0100)]
Fix a memory leak in tls1_mac

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

6 years agoFix a memory leak in n_ssl3_mac
Bernd Edlinger [Fri, 16 Mar 2018 16:07:54 +0000 (17:07 +0100)]
Fix a memory leak in n_ssl3_mac

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

6 years agoFix error handling in b2i_dss and b2i_rsa
Bernd Edlinger [Thu, 15 Mar 2018 11:34:12 +0000 (12:34 +0100)]
Fix error handling in b2i_dss and b2i_rsa

Fixes: #5567

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

(cherry picked from commit d288d7fc7beaa1d720a539d6ae27dba2c910ee68)

6 years agoWindows makefile: don't use different looking variants of same cmd
Richard Levitte [Thu, 15 Mar 2018 20:37:32 +0000 (21:37 +0100)]
Windows makefile: don't use different looking variants of same cmd

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

(cherry picked from commit ad3350a90b81275ed2357cad0b9d435d6077bf9d)

6 years agoFix a memory leak in the ca application
Matt Caswell [Wed, 14 Mar 2018 14:32:48 +0000 (14:32 +0000)]
Fix a memory leak in the ca application

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

6 years agoAllow multiple entries without a Subject even if unique_subject == yes
Matt Caswell [Fri, 23 Feb 2018 19:48:11 +0000 (19:48 +0000)]
Allow multiple entries without a Subject even if unique_subject == yes

It is quite likely for there to be multiple certificates with empty
subjects, which are still distinct because of subjectAltName. Therefore
we allow multiple certificates with an empty Subject even if
unique_subject is set to yes.

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

6 years agoReport a readable error on a duplicate cert in ca app
Matt Caswell [Fri, 23 Feb 2018 18:28:47 +0000 (18:28 +0000)]
Report a readable error on a duplicate cert in ca app

Commit 87e8feca (16 years ago!) introduced a bug where if we are
attempting to insert a cert with a duplicate subject name, and
duplicate subject names are not allowed (which is the default),
then we get an unhelpful error message back (error number 2). Prior
to that commit we got a helpful error message which displayed details
of the conflicting entry in the database.

That commit was itself attempting to fix a bug with the noemailDN option
where we were setting the subject field in the database too early
(before extensions had made any amendments to it).

This PR moves the check for a conflicting Subject name until after all
changes to the Subject have been made by extensions etc.

This also, co-incidentally fixes the ca crashing bug described in issue
5109.

Fixes #5109

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

6 years agoRevert "Don't allow an empty Subject when creating a Certificate"
Matt Caswell [Fri, 23 Feb 2018 09:46:30 +0000 (09:46 +0000)]
Revert "Don't allow an empty Subject when creating a Certificate"

This reverts commit f2982ad79c9eeac4d8ee4225056f971eadf9302b.

Empty Subjects should be permissible.

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

6 years agoRevert "Don't crash on a missing Subject in index.txt"
Matt Caswell [Fri, 23 Feb 2018 09:46:06 +0000 (09:46 +0000)]
Revert "Don't crash on a missing Subject in index.txt"

This reverts commit 462163e91a6f06e8bf0791a01f6e0a1897ad2081.

Empty subjects should be permissible.

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

6 years agoFree the correct type in OBJ_add_object()
Matt Caswell [Mon, 12 Mar 2018 15:24:29 +0000 (15:24 +0000)]
Free the correct type in OBJ_add_object()

We should be using ASN1_OBJECT_free() not OPENSSL_free().

Fixes #5568

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

6 years agoImprove error handling in pk7_doit
Matt Caswell [Mon, 12 Mar 2018 13:56:34 +0000 (13:56 +0000)]
Improve error handling in pk7_doit

If a mem allocation failed we would ignore it. This commit fixes it to
always check.

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

(cherry picked from commit 4718f449a3ecd5efac62b22d0fa9a759a7895dbc)

6 years agoConfigurations/unix-Makefile.tmpl: overhaul assembler make rules.
Andy Polyakov [Sat, 10 Mar 2018 15:19:33 +0000 (16:19 +0100)]
Configurations/unix-Makefile.tmpl: overhaul assembler make rules.

So far assembly modules were built as .pl->.S->.s followed by .s->.o.
This posed a problem in build_all_generated rule if it was executed
on another computer. So we change rule sequence to .pl->.S and then
.S->.s->.o.

(backport of a23f03166e0ec49ac09b3671e7ab4ba4fa57d42a)

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

6 years agoFix propotype to include the const qualifier
Kurt Roeckx [Sat, 10 Mar 2018 15:32:55 +0000 (16:32 +0100)]
Fix propotype to include the const qualifier

Reviewed-by: Andy Polyakov <appro@openssl.org>
GH: #5582

6 years agoConfigure: catch the build tree configdata.pm
Richard Levitte [Thu, 8 Mar 2018 11:01:28 +0000 (12:01 +0100)]
Configure: catch the build tree configdata.pm

There are things depending on configdata.pm.  However, it's perfectly
possible that there is one in the source directory from a previous
build, and that might disrupt an out of source build.  To avoid this
conflict, make sure never to use the source tree configdata.pm in that
case, i.e. make the hard assumption that it's a generated file in the
build tree, which it is.

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

(cherry picked from commit 846e4c4d650da50f049ee74901e840ffe409fa69)

6 years agoConfigure: don't mangle the directory again when checking DEPEND inclusion
Richard Levitte [Wed, 7 Mar 2018 14:58:04 +0000 (15:58 +0100)]
Configure: don't mangle the directory again when checking DEPEND inclusion

When generating the correct inclusion directory for DEPEND, we mangled
it to be relative to the build or the source directory.  However, the
value we handle already come with a correct directory, so we only need
to use it as is.

Fixes #5543

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

(cherry picked from commit 906032d5a04f8cf8af5f515e0a8ea44a2285a2cc)

6 years agoRestore the display of options with 'openssl version -a'
Richard Levitte [Fri, 9 Mar 2018 13:28:51 +0000 (14:28 +0100)]
Restore the display of options with 'openssl version -a'

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

(cherry picked from commit b971b05ec6893fe7a3416a3b34d50a52b6cfe9bc)

6 years agoConfigurations/10-main.conf: add -fno-common back to darwin-ppc-cc.
Andy Polyakov [Tue, 6 Mar 2018 22:33:06 +0000 (23:33 +0100)]
Configurations/10-main.conf: add -fno-common back to darwin-ppc-cc.

-fno-common was removed for all Darwin targets in
0c8734198d4282f6997965a03cd2e0ceaf207549 with rationale "it's either
'ranlib -c' or '-fno-common'." However, it's still absolutely required
in 32-bit darwin-ppc-cc. And when trying things out I didn't quite
see why it was formulated as one-or-another choice, as 'ranlib -c'
shouldn't [and doesn't] have problems with object modules without
commons. [Well, to be frank, I didn't manage to reproduce the problem
the modification was meaning to resolve either...]

(backport of 107783d9c56e7dcb338c011fa202ffa8f066dbca)

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agoRemove useless -D_ENDIAN from MPE/iX-gcc config
Richard Levitte [Thu, 8 Mar 2018 21:04:33 +0000 (22:04 +0100)]
Remove useless -D_ENDIAN from MPE/iX-gcc config

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

6 years agoMake a few more asm modules conform: last argument is output file
Richard Levitte [Sat, 10 Feb 2018 07:52:12 +0000 (08:52 +0100)]
Make a few more asm modules conform: last argument is output file

Fixes #5310

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

6 years agoConfigurations/unix-Makefile.tmpl: remove assignment of AS and ASFLAGS
Richard Levitte [Wed, 7 Mar 2018 13:52:47 +0000 (14:52 +0100)]
Configurations/unix-Makefile.tmpl: remove assignment of AS and ASFLAGS

We have never used these variables with the Unix Makefile, and there's
no reason for us to change this, so to avoid confusion, we remove them.

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

(cherry picked from commit 61ab6919183fe804f3ed5cf26fcc121a4ecbb6af)

6 years agoBIO_s_mem.pod: fix indirection for out parameter **pp
Dr. Matthias St. Pierre [Wed, 7 Mar 2018 13:37:23 +0000 (14:37 +0100)]
BIO_s_mem.pod: fix indirection for out parameter **pp

BIO_get_mem_data() and BIO_get_mem_ptr() assign to *pp, not pp

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

6 years agoutil/dofile.pl: only quote stuff that actually needs quoting
Richard Levitte [Tue, 6 Mar 2018 20:05:16 +0000 (21:05 +0100)]
util/dofile.pl: only quote stuff that actually needs quoting

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

(cherry picked from commit 49cd47eaababc8c57871b929080fc1357e2ad7b8)

6 years agoopensslconf.h.in: Use all the "openssl_api_defines"
Richard Levitte [Tue, 6 Mar 2018 20:04:11 +0000 (21:04 +0100)]
opensslconf.h.in: Use all the "openssl_api_defines"

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

(cherry picked from commit cd15cb4d21fce81c94bc16f991c4bb1c73e71bfe)

6 years agoAvoid unconditional store in CRYPTO_malloc.
knekritz [Tue, 6 Mar 2018 18:21:49 +0000 (13:21 -0500)]
Avoid unconditional store in CRYPTO_malloc.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5372)
(cherry picked from commit 41aede863b76202347c2d5e2c2666428084f9203)

6 years agod2i_X509.pod: clarify usage of the 'pp' function parameter
Dr. Matthias St. Pierre [Wed, 14 Feb 2018 11:21:26 +0000 (12:21 +0100)]
d2i_X509.pod: clarify usage of the 'pp' function parameter

The 'pp' function parameters of d2i_TYPE() and i2d_TYPE() are referenced
in the DESCRIPTION section as 'in' resp. 'out'. This commit renames the
references to 'ppin' resp. 'ppout' and adds an explaining sentence.

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

6 years agoFix credit for SRP code
Rich Salz [Sun, 4 Mar 2018 23:53:45 +0000 (18:53 -0500)]
Fix credit for SRP code

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

6 years agoWindows makefile: Don't quote generator arguments
Richard Levitte [Sat, 3 Mar 2018 22:07:14 +0000 (23:07 +0100)]
Windows makefile: Don't quote generator arguments

Rely on the build.info constructor to do the right thing.

Fixes #5500

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

(cherry picked from commit 1c9858d0d013184ff756d063022161b1853a9cbf)

6 years agomem_sec.c: portability fixup.
Andy Polyakov [Fri, 2 Mar 2018 15:50:11 +0000 (16:50 +0100)]
mem_sec.c: portability fixup.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/5493)

(cherry picked from commit 014cc4b27a7f8ed0cf23a3c9d1fdbf44e41b7993)

6 years agoFix a possible memory leak in engine_table_register
Bernd Edlinger [Fri, 2 Mar 2018 08:27:39 +0000 (09:27 +0100)]
Fix a possible memory leak in engine_table_register

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

(cherry picked from commit 55a7f77d72930f9aee1a51e0af9658b2728be127)

6 years agoFixed a typo in a man page
Alex Gaynor [Sat, 3 Mar 2018 16:37:07 +0000 (11:37 -0500)]
Fixed a typo in a man page

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5498)
(cherry picked from commit c03dc6427cb8d15ddce735b5e5beef606bdea51d)

6 years agoFix typo in ASN1_STRING_length doc
Ivan Filenko [Sun, 25 Feb 2018 13:49:27 +0000 (16:49 +0300)]
Fix typo in ASN1_STRING_length doc

CLA: trivial

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/5458)

6 years agoTest the result of CMS_RecipientInfo_ktri_get0_algs() before using its output in...
Brad Spencer [Wed, 20 Dec 2017 17:41:14 +0000 (13:41 -0400)]
Test the result of CMS_RecipientInfo_ktri_get0_algs() before using its output in rsa_cms_encrypt().

CLA: trivial

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/4966)

(cherry picked from commit 178989b4a3ed714fa169cae5865c75f156ec9fdb)

6 years agoAlways use adr with __thumb2__.
David Benjamin [Wed, 21 Feb 2018 23:50:21 +0000 (18:50 -0500)]
Always use adr with __thumb2__.

Thumb2 addresses are a bit a mess, depending on whether a label is
interpreted as a function pointer value (for use with BX and BLX) or as
a program counter value (for use with PC-relative addressing). Clang's
integrated assembler mis-assembles this code. See
https://crbug.com/124610#c54 for details.

Instead, use the ADR pseudo-instruction which has clear semantics and
should be supported by every assembler that handles the OpenSSL Thumb2
code. (In other files, the ADR vs SUB conditionals are based on
__thumb2__ already. For some reason, this one is based on __APPLE__, I'm
guessing to deal with an older version of clang assembler.)

It's unclear to me which of clang or binutils is "correct" or if this is
even a well-defined notion beyond "whatever binutils does". But I will
note that https://github.com/openssl/openssl/pull/4669 suggests binutils
has also changed behavior around this before.

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

(cherry picked from commit 8a5d8bc4bc1e835b62d988ad63454540be83d862)

6 years agobio_b64.c: prevent base64 filter BIO from decoding out-of-bound data
Dr. Matthias St. Pierre [Wed, 21 Feb 2018 00:45:14 +0000 (01:45 +0100)]
bio_b64.c: prevent base64 filter BIO from decoding out-of-bound data

Fixes #5405, #1381

The base64 filter BIO reads its input in chunks of B64_BLOCK_SIZE bytes.
When processing input in PEM format it can happen in rare cases that

- the trailing PEM marker crosses the boundary of a chunk, and
- the beginning of the following chunk contains valid base64 encoded data.

This happened in issue #5405, where the PEM marker was split into
"-----END CER" and "TIFICATE-----" at the end of the first chunk.

The decoding of the first chunk terminated correctly at the '-' character,
which is treated as an EOF marker, and b64_read() returned. However,
when called the second time, b64_read() read the next chunk and interpreted
the string "TIFICATE" as valid base64 encoded data, adding 6 extra bytes
'4c 81 48 08 04 c4'.

This patch restores the assignment of the error code to 'ctx->cont', which
was deleted accidentally in commit 5562cfaca4f3 and which prevents b64_read()
from reading additional data on subsequent calls.

This issue was observed and reported by Annie Yousar.

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

6 years agomem_sec.c: relax POSIX requirement.
Andy Polyakov [Sun, 25 Feb 2018 15:56:26 +0000 (16:56 +0100)]
mem_sec.c: relax POSIX requirement.

Even though mlock(2) was standardized in POSIX.1-2001, vendors did
implement it prior that point.

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

(cherry picked from commit 5839185cdd9b339ff741da437d964a25e72a3fb6)

6 years agotest/recipes/80-test_pkcs12.t: handle lack of Win32::API.
Andy Polyakov [Tue, 20 Feb 2018 11:43:35 +0000 (12:43 +0100)]
test/recipes/80-test_pkcs12.t: handle lack of Win32::API.

So far check for availability of Win32::API served as implicit check
for $^O being MSWin32. Reportedly it's not safe assumption, and check
for MSWin32 has to be explicit.

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

(cherry picked from commit d4c499f562c1ab7ec7773c3987fc4dce7662a805)

6 years agoFix some bugs with the cfb1 bitsize handling
Bernd Edlinger [Wed, 21 Feb 2018 14:48:02 +0000 (15:48 +0100)]
Fix some bugs with the cfb1 bitsize handling

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

(cherry picked from commit 604e591ed75eff9296c21ee5fe93f3e9ec246094)

6 years agoUpdate EC_POINT_new.pod
Per Sandström [Wed, 14 Feb 2018 13:08:33 +0000 (14:08 +0100)]
Update EC_POINT_new.pod

CLA: trivial
fix typo:
EC_point2buf => EC_POINT_point2buf

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

(cherry picked from commit 6f4b929af0b7dfb6a4d420fc9a8e25016f616c10)

6 years agodo_body: fix heap-use-after-free.
Pavel Kopyl [Fri, 3 Nov 2017 19:18:35 +0000 (22:18 +0300)]
do_body: fix heap-use-after-free.

The memory pointed to by the 'push' is freed by the
X509_NAME_ENTRY_free() in do_body(). The second time
it is referenced to (indirectly) in certify_cert:X509_REQ_free().

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

6 years agoX509V3_EXT_add_nconf_sk, X509v3_add_ext: fix errors handling
Pavel Kopyl [Tue, 7 Nov 2017 12:28:18 +0000 (15:28 +0300)]
X509V3_EXT_add_nconf_sk, X509v3_add_ext: fix errors handling

X509v3_add_ext: free 'sk' if the memory pointed to by it
was malloc-ed inside this function.
X509V3_EXT_add_nconf_sk: return an error if X509v3_add_ext() fails.
This prevents use of a freed memory in do_body:sk_X509_EXTENSION_num().

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

6 years agoSanity check the ticket length before using key name/IV
Matt Caswell [Tue, 20 Feb 2018 10:20:20 +0000 (10:20 +0000)]
Sanity check the ticket length before using key name/IV

This could in theory result in an overread - but due to the over allocation
of the underlying buffer does not represent a security issue.

Thanks to Fedor Indutny for reporting this issue.

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

6 years agoAdd X509_get0_authority_key_id() function
Massimiliano Pala [Mon, 19 Feb 2018 20:47:02 +0000 (15:47 -0500)]
Add X509_get0_authority_key_id() function

This function makes it easier to retrieve a reference to the
authority key identifier (akid->keyid) inside a certificate.

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

(cherry picked from commit b383aa2081467e8d49c3362d295da7bd5cb4e1d8)

6 years agotest_ssl_old: avoid empty strings for flags
Richard Levitte [Fri, 16 Feb 2018 22:34:32 +0000 (23:34 +0100)]
test_ssl_old: avoid empty strings for flags

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

(cherry picked from commit 62930b2ecf6ce308fd2ae9ee3e34ace8ba698aac)

6 years agoOpenSSL::Test::quotify: put quotes around empty arguments
Richard Levitte [Fri, 16 Feb 2018 22:28:31 +0000 (23:28 +0100)]
OpenSSL::Test::quotify: put quotes around empty arguments

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

(cherry picked from commit 5845f7de8165f35829e49acd41f6a2fc3698f221)

6 years agoCheck the return code from ASN1_TIME_diff()
Matt Caswell [Mon, 12 Feb 2018 17:47:50 +0000 (17:47 +0000)]
Check the return code from ASN1_TIME_diff()

The function can fail so we should check the return code.

Found by Coverity

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

(cherry picked from commit 0d502c3511ab3b1c8acb129fb3af836727b8092d)

6 years agoThe function X509_gmtime_adj() can fail
Matt Caswell [Mon, 12 Feb 2018 17:43:38 +0000 (17:43 +0000)]
The function X509_gmtime_adj() can fail

Check for a failure and free a_tm as appropriate.

Found by Coverity

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

(cherry picked from commit bc2a0dd283c0f61df572b8c2aaf3bfc2dd4b7571)

6 years agoAvoid fragile aliasing of SHA224/384 update/final
Viktor Dukhovni [Wed, 14 Feb 2018 03:43:15 +0000 (22:43 -0500)]
Avoid fragile aliasing of SHA224/384 update/final

This is purported to save a few cycles, but makes the code less
obvious and more brittle, and in fact breaks on platforms where for
ABI continuity reasons there is a SHA2 implementation in libc, and
so EVP needs to call those to avoid conflicts.

A sufficiently good optimizer could simply generate the same entry
points for:

        foo(...) { ... }
    and
        bar(...) { return foo(...); }

but, even without that, the different is negligible, with the
"winner" varying from run to run (openssl speed -evp sha384):

    Old:
    type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes 16384 bytes
    sha384           28864.28k   117362.62k   266469.21k   483258.03k   635144.87k 649123.16k

    New:
    type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes 16384 bytes
    sha384           30055.18k   120725.98k   272057.26k   482847.40k   634585.09k 650308.27k

Reviewed-by: Rich Salz <rsalz@openssl.org>
6 years agoConfigure: if a file is generated, never assume it's in the source dir
Richard Levitte [Tue, 13 Feb 2018 18:46:10 +0000 (19:46 +0100)]
Configure: if a file is generated, never assume it's in the source dir

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

(cherry picked from commit 9b7e82f8d939ca6894f941268b219da55f069b26)

6 years agoFix bug in BIO_f_linebuffer()
Richard Levitte [Tue, 13 Feb 2018 18:18:46 +0000 (19:18 +0100)]
Fix bug in BIO_f_linebuffer()

In BIO_f_linebuffer, this would cause an error:

    BIO_write(bio, "1\n", 1);

I.e. there's a \n just after the part of the string that we currently
ask to get written.

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

6 years agoCopy dlls into fuzz directory
Matt Caswell [Wed, 16 Aug 2017 13:33:13 +0000 (14:33 +0100)]
Copy dlls into fuzz directory

This should fix the recent AppVeyor failures.

[extended tests]

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

(cherry picked from commit 30bb02597df9a79b46bae2ddc9885a35286ed205)

6 years agoAdd the target 'build_all_generated'
Richard Levitte [Fri, 16 Jun 2017 01:46:41 +0000 (03:46 +0200)]
Add the target 'build_all_generated'

This new target is used to build all generated files and only that.
This can be used to prepare everything that requires things like perl
for a system that lacks perl and then move everything to that system
and do the rest of the build there.

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

(cherry picked from commit 9b03b91b84b64c086081b87bd0a2c7d3612af6c0)

6 years agoRemove code that prints "<SPACES/NULS>" in hexdumps
Bernd Edlinger [Mon, 12 Feb 2018 08:28:33 +0000 (09:28 +0100)]
Remove code that prints "<SPACES/NULS>" in hexdumps
when the data block ends with SPACEs or NULs.

The problem is, you can't see if the data ends
with SPACE or NUL or a combination of both.

This can happen for instance with
openssl rsautl -decrypt -hexdump

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

6 years agoCopy name string in BIO_meth_new
Rich Salz [Sat, 10 Feb 2018 20:07:39 +0000 (15:07 -0500)]
Copy name string in BIO_meth_new

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

6 years agoAvoid leaking peername data via accept BIOs
Viktor Dukhovni [Fri, 9 Feb 2018 23:34:33 +0000 (18:34 -0500)]
Avoid leaking peername data via accept BIOs

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 4e0752535eb87b9aab4cf193f4422b5801ab7b32)