3 UMAC message authentication code (RFC-4418).
5 Copyright (C) 2013 Niels Möller
7 This file is part of GNU Nettle.
9 GNU Nettle is free software: you can redistribute it and/or
10 modify it under the terms of either:
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.
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.
22 or both in parallel, as here.
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.
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/.
34 #ifndef NETTLE_UMAC_INTERNAL_H_INCLUDED
35 #define NETTLE_UMAC_INTERNAL_H_INCLUDED
37 #include "nettle-types.h"
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
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);
56 _umac_nh (const uint32_t *key, unsigned length, const uint8_t *msg);
60 for (i = 0; i < n; i++)
61 out[i] = _umac_nh (key + 4*i, length, msg);
63 but processing input only once.
66 _umac_nh_n (uint64_t *out, unsigned n, const uint32_t *key,
67 unsigned length, const uint8_t *msg);
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. */
73 _umac_poly64 (uint32_t kh, uint32_t kl, uint64_t y, uint64_t m);
76 _umac_poly128 (const uint32_t *k, uint64_t *y, uint64_t mh, uint64_t ml);
79 _umac_l2_init (unsigned size, uint32_t *k);
82 _umac_l2(const uint32_t *key, uint64_t *state, unsigned n,
83 uint64_t count, const uint64_t *m);
86 _umac_l2_final(const uint32_t *key, uint64_t *state, unsigned n,
90 _umac_l3_init (unsigned size, uint64_t *k);
93 _umac_l3 (const uint64_t *key, const uint64_t *m);
95 #endif /* NETTLE_UMAC_INTERNAL_H_INCLUDED */