openssl.git
7 years agoFix a mem leak in NPN handling
Matt Caswell [Fri, 9 Sep 2016 09:53:39 +0000 (10:53 +0100)]
Fix a mem leak in NPN handling

If a server sent multiple NPN extensions in a single ClientHello then a
mem leak can occur. This will only happen where the client has requested
NPN in the first place. It does not occur during renegotiation. Therefore
the maximum that could be leaked in a single connection with a malicious
server is 64k (the maximum size of the ServerHello extensions section). As
this is client side, only occurs if NPN has been requested and does not
occur during renegotiation this is unlikely to be exploitable.

Issue reported by Shi Lei.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd some more OCSP testing
Matt Caswell [Tue, 13 Sep 2016 16:02:03 +0000 (17:02 +0100)]
Add some more OCSP testing

Test that the OCSP callbacks work as expected.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd OCSP_RESPID_match()
Matt Caswell [Tue, 13 Sep 2016 22:26:53 +0000 (23:26 +0100)]
Add OCSP_RESPID_match()

Add a function for testing whether a given OCSP_RESPID matches with a
certificate.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd the ability to set OCSP_RESPID fields
Matt Caswell [Mon, 12 Sep 2016 16:39:55 +0000 (17:39 +0100)]
Add the ability to set OCSP_RESPID fields

OCSP_RESPID was made opaque in 1.1.0, but no accessors were provided for
setting the name/key value for the OCSP_RESPID.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoFix OCSP Status Request extension unbounded memory growth
Matt Caswell [Fri, 9 Sep 2016 09:08:45 +0000 (10:08 +0100)]
Fix OCSP Status Request extension unbounded memory growth

A malicious client can send an excessively large OCSP Status Request
extension. If that client continually requests renegotiation,
sending a large OCSP Status Request extension each time, then there will
be unbounded memory growth on the server. This will eventually lead to a
Denial Of Service attack through memory exhaustion. Servers with a
default configuration are vulnerable even if they do not support OCSP.
Builds using the "no-ocsp" build time option are not affected.

I have also checked other extensions to see if they suffer from a similar
problem but I could not find any other issues.

CVE-2016-6304

Issue reported by Shi Lei.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoFix error message typo, wrong function code
Richard Levitte [Thu, 22 Sep 2016 08:15:02 +0000 (10:15 +0200)]
Fix error message typo, wrong function code

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoExcessive allocation of memory in dtls1_preprocess_fragment()
Matt Caswell [Mon, 19 Sep 2016 10:57:07 +0000 (11:57 +0100)]
Excessive allocation of memory in dtls1_preprocess_fragment()

This issue is very similar to CVE-2016-6307 described in the previous
commit. The underlying defect is different but the security analysis and
impacts are the same except that it impacts DTLS.

A DTLS message includes 3 bytes for its length in the header for the
message.
This would allow for messages up to 16Mb in length. Messages of this length
are excessive and OpenSSL includes a check to ensure that a peer is sending
reasonably sized messages in order to avoid too much memory being consumed
to service a connection. A flaw in the logic of version 1.1.0 means that
memory for the message is allocated too early, prior to the excessive
message length check. Due to way memory is allocated in OpenSSL this could
mean an attacker could force up to 21Mb to be allocated to service a
connection. This could lead to a Denial of Service through memory
exhaustion. However, the excessive message length check still takes place,
and this would cause the connection to immediately fail. Assuming that the
application calls SSL_free() on the failed conneciton in a timely manner
then the 21Mb of allocated memory will then be immediately freed again.
Therefore the excessive memory allocation will be transitory in nature.
This then means that there is only a security impact if:

1) The application does not call SSL_free() in a timely manner in the
event that the connection fails
or
2) The application is working in a constrained environment where there
is very little free memory
or
3) The attacker initiates multiple connection attempts such that there
are multiple connections in a state where memory has been allocated for
the connection; SSL_free() has not yet been called; and there is
insufficient memory to service the multiple requests.

