Skip to content

fix: signed and init field warnings #387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/utility/HCI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void HCIClass::poll(unsigned long timeout)
while (HCITransport.available()) {
byte b = HCITransport.read();

if (_recvIndex >= sizeof(_recvBuffer)) {
if (_recvIndex >= (int)sizeof(_recvBuffer)) {
_recvIndex = 0;
if (_debug) {
_debug->println("_recvBuffer overflow");
Expand Down Expand Up @@ -461,6 +461,8 @@ int HCIClass::leConnUpdate(uint16_t handle, uint16_t minInterval, uint16_t maxIn
return sendCommand(OGF_LE_CTL << 10 | OCF_LE_CONN_UPDATE, sizeof(leConnUpdateData), &leConnUpdateData);
}
void HCIClass::saveNewAddress(uint8_t addressType, uint8_t* address, uint8_t* peerIrk, uint8_t* localIrk){
(void)addressType;
(void)localIrk;
if(_storeIRK!=0){
_storeIRK(address, peerIrk);
}
Expand Down Expand Up @@ -503,6 +505,7 @@ int HCIClass::leStartResolvingAddresses(){
return HCI.sendCommand(OGF_LE_CTL << 10 | 0x2D, 1,&enable); // Disable address resolution
}
int HCIClass::leReadPeerResolvableAddress(uint8_t peerAddressType, uint8_t* peerIdentityAddress, uint8_t* peerResolvableAddress){
(void)peerResolvableAddress;
struct __attribute__ ((packed)) Request {
uint8_t addressType;
uint8_t identityAddress[6];
Expand Down Expand Up @@ -546,7 +549,7 @@ int HCIClass::readStoredLK(uint8_t BD_ADDR[], uint8_t read_all ){
struct __attribute__ ((packed)) Request {
uint8_t BD_ADDR[6];
uint8_t read_a;
} request = {0,0};
} request = {{0},0};
for(int i=0; i<6; i++) request.BD_ADDR[5-i] = BD_ADDR[i];
request.read_a = read_all;
return sendCommand(OGF_HOST_CTL << 10 | 0xD, sizeof(request), &request);
Expand Down Expand Up @@ -1268,7 +1271,7 @@ void HCIClass::handleEventPkt(uint8_t /*plen*/, uint8_t pdata[])
uint8_t U[32];
uint8_t V[32];
uint8_t Z;
} f4Params = {0,0,Z};
} f4Params = {{0},{0},Z};
for(int i=0; i<32; i++){
f4Params.U[31-i] = pairingPublicKey.publicKey[i];
f4Params.V[31-i] = HCI.remotePublicKeyBuffer[i];
Expand All @@ -1288,7 +1291,7 @@ void HCIClass::handleEventPkt(uint8_t /*plen*/, uint8_t pdata[])
#endif

uint8_t cb_temp[sizeof(pairingConfirm.cb)];
for(int i=0; i<sizeof(pairingConfirm.cb);i++){
for(unsigned int i=0; i<sizeof(pairingConfirm.cb);i++){
cb_temp[sizeof(pairingConfirm.cb)-1-i] = pairingConfirm.cb[i];
}
/// cb wa back to front.
Expand Down Expand Up @@ -1372,11 +1375,12 @@ void HCIClass::handleEventPkt(uint8_t /*plen*/, uint8_t pdata[])
}
}
int HCIClass::leEncrypt(uint8_t* key, uint8_t* plaintext, uint8_t* status, uint8_t* ciphertext){
(void)status;
struct __attribute__ ((packed)) LeEncryptCommand
{
uint8_t key[16];
uint8_t plaintext[16];
} leEncryptCommand = {0,0};
} leEncryptCommand = {{0},{0}};
for(int i=0; i<16; i++){
leEncryptCommand.key[15-i] = key[i];
leEncryptCommand.plaintext[15-i] = plaintext[i];
Expand Down
6 changes: 4 additions & 2 deletions src/utility/L2CAPSignaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ void L2CAPSignalingClass::handleSecurityData(uint16_t connectionHandle, uint8_t
#ifdef _BLE_TRACE_
Serial.print("dlen: ");
Serial.println(dlen);
#else
(void)dlen;
#endif
uint8_t code = l2capSignalingHdr->code;

Expand Down Expand Up @@ -310,8 +312,8 @@ void L2CAPSignalingClass::handleSecurityData(uint16_t connectionHandle, uint8_t
uint8_t x[32];
uint8_t y[32];
} generateDHKeyCommand = {
0x00,
0x00,
{0x00},
{0x00},
};
memcpy(generateDHKeyCommand.x,connectionPairingPublicKey->x,32);
memcpy(generateDHKeyCommand.y,connectionPairingPublicKey->y,32);
Expand Down
6 changes: 3 additions & 3 deletions src/utility/btct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int BluetoothCryptoToolbox::f5(uint8_t DHKey[],uint8_t N_master[], uint8_t N_sla
uint8_t A1[7];
uint8_t A2[7];
uint8_t length[2];
} cmacInput = {0,0,0,0,0,0,0};
} cmacInput = {0,{0},{0},{0},{0},{0},{0}};
cmacInput.counter = 0;
memcpy(cmacInput.keyID, keyID, 4);
memcpy(cmacInput.N1,N_master,16);
Expand All @@ -97,7 +97,7 @@ int BluetoothCryptoToolbox::f6(uint8_t W[], uint8_t N1[],uint8_t N2[],uint8_t R[
uint8_t IOCap[3];
uint8_t A1[7];
uint8_t A2[7];
} f6Input = {0,0,0,0,0,0};
} f6Input = {{0},{0},{0},{0},{0},{0}};

memcpy(f6Input.N1, N1, 16);
memcpy(f6Input.N2, N2, 16);
Expand Down Expand Up @@ -145,7 +145,7 @@ int BluetoothCryptoToolbox::g2(uint8_t U[], uint8_t V[], uint8_t X[], uint8_t Y[
uint8_t U[32];
uint8_t V[32];
uint8_t Y[16];
} cmacInput= {0,0,0};
} cmacInput= {{0},{0},{0}};
memcpy(cmacInput.U,U,32);
memcpy(cmacInput.V,V,32);
memcpy(cmacInput.Y,Y,16);
Expand Down