CVS commit: src/sys/crypto/aes/arch/x86

2024-06-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jun 16 16:30:53 UTC 2024

Modified Files:
src/sys/crypto/aes/arch/x86: aes_via.c

Log Message:
sys/aes_via: fix broken link in comment


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/crypto/aes/arch/x86/aes_via.c

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



CVS commit: src/sys/crypto/aes/arch/x86

2024-06-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jun 16 16:30:53 UTC 2024

Modified Files:
src/sys/crypto/aes/arch/x86: aes_via.c

Log Message:
sys/aes_via: fix broken link in comment


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/crypto/aes/arch/x86/aes_via.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/x86/aes_via.c
diff -u src/sys/crypto/aes/arch/x86/aes_via.c:1.8 src/sys/crypto/aes/arch/x86/aes_via.c:1.9
--- src/sys/crypto/aes/arch/x86/aes_via.c:1.8	Sun Jun 16 16:11:17 2024
+++ src/sys/crypto/aes/arch/x86/aes_via.c	Sun Jun 16 16:30:52 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: aes_via.c,v 1.8 2024/06/16 16:11:17 christos Exp $	*/
+/*	$NetBSD: aes_via.c,v 1.9 2024/06/16 16:30:52 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: aes_via.c,v 1.8 2024/06/16 16:11:17 christos Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aes_via.c,v 1.9 2024/06/16 16:30:52 rillig Exp $");
 
 #ifdef _KERNEL
 #include 
@@ -857,7 +857,7 @@ aesvia_probe(void)
 #else
 	/*
 	 * From the VIA PadLock Programming Guide:
-	 * http://linux.via.com.tw/support/beginDownload.action?eleid=181=261
+	 * https://web.archive.org/web/20220104214041/http://linux.via.com.tw/support/beginDownload.action?eleid=181=261
 	 */
 	unsigned eax, ebx, ecx, edx;
 	if (!__get_cpuid(0, , , , ))



CVS commit: src/sys/crypto/aes/arch/x86

2024-06-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 16 16:11:17 UTC 2024

Modified Files:
src/sys/crypto/aes/arch/x86: aes_via.c

