gnutls-commit
[Top][All Lists]
Advanced

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

[SCM] GNU gnutls branch, master, updated. gnutls_3_0_21-47-g4c3db96


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_3_0_21-47-g4c3db96
Date: Mon, 16 Jul 2012 23:15:33 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".

http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=4c3db964f976389c0545abb32f1e64ab2f61b037

The branch, master has been updated
       via  4c3db964f976389c0545abb32f1e64ab2f61b037 (commit)
      from  8b61dcc7715562707e4c0ce6406ad820c6cad127 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4c3db964f976389c0545abb32f1e64ab2f61b037
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Tue Jul 17 01:15:17 2012 +0200

    Callbacks are being called even if a global PIN functions is not set.

-----------------------------------------------------------------------

Summary of changes:
 lib/pkcs11.c |    7 +++++--
 lib/tpm.c    |   20 ++++++++++----------
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/lib/pkcs11.c b/lib/pkcs11.c
index a169862..a5a9c92 100644
--- a/lib/pkcs11.c
+++ b/lib/pkcs11.c
@@ -2008,9 +2008,12 @@ retrieve_pin_from_callback (const struct pin_info_st 
*pin_info,
   if (pin_info && pin_info->cb)
     ret = pin_info->cb (pin_info->data, attempts, (char*)token_str, label,
                         flags, pin_value, GNUTLS_PKCS11_MAX_PIN_LEN);
-  else
+  else if (_gnutls_pin_func)
     ret = _gnutls_pin_func (_gnutls_pin_data, attempts, (char*)token_str, 
label,
                             flags, pin_value, GNUTLS_PKCS11_MAX_PIN_LEN);
+  else
+    ret = gnutls_assert_val(GNUTLS_E_PKCS11_PIN_ERROR);
+
   free (token_str);
   free (label);
 
@@ -2044,7 +2047,7 @@ retrieve_pin (struct pin_info_st* pin_info, struct 
p11_kit_uri *info,
     }
 
   /* The global gnutls pin callback */
-  if (_gnutls_pin_func && ret < 0)
+  if (ret < 0)
     ret = retrieve_pin_from_callback (pin_info, token_info, attempts, 
user_type, pin);
 
   /* Otherwise, PIN entry is necessary for login, so fail if there's
diff --git a/lib/tpm.c b/lib/tpm.c
index 1bf57c9..c6d22d0 100644
--- a/lib/tpm.c
+++ b/lib/tpm.c
@@ -205,8 +205,11 @@ int ret;
 
   if (pin_info && pin_info->cb)
     ret = pin_info->cb(pin_info->data, attempts, "TPM", label, flags, pin, 
pin_size);
-  else
+  else if (_gnutls_pin_func)
     ret = _gnutls_pin_func(_gnutls_pin_data, attempts, "TPM", label, flags, 
pin, pin_size);
+  else
+    ret = gnutls_assert_val(GNUTLS_E_TPM_KEY_PASSWORD_ERROR); /* doesn't 
really matter */
+
   if (ret < 0)
     {
       gnutls_assert();
@@ -311,13 +314,10 @@ static void tpm_close_session(struct tpm_ctx_st *s)
 }
 
 static int
-import_tpm_key_cb (gnutls_privkey_t pkey,
-                const gnutls_datum_t * fdata,
-                gnutls_x509_crt_fmt_t format,
-                TSS_UUID *uuid,
-                TSS_FLAG storage,
-                const char *srk_password,
-                const char *key_password)
+import_tpm_key_cb (gnutls_privkey_t pkey, const gnutls_datum_t * fdata,
+                   gnutls_x509_crt_fmt_t format, TSS_UUID *uuid,
+                   TSS_FLAG storage, const char *srk_password,
+                   const char *key_password)
 {
 unsigned int attempts = 0;
 char pin1[GNUTLS_PKCS11_MAX_PIN_LEN];
@@ -328,7 +328,7 @@ int ret, ret2;
     {
       ret = import_tpm_key(pkey, fdata, format, uuid, storage, srk_password, 
key_password);
 
-      if (attempts > 3 || _gnutls_pin_func == NULL)
+      if (attempts > 3)
         break;
 
       if (ret == GNUTLS_E_TPM_SRK_PASSWORD_ERROR)
@@ -996,7 +996,7 @@ int ret;
     {
       ret = import_tpm_pubkey(pkey, fdata, format, uuid, storage, 
srk_password);
       
-      if (attempts > 3 || _gnutls_pin_func == NULL)
+      if (attempts > 3)
         break;
 
       if (ret == GNUTLS_E_TPM_SRK_PASSWORD_ERROR)


hooks/post-receive
-- 
GNU gnutls



reply via email to

[Prev in Thread] Current Thread [Next in Thread]