Files opencryptoki-2.2.4.1/usr/lib/pkcs11/common/.defs.h.swp and opencryptoki-2.2.4.1_new/usr/lib/pkcs11/common/.defs.h.swp differ diff -Nru opencryptoki-2.2.4.1/usr/lib/pkcs11/common/key.c opencryptoki-2.2.4.1_new/usr/lib/pkcs11/common/key.c --- opencryptoki-2.2.4.1/usr/lib/pkcs11/common/key.c 2006-06-15 17:58:22.000000000 -0400 +++ opencryptoki-2.2.4.1_new/usr/lib/pkcs11/common/key.c 2009-05-14 15:57:11.000000000 -0400 @@ -5204,14 +5204,17 @@ CK_BBOOL found = FALSE; - /* If the user didn't specify the size of the AES key being - * unwrapped, we return. - KEY */ + /* + * CKA_VALUE_LEN attribute is optional in the key template. Default + * is to use AES_BLOCK_SIZE and truncate if no value is specified. --KlausK + */ found = template_attribute_find( tmpl, CKA_VALUE_LEN, &val_len_attr ); - if (!found){ - st_err_log(48, __FILE__, __LINE__); - return CKR_TEMPLATE_INCOMPLETE; + if (found){ + key_size = *(CK_ULONG *)val_len_attr->pValue; + } + else { + key_size = AES_BLOCK_SIZE; /* same as AES_KEY_SIZE_128 */ } - key_size = *(CK_ULONG *)val_len_attr->pValue; /* key_size should be one of AES's possible sizes */ if (key_size != AES_KEY_SIZE_128 &&