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
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]
25 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
29 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <rpc/key_prot.h>
35 #define HEX_KEY_BYTES HEXKEYBYTES
38 extern int key_encryptsession_pk(const char *, netobj
*, des_block
*);
39 extern int key_decryptsession_pk(const char *, netobj
*, des_block
*);
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
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
61 key_encryptsession_pk_g(const char *remotename
, const char *pk
, int keylen
,
62 int algtype
, des_block deskeys
[], int no_keys
)
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
]))
77 #pragma weak key_decryptsession_pk_g
80 key_decryptsession_pk_g(const char *remotename
, const char *pk
, int keylen
,
81 int algtype
, des_block deskeys
[], int no_keys
)
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
]))
96 #pragma weak key_gendes_g
98 key_gendes_g(des_block deskeys
[], int no_keys
)
102 memset(deskeys
, 0, no_keys
* sizeof (des_block
));
103 for (i
= 0; i
< no_keys
; i
++) {
104 if (key_gendes(&deskeys
[i
]))
110 #pragma weak key_secretkey_is_set_g
113 key_secretkey_is_set_g(int Keylen
, int algtype
)
115 return (key_secretkey_is_set());
118 #pragma weak des_setparity
120 des_setparity_g(des_block
*key
)
122 des_setparity((char *)key
);