pkgsrc-Changes archive

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

CVS commit: pkgsrc/pkgtools/digest/files



Module Name:    pkgsrc
Committed By:   mcf
Date:           Tue Feb 15 05:25:38 UTC 2022

Modified Files:
        pkgsrc/pkgtools/digest/files: configure sha2.c

Log Message:
digest: fix aliasing bug with gcc 11

gcc 11 with -O2 optimizes away the store of the bit length into the
last 8 bytes of the context buffer due to an aliasing violation
(stored through uint64_t, retrieved through uint32_t).

To fix this, import the NetBSD patch from christos[0] which makes
it use memcpy instead.

[0] http://cvsweb.netbsd.org/bsdweb.cgi/src/common/lib/libc/hash/sha2/sha2.c.diff?r1=1.12&r2=1.13


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 pkgsrc/pkgtools/digest/files/configure
cvs rdiff -u -r1.9 -r1.10 pkgsrc/pkgtools/digest/files/sha2.c

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

Modified files:

Index: pkgsrc/pkgtools/digest/files/configure
diff -u pkgsrc/pkgtools/digest/files/configure:1.27 pkgsrc/pkgtools/digest/files/configure:1.28
--- pkgsrc/pkgtools/digest/files/configure:1.27 Sat Oct 23 18:09:13 2021
+++ pkgsrc/pkgtools/digest/files/configure      Tue Feb 15 05:25:38 2022
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='nbsd-digest'
 PACKAGE_TARNAME='nbsd-digest'
-PACKAGE_VERSION='20211023'
-PACKAGE_STRING='nbsd-digest 20190127'
+PACKAGE_VERSION='20220214'
+PACKAGE_STRING='nbsd-digest 20220214'
 PACKAGE_BUGREPORT='agc%netbsd.org@localhost'
 PACKAGE_URL=''
 

Index: pkgsrc/pkgtools/digest/files/sha2.c
diff -u pkgsrc/pkgtools/digest/files/sha2.c:1.9 pkgsrc/pkgtools/digest/files/sha2.c:1.10
--- pkgsrc/pkgtools/digest/files/sha2.c:1.9     Fri May  9 16:19:57 2008
+++ pkgsrc/pkgtools/digest/files/sha2.c Tue Feb 15 05:25:38 2022
@@ -548,7 +548,8 @@ void SHA256_Final(sha2_byte digest[], SH
                        *context->buffer = 0x80;
                }
                /* Set the bit count: */
-               *(sha2_word64*)&context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
+               MEMCPY_BCOPY(&context->buffer[SHA256_SHORT_BLOCK_LENGTH],
+                   &context->bitcount, sizeof(context->bitcount));
 
                /* Final transform: */
                SHA256_Transform(context, (sha2_word32*)context->buffer);



Home | Main Index | Thread Index | Old Index