MCPcopy Create free account
hub / github.com/BruceDevices/firmware / generateValidNonce

Method generateValidNonce

src/modules/ble/fastpair_crypto.cpp:150–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150void FastPairCrypto::generateValidNonce(uint8_t *nonce) {
151 uint32_t time_part = millis();
152 memcpy(nonce, &time_part, 4);
153 esp_fill_random(&nonce[4], 4);
154
155 for (int i = 8; i < 16; i++) {
156 nonce[i] = esp_random() & 0xFF;
157 if (i == 8) nonce[i] |= 0x80;
158 }
159}
160
161bool FastPairCrypto::looksLikeValidPublicKey(const uint8_t *key, size_t len) {
162 if (len != 65) return false;

Callers 1

sendProtocolAttackMethod · 0.80

Calls 1

millisFunction · 0.85

Tested by

no test coverage detected