Module Name: src
Committed By: riastradh
Date: Sun Jun 26 17:52:54 UTC 2022
Modified Files:
src/sys/crypto/aes/arch/arm: aes_neon_subr.c
Log Message:
arm/aes_neon: Fix formatting of self-test failure message.
Discovered by code inspection. Remarkably, a combination of errors
made this fail to be a stack buffer overrun. Verified by booting
with ARMv8.0-AES disabled and with the self-test artificially made to
fail.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/crypto/aes/arch/arm/aes_neon_subr.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/crypto/aes/arch/arm/aes_neon_subr.c
diff -u src/sys/crypto/aes/arch/arm/aes_neon_subr.c:1.7 src/sys/crypto/aes/arch/arm/aes_neon_subr.c:1.8
--- src/sys/crypto/aes/arch/arm/aes_neon_subr.c:1.7 Sun Aug 9 02:48:38 2020
+++ src/sys/crypto/aes/arch/arm/aes_neon_subr.c Sun Jun 26 17:52:54 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: aes_neon_subr.c,v 1.7 2020/08/09 02:48:38 riastradh Exp $ */
+/* $NetBSD: aes_neon_subr.c,v 1.8 2022/06/26 17:52:54 riastradh Exp $ */
/*-
* Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: aes_neon_subr.c,v 1.7 2020/08/09 02:48:38 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aes_neon_subr.c,v 1.8 2022/06/26 17:52:54 riastradh Exp $");
#ifdef _KERNEL
#include <sys/systm.h>
@@ -183,11 +183,11 @@ aes_neon_xts_update_selftest(void)
for (i = 0; i < sizeof(cases)/sizeof(cases[0]); i++) {
storeblock(t, aes_neon_xts_update(loadblock(cases[i].in)));
if (memcmp(t, cases[i].out, 16)) {
- char buf[33];
+ char buf[3*16 + 1];
unsigned j;
for (j = 0; j < 16; j++) {
- snprintf(buf + 2*j, sizeof(buf) - 2*j,
+ snprintf(buf + 3*j, sizeof(buf) - 3*j,
" %02hhx", t[j]);
}
printf("%s %u: %s\n", __func__, i, buf);