mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
tls: don't copy the key out of tls12_crypto_info_aes_gcm_128
[ Upstream commit7cba09c6d5] There's no need to copy the key to an on-stack buffer before calling crypto_aead_setkey(). Fixes:3c4d755915("tls: kernel TLS support") Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ee547ed7de
commit
10cacaf131
@@ -661,7 +661,6 @@ static void tls_sw_free_resources(struct sock *sk)
|
||||
|
||||
int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx)
|
||||
{
|
||||
char keyval[TLS_CIPHER_AES_GCM_128_KEY_SIZE];
|
||||
struct tls_crypto_info *crypto_info;
|
||||
struct tls12_crypto_info_aes_gcm_128 *gcm_128_info;
|
||||
struct tls_sw_context *sw_ctx;
|
||||
@@ -753,9 +752,7 @@ int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx)
|
||||
|
||||
ctx->push_pending_record = tls_sw_push_pending_record;
|
||||
|
||||
memcpy(keyval, gcm_128_info->key, TLS_CIPHER_AES_GCM_128_KEY_SIZE);
|
||||
|
||||
rc = crypto_aead_setkey(sw_ctx->aead_send, keyval,
|
||||
rc = crypto_aead_setkey(sw_ctx->aead_send, gcm_128_info->key,
|
||||
TLS_CIPHER_AES_GCM_128_KEY_SIZE);
|
||||
if (rc)
|
||||
goto free_aead;
|
||||
|
||||
Reference in New Issue
Block a user