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 /*
30 * Entry points for key generation for libnsl. This file should
31 * be included in the file that defines the MODULUS, ROOT, and KEYLEN
32 * for an algorithm 0 mechanism.
33 */
34
35
36 /*
37 * The libnsl routine __gen_common_dhkeys_g generate a set of DES
38 * keys based on the DH common key given the ALGTYPE and KEYLEN. That
39 * routine will construct the mechanism name from those inputs and
40 * dlopen the mechanism library to grab this routine with dlsym. This
41 * routine will then be used to generate the common key from the
42 * supplied public key, private key, and passwd. This routine is
43 * just a wrapper to call the generic algorithm 0 key generation
44 * routine found in generic_key.c with KEYLEN and MODULUS specified.
45 */
46
47 void
__dl_gen_common_dhkeys(char * xpublic,char * xsecret,des_block keys[],int keynum)48 __dl_gen_common_dhkeys(char *xpublic, char *xsecret,
49 des_block keys[], int keynum)
50 {
51 __generic_common_dhkeys(xpublic, xsecret, KEYLEN,
52 MODULUS, keys, keynum);
53 }
54
55 /*
56 * The libnsl routine __gen_dhkeys_g generate a key pair for a given
57 * ALGTYPE and KEYLEN. That routine will construct the mechanism
58 * name from those inputs and dlopen the mechanism to grab this routine. It
59 * will then use this routine to generate the key pair. This routine
60 * is just a wrapper that marshels the MODULUS, ROOT, and KEYLEN to the
61 * generic algorithm 0 key generation routine found in generic_key.c
62 */
63
64 void
__dl_gen_dhkeys(char * xpublic,char * xsecret,char * passwd)65 __dl_gen_dhkeys(char *xpublic, char *xsecret, char *passwd)
66 {
67 __generic_gen_dhkeys(KEYLEN, MODULUS, ROOT, xpublic, xsecret, passwd);
68 }
69