From 5959b1bb4a77fc0bfa2e12df16498f5b05b71e89 Mon Sep 17 00:00:00 2001 From: "Jan Winkelmann (keks)" Date: Thu, 1 Feb 2024 17:17:54 +0100 Subject: [PATCH] update test code --- tests/aesgcm.rs | 12 +++++++++--- tests/chachapoly.rs | 9 +++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/tests/aesgcm.rs b/tests/aesgcm.rs index f7d4f9e99..0954e9a1e 100644 --- a/tests/aesgcm.rs +++ b/tests/aesgcm.rs @@ -7,7 +7,7 @@ use libcrux::{ aead::{ decrypt, encrypt, Aes128Key, Aes256Key, Algorithm::{Aes128Gcm, Aes256Gcm}, - EncryptError, Iv, Key, + EncryptError, InvalidArgumentError, Iv, Key, }, aes_ni_support, }; @@ -34,7 +34,10 @@ fn aesgcm_self_test() { let tag = match encrypt(&key, &mut msg, iv, aad) { Ok(t) => t, Err(e) => { - if matches!(e, EncryptError::UnsupportedAlgorithm) { + if matches!( + e, + EncryptError::InvalidArgument(InvalidArgumentError::UnsupportedAlgorithm) + ) { eprintln!("AES not supported on this architecture."); return; } else { @@ -83,7 +86,10 @@ fn aesgcm_self_test_rand() { let tag = match encrypt(&key, &mut msg, iv, aad) { Ok(t) => t, Err(e) => { - if matches!(e, EncryptError::UnsupportedAlgorithm) { + if matches!( + e, + EncryptError::InvalidArgument(InvalidArgumentError::UnsupportedAlgorithm) + ) { eprintln!("AES not supported on this architecture."); return; } else { diff --git a/tests/chachapoly.rs b/tests/chachapoly.rs index 1fc7c3b32..c1769cb71 100644 --- a/tests/chachapoly.rs +++ b/tests/chachapoly.rs @@ -12,7 +12,7 @@ use libcrux::{ aead::{ self, decrypt, encrypt, Algorithm::{self, Chacha20Poly1305}, - Chacha20Key, EncryptError, Iv, Key, Tag, + Chacha20Key, EncryptError, InvalidArgumentError, Iv, Key, Tag, }, aes_ni_support, }; @@ -176,7 +176,12 @@ fn wycheproof() { let tag = match aead::encrypt(&aead_key, &mut msg_ctxt, Iv(nonce), &aad) { Ok(v) => v, Err(e) => { - if matches!(e, EncryptError::UnsupportedAlgorithm) { + if matches!( + e, + EncryptError::InvalidArgument( + InvalidArgumentError::UnsupportedAlgorithm + ) + ) { eprintln!("AES not supported on this architecture."); *skipped_tests += 1; continue;