]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
added openpgp authentication test, and unknown cipher suites test
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 27 Feb 2002 20:53:05 +0000 (20:53 +0000)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 27 Feb 2002 20:53:05 +0000 (20:53 +0000)
src/tests.c
src/tests.h
src/tls_test.c

index 7f77fb70a3cbfcadd0f8b7e3410cba7d4d3345ea..d7a8671451a1ab572499893155aa86847f3db8b6 100644 (file)
@@ -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);
index 938fb6d8e1f03f54b671b315ada0ac8f503a8d45..04985478bfd17e7cf9c451d1bd4bb7ddea384158 100644 (file)
@@ -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))
 
index 58fd834c87d17e35b90d81c43fcc80a3f38ee4b6..d950d51da7060817196c131a82daa29910d081fb 100644 (file)
@@ -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 }
 };