diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 70cd493a..c90c449d 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -654,7 +654,7 @@ context_init_1(struct context *c) if (c->first_time) { int i; - pkcs11_initialize(true, c->options.pkcs11_pin_cache_period); + pkcs11_initialize(true, c->options.pkcs11_pin_cache_period,c->options.key_pass_file); for (i = 0; ioptions.pkcs11_providers[i] != NULL; i++) { pkcs11_addProvider(c->options.pkcs11_providers[i], c->options.pkcs11_protected_authentication[i], diff --git a/src/openvpn/pkcs11.c b/src/openvpn/pkcs11.c index d40ca458..1b616a50 100644 --- a/src/openvpn/pkcs11.c +++ b/src/openvpn/pkcs11.c @@ -34,6 +34,7 @@ #include #include "basic.h" #include "error.h" +#include "options.h" #include "manage.h" #include "base64.h" #include "pkcs11.h" @@ -241,7 +242,7 @@ _pkcs11_openvpn_pin_prompt( struct user_pass token_pass; char prompt[1024]; - (void)global_data; +// (void)global_data; (void)user_data; (void)retry; @@ -255,7 +256,7 @@ _pkcs11_openvpn_pin_prompt( if ( !get_user_pass( &token_pass, - NULL, + (const char *)global_data, prompt, GET_USER_PASS_MANAGEMENT|GET_USER_PASS_PASSWORD_ONLY|GET_USER_PASS_NOFATAL ) @@ -282,7 +283,8 @@ _pkcs11_openvpn_pin_prompt( bool pkcs11_initialize( const bool protected_auth, - const int nPINCachePeriod + const int nPINCachePeriod, + const char * key_pass_file ) { CK_RV rv = CKR_FUNCTION_FAILED; @@ -324,7 +326,7 @@ pkcs11_initialize( goto cleanup; } - if ((rv = pkcs11h_setPINPromptHook(_pkcs11_openvpn_pin_prompt, NULL)) != CKR_OK) + if ((rv = pkcs11h_setPINPromptHook(_pkcs11_openvpn_pin_prompt, (void *)key_pass_file)) != CKR_OK) { msg(M_FATAL, "PKCS#11: Cannot set hooks %ld-'%s'", rv, pkcs11h_getMessage(rv)); goto cleanup; diff --git a/src/openvpn/pkcs11.h b/src/openvpn/pkcs11.h index 66c6a7e1..8ffcaacf 100644 --- a/src/openvpn/pkcs11.h +++ b/src/openvpn/pkcs11.h @@ -31,7 +31,8 @@ bool pkcs11_initialize( const bool fProtectedAuthentication, - const int nPINCachePeriod + const int nPINCachePeriod, + const char * key_pass_file ); void