sm.c (0a1a2d88e7802e157f2233466f98e9131aef9b2f) | sm.c (7ece0eaa04a64d54ee270d7d31e39198d41ab411) |
---|---|
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 --- 46 unchanged lines hidden (view full) --- 55#include "hci.h" 56#include "hci_dump.h" 57#include "l2cap.h" 58 59#if !defined(ENABLE_LE_PERIPHERAL) && !defined(ENABLE_LE_CENTRAL) 60#error "LE Security Manager used, but neither ENABLE_LE_PERIPHERAL nor ENABLE_LE_CENTRAL defined. Please add at least one to btstack_config.h." 61#endif 62 | 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 --- 46 unchanged lines hidden (view full) --- 55#include "hci.h" 56#include "hci_dump.h" 57#include "l2cap.h" 58 59#if !defined(ENABLE_LE_PERIPHERAL) && !defined(ENABLE_LE_CENTRAL) 60#error "LE Security Manager used, but neither ENABLE_LE_PERIPHERAL nor ENABLE_LE_CENTRAL defined. Please add at least one to btstack_config.h." 61#endif 62 |
63#if defined(ENABLE_CROSS_TRANSPORT_KEY_DERIVATION) && !defined(ENABLE_CLASSIC) 64#error "Cross Transport Key Derivation requires BR/EDR (Classic) support" | 63#if defined(ENABLE_CROSS_TRANSPORT_KEY_DERIVATION) && (!defined(ENABLE_CLASSIC) || !defined(ENABLE_LE_SECURE_CONNECTIONS)) 64#error "Cross Transport Key Derivation requires support for LE Secure Connections and BR/EDR (Classic)" |
65#endif 66 67// assert SM Public Key can be sent/received 68#ifdef ENABLE_LE_SECURE_CONNECTIONS 69#if HCI_ACL_PAYLOAD_SIZE < 69 70#error "HCI_ACL_PAYLOAD_SIZE must be at least 69 bytes when using LE Secure Conection. Please increase HCI_ACL_PAYLOAD_SIZE or disable ENABLE_LE_SECURE_CONNECTIONS" 71#endif 72#endif --- 974 unchanged lines hidden (view full) --- 1047 1048 int flags = SM_KEYDIST_ID_KEY; 1049 if (sm_auth_req & SM_AUTHREQ_BONDING){ 1050 // encryption and signing information only if bonding requested 1051 flags |= SM_KEYDIST_ENC_KEY; 1052#ifdef ENABLE_LE_SIGNED_WRITE 1053 flags |= SM_KEYDIST_SIGN; 1054#endif | 65#endif 66 67// assert SM Public Key can be sent/received 68#ifdef ENABLE_LE_SECURE_CONNECTIONS 69#if HCI_ACL_PAYLOAD_SIZE < 69 70#error "HCI_ACL_PAYLOAD_SIZE must be at least 69 bytes when using LE Secure Conection. Please increase HCI_ACL_PAYLOAD_SIZE or disable ENABLE_LE_SECURE_CONNECTIONS" 71#endif 72#endif --- 974 unchanged lines hidden (view full) --- 1047 1048 int flags = SM_KEYDIST_ID_KEY; 1049 if (sm_auth_req & SM_AUTHREQ_BONDING){ 1050 // encryption and signing information only if bonding requested 1051 flags |= SM_KEYDIST_ENC_KEY; 1052#ifdef ENABLE_LE_SIGNED_WRITE 1053 flags |= SM_KEYDIST_SIGN; 1054#endif |
1055#ifdef ENABLE_CROSS_TRANSPORT_KEY_DERIVATION 1056 // LinkKey for CTKD requires SC 1057 if (sm_auth_req & SM_AUTHREQ_SECURE_CONNECTION){ 1058 flags |= SM_KEYDIST_LINK_KEY; 1059 } 1060#endif |
|
1055 } 1056 return flags; 1057} 1058 1059static void sm_reset_setup(void){ 1060 // fill in sm setup 1061 setup->sm_state_vars = 0; 1062 setup->sm_keypress_notification = 0; --- 3482 unchanged lines hidden --- | 1061 } 1062 return flags; 1063} 1064 1065static void sm_reset_setup(void){ 1066 // fill in sm setup 1067 setup->sm_state_vars = 0; 1068 setup->sm_keypress_notification = 0; --- 3482 unchanged lines hidden --- |