From: Nikos Mavrogiannopoulos Date: Wed, 27 Feb 2002 20:53:05 +0000 (+0000) Subject: added openpgp authentication test, and unknown cipher suites test X-Git-Tag: gnutls_0_3_91~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=629fc4e7f4b5b269dabdf4025ed6ca82de32f05a;p=thirdparty%2Fgnutls.git added openpgp authentication test, and unknown cipher suites test --- diff --git a/src/tests.c b/src/tests.c index 7f77fb70a3..d7a8671451 100644 --- a/src/tests.c +++ b/src/tests.c @@ -92,6 +92,15 @@ static void ADD_CIPHER(GNUTLS_STATE state, int cipher) { gnutls_cipher_set_priority(state, _cipher_priority); } +static void ADD_CIPHER3(GNUTLS_STATE state, int cipher1, int cipher2, int cipher3) { + static int _cipher_priority[] = { 0, 0, 0, 0 }; + _cipher_priority[0] = cipher1; + _cipher_priority[1] = cipher2; + _cipher_priority[2] = cipher3; + + gnutls_cipher_set_priority(state, _cipher_priority); +} + static void ADD_MAC(GNUTLS_STATE state, int mac) { static int _mac_priority[] = { 0, 0 }; _mac_priority[0] = mac; @@ -99,6 +108,13 @@ static void ADD_MAC(GNUTLS_STATE state, int mac) { gnutls_mac_set_priority(state, _mac_priority); } +static void ADD_CERTTYPE(GNUTLS_STATE state, int ctype) { + static int _ct_priority[] = { 0, 0 }; + _ct_priority[0] = ctype; + + gnutls_cert_type_set_priority(state, _ct_priority); +} + static void ADD_PROTOCOL(GNUTLS_STATE state, int protocol) { static int _proto_priority[] = { 0, 0 }; _proto_priority[0] = protocol; @@ -164,6 +180,35 @@ int ret; return ret; } +int test_openpgp1( GNUTLS_STATE state) { +int ret; + ADD_ALL_CIPHERS(state); + ADD_ALL_COMP(state); + ADD_CERTTYPE(state, GNUTLS_CRT_OPENPGP); + ADD_ALL_PROTOCOLS(state); + ADD_ALL_MACS(state); + ADD_ALL_KX(state); + gnutls_cred_set(state, GNUTLS_CRD_CERTIFICATE, xcred); + + ret = do_handshake( state); + return ret; +} + +int test_unknown_ciphersuites( GNUTLS_STATE state) { +int ret; + ADD_CIPHER3(state, GNUTLS_CIPHER_RIJNDAEL_128_CBC, + GNUTLS_CIPHER_3DES_CBC, GNUTLS_CIPHER_ARCFOUR); + ADD_ALL_COMP(state); + ADD_ALL_CERTTYPES(state); + ADD_ALL_PROTOCOLS(state); + ADD_ALL_MACS(state); + ADD_ALL_KX(state); + gnutls_cred_set(state, GNUTLS_CRD_CERTIFICATE, xcred); + + ret = do_handshake( state); + return ret; +} + int test_md5( GNUTLS_STATE state) { int ret; ADD_ALL_CIPHERS(state); @@ -264,7 +309,7 @@ int ret; /* here we enable both SSL 3.0 and TLS 1.0 * and try to connect and use rsa authentication. - * If the server is an old buggy than only supports + * If the server is old, buggy and only supports * SSL 3.0 then the handshake will fail. */ ADD_ALL_CIPHERS(state); diff --git a/src/tests.h b/src/tests.h index 938fb6d8e1..04985478bf 100644 --- a/src/tests.h +++ b/src/tests.h @@ -19,6 +19,8 @@ int test_rsa_pms( GNUTLS_STATE state); int test_max_record_size( GNUTLS_STATE state); int test_version_rollback( GNUTLS_STATE state); int test_anonymous( GNUTLS_STATE state); +int test_unknown_ciphersuites( GNUTLS_STATE state); +int test_openpgp1( GNUTLS_STATE state); #define GERR(ret) fprintf(stderr, "*** Error: %s\n", gnutls_strerror(ret)) diff --git a/src/tls_test.c b/src/tls_test.c index 58fd834c87..d950d51da7 100644 --- a/src/tls_test.c +++ b/src/tls_test.c @@ -84,6 +84,7 @@ static const TLS_TEST tls_tests[] = { * buggy */ { "whether we need disable TLS 1.0", test_tls1_2, "no", "yes", "dunno" }, { "whether the server can accept Hello Extensions", test_hello_extension, "yes", "no", "dunno"}, + { "whether the server can accept cipher suites not in SSL 3.0 spec", test_unknown_ciphersuites, "yes", "no", "dunno"}, { "for anonymous authentication support", test_anonymous, "yes", "no", "dunno"}, { "for ephemeral Diffie Hellman support", test_dhe, "yes", "no", "dunno" }, { "for AES cipher support", test_aes, "yes", "no", "dunno"}, @@ -93,6 +94,7 @@ static const TLS_TEST tls_tests[] = { { "for SHA1 MAC support", test_sha, "yes", "no", "dunno"}, { "for max record size TLS extension", test_max_record_size, "yes", "no", "dunno" }, { "for SRP authentication support (gnutls extension)", test_srp, "yes", "no", "dunno" }, + { "for OpenPGP authentication support (gnutls extension)", test_openpgp1, "yes", "no", "dunno" }, { NULL } };