Changeset View
Changeset View
Standalone View
Standalone View
sys/opencrypto/xform_enc.h
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
struct enc_xform { | struct enc_xform { | ||||
int type; | int type; | ||||
const char *name; | const char *name; | ||||
size_t ctxsize; | size_t ctxsize; | ||||
uint16_t blocksize; /* Required input block size -- 1 for stream ciphers. */ | uint16_t blocksize; /* Required input block size -- 1 for stream ciphers. */ | ||||
uint16_t native_blocksize; /* Used for stream ciphers. */ | uint16_t native_blocksize; /* Used for stream ciphers. */ | ||||
uint16_t ivsize; | uint16_t ivsize; | ||||
uint16_t minkey, maxkey; | uint16_t minkey, maxkey; | ||||
uint16_t macsize; /* For AEAD ciphers. */ | |||||
/* | /* | ||||
* Encrypt/decrypt a single block. For stream ciphers this | * Encrypt/decrypt a single block. For stream ciphers this | ||||
* encrypts/decrypts a single "native" block. | * 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 uint8_t *, size_t); | void (*reinit) (void *, const uint8_t *, size_t); | ||||
/* | /* | ||||
* For stream ciphers, encrypt/decrypt the final partial block | * For stream ciphers, encrypt/decrypt the final partial block | ||||
* of 'len' bytes. | * of 'len' bytes. | ||||
*/ | */ | ||||
void (*encrypt_last) (void *, const uint8_t *, uint8_t *, size_t len); | void (*encrypt_last) (void *, const uint8_t *, uint8_t *, size_t len); | ||||
void (*decrypt_last) (void *, const uint8_t *, uint8_t *, size_t len); | void (*decrypt_last) (void *, const uint8_t *, uint8_t *, size_t len); | ||||
/* | |||||
* For AEAD ciphers, update and generate MAC/tag. | |||||
*/ | |||||
int (*update) (void *, const void *, u_int); | |||||
void (*final) (uint8_t *, void *); | |||||
}; | }; | ||||
extern const struct enc_xform enc_xform_null; | extern const struct enc_xform enc_xform_null; | ||||
extern const struct enc_xform enc_xform_rijndael128; | extern const struct enc_xform enc_xform_rijndael128; | ||||
extern const struct enc_xform enc_xform_aes_icm; | extern const struct enc_xform enc_xform_aes_icm; | ||||
extern const struct enc_xform enc_xform_aes_nist_gcm; | extern const struct enc_xform enc_xform_aes_nist_gcm; | ||||
extern const struct enc_xform enc_xform_aes_nist_gmac; | extern const struct enc_xform enc_xform_aes_nist_gmac; | ||||
Show All 20 Lines |