btstack_crypto.c (5db50aaad5b1b50d3f0645b052ed20baebdd39f3) btstack_crypto.c (0c23bea1f51cb1a155c3521a81dea6558637ba2d)
1/*
2 * Copyright (C) 2017 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

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

939#ifndef USE_SOFTWARE_ECC_P256_IMPLEMENTATION
940 btstack_crypto_ecc_p256_t * btstack_crypto_ec_p192;
941#endif
942#endif
943
944 if (packet_type != HCI_EVENT_PACKET) return;
945
946 switch (hci_event_packet_get_type(packet)){
1/*
2 * Copyright (C) 2017 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

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

939#ifndef USE_SOFTWARE_ECC_P256_IMPLEMENTATION
940 btstack_crypto_ecc_p256_t * btstack_crypto_ec_p192;
941#endif
942#endif
943
944 if (packet_type != HCI_EVENT_PACKET) return;
945
946 switch (hci_event_packet_get_type(packet)){
947 case BTSTACK_EVENT_STATE:
948 log_info("BTSTACK_EVENT_STATE");
949 if (btstack_event_state_get_state(packet) != HCI_STATE_HALTING) break;
950 if (!btstack_crypto_wait_for_hci_result) break;
951 // request stack to defer shutdown a bit
952 hci_halting_defer();
953 break;
954
947 case HCI_EVENT_COMMAND_COMPLETE:
948 if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_le_encrypt)){
949 if (hci_get_state() != HCI_STATE_WORKING) return;
950 if (!btstack_crypto_wait_for_hci_result) return;
951 btstack_crypto_wait_for_hci_result = 0;
952 btstack_crypto_handle_encryption_result(&packet[6]);
953 }
954 if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_le_rand)){

--- 247 unchanged lines hidden ---
955 case HCI_EVENT_COMMAND_COMPLETE:
956 if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_le_encrypt)){
957 if (hci_get_state() != HCI_STATE_WORKING) return;
958 if (!btstack_crypto_wait_for_hci_result) return;
959 btstack_crypto_wait_for_hci_result = 0;
960 btstack_crypto_handle_encryption_result(&packet[6]);
961 }
962 if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_le_rand)){

--- 247 unchanged lines hidden ---