Source-Changes-HG archive

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

[src/trunk]: src/sys/crypto/adiantum use an enum instead of constant variable...



details:   https://anonhg.NetBSD.org/src/rev/d018c98f3789
branches:  trunk
changeset: 1020525:d018c98f3789
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Apr 14 21:29:57 2021 +0000

description:
use an enum instead of constant variables so that they work in CTASSERT.

diffstat:

 sys/crypto/adiantum/adiantum.c |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (35 lines):

diff -r cc68050a88bf -r d018c98f3789 sys/crypto/adiantum/adiantum.c
--- a/sys/crypto/adiantum/adiantum.c    Wed Apr 14 21:20:21 2021 +0000
+++ b/sys/crypto/adiantum/adiantum.c    Wed Apr 14 21:29:57 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: adiantum.c,v 1.5 2020/07/26 04:05:20 riastradh Exp $   */
+/*     $NetBSD: adiantum.c,v 1.6 2021/04/14 21:29:57 christos Exp $    */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: adiantum.c,v 1.5 2020/07/26 04:05:20 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: adiantum.c,v 1.6 2021/04/14 21:29:57 christos Exp $");
 
 #include <sys/types.h>
 #include <sys/endian.h>
@@ -390,10 +390,12 @@
 nh(uint8_t h[static 32], const uint8_t *m, size_t mlen,
     const uint32_t k[static 268 /* u/w + 2s(r - 1) */])
 {
-       const unsigned w = 32;   /* word size */
-       const unsigned s = 2;    /* stride */
-       const unsigned r = 4;    /* rounds */
-       const unsigned u = 8192; /* unit count (bits per msg unit) */
+       enum {
+           s = 2,       /* stride */
+           r = 4,       /* rounds */
+           w = 32,      /* word size */
+           u = 8192     /* unit count (bits per msg unit) */
+       };
        uint64_t h0 = 0, h1 = 0, h2 = 0, h3 = 0;
        unsigned i;
 



Home | Main Index | Thread Index | Old Index