oweals/openssl.git
9 years agoFix DTLSv1_listen following state machine changes
Matt Caswell [Thu, 22 Oct 2015 11:18:45 +0000 (12:18 +0100)]
Fix DTLSv1_listen following state machine changes

Adding the new state machine broke the DTLSv1_listen code because
calling SSL_in_before() was erroneously returning true after DTLSv1_listen
had successfully completed. This change ensures that SSL_in_before returns
false.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoAdd a function to get the info_callback
Matt Caswell [Mon, 5 Oct 2015 10:28:51 +0000 (11:28 +0100)]
Add a function to get the info_callback

Remove repeated blocks of checking SSL and then SSL_CTX for the
info_callback.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoRemove the old state defines
Matt Caswell [Mon, 5 Oct 2015 10:17:08 +0000 (11:17 +0100)]
Remove the old state defines

Remove all the defines for the old state machines states. Mapping old to new
is probably going to cause more problems than it solves so it is probably
better to just remove them.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoChange SUB_STATE_RETURN into a typedef
Matt Caswell [Mon, 5 Oct 2015 10:03:27 +0000 (11:03 +0100)]
Change SUB_STATE_RETURN into a typedef

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoRename STATEM to OSSL_STATEM
Matt Caswell [Mon, 5 Oct 2015 09:58:52 +0000 (10:58 +0100)]
Rename STATEM to OSSL_STATEM

Add an OSSL_ prefix onto STATEM

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoRemove SSL_state and SSL_set_state
Matt Caswell [Mon, 5 Oct 2015 09:49:15 +0000 (10:49 +0100)]
Remove SSL_state and SSL_set_state

SSL_state has been replaced by SSL_get_state and SSL_set_state is no longer
supported.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoMove |no_cert_verify| into state machine
Matt Caswell [Mon, 5 Oct 2015 09:44:41 +0000 (10:44 +0100)]
Move |no_cert_verify| into state machine

The |no_cert_verify| should be in the state machine structure not in SSL

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoRemove extraneous parens
Matt Caswell [Mon, 5 Oct 2015 09:41:13 +0000 (10:41 +0100)]
Remove extraneous parens

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoChange statem prefix to ossl_statem
Matt Caswell [Mon, 5 Oct 2015 09:39:54 +0000 (10:39 +0100)]
Change statem prefix to ossl_statem

Change various state machine functions to use the prefix ossl_statem
instead.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoDon't depend on SSL structure internals
Matt Caswell [Mon, 5 Oct 2015 09:21:11 +0000 (10:21 +0100)]
Don't depend on SSL structure internals

The macros SSL_in_connect_init() and SSL_in_accept_init() inadvertently
depended on SSL structure internals. This fixes it to use public API calls
instead.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoChange HANDSHAKE_STATE to OSSL_HANDSHAKE_STATE
Matt Caswell [Mon, 5 Oct 2015 09:18:06 +0000 (10:18 +0100)]
Change HANDSHAKE_STATE to OSSL_HANDSHAKE_STATE

Rename the enum HANDSHAKE_STATE to OSSL_HANDSHAKE_STATE to ensure there are
no namespace clashes, and convert it into a typedef.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoFix some client side transition logic
Matt Caswell [Mon, 14 Sep 2015 14:06:37 +0000 (15:06 +0100)]
Fix some client side transition logic

Fixed some issues in the logic for determining whether an SKE should be
expected or not. In particular only allow an SKE for RSA if its export and
the key size is not allowed. Also fix the ephemeral ciphersuite checks and
add in a missing call to ssl3_check_cert_and_algorithm().

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoMinor documentation tweak
Matt Caswell [Fri, 11 Sep 2015 12:39:04 +0000 (13:39 +0100)]
Minor documentation tweak

Update the return type for SSL_state in the documentation.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoUpdate CHANGES
Matt Caswell [Fri, 11 Sep 2015 12:36:42 +0000 (13:36 +0100)]
Update CHANGES

