File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
features/FEATURE_BLE/targets/TARGET_CORDIO/source Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -478,15 +478,17 @@ bool CordioSecurityManager::sm_handler(const wsfMsgHdr_t* msg) {
478
478
);
479
479
DmSecAuthRsp (
480
480
connection,
481
- 3 ,
481
+ /* data length */ SMP_PIN_LEN ,
482
482
reinterpret_cast <uint8_t *>(&(get_security_manager ()._default_passkey ))
483
483
);
484
484
} else {
485
- // FIXME: generate a random passkey
486
- passkey_num_t passkey = 0x00654321 ;
485
+ /* generate random passkey, limit to 6 digit max */
486
+ passkey_num_t passkey;
487
+ SecRand ((uint8_t *) &passkey, sizeof (passkey));
488
+ passkey %= 1000000 ;
487
489
handler->on_passkey_display (connection, passkey);
488
490
DmSecAuthRsp (
489
- connection, 3 , reinterpret_cast <uint8_t *>(&passkey)
491
+ connection, SMP_PIN_LEN , reinterpret_cast <uint8_t *>(&passkey)
490
492
);
491
493
}
492
494
} else {
You can’t perform that action at this time.
0 commit comments