cryptodev.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  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@mcafee.com>
  5. * Copyright (C) 2006-2010 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_LZS_COMP 26
  151. #define CRYPTO_ALGORITHM_MAX 26 /* Keep updated - see above */
  152. /* Algorithm flags */
  153. #define CRYPTO_ALG_FLAG_SUPPORTED 0x01 /* Algorithm is supported */
  154. #define CRYPTO_ALG_FLAG_RNG_ENABLE 0x02 /* Has HW RNG for DH/DSA */
  155. #define CRYPTO_ALG_FLAG_DSA_SHA 0x04 /* Can do SHA on msg */
  156. /*
  157. * Crypto driver/device flags. They can set in the crid
  158. * parameter when creating a session or submitting a key
  159. * op to affect the device/driver assigned. If neither
  160. * of these are specified then the crid is assumed to hold
  161. * the driver id of an existing (and suitable) device that
  162. * must be used to satisfy the request.
  163. */
  164. #define CRYPTO_FLAG_HARDWARE 0x01000000 /* hardware accelerated */
  165. #define CRYPTO_FLAG_SOFTWARE 0x02000000 /* software implementation */
  166. /* NB: deprecated */
  167. struct session_op {
  168. u_int32_t cipher; /* ie. CRYPTO_DES_CBC */
  169. u_int32_t mac; /* ie. CRYPTO_MD5_HMAC */
  170. u_int32_t keylen; /* cipher key */
  171. caddr_t key;
  172. int mackeylen; /* mac key */
  173. caddr_t mackey;
  174. u_int32_t ses; /* returns: session # */
  175. };
  176. struct session2_op {
  177. u_int32_t cipher; /* ie. CRYPTO_DES_CBC */
  178. u_int32_t mac; /* ie. CRYPTO_MD5_HMAC */
  179. u_int32_t keylen; /* cipher key */
  180. caddr_t key;
  181. int mackeylen; /* mac key */
  182. caddr_t mackey;
  183. u_int32_t ses; /* returns: session # */
  184. int crid; /* driver id + flags (rw) */
  185. int pad[4]; /* for future expansion */
  186. };
  187. struct crypt_op {
  188. u_int32_t ses;
  189. u_int16_t op; /* i.e. COP_ENCRYPT */
  190. #define COP_NONE 0
  191. #define COP_ENCRYPT 1
  192. #define COP_DECRYPT 2
  193. u_int16_t flags;
  194. #define COP_F_BATCH 0x0008 /* Batch op if possible */
  195. u_int len;
  196. caddr_t src, dst; /* become iov[] inside kernel */
  197. caddr_t mac; /* must be big enough for chosen MAC */
  198. caddr_t iv;
  199. };
  200. /*
  201. * Parameters for looking up a crypto driver/device by
  202. * device name or by id. The latter are returned for
  203. * created sessions (crid) and completed key operations.
  204. */
  205. struct crypt_find_op {
  206. int crid; /* driver id + flags */
  207. char name[32]; /* device/driver name */
  208. };
  209. /* bignum parameter, in packed bytes, ... */
  210. struct crparam {
  211. caddr_t crp_p;
  212. u_int crp_nbits;
  213. };
  214. #define CRK_MAXPARAM 8
  215. struct crypt_kop {
  216. u_int crk_op; /* ie. CRK_MOD_EXP or other */
  217. u_int crk_status; /* return status */
  218. u_short crk_iparams; /* # of input parameters */
  219. u_short crk_oparams; /* # of output parameters */
  220. u_int crk_crid; /* NB: only used by CIOCKEY2 (rw) */
  221. struct crparam crk_param[CRK_MAXPARAM];
  222. };
  223. #define CRK_ALGORITM_MIN 0
  224. #define CRK_MOD_EXP 0
  225. #define CRK_MOD_EXP_CRT 1
  226. #define CRK_DSA_SIGN 2
  227. #define CRK_DSA_VERIFY 3
  228. #define CRK_DH_COMPUTE_KEY 4
  229. #define CRK_ALGORITHM_MAX 4 /* Keep updated - see below */
  230. #define CRF_MOD_EXP (1 << CRK_MOD_EXP)
  231. #define CRF_MOD_EXP_CRT (1 << CRK_MOD_EXP_CRT)
  232. #define CRF_DSA_SIGN (1 << CRK_DSA_SIGN)
  233. #define CRF_DSA_VERIFY (1 << CRK_DSA_VERIFY)
  234. #define CRF_DH_COMPUTE_KEY (1 << CRK_DH_COMPUTE_KEY)
  235. /*
  236. * done against open of /dev/crypto, to get a cloned descriptor.
  237. * Please use F_SETFD against the cloned descriptor.
  238. */
  239. #define CRIOGET _IOWR('c', 100, u_int32_t)
  240. #define CRIOASYMFEAT CIOCASYMFEAT
  241. #define CRIOFINDDEV CIOCFINDDEV
  242. /* the following are done against the cloned descriptor */
  243. #define CIOCGSESSION _IOWR('c', 101, struct session_op)
  244. #define CIOCFSESSION _IOW('c', 102, u_int32_t)
  245. #define CIOCCRYPT _IOWR('c', 103, struct crypt_op)
  246. #define CIOCKEY _IOWR('c', 104, struct crypt_kop)
  247. #define CIOCASYMFEAT _IOR('c', 105, u_int32_t)
  248. #define CIOCGSESSION2 _IOWR('c', 106, struct session2_op)
  249. #define CIOCKEY2 _IOWR('c', 107, struct crypt_kop)
  250. #define CIOCFINDDEV _IOWR('c', 108, struct crypt_find_op)
  251. struct cryptotstat {
  252. struct timespec acc; /* total accumulated time */
  253. struct timespec min; /* min time */
  254. struct timespec max; /* max time */
  255. u_int32_t count; /* number of observations */
  256. };
  257. struct cryptostats {
  258. u_int32_t cs_ops; /* symmetric crypto ops submitted */
  259. u_int32_t cs_errs; /* symmetric crypto ops that failed */
  260. u_int32_t cs_kops; /* asymetric/key ops submitted */
  261. u_int32_t cs_kerrs; /* asymetric/key ops that failed */
  262. u_int32_t cs_intrs; /* crypto swi thread activations */
  263. u_int32_t cs_rets; /* crypto return thread activations */
  264. u_int32_t cs_blocks; /* symmetric op driver block */
  265. u_int32_t cs_kblocks; /* symmetric op driver block */
  266. /*
  267. * When CRYPTO_TIMING is defined at compile time and the
  268. * sysctl debug.crypto is set to 1, the crypto system will
  269. * accumulate statistics about how long it takes to process
  270. * crypto requests at various points during processing.
  271. */
  272. struct cryptotstat cs_invoke; /* crypto_dipsatch -> crypto_invoke */
  273. struct cryptotstat cs_done; /* crypto_invoke -> crypto_done */
  274. struct cryptotstat cs_cb; /* crypto_done -> callback */
  275. struct cryptotstat cs_finis; /* callback -> callback return */
  276. u_int32_t cs_drops; /* crypto ops dropped due to congestion */
  277. };
  278. #ifdef __KERNEL__
  279. /* Standard initialization structure beginning */
  280. struct cryptoini {
  281. int cri_alg; /* Algorithm to use */
  282. int cri_klen; /* Key length, in bits */
  283. int cri_mlen; /* Number of bytes we want from the
  284. entire hash. 0 means all. */
  285. caddr_t cri_key; /* key to use */
  286. u_int8_t cri_iv[EALG_MAX_BLOCK_LEN]; /* IV to use */
  287. struct cryptoini *cri_next;
  288. };
  289. /* Describe boundaries of a single crypto operation */
  290. struct cryptodesc {
  291. int crd_skip; /* How many bytes to ignore from start */
  292. int crd_len; /* How many bytes to process */
  293. int crd_inject; /* Where to inject results, if applicable */
  294. int crd_flags;
  295. #define CRD_F_ENCRYPT 0x01 /* Set when doing encryption */
  296. #define CRD_F_IV_PRESENT 0x02 /* When encrypting, IV is already in
  297. place, so don't copy. */
  298. #define CRD_F_IV_EXPLICIT 0x04 /* IV explicitly provided */
  299. #define CRD_F_DSA_SHA_NEEDED 0x08 /* Compute SHA-1 of buffer for DSA */
  300. #define CRD_F_KEY_EXPLICIT 0x10 /* Key explicitly provided */
  301. #define CRD_F_COMP 0x0f /* Set when doing compression */
  302. struct cryptoini CRD_INI; /* Initialization/context data */
  303. #define crd_iv CRD_INI.cri_iv
  304. #define crd_key CRD_INI.cri_key
  305. #define crd_alg CRD_INI.cri_alg
  306. #define crd_klen CRD_INI.cri_klen
  307. #define crd_mlen CRD_INI.cri_mlen
  308. struct cryptodesc *crd_next;
  309. };
  310. /* Structure describing complete operation */
  311. struct cryptop {
  312. struct list_head crp_next;
  313. wait_queue_head_t crp_waitq;
  314. u_int64_t crp_sid; /* Session ID */
  315. int crp_ilen; /* Input data total length */
  316. int crp_olen; /* Result total length */
  317. int crp_etype; /*
  318. * Error type (zero means no error).
  319. * All error codes except EAGAIN
  320. * indicate possible data corruption (as in,
  321. * the data have been touched). On all
  322. * errors, the crp_sid may have changed
  323. * (reset to a new one), so the caller
  324. * should always check and use the new
  325. * value on future requests.
  326. */
  327. int crp_flags;
  328. #define CRYPTO_F_SKBUF 0x0001 /* Input/output are skbuf chains */
  329. #define CRYPTO_F_IOV 0x0002 /* Input/output are uio */
  330. #define CRYPTO_F_REL 0x0004 /* Must return data in same place */
  331. #define CRYPTO_F_BATCH 0x0008 /* Batch op if possible */
  332. #define CRYPTO_F_CBIMM 0x0010 /* Do callback immediately */
  333. #define CRYPTO_F_DONE 0x0020 /* Operation completed */
  334. #define CRYPTO_F_CBIFSYNC 0x0040 /* Do CBIMM if op is synchronous */
  335. caddr_t crp_buf; /* Data to be processed */
  336. caddr_t crp_opaque; /* Opaque pointer, passed along */
  337. struct cryptodesc *crp_desc; /* Linked list of processing descriptors */
  338. int (*crp_callback)(struct cryptop *); /* Callback function */
  339. };
  340. #define CRYPTO_BUF_CONTIG 0x0
  341. #define CRYPTO_BUF_IOV 0x1
  342. #define CRYPTO_BUF_SKBUF 0x2
  343. #define CRYPTO_OP_DECRYPT 0x0
  344. #define CRYPTO_OP_ENCRYPT 0x1
  345. /*
  346. * Hints passed to process methods.
  347. */
  348. #define CRYPTO_HINT_MORE 0x1 /* more ops coming shortly */
  349. struct cryptkop {
  350. struct list_head krp_next;
  351. wait_queue_head_t krp_waitq;
  352. int krp_flags;
  353. #define CRYPTO_KF_DONE 0x0001 /* Operation completed */
  354. #define CRYPTO_KF_CBIMM 0x0002 /* Do callback immediately */
  355. u_int krp_op; /* ie. CRK_MOD_EXP or other */
  356. u_int krp_status; /* return status */
  357. u_short krp_iparams; /* # of input parameters */
  358. u_short krp_oparams; /* # of output parameters */
  359. u_int krp_crid; /* desired device, etc. */
  360. u_int32_t krp_hid;
  361. struct crparam krp_param[CRK_MAXPARAM]; /* kvm */
  362. int (*krp_callback)(struct cryptkop *);
  363. };
  364. #include <ocf-compat.h>
  365. /*
  366. * Session ids are 64 bits. The lower 32 bits contain a "local id" which
  367. * is a driver-private session identifier. The upper 32 bits contain a
  368. * "hardware id" used by the core crypto code to identify the driver and
  369. * a copy of the driver's capabilities that can be used by client code to
  370. * optimize operation.
  371. */
  372. #define CRYPTO_SESID2HID(_sid) (((_sid) >> 32) & 0x00ffffff)
  373. #define CRYPTO_SESID2CAPS(_sid) (((_sid) >> 32) & 0xff000000)
  374. #define CRYPTO_SESID2LID(_sid) (((u_int32_t) (_sid)) & 0xffffffff)
  375. extern int crypto_newsession(u_int64_t *sid, struct cryptoini *cri, int hard);
  376. extern int crypto_freesession(u_int64_t sid);
  377. #define CRYPTOCAP_F_HARDWARE CRYPTO_FLAG_HARDWARE
  378. #define CRYPTOCAP_F_SOFTWARE CRYPTO_FLAG_SOFTWARE
  379. #define CRYPTOCAP_F_SYNC 0x04000000 /* operates synchronously */
  380. extern int32_t crypto_get_driverid(device_t dev, int flags);
  381. extern int crypto_find_driver(const char *);
  382. extern device_t crypto_find_device_byhid(int hid);
  383. extern int crypto_getcaps(int hid);
  384. extern int crypto_register(u_int32_t driverid, int alg, u_int16_t maxoplen,
  385. u_int32_t flags);
  386. extern int crypto_kregister(u_int32_t, int, u_int32_t);
  387. extern int crypto_unregister(u_int32_t driverid, int alg);
  388. extern int crypto_unregister_all(u_int32_t driverid);
  389. extern int crypto_dispatch(struct cryptop *crp);
  390. extern int crypto_kdispatch(struct cryptkop *);
  391. #define CRYPTO_SYMQ 0x1
  392. #define CRYPTO_ASYMQ 0x2
  393. extern int crypto_unblock(u_int32_t, int);
  394. extern void crypto_done(struct cryptop *crp);
  395. extern void crypto_kdone(struct cryptkop *);
  396. extern int crypto_getfeat(int *);
  397. extern void crypto_freereq(struct cryptop *crp);
  398. extern struct cryptop *crypto_getreq(int num);
  399. extern int crypto_usercrypto; /* userland may do crypto requests */
  400. extern int crypto_userasymcrypto; /* userland may do asym crypto reqs */
  401. extern int crypto_devallowsoft; /* only use hardware crypto */
  402. /*
  403. * random number support, crypto_unregister_all will unregister
  404. */
  405. extern int crypto_rregister(u_int32_t driverid,
  406. int (*read_random)(void *arg, u_int32_t *buf, int len), void *arg);
  407. extern int crypto_runregister_all(u_int32_t driverid);
  408. /*
  409. * Crypto-related utility routines used mainly by drivers.
  410. *
  411. * XXX these don't really belong here; but for now they're
  412. * kept apart from the rest of the system.
  413. */
  414. struct uio;
  415. extern void cuio_copydata(struct uio* uio, int off, int len, caddr_t cp);
  416. extern void cuio_copyback(struct uio* uio, int off, int len, caddr_t cp);
  417. extern struct iovec *cuio_getptr(struct uio *uio, int loc, int *off);
  418. extern void crypto_copyback(int flags, caddr_t buf, int off, int size,
  419. caddr_t in);
  420. extern void crypto_copydata(int flags, caddr_t buf, int off, int size,
  421. caddr_t out);
  422. extern int crypto_apply(int flags, caddr_t buf, int off, int len,
  423. int (*f)(void *, void *, u_int), void *arg);
  424. #endif /* __KERNEL__ */
  425. #endif /* _CRYPTO_CRYPTO_H_ */