1189251Ssam/* 2189251Ssam * AES-based functions 3189251Ssam * 4189251Ssam * - AES Key Wrap Algorithm (128-bit KEK) (RFC3394) 5189251Ssam * - One-Key CBC MAC (OMAC1) hash with AES-128 6189251Ssam * - AES-128 CTR mode encryption 7189251Ssam * - AES-128 EAX mode encryption/decryption 8189251Ssam * - AES-128 CBC 9252726Srpaulo * - AES-GCM 10252726Srpaulo * - AES-CCM 11189251Ssam * 12252726Srpaulo * Copyright (c) 2003-2012, Jouni Malinen <j@w1.fi> 13189251Ssam * 14252726Srpaulo * This software may be distributed under the terms of the BSD license. 15252726Srpaulo * See README for more details. 16189251Ssam */ 17189251Ssam 18189251Ssam#ifndef AES_WRAP_H 19189251Ssam#define AES_WRAP_H 20189251Ssam 21189251Ssamint __must_check aes_wrap(const u8 *kek, int n, const u8 *plain, u8 *cipher); 22189251Ssamint __must_check aes_unwrap(const u8 *kek, int n, const u8 *cipher, u8 *plain); 23189251Ssamint __must_check omac1_aes_128_vector(const u8 *key, size_t num_elem, 24189251Ssam const u8 *addr[], const size_t *len, 25189251Ssam u8 *mac); 26189251Ssamint __must_check omac1_aes_128(const u8 *key, const u8 *data, size_t data_len, 27189251Ssam u8 *mac); 28189251Ssamint __must_check aes_128_encrypt_block(const u8 *key, const u8 *in, u8 *out); 29189251Ssamint __must_check aes_128_ctr_encrypt(const u8 *key, const u8 *nonce, 30189251Ssam u8 *data, size_t data_len); 31189251Ssamint __must_check aes_128_eax_encrypt(const u8 *key, 32189251Ssam const u8 *nonce, size_t nonce_len, 33189251Ssam const u8 *hdr, size_t hdr_len, 34189251Ssam u8 *data, size_t data_len, u8 *tag); 35189251Ssamint __must_check aes_128_eax_decrypt(const u8 *key, 36189251Ssam const u8 *nonce, size_t nonce_len, 37189251Ssam const u8 *hdr, size_t hdr_len, 38189251Ssam u8 *data, size_t data_len, const u8 *tag); 39189251Ssamint __must_check aes_128_cbc_encrypt(const u8 *key, const u8 *iv, u8 *data, 40189251Ssam size_t data_len); 41189251Ssamint __must_check aes_128_cbc_decrypt(const u8 *key, const u8 *iv, u8 *data, 42189251Ssam size_t data_len); 43252726Srpauloint __must_check aes_gcm_ae(const u8 *key, size_t key_len, 44252726Srpaulo const u8 *iv, size_t iv_len, 45252726Srpaulo const u8 *plain, size_t plain_len, 46252726Srpaulo const u8 *aad, size_t aad_len, 47252726Srpaulo u8 *crypt, u8 *tag); 48252726Srpauloint __must_check aes_gcm_ad(const u8 *key, size_t key_len, 49252726Srpaulo const u8 *iv, size_t iv_len, 50252726Srpaulo const u8 *crypt, size_t crypt_len, 51252726Srpaulo const u8 *aad, size_t aad_len, const u8 *tag, 52252726Srpaulo u8 *plain); 53252726Srpauloint __must_check aes_gmac(const u8 *key, size_t key_len, 54252726Srpaulo const u8 *iv, size_t iv_len, 55252726Srpaulo const u8 *aad, size_t aad_len, u8 *tag); 56252726Srpauloint __must_check aes_ccm_ae(const u8 *key, size_t key_len, const u8 *nonce, 57252726Srpaulo size_t M, const u8 *plain, size_t plain_len, 58252726Srpaulo const u8 *aad, size_t aad_len, u8 *crypt, u8 *auth); 59252726Srpauloint __must_check aes_ccm_ad(const u8 *key, size_t key_len, const u8 *nonce, 60252726Srpaulo size_t M, const u8 *crypt, size_t crypt_len, 61252726Srpaulo const u8 *aad, size_t aad_len, const u8 *auth, 62252726Srpaulo u8 *plain); 63189251Ssam 64189251Ssam#endif /* AES_WRAP_H */ 65