ecdh.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (C) 2017-2022 Alibaba Group Holding Limited
  3. */
  4. /******************************************************************************
  5. * @file drv/ecdh.h
  6. * @brief Header File for ECDH Driver
  7. * @version V3.3
  8. * @date 10.June 2022
  9. * @model ECC
  10. ******************************************************************************/
  11. #ifndef _DRV_ECDH_H_
  12. #define _DRV_ECDH_H_
  13. #include <stdint.h>
  14. #include "common.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #define CSI_ECDH_PUBKEY_LEN (65-1)
  19. #define CSI_ECDH_PRIVKEY_LEN (32)
  20. #define CSI_ECDH_SHARE_LEN (64)
  21. #define CSI_ECDH_SHAREKEY_LEN (32)
  22. /**
  23. \brief ecdh cacl share secret
  24. \param[in] ecc ecc handle to operate.
  25. \param[in] pubkey Pointer to the A public key.
  26. \param[in] prikey Pointer to the B private key.
  27. \param[out] shareKey Pointer to the share secret.
  28. \param[out] len length of the share secret.
  29. \return Error code \ref csi_error_t
  30. */
  31. csi_error_t csi_ecdh_calc_secret(csi_ecc_t *ecc, uint8_t privkey[32], uint8_t pubkey[65], uint8_t shareKey[32], uint32_t *len);
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. #endif