Source-Changes-HG archive

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

[src/trunk]: src/sys/crypto/aes Add hack to compile aes_ccm_tag() with -O0 fo...



details:   https://anonhg.NetBSD.org/src/rev/2c9a794c3347
branches:  trunk
changeset: 937156:2c9a794c3347
user:      rin <rin%NetBSD.org@localhost>
date:      Mon Aug 10 06:27:29 2020 +0000

description:
Add hack to compile aes_ccm_tag() with -O0 for m68k for GCC8.

GCC 8 miscompiles aes_ccm_tag() for m68k with optimization level -O[12],
which results in failure in aes_ccm_selftest():

| aes_ccm_selftest: tag 0: 8 bytes @ 0x4d3e38
| 03 80 5f 08 22 6f cb fe                          | .._."o..
| aes_ccm_selftest: verify 0 failed
| ...
| WARNING: module error: built-in module aes_ccm failed its MODULE_CMD_INIT, error 5

This is observed for amiga (A1200, 68060), mac68k (Quadra 840AV, 68040),
and luna68k (nono, 68030 emulator). However, it is not for sun3 (TME, 68020
emulator) and sun2 (TME, 68010 emulator). At the moment, it is unclear
whether this is due to differences b/w 68010-20 vs 68030-60, or something
wrong with TME.

diffstat:

 sys/crypto/aes/aes_ccm.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r e61747ff03d7 -r 2c9a794c3347 sys/crypto/aes/aes_ccm.c
--- a/sys/crypto/aes/aes_ccm.c  Mon Aug 10 06:24:39 2020 +0000
+++ b/sys/crypto/aes/aes_ccm.c  Mon Aug 10 06:27:29 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aes_ccm.c,v 1.4 2020/07/27 20:44:30 riastradh Exp $    */
+/*     $NetBSD: aes_ccm.c,v 1.5 2020/08/10 06:27:29 rin Exp $  */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: aes_ccm.c,v 1.4 2020/07/27 20:44:30 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aes_ccm.c,v 1.5 2020/08/10 06:27:29 rin Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -301,6 +301,9 @@
 }
 
 void
+#if defined(__m68k__) && __GNUC_PREREQ__(8, 0)
+__attribute__((__optimize__("O0")))
+#endif
 aes_ccm_tag(struct aes_ccm *C, void *out)
 {
        uint8_t *auth = C->authctr;



Home | Main Index | Thread Index | Old Index