mirror of https://github.com/google/oss-fuzz.git
49 lines
2.4 KiB
Diff
49 lines
2.4 KiB
Diff
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++)
|