summaryrefslogtreecommitdiffstats
path: root/ssl
AgeCommit message (Collapse)Author
2015-10-15PACKET: fix __owurEmilia Kasper
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-10-15Appease gcc's Wmaybe-uninitializedEmilia Kasper
False positive: gcc (4.8) can't figure out the SSL_IS_DTLS logic. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-10-11Make no-psk compile without warnings.Dr. Stephen Henson
PR#4035 Reviewed-by: Matt Caswell <matt@openssl.org>
2015-10-09DTLS: remove unused cookie fieldEmilia Kasper
Note that this commit constifies a user callback parameter and therefore will break compilation for applications using this callback. But unless they are abusing write access to the buffer, the fix is trivial. Reviewed-by: Andy Polyakov <appro@openssl.org>
2015-10-08PACKET: simplify ServerKeyExchange parsingEmilia Kasper
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-10-07Don't advance PACKET in ssl_check_for_safariMatt Caswell
The function ssl_check_for_safari fingerprints the incoming extensions to see whether it is one of the broken versions of safari. However it was failing to reset the PACKET back to the same position it started in, hence causing some extensions to be skipped incorrectly. Reviewed-by: Emilia Käsper <emilia@openssl.org>
2015-10-06SSLv2 compat ciphers: clarify commentEmilia Kasper
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-10-06Address more Windows warnings illuminated by mingw.Andy Polyakov
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-10-05Validate ClientHello extension field lengthAlessandro Ghedini
RT#4069 Reviewed-by: Emilia Käsper <emilia@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2015-10-05Add PACKET_copy_allEmilia Kasper
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-10-05ssl_sess.c: grab a copy of the session IDEmilia Kasper
The user callback takes a non-const pointer, so don't pass PACKET data to it directly; rather, grab a local copy. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-10-05PACKETize and clean up ssl_bytes_to_cipher_list.Emilia Kasper
Fix alerts. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-10-05ssl3_get_client_hello: rearrange logicEmilia Kasper
Move all packet parsing to the beginning of the method. This limits the SSLv2 compatibility soup to the parsing, and makes the rest of the processing uniform. This is also needed for simpler EMS support: EMS servers need to do an early scan for EMS to make resumption decisions. This'll be easier when the entire ClientHello is parsed in the beginning. As a side effect, 1) PACKETize ssl_get_prev_session and tls1_process_ticket; and 2) Delete dead code for SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-10-05make dependRichard Levitte
Reviewed-by: Ben Laurie <ben@openssl.org>
2015-10-02Remove BIO_s_file_internal macro.Rich Salz
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-09-30Change the DEFAULT ciphersuites to exclude DES, RC4 and RC2Matt Caswell
This patch updates the "DEFAULT" cipherstring to be "ALL:!COMPLEMENTOFDEFAULT:!eNULL". COMPLEMENTOFDEFAULT is now defined internally by a flag on each ciphersuite indicating whether it should be excluded from DEFAULT or not. This gives us control at an individual ciphersuite level as to exactly what is in DEFAULT and what is not. Finally all DES, RC4 and RC2 ciphersuites are added to COMPLEMENTOFDEFAULT and hence removed from DEFAULT. Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-09-29Fix no-stdio buildDavid Woodhouse
Much related/similar work also done by Ivan Nestlerode <ivan.nestlerode@sonos.com> +Replace FILE BIO's with dummy ops that fail. +Include <stdio.h> for sscanf() even with no-stdio (since the declaration is there). We rely on sscanf() to parse the OPENSSL_ia32cap environment variable, since it can be larger than a 'long'. And we don't rely on the availability of strtoull(). +Remove OPENSSL_stderr(); not used. +Make OPENSSL_showfatal() do nothing (currently without stdio there's nothing we can do). +Remove file-based functionality from ssl/. The function prototypes were already gone, but not the functions themselves. +Remove unviable conf functionality via SYS_UEFI +Add fallback definition of BUFSIZ. +Remove functions taking FILE * from header files. +Add missing DECLARE_PEM_write_fp_const +Disable X509_LOOKUP_hash_dir(). X509_LOOKUP_file() was already compiled out, so remove its prototype. +Use OPENSSL_showfatal() in CRYPTO_destroy_dynlockid(). +Eliminate SRP_VBASE_init() and supporting functions. Users will need to build the verifier manually instead. +Eliminate compiler warning for unused do_pk8pkey_fp(). +Disable TEST_ENG_OPENSSL_PKEY. +Disable GOST engine as is uses [f]printf all over the place. +Eliminate compiler warning for unused send_fp_chars(). Signed-off-by: Rich Salz <rsalz@akamai.com> Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-09-28PACKET: simplify ServerHello parsingEmilia Kasper
Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-09-28RT2772: accept empty SessionTicketEmilia Kasper
RFC 5077 section 3.3 says: If the server determines that it does not want to include a ticket after it has included the SessionTicket extension in the ServerHello, then it sends a zero-length ticket in the NewSessionTicket handshake message. Previously the client would fail upon attempting to allocate a zero-length buffer. Now, we have the client ignore the empty ticket and keep the existing session. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-09-25Add ability to set default CA path and file locations individuallyMatt Caswell
Previously you could only set both the default path and file locations together. This adds the ability to set one without the other. Reviewed-by: Andy Polyakov <appro@openssl.org>
2015-09-23Sanity check cookie_lenMatt Caswell
Add a sanity check that the cookie_len returned by app_gen_cookie_cb is valid. Reviewed-by: Andy Polyakov <appro@openssl.org>
2015-09-23Remove remaining old listen codeMatt Caswell
The old implementation of DTLSv1_listen which has now been replaced still had a few vestiges scattered throughout the code. This commit removes them. Reviewed-by: Andy Polyakov <appro@openssl.org>
2015-09-23DTLSv1_listen rewriteMatt Caswell
The existing implementation of DTLSv1_listen() is fundamentally flawed. This function is used in DTLS solutions to listen for new incoming connections from DTLS clients. A client will send an initial ClientHello. The server will respond with a HelloVerifyRequest containing a unique cookie. The client the responds with a second ClientHello - which this time contains the cookie. Once the cookie has been verified then DTLSv1_listen() returns to user code, which is typically expected to continue the handshake with a call to (for example) SSL_accept(). Whilst listening for incoming ClientHellos, the underlying BIO is usually in an unconnected state. Therefore ClientHellos can come in from *any* peer. The arrival of the first ClientHello without the cookie, and the second one with it, could be interspersed with other intervening messages from different clients. The whole purpose of this mechanism is as a defence against DoS attacks. The idea is to avoid allocating state on the server until the client has verified that it is capable of receiving messages at the address it claims to come from. However the existing DTLSv1_listen() implementation completely fails to do this. It attempts to super-impose itself on the standard state machine and reuses all of this code. However the standard state machine expects to operate in a stateful manner with a single client, and this can cause various problems. A second more minor issue is that the return codes from this function are quite confused, with no distinction made between fatal and non-fatal errors. Most user code treats all errors as non-fatal, and simply retries the call to DTLSv1_listen(). This commit completely rewrites the implementation of DTLSv1_listen() and provides a stand alone implementation that does not rely on the existing state machine. It also provides more consistent return codes. Reviewed-by: Andy Polyakov <appro@openssl.org>
2015-09-22PACKET: simplifyEmilia Kasper
Get rid of the third field that is no longer needed. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-09-22Remove ssl_put_cipher_by_charEmilia Kasper
Since SSLv3, a CipherSuite is always 2 bytes. The only place where we need 3-byte ciphers is SSLv2-compatible ClientHello processing. So, remove the ssl_put_cipher_by_char indirection. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-09-20Handle SSL_ERROR_WANT_X509_LOOKUPDr. Stephen Henson
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-09-18Remove PACKET_backEmilia Kasper
It's unused, and the same functionality can be achieved with saving a copy of the struct. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-09-17Remove PACKET_(get|goto)_bookmarkEmilia Kasper
The bookmark API results in a lot of boilerplate error checking that can be much more easily achieved with a simple struct copy. It also lays the path for removing the third PACKET field. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-09-17RT4047: Set reference count earlierFilipe DA SILVA
Make sure it's valid very early. Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-09-17Disentangle RSA premaster secret parsingEmilia Kasper
Simplify encrypted premaster secret reading by using new methods in the PACKET API. Don't overwrite the packet buffer. RSA decrypt accepts truncated ciphertext with leading zeroes omitted, so it's even possible that by crafting a valid ciphertext with several leading zeroes, this could cause a few bytes out-of-bounds write. The write is harmless because of the size of the underlying message buffer, but nevertheless we shouldn't write into the packet. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-09-16Fix return values when adding serverinfo fails.Kurt Roeckx
Reviewed-by: Rich Salz <rsalz@openssl.org> MR #1128
2015-09-16make updateMatt Caswell
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-09-14Fix PSK identity hint handling.Dr. Stephen Henson
For server use a PSK identity hint value in the CERT structure which is inherited when SSL_new is called and which allows applications to set hints on a per-SSL basis. The previous version of SSL_use_psk_identity_hint tried (wrongly) to use the SSL_SESSION structure. PR#4039 Reviewed-by: Matt Caswell <matt@openssl.org>
2015-09-11Enable -Wmissing-variable-declarations andBen Laurie
-Wincompatible-pointer-types-discards-qualifiers (the latter did not require any code changes). Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-09-10Restore SSLerr on PACKET_strndup failure.Emilia Kasper
Reviewed-by: Dr Stephen Henson <steve@openssl.org>
2015-09-09PACKET: add PACKET_memdup and PACKET_strndupEmilia Kasper
Use each once in s3_srvr.c to show how they work. Also fix a bug introduced in c3fc7eeab884b6876a1b4006163f190d325aa047 and made apparent by this change: ssl3_get_next_proto wasn't updating next_proto_negotiated_len Reviewed-by: Matt Caswell <matt@openssl.org>
2015-09-07PACKETise ServerKeyExchangeMatt Caswell
Process the ServerKeyExchange message using the PACKET API Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-09-07PACKETise ServerHello processingMatt Caswell
Process ServerHello messages using the PACKET API Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-09-06Avoid direct X509 structure accessDr. Stephen Henson
Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-09-04Match SUITEB strings at start of cipher list.Dr. Stephen Henson
PR#4009. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-09-03remove 0 assignments.Rich Salz
After openssl_zalloc, cleanup more "set to 0/NULL" assignments. Many are from github feedback. Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-09-02Add and use OPENSSL_zallocRich Salz
There are many places (nearly 50) where we malloc and then memset. Add an OPENSSL_zalloc routine to encapsulate that. (Missed one conversion; thanks Richard) Also fixes GH328 Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-09-02Fix CCM support in DTLSDr. Stephen Henson
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-09-02Fix DTLS1.2 buffersHiroyuki YAMAMORI
Fix the setup of DTLS1.2 buffers to take account of the Header Reviewed-by: Emilia Käsper <emilia@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2015-08-31Add X509_up_ref function.Dr. Stephen Henson
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-08-26Clean up reset of read/write sequencesMatt Caswell
Use sizeof instead of an explicit size, and use the functions for the purpose. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-08-26PACKET: add methods for reading length-prefixed TLS vectors.Emilia Kasper
Rewrite ssl3_get_client_hello to use the new methods. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-08-26Fix SSLv2-compatible ClientHello processing.Emilia Kasper
If the client challenge is less than 32 bytes, it is padded with leading - not trailing - zero bytes. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-08-26PACKET: constify where possibleEmilia Kasper
The PACKET should hold a 'const unsigned char*' underneath as well but the legacy code passes the record buffer around as 'unsigned char*' (to callbacks, too) so that's a bigger refactor. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-08-26Fix DTLS session ticket renewalMatt Caswell
A DTLS client will abort a handshake if the server attempts to renew the session ticket. This is caused by a state machine discrepancy between DTLS and TLS discovered during the state machine rewrite work. The bug can be demonstrated as follows: Start a DTLS s_server instance: openssl s_server -dtls Start a client and obtain a session but no ticket: openssl s_client -dtls -sess_out session.pem -no_ticket Now start a client reusing the session, but allow a ticket: openssl s_client -dtls -sess_in session.pem The client will abort the handshake. Reviewed-by: Tim Hudson <tjh@openssl.org>