2 This file is part of the aeslib.
3 Copyright (C) 2012 Davy Landman (davy.landman@gmail.com)
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 // encrypt multiple blocks of 128bit data, data_len but be mod 16
25 // key and iv are assumed to be both 128bit thus 16 uint8_t's
26 void aes128_cbc_enc(const uint8_t* key, const uint8_t* iv, void* data, const uint16_t data_len);
28 // encrypt multiple blocks of 128bit data, data_len but be mod 16
29 // key and iv are assumed to be both 192bit thus 24 uint8_t's
30 void aes192_cbc_enc(const uint8_t* key, const uint8_t* iv, void* data, const uint16_t data_len);
32 // encrypt single 128bit block. data is assumed to be 16 uint8_t's
33 // key is assumed to be 128bit thus 16 uint8_t's
34 void aes128_enc_single(const uint8_t* key, void* data);
36 // encrypt single 128bit block. data is assumed to be 16 uint8_t's
37 // key is assumed to be 256bit thus 32 uint8_t's
38 void aes256_enc_single(const uint8_t* key, void* data);
40 typedef void* aes_context;
42 // prepare an encrypted to use for encrypting multiple blocks lateron.
43 // key and iv are assumed to be both 128bit thus 16 uint8_t's
44 aes_context aes128_cbc_enc_start(const uint8_t* key, const void* iv);
46 // prepare an encrypted to use for encrypting multiple blocks lateron.
47 // key and iv are assumed to be both 192bit thus 24 uint8_t's
48 aes_context aes192_cbc_enc_start(const uint8_t* key, const void* iv);
50 // encrypt one or more blocks of 128bit data
51 // data_len should be mod 16
52 void aes128_cbc_enc_continue(const aes_context ctx, void* data, const uint16_t data_len);
54 // encrypt one or more blocks of 128bit data
55 // data_len should be mod 16
56 void aes192_cbc_enc_continue(const aes_context ctx, void* data, const uint16_t data_len);
58 // cleanup encryption context
59 void aes128_cbc_enc_finish(const aes_context ctx);
61 // cleanup encryption context
62 void aes192_cbc_enc_finish(const aes_context ctx);
64 // decrypt multiple blocks of 128bit data, data_len but be mod 16
65 // key and iv are assumed to be both 128bit thus 16 uint8_t's
66 void aes128_cbc_dec(const uint8_t* key, const uint8_t* iv, void* data, const uint16_t data_len);
68 // decrypt multiple blocks of 128bit data, data_len but be mod 16
69 // key and iv are assumed to be both 192bit thus 24 uint8_t's
70 void aes192_cbc_dec(const uint8_t* key, const uint8_t* iv, void* data, const uint16_t data_len);
72 // decrypt single 128bit block. data is assumed to be 16 uint8_t's
73 // key is assumed to be 128bit thus 16 uint8_t's
74 void aes128_dec_single(const uint8_t* key, void* data);
76 // decrypt single 128bit block. data is assumed to be 16 uint8_t's
77 // key is assumed to be 256bit thus 32 uint8_t's
78 void aes256_dec_single(const uint8_t* key, void* data);
80 // prepare an decrypter to use for decrypting multiple blocks lateron.
81 // key and iv are assumed to be both 128bit thus 16 uint8_t's
82 aes_context aes128_cbc_dec_start(const uint8_t* key, const void* iv);
84 // prepare an decrypter to use for decrypting multiple blocks lateron.
85 // key and iv are assumed to be both 192bit thus 24 uint8_t's
86 aes_context aes192_cbc_dec_start(const uint8_t* key, const void* iv);
88 // decrypt one or more blocks of 128bit data
89 // data_len should be mod 16
90 void aes128_cbc_dec_continue(const aes_context ctx, void* data, const uint16_t data_len);
92 // decrypt one or more blocks of 128bit data
93 // data_len should be mod 16
94 void aes192_cbc_dec_continue(const aes_context ctx, void* data, const uint16_t data_len);
96 // cleanup decryption context
97 void aes128_cbc_dec_finish(const aes_context ctx);
99 // cleanup decryption context
100 void aes192_cbc_dec_finish(const aes_context ctx);