You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

secp256k1_ecdh.h 1.0KB

12345678910111213141516171819202122232425262728293031
  1. #ifndef SECP256K1_ECDH_H
  2. #define SECP256K1_ECDH_H
  3. #include "secp256k1.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /** Compute an EC Diffie-Hellman secret in constant time
  8. * Returns: 1: exponentiation was successful
  9. * 0: scalar was invalid (zero or overflow)
  10. * Args: ctx: pointer to a context object (cannot be NULL)
  11. * Out: result: a 32-byte array which will be populated by an ECDH
  12. * secret computed from the point and scalar
  13. * In: pubkey: a pointer to a secp256k1_pubkey containing an
  14. * initialized public key
  15. * privkey: a 32-byte scalar with which to multiply the point
  16. */
  17. SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdh(
  18. const secp256k1_context* ctx,
  19. unsigned char *result,
  20. const secp256k1_pubkey *pubkey,
  21. const unsigned char *privkey
  22. ) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4);
  23. #ifdef __cplusplus
  24. }
  25. #endif
  26. #endif /* SECP256K1_ECDH_H */