| c3033708 | 23-Feb-2021 |
Ruchika Gupta <ruchika.gupta@linaro.org> |
ta: pkcs11: Forbid derivation by encryption from AES encryption keys
Enforce that AES keys should not be allowed for both 'derivation by encryption' and ciphering. This is not explicitly mentioned i
ta: pkcs11: Forbid derivation by encryption from AES encryption keys
Enforce that AES keys should not be allowed for both 'derivation by encryption' and ciphering. This is not explicitly mentioned in the PKCS#11 specifications v2.4 and v3.0 but is essential to avoid attacks where derived key can be revealed by doing data encryption using parent key.
Suggested-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org>
show more ...
|
| 48799892 | 17-Feb-2021 |
Ruchika Gupta <ruchika.gupta@linaro.org> |
ta: pkcs11: Add implementation for key derivation
Add code for handling C_DeriveKey() for mechanisms : CKM_AES_ECB_ENCRYPT_DATA CKM_AES_CBC_ENCRYPT_DATA
Reviewed-by: Etienne Carriere <etienne.carri
ta: pkcs11: Add implementation for key derivation
Add code for handling C_DeriveKey() for mechanisms : CKM_AES_ECB_ENCRYPT_DATA CKM_AES_CBC_ENCRYPT_DATA
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org>
show more ...
|
| 65fb9092 | 13-Feb-2021 |
Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> |
ta: pkcs11: private key can also be public
Even thou normal operations should mark private key a private with CKA_PRIVATE attribute it is possible that someone could do unexpected choise.
Specifica
ta: pkcs11: private key can also be public
Even thou normal operations should mark private key a private with CKA_PRIVATE attribute it is possible that someone could do unexpected choise.
Specification does not state that private key class itself means that it is private, specification only states that CKA_PRIVATE is in control of the privacy of the object.
This commit moves object class CKO_PRIVATE_KEY processing to normal handling of CKA_PRIVATE.
CKA_PRIVATE is specified in: PKCS #11 Cryptographic Token Interface Base Specification Version 2.40 Plus Errata 01 4.4 Storage Objects
Possibility of having private key object with CKA_PRIVATE as false: PKCS #11 Cryptographic Token Interface Base Specification Version 2.40 Plus Errata 01 4.9 Private key objects
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Reviewed-by: Ruchika Gupta <ruchika.gupta@linaro.org> Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
show more ...
|
| e3737878 | 12-Feb-2021 |
Ruchika Gupta <ruchika.gupta@linaro.org> |
ta: pkcs11: Correct the return type of functions and typos
Correct return types of few functions and few typos.
Reviewed-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> Reviewed-by: Etienne C
ta: pkcs11: Correct the return type of functions and typos
Correct return types of few functions and few typos.
Reviewed-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org>
show more ...
|
| 49ed60ab | 12-Feb-2021 |
Ruchika Gupta <ruchika.gupta@linaro.org> |
ta: pkcs11: Add key size check for AES type of key
For AES Keys, the allowed lengths are 16, 24 or 32 bytes. Return error if the key length passed when creating keys is not one of these.
If not che
ta: pkcs11: Add key size check for AES type of key
For AES Keys, the allowed lengths are 16, 24 or 32 bytes. Return error if the key length passed when creating keys is not one of these.
If not checked when creating keys, error CKR_MECHANISM_INVALID is returned later when trying to use invalid keys which is ambiguous.The right approach is to disallow creation of such keys.
Reviewed-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org>
show more ...
|
| 2d0cd829 | 12-Feb-2021 |
Ruchika Gupta <ruchika.gupta@linaro.org> |
ta: pkcs11: Fix interpretation of CKA_VALUE_LEN for Generic Secrets
PKCS#11 specification [1] section 2.6.3 states that - For CKM_GENERIC_SECRET_KEY_GEN mechanism, the ulMinKeySize and ulMaxKeySize
ta: pkcs11: Fix interpretation of CKA_VALUE_LEN for Generic Secrets
PKCS#11 specification [1] section 2.6.3 states that - For CKM_GENERIC_SECRET_KEY_GEN mechanism, the ulMinKeySize and ulMaxKeySize fields of the CK_MECHANISM_INFO structure specify the supported range of key sizes, in bits.
Based on this, assumption was being made in the code that key length specified by CKA_VALUE_LEN for keys of type CKK_GENERIC_SECRET is also in bits. This assumption is not correct as per Section 2.6.2 in [1]. Special handling in code for CKK_GENERIC_SECRET for handling keysize in bits has been now removed.
[1] - PKCS #11 Cryptographic Token Interface Current Mechanisms Specification Version 2.40
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org>
show more ...
|
| 0fafe5c7 | 17-Feb-2021 |
Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> |
ta: pkcs11: Close file handle after object has been created
When creating a object file handle was left open. This was observed in tee-supplicant as open file handles.
This fixes the situation so t
ta: pkcs11: Close file handle after object has been created
When creating a object file handle was left open. This was observed in tee-supplicant as open file handles.
This fixes the situation so that file handles are not left open.
Reviewed-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
show more ...
|
| 22587dc4 | 30-Dec-2020 |
Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> |
ta: pkcs11: Add implementation for random number generation
Add code for handling C_SeedRandom() and C_GenerateRandom() functionality.
Reviewed-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed
ta: pkcs11: Add implementation for random number generation
Add code for handling C_SeedRandom() and C_GenerateRandom() functionality.
Reviewed-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
show more ...
|
| f44a7a58 | 04-Feb-2021 |
Etienne Carriere <etienne.carriere@linaro.org> |
ta: pkcs11: fix TEE identity authentication token reference
Correct token reference pass to verify client credentials.
Fixes: 1a27b197 ("ta: pkcs11: Add TEE Identity based authentication support")
ta: pkcs11: fix TEE identity authentication token reference
Correct token reference pass to verify client credentials.
Fixes: 1a27b197 ("ta: pkcs11: Add TEE Identity based authentication support") Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Ruchika Gupta <ruchika.gupta@linaro.org>
show more ...
|
| df017b2b | 10-Feb-2021 |
Ruchika Gupta <ruchika.gupta@linaro.org> |
ta: pkcs11: forbid change of CKA_PRIVATE from true to false on object copy
In C_CopyObject(), forbid copying of an object with a template which attempts to change the attribute CKA_PRIVATE from true
ta: pkcs11: forbid change of CKA_PRIVATE from true to false on object copy
In C_CopyObject(), forbid copying of an object with a template which attempts to change the attribute CKA_PRIVATE from true to false.
Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
show more ...
|
| bc09507c | 09-Feb-2021 |
Ruchika Gupta <ruchika.gupta@linaro.org> |
ta: pkcs11: Add support for copying objects
Implement command PKCS11_CMD_COPY_OBJECT.
Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.
ta: pkcs11: Add support for copying objects
Implement command PKCS11_CMD_COPY_OBJECT.
Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
show more ...
|
| 2d25a9bc | 09-Feb-2021 |
Ruchika Gupta <ruchika.gupta@linaro.org> |
ta: pkcs11: Add support for modifying objects
Implement command PKCS11_CMD_SET_ATTRIBUTE_VALUE.
Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Etienne Carriere <etienne.carrie
ta: pkcs11: Add support for modifying objects
Implement command PKCS11_CMD_SET_ATTRIBUTE_VALUE.
Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
show more ...
|
| 3bf0e097 | 22-Jan-2021 |
Ruchika Gupta <ruchika.gupta@linaro.org> |
ta/pkcs11: Use LIST_FOREACH_SAFE when removing objects from list
When traversing object list to remove objects, use LIST_FOREACH_SAFE to avoid segmentation fault.
Signed-off-by: Ruchika Gupta <ruch
ta/pkcs11: Use LIST_FOREACH_SAFE when removing objects from list
When traversing object list to remove objects, use LIST_FOREACH_SAFE to avoid segmentation fault.
Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| db0f45f3 | 20-Jan-2021 |
Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> |
ta: pkcs11: add debug string for PKCS11_CKA_KEY_GEN_MECHANISM
Add missing attribute debug string for PKCS11_CKA_KEY_GEN_MECHANISM.
Reviewed-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by:
ta: pkcs11: add debug string for PKCS11_CKA_KEY_GEN_MECHANISM
Add missing attribute debug string for PKCS11_CKA_KEY_GEN_MECHANISM.
Reviewed-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
show more ...
|
| 46900d03 | 02-Dec-2020 |
Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> |
ta: pkcs11: Fix serialization handling for non-indirect attributes
Both sides of serialization and de-serialization must match the logic.
Only TEMPLATE based arguments has indirect attributes so de
ta: pkcs11: Fix serialization handling for non-indirect attributes
Both sides of serialization and de-serialization must match the logic.
Only TEMPLATE based arguments has indirect attributes so detect them and handle them specifically.
Otherwise use standard attribute handling code for other attributes.
Reviewed-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
show more ...
|
| f3178382 | 31-Dec-2020 |
Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> |
ta: pkcs11: get_attribute: fix return value when querying value size
When C_GetAttributeValue() is issued with attribute with pValue == NULL: - Size of the attribute value should be returned - Retur
ta: pkcs11: get_attribute: fix return value when querying value size
When C_GetAttributeValue() is issued with attribute with pValue == NULL: - Size of the attribute value should be returned - Return value should be CKR_OK
If pValue != NULL and value does not fit then CKR_BUFFER_TOO_SMALL should be returned.
Reviewed-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
show more ...
|
| d17c25d2 | 29-Dec-2020 |
Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> |
ta: pkcs11: get_attribute: fix returning values into larger buffer
It is completely fine for callee to allocate more memory than what is needed.
Now attributes value is wholly copied and copied dat
ta: pkcs11: get_attribute: fix returning values into larger buffer
It is completely fine for callee to allocate more memory than what is needed.
Now attributes value is wholly copied and copied data amount is returned.
Reviewed-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
show more ...
|
| 18cbc7a2 | 16-Sep-2020 |
Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> |
ta: pkcs11: fix get attribute data alignment problem
In OP-TEE there is no behind the scenes handler that would fix data alignment problems.
Use aligned variables when accessing struct variables.
ta: pkcs11: fix get attribute data alignment problem
In OP-TEE there is no behind the scenes handler that would fix data alignment problems.
Use aligned variables when accessing struct variables.
Reviewed-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
show more ...
|
| fa1ac767 | 15-Jan-2021 |
Robin van der Gracht <robin@protonic.nl> |
ta: pkcs11: Don't load objects that don't match the search during find
Don't load all persistent object attributes in find_objects_init(). Instead, temporary load object attributes and release them
ta: pkcs11: Don't load objects that don't match the search during find
Don't load all persistent object attributes in find_objects_init(). Instead, temporary load object attributes and release them if not matching the current search.
Move object attribute loading from token_obj_matches_ref() to load_persistent_object_attributes() and introduce counterpart release_persistent_object_attributes().
Changes attributes_match_reference() to always return true when reference is empty (match all case).
Remove token_obj_matches_ref() since attributes_match_reference() can be called straight from load_persistent_object_attributes().
Signed-off-by: Robin van der Gracht <robin@protonic.nl> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Ruchika Gupta <ruchika.gupta@linaro.org>
show more ...
|
| 89735787 | 12-Jan-2021 |
Ruchika Gupta <ruchika.gupta@linaro.org> |
ta: pkcs11: Deal with the private objects in C_Logout
The logic to deal with the private objects was missing in the C_Logout() implementation. PKCS#11 specification states that : When C_Logout succe
ta: pkcs11: Deal with the private objects in C_Logout
The logic to deal with the private objects was missing in the C_Logout() implementation. PKCS#11 specification states that : When C_Logout successfully executes, any of the application’s handles to private objects should become invalid (even if a user is later logged back into the token, those handles remain invalid). In addition, all private session objects from sessions belonging to the application should also be destroyed.
In addition, also release any ongoing cryptographic or object-finding operations that may be associated with the session while logging out.
Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| 355d722a | 12-Jan-2021 |
Ruchika Gupta <ruchika.gupta@linaro.org> |
ta: pkcs11: Reduce the minimum pin length required
SoftHSM Unit test suite passes a 4 byte pin while initializing pin. Since current implementation restricts the minimum pin length to 10, C_InitPin(
ta: pkcs11: Reduce the minimum pin length required
SoftHSM Unit test suite passes a 4 byte pin while initializing pin. Since current implementation restricts the minimum pin length to 10, C_InitPin() fails resulting in the testcases to be aborted. Reduce the minimum pin length requirement inorder to run the SoftHSM test suite.
Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| 5db0fef4 | 12-Jan-2021 |
Ruchika Gupta <ruchika.gupta@linaro.org> |
ta: pkcs11: Access check for private objects
Private objects of a session/token are accessible only in a R/O or R/W user session i.e if a user is logged in. R/O or R/W public session or a R/W SO ses
ta: pkcs11: Access check for private objects
Private objects of a session/token are accessible only in a R/O or R/W user session i.e if a user is logged in. R/O or R/W public session or a R/W SO session cannot access these private objects. Check for SO session was missing in the logic when checking for access of private objects. This has now been added.
Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| 783c1515 | 13-Jan-2021 |
Ruchika Gupta <ruchika.gupta@linaro.org> |
ta: pkcs11: Add support for getting object size and attribute value
Implement commands - PKCS11_CMD_GET_OBJECT_SIZE - PKCS11_CMD_GET_ATTRIBUTE_VALUE
Co-developed-by: Etienne Carriere <etienne.carri
ta: pkcs11: Add support for getting object size and attribute value
Implement commands - PKCS11_CMD_GET_OBJECT_SIZE - PKCS11_CMD_GET_ATTRIBUTE_VALUE
Co-developed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Co-developed-by: Gabor Szekely <szvgabor@gmail.com> Signed-off-by: Gabor Szekely <szvgabor@gmail.com> Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
show more ...
|
| dc99b202 | 22-Dec-2020 |
Ruchika Gupta <ruchika.gupta@linaro.org> |
ta: pkcs11: Add support for finding objects
Implement commands - PKCS11_CMD_FIND_OBJECTS_INIT - PKCS11_CMD_FIND_OBJECTS - PKCS11_CMD_FIND_OBJECTS_FINAL
Co-developed-by: Etienne Carriere <etienne.ca
ta: pkcs11: Add support for finding objects
Implement commands - PKCS11_CMD_FIND_OBJECTS_INIT - PKCS11_CMD_FIND_OBJECTS - PKCS11_CMD_FIND_OBJECTS_FINAL
Co-developed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Co-developed-by: Gabor Szekely <szvgabor@gmail.com> Signed-off-by: Gabor Szekely <szvgabor@gmail.com> Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
show more ...
|
| 7f12c782 | 06-Jan-2021 |
Robin van der Gracht <robin@protonic.nl> |
ta: pkcs11: Remove persistent objects on token re-initialization
When re-initializing a token the previously created objects need to be removed.
Signed-off-by: Robin van der Gracht <robin@protonic.
ta: pkcs11: Remove persistent objects on token re-initialization
When re-initializing a token the previously created objects need to be removed.
Signed-off-by: Robin van der Gracht <robin@protonic.nl> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|