17985 Commits

Author SHA1 Message Date
Matt Caswell
8c9365a690 Fix length check writing status request extension
The status request extension did not correctly check its length, meaning
that writing the extension could go 2 bytes beyond the buffer size. In
practice this makes little difference because, due to logic in buffer.c the
buffer is actually over allocated by approximately 5k!

Issue reported by Guido Vranken.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-10-28 09:40:55 +01:00
Matt Caswell
3bceb47a27 Fix a double free in ca command line
Providing a spkac file with no default section causes a double free.

Thanks to Brian Carpenter for reporting this issue.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
(cherry picked from commit 229bd12487f8576fc088dc4f641950ac33c62033)
2016-10-28 09:30:40 +01:00
Matt Caswell
dafa1c85b9 Add a test for BIO_read() returning 0 in SSL_read() (and also for write)
A BIO_read() 0 return indicates that a failure occurred that may be
retryable. An SSL_read() 0 return indicates a non-retryable failure. Check
that if BIO_read() returns 0, SSL_read() returns <0. Same for SSL_write().

The asyncio test filter BIO already returns 0 on a retryable failure so we
build on that.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit a34ac5b8b9c1a3281b4ee545c46177f485fb4949)
2016-10-28 09:17:30 +01:00
Matt Caswell
122580ef71 A zero return from BIO_read()/BIO_write() could be retryable
A zero return from BIO_read()/BIO_write() could mean that an IO operation
is retryable. A zero return from SSL_read()/SSL_write() means that the
connection has been closed down (either cleanly or not). Therefore we
should not propagate a zero return value from BIO_read()/BIO_write() back
up the stack to SSL_read()/SSL_write(). This could result in a retryable
failure being treated as fatal.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 4880672a9b41a09a0984b55e219f02a2de7ab75e)
2016-10-28 09:17:30 +01:00
Richard Levitte
207a9cb352 VMS: tell the C compiler to use the ISO C94 standard
The current version of the VMS compiler provides C99 features,
strictly language wise.  Unfortunately, even the most recent standard
library isn't fully updated for that standard, so we need to use an
earlier standard that the compiler supports.

Most importantly, this affects the __STDC_VERSION__ value, which the
compiler unfortunately currently defaults to 199901L.  With this
change we won't have to give VMS special treatment when looking for
features based on that macro.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1785)
(cherry picked from commit 4f3015bb30b7d95bb97408776b70e6a35fb91e8a)
2016-10-26 18:24:26 +02:00
Rich Salz
b2d0859ce1 Fix typo (reported by Matthias St. Pierre)
Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 12a7715e3daed439e46cbed461d2a3d9dfd37c0f)
2016-10-26 11:49:35 -04:00
Richard Levitte
2aec6095d3 Backdated note in CHANGES about shared library names
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1767)
(cherry picked from commit 78ce90cb1adb95eae094481e01f7a7d408ec78b7)
2016-10-25 20:34:10 +02:00
Richard Levitte
ea897a0aa8 Add some notes on shared library names on different platforms
This is overdue since the addition of the unified build system

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1767)
(cherry picked from commit 4fa3f08fee253020ea152e11ff1f6fdcab79424f)
2016-10-25 20:34:09 +02:00
Andy Polyakov
87148d30c9 x86_64 assembly pack: add Goldmont performance results.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit ace05265d2d599e350cf84ed60955b7f2b173bc9)
2016-10-24 13:02:41 +02:00
Richard Levitte
9df0b74d0f Efence is antiquated, remove all traces of using it
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1768)
(cherry picked from commit 4fab3e24d62c810bc9165920af1c67c6215c7418)
2016-10-22 02:50:45 +02:00
Richard Levitte
8b13f33dbf Correct installation test in appveyor
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1759)
(cherry picked from commit 92403e77ac57e7c5fe49d2d2f304839757293922)
2016-10-21 13:48:34 +02:00
Claus Assmann
e8e9cf7e9d Fix grammar error in SSL_CTX_set_min_proto_version
CLA: trivial
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1762)

