diff options
author | John Baldwin <jhb@FreeBSD.org> | 2020-08-31 17:13:17 -0700 |
---|---|---|
committer | Benjamin Kaduk <bkaduk@akamai.com> | 2020-09-05 20:11:50 -0700 |
commit | 7f0f88240e181b6c95d55893cbab55e0765a1d89 (patch) | |
tree | 16ea6d07a37a1cd0bd77b7d32a17d5402d13116c /crypto/bio | |
parent | 74eee1bdaa03cfcb3b1df01beff2b6d81a113f58 (diff) |
Slightly abstract ktls_start() to reduce OS-specific #ifdefs.
Instead of passing the length in from the caller, compute the length
to pass to setsockopt() inside of ktls_start(). This isolates the
OS-specific behavior to ktls.h and removes it from the socket BIO
implementations.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/12782)
Diffstat (limited to 'crypto/bio')
-rw-r--r-- | crypto/bio/bss_conn.c | 8 | ||||
-rw-r--r-- | crypto/bio/bss_sock.c | 8 |
2 files changed, 2 insertions, 14 deletions
diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c index 79e31f80bf..e6972efd8d 100644 --- a/crypto/bio/bss_conn.c +++ b/crypto/bio/bss_conn.c @@ -377,7 +377,6 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) long ret = 1; BIO_CONNECT *data; # ifndef OPENSSL_NO_KTLS - size_t crypto_info_len; ktls_crypto_info_t *crypto_info; # endif @@ -542,12 +541,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) # ifndef OPENSSL_NO_KTLS case BIO_CTRL_SET_KTLS: crypto_info = (ktls_crypto_info_t *)ptr; -# ifdef __FreeBSD__ - crypto_info_len = sizeof(*crypto_info); -# else - crypto_info_len = crypto_info->tls_crypto_info_len; -# endif - ret = ktls_start(b->num, crypto_info, crypto_info_len, num); + ret = ktls_start(b->num, crypto_info, num); if (ret) BIO_set_ktls_flag(b, num); break; diff --git a/crypto/bio/bss_sock.c b/crypto/bio/bss_sock.c index 6c6c610b0e..d3eaa6b19e 100644 --- a/crypto/bio/bss_sock.c +++ b/crypto/bio/bss_sock.c @@ -154,7 +154,6 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr) long ret = 1; int *ip; # ifndef OPENSSL_NO_KTLS - size_t crypto_info_len; ktls_crypto_info_t *crypto_info; # endif @@ -187,12 +186,7 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr) # ifndef OPENSSL_NO_KTLS case BIO_CTRL_SET_KTLS: crypto_info = (ktls_crypto_info_t *)ptr; -# ifdef __FreeBSD__ - crypto_info_len = sizeof(*crypto_info); -# else - crypto_info_len = crypto_info->tls_crypto_info_len; -# endif - ret = ktls_start(b->num, crypto_info, crypto_info_len, num); + ret = ktls_start(b->num, crypto_info, num); if (ret) BIO_set_ktls_flag(b, num); break; |