diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-09-25 15:03:55 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-09-25 15:08:32 -0400 |
commit | 46cda485bce60894d3128dcd42831a8c6cc7bcb4 (patch) | |
tree | d275ffaf6c369520474a34a10d287840d823b5aa /src/common | |
parent | 6dbd451b9f7542b16f64415a57a1af26723f8645 (diff) | |
download | tor-46cda485bce60894d3128dcd42831a8c6cc7bcb4.tar.gz tor-46cda485bce60894d3128dcd42831a8c6cc7bcb4.zip |
Comments and tweaks based on review by asn
Add some documentation
Rename "derive" -> "blind"
Check for failure on randombytes().
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/crypto_curve25519.c | 14 | ||||
-rw-r--r-- | src/common/crypto_ed25519.c | 6 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/common/crypto_curve25519.c b/src/common/crypto_curve25519.c index 484dd76930..44b280a346 100644 --- a/src/common/crypto_curve25519.c +++ b/src/common/crypto_curve25519.c @@ -128,7 +128,13 @@ curve25519_keypair_generate(curve25519_keypair_t *keypair_out, return 0; } -/** DOCDOC */ +/** Write the <b>datalen</b> bytes from <b>data</b> to the file named + * <b>fname</b> in the tagged-data format. This format contains a + * 32-byte header, followed by the data itself. The header is the + * NUL-padded string "== <b>typestring</b>: <b>tag</b> ==". The length + * of <b>typestring</b> and <b>tag</b> must therefore be no more than + * 24. + **/ int crypto_write_tagged_contents_to_file(const char *fname, const char *typestring, @@ -159,7 +165,11 @@ crypto_write_tagged_contents_to_file(const char *fname, return r; } -/** DOCDOC */ +/** Read a tagged-data file from <b>fname</b> into the + * <b>data_out_len</b>-byte buffer in <b>data_out</b>. Check that the + * typestring matches <b>typestring</b>; store the tag into a newly allocated + * string in <b>tag_out</b>. Return -1 on failure, and the number of bytes of + * data on success. */ ssize_t crypto_read_tagged_contents_from_file(const char *fname, const char *typestring, diff --git a/src/common/crypto_ed25519.c b/src/common/crypto_ed25519.c index a545cad9f5..408c12b4fd 100644 --- a/src/common/crypto_ed25519.c +++ b/src/common/crypto_ed25519.c @@ -138,6 +138,8 @@ ed25519_checksig_batch(int *okay_out, } #if 0 + /* This is how we'd do it if we were using ed25519_donna. I'll keep this + * code around here in case we ever do that. */ const uint8_t **ms; size_t *lens; const uint8_t **pks; @@ -249,7 +251,7 @@ ed25519_keypair_blind(ed25519_keypair_t *out, { ed25519_public_key_t pubkey_check; - ed25519_ref10_derive_secret_key(out->seckey.seckey, + ed25519_ref10_blind_secret_key(out->seckey.seckey, inp->seckey.seckey, param); ed25519_public_blind(&pubkey_check, &inp->pubkey, param); @@ -272,7 +274,7 @@ ed25519_public_blind(ed25519_public_key_t *out, const ed25519_public_key_t *inp, const uint8_t *param) { - ed25519_ref10_derive_public_key(out->pubkey, inp->pubkey, param); + ed25519_ref10_blind_public_key(out->pubkey, inp->pubkey, param); return 0; } |