pub fn verify(
        self,
        digest: &[u8],
        build: Build,
        msr: launch::sev::Measurement,
    ) -> Result<Session<Verified>> {
        let key = pkey::PKey::hmac(&*self.tik)?;
        let mut sig = sign::Signer::new(hash::MessageDigest::sha256(), &key)?;

        sig.update(&[0x04u8])?;
        sig.update(&[build.version.major, build.version.minor, build.build])?;
        sig.update(&self.policy.bytes())?;
        sig.update(digest)?;
        sig.update(&msr.mnonce)?;

        if sig.sign_to_vec()? != msr.measure {
            return Err(ErrorKind::InvalidInput.into());
        }

        Ok(Session {
            policy: self.policy,
            tek: self.tek,
            tik: self.tik,
            data: Verified(msr),
        })
    }
/// Verifies the AMD SP's measurement.
Verifies the AMD SP's measurement.
Verifies the AMD SP ' s measurement .
pub fn verify(
        self,
        digest: &[u8],
        build: Build,
        msr: launch::sev::Measurement,
    ) -> Result<Session<Verified>> {
        let key = pkey::PKey::hmac(&*self.tik)?;
        let mut sig = sign::Signer::new(hash::MessageDigest::sha256(), &key)?;
        sig.update(&[0x04u8])?;
        sig.update(&[build.version.major, build.version.minor, build.build])?;
        sig.update(&self.policy.bytes())?;
        sig.update(digest)?;
        sig.update(&msr.mnonce)?;
        if sig.sign_to_vec()? != msr.measure {
            return Err(ErrorKind::InvalidInput.into());
        }
        Ok(Session {
            policy: self.policy,
            tek: self.tek,
            tik: self.tik,
            data: Verified(msr),
        })
    }
pub fn verify ( self , digest : & [ u8 ] , build : Build , msr : launch :: sev :: Measurement , ) -> Result < Session < Verified > > { let key = pkey :: PKey :: hmac ( & * self . tik ) ? ; let mut sig = sign :: Signer :: new ( hash :: MessageDigest :: sha256 ( ) , & key ) ? ; sig . update ( & [ 0x04u8 ] ) ? ; sig . update ( & [ build . version . major , build . version . minor , build . build ] ) ? ; sig . update ( & self . policy . bytes ( ) ) ? ; sig . update ( digest ) ? ; sig . update ( & msr . mnonce ) ? ; if sig . sign_to_vec ( ) ? != msr . measure { return Err ( ErrorKind :: InvalidInput . into ( ) ) ; } Ok ( Session { policy : self . policy , tek : self . tek , tik : self . tik , data : Verified ( msr ) , } ) }
Verifies the AMD SP's measurement.
Verifies the AMD SP ' s measurement .
self
digest
&[u8]
build
Build
msr
launch::sev::Measurement
self
digest
&[u8]
build
Build
msr
launch::sev::Measurement