sec_crypto_ecdh.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (C) 2017-2022 Alibaba Group Holding Limited
  3. */
  4. /******************************************************************************
  5. * @file sec_crypto_ecdh.h
  6. * @brief Header File for curve25519( a state-of-the-art Diffie-Hellman function)
  7. * @version V3.3
  8. * @date 10. June 2022
  9. * @model ecdh
  10. ******************************************************************************/
  11. #ifndef _SC_ECDH_H_
  12. #define _SC_ECDH_H_
  13. #include "sec_include_config.h"
  14. #define CONFIG_SEC_CRYPTO_ECC
  15. #ifdef CONFIG_SEC_CRYPTO_ECC
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. #ifdef SEC_LIB_VERSION
  20. #include "drv/ecdh.h"
  21. #include "drv/ecc.h"
  22. #include "sec_crypto_ecc.h"
  23. #else
  24. #include "ecdh.h"
  25. #include "ecc.h"
  26. #include "sec_crypto_ecc.h"
  27. #endif
  28. /**
  29. \brief ecdh calc secret
  30. \param[in] ecc ecc handle to operate.
  31. \param[in] pubkey Pointer to the A(or B) public key.
  32. \param[out] privkey Pointer to the B(or A) private key.
  33. \param[out] out Pointer to the share secret.
  34. \param[out] len length of the share secret.
  35. \return \ref uint32_t.
  36. */
  37. uint32_t sc_ecdh_calc_secret(sc_ecc_t *ecc, uint8_t privkey[32],
  38. uint8_t pubkey[65], uint8_t out[32],
  39. uint32_t *len, sc_ecc_curve_type type) ;
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. #endif
  44. #endif /* _SC_CURVE15519_H_ */