Skip to content

Commit ad0810a

Browse files
committed
tests: Reproducer for empty AllowedMechanisms issue with SoftHSM
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
1 parent 44dcbe9 commit ad0810a

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
@@ -1117,6 +1117,20 @@ fn import_export() -> TestResult {
11171117
panic!("Expected the Modulus attribute.");
11181118
}
11191119

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

0 commit comments

Comments
 (0)