summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authoragc <agc@pkgsrc.org>2020-05-04 01:37:54 +0000
committeragc <agc@pkgsrc.org>2020-05-04 01:37:54 +0000
commitc2763fe9d3b8de1f6a5815a47c4d6b0f94e821cd (patch)
tree4e5b875ea3d6eeab029379c592a8acb0ecd8c097 /security
parent4f6f3f2ef4cbd8704e533bb6f509964da38cfcb6 (diff)
downloadpkgsrc-c2763fe9d3b8de1f6a5815a47c4d6b0f94e821cd.tar.gz
bring over changes from src - cast return values
Diffstat (limited to 'security')
-rw-r--r--security/netpgpverify/files/sha2.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/security/netpgpverify/files/sha2.c b/security/netpgpverify/files/sha2.c
index d68ccca1034..2cf7897ac0c 100644
--- a/security/netpgpverify/files/sha2.c
+++ b/security/netpgpverify/files/sha2.c
@@ -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);
}