Skip to content

Commit

Permalink
Make HSM support optional, for static binary support
Browse files Browse the repository at this point in the history
  • Loading branch information
kpcyrd committed Nov 11, 2024
1 parent ae31588 commit 488e40c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ readme = "README.md"
edition = "2021"

[features]
default = ["zstd/pkg-config"] # https://github.com/gyscos/zstd-rs/pull/309
default = ["hsm", "zstd/pkg-config"] # https://github.com/gyscos/zstd-rs/pull/309
hsm = ["pcsc", "talktosc"]
vendored = ["openssl/vendored", "xz2/static"]

[dependencies]
Expand Down Expand Up @@ -46,7 +47,7 @@ oci-spec = { version = "0.7", features = ["image"], default-features = false }
once_cell = "1.15.0"
openssl = "0.10.60"
osshkeys = { version = "0.7", features = ["rustcrypto-cipher"], default-features = false }
pcsc = "2.7.0"
pcsc = { version = "2.7.0", optional = true }
peekread = "0.1.1"
rcgen = { version = "0.13", features = ["aws_lc_rs"] }
regex = "1.7.0"
Expand All @@ -58,7 +59,7 @@ serde_yaml = "0.9.13"
sha1 = "0.10.5"
sha2 = "0.10.6"
shell-escape = "0.1.5"
talktosc = "0.2"
talktosc = { version = "0.2", optional = true }
tar = "0.4.38"
tempfile = "3.3.0"
termcolor = "1.1.3"
Expand Down
12 changes: 12 additions & 0 deletions src/hsm/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
#[cfg(feature = "hsm")]
pub mod pgp;

// Expose dummy functions
#[cfg(not(feature = "hsm"))]
pub mod pgp {
use crate::args::HsmAccess;
use crate::errors::*;

pub fn access(_access: &HsmAccess) -> Result<()> {
bail!("HSM support is not available in this binary");
}
}

0 comments on commit 488e40c

Please sign in to comment.