[OLEACC]
[reactos.git] / reactos / include / reactos / libs / gnutls / nettle / gosthash94.h
1 /* gosthash94.h
2 *
3 * The GOST R 34.11-94 hash function, described in RFC 5831.
4 */
5
6 /* nettle, low-level cryptographics library
7 *
8 * Copyright (C) 2012 Nikos Mavrogiannopoulos, Niels Möller
9 *
10 * The nettle library is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2.1 of the License, or (at your
13 * option) any later version.
14 *
15 * The nettle library is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with the nettle library; see the file COPYING.LIB. If not, write to
22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23 * MA 02111-1301, USA.
24 */
25
26 /* Interface based on rhash gost.h. */
27
28 /* Copyright: 2009-2012 Aleksey Kravchenko <rhash.admin@gmail.com>
29 *
30 * Permission is hereby granted, free of charge, to any person obtaining a
31 * copy of this software and associated documentation files (the
32 * "Software"), to deal in the Software without restriction, including
33 * without limitation the rights to use, copy, modify, merge, publish,
34 * distribute, sublicense, and/or sell copies of the Software, and to
35 * permit persons to whom the Software is furnished to do so, subject to
36 * the following conditions:
37 *
38 * The above copyright notice and this permission notice shall be included
39 * in all copies or substantial portions of the Software.
40 *
41 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
42 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
43 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
44 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
45 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
46 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
47 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
48 */
49
50 /*
51 * Ported to nettle by Nikos Mavrogiannopoulos.
52 */
53
54 #ifndef NETTLE_GOSTHASH94_H_INCLUDED
55 #define NETTLE_GOSTHASH94_H_INCLUDED
56
57 #include "nettle-types.h"
58
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62
63 #define gosthash94_init nettle_gosthash94_init
64 #define gosthash94_update nettle_gosthash94_update
65 #define gosthash94_digest nettle_gosthash94_digest
66
67 #define GOSTHASH94_DATA_SIZE 32
68 #define GOSTHASH94_DIGEST_SIZE 32
69
70 struct gosthash94_ctx {
71 uint32_t hash[8]; /* algorithm 256-bit state */
72 uint32_t sum[8]; /* sum of processed message blocks */
73 uint8_t message[GOSTHASH94_DATA_SIZE]; /* 256-bit buffer for leftovers */
74 uint64_t length; /* number of processed bytes */
75 };
76
77 void gosthash94_init(struct gosthash94_ctx *ctx);
78 void gosthash94_update(struct gosthash94_ctx *ctx,
79 unsigned length, const uint8_t * msg);
80 void gosthash94_digest(struct gosthash94_ctx *ctx,
81 unsigned length, uint8_t * result);
82
83 #ifdef __cplusplus
84 }
85 #endif
86 #endif /* NETTLE_GOSTHASH94_H_INCLUDED */