aboutsummaryrefslogtreecommitdiff
path: root/src/sas.c
diff options
context:
space:
mode:
authorHubert Chathi <hubert@uhoreg.ca>2020-09-23 16:45:36 -0400
committerHubert Chathi <hubert@uhoreg.ca>2020-09-23 16:47:00 -0400
commitec5ff1e032868d5bce9dd36b0e549928dc7ebe36 (patch)
treeadcd0a8a8b84981cf0b55b194cdd0d89e6ce129d /src/sas.c
parent78d9cbabb7a360277864f39157c506279c1abdde (diff)
also check that the pubkey is set when calculating the MAC
Diffstat (limited to 'src/sas.c')
-rw-r--r--src/sas.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/sas.c b/src/sas.c
index 75e7724..7117fed 100644
--- a/src/sas.c
+++ b/src/sas.c
@@ -141,6 +141,10 @@ size_t olm_sas_calculate_mac(
sas->last_error = OLM_OUTPUT_BUFFER_TOO_SMALL;
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];
_olm_crypto_hkdf_sha256(
sas->secret, sizeof(sas->secret),
@@ -164,6 +168,10 @@ size_t olm_sas_calculate_mac_long_kdf(
sas->last_error = OLM_OUTPUT_BUFFER_TOO_SMALL;
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];
_olm_crypto_hkdf_sha256(
sas->secret, sizeof(sas->secret),