]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - include/net/tls.h
tls: zero the crypto information from tls_context before freeing
[mirror_ubuntu-bionic-kernel.git] / include / net / tls.h
index 7841bd70c70db8d6fa97b6d228d5ed74f56fe136..18a937407427bd83440b4797b3beb18a9ac96fa2 100644 (file)
@@ -79,11 +79,13 @@ enum {
        TLS_PENDING_CLOSED_RECORD
 };
 
+union tls_crypto_context {
+       struct tls_crypto_info info;
+       struct tls12_crypto_info_aes_gcm_128 aes_gcm_128;
+};
+
 struct tls_context {
-       union {
-               struct tls_crypto_info crypto_send;
-               struct tls12_crypto_info_aes_gcm_128 crypto_send_aes_gcm_128;
-       };
+       union tls_crypto_context crypto_send;
 
        void *priv_ctx;
 
@@ -210,8 +212,8 @@ static inline void tls_fill_prepend(struct tls_context *ctx,
         * size KTLS_DTLS_HEADER_SIZE + KTLS_DTLS_NONCE_EXPLICIT_SIZE
         */
        buf[0] = record_type;
-       buf[1] = TLS_VERSION_MINOR(ctx->crypto_send.version);
-       buf[2] = TLS_VERSION_MAJOR(ctx->crypto_send.version);
+       buf[1] = TLS_VERSION_MINOR(ctx->crypto_send.info.version);
+       buf[2] = TLS_VERSION_MAJOR(ctx->crypto_send.info.version);
        /* we can use IV for nonce explicit according to spec */
        buf[3] = pkt_len >> 8;
        buf[4] = pkt_len & 0xFF;