test(aes): add AES-CBC NIST SP 800-38A test vectors

Add integration tests for AES-CBC mode:
    - Single block encrypt/decrypt with NIST vectors
    - Multi-block encrypt with NIST vectors
    - Multi-block roundtrip verification
    - Empty plaintext handling
    - Arbitrary length plaintext
This commit is contained in:
2025-12-31 04:11:15 +02:00
parent 1ffc0327b3
commit ae33c596ef
2 changed files with 119 additions and 3 deletions

View File

@@ -55,9 +55,10 @@ impl CipherContext {
}
fn process_cbc(&self) -> CipherResult<String> {
let iv = self.iv.as_ref().ok_or_else(|| {
CipherError::InvalidPadding("CBC mode requires an IV".into())
})?;
let iv = self
.iv
.as_ref()
.ok_or_else(|| CipherError::InvalidPadding("CBC mode requires an IV".into()))?;
let cipher = self.algorithm.new_cbc_cipher(&self.key, iv)?;