Commit ec5ff1e0 authored by Hubert Chathi's avatar Hubert Chathi
Browse files

also check that the pubkey is set when calculating the MAC

parent 78d9cbab
...@@ -141,6 +141,10 @@ size_t olm_sas_calculate_mac( ...@@ -141,6 +141,10 @@ size_t olm_sas_calculate_mac(
sas->last_error = OLM_OUTPUT_BUFFER_TOO_SMALL; sas->last_error = OLM_OUTPUT_BUFFER_TOO_SMALL;
return (size_t)-1; return (size_t)-1;
} }
if (!sas->their_key_set) {
sas->last_error = OLM_SAS_THEIR_KEY_NOT_SET;
return (size_t)-1;
}
uint8_t key[32]; uint8_t key[32];
_olm_crypto_hkdf_sha256( _olm_crypto_hkdf_sha256(
sas->secret, sizeof(sas->secret), sas->secret, sizeof(sas->secret),
...@@ -164,6 +168,10 @@ size_t olm_sas_calculate_mac_long_kdf( ...@@ -164,6 +168,10 @@ size_t olm_sas_calculate_mac_long_kdf(
sas->last_error = OLM_OUTPUT_BUFFER_TOO_SMALL; sas->last_error = OLM_OUTPUT_BUFFER_TOO_SMALL;
return (size_t)-1; return (size_t)-1;
} }
if (!sas->their_key_set) {
sas->last_error = OLM_SAS_THEIR_KEY_NOT_SET;
return (size_t)-1;
}
uint8_t key[256]; uint8_t key[256];
_olm_crypto_hkdf_sha256( _olm_crypto_hkdf_sha256(
sas->secret, sizeof(sas->secret), sas->secret, sizeof(sas->secret),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment