summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuchika Gupta <ruchika.gupta@linaro.org>2020-12-17 17:19:24 +0530
committerJérôme Forissier <jerome@forissier.org>2020-12-23 09:51:29 +0100
commit70c78a55b8a5a4ffe5310e322bbdadfd11d7e641 (patch)
tree3350948ecf9158509aaafa4ea5cf3791a936d6d2
parentff65c72a8592c0ddf2f37eb77248b546af035871 (diff)
ta: pkcs11: Fix for CKA_KEY_GEN_MECHANISM in create_attributes_from_template()
CKA_KEY_GEN_MECHANISM attribute is not added in the attribute list (attrs) from the template (temp) when a key object is created as it doesn't fall in mandatory/optional attribute. So, error checking for this attribute should be done on the original source template(temp) and not the attribute list(attrs) in create_attributes_from_template(). Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
-rw-r--r--ta/pkcs11/src/pkcs11_attributes.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ta/pkcs11/src/pkcs11_attributes.c b/ta/pkcs11/src/pkcs11_attributes.c
index 5222d8c5..a9fde0cd 100644
--- a/ta/pkcs11/src/pkcs11_attributes.c
+++ b/ta/pkcs11/src/pkcs11_attributes.c
@@ -796,7 +796,7 @@ create_attributes_from_template(struct obj_attrs **out, void *template,
goto out;
}
- if (get_attribute(attrs, PKCS11_CKA_KEY_GEN_MECHANISM, NULL, NULL) !=
+ if (get_attribute(temp, PKCS11_CKA_KEY_GEN_MECHANISM, NULL, NULL) !=
PKCS11_RV_NOT_FOUND) {
rc = PKCS11_CKR_TEMPLATE_INCONSISTENT;
goto out;