aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Cannings <richc@google.com>2018-10-09 13:56:37 -0700
committerRich Cannings <richc@google.com>2018-11-20 19:17:19 +0000
commitfeccb6197f3328885cc8b9ccfa356b29fe6bfe71 (patch)
tree8043b7c779f27a17272210d3a788d36a29485d71
parent7a543744db8ece2376b019040b5668ede68ebd8b (diff)
downloadwpa_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.c7
-rw-r--r--wpa_supplicant/Android.mk1
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