Changeset View
Changeset View
Standalone View
Standalone View
sys/crypto/aesni/aesni.h
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
#define AES192_ROUNDS 12 | #define AES192_ROUNDS 12 | ||||
#define AES256_ROUNDS 14 | #define AES256_ROUNDS 14 | ||||
#define AES_SCHED_LEN ((AES256_ROUNDS + 1) * AES_BLOCK_LEN) | #define AES_SCHED_LEN ((AES256_ROUNDS + 1) * AES_BLOCK_LEN) | ||||
struct aesni_session { | struct aesni_session { | ||||
uint8_t enc_schedule[AES_SCHED_LEN] __aligned(16); | uint8_t enc_schedule[AES_SCHED_LEN] __aligned(16); | ||||
uint8_t dec_schedule[AES_SCHED_LEN] __aligned(16); | uint8_t dec_schedule[AES_SCHED_LEN] __aligned(16); | ||||
uint8_t xts_schedule[AES_SCHED_LEN] __aligned(16); | uint8_t xts_schedule[AES_SCHED_LEN] __aligned(16); | ||||
/* Same as the SHA256 Blocksize. */ | |||||
uint8_t hmac_key[SHA1_HMAC_BLOCK_LEN] __aligned(16); | |||||
int algo; | int algo; | ||||
int rounds; | int rounds; | ||||
/* uint8_t *ses_ictx; */ | /* uint8_t *ses_ictx; */ | ||||
/* uint8_t *ses_octx; */ | /* uint8_t *ses_octx; */ | ||||
/* int ses_mlen; */ | /* int ses_mlen; */ | ||||
int used; | int used; | ||||
int auth_algo; | |||||
int mlen; | |||||
uint32_t id; | uint32_t id; | ||||
TAILQ_ENTRY(aesni_session) next; | TAILQ_ENTRY(aesni_session) next; | ||||
}; | }; | ||||
/* | /* | ||||
* Internal functions, implemented in assembler. | * Internal functions, implemented in assembler. | ||||
*/ | */ | ||||
void aesni_set_enckey(const uint8_t *userkey, | void aesni_set_enckey(const uint8_t *userkey, | ||||
Show All 33 Lines | void AES_GCM_encrypt(const unsigned char *in, unsigned char *out, | ||||
const unsigned char *key, int nr); | const unsigned char *key, int nr); | ||||
int AES_GCM_decrypt(const unsigned char *in, unsigned char *out, | int AES_GCM_decrypt(const unsigned char *in, unsigned char *out, | ||||
const unsigned char *addt, const unsigned char *ivec, | const unsigned char *addt, const unsigned char *ivec, | ||||
const unsigned char *tag, uint32_t nbytes, uint32_t abytes, int ibytes, | const unsigned char *tag, uint32_t nbytes, uint32_t abytes, int ibytes, | ||||
const unsigned char *key, int nr); | const unsigned char *key, int nr); | ||||
int aesni_cipher_setup_common(struct aesni_session *ses, const uint8_t *key, | int aesni_cipher_setup_common(struct aesni_session *ses, const uint8_t *key, | ||||
int keylen); | int keylen); | ||||
uint8_t *aesni_cipher_alloc(struct cryptodesc *enccrd, struct cryptop *crp, | |||||
int *allocated); | |||||
#endif /* _AESNI_H_ */ | #endif /* _AESNI_H_ */ |