aboutsummaryrefslogtreecommitdiffstats
path: root/ssl/t1_enc.c
Commit message (Collapse)AuthorAgeFilesLines
* Copyright consolidation 01/10Rich Salz2016-05-171-107/+7
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Remove #error from include files.Rich Salz2016-03-201-3/+1
| | | | | | | | Don't have #error statements in header files, but instead wrap the contents of that file in #ifndef OPENSSL_NO_xxx This means it is now always safe to include the header file. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Lazily initialise the compression bufferMatt Caswell2016-03-071-2/+0
| | | | | | | | | | | | With read pipelining we use multiple SSL3_RECORD structures for reading. There are SSL_MAX_PIPELINES (32) of them defined (typically not all of these would be used). Each one has a 16k compression buffer allocated! This results in a significant amount of memory being consumed which, most of the time, is not needed. This change swaps the allocation of the compression buffer to be lazy so that it is only done immediately before it is actually used. Reviewed-by: Tim Hudson <tjh@openssl.org>
* Refactor ClientHello extension parsingEmilia Kasper2016-03-031-0/+2
| | | | | | | | | | | | | | | | | 1) Simplify code with better PACKET methods. 2) Make broken SNI parsing explicit. SNI was intended to be extensible to new name types but RFC 4366 defined the syntax inextensibly, and OpenSSL has never parsed SNI in a way that would allow adding a new name type. RFC 6066 fixed the definition but due to broken implementations being widespread, it appears impossible to ever extend SNI. 3) Annotate resumption behaviour. OpenSSL doesn't currently handle all extensions correctly upon resumption. Annotate for further clean-up. 4) Send an alert on ALPN protocol mismatch. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* GH735: remove unnecessary allocationJ Mohan Rao Arisankala2016-02-231-6/+0
| | | | | | | Removing code, where memory was getting allocated for an unused variable Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* Fix {TLS,CIPHER}_DEBUG compiles.Rich Salz2016-02-181-1/+1
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Remove outdated DEBUG flags.Rich Salz2016-02-181-4/+4
| | | | | | | | | | | | | | | | | Add -DBIO_DEBUG to --strict-warnings. Remove comments about outdated debugging ifdef guards. Remove md_rand ifdef guarding an assert; it doesn't seem used. Remove the conf guards in conf_api since we use OPENSSL_assert, not assert. For pkcs12 stuff put OPENSSL_ in front of the macro name. Merge TLS_DEBUG into SSL_DEBUG. Various things just turned on/off asserts, mainly for checking non-NULL arguments, which is now removed: camellia, bn_ctx, crypto/modes. Remove some old debug code, that basically just printed things to stderr: DEBUG_PRINT_UNKNOWN_CIPHERSUITES, DEBUG_ZLIB, OPENSSL_RI_DEBUG, RL_DEBUG, RSA_DEBUG, SCRYPT_DEBUG. Remove OPENSSL_SSL_DEBUG_BROKEN_PROTOCOL. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Implement the use of heap manipulator implementionsRichard Levitte2016-02-171-2/+2
| | | | | | | | | | | | | | | | - Make use of the functions given through CRYPTO_set_mem_functions(). - CRYPTO_free(), CRYPTO_clear_free() and CRYPTO_secure_free() now receive __FILE__ and __LINE__. - The API for CRYPTO_set_mem_functions() and CRYPTO_get_mem_functions() is slightly changed, the implementation for free() now takes a couple of extra arguments, taking __FILE__ and __LINE__. - The CRYPTO_ memory functions will *always* receive __FILE__ and __LINE__ from the corresponding OPENSSL_ macros, regardless of if crypto-mdebug has been enabled or not. The reason is that if someone swaps out the malloc(), realloc() and free() implementations, we can't know if they will use them or not. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Remove /* foo.c */ commentsRich Salz2016-01-261-1/+0
| | | | | | | | | | | | This was done by the following find . -name '*.[ch]' | /tmp/pl where /tmp/pl is the following three-line script: print unless $. == 1 && m@/\* .*\.[ch] \*/@; close ARGV if eof; # Close file to reset $. And then some hand-editing of other files. Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
* use TLS PRFDr. Stephen Henson2016-01-191-144/+44
| | | | | | Modify libssl to use EVP_PKEY TLS PRF. Reviewed-by: Matt Caswell <matt@openssl.org>
* Adapt all EVP_CIPHER_CTX users for it becoming opaqueRichard Levitte2016-01-121-4/+3
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* Fix clang complaints about uninitialised variables.Richard Levitte2015-12-071-2/+2
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* Cleanup: fix all sources that used EVP_MD_CTX_(create|init|destroy)Richard Levitte2015-12-071-7/+7
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* Adjust all accesses to EVP_MD_CTX to use accessor functions.Richard Levitte2015-12-071-27/+29
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* Remove support for all 40 and 56 bit ciphers.Kurt Roeckx2015-12-051-40/+2
| | | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> MR: #364
* PRF and handshake hash revision.Dr. Stephen Henson2015-11-271-46/+35
| | | | | | | | | | | | | | Change handshake hash array into a single digest context simplifying the handhake hash code. Use EVP_md5_sha1() if needed for handshake hashes in TLS 1.1 and earlier. Simplify PRF code to also use a single digest and treat EVP_md5_sha1() as a special case. Modify algorithm2 field of ciphers to use a single index value for handshake hash and PRF instead of a bitmap. Reviewed-by: Matt Caswell <matt@openssl.org>
* Remove unused cert_verify_mac codeDr. Stephen Henson2015-11-251-30/+0
| | | | Reviewed-by: Andy Polyakov <appro@openssl.org>
* Ensure all EVP calls have their returns checked where appropriateMatt Caswell2015-11-201-5/+16
| | | | | | | | There are lots of calls to EVP functions from within libssl There were various places where we should probably check the return value but don't. This adds these checks. Reviewed-by: Richard Levitte <levitte@openssl.org>
* ccm8 supportDr. Stephen Henson2015-08-141-1/+5
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* CCM support.Dr. Stephen Henson2015-08-141-1/+13
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* Tidy up ssl3_digest_cached_records logic.Dr. Stephen Henson2015-06-231-17/+11
| | | | | | | | | | | | | | | Rewrite ssl3_digest_cached_records handling. Only digest cached records if digest array is NULL: this means it is safe to call ssl3_digest_cached_records multiple times (subsequent calls are no op). Remove flag TLS1_FLAGS_KEEP_HANDSHAKE instead only update handshake buffer if digest array is NULL. Add additional "keep" parameter to ssl3_digest_cached_records to indicate if the handshake buffer should be retained after digesting cached records (needed for TLS 1.2 client authentication). Reviewed-by: Matt Caswell <matt@openssl.org>
* Silence Clang warning about unit'd variableRich Salz2015-05-311-1/+1
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* clear/cleanse cleanupRich Salz2015-05-301-5/+7
| | | | | | | Where we called openssl_cleanse, make sure we do it on all error paths. Be consistent in use of sizeof(foo) when possible. Reviewed-by: Andy Polyakov <appro@openssl.org>
* Remove Kerberos support from libsslMatt Caswell2015-05-131-66/+1
| | | | | | | Remove RFC2712 Kerberos support from libssl. This code and the associated standard is no longer considered fit-for-purpose. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Use safer sizeof variant in mallocRich Salz2015-05-041-1/+1
| | | | | | | | | | | | | For a local variable: TYPE *p; Allocations like this are "risky": p = OPENSSL_malloc(sizeof(TYPE)); if the type of p changes, and the malloc call isn't updated, you could get memory corruption. Instead do this: p = OPENSSL_malloc(sizeof(*p)); Also fixed a few memset() calls that I noticed while doing this. Reviewed-by: Richard Levitte <levitte@openssl.org>
* free NULL cleanup 11Rich Salz2015-05-011-8/+4
| | | | | | | | | | | | | | | | | | | Don't check for NULL before calling free functions. This gets: ERR_STATE_free ENGINE_free DSO_free CMAC_CTX_free COMP_CTX_free CONF_free NCONF_free NCONF_free_data _CONF_free_data A sk_free use within OBJ_sigid_free TS_TST_INFO_free (rest of TS_ API was okay) Doc update for UI_free (all uses were fine) X509V3_conf_free X509V3_section_free X509V3_string_free Reviewed-by: Richard Levitte <levitte@openssl.org>
* free null cleanup finaleRich Salz2015-05-011-4/+2
| | | | | | Don't check for NULL before calling OPENSSL_free Reviewed-by: Richard Levitte <levitte@openssl.org>
* free cleanup almost the finaleRich Salz2015-04-301-4/+1
| | | | | | | | | | Add OPENSSL_clear_free which merges cleanse and free. (Names was picked to be similar to BN_clear_free, etc.) Removed OPENSSL_freeFunc macro. Fixed the small simple ones that are left: CRYPTO_free CRYPTO_free_locked OPENSSL_free_locked Reviewed-by: Richard Levitte <levitte@openssl.org>
* remove malloc castsRich Salz2015-04-281-2/+2
| | | | | | | Following ANSI C rules, remove the casts from calls to OPENSSL_malloc and OPENSSL_realloc. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Code style: space after 'if'Viktor Dukhovni2015-04-161-2/+2
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Move read_sequence and write_sequence from s->s3 to s->rlayerMatt Caswell2015-03-261-2/+2
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Introduce macro RECORD_LAYER_setup_comp_bufferMatt Caswell2015-03-261-2/+1
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Move more SSL3_RECORD oriented functions into ssl3_record.cMatt Caswell2015-03-261-291/+0
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Encapsulate s->s3->wrecMatt Caswell2015-03-261-2/+2
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Encapsulate s->s3->rrecMatt Caswell2015-03-261-6/+4
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Ensure last_write_sequence is saved in DTLS1.2Matt Caswell2015-03-251-4/+4
| | | | | | | | | | | | In DTLS, immediately prior to epoch change, the write_sequence is supposed to be stored in s->d1->last_write_sequence. The write_sequence is then reset back to 00000000. In the event of retransmits of records from the previous epoch, the last_write_sequence is restored. This commit fixes a bug in DTLS1.2 where the write_sequence was being reset before last_write_sequence was saved, and therefore retransmits are sent with incorrect sequence numbers. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Fix missing return value checksMatt Caswell2015-03-231-1/+2
| | | | | | | | Ensure that all functions have their return values checked where appropriate. This covers all functions defined and called from within libssl. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Add sanity check to PRFMatt Caswell2015-03-171-0/+5
| | | | | | | | The function tls1_PRF counts the number of digests in use and partitions security evenly between them. There always needs to be at least one digest in use, otherwise this is an internal error. Add a sanity check for this. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Cleanse buffersMatt Caswell2015-03-111-0/+5
| | | | | | Cleanse various intermediate buffers used by the PRF. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Fixed missing return value checks.Matt Caswell2015-02-271-9/+17
| | | | | | Added various missing return value checks in tls1_change_cipher_state. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Missing OPENSSL_free on error path.Eric Dequin2015-02-121-0/+1
| | | | | Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
* dead code cleanup: #if 0 in sslRich Salz2015-02-061-5/+0
| | | | | | | | I left many "#if 0" lines, usually because I thought we would probably want to revisit them later, or because they provided some useful internal documentation tips. Reviewed-by: Andy Polyakov <appro@openssl.org>
* Remove unused variables.Dr. Stephen Henson2015-02-031-6/+4
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* Add extms support to master key generation.Dr. Stephen Henson2015-02-031-7/+38
| | | | | | | | | | | | Update master secret calculation to support extended master secret. TLS 1.2 client authentication adds a complication because we need to cache the handshake messages. This is simpllified however because the point at which the handshake hashes are calculated for extended master secret is identical to that required for TLS 1.2 client authentication (immediately after client key exchange which is also immediately before certificate verify). Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* Utility function to retrieve handshake hashes.Dr. Stephen Henson2015-02-031-39/+10
| | | | | | | Retrieve handshake hashes in a separate function. This tidies the existing code and will be used for extended master secret generation. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* Remove support for opaque-prfRich Salz2015-01-281-16/+0
| | | | | | | An expired IETF Internet-Draft (seven years old) that nobody implements, and probably just as good as NSA DRBG work. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Run util/openssl-format-source -v -c .Matt Caswell2015-01-221-1051/+1091
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* Move more comments that confuse indentMatt Caswell2015-01-221-1/+2
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* Fix strange formatting by indentMatt Caswell2015-01-221-1/+2
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* Fix source where indent will not be able to copeMatt Caswell2015-01-221-1/+2
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>