Except in the instance of (1) above any Denial Of Service is likely to
be transitory because as soon as the connection fails the memory is
subsequently freed again in the SSL_free() call. However there is an
increased risk during this period of application crashes due to the lack
of memory - which would then mean a more serious Denial of Service.

This issue does not affect TLS users.

Issue was reported by Shi Lei (Gear Team, Qihoo 360 Inc.).

CVE-2016-6308

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoExcessive allocation of memory in tls_get_message_header()
Matt Caswell [Mon, 19 Sep 2016 10:39:21 +0000 (11:39 +0100)]
Excessive allocation of memory in tls_get_message_header()

A TLS message includes 3 bytes for its length in the header for the message.
This would allow for messages up to 16Mb in length. Messages of this length
are excessive and OpenSSL includes a check to ensure that a peer is sending
reasonably sized messages in order to avoid too much memory being consumed
to service a connection. A flaw in the logic of version 1.1.0 means that
memory for the message is allocated too early, prior to the excessive
message length check. Due to way memory is allocated in OpenSSL this could
mean an attacker could force up to 21Mb to be allocated to service a
connection. This could lead to a Denial of Service through memory
exhaustion. However, the excessive message length check still takes place,
and this would cause the connection to immediately fail. Assuming that the
application calls SSL_free() on the failed conneciton in a timely manner
then the 21Mb of allocated memory will then be immediately freed again.
Therefore the excessive memory allocation will be transitory in nature.
This then means that there is only a security impact if:

1) The application does not call SSL_free() in a timely manner in the
event that the connection fails
or
2) The application is working in a constrained environment where there
is very little free memory
or
3) The attacker initiates multiple connection attempts such that there
are multiple connections in a state where memory has been allocated for
the connection; SSL_free() has not yet been called; and there is
insufficient memory to service the multiple requests.

Except in the instance of (1) above any Denial Of Service is likely to
be transitory because as soon as the connection fails the memory is
subsequently freed again in the SSL_free() call. However there is an
increased risk during this period of application crashes due to the lack
of memory - which would then mean a more serious Denial of Service.

This issue does not affect DTLS users.

Issue was reported by Shi Lei (Gear Team, Qihoo 360 Inc.).

CVE-2016-6307

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoDon't leak on an OPENSSL_realloc() failure
Matt Caswell [Wed, 21 Sep 2016 14:49:28 +0000 (15:49 +0100)]
Don't leak on an OPENSSL_realloc() failure

If OPENSSL_sk_insert() calls OPENSSL_realloc() and it fails, it was leaking
the originally allocated memory.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoDon't allow too many consecutive warning alerts
Matt Caswell [Wed, 21 Sep 2016 13:07:31 +0000 (14:07 +0100)]
Don't allow too many consecutive warning alerts

Certain warning alerts are ignored if they are received. This can mean that
no progress will be made if one peer continually sends those warning alerts.
Implement a count so that we abort the connection if we receive too many.

Issue reported by Shi Lei.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agorand/randfile.c: treat empty string in RAND_file_name as error.
Andy Polyakov [Tue, 20 Sep 2016 15:08:03 +0000 (17:08 +0200)]
rand/randfile.c: treat empty string in RAND_file_name as error.

Suggested in GH#1589.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agorand/randfile.c: rationalize __OpenBSD__ code path.
Andy Polyakov [Tue, 20 Sep 2016 15:06:58 +0000 (17:06 +0200)]
rand/randfile.c: rationalize __OpenBSD__ code path.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agorand/randfile.c: restore fallback to $HOME for non-setuid programs.
Andy Polyakov [Tue, 20 Sep 2016 14:59:32 +0000 (16:59 +0200)]
rand/randfile.c: restore fallback to $HOME for non-setuid programs.

Reported in GH#1589, but solution is different from suggested.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoDcoument -alpn flag
Rich Salz [Wed, 21 Sep 2016 14:59:15 +0000 (10:59 -0400)]
Dcoument -alpn flag

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoGH1555: Don't bump size on realloc failure
Rich Salz [Fri, 9 Sep 2016 14:52:59 +0000 (10:52 -0400)]
GH1555: Don't bump size on realloc failure

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoRevert "Constify code about X509_VERIFY_PARAM"
Rich Salz [Wed, 21 Sep 2016 14:37:03 +0000 (10:37 -0400)]
Revert "Constify code about X509_VERIFY_PARAM"

