xref: /titanic_51/usr/src/lib/libcryptoutil/common/mechkeygen.c (revision 26ff1ce9e5494c59fafe62a0c6e3ca41cd0f2a99)
1*26ff1ce9Sdinak /*
2*26ff1ce9Sdinak  * CDDL HEADER START
3*26ff1ce9Sdinak  *
4*26ff1ce9Sdinak  * The contents of this file are subject to the terms of the
5*26ff1ce9Sdinak  * Common Development and Distribution License (the "License").
6*26ff1ce9Sdinak  * You may not use this file except in compliance with the License.
7*26ff1ce9Sdinak  *
8*26ff1ce9Sdinak  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*26ff1ce9Sdinak  * or http://www.opensolaris.org/os/licensing.
10*26ff1ce9Sdinak  * See the License for the specific language governing permissions
11*26ff1ce9Sdinak  * and limitations under the License.
12*26ff1ce9Sdinak  *
13*26ff1ce9Sdinak  * When distributing Covered Code, include this CDDL HEADER in each
14*26ff1ce9Sdinak  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*26ff1ce9Sdinak  * If applicable, add the following below this CDDL HEADER, with the
16*26ff1ce9Sdinak  * fields enclosed by brackets "[]" replaced with your own identifying
17*26ff1ce9Sdinak  * information: Portions Copyright [yyyy] [name of copyright owner]
18*26ff1ce9Sdinak  *
19*26ff1ce9Sdinak  * CDDL HEADER END
20*26ff1ce9Sdinak  */
21*26ff1ce9Sdinak /*
22*26ff1ce9Sdinak  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*26ff1ce9Sdinak  * Use is subject to license terms.
24*26ff1ce9Sdinak  */
25*26ff1ce9Sdinak 
26*26ff1ce9Sdinak #pragma ident	"%Z%%M%	%I%	%E% SMI"
27*26ff1ce9Sdinak 
28*26ff1ce9Sdinak #include <cryptoutil.h>
29*26ff1ce9Sdinak 
30*26ff1ce9Sdinak /*
31*26ff1ce9Sdinak  * Get the key generation mechanism for the given mechanism.
32*26ff1ce9Sdinak  *
33*26ff1ce9Sdinak  * All mechanisms in PKCS #11 v2.20 are listed here.
34*26ff1ce9Sdinak  */
35*26ff1ce9Sdinak CK_RV
36*26ff1ce9Sdinak pkcs11_mech2keygen(CK_MECHANISM_TYPE mech_type, CK_MECHANISM_TYPE *gen_mech)
37*26ff1ce9Sdinak {
38*26ff1ce9Sdinak 	switch (mech_type) {
39*26ff1ce9Sdinak 
40*26ff1ce9Sdinak 	case CKM_RSA_PKCS_KEY_PAIR_GEN:
41*26ff1ce9Sdinak 	case CKM_RSA_PKCS:
42*26ff1ce9Sdinak 	case CKM_RSA_9796:
43*26ff1ce9Sdinak 	case CKM_RSA_X_509:
44*26ff1ce9Sdinak 	case CKM_MD2_RSA_PKCS:
45*26ff1ce9Sdinak 	case CKM_MD5_RSA_PKCS:
46*26ff1ce9Sdinak 	case CKM_SHA1_RSA_PKCS:
47*26ff1ce9Sdinak 	case CKM_SHA256_RSA_PKCS:
48*26ff1ce9Sdinak 	case CKM_SHA384_RSA_PKCS:
49*26ff1ce9Sdinak 	case CKM_SHA512_RSA_PKCS:
50*26ff1ce9Sdinak 	case CKM_SHA256_RSA_PKCS_PSS:
51*26ff1ce9Sdinak 	case CKM_SHA384_RSA_PKCS_PSS:
52*26ff1ce9Sdinak 	case CKM_SHA512_RSA_PKCS_PSS:
53*26ff1ce9Sdinak 	case CKM_RIPEMD128_RSA_PKCS:
54*26ff1ce9Sdinak 	case CKM_RIPEMD160_RSA_PKCS:
55*26ff1ce9Sdinak 	case CKM_RSA_PKCS_OAEP:
56*26ff1ce9Sdinak 		*gen_mech = CKM_RSA_PKCS_KEY_PAIR_GEN;
57*26ff1ce9Sdinak 		break;
58*26ff1ce9Sdinak 
59*26ff1ce9Sdinak 	case CKM_RSA_X9_31_KEY_PAIR_GEN:
60*26ff1ce9Sdinak 	case CKM_RSA_X9_31:
61*26ff1ce9Sdinak 	case CKM_SHA1_RSA_X9_31:
62*26ff1ce9Sdinak 		*gen_mech = CKM_RSA_X9_31_KEY_PAIR_GEN;
63*26ff1ce9Sdinak 		break;
64*26ff1ce9Sdinak 
65*26ff1ce9Sdinak 	case CKM_RSA_PKCS_PSS:
66*26ff1ce9Sdinak 	case CKM_SHA1_RSA_PKCS_PSS:
67*26ff1ce9Sdinak 		*gen_mech = CKM_RSA_PKCS_KEY_PAIR_GEN;
68*26ff1ce9Sdinak 		break;
69*26ff1ce9Sdinak 
70*26ff1ce9Sdinak 	case CKM_DH_PKCS_PARAMETER_GEN:
71*26ff1ce9Sdinak 		*gen_mech = CKM_DH_PKCS_PARAMETER_GEN;
72*26ff1ce9Sdinak 		break;
73*26ff1ce9Sdinak 
74*26ff1ce9Sdinak 	case CKM_DSA_KEY_PAIR_GEN:
75*26ff1ce9Sdinak 	case CKM_DSA:
76*26ff1ce9Sdinak 	case CKM_DSA_SHA1:
77*26ff1ce9Sdinak 		*gen_mech = CKM_DSA_KEY_PAIR_GEN;
78*26ff1ce9Sdinak 		break;
79*26ff1ce9Sdinak 
80*26ff1ce9Sdinak 	case CKM_DSA_PARAMETER_GEN:
81*26ff1ce9Sdinak 		*gen_mech = CKM_DSA_PARAMETER_GEN;
82*26ff1ce9Sdinak 		break;
83*26ff1ce9Sdinak 
84*26ff1ce9Sdinak 	case CKM_FORTEZZA_TIMESTAMP:
85*26ff1ce9Sdinak 		*gen_mech = CKM_DSA_KEY_PAIR_GEN;
86*26ff1ce9Sdinak 		break;
87*26ff1ce9Sdinak 
88*26ff1ce9Sdinak 	case CKM_DH_PKCS_KEY_PAIR_GEN:
89*26ff1ce9Sdinak 	case CKM_DH_PKCS_DERIVE:
90*26ff1ce9Sdinak 		*gen_mech = CKM_DH_PKCS_KEY_PAIR_GEN;
91*26ff1ce9Sdinak 		break;
92*26ff1ce9Sdinak 
93*26ff1ce9Sdinak 	case CKM_ECDSA:
94*26ff1ce9Sdinak 	case CKM_ECDSA_SHA1:
95*26ff1ce9Sdinak 	case CKM_EC_KEY_PAIR_GEN:
96*26ff1ce9Sdinak 	case CKM_ECDH1_DERIVE:
97*26ff1ce9Sdinak 	case CKM_ECDH1_COFACTOR_DERIVE:
98*26ff1ce9Sdinak 	case CKM_ECMQV_DERIVE:
99*26ff1ce9Sdinak 		*gen_mech = CKM_EC_KEY_PAIR_GEN;
100*26ff1ce9Sdinak 		break;
101*26ff1ce9Sdinak 
102*26ff1ce9Sdinak 	case CKM_X9_42_DH_KEY_PAIR_GEN:
103*26ff1ce9Sdinak 	case CKM_X9_42_DH_DERIVE:
104*26ff1ce9Sdinak 	case CKM_X9_42_DH_HYBRID_DERIVE:
105*26ff1ce9Sdinak 	case CKM_X9_42_MQV_DERIVE:
106*26ff1ce9Sdinak 		*gen_mech = CKM_X9_42_DH_KEY_PAIR_GEN;
107*26ff1ce9Sdinak 		break;
108*26ff1ce9Sdinak 
109*26ff1ce9Sdinak 	case CKM_X9_42_DH_PARAMETER_GEN:
110*26ff1ce9Sdinak 		*gen_mech = CKM_X9_42_DH_PARAMETER_GEN;
111*26ff1ce9Sdinak 		break;
112*26ff1ce9Sdinak 
113*26ff1ce9Sdinak 	case CKM_KEA_KEY_PAIR_GEN:
114*26ff1ce9Sdinak 	case CKM_KEA_KEY_DERIVE:
115*26ff1ce9Sdinak 		*gen_mech = CKM_KEA_KEY_PAIR_GEN;
116*26ff1ce9Sdinak 		break;
117*26ff1ce9Sdinak 
118*26ff1ce9Sdinak 	case CKM_MD2:
119*26ff1ce9Sdinak 	case CKM_MD2_HMAC:
120*26ff1ce9Sdinak 	case CKM_MD2_HMAC_GENERAL:
121*26ff1ce9Sdinak 	case CKM_MD5:
122*26ff1ce9Sdinak 	case CKM_MD5_HMAC:
123*26ff1ce9Sdinak 	case CKM_MD5_HMAC_GENERAL:
124*26ff1ce9Sdinak 	case CKM_SHA_1:
125*26ff1ce9Sdinak 	case CKM_SHA_1_HMAC:
126*26ff1ce9Sdinak 	case CKM_SHA_1_HMAC_GENERAL:
127*26ff1ce9Sdinak 	case CKM_SHA256:
128*26ff1ce9Sdinak 	case CKM_SHA256_HMAC:
129*26ff1ce9Sdinak 	case CKM_SHA256_HMAC_GENERAL:
130*26ff1ce9Sdinak 	case CKM_SHA384:
131*26ff1ce9Sdinak 	case CKM_SHA384_HMAC:
132*26ff1ce9Sdinak 	case CKM_SHA384_HMAC_GENERAL:
133*26ff1ce9Sdinak 	case CKM_SHA512:
134*26ff1ce9Sdinak 	case CKM_SHA512_HMAC:
135*26ff1ce9Sdinak 	case CKM_SHA512_HMAC_GENERAL:
136*26ff1ce9Sdinak 	case CKM_GENERIC_SECRET_KEY_GEN:
137*26ff1ce9Sdinak 	case CKM_FASTHASH:
138*26ff1ce9Sdinak 	case CKM_PKCS5_PBKD2:
139*26ff1ce9Sdinak 	case CKM_PBA_SHA1_WITH_SHA1_HMAC:
140*26ff1ce9Sdinak 		*gen_mech = CKM_GENERIC_SECRET_KEY_GEN;
141*26ff1ce9Sdinak 		break;
142*26ff1ce9Sdinak 
143*26ff1ce9Sdinak 	case CKM_SSL3_MD5_MAC:
144*26ff1ce9Sdinak 	case CKM_SSL3_SHA1_MAC:
145*26ff1ce9Sdinak 	case CKM_SSL3_PRE_MASTER_KEY_GEN:
146*26ff1ce9Sdinak 	case CKM_SSL3_MASTER_KEY_DERIVE:
147*26ff1ce9Sdinak 	case CKM_SSL3_KEY_AND_MAC_DERIVE:
148*26ff1ce9Sdinak 	case CKM_SSL3_MASTER_KEY_DERIVE_DH:
149*26ff1ce9Sdinak 		*gen_mech = CKM_SSL3_PRE_MASTER_KEY_GEN;
150*26ff1ce9Sdinak 		break;
151*26ff1ce9Sdinak 
152*26ff1ce9Sdinak 	case CKM_TLS_PRE_MASTER_KEY_GEN:
153*26ff1ce9Sdinak 	case CKM_TLS_MASTER_KEY_DERIVE:
154*26ff1ce9Sdinak 	case CKM_TLS_KEY_AND_MAC_DERIVE:
155*26ff1ce9Sdinak 	case CKM_TLS_MASTER_KEY_DERIVE_DH:
156*26ff1ce9Sdinak 	case CKM_TLS_PRF:
157*26ff1ce9Sdinak 		*gen_mech = CKM_TLS_PRE_MASTER_KEY_GEN;
158*26ff1ce9Sdinak 		break;
159*26ff1ce9Sdinak 
160*26ff1ce9Sdinak 	case CKM_WTLS_PRE_MASTER_KEY_GEN:
161*26ff1ce9Sdinak 	case CKM_WTLS_MASTER_KEY_DERIVE:
162*26ff1ce9Sdinak 	case CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC:
163*26ff1ce9Sdinak 	case CKM_WTLS_PRF:
164*26ff1ce9Sdinak 	case CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE:
165*26ff1ce9Sdinak 	case CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE:
166*26ff1ce9Sdinak 		*gen_mech = CKM_WTLS_PRE_MASTER_KEY_GEN;
167*26ff1ce9Sdinak 		break;
168*26ff1ce9Sdinak 
169*26ff1ce9Sdinak 	case CKM_CONCATENATE_BASE_AND_KEY:
170*26ff1ce9Sdinak 	case CKM_CONCATENATE_BASE_AND_DATA:
171*26ff1ce9Sdinak 	case CKM_CONCATENATE_DATA_AND_BASE:
172*26ff1ce9Sdinak 	case CKM_XOR_BASE_AND_DATA:
173*26ff1ce9Sdinak 	case CKM_EXTRACT_KEY_FROM_KEY:
174*26ff1ce9Sdinak 	case CKM_RIPEMD128:
175*26ff1ce9Sdinak 	case CKM_RIPEMD128_HMAC:
176*26ff1ce9Sdinak 	case CKM_RIPEMD128_HMAC_GENERAL:
177*26ff1ce9Sdinak 	case CKM_RIPEMD160:
178*26ff1ce9Sdinak 	case CKM_RIPEMD160_HMAC:
179*26ff1ce9Sdinak 	case CKM_RIPEMD160_HMAC_GENERAL:
180*26ff1ce9Sdinak 	case CKM_SHA1_KEY_DERIVATION:
181*26ff1ce9Sdinak 	case CKM_SHA256_KEY_DERIVATION:
182*26ff1ce9Sdinak 	case CKM_SHA384_KEY_DERIVATION:
183*26ff1ce9Sdinak 	case CKM_SHA512_KEY_DERIVATION:
184*26ff1ce9Sdinak 	case CKM_MD5_KEY_DERIVATION:
185*26ff1ce9Sdinak 	case CKM_MD2_KEY_DERIVATION:
186*26ff1ce9Sdinak 	/* not sure the following 2 should be CKK_DES or not */
187*26ff1ce9Sdinak 	case CKM_KEY_WRAP_LYNKS: /* wrap/unwrap secret key w/ DES key */
188*26ff1ce9Sdinak 	case CKM_KEY_WRAP_SET_OAEP:  /* wrap/unwarp DES key w/ RSA key */
189*26ff1ce9Sdinak 		*gen_mech = CKM_GENERIC_SECRET_KEY_GEN;
190*26ff1ce9Sdinak 		break;
191*26ff1ce9Sdinak 
192*26ff1ce9Sdinak 	case CKM_RC2_KEY_GEN:
193*26ff1ce9Sdinak 	case CKM_RC2_ECB:
194*26ff1ce9Sdinak 	case CKM_RC2_CBC:
195*26ff1ce9Sdinak 	case CKM_RC2_MAC:
196*26ff1ce9Sdinak 	case CKM_RC2_MAC_GENERAL:
197*26ff1ce9Sdinak 	case CKM_RC2_CBC_PAD:
198*26ff1ce9Sdinak 	case CKM_PBE_SHA1_RC2_128_CBC:
199*26ff1ce9Sdinak 	case CKM_PBE_SHA1_RC2_40_CBC:
200*26ff1ce9Sdinak 		*gen_mech = CKM_RC2_KEY_GEN;
201*26ff1ce9Sdinak 		break;
202*26ff1ce9Sdinak 
203*26ff1ce9Sdinak 	case CKM_RC4_KEY_GEN:
204*26ff1ce9Sdinak 	case CKM_RC4:
205*26ff1ce9Sdinak 	case CKM_PBE_SHA1_RC4_128:
206*26ff1ce9Sdinak 	case CKM_PBE_SHA1_RC4_40:
207*26ff1ce9Sdinak 		*gen_mech = CKM_RC4_KEY_GEN;
208*26ff1ce9Sdinak 		break;
209*26ff1ce9Sdinak 
210*26ff1ce9Sdinak 	case CKM_DES_KEY_GEN:
211*26ff1ce9Sdinak 	case CKM_DES_ECB:
212*26ff1ce9Sdinak 	case CKM_DES_CBC:
213*26ff1ce9Sdinak 	case CKM_DES_MAC:
214*26ff1ce9Sdinak 	case CKM_DES_MAC_GENERAL:
215*26ff1ce9Sdinak 	case CKM_DES_CBC_PAD:
216*26ff1ce9Sdinak 	case CKM_PBE_MD2_DES_CBC:
217*26ff1ce9Sdinak 	case CKM_PBE_MD5_DES_CBC:
218*26ff1ce9Sdinak 	case CKM_DES_OFB64:
219*26ff1ce9Sdinak 	case CKM_DES_OFB8:
220*26ff1ce9Sdinak 	case CKM_DES_CFB64:
221*26ff1ce9Sdinak 	case CKM_DES_CFB8:
222*26ff1ce9Sdinak 	case CKM_DES_ECB_ENCRYPT_DATA:
223*26ff1ce9Sdinak 	case CKM_DES_CBC_ENCRYPT_DATA:
224*26ff1ce9Sdinak 		*gen_mech = CKM_DES_KEY_GEN;
225*26ff1ce9Sdinak 		break;
226*26ff1ce9Sdinak 
227*26ff1ce9Sdinak 	case CKM_DES2_KEY_GEN:
228*26ff1ce9Sdinak 	case CKM_PBE_SHA1_DES2_EDE_CBC:
229*26ff1ce9Sdinak 		*gen_mech = CKM_DES2_KEY_GEN;
230*26ff1ce9Sdinak 		break;
231*26ff1ce9Sdinak 
232*26ff1ce9Sdinak 	case CKM_DES3_KEY_GEN:
233*26ff1ce9Sdinak 	case CKM_DES3_ECB:
234*26ff1ce9Sdinak 	case CKM_DES3_CBC:
235*26ff1ce9Sdinak 	case CKM_DES3_MAC:
236*26ff1ce9Sdinak 	case CKM_DES3_MAC_GENERAL:
237*26ff1ce9Sdinak 	case CKM_DES3_CBC_PAD:
238*26ff1ce9Sdinak 	case CKM_PBE_SHA1_DES3_EDE_CBC:
239*26ff1ce9Sdinak 	case CKM_DES3_ECB_ENCRYPT_DATA:
240*26ff1ce9Sdinak 	case CKM_DES3_CBC_ENCRYPT_DATA:
241*26ff1ce9Sdinak 		*gen_mech = CKM_DES3_KEY_GEN;
242*26ff1ce9Sdinak 		break;
243*26ff1ce9Sdinak 
244*26ff1ce9Sdinak 	case CKM_CAST_KEY_GEN:
245*26ff1ce9Sdinak 	case CKM_CAST_ECB:
246*26ff1ce9Sdinak 	case CKM_CAST_CBC:
247*26ff1ce9Sdinak 	case CKM_CAST_MAC:
248*26ff1ce9Sdinak 	case CKM_CAST_MAC_GENERAL:
249*26ff1ce9Sdinak 	case CKM_CAST_CBC_PAD:
250*26ff1ce9Sdinak 	case CKM_PBE_MD5_CAST_CBC:
251*26ff1ce9Sdinak 		*gen_mech = CKM_CAST_KEY_GEN;
252*26ff1ce9Sdinak 		break;
253*26ff1ce9Sdinak 
254*26ff1ce9Sdinak 	case CKM_CAST3_KEY_GEN:
255*26ff1ce9Sdinak 	case CKM_CAST3_ECB:
256*26ff1ce9Sdinak 	case CKM_CAST3_CBC:
257*26ff1ce9Sdinak 	case CKM_CAST3_MAC:
258*26ff1ce9Sdinak 	case CKM_CAST3_MAC_GENERAL:
259*26ff1ce9Sdinak 	case CKM_CAST3_CBC_PAD:
260*26ff1ce9Sdinak 	case CKM_PBE_MD5_CAST3_CBC:
261*26ff1ce9Sdinak 		*gen_mech = CKM_CAST3_KEY_GEN;
262*26ff1ce9Sdinak 		break;
263*26ff1ce9Sdinak 
264*26ff1ce9Sdinak 	case CKM_CAST128_KEY_GEN:
265*26ff1ce9Sdinak 	case CKM_CAST128_ECB:
266*26ff1ce9Sdinak 	case CKM_CAST128_CBC:
267*26ff1ce9Sdinak 	case CKM_CAST128_MAC:
268*26ff1ce9Sdinak 	case CKM_CAST128_MAC_GENERAL:
269*26ff1ce9Sdinak 	case CKM_CAST128_CBC_PAD:
270*26ff1ce9Sdinak 	case CKM_PBE_MD5_CAST128_CBC:
271*26ff1ce9Sdinak 	case CKM_PBE_SHA1_CAST128_CBC:
272*26ff1ce9Sdinak 		*gen_mech = CKM_CAST128_KEY_GEN;
273*26ff1ce9Sdinak 		break;
274*26ff1ce9Sdinak 
275*26ff1ce9Sdinak 	case CKM_RC5_KEY_GEN:
276*26ff1ce9Sdinak 	case CKM_RC5_ECB:
277*26ff1ce9Sdinak 	case CKM_RC5_CBC:
278*26ff1ce9Sdinak 	case CKM_RC5_MAC:
279*26ff1ce9Sdinak 	case CKM_RC5_MAC_GENERAL:
280*26ff1ce9Sdinak 	case CKM_RC5_CBC_PAD:
281*26ff1ce9Sdinak 		*gen_mech = CKM_RC5_KEY_GEN;
282*26ff1ce9Sdinak 		break;
283*26ff1ce9Sdinak 
284*26ff1ce9Sdinak 	case CKM_IDEA_KEY_GEN:
285*26ff1ce9Sdinak 	case CKM_IDEA_ECB:
286*26ff1ce9Sdinak 	case CKM_IDEA_CBC:
287*26ff1ce9Sdinak 	case CKM_IDEA_MAC:
288*26ff1ce9Sdinak 	case CKM_IDEA_MAC_GENERAL:
289*26ff1ce9Sdinak 	case CKM_IDEA_CBC_PAD:
290*26ff1ce9Sdinak 		*gen_mech = CKM_IDEA_KEY_GEN;
291*26ff1ce9Sdinak 		break;
292*26ff1ce9Sdinak 
293*26ff1ce9Sdinak 	case CKM_SKIPJACK_KEY_GEN:
294*26ff1ce9Sdinak 	case CKM_SKIPJACK_ECB64:
295*26ff1ce9Sdinak 	case CKM_SKIPJACK_CBC64:
296*26ff1ce9Sdinak 	case CKM_SKIPJACK_OFB64:
297*26ff1ce9Sdinak 	case CKM_SKIPJACK_CFB64:
298*26ff1ce9Sdinak 	case CKM_SKIPJACK_CFB32:
299*26ff1ce9Sdinak 	case CKM_SKIPJACK_CFB16:
300*26ff1ce9Sdinak 	case CKM_SKIPJACK_CFB8:
301*26ff1ce9Sdinak 	case CKM_SKIPJACK_WRAP:
302*26ff1ce9Sdinak 	case CKM_SKIPJACK_PRIVATE_WRAP:
303*26ff1ce9Sdinak 	case CKM_SKIPJACK_RELAYX:
304*26ff1ce9Sdinak 		*gen_mech = CKM_SKIPJACK_KEY_GEN;
305*26ff1ce9Sdinak 		break;
306*26ff1ce9Sdinak 
307*26ff1ce9Sdinak 	case CKM_BATON_KEY_GEN:
308*26ff1ce9Sdinak 	case CKM_BATON_ECB128:
309*26ff1ce9Sdinak 	case CKM_BATON_ECB96:
310*26ff1ce9Sdinak 	case CKM_BATON_CBC128:
311*26ff1ce9Sdinak 	case CKM_BATON_COUNTER:
312*26ff1ce9Sdinak 	case CKM_BATON_SHUFFLE:
313*26ff1ce9Sdinak 	case CKM_BATON_WRAP:
314*26ff1ce9Sdinak 		*gen_mech = CKM_BATON_KEY_GEN;
315*26ff1ce9Sdinak 		break;
316*26ff1ce9Sdinak 
317*26ff1ce9Sdinak 	case CKM_JUNIPER_KEY_GEN:
318*26ff1ce9Sdinak 	case CKM_JUNIPER_ECB128:
319*26ff1ce9Sdinak 	case CKM_JUNIPER_CBC128:
320*26ff1ce9Sdinak 	case CKM_JUNIPER_COUNTER:
321*26ff1ce9Sdinak 	case CKM_JUNIPER_SHUFFLE:
322*26ff1ce9Sdinak 	case CKM_JUNIPER_WRAP:
323*26ff1ce9Sdinak 		*gen_mech = CKM_JUNIPER_KEY_GEN;
324*26ff1ce9Sdinak 		break;
325*26ff1ce9Sdinak 
326*26ff1ce9Sdinak 	case CKM_CDMF_KEY_GEN:
327*26ff1ce9Sdinak 	case CKM_CDMF_ECB:
328*26ff1ce9Sdinak 	case CKM_CDMF_CBC:
329*26ff1ce9Sdinak 	case CKM_CDMF_MAC:
330*26ff1ce9Sdinak 	case CKM_CDMF_MAC_GENERAL:
331*26ff1ce9Sdinak 	case CKM_CDMF_CBC_PAD:
332*26ff1ce9Sdinak 		*gen_mech = CKM_CDMF_KEY_GEN;
333*26ff1ce9Sdinak 		break;
334*26ff1ce9Sdinak 
335*26ff1ce9Sdinak 	case CKM_AES_KEY_GEN:
336*26ff1ce9Sdinak 	case CKM_AES_ECB:
337*26ff1ce9Sdinak 	case CKM_AES_CBC:
338*26ff1ce9Sdinak 	case CKM_AES_MAC:
339*26ff1ce9Sdinak 	case CKM_AES_MAC_GENERAL:
340*26ff1ce9Sdinak 	case CKM_AES_CBC_PAD:
341*26ff1ce9Sdinak 	case CKM_AES_ECB_ENCRYPT_DATA:
342*26ff1ce9Sdinak 	case CKM_AES_CBC_ENCRYPT_DATA:
343*26ff1ce9Sdinak 		*gen_mech = CKM_AES_KEY_GEN;
344*26ff1ce9Sdinak 		break;
345*26ff1ce9Sdinak 
346*26ff1ce9Sdinak 	case CKM_BLOWFISH_KEY_GEN:
347*26ff1ce9Sdinak 	case CKM_BLOWFISH_CBC:
348*26ff1ce9Sdinak 		*gen_mech = CKM_BLOWFISH_KEY_GEN;
349*26ff1ce9Sdinak 		break;
350*26ff1ce9Sdinak 
351*26ff1ce9Sdinak 	case CKM_TWOFISH_KEY_GEN:
352*26ff1ce9Sdinak 	case CKM_TWOFISH_CBC:
353*26ff1ce9Sdinak 		*gen_mech = CKM_TWOFISH_KEY_GEN;
354*26ff1ce9Sdinak 		break;
355*26ff1ce9Sdinak 
356*26ff1ce9Sdinak 	default:
357*26ff1ce9Sdinak 		return (CKR_MECHANISM_INVALID);
358*26ff1ce9Sdinak 		break;
359*26ff1ce9Sdinak 	}
360*26ff1ce9Sdinak 
361*26ff1ce9Sdinak 	return (CKR_OK);
362*26ff1ce9Sdinak }
363