Fix TLV sizes for signed images
TLV types don't need to list KEYHASH because it's already added by any
signature TLV.
Total sizes were missing the KEYHASH amount.
Add a new TLV for images signed with RSA and encrypted with RSA-OAEP.
@@ -61,8 +61,8 @@ impl TlvGen {
pub fn new_rsa_pss() -> TlvGen {
TlvGen {
flags: 0,
- kinds: vec![TlvKinds::SHA256, TlvKinds::KEYHASH, TlvKinds::RSA2048],
- size: 4 + 32 + 4 + 256,
+ kinds: vec![TlvKinds::SHA256, TlvKinds::RSA2048],
+ size: 4 + 32 + 4 + 32 + 4 + 256,
payload: vec![],
}
}
@@ -71,8 +71,8 @@ impl TlvGen {
pub fn new_ecdsa() -> TlvGen {
TlvGen {
flags: 0,
- kinds: vec![TlvKinds::SHA256, TlvKinds::KEYHASH, TlvKinds::ECDSA256],
- size: 4 + 32 + 4 + 72,
+ kinds: vec![TlvKinds::SHA256, TlvKinds::ECDSA256],
+ size: 4 + 32 + 4 + 32 + 4 + 72,
payload: vec![],
}
}
@@ -87,6 +87,16 @@ impl TlvGen {
}
}
+ #[allow(dead_code)]
+ pub fn new_sig_enc_rsa() -> TlvGen {
+ TlvGen {
+ flags: TlvFlags::ENCRYPTED as u32,
+ kinds: vec![TlvKinds::SHA256, TlvKinds::RSA2048, TlvKinds::ENCRSA2048],
+ size: 4 + 32 + 4 + 32 + 4 + 256 + 4 + 256,
+ payload: vec![],
+ }
+ }
+
#[allow(dead_code)]
pub fn new_enc_kw() -> TlvGen {
TlvGen {