Update the CHANGES file for the state machine rewrite

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoRemove a call to SSL_set_state from s_server
Matt Caswell [Fri, 11 Sep 2015 12:11:37 +0000 (13:11 +0100)]
Remove a call to SSL_set_state from s_server

s_server was (ab)using SSL_set_state to force a renegotiation. This is a
bad way to do things and does not work with the new state machine code, so
we need to do it a different way.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoFix a comment
Matt Caswell [Fri, 11 Sep 2015 11:11:39 +0000 (12:11 +0100)]
Fix a comment

Fix an out of date reference to old state machine code in a comment

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoRemove some unused variables
Matt Caswell [Fri, 11 Sep 2015 10:56:48 +0000 (11:56 +0100)]
Remove some unused variables

The next_state variable is no longer needed in the new state machine.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoAdd a state machine README
Matt Caswell [Fri, 11 Sep 2015 10:51:20 +0000 (11:51 +0100)]
Add a state machine README

Add some documentation on the thinking behind the state machine.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agomake update
Matt Caswell [Fri, 11 Sep 2015 10:28:24 +0000 (11:28 +0100)]
make update

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoMore state machine reorg
Matt Caswell [Fri, 11 Sep 2015 10:23:20 +0000 (11:23 +0100)]
More state machine reorg

Move some function definitions around within the state machine to make sure
they are in the correct files. Also create a statem_locl.h header for stuff
entirely local to the state machine code and move various definitions into
it.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoReorganise state machine files
Matt Caswell [Fri, 11 Sep 2015 09:48:59 +0000 (10:48 +0100)]
Reorganise state machine files

Pull out the state machine into a separate sub directory. Also moved some
functions which were nothing to do with the state machine but were in state
machine files. Pulled all the SSL_METHOD definitions into one place...most
of those files had very little left in them any more.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoRemove ssl_get_message from ssl_method_st
Matt Caswell [Thu, 10 Sep 2015 09:43:22 +0000 (10:43 +0100)]
Remove ssl_get_message from ssl_method_st

ssl_get_message is no longer used so it should be removed from
ssl_method_st

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoMove PACKET creation into the state machine
Matt Caswell [Thu, 10 Sep 2015 09:22:30 +0000 (10:22 +0100)]
Move PACKET creation into the state machine

Previously each message specific process function would create its own
PACKET structure. Rather than duplicate all of this code lots of times we
should create it in the state machine itself.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoRemove the SSL state variable
Matt Caswell [Thu, 10 Sep 2015 08:23:34 +0000 (09:23 +0100)]
Remove the SSL state variable

The SSL structure contained a "state" variable that kept track of the state
machine in the old code. The new state machine does not use this so it can
be removed.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoRemove the type variable
Matt Caswell [Thu, 10 Sep 2015 08:19:53 +0000 (09:19 +0100)]
Remove the type variable

The SSL structure contained a "type" variable that was set to either
SSL_ST_ACCEPT or SSL_ST_CONNECT depending on whether we are the server or
the client. This duplicates the capability of the "server" variable and was
actually rarely used.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoConvert DTLSv1_listen to use new state machine code
Matt Caswell [Thu, 22 Oct 2015 09:45:29 +0000 (10:45 +0100)]
Convert DTLSv1_listen to use new state machine code

The DTLSv1_listen code set the state value explicitly to move into init.
Change to use state_set_in_init() instead.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoRedefine old state values
Matt Caswell [Thu, 10 Sep 2015 08:11:41 +0000 (09:11 +0100)]
Redefine old state values

ssl.h and ssl3.h have a number of defines for the various states in the old
state machine code. Since this is public API it is not desirable to just
remove them. Instead redefine them to the closest equivalent state in the
new state machine code. If an application calls SSL_state then the return
value can still be compared against these old values if necessary. However
not all values have an equivalent state in the new code, so these are just
redefined to a dummy value.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoRemove redundant code
Matt Caswell [Tue, 8 Sep 2015 08:13:50 +0000 (09:13 +0100)]
Remove redundant code

