secio: don't panic in agree_ephemeral. (#480)

Given that echoing back our local key and nonce would result in equal
digest values, we should treat this as an error instead of panicking.
This commit is contained in:
Toralf Wittner
2018-09-14 11:37:40 +02:00
committed by GitHub
parent b2756c8fa9
commit 0614b0d44e
2 changed files with 36 additions and 29 deletions

View File

@ -499,7 +499,10 @@ where
let (local_infos, remote_infos) = {
let (first_half, second_half) = longer_key.split_at(longer_key.len() / 2);
match context.hashes_ordering {
Ordering::Equal => panic!(),
Ordering::Equal => {
let msg = "equal digest of public key and nonce for local and remote";
return Err(SecioError::InvalidProposition(msg))
}
Ordering::Less => (second_half, first_half),
Ordering::Greater => (first_half, second_half),
}