Loading crypto/ec/curve448/curve448utils.h +0 −7 Original line number Diff line number Diff line Loading @@ -20,13 +20,6 @@ extern "C" { #endif /** @cond internal */ #if defined(DOXYGEN) && !defined(__attribute__) #define __attribute__((x)) #endif #define DECAF_NOINLINE __attribute__((noinline)) /** @endcond */ /* Internal word types. * * Somewhat tricky. This could be decided separately per platform. However, Loading crypto/ec/curve448/decaf.c +6 −6 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ gf_invert(gf y, const gf x, int assert_nonzero) { /** identity = (0,1) */ const curve448_point_t curve448_point_identity = {{{{{0}}},{{{1}}},{{{1}}},{{{0}}}}}; static DECAF_NOINLINE void static void point_double_internal ( curve448_point_t p, const curve448_point_t q, Loading Loading @@ -116,7 +116,7 @@ cond_neg_niels ( gf_cond_neg(n->c, neg); } static DECAF_NOINLINE void pt_to_pniels ( static void pt_to_pniels ( pniels_t b, const curve448_point_t a ) { Loading @@ -126,7 +126,7 @@ static DECAF_NOINLINE void pt_to_pniels ( gf_add ( b->z, a->z, a->z ); } static DECAF_NOINLINE void pniels_to_pt ( static void pniels_to_pt ( curve448_point_t e, const pniels_t d ) { Loading @@ -139,7 +139,7 @@ static DECAF_NOINLINE void pniels_to_pt ( gf_sqr ( e->z, d->z ); } static DECAF_NOINLINE void static void niels_to_pt ( curve448_point_t e, const niels_t n Loading @@ -150,7 +150,7 @@ niels_to_pt ( gf_copy ( e->z, ONE ); } static DECAF_NOINLINE void static void add_niels_to_pt ( curve448_point_t d, const niels_t e, Loading @@ -172,7 +172,7 @@ add_niels_to_pt ( if (!before_double) gf_mul ( d->t, b, c ); } static DECAF_NOINLINE void static void sub_niels_from_pt ( curve448_point_t d, const niels_t e, Loading crypto/ec/curve448/ed448.h +10 −10 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ extern "C" { void decaf_ed448_derive_public_key ( uint8_t pubkey[DECAF_EDDSA_448_PUBLIC_BYTES], const uint8_t privkey[DECAF_EDDSA_448_PRIVATE_BYTES] ) DECAF_NOINLINE; ); /** * @brief EdDSA signing. Loading Loading @@ -84,7 +84,7 @@ void decaf_ed448_sign ( uint8_t prehashed, const uint8_t *context, uint8_t context_len ) __attribute__((nonnull(1,2,3))) DECAF_NOINLINE; ) __attribute__((nonnull(1,2,3))); /** * @brief EdDSA signing with prehash. Loading @@ -108,7 +108,7 @@ void decaf_ed448_sign_prehash ( const decaf_ed448_prehash_ctx_t hash, const uint8_t *context, uint8_t context_len ) __attribute__((nonnull(1,2,3,4))) DECAF_NOINLINE; ) __attribute__((nonnull(1,2,3,4))); /** * @brief Prehash initialization, with contexts if supported. Loading @@ -117,7 +117,7 @@ void decaf_ed448_sign_prehash ( */ void decaf_ed448_prehash_init ( decaf_ed448_prehash_ctx_t hash ) __attribute__((nonnull(1))) DECAF_NOINLINE; ) __attribute__((nonnull(1))); /** * @brief EdDSA signature verification. Loading Loading @@ -145,7 +145,7 @@ decaf_error_t decaf_ed448_verify ( uint8_t prehashed, const uint8_t *context, uint8_t context_len ) __attribute__((nonnull(1,2))) DECAF_NOINLINE; ) __attribute__((nonnull(1,2))); /** * @brief EdDSA signature verification. Loading @@ -169,7 +169,7 @@ decaf_error_t decaf_ed448_verify_prehash ( const decaf_ed448_prehash_ctx_t hash, const uint8_t *context, uint8_t context_len ) __attribute__((nonnull(1,2))) DECAF_NOINLINE; ) __attribute__((nonnull(1,2))); /** * @brief EdDSA point encoding. Used internally, exposed externally. Loading Loading @@ -198,7 +198,7 @@ decaf_error_t decaf_ed448_verify_prehash ( void curve448_point_mul_by_ratio_and_encode_like_eddsa ( uint8_t enc[DECAF_EDDSA_448_PUBLIC_BYTES], const curve448_point_t p ) DECAF_NOINLINE; ); /** * @brief EdDSA point decoding. Multiplies by DECAF_448_EDDSA_DECODE_RATIO, Loading @@ -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 ( curve448_point_t p, const uint8_t enc[DECAF_EDDSA_448_PUBLIC_BYTES] ) DECAF_NOINLINE; ); /** * @brief EdDSA to ECDH public key conversion Loading @@ -228,7 +228,7 @@ decaf_error_t curve448_point_decode_like_eddsa_and_mul_by_ratio ( 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_NOINLINE; ); /** * @brief EdDSA to ECDH private key conversion Loading @@ -241,7 +241,7 @@ void decaf_ed448_convert_public_key_to_x448 ( 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_NOINLINE; ); #ifdef __cplusplus } /* extern "C" */ Loading crypto/ec/curve448/point_448.h +13 −13 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ extern const struct curve448_precomputed_s *curve448_precomputed_base; __owur decaf_error_t curve448_scalar_decode ( curve448_scalar_t out, const unsigned char ser[DECAF_448_SCALAR_BYTES] ) DECAF_NOINLINE; ); /** * @brief Read a scalar from wire format or from bytes. Reduces mod Loading @@ -117,7 +117,7 @@ void curve448_scalar_decode_long ( curve448_scalar_t out, const unsigned char *ser, size_t ser_len ) DECAF_NOINLINE; ); /** * @brief Serialize a scalar to wire format. Loading @@ -128,7 +128,7 @@ void curve448_scalar_decode_long ( void curve448_scalar_encode ( unsigned char ser[DECAF_448_SCALAR_BYTES], const curve448_scalar_t s ) DECAF_NOINLINE DECAF_NOINLINE; ); /** * @brief Add two scalars. The scalars may use the same memory. Loading @@ -140,7 +140,7 @@ void curve448_scalar_add ( curve448_scalar_t out, const curve448_scalar_t a, const curve448_scalar_t b ) DECAF_NOINLINE; ); /** * @brief Subtract two scalars. The scalars may use the same memory. Loading @@ -152,7 +152,7 @@ void curve448_scalar_sub ( curve448_scalar_t out, const curve448_scalar_t a, const curve448_scalar_t b ) DECAF_NOINLINE; ); /** * @brief Multiply two scalars. The scalars may use the same memory. Loading @@ -164,7 +164,7 @@ void curve448_scalar_mul ( curve448_scalar_t out, const curve448_scalar_t a, const curve448_scalar_t b ) DECAF_NOINLINE; ); /** * @brief Halve a scalar. The scalars may use the same memory. Loading @@ -174,7 +174,7 @@ void curve448_scalar_mul ( void curve448_scalar_halve ( curve448_scalar_t out, const curve448_scalar_t a ) DECAF_NOINLINE; ); /** * @brief Copy a scalar. The scalars may use the same memory, in which Loading Loading @@ -215,7 +215,7 @@ static inline void curve448_point_copy ( __owur decaf_bool_t curve448_point_eq ( const curve448_point_t a, const curve448_point_t b ) DECAF_NOINLINE; ); /** * @brief Double a point. Equivalent to Loading Loading @@ -245,7 +245,7 @@ __owur decaf_error_t decaf_x448 ( uint8_t out[DECAF_X448_PUBLIC_BYTES], const uint8_t base[DECAF_X448_PUBLIC_BYTES], const uint8_t scalar[DECAF_X448_PRIVATE_BYTES] ) DECAF_NOINLINE; ); /** * @brief Multiply a point by DECAF_X448_ENCODE_RATIO, Loading Loading @@ -288,7 +288,7 @@ 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_NOINLINE; ); /** Loading @@ -306,7 +306,7 @@ void curve448_precomputed_scalarmul ( curve448_point_t scaled, const curve448_precomputed_s *base, const curve448_scalar_t scalar ) DECAF_NOINLINE; ); /** Loading @@ -329,7 +329,7 @@ void curve448_base_double_scalarmul_non_secret ( const curve448_scalar_t scalar1, const curve448_point_t base2, const curve448_scalar_t scalar2 ) DECAF_NOINLINE; ); /** * @brief Test that a point is valid, for debugging purposes. Loading @@ -340,7 +340,7 @@ void curve448_base_double_scalarmul_non_secret ( */ __owur decaf_bool_t curve448_point_valid ( const curve448_point_t to_test ) DECAF_NOINLINE; ); /** * @brief Overwrite scalar with zeros. Loading crypto/ec/curve448/scalar.c +2 −2 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ const curve448_scalar_t curve448_scalar_one = {{{1}}}, curve448_scalar_zero = {{ /** {extra,accum} - sub +? p * Must have extra <= 1 */ static DECAF_NOINLINE void sc_subx( static void sc_subx( curve448_scalar_t out, const decaf_word_t accum[DECAF_448_SCALAR_LIMBS], const curve448_scalar_t sub, Loading @@ -56,7 +56,7 @@ static DECAF_NOINLINE void sc_subx( } } static DECAF_NOINLINE void sc_montmul ( static void sc_montmul ( curve448_scalar_t out, const curve448_scalar_t a, const curve448_scalar_t b Loading Loading
crypto/ec/curve448/curve448utils.h +0 −7 Original line number Diff line number Diff line Loading @@ -20,13 +20,6 @@ extern "C" { #endif /** @cond internal */ #if defined(DOXYGEN) && !defined(__attribute__) #define __attribute__((x)) #endif #define DECAF_NOINLINE __attribute__((noinline)) /** @endcond */ /* Internal word types. * * Somewhat tricky. This could be decided separately per platform. However, Loading
crypto/ec/curve448/decaf.c +6 −6 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ gf_invert(gf y, const gf x, int assert_nonzero) { /** identity = (0,1) */ const curve448_point_t curve448_point_identity = {{{{{0}}},{{{1}}},{{{1}}},{{{0}}}}}; static DECAF_NOINLINE void static void point_double_internal ( curve448_point_t p, const curve448_point_t q, Loading Loading @@ -116,7 +116,7 @@ cond_neg_niels ( gf_cond_neg(n->c, neg); } static DECAF_NOINLINE void pt_to_pniels ( static void pt_to_pniels ( pniels_t b, const curve448_point_t a ) { Loading @@ -126,7 +126,7 @@ static DECAF_NOINLINE void pt_to_pniels ( gf_add ( b->z, a->z, a->z ); } static DECAF_NOINLINE void pniels_to_pt ( static void pniels_to_pt ( curve448_point_t e, const pniels_t d ) { Loading @@ -139,7 +139,7 @@ static DECAF_NOINLINE void pniels_to_pt ( gf_sqr ( e->z, d->z ); } static DECAF_NOINLINE void static void niels_to_pt ( curve448_point_t e, const niels_t n Loading @@ -150,7 +150,7 @@ niels_to_pt ( gf_copy ( e->z, ONE ); } static DECAF_NOINLINE void static void add_niels_to_pt ( curve448_point_t d, const niels_t e, Loading @@ -172,7 +172,7 @@ add_niels_to_pt ( if (!before_double) gf_mul ( d->t, b, c ); } static DECAF_NOINLINE void static void sub_niels_from_pt ( curve448_point_t d, const niels_t e, Loading
crypto/ec/curve448/ed448.h +10 −10 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ extern "C" { void decaf_ed448_derive_public_key ( uint8_t pubkey[DECAF_EDDSA_448_PUBLIC_BYTES], const uint8_t privkey[DECAF_EDDSA_448_PRIVATE_BYTES] ) DECAF_NOINLINE; ); /** * @brief EdDSA signing. Loading Loading @@ -84,7 +84,7 @@ void decaf_ed448_sign ( uint8_t prehashed, const uint8_t *context, uint8_t context_len ) __attribute__((nonnull(1,2,3))) DECAF_NOINLINE; ) __attribute__((nonnull(1,2,3))); /** * @brief EdDSA signing with prehash. Loading @@ -108,7 +108,7 @@ void decaf_ed448_sign_prehash ( const decaf_ed448_prehash_ctx_t hash, const uint8_t *context, uint8_t context_len ) __attribute__((nonnull(1,2,3,4))) DECAF_NOINLINE; ) __attribute__((nonnull(1,2,3,4))); /** * @brief Prehash initialization, with contexts if supported. Loading @@ -117,7 +117,7 @@ void decaf_ed448_sign_prehash ( */ void decaf_ed448_prehash_init ( decaf_ed448_prehash_ctx_t hash ) __attribute__((nonnull(1))) DECAF_NOINLINE; ) __attribute__((nonnull(1))); /** * @brief EdDSA signature verification. Loading Loading @@ -145,7 +145,7 @@ decaf_error_t decaf_ed448_verify ( uint8_t prehashed, const uint8_t *context, uint8_t context_len ) __attribute__((nonnull(1,2))) DECAF_NOINLINE; ) __attribute__((nonnull(1,2))); /** * @brief EdDSA signature verification. Loading @@ -169,7 +169,7 @@ decaf_error_t decaf_ed448_verify_prehash ( const decaf_ed448_prehash_ctx_t hash, const uint8_t *context, uint8_t context_len ) __attribute__((nonnull(1,2))) DECAF_NOINLINE; ) __attribute__((nonnull(1,2))); /** * @brief EdDSA point encoding. Used internally, exposed externally. Loading Loading @@ -198,7 +198,7 @@ decaf_error_t decaf_ed448_verify_prehash ( void curve448_point_mul_by_ratio_and_encode_like_eddsa ( uint8_t enc[DECAF_EDDSA_448_PUBLIC_BYTES], const curve448_point_t p ) DECAF_NOINLINE; ); /** * @brief EdDSA point decoding. Multiplies by DECAF_448_EDDSA_DECODE_RATIO, Loading @@ -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 ( curve448_point_t p, const uint8_t enc[DECAF_EDDSA_448_PUBLIC_BYTES] ) DECAF_NOINLINE; ); /** * @brief EdDSA to ECDH public key conversion Loading @@ -228,7 +228,7 @@ decaf_error_t curve448_point_decode_like_eddsa_and_mul_by_ratio ( 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_NOINLINE; ); /** * @brief EdDSA to ECDH private key conversion Loading @@ -241,7 +241,7 @@ void decaf_ed448_convert_public_key_to_x448 ( 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_NOINLINE; ); #ifdef __cplusplus } /* extern "C" */ Loading
crypto/ec/curve448/point_448.h +13 −13 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ extern const struct curve448_precomputed_s *curve448_precomputed_base; __owur decaf_error_t curve448_scalar_decode ( curve448_scalar_t out, const unsigned char ser[DECAF_448_SCALAR_BYTES] ) DECAF_NOINLINE; ); /** * @brief Read a scalar from wire format or from bytes. Reduces mod Loading @@ -117,7 +117,7 @@ void curve448_scalar_decode_long ( curve448_scalar_t out, const unsigned char *ser, size_t ser_len ) DECAF_NOINLINE; ); /** * @brief Serialize a scalar to wire format. Loading @@ -128,7 +128,7 @@ void curve448_scalar_decode_long ( void curve448_scalar_encode ( unsigned char ser[DECAF_448_SCALAR_BYTES], const curve448_scalar_t s ) DECAF_NOINLINE DECAF_NOINLINE; ); /** * @brief Add two scalars. The scalars may use the same memory. Loading @@ -140,7 +140,7 @@ void curve448_scalar_add ( curve448_scalar_t out, const curve448_scalar_t a, const curve448_scalar_t b ) DECAF_NOINLINE; ); /** * @brief Subtract two scalars. The scalars may use the same memory. Loading @@ -152,7 +152,7 @@ void curve448_scalar_sub ( curve448_scalar_t out, const curve448_scalar_t a, const curve448_scalar_t b ) DECAF_NOINLINE; ); /** * @brief Multiply two scalars. The scalars may use the same memory. Loading @@ -164,7 +164,7 @@ void curve448_scalar_mul ( curve448_scalar_t out, const curve448_scalar_t a, const curve448_scalar_t b ) DECAF_NOINLINE; ); /** * @brief Halve a scalar. The scalars may use the same memory. Loading @@ -174,7 +174,7 @@ void curve448_scalar_mul ( void curve448_scalar_halve ( curve448_scalar_t out, const curve448_scalar_t a ) DECAF_NOINLINE; ); /** * @brief Copy a scalar. The scalars may use the same memory, in which Loading Loading @@ -215,7 +215,7 @@ static inline void curve448_point_copy ( __owur decaf_bool_t curve448_point_eq ( const curve448_point_t a, const curve448_point_t b ) DECAF_NOINLINE; ); /** * @brief Double a point. Equivalent to Loading Loading @@ -245,7 +245,7 @@ __owur decaf_error_t decaf_x448 ( uint8_t out[DECAF_X448_PUBLIC_BYTES], const uint8_t base[DECAF_X448_PUBLIC_BYTES], const uint8_t scalar[DECAF_X448_PRIVATE_BYTES] ) DECAF_NOINLINE; ); /** * @brief Multiply a point by DECAF_X448_ENCODE_RATIO, Loading Loading @@ -288,7 +288,7 @@ 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_NOINLINE; ); /** Loading @@ -306,7 +306,7 @@ void curve448_precomputed_scalarmul ( curve448_point_t scaled, const curve448_precomputed_s *base, const curve448_scalar_t scalar ) DECAF_NOINLINE; ); /** Loading @@ -329,7 +329,7 @@ void curve448_base_double_scalarmul_non_secret ( const curve448_scalar_t scalar1, const curve448_point_t base2, const curve448_scalar_t scalar2 ) DECAF_NOINLINE; ); /** * @brief Test that a point is valid, for debugging purposes. Loading @@ -340,7 +340,7 @@ void curve448_base_double_scalarmul_non_secret ( */ __owur decaf_bool_t curve448_point_valid ( const curve448_point_t to_test ) DECAF_NOINLINE; ); /** * @brief Overwrite scalar with zeros. Loading
crypto/ec/curve448/scalar.c +2 −2 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ const curve448_scalar_t curve448_scalar_one = {{{1}}}, curve448_scalar_zero = {{ /** {extra,accum} - sub +? p * Must have extra <= 1 */ static DECAF_NOINLINE void sc_subx( static void sc_subx( curve448_scalar_t out, const decaf_word_t accum[DECAF_448_SCALAR_LIMBS], const curve448_scalar_t sub, Loading @@ -56,7 +56,7 @@ static DECAF_NOINLINE void sc_subx( } } static DECAF_NOINLINE void sc_montmul ( static void sc_montmul ( curve448_scalar_t out, const curve448_scalar_t a, const curve448_scalar_t b Loading