Clean up and remove lots of code that is now no longer needed due to the
move to the new state machine.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoMove server side DTLS to new state machine
Matt Caswell [Fri, 4 Sep 2015 12:51:49 +0000 (13:51 +0100)]
Move server side DTLS to new state machine

Implement all of the necessary changes to make DTLS on the server work
with the new state machine code.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoMove server side TLS to new state machine
Matt Caswell [Tue, 8 Sep 2015 08:19:22 +0000 (09:19 +0100)]
Move server side TLS to new state machine

Implement all of the necessary changes for moving TLS server side
processing into the new state machine code.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoSplit TLS server functions
Matt Caswell [Tue, 8 Sep 2015 08:38:08 +0000 (09:38 +0100)]
Split TLS server functions

Split the TLS server ssl3_get_* and ssl3_send_* functions into two ready
for the migration to the new state machine code.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoDelete unused functions
Matt Caswell [Wed, 12 Aug 2015 18:58:29 +0000 (19:58 +0100)]
Delete unused functions

Remove all the functions and dead code that is now no longer required as
a result of the DTLS client move into the new state machine code.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoImplement DTLS client move to new state machine
Matt Caswell [Mon, 7 Sep 2015 21:00:36 +0000 (22:00 +0100)]
Implement DTLS client move to new state machine

Move all DTLS client side processing into the new state machine code. A
subsequent commit will clean up the old dead code.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agodtls_get_message changes for state machine move
Matt Caswell [Tue, 11 Aug 2015 10:41:03 +0000 (11:41 +0100)]
dtls_get_message changes for state machine move

Create a dtls_get_message function similar to the old dtls1_get_message but
in the format required for the new state machine code. The old function will
eventually be deleted in later commits.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoClient TLS state machine rewrite cleanup
Matt Caswell [Thu, 30 Jul 2015 12:45:50 +0000 (13:45 +0100)]
Client TLS state machine rewrite cleanup

Remove redundant code following moving client side TLS handling to the new
state machine implementation.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoImplement Client TLS state machine
Matt Caswell [Mon, 7 Sep 2015 15:36:53 +0000 (16:36 +0100)]
Implement Client TLS state machine

This swaps the implementation of the client TLS state machine to use the
new state machine code instead.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoSplit client message reading and writing functions
Matt Caswell [Wed, 29 Jul 2015 13:08:49 +0000 (14:08 +0100)]
Split client message reading and writing functions

The new state machine code will split up the reading and writing of
hanshake messages into discrete phases. In order to facilitate that the
existing "get" type functions will be split into two halves: one to get
the message and one to process it. The "send" type functions will also have
all work relating to constructing the message split out into a separate
function just for that. For some functions there will also be separate
pre and post "work" phases to prepare or update state.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoAdd initial state machine rewrite code
Matt Caswell [Wed, 29 Jul 2015 13:23:56 +0000 (14:23 +0100)]
Add initial state machine rewrite code

This is the first drop of the new state machine code.

The rewrite has the following objectives:
- Remove duplication of state code between client and server
- Remove duplication of state code between TLS and DTLS
- Simplify transitions and bring the logic together in a single location
  so that it is easier to validate
- Remove duplication of code between each of the message handling functions
- Receive a message first and then work out whether that is a valid
  transition - not the other way around (the other way causes lots of issues
  where we are expecting one type of message next but actually get something
  else)
- Separate message flow state from handshake state (in order to better
  understand each)
  - message flow state = when to flush buffers; handling restarts in the
    event of NBIO events; handling the common flow of steps for reading a
    message and the common flow of steps for writing a message etc
  - handshake state = what handshake message are we working on now
- Control complexity: only the state machine can change state: keep all
  the state changes local to a file

This builds on previous state machine related work:
- Surface CCS processing in the state machine
- Version negotiation rewrite

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoSplit ssl3_get_message
Matt Caswell [Wed, 29 Jul 2015 13:20:05 +0000 (14:20 +0100)]
Split ssl3_get_message

