Skip to content

Commit

Permalink
[hsmtool] Correctly handle missing SPX IDs
Browse files Browse the repository at this point in the history
It is legal for SPX key entities to be missing a PKCS#11 `id`.

Signed-off-by: Chris Frantz <[email protected]>
  • Loading branch information
cfrantz committed Dec 19, 2024
1 parent 65e163e commit 5164e7b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sw/host/hsmtool/src/commands/spx/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl Dispatch for Generate {

Ok(Box::new(BasicResult {
success: true,
id: AttrData::Str(key.hash.expect("key hash")),
id: key.hash.map_or(AttrData::None, AttrData::Str),
label: AttrData::Str(key.alias),
value: None,
error: None,
Expand Down
2 changes: 1 addition & 1 deletion sw/host/hsmtool/src/commands/spx/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Dispatch for Import {
)?;
Ok(Box::new(BasicResult {
success: true,
id: AttrData::Str(key.hash.expect("key hash")),
id: key.hash.map_or(AttrData::None, AttrData::Str),
label: AttrData::Str(key.alias),
value: None,
error: None,
Expand Down

0 comments on commit 5164e7b

Please sign in to comment.