[Help-gnutls] handshake

Martin Knappe martin.knappe at gmail.com
Mon Nov 3 17:39:26 CET 2008


hi

im having a problem with making a handshake between client and server
the problem is that my client seems to "think" it is really a server,
because instead of sending a client hello. it does a receive when initiating
the handshake (i checked with strace)
could someone have a look at this snippet and tell me why this client might
think it is a server:

    if (gnutls_init(&session, GNUTLS_CLIENT) != 0) {
        return E_GNUTLS_INIT;
    }
    if (gnutls_set_default_priority(session) != 0) {
        return E_GNUTLS_SET_DEFAULT_PRIORITY;
    }
    if (gnutls_kx_set_priority(session, (const int[]) {GNUTLS_KX_DHE_PSK,
0})) {
        return E_GNUTLS_KX_SET_PRIORITY;
    }
    if (gnutls_credentials_set (session, GNUTLS_CRD_PSK, psk_cred) != 0) {
        return E_GNUTLS_CREDENTIALS_SET;
    }
    gnutls_transport_set_ptr(session, (gnutls_transport_ptr_t) sockfd);
    printf("BEFORE
HANDSHAKE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
    if (gnutls_handshake(session) < 0) {
        return E_HANDSHAKE;
    }
    printf("AFTER
HANDSHAKE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
    return E_SUCCESS;

when i execute this, I get the message "BEFORE
HANDSHAKE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", and then my
client blocks!

many thanks

martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20081103/02689a4b/attachment.htm>


More information about the Gnutls-help mailing list