Changeset View
Changeset View
Standalone View
Standalone View
sys/opencrypto/cryptodev.h
Show First 20 Lines • Show All 449 Lines • ▼ Show 20 Lines | int crp_etype; /* | ||||
* the data have been touched). On all | * the data have been touched). On all | ||||
* errors, the crp_session may have changed | * errors, the crp_session may have changed | ||||
* (reset to a new one), so the caller | * (reset to a new one), so the caller | ||||
* should always check and use the new | * should always check and use the new | ||||
* value on future requests. | * value on future requests. | ||||
*/ | */ | ||||
int crp_flags; | int crp_flags; | ||||
#define CRYPTO_F_BATCH 0x0008 /* Batch op if possible */ | |||||
#define CRYPTO_F_CBIMM 0x0010 /* Do callback immediately */ | #define CRYPTO_F_CBIMM 0x0010 /* Do callback immediately */ | ||||
#define CRYPTO_F_DONE 0x0020 /* Operation completed */ | #define CRYPTO_F_DONE 0x0020 /* Operation completed */ | ||||
#define CRYPTO_F_CBIFSYNC 0x0040 /* Do CBIMM if op is synchronous */ | #define CRYPTO_F_CBIFSYNC 0x0040 /* Do CBIMM if op is synchronous */ | ||||
#define CRYPTO_F_ASYNC 0x0080 /* Dispatch crypto jobs on several threads | #define CRYPTO_F_ASYNC_ORDERED 0x0100 /* Completions must happen in order */ | ||||
* if op is synchronous | |||||
*/ | |||||
#define CRYPTO_F_ASYNC_KEEPORDER 0x0100 /* | |||||
* Dispatch the crypto jobs in the same | |||||
* order there are submitted. Applied only | |||||
* if CRYPTO_F_ASYNC flags is set | |||||
*/ | |||||
#define CRYPTO_F_IV_SEPARATE 0x0200 /* Use crp_iv[] as IV. */ | #define CRYPTO_F_IV_SEPARATE 0x0200 /* Use crp_iv[] as IV. */ | ||||
int crp_op; | int crp_op; | ||||
struct crypto_buffer crp_buf; | struct crypto_buffer crp_buf; | ||||
struct crypto_buffer crp_obuf; | struct crypto_buffer crp_obuf; | ||||
void *crp_aad; /* AAD buffer. */ | void *crp_aad; /* AAD buffer. */ | ||||
Show All 23 Lines | #define CRYPTO_F_IV_SEPARATE 0x0200 /* Use crp_iv[] as IV. */ | ||||
struct bintime crp_tstamp; /* performance time stamp */ | struct bintime crp_tstamp; /* performance time stamp */ | ||||
uint32_t crp_seq; /* used for ordered dispatch */ | uint32_t crp_seq; /* used for ordered dispatch */ | ||||
uint32_t crp_retw_id; /* | uint32_t crp_retw_id; /* | ||||
* the return worker to be used, | * the return worker to be used, | ||||
* used for ordered dispatch | * used for ordered dispatch | ||||
*/ | */ | ||||
}; | }; | ||||
TAILQ_HEAD(cryptopq, cryptop); | |||||
static __inline void | static __inline void | ||||
_crypto_use_buf(struct crypto_buffer *cb, void *buf, int len) | _crypto_use_buf(struct crypto_buffer *cb, void *buf, int len) | ||||
{ | { | ||||
cb->cb_buf = buf; | cb->cb_buf = buf; | ||||
cb->cb_buf_len = len; | cb->cb_buf_len = len; | ||||
cb->cb_type = CRYPTO_BUF_CONTIG; | cb->cb_type = CRYPTO_BUF_CONTIG; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static __inline void | static __inline void | ||||
crypto_use_output_uio(struct cryptop *crp, struct uio *uio) | crypto_use_output_uio(struct cryptop *crp, struct uio *uio) | ||||
{ | { | ||||
_crypto_use_uio(&crp->crp_obuf, uio); | _crypto_use_uio(&crp->crp_obuf, uio); | ||||
} | } | ||||
#define CRYPTOP_ASYNC(crp) \ | |||||
(((crp)->crp_flags & CRYPTO_F_ASYNC) && \ | |||||
crypto_ses2caps((crp)->crp_session) & CRYPTOCAP_F_SYNC) | |||||
#define CRYPTOP_ASYNC_KEEPORDER(crp) \ | |||||
(CRYPTOP_ASYNC(crp) && \ | |||||
(crp)->crp_flags & CRYPTO_F_ASYNC_KEEPORDER) | |||||
#define CRYPTO_HAS_OUTPUT_BUFFER(crp) \ | #define CRYPTO_HAS_OUTPUT_BUFFER(crp) \ | ||||
((crp)->crp_obuf.cb_type != CRYPTO_BUF_NONE) | ((crp)->crp_obuf.cb_type != CRYPTO_BUF_NONE) | ||||
/* Flags in crp_op. */ | /* Flags in crp_op. */ | ||||
#define CRYPTO_OP_DECRYPT 0x0 | #define CRYPTO_OP_DECRYPT 0x0 | ||||
#define CRYPTO_OP_ENCRYPT 0x1 | #define CRYPTO_OP_ENCRYPT 0x1 | ||||
#define CRYPTO_OP_IS_ENCRYPT(op) ((op) & CRYPTO_OP_ENCRYPT) | #define CRYPTO_OP_IS_ENCRYPT(op) ((op) & CRYPTO_OP_ENCRYPT) | ||||
#define CRYPTO_OP_COMPUTE_DIGEST 0x0 | #define CRYPTO_OP_COMPUTE_DIGEST 0x0 | ||||
Show All 33 Lines | |||||
extern int crypto_newsession(crypto_session_t *cses, | extern int crypto_newsession(crypto_session_t *cses, | ||||
const struct crypto_session_params *params, int hard); | const struct crypto_session_params *params, int hard); | ||||
extern void crypto_freesession(crypto_session_t cses); | extern void crypto_freesession(crypto_session_t cses); | ||||
#define CRYPTOCAP_F_HARDWARE CRYPTO_FLAG_HARDWARE | #define CRYPTOCAP_F_HARDWARE CRYPTO_FLAG_HARDWARE | ||||
#define CRYPTOCAP_F_SOFTWARE CRYPTO_FLAG_SOFTWARE | #define CRYPTOCAP_F_SOFTWARE CRYPTO_FLAG_SOFTWARE | ||||
#define CRYPTOCAP_F_SYNC 0x04000000 /* operates synchronously */ | #define CRYPTOCAP_F_SYNC 0x04000000 /* operates synchronously */ | ||||
#define CRYPTOCAP_F_ACCEL_SOFTWARE 0x08000000 | #define CRYPTOCAP_F_ACCEL_SOFTWARE 0x08000000 | ||||
#define CRYPTO_SESS_SYNC(sess) \ | |||||
((crypto_ses2caps(sess) & CRYPTOCAP_F_SYNC) != 0) | |||||
extern int32_t crypto_get_driverid(device_t dev, size_t session_size, | extern int32_t crypto_get_driverid(device_t dev, size_t session_size, | ||||
int flags); | int flags); | ||||
extern int crypto_find_driver(const char *); | extern int crypto_find_driver(const char *); | ||||
extern device_t crypto_find_device_byhid(int hid); | extern device_t crypto_find_device_byhid(int hid); | ||||
extern int crypto_getcaps(int hid); | extern int crypto_getcaps(int hid); | ||||
extern int crypto_kregister(uint32_t, int, uint32_t); | extern int crypto_kregister(uint32_t, int, uint32_t); | ||||
extern int crypto_unregister_all(uint32_t driverid); | extern int crypto_unregister_all(uint32_t driverid); | ||||
extern int crypto_dispatch(struct cryptop *crp); | extern int crypto_dispatch(struct cryptop *crp); | ||||
#define CRYPTO_ASYNC_ORDERED 0x1 /* complete in order dispatched */ | |||||
extern int crypto_dispatch_async(struct cryptop *crp, int flags); | |||||
extern void crypto_dispatch_batch(struct cryptopq *crpq, int flags); | |||||
extern int crypto_kdispatch(struct cryptkop *); | extern int crypto_kdispatch(struct cryptkop *); | ||||
#define CRYPTO_SYMQ 0x1 | #define CRYPTO_SYMQ 0x1 | ||||
#define CRYPTO_ASYMQ 0x2 | #define CRYPTO_ASYMQ 0x2 | ||||
extern int crypto_unblock(uint32_t, int); | extern int crypto_unblock(uint32_t, int); | ||||
extern void crypto_done(struct cryptop *crp); | extern void crypto_done(struct cryptop *crp); | ||||
extern void crypto_kdone(struct cryptkop *); | extern void crypto_kdone(struct cryptkop *); | ||||
extern int crypto_getfeat(int *); | extern int crypto_getfeat(int *); | ||||
▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines |