Formatting fixes 10/307510/1
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 11 Mar 2024 09:53:40 +0000 (10:53 +0100)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 11 Mar 2024 09:54:12 +0000 (10:54 +0100)
Change-Id: Ie02d3d16f66bf6dc47cc7e573eaf4a35d5f9ed00

srcs/bluetooth_advert.cpp
srcs/handshake.cpp

index cc61ba7355d5c63ba2ffd6df673fb7d96edff419..d02b801e2585adbff8b2ac10a138158102e5fa14 100644 (file)
@@ -134,7 +134,7 @@ int Bluetooth::StartLEAdvertScanAndAwaitStop(CallbackType callback, void *userDa
     m_scanCallback = callback;
     m_scanCallbackUserData = userData;
     // Starting scan can fail for some time just after enabling the adapter, so retry it for 1s
-    constexpr auto SLEEP_PERIOD_US = 10'000;
+    constexpr auto SLEEP_PERIOD_US = 10000;
     for (int i = 0; i < 1'000'000 / SLEEP_PERIOD_US; ++i) {
         err = bt_adapter_le_start_scan(ScanCallback, this);
         if (err == BT_ERROR_OPERATION_FAILED) {
@@ -317,17 +317,18 @@ int BtAdvertScanner::AwaitAdvert(const CryptoBuffer &eidKey, CryptoBuffer &decry
                 assert(innerCryptoData->eidKey.size() == 64);
                 auto serviceDataRaw = reinterpret_cast<const uint8_t *>(serviceData);
                 // Compute HMAC tag.
-                auto hmacKey =
-                    CryptoBuffer(innerCryptoData->eidKey.begin() + 32, innerCryptoData->eidKey.end());
+                auto hmacKey = CryptoBuffer(innerCryptoData->eidKey.begin() + 32,
+                                            innerCryptoData->eidKey.end());
                 auto encryptedAdvert = CryptoBuffer(serviceDataRaw, serviceDataRaw + ADVERT_LEN);
                 auto hmac = Crypto::HmacSha256(hmacKey, encryptedAdvert);
                 // Check if the computed tag matches the advertised tag.
                 auto *encryptedAdvertTag = serviceDataRaw + ADVERT_LEN;
                 if (std::memcmp(hmac.data(), encryptedAdvertTag, ENCRYPTED_ADVERT_TAG_LEN) == 0) {
                     // Tag matches, decrypt.
-                    auto aesKey =
-                        CryptoBuffer(innerCryptoData->eidKey.begin(), innerCryptoData->eidKey.begin() + 32);
-                    innerCryptoData->decryptedAdvert = Crypto::DecryptAes256ECB(aesKey, encryptedAdvert);
+                    auto aesKey = CryptoBuffer(innerCryptoData->eidKey.begin(),
+                                               innerCryptoData->eidKey.begin() + 32);
+                    innerCryptoData->decryptedAdvert =
+                        Crypto::DecryptAes256ECB(aesKey, encryptedAdvert);
                     return IBluetooth::Scanning::STOP;
                 }
             } catch (const std::exception &e) {
index 8fd59beaa3165fc1fa5014cb45c95b05515fae6a..7d8b0c951c36f1db7547821b7eb106647ede798f 100644 (file)
@@ -71,7 +71,7 @@ ProcessedHandshakeResponse processHandshakeResponse(const CryptoBuffer &peerHand
     constexpr size_t p256X962Length = 1 + 32 + 32;
     if (peerHandshakeMessage.size() < p256X962Length)
         THROW_UNKNOWN("invalid handshake response length: " << peerHandshakeMessage.size()
-                                                       << " expected: " << p256X962Length);
+                                                            << " expected: " << p256X962Length);
 
     auto peerPointBytes =
         CryptoBuffer(peerHandshakeMessage.begin(), peerHandshakeMessage.begin() + p256X962Length);