aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHubert Chathi <hubert@uhoreg.ca>2018-12-28 13:41:25 -0500
committerHubert Chathi <hubert@uhoreg.ca>2018-12-28 13:41:25 -0500
commit17a989db6c4d42828f68afed20bafcb377c65cfb (patch)
treede29380ff1ecd0ad17e7134caab8c1054fbb9667 /src
parentded55f50536d852b544c7255551fc3b8c1e7b044 (diff)
allow specifying the info parameter for the HKDF
Diffstat (limited to 'src')
-rw-r--r--src/sas.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/sas.c b/src/sas.c
index 6de6278..c0bc80c 100644
--- a/src/sas.c
+++ b/src/sas.c
@@ -100,12 +100,13 @@ size_t olm_sas_set_their_key(
size_t olm_sas_generate_bytes(
OlmSAS * sas,
+ const void * info, size_t info_length,
void * output, size_t output_length
) {
_olm_crypto_hkdf_sha256(
sas->secret, sizeof(sas->secret),
NULL, 0,
- (const uint8_t *) "SAS", 3,
+ (const uint8_t *) info, info_length,
output, output_length
);
return 0;
@@ -120,6 +121,7 @@ size_t olm_sas_mac_length(
size_t olm_sas_calculate_mac(
OlmSAS * sas,
void * input, size_t input_length,
+ const void * info, size_t info_length,
void * mac, size_t mac_length
) {
if (mac_length < olm_sas_mac_length(sas)) {
@@ -131,7 +133,7 @@ size_t olm_sas_calculate_mac(
_olm_crypto_hkdf_sha256(
sas->secret, sizeof(sas->secret),
NULL, 0,
- (const uint8_t *) "MAC", 3,
+ (const uint8_t *) info, info_length,
key, 256
);
_olm_crypto_hmac_sha256(key, 256, input, input_length, mac);