Skip to content

Commit

Permalink
build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kpschoedel committed Jul 10, 2021
1 parent ef55256 commit 262f8ce
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
16 changes: 8 additions & 8 deletions src/crypto/hsm/nxp/CHIPCryptoPALHsm_SE05X_Spake2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,18 +314,18 @@ CHIP_ERROR Spake2pHSM_P256_SHA256_HKDF_HMAC::BeginVerifier(const uint8_t * my_id
#if SSS_HAVE_SE05X_VER_GTE_16_02
smstatus = Se05x_API_PAKEConfigDevice(&((sss_se05x_session_t *) &gex_sss_chip_ctx.session)->s_ctx, SE05x_SPAKEDevice_B,
hsm_pake_context.spake_objId);
VerifyOrReturnError(smstatus == SM_OK, ChipError::Encapsulate(ChipError::Range::kSe05x, smstatus));
VerifyOrReturnError(smstatus == SM_OK, chip::ChipError::Encapsulate(chip::ChipError::Range::kSe05x, smstatus));

smstatus = Se05x_API_PAKEInitDevice(&((sss_se05x_session_t *) &gex_sss_chip_ctx.session)->s_ctx, hsm_pake_context.spake_objId,
(uint8_t *) hsm_pake_context.spake_context, hsm_pake_context.spake_context_len,
(uint8_t *) peer_identity, peer_identity_len, (uint8_t *) my_identity, my_identity_len);
VerifyOrReturnError(smstatus == SM_OK, ChipError::Encapsulate(ChipError::Range::kSe05x, smstatus));
VerifyOrReturnError(smstatus == SM_OK, chip::ChipError::Encapsulate(chip::ChipError::Range::kSe05x, smstatus));
#else
smstatus = Se05x_API_PAKEConfigDevice(&((sss_se05x_session_t *) &gex_sss_chip_ctx.session)->s_ctx, SE05x_SPAKEDevice_B,
hsm_pake_context.spake_objId, (uint8_t *) hsm_pake_context.spake_context,
hsm_pake_context.spake_context_len, (uint8_t *) peer_identity, peer_identity_len,
(uint8_t *) my_identity, my_identity_len);
VerifyOrReturnError(smstatus == SM_OK, ChipError::Encapsulate(ChipError::Range::kSe05x, smstatus));
VerifyOrReturnError(smstatus == SM_OK, chip::ChipError::Encapsulate(chip::ChipError::Range::kSe05x, smstatus));
#endif

ReturnErrorOnFailure(se05x_set_key(w0in_id_v, w0in_mod, w0in_mod_len, kSSS_KeyPart_Default, kSSS_CipherType_AES));
Expand All @@ -338,7 +338,7 @@ CHIP_ERROR Spake2pHSM_P256_SHA256_HKDF_HMAC::BeginVerifier(const uint8_t * my_id
smstatus = Se05x_API_PAKEInitDevice(&((sss_se05x_session_t *) &gex_sss_chip_ctx.session)->s_ctx, hsm_pake_context.spake_objId,
w0in_id_v, 0, Lin_id_v);
#endif
VerifyOrReturnError(smstatus == SM_OK, ChipError::Encapsulate(ChipError::Range::kSe05x, smstatus));
VerifyOrReturnError(smstatus == SM_OK, chip::ChipError::Encapsulate(chip::ChipError::Range::kSe05x, smstatus));

state = CHIP_SPAKE2P_STATE::STARTED;
role = CHIP_SPAKE2P_ROLE::VERIFIER;
Expand Down Expand Up @@ -388,18 +388,18 @@ CHIP_ERROR Spake2pHSM_P256_SHA256_HKDF_HMAC::BeginProver(const uint8_t * my_iden
#if SSS_HAVE_SE05X_VER_GTE_16_02
smstatus = Se05x_API_PAKEConfigDevice(&((sss_se05x_session_t *) &gex_sss_chip_ctx.session)->s_ctx, SE05x_SPAKEDevice_A,
hsm_pake_context.spake_objId);
VerifyOrReturnError(smstatus == SM_OK, ChipError::Encapsulate(ChipError::Range::kSe05x, smstatus));
VerifyOrReturnError(smstatus == SM_OK, chip::ChipError::Encapsulate(chip::ChipError::Range::kSe05x, smstatus));

smstatus = Se05x_API_PAKEInitDevice(&((sss_se05x_session_t *) &gex_sss_chip_ctx.session)->s_ctx, hsm_pake_context.spake_objId,
(uint8_t *) hsm_pake_context.spake_context, hsm_pake_context.spake_context_len,
(uint8_t *) my_identity, my_identity_len, (uint8_t *) peer_identity, peer_identity_len);
VerifyOrReturnError(smstatus == SM_OK, ChipError::Encapsulate(ChipError::Range::kSe05x, smstatus));
VerifyOrReturnError(smstatus == SM_OK, chip::ChipError::Encapsulate(chip::ChipError::Range::kSe05x, smstatus));
#else
smstatus = Se05x_API_PAKEConfigDevice(&((sss_se05x_session_t *) &gex_sss_chip_ctx.session)->s_ctx, SE05x_SPAKEDevice_A,
hsm_pake_context.spake_objId, (uint8_t *) hsm_pake_context.spake_context,
hsm_pake_context.spake_context_len, (uint8_t *) peer_identity, peer_identity_len,
(uint8_t *) my_identity, my_identity_len);
VerifyOrReturnError(smstatus == SM_OK, ChipError::Encapsulate(ChipError::Range::kSe05x, smstatus));
VerifyOrReturnError(smstatus == SM_OK, chip::ChipError::Encapsulate(chip::ChipError::Range::kSe05x, smstatus));
#endif

ReturnErrorOnFailure(se05x_set_key(w0in_id_p, w0in_mod, w0in_mod_len, kSSS_KeyPart_Default, kSSS_CipherType_AES));
Expand All @@ -412,7 +412,7 @@ CHIP_ERROR Spake2pHSM_P256_SHA256_HKDF_HMAC::BeginProver(const uint8_t * my_iden
smstatus = Se05x_API_PAKEInitDevice(&((sss_se05x_session_t *) &gex_sss_chip_ctx.session)->s_ctx, hsm_pake_context.spake_objId,
w0in_id_p, w1in_id_p, 0);
#endif
VerifyOrReturnError(smstatus == SM_OK, ChipError::Encapsulate(ChipError::Range::kSe05x, smstatus));
VerifyOrReturnError(smstatus == SM_OK, chip::ChipError::Encapsulate(chip::ChipError::Range::kSe05x, smstatus));

state = CHIP_SPAKE2P_STATE::STARTED;
role = CHIP_SPAKE2P_ROLE::PROVER;
Expand Down
26 changes: 13 additions & 13 deletions src/platform/mbed/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ CHIP_ERROR BLEManagerImpl::_Init()
mbed_err = ble_interface.init([](ble::BLE::InitializationCompleteCallbackContext * context) {
BLEMgrImpl().HandleInitComplete(context->error == BLE_ERROR_NONE);
});
VerifyOrReturnError(mbed_err == BLE_ERROR_NONE, ChipError::Encapsulate(ChipError::Range::OS, mbed_err));
VerifyOrReturnError(mbed_err == BLE_ERROR_NONE, chip::ChipError::Encapsulate(chip::ChipError::Range::OS, mbed_err));

return CHIP_NO_ERROR;
}
Expand Down Expand Up @@ -621,10 +621,10 @@ void BLEManagerImpl::HandleInitComplete(bool no_error)
/*const Passkey_t passkey */ nullptr,
/*bool signing */ true,
/*const char *dbFilepath */ nullptr);
VerifyOrExit(mbed_err == BLE_ERROR_NONE, ChipError::Encapsulate(ChipError::Range::OS, mbed_err));
VerifyOrExit(mbed_err == BLE_ERROR_NONE, chip::ChipError::Encapsulate(chip::ChipError::Range::OS, mbed_err));

mbed_err = security_mgr.setPairingRequestAuthorisation(true);
VerifyOrExit(mbed_err == BLE_ERROR_NONE, err = ChipError::Encapsulate(ChipError::Range::OS, mbed_err));
VerifyOrExit(mbed_err == BLE_ERROR_NONE, err = chip::ChipError::Encapsulate(chip::ChipError::Range::OS, mbed_err));
security_mgr.setSecurityManagerEventHandler(&sSecurityManagerEventHandler);

err = BleLayer::Init(this, this, &SystemLayer);
Expand Down Expand Up @@ -751,16 +751,16 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
if (gap.isAdvertisingActive(ble::LEGACY_ADVERTISING_HANDLE))
{
mbed_err = gap.stopAdvertising(ble::LEGACY_ADVERTISING_HANDLE);
VerifyOrExit(mbed_err == BLE_ERROR_NONE, err = ChipError::Encapsulate(ChipError::Range::OS, mbed_err));
VerifyOrExit(mbed_err == BLE_ERROR_NONE, err = chip::ChipError::Encapsulate(chip::ChipError::Range::OS, mbed_err));
ChipLogDetail(DeviceLayer, "Advertising already active. Restarting.");
}

mbed_err = gap.setAdvertisingParameters(ble::LEGACY_ADVERTISING_HANDLE, adv_params);
VerifyOrExit(mbed_err == BLE_ERROR_NONE, err = ChipError::Encapsulate(ChipError::Range::OS, mbed_err));
VerifyOrExit(mbed_err == BLE_ERROR_NONE, err = chip::ChipError::Encapsulate(chip::ChipError::Range::OS, mbed_err));

mbed_err =
adv_data_builder.setFlags(ble::adv_data_flags_t::BREDR_NOT_SUPPORTED | ble::adv_data_flags_t::LE_GENERAL_DISCOVERABLE);
VerifyOrExit(mbed_err == BLE_ERROR_NONE, err = ChipError::Encapsulate(ChipError::Range::OS, mbed_err));
VerifyOrExit(mbed_err == BLE_ERROR_NONE, err = chip::ChipError::Encapsulate(chip::ChipError::Range::OS, mbed_err));

if (!mFlags.Has(kFlag_UseCustomDeviceName))
{
Expand All @@ -770,24 +770,24 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
snprintf(mDeviceName, kMaxDeviceNameLength, "%s%04u", CHIP_DEVICE_CONFIG_BLE_DEVICE_NAME_PREFIX, discriminator);
}
mbed_err = adv_data_builder.setName(mDeviceName);
VerifyOrExit(mbed_err == BLE_ERROR_NONE, err = ChipError::Encapsulate(ChipError::Range::OS, mbed_err));
VerifyOrExit(mbed_err == BLE_ERROR_NONE, err = chip::ChipError::Encapsulate(chip::ChipError::Range::OS, mbed_err));

dev_id_info.Init();
SuccessOrExit(ConfigurationMgr().GetBLEDeviceIdentificationInfo(dev_id_info));
mbed_err = adv_data_builder.setServiceData(
ShortUUID_CHIPoBLEService, mbed::make_Span<const uint8_t>(reinterpret_cast<uint8_t *>(&dev_id_info), sizeof dev_id_info));
VerifyOrExit(mbed_err == BLE_ERROR_NONE, err = ChipError::Encapsulate(ChipError::Range::OS, mbed_err));
VerifyOrExit(mbed_err == BLE_ERROR_NONE, err = chip::ChipError::Encapsulate(chip::ChipError::Range::OS, mbed_err));

mbed_err = gap.setAdvertisingPayload(ble::LEGACY_ADVERTISING_HANDLE, adv_data_builder.getAdvertisingData());
VerifyOrExit(mbed_err == BLE_ERROR_NONE, err = ChipError::Encapsulate(ChipError::Range::OS, mbed_err));
VerifyOrExit(mbed_err == BLE_ERROR_NONE, err = chip::ChipError::Encapsulate(chip::ChipError::Range::OS, mbed_err));

adv_data_builder.clear();
adv_data_builder.setLocalServiceList(mbed::make_Span<const UUID>(&ShortUUID_CHIPoBLEService, 1));
mbed_err = gap.setAdvertisingScanResponse(ble::LEGACY_ADVERTISING_HANDLE, adv_data_builder.getAdvertisingData());
VerifyOrExit(mbed_err == BLE_ERROR_NONE, err = ChipError::Encapsulate(ChipError::Range::OS, mbed_err));
VerifyOrExit(mbed_err == BLE_ERROR_NONE, err = chip::ChipError::Encapsulate(chip::ChipError::Range::OS, mbed_err));

mbed_err = gap.startAdvertising(ble::LEGACY_ADVERTISING_HANDLE);
VerifyOrExit(mbed_err == BLE_ERROR_NONE, ChipError::Encapsulate(ChipError::Range::OS, mbed_err));
VerifyOrExit(mbed_err == BLE_ERROR_NONE, chip::ChipError::Encapsulate(chip::ChipError::Range::OS, mbed_err));

ChipLogDetail(DeviceLayer, "Advertising started, type: 0x%x (%sconnectable), interval: [%lu:%lu] ms, device name: %s)",
adv_params.getType().value(), connectable ? "" : "non-", adv_params.getMinPrimaryInterval().valueInMs(),
Expand All @@ -814,7 +814,7 @@ CHIP_ERROR BLEManagerImpl::StopAdvertising(void)
return err;
}
mbed_err = gap.stopAdvertising(ble::LEGACY_ADVERTISING_HANDLE);
VerifyOrExit(mbed_err == BLE_ERROR_NONE, ChipError::Encapsulate(ChipError::Range::OS, mbed_err));
VerifyOrExit(mbed_err == BLE_ERROR_NONE, chip::ChipError::Encapsulate(chip::ChipError::Range::OS, mbed_err));

exit:
if (mbed_err != BLE_ERROR_NONE)
Expand Down Expand Up @@ -1028,7 +1028,7 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU
conId, att_handle, pBuf->DataLength());

mbed_err = gatt_server.write(att_handle, pBuf->Start(), pBuf->DataLength(), false);
VerifyOrExit(mbed_err == BLE_ERROR_NONE, ChipError::Encapsulate(ChipError::Range::OS, mbed_err));
VerifyOrExit(mbed_err == BLE_ERROR_NONE, chip::ChipError::Encapsulate(chip::ChipError::Range::OS, mbed_err));

exit:
if (mbed_err != BLE_ERROR_NONE)
Expand Down

0 comments on commit 262f8ce

Please sign in to comment.