Skip to content

Commit 2f3d086

Browse files
committed
Move checkquote to abstractions/no_tpm
1 parent 1e1eaec commit 2f3d086

File tree

8 files changed

+24
-25
lines changed

8 files changed

+24
-25
lines changed

tss-esapi/src/abstraction/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
pub mod ak;
55
pub mod cipher;
66
pub mod ek;
7+
pub mod no_tpm;
78
pub mod nv;
89
pub mod pcr;
910
pub mod public;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#[cfg(all(
2+
any(feature = "p224", feature = "p256", feature = "p384", feature = "rsa"),
3+
any(feature = "sha1", feature = "sha2",)
4+
))]
5+
mod quote;
6+
#[cfg(all(
7+
any(feature = "p224", feature = "p256", feature = "p384", feature = "rsa"),
8+
any(feature = "sha1", feature = "sha2",)
9+
))]
10+
pub use quote::checkquote;

tss-esapi/src/utils/quote.rs renamed to tss-esapi/src/abstraction/no_tpm/quote.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ fn checkquote_pcr_digests(
210210
/// # use std::convert::TryFrom;
211211
/// # use tss_esapi::{
212212
/// # attributes::SessionAttributes,
213-
/// # abstraction::{ak, ek, AsymmetricAlgorithmSelection},
213+
/// # abstraction::{ak, ek, AsymmetricAlgorithmSelection, no_tpm},
214214
/// # constants::SessionType, Context,
215215
/// # interface_types::{
216216
/// # algorithm::{HashingAlgorithm, SignatureSchemeAlgorithm},
@@ -221,7 +221,6 @@ fn checkquote_pcr_digests(
221221
/// # SignatureScheme, SymmetricDefinition,
222222
/// # },
223223
/// # TctiNameConf,
224-
/// # utils,
225224
/// # };
226225
/// # let mut context =
227226
/// # Context::new(
@@ -286,7 +285,7 @@ fn checkquote_pcr_digests(
286285
/// .execute_without_session(|ctx| ctx.pcr_read(pcr_selection_list))
287286
/// .unwrap();
288287
/// let public = ak_res.out_public;
289-
/// utils::checkquote(
288+
/// no_tpm::checkquote(
290289
/// &attest,
291290
/// &signature,
292291
/// &public,

tss-esapi/src/utils/mod.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,6 @@ use crate::{Context, Error, Result, WrapperErrorKind};
2323
use std::convert::TryFrom;
2424
use zeroize::Zeroize;
2525

26-
#[cfg(all(
27-
any(feature = "p224", feature = "p256", feature = "p384", feature = "rsa"),
28-
any(feature = "sha1", feature = "sha2",)
29-
))]
30-
mod quote;
31-
#[cfg(all(
32-
any(feature = "p224", feature = "p256", feature = "p384", feature = "rsa"),
33-
any(feature = "sha1", feature = "sha2",)
34-
))]
35-
pub use quote::checkquote;
36-
3726
/// Create the [Public] structure for a restricted decryption key.
3827
///
3928
/// * `symmetric` - Cipher to be used for decrypting children of the key

tss-esapi/tests/integration_tests/abstraction_tests/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33
mod ak_tests;
44
mod ek_tests;
5+
mod no_tpm;
56
mod nv_tests;
67
mod pcr_data_tests;
78
mod pcr_tests;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mod quote_test;

tss-esapi/tests/integration_tests/utils_tests/quote_test.rs renamed to tss-esapi/tests/integration_tests/abstraction_tests/no_tpm/quote_test.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mod test_quote {
55
use crate::common::create_ctx_with_session;
66
use std::convert::TryFrom;
77
use tss_esapi::{
8-
abstraction::{ak, ek, AsymmetricAlgorithmSelection},
8+
abstraction::{ak, ek, AsymmetricAlgorithmSelection, no_tpm},
99
handles::PcrHandle,
1010
interface_types::{
1111
algorithm::{HashingAlgorithm, SignatureSchemeAlgorithm},
@@ -16,7 +16,6 @@ mod test_quote {
1616
Auth, Data, Digest, DigestList, DigestValues, EccSignature, PcrSelectionListBuilder,
1717
PcrSlot, Signature, SignatureScheme,
1818
},
19-
utils,
2019
};
2120

2221
fn checkquote_ecc(hash_alg: HashingAlgorithm) {
@@ -79,7 +78,7 @@ mod test_quote {
7978
.unwrap();
8079

8180
let public = ak_res.out_public;
82-
assert!(utils::checkquote(
81+
assert!(no_tpm::checkquote(
8382
&attest,
8483
&signature,
8584
&public,
@@ -88,10 +87,10 @@ mod test_quote {
8887
)
8988
.unwrap());
9089
// Test without pcrs
91-
assert!(utils::checkquote(&attest, &signature, &public, &None, &qualifying_data).unwrap());
90+
assert!(no_tpm::checkquote(&attest, &signature, &public, &None, &qualifying_data).unwrap());
9291

9392
let wrong_nonce = vec![5, 2, 3, 8, 1, 4, 8];
94-
assert!(!utils::checkquote(&attest, &signature, &public, &None, &wrong_nonce).unwrap());
93+
assert!(!no_tpm::checkquote(&attest, &signature, &public, &None, &wrong_nonce).unwrap());
9594

9695
let wrong_ak_res = ak::create_ak(
9796
&mut context,
@@ -103,7 +102,7 @@ mod test_quote {
103102
None,
104103
)
105104
.unwrap();
106-
assert!(!utils::checkquote(
105+
assert!(!no_tpm::checkquote(
107106
&attest,
108107
&signature,
109108
&wrong_ak_res.out_public,
@@ -117,7 +116,7 @@ mod test_quote {
117116
.with_selection(HashingAlgorithm::Sha256, &[PcrSlot::Slot2])
118117
.build()
119118
.expect("Failed to create PcrSelectionList");
120-
assert!(!utils::checkquote(
119+
assert!(!no_tpm::checkquote(
121120
&attest,
122121
&signature,
123122
&public,
@@ -131,7 +130,7 @@ mod test_quote {
131130
wrong_pcr_data.add(pcr_data.value()[i].clone()).unwrap();
132131
}
133132
wrong_pcr_data.add(pcr_data.value()[0].clone()).unwrap();
134-
assert!(!utils::checkquote(
133+
assert!(!no_tpm::checkquote(
135134
&attest,
136135
&signature,
137136
&public,
@@ -152,7 +151,7 @@ mod test_quote {
152151
ecc.signature_r().clone(),
153152
)
154153
.unwrap();
155-
assert!(!utils::checkquote(
154+
assert!(!no_tpm::checkquote(
156155
&attest,
157156
&Signature::EcDsa(wrong_signature),
158157
&public,
@@ -226,7 +225,7 @@ mod test_quote {
226225
.execute_without_session(|ctx| ctx.pcr_read(pcr_selection_list))
227226
.unwrap();
228227

229-
assert!(utils::checkquote(
228+
assert!(no_tpm::checkquote(
230229
&attest,
231230
&signature,
232231
&ak_rsa.out_public,
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
// Copyright 2021 Contributors to the Parsec project.
22
// SPDX-License-Identifier: Apache-2.0
33
mod get_tpm_vendor_test;
4-
mod quote_test;

0 commit comments

Comments
 (0)