Skip to content

Commit 85fd7be

Browse files
gaojiaqi7jyao1
authored andcommitted
td-shim: upgrade der to close compiler warnings
Signed-off-by: Jiaqi Gao <[email protected]>
1 parent 678f124 commit 85fd7be

File tree

3 files changed

+22
-32
lines changed

3 files changed

+22
-32
lines changed

Cargo.lock

+15-25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

td-shim/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ x86 = { version ="0.47.0", optional = true }
3939
x86_64 = { version = "0.14.9", default-features = false, features = ["instructions"], optional = true }
4040

4141
# secure boot
42-
der = {version = "0.4.5", features = ["derive", "alloc"], optional = true}
42+
der = {version = "0.7.9", features = ["derive", "alloc"], optional = true}
4343

4444
# TDX
4545
tdx-tdcall = { path = "../tdx-tdcall", optional = true }

td-shim/src/secure_boot.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use core::mem::size_of;
1212
use core::ptr::slice_from_raw_parts;
1313

14-
use der::{asn1::UIntBytes, Encodable, Message};
14+
use der::{asn1::UintRef, Encode, Sequence};
1515
use r_efi::efi::Guid;
1616
use ring::{
1717
digest,
@@ -120,10 +120,10 @@ pub enum VerifyErr {
120120
// modulus INTEGER, -- n
121121
// publicExponent INTEGER } -- e
122122
//
123-
#[derive(Copy, Clone, Debug, Eq, PartialEq, Message)]
123+
#[derive(Copy, Clone, Debug, Eq, PartialEq, Sequence)]
124124
struct RsaPublicKeyDer<'a> {
125-
pub modulus: UIntBytes<'a>,
126-
pub exponents: UIntBytes<'a>,
125+
pub modulus: UintRef<'a>,
126+
pub exponents: UintRef<'a>,
127127
}
128128

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

202202
let der = RsaPublicKeyDer {
203-
modulus: UIntBytes::new(modulus).map_err(|_e| VerifyErr::InvalidContent)?,
204-
exponents: UIntBytes::new(exp).map_err(|_e| VerifyErr::InvalidContent)?,
203+
modulus: UintRef::new(modulus).map_err(|_e| VerifyErr::InvalidContent)?,
204+
exponents: UintRef::new(exp).map_err(|_e| VerifyErr::InvalidContent)?,
205205
};
206206
let encoded = der
207207
.encode_to_slice(&mut formated_public_key)

0 commit comments

Comments
 (0)