cryptodev.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. /* $FreeBSD: src/sys/opencrypto/cryptodev.h,v 1.25 2007/05/09 19:37:02 gnn Exp $ */
  2. /* $OpenBSD: cryptodev.h,v 1.31 2002/06/11 11:14:29 beck Exp $ */
  3. /*-
  4. * Linux port done by David McCullough <david_mccullough@securecomputing.com>
  5. * Copyright (C) 2006-2007 David McCullough
  6. * Copyright (C) 2004-2005 Intel Corporation.
  7. * The license and original author are listed below.
  8. *
  9. * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
  10. * Copyright (c) 2002-2006 Sam Leffler, Errno Consulting
  11. *
  12. * This code was written by Angelos D. Keromytis in Athens, Greece, in
  13. * February 2000. Network Security Technologies Inc. (NSTI) kindly
  14. * supported the development of this code.
  15. *
  16. * Copyright (c) 2000 Angelos D. Keromytis
  17. *
  18. * Permission to use, copy, and modify this software with or without fee
  19. * is hereby granted, provided that this entire notice is included in
  20. * all source code copies of any software which is or includes a copy or
  21. * modification of this software.
  22. *
  23. * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
  24. * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
  25. * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
  26. * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
  27. * PURPOSE.
  28. *
  29. * Copyright (c) 2001 Theo de Raadt
  30. *
  31. * Redistribution and use in source and binary forms, with or without
  32. * modification, are permitted provided that the following conditions
  33. * are met:
  34. *
  35. * 1. Redistributions of source code must retain the above copyright
  36. * notice, this list of conditions and the following disclaimer.
  37. * 2. Redistributions in binary form must reproduce the above copyright
  38. * notice, this list of conditions and the following disclaimer in the
  39. * documentation and/or other materials provided with the distribution.
  40. * 3. The name of the author may not be used to endorse or promote products
  41. * derived from this software without specific prior written permission.
  42. *
  43. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  44. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  45. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  46. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  47. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  48. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  49. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  50. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  51. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  52. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  53. *
  54. * Effort sponsored in part by the Defense Advanced Research Projects
  55. * Agency (DARPA) and Air Force Research Laboratory, Air Force
  56. * Materiel Command, USAF, under agreement number F30602-01-2-0537.
  57. *
  58. */
  59. #ifndef _CRYPTO_CRYPTO_H_
  60. #define _CRYPTO_CRYPTO_H_
  61. /* Some initial values */
  62. #define CRYPTO_DRIVERS_INITIAL 4
  63. #define CRYPTO_SW_SESSIONS 32
  64. /* Hash values */
  65. #define NULL_HASH_LEN 0
  66. #define MD5_HASH_LEN 16
  67. #define SHA1_HASH_LEN 20
  68. #define RIPEMD160_HASH_LEN 20
  69. #define SHA2_256_HASH_LEN 32
  70. #define SHA2_384_HASH_LEN 48
  71. #define SHA2_512_HASH_LEN 64
  72. #define MD5_KPDK_HASH_LEN 16
  73. #define SHA1_KPDK_HASH_LEN 20
  74. /* Maximum hash algorithm result length */
  75. #define HASH_MAX_LEN SHA2_512_HASH_LEN /* Keep this updated */
  76. /* HMAC values */
  77. #define NULL_HMAC_BLOCK_LEN 1
  78. #define MD5_HMAC_BLOCK_LEN 64
  79. #define SHA1_HMAC_BLOCK_LEN 64
  80. #define RIPEMD160_HMAC_BLOCK_LEN 64
  81. #define SHA2_256_HMAC_BLOCK_LEN 64
  82. #define SHA2_384_HMAC_BLOCK_LEN 128
  83. #define SHA2_512_HMAC_BLOCK_LEN 128
  84. /* Maximum HMAC block length */
  85. #define HMAC_MAX_BLOCK_LEN SHA2_512_HMAC_BLOCK_LEN /* Keep this updated */
  86. #define HMAC_IPAD_VAL 0x36
  87. #define HMAC_OPAD_VAL 0x5C
  88. /* Encryption algorithm block sizes */
  89. #define NULL_BLOCK_LEN 1
  90. #define DES_BLOCK_LEN 8
  91. #define DES3_BLOCK_LEN 8
  92. #define BLOWFISH_BLOCK_LEN 8
  93. #define SKIPJACK_BLOCK_LEN 8
  94. #define CAST128_BLOCK_LEN 8
  95. #define RIJNDAEL128_BLOCK_LEN 16
  96. #define AES_BLOCK_LEN RIJNDAEL128_BLOCK_LEN
  97. #define CAMELLIA_BLOCK_LEN 16
  98. #define ARC4_BLOCK_LEN 1
  99. #define EALG_MAX_BLOCK_LEN AES_BLOCK_LEN /* Keep this updated */
  100. /* Encryption algorithm min and max key sizes */
  101. #define NULL_MIN_KEY_LEN 0
  102. #define NULL_MAX_KEY_LEN 0
  103. #define DES_MIN_KEY_LEN 8
  104. #define DES_MAX_KEY_LEN 8
  105. #define DES3_MIN_KEY_LEN 24
  106. #define DES3_MAX_KEY_LEN 24
  107. #define BLOWFISH_MIN_KEY_LEN 4
  108. #define BLOWFISH_MAX_KEY_LEN 56
  109. #define SKIPJACK_MIN_KEY_LEN 10
  110. #define SKIPJACK_MAX_KEY_LEN 10
  111. #define CAST128_MIN_KEY_LEN 5
  112. #define CAST128_MAX_KEY_LEN 16
  113. #define RIJNDAEL128_MIN_KEY_LEN 16
  114. #define RIJNDAEL128_MAX_KEY_LEN 32
  115. #define AES_MIN_KEY_LEN RIJNDAEL128_MIN_KEY_LEN
  116. #define AES_MAX_KEY_LEN RIJNDAEL128_MAX_KEY_LEN
  117. #define CAMELLIA_MIN_KEY_LEN 16
  118. #define CAMELLIA_MAX_KEY_LEN 32
  119. #define ARC4_MIN_KEY_LEN 1
  120. #define ARC4_MAX_KEY_LEN 256
  121. /* Max size of data that can be processed */
  122. #define CRYPTO_MAX_DATA_LEN 64*1024 - 1
  123. #define CRYPTO_ALGORITHM_MIN 1
  124. #define CRYPTO_DES_CBC 1
  125. #define CRYPTO_3DES_CBC 2
  126. #define CRYPTO_BLF_CBC 3
  127. #define CRYPTO_CAST_CBC 4
  128. #define CRYPTO_SKIPJACK_CBC 5
  129. #define CRYPTO_MD5_HMAC 6
  130. #define CRYPTO_SHA1_HMAC 7
  131. #define CRYPTO_RIPEMD160_HMAC 8
  132. #define CRYPTO_MD5_KPDK 9
  133. #define CRYPTO_SHA1_KPDK 10
  134. #define CRYPTO_RIJNDAEL128_CBC 11 /* 128 bit blocksize */
  135. #define CRYPTO_AES_CBC 11 /* 128 bit blocksize -- the same as above */
  136. #define CRYPTO_ARC4 12
  137. #define CRYPTO_MD5 13
  138. #define CRYPTO_SHA1 14
  139. #define CRYPTO_NULL_HMAC 15
  140. #define CRYPTO_NULL_CBC 16
  141. #define CRYPTO_DEFLATE_COMP 17 /* Deflate compression algorithm */
  142. #define CRYPTO_SHA2_256_HMAC 18
  143. #define CRYPTO_SHA2_384_HMAC 19
  144. #define CRYPTO_SHA2_512_HMAC 20
  145. #define CRYPTO_CAMELLIA_CBC 21
  146. #define CRYPTO_SHA2_256 22
  147. #define CRYPTO_SHA2_384 23
  148. #define CRYPTO_SHA2_512 24
  149. #define CRYPTO_RIPEMD160 25
  150. #define CRYPTO_ALGORITHM_MAX 25 /* Keep updated - see below */
  151. /* Algorithm flags */
  152. #define CRYPTO_ALG_FLAG_SUPPORTED 0x01 /* Algorithm is supported */
  153. #define CRYPTO_ALG_FLAG_RNG_ENABLE 0x02 /* Has HW RNG for DH/DSA */
  154. #define CRYPTO_ALG_FLAG_DSA_SHA 0x04 /* Can do SHA on msg */
  155. /*
  156. * Crypto driver/device flags. They can set in the crid
  157. * parameter when creating a session or submitting a key
  158. * op to affect the device/driver assigned. If neither
  159. * of these are specified then the crid is assumed to hold
  160. * the driver id of an existing (and suitable) device that
  161. * must be used to satisfy the request.
  162. */
  163. #define CRYPTO_FLAG_HARDWARE 0x01000000 /* hardware accelerated */
  164. #define CRYPTO_FLAG_SOFTWARE 0x02000000 /* software implementation */
  165. /* NB: deprecated */
  166. struct session_op {
  167. u_int32_t cipher; /* ie. CRYPTO_DES_CBC */
  168. u_int32_t mac; /* ie. CRYPTO_MD5_HMAC */
  169. u_int32_t keylen; /* cipher key */
  170. caddr_t key;
  171. int mackeylen; /* mac key */
  172. caddr_t mackey;
  173. u_int32_t ses; /* returns: session # */
  174. };
  175. struct session2_op {
  176. u_int32_t cipher; /* ie. CRYPTO_DES_CBC */
  177. u_int32_t mac; /* ie. CRYPTO_MD5_HMAC */
  178. u_int32_t keylen; /* cipher key */
  179. caddr_t key;
  180. int mackeylen; /* mac key */
  181. caddr_t mackey;
  182. u_int32_t ses; /* returns: session # */
  183. int crid; /* driver id + flags (rw) */
  184. int pad[4]; /* for future expansion */
  185. };
  186. struct crypt_op {
  187. u_int32_t ses;
  188. u_int16_t op; /* i.e. COP_ENCRYPT */
  189. #define COP_NONE 0
  190. #define COP_ENCRYPT 1
  191. #define COP_DECRYPT 2
  192. u_int16_t flags;
  193. #define COP_F_BATCH 0x0008 /* Batch op if possible */
  194. u_int len;
  195. caddr_t src, dst; /* become iov[] inside kernel */
  196. caddr_t mac; /* must be big enough for chosen MAC */
  197. caddr_t iv;
  198. };
  199. /*
  200. * Parameters for looking up a crypto driver/device by
  201. * device name or by id. The latter are returned for
  202. * created sessions (crid) and completed key operations.
  203. */
  204. struct crypt_find_op {
  205. int crid; /* driver id + flags */
  206. char name[32]; /* device/driver name */
  207. };
  208. /* bignum parameter, in packed bytes, ... */
  209. struct crparam {
  210. caddr_t crp_p;
  211. u_int crp_nbits;
  212. };
  213. #define CRK_MAXPARAM 8
  214. struct crypt_kop {
  215. u_int crk_op; /* ie. CRK_MOD_EXP or other */
  216. u_int crk_status; /* return status */
  217. u_short crk_iparams; /* # of input parameters */
  218. u_short crk_oparams; /* # of output parameters */
  219. u_int crk_crid; /* NB: only used by CIOCKEY2 (rw) */
  220. struct crparam crk_param[CRK_MAXPARAM];
  221. };
  222. #define CRK_ALGORITM_MIN 0
  223. #define CRK_MOD_EXP 0
  224. #define CRK_MOD_EXP_CRT 1
  225. #define CRK_DSA_SIGN 2
  226. #define CRK_DSA_VERIFY 3
  227. #define CRK_DH_COMPUTE_KEY 4
  228. #define CRK_ALGORITHM_MAX 4 /* Keep updated - see below */
  229. #define CRF_MOD_EXP (1 << CRK_MOD_EXP)
  230. #define CRF_MOD_EXP_CRT (1 << CRK_MOD_EXP_CRT)
  231. #define CRF_DSA_SIGN (1 << CRK_DSA_SIGN)
  232. #define CRF_DSA_VERIFY (1 << CRK_DSA_VERIFY)
  233. #define CRF_DH_COMPUTE_KEY (1 << CRK_DH_COMPUTE_KEY)
  234. /*
  235. * done against open of /dev/crypto, to get a cloned descriptor.
  236. * Please use F_SETFD against the cloned descriptor.
  237. */
  238. #define CRIOGET _IOWR('c', 100, u_int32_t)
  239. #define CRIOASYMFEAT CIOCASYMFEAT
  240. #define CRIOFINDDEV CIOCFINDDEV
  241. /* the following are done against the cloned descriptor */
  242. #define CIOCGSESSION _IOWR('c', 101, struct session_op)
  243. #define CIOCFSESSION _IOW('c', 102, u_int32_t)
  244. #define CIOCCRYPT _IOWR('c', 103, struct crypt_op)
  245. #define CIOCKEY _IOWR('c', 104, struct crypt_kop)
  246. #define CIOCASYMFEAT _IOR('c', 105, u_int32_t)
  247. #define CIOCGSESSION2 _IOWR('c', 106, struct session2_op)
  248. #define CIOCKEY2 _IOWR('c', 107, struct crypt_kop)
  249. #define CIOCFINDDEV _IOWR('c', 108, struct crypt_find_op)
  250. struct cryptotstat {
  251. struct timespec acc; /* total accumulated time */
  252. struct timespec min; /* min time */
  253. struct timespec max; /* max time */
  254. u_int32_t count; /* number of observations */
  255. };
  256. struct cryptostats {
  257. u_int32_t cs_ops; /* symmetric crypto ops submitted */
  258. u_int32_t cs_errs; /* symmetric crypto ops that failed */
  259. u_int32_t cs_kops; /* asymetric/key ops submitted */
  260. u_int32_t cs_kerrs; /* asymetric/key ops that failed */
  261. u_int32_t cs_intrs; /* crypto swi thread activations */
  262. u_int32_t cs_rets; /* crypto return thread activations */
  263. u_int32_t cs_blocks; /* symmetric op driver block */
  264. u_int32_t cs_kblocks; /* symmetric op driver block */
  265. /*
  266. * When CRYPTO_TIMING is defined at compile time and the
  267. * sysctl debug.crypto is set to 1, the crypto system will
  268. * accumulate statistics about how long it takes to process
  269. * crypto requests at various points during processing.
  270. */
  271. struct cryptotstat cs_invoke; /* crypto_dipsatch -> crypto_invoke */
  272. struct cryptotstat cs_done; /* crypto_invoke -> crypto_done */
  273. struct cryptotstat cs_cb; /* crypto_done -> callback */
  274. struct cryptotstat cs_finis; /* callback -> callback return */
  275. u_int32_t cs_drops; /* crypto ops dropped due to congestion */
  276. };
  277. #ifdef __KERNEL__
  278. /* Standard initialization structure beginning */
  279. struct cryptoini {
  280. int cri_alg; /* Algorithm to use */
  281. int cri_klen; /* Key length, in bits */
  282. int cri_mlen; /* Number of bytes we want from the
  283. entire hash. 0 means all. */
  284. caddr_t cri_key; /* key to use */
  285. u_int8_t cri_iv[EALG_MAX_BLOCK_LEN]; /* IV to use */
  286. struct cryptoini *cri_next;
  287. };
  288. /* Describe boundaries of a single crypto operation */
  289. struct cryptodesc {
  290. int crd_skip; /* How many bytes to ignore from start */
  291. int crd_len; /* How many bytes to process */
  292. int crd_inject; /* Where to inject results, if applicable */
  293. int crd_flags;
  294. #define CRD_F_ENCRYPT 0x01 /* Set when doing encryption */
  295. #define CRD_F_IV_PRESENT 0x02 /* When encrypting, IV is already in
  296. place, so don't copy. */
  297. #define CRD_F_IV_EXPLICIT 0x04 /* IV explicitly provided */
  298. #define CRD_F_DSA_SHA_NEEDED 0x08 /* Compute SHA-1 of buffer for DSA */
  299. #define CRD_F_KEY_EXPLICIT 0x10 /* Key explicitly provided */
  300. #define CRD_F_COMP 0x0f /* Set when doing compression */
  301. struct cryptoini CRD_INI; /* Initialization/context data */
  302. #define crd_iv CRD_INI.cri_iv
  303. #define crd_key CRD_INI.cri_key
  304. #define crd_alg CRD_INI.cri_alg
  305. #define crd_klen CRD_INI.cri_klen
  306. struct cryptodesc *crd_next;
  307. };
  308. /* Structure describing complete operation */
  309. struct cryptop {
  310. struct list_head crp_next;
  311. wait_queue_head_t crp_waitq;
  312. u_int64_t crp_sid; /* Session ID */
  313. int crp_ilen; /* Input data total length */
  314. int crp_olen; /* Result total length */
  315. int crp_etype; /*
  316. * Error type (zero means no error).
  317. * All error codes except EAGAIN
  318. * indicate possible data corruption (as in,
  319. * the data have been touched). On all
  320. * errors, the crp_sid may have changed
  321. * (reset to a new one), so the caller
  322. * should always check and use the new
  323. * value on future requests.
  324. */
  325. int crp_flags;
  326. #define CRYPTO_F_SKBUF 0x0001 /* Input/output are skbuf chains */
  327. #define CRYPTO_F_IOV 0x0002 /* Input/output are uio */
  328. #define CRYPTO_F_REL 0x0004 /* Must return data in same place */
  329. #define CRYPTO_F_BATCH 0x0008 /* Batch op if possible */
  330. #define CRYPTO_F_CBIMM 0x0010 /* Do callback immediately */
  331. #define CRYPTO_F_DONE 0x0020 /* Operation completed */
  332. #define CRYPTO_F_CBIFSYNC 0x0040 /* Do CBIMM if op is synchronous */
  333. caddr_t crp_buf; /* Data to be processed */
  334. caddr_t crp_opaque; /* Opaque pointer, passed along */
  335. struct cryptodesc *crp_desc; /* Linked list of processing descriptors */
  336. int (*crp_callback)(struct cryptop *); /* Callback function */
  337. };
  338. #define CRYPTO_BUF_CONTIG 0x0
  339. #define CRYPTO_BUF_IOV 0x1
  340. #define CRYPTO_BUF_SKBUF 0x2
  341. #define CRYPTO_OP_DECRYPT 0x0
  342. #define CRYPTO_OP_ENCRYPT 0x1
  343. /*
  344. * Hints passed to process methods.
  345. */
  346. #define CRYPTO_HINT_MORE 0x1 /* more ops coming shortly */
  347. struct cryptkop {
  348. struct list_head krp_next;
  349. wait_queue_head_t krp_waitq;
  350. int krp_flags;
  351. #define CRYPTO_KF_DONE 0x0001 /* Operation completed */
  352. #define CRYPTO_KF_CBIMM 0x0002 /* Do callback immediately */
  353. u_int krp_op; /* ie. CRK_MOD_EXP or other */
  354. u_int krp_status; /* return status */
  355. u_short krp_iparams; /* # of input parameters */
  356. u_short krp_oparams; /* # of output parameters */
  357. u_int krp_crid; /* desired device, etc. */
  358. u_int32_t krp_hid;
  359. struct crparam krp_param[CRK_MAXPARAM]; /* kvm */
  360. int (*krp_callback)(struct cryptkop *);
  361. };
  362. #include <ocf-compat.h>
  363. /*
  364. * Session ids are 64 bits. The lower 32 bits contain a "local id" which
  365. * is a driver-private session identifier. The upper 32 bits contain a
  366. * "hardware id" used by the core crypto code to identify the driver and
  367. * a copy of the driver's capabilities that can be used by client code to
  368. * optimize operation.
  369. */
  370. #define CRYPTO_SESID2HID(_sid) (((_sid) >> 32) & 0x00ffffff)
  371. #define CRYPTO_SESID2CAPS(_sid) (((_sid) >> 32) & 0xff000000)
  372. #define CRYPTO_SESID2LID(_sid) (((u_int32_t) (_sid)) & 0xffffffff)
  373. extern int crypto_newsession(u_int64_t *sid, struct cryptoini *cri, int hard);
  374. extern int crypto_freesession(u_int64_t sid);
  375. #define CRYPTOCAP_F_HARDWARE CRYPTO_FLAG_HARDWARE
  376. #define CRYPTOCAP_F_SOFTWARE CRYPTO_FLAG_SOFTWARE
  377. #define CRYPTOCAP_F_SYNC 0x04000000 /* operates synchronously */
  378. extern int32_t crypto_get_driverid(device_t dev, int flags);
  379. extern int crypto_find_driver(const char *);
  380. extern device_t crypto_find_device_byhid(int hid);
  381. extern int crypto_getcaps(int hid);
  382. extern int crypto_register(u_int32_t driverid, int alg, u_int16_t maxoplen,
  383. u_int32_t flags);
  384. extern int crypto_kregister(u_int32_t, int, u_int32_t);
  385. extern int crypto_unregister(u_int32_t driverid, int alg);
  386. extern int crypto_unregister_all(u_int32_t driverid);
  387. extern int crypto_dispatch(struct cryptop *crp);
  388. extern int crypto_kdispatch(struct cryptkop *);
  389. #define CRYPTO_SYMQ 0x1
  390. #define CRYPTO_ASYMQ 0x2
  391. extern int crypto_unblock(u_int32_t, int);
  392. extern void crypto_done(struct cryptop *crp);
  393. extern void crypto_kdone(struct cryptkop *);
  394. extern int crypto_getfeat(int *);
  395. extern void crypto_freereq(struct cryptop *crp);
  396. extern struct cryptop *crypto_getreq(int num);
  397. extern int crypto_usercrypto; /* userland may do crypto requests */
  398. extern int crypto_userasymcrypto; /* userland may do asym crypto reqs */
  399. extern int crypto_devallowsoft; /* only use hardware crypto */
  400. /*
  401. * random number support, crypto_unregister_all will unregister
  402. */
  403. extern int crypto_rregister(u_int32_t driverid,
  404. int (*read_random)(void *arg, u_int32_t *buf, int len), void *arg);
  405. extern int crypto_runregister_all(u_int32_t driverid);
  406. /*
  407. * Crypto-related utility routines used mainly by drivers.
  408. *
  409. * XXX these don't really belong here; but for now they're
  410. * kept apart from the rest of the system.
  411. */
  412. struct uio;
  413. extern void cuio_copydata(struct uio* uio, int off, int len, caddr_t cp);
  414. extern void cuio_copyback(struct uio* uio, int off, int len, caddr_t cp);
  415. extern struct iovec *cuio_getptr(struct uio *uio, int loc, int *off);
  416. extern void crypto_copyback(int flags, caddr_t buf, int off, int size,
  417. caddr_t in);
  418. extern void crypto_copydata(int flags, caddr_t buf, int off, int size,
  419. caddr_t out);
  420. extern int crypto_apply(int flags, caddr_t buf, int off, int len,
  421. int (*f)(void *, void *, u_int), void *arg);
  422. #endif /* __KERNEL__ */
  423. #endif /* _CRYPTO_CRYPTO_H_ */