diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index 70cd493a..c90c449d 100644
a
|
b
|
context_init_1(struct context *c) |
654 | 654 | if (c->first_time) |
655 | 655 | { |
656 | 656 | int i; |
657 | | pkcs11_initialize(true, c->options.pkcs11_pin_cache_period); |
| 657 | pkcs11_initialize(true, c->options.pkcs11_pin_cache_period,c->options.key_pass_file); |
658 | 658 | for (i = 0; i<MAX_PARMS && c->options.pkcs11_providers[i] != NULL; i++) |
659 | 659 | { |
660 | 660 | 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
|
b
|
|
34 | 34 | #include <pkcs11-helper-1.0/pkcs11h-certificate.h> |
35 | 35 | #include "basic.h" |
36 | 36 | #include "error.h" |
| 37 | #include "options.h" |
37 | 38 | #include "manage.h" |
38 | 39 | #include "base64.h" |
39 | 40 | #include "pkcs11.h" |
… |
… |
_pkcs11_openvpn_pin_prompt( |
241 | 242 | struct user_pass token_pass; |
242 | 243 | char prompt[1024]; |
243 | 244 | |
244 | | (void)global_data; |
| 245 | // (void)global_data; |
245 | 246 | (void)user_data; |
246 | 247 | (void)retry; |
247 | 248 | |
… |
… |
_pkcs11_openvpn_pin_prompt( |
255 | 256 | if ( |
256 | 257 | !get_user_pass( |
257 | 258 | &token_pass, |
258 | | NULL, |
| 259 | (const char *)global_data, |
259 | 260 | prompt, |
260 | 261 | GET_USER_PASS_MANAGEMENT|GET_USER_PASS_PASSWORD_ONLY|GET_USER_PASS_NOFATAL |
261 | 262 | ) |
… |
… |
_pkcs11_openvpn_pin_prompt( |
282 | 283 | bool |
283 | 284 | pkcs11_initialize( |
284 | 285 | const bool protected_auth, |
285 | | const int nPINCachePeriod |
| 286 | const int nPINCachePeriod, |
| 287 | const char * key_pass_file |
286 | 288 | ) |
287 | 289 | { |
288 | 290 | CK_RV rv = CKR_FUNCTION_FAILED; |
… |
… |
pkcs11_initialize( |
324 | 326 | goto cleanup; |
325 | 327 | } |
326 | 328 | |
327 | | if ((rv = pkcs11h_setPINPromptHook(_pkcs11_openvpn_pin_prompt, NULL)) != CKR_OK) |
| 329 | if ((rv = pkcs11h_setPINPromptHook(_pkcs11_openvpn_pin_prompt, (void *)key_pass_file)) != CKR_OK) |
328 | 330 | { |
329 | 331 | msg(M_FATAL, "PKCS#11: Cannot set hooks %ld-'%s'", rv, pkcs11h_getMessage(rv)); |
330 | 332 | goto cleanup; |
diff --git a/src/openvpn/pkcs11.h b/src/openvpn/pkcs11.h
index 66c6a7e1..8ffcaacf 100644
a
|
b
|
|
31 | 31 | bool |
32 | 32 | pkcs11_initialize( |
33 | 33 | const bool fProtectedAuthentication, |
34 | | const int nPINCachePeriod |
| 34 | const int nPINCachePeriod, |
| 35 | const char * key_pass_file |
35 | 36 | ); |
36 | 37 | |
37 | 38 | void |