Skip to content

Commit

Permalink
152: Fixing cert identifier bug
Browse files Browse the repository at this point in the history
There was a bug where we were comparing the whole
byte stream instead of the first 27 bytes of data.

Signed-off-by: Larry Dewey <larry.dewey@amd.com>
  • Loading branch information
larrydewey committed Feb 16, 2024
1 parent 5d8d03c commit a972f3c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/certs/snp/cert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ impl Certificate {
Ok(self.0.public_key()?)
}

/// Identifies the format of a certificate based upon the first twenty-eight
/// Identifies the format of a certificate based upon the first twenty-seven
/// bytes of a byte stream. A non-PEM format assumes DER format.
fn identify_format(bytes: &[u8]) -> CertFormat {
const PEM_START: &[u8] = b"-----BEGIN CERTIFICATE-----";
match bytes {
match bytes[0..27] {
PEM_START => CertFormat::Pem,

Check failure on line 115 in src/certs/snp/cert.rs

View workflow job for this annotation

GitHub Actions / sw openssl stable debug openssl

mismatched types

Check failure on line 115 in src/certs/snp/cert.rs

View workflow job for this annotation

GitHub Actions / sw openssl stable release openssl

mismatched types

Check failure on line 115 in src/certs/snp/cert.rs

View workflow job for this annotation

GitHub Actions / cargo clippy openssl

mismatched types

Check failure on line 115 in src/certs/snp/cert.rs

View workflow job for this annotation

GitHub Actions / sw openssl 1.70.0 debug openssl

mismatched types

Check failure on line 115 in src/certs/snp/cert.rs

View workflow job for this annotation

GitHub Actions / sw openssl 1.70.0 release openssl

mismatched types
_ => CertFormat::Der,
}
Expand Down

0 comments on commit a972f3c

Please sign in to comment.