Skip to content

Commit 6ce1680

Browse files
Changed tests to support different backend behaviours
Signed-off-by: Jacob Prud'homme <2160185+jacobprudhomme@users.noreply.github.com>
1 parent b616cd2 commit 6ce1680

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

cryptoki/tests/basic.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,10 @@ fn sign_verify_multipart_already_initialized() -> TestResult {
363363
Error::Pkcs11(RvError::OperationActive, Function::SignInit)
364364
));
365365

366-
// Make sure signing operation is over before trying same with verification
367-
session.sign_final()?;
366+
// Make sure signing operation is over before trying same with verification.
367+
// Some backends will reset the ongoing operation after the failed 2nd call to
368+
// sign_init(), so we should not unwrap the result of this call.
369+
let _ = session.sign_final();
368370

369371
// Initialize verification operation twice in a row
370372
session.verify_init(&Mechanism::Sha256RsaPkcs, pub_key)?;
@@ -575,8 +577,10 @@ fn encrypt_decrypt_multipart_already_initialized() -> TestResult {
575577
Error::Pkcs11(RvError::OperationActive, Function::EncryptInit)
576578
));
577579

578-
// Make sure encryption operation is over before trying same with decryption
579-
session.encrypt_final()?;
580+
// Make sure encryption operation is over before trying same with decryption.
581+
// Some backends will reset the ongoing operation after the failed 2nd call to
582+
// encrypt_init(), so we should not unwrap the result of this call.
583+
let _ = session.encrypt_final();
580584

581585
// Initialize encryption operation twice in a row
582586
session.decrypt_init(&Mechanism::AesEcb, key)?;

0 commit comments

Comments
 (0)