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]
23 * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _KEYSERV_CACHE_H
28 #define _KEYSERV_CACHE_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
36 /* uid_t, size_t, caddr_t, u_int, etc. */
37 #include <sys/types.h>
38 /* des_block, keylen_t, algtype_t */
39 #include <rpc/key_prot.h>
42 u_short length
; /* Length in bytes */
43 u_char key
[1]; /* Binary data; allocated to correct length */
46 /* Round up to multiple of four */
47 #define ALIGN4(addr) (4 * (((addr)+3)/4))
48 /* Round up to multiple of eight */
49 #define ALIGN8(addr) (8 * (((addr)+7)/8))
51 /* Convert key length in bits to bytes */
52 #define KEYLEN(keylen) (((keylen)+7)/8)
54 /* Bytes to allocate for struct dhkey holding key of specified length (bits) */
55 #define DHKEYALLOC(keylen) ALIGN4(sizeof (struct dhkey) + KEYLEN(keylen))
56 /* Bytes used for a struct dhkey (already allocated */
57 #define DHKEYSIZE(dhkey_ptr) ALIGN4(sizeof (struct dhkey) + \
60 struct cachekey3_list
{
65 struct cachekey3_list
*next
;
68 #define CACHEKEY3_LIST_SIZE(keylen) (sizeof (struct cachekey3_list) + \
69 2*sizeof (keybuf3) + \
70 2*(ALIGN4(2*KEYLEN(keylen)+1)) + \
73 int create_cache_file(keylen_t keylen
, algtype_t algtype
,
76 int cache_insert(keylen_t keylen
, algtype_t algtype
,
78 deskeyarray common
, des_block key
,
82 struct cachekey3_list
*cache_retrieve(keylen_t keylen
, algtype_t algtype
,
84 keybuf3
*public, des_block key
);
86 int cache_remove(keylen_t keylen
, algtype_t algtype
,
90 void print_cache(keylen_t keylen
, algtype_t algtype
);
96 #endif /* _KEYSERV_CACHE_H */