#define __attribute__((x))
#endif
#define DECAF_NOINLINE __attribute__((noinline))
-#define DECAF_NONNULL __attribute__((nonnull))
/** @endcond */
/* Internal word types.
void decaf_ed448_derive_public_key (
uint8_t pubkey[DECAF_EDDSA_448_PUBLIC_BYTES],
const uint8_t privkey[DECAF_EDDSA_448_PRIVATE_BYTES]
-) DECAF_NONNULL DECAF_NOINLINE;
+) DECAF_NOINLINE;
/**
* @brief EdDSA signing.
void curve448_point_mul_by_ratio_and_encode_like_eddsa (
uint8_t enc[DECAF_EDDSA_448_PUBLIC_BYTES],
const curve448_point_t p
-) DECAF_NONNULL DECAF_NOINLINE;
+) DECAF_NOINLINE;
/**
* @brief EdDSA point decoding. Multiplies by DECAF_448_EDDSA_DECODE_RATIO,
decaf_error_t curve448_point_decode_like_eddsa_and_mul_by_ratio (
curve448_point_t p,
const uint8_t enc[DECAF_EDDSA_448_PUBLIC_BYTES]
-) DECAF_NONNULL DECAF_NOINLINE;
+) DECAF_NOINLINE;
/**
* @brief EdDSA to ECDH public key conversion
void decaf_ed448_convert_public_key_to_x448 (
uint8_t x[DECAF_X448_PUBLIC_BYTES],
const uint8_t ed[DECAF_EDDSA_448_PUBLIC_BYTES]
-) DECAF_NONNULL DECAF_NOINLINE;
+) DECAF_NOINLINE;
/**
* @brief EdDSA to ECDH private key conversion
void decaf_ed448_convert_private_key_to_x448 (
uint8_t x[DECAF_X448_PRIVATE_BYTES],
const uint8_t ed[DECAF_EDDSA_448_PRIVATE_BYTES]
-) DECAF_NONNULL DECAF_NOINLINE;
+) DECAF_NOINLINE;
#ifdef __cplusplus
} /* extern "C" */
__owur decaf_error_t curve448_scalar_decode (
curve448_scalar_t out,
const unsigned char ser[DECAF_448_SCALAR_BYTES]
-) DECAF_NONNULL DECAF_NOINLINE;
+) DECAF_NOINLINE;
/**
* @brief Read a scalar from wire format or from bytes. Reduces mod
curve448_scalar_t out,
const unsigned char *ser,
size_t ser_len
-) DECAF_NONNULL DECAF_NOINLINE;
+) DECAF_NOINLINE;
/**
* @brief Serialize a scalar to wire format.
void curve448_scalar_encode (
unsigned char ser[DECAF_448_SCALAR_BYTES],
const curve448_scalar_t s
-) DECAF_NONNULL DECAF_NOINLINE DECAF_NOINLINE;
+) DECAF_NOINLINE DECAF_NOINLINE;
/**
* @brief Add two scalars. The scalars may use the same memory.
curve448_scalar_t out,
const curve448_scalar_t a,
const curve448_scalar_t b
-) DECAF_NONNULL DECAF_NOINLINE;
+) DECAF_NOINLINE;
/**
* @brief Subtract two scalars. The scalars may use the same memory.
curve448_scalar_t out,
const curve448_scalar_t a,
const curve448_scalar_t b
-) DECAF_NONNULL DECAF_NOINLINE;
+) DECAF_NOINLINE;
/**
* @brief Multiply two scalars. The scalars may use the same memory.
curve448_scalar_t out,
const curve448_scalar_t a,
const curve448_scalar_t b
-) DECAF_NONNULL DECAF_NOINLINE;
+) DECAF_NOINLINE;
/**
* @brief Halve a scalar. The scalars may use the same memory.
void curve448_scalar_halve (
curve448_scalar_t out,
const curve448_scalar_t a
-) DECAF_NONNULL DECAF_NOINLINE;
+) DECAF_NOINLINE;
/**
* @brief Copy a scalar. The scalars may use the same memory, in which
* @param [in] a A scalar.
* @param [out] out Will become a copy of a.
*/
-static inline void DECAF_NONNULL curve448_scalar_copy (
+static inline void curve448_scalar_copy (
curve448_scalar_t out,
const curve448_scalar_t a
) {
* @param [out] a A copy of the point.
* @param [in] b Any point.
*/
-static inline void DECAF_NONNULL curve448_point_copy (
+static inline void curve448_point_copy (
curve448_point_t a,
const curve448_point_t b
) {
__owur decaf_bool_t curve448_point_eq (
const curve448_point_t a,
const curve448_point_t b
-) DECAF_NONNULL DECAF_NOINLINE;
+) DECAF_NOINLINE;
/**
* @brief Double a point. Equivalent to
void curve448_point_double (
curve448_point_t two_a,
const curve448_point_t a
-) DECAF_NONNULL;
+);
/**
* @brief RFC 7748 Diffie-Hellman scalarmul. This function uses a different
uint8_t out[DECAF_X448_PUBLIC_BYTES],
const uint8_t base[DECAF_X448_PUBLIC_BYTES],
const uint8_t scalar[DECAF_X448_PRIVATE_BYTES]
-) DECAF_NONNULL DECAF_NOINLINE;
+) DECAF_NOINLINE;
/**
* @brief Multiply a point by DECAF_X448_ENCODE_RATIO,
void curve448_point_mul_by_ratio_and_encode_like_x448 (
uint8_t out[DECAF_X448_PUBLIC_BYTES],
const curve448_point_t p
-) DECAF_NONNULL;
+);
/** The base point for X448 Diffie-Hellman */
extern const uint8_t decaf_x448_base_point[DECAF_X448_PUBLIC_BYTES];
void decaf_x448_derive_public_key (
uint8_t out[DECAF_X448_PUBLIC_BYTES],
const uint8_t scalar[DECAF_X448_PRIVATE_BYTES]
-) DECAF_NONNULL DECAF_NOINLINE;
+) DECAF_NOINLINE;
/**
curve448_point_t scaled,
const curve448_precomputed_s *base,
const curve448_scalar_t scalar
-) DECAF_NONNULL DECAF_NOINLINE;
+) DECAF_NOINLINE;
/**
const curve448_scalar_t scalar1,
const curve448_point_t base2,
const curve448_scalar_t scalar2
-) DECAF_NONNULL DECAF_NOINLINE;
+) DECAF_NOINLINE;
/**
* @brief Test that a point is valid, for debugging purposes.
*/
__owur decaf_bool_t curve448_point_valid (
const curve448_point_t to_test
-) DECAF_NONNULL DECAF_NOINLINE;
+) DECAF_NOINLINE;
/**
* @brief Overwrite scalar with zeros.
*/
void curve448_scalar_destroy (
curve448_scalar_t scalar
-) DECAF_NONNULL;
+);
/**
* @brief Overwrite point with zeros.
*/
void curve448_point_destroy (
curve448_point_t point
-) DECAF_NONNULL;
+);
#ifdef __cplusplus
} /* extern "C" */
#define DECAF_DEC_SHAKE(n) \
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]; \
- static inline void DECAF_NONNULL decaf_shake##n##_init(decaf_shake##n##_ctx_t sponge) { \
+ static inline void decaf_shake##n##_init(decaf_shake##n##_ctx_t sponge) { \
decaf_sha3_init(sponge->s, &DECAF_SHAKE##n##_params_s); \
} \
- static inline void DECAF_NONNULL decaf_shake##n##_gen_init(decaf_keccak_sponge_t sponge) { \
+ static inline void decaf_shake##n##_gen_init(decaf_keccak_sponge_t sponge) { \
decaf_sha3_init(sponge, &DECAF_SHAKE##n##_params_s); \
} \
- static inline decaf_error_t DECAF_NONNULL decaf_shake##n##_update(decaf_shake##n##_ctx_t sponge, const uint8_t *in, size_t inlen ) { \
+ static inline decaf_error_t decaf_shake##n##_update(decaf_shake##n##_ctx_t sponge, const uint8_t *in, size_t inlen ) { \
return decaf_sha3_update(sponge->s, in, inlen); \
} \
- static inline void DECAF_NONNULL decaf_shake##n##_final(decaf_shake##n##_ctx_t sponge, uint8_t *out, size_t outlen ) { \
+ static inline void decaf_shake##n##_final(decaf_shake##n##_ctx_t sponge, uint8_t *out, size_t outlen ) { \
decaf_sha3_output(sponge->s, out, outlen); \
decaf_sha3_init(sponge->s, &DECAF_SHAKE##n##_params_s); \
} \
- static inline void DECAF_NONNULL decaf_shake##n##_output(decaf_shake##n##_ctx_t sponge, uint8_t *out, size_t outlen ) { \
+ static inline void decaf_shake##n##_output(decaf_shake##n##_ctx_t sponge, uint8_t *out, size_t outlen ) { \
decaf_sha3_output(sponge->s, out, outlen); \
} \
- static inline void DECAF_NONNULL decaf_shake##n##_hash(uint8_t *out, size_t outlen, const uint8_t *in, size_t inlen) { \
+ static inline void decaf_shake##n##_hash(uint8_t *out, size_t outlen, const uint8_t *in, size_t inlen) { \
decaf_sha3_hash(out,outlen,in,inlen,&DECAF_SHAKE##n##_params_s); \
} \
- static inline void DECAF_NONNULL decaf_shake##n##_destroy( decaf_shake##n##_ctx_t sponge ) { \
+ static inline void decaf_shake##n##_destroy( decaf_shake##n##_ctx_t sponge ) { \
decaf_sha3_destroy(sponge->s); \
}
#define DECAF_DEC_SHA3(n) \
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]; \
- static inline void DECAF_NONNULL decaf_sha3_##n##_init(decaf_sha3_##n##_ctx_t sponge) { \
+ static inline void decaf_sha3_##n##_init(decaf_sha3_##n##_ctx_t sponge) { \
decaf_sha3_init(sponge->s, &DECAF_SHA3_##n##_params_s); \
} \
- static inline void DECAF_NONNULL decaf_sha3_##n##_gen_init(decaf_keccak_sponge_t sponge) { \
+ static inline void decaf_sha3_##n##_gen_init(decaf_keccak_sponge_t sponge) { \
decaf_sha3_init(sponge, &DECAF_SHA3_##n##_params_s); \
} \
- static inline decaf_error_t DECAF_NONNULL decaf_sha3_##n##_update(decaf_sha3_##n##_ctx_t sponge, const uint8_t *in, size_t inlen ) { \
+ static inline decaf_error_t decaf_sha3_##n##_update(decaf_sha3_##n##_ctx_t sponge, const uint8_t *in, size_t inlen ) { \
return decaf_sha3_update(sponge->s, in, inlen); \
} \
- static inline decaf_error_t DECAF_NONNULL decaf_sha3_##n##_final(decaf_sha3_##n##_ctx_t sponge, uint8_t *out, size_t outlen ) { \
+ static inline decaf_error_t decaf_sha3_##n##_final(decaf_sha3_##n##_ctx_t sponge, uint8_t *out, size_t outlen ) { \
decaf_error_t ret = decaf_sha3_output(sponge->s, out, outlen); \
decaf_sha3_init(sponge->s, &DECAF_SHA3_##n##_params_s); \
return ret; \
} \
- static inline decaf_error_t DECAF_NONNULL decaf_sha3_##n##_output(decaf_sha3_##n##_ctx_t sponge, uint8_t *out, size_t outlen ) { \
+ static inline decaf_error_t decaf_sha3_##n##_output(decaf_sha3_##n##_ctx_t sponge, uint8_t *out, size_t outlen ) { \
return decaf_sha3_output(sponge->s, out, outlen); \
} \
- static inline decaf_error_t DECAF_NONNULL decaf_sha3_##n##_hash(uint8_t *out, size_t outlen, const uint8_t *in, size_t inlen) { \
+ static inline decaf_error_t decaf_sha3_##n##_hash(uint8_t *out, size_t outlen, const uint8_t *in, size_t inlen) { \
return decaf_sha3_hash(out,outlen,in,inlen,&DECAF_SHA3_##n##_params_s); \
} \
- static inline void DECAF_NONNULL decaf_sha3_##n##_destroy(decaf_sha3_##n##_ctx_t sponge) { \
+ static inline void decaf_sha3_##n##_destroy(decaf_sha3_##n##_ctx_t sponge) { \
decaf_sha3_destroy(sponge->s); \
}
/** @endcond */