From 2a8591f166216f8f90f0a05a73a466b15c0bb2a0 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Thu, 17 Apr 2025 11:30:02 +0200 Subject: [PATCH] fix: unused variable warnings Signed-off-by: Frederic Pillon --- src/utility/HCI.cpp | 4 +--- src/utility/btct.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/utility/HCI.cpp b/src/utility/HCI.cpp index af73ead2..ebe66a27 100644 --- a/src/utility/HCI.cpp +++ b/src/utility/HCI.cpp @@ -521,19 +521,17 @@ int HCIClass::leReadPeerResolvableAddress(uint8_t peerAddressType, uint8_t* peer #ifdef _BLE_TRACE_ Serial.print("res: 0x"); Serial.println(res, HEX); -#endif if(res==0){ struct __attribute__ ((packed)) Response { uint8_t status; uint8_t peerResolvableAddress[6]; } *response = (Response*)_cmdResponse; -#ifdef _BLE_TRACE_ Serial.print("Address resolution status: 0x"); Serial.println(response->status, HEX); Serial.print("peer resolvable address: "); btct.printBytes(response->peerResolvableAddress,6); -#endif } + #endif return res; } diff --git a/src/utility/btct.cpp b/src/utility/btct.cpp index 77a5e818..0a84dd50 100644 --- a/src/utility/btct.cpp +++ b/src/utility/btct.cpp @@ -37,6 +37,9 @@ void BluetoothCryptoToolbox::printBytes(uint8_t bytes[], uint8_t length){ Serial.print(bytes[i],HEX); } Serial.print('\n'); +#else + (void)bytes; + (void)length; #endif } @@ -130,7 +133,7 @@ int BluetoothCryptoToolbox::ah(uint8_t k[16], uint8_t r[3], uint8_t* result) } void BluetoothCryptoToolbox::testAh() { - uint8_t irk[16] = {0xec,0x02,0x34,0xa3,0x57,0xc8,0xad,0x05,0x34,0x10,0x10,0xa6,0x0a,0x39,0x7d,0x9b}; + uint8_t irk[16] = {0xec,0x02,0x34,0xa3,0x57,0xc8,0xad,0x05,0x34,0x10,0x10,0xa6,0x0a,0x39,0x7d,0x9b}; uint8_t expected_final[3] = {0x0d,0xfb,0xaa}; uint8_t ourResult[3]; ah(irk, expected_final, ourResult); @@ -165,14 +168,12 @@ void BluetoothCryptoToolbox::testg2(){ uint8_t Y[16] = {0xa6,0xe8,0xe7,0xcc,0x25,0xa7,0x5f,0x6e,0x21,0x65,0x83,0xf7,0xff,0x3d,0xc4,0xcf}; uint8_t out[4]; - uint32_t expected = 0; g2(U,V,X,Y,out); uint32_t result = 0; for(int i=0; i<4; i++) result += out[i] << 8*i; #ifdef _BLE_TRACE_ - Serial.print("Expected : "); - Serial.println(expected); + Serial.println("Expected : 0"); Serial.print("Result : "); Serial.println(result); Serial.println(); @@ -383,4 +384,4 @@ void BluetoothCryptoToolbox::xor_128(unsigned char *a, unsigned char *b, unsigne out[i] = a[i] ^ b[i]; } } -BluetoothCryptoToolbox btct; \ No newline at end of file +BluetoothCryptoToolbox btct;