From 77cb54471e1898cc1d741d9212994c09d61e9af3 Mon Sep 17 00:00:00 2001 From: sinu <65924192+sinui0@users.noreply.github.com> Date: Thu, 20 Jul 2023 16:01:02 -0700 Subject: [PATCH] remove panic --- ot/mpz-ot-core/src/kos/error.rs | 2 ++ ot/mpz-ot-core/src/kos/sender.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ot/mpz-ot-core/src/kos/error.rs b/ot/mpz-ot-core/src/kos/error.rs index 1623ab8f..2e61ce02 100644 --- a/ot/mpz-ot-core/src/kos/error.rs +++ b/ot/mpz-ot-core/src/kos/error.rs @@ -6,6 +6,8 @@ pub enum SenderError { InvalidState(String), #[error("count mismatch: receiver expected {0}, got {1}")] CountMismatch(usize, usize), + #[error("invalid extend")] + InvalidExtend, #[error("consistency check failed")] ConsistencyCheckFailed, #[error("not enough OTs are setup: expected {0}, actual {1}")] diff --git a/ot/mpz-ot-core/src/kos/sender.rs b/ot/mpz-ot-core/src/kos/sender.rs index 2854cada..1ca95ba2 100644 --- a/ot/mpz-ot-core/src/kos/sender.rs +++ b/ot/mpz-ot-core/src/kos/sender.rs @@ -172,7 +172,7 @@ impl Sender { } if us.len() != NROWS * row_width { - panic!(); + return Err(SenderError::InvalidExtend); } let mut qs = vec![0u8; NROWS * row_width];