resume.c   resume.c 
skipping to change at line 124 skipping to change at line 124
global_init(); global_init();
gnutls_anon_allocate_client_credentials(&anoncred); gnutls_anon_allocate_client_credentials(&anoncred);
for (t = 0; t < SESSIONS; t++) { for (t = 0; t < SESSIONS; t++) {
int sd = sds[t]; int sd = sds[t];
/* Initialize TLS session /* Initialize TLS session
*/ */
gnutls_init(&session, gnutls_init(&session,
GNUTLS_CLIENT | GNUTLS_NO_EXTENSIONS); GNUTLS_CLIENT);
/* Use default priorities */ /* Use default priorities */
gnutls_priority_set_direct(session, if (params->enable_session_ticket_client) {
"NONE:+VERS-TLS-ALL:+CIPHER-ALL:+ gnutls_priority_set_direct(session,
MAC-ALL:+SIGN-ALL:+COMP-ALL:+ANON-DH", "NONE:+VERS-TLS-ALL:+CIPH
NULL); ER-ALL:+MAC-ALL:+SIGN-ALL:+COMP-ALL:+ANON-DH",
NULL);
} else {
gnutls_priority_set_direct(session,
"NONE:+VERS-TLS-ALL:+CIPH
ER-ALL:+MAC-ALL:+SIGN-ALL:+COMP-ALL:+ANON-DH:%NO_TICKETS",
NULL);
}
/* put the anonymous credentials to the current session /* put the anonymous credentials to the current session
*/ */
gnutls_credentials_set(session, GNUTLS_CRD_ANON, anoncred); gnutls_credentials_set(session, GNUTLS_CRD_ANON, anoncred);
if (params->enable_session_ticket_client)
gnutls_session_ticket_enable_client(session);
if (t > 0) { if (t > 0) {
/* if this is not the first time we connect */ /* if this is not the first time we connect */
gnutls_session_set_data(session, session_data.data, gnutls_session_set_data(session, session_data.data,
session_data.size); session_data.size);
} }
gnutls_transport_set_int(session, sd); gnutls_transport_set_int(session, sd);
/* Perform the TLS handshake /* Perform the TLS handshake
*/ */
skipping to change at line 164 skipping to change at line 167
fail("client: Handshake failed\n"); fail("client: Handshake failed\n");
gnutls_perror(ret); gnutls_perror(ret);
goto end; goto end;
} else { } else {
if (debug) if (debug)
success success
("client: Handshake was completed\n"); ("client: Handshake was completed\n");
} }
if (t == 0) { /* the first time we connect */ if (t == 0) { /* the first time we connect */
/* check whether using NO_EXTENSIONS had any effect
*/
ret = gnutls_session_ext_master_secret_status(sessio
n);
if (ret != 0) {
fail("Extended master secret should have not
been negotiated by default (ret: %d)\n", ret);
}
/* get the session data size */ /* get the session data size */
ret = ret =
gnutls_session_get_data2(session, gnutls_session_get_data2(session,
&session_data); &session_data);
if (ret < 0) if (ret < 0)
fail("Getting resume data failed\n"); fail("Getting resume data failed\n");
} else { /* the second time we connect */ } else { /* the second time we connect */
/* check if we actually resumed the previous session */ /* check if we actually resumed the previous session */
if (gnutls_session_is_resumed(session) != 0) { if (gnutls_session_is_resumed(session) != 0) {
skipping to change at line 488 skipping to change at line 485
free(cache_db); free(cache_db);
cache_db = NULL; cache_db = NULL;
return; return;
} }
static int static int
wrap_db_store(void *dbf, gnutls_datum_t key, gnutls_datum_t data) wrap_db_store(void *dbf, gnutls_datum_t key, gnutls_datum_t data)
{ {
time_t t, now = time(0); time_t t, now = time(0);
#ifdef DEBUG_CACHE
if (debug) { if (debug) {
unsigned int i; unsigned int i;
fprintf(stderr, "resume db storing (%d-%d): ", key.size, fprintf(stderr, "resume db storing (%d-%d): ", key.size,
data.size); data.size);
for (i = 0; i < key.size; i++) { for (i = 0; i < key.size; i++) {
fprintf(stderr, "%02x", key.data[i] & 0xFF); fprintf(stderr, "%02x", key.data[i] & 0xFF);
} }
fprintf(stderr, "\n"); fprintf(stderr, "\n");
fprintf(stderr, "data: "); fprintf(stderr, "data: ");
for (i = 0; i < data.size; i++) { for (i = 0; i < data.size; i++) {
fprintf(stderr, "%02x", data.data[i] & 0xFF); fprintf(stderr, "%02x", data.data[i] & 0xFF);
} }
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }
#endif
/* check the correctness of gnutls_db_check_entry_time() */ /* check the correctness of gnutls_db_check_entry_time() */
t = gnutls_db_check_entry_time(&data); t = gnutls_db_check_entry_time(&data);
if (t < now - 10 || t > now + 10) { if (t < now - 10 || t > now + 10) {
fail("Time returned by gnutls_db_check_entry_time is bogus\n "); fail("Time returned by gnutls_db_check_entry_time is bogus\n ");
exit(1); exit(1);
} }
if (cache_db == NULL) if (cache_db == NULL)
return -1; return -1;
skipping to change at line 568 skipping to change at line 567
res.size = cache_db[i].session_data_size; res.size = cache_db[i].session_data_size;
res.data = gnutls_malloc(res.size); res.data = gnutls_malloc(res.size);
if (res.data == NULL) if (res.data == NULL)
return res; return res;
memcpy(res.data, cache_db[i].session_data, memcpy(res.data, cache_db[i].session_data,
res.size); res.size);
#ifdef DEBUG_CACHE
if (debug) { if (debug) {
unsigned int j; unsigned int j;
printf("data:\n"); printf("data:\n");
for (j = 0; j < res.size; j++) { for (j = 0; j < res.size; j++) {
printf("%02x ", printf("%02x ",
res.data[j] & 0xFF); res.data[j] & 0xFF);
if ((j + 1) % 16 == 0) if ((j + 1) % 16 == 0)
printf("\n"); printf("\n");
} }
printf("\n"); printf("\n");
} }
#endif
return res; return res;
} }
} }
if (debug) if (debug)
success("resume db fetch... NOT FOUND\n"); success("resume db fetch... NOT FOUND\n");
return res; return res;
} }
static int wrap_db_delete(void *dbf, gnutls_datum_t key) static int wrap_db_delete(void *dbf, gnutls_datum_t key)
 End of changes. 8 change blocks. 
18 lines changed or deleted 16 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/