-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #515 from ionut-arm/trans-key-ctx
Update provider to use new version fo TransKeyCtx
- Loading branch information
Showing
13 changed files
with
454 additions
and
284 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 |
---|---|---|
|
@@ -3,3 +3,5 @@ | |
mod key_mappings; | ||
mod normal_tests; | ||
mod stress_test; | ||
#[cfg(feature = "tpm-provider")] | ||
mod tpm_reset; |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2021 Contributors to the Parsec project. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// These tests track a potential regression where the TPM provider | ||
// was unable to handle stored keys after a TPM reset. | ||
// | ||
// `before_tpm_reset` creates keys that should be usable post-TPM-reset, | ||
// in `after_tpm_reset`. | ||
// | ||
// See: https://github.com/parallaxsecond/parsec/issues/504 | ||
use e2e_tests::TestClient; | ||
|
||
const RSA_KEY_NAME: &str = "tpm-reset-rsa"; | ||
const ECC_KEY_NAME: &str = "tpm-reset-ecc"; | ||
|
||
#[test] | ||
fn before_tpm_reset() { | ||
let mut client = TestClient::new(); | ||
client.do_not_destroy_keys(); | ||
|
||
let rsa_key_name = String::from(RSA_KEY_NAME); | ||
let ecc_key_name = String::from(ECC_KEY_NAME); | ||
|
||
client.generate_rsa_sign_key(rsa_key_name.clone()).unwrap(); | ||
client | ||
.generate_ecc_key_pair_secpr1_ecdsa_sha256(ecc_key_name.clone()) | ||
.unwrap(); | ||
} | ||
|
||
#[test] | ||
fn after_tpm_reset() { | ||
let mut client = TestClient::new(); | ||
|
||
let rsa_key_name = String::from(RSA_KEY_NAME); | ||
let ecc_key_name = String::from(ECC_KEY_NAME); | ||
|
||
let _ = client | ||
.sign_with_rsa_sha256(rsa_key_name, vec![0xff; 32]) | ||
.unwrap(); | ||
let _ = client | ||
.sign_with_ecdsa_sha256(ecc_key_name, vec![0xff; 32]) | ||
.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.