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