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