@@ -2227,6 +2227,38 @@ bool P11AttrEcPoint::setDefault()
22272227 return osobject->setAttribute (type, attr);
22282228}
22292229
2230+ /* ****************************************
2231+ * CKA_PARAMETER_SET
2232+ *****************************************/
2233+
2234+ // Set default value
2235+ bool P11AttrParameterSet::setDefault ()
2236+ {
2237+ OSAttribute attr ((unsigned long )0 );
2238+ return osobject->setAttribute (type, attr);
2239+ }
2240+
2241+ // Update the value if allowed
2242+ CK_RV P11AttrParameterSet::updateAttr (Token* /* token*/ , bool /* isPrivate*/ , CK_VOID_PTR pValue, CK_ULONG ulValueLen, int op)
2243+ {
2244+ // Attribute specific checks
2245+ if (op != OBJECT_OP_GENERATE && op != OBJECT_OP_CREATE)
2246+ {
2247+ return CKR_ATTRIBUTE_READ_ONLY;
2248+ }
2249+
2250+ if (ulValueLen != sizeof (CK_ULONG))
2251+ {
2252+ return CKR_ATTRIBUTE_VALUE_INVALID;
2253+ }
2254+
2255+ // Store data
2256+
2257+ osobject->setAttribute (type, *(CK_ULONG*)pValue);
2258+
2259+ return CKR_OK;
2260+ }
2261+
22302262/* ****************************************
22312263 * CKA_GOSTR3410_PARAMS
22322264 *****************************************/
@@ -2523,3 +2555,42 @@ CK_RV P11AttrAllowedMechanisms::updateAttr(Token* /*token*/, bool /*isPrivate*/,
25232555 osobject->setAttribute (type, OSAttribute (data));
25242556 return CKR_OK;
25252557}
2558+
2559+ /* ****************************************
2560+ * CKA_SEED
2561+ *****************************************/
2562+
2563+ // Set default value
2564+ bool P11AttrSeed::setDefault ()
2565+ {
2566+ OSAttribute attr (ByteString (" " ));
2567+ return osobject->setAttribute (type, attr);
2568+ }
2569+
2570+ // Update the value if allowed
2571+ CK_RV P11AttrSeed::updateAttr (Token *token, bool isPrivate, CK_VOID_PTR pValue, CK_ULONG ulValueLen, int /* op*/ )
2572+ {
2573+ ByteString plaintext ((unsigned char *)pValue, ulValueLen);
2574+ ByteString value;
2575+
2576+ // Encrypt
2577+
2578+ if (isPrivate)
2579+ {
2580+ if (!token->encrypt (plaintext, value))
2581+ return CKR_GENERAL_ERROR;
2582+ }
2583+ else
2584+ value = plaintext;
2585+
2586+ // Attribute specific checks
2587+
2588+ if (value.size () < ulValueLen)
2589+ return CKR_GENERAL_ERROR;
2590+
2591+ // Store data
2592+
2593+ osobject->setAttribute (type, value);
2594+
2595+ return CKR_OK;
2596+ }
0 commit comments