Skip to content
This repository was archived by the owner on Apr 15, 2022. It is now read-only.

Commit 638a3d5

Browse files
Connor Kuehlenarxbot
authored andcommitted
Don't take ownership during verification
Otherwise the borrow checker will complain if one tries to verify a certificate chain before passing it in to a Session<Start> constructor function. Signed-off-by: Connor Kuehl <[email protected]>
1 parent 53c7494 commit 638a3d5

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/certs/ca/chain.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ impl codicon::Encoder<()> for Chain {
4545
}
4646

4747
#[cfg(feature = "openssl")]
48-
impl Verifiable for Chain {
49-
type Output = Certificate;
48+
impl<'a> Verifiable for &'a Chain {
49+
type Output = &'a Certificate;
5050

51-
fn verify(self) -> Result<Certificate> {
51+
fn verify(self) -> Result<Self::Output> {
5252
(&self.ark, &self.ark).verify()?;
5353
(&self.ark, &self.ask).verify()?;
54-
Ok(self.ask)
54+
Ok(&self.ask)
5555
}
5656
}

src/certs/chain.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ impl codicon::Encoder<()> for Chain {
3737
}
3838

3939
#[cfg(feature = "openssl")]
40-
impl Verifiable for Chain {
41-
type Output = sev::Certificate;
40+
impl<'a> Verifiable for &'a Chain {
41+
type Output = &'a sev::Certificate;
4242

43-
fn verify(self) -> Result<sev::Certificate> {
43+
fn verify(self) -> Result<Self::Output> {
4444
let ask = self.ca.verify()?;
45-
(&ask, &self.sev.cek).verify()?;
45+
(ask, &self.sev.cek).verify()?;
4646
self.sev.verify()
4747
}
4848
}

src/certs/sev/chain.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ impl codicon::Encoder<()> for Chain {
6363
}
6464

6565
#[cfg(feature = "openssl")]
66-
impl Verifiable for Chain {
67-
type Output = Certificate;
66+
impl<'a> Verifiable for &'a Chain {
67+
type Output = &'a Certificate;
6868

69-
fn verify(self) -> Result<Certificate> {
69+
fn verify(self) -> Result<Self::Output> {
7070
(&self.oca, &self.oca).verify()?;
7171
(&self.oca, &self.pek).verify()?;
7272
(&self.cek, &self.pek).verify()?;
7373
(&self.pek, &self.pdh).verify()?;
74-
Ok(self.pdh)
74+
Ok(&self.pdh)
7575
}
7676
}

0 commit comments

Comments
 (0)