Module Name:    src
Committed By:   riastradh
Date:           Mon Jun 29 23:40:28 UTC 2020

Modified Files:
        src/sys/uvm: uvm_swap.c

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

Will help hardware-assisted AES.


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 src/sys/uvm/uvm_swap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_swap.c
diff -u src/sys/uvm/uvm_swap.c:1.194 src/sys/uvm/uvm_swap.c:1.195
--- src/sys/uvm/uvm_swap.c:1.194	Mon Jun 29 23:33:46 2020
+++ src/sys/uvm/uvm_swap.c	Mon Jun 29 23:40:28 2020
@@ -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 @@ uvm_swap_genkey(struct swapdev *sdp)
 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 @@ uvm_swap_encryptpage(struct swapdev *sdp
 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);

Reply via email to