The function ssl3_get_message gets a whole message from the underlying bio
and returns it to the state machine code. The new state machine code will
split this into two discrete steps: get the message header and get the
message body. This commit splits the existing function into these two
sub steps to facilitate the state machine implementation.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoBN_GF2m_mod_inv(): check bn_wexpand return value
Pascal Cuoq [Mon, 12 Oct 2015 10:19:19 +0000 (12:19 +0200)]
BN_GF2m_mod_inv(): check bn_wexpand return value

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@akamai.com>
MR #1276, RT #4107

9 years agoRemove SSLeay history, etc., from docs
Rich Salz [Tue, 27 Oct 2015 17:40:11 +0000 (13:40 -0400)]
Remove SSLeay history, etc., from docs

If something was "present in all versions" of SSLeay, or if it was
added to a version of SSLeay (and therefore predates OpenSSL),
remove mention of it.  Documentation history now starts with OpenSSL.

Remove mention of all history before OpenSSL 0.9.8, inclusive.

Remove all AUTHOR sections.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoRemove HAMC_cleanup
Rich Salz [Tue, 27 Oct 2015 19:44:15 +0000 (15:44 -0400)]
Remove HAMC_cleanup

Old API for use with OpenSSL-0.9.6.  Remove it.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoMove crypto/threads to demo/threads
Rich Salz [Mon, 26 Oct 2015 20:00:23 +0000 (16:00 -0400)]
Move crypto/threads to demo/threads

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoProbably fix travis (wine build).
Ben Laurie [Sat, 24 Oct 2015 17:37:12 +0000 (18:37 +0100)]
Probably fix travis (wine build).

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agoImprove make depend.
Ben Laurie [Sat, 3 Oct 2015 15:43:21 +0000 (16:43 +0100)]
Improve make depend.

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoFix undeclared variable warnings.
Ben Laurie [Sat, 3 Oct 2015 15:43:21 +0000 (16:43 +0100)]
Fix undeclared variable warnings.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
9 years agoRemove useless code
Alessandro Ghedini [Thu, 8 Oct 2015 20:00:27 +0000 (22:00 +0200)]
Remove useless code

RT#4081

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoCheck memory allocation
Alessandro Ghedini [Thu, 8 Oct 2015 12:50:27 +0000 (14:50 +0200)]
Check memory allocation

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoFix references to various RFCs
Alessandro Ghedini [Thu, 8 Oct 2015 12:41:09 +0000 (14:41 +0200)]
Fix references to various RFCs

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoFix typos
Alessandro Ghedini [Thu, 8 Oct 2015 12:40:42 +0000 (14:40 +0200)]
Fix typos

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoSet salt length after the malloc has succeeded
Alessandro Ghedini [Thu, 8 Oct 2015 12:39:58 +0000 (14:39 +0200)]
Set salt length after the malloc has succeeded

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoFix memory leaks and other mistakes on errors
Alessandro Ghedini [Thu, 8 Oct 2015 12:38:57 +0000 (14:38 +0200)]
Fix memory leaks and other mistakes on errors

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoReplace malloc+strlcpy with strdup
Alessandro Ghedini [Thu, 8 Oct 2015 12:37:21 +0000 (14:37 +0200)]
Replace malloc+strlcpy with strdup

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoDo not treat 0 return value from BIO_get_fd() as error
Alessandro Ghedini [Fri, 2 Oct 2015 13:16:08 +0000 (15:16 +0200)]
Do not treat 0 return value from BIO_get_fd() as error

0 is a valid file descriptor.

RT#4068

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoRemove bugs/ and crypto/threads/
Alessandro Ghedini [Fri, 23 Oct 2015 15:55:27 +0000 (17:55 +0200)]
Remove bugs/ and crypto/threads/

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoClarify return values for EVP_DigestVerifyFinal.
Adam Eijdenberg [Mon, 19 Oct 2015 18:16:25 +0000 (11:16 -0700)]
Clarify return values for EVP_DigestVerifyFinal.

