if (htype != GNUTLS_HANDSHAKE_NEW_SESSION_TICKET)
return 0;
- success("sent session ticket\n");
+ if (debug)
+ success("sent session ticket\n");
sent = 1;
return 0;
}
int ret;
gnutls_certificate_credentials_t x509_cred;
gnutls_session_t session;
- /* Need to enable anonymous KX specifically. */
global_init();
gnutls_certificate_allocate_credentials(&x509_cred);
- /* Initialize TLS session
- */
- gnutls_init(&session, GNUTLS_CLIENT);
+ assert(gnutls_init(&session, GNUTLS_CLIENT)>=0);
- /* Use default priorities */
- gnutls_priority_set_direct(session, "NORMAL:-KX-ALL:+ECDHE-RSA", NULL);
+ assert(gnutls_priority_set_direct(session, prio, NULL)>=0);
- /* put the anonymous credentials to the current session
- */
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, x509_cred);
gnutls_transport_set_int(session, fd);
- /* Perform the TLS handshake
- */
do {
ret = gnutls_handshake(session);
}
while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
- if (ret == GNUTLS_E_UNSUPPORTED_SIGNATURE_ALGORITHM) {
- /* success */
- goto end;
- }
-
if (ret < 0) {
fail("client: Handshake failed: %s\n", gnutls_strerror(ret));
terminate();
gnutls_bye(session, GNUTLS_SHUT_WR);
- end:
-
close(fd);
gnutls_deinit(session);
/* avoid calling all the priority functions, since the defaults
* are adequate.
*/
- assert(gnutls_priority_set_direct(session, "NORMAL", NULL)>=0);
+ assert(gnutls_priority_set_direct(session, prio, NULL)>=0);
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, x509_cred);