summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike A. Owens <mike@meter.md>2019-09-23 19:24:09 -0400
committerMike A. Owens <mike@meter.md>2019-09-23 19:24:09 -0400
commit0a4d2bbd9c07bdaa5979941b5483cebb7419f7a0 (patch)
tree3691f1d6d391f3432521517555ef9fff3fbb7f71
parenteda703ab284f1ce491fb2c376fd08fe8aa956c62 (diff)
downloadredis-0a4d2bbd9c07bdaa5979941b5483cebb7419f7a0.tar.gz
Seed SipHash with 128-bit key
SipHash expects a 128-bit key, and we were indeed generating 128-bits, but restricting them to hex characters 0-9a-f, effectively giving us only 4 bits-per-byte of key material, and 64 bits overall. Now, we skip the hex conversion and supply 128 bits of unfiltered random data.
-rw-r--r--src/server.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/server.c b/src/server.c
index 7882b0d99..fc9809b1c 100644
--- a/src/server.c
+++ b/src/server.c
@@ -4787,9 +4787,9 @@ int main(int argc, char **argv) {
srand(time(NULL)^getpid());
gettimeofday(&tv,NULL);
- char hashseed[16];
- getRandomHexChars(hashseed,sizeof(hashseed));
- dictSetHashFunctionSeed((uint8_t*)hashseed);
+ uint8_t hashseed[16];
+ getRandomBytes(hashseed,sizeof(hashseed));
+ dictSetHashFunctionSeed(hashseed);
server.sentinel_mode = checkForSentinelMode(argc,argv);
initServerConfig();
ACLInit(); /* The ACL subsystem must be initialized ASAP because the