From 0601cf0afc5c1f1407bb5f264b21583404591b8d Mon Sep 17 00:00:00 2001 From: Franziskus Kiefer Date: Fri, 9 Jul 2021 10:16:29 +0200 Subject: [PATCH] avoid panic in eddsa verify --- evercrypt-rs/src/signature.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/evercrypt-rs/src/signature.rs b/evercrypt-rs/src/signature.rs index ecc889d..8e6b452 100644 --- a/evercrypt-rs/src/signature.rs +++ b/evercrypt-rs/src/signature.rs @@ -101,6 +101,12 @@ pub fn verify( ) -> Result { match mode { Mode::Ed25519 => { + if signature.len() != 64 { + return Err(Error::InvalidSignature); + } + if pk.len() != 32 { + return Err(Error::InvalidPoint); + } let mut key = [0u8; 32]; key.clone_from_slice(pk); let mut sig = [0u8; 64];