btstack_crypto.c (b45b7749fd0a3efec18073ae84f893078d0216d0) btstack_crypto.c (20eba63f8a48ade11cd6ec7ad52fcce3f748a606)
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

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

1165
1166void btstack_crypto_init(void){
1167 if (btstack_crypto_initialized) return;
1168 btstack_crypto_initialized = true;
1169
1170 // register with HCI
1171 hci_event_callback_registration.callback = &btstack_crypto_event_handler;
1172 hci_add_event_handler(&hci_event_callback_registration);
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

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

1165
1166void btstack_crypto_init(void){
1167 if (btstack_crypto_initialized) return;
1168 btstack_crypto_initialized = true;
1169
1170 // register with HCI
1171 hci_event_callback_registration.callback = &btstack_crypto_event_handler;
1172 hci_add_event_handler(&hci_event_callback_registration);
1173
1173#ifndef USE_BTSTACK_AES128
1174 btstack_crypto_cmac_state = CMAC_IDLE;
1175#endif
1176#ifdef ENABLE_ECC_P256
1177 btstack_crypto_ecc_p256_key_generation_state = ECC_P256_KEY_GENERATION_IDLE;
1178#endif
1174#ifdef USE_MBEDTLS_ECC_P256
1175 mbedtls_ecp_group_init(&mbedtls_ec_group);
1176 mbedtls_ecp_group_load(&mbedtls_ec_group, MBEDTLS_ECP_DP_SECP256R1);
1177#endif
1178}
1179
1180void btstack_crypto_random_generate(btstack_crypto_random_t * request, uint8_t * buffer, uint16_t size, void (* callback)(void * arg), void * callback_arg){
1181 request->btstack_crypto.context_callback.callback = callback;

--- 196 unchanged lines hidden ---
1179#ifdef USE_MBEDTLS_ECC_P256
1180 mbedtls_ecp_group_init(&mbedtls_ec_group);
1181 mbedtls_ecp_group_load(&mbedtls_ec_group, MBEDTLS_ECP_DP_SECP256R1);
1182#endif
1183}
1184
1185void btstack_crypto_random_generate(btstack_crypto_random_t * request, uint8_t * buffer, uint16_t size, void (* callback)(void * arg), void * callback_arg){
1186 request->btstack_crypto.context_callback.callback = callback;

--- 196 unchanged lines hidden ---