Previous language was unclear.  New language isn't pretty but I believe
it is more accurate.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoOnly include SRP headers when OPENSSL_NO_SRP is undefined
Richard Levitte [Thu, 22 Oct 2015 21:45:45 +0000 (23:45 +0200)]
Only include SRP headers when OPENSSL_NO_SRP is undefined

[fixes github issue #447]

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoMake Configure die when unsupported options are given
Richard Levitte [Thu, 22 Oct 2015 15:33:47 +0000 (17:33 +0200)]
Make Configure die when unsupported options are given

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoAdd an explicit list of options that can be disabled, enabled, ...
Richard Levitte [Thu, 22 Oct 2015 15:09:14 +0000 (17:09 +0200)]
Add an explicit list of options that can be disabled, enabled, ...

Configure has, so far, had no control at all of which 'no-' options it
can be given.  This means that, for example, someone could configure
with something absurd like 'no-stack' and then watch the build crumble
to dust...  or file a bug report.

This introduces some sanity into the possible choices.

The added list comes from looking for the explicit ones used in
Configure, and from grepping after OPENSSL_NO_ in all source files.

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agomake update
Richard Levitte [Mon, 19 Oct 2015 18:53:14 +0000 (20:53 +0200)]
make update

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoDon't forget to load the CT error strings
Richard Levitte [Mon, 19 Oct 2015 03:24:16 +0000 (05:24 +0200)]
Don't forget to load the CT error strings

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoHandle CT error macros separately
Richard Levitte [Mon, 19 Oct 2015 02:20:01 +0000 (04:20 +0200)]
Handle CT error macros separately

Because the default error macro generator assumes the header file with
error macros is in include/openssl and therefore generates a C file
with error texts that include <openssl/{name}.h>, we need to generate
the error macros and texts for CT separately, since the CT module
doesn't follow the default criteria.

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoDon't use SSLv23_server_method in an example
Matt Caswell [Wed, 21 Oct 2015 13:40:15 +0000 (14:40 +0100)]
Don't use SSLv23_server_method in an example

The function SSLv23_server_method() is an old name. New code should use
TLS_server_method() instead. Therefore don't use SSLv23_server_method() in
an example in the docs.

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoAvoid undefined behaviour in PACKET_buf_init
Matt Caswell [Wed, 21 Oct 2015 09:00:24 +0000 (10:00 +0100)]
Avoid undefined behaviour in PACKET_buf_init

Change the sanity check in PACKET_buf_init to check for excessive length
buffers, which should catch the interesting cases where len has been cast
from a negative value whilst avoiding any undefined behaviour.

RT#4094

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoct_locl.h moved, reflect it in crypto/ct/Makefile
Richard Levitte [Sun, 18 Oct 2015 19:31:21 +0000 (21:31 +0200)]
ct_locl.h moved, reflect it in crypto/ct/Makefile

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agomake update
Richard Levitte [Sun, 18 Oct 2015 06:59:51 +0000 (08:59 +0200)]
make update

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoAdd crypto/include/internal to the directories to scan for stack declarations
Richard Levitte [Sun, 18 Oct 2015 06:59:00 +0000 (08:59 +0200)]
Add crypto/include/internal to the directories to scan for stack declarations

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoBecause ct_locl.h is used between modules, move it to internal headers
Richard Levitte [Sun, 18 Oct 2015 06:57:37 +0000 (08:57 +0200)]
Because ct_locl.h is used between modules, move it to internal headers

Rename it to ct_int.h

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoMove auto Host adding to query_responder
Dr. Stephen Henson [Sat, 17 Oct 2015 23:16:23 +0000 (00:16 +0100)]
Move auto Host adding to query_responder

Check for Host header in query_responder instead of process_responder. This
also fixes a memory leak in the old code if the headers was NULL.

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoFix memory leak with -issuer option.
Dr. Stephen Henson [Sat, 17 Oct 2015 23:04:10 +0000 (00:04 +0100)]
Fix memory leak with -issuer option.

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoset string type when embedding
Dr. Stephen Henson [Sat, 17 Oct 2015 23:54:13 +0000 (00:54 +0100)]
set string type when embedding

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoMove contributing info to CONTRIBUTING
Manish Goregaokar [Sat, 17 Oct 2015 11:10:55 +0000 (16:40 +0530)]
Move contributing info to CONTRIBUTING

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoRun tests on Travis for mingw builds as well
Rich Salz [Fri, 16 Oct 2015 15:19:04 +0000 (11:19 -0400)]
Run tests on Travis for mingw builds as well

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Andy Polyakov <appro@openssl.org>
9 years agoFix error message when loading engines from config
Dmitry Belyavsky [Fri, 16 Oct 2015 09:07:57 +0000 (10:07 +0100)]
Fix error message when loading engines from config

When using command line applications errors occur when trying to
load engines specified in a config file. Introduced by commit
a0a82324f96

RT#4093

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoRemove Obsolete engines
Matt Caswell [Tue, 13 Oct 2015 14:02:47 +0000 (15:02 +0100)]
Remove Obsolete engines

There are a number of engines in the OpenSSL source code which are now
obsolete. The following engines have been removed: 4758cca, aep, atalla,
cswift, nuron, sureware.

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoFix self signed handling.
Dr. Stephen Henson [Wed, 5 Aug 2015 02:21:40 +0000 (03:21 +0100)]
Fix self signed handling.

Don't mark a certificate as self signed if keyUsage is present and
certificate signing not asserted.

PR#3979

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoembed CRL serial number and signature fields
Dr. Stephen Henson [Sun, 11 Oct 2015 20:13:42 +0000 (21:13 +0100)]
embed CRL serial number and signature fields

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoembed certificate serial number and signature fields
Dr. Stephen Henson [Sun, 11 Oct 2015 20:05:49 +0000 (21:05 +0100)]
embed certificate serial number and signature fields

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoembed value field of X509_EXTENSION
Dr. Stephen Henson [Sun, 11 Oct 2015 19:44:07 +0000 (20:44 +0100)]
embed value field of X509_EXTENSION

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoadd CHANGES entry for embed
Dr. Stephen Henson [Sun, 11 Oct 2015 20:20:19 +0000 (21:20 +0100)]
add CHANGES entry for embed

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoHandle embed flag in ASN1_STRING_copy().
Dr. Stephen Henson [Sun, 11 Oct 2015 22:25:08 +0000 (23:25 +0100)]
Handle embed flag in ASN1_STRING_copy().

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoPACKET: fix __owur
Emilia Kasper [Thu, 15 Oct 2015 10:53:35 +0000 (12:53 +0200)]
PACKET: fix __owur

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoAppease gcc's Wmaybe-uninitialized
Emilia Kasper [Thu, 15 Oct 2015 11:27:55 +0000 (13:27 +0200)]
Appease gcc's Wmaybe-uninitialized

False positive: gcc (4.8) can't figure out the SSL_IS_DTLS logic.

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoRemove EVP_CHECK_DES_KEY
Emilia Kasper [Wed, 14 Oct 2015 16:32:38 +0000 (18:32 +0200)]
Remove EVP_CHECK_DES_KEY

Thanks to the OpenBSD community for bringing this to our attention.

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoct_locl.h: fix some comments
Emilia Kasper [Fri, 9 Oct 2015 15:38:47 +0000 (17:38 +0200)]
ct_locl.h: fix some comments

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agomake depend: prefer clang over makedepend
Emilia Kasper [Fri, 9 Oct 2015 18:00:53 +0000 (20:00 +0200)]
make depend: prefer clang over makedepend

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoRFC5753 compliance.
Dr. Stephen Henson [Mon, 12 Oct 2015 20:14:04 +0000 (21:14 +0100)]
RFC5753 compliance.

RFC5753 requires that we omit parameters for AES key wrap and set them
to NULL for 3DES wrap. OpenSSL decrypt uses the received algorithm
parameters so can transparently handle either form.

Reviewed-by: Andy Polyakov <appro@openssl.org>
9 years agoAdd Clang 3.6 and additional GCC 5 builds to travis
Alessandro Ghedini [Tue, 6 Oct 2015 18:27:50 +0000 (20:27 +0200)]
Add Clang 3.6 and additional GCC 5 builds to travis

Follow-up to f386742.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
9 years agoGH429: Add clang to travis
Alessandro Ghedini [Mon, 12 Oct 2015 20:15:43 +0000 (16:15 -0400)]
GH429: Add clang to travis

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Andy Polyakov <appro@openssl.org>
9 years agotestlib/OpenSSL/Test.pm: remove redundant 'cmd /c', MSWin32 Perl can take care of...
Andy Polyakov [Mon, 12 Oct 2015 20:31:20 +0000 (22:31 +0200)]
testlib/OpenSSL/Test.pm: remove redundant 'cmd /c', MSWin32 Perl can take care of itself.

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoHarmonize do_rehash_rule with updated test/recipies/25-test_verify.t.
Andy Polyakov [Mon, 12 Oct 2015 20:26:14 +0000 (22:26 +0200)]
Harmonize do_rehash_rule with updated test/recipies/25-test_verify.t.

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoTest suite: chomp->s/\R// to harmonize with mingw 'make test'.
Andy Polyakov [Mon, 12 Oct 2015 20:24:27 +0000 (22:24 +0200)]
Test suite: chomp->s/\R// to harmonize with mingw 'make test'.

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoTest suite: minimal required to get mingw 'make test' work under Linux.
Andy Polyakov [Mon, 12 Oct 2015 20:16:07 +0000 (22:16 +0200)]
Test suite: minimal required to get mingw 'make test' work under Linux.

(part by Alessandro Ghedini)

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoRename -set-serial command to req
Matt Caswell [Mon, 12 Oct 2015 12:03:50 +0000 (13:03 +0100)]
Rename -set-serial command to req

Previous OpenSSL versions used -set_serial, but master was using
-set-serial - so rename it back to the old version.

RT#4059

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoCentralise loading default apps config file
Matt Caswell [Mon, 12 Oct 2015 11:40:15 +0000 (12:40 +0100)]
Centralise loading default apps config file

Loading the config file after processing command line options can
cause problems, e.g. where an engine provides new ciphers/digests
these are not then recoginised on the command line. Move the
default config file loading to before the command line option
processing. Whilst we're doing this we might as well centralise
this instead of doing it individually for each application. Finally
if we do it before the OpenSSL_add_ssl_algorithms() call then
ciphersuites provided by an engine (e.g. GOST) can be available to
the apps.

RT#4085
RT#4086

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoFix option name discrepancy
Matt Caswell [Mon, 12 Oct 2015 08:44:15 +0000 (09:44 +0100)]
Fix option name discrepancy

There used to be options -macopt and -sigopt in <=1.0.2 for the dgst
command line app. These were incorrectly spelled as -macop and -sigop in
master.

RT#4072

Reviewed-by: Andy Polyakov <appro@openssl.org>
9 years agoConfigurations: move -Wno-pedantic-ms-format to .travis.yml.
Andy Polyakov [Wed, 7 Oct 2015 07:35:12 +0000 (09:35 +0200)]
Configurations: move -Wno-pedantic-ms-format to .travis.yml.

The option is not available in older toolchains and would cause breakage.

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoembed OCSP_CERTID
Dr. Stephen Henson [Wed, 7 Oct 2015 13:42:34 +0000 (14:42 +0100)]
embed OCSP_CERTID

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoembed support for ASN1_STRING
Dr. Stephen Henson [Wed, 7 Oct 2015 12:28:46 +0000 (13:28 +0100)]
embed support for ASN1_STRING

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoEmbed various OCSP fields.
Dr. Stephen Henson [Tue, 6 Oct 2015 22:04:08 +0000 (23:04 +0100)]
Embed various OCSP fields.

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