4 #ifndef TOR_CRYPTO_ED25519_H 5 #define TOR_CRYPTO_ED25519_H 7 #include "testsupport.h" 9 #include "crypto_curve25519.h" 12 #define ED25519_PUBKEY_LEN 32 13 #define ED25519_SECKEY_LEN 64 14 #define ED25519_SECKEY_SEED_LEN 32 15 #define ED25519_SIG_LEN 64 19 uint8_t sig[ED25519_SIG_LEN];
24 uint8_t pubkey[ED25519_PUBKEY_LEN];
35 uint8_t seckey[ED25519_SECKEY_LEN];
53 const uint8_t *msg,
size_t len,
56 const uint8_t *msg,
size_t len,
61 const uint8_t *msg,
size_t len,
62 const char *prefix_str,
67 const uint8_t *msg,
size_t len,
68 const char *prefix_str,
88 MOCK_DECL(
int, ed25519_checksig_batch,(
int *okay_out,
101 const uint8_t *param);
104 const uint8_t *param);
109 const char *filename,
113 const char *filename);
115 const char *filename,
119 const char *filename);
122 #define ed25519_keypair_free(kp) \ 123 FREE_AND_NULL(ed25519_keypair_t, ed25519_keypair_free_, (kp)) 131 void ed25519_init(
void);
135 #ifdef TOR_UNIT_TESTS 136 void crypto_ed25519_testing_force_impl(
const char *name);
137 void crypto_ed25519_testing_restore_impl(
void);
140 #ifdef CRYPTO_ED25519_PRIVATE 141 MOCK_DECL(STATIC
int, ed25519_impl_spot_check, (
void));
int ed25519_checksig_prefixed(const ed25519_signature_t *signature, const uint8_t *msg, size_t msg_len, const char *prefix_str, const ed25519_public_key_t *pubkey)
Definition: crypto_ed25519.c:334
Definition: crypto_ed25519.h:39
int ed25519_pubkey_read_from_file(ed25519_public_key_t *pubkey_out, char **tag_out, const char *filename)
Definition: crypto_ed25519.c:605
Definition: crypto_ed25519.h:23
int ed25519_secret_key_generate(ed25519_secret_key_t *seckey_out, int extra_strong)
Definition: crypto_ed25519.c:163
size_t len
Definition: crypto_ed25519.h:85
int ed25519_public_key_generate(ed25519_public_key_t *pubkey_out, const ed25519_secret_key_t *seckey)
Definition: crypto_ed25519.c:197
int ed25519_public_key_from_curve25519_public_key(ed25519_public_key_t *pubkey, const curve25519_public_key_t *pubkey_in, int signbit)
Definition: crypto_ed25519.c:488
int ed25519_keypair_from_curve25519_keypair(ed25519_keypair_t *out, int *signbit_out, const curve25519_keypair_t *inp)
Definition: crypto_ed25519.c:450
const ed25519_public_key_t * pubkey
Definition: crypto_ed25519.h:79
MOCK_DECL(int, router_have_minimum_dir_info,(void))
Header file to define uint32_t and friends.
int ed25519_keypair_blind(ed25519_keypair_t *out, const ed25519_keypair_t *inp, const uint8_t *param)
Definition: crypto_ed25519.c:509
int ed25519_pubkey_eq(const ed25519_public_key_t *key1, const ed25519_public_key_t *key2)
Definition: crypto_ed25519.c:637
void ed25519_set_impl_params(int use_donna)
Definition: crypto_ed25519.c:741
int ed25519_seckey_read_from_file(ed25519_secret_key_t *seckey_out, char **tag_out, const char *filename)
Definition: crypto_ed25519.c:565
int ed25519_seckey_write_to_file(const ed25519_secret_key_t *seckey, const char *filename, const char *tag)
Definition: crypto_ed25519.c:548
int ed25519_public_key_is_zero(const ed25519_public_key_t *pubkey)
Definition: crypto_ed25519.c:222
void ed25519_pubkey_copy(ed25519_public_key_t *dest, const ed25519_public_key_t *src)
Definition: crypto_ed25519.c:649
Definition: crypto_curve25519.h:38
ed25519_signature_t signature
Definition: crypto_ed25519.h:81
Definition: crypto_curve25519.h:24
void ed25519_keypair_free_(ed25519_keypair_t *kp)
Definition: crypto_ed25519.c:626
Definition: crypto_ed25519.h:28
int ed25519_pubkey_write_to_file(const ed25519_public_key_t *pubkey, const char *filename, const char *tag)
Definition: crypto_ed25519.c:589
int ed25519_sign(ed25519_signature_t *signature_out, const uint8_t *msg, size_t len, const ed25519_keypair_t *keypair)
Definition: crypto_ed25519.c:266
int ed25519_keypair_generate(ed25519_keypair_t *keypair_out, int extra_strong)
Definition: crypto_ed25519.c:209
int ed25519_secret_key_from_seed(ed25519_secret_key_t *seckey_out, const uint8_t *seed)
Definition: crypto_ed25519.c:184
Definition: crypto_ed25519.h:77
Definition: crypto_ed25519.h:18
const uint8_t * msg
Definition: crypto_ed25519.h:83
int ed25519_validate_pubkey(const ed25519_public_key_t *pubkey)
Definition: crypto_ed25519.c:791
int ed25519_public_blind(ed25519_public_key_t *out, const ed25519_public_key_t *inp, const uint8_t *param)
Definition: crypto_ed25519.c:536