Hello everyone,
I am in the process of implementing a GnuTLS backend to PJSIP, a popular voip/sip library, and I started off by editing the OpenSSL backend.

Normally the library uses a complex callback mechanism that informs the underlying secure socket layer that data has been read from the (normal) socket and then it waits for the callback return value containing the decrypted data. With openssl this is implemented by heavy use of BIO_read/BIO_write functions, however it is where I am stuck during my porting.

As far as I understand the gnutls logic, everything must go through gnutls_record_send and gnutls_record_recv, but there is no way to use the session information to decrypt a raw memory buffer isn't there? I have tried to hack things around saving the externally-received buffer and hijacking the _recv function so that it would decrypt that buffer only, instead of waiting to receive on the socket, but I must be doing something wrong as I always get a 'tls packet with wrong length'.

If anyone could give some advice I'd really appreciate that; the currently WIP code is here if anyone want to look https://github.com/kodabb/pjproject/blob/gnutls/pjlib/src/pj/ssl_sock_ossl.c
Thanks for any suggestions,
Vittorio

_______________________________________________
Gnutls-help mailing list
[email protected]
http://lists.gnupg.org/mailman/listinfo/gnutls-help

Reply via email to