[glib-networking/pgriffis/pkcs11-pin] gnutls-pkcs11: Expose pin type on pin requests




commit 0d010638f1e6162dcd6631bd297e7fec5481f951
Author: Patrick Griffis <pgriffis igalia com>
Date:   Sat May 29 10:29:19 2021 -0500

    gnutls-pkcs11: Expose pin type on pin requests

 meson.build                        | 2 +-
 tls/gnutls/gtlsconnection-gnutls.c | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index 6d15970..1a552b6 100644
--- a/meson.build
+++ b/meson.build
@@ -48,7 +48,7 @@ if host_system.contains('linux')
 endif
 
 # *** Check GLib GIO        ***
-glib_dep = dependency('glib-2.0', version: '>= 2.67.0',
+glib_dep = dependency('glib-2.0', version: '>= 2.69.1',
   fallback: ['glib', 'libglib_dep'])
 gio_dep = dependency('gio-2.0',
   fallback: ['glib', 'libgio_dep'])
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index 369a360..243fe0a 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -254,6 +254,13 @@ on_pin_request (void         *userdata,
   if (callback_flags & GNUTLS_PIN_FINAL_TRY || attempt > 5) /* Give up at some point */
     password_flags |= G_TLS_PASSWORD_FINAL_TRY;
 
+  if (callback_flags & GNUTLS_PIN_USER)
+    password_flags |= G_TLS_PASSWORD_PKCS11_USER;
+  if (callback_flags & GNUTLS_PIN_SO)
+    password_flags |= G_TLS_PASSWORD_PKCS11_SECURITY_OFFICER;
+  if (callback_flags & GNUTLS_PIN_CONTEXT_SPECIFIC)
+    password_flags |= G_TLS_PASSWORD_PKCS11_CONTEXT_SPECIFIC;
+
   description = g_strdup_printf (" %s (%s)", token_label, token_url);
   password = g_tls_password_new (password_flags, description);
   if (g_tls_connection_base_handshake_thread_ask_password (G_TLS_CONNECTION_BASE (connection), password))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]