diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2003-02-12 13:30:19 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2003-02-12 13:30:19 +0000 |
commit | aae2a10ed0585d377b1d0ceea26b52592e2785d8 (patch) | |
tree | 6d8d069f4ec6c5373c2a2a5005a5959f539df278 | |
parent | f60f14c1c2032d1aaf9308d4403922f8e9ebbbd6 (diff) | |
download | gnutls-aae2a10ed0585d377b1d0ceea26b52592e2785d8.tar.gz |
Added test which prints the Diffie Hellman prime bits used.
-rw-r--r-- | lib/Makefile.am | 2 | ||||
-rw-r--r-- | src/tests.c | 55 | ||||
-rw-r--r-- | src/tests.h | 1 | ||||
-rw-r--r-- | src/tls_test.c | 2 |
4 files changed, 41 insertions, 19 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index 6c359f9808..f5a1551640 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -48,7 +48,7 @@ libgnutls_la_SOURCES = $(COBJECTS) libgnutls_la_LIBADD = $(MINITASN1_OBJECTS) x509/dn.lo x509/crl.lo x509/common.lo \ x509/x509.lo x509/pkcs7.lo x509/extensions.lo x509/compat.lo x509/verify.lo \ - x509/mpi.lo + x509/mpi.lo x509/privkey.lo libgnutls_la_LDFLAGS = $(LIBASN1_LINK) $(LIBGCRYPT_LIBS) \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) #-export-symbols gnutls.sym diff --git a/src/tests.c b/src/tests.c index 13681be92d..ac972f0c57 100644 --- a/src/tests.c +++ b/src/tests.c @@ -33,6 +33,7 @@ extern gnutls_certificate_credentials xcred; extern int more_info; static int srp = 0; +static int dh_bits; extern int tls1_ok; extern int ssl3_ok; @@ -183,29 +184,43 @@ int ret; } int test_export( gnutls_session session) { - ADD_ALL_COMP(session); - ADD_ALL_CERTTYPES(session); - ADD_ALL_PROTOCOLS(session); - ADD_ALL_MACS(session); + ADD_ALL_COMP(session); + ADD_ALL_CERTTYPES(session); + ADD_ALL_PROTOCOLS(session); + ADD_ALL_MACS(session); - ADD_KX(session, GNUTLS_KX_RSA_EXPORT); - ADD_CIPHER(session, GNUTLS_CIPHER_ARCFOUR_40); - gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); + ADD_KX(session, GNUTLS_KX_RSA_EXPORT); + ADD_CIPHER(session, GNUTLS_CIPHER_ARCFOUR_40); + gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); - return do_handshake( session); + return do_handshake( session); } int test_dhe( gnutls_session session) { - ADD_ALL_CIPHERS(session); - ADD_ALL_COMP(session); - ADD_ALL_CERTTYPES(session); - ADD_ALL_PROTOCOLS(session); - ADD_ALL_MACS(session); +int ret; - ADD_KX2(session, GNUTLS_KX_DHE_RSA, GNUTLS_KX_DHE_DSS); - gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); + ADD_ALL_CIPHERS(session); + ADD_ALL_COMP(session); + ADD_ALL_CERTTYPES(session); + ADD_ALL_PROTOCOLS(session); + ADD_ALL_MACS(session); + + ADD_KX2(session, GNUTLS_KX_DHE_RSA, GNUTLS_KX_DHE_DSS); + gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); - return do_handshake( session); + ret = do_handshake( session); + dh_bits = gnutls_dh_get_prime_bits( session); + + return ret; +} + +int test_dhe_bits( gnutls_session session) { +int ret; + + if (dh_bits == 0) return FAILED; + + printf( " %d", dh_bits); + return SUCCEED; } int test_ssl3( gnutls_session session) { @@ -498,6 +513,8 @@ int ret; int test_anonymous( gnutls_session session) { +int ret; + ADD_ALL_CIPHERS(session); ADD_ALL_COMP(session); ADD_ALL_CERTTYPES(session); @@ -506,8 +523,10 @@ int test_anonymous( gnutls_session session) { ADD_KX(session, GNUTLS_KX_ANON_DH); gnutls_credentials_set(session, GNUTLS_CRD_ANON, anon_cred); - return do_handshake( session); - + ret = do_handshake( session); + dh_bits = gnutls_dh_get_prime_bits( session); + + return ret; } diff --git a/src/tests.h b/src/tests.h index d2081cb8e3..0f7083a036 100644 --- a/src/tests.h +++ b/src/tests.h @@ -8,6 +8,7 @@ int test_srp( gnutls_session state); int test_export( gnutls_session state); int test_hello_extension( gnutls_session state); int test_dhe( gnutls_session state); +int test_dhe_bits( gnutls_session state); int test_ssl3( gnutls_session state); int test_aes( gnutls_session state); int test_md5( gnutls_session state); diff --git a/src/tls_test.c b/src/tls_test.c index 58304bac4a..2adf86d3c4 100644 --- a/src/tls_test.c +++ b/src/tls_test.c @@ -91,7 +91,9 @@ static const TLS_TEST tls_tests[] = { { "whether the server supports session resumption", test_session_resume2, "yes", "no", "dunno"}, { "for export-grade ciphersuite support", test_export, "yes", "no", "dunno" }, { "for anonymous authentication support", test_anonymous, "yes", "no", "dunno"}, + { "for anonymous Diffie Hellman prime size", test_dhe_bits, "", "N/A", "N/A" }, { "for ephemeral Diffie Hellman support", test_dhe, "yes", "no", "dunno" }, + { "for ephemeral Diffie Hellman prime size", test_dhe_bits, "", "N/A", "N/A" }, { "for AES cipher support", test_aes, "yes", "no", "dunno"}, { "for 3DES cipher support", test_3des, "yes", "no", "dunno"}, { "for ARCFOUR cipher support", test_arcfour, "yes", "no", "dunno"}, |