aboutsummaryrefslogtreecommitdiff
path: root/src/common/crypto_curve25519.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-09-25 15:03:55 -0400
committerNick Mathewson <nickm@torproject.org>2014-09-25 15:08:32 -0400
commit46cda485bce60894d3128dcd42831a8c6cc7bcb4 (patch)
treed275ffaf6c369520474a34a10d287840d823b5aa /src/common/crypto_curve25519.c
parent6dbd451b9f7542b16f64415a57a1af26723f8645 (diff)
downloadtor-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/crypto_curve25519.c')
-rw-r--r--src/common/crypto_curve25519.c14
1 files changed, 12 insertions, 2 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,