3
* The GOST R 34.11-94 hash function, described in RFC 5831.
6
/* nettle, low-level cryptographics library
8
* Copyright (C) 2012 Nikos Mavrogiannopoulos, Niels Möller
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.
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.
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,
26
/* Interface based on rhash gost.h. */
28
/* Copyright: 2009-2012 Aleksey Kravchenko <rhash.admin@gmail.com>
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:
38
* The above copyright notice and this permission notice shall be included
39
* in all copies or substantial portions of the Software.
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.
51
* Ported to nettle by Nikos Mavrogiannopoulos.
54
#ifndef NETTLE_GOSTHASH94_H_INCLUDED
55
#define NETTLE_GOSTHASH94_H_INCLUDED
57
#include "nettle-types.h"
63
#define gosthash94_init nettle_gosthash94_init
64
#define gosthash94_update nettle_gosthash94_update
65
#define gosthash94_digest nettle_gosthash94_digest
67
#define GOSTHASH94_DATA_SIZE 32
68
#define GOSTHASH94_DIGEST_SIZE 32
72
uint32_t hash[8]; /* algorithm 256-bit state */
73
uint32_t sum[8]; /* sum of processed message blocks */
74
uint8_t message[GOSTHASH94_DATA_SIZE]; /* 256-bit buffer for leftovers */
75
uint64_t length; /* number of processed bytes */
78
void gosthash94_init(struct gosthash94_ctx *ctx);
79
void gosthash94_update(struct gosthash94_ctx *ctx,
80
unsigned length, const uint8_t *msg);
81
void gosthash94_digest(struct gosthash94_ctx *ctx,
82
unsigned length, uint8_t *result);
88
#endif /* NETTLE_GOSTHASH94_H_INCLUDED */