1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * dh_nsl_tmpl.c
24 *
25 * Copyright (c) 1997, by Sun Microsystems, Inc.
26 * All rights reserved.
27 */
28
29 #pragma ident "%Z%%M% %I% %E% SMI"
30
31 /*
32 * Entry points for key generation for libnsl. This file should
33 * be included in the file that defines the MODULUS, ROOT, and KEYLEN
34 * for an algorithm 0 mechanism.
35 */
36
37
38 /*
39 * The libnsl routine __gen_common_dhkeys_g generate a set of DES
40 * keys based on the DH common key given the ALGTYPE and KEYLEN. That
41 * routine will construct the mechanism name from those inputs and
42 * dlopen the mechanism library to grab this routine with dlsym. This
43 * routine will then be used to generate the common key from the
44 * supplied public key, private key, and passwd. This routine is
45 * just a wrapper to call the generic algorithm 0 key generation
46 * routine found in generic_key.c with KEYLEN and MODULUS specified.
47 */
48
49 void
__dl_gen_common_dhkeys(char * xpublic,char * xsecret,des_block keys[],int keynum)50 __dl_gen_common_dhkeys(char *xpublic, char *xsecret,
51 des_block keys[], int keynum)
52 {
53 __generic_common_dhkeys(xpublic, xsecret, KEYLEN,
54 MODULUS, keys, keynum);
55 }
56
57 /*
58 * The libnsl routine __gen_dhkeys_g generate a key pair for a given
59 * ALGTYPE and KEYLEN. That routine will construct the mechanism
60 * name from those inputs and dlopen the mechanism to grab this routine. It
61 * will then use this routine to generate the key pair. This routine
62 * is just a wrapper that marshels the MODULUS, ROOT, and KEYLEN to the
63 * generic algorithm 0 key generation routine found in generic_key.c
64 */
65
66 void
__dl_gen_dhkeys(char * xpublic,char * xsecret,char * passwd)67 __dl_gen_dhkeys(char *xpublic, char *xsecret, char *passwd)
68 {
69 __generic_gen_dhkeys(KEYLEN, MODULUS, ROOT, xpublic, xsecret, passwd);
70 }
71