Changeset View
Changeset View
Standalone View
Standalone View
head/sys/opencrypto/xform_enc.h
Show All 30 Lines | |||||
#ifndef _CRYPTO_XFORM_ENC_H_ | #ifndef _CRYPTO_XFORM_ENC_H_ | ||||
#define _CRYPTO_XFORM_ENC_H_ | #define _CRYPTO_XFORM_ENC_H_ | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/errno.h> | #include <sys/errno.h> | ||||
#include <crypto/rijndael/rijndael.h> | #include <crypto/rijndael/rijndael.h> | ||||
#include <crypto/camellia/camellia.h> | #include <crypto/camellia/camellia.h> | ||||
#include <opencrypto/cryptodev.h> | #include <opencrypto/cryptodev.h> | ||||
#include <opencrypto/xform_userland.h> | |||||
#define AESICM_BLOCKSIZE AES_BLOCK_LEN | #define AESICM_BLOCKSIZE AES_BLOCK_LEN | ||||
#define AES_XTS_BLOCKSIZE 16 | #define AES_XTS_BLOCKSIZE 16 | ||||
#define AES_XTS_IVSIZE 8 | #define AES_XTS_IVSIZE 8 | ||||
#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; | |||||
u_int16_t blocksize; /* Required input block size -- 1 for stream ciphers. */ | u_int16_t blocksize; /* Required input block size -- 1 for stream ciphers. */ | ||||
u_int16_t ivsize; | u_int16_t ivsize; | ||||
u_int16_t minkey, maxkey; | u_int16_t minkey, maxkey; | ||||
void (*encrypt) (caddr_t, u_int8_t *); | void (*encrypt) (void *, const uint8_t *, uint8_t *); | ||||
void (*decrypt) (caddr_t, u_int8_t *); | void (*decrypt) (void *, const uint8_t *, uint8_t *); | ||||
int (*setkey) (u_int8_t **, const u_int8_t *, int len); | int (*setkey) (void *, const uint8_t *, int len); | ||||
void (*zerokey) (u_int8_t **); | void (*reinit) (void *, const u_int8_t *); | ||||
void (*reinit) (caddr_t, const u_int8_t *); | |||||
/* | /* | ||||
* Encrypt/decrypt 1+ blocks of input -- total size is 'len' bytes. | * Encrypt/decrypt 1+ blocks of input -- total size is 'len' bytes. | ||||
* Len is guaranteed to be a multiple of the defined 'blocksize'. | * Len is guaranteed to be a multiple of the defined 'blocksize'. | ||||
* Optional interface -- most useful for stream ciphers with a small | * Optional interface -- most useful for stream ciphers with a small | ||||
* blocksize (1). | * blocksize (1). | ||||
*/ | */ | ||||
void (*encrypt_multi) (void *, uint8_t *, size_t len); | void (*encrypt_multi) (void *, const uint8_t *, uint8_t *, size_t len); | ||||
void (*decrypt_multi) (void *, uint8_t *, size_t len); | void (*decrypt_multi) (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 |