Skip to content

Commit f2ee601

Browse files
committed
#267: Modified get_attribute_info_map to take slice instead of vec.
Signed-off-by: Ivo Zeba <[email protected]>
1 parent 1d52d25 commit f2ee601

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

cryptoki/src/session/object_management.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -486,9 +486,9 @@ impl Session {
486486
pub fn get_attribute_info_map(
487487
&self,
488488
object: ObjectHandle,
489-
attributes: Vec<AttributeType>,
489+
attributes: &[AttributeType],
490490
) -> Result<HashMap<AttributeType, AttributeInfo>> {
491-
let attrib_info = self.get_attribute_info(object, attributes.as_slice())?;
491+
let attrib_info = self.get_attribute_info(object, attributes)?;
492492

493493
Ok(attributes
494494
.iter()

cryptoki/tests/basic.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1192,8 +1192,9 @@ fn get_attribute_info_test() -> TestResult {
11921192
session.generate_key_pair(&mechanism, &pub_key_template, &priv_key_template)?;
11931193

11941194
let pub_attribs = vec![AttributeType::PublicExponent, AttributeType::Modulus];
1195-
let mut priv_attribs = pub_attribs.clone();
1196-
priv_attribs.push(AttributeType::PrivateExponent);
1195+
let mut priv_attribs = [
1196+
AttributeType::PublicExponent, AttributeType::Modulus, AttributeType::PrivateExponent
1197+
];
11971198

11981199
let attrib_info = session.get_attribute_info(public, &pub_attribs)?;
11991200
let hash = pub_attribs
@@ -1234,7 +1235,7 @@ fn get_attribute_info_test() -> TestResult {
12341235
_ => panic!("Private Exponent of RSA private key should be sensitive"),
12351236
}
12361237

1237-
let hash = session.get_attribute_info_map(private, priv_attribs)?;
1238+
let hash = session.get_attribute_info_map(private, &priv_attribs)?;
12381239
if let AttributeInfo::Available(size) = hash[&AttributeType::Modulus] {
12391240
assert_eq!(size, 2048 / 8);
12401241
} else {

0 commit comments

Comments
 (0)