Comments and tweaks based on review by asn

Add some documentation

Rename "derive" -> "blind"

Check for failure on randombytes().
This commit is contained in:
Nick Mathewson
2014-09-25 15:03:55 -04:00
parent 6dbd451b9f
commit 46cda485bc
8 changed files with 36 additions and 12 deletions
+12 -2
View File
@@ -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,
+4 -2
View File
@@ -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;
}