Skip to content

Commit

Permalink
Fix warnings reports by MIRAI
Browse files Browse the repository at this point in the history
Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
  • Loading branch information
sunceping committed Sep 19, 2023
1 parent 20d5e96 commit c9c69ab
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/attestation/src/root_ca.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ pub fn set_ca(cert: &'static [u8]) -> Result<(), Error> {
.try_call_once(|| Certificate::from_der(cert))
.map_err(|_| Error::InvalidRootCa)?;

if ROOT_CA
.get()
let cert = ROOT_CA.get();
if cert.is_none() {
return Err(Error::InvalidRootCa);
}

if cert
.unwrap()
.tbs_certificate
.subject_public_key_info
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/src/ek_cert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::resolve::{
};
use crate::x509::{self, DistinguishedName, Extension};
use crate::{
resolve::{ResolveError, ID_EC_PUBKEY_OID, SECP384R1_OID, VTPMTD_EXTENDED_KEY_USAGE},
resolve::{ResolveError, ID_EC_PUBKEY_OID, SECP384R1_OID},
x509::{AlgorithmIdentifier, X509Error},
};

Expand Down
2 changes: 1 addition & 1 deletion src/tpm/src/tpm2_cmd_rsp/getcaps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const TPM_CAP_TPM_PROPERTIES: u32 = 6;
fn read_u32_from_bytes(bytes: &[u8], be: bool) -> u32 {
let mut buf: [u8; 4] = [0; 4];
buf.copy_from_slice(bytes);
let mut val: u32;
let val: u32;
if be {
val = u32::from_be_bytes(buf);
} else {
Expand Down

0 comments on commit c9c69ab

Please sign in to comment.