/src/nettle/siv-gcm-aes128.c
Line  | Count  | Source (jump to first uncovered line)  | 
1  |  | /* siv-gcm-aes128.c  | 
2  |  |  | 
3  |  |    AES-GCM-SIV, RFC8452  | 
4  |  |  | 
5  |  |    Copyright (C) 2022 Red Hat, Inc.  | 
6  |  |  | 
7  |  |    This file is part of GNU Nettle.  | 
8  |  |  | 
9  |  |    GNU Nettle is free software: you can redistribute it and/or  | 
10  |  |    modify it under the terms of either:  | 
11  |  |  | 
12  |  |      * the GNU Lesser General Public License as published by the Free  | 
13  |  |        Software Foundation; either version 3 of the License, or (at your  | 
14  |  |        option) any later version.  | 
15  |  |  | 
16  |  |    or  | 
17  |  |  | 
18  |  |      * the GNU General Public License as published by the Free  | 
19  |  |        Software Foundation; either version 2 of the License, or (at your  | 
20  |  |        option) any later version.  | 
21  |  |  | 
22  |  |    or both in parallel, as here.  | 
23  |  |  | 
24  |  |    GNU Nettle is distributed in the hope that it will be useful,  | 
25  |  |    but WITHOUT ANY WARRANTY; without even the implied warranty of  | 
26  |  |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  | 
27  |  |    General Public License for more details.  | 
28  |  |  | 
29  |  |    You should have received copies of the GNU General Public License and  | 
30  |  |    the GNU Lesser General Public License along with this program.  If  | 
31  |  |    not, see http://www.gnu.org/licenses/.  | 
32  |  | */  | 
33  |  |  | 
34  |  | #if HAVE_CONFIG_H  | 
35  |  | # include "config.h"  | 
36  |  | #endif  | 
37  |  |  | 
38  |  | #include "nettle-meta.h"  | 
39  |  | #include "siv-gcm.h"  | 
40  |  |  | 
41  |  | void  | 
42  |  | siv_gcm_aes128_encrypt_message (const struct aes128_ctx *ctx,  | 
43  |  |         size_t nlength, const uint8_t *nonce,  | 
44  |  |         size_t alength, const uint8_t *adata,  | 
45  |  |         size_t clength, uint8_t *dst, const uint8_t *src)  | 
46  | 0  | { | 
47  | 0  |   struct aes128_ctx ctr_ctx;  | 
48  | 0  |   siv_gcm_encrypt_message (&nettle_aes128, ctx, &ctr_ctx,  | 
49  | 0  |          nlength, nonce,  | 
50  | 0  |          alength, adata,  | 
51  | 0  |          clength, dst, src);  | 
52  | 0  | }  | 
53  |  |  | 
54  |  | int  | 
55  |  | siv_gcm_aes128_decrypt_message (const struct aes128_ctx *ctx,  | 
56  |  |         size_t nlength, const uint8_t *nonce,  | 
57  |  |         size_t alength, const uint8_t *adata,  | 
58  |  |         size_t mlength, uint8_t *dst, const uint8_t *src)  | 
59  | 0  | { | 
60  | 0  |   struct aes128_ctx ctr_ctx;  | 
61  | 0  |   return siv_gcm_decrypt_message (&nettle_aes128, ctx, &ctr_ctx,  | 
62  | 0  |           nlength, nonce,  | 
63  | 0  |           alength, adata,  | 
64  | 0  |           mlength, dst, src);  | 
65  | 0  | }  |