crypto_toolbox.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. #include "stack/include/bt_types.h"
  17. /* Functions below implement cryptographic toolbox, as described in BT Spec
  18. * Ver 5.0 | Vol 3, Part H CRYPTOGRAPHIC TOOLBOX. Please see the spec for
  19. * description.
  20. *
  21. * Example of usage is avaliable in cryptographic_toolbox_test.cc */
  22. extern Octet16 smp_calculate_f4(uint8_t* u, uint8_t* v, const Octet16& x,
  23. uint8_t z);
  24. extern uint32_t smp_calculate_g2(uint8_t* u, uint8_t* v, const Octet16& x,
  25. const Octet16& y);
  26. extern void smp_calculate_f5(uint8_t* w, const Octet16& n1, const Octet16& n2,
  27. uint8_t* a1, uint8_t* a2, Octet16* mac_key,
  28. Octet16* ltk);
  29. extern Octet16 smp_calculate_f6(const Octet16& w, const Octet16& n1,
  30. const Octet16& n2, const Octet16& r,
  31. uint8_t* iocap, uint8_t* a1, uint8_t* a2);
  32. extern Octet16 smp_calculate_h6(const Octet16& w, std::array<uint8_t, 4> keyid);
  33. extern Octet16 smp_calculate_h7(const Octet16& salt, const Octet16& w);
  34. extern Octet16 smp_calculate_ltk_to_link_key(const Octet16& ltk, bool use_h7);
  35. extern Octet16 smp_calculate_link_key_to_ltk(const Octet16& link_key,
  36. bool use_h7);