refactor: Replace SECP256K1_API_VAR with SECP256K1_API

This commit is contained in:
Hennadii Stepanov 2023-06-29 17:07:50 +01:00
parent ae9db95cea
commit 9f1b1904a3
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F
4 changed files with 13 additions and 17 deletions

View File

@ -138,24 +138,20 @@ typedef int (*secp256k1_nonce_function)(
#if defined(_WIN32) #if defined(_WIN32)
# ifdef SECP256K1_BUILD # ifdef SECP256K1_BUILD
# ifdef DLL_EXPORT # ifdef DLL_EXPORT
# define SECP256K1_API __declspec (dllexport) # define SECP256K1_API extern __declspec (dllexport)
# define SECP256K1_API_VAR extern __declspec (dllexport)
# endif # endif
/* The user must define SECP256K1_STATIC when consuming libsecp256k1 as a static /* The user must define SECP256K1_STATIC when consuming libsecp256k1 as a static
* library on Windows. */ * library on Windows. */
# elif !defined(SECP256K1_STATIC) # elif !defined(SECP256K1_STATIC)
/* Consuming libsecp256k1 as a DLL. */ /* Consuming libsecp256k1 as a DLL. */
# define SECP256K1_API __declspec (dllimport) # define SECP256K1_API extern __declspec (dllimport)
# define SECP256K1_API_VAR extern __declspec (dllimport)
# endif # endif
#endif #endif
#ifndef SECP256K1_API #ifndef SECP256K1_API
# if defined(__GNUC__) && (__GNUC__ >= 4) && defined(SECP256K1_BUILD) # if defined(__GNUC__) && (__GNUC__ >= 4) && defined(SECP256K1_BUILD)
# define SECP256K1_API __attribute__ ((visibility ("default"))) # define SECP256K1_API extern __attribute__ ((visibility ("default")))
# define SECP256K1_API_VAR extern __attribute__ ((visibility ("default")))
# else # else
# define SECP256K1_API # define SECP256K1_API extern
# define SECP256K1_API_VAR extern
# endif # endif
#endif #endif
@ -227,10 +223,10 @@ typedef int (*secp256k1_nonce_function)(
* *
* It is highly recommended to call secp256k1_selftest before using this context. * It is highly recommended to call secp256k1_selftest before using this context.
*/ */
SECP256K1_API_VAR const secp256k1_context *secp256k1_context_static; SECP256K1_API const secp256k1_context *secp256k1_context_static;
/** Deprecated alias for secp256k1_context_static. */ /** Deprecated alias for secp256k1_context_static. */
SECP256K1_API_VAR const secp256k1_context *secp256k1_context_no_precomp SECP256K1_API const secp256k1_context *secp256k1_context_no_precomp
SECP256K1_DEPRECATED("Use secp256k1_context_static instead"); SECP256K1_DEPRECATED("Use secp256k1_context_static instead");
/** Perform basic self tests (to be used in conjunction with secp256k1_context_static) /** Perform basic self tests (to be used in conjunction with secp256k1_context_static)
@ -627,10 +623,10 @@ SECP256K1_API int secp256k1_ecdsa_signature_normalize(
* If a data pointer is passed, it is assumed to be a pointer to 32 bytes of * If a data pointer is passed, it is assumed to be a pointer to 32 bytes of
* extra entropy. * extra entropy.
*/ */
SECP256K1_API_VAR const secp256k1_nonce_function secp256k1_nonce_function_rfc6979; SECP256K1_API const secp256k1_nonce_function secp256k1_nonce_function_rfc6979;
/** A default safe nonce generation function (currently equal to secp256k1_nonce_function_rfc6979). */ /** A default safe nonce generation function (currently equal to secp256k1_nonce_function_rfc6979). */
SECP256K1_API_VAR const secp256k1_nonce_function secp256k1_nonce_function_default; SECP256K1_API const secp256k1_nonce_function secp256k1_nonce_function_default;
/** Create an ECDSA signature. /** Create an ECDSA signature.
* *

View File

@ -27,11 +27,11 @@ typedef int (*secp256k1_ecdh_hash_function)(
/** An implementation of SHA256 hash function that applies to compressed public key. /** An implementation of SHA256 hash function that applies to compressed public key.
* Populates the output parameter with 32 bytes. */ * Populates the output parameter with 32 bytes. */
SECP256K1_API_VAR const secp256k1_ecdh_hash_function secp256k1_ecdh_hash_function_sha256; SECP256K1_API const secp256k1_ecdh_hash_function secp256k1_ecdh_hash_function_sha256;
/** A default ECDH hash function (currently equal to secp256k1_ecdh_hash_function_sha256). /** A default ECDH hash function (currently equal to secp256k1_ecdh_hash_function_sha256).
* Populates the output parameter with 32 bytes. */ * Populates the output parameter with 32 bytes. */
SECP256K1_API_VAR const secp256k1_ecdh_hash_function secp256k1_ecdh_hash_function_default; SECP256K1_API const secp256k1_ecdh_hash_function secp256k1_ecdh_hash_function_default;
/** Compute an EC Diffie-Hellman secret in constant time /** Compute an EC Diffie-Hellman secret in constant time
* *

View File

@ -72,7 +72,7 @@ typedef int (*secp256k1_ellswift_xdh_hash_function)(
/** An implementation of an secp256k1_ellswift_xdh_hash_function which uses /** An implementation of an secp256k1_ellswift_xdh_hash_function which uses
* SHA256(prefix64 || ell_a64 || ell_b64 || x32), where prefix64 is the 64-byte * SHA256(prefix64 || ell_a64 || ell_b64 || x32), where prefix64 is the 64-byte
* array pointed to by data. */ * array pointed to by data. */
SECP256K1_API_VAR const secp256k1_ellswift_xdh_hash_function secp256k1_ellswift_xdh_hash_function_prefix; SECP256K1_API const secp256k1_ellswift_xdh_hash_function secp256k1_ellswift_xdh_hash_function_prefix;
/** An implementation of an secp256k1_ellswift_xdh_hash_function compatible with /** An implementation of an secp256k1_ellswift_xdh_hash_function compatible with
* BIP324. It returns H_tag(ell_a64 || ell_b64 || x32), where H_tag is the * BIP324. It returns H_tag(ell_a64 || ell_b64 || x32), where H_tag is the
@ -80,7 +80,7 @@ SECP256K1_API_VAR const secp256k1_ellswift_xdh_hash_function secp256k1_ellswift_
* to secp256k1_ellswift_xdh_hash_function_prefix with prefix64 set to * to secp256k1_ellswift_xdh_hash_function_prefix with prefix64 set to
* SHA256("bip324_ellswift_xonly_ecdh")||SHA256("bip324_ellswift_xonly_ecdh"). * SHA256("bip324_ellswift_xonly_ecdh")||SHA256("bip324_ellswift_xonly_ecdh").
* The data argument is ignored. */ * The data argument is ignored. */
SECP256K1_API_VAR const secp256k1_ellswift_xdh_hash_function secp256k1_ellswift_xdh_hash_function_bip324; SECP256K1_API const secp256k1_ellswift_xdh_hash_function secp256k1_ellswift_xdh_hash_function_bip324;
/** Construct a 64-byte ElligatorSwift encoding of a given pubkey. /** Construct a 64-byte ElligatorSwift encoding of a given pubkey.
* *

View File

@ -61,7 +61,7 @@ typedef int (*secp256k1_nonce_function_hardened)(
* Therefore, to create BIP-340 compliant signatures, algo must be set to * Therefore, to create BIP-340 compliant signatures, algo must be set to
* "BIP0340/nonce" and algolen to 13. * "BIP0340/nonce" and algolen to 13.
*/ */
SECP256K1_API_VAR const secp256k1_nonce_function_hardened secp256k1_nonce_function_bip340; SECP256K1_API const secp256k1_nonce_function_hardened secp256k1_nonce_function_bip340;
/** Data structure that contains additional arguments for schnorrsig_sign_custom. /** Data structure that contains additional arguments for schnorrsig_sign_custom.
* *