pkcs11-tool: no error when getting sensitive attr. value
resolves PR #807
This commit is contained in:
parent
3dbcc0b035
commit
76e0e19460
@ -2647,15 +2647,22 @@ get##ATTR(CK_SESSION_HANDLE sess, CK_OBJECT_HANDLE obj, CK_ULONG_PTR pulCount) \
|
||||
{ \
|
||||
CK_ATTRIBUTE attr = { CKA_##ATTR, NULL, 0 }; \
|
||||
CK_RV rv; \
|
||||
\
|
||||
if (pulCount) \
|
||||
*pulCount = 0; \
|
||||
rv = p11->C_GetAttributeValue(sess, obj, &attr, 1); \
|
||||
if (rv == CKR_OK) { \
|
||||
if (attr.ulValueLen == (CK_ULONG)(-1)) \
|
||||
return NULL; \
|
||||
if (!(attr.pValue = calloc(1, attr.ulValueLen + 1))) \
|
||||
util_fatal("out of memory in get" #ATTR ": %m"); \
|
||||
rv = p11->C_GetAttributeValue(sess, obj, &attr, 1); \
|
||||
if (attr.ulValueLen == (CK_ULONG)(-1)) { \
|
||||
free(attr.pValue); \
|
||||
return NULL; \
|
||||
} \
|
||||
if (pulCount) \
|
||||
*pulCount = attr.ulValueLen / sizeof(TYPE); \
|
||||
} else {\
|
||||
} else { \
|
||||
p11_warn("C_GetAttributeValue(" #ATTR ")", rv); \
|
||||
} \
|
||||
return (TYPE *) attr.pValue; \
|
||||
|
Loading…
Reference in New Issue
Block a user