github.com/kisexp/xdchain@v0.0.0-20211206025815-490d6b732aa7/crypto/secp256k1/libsecp256k1/include/secp256k1_ecdh.h (about)

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