aboutsummaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorIlya Lesokhin2017-11-13 10:22:47 +0200
committerDavid S. Miller2017-11-14 16:26:34 +0900
commit213ef6e7c9c063c482d77f12cc438872628d48ec (patch)
treefeccd86cabb68644e4cdbf011c46ff0def88f9a7 /include/net
parentff45d820a2df163957ad8ab459b6eb6976144c18 (diff)
tls: Move tls_make_aad to header to allow sharing
move tls_make_aad as it is going to be reused by the device offload code and rx path. Remove unused recv parameter. Signed-off-by: Ilya Lesokhin <ilyal@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/tls.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/net/tls.h b/include/net/tls.h
index 7cb58a6b8fd0..70becd0a9299 100644
--- a/include/net/tls.h
+++ b/include/net/tls.h
@@ -214,6 +214,21 @@ static inline void tls_fill_prepend(struct tls_context *ctx,
ctx->iv + TLS_CIPHER_AES_GCM_128_SALT_SIZE, iv_size);
}
+static inline void tls_make_aad(char *buf,
+ size_t size,
+ char *record_sequence,
+ int record_sequence_size,
+ unsigned char record_type)
+{
+ memcpy(buf, record_sequence, record_sequence_size);
+
+ buf[8] = record_type;
+ buf[9] = TLS_1_2_VERSION_MAJOR;
+ buf[10] = TLS_1_2_VERSION_MINOR;
+ buf[11] = size >> 8;
+ buf[12] = size & 0xFF;
+}
+
static inline struct tls_context *tls_get_ctx(const struct sock *sk)
{
struct inet_connection_sock *icsk = inet_csk(sk);