Changeset View
Changeset View
Standalone View
Standalone View
head/sys/opencrypto/cryptodev.h
Show First 20 Lines • Show All 205 Lines • ▼ Show 20 Lines | |||||
#define CRYPTO_FLAG_SOFTWARE 0x02000000 /* software implementation */ | #define CRYPTO_FLAG_SOFTWARE 0x02000000 /* software implementation */ | ||||
/* NB: deprecated */ | /* NB: deprecated */ | ||||
struct session_op { | struct session_op { | ||||
u_int32_t cipher; /* ie. CRYPTO_DES_CBC */ | u_int32_t cipher; /* ie. CRYPTO_DES_CBC */ | ||||
u_int32_t mac; /* ie. CRYPTO_MD5_HMAC */ | u_int32_t mac; /* ie. CRYPTO_MD5_HMAC */ | ||||
u_int32_t keylen; /* cipher key */ | u_int32_t keylen; /* cipher key */ | ||||
caddr_t key; | c_caddr_t key; | ||||
int mackeylen; /* mac key */ | int mackeylen; /* mac key */ | ||||
caddr_t mackey; | c_caddr_t mackey; | ||||
u_int32_t ses; /* returns: session # */ | u_int32_t ses; /* returns: session # */ | ||||
}; | }; | ||||
struct session2_op { | struct session2_op { | ||||
u_int32_t cipher; /* ie. CRYPTO_DES_CBC */ | u_int32_t cipher; /* ie. CRYPTO_DES_CBC */ | ||||
u_int32_t mac; /* ie. CRYPTO_MD5_HMAC */ | u_int32_t mac; /* ie. CRYPTO_MD5_HMAC */ | ||||
u_int32_t keylen; /* cipher key */ | u_int32_t keylen; /* cipher key */ | ||||
caddr_t key; | c_caddr_t key; | ||||
int mackeylen; /* mac key */ | int mackeylen; /* mac key */ | ||||
caddr_t mackey; | c_caddr_t mackey; | ||||
u_int32_t ses; /* returns: session # */ | u_int32_t ses; /* returns: session # */ | ||||
int crid; /* driver id + flags (rw) */ | int crid; /* driver id + flags (rw) */ | ||||
int pad[4]; /* for future expansion */ | int pad[4]; /* for future expansion */ | ||||
}; | }; | ||||
struct crypt_op { | struct crypt_op { | ||||
u_int32_t ses; | u_int32_t ses; | ||||
u_int16_t op; /* i.e. COP_ENCRYPT */ | u_int16_t op; /* i.e. COP_ENCRYPT */ | ||||
#define COP_ENCRYPT 1 | #define COP_ENCRYPT 1 | ||||
#define COP_DECRYPT 2 | #define COP_DECRYPT 2 | ||||
u_int16_t flags; | u_int16_t flags; | ||||
#define COP_F_BATCH 0x0008 /* Batch op if possible */ | #define COP_F_BATCH 0x0008 /* Batch op if possible */ | ||||
u_int len; | u_int len; | ||||
caddr_t src, dst; /* become iov[] inside kernel */ | c_caddr_t src; /* become iov[] inside kernel */ | ||||
caddr_t dst; | |||||
caddr_t mac; /* must be big enough for chosen MAC */ | caddr_t mac; /* must be big enough for chosen MAC */ | ||||
caddr_t iv; | c_caddr_t iv; | ||||
}; | }; | ||||
/* op and flags the same as crypt_op */ | /* op and flags the same as crypt_op */ | ||||
struct crypt_aead { | struct crypt_aead { | ||||
u_int32_t ses; | u_int32_t ses; | ||||
u_int16_t op; /* i.e. COP_ENCRYPT */ | u_int16_t op; /* i.e. COP_ENCRYPT */ | ||||
u_int16_t flags; | u_int16_t flags; | ||||
u_int len; | u_int len; | ||||
u_int aadlen; | u_int aadlen; | ||||
u_int ivlen; | u_int ivlen; | ||||
caddr_t src, dst; /* become iov[] inside kernel */ | c_caddr_t src; /* become iov[] inside kernel */ | ||||
caddr_t aad; /* additional authenticated data */ | caddr_t dst; | ||||
c_caddr_t aad; /* additional authenticated data */ | |||||
caddr_t tag; /* must fit for chosen TAG length */ | caddr_t tag; /* must fit for chosen TAG length */ | ||||
caddr_t iv; | c_caddr_t iv; | ||||
}; | }; | ||||
/* | /* | ||||
* Parameters for looking up a crypto driver/device by | * Parameters for looking up a crypto driver/device by | ||||
* device name or by id. The latter are returned for | * device name or by id. The latter are returned for | ||||
* created sessions (crid) and completed key operations. | * created sessions (crid) and completed key operations. | ||||
*/ | */ | ||||
struct crypt_find_op { | struct crypt_find_op { | ||||
▲ Show 20 Lines • Show All 230 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Crypto-related utility routines used mainly by drivers. | * Crypto-related utility routines used mainly by drivers. | ||||
* | * | ||||
* XXX these don't really belong here; but for now they're | * XXX these don't really belong here; but for now they're | ||||
* kept apart from the rest of the system. | * kept apart from the rest of the system. | ||||
*/ | */ | ||||
struct uio; | struct uio; | ||||
extern void cuio_copydata(struct uio* uio, int off, int len, caddr_t cp); | extern void cuio_copydata(struct uio* uio, int off, int len, caddr_t cp); | ||||
extern void cuio_copyback(struct uio* uio, int off, int len, caddr_t cp); | extern void cuio_copyback(struct uio* uio, int off, int len, c_caddr_t cp); | ||||
extern int cuio_getptr(struct uio *uio, int loc, int *off); | extern int cuio_getptr(struct uio *uio, int loc, int *off); | ||||
extern int cuio_apply(struct uio *uio, int off, int len, | extern int cuio_apply(struct uio *uio, int off, int len, | ||||
int (*f)(void *, void *, u_int), void *arg); | int (*f)(void *, void *, u_int), void *arg); | ||||
struct mbuf; | struct mbuf; | ||||
struct iovec; | struct iovec; | ||||
extern int crypto_mbuftoiov(struct mbuf *mbuf, struct iovec **iovptr, | extern int crypto_mbuftoiov(struct mbuf *mbuf, struct iovec **iovptr, | ||||
int *cnt, int *allocated); | int *cnt, int *allocated); | ||||
extern void crypto_copyback(int flags, caddr_t buf, int off, int size, | extern void crypto_copyback(int flags, caddr_t buf, int off, int size, | ||||
caddr_t in); | c_caddr_t in); | ||||
extern void crypto_copydata(int flags, caddr_t buf, int off, int size, | extern void crypto_copydata(int flags, caddr_t buf, int off, int size, | ||||
caddr_t out); | caddr_t out); | ||||
extern int crypto_apply(int flags, caddr_t buf, int off, int len, | extern int crypto_apply(int flags, caddr_t buf, int off, int len, | ||||
int (*f)(void *, void *, u_int), void *arg); | int (*f)(void *, void *, u_int), void *arg); | ||||
#endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
#endif /* _CRYPTO_CRYPTO_H_ */ | #endif /* _CRYPTO_CRYPTO_H_ */ |