summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeonah Moon <seonah1.moon@samsung.com>2019-05-13 17:18:59 +0900
committerSeonah Moon <seonah1.moon@samsung.com>2019-05-13 17:19:06 +0900
commitca673fc935cb19c6aa901b4feb03bc39a3c5e6d0 (patch)
treeb540dfd0a195bb8ad7baaccae033db5e53a3f746
parent056504456659d30029525b611e4bc5bdb2b1a100 (diff)
downloadwifi-ca673fc935cb19c6aa901b4feb03bc39a3c5e6d0.tar.gz
wifi-ca673fc935cb19c6aa901b4feb03bc39a3c5e6d0.tar.bz2
wifi-ca673fc935cb19c6aa901b4feb03bc39a3c5e6d0.zip
[WGID-253912] Do not use weak pseudo-random generatorsubmit/tizen/20190513.083717accepted/tizen/unified/20190515.084931
Change-Id: I30b90744be56241501bd757d9783f0697ff3392a
-rw-r--r--packaging/org.tizen.w-wifi.spec2
-rw-r--r--sources/wearable/src/net/wifi_generate_pin.c13
2 files changed, 4 insertions, 11 deletions
diff --git a/packaging/org.tizen.w-wifi.spec b/packaging/org.tizen.w-wifi.spec
index 6360d0b..1e8840e 100644
--- a/packaging/org.tizen.w-wifi.spec
+++ b/packaging/org.tizen.w-wifi.spec
@@ -1,6 +1,6 @@
Name: org.tizen.w-wifi
Summary: Wi-Fi UI Gadget for TIZEN wearable
-Version: 1.0.234
+Version: 1.0.235
Release: 1
Group: App/Network
License: Flora-1.1
diff --git a/sources/wearable/src/net/wifi_generate_pin.c b/sources/wearable/src/net/wifi_generate_pin.c
index e9cb90f..e310192 100644
--- a/sources/wearable/src/net/wifi_generate_pin.c
+++ b/sources/wearable/src/net/wifi_generate_pin.c
@@ -303,11 +303,6 @@ static int os_get_time(struct os_time *t)
return res;
}
-static unsigned long os_random(void)
-{
- return random();
-}
-
static int os_get_random(unsigned char *buf, size_t len)
{
FILE *f;
@@ -441,11 +436,9 @@ unsigned int wifi_generate_pin(void)
unsigned int val;
/* Generate seven random digits for the PIN */
- if (random_get_bytes((unsigned char *) &val, sizeof(val)) < 0) {
- struct os_time now;
- os_get_time(&now);
- val = os_random() ^ now.sec ^ now.usec;
- }
+ if (random_get_bytes((unsigned char *) &val, sizeof(val)) < 0)
+ return 0;
+
val %= 10000000;
/* Append checksum digit */