From: Nikos Mavrogiannopoulos Date: Mon, 16 Apr 2012 16:18:51 +0000 (+0200) Subject: by default register a file callback in p11-kit to read a file from the pin-source... X-Git-Tag: gnutls_3_0_21~157 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c1eddcfe663b9e3cb9a411f855e00f49811ff205;p=thirdparty%2Fgnutls.git by default register a file callback in p11-kit to read a file from the pin-source pkcs11url field. --- diff --git a/NEWS b/NEWS index 44de26e5b1..c105b32cd0 100644 --- a/NEWS +++ b/NEWS @@ -4,7 +4,8 @@ See the end for copying conditions. * Version 3.1.0 (unreleased) -** libgnutls: xxx +** libgnutls: When decoding a PKCS #11 URL the pin-source field +is assumed to be a file that stores the pin. ** API and ABI modifications: No changes since last version. diff --git a/lib/pkcs11.c b/lib/pkcs11.c index fee702384d..ca7b76b8e4 100644 --- a/lib/pkcs11.c +++ b/lib/pkcs11.c @@ -557,6 +557,9 @@ gnutls_pkcs11_init (unsigned int flags, const char *deprecated_config_file) } init++; + p11_kit_pin_register_callback (P11_KIT_PIN_FALLBACK, p11_kit_pin_file_callback, + NULL, NULL); + if (flags == GNUTLS_PKCS11_FLAG_MANUAL) return 0; else if (flags == GNUTLS_PKCS11_FLAG_AUTO) @@ -1960,7 +1963,7 @@ retrieve_pin (struct p11_kit_uri *info, struct ck_token_info *token_info, /* Check if a pinfile is specified, and use that if possible */ pinfile = p11_kit_uri_get_pinfile (info); - if (pinfile != NULL) + if (pinfile != NULL && attempts == 0) { _gnutls_debug_log("pk11: Using pinfile to retrieve PIN\n"); return retrieve_pin_for_pinfile (pinfile, token_info, attempts, user_type, pin);