This reverts commit 81f9ce1e1965e0e33db6d2391285c4c1b6af0434.

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agotest/x509aux.c: Fix argv loop
Richard Levitte [Wed, 21 Sep 2016 12:44:42 +0000 (14:44 +0200)]
test/x509aux.c: Fix argv loop

There are cases when argc is more trustable than proper argv termination.
Since we trust argc in all other test programs, we might as well treat it
the same way in this program.

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agomake update and fix some associated mis-matched error codes
Matt Caswell [Wed, 21 Sep 2016 13:05:42 +0000 (14:05 +0100)]
make update and fix some associated mis-matched error codes

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoFix a missing NULL check in dsa_builtin_paramgen
Matt Caswell [Wed, 14 Sep 2016 12:27:59 +0000 (13:27 +0100)]
Fix a missing NULL check in dsa_builtin_paramgen

We should check the last BN_CTX_get() call to ensure that it isn't NULL
before we try and use any of the allocated BIGNUMs.

Issue reported by Shi Lei.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoVMS: add [.util]shlib_wrap.exe and its build instructions
Richard Levitte [Tue, 20 Sep 2016 23:47:06 +0000 (01:47 +0200)]
VMS: add [.util]shlib_wrap.exe and its build instructions

This is a program for VMS that corresponds to util/shlib_wrap.sh.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agodescrip.mms.tmpl: in obj2bin, make sure an empty @deps means no empty lines
Richard Levitte [Tue, 20 Sep 2016 23:49:53 +0000 (01:49 +0200)]
descrip.mms.tmpl: in obj2bin, make sure an empty @deps means no empty lines

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoutil/dofile.pl: report if a template couldn't be loaded
Richard Levitte [Tue, 20 Sep 2016 23:49:04 +0000 (01:49 +0200)]
util/dofile.pl: report if a template couldn't be loaded

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoQuiet compiler warning about uninitialised variable
Richard Levitte [Tue, 20 Sep 2016 19:48:24 +0000 (21:48 +0200)]
Quiet compiler warning about uninitialised variable

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoRT3669: dgst can only sign/verify one file.
Rich Salz [Fri, 2 Sep 2016 21:34:31 +0000 (17:34 -0400)]
RT3669: dgst can only sign/verify one file.

Check arg count and print an error message.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoapps/apps.c: include sys/socket.h to declare recv()
Richard Levitte [Tue, 20 Sep 2016 16:43:24 +0000 (18:43 +0200)]
apps/apps.c: include sys/socket.h to declare recv()

Reviewed-by: Tim Hudson <tjh@openssl.org>
7 years agoDocumentation fixup; no more ECDHParameters
Richard Levitte [Sun, 18 Sep 2016 21:52:30 +0000 (23:52 +0200)]
Documentation fixup; no more ECDHParameters

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoCrude VMS build files for demos/bio/
Richard Levitte [Thu, 8 Sep 2016 23:53:38 +0000 (01:53 +0200)]
Crude VMS build files for demos/bio/

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoCrude Makefile for demos/bio/
Richard Levitte [Thu, 8 Sep 2016 23:01:30 +0000 (01:01 +0200)]
Crude Makefile for demos/bio/

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoDon't ignore Makefiles in demos/
Richard Levitte [Thu, 8 Sep 2016 23:01:15 +0000 (01:01 +0200)]
Don't ignore Makefiles in demos/

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoFixup BIO demos for OpenSSL 1.1.x
Richard Levitte [Fri, 9 Sep 2016 07:32:00 +0000 (09:32 +0200)]
Fixup BIO demos for OpenSSL 1.1.x