(cherry picked from commit 8b5fffc819332dc381a431cae1a269642f0adf38)
2016-10-21 06:42:57 -04:00
Rich Salz
a3b94c9c2b GH1546: Fix old names in cryptodev code.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1584)
(cherry picked from commit a8a8a917c0c0d36162fdc0cbf84ab17282cef3e9)
2016-10-21 04:37:10 -04:00
David Woodhouse
8afb9742ae Disable encrypt_then_mac negotiation for DTLS.
I use the word 'negotiation' advisedly. Because that's all we were doing.
We negotiated it, set the TLS1_FLAGS_ENCRYPT_THEN_MAC flag in our data
structure, and then utterly ignored it in both dtls_process_record()
and do_dtls1_write().

Turn it off for 1.1.0; we'll fix it for 1.1.1 and by the time that's
released, hopefully 1.1.0b will be ancient history.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
2016-10-20 09:59:41 +01:00
Richard Levitte
ec7b16ddbb apps: remove some #ifndef clutter
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1643)
(cherry picked from commit b85bf6395251dc28457b95de586a2f0a5faae4af)
2016-10-20 08:59:54 +02:00
Richard Levitte
a55b395937 apps: instead of varying implementation, make setup_engine a function always
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1643)
(cherry picked from commit 907c6c86331243897b80f37895a14de1e7957541)
2016-10-20 08:59:53 +02:00
Richard Levitte
233bcb95dd If an engine comes up explicitely, it must also come down explicitely
In apps/apps.c, one can set up an engine with setup_engine().
However, we freed the structural reference immediately, which means
that for engines that don't already have a structural reference
somewhere else (because it's a built in engine), we end up returning
an invalid reference.

Instead, the function release_engine() is added, and called at the end
of the routines that call setup_engine().

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1643)
(cherry picked from commit dd1abd4462e4e4fa84b8f8de2ec70375f9b0e191)
2016-10-20 08:59:53 +02:00
Andrea Grandi
e7a5f50da0 Fix broken link to ASYNC_get_wait_ctx and rewrap the paragraph
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1745)
(cherry picked from commit 50c3fc00cc3090d082669591c0923a8468f2d8f9)
2016-10-19 10:42:57 -04:00
Mat
3d040392ff Do not set load_crypto_strings_inited when OPENSSL_NO_ERR is defined
Only set the load_crypto_strings_inited to 1 when err_load_crypto_strings_int was called.

This solves the following issue:
- openssl is built with no-err
- load_crypto_strings_inited is set to 1 during the OPENSSL_init_crypto call
- During the cleanup: OPENSSL_cleanup, err_free_strings_int is called because load_crypto_strings_inited == 1
- err_free_strings_int calls do_err_strings_init because it has never been called
- Now do_err_strings_init calls OPENSSL_init_crypto
- But since we are in the cleanup (stopped == 1) this results in an error:
  CRYPTOerr(CRYPTO_F_OPENSSL_INIT_CRYPTO, ERR_R_INIT_FAIL);
- which then tries to initialize everything we are trying to clean up: ERR_get_state, ossl_init_thread_start, etc
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1654)
(cherry picked from commit a1f2b0e6e07a53c0ae2c81cba319b90e54210cd6)
2016-10-19 07:03:04 -04:00
FdaSilvaYY
c347c5a3b6 Add error checking, small nit on ouput
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1632)
(cherry picked from commit 31dad404fd6854ec8dd697bcccfef1e8dba3faff)
2016-10-19 06:42:43 -04:00
Andrea Grandi
be118c3d57 Add missing .pod extension to EVP_PKEY_CTX_set_tls1_prf_md
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit efba60ca7ab72cae62baad2aaaf2da32d1093c38)
2016-10-19 10:30:30 +01:00
Dr. Stephen Henson
e97afdad65 Fix embedded string handling.
Don't rely on embedded flag to free strings correctly: it wont be
set if there is a malloc failure during initialisation.

