sm.c (8b3ffec5c933068b9ea632385ab6f80d1a7ed022) | sm.c (e061bbd4478b802bef6db7dded174d91e3a2cd1e) |
---|---|
1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 3445 unchanged lines hidden (view full) --- 3454 // Initiator 3455 case SM_INITIATOR_CONNECTED: 3456 if ((sm_pdu_code != SM_CODE_SECURITY_REQUEST) || (sm_conn->sm_role)){ 3457 sm_pdu_received_in_wrong_state(sm_conn); 3458 break; 3459 } 3460 3461 // IRK complete? | 1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 3445 unchanged lines hidden (view full) --- 3454 // Initiator 3455 case SM_INITIATOR_CONNECTED: 3456 if ((sm_pdu_code != SM_CODE_SECURITY_REQUEST) || (sm_conn->sm_role)){ 3457 sm_pdu_received_in_wrong_state(sm_conn); 3458 break; 3459 } 3460 3461 // IRK complete? |
3462 int have_ltk; 3463 uint8_t ltk[16]; |
|
3462 switch (sm_conn->sm_irk_lookup_state){ 3463 case IRK_LOOKUP_FAILED: | 3464 switch (sm_conn->sm_irk_lookup_state){ 3465 case IRK_LOOKUP_FAILED: |
3464 case IRK_LOOKUP_SUCCEEDED: | |
3465 sm_conn->sm_engine_state = SM_INITIATOR_PH1_W2_SEND_PAIRING_REQUEST; 3466 break; | 3466 sm_conn->sm_engine_state = SM_INITIATOR_PH1_W2_SEND_PAIRING_REQUEST; 3467 break; |
3468 case IRK_LOOKUP_SUCCEEDED: 3469 le_device_db_encryption_get(sm_conn->sm_le_db_index, NULL, NULL, ltk, NULL, NULL, NULL, NULL); 3470 have_ltk = !sm_is_null_key(ltk); 3471 log_info("central: security request - have_ltk %u", have_ltk); 3472 if (have_ltk){ 3473 sm_conn->sm_engine_state = SM_INITIATOR_PH0_HAS_LTK; 3474 } else { 3475 sm_conn->sm_engine_state = SM_INITIATOR_PH1_W2_SEND_PAIRING_REQUEST; 3476 } 3477 break; |
|
3467 default: 3468 break; 3469 } 3470 3471 // otherwise, store security request 3472 sm_conn->sm_security_request_received = 1; 3473 break; 3474 --- 866 unchanged lines hidden --- | 3478 default: 3479 break; 3480 } 3481 3482 // otherwise, store security request 3483 sm_conn->sm_security_request_received = 1; 3484 break; 3485 --- 866 unchanged lines hidden --- |