Call SSL_CTX_new() before doing any configuration.
(or call OPENSSL_ssl_init())

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoFixup BIO demos for OpenSSL 1.1.x
Richard Levitte [Thu, 8 Sep 2016 22:59:00 +0000 (00:59 +0200)]
Fixup BIO demos for OpenSSL 1.1.x

'ECDHParameters = Automatic' isn't accepted.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoFixup BIO demos for OpenSSL 1.1.x
Richard Levitte [Thu, 8 Sep 2016 22:58:21 +0000 (00:58 +0200)]
Fixup BIO demos for OpenSSL 1.1.x

Note: server-cmod doesn't seem to do things right...  from loading
cmod.cnf, it tries to load libssl_conf.so.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoConvert WPACKET_put_bytes to use convenience macros
Matt Caswell [Tue, 20 Sep 2016 13:47:44 +0000 (14:47 +0100)]
Convert WPACKET_put_bytes to use convenience macros

All the other functions that take an argument for the number of bytes
use convenience macros for this purpose. We should do the same with
WPACKET_put_bytes().

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoConvert CCS construction to WPACKET
Matt Caswell [Tue, 20 Sep 2016 11:26:46 +0000 (12:26 +0100)]
Convert CCS construction to WPACKET

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoConvert Finished construction to WPACKET
Matt Caswell [Tue, 20 Sep 2016 11:19:18 +0000 (12:19 +0100)]
Convert Finished construction to WPACKET

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoStyle tweaks following review feedback
Matt Caswell [Tue, 20 Sep 2016 09:16:15 +0000 (10:16 +0100)]
Style tweaks following review feedback

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoConvert NextProto message construction to WPACKET
Matt Caswell [Wed, 14 Sep 2016 11:10:33 +0000 (12:10 +0100)]
Convert NextProto message construction to WPACKET

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoConvert Certificate message construction to WPACKET
Matt Caswell [Wed, 14 Sep 2016 10:41:27 +0000 (11:41 +0100)]
Convert Certificate message construction to WPACKET

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoConvert ClientVerify Construction to WPACKET
Matt Caswell [Wed, 14 Sep 2016 10:10:37 +0000 (11:10 +0100)]
Convert ClientVerify Construction to WPACKET

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoRemove an option related to a deprecated flag
FdaSilvaYY [Sat, 17 Sep 2016 19:29:48 +0000 (21:29 +0200)]
Remove an option related to a deprecated flag

CMS_NOOLDMIMETYPE and PKCS7_NOOLDMIMETYPE  are unused in pkcs7/cms code.

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

7 years agoFix various missing option help messages ...
FdaSilvaYY [Sun, 31 Jul 2016 17:02:50 +0000 (19:02 +0200)]
Fix various missing option help messages ...

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

7 years agoConvert num_alloc to a size_t in stack.c and tweak style
Matt Caswell [Thu, 8 Sep 2016 10:06:29 +0000 (11:06 +0100)]
Convert num_alloc to a size_t in stack.c and tweak style

We were casting num_alloc to size_t in lots of places, or just using it in
a context where size_t makes more sense - so convert it. This simplifies
the code a bit.

Also tweak the style in stack.c a bit following on from the previous
commit

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoPrevent overflows in stack API
Guido Vranken [Thu, 8 Sep 2016 09:43:37 +0000 (10:43 +0100)]
Prevent overflows in stack API

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoUpdate INSTALL about no-md5 removal
FdaSilvaYY [Mon, 12 Sep 2016 20:42:37 +0000 (22:42 +0200)]
Update INSTALL about no-md5 removal

no-rsa is no longer an option since 7ec8de1

Fix a typo about poly1305

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

7 years agoFix no-ocsp
Richard Levitte [Mon, 19 Sep 2016 13:08:58 +0000 (15:08 +0200)]
Fix no-ocsp

Some compilers complain about unused variables, and some tests do
not run well without OCSP.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoConstify code about X509_VERIFY_PARAM
FdaSilvaYY [Thu, 15 Sep 2016 19:37:14 +0000 (21:37 +0200)]
Constify code about X509_VERIFY_PARAM

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

