Skip to content

Commit

Permalink
efikeygen: Fix segfault when using pubkey
Browse files Browse the repository at this point in the history
When using pubkey we also need to initialize the slot to import
signed certificate later.
  • Loading branch information
Blarse committed Mar 22, 2024
1 parent d734b6a commit 956cb5e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/efikeygen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,14 +1069,14 @@ int main(int argc, char *argv[])
nsserr(1, "Could not register OIDs");

PK11SlotInfo *slot = NULL;
rc = find_slot_for_token(cms, &slot);
if (rc < 0)
nsserr(1, "could not find NSS slot for token \"%s\"",
cms->tokenname);

if (pubfile) {
rc = get_pubkey_from_file(pubfile, &pubkey);
} else {
rc = find_slot_for_token(cms, &slot);
if (rc < 0)
nsserr(1, "could not find NSS slot for token \"%s\"",
cms->tokenname);

rc = generate_keys(cms, slot, &privkey, &pubkey, key_bits,
exponent);
}
Expand Down

0 comments on commit 956cb5e

Please sign in to comment.