Delete nettle-stdint.h
[gd/nettle] / umac-internal.h
1 /* umac-internal.h
2
3    UMAC message authentication code (RFC-4418).
4
5    Copyright (C) 2013 Niels Möller
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 #ifndef NETTLE_UMAC_INTERNAL_H_INCLUDED
35 #define NETTLE_UMAC_INTERNAL_H_INCLUDED
36
37 #include "nettle-types.h"
38
39 #define _umac_set_key _nettle_umac_set_key
40 #define _umac_nh _nettle_umac_nh
41 #define _umac_nh_n _nettle_umac_nh_n
42 #define _umac_poly64 _nettle_umac_poly64
43 #define _umac_poly128 _nettle_umac_poly128
44 #define _umac_l2_init _nettle_umac_l2_init
45 #define _umac_l2 _nettle_umac_l2
46 #define _umac_l2_final _nettle_umac_l2_final
47 #define _umac_l3_init _nettle_umac_l3_init
48 #define _umac_l3 _nettle_umac_l3
49
50 void
51 _umac_set_key (uint32_t *l1_key, uint32_t *l2_key,
52                uint64_t *l3_key1, uint32_t *l3_key2,
53                struct aes128_ctx *pad, const uint8_t *key, unsigned n);
54
55 uint64_t
56 _umac_nh (const uint32_t *key, unsigned length, const uint8_t *msg);
57
58 /* Equivalent to
59
60    for (i = 0; i < n; i++)
61      out[i] = _umac_nh (key + 4*i, length, msg);
62
63    but processing input only once.
64 */
65 void
66 _umac_nh_n (uint64_t *out, unsigned n, const uint32_t *key,
67             unsigned length, const uint8_t *msg);
68
69 /* Returns y*k + m (mod p), including "marker" processing. Return
70    value is *not* in canonical representation, and must be normalized
71    before the output is used. */
72 uint64_t
73 _umac_poly64 (uint32_t kh, uint32_t kl, uint64_t y, uint64_t m);
74
75 void
76 _umac_poly128 (const uint32_t *k, uint64_t *y, uint64_t mh, uint64_t ml);
77
78 void
79 _umac_l2_init (unsigned size, uint32_t *k);
80
81 void
82 _umac_l2(const uint32_t *key, uint64_t *state, unsigned n,
83          uint64_t count, const uint64_t *m);
84
85 void
86 _umac_l2_final(const uint32_t *key, uint64_t *state, unsigned n,
87                uint64_t count);
88
89 void
90 _umac_l3_init (unsigned size, uint64_t *k);
91
92 uint32_t
93 _umac_l3 (const uint64_t *key, const uint64_t *m);
94
95 #endif /* NETTLE_UMAC_INTERNAL_H_INCLUDED */