提交 09ffbc94 编写于 作者: M Matt Caswell

Remove all instances of DECAF_API_VIS

Reviewed-by: NBernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/5105)
上级 9455aab4
#include "curve448utils.h" #include "curve448utils.h"
int X448(uint8_t out_shared_key[56], const uint8_t private_key[56], int X448(uint8_t out_shared_key[56], const uint8_t private_key[56],
const uint8_t peer_public_value[56]) DECAF_API_VIS; const uint8_t peer_public_value[56]);
void X448_public_from_private(uint8_t out_public_value[56], void X448_public_from_private(uint8_t out_public_value[56],
const uint8_t private_key[56]) DECAF_API_VIS; const uint8_t private_key[56]);
...@@ -20,12 +20,10 @@ ...@@ -20,12 +20,10 @@
extern "C" { extern "C" {
#endif #endif
/* Goldilocks' build flags default to hidden and stripping executables. */
/** @cond internal */ /** @cond internal */
#if defined(DOXYGEN) && !defined(__attribute__) #if defined(DOXYGEN) && !defined(__attribute__)
#define __attribute__((x)) #define __attribute__((x))
#endif #endif
#define DECAF_API_VIS __attribute__((visibility("default")))
#define DECAF_NOINLINE __attribute__((noinline)) #define DECAF_NOINLINE __attribute__((noinline))
#define DECAF_NONNULL __attribute__((nonnull)) #define DECAF_NONNULL __attribute__((nonnull))
/** @endcond */ /** @endcond */
......
...@@ -56,7 +56,7 @@ extern "C" { ...@@ -56,7 +56,7 @@ extern "C" {
void decaf_ed448_derive_public_key ( void decaf_ed448_derive_public_key (
uint8_t pubkey[DECAF_EDDSA_448_PUBLIC_BYTES], uint8_t pubkey[DECAF_EDDSA_448_PUBLIC_BYTES],
const uint8_t privkey[DECAF_EDDSA_448_PRIVATE_BYTES] const uint8_t privkey[DECAF_EDDSA_448_PRIVATE_BYTES]
) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE; ) DECAF_NONNULL DECAF_NOINLINE;
/** /**
* @brief EdDSA signing. * @brief EdDSA signing.
...@@ -84,7 +84,7 @@ void decaf_ed448_sign ( ...@@ -84,7 +84,7 @@ void decaf_ed448_sign (
uint8_t prehashed, uint8_t prehashed,
const uint8_t *context, const uint8_t *context,
uint8_t context_len uint8_t context_len
) DECAF_API_VIS __attribute__((nonnull(1,2,3))) DECAF_NOINLINE; ) __attribute__((nonnull(1,2,3))) DECAF_NOINLINE;
/** /**
* @brief EdDSA signing with prehash. * @brief EdDSA signing with prehash.
...@@ -108,7 +108,7 @@ void decaf_ed448_sign_prehash ( ...@@ -108,7 +108,7 @@ void decaf_ed448_sign_prehash (
const decaf_ed448_prehash_ctx_t hash, const decaf_ed448_prehash_ctx_t hash,
const uint8_t *context, const uint8_t *context,
uint8_t context_len uint8_t context_len
) DECAF_API_VIS __attribute__((nonnull(1,2,3,4))) DECAF_NOINLINE; ) __attribute__((nonnull(1,2,3,4))) DECAF_NOINLINE;
/** /**
* @brief Prehash initialization, with contexts if supported. * @brief Prehash initialization, with contexts if supported.
...@@ -117,7 +117,7 @@ void decaf_ed448_sign_prehash ( ...@@ -117,7 +117,7 @@ void decaf_ed448_sign_prehash (
*/ */
void decaf_ed448_prehash_init ( void decaf_ed448_prehash_init (
decaf_ed448_prehash_ctx_t hash decaf_ed448_prehash_ctx_t hash
) DECAF_API_VIS __attribute__((nonnull(1))) DECAF_NOINLINE; ) __attribute__((nonnull(1))) DECAF_NOINLINE;
/** /**
* @brief EdDSA signature verification. * @brief EdDSA signature verification.
...@@ -145,7 +145,7 @@ decaf_error_t decaf_ed448_verify ( ...@@ -145,7 +145,7 @@ decaf_error_t decaf_ed448_verify (
uint8_t prehashed, uint8_t prehashed,
const uint8_t *context, const uint8_t *context,
uint8_t context_len uint8_t context_len
) DECAF_API_VIS __attribute__((nonnull(1,2))) DECAF_NOINLINE; ) __attribute__((nonnull(1,2))) DECAF_NOINLINE;
/** /**
* @brief EdDSA signature verification. * @brief EdDSA signature verification.
...@@ -169,7 +169,7 @@ decaf_error_t decaf_ed448_verify_prehash ( ...@@ -169,7 +169,7 @@ decaf_error_t decaf_ed448_verify_prehash (
const decaf_ed448_prehash_ctx_t hash, const decaf_ed448_prehash_ctx_t hash,
const uint8_t *context, const uint8_t *context,
uint8_t context_len uint8_t context_len
) DECAF_API_VIS __attribute__((nonnull(1,2))) DECAF_NOINLINE; ) __attribute__((nonnull(1,2))) DECAF_NOINLINE;
/** /**
* @brief EdDSA point encoding. Used internally, exposed externally. * @brief EdDSA point encoding. Used internally, exposed externally.
...@@ -198,7 +198,7 @@ decaf_error_t decaf_ed448_verify_prehash ( ...@@ -198,7 +198,7 @@ decaf_error_t decaf_ed448_verify_prehash (
void curve448_point_mul_by_ratio_and_encode_like_eddsa ( void curve448_point_mul_by_ratio_and_encode_like_eddsa (
uint8_t enc[DECAF_EDDSA_448_PUBLIC_BYTES], uint8_t enc[DECAF_EDDSA_448_PUBLIC_BYTES],
const curve448_point_t p const curve448_point_t p
) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE; ) DECAF_NONNULL DECAF_NOINLINE;
/** /**
* @brief EdDSA point decoding. Multiplies by DECAF_448_EDDSA_DECODE_RATIO, * @brief EdDSA point decoding. Multiplies by DECAF_448_EDDSA_DECODE_RATIO,
...@@ -212,7 +212,7 @@ void curve448_point_mul_by_ratio_and_encode_like_eddsa ( ...@@ -212,7 +212,7 @@ void curve448_point_mul_by_ratio_and_encode_like_eddsa (
decaf_error_t curve448_point_decode_like_eddsa_and_mul_by_ratio ( decaf_error_t curve448_point_decode_like_eddsa_and_mul_by_ratio (
curve448_point_t p, curve448_point_t p,
const uint8_t enc[DECAF_EDDSA_448_PUBLIC_BYTES] const uint8_t enc[DECAF_EDDSA_448_PUBLIC_BYTES]
) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE; ) DECAF_NONNULL DECAF_NOINLINE;
/** /**
* @brief EdDSA to ECDH public key conversion * @brief EdDSA to ECDH public key conversion
...@@ -228,7 +228,7 @@ decaf_error_t curve448_point_decode_like_eddsa_and_mul_by_ratio ( ...@@ -228,7 +228,7 @@ decaf_error_t curve448_point_decode_like_eddsa_and_mul_by_ratio (
void decaf_ed448_convert_public_key_to_x448 ( void decaf_ed448_convert_public_key_to_x448 (
uint8_t x[DECAF_X448_PUBLIC_BYTES], uint8_t x[DECAF_X448_PUBLIC_BYTES],
const uint8_t ed[DECAF_EDDSA_448_PUBLIC_BYTES] const uint8_t ed[DECAF_EDDSA_448_PUBLIC_BYTES]
) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE; ) DECAF_NONNULL DECAF_NOINLINE;
/** /**
* @brief EdDSA to ECDH private key conversion * @brief EdDSA to ECDH private key conversion
...@@ -241,7 +241,7 @@ void decaf_ed448_convert_public_key_to_x448 ( ...@@ -241,7 +241,7 @@ void decaf_ed448_convert_public_key_to_x448 (
void decaf_ed448_convert_private_key_to_x448 ( void decaf_ed448_convert_private_key_to_x448 (
uint8_t x[DECAF_X448_PRIVATE_BYTES], uint8_t x[DECAF_X448_PRIVATE_BYTES],
const uint8_t ed[DECAF_EDDSA_448_PRIVATE_BYTES] const uint8_t ed[DECAF_EDDSA_448_PRIVATE_BYTES]
) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE; ) DECAF_NONNULL DECAF_NOINLINE;
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
......
...@@ -76,19 +76,19 @@ typedef struct curve448_scalar_s { ...@@ -76,19 +76,19 @@ typedef struct curve448_scalar_s {
} curve448_scalar_t[1]; } curve448_scalar_t[1];
/** A scalar equal to 1. */ /** A scalar equal to 1. */
extern const curve448_scalar_t curve448_scalar_one DECAF_API_VIS; extern const curve448_scalar_t curve448_scalar_one;
/** A scalar equal to 0. */ /** A scalar equal to 0. */
extern const curve448_scalar_t curve448_scalar_zero DECAF_API_VIS; extern const curve448_scalar_t curve448_scalar_zero;
/** The identity point on the curve. */ /** The identity point on the curve. */
extern const curve448_point_t curve448_point_identity DECAF_API_VIS; extern const curve448_point_t curve448_point_identity;
/** An arbitrarily chosen base point on the curve. */ /** An arbitrarily chosen base point on the curve. */
extern const curve448_point_t curve448_point_base DECAF_API_VIS; extern const curve448_point_t curve448_point_base;
/** Precomputed table for the base point on the curve. */ /** Precomputed table for the base point on the curve. */
extern const struct curve448_precomputed_s *curve448_precomputed_base DECAF_API_VIS; extern const struct curve448_precomputed_s *curve448_precomputed_base;
/** /**
* @brief Read a scalar from wire format or from bytes. * @brief Read a scalar from wire format or from bytes.
...@@ -103,7 +103,7 @@ extern const struct curve448_precomputed_s *curve448_precomputed_base DECAF_API_ ...@@ -103,7 +103,7 @@ extern const struct curve448_precomputed_s *curve448_precomputed_base DECAF_API_
__owur decaf_error_t curve448_scalar_decode ( __owur decaf_error_t curve448_scalar_decode (
curve448_scalar_t out, curve448_scalar_t out,
const unsigned char ser[DECAF_448_SCALAR_BYTES] const unsigned char ser[DECAF_448_SCALAR_BYTES]
) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE; ) DECAF_NONNULL DECAF_NOINLINE;
/** /**
* @brief Read a scalar from wire format or from bytes. Reduces mod * @brief Read a scalar from wire format or from bytes. Reduces mod
...@@ -117,7 +117,7 @@ void curve448_scalar_decode_long ( ...@@ -117,7 +117,7 @@ void curve448_scalar_decode_long (
curve448_scalar_t out, curve448_scalar_t out,
const unsigned char *ser, const unsigned char *ser,
size_t ser_len size_t ser_len
) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE; ) DECAF_NONNULL DECAF_NOINLINE;
/** /**
* @brief Serialize a scalar to wire format. * @brief Serialize a scalar to wire format.
...@@ -128,7 +128,7 @@ void curve448_scalar_decode_long ( ...@@ -128,7 +128,7 @@ void curve448_scalar_decode_long (
void curve448_scalar_encode ( void curve448_scalar_encode (
unsigned char ser[DECAF_448_SCALAR_BYTES], unsigned char ser[DECAF_448_SCALAR_BYTES],
const curve448_scalar_t s const curve448_scalar_t s
) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE DECAF_NOINLINE; ) DECAF_NONNULL DECAF_NOINLINE DECAF_NOINLINE;
/** /**
* @brief Add two scalars. The scalars may use the same memory. * @brief Add two scalars. The scalars may use the same memory.
...@@ -140,7 +140,7 @@ void curve448_scalar_add ( ...@@ -140,7 +140,7 @@ void curve448_scalar_add (
curve448_scalar_t out, curve448_scalar_t out,
const curve448_scalar_t a, const curve448_scalar_t a,
const curve448_scalar_t b const curve448_scalar_t b
) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE; ) DECAF_NONNULL DECAF_NOINLINE;
/** /**
* @brief Subtract two scalars. The scalars may use the same memory. * @brief Subtract two scalars. The scalars may use the same memory.
...@@ -152,7 +152,7 @@ void curve448_scalar_sub ( ...@@ -152,7 +152,7 @@ void curve448_scalar_sub (
curve448_scalar_t out, curve448_scalar_t out,
const curve448_scalar_t a, const curve448_scalar_t a,
const curve448_scalar_t b const curve448_scalar_t b
) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE; ) DECAF_NONNULL DECAF_NOINLINE;
/** /**
* @brief Multiply two scalars. The scalars may use the same memory. * @brief Multiply two scalars. The scalars may use the same memory.
...@@ -164,7 +164,7 @@ void curve448_scalar_mul ( ...@@ -164,7 +164,7 @@ void curve448_scalar_mul (
curve448_scalar_t out, curve448_scalar_t out,
const curve448_scalar_t a, const curve448_scalar_t a,
const curve448_scalar_t b const curve448_scalar_t b
) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE; ) DECAF_NONNULL DECAF_NOINLINE;
/** /**
* @brief Halve a scalar. The scalars may use the same memory. * @brief Halve a scalar. The scalars may use the same memory.
...@@ -174,7 +174,7 @@ void curve448_scalar_mul ( ...@@ -174,7 +174,7 @@ void curve448_scalar_mul (
void curve448_scalar_halve ( void curve448_scalar_halve (
curve448_scalar_t out, curve448_scalar_t out,
const curve448_scalar_t a const curve448_scalar_t a
) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE; ) DECAF_NONNULL DECAF_NOINLINE;
/** /**
* @brief Copy a scalar. The scalars may use the same memory, in which * @brief Copy a scalar. The scalars may use the same memory, in which
...@@ -215,7 +215,7 @@ static inline void DECAF_NONNULL curve448_point_copy ( ...@@ -215,7 +215,7 @@ static inline void DECAF_NONNULL curve448_point_copy (
__owur decaf_bool_t curve448_point_eq ( __owur decaf_bool_t curve448_point_eq (
const curve448_point_t a, const curve448_point_t a,
const curve448_point_t b const curve448_point_t b
) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE; ) DECAF_NONNULL DECAF_NOINLINE;
/** /**
* @brief Double a point. Equivalent to * @brief Double a point. Equivalent to
...@@ -227,7 +227,7 @@ __owur decaf_bool_t curve448_point_eq ( ...@@ -227,7 +227,7 @@ __owur decaf_bool_t curve448_point_eq (
void curve448_point_double ( void curve448_point_double (
curve448_point_t two_a, curve448_point_t two_a,
const curve448_point_t a const curve448_point_t a
) DECAF_API_VIS DECAF_NONNULL; ) DECAF_NONNULL;
/** /**
* @brief RFC 7748 Diffie-Hellman scalarmul. This function uses a different * @brief RFC 7748 Diffie-Hellman scalarmul. This function uses a different
...@@ -245,7 +245,7 @@ __owur decaf_error_t decaf_x448 ( ...@@ -245,7 +245,7 @@ __owur decaf_error_t decaf_x448 (
uint8_t out[DECAF_X448_PUBLIC_BYTES], uint8_t out[DECAF_X448_PUBLIC_BYTES],
const uint8_t base[DECAF_X448_PUBLIC_BYTES], const uint8_t base[DECAF_X448_PUBLIC_BYTES],
const uint8_t scalar[DECAF_X448_PRIVATE_BYTES] const uint8_t scalar[DECAF_X448_PRIVATE_BYTES]
) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE; ) DECAF_NONNULL DECAF_NOINLINE;
/** /**
* @brief Multiply a point by DECAF_X448_ENCODE_RATIO, * @brief Multiply a point by DECAF_X448_ENCODE_RATIO,
...@@ -270,10 +270,10 @@ __owur decaf_error_t decaf_x448 ( ...@@ -270,10 +270,10 @@ __owur decaf_error_t decaf_x448 (
void curve448_point_mul_by_ratio_and_encode_like_x448 ( void curve448_point_mul_by_ratio_and_encode_like_x448 (
uint8_t out[DECAF_X448_PUBLIC_BYTES], uint8_t out[DECAF_X448_PUBLIC_BYTES],
const curve448_point_t p const curve448_point_t p
) DECAF_API_VIS DECAF_NONNULL; ) DECAF_NONNULL;
/** The base point for X448 Diffie-Hellman */ /** The base point for X448 Diffie-Hellman */
extern const uint8_t decaf_x448_base_point[DECAF_X448_PUBLIC_BYTES] DECAF_API_VIS; extern const uint8_t decaf_x448_base_point[DECAF_X448_PUBLIC_BYTES];
/** /**
* @brief RFC 7748 Diffie-Hellman base point scalarmul. This function uses * @brief RFC 7748 Diffie-Hellman base point scalarmul. This function uses
...@@ -288,7 +288,7 @@ extern const uint8_t decaf_x448_base_point[DECAF_X448_PUBLIC_BYTES] DECAF_API_VI ...@@ -288,7 +288,7 @@ extern const uint8_t decaf_x448_base_point[DECAF_X448_PUBLIC_BYTES] DECAF_API_VI
void decaf_x448_derive_public_key ( void decaf_x448_derive_public_key (
uint8_t out[DECAF_X448_PUBLIC_BYTES], uint8_t out[DECAF_X448_PUBLIC_BYTES],
const uint8_t scalar[DECAF_X448_PRIVATE_BYTES] const uint8_t scalar[DECAF_X448_PRIVATE_BYTES]
) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE; ) DECAF_NONNULL DECAF_NOINLINE;
/** /**
...@@ -306,7 +306,7 @@ void curve448_precomputed_scalarmul ( ...@@ -306,7 +306,7 @@ void curve448_precomputed_scalarmul (
curve448_point_t scaled, curve448_point_t scaled,
const curve448_precomputed_s *base, const curve448_precomputed_s *base,
const curve448_scalar_t scalar const curve448_scalar_t scalar
) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE; ) DECAF_NONNULL DECAF_NOINLINE;
/** /**
...@@ -329,7 +329,7 @@ void curve448_base_double_scalarmul_non_secret ( ...@@ -329,7 +329,7 @@ void curve448_base_double_scalarmul_non_secret (
const curve448_scalar_t scalar1, const curve448_scalar_t scalar1,
const curve448_point_t base2, const curve448_point_t base2,
const curve448_scalar_t scalar2 const curve448_scalar_t scalar2
) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE; ) DECAF_NONNULL DECAF_NOINLINE;
/** /**
* @brief Test that a point is valid, for debugging purposes. * @brief Test that a point is valid, for debugging purposes.
...@@ -340,21 +340,21 @@ void curve448_base_double_scalarmul_non_secret ( ...@@ -340,21 +340,21 @@ void curve448_base_double_scalarmul_non_secret (
*/ */
__owur decaf_bool_t curve448_point_valid ( __owur decaf_bool_t curve448_point_valid (
const curve448_point_t to_test const curve448_point_t to_test
) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE; ) DECAF_NONNULL DECAF_NOINLINE;
/** /**
* @brief Overwrite scalar with zeros. * @brief Overwrite scalar with zeros.
*/ */
void curve448_scalar_destroy ( void curve448_scalar_destroy (
curve448_scalar_t scalar curve448_scalar_t scalar
) DECAF_NONNULL DECAF_API_VIS; ) DECAF_NONNULL;
/** /**
* @brief Overwrite point with zeros. * @brief Overwrite point with zeros.
*/ */
void curve448_point_destroy ( void curve448_point_destroy (
curve448_point_t point curve448_point_t point
) DECAF_NONNULL DECAF_API_VIS; ) DECAF_NONNULL;
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
......
...@@ -46,7 +46,7 @@ extern "C" { ...@@ -46,7 +46,7 @@ extern "C" {
void decaf_sha3_init ( void decaf_sha3_init (
decaf_keccak_sponge_t sponge, decaf_keccak_sponge_t sponge,
const struct decaf_kparams_s *params const struct decaf_kparams_s *params
) DECAF_API_VIS; );
/** /**
* @brief Absorb data into a DECAF_SHA3 or DECAF_SHAKE hash context. * @brief Absorb data into a DECAF_SHA3 or DECAF_SHAKE hash context.
...@@ -60,7 +60,7 @@ decaf_error_t decaf_sha3_update ( ...@@ -60,7 +60,7 @@ decaf_error_t decaf_sha3_update (
struct decaf_keccak_sponge_s * __restrict__ sponge, struct decaf_keccak_sponge_s * __restrict__ sponge,
const uint8_t *in, const uint8_t *in,
size_t len size_t len
) DECAF_API_VIS; );
/** /**
* @brief Squeeze output data from a DECAF_SHA3 or DECAF_SHAKE hash context. * @brief Squeeze output data from a DECAF_SHA3 or DECAF_SHAKE hash context.
...@@ -77,7 +77,7 @@ decaf_error_t decaf_sha3_output ( ...@@ -77,7 +77,7 @@ decaf_error_t decaf_sha3_output (
decaf_keccak_sponge_t sponge, decaf_keccak_sponge_t sponge,
uint8_t * __restrict__ out, uint8_t * __restrict__ out,
size_t len size_t len
) DECAF_API_VIS; );
/** /**
* @brief Squeeze output data from a DECAF_SHA3 or DECAF_SHAKE hash context. * @brief Squeeze output data from a DECAF_SHA3 or DECAF_SHAKE hash context.
...@@ -91,7 +91,7 @@ decaf_error_t decaf_sha3_final ( ...@@ -91,7 +91,7 @@ decaf_error_t decaf_sha3_final (
decaf_keccak_sponge_t sponge, decaf_keccak_sponge_t sponge,
uint8_t * __restrict__ out, uint8_t * __restrict__ out,
size_t len size_t len
) DECAF_API_VIS; );
/** /**
* @brief Reset the sponge to the empty string. * @brief Reset the sponge to the empty string.
...@@ -100,7 +100,7 @@ decaf_error_t decaf_sha3_final ( ...@@ -100,7 +100,7 @@ decaf_error_t decaf_sha3_final (
*/ */
void decaf_sha3_reset ( void decaf_sha3_reset (
decaf_keccak_sponge_t sponge decaf_keccak_sponge_t sponge
) DECAF_API_VIS; );
/** /**
* @brief Return the default output length of the sponge construction, * @brief Return the default output length of the sponge construction,
...@@ -110,7 +110,7 @@ void decaf_sha3_reset ( ...@@ -110,7 +110,7 @@ void decaf_sha3_reset (
*/ */
size_t decaf_sha3_default_output_bytes ( size_t decaf_sha3_default_output_bytes (
const decaf_keccak_sponge_t sponge /**< [inout] The context. */ const decaf_keccak_sponge_t sponge /**< [inout] The context. */
) DECAF_API_VIS; );
/** /**
* @brief Return the default output length of the sponge construction, * @brief Return the default output length of the sponge construction,
...@@ -120,7 +120,7 @@ size_t decaf_sha3_default_output_bytes ( ...@@ -120,7 +120,7 @@ size_t decaf_sha3_default_output_bytes (
*/ */
size_t decaf_sha3_max_output_bytes ( size_t decaf_sha3_max_output_bytes (
const decaf_keccak_sponge_t sponge /**< [inout] The context. */ const decaf_keccak_sponge_t sponge /**< [inout] The context. */
) DECAF_API_VIS; );
/** /**
* @brief Destroy a DECAF_SHA3 or DECAF_SHAKE sponge context by overwriting it with 0. * @brief Destroy a DECAF_SHA3 or DECAF_SHAKE sponge context by overwriting it with 0.
...@@ -128,7 +128,7 @@ size_t decaf_sha3_max_output_bytes ( ...@@ -128,7 +128,7 @@ size_t decaf_sha3_max_output_bytes (
*/ */
void decaf_sha3_destroy ( void decaf_sha3_destroy (
decaf_keccak_sponge_t sponge decaf_keccak_sponge_t sponge
) DECAF_API_VIS; );
/** /**
* @brief Hash (in) to (out) * @brief Hash (in) to (out)
...@@ -144,13 +144,13 @@ decaf_error_t decaf_sha3_hash ( ...@@ -144,13 +144,13 @@ decaf_error_t decaf_sha3_hash (
const uint8_t *in, const uint8_t *in,
size_t inlen, size_t inlen,
const struct decaf_kparams_s *params const struct decaf_kparams_s *params
) DECAF_API_VIS; );
/* FUTURE: expand/doxygenate individual DECAF_SHAKE/DECAF_SHA3 instances? */ /* FUTURE: expand/doxygenate individual DECAF_SHAKE/DECAF_SHA3 instances? */
/** @cond internal */ /** @cond internal */
#define DECAF_DEC_SHAKE(n) \ #define DECAF_DEC_SHAKE(n) \
extern const struct decaf_kparams_s DECAF_SHAKE##n##_params_s DECAF_API_VIS; \ extern const struct decaf_kparams_s DECAF_SHAKE##n##_params_s; \
typedef struct decaf_shake##n##_ctx_s { decaf_keccak_sponge_t s; } decaf_shake##n##_ctx_t[1]; \ typedef struct decaf_shake##n##_ctx_s { decaf_keccak_sponge_t s; } decaf_shake##n##_ctx_t[1]; \
static inline void DECAF_NONNULL decaf_shake##n##_init(decaf_shake##n##_ctx_t sponge) { \ static inline void DECAF_NONNULL decaf_shake##n##_init(decaf_shake##n##_ctx_t sponge) { \
decaf_sha3_init(sponge->s, &DECAF_SHAKE##n##_params_s); \ decaf_sha3_init(sponge->s, &DECAF_SHAKE##n##_params_s); \
...@@ -176,7 +176,7 @@ decaf_error_t decaf_sha3_hash ( ...@@ -176,7 +176,7 @@ decaf_error_t decaf_sha3_hash (
} }
#define DECAF_DEC_SHA3(n) \ #define DECAF_DEC_SHA3(n) \
extern const struct decaf_kparams_s DECAF_SHA3_##n##_params_s DECAF_API_VIS; \ extern const struct decaf_kparams_s DECAF_SHA3_##n##_params_s; \
typedef struct decaf_sha3_##n##_ctx_s { decaf_keccak_sponge_t s; } decaf_sha3_##n##_ctx_t[1]; \ typedef struct decaf_sha3_##n##_ctx_s { decaf_keccak_sponge_t s; } decaf_sha3_##n##_ctx_t[1]; \
static inline void DECAF_NONNULL decaf_sha3_##n##_init(decaf_sha3_##n##_ctx_t sponge) { \ static inline void DECAF_NONNULL decaf_sha3_##n##_init(decaf_sha3_##n##_ctx_t sponge) { \
decaf_sha3_init(sponge->s, &DECAF_SHA3_##n##_params_s); \ decaf_sha3_init(sponge->s, &DECAF_SHA3_##n##_params_s); \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册