crypto: Remove an allocation when calculating the SAS MAC
parent
d877c1cf8c
commit
b52f3fb11f
|
@ -198,8 +198,9 @@ pub fn receive_mac_event(
|
||||||
ids.other_device.device_id()
|
ids.other_device.device_id()
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut keys = content.mac().keys().cloned().collect::<Vec<String>>();
|
let mut keys = content.mac().keys().map(|k| k.as_str()).collect::<Vec<_>>();
|
||||||
keys.sort();
|
keys.sort();
|
||||||
|
|
||||||
let keys = sas
|
let keys = sas
|
||||||
.calculate_mac(&keys.join(","), &format!("{}KEY_IDS", &info))
|
.calculate_mac(&keys.join(","), &format!("{}KEY_IDS", &info))
|
||||||
.expect("Can't calculate SAS MAC");
|
.expect("Can't calculate SAS MAC");
|
||||||
|
@ -215,6 +216,7 @@ pub fn receive_mac_event(
|
||||||
sender,
|
sender,
|
||||||
ids.other_device.device_id()
|
ids.other_device.device_id()
|
||||||
);
|
);
|
||||||
|
|
||||||
let key_id: DeviceKeyId = match key_id.as_str().try_into() {
|
let key_id: DeviceKeyId = match key_id.as_str().try_into() {
|
||||||
Ok(id) => id,
|
Ok(id) => id,
|
||||||
Err(_) => continue,
|
Err(_) => continue,
|
||||||
|
|
Loading…
Reference in New Issue