Skip to content

Commit 370bcf6

Browse files
committed
Add abstraction feature
Adding a feature that separates the abstraction from the basic interface of the Rust-native crate. This feature is enabled by default so as not to break existing uses. Signed-off-by: Ionut Mihalcea <[email protected]>
1 parent b234176 commit 370bcf6

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

tss-esapi/Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ hostname-validator = "1.1.0"
2323
regex = "1.3.9"
2424
zeroize = { version = "1.5.7", features = ["zeroize_derive"] }
2525
tss-esapi-sys = { path = "../tss-esapi-sys", version = "0.4.0" }
26-
oid = "0.2.1"
27-
picky-asn1 = "0.3.0"
28-
picky-asn1-x509 = "0.6.1"
26+
oid = { version = "0.2.1", optional = true }
27+
picky-asn1 = { version = "0.3.0", optional = true }
28+
picky-asn1-x509 = { version = "0.6.1", optional = true }
2929
cfg-if = "1.0.0"
3030

3131
[dev-dependencies]
@@ -36,4 +36,6 @@ sha2 = "0.10.1"
3636
semver = "1.0.7"
3737

3838
[features]
39+
default = ["abstraction"]
3940
generate-bindings = ["tss-esapi-sys/generate-bindings"]
41+
abstraction = ["oid", "picky-asn1", "picky-asn1-x509"]

tss-esapi/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ time using the headers identified on the system.
1717

1818
Our end-goal is to achieve a fully Rust-native interface that offers strong safety and security guarantees. Check out our [documentation](https://docs.rs/tss-esapi/*/tss_esapi/#notes-on-code-safety) for an overview of our code safety approach.
1919

20+
## Cargo Features
21+
22+
The crate currently offers the following features:
23+
24+
* `generate_bindings` - forces the underlying `tss-esapi-sys`
25+
crate to regenerate the FFI bindings on each build, using the TSS
26+
libraries available on the build machine.
27+
* `abstraction` (enabled by default) - provides a set of abstracted primitives
28+
on top of the basic Rust-native ESAPI API provided by the crate. This feature
29+
can be turned off to reduce the number of dependencies built.
30+
2031
## Cross compiling
2132

2233
For more information on cross-compiling the `tss-esapi` crate, please see the README of the `tss-esapi-sys` crate.

tss-esapi/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ mod context;
9494

9595
pub mod error;
9696
pub use tss_esapi_sys as tss2_esys;
97+
#[cfg(feature = "abstraction")]
9798
pub mod abstraction;
9899
pub mod attributes;
99100
pub mod constants;

tss-esapi/tests/integration_tests/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#[path = "common/mod.rs"]
66
mod common;
77

8+
#[cfg(feature = "abstraction")]
89
mod abstraction_tests;
910
mod attributes_tests;
1011
mod constants_tests;

0 commit comments

Comments
 (0)