Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src-all/rev/4140d9491e4a
branches:  trunk
changeset: 934717:4140d9491e4a
user:      Taylor R Campbell <riastradh%NetBSD.org@localhost>
date:      Mon Jun 15 21:59:30 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 |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 71208a94415a -r 4140d9491e4a sys/uvm/uvm_swap.c
--- a/sys/uvm/uvm_swap.c        Mon Jun 15 16:27:33 2020 +0000
+++ b/sys/uvm/uvm_swap.c        Mon Jun 15 21:59:30 2020 +0000
@@ -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