This commit is contained in:
hathach committed 2019-01-24 16:37:16 +07:00
1 parent bc36c95133
commit 6dd7918cc9
6 files changed
+13 -19

No files matched your search

+2 -2
View File
@@ -232,7 +232,7 @@ void srp_start(void)
srp.serverM1 = 0;
}
uint8_t srp_setA(uint8_t* abuf, uint16_t length, moretime_t moretime)
uint8_t srp_setA(uint8_t* abuf, uint16_t length, moretime_t moretime, uint16_t conn_hdl)
{
int err_code;
@@ -280,7 +280,7 @@ uint8_t srp_setA(uint8_t* abuf, uint16_t length, moretime_t moretime)
// These calculations take a long time. To avoid the connection dying we ask for more time now.
if (moretime)
{
moretime();
moretime(conn_hdl);
}
{
+2 -2
View File
@@ -36,11 +36,11 @@ extern "C"
extern srp_keys_t srp;
typedef void (*moretime_t)(void);
typedef void (*moretime_t)(uint16_t);
extern void srp_init(void);
extern void srp_start(void);
extern uint8_t srp_setA(uint8_t* a, uint16_t length, moretime_t moretime);
extern uint8_t srp_setA(uint8_t* a, uint16_t length, moretime_t moretime, uint16_t conn_hdl);
extern uint8_t srp_checkM1(uint8_t* m1, uint16_t length);
extern uint8_t* srp_getSalt(void);
extern uint8_t* srp_getB(void);
@@ -105,8 +105,7 @@ static const char* pairing_type_str[] =
void _pair_setup_write_cb (uint16_t conn_hdl, HAPCharacteristic* chr, HAPRequest_t const* hap_req);
void _pair_verify_write_cb (uint16_t conn_hdl, HAPCharacteristic* chr, HAPRequest_t const* hap_req);
// TODO add connection handle parameter
void gatt_reply_now(void)
void gatt_reply_now(uint16_t conn_hdl)
{
ble_gatts_rw_authorize_reply_params_t reply =
{
@@ -118,7 +117,7 @@ void gatt_reply_now(void)
}
}
};
VERIFY_STATUS( sd_ble_gatts_rw_authorize_reply(Bluefruit.connHandle(), &reply), );
VERIFY_STATUS( sd_ble_gatts_rw_authorize_reply(conn_hdl, &reply), );
}
HAPPairing::HAPPairing(void)
@@ -243,7 +242,7 @@ void HAPPairing::pair_setup_m3(uint16_t conn_hdl, HAPRequest_t const* hap_req, T
#endif
// Set iOS public key
srp_setA( (uint8_t*) pubkey.value, pubkey.len, gatt_reply_now);
srp_setA( (uint8_t*) pubkey.value, pubkey.len, gatt_reply_now, conn_hdl);
// Check proof
if ( srp_checkM1( (uint8_t*) proof.value, proof.len) )