From 425ec51f782979a65d98cb3494cf7b1b0f5f8d0d Mon Sep 17 00:00:00 2001 From: s Date: Tue, 8 Dec 2009 18:28:22 +0000 Subject: [PATCH] fix: CK_MECHANISM gostMech = { CKM_GOSTR3410_KEY_PAIR_GEN, NULL, 0 }; ... C_GenerateKeyPair(hSession, &gostMech, NULL_PTR, 0, NULL_PTR, 0, &hPubKey, &hPrvKey); -> CKR_OK and Generate RSA Key Pair git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3887 c6295689-39f2-0310-b995-f0e70906c6a9 --- src/pkcs11/framework-pkcs15.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pkcs11/framework-pkcs15.c b/src/pkcs11/framework-pkcs15.c index fc08779c..2680f989 100644 --- a/src/pkcs11/framework-pkcs15.c +++ b/src/pkcs11/framework-pkcs15.c @@ -1635,8 +1635,10 @@ static CK_RV pkcs15_gen_keypair(struct sc_pkcs11_card *p11card, rv = attr_find2(pPubTpl, ulPubCnt, pPrivTpl, ulPrivCnt, CKA_KEY_TYPE, &keytype, NULL); - if (rv != CKR_OK) + if (rv != CKR_OK && pMechanism->mechanism == CKM_RSA_PKCS_KEY_PAIR_GEN) keytype = CKK_RSA; + else + goto kpgen_done; if (keytype == CKK_GOSTR3410) { keygen_args.prkey_args.key.algorithm = SC_ALGORITHM_GOSTR3410;