Skip to content

Commit

Permalink
unify code path for adding PKCS#11 providers
Browse files Browse the repository at this point in the history
Use existing wrapper for pkcs11h_addProvider to have arguments with
"magic values" for pkcs11-helper call in a central place.

Slot event argument to pkcs11h_addProvider has NOT been a boolean for
at least 15 years.
Luckily the default is PKCS11H_SLOTEVENT_METHOD_AUTO=0=FALSE.

Signed-off-by: Marc Becker <[email protected]>
Acked-by: Frank Lichtenheld <[email protected]>
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg25642.html
Signed-off-by: Gert Doering <[email protected]>
  • Loading branch information
astos-marcb authored and cron2 committed Dec 15, 2022
1 parent 860bf4b commit 8958a36
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/openvpn/pkcs11.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,19 +853,9 @@ show_pkcs11_ids(
goto cleanup;
}

if (
(rv = pkcs11h_addProvider(
provider,
provider,
TRUE,
0,
FALSE,
0,
cert_private ? TRUE : FALSE
)) != CKR_OK
)
if (!pkcs11_addProvider(provider, TRUE, 0, cert_private ? TRUE : FALSE))
{
msg(M_FATAL, "PKCS#11: Cannot add provider '%s' %ld-'%s'", provider, rv, pkcs11h_getMessage(rv));
msg(M_FATAL, "Failed to add PKCS#11 provider '%s", provider);
goto cleanup;
}

Expand Down

0 comments on commit 8958a36

Please sign in to comment.