Log Message:
revert previous, probably a gcc bug?


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/crypto/aes/arch/x86/aes_via.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/x86/aes_via.c
diff -u src/sys/crypto/aes/arch/x86/aes_via.c:1.7 src/sys/crypto/aes/arch/x86/aes_via.c:1.8
--- src/sys/crypto/aes/arch/x86/aes_via.c:1.7	Sun Jun 16 09:03:48 2024
+++ src/sys/crypto/aes/arch/x86/aes_via.c	Sun Jun 16 12:11:17 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: aes_via.c,v 1.7 2024/06/16 13:03:48 christos Exp $	*/
+/*	$NetBSD: aes_via.c,v 1.8 2024/06/16 16:11:17 christos Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: aes_via.c,v 1.7 2024/06/16 13:03:48 christos Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aes_via.c,v 1.8 2024/06/16 16:11:17 christos Exp $");
 
 #ifdef _KERNEL
 #include 
@@ -428,8 +428,7 @@ aesvia_cbc_dec(const struct aesdec *dec,
 break;
 			memcpy(cv, in + nbytes - 16, 16);
 			xor128(tmp, tmp, cv);
-			// XXX: is this right? (subtracting 16)
-			memcpy(out + nbytes - 16, tmp, 16);
+			memcpy(out + nbytes, tmp, 16);
 		}
 
 		xor128(tmp, tmp, iv0);



CVS commit: src/sys/crypto/aes/arch/x86

2024-06-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 16 16:11:17 UTC 2024

Modified Files:
src/sys/crypto/aes/arch/x86: aes_via.c

Log Message:
revert previous, probably a gcc bug?


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/crypto/aes/arch/x86/aes_via.c

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



CVS commit: src/sys/crypto/aes/arch/x86

2024-06-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 16 13:03:48 UTC 2024

Modified Files:
src/sys/crypto/aes/arch/x86: aes_via.c

Log Message:
try to fix the overflow gcc pointed out.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/crypto/aes/arch/x86/aes_via.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/x86/aes_via.c
diff -u src/sys/crypto/aes/arch/x86/aes_via.c:1.6 src/sys/crypto/aes/arch/x86/aes_via.c:1.7
--- src/sys/crypto/aes/arch/x86/aes_via.c:1.6	Tue Jul 28 10:01:35 2020
+++ src/sys/crypto/aes/arch/x86/aes_via.c	Sun Jun 16 09:03:48 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: aes_via.c,v 1.6 2020/07/28 14:01:35 riastradh Exp $	*/
+/*	$NetBSD: aes_via.c,v 1.7 2024/06/16 13:03:48 christos Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: aes_via.c,v 1.6 2020/07/28 14:01:35 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aes_via.c,v 1.7 2024/06/16 13:03:48 christos Exp $");
 
 #ifdef _KERNEL
 #include 
@@ -428,7 +428,8 @@ aesvia_cbc_dec(const struct aesdec *dec,
 break;
 			memcpy(cv, in + nbytes - 16, 16);
 			xor128(tmp, tmp, cv);
-			memcpy(out + nbytes, tmp, 16);
+			// XXX: is this right? (subtracting 16)
+			memcpy(out + nbytes - 16, tmp, 16);
 		}
 
 		xor128(tmp, tmp, iv0);



CVS commit: src/sys/crypto/aes/arch/x86

2024-06-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 16 13:03:48 UTC 2024

Modified Files:
src/sys/crypto/aes/arch/x86: aes_via.c

Log Message:
try to fix the overflow gcc pointed out.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/crypto/aes/arch/x86/aes_via.c

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



CVS commit: src/sys/crypto/aes/arch/arm

2023-08-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Aug  7 00:58:35 UTC 2023

Modified Files:
src/sys/crypto/aes/arch/arm: arm_neon.h

Log Message:
sys/crypto/{aes,chacha}/arch/arm/arm_neon.h: Sync (whitespace fix)

No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/crypto/aes/arch/arm/arm_neon.h

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/arm_neon.h
diff -u src/sys/crypto/aes/arch/arm/arm_neon.h:1.11 src/sys/crypto/aes/arch/arm/arm_neon.h:1.12
--- src/sys/crypto/aes/arch/arm/arm_neon.h:1.11	Mon Sep  7 18:06:13 2020
+++ src/sys/crypto/aes/arch/arm/arm_neon.h	Mon Aug  7 00:58:35 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm_neon.h,v 1.11 2020/09/07 18:06:13 jakllsch Exp $	*/
+/*	$NetBSD: arm_neon.h,v 1.12 2023/08/07 00:58:35 rin Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -232,7 +232,7 @@ static __inline uint32_t
 vgetq_lane_u32(uint32x4_t __v, uint8_t __i)
 {
 #ifdef __aarch64__
-	return __v[__neon_laneq_index(__v,__i)];
+	return __v[__neon_laneq_index(__v, __i)];
 #else
 	return (uint32_t)__builtin_neon_vget_laneuv4si((int32x4_t)__v, __i);
 #endif



CVS commit: src/sys/crypto/aes/arch/arm

2023-08-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Aug  7 00:58:35 UTC 2023

Modified Files:
src/sys/crypto/aes/arch/arm: arm_neon.h

Log Message:
sys/crypto/{aes,chacha}/arch/arm/arm_neon.h: Sync (whitespace fix)

No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/crypto/aes/arch/arm/arm_neon.h

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



CVS commit: src/sys/crypto/aes/arch/arm

2022-06-26 Thread Taylor R Campbell
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 
-__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 
@@ -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);



CVS commit: src/sys/crypto/aes/arch/arm

2022-06-26 Thread Taylor R Campbell
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.



CVS commit: src/sys/crypto/aes

2021-12-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 04:48:35 UTC 2021

Modified Files:
src/sys/crypto/aes: aes_selftest.c

Log Message:
s/folllowing/following/


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/crypto/aes/aes_selftest.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/aes_selftest.c
diff -u src/sys/crypto/aes/aes_selftest.c:1.6 src/sys/crypto/aes/aes_selftest.c:1.7
--- src/sys/crypto/aes/aes_selftest.c:1.6	Tue Sep  8 22:48:24 2020
+++ src/sys/crypto/aes/aes_selftest.c	Sun Dec  5 04:48:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: aes_selftest.c,v 1.6 2020/09/08 22:48:24 riastradh Exp $	*/
+/*	$NetBSD: aes_selftest.c,v 1.7 2021/12/05 04:48:35 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: aes_selftest.c,v 1.6 2020/09/08 22:48:24 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aes_selftest.c,v 1.7 2021/12/05 04:48:35 msaitoh Exp $");
 
 #ifdef _KERNEL
 
@@ -133,7 +133,7 @@ aes_selftest_encdec(const struct aes_imp
 	if (outbuf[17] != 0x1a)
 		return aes_selftest_fail(impl, outbuf + 17,
 		(const uint8_t[1]){0x1a}, 1,
-		"AES overrun folllowing");
+		"AES overrun following");
 
 	/* Success!  */
 	return 0;



CVS commit: src/sys/crypto/aes

2021-12-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 04:48:35 UTC 2021

Modified Files:
src/sys/crypto/aes: aes_selftest.c

Log Message:
s/folllowing/following/


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/crypto/aes/aes_selftest.c

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



Re: CVS commit: src/sys/crypto/aes

2020-07-28 Thread Roy Marples

On 27/07/2020 21:44, Taylor R Campbell wrote:

Module Name:src
Committed By:   riastradh
Date:   Mon Jul 27 20:44:30 UTC 2020

Modified Files:
src/sys/crypto/aes: aes_ccm.c aes_ccm.h

Log Message:
Gather auth[16] and ctr[16] into one authctr[32].

Should appease clang.


clang is still not appeased :/

--- aes_via.o ---
/home/roy/src/hg/src/sys/crypto/aes/arch/x86/aes_via.c:807:6: error: variable 
'authctr' is used uninitialized whenever 'if' condition is false 
[-Werror,-Wsometimes-uninitialized]

if ((uintptr_t)authctr0 & 0xf) {
^
/home/roy/src/hg/src/sys/crypto/aes/arch/x86/aes_via.c:820:10: note: 
uninitialized use occurs here

be32enc(authctr + 16 + 4*3, ++c3);
^~~
/home/roy/src/hg/src/sys/crypto/aes/arch/x86/aes_via.c:807:2: note: remove the 
'if' if its condition is always true

if ((uintptr_t)authctr0 & 0xf) {
^~~
/home/roy/src/hg/src/sys/crypto/aes/arch/x86/aes_via.c:796:18: note: initialize 
the variable 'authctr' to silence this warning

uint8_t *authctr;
^
 = NULL
1 error generated.
*** [aes_via.o] Error code 1