libsmb: Simplify netsamlogon_cache_get
[Samba.git] / lib / crypto / aes_gcm_128.h
blob278b6db03082adfbbc8aabb0ae38b7c0df61fe59
1 /*
2 AES-GCM-128
4 Copyright (C) Stefan Metzmacher 2014
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/>.
20 #ifndef LIB_CRYPTO_AES_GCM_128_H
21 #define LIB_CRYPTO_AES_GCM_128_H
23 #define AES_GCM_128_IV_SIZE (12)
25 struct aes_gcm_128_context {
26 AES_KEY aes_key;
27 uint8_t H[AES_BLOCK_SIZE];
28 uint8_t J0[AES_BLOCK_SIZE];
29 uint8_t CB[AES_BLOCK_SIZE];
30 uint8_t Y[AES_BLOCK_SIZE];
31 uint8_t AC[AES_BLOCK_SIZE];
33 struct aes_gcm_128_tmp {
34 uint8_t block[AES_BLOCK_SIZE];
35 size_t ofs;
36 size_t total;
37 } A, C, c, y;
40 void aes_gcm_128_init(struct aes_gcm_128_context *ctx,
41 const uint8_t K[AES_BLOCK_SIZE],
42 const uint8_t IV[AES_GCM_128_IV_SIZE]);
43 void aes_gcm_128_updateA(struct aes_gcm_128_context *ctx,
44 const uint8_t *a, size_t a_len);
45 void aes_gcm_128_updateC(struct aes_gcm_128_context *ctx,
46 const uint8_t *c, size_t c_len);
47 void aes_gcm_128_crypt(struct aes_gcm_128_context *ctx,
48 uint8_t *m, size_t m_len);
49 void aes_gcm_128_digest(struct aes_gcm_128_context *ctx,
50 uint8_t T[AES_BLOCK_SIZE]);
52 #endif /* LIB_CRYPTO_AES_GCM_128_H */