blob: 0433c0434eed398e03d3d2161470f50c734de46d [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * AES-based functions
3 *
4 * - AES Key Wrap Algorithm (128-bit KEK) (RFC3394)
5 * - One-Key CBC MAC (OMAC1) hash with AES-128
6 * - AES-128 CTR mode encryption
7 * - AES-128 EAX mode encryption/decryption
8 * - AES-128 CBC
Dmitry Shmidt9bce59c2012-09-11 15:06:38 -07009 * - AES-GCM
10 * - AES-CCM
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070011 *
Dmitry Shmidt9bce59c2012-09-11 15:06:38 -070012 * Copyright (c) 2003-2012, Jouni Malinen <j@w1.fi>
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070013 *
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -080014 * This software may be distributed under the terms of the BSD license.
15 * See README for more details.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070016 */
17
18#ifndef AES_WRAP_H
19#define AES_WRAP_H
20
21int __must_check aes_wrap(const u8 *kek, int n, const u8 *plain, u8 *cipher);
22int __must_check aes_unwrap(const u8 *kek, int n, const u8 *cipher, u8 *plain);
23int __must_check omac1_aes_128_vector(const u8 *key, size_t num_elem,
24 const u8 *addr[], const size_t *len,
25 u8 *mac);
26int __must_check omac1_aes_128(const u8 *key, const u8 *data, size_t data_len,
27 u8 *mac);
28int __must_check aes_128_encrypt_block(const u8 *key, const u8 *in, u8 *out);
29int __must_check aes_128_ctr_encrypt(const u8 *key, const u8 *nonce,
30 u8 *data, size_t data_len);
31int __must_check aes_128_eax_encrypt(const u8 *key,
32 const u8 *nonce, size_t nonce_len,
33 const u8 *hdr, size_t hdr_len,
34 u8 *data, size_t data_len, u8 *tag);
35int __must_check aes_128_eax_decrypt(const u8 *key,
36 const u8 *nonce, size_t nonce_len,
37 const u8 *hdr, size_t hdr_len,
38 u8 *data, size_t data_len, const u8 *tag);
39int __must_check aes_128_cbc_encrypt(const u8 *key, const u8 *iv, u8 *data,
40 size_t data_len);
41int __must_check aes_128_cbc_decrypt(const u8 *key, const u8 *iv, u8 *data,
42 size_t data_len);
Dmitry Shmidt9bce59c2012-09-11 15:06:38 -070043int __must_check aes_gcm_ae(const u8 *key, size_t key_len,
44 const u8 *iv, size_t iv_len,
45 const u8 *plain, size_t plain_len,
46 const u8 *aad, size_t aad_len,
47 u8 *crypt, u8 *tag);
48int __must_check aes_gcm_ad(const u8 *key, size_t key_len,
49 const u8 *iv, size_t iv_len,
50 const u8 *crypt, size_t crypt_len,
51 const u8 *aad, size_t aad_len, const u8 *tag,
52 u8 *plain);
53int __must_check aes_gmac(const u8 *key, size_t key_len,
54 const u8 *iv, size_t iv_len,
55 const u8 *aad, size_t aad_len, u8 *tag);
56int __must_check aes_ccm_ae(const u8 *key, size_t key_len, const u8 *nonce,
57 size_t M, const u8 *plain, size_t plain_len,
58 const u8 *aad, size_t aad_len, u8 *crypt, u8 *auth);
59int __must_check aes_ccm_ad(const u8 *key, size_t key_len, const u8 *nonce,
60 size_t M, const u8 *crypt, size_t crypt_len,
61 const u8 *aad, size_t aad_len, const u8 *auth,
62 u8 *plain);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070063
64#endif /* AES_WRAP_H */