Skip to content

Commit e55706f

Browse files
committed
tests: Adjust copy test for Softokn
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
1 parent dd25e7a commit e55706f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

cryptoki/tests/basic.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,10 +1501,15 @@ fn session_copy_object() -> TestResult {
15011501
let copy = rw_session.copy_object(object, &copy_template)?;
15021502
rw_session.destroy_object(copy)?;
15031503

1504-
// try the copy with the insecure template. It should fail. Returning CKR_OK is considered a failure.
1505-
rw_session
1506-
.copy_object(object, &insecure_copy_template)
1507-
.unwrap_err();
1504+
let res = rw_session.copy_object(object, &insecure_copy_template);
1505+
if is_softokn() {
1506+
// Softokn considers all keys nonextractable
1507+
let copy = res?;
1508+
rw_session.destroy_object(copy)?;
1509+
} else {
1510+
// try the copy with the insecure template. It should fail. Returning CKR_OK is considered a failure.
1511+
res.unwrap_err();
1512+
}
15081513

15091514
// delete keys
15101515
rw_session.destroy_object(object)?;

0 commit comments

Comments
 (0)