* [PATCH 1/3] tls: retrun the correct IV in getsockopt
@ 2018-02-14 8:46 Boris Pismenny
2018-02-14 8:46 ` [PATCH 2/3] tls: reset the crypto info if copy_from_user fails Boris Pismenny
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Boris Pismenny @ 2018-02-14 8:46 UTC (permalink / raw)
To: netdev, davem; +Cc: borisp, ilyal, aviadye
Current code returns four bytes of salt followed by four bytes of IV.
This patch returns all eight bytes of IV.
fixes: 3c4d7559159b ("tls: kernel TLS support")
Signed-off-by: Boris Pismenny <borisp@mellanox.com>
---
net/tls/tls_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
index b0d5fce..a6c3702 100644
--- a/net/tls/tls_main.c
+++ b/net/tls/tls_main.c
@@ -308,7 +308,8 @@ static int do_tls_getsockopt_tx(struct sock *sk, char __user *optval,
goto out;
}
lock_sock(sk);
- memcpy(crypto_info_aes_gcm_128->iv, ctx->iv,
+ memcpy(crypto_info_aes_gcm_128->iv,
+ ctx->iv + TLS_CIPHER_AES_GCM_128_SALT_SIZE,
TLS_CIPHER_AES_GCM_128_IV_SIZE);
release_sock(sk);
if (copy_to_user(optval,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] tls: reset the crypto info if copy_from_user fails
2018-02-14 8:46 [PATCH 1/3] tls: retrun the correct IV in getsockopt Boris Pismenny
@ 2018-02-14 8:46 ` Boris Pismenny
2018-02-14 20:07 ` David Miller
2018-02-14 8:46 ` [PATCH 3/3] tls: getsockopt return record sequence number Boris Pismenny
2018-02-14 20:07 ` [PATCH 1/3] tls: retrun the correct IV in getsockopt David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Boris Pismenny @ 2018-02-14 8:46 UTC (permalink / raw)
To: netdev, davem; +Cc: borisp, ilyal, aviadye
copy_from_user could copy some partial information, as a result
TLS_CRYPTO_INFO_READY(crypto_info) could be true while crypto_info is
using uninitialzed data.
This patch resets crypto_info when copy_from_user fails.
fixes: 3c4d7559159b ("tls: kernel TLS support")
Signed-off-by: Boris Pismenny <borisp@mellanox.com>
---
net/tls/tls_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
index a6c3702..c105f86 100644
--- a/net/tls/tls_main.c
+++ b/net/tls/tls_main.c
@@ -376,7 +376,7 @@ static int do_tls_setsockopt_tx(struct sock *sk, char __user *optval,
rc = copy_from_user(crypto_info, optval, sizeof(*crypto_info));
if (rc) {
rc = -EFAULT;
- goto out;
+ goto err_crypto_info;
}
/* check version */
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] tls: getsockopt return record sequence number
2018-02-14 8:46 [PATCH 1/3] tls: retrun the correct IV in getsockopt Boris Pismenny
2018-02-14 8:46 ` [PATCH 2/3] tls: reset the crypto info if copy_from_user fails Boris Pismenny
@ 2018-02-14 8:46 ` Boris Pismenny
2018-02-14 20:07 ` David Miller
2018-02-14 20:07 ` [PATCH 1/3] tls: retrun the correct IV in getsockopt David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Boris Pismenny @ 2018-02-14 8:46 UTC (permalink / raw)
To: netdev, davem; +Cc: borisp, ilyal, aviadye
Return the TLS record sequence number in getsockopt.
Signed-off-by: Boris Pismenny <borisp@mellanox.com>
---
net/tls/tls_main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
index c105f86..e9b4b53 100644
--- a/net/tls/tls_main.c
+++ b/net/tls/tls_main.c
@@ -311,6 +311,8 @@ static int do_tls_getsockopt_tx(struct sock *sk, char __user *optval,
memcpy(crypto_info_aes_gcm_128->iv,
ctx->iv + TLS_CIPHER_AES_GCM_128_SALT_SIZE,
TLS_CIPHER_AES_GCM_128_IV_SIZE);
+ memcpy(crypto_info_aes_gcm_128->rec_seq, ctx->rec_seq,
+ TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE);
release_sock(sk);
if (copy_to_user(optval,
crypto_info_aes_gcm_128,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] tls: retrun the correct IV in getsockopt
2018-02-14 8:46 [PATCH 1/3] tls: retrun the correct IV in getsockopt Boris Pismenny
2018-02-14 8:46 ` [PATCH 2/3] tls: reset the crypto info if copy_from_user fails Boris Pismenny
2018-02-14 8:46 ` [PATCH 3/3] tls: getsockopt return record sequence number Boris Pismenny
@ 2018-02-14 20:07 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2018-02-14 20:07 UTC (permalink / raw)
To: borisp; +Cc: netdev, ilyal, aviadye
From: Boris Pismenny <borisp@mellanox.com>
Date: Wed, 14 Feb 2018 10:46:06 +0200
> Current code returns four bytes of salt followed by four bytes of IV.
> This patch returns all eight bytes of IV.
>
> fixes: 3c4d7559159b ("tls: kernel TLS support")
> Signed-off-by: Boris Pismenny <borisp@mellanox.com>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] tls: reset the crypto info if copy_from_user fails
2018-02-14 8:46 ` [PATCH 2/3] tls: reset the crypto info if copy_from_user fails Boris Pismenny
@ 2018-02-14 20:07 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2018-02-14 20:07 UTC (permalink / raw)
To: borisp; +Cc: netdev, ilyal, aviadye
From: Boris Pismenny <borisp@mellanox.com>
Date: Wed, 14 Feb 2018 10:46:07 +0200
> copy_from_user could copy some partial information, as a result
> TLS_CRYPTO_INFO_READY(crypto_info) could be true while crypto_info is
> using uninitialzed data.
>
> This patch resets crypto_info when copy_from_user fails.
>
> fixes: 3c4d7559159b ("tls: kernel TLS support")
> Signed-off-by: Boris Pismenny <borisp@mellanox.com>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] tls: getsockopt return record sequence number
2018-02-14 8:46 ` [PATCH 3/3] tls: getsockopt return record sequence number Boris Pismenny
@ 2018-02-14 20:07 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2018-02-14 20:07 UTC (permalink / raw)
To: borisp; +Cc: netdev, ilyal, aviadye
From: Boris Pismenny <borisp@mellanox.com>
Date: Wed, 14 Feb 2018 10:46:08 +0200
> Return the TLS record sequence number in getsockopt.
>
> Signed-off-by: Boris Pismenny <borisp@mellanox.com>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-02-14 20:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-14 8:46 [PATCH 1/3] tls: retrun the correct IV in getsockopt Boris Pismenny
2018-02-14 8:46 ` [PATCH 2/3] tls: reset the crypto info if copy_from_user fails Boris Pismenny
2018-02-14 20:07 ` David Miller
2018-02-14 8:46 ` [PATCH 3/3] tls: getsockopt return record sequence number Boris Pismenny
2018-02-14 20:07 ` David Miller
2018-02-14 20:07 ` [PATCH 1/3] tls: retrun the correct IV in getsockopt David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).