PKCS#11: Fetch real value of CKA_LOCAL for pubkey

* Fetch value from pub_info structure for CKA_LOCAL attribute.
This commit is contained in:
Thomas Calderon 2015-01-14 17:37:08 +01:00
parent d727acb47a
commit ed87ea38b9
1 changed files with 7 additions and 1 deletions

View File

@ -3856,11 +3856,17 @@ pkcs15_pubkey_get_attribute(struct sc_pkcs11_session *session, void *object, CK_
*(CK_OBJECT_CLASS*)attr->pValue = CKO_PUBLIC_KEY;
break;
case CKA_TOKEN:
case CKA_LOCAL:
case CKA_SENSITIVE:
check_attribute_buffer(attr, sizeof(CK_BBOOL));
*(CK_BBOOL*)attr->pValue = TRUE;
break;
case CKA_LOCAL:
check_attribute_buffer(attr, sizeof(CK_BBOOL));
if (pubkey->pub_info)
*(CK_BBOOL*)attr->pValue = (pubkey->pub_info->access_flags & SC_PKCS15_PRKEY_ACCESS_LOCAL) != 0;
else /* no pub_info structure, falling back to TRUE */
*(CK_BBOOL*)attr->pValue = TRUE;
break;
case CKA_PRIVATE:
check_attribute_buffer(attr, sizeof(CK_BBOOL));
if (pubkey->pub_p15obj)