sm.c (47ba4de1cece6f3b78cfb12690dda1430ca8a4f9) sm.c (aacfafc3aca3af89dc6537f728b4be2024e8251c)
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

--- 3263 unchanged lines hidden (view full) ---

3272 break;
3273 }
3274
3275 // otherwise, store security request
3276 sm_conn->sm_security_request_received = 1;
3277 break;
3278
3279 case SM_INITIATOR_PH1_W4_PAIRING_RESPONSE:
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

--- 3263 unchanged lines hidden (view full) ---

3272 break;
3273 }
3274
3275 // otherwise, store security request
3276 sm_conn->sm_security_request_received = 1;
3277 break;
3278
3279 case SM_INITIATOR_PH1_W4_PAIRING_RESPONSE:
3280 // Core 5, Vol 3, Part H, 2.4.6:
3281 // "The master shall ignore the slave’s Security Request if the master has sent a Pairing Request
3282 // without receiving a Pairing Response from the slave or if the master has initiated encryption mode setup."
3283 if (sm_pdu_code == SM_CODE_SECURITY_REQUEST){
3284 log_info("Ignoring Security Request");
3285 break;
3286 }
3287
3288 // all other pdus are incorrect
3280 if (sm_pdu_code != SM_CODE_PAIRING_RESPONSE){
3281 sm_pdu_received_in_wrong_state(sm_conn);
3282 break;
3283 }
3284
3285 // store pairing request
3286 memcpy(&setup->sm_s_pres, packet, sizeof(sm_pairing_packet_t));
3287 err = sm_stk_generation_init(sm_conn);

--- 831 unchanged lines hidden ---
3289 if (sm_pdu_code != SM_CODE_PAIRING_RESPONSE){
3290 sm_pdu_received_in_wrong_state(sm_conn);
3291 break;
3292 }
3293
3294 // store pairing request
3295 memcpy(&setup->sm_s_pres, packet, sizeof(sm_pairing_packet_t));
3296 err = sm_stk_generation_init(sm_conn);

--- 831 unchanged lines hidden ---