gnutls_anon_server_credentials dh_cred;
gnutls_certificate_credentials cert_cred;
-const int ssl_session_cache = 40;
+const int ssl_session_cache = 128;
static void wrap_db_init(void);
static void wrap_db_deinit(void);
}
#endif
-int test_session_resume2( gnutls_session session) {
+int test_session_resume2( gnutls_session session)
+{
int ret;
char tmp_session_id[32];
int tmp_session_id_size;
ADD_ALL_PROTOCOLS(session);
ADD_ALL_MACS(session);
ADD_ALL_KX(session);
+
+ gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
gnutls_credentials_set(session, GNUTLS_CRD_ANON, anon_cred);
gnutls_session_set_data(session, session_data, session_data_size);
ret = do_handshake( session);
if (ret == FAILED) return ret;
-
+
/* check if we actually resumed the previous session */
session_id_size = sizeof(session_id);
gnutls_session_get_id(session, session_id, &session_id_size);
+ if (gnutls_session_is_resumed( session)) return SUCCEED;
+
if (memcmp(tmp_session_id, session_id, tmp_session_id_size) == 0)
return SUCCEED;
else
{
printf("GNU TLS debug client\nUsage: gnutls-cli-debug [options] hostname\n\n\n");
__gaa_helpsingle('p', "port", "integer ", "The port to connect to.");
+ __gaa_helpsingle('d', "debug", "integer ", "Enable debugging");
__gaa_helpsingle('v', "verbose", "", "More verbose output");
__gaa_helpsingle('h', "help", "", "prints this help");
struct _gaainfo
{
-#line 12 "tls_test.gaa"
+#line 15 "tls_test.gaa"
char *rest_args;
-#line 6 "tls_test.gaa"
+#line 9 "tls_test.gaa"
int more_info;
+#line 6 "tls_test.gaa"
+ int debug;
#line 3 "tls_test.gaa"
int pp;
#define GAA_MULTIPLE_OPTION 3
#define GAA_REST 0
-#define GAA_NB_OPTION 3
+#define GAA_NB_OPTION 4
#define GAAOPTID_help 1
#define GAAOPTID_verbose 2
-#define GAAOPTID_port 3
+#define GAAOPTID_debug 3
+#define GAAOPTID_port 4
#line 168 "gaa.skel"
}
/* option structures */
+struct GAAOPTION_debug
+{
+ int arg1;
+ int size1;
+};
+
struct GAAOPTION_port
{
int arg1;
switch(status)
{
case GAA_LETTER_OPTION:
+ GAA_CHECK1STR("d", GAAOPTID_debug);
GAA_CHECK1STR("p", GAAOPTID_port);
case GAA_MULTIPLE_OPTION:
#line 375 "gaa.skel"
case GAA_WORD_OPTION:
GAA_CHECKSTR("help", GAAOPTID_help);
GAA_CHECKSTR("verbose", GAAOPTID_verbose);
+ GAA_CHECKSTR("debug", GAAOPTID_debug);
GAA_CHECKSTR("port", GAAOPTID_port);
#line 281 "gaa.skel"
{
int OK = 0;
int gaa_last_non_option;
+ struct GAAOPTION_debug GAATMP_debug;
struct GAAOPTION_port GAATMP_port;
#line 393 "gaa.skel"
{
case GAAOPTID_help:
OK = 0;
-#line 9 "tls_test.gaa"
+#line 12 "tls_test.gaa"
{ gaa_help(); exit(0); ;};
return GAA_OK;
break;
case GAAOPTID_verbose:
OK = 0;
-#line 7 "tls_test.gaa"
+#line 10 "tls_test.gaa"
{ gaaval->more_info = 1 ;};
+ return GAA_OK;
+ break;
+ case GAAOPTID_debug:
+ OK = 0;
+ GAA_TESTMOREARGS;
+ GAA_FILL(GAATMP_debug.arg1, gaa_getint, GAATMP_debug.size1);
+ gaa_index++;
+#line 7 "tls_test.gaa"
+{ gaaval->debug = GAATMP_debug.arg1 ;};
+
return GAA_OK;
break;
case GAAOPTID_port:
GAA_TESTMOREARGS;
GAA_FILL(GAAREST_tmp.arg1, gaa_getstr, GAAREST_tmp.size1);
gaa_index++;
-#line 13 "tls_test.gaa"
+#line 16 "tls_test.gaa"
{ gaaval->rest_args = GAAREST_tmp.arg1; ;};
return GAA_OK;
if(inited == 0)
{
-#line 15 "tls_test.gaa"
+#line 18 "tls_test.gaa"
{ gaaval->rest_args=NULL; gaaval->pp = 443; gaaval->more_info = 0; ;};
}
struct _gaainfo
{
-#line 12 "tls_test.gaa"
+#line 15 "tls_test.gaa"
char *rest_args;
-#line 6 "tls_test.gaa"
+#line 9 "tls_test.gaa"
int more_info;
+#line 6 "tls_test.gaa"
+ int debug;
#line 3 "tls_test.gaa"
int pp;
int port;
int record_max_size;
int fingerprint;
+static int debug;
gnutls_srp_client_credentials srp_cred;
gnutls_anon_client_credentials anon_cred;
int tls1_ok = 0;
int ssl3_ok = 0;
+static void tls_log_func( int level, const char* str)
+{
+ fprintf(stderr, "|<%d>| %s", level, str);
+}
+
typedef int (*TEST_FUNC)( gnutls_session);
typedef struct {
{ "for certificate information", test_certificate, "", "", "" },
{ "for trusted CAs", test_server_cas, "", "", "" },
{ "whether the server understands TLS closure alerts", test_bye, "yes", "no", "partially"},
+ /* the fact that is after the closure alert test matter.
+ */
{ "whether the server supports session resumption", test_session_resume2, "yes", "no", "dunno"},
{ "for export-grade ciphersuite support", test_export, "yes", "no", "dunno" },
#ifdef ENABLE_ANON
exit(1);
}
+ gnutls_global_set_log_function( tls_log_func);
+ gnutls_global_set_log_level(debug);
+
if (gnutls_global_init_extra() < 0) {
fprintf(stderr, "global state initialization error\n");
exit(1);
if (info.rest_args==NULL) hostname="localhost";
else hostname = info.rest_args;
+ debug = info.debug;
+
more_info = info.more_info;
}
#int pp;
option (p, port) INT "integer" { $pp = $1 } "The port to connect to."
+#int debug;
+option (d, debug) INT "integer" { $debug = $1 } "Enable debugging"
+
#int more_info;
option (v, verbose) { $more_info = 1 } "More verbose output"