3329 spa_sync() spends 10-20% of its time in spa_free_sync_cb()
[unleashed.git] / usr / src / uts / common / rpc / des_crypt.h
blob7451354ab298d072d2ed6b0b6229754bc0207148
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 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
29 * Portions of this source code were derived from Berkeley
30 * 4.3 BSD under license from the Regents of the University of
31 * California.
35 * des_crypt.h, des library routine interface
38 #ifndef _DES_DES_CRYPT_H
39 #define _DES_DES_CRYPT_H
41 #pragma ident "%Z%%M% %I% %E% SMI"
43 #include <sys/types.h>
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
49 #define DES_MAXDATA 8192 /* max bytes encrypted in one call */
50 #define DES_DIRMASK (1 << 0)
51 #define DES_ENCRYPT (0 * DES_DIRMASK) /* Encrypt */
52 #define DES_DECRYPT (1 * DES_DIRMASK) /* Decrypt */
55 #define DES_DEVMASK (1 << 1)
56 #define DES_HW (0 * DES_DEVMASK) /* Use hardware device */
57 #define DES_SW (1 * DES_DEVMASK) /* Use software device */
60 #define DESERR_NONE 0 /* succeeded */
61 #define DESERR_NOHWDEVICE 1 /* succeeded, but hw device not available */
62 #define DESERR_HWERROR 2 /* failed, hardware/driver error */
63 #define DESERR_BADPARAM 3 /* failed, bad parameter to call */
65 #define DES_FAILED(err) \
66 ((err) > DESERR_NOHWDEVICE)
69 * cbc_crypt()
70 * ecb_crypt()
72 * Encrypt (or decrypt) len bytes of a buffer buf.
73 * The length must be a multiple of eight.
74 * The key should have odd parity in the low bit of each byte.
75 * ivec is the input vector, and is updated to the new one (cbc only).
76 * The mode is created by oring together the appropriate parameters.
77 * DESERR_NOHWDEVICE is returned if DES_HW was specified but
78 * there was no hardware to do it on (the data will still be
79 * encrypted though, in software).
84 * Cipher Block Chaining mode
86 #ifdef __STDC__
87 int cbc_crypt(char *key, char *buf, size_t len, unsigned int mode, char *ivec);
88 #else
89 int cbc_crypt();
90 #endif
94 * Electronic Code Book mode
96 #ifdef __STDC__
97 int ecb_crypt(char *key, char *buf, size_t len, unsigned int mode);
98 #else
99 int ecb_crypt();
100 #endif
103 #ifndef _KERNEL
105 * Set des parity for a key.
106 * DES parity is odd and in the low bit of each byte
108 #ifdef __STDC__
109 void des_setparity(char *key);
110 #else
111 void des_setparity();
112 #endif
113 #endif /* _KERNEL */
115 #ifdef __cplusplus
117 #endif
119 #endif /* _DES_DES_CRYPT_H */