Skip to content

Commit 40ab9f8

Browse files
committed
tests: Explicitly set attributes that are checked for KBKDF
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
1 parent 2cc5475 commit 40ab9f8

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

cryptoki/tests/basic.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2514,6 +2514,8 @@ fn kbkdf_additional_keys_counter_mode() -> TestResult {
25142514
Attribute::ValueLen((AES128_BLOCK_SIZE as u64).into()),
25152515
Attribute::Sign(true),
25162516
Attribute::Verify(true),
2517+
Attribute::Encrypt(false),
2518+
Attribute::Decrypt(false),
25172519
],
25182520
vec![
25192521
Attribute::Token(true),
@@ -2522,6 +2524,8 @@ fn kbkdf_additional_keys_counter_mode() -> TestResult {
25222524
Attribute::KeyType(KeyType::GENERIC_SECRET),
25232525
Attribute::ValueLen(1.into()),
25242526
Attribute::Derive(true),
2527+
Attribute::Encrypt(false),
2528+
Attribute::Decrypt(false),
25252529
],
25262530
];
25272531

@@ -2598,6 +2602,8 @@ fn kbkdf_additional_keys_counter_mode() -> TestResult {
25982602
Attribute::Sign(true),
25992603
Attribute::Verify(true),
26002604
Attribute::Derive(false),
2605+
Attribute::Encrypt(false),
2606+
Attribute::Decrypt(false),
26012607
],
26022608
vec![
26032609
Attribute::Class(ObjectClass::SECRET_KEY),
@@ -2608,14 +2614,16 @@ fn kbkdf_additional_keys_counter_mode() -> TestResult {
26082614
Attribute::Sign(false),
26092615
Attribute::Verify(false),
26102616
Attribute::Derive(true),
2617+
Attribute::Encrypt(false),
2618+
Attribute::Decrypt(false),
26112619
],
26122620
];
26132621

26142622
for (key, wanted_attributes) in derived_keys.iter().zip(wanted_attributes.iter().cycle()) {
26152623
let have_attributes = session.get_attributes(*key, &attributes_to_check)?;
26162624

26172625
for (value_wanted, value_have) in wanted_attributes.iter().zip(have_attributes.iter()) {
2618-
assert_eq!(value_wanted, value_have);
2626+
assert_eq!(value_wanted, value_have, "The generated key {key} has unexpected attribute value");
26192627
}
26202628
}
26212629

@@ -2670,6 +2678,8 @@ fn kbkdf_additional_keys_feedback_mode() -> TestResult {
26702678
Attribute::ValueLen((AES128_BLOCK_SIZE as u64).into()),
26712679
Attribute::Sign(true),
26722680
Attribute::Verify(true),
2681+
Attribute::Encrypt(false),
2682+
Attribute::Decrypt(false),
26732683
],
26742684
vec![
26752685
Attribute::Token(true),
@@ -2678,6 +2688,8 @@ fn kbkdf_additional_keys_feedback_mode() -> TestResult {
26782688
Attribute::KeyType(KeyType::GENERIC_SECRET),
26792689
Attribute::ValueLen(1.into()),
26802690
Attribute::Derive(true),
2691+
Attribute::Encrypt(false),
2692+
Attribute::Decrypt(false),
26812693
],
26822694
];
26832695

0 commit comments

Comments
 (0)