aboutsummaryrefslogtreecommitdiff
path: root/include/olm
diff options
context:
space:
mode:
Diffstat (limited to 'include/olm')
-rw-r--r--include/olm/olm.h2
-rw-r--r--include/olm/pk.h34
-rw-r--r--include/olm/sas.h10
3 files changed, 34 insertions, 12 deletions
diff --git a/include/olm/olm.h b/include/olm/olm.h
index 0722d79..61ea07b 100644
--- a/include/olm/olm.h
+++ b/include/olm/olm.h
@@ -435,7 +435,7 @@ size_t olm_sha256(
);
/** Verify an ed25519 signature. If the key was too small then
- * olm_session_last_error will be "INVALID_BASE64". If the signature was invalid
+ * olm_utility_last_error() will be "INVALID_BASE64". If the signature was invalid
* then olm_utility_last_error() will be "BAD_MESSAGE_MAC". */
size_t olm_ed25519_verify(
OlmUtility * utility,
diff --git a/include/olm/pk.h b/include/olm/pk.h
index 3f77ef7..b51033c 100644
--- a/include/olm/pk.h
+++ b/include/olm/pk.h
@@ -87,7 +87,7 @@ size_t olm_pk_encrypt(
void * ciphertext, size_t ciphertext_length,
void * mac, size_t mac_length,
void * ephemeral_key, size_t ephemeral_key_size,
- void * random, size_t random_length
+ const void * random, size_t random_length
);
typedef struct OlmPkDecryption OlmPkDecryption;
@@ -133,7 +133,7 @@ size_t olm_pk_generate_key_random_length(void);
size_t olm_pk_key_from_private(
OlmPkDecryption * decryption,
void * pubkey, size_t pubkey_length,
- void * privkey, size_t privkey_length
+ const void * privkey, size_t privkey_length
);
/** DEPRECATED: Use olm_pk_key_from_private
@@ -141,7 +141,7 @@ size_t olm_pk_key_from_private(
size_t olm_pk_generate_key(
OlmPkDecryption * decryption,
void * pubkey, size_t pubkey_length,
- void * privkey, size_t privkey_length
+ const void * privkey, size_t privkey_length
);
/** Returns the number of bytes needed to store a decryption object. */
@@ -152,7 +152,7 @@ size_t olm_pickle_pk_decryption_length(
/** Stores decryption object as a base64 string. Encrypts the object using the
* supplied key. Returns the length of the pickled object on success.
* Returns olm_error() on failure. If the pickle output buffer
- * is smaller than olm_pickle_account_length() then
+ * is smaller than olm_pickle_decryption_length() then
* olm_pk_decryption_last_error() will be "OUTPUT_BUFFER_TOO_SMALL" */
size_t olm_pickle_pk_decryption(
OlmPkDecryption * decryption,
@@ -230,19 +230,39 @@ size_t olm_clear_pk_signing(
);
/**
- * Initialise the signing object with a public/private keypair from a seed
+ * Initialise the signing object with a public/private keypair from a seed. The
+ * associated public key will be written to the pubkey buffer. Returns
+ * olm_error() on failure. If the public key buffer is too small then
+ * olm_pk_signing_last_error() will be "OUTPUT_BUFFER_TOO_SMALL". If the seed
+ * buffer is too small then olm_pk_signing_last_error() will be
+ * "INPUT_BUFFER_TOO_SMALL".
*/
size_t olm_pk_signing_key_from_seed(
OlmPkSigning * sign,
void * pubkey, size_t pubkey_length,
- void * seed, size_t seed_length
+ const void * seed, size_t seed_length
);
+/**
+ * The size required for the seed for initialising a signing object.
+ */
size_t olm_pk_signing_seed_length(void);
+
+/**
+ * The size of the public key of a signing object.
+ */
size_t olm_pk_signing_public_key_length(void);
-size_t olm_pk_signature_length();
+/**
+ * The size of a signature created by a signing object.
+ */
+size_t olm_pk_signature_length(void);
+/**
+ * Sign a message. The signature will be written to the signature
+ * buffer. Returns olm_error() on failure. If the signature buffer is too
+ * small, olm_pk_signing_last_error() will be "OUTPUT_BUFFER_TOO_SMALL".
+ */
size_t olm_pk_sign(
OlmPkSigning *sign,
uint8_t const * message, size_t message_length,
diff --git a/include/olm/sas.h b/include/olm/sas.h
index 9d2ae3e..ee44eff 100644
--- a/include/olm/sas.h
+++ b/include/olm/sas.h
@@ -59,7 +59,8 @@ size_t olm_create_sas_random_length(
/** Creates a new SAS object.
*
* @param[in] sas the SAS object to create, initialized by `olm_sas()`.
- * @param[in] random array of random bytes.
+ * @param[in] random array of random bytes. The contents of the buffer may be
+ * overwritten.
* @param[in] random_length the number of random bytes provided. Must be at
* least `olm_create_sas_random_length()`.
*
@@ -92,7 +93,8 @@ size_t olm_sas_get_pubkey(
/** Sets the public key of other user.
*
* @param[in] sas the SAS object.
- * @param[in] their_key the other user's public key.
+ * @param[in] their_key the other user's public key. The contents of the
+ * buffer will be overwritten.
* @param[in] their_key_length the size of the `their_key` buffer.
*
* @return `olm_error()` on failure. If the `their_key` buffer is too small,
@@ -142,7 +144,7 @@ size_t olm_sas_mac_length(
*/
size_t olm_sas_calculate_mac(
OlmSAS * sas,
- void * input, size_t input_length,
+ const void * input, size_t input_length,
const void * info, size_t info_length,
void * mac, size_t mac_length
);
@@ -150,7 +152,7 @@ size_t olm_sas_calculate_mac(
// for compatibility with an old version of Riot
size_t olm_sas_calculate_mac_long_kdf(
OlmSAS * sas,
- void * input, size_t input_length,
+ const void * input, size_t input_length,
const void * info, size_t info_length,
void * mac, size_t mac_length
);