help-gnutls
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Help-gnutls] Re: handshake


From: kristian . martens
Subject: RE: [Help-gnutls] Re: handshake
Date: Tue, 04 Nov 2008 10:17:45 +0100
User-agent: freenetMail

Maybe you were missing (see gnutls manual)

....
int sd;

/* connect to the peer
*/
sd = tcp_connect ();
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd);
....



-----Ursprüngliche Nachricht-----
Von: "Martin Knappe" [address@hidden]
Gesendet: Di. 04.11.08 (09:19)
An: address@hidden
Betreff: [Help-gnutls] Re: handshake

I'll also post the output of strace; I really don't understand what's going on here...

write(1, "BEFORE HANDSHAKEn", 14BEFORE HANDSHAKE
)         = 14
gettimeofday({1225793748, 165856}, NULL) = 0
getrusage(RUSAGE_SELF, {ru_utime={0, 664041}, ru_stime={0, 0}, ...}) = 0
time(NULL)                              = 1225793748
times({tms_utime=66, tms_stime=0, tms_cutime=0, tms_cstime=0}) = 1845603364
gettimeofday({1225793748, 167291}, NULL) = 0
getrusage(RUSAGE_SELF, {ru_utime={0, 664041}, ru_stime={0, 0}, ...}) = 0
time(NULL)                              = 1225793748
times({tms_utime=66, tms_stime=0, tms_cutime=0, tms_cstime=0}) = 1845603364
recv(5,

here the client blocks, when it has to do a send instead of a receive!


On Mon, Nov 3, 2008 at 5:39 PM, Martin Knappe <address@hidden> wrote:
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



-----Ursprüngliche Nachricht Ende-----
--

reply via email to

[Prev in Thread] Current Thread [Next in Thread]