7 years agoHave the configuration options 'no-err' and 'no-async' work again
Richard Levitte [Sat, 17 Sep 2016 19:57:29 +0000 (21:57 +0200)]
Have the configuration options 'no-err' and 'no-async' work again

In an earlier attempt to simplify the processing of disabled options,
'no-err' and 'no-async' stopped working properly.  'err' and 'async'
are directories under 'crypto/', but they are special insofar that
they can't be simply skipped, like all the algorithm directories can,
so they need special treatment among the disablable things.

Reviewed-by: Tim Hudson <tjh@openssl.org>
7 years agoSimplify configudata.pm dependency generation
Richard Levitte [Sat, 17 Sep 2016 18:50:56 +0000 (20:50 +0200)]
Simplify configudata.pm dependency generation

While we're at it, correct the fault in windows-makefile.tmpl

Reviewed-by: Andy Polyakov <appro@openssl.org>
7 years agoRemove an useless definition.
FdaSilvaYY [Thu, 15 Sep 2016 18:33:18 +0000 (20:33 +0200)]
Remove an useless definition.

APP_INFO is currently a field of MEM struct.

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

7 years agoUse switch instead of multiple ifs
Alessandro Ghedini [Tue, 13 Sep 2016 23:51:02 +0000 (00:51 +0100)]
Use switch instead of multiple ifs

Makes the logic a little bit clearer.

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

7 years agoSimplify the dependencies for remaking configdata.pm
Richard Levitte [Thu, 15 Sep 2016 21:56:03 +0000 (23:56 +0200)]
Simplify the dependencies for remaking configdata.pm

Reviewed-by: Andy Polyakov <appro@openssl.org>
7 years agoRearrange the storage of build file template names in %config
Richard Levitte [Thu, 15 Sep 2016 21:55:24 +0000 (23:55 +0200)]
Rearrange the storage of build file template names in %config

They are now relative paths as well

Reviewed-by: Andy Polyakov <appro@openssl.org>
7 years agoUse the registered conf file names as dependencies to build configdata.pm
Richard Levitte [Wed, 14 Sep 2016 20:22:20 +0000 (22:22 +0200)]
Use the registered conf file names as dependencies to build configdata.pm

Reviewed-by: Andy Polyakov <appro@openssl.org>
7 years agoRegister the name of the config file each config target was found in
Richard Levitte [Wed, 14 Sep 2016 20:21:41 +0000 (22:21 +0200)]
Register the name of the config file each config target was found in

Reviewed-by: Andy Polyakov <appro@openssl.org>
7 years agoRevert "Abort on unrecognised warning alerts"
Matt Caswell [Thu, 15 Sep 2016 19:43:16 +0000 (20:43 +0100)]
Revert "Abort on unrecognised warning alerts"

This reverts commit 77a6be4dfc2ecf406c2559a99bea51317ce0f533.

There were some unexpected side effects to this commit, e.g. in SSLv3 a
warning alert gets sent "no_certificate" if a client does not send a
Certificate during Client Auth. With the above commit this causes the
connection to abort, which is incorrect. There may be some other edge cases
like this so we need to have a rethink on this.

Reviewed-by: Tim Hudson <tjh@openssl.org>
7 years agoFinally, make sure vms_term_sock.c is built on VMS
Richard Levitte [Wed, 14 Sep 2016 21:40:27 +0000 (23:40 +0200)]
Finally, make sure vms_term_sock.c is built on VMS

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoRefactor to avoid unnecessary preprocessor logic
Richard Levitte [Thu, 15 Sep 2016 09:20:18 +0000 (11:20 +0200)]
Refactor to avoid unnecessary preprocessor logic

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoReformat to fit OpenSSL source code standards
Richard Levitte [Wed, 14 Sep 2016 18:54:30 +0000 (20:54 +0200)]
Reformat to fit OpenSSL source code standards

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd copyright and license on apps/vms_term_sock.[ch]
Richard Levitte [Wed, 14 Sep 2016 18:52:03 +0000 (20:52 +0200)]
Add copyright and license on apps/vms_term_sock.[ch]

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoVSI submission: redirect terminal input through socket
Richard Levitte [Wed, 3 Aug 2016 19:16:43 +0000 (21:16 +0200)]
VSI submission: redirect terminal input through socket

