rust/pv: Add conversion implementations

Add AsRef<[u8]> and TryFrom<Vec<u8>> implementations so that the tag
data can be converted into base64.
See: https://docs.rs/serde_with/latest/serde_with/base64/struct.Base64.html

While at it, fix some typos and simplify the tag extraction.

Suggested-by:  Qi Feng Huo <huoqif@cn.ibm.com>
Acked-by: Qi Feng Huo <huoqif@cn.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
Steffen Eiden
2024-05-14 10:43:04 +02:00
parent 16875f7c6d
commit 38600bb4e2
2 changed files with 58 additions and 12 deletions
+3
View File
@@ -79,6 +79,9 @@ pub enum Error {
#[error("The provided host key document in {0} contains no certificate!")]
NoHkdInFile(String),
#[error("Invalid input size ({0}) for boot hdr")]
InvBootHdrSize(usize),
// errors from other crates
#[error(transparent)]
PvCore(#[from] pv_core::Error),