From: Jason A. Donenfeld Date: Mon, 4 Feb 2019 23:49:18 +0000 (+0100) Subject: x25519: demand RNG is successful X-Git-Tag: 0.0.20190207-1~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7a31ca7bb0106ce5df02aaa4a04bc044563ce0e;p=thirdparty%2Fwireguard-apple.git x25519: demand RNG is successful Signed-off-by: Jason A. Donenfeld --- 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; }