Changeset View
Changeset View
Standalone View
Standalone View
head/sys/opencrypto/xform_enc.h
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
#define AES_XTS_ALPHA 0x87 /* GF(2^128) generator polynomial */ | #define AES_XTS_ALPHA 0x87 /* GF(2^128) generator polynomial */ | ||||
/* Declarations */ | /* Declarations */ | ||||
struct enc_xform { | struct enc_xform { | ||||
int type; | int type; | ||||
char *name; | char *name; | ||||
size_t ctxsize; | size_t ctxsize; | ||||
u_int16_t blocksize; /* Required input block size -- 1 for stream ciphers. */ | u_int16_t blocksize; /* Required input block size -- 1 for stream ciphers. */ | ||||
uint16_t native_blocksize; /* Used for stream ciphers. */ | |||||
u_int16_t ivsize; | u_int16_t ivsize; | ||||
u_int16_t minkey, maxkey; | u_int16_t minkey, maxkey; | ||||
/* | |||||
* Encrypt/decrypt a single block. For stream ciphers this | |||||
* encrypts/decrypts a single "native" block. | |||||
*/ | |||||
void (*encrypt) (void *, const uint8_t *, uint8_t *); | void (*encrypt) (void *, const uint8_t *, uint8_t *); | ||||
void (*decrypt) (void *, const uint8_t *, uint8_t *); | void (*decrypt) (void *, const uint8_t *, uint8_t *); | ||||
int (*setkey) (void *, const uint8_t *, int len); | int (*setkey) (void *, const uint8_t *, int len); | ||||
void (*reinit) (void *, const u_int8_t *); | void (*reinit) (void *, const u_int8_t *); | ||||
/* | /* | ||||
* Encrypt/decrypt 1+ blocks of input -- total size is 'len' bytes. | * For stream ciphers, encrypt/decrypt the final partial block | ||||
* Len is guaranteed to be a multiple of the defined 'blocksize'. | * of 'len' bytes. | ||||
* Optional interface -- most useful for stream ciphers with a small | |||||
* blocksize (1). | |||||
*/ | */ | ||||
void (*encrypt_multi) (void *, const uint8_t *, uint8_t *, size_t len); | void (*encrypt_last) (void *, const uint8_t *, uint8_t *, size_t len); | ||||
void (*decrypt_multi) (void *, const uint8_t *, uint8_t *, size_t len); | void (*decrypt_last) (void *, const uint8_t *, uint8_t *, size_t len); | ||||
}; | }; | ||||
extern struct enc_xform enc_xform_null; | extern struct enc_xform enc_xform_null; | ||||
extern struct enc_xform enc_xform_rijndael128; | extern struct enc_xform enc_xform_rijndael128; | ||||
extern struct enc_xform enc_xform_aes_icm; | extern struct enc_xform enc_xform_aes_icm; | ||||
extern struct enc_xform enc_xform_aes_nist_gcm; | extern struct enc_xform enc_xform_aes_nist_gcm; | ||||
extern struct enc_xform enc_xform_aes_nist_gmac; | extern struct enc_xform enc_xform_aes_nist_gmac; | ||||
Show All 19 Lines |