projects
/
ccan
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a3a6931
)
siphash: Use ~7 correctly
author
Ulrik Sverdrup
<ulrik.sverdrup@gmail.com>
Fri, 25 Jan 2013 19:48:35 +0000
(20:48 +0100)
committer
Ulrik Sverdrup
<ulrik.sverdrup@gmail.com>
Fri, 25 Jan 2013 19:48:35 +0000
(20:48 +0100)
7 in ~7 needs to be size_t for it to be correct when len > INT_MAX.
ccan/siphash/siphash.c
patch
|
blob
|
history
diff --git
a/ccan/siphash/siphash.c
b/ccan/siphash/siphash.c
index 9f41489e9ee9e050ae4f09c16bd66358b3de040f..766617ed9c4ce1761cd97715942757cb422f7fa3 100644
(file)
--- a/
ccan/siphash/siphash.c
+++ b/
ccan/siphash/siphash.c
@@
-45,7
+45,7
@@
static void siphash_init(u64 v[5], const unsigned char key[16])
/* Load the last 0-7 bytes of `in` and put in len & 255 */
static void siphash_epilogue(u64 *m, const unsigned char *in, size_t len)
{
- in +=
(len & ~7)
;
+ in +=
len & ~(size_t)7
;
*m = (u64)(len & 255) << 56;
switch (len & 7) {
case 7: *m |= (u64) in[6] << 48;