aboutsummaryrefslogtreecommitdiff
path: root/test/ssltest.c
AgeCommit message (Collapse)AuthorFilesLines
2016-03-09Use version flexible method instead of fixed versionKurt Roeckx1-17/+2
Reviewed-by: Viktor Dukhovni <viktor@openssl.org> MR: #1824
2016-03-09Use minimum and maximum protocol version instead of version fixed methodsKurt Roeckx1-33/+33
Reviewed-by: Viktor Dukhovni <viktor@openssl.org> MR: #1824
2016-03-09Fix usage of OPENSSL_NO_*_METHODKurt Roeckx1-3/+3
Reviewed-by: Viktor Dukhovni <viktor@openssl.org> MR: #1824
2016-03-09Remove the old threading APIMatt Caswell1-56/+0
All OpenSSL code has now been transferred to use the new threading API, so the old one is no longer used and can be removed. We provide some compat macros for removed functions which are all no-ops. There is now no longer a need to set locking callbacks!! Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-09Fix memory leak in ssltestMatt Caswell1-0/+6
The new Rand usage of Thread API exposed a bug in ssltest. ssltest "cheats" and uses internal headers to directly call functions that normally you wouldn't be able to do. This means that auto-init doesn't happen, and therefore auto-deinit doesn't happen either, meaning that the new rand locks don't get cleaned up properly. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-08Convert CRYPTO_LOCK_SSL_* to new multi-threading APIAlessandro Ghedini1-11/+14
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-08Fix error in ssltestMatt Caswell1-2/+3
Compiling ssltest with some compilers using --strict-warnings results in complaints about an unused result. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2016-03-08Fix build; ssltestRich Salz1-3/+3
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-08GH787: Fix ALPNTodd Short1-78/+173
* Perform ALPN after the SNI callback; the SSL_CTX may change due to that processing * Add flags to indicate that we actually sent ALPN, to properly error out if unexpectedly received. * clean up ssl3_free() no need to explicitly clear when doing memset * document ALPN functions Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-03-04Extends s_client to allow a basic CT policy to be enabledRob Percival1-9/+45
Reviewed-by: Ben Laurie <ben@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-04Adds CT validation to SSL connectionsRob Percival1-1/+3
Disabled by default, but can be enabled by setting the ct_validation_callback on a SSL or SSL_CTX. Reviewed-by: Ben Laurie <ben@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-09Clean up the tests for auto-init/de-initMatt Caswell1-12/+0
Remove the need to explicitly initialise/deinitialise for the tests Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-02-05If memory debugging enabled return error on leaks.Dr. Stephen Henson1-1/+2
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-03Use BIO_snprintf() rather than snprintf()Richard Levitte1-1/+1
Some platforms do not have the latter. Reviewed-by: Matt Caswell <matt@openssl.org>
2016-02-03Refactoring BIO: add a test, using test/ssltestRichard Levitte1-8/+309
This adds a couple of simple tests to see that SSL traffic using the reimplemented BIO_s_accept() and BIO_s_connect() works as expected, both on IPv4 and on IPv6. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2016-01-26Remove /* foo.c */ commentsRich Salz1-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>
2016-01-19Support disabling any or all TLS or DTLS versionsViktor Dukhovni1-21/+49
Some users want to disable SSL 3.0/TLS 1.0/TLS 1.1, and enable just TLS 1.2. In the future they might want to disable TLS 1.2 and enable just TLS 1.3, ... This commit makes it possible to disable any or all of the TLS or DTLS protocols. It also considerably simplifies the SSL/TLS tests, by auto-generating the min/max version tests based on the set of supported protocols (425 explicitly written out tests got replaced by two loops that generate all 425 tests if all protocols are enabled, fewer otherwise). Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-01-11Enable/disable crypto-mdebug just like other featuresViktor Dukhovni1-1/+1
Also always abort() on leak failure. Reviewed-by: Stephen Henson <steve@openssl.org>
2016-01-07mem functions cleanupRich Salz1-9/+6
Only two macros CRYPTO_MDEBUG and CRYPTO_MDEBUG_ABORT to control this. If CRYPTO_MDEBUG is not set, #ifdef out the whole debug machinery. (Thanks to Jakob Bohm for the suggestion!) Make the "change wrapper functions" be the only paradigm. Wrote documentation! Format the 'set func' functions so their paramlists are legible. Format some multi-line comments. Remove ability to get/set the "memory debug" functions at runtme. Remove MemCheck_* and CRYPTO_malloc_debug_init macros. Add CRYPTO_mem_debug(int flag) function. Add test/memleaktest. Rename CRYPTO_malloc_init to OPENSSL_malloc_init; remove needless calls. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-01-07Fix declarations and constification for inline stack.Dr. Stephen Henson1-1/+1
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-01-02Add support for minimum and maximum protocol versionKurt Roeckx1-5/+137
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2015-12-22unload modules in ssltestDr. Stephen Henson1-0/+1
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-12-16Rename some BUF_xxx to OPENSSL_xxxRich Salz1-1/+1
Rename BUF_{strdup,strlcat,strlcpy,memdup,strndup,strnlen} to OPENSSL_{strdup,strlcat,strlcpy,memdup,strndup,strnlen} Add #define's for the old names. Add CRYPTO_{memdup,strndup}, called by OPENSSL_{memdup,strndup} macros. Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-12-05Remove support for all 40 and 56 bit ciphers.Kurt Roeckx1-44/+0
Reviewed-by: Rich Salz <rsalz@openssl.org> MR: #364
2015-12-04Remove SSL_{CTX_}set_ecdh_auto() and always enable ECDHKurt Roeckx1-1/+0
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
2015-12-04Make SSL_{CTX}_set_tmp_ecdh() call SSL_{CTX_}set1_curves()Kurt Roeckx1-0/+1
SSL_{CTX}_set_tmp_ecdh() allows to set 1 EC curve and then tries to use it. On the other hand SSL_{CTX_}set1_curves() allows you to set a list of curves, but only when SSL_{CTX_}set_ecdh_auto() was called to turn it on. Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
2015-12-02_BSD_SOURCE is deprecated, use _DEFAULT_SOURCE insteadRichard Levitte1-0/+1
The feature_test_macros(7) manual tells us that _BSD_SOURCE is deprecated since glibc 2.20 and that the compiler will warn about it being used, unless _DEFAULT_SOURCE is defined as well. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-11-21Fix (minor) problems found by ubsanAlessandro Ghedini1-1/+6
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-11-08Use uint32_t and int32_t for SSL_CIPHER structure.Dr. Stephen Henson1-2/+2
Reviewed-by: Andy Polyakov <appro@openssl.org>
2015-09-11Enable -Wmissing-variable-declarations andBen Laurie1-13/+13
-Wincompatible-pointer-types-discards-qualifiers (the latter did not require any code changes). Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-09-06Have the test executables output in text modeRichard Levitte1-1/+1
The test executables use standard output and standard error for text output, so let's open the corresponding BIOs in text mode. Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-09-06Avoid direct X509 structure accessDr. Stephen Henson1-1/+1
Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-09-02Add and use OPENSSL_zallocRich Salz1-5/+2
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-02Update ssltest certificate handling.Dr. Stephen Henson1-64/+6
Use SSL_CONF for certificate handling is ssltest.c, this changes the behaviour slightly: the -cert and -key options are no longer recognised and a default certificate file is not used. This change means that -s_cert and -c_cert can be used mode than once to support use of multiple certificates. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-05-27Enable DH testsEmilia Kasper1-1/+2
In master, the 'dh' command is gone, so use 'dhparam' instead to determine if we're compiled with DH. Also, set "@SECLEVEL=1" for the weak DH test, so that it actually passes. Reviewed-by: Dr Stephen Henson <steve@openssl.org>
2015-05-26Fix ssltest to use 1024-bit DHE parametersEmilia Kasper1-9/+11
Also add more ciphersuite test coverage, and a negative test for 512-bit DHE. Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 1ee85aab75d7c9f20058f781bfe9222323df08eb)
2015-05-20Only support >= 256-bit elliptic curves with ecdh_auto (server) or by ↵Emilia Kasper1-5/+2
default (client). Also reorder preferences to prefer prime curves to binary curves, and P-256 to everything else. The result: $ openssl s_server -named_curves "auto" This command will negotiate an ECDHE ciphersuite with P-256: $ openssl s_client This command will negotiate P-384: $ openssl s_client -curves "P-384" This command will not negotiate ECDHE because P-224 is disabled with "auto": $ openssl s_client -curves "P-224" Reviewed-by: Kurt Roeckx <kurt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-05-16Server side version negotiation rewriteMatt Caswell1-1/+1
This commit changes the way that we do server side protocol version negotiation. Previously we had a whole set of code that had an "up front" state machine dedicated to the negotiating the protocol version. This adds significant complexity to the state machine. Historically the justification for doing this was the support of SSLv2 which works quite differently to SSLv3+. However, we have now removed support for SSLv2 so there is little reason to maintain this complexity. The one slight difficulty is that, although we no longer support SSLv2, we do still support an SSLv3+ ClientHello in an SSLv2 backward compatible ClientHello format. This is generally only used by legacy clients. This commit adds support within the SSLv3 code for these legacy format ClientHellos. Server side version negotiation now works in much the same was as DTLS, i.e. we introduce the concept of TLS_ANY_VERSION. If s->version is set to that then when a ClientHello is received it will work out the most appropriate version to respond with. Also, SSLv23_method and SSLv23_server_method have been replaced with TLS_method and TLS_server_method respectively. The old SSLv23* names still exist as macros pointing at the new name, although they are deprecated. Subsequent commits will look at client side version negotiation, as well of removal of the old s23* code. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-05-13Remove Kerberos support from libsslMatt Caswell1-15/+0
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>
2015-05-12Make COMP_CTX and COMP_METHOD opaqueRich Salz1-3/+2
Since COMP_METHOD is now defined in comp_lcl.h, it is no longer possible to create new TLS compression methods without using the OpenSSL source. Only ZLIB is supported by default. Also, since the types are opaque, #ifdef guards to use "char *" instead of the real type aren't necessary. The changes are actually minor. Adding missing copyright to some files makes the diff misleadingly big. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-05-06Use "==0" instead of "!strcmp" etcRich Salz1-1/+1
For the various string-compare routines (strcmp, strcasecmp, str.*cmp) use "strcmp()==0" instead of "!strcmp()" Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-05-04Remove the fake RLE compression method.Rich Salz1-10/+3
RLE is a no-op only for testing. Remove it. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-05-01free null cleanup finaleRich Salz1-9/+4
Don't check for NULL before calling OPENSSL_free Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-30free NULL cleanup 7Rich Salz1-4/+2
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>
2015-04-21ssltest output cleanupRich Salz1-45/+36
Make only errors go to stderr. Print count and size before the loop, so you can see it's an 838K message that will take a few moments. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-16Code style: space after 'if'Viktor Dukhovni1-15/+15
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-11free NULL cleanup 9Rich Salz1-1/+0
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>
2015-04-11free NULL cleanup 10Rich Salz1-9/+5
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>
2015-04-02Fewer newlines in comp method outputRich Salz1-3/+5
Print "supported compression methods" all on one line. Reviewed-by: Andy Polyakov <appro@openssl.org>
2015-03-31Stop symlinking, move files to intended directoryRichard Levitte1-0/+3207
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>