dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / lib / gss_mechs / mech_dh / dh192 / fakensl.c
blobbbf94cc174ae1d91ce82f442f5fca25fdbfd8292
1 /*
2 * CDDL HEADER START
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.
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.
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]
20 * CDDL HEADER END
23 * fakensl.c
25 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
29 #pragma ident "%Z%%M% %I% %E% SMI"
31 #include <rpc/rpc.h>
32 #include <rpc/key_prot.h>
34 #ifndef HEX_KEY_BYTES
35 #define HEX_KEY_BYTES HEXKEYBYTES
36 #endif
38 extern int key_encryptsession_pk(const char *, netobj *, des_block *);
39 extern int key_decryptsession_pk(const char *, netobj *, des_block *);
41 /*ARGSUSED*/
42 int
43 __getpublickey_cached_g(const char remotename[MAXNETNAMELEN], int keylen,
44 int algtype, char *pkey, size_t pkeylen, int *cached)
46 return (getpublickey(remotename, pkey));
49 #pragma weak getpublickey_g
50 /*ARGSUSED*/
51 int
52 getpublickey_g(const char remotename[MAXNETNAMELEN], int keylen,
53 int algtype, char *pkey, size_t pkeylen)
55 return (getpublickey(remotename, pkey));
58 #pragma weak key_encryptsession_pk_g
59 /*ARGSUSED*/
60 int
61 key_encryptsession_pk_g(const char *remotename, const char *pk, int keylen,
62 int algtype, des_block deskeys[], int no_keys)
64 int i;
65 netobj npk;
67 npk.n_len = HEX_KEY_BYTES;
68 npk.n_bytes = (char *)pk;
70 for (i = 0; i < no_keys; i++) {
71 if (key_encryptsession_pk(remotename, &npk, &deskeys[i]))
72 return (-1);
74 return (0);
77 #pragma weak key_decryptsession_pk_g
78 /*ARGSUSED*/
79 int
80 key_decryptsession_pk_g(const char *remotename, const char *pk, int keylen,
81 int algtype, des_block deskeys[], int no_keys)
83 int i;
84 netobj npk;
86 npk.n_len = HEX_KEY_BYTES;
87 npk.n_bytes = (char *)pk;
89 for (i = 0; i < no_keys; i++) {
90 if (key_decryptsession_pk(remotename, &npk, &deskeys[i]))
91 return (-1);
93 return (0);
96 #pragma weak key_gendes_g
97 int
98 key_gendes_g(des_block deskeys[], int no_keys)
100 int i;
102 memset(deskeys, 0, no_keys* sizeof (des_block));
103 for (i = 0; i < no_keys; i++) {
104 if (key_gendes(&deskeys[i]))
105 return (-1);
107 return (0);
110 #pragma weak key_secretkey_is_set_g
111 /*ARGSUSED*/
113 key_secretkey_is_set_g(int Keylen, int algtype)
115 return (key_secretkey_is_set());
118 #pragma weak des_setparity
119 void
120 des_setparity_g(des_block *key)
122 des_setparity((char *)key);