diff options
author | Rich Cannings <richc@google.com> | 2018-10-09 13:56:37 -0700 |
---|---|---|
committer | Rich Cannings <richc@google.com> | 2018-11-20 19:17:19 +0000 |
commit | feccb6197f3328885cc8b9ccfa356b29fe6bfe71 (patch) | |
tree | 8043b7c779f27a17272210d3a788d36a29485d71 | |
parent | 7a543744db8ece2376b019040b5668ede68ebd8b (diff) | |
download | wpa_supplicant_8-feccb6197f3328885cc8b9ccfa356b29fe6bfe71.tar.gz |
Use BoringSSL to get random bytes
Bug: 117508900
Change-Id: I4889513c0671ff2b689f1beca8084d6f149d473d
Test: Existing tests pass
-rw-r--r-- | src/crypto/random.c | 7 | ||||
-rw-r--r-- | wpa_supplicant/Android.mk | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/crypto/random.c b/src/crypto/random.c index 3a86a93a..5d671bdc 100644 --- a/src/crypto/random.c +++ b/src/crypto/random.c @@ -160,10 +160,17 @@ int random_get_bytes(void *buf, size_t len) wpa_printf(MSG_MSGDUMP, "Get randomness: len=%u entropy=%u", (unsigned int) len, entropy); +#ifdef CONFIG_USE_OPENSSL_RNG + /* Start with assumed strong randomness from OpenSSL */ + ret = crypto_get_random(buf, len); + wpa_hexdump_key(MSG_EXCESSIVE, "random from crypto_get_random", + buf, len); +#else /* CONFIG_USE_OPENSSL_RNG */ /* Start with assumed strong randomness from OS */ ret = os_get_random(buf, len); wpa_hexdump_key(MSG_EXCESSIVE, "random from os_get_random", buf, len); +#endif /* CONFIG_USE_OPENSSL_RNG */ /* Mix in additional entropy extracted from the internal pool */ left = len; diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk index f65076c7..09399cde 100644 --- a/wpa_supplicant/Android.mk +++ b/wpa_supplicant/Android.mk @@ -931,6 +931,7 @@ endif ifndef CONFIG_TLS CONFIG_TLS=openssl +L_CFLAGS += -DCONFIG_USE_OPENSSL_RNG endif ifdef CONFIG_TLSV11 |