Thanks to Guido Vranken for reporting this issue.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1725)
(cherry picked from commit 6215f27a83c6b9089a217dd6deab1665e0ced516)
2016-10-17 14:36:29 +01:00
choury
6a73da167f fix invalid use of incomplete type X509_STORE_CTX
CLA: trivial

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit ba6017a19346a169ca09bb67427ccf6fc56af0af)
2016-10-17 14:40:20 +02:00
Steven Fackler
969f378e36 Fix signatures of EVP_Digest{Sign,Verify}Update
These are implemented as macros delegating to `EVP_DigestUpdate`, which
takes a `size_t` as its third argument, not an `unsigned int`.

CLA: trivial

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 8bdce8d160e29b4e1b80fec31f618d85d8c2b7a8)
2016-10-15 23:39:01 +01:00
Matt Caswell
953ef2cbd0 Ensure we handle len == 0 in ERR_err_string_n
If len == 0 in a call to ERR_error_string_n() then we can read beyond the
end of the buffer. Really applications should not be calling this function
with len == 0, but we shouldn't be letting it through either!

Thanks to Agostino Sarubbo for reporting this issue. Agostino's blog on
this issue is available here:
https://blogs.gentoo.org/ago/2016/10/14/openssl-libcrypto-stack-based-buffer-overflow-in-err_error_string_n-err-c/

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit e5c1361580d8de79682958b04a5f0d262e680f8b)
2016-10-15 11:32:24 +01:00
Tomas Mraz
5389388a2b Engine afalg: properly set operation type also on big endian.
Copy the whole ALG_OP_TYPE to CMSG_DATA.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 574cffd5d5b8f57f811c8d36d930205041deedee)
2016-10-14 20:09:53 +01:00
Xiaoyin Liu
1ee297e52f Fix typo
I think the second "VC-WIN32" should be "VC-WIN64".
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
CLA: trivial
2016-10-14 10:02:42 +01:00
Vitezslav Cizek
bf4e64227d Configure: remove superfluous 0x
The number is taken from the OPENSSL_VERSION_NUMBER which is already
in the hex form.

CLA: trivial

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

(cherry picked from commit 35a498e431f81f94c4ee2dd451cdfe4d566fef3b)
2016-10-13 15:37:00 -04:00
Dr. Stephen Henson
91951307d6 Add memory leak detection to d2i_test
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1707)
(cherry picked from commit 4a4c4bf06d6362f56507c787c61b07655563e962)
2016-10-13 19:27:34 +01:00
FdaSilvaYY
5c0c82c3f6 Fix copy-paste test labels
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 32804b04b8f3c889beebb6e63e14cc3ea4d8273c)
2016-10-13 13:42:03 +02:00
Ben Laurie
8934b0949c Remove blank line.
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-10-13 10:08:37 +01:00
Ben Laurie
d0929aff54 Fix no-ocsp.
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-10-13 09:52:53 +01:00
Richard Levitte
d8631ebaab Remove automatic RPATH - Add a CHANGES entry
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 38be1ea85515a34b3f7285134bdfc1f88082331b)
2016-10-13 02:26:34 +02:00
Richard Levitte
7b7f21cd60 Remove automatic RPATH - adapt shlib_wrap.sh
Looking for something starting with '-Wl,-rpath,' isn't good enough,
as someone might give something like '-Wl,--enable-new-dtags,-rpath,/PATH'.
Looking for ',-rpath,' should be safe enough.

We could remove the preloading stuff entirely, but just in case the
user has chosen to given RPATH setting arguments at configuration,
we'd better make sure testing will still work.  Fair warning, there
are some configuration options that do not work with preloaded OpenSSL
libraries, such as the sanity checking ones.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 71d8ff1a8998da20db5ab8d4024c3d155b2f6733)
2016-10-13 02:25:46 +02:00
Richard Levitte
0de5e4f092 Remove automatic RPATH - add user rpath support
Make Configure recognise -rpath and -R to support user added rpaths
for OSF1 and Solaris.  For convenience, add a variable LIBRPATH in the
Unix Makefile, which the users can use as follows:

    ./config [options] -Wl,-rpath,\$(LIBRPATH)

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit fad599f7f147ee71e5581211fb654c2c8c491cd8)
2016-10-13 02:25:42 +02:00
Richard Levitte
68f3b89910 Remove automatic RPATH
Before OpenSSL 1.1.0, binaries were installed in a non-standard
location by default, and runpath directories were therefore added in
those binaries, to make sure the executables would be able to find the
shared libraries they were linked with.

With OpenSSL 1.1.0 and on, binaries are installed in standard
directories by default, and the addition of runpath directories is
therefore not needed any more.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 075f7e2c6062a33352f570eeafe3c95e41419521)
2016-10-13 02:24:40 +02:00
Rich Salz
e4e407fe82 RT is put out to pasture
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1702)
(cherry picked from commit 7954dced19a7e59e7055eab95a981fa943c7d100)
2016-10-12 19:05:43 -04:00
Dr. Stephen Henson
15ef80b5b1 Fix X509_NAME decode for malloc failures.
The original X509_NAME decode free code was buggy: this
could result in double free or leaks if a malloc failure
occurred.

Simplify and fix the logic.

Thanks to Guido Vranken for reporting this issue.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1691)
(cherry picked from commit 6dcba070a94b1ead92f3e327cf207a0b7db6596f)
2016-10-11 22:18:20 +01:00
Ben Laurie
174ec019c3 Remove untrue comment.
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-10-02 22:58:59 +01:00
Ben Laurie
941005df14 Make dependencies if Makefile is new.
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-10-02 22:58:59 +01:00
Ben Laurie
dc2a7e42a2 Don't use des when disabled.
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-10-02 05:58:22 +01:00
Dr. Stephen Henson
08a78f8c44 fix memory leak
Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit eb67172ae53da63a6ff5189dfde2af8f98309ce3)
2016-10-01 15:31:29 +01:00
Dr. Stephen Henson
3f39423aac SRP code tidy.
Tidy up srp_Calc_k and SRP_Calc_u by making them a special case of
srp_Calc_xy which performs SHA1(PAD(x) | PAD(y)).

This addresses an OCAP Audit issue.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 8f332ac962b377a52016927e6db7a15367cb839c)
2016-10-01 14:13:02 +01:00
Dr. Stephen Henson
25a127bde9 Add SRP test vectors from RFC5054
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 198d805900b183943a1ced0f5a230d55c8493a04)
2016-10-01 14:13:02 +01:00
Matt Caswell
6b02b586c3 Fix missing NULL checks in NewSessionTicket construction
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 83ae4661315d3d0ad52ddaa8fa5c8f1055c6c6f6)
2016-09-29 16:17:54 +01:00
David Woodhouse
9cb0c3a3ca Restore '-keyform engine' support for s_client
This used to work in 1.0.2 but disappeared when the argument parsing was
revamped.

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

(cherry picked from commit a6972f346248fbc37e42056bb943fae0896a2967)
2016-09-29 12:52:15 +02:00
Matt Caswell
61b1eb2c67 Fix an Uninit read in DTLS
If we have a handshake fragment waiting then dtls1_read_bytes() was not
correctly setting the value of recvd_type, leading to an uninit read.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 2f2d6e3e3ccd1ae7bba9f1af62f97dfca986e083)
2016-09-29 10:00:52 +01:00
Matt Caswell
dd63da7032 Fix no-dtls
The new large message test in sslapitest needs OPENSSL_NO_DTLS guards

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 55386bef807c7edd0f1db036c0ed464b28a61d68)
2016-09-29 09:54:38 +01:00
Richard Levitte
a1b791225f apps/apps.c: initialize and de-initialize engine around key loading
Before loading a key from an engine, it may need to be initialized.
When done loading the key, we must de-initialize the engine.
(if the engine is already initialized somehow, only the reference
counter will be incremented then decremented)

Reviewed-by: Stephen Henson <steve@openssl.org>
(cherry picked from commit 49e476a5382602d0bad1139d6f1f66ddbc7959d6)
2016-09-28 21:58:50 +02:00
Matt Caswell
8061fdc8d3 Add DTLS renegotiation tests
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit f9b1b6644a3a8fc6d617625ad979ee61cb67d381)
2016-09-28 09:18:46 +01:00