mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
rust/pvattest: Add check command
Add a new command: check. This allows users to perform policy checks on the Attestation result. The host-key hashes, and the user-data can be tested for certain values. While at it fix some typos and enable CSV parsing for the Additional-data flags. Example: ``` pvattest check attestresp checkresult -k hkd0.crt,hkd1.crt --host-key-check AttKeyCheck ``` Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
@@ -139,6 +139,19 @@ impl<'a, T: Serialize + From<&'a [u8]> + Sized> AdditionalData<T> {
|
||||
unrecognized: unrecognized.map(|i| i.into()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Create from a slice of additional-data
|
||||
///
|
||||
/// `data`: Unstructured additional-data
|
||||
/// `flags`: Flags indicating which additional-data field is present.
|
||||
///
|
||||
/// # Error
|
||||
///
|
||||
/// Fails if there is a mismatch between the data and the flags. Should not happen after a
|
||||
/// successful attestation verification.
|
||||
pub fn from_slice_sized(data: &'a [u8], flags: &AttestationFlags) -> Result<Self> {
|
||||
AdditionalData::<&'a [u8]>::from_slice(data, flags).map(Self::from_other)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> AdditionalData<&'a [u8]> {
|
||||
|
||||
Reference in New Issue
Block a user