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




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

    gnutls-pkcs11: Expose pin type on pin requests

 tls/gnutls/gtlsconnection-gnutls.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index c385a37..1b7fd85 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]