Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm uvm: Make sure swap encryption IV is 128-bit-aligned...



details:   https://anonhg.NetBSD.org/src/rev/3f1fe23aef5f
branches:  trunk
changeset: 935312:3f1fe23aef5f
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Jun 29 23:40:28 2020 +0000

description:
uvm: Make sure swap encryption IV is 128-bit-aligned on stack.

Will help hardware-assisted AES.

diffstat:

 sys/uvm/uvm_swap.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 42565b49f26d -r 3f1fe23aef5f sys/uvm/uvm_swap.c
--- a/sys/uvm/uvm_swap.c        Mon Jun 29 23:39:30 2020 +0000
+++ b/sys/uvm/uvm_swap.c        Mon Jun 29 23:40:28 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_swap.c,v 1.194 2020/06/29 23:33:46 riastradh Exp $ */
+/*     $NetBSD: uvm_swap.c,v 1.195 2020/06/29 23:40:28 riastradh Exp $ */
 
 /*
  * Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.194 2020/06/29 23:33:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.195 2020/06/29 23:40:28 riastradh Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_compat_netbsd.h"
@@ -2089,7 +2089,7 @@
 static void
 uvm_swap_encryptpage(struct swapdev *sdp, void *kva, int slot)
 {
-       uint8_t preiv[16] = {0}, iv[16];
+       uint8_t preiv[16] __aligned(16) = {0}, iv[16] __aligned(16);
 
        /* iv := AES_k(le32enc(slot) || 0^96) */
        le32enc(preiv, slot);
@@ -2111,7 +2111,7 @@
 static void
 uvm_swap_decryptpage(struct swapdev *sdp, void *kva, int slot)
 {
-       uint8_t preiv[16] = {0}, iv[16];
+       uint8_t preiv[16] __aligned(16) = {0}, iv[16] __aligned(16);
 
        /* iv := AES_k(le32enc(slot) || 0^96) */
        le32enc(preiv, slot);



Home | Main Index | Thread Index | Old Index