From f7a31ca7bb0106ce5df02aaa4a04bc044563ce0e Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 5 Feb 2019 00:49:18 +0100 Subject: x25519: demand RNG is successful Signed-off-by: Jason A. Donenfeld --- WireGuard/WireGuard/Crypto/x25519.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WireGuard/WireGuard/Crypto/x25519.c b/WireGuard/WireGuard/Crypto/x25519.c index e0ff482..b77da0b 100644 --- a/WireGuard/WireGuard/Crypto/x25519.c +++ b/WireGuard/WireGuard/Crypto/x25519.c @@ -7,6 +7,7 @@ #include #include +#include #include #include "x25519.h" @@ -171,7 +172,7 @@ void curve25519_derive_public_key(uint8_t public_key[32], const uint8_t private_ void curve25519_generate_private_key(uint8_t private_key[32]) { - CCRandomGenerateBytes(private_key, 32); + assert(CCRandomGenerateBytes(private_key, 32) == kCCSuccess); private_key[31] = (private_key[31] & 127) | 64; private_key[0] &= 248; } -- cgit v1.2.3-59-g8ed1b