diff options
author | Boris Pismenny <borisp@mellanox.com> | 2018-03-11 16:17:51 +0200 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2019-04-01 11:54:48 +0100 |
commit | e401ef801e410d4d0d6dba62cc599cde786024b5 (patch) | |
tree | ac2111740059771a0ca2e2e54b049f6abc1eaffd /crypto/bio | |
parent | f851a689328508cf1c5e64c0cde249956b72789f (diff) |
bio: Linux TLS Rx Offload
Add support for Linux TLS Rx offload in the BIO layer.
Change-Id: I79924b25dd290a873d69f6c8d429e1f5bb2c3365
Signed-off-by: Boris Pismenny <borisp@mellanox.com>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7848)
Diffstat (limited to 'crypto/bio')
-rw-r--r-- | crypto/bio/bss_sock.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/crypto/bio/bss_sock.c b/crypto/bio/bss_sock.c index 60e5adc04a..0c9945939c 100644 --- a/crypto/bio/bss_sock.c +++ b/crypto/bio/bss_sock.c @@ -108,7 +108,12 @@ static int sock_read(BIO *b, char *out, int outl) if (out != NULL) { clear_socket_error(); - ret = readsocket(b->num, out, outl); +# ifndef OPENSSL_NO_KTLS + if (BIO_get_ktls_recv(b)) + ret = ktls_read_record(b->num, out, outl); + else +# endif + ret = readsocket(b->num, out, outl); BIO_clear_retry_flags(b); if (ret <= 0) { if (BIO_sock_should_retry(ret)) @@ -177,20 +182,22 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr) ret = 1; break; # ifndef OPENSSL_NO_KTLS - case BIO_CTRL_SET_KTLS_SEND: + case BIO_CTRL_SET_KTLS: crypto_info = (struct tls12_crypto_info_aes_gcm_128 *)ptr; ret = ktls_start(b->num, crypto_info, sizeof(*crypto_info), num); if (ret) - BIO_set_ktls_flag(b); + BIO_set_ktls_flag(b, num); break; case BIO_CTRL_GET_KTLS_SEND: - return BIO_should_ktls_flag(b); - case BIO_CTRL_SET_KTLS_SEND_CTRL_MSG: + return BIO_should_ktls_flag(b, 1); + case BIO_CTRL_GET_KTLS_RECV: + return BIO_should_ktls_flag(b, 0); + case BIO_CTRL_SET_KTLS_TX_SEND_CTRL_MSG: BIO_set_ktls_ctrl_msg_flag(b); b->ptr = (void *)num; ret = 0; break; - case BIO_CTRL_CLEAR_KTLS_CTRL_MSG: + case BIO_CTRL_CLEAR_KTLS_TX_CTRL_MSG: BIO_clear_ktls_ctrl_msg_flag(b); ret = 0; break; |