rust/pv: Add-Secret: Add user-data types

Add four new user-data types an add-secret request could have:
Unsigned, Signed(EcSECP521R1, Rsa(2048, 3072))

As the user-data enum was not marked as non-exaustive this might be a
breaking change for users. (Not for any crate in this repo though).

The addition of such user-data is provided by following patches.

Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Steffen Eiden
2024-01-30 12:55:53 +01:00
committed by Jan Höppner
parent bfd0e12d22
commit f36c34038b
4 changed files with 143 additions and 15 deletions
+1 -5
View File
@@ -240,11 +240,7 @@ impl AddSecretRequest {
self.keyslots.iter().for_each(|k| aad.push(Aad::Ks(k)));
aad.push(Aad::Plain(&secr_auth));
ctx.build_aad(self.version.into(), &aad, conf_len, self.magic())
}
fn magic(&self) -> crate::request::RequestMagic {
self.magic.as_bytes().try_into().unwrap()
ctx.build_aad(self.version.into(), &aad, conf_len, self.magic.get())
}
#[doc(hidden)]
+1 -1
View File
@@ -63,7 +63,7 @@ impl AddCmd {
let mut data = Vec::with_capacity(PAGESIZE);
bin_add_secret_req.read_to_end(&mut data)?;
if !AddSecretMagic::starts_with_magic(&data[..6]) {
if !AddSecretMagic::starts_with_magic(&data) {
return Err(Error::NoAsrcb);
}
Ok(Self(data))