Discussion:
Fetch socket error/SSL error in error_cb ?
(too old to reply)
Jeffrey Walton
2014-03-03 05:02:51 UTC
Permalink
Raw Message
I'm working on a libevent-based server. The server is working great
with RSA-based certs. But something is blowing up with ECDSA-based
certs. OpenSSL's s_client is dying with:


My accept_cb performs the following:

bufferevent* bin = NULL;
bin = bufferevent_openssl_socket_new(base, fd, ssl,
BUFFEREVENT_SSL_ACCEPTING,
BEV_OPT_CLOSE_ON_FREE | BEV_OPT_DEFER_CALLBACKS);

bufferevent_setcb(bin, proxy_server_read_cb, NULL, error_cb, NULL);
bufferevent_enable(bin, EV_READ);

When things blow up on accept(), I land here:

void error_cb(struct bufferevent *bev, short what, void *arg)
{
LogDebug("error_cb (bufferevent)");

if (what & (BEV_EVENT_EOF | BEV_EVENT_ERROR))
{
...
bufferevent_free(bev);
}
}

befferevent.h mentions SSL a few times, but there does not appear to
be a function retrieve the SSL object (unless I'm mis-reading the
header).

How do I access the SSL object associated with the bufferevent bev?

Thanks in advance.
***********************************************************************
To unsubscribe, send an e-mail to ***@freehaven.net with
unsubscribe libevent-users in the body.
Nick Mathewson
2014-03-03 18:42:47 UTC
Permalink
Raw Message
Post by Jeffrey Walton
How do I access the SSL object associated with the bufferevent bev?
Here's the function you want:

/** Return the underlying openssl SSL * object for an SSL bufferevent. */
struct ssl_st *
bufferevent_openssl_get_ssl(struct bufferevent *bufev);


(It returns "struct ssl_st *" instead of "SSL *" so that it isn't
forced to pull in all the openssl headers, but don't worry: those are
actually the same type.)

best wishes,
--
Nick
***********************************************************************
To unsubscribe, send an e-mail to ***@freehaven.net with
unsubscribe libevent-users in the body.
Jeffrey Walton
2014-03-03 20:18:21 UTC
Permalink
Raw Message
Post by Nick Mathewson
Post by Jeffrey Walton
How do I access the SSL object associated with the bufferevent bev?
/** Return the underlying openssl SSL * object for an SSL bufferevent. */
struct ssl_st *
bufferevent_openssl_get_ssl(struct bufferevent *bufev);
(It returns "struct ssl_st *" instead of "SSL *" so that it isn't
forced to pull in all the openssl headers, but don't worry: those are
actually the same type.)
Oh, I was poking around the wrong header. Thanks you very much.

Jeff
***********************************************************************
To unsubscribe, send an e-mail to ***@freehaven.net with
unsubscribe libevent-users in the body.

Loading...