remove all assert in non-test code

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-05-16 14:40:33 +08:00
parent 2d7bebb54b
commit edf6b00f13
5 changed files with 9 additions and 7 deletions

View File

@@ -349,7 +349,9 @@ impl Encrypt {
their_pk_b: &[u8],
our_sk_b: &box_::SecretKey,
) -> ResultType<Key> {
assert!(their_pk_b.len() == box_::PUBLICKEYBYTES);
if their_pk_b.len() != box_::PUBLICKEYBYTES {
anyhow::bail!("Handshake failed: pk length {}", their_pk_b.len());
}
let nonce = box_::Nonce([0u8; box_::NONCEBYTES]);
let mut pk_ = [0u8; box_::PUBLICKEYBYTES];
pk_[..].copy_from_slice(their_pk_b);