aboutsummaryrefslogtreecommitdiff
path: root/include/olm/utility.hh
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-08-20 10:08:15 +0100
committerMark Haines <mark.haines@matrix.org>2015-08-20 10:08:15 +0100
commit5e1b8a5b3b06c2aada6a7a0103e0faa8792dbfb0 (patch)
treeab50b39dbf2d69d1839cca6bba4f6c5855056ab2 /include/olm/utility.hh
parent7649125a9e8412ed716e40f0ff6a40720a211c4b (diff)
Add docstrings for the utility class
Diffstat (limited to 'include/olm/utility.hh')
-rw-r--r--include/olm/utility.hh9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/olm/utility.hh b/include/olm/utility.hh
index 241d7e0..5329a59 100644
--- a/include/olm/utility.hh
+++ b/include/olm/utility.hh
@@ -31,13 +31,22 @@ struct Utility {
ErrorCode last_error;
+ /** The length of a SHA-256 hash in bytes. */
std::size_t sha256_length();
+ /** Compute a SHA-256 hash. Returns the length of the SHA-256 hash in bytes
+ * on success. Returns std::size_t(-1) on failure. On failure last_error
+ * will be set with an error code. If the output buffer was too small then
+ * last error will be OUTPUT_BUFFER_TOO_SMALL. */
std::size_t sha256(
std::uint8_t const * input, std::size_t input_length,
std::uint8_t * output, std::size_t output_length
);
+ /** Verify a ed25519 signature. Returns std::size_t(0) on success. Returns
+ * std::size_t(-1) on failure or if the signature was invalid. On failure
+ * last_error will be set with an error code. If the signature was too short
+ * or was not a valid signature then last_error will be BAD_MESSAGE_MAC. */
std::size_t ed25519_verify(
Ed25519PublicKey const & key,
std::uint8_t const * message, std::size_t message_length,