pkgsrc-Changes archive

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

CVS commit: pkgsrc/security/netpgpverify/files



Module Name:    pkgsrc
Committed By:   agc
Date:           Mon May  4 01:37:54 UTC 2020

Modified Files:
        pkgsrc/security/netpgpverify/files: sha2.c

Log Message:
bring over changes from src - cast return values


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 pkgsrc/security/netpgpverify/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/security/netpgpverify/files/sha2.c
diff -u pkgsrc/security/netpgpverify/files/sha2.c:1.5 pkgsrc/security/netpgpverify/files/sha2.c:1.6
--- pkgsrc/security/netpgpverify/files/sha2.c:1.5       Wed Sep  2 17:15:09 2015
+++ pkgsrc/security/netpgpverify/files/sha2.c   Mon May  4 01:37:54 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: sha2.c,v 1.5 2015/09/02 17:15:09 jperkin Exp $ */
+/* $NetBSD: sha2.c,v 1.6 2020/05/04 01:37:54 agc Exp $ */
 /*     $KAME: sha2.c,v 1.9 2003/07/20 00:28:38 itojun Exp $    */
 
 /*
@@ -48,7 +48,9 @@
 #   undef be32toh
 #   undef be64toh
 
+#ifndef __CAST
 #define __CAST(__dt, __st)      ((__dt)(__st)) /* srsly? */
+#endif
 
 static __inline void
 be32encode(void *buf, uint32_t u)
@@ -76,7 +78,7 @@ htobe32(uint32_t x)
        uint8_t p[4];
        memcpy(p, &x, 4);
 
-       return ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
+       return (((uint32_t)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
 }
 
 static uint64_t
@@ -86,8 +88,8 @@ htobe64(uint64_t x)
        uint32_t u, v;
        memcpy(p, &x, 8);
 
-       u = ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
-       v = ((p[4] << 24) | (p[5] << 16) | (p[6] << 8) | p[7]);
+       u = (((uint32_t)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
+       v = (((uint32_t)p[4] << 24) | (p[5] << 16) | (p[6] << 8) | p[7]);
 
        return ((((uint64_t)u) << 32) | v);
 }



Home | Main Index | Thread Index | Old Index