aboutsummaryrefslogtreecommitdiffstats
path: root/net/tls/tls_sw.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tls/tls_sw.c')
-rw-r--r--net/tls/tls_sw.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index e28a6ff25d96..9e918489f4fb 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -1055,8 +1055,8 @@ static int tls_read_size(struct strparser *strp, struct sk_buff *skb)
1055 goto read_failure; 1055 goto read_failure;
1056 } 1056 }
1057 1057
1058 if (header[1] != TLS_VERSION_MINOR(tls_ctx->crypto_recv.version) || 1058 if (header[1] != TLS_VERSION_MINOR(tls_ctx->crypto_recv.info.version) ||
1059 header[2] != TLS_VERSION_MAJOR(tls_ctx->crypto_recv.version)) { 1059 header[2] != TLS_VERSION_MAJOR(tls_ctx->crypto_recv.info.version)) {
1060 ret = -EINVAL; 1060 ret = -EINVAL;
1061 goto read_failure; 1061 goto read_failure;
1062 } 1062 }
@@ -1136,7 +1136,6 @@ void tls_sw_free_resources_rx(struct sock *sk)
1136 1136
1137int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx, int tx) 1137int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx, int tx)
1138{ 1138{
1139 char keyval[TLS_CIPHER_AES_GCM_128_KEY_SIZE];
1140 struct tls_crypto_info *crypto_info; 1139 struct tls_crypto_info *crypto_info;
1141 struct tls12_crypto_info_aes_gcm_128 *gcm_128_info; 1140 struct tls12_crypto_info_aes_gcm_128 *gcm_128_info;
1142 struct tls_sw_context_tx *sw_ctx_tx = NULL; 1141 struct tls_sw_context_tx *sw_ctx_tx = NULL;
@@ -1181,12 +1180,12 @@ int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx, int tx)
1181 1180
1182 if (tx) { 1181 if (tx) {
1183 crypto_init_wait(&sw_ctx_tx->async_wait); 1182 crypto_init_wait(&sw_ctx_tx->async_wait);
1184 crypto_info = &ctx->crypto_send; 1183 crypto_info = &ctx->crypto_send.info;
1185 cctx = &ctx->tx; 1184 cctx = &ctx->tx;
1186 aead = &sw_ctx_tx->aead_send; 1185 aead = &sw_ctx_tx->aead_send;
1187 } else { 1186 } else {
1188 crypto_init_wait(&sw_ctx_rx->async_wait); 1187 crypto_init_wait(&sw_ctx_rx->async_wait);
1189 crypto_info = &ctx->crypto_recv; 1188 crypto_info = &ctx->crypto_recv.info;
1190 cctx = &ctx->rx; 1189 cctx = &ctx->rx;
1191 aead = &sw_ctx_rx->aead_recv; 1190 aead = &sw_ctx_rx->aead_recv;
1192 } 1191 }
@@ -1265,9 +1264,7 @@ int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx, int tx)
1265 1264
1266 ctx->push_pending_record = tls_sw_push_pending_record; 1265 ctx->push_pending_record = tls_sw_push_pending_record;
1267 1266
1268 memcpy(keyval, gcm_128_info->key, TLS_CIPHER_AES_GCM_128_KEY_SIZE); 1267 rc = crypto_aead_setkey(*aead, gcm_128_info->key,
1269
1270 rc = crypto_aead_setkey(*aead, keyval,
1271 TLS_CIPHER_AES_GCM_128_KEY_SIZE); 1268 TLS_CIPHER_AES_GCM_128_KEY_SIZE);
1272 if (rc) 1269 if (rc)
1273 goto free_aead; 1270 goto free_aead;