~ubuntu-branches/debian/sid/gnutls26/sid

« back to all changes in this revision

Viewing changes to lib/pkcs11.c

  • Committer: Package Import Robot
  • Author(s): Andreas Metzler
  • Date: 2012-05-05 20:02:34 UTC
  • mfrom: (1.4.23)
  • Revision ID: package-import@ubuntu.com-20120505200234-hiozjrt88cg5oh7k
Tags: 2.12.19-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
557
557
    }
558
558
  init++;
559
559
 
 
560
  p11_kit_pin_register_callback (P11_KIT_PIN_FALLBACK, p11_kit_pin_file_callback,
 
561
                                 NULL, NULL);
 
562
 
560
563
  if (flags == GNUTLS_PKCS11_FLAG_AUTO)
561
564
    {
562
565
      if (deprecated_config_file == NULL)
1896
1899
  *pin = p11_kit_pin_new_for_string (pin_value);
1897
1900
  
1898
1901
  if (*pin == NULL)
1899
 
    return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR);
 
1902
    return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR);
1900
1903
 
1901
1904
  return 0;
1902
1905
}
1906
1909
              int attempts, ck_user_type_t user_type, struct p11_kit_pin **pin)
1907
1910
{
1908
1911
  const char *pinfile;
 
1912
  int ret = GNUTLS_E_PKCS11_PIN_ERROR;
1909
1913
 
1910
1914
  *pin = NULL;
1911
1915
 
1914
1918
  if (pinfile != NULL)
1915
1919
    {
1916
1920
      _gnutls_debug_log("pk11: Using pinfile to retrieve PIN\n");
1917
 
      return retrieve_pin_for_pinfile (pinfile, token_info, attempts, user_type, pin);
 
1921
      ret = retrieve_pin_for_pinfile (pinfile, token_info, attempts, user_type, pin);
1918
1922
    }
1919
1923
 
1920
1924
  /* The global gnutls pin callback */
1921
 
  else if (pin_func)
1922
 
    return retrieve_pin_for_callback (token_info, attempts, user_type, pin);
 
1925
  if (pin_func && ret < 0)
 
1926
    ret = retrieve_pin_for_callback (token_info, attempts, user_type, pin);
1923
1927
 
1924
1928
  /* Otherwise, PIN entry is necessary for login, so fail if there's
1925
1929
   * no callback. */
1926
 
  else
 
1930
  
 
1931
  if (ret < 0)
1927
1932
    {
1928
1933
      gnutls_assert ();
1929
 
      _gnutls_debug_log ("pk11: No pin callback but login required.\n");
1930
 
      return GNUTLS_E_PKCS11_ERROR;
 
1934
      _gnutls_debug_log ("pk11: No suitable pin callback but login required.\n");
1931
1935
    }
 
1936
    
 
1937
  return ret;
1932
1938
}
1933
1939
 
1934
1940
int