Skip to content

Commit c45d4d4

Browse files
authored
Merge pull request #274 from Superhepper/auth_policy_method
Added auth_policy method to ther Public structure.
2 parents cedb8c6 + be5355b commit c45d4d4

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

tss-esapi/src/structures/buffers/public.rs

+22-16
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,14 @@ impl Public {
329329
match self {
330330
Public::Rsa {
331331
object_attributes, ..
332-
} => *object_attributes,
333-
Public::KeyedHash {
332+
}
333+
| Public::KeyedHash {
334334
object_attributes, ..
335-
} => *object_attributes,
336-
Public::Ecc {
335+
}
336+
| Public::Ecc {
337337
object_attributes, ..
338-
} => *object_attributes,
339-
Public::SymCipher {
338+
}
339+
| Public::SymCipher {
340340
object_attributes, ..
341341
} => *object_attributes,
342342
}
@@ -346,27 +346,33 @@ impl Public {
346346
pub fn name_hashing_algorithm(&self) -> HashingAlgorithm {
347347
match self {
348348
Public::Rsa {
349-
object_attributes: _,
350349
name_hashing_algorithm,
351350
..
352-
} => *name_hashing_algorithm,
353-
Public::KeyedHash {
354-
object_attributes: _,
351+
}
352+
| Public::KeyedHash {
355353
name_hashing_algorithm,
356354
..
357-
} => *name_hashing_algorithm,
358-
Public::Ecc {
359-
object_attributes: _,
355+
}
356+
| Public::Ecc {
360357
name_hashing_algorithm,
361358
..
362-
} => *name_hashing_algorithm,
363-
Public::SymCipher {
364-
object_attributes: _,
359+
}
360+
| Public::SymCipher {
365361
name_hashing_algorithm,
366362
..
367363
} => *name_hashing_algorithm,
368364
}
369365
}
366+
367+
/// Returns the auth policy digest.
368+
pub fn auth_policy(&self) -> &Digest {
369+
match self {
370+
Public::Rsa { auth_policy, .. }
371+
| Public::KeyedHash { auth_policy, .. }
372+
| Public::Ecc { auth_policy, .. }
373+
| Public::SymCipher { auth_policy, .. } => auth_policy,
374+
}
375+
}
370376
}
371377

372378
impl From<Public> for TPM2B_PUBLIC {

0 commit comments

Comments
 (0)