1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include "stack/include/bt_types.h" 18 19 /* Functions below implement cryptographic toolbox, as described in BT Spec 20 * Ver 5.0 | Vol 3, Part H CRYPTOGRAPHIC TOOLBOX. Please see the spec for 21 * description. 22 * 23 * Example of usage is avaliable in cryptographic_toolbox_test.cc */ 24 25 extern Octet16 smp_calculate_f4(uint8_t* u, uint8_t* v, const Octet16& x, 26 uint8_t z); 27 extern uint32_t smp_calculate_g2(uint8_t* u, uint8_t* v, const Octet16& x, 28 const Octet16& y); 29 extern void smp_calculate_f5(uint8_t* w, const Octet16& n1, const Octet16& n2, 30 uint8_t* a1, uint8_t* a2, Octet16* mac_key, 31 Octet16* ltk); 32 extern Octet16 smp_calculate_f6(const Octet16& w, const Octet16& n1, 33 const Octet16& n2, const Octet16& r, 34 uint8_t* iocap, uint8_t* a1, uint8_t* a2); 35 extern Octet16 smp_calculate_h6(const Octet16& w, std::array<uint8_t, 4> keyid); 36 extern Octet16 smp_calculate_h7(const Octet16& salt, const Octet16& w); 37 extern Octet16 smp_calculate_ltk_to_link_key(const Octet16& ltk, bool use_h7); 38 extern Octet16 smp_calculate_link_key_to_ltk(const Octet16& link_key, 39 bool use_h7); 40