aboutsummaryrefslogtreecommitdiffstats
path: root/ssl
Commit message (Collapse)AuthorAgeFilesLines
* free NULL cleanup -- codaRich Salz2015-05-0113-141/+68
| | | | | | | | After the finale, the "real" final part. :) Do a recursive grep with "-B1 -w [a-zA-Z0-9_]*_free" to see if any of the preceeding lines are an "if NULL" check that can be removed. Reviewed-by: Tim Hudson <tjh@openssl.org>
* Remove goto inside an if(0) blockRich Salz2015-05-016-35/+24
| | | | | | | There were a dozen-plus instances of this construct: if (0) { label: ..... } Reviewed-by: Tim Hudson <tjh@openssl.org>
* u_len may be unused.Ben Laurie2015-05-011-1/+1
| | | | Reviewed-by: Andy Polyakov
* free NULL cleanup 11Rich Salz2015-05-013-24/+12
| | | | | | | | | | | | | | | | | | | 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-0116-171/+86
| | | | | | Don't check for NULL before calling OPENSSL_free Reviewed-by: Richard Levitte <levitte@openssl.org>
* free NULL cleanup 7Rich Salz2015-04-301-8/+4
| | | | | | | | | | | This gets BN_.*free: BN_BLINDING_free BN_CTX_free BN_FLG_FREE BN_GENCB_free BN_MONT_CTX_free BN_RECP_CTX_free BN_clear_free BN_free BUF_MEM_free Also fix a call to DSA_SIG_free to ccgost engine and remove some #ifdef'd dead code in engines/e_ubsec. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Add sanity check to ssl_get_prev_sessionMatt Caswell2015-04-301-1/+1
| | | | | | | | Sanity check the |len| parameter to ensure it is positive. Thanks to Kevin Wojtysiak (Int3 Solutions) and Paramjot Oberoi (Int3 Solutions) for reporting this issue. Reviewed-by: Andy Polyakov <appro@openssl.org>
* Sanity check the return from final_finish_macMatt Caswell2015-04-302-2/+1
| | | | | | | | | The return value is checked for 0. This is currently safe but we should really check for <= 0 since -1 is frequently used for error conditions. Thanks to Kevin Wojtysiak (Int3 Solutions) and Paramjot Oberoi (Int3 Solutions) for reporting this issue. Reviewed-by: Andy Polyakov <appro@openssl.org>
* Add sanity check in ssl3_cbc_digest_recordMatt Caswell2015-04-301-2/+12
| | | | | | | | | | | | For SSLv3 the code assumes that |header_length| > |md_block_size|. Whilst this is true for all SSLv3 ciphersuites, this fact is far from obvious by looking at the code. If this were not the case then an integer overflow would occur, leading to a subsequent buffer overflow. Therefore I have added an explicit sanity check to ensure header_length is always valid. Thanks to Kevin Wojtysiak (Int3 Solutions) and Paramjot Oberoi (Int3 Solutions) for reporting this issue. Reviewed-by: Andy Polyakov <appro@openssl.org>
* Sanity check EVP_CTRL_AEAD_TLS_AADMatt Caswell2015-04-301-2/+5
| | | | | | | | | | The various implementations of EVP_CTRL_AEAD_TLS_AAD expect a buffer of at least 13 bytes long. Add sanity checks to ensure that the length is at least that. Also add a new constant (EVP_AEAD_TLS1_AAD_LEN) to evp.h to represent this length. Thanks to Kevin Wojtysiak (Int3 Solutions) and Paramjot Oberoi (Int3 Solutions) for reporting this issue. Reviewed-by: Andy Polyakov <appro@openssl.org>
* make updateMatt Caswell2015-04-301-22/+21
| | | | | | Run make update following previous header file changes. Reviewed-by: Rich Salz <rsalz@openssl.org>
* free cleanup almost the finaleRich Salz2015-04-307-39/+15
| | | | | | | | | | 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>
* free NULL cleanup 5aRich Salz2015-04-308-89/+43
| | | | | | | | | Don't check for NULL before calling a free routine. This gets X509_.*free: x509_name_ex_free X509_policy_tree_free X509_VERIFY_PARAM_free X509_STORE_free X509_STORE_CTX_free X509_PKEY_free X509_OBJECT_free_contents X509_LOOKUP_free X509_INFO_free Reviewed-by: Richard Levitte <levitte@openssl.org>
* Remove redundant includes from dtls1.hMatt Caswell2015-04-302-0/+8
| | | | | | | | | There were a set of includes in dtls1.h which are now redundant due to the libssl opaque work. This commit removes those includes, which also has the effect of resolving one issue preventing building on windows (i.e. the include of winsock.h) Reviewed-by: Andy Polyakov <appro@openssl.org>
* remove malloc castsRich Salz2015-04-287-17/+15
| | | | | | | Following ANSI C rules, remove the casts from calls to OPENSSL_malloc and OPENSSL_realloc. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Big apps cleanup (option-parsing, etc)Rich Salz2015-04-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is merges the old "rsalz-monolith" branch over to master. The biggest change is that option parsing switch from cascasding 'else if strcmp("-foo")' to a utility routine and somethin akin to getopt. Also, an error in the command line no longer prints the full summary; use -help (or --help :) for that. There have been many other changes and code-cleanup, see bullet list below. Special thanks to Matt for the long and detailed code review. TEMPORARY: For now, comment out CRYPTO_mem_leaks() at end of main Tickets closed: RT3515: Use 3DES in pkcs12 if built with no-rc2 RT1766: s_client -reconnect and -starttls broke RT2932: Catch write errors RT2604: port should be 'unsigned short' RT2983: total_bytes undeclared #ifdef RENEG RT1523: Add -nocert to fix output in x509 app RT3508: Remove unused variable introduced by b09eb24 RT3511: doc fix; req default serial is random RT1325,2973: Add more extensions to c_rehash RT2119,3407: Updated to dgst.pod RT2379: Additional typo fix RT2693: Extra include of string.h RT2880: HFS is case-insensitive filenames RT3246: req command prints version number wrong Other changes; incompatibilities marked with *: Add SCSV support Add -misalign to speed command Make dhparam, dsaparam, ecparam, x509 output C in proper style Make some internal ocsp.c functions void Only display cert usages with -help in verify Use global bio_err, remove "BIO*err" parameter from functions For filenames, - always means stdin (or stdout as appropriate) Add aliases for -des/aes "wrap" ciphers. *Remove support for IISSGC (server gated crypto) *The undocumented OCSP -header flag is now "-header name=value" *Documented the OCSP -header flag Reviewed-by: Matt Caswell <matt@openssl.org>
* SSL_CIPHER lookup functions.Dr. Stephen Henson2015-04-221-125/+95
| | | | | | | | | | | | | Add tables to convert between SSL_CIPHER fields and indices for ciphers and MACs. Reorganise ssl_ciph.c to use tables to lookup values and load them. New functions SSL_CIPHER_get_cipher_nid and SSL_CIPHER_get_digest_nid. Add documentation. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Repair EAP-FAST session resumptionEmilia Kasper2015-04-212-18/+99
| | | | | | | | | | | | | | | | | | | EAP-FAST session resumption relies on handshake message lookahead to determine server intentions. Commits 980bc1ec6114f5511b20c2e6ca741e61a39b99d6 and 7b3ba508af5c86afe43e28174aa3c53a0a24f4d9 removed the lookahead so broke session resumption. This change partially reverts the commits and brings the lookahead back in reduced capacity for TLS + EAP-FAST only. Since EAP-FAST does not support regular session tickets, the lookahead now only checks for a Finished message. Regular handshakes are unaffected by this change. Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* Error out immediately on empty ciphers list.Emilia Kasper2015-04-171-7/+6
| | | | | | | | | A 0-length ciphers list is never permitted. The old code only used to reject an empty ciphers list for connections with a session ID. It would later error out on a NULL structure, so this change just moves the alert closer to the problem source. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Code style: space after 'if'Viktor Dukhovni2015-04-1622-58/+58
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Fix ssl_get_prev_session overrunMatt Caswell2015-04-141-0/+5
| | | | | | | | | | | | | | | If OpenSSL is configured with no-tlsext then ssl_get_prev_session can read past the end of the ClientHello message if the session_id length in the ClientHello is invalid. This should not cause any security issues since the underlying buffer is 16k in size. It should never be possible to overrun by that many bytes. This is probably made redundant by the previous commit - but you can never be too careful. With thanks to Qinghao Tang for reporting this issue. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Check for ClientHello message overrunsMatt Caswell2015-04-141-1/+41
| | | | | | | | | | | The ClientHello processing is insufficiently rigorous in its checks to make sure that we don't read past the end of the message. This does not have security implications due to the size of the underlying buffer - but still needs to be fixed. With thanks to Qinghao Tang for reporting this issue. Reviewed-by: Rich Salz <rsalz@openssl.org>
* free NULL cleanup 9Rich Salz2015-04-112-26/+12
| | | | | | | | | | | | Ongoing work to skip NULL check before calling free routine. This gets: ecp_nistz256_pre_comp_free nistp224_pre_comp_free nistp256_pre_comp_free nistp521_pre_comp_free PKCS7_free PKCS7_RECIP_INFO_free PKCS7_SIGNER_INFO_free sk_PKCS7_pop_free PKCS8_PRIV_KEY_INFO_free PKCS12_free PKCS12_SAFEBAG_free PKCS12_free sk_PKCS12_SAFEBAG_pop_free SSL_CONF_CTX_free SSL_CTX_free SSL_SESSION_free SSL_free ssl_cert_free ssl_sess_cert_free Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* free NULL cleanup 10Rich Salz2015-04-114-13/+8
| | | | | | | | | | Avoid checking for NULL before calling free functions. This gets ssl.*free: ssl_sess_cert_free ssl_free ssl_excert_free ssl_cert_free SSL_free SSL_SRP_CTX_free SSL_SESSION_free SSL_CTX_free SSL_CTX_SRP_CTX_free SSL_CONF_CTX_free Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* The wrong ifdef is used to guard usage of PSK codeKurt Cancemi2015-04-101-1/+1
| | | | | | | PR#3790 Reviewed-by: Stephen Henson <steve@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
* Fix read_ahead issueMatt Caswell2015-04-101-1/+1
| | | | | | | | | Fix a "&" that should have been "!" when processing read_ahead. RT#3793 Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
* make dependDr. Stephen Henson2015-04-031-1/+1
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* Rewrite ssl_asn1.c using new ASN.1 code.Dr. Stephen Henson2015-04-031-439/+275
| | | | | | | Complete reimplementation of d2i_SSL_SESSION and i2d_SSL_SESSION using new ASN.1 code and eliminating use of old ASN.1 macros. Reviewed-by: Rich Salz <rsalz@openssl.org>
* make updateEmilia Kasper2015-04-011-115/+226
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Remove SSL_TASK, the DECnet Based SSL Engine - addendumRichard Levitte2015-03-311-20/+0
| | | | | | A bit of cleanup was forgotten. Reviewed-by: Tim Hudson <tjh@openssl.org>
* Remove SSL_TASK, the DECnet Based SSL EngineRichard Levitte2015-03-312-646/+1
| | | | | | | | | | | | | This engine is for VMS only, and isn't really part of the core OpenSSL but rather a side project of its own that just happens to have tagged along for a long time. The reasons why it has remained within the OpenSSL source are long lost in history, and there not being any real reason for it to remain here, it's time for it to move out. This side project will appear as a project in its own right, the location of which will be announced later on. Reviewed-by: Tim Hudson <tjh@openssl.org>
* Remove EXHEADER, TEST, APPS, links:, install: and uninstall: where relevantRichard Levitte2015-03-311-20/+2
| | | | | | | | | | | | With no more symlinks, there's no need for those variables, or the links target. This also goes for all install: and uninstall: targets that do nothing but copy $(EXHEADER) files, since that's now taken care of by the top Makefile. Also, removed METHTEST from test/Makefile. It looks like an old test that's forgotten... Reviewed-by: Rich Salz <rsalz@openssl.org>
* Stop symlinking, move files to intended directoryRichard Levitte2015-03-3110-8140/+0
| | | | | | | | | | | | | Rather than making include/openssl/foo.h a symlink to crypto/foo/foo.h, this change moves the file to include/openssl/foo.h once and for all. Likewise, move crypto/foo/footest.c to test/footest.c, instead of symlinking it there. Originally-by: Geoff Thorpe <geoff@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
* Clean up record layerMatt Caswell2015-03-313-121/+150
| | | | | | | Fix up various things that were missed during the record layer work. All instances where we are breaking the encapsulation rules. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Fix record layer "make clean"Matt Caswell2015-03-311-1/+3
| | | | | | | The "clean" target in libssl has been updated to handle the new record layer sub-directory. Reviewed-by: Richard Levitte <levitte@openssl.org>
* free NULL cleanupRich Salz2015-03-282-6/+3
| | | | | | | | | EVP_.*free; this gets: EVP_CIPHER_CTX_free EVP_PKEY_CTX_free EVP_PKEY_asn1_free EVP_PKEY_asn1_set_free EVP_PKEY_free EVP_PKEY_free_it EVP_PKEY_meth_free; and also EVP_CIPHER_CTX_cleanup Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Add Record Layer documentationMatt Caswell2015-03-261-0/+78
| | | | | | | Add some design documentation on how the record layer works to aid future maintenance. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Fix formatting odditiesMatt Caswell2015-03-261-5/+3
| | | | | | Fix some formatting oddities in rec_layer_d1.c. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Fix record.h formattingMatt Caswell2015-03-261-27/+26
| | | | | | | Fix some strange formatting in record.h. This was probably originally introduced as part of the reformat work. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Define SEQ_NUM_SIZEMatt Caswell2015-03-263-7/+9
| | | | | | | Replace the hard coded value 8 (the size of the sequence number) with a constant defined in a macro. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Fix compilation on windows for record layerMatt Caswell2015-03-261-1/+1
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Rename record layer source filesMatt Caswell2015-03-264-12/+12
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Remove some unneccessary macrosMatt Caswell2015-03-261-7/+7
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Renamed record layer header filesMatt Caswell2015-03-267-4/+7
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Reorganise header filesMatt Caswell2015-03-267-351/+150
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Remove last trace of non-record layer code reading and writing sequenceMatt Caswell2015-03-262-4/+5
| | | | | | numbers directly Reviewed-by: Richard Levitte <levitte@openssl.org>
* Move last_write_sequence from s->d1 to s->rlayer.d.Matt Caswell2015-03-264-24/+30
| | | | | | | Also push some usage of last_write_sequence out of dtls1_retransmit_message and into the record layer. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Move ssl3_record_sequence_update into record layerMatt Caswell2015-03-264-15/+13
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Move buffered_app_data from s->d1 to s->rlayer.dMatt Caswell2015-03-264-30/+29
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Move handshake_fragment, handshake_fragment_len, alert_fragment andMatt Caswell2015-03-263-38/+44
| | | | | | alert_fragment_len from s->d1 to s->rlayer.d Reviewed-by: Richard Levitte <levitte@openssl.org>