Skip to content

Commit

Permalink
td-shim: upgrade der to close compiler warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Jiaqi Gao <[email protected]>
  • Loading branch information
gaojiaqi7 committed Dec 19, 2024
1 parent e116eb1 commit d8cf119
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 32 deletions.
40 changes: 15 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion td-shim/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ x86 = { version ="0.47.0", optional = true }
x86_64 = { version = "0.14.9", default-features = false, features = ["instructions"], optional = true }

# secure boot
der = {version = "0.4.5", features = ["derive", "alloc"], optional = true}
der = {version = "0.7.9", features = ["derive", "alloc"], optional = true}

# TDX
tdx-tdcall = { path = "../tdx-tdcall", optional = true }
Expand Down
12 changes: 6 additions & 6 deletions td-shim/src/secure_boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use core::mem::size_of;
use core::ptr::slice_from_raw_parts;

use der::{asn1::UIntBytes, Encodable, Message};
use der::{asn1::UintRef, Encode, Sequence};
use r_efi::efi::Guid;
use ring::{
digest,
Expand Down Expand Up @@ -120,10 +120,10 @@ pub enum VerifyErr {
// modulus INTEGER, -- n
// publicExponent INTEGER } -- e
//
#[derive(Copy, Clone, Debug, Eq, PartialEq, Message)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Sequence)]
struct RsaPublicKeyDer<'a> {
pub modulus: UIntBytes<'a>,
pub exponents: UIntBytes<'a>,
pub modulus: UintRef<'a>,
pub exponents: UintRef<'a>,
}

pub struct PayloadVerifier<'a> {
Expand Down Expand Up @@ -200,8 +200,8 @@ impl<'a> PayloadVerifier<'a> {
signature = &signed_payload[offset..offset + 384];

let der = RsaPublicKeyDer {
modulus: UIntBytes::new(modulus).map_err(|_e| VerifyErr::InvalidContent)?,
exponents: UIntBytes::new(exp).map_err(|_e| VerifyErr::InvalidContent)?,
modulus: UintRef::new(modulus).map_err(|_e| VerifyErr::InvalidContent)?,
exponents: UintRef::new(exp).map_err(|_e| VerifyErr::InvalidContent)?,
};
let encoded = der
.encode_to_slice(&mut formated_public_key)
Expand Down

0 comments on commit d8cf119

Please sign in to comment.