forked from virtee/sev
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed testing to have comprehensive testing for the library
Several bugs caught when trying to run cargo test with different feature combinations. Fixed these bugs and made some slight tweaks to be able to run comprehensive testing on the library. - When running cargo test with dangerous_hw_tests enabled both has_sev and has_sev_guest tests were run leading to a failure. Fixed by removing an unecessary or - Renamed has_sev to host and renamed has_sev_guest to guest - ID-BLOCK had to be put behind openssl only - Changed snp_config test to hit only the IOCTL and not modify the config. This was done to avoid messing up system configs during testing. - Renamed the launch test to sev_launch test. This allows us to test that launch test individually. - Added code to create a legacy SEV cert-chain locally. This allows us to test the SEV launch test without the need of an external tool. - Cached Turin certificates to the SEV builtin certs and the SNP builtin certs. Signed-off-by: DGonzalezVillal <Diego.GonzalezVillalobos@amd.com>
- Loading branch information
1 parent
f892722
commit 542e3b7
Showing
18 changed files
with
1,350 additions
and
178 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ pub mod genoa; | |
pub mod milan; | ||
pub mod naples; | ||
pub mod rome; | ||
pub mod turin; |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//! AMD's TURIN certificates. | ||
//! | ||
//! Certificate provenance: <https://developer.amd.com/wp-content/resources/ask_ark_turin.cert> | ||
//! | ||
//! For convenience, the certificate chain has been split into individual | ||
//! certificates and are embedded here as byte slices. | ||
/// The public Turin ARK certificate. | ||
pub const ARK: &[u8] = include_bytes!("ark.cert"); | ||
|
||
/// The public Turin ASK certificate. | ||
pub const ASK: &[u8] = include_bytes!("ask.cert"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,7 @@ pub mod genoa; | |
/// Milan generation. | ||
pub mod milan; | ||
|
||
/// Turin generation | ||
pub mod turin; | ||
|
||
use super::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIGYzCCBBKgAwIBAgIDAwAAMEYGCSqGSIb3DQEBCjA5oA8wDQYJYIZIAWUDBAIC | ||
BQChHDAaBgkqhkiG9w0BAQgwDQYJYIZIAWUDBAICBQCiAwIBMKMDAgEBMHsxFDAS | ||
BgNVBAsMC0VuZ2luZWVyaW5nMQswCQYDVQQGEwJVUzEUMBIGA1UEBwwLU2FudGEg | ||
Q2xhcmExCzAJBgNVBAgMAkNBMR8wHQYDVQQKDBZBZHZhbmNlZCBNaWNybyBEZXZp | ||
Y2VzMRIwEAYDVQQDDAlBUkstVHVyaW4wHhcNMjMwNTE1MjAwMzEyWhcNNDgwNTE1 | ||
MjAwMzEyWjB7MRQwEgYDVQQLDAtFbmdpbmVlcmluZzELMAkGA1UEBhMCVVMxFDAS | ||
BgNVBAcMC1NhbnRhIENsYXJhMQswCQYDVQQIDAJDQTEfMB0GA1UECgwWQWR2YW5j | ||
ZWQgTWljcm8gRG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I | ||
AWUDBAICBQCiAwIBMKMDAgEBA4ICAQA/i6Mz4IETMK8YU/HxP7Bfej5i4aXhenJo | ||
TuiDX0nqx5CDJm9ELhskxAkJ/oLA1O92UoLybfFk4gEpKFtyfiUYex9LogZj5ix0 | ||
sb2qfSSy9CRnOktGqfpel4e3KAhLgF5n2qZrqyq/8EPPldtSjEXn78sZMlIlUcQK | ||
SnnNCQZVFpktDfDiEiGNuitux3ghHUrcVuxSbZcrXDbsbMF7NDdfLUUS9TijrL33 | ||
lrCXJs7m8kggGyCusiRQKHli1AEswiA4xU+8xsZrByYTopiGYtbJK8s0UCCXylyO | ||
uKSubvdAnMDJ5GDD0+DX46LSfv7fgGNSG+LOBWdif7KoQf9cIhKJtxGxZCn/tvHm | ||
wMzu4Jnx8N2vRnT+8DpBqhxtNvdXmrZUelSeQakx4djMKvmTR8Gd25EnC4RppCkj | ||
bmPxY3zPd1X7raalTn34EOF9DeLsC9JfzkDuojxpHWMm30wKnDo20mlDQk/zKCDa | ||
2Zc+YjtsTZCrTbvdgCukTKNZOUUVlWRu+sO/OwrmS2p16seHTIqHEbE1LntPv3gk | ||
CcHGDSUAKx9c0Aol+Dj9xpb2nmGqoDeJ59Ja6REkHCdw5TduXyqqMqfD1AX0/QDN | ||
devCMKlWBRCQ7DFlog3H1a+r/kuMUZ/Ij9yyKlSgYZMJ4VgNKDgTQdcsAL0MCEMr | ||
zpacMwFusA== | ||
-----END CERTIFICATE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIGiTCCBDigAwIBAgIDAwABMEYGCSqGSIb3DQEBCjA5oA8wDQYJYIZIAWUDBAIC | ||
BQChHDAaBgkqhkiG9w0BAQgwDQYJYIZIAWUDBAICBQCiAwIBMKMDAgEBMHsxFDAS | ||
Bg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Rf+mP0NfzJb+6ZHNsOvyq/WByYpLXV9JJoiDW/ | ||
8RZwPU/Mn7IuQBauCy78G7FS0ta3q1et74faYBBgeJ6awEasa25CvmsmlU0R | ||
-----END CERTIFICATE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use super::*; | ||
|
||
/// The public Turin ARK certificate (PEM-encoded). | ||
pub const ARK: &[u8] = include_bytes!("ark.pem"); | ||
|
||
/// The public Turin ASK certificate (PEM-encoded). | ||
pub const ASK: &[u8] = include_bytes!("ask.pem"); | ||
|
||
/// Get the Turin ARK Certificate. | ||
pub fn ark() -> Result<Certificate> { | ||
Certificate::from_pem(ARK) | ||
} | ||
|
||
/// Get the Turin ASK Certificate. | ||
pub fn ask() -> Result<Certificate> { | ||
Certificate::from_pem(ASK) | ||
} | ||
|
||
mod tests { | ||
#[test] | ||
fn ark_self_signed() { | ||
use super::*; | ||
|
||
let ark = ark().unwrap(); | ||
|
||
(&ark, &ark).verify().unwrap(); | ||
} | ||
|
||
#[test] | ||
fn ark_signs_ask() { | ||
use super::*; | ||
|
||
let ark = ark().unwrap(); | ||
let ask = ask().unwrap(); | ||
|
||
(&ark, &ask).verify().unwrap(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.