/src/nettle-with-mini-gmp/siv-ghash-set-key.c
Line  | Count  | Source  | 
1  |  | /* siv-ghash-set-key.c  | 
2  |  |  | 
3  |  |    POLYVAL implementation for AES-GCM-SIV, based on GHASH  | 
4  |  |  | 
5  |  |    Copyright (C) 2011 Katholieke Universiteit Leuven  | 
6  |  |    Copyright (C) 2011, 2013, 2018, 2022 Niels Möller  | 
7  |  |    Copyright (C) 2018, 2022 Red Hat, Inc.  | 
8  |  |  | 
9  |  |    This file is part of GNU Nettle.  | 
10  |  |  | 
11  |  |    GNU Nettle is free software: you can redistribute it and/or  | 
12  |  |    modify it under the terms of either:  | 
13  |  |  | 
14  |  |      * the GNU Lesser General Public License as published by the Free  | 
15  |  |        Software Foundation; either version 3 of the License, or (at your  | 
16  |  |        option) any later version.  | 
17  |  |  | 
18  |  |    or  | 
19  |  |  | 
20  |  |      * the GNU General Public License as published by the Free  | 
21  |  |        Software Foundation; either version 2 of the License, or (at your  | 
22  |  |        option) any later version.  | 
23  |  |  | 
24  |  |    or both in parallel, as here.  | 
25  |  |  | 
26  |  |    GNU Nettle is distributed in the hope that it will be useful,  | 
27  |  |    but WITHOUT ANY WARRANTY; without even the implied warranty of  | 
28  |  |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  | 
29  |  |    General Public License for more details.  | 
30  |  |  | 
31  |  |    You should have received copies of the GNU General Public License and  | 
32  |  |    the GNU Lesser General Public License along with this program.  If  | 
33  |  |    not, see http://www.gnu.org/licenses/.  | 
34  |  | */  | 
35  |  |  | 
36  |  | #if HAVE_CONFIG_H  | 
37  |  | # include "config.h"  | 
38  |  | #endif  | 
39  |  |  | 
40  |  | #include "ghash-internal.h"  | 
41  |  | #include "block-internal.h"  | 
42  |  |  | 
43  |  | void  | 
44  |  | _siv_ghash_set_key (struct gcm_key *ctx, const union nettle_block16 *key)  | 
45  | 461  | { | 
46  | 461  |   union nettle_block16 h;  | 
47  |  |  | 
48  | 461  |   block16_bswap (&h, key);  | 
49  | 461  |   block16_mulx_ghash (&h, &h);  | 
50  |  |  | 
51  | 461  |   _ghash_set_key (ctx, &h);  | 
52  | 461  | }  |