This is needed, because on VMS, select() can only be used on sockets.  being
able to use select() on all kinds of file descriptors is unique to Unix.

So, the solution for VMS is to create a layer that translates input from
standard input to socket communication.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoMake reference to other manpage more explicit
Rich Salz [Wed, 14 Sep 2016 15:13:57 +0000 (11:13 -0400)]
Make reference to other manpage more explicit

Where -curves, etc., are defined: SSL_CONF_cmd

Reviewed-by: Andy Polyakov <appro@openssl.org>
7 years agoGH1536: Install empty CT log list
Rich Salz [Fri, 9 Sep 2016 22:05:41 +0000 (18:05 -0400)]
GH1536: Install empty CT log list

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoVMS: Really don't force symbol mixed case when building DSOs
Richard Levitte [Wed, 14 Sep 2016 15:49:21 +0000 (17:49 +0200)]
VMS: Really don't force symbol mixed case when building DSOs

This is an amendment to the september 8 commit titled "VMS: Don't
force symbol mixed case when building DSOs"

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoRather than one variable for each passwd type, use one enum variable
Richard Levitte [Wed, 14 Sep 2016 03:06:56 +0000 (05:06 +0200)]
Rather than one variable for each passwd type, use one enum variable

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoTest the new SHA256 and SHA512 based password generation options
Richard Levitte [Wed, 14 Sep 2016 02:07:36 +0000 (04:07 +0200)]
Test the new SHA256 and SHA512 based password generation options

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoDocument the new SHA256 and SHA512 password generation options
Richard Levitte [Wed, 14 Sep 2016 02:07:04 +0000 (04:07 +0200)]
Document the new SHA256 and SHA512 password generation options

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd SHA256 and SHA512 based output for 'openssl passwd'
Richard Levitte [Wed, 14 Sep 2016 01:52:40 +0000 (03:52 +0200)]
Add SHA256 and SHA512 based output for 'openssl passwd'

RT#4674 issue 2

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd -h and -help for c_rehash script and app
Rich Salz [Mon, 12 Sep 2016 15:29:22 +0000 (11:29 -0400)]
Add -h and -help for c_rehash script and app

Resolves GH1515 and GH1509.

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoFix OCSP_RESPID processing bug introduced by WPACKET changes
Matt Caswell [Tue, 13 Sep 2016 22:59:11 +0000 (23:59 +0100)]
Fix OCSP_RESPID processing bug introduced by WPACKET changes

An OCSP_RESPID in a status request extension has 2 bytes for the length
not 1.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd some sanity checks around usage of t_fromb64()
Matt Caswell [Thu, 8 Sep 2016 13:32:27 +0000 (14:32 +0100)]
Add some sanity checks around usage of t_fromb64()

The internal SRP function t_fromb64() converts from base64 to binary. It
does not validate that the size of the destination is sufficiently large -
that is up to the callers. In some places there was such a check, but not
in others.

Add an argument to t_fromb64() to provide the size of the destination
buffer and validate that we don't write too much data. Also add some sanity
checks to the callers where appropriate.

With thanks to Shi Lei for reporting this issue.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoEncourage use of the macros for the various "sub" functions
Matt Caswell [Tue, 13 Sep 2016 14:42:12 +0000 (15:42 +0100)]
Encourage use of the macros for the various "sub" functions

Don't call WPACKET_sub_memcpy(), WPACKET_sub_allocation_bytes() and
WPACKET_start_sub_packet_len() directly.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoMake wpackettest conform to style rules
Matt Caswell [Tue, 13 Sep 2016 13:17:09 +0000 (14:17 +0100)]
Make wpackettest conform to style rules

Remove extra indentation at the start of an "if".

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd a WPACKET_sub_allocate_bytes() function
Matt Caswell [Tue, 13 Sep 2016 10:32:52 +0000 (11:32 +0100)]
Add a WPACKET_sub_allocate_bytes() function

Updated the construction code to use the new function. Also added some
convenience macros for WPACKET_sub_memcpy().

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoConvert CKE construction to use the WPACKET API
Matt Caswell [Tue, 13 Sep 2016 10:01:04 +0000 (11:01 +0100)]
Convert CKE construction to use the WPACKET API

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd a test for 'openssl passwd'
Richard Levitte [Tue, 13 Sep 2016 21:23:51 +0000 (23:23 +0200)]
Add a test for 'openssl passwd'

Also, enlarge test group 20 to include openssl commands that aren't
tested otherwise

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoFix 'openssl passwd' with arguments -1 or -apr1
Richard Levitte [Tue, 13 Sep 2016 20:48:35 +0000 (22:48 +0200)]
Fix 'openssl passwd' with arguments -1 or -apr1

RT#4674

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoFix some magic values about revocation info type...
FdaSilvaYY [Sat, 6 Aug 2016 12:19:03 +0000 (14:19 +0200)]
Fix some magic values about revocation info type...

Add comments, document -valid option.
Add some const qualifiers.

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

7 years agoAdd --missing-help to list command
Rich Salz [Sat, 10 Sep 2016 19:46:48 +0000 (15:46 -0400)]
Add --missing-help to list command

Reviewed-by: Andy Polyakov <appro@openssl.org>
7 years agoRemove -xtarget=ultra from solaris(64)-sparcv9-cc builds.
Andy Grundman [Tue, 30 Aug 2016 21:25:10 +0000 (17:25 -0400)]
Remove -xtarget=ultra from solaris(64)-sparcv9-cc builds.

This flag got moved after -xarch=v9 in 1.1.0 and had the unexpected
side effect of the compiler building for 32-bit v8plusa instead of v9.

GH#1521
CLA: none; trivial

Signed-off-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
7 years agobio.h: fix number of arguments passed to BIO_ptr_ctrl()
Viktor Szakats [Tue, 30 Aug 2016 16:56:49 +0000 (18:56 +0200)]
bio.h: fix number of arguments passed to BIO_ptr_ctrl()
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1520)

7 years agos_client: avoid warning on Windows/MS-DOS systems
Viktor Szakats [Tue, 30 Aug 2016 01:01:16 +0000 (03:01 +0200)]
s_client: avoid warning on Windows/MS-DOS systems

it appears when using gcc/mingw:
```
apps/s_client.c:815:9: warning: variable 'at_eof' set but not used [-Wunused-but-set-variable]
     int at_eof = 0;
         ^~~~~~
```
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1512)

7 years agoConfigure: detect gcc's dependency generation capability more accurately.
Andy Polyakov [Sat, 10 Sep 2016 19:12:56 +0000 (21:12 +0200)]
Configure: detect gcc's dependency generation capability more accurately.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agobn/bn_lcl.h: improve interoperability with clang and Android NDK.
Andy Polyakov [Sat, 10 Sep 2016 16:57:14 +0000 (18:57 +0200)]
bn/bn_lcl.h: improve interoperability with clang and Android NDK.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoConfigure: impose ^X on whole build procedure.
Andy Polyakov [Fri, 9 Sep 2016 21:45:57 +0000 (23:45 +0200)]
Configure: impose ^X on whole build procedure.

Traditionally Configure passed $ENV{PERL} to Makefile. But this
resulted in ambiguilty as Configure script could be executed by
interpreter different from one executing remaining scripts. Since
we separate compile- and run-time interpreters with HASHBANGPERL
variable, there is no reason to segment the build procedure.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAbort on unrecognised warning alerts
Matt Caswell [Mon, 12 Sep 2016 10:04:51 +0000 (11:04 +0100)]
Abort on unrecognised warning alerts

A peer continually sending unrecognised warning alerts could mean that we
make no progress on a connection. We should abort rather than continuing if
we receive an unrecognised warning alert.

Thanks to Shi Lei for reporting this issue.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoFix a few style nits in the wpacket code
Matt Caswell [Tue, 13 Sep 2016 08:40:38 +0000 (09:40 +0100)]
Fix a few style nits in the wpacket code

Addressing more feedback comments.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoRemove else after a return in packet code
Matt Caswell [Mon, 12 Sep 2016 08:41:01 +0000 (09:41 +0100)]
Remove else after a return in packet code

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoPull out some common packet code into a function
Matt Caswell [Mon, 12 Sep 2016 08:39:10 +0000 (09:39 +0100)]
Pull out some common packet code into a function

Two locations had the same loop for writing out a value. Pull it out into
a function.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd some soft asserts where applicable
Matt Caswell [Fri, 9 Sep 2016 08:49:16 +0000 (09:49 +0100)]
Add some soft asserts where applicable

This is an internal API. Some of the tests were for programmer erorr and
"should not happen" situations, so a soft assert is reasonable.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAddress WPACKET review comments
Matt Caswell [Thu, 8 Sep 2016 23:13:41 +0000 (00:13 +0100)]
Address WPACKET review comments

A few style tweaks here and there. The main change is that curr and
packet_len are now offsets into the buffer to account for the fact that
the pointers can change if the buffer grows. Also dropped support for the
WPACKET_set_packet_len() function. I thought that was going to be needed
but so far it hasn't been. It doesn't really work any more due to the
offsets change.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoSimplify the overflow checks in WPACKET_allocate_bytes()
Matt Caswell [Thu, 8 Sep 2016 22:08:53 +0000 (23:08 +0100)]
Simplify the overflow checks in WPACKET_allocate_bytes()

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoMove the WPACKET documentation comments to packet_locl.h
Matt Caswell [Thu, 8 Sep 2016 10:44:25 +0000 (11:44 +0100)]
Move the WPACKET documentation comments to packet_locl.h

The PACKET documentation is already in packet_locl.h so it makes sense to
have the WPACKET documentation there as well.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd tests for the WPACKET implementation
Matt Caswell [Thu, 8 Sep 2016 09:01:24 +0000 (10:01 +0100)]
Add tests for the WPACKET implementation

The tests will only work in no-shared builds because WPACKET is an
internal only API that does not get exported by the shared library.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoEnsure the WPACKET gets cleaned up in the event of an error
Matt Caswell [Thu, 8 Sep 2016 09:00:56 +0000 (10:00 +0100)]
Ensure the WPACKET gets cleaned up in the event of an error

Otherwise a mem leak can occur.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoVarious bug fixes and tweaks to WPACKET implementation
Matt Caswell [Thu, 8 Sep 2016 08:58:29 +0000 (09:58 +0100)]
Various bug fixes and tweaks to WPACKET implementation

Also added the WPACKET_cleanup() function to cleanup a WPACKET if we hit
an error.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd WPACKET_sub_memcpy() function
Matt Caswell [Tue, 6 Sep 2016 14:19:32 +0000 (15:19 +0100)]
Add WPACKET_sub_memcpy() function

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoMove from explicit sub-packets to implicit ones
Matt Caswell [Tue, 6 Sep 2016 14:09:51 +0000 (15:09 +0100)]
Move from explicit sub-packets to implicit ones

No need to declare an explicit sub-packet. Just start one.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoRename PACKETW to WPACKET
Matt Caswell [Mon, 5 Sep 2016 16:34:04 +0000 (17:34 +0100)]
Rename PACKETW to WPACKET

To avoid confusion with the read PACKET structure.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoConvert tls_construct_client_hello() to use PACKETW
Matt Caswell [Wed, 3 Aug 2016 19:57:52 +0000 (20:57 +0100)]
Convert tls_construct_client_hello() to use PACKETW

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoFirst pass at writing a writeable packets API
Matt Caswell [Wed, 3 Aug 2016 16:06:39 +0000 (17:06 +0100)]
First pass at writing a writeable packets API

Reviewed-by: Rich Salz <rsalz@openssl.org>