3 This file is part of the AVR-Crypto-Lib.
4 Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 This file is part of the AVR-Crypto-Lib.
27 Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
29 This program is free software: you can redistribute it and/or modify
30 it under the terms of the GNU General Public License as published by
31 the Free Software Foundation, either version 3 of the License, or
32 (at your option) any later version.
34 This program is distributed in the hope that it will be useful,
35 but WITHOUT ANY WARRANTY; without even the implied warranty of
36 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37 GNU General Public License for more details.
39 You should have received a copy of the GNU General Public License
40 along with this program. If not, see <http://www.gnu.org/licenses/>.
47 #include <blockcipher_descriptor.h>
50 #define GCM128_BLOCK_BYTES 16
51 #define GCM128_BLOCK_BITS (GCM128_BLOCK_BYTES * 8)
53 #define GCM128_COUNT_BYTES 4
54 #define GCM128_COUNT_BITS (GCM128_COUNT_BYTES * 8)
59 uint8_t tag[GCM128_BLOCK_BYTES];
60 uint8_t key[GCM128_BLOCK_BYTES];
64 ghash128_ctx_t ghash_ctx;
65 bcgen_ctx_t cipher_ctx;
66 uint8_t ctr[GCM128_BLOCK_BYTES];
67 uint8_t j0[GCM128_COUNT_BYTES];
74 const bcdesc_t *cipher,
76 uint16_t key_length_b,
78 uint16_t iv_length_b);
80 void gcm128_add_ad_block(
84 void gcm128_add_ad_final_block(
89 void gcm128_encrypt_block(
94 void gcm128_encrypt_final_block(
100 void gcm128_decrypt_block(
105 void gcm128_decrypt_final_block(
111 void gcm128_finalize(
114 uint16_t tag_length_b);
116 #endif /* GCM_GCM128_H_ */