When using a non-encrypted socket I'd use
int num bytes = recvmsg(sock, &msg, 0)
and then get the SO_TIMESTAMP info from the msg (see e.g. Linux recvmsg() not getting a software timestamp from socket and https://linux.die.net/man/2/recvmsg).
However, there doesn't seem to be a corresponding API for an SSL-encrypted socket, at least for OpenSSL. The only one I can see is
int SSL_read(SSL *ssl, void *buf, int num);
which obviously doesn't propagate the timestamp info.
Have people tried this before? I can see a few options,
- fork/extend OpenSSL at the point where it reads from the raw socket and carry the data across
- do a
recvmsg(s, data, flags)
explicitly and somehow pass that into an OpenSSL function for subsequent decoding. - use a different library?
I find surprisingly little info about this online. Thanks!