From 4b09e19216d5e889b85593dbf45b78a874426d8a Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Mon, 31 Aug 2020 17:02:01 -0700 Subject: Fix the socket BIO control methods to use ktls_crypto_info_t. This is mostly a cosmetic cleanup I missed when adding the ktls_crypto_info_t type. However, while fixing this I noticed that the changes to extract the size from crypto_info from the wrapper structure for Linux KTLS had not been propagated from bss_sock.c to bss_conn.c, so I've fixed that to use the correct length. Reviewed-by: Matt Caswell Reviewed-by: Ben Kaduk (Merged from https://github.com/openssl/openssl/pull/12782) --- crypto/bio/bss_conn.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'crypto/bio/bss_conn.c') diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c index 6cff2a99ac..79e31f80bf 100644 --- a/crypto/bio/bss_conn.c +++ b/crypto/bio/bss_conn.c @@ -377,11 +377,8 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) long ret = 1; BIO_CONNECT *data; # ifndef OPENSSL_NO_KTLS -# ifdef __FreeBSD__ - struct tls_enable *crypto_info; -# else - struct tls12_crypto_info_aes_gcm_128 *crypto_info; -# endif + size_t crypto_info_len; + ktls_crypto_info_t *crypto_info; # endif data = (BIO_CONNECT *)b->ptr; @@ -544,12 +541,13 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) break; # ifndef OPENSSL_NO_KTLS case BIO_CTRL_SET_KTLS: + crypto_info = (ktls_crypto_info_t *)ptr; # ifdef __FreeBSD__ - crypto_info = (struct tls_enable *)ptr; + crypto_info_len = sizeof(*crypto_info); # else - crypto_info = (struct tls12_crypto_info_aes_gcm_128 *)ptr; + crypto_info_len = crypto_info->tls_crypto_info_len; # endif - ret = ktls_start(b->num, crypto_info, sizeof(*crypto_info), num); + ret = ktls_start(b->num, crypto_info, crypto_info_len, num); if (ret) BIO_set_ktls_flag(b, num); break; -- cgit v1.2.3