@end verbatim
When objects require a PIN to be accessed the same callbacks as with PKCS #11
-objects are expected (see @ref{Accessing objects that require a PIN}).
+objects are expected (see @ref{Accessing objects that require a PIN}). Note
+that the PIN function may be called multiple times to unlock the SRK and
+the specific key in use. The label in the key function will then be set to
+`SRK' when unlocking the SRK key, or to `TPM' when unlocking any other key.
@node Key generation
@subsection Key generation
*
**/
void
-gnutls_transport_set_ptr (gnutls_session_t session, int i)
+gnutls_transport_set_int (gnutls_session_t session, int i)
{
session->internals.transport_recv_ptr = (gnutls_transport_ptr_t)(long)i;
session->internals.transport_send_ptr = (gnutls_transport_ptr_t)(long)i;
const giovec_t * iov, int iovcnt);
typedef int (*gnutls_errno_func) (gnutls_transport_ptr_t);
-
+
+/* This will be defined as macro.
+ void gnutls_transport_set_int (gnutls_session_t session, int r);
+ */
void gnutls_transport_set_int2 (gnutls_session_t session, int r, int s);
#define gnutls_transport_set_int(s, i) gnutls_transport_set_int2(s, i, i)
if (uuid)
{
if (memcmp(uuid, &srk_uuid, sizeof(TSS_UUID)) == 0)
- label = "SRK";
+ {
+ label = "SRK";
+
+ ret = encode_tpmkey_url(&url, uuid, storage);
+ if (ret < 0)
+ return gnutls_assert_val(ret);
+ }
else
{
+ label = "TPM";
+
ret = encode_tpmkey_url(&url, uuid, storage);
if (ret < 0)
return gnutls_assert_val(ret);
-
- label = url;
}
}
else
label = "unknown";
if (pin_info && pin_info->cb)
- ret = pin_info->cb(pin_info->data, attempts, "TPM", label, flags, pin, pin_size);
+ ret = pin_info->cb(pin_info->data, attempts, url, label, flags, pin, pin_size);
else if (_gnutls_pin_func)
- ret = _gnutls_pin_func(_gnutls_pin_data, attempts, "TPM", label, flags, pin, pin_size);
+ ret = _gnutls_pin_func(_gnutls_pin_data, attempts, url, label, flags, pin, pin_size);
else
ret = gnutls_assert_val(GNUTLS_E_TPM_KEY_PASSWORD_ERROR); /* doesn't really matter */
if (cache > 0 && cached_url != NULL)
{
- if (strcmp (cached_url, token_url) == 0)
+ if (token_url != NULL && strcmp (cached_url, token_url) == 0)
{
if (strlen(pin) >= sizeof(cached_pin))
{
/* cache */
strcpy (cached_pin, pin);
free (cached_url);
- cached_url = strdup (token_url);
+ if (token_url)
+ cached_url = strdup (token_url);
+ else
+ cached_url = NULL;
+
cache = MAX_CACHE_TRIES;
return 0;