aboutsummaryrefslogtreecommitdiff
path: root/projects/openweave/patch.diff
blob: c1ce5201a3942fd4d9a1a17e5b33060374b44bac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
diff --git a/src/lib/support/crypto/WeaveRNG-OpenSSL.cpp b/src/lib/support/crypto/WeaveRNG-OpenSSL.cpp
index 7a6cb42..c05caae 100644
--- a/src/lib/support/crypto/WeaveRNG-OpenSSL.cpp
+++ b/src/lib/support/crypto/WeaveRNG-OpenSSL.cpp
@@ -53,8 +53,9 @@ WEAVE_ERROR InitSecureRandomDataSource(nl::Weave::Crypto::EntropyFunct entropyFu
 
 WEAVE_ERROR GetSecureRandomData(uint8_t *buf, uint16_t len)
 {
-    if (RAND_bytes((unsigned char *)buf, (int)len) != 1)
-        return WEAVE_ERROR_RANDOM_DATA_UNAVAILABLE;
+    //if (RAND_bytes((unsigned char *)buf, (int)len) != 1)
+    //    return WEAVE_ERROR_RANDOM_DATA_UNAVAILABLE;
+    memset((unsigned char *)buf, 'A', (int)len);
 
     return WEAVE_NO_ERROR;
 }
diff --git a/src/tools/weave/CertUtils.cpp b/src/tools/weave/CertUtils.cpp
index 2bd8097..a1dce36 100644
--- a/src/tools/weave/CertUtils.cpp
+++ b/src/tools/weave/CertUtils.cpp
@@ -695,8 +695,9 @@ bool SetCertSerialNumber(X509 *cert)
     ASN1_INTEGER *snInt = X509_get_serialNumber(cert);
 
     // Generate a random value to be used as the serial number.
-    if (!RAND_bytes(reinterpret_cast<uint8_t *>(&rnd), sizeof(rnd)))
-        ReportOpenSSLErrorAndExit("RAND_bytes", res = false);
+    //if (!RAND_bytes(reinterpret_cast<uint8_t *>(&rnd), sizeof(rnd)))
+    //    ReportOpenSSLErrorAndExit("RAND_bytes", res = false);
+    memset(reinterpret_cast<uint8_t *>(&rnd), 'A', sizeof(rnd));
 
     // Avoid negative numbers.
     rnd &= 0x7FFFFFFFFFFFFFFF;
diff --git a/src/tools/weave/Cmd_GenProvisioningData.cpp b/src/tools/weave/Cmd_GenProvisioningData.cpp
index 85ca2e2..bd5c18b 100644
--- a/src/tools/weave/Cmd_GenProvisioningData.cpp
+++ b/src/tools/weave/Cmd_GenProvisioningData.cpp
@@ -543,8 +543,9 @@ char *GeneratePairingCode(uint32_t pairingCodeLen)
     }
 
     // Generate random data for the pairing code, excluding the check digit at the end.
-    if (!RAND_bytes((uint8_t *)pairingCode, pairingCodeLen - 1))
-        ReportOpenSSLErrorAndExit("Failed to get random data", pairingCode = NULL);
+    //if (!RAND_bytes((uint8_t *)pairingCode, pairingCodeLen - 1))
+    //    ReportOpenSSLErrorAndExit("Failed to get random data", pairingCode = NULL);
+    memset((uint8_t *)pairingCode, 'A', pairingCodeLen - 1);
 
     // Convert the random data to characters in the range 0-9, A-H, J-N, P, R-Y (base-32 alphanumeric, excluding I, O, Q and Z).
     for (uint32_t i = 0; i < pairingCodeLen - 1; i++)