mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Comments and tweaks based on review by asn
Add some documentation Rename "derive" -> "blind" Check for failure on randombytes().
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user