Skip to content

Commit 42006eb

Browse files
Antoine Lochetantoinelochet
authored andcommitted
Fixed issue #707 by allowing operation OBJECT_OP_UNWRAP to modify attributes when CKA_MODIFIABLE is true
1 parent a181dae commit 42006eb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/P11Attributes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,13 +411,13 @@ CK_RV P11Attribute::update(Token* token, bool isPrivate, CK_VOID_PTR pValue, CK_
411411
// given non-Cryptoki attribute is read-only is obviously outside the scope of Cryptoki.
412412

413413
// Attributes cannot be changed if CKA_MODIFIABLE is set to false
414-
if (!isModifiable() && op != OBJECT_OP_GENERATE && op != OBJECT_OP_CREATE) {
414+
if (!isModifiable() && op != OBJECT_OP_GENERATE && op != OBJECT_OP_CREATE && op != OBJECT_OP_UNWRAP) {
415415
ERROR_MSG("An object is with CKA_MODIFIABLE set to false is not modifiable");
416416
return CKR_ATTRIBUTE_READ_ONLY;
417417
}
418418

419419
// Attributes cannot be modified if CKA_TRUSTED is true on a certificate object.
420-
if (isTrusted() && op != OBJECT_OP_GENERATE && op != OBJECT_OP_CREATE) {
420+
if (isTrusted() && op != OBJECT_OP_GENERATE && op != OBJECT_OP_CREATE && op != OBJECT_OP_UNWRAP) {
421421
if (osobject->getUnsignedLongValue(CKA_CLASS, CKO_VENDOR_DEFINED) == CKO_CERTIFICATE)
422422
{
423423
ERROR_MSG("A trusted certificate cannot be modified");

0 commit comments

Comments
 (0)