Index: nss/lib/softoken/pkcs11.c |
diff --git a/nss/lib/softoken/pkcs11.c b/nss/lib/softoken/pkcs11.c |
index c54194662803a105c1e1c0b1ad4a621193d58545..716922f32243e303f8e60b25e05031895b4c51f0 100644 |
--- a/nss/lib/softoken/pkcs11.c |
+++ b/nss/lib/softoken/pkcs11.c |
@@ -972,6 +972,17 @@ sftk_handlePublicKeyObject(SFTKSession *session, SFTKObject *object, |
} |
object->infoFree = (SFTKFree) nsslowkey_DestroyPublicKey; |
+ /* Check that an imported EC key is valid */ |
+ if (key_type == CKK_EC) { |
+ NSSLOWKEYPublicKey *pubKey = (NSSLOWKEYPublicKey*) object->objectInfo; |
+ SECStatus rv = EC_ValidatePublicKey(&pubKey->u.ec.ecParams, |
+ &pubKey->u.ec.publicValue); |
+ |
+ if (rv != SECSuccess) { |
+ return CKR_TEMPLATE_INCONSISTENT; |
+ } |
+ } |
+ |
if (sftk_isTrue(object,CKA_TOKEN)) { |
SFTKSlot *slot = session->slot; |
SFTKDBHandle *certHandle = sftk_getCertDB(slot); |