Skip to content

Commit 84339fb

Browse files
committed
tests: Reproducer for empty AllowedMechanisms issue with SoftHSM
Signed-off-by: Jakub Jelen <[email protected]>
1 parent 5c494cd commit 84339fb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

cryptoki/tests/basic.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,20 @@ fn import_export() -> TestResult {
11131113
panic!("Expected the Modulus attribute.");
11141114
}
11151115

1116+
let mut attrs =
1117+
session.get_attributes(is_it_the_public_key, &[AttributeType::AllowedMechanisms])?;
1118+
1119+
if is_softhsm() {
1120+
let attr = attrs.remove(0);
1121+
if let Attribute::AllowedMechanisms(v) = attr {
1122+
assert_eq!(v, Vec::<MechanismType>::new());
1123+
} else {
1124+
panic!("Expected the AllowedMechanisms attribute.");
1125+
}
1126+
} else {
1127+
assert_eq!(attrs, Vec::<Attribute>::new());
1128+
}
1129+
11161130
// delete key
11171131
session.destroy_object(is_it_the_public_key)?;
11181132

0 commit comments

Comments
 (0)