Skip to content

Commit

Permalink
Merge branch 'patch-3' of git://github.com/sdgathman/cjdns into crashey
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdelisle committed Aug 6, 2019
2 parents 45c9d28 + bc524d7 commit 2dfc2a5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crypto/random/seed/LinuxRandomUuidSysctlRandomSeed.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <unistd.h>
#include <sys/syscall.h>
#ifndef SYS_getrandom
#include <sys/sysctl.h>

static int getUUID(uint64_t output[2])
Expand All @@ -35,6 +36,7 @@ static int getUUID(uint64_t output[2])
}
return 0;
}
#endif

static int get(struct RandomSeed* randomSeed, uint64_t output[8])
{
Expand All @@ -48,11 +50,13 @@ static int get(struct RandomSeed* randomSeed, uint64_t output[8])
if (ret == 64 && !Bits_isZero(output, 64)) {
return 0;
}
#endif
return -1;
#else
if (getUUID(output) || getUUID(output+2) || getUUID(output+4) || getUUID(output+6)) {
return -1;
}
return 0;
#endif
}

struct RandomSeed* LinuxRandomUuidSysctlRandomSeed_new(struct Allocator* alloc)
Expand Down

0 comments on commit 2dfc2a5

Please sign in to comment.