Skip to content

Commit e38d6ce

Browse files
committed
hsm initialize: Fix output path for the feldman verifier.
1 parent cc7d6c6 commit e38d6ce

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

Cargo.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ glob = "0.3.2"
4141
rsa = "0.9.3"
4242
sha2 = "0.10.8"
4343
zerocopy = { version = "0.8.17", features = ["derive", "std", "zerocopy-derive"] }
44+
const_format = "0.2.34"

src/main.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use anyhow::{anyhow, Context, Result};
66
use clap::{Parser, Subcommand};
7+
use const_format::formatcp;
78
use env_logger::Builder;
89
use log::{debug, error, info, LevelFilter};
910
use std::{
@@ -12,7 +13,7 @@ use std::{
1213
ffi::OsStr,
1314
fs,
1415
ops::{Deref, DerefMut},
15-
path::{Path, PathBuf},
16+
path::{Path, PathBuf, MAIN_SEPARATOR},
1617
str::FromStr,
1718
};
1819
use yubihsm::object::{Id, Type};
@@ -39,7 +40,9 @@ const PASSWD_NEW: &str = "Enter new password: ";
3940
const PASSWD_NEW_2: &str = "Enter password again to confirm: ";
4041

4142
const INPUT_PATH: &str = "/usr/share/oks";
42-
const VERIFIER_PATH: &str = "/usr/share/oks/verifier.json";
43+
const VERIFIER_FILE: &str = "verifier.json";
44+
const VERIFIER_PATH: &str =
45+
formatcp!("{}{}{}", INPUT_PATH, MAIN_SEPARATOR, VERIFIER_FILE);
4346

4447
const OUTPUT_PATH: &str = "/var/lib/oks";
4548
const STATE_PATH: &str = "/var/lib/oks/ca-state";
@@ -639,7 +642,7 @@ fn main() -> Result<()> {
639642
let (shares, verifier) = wrap.split(&mut hsm)?;
640643
let verifier = serde_json::to_string(&verifier)?;
641644
debug!("JSON: {}", verifier);
642-
let verifier_path = args.output.join(VERIFIER_PATH);
645+
let verifier_path = args.output.join(VERIFIER_FILE);
643646
debug!(
644647
"Serializing verifier as json to: {}",
645648
verifier_path.display()

0 commit comments

Comments
 (0)