|
||||
File indexing completed on 2025-01-18 10:02:15
0001 /* gosthash94.h 0002 0003 The GOST R 34.11-94 hash function, described in RFC 5831. 0004 0005 Copyright (C) 2012 Nikos Mavrogiannopoulos, Niels Möller 0006 0007 This file is part of GNU Nettle. 0008 0009 GNU Nettle is free software: you can redistribute it and/or 0010 modify it under the terms of either: 0011 0012 * the GNU Lesser General Public License as published by the Free 0013 Software Foundation; either version 3 of the License, or (at your 0014 option) any later version. 0015 0016 or 0017 0018 * the GNU General Public License as published by the Free 0019 Software Foundation; either version 2 of the License, or (at your 0020 option) any later version. 0021 0022 or both in parallel, as here. 0023 0024 GNU Nettle is distributed in the hope that it will be useful, 0025 but WITHOUT ANY WARRANTY; without even the implied warranty of 0026 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0027 General Public License for more details. 0028 0029 You should have received copies of the GNU General Public License and 0030 the GNU Lesser General Public License along with this program. If 0031 not, see http://www.gnu.org/licenses/. 0032 */ 0033 0034 /* Based on rhash gost.h. */ 0035 0036 /* Copyright: 2009-2012 Aleksey Kravchenko <rhash.admin@gmail.com> 0037 * 0038 * Permission is hereby granted, free of charge, to any person obtaining a 0039 * copy of this software and associated documentation files (the 0040 * "Software"), to deal in the Software without restriction, including 0041 * without limitation the rights to use, copy, modify, merge, publish, 0042 * distribute, sublicense, and/or sell copies of the Software, and to 0043 * permit persons to whom the Software is furnished to do so, subject to 0044 * the following conditions: 0045 * 0046 * The above copyright notice and this permission notice shall be included 0047 * in all copies or substantial portions of the Software. 0048 * 0049 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 0050 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 0051 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 0052 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 0053 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 0054 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 0055 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 0056 */ 0057 0058 /* 0059 * Ported to nettle by Nikos Mavrogiannopoulos. 0060 */ 0061 0062 #ifndef NETTLE_GOSTHASH94_H_INCLUDED 0063 #define NETTLE_GOSTHASH94_H_INCLUDED 0064 0065 #include "nettle-types.h" 0066 0067 #ifdef __cplusplus 0068 extern "C" { 0069 #endif 0070 0071 #define gosthash94_init nettle_gosthash94_init 0072 #define gosthash94_update nettle_gosthash94_update 0073 #define gosthash94_digest nettle_gosthash94_digest 0074 0075 #define gosthash94cp_update nettle_gosthash94cp_update 0076 #define gosthash94cp_digest nettle_gosthash94cp_digest 0077 0078 #define GOSTHASH94_BLOCK_SIZE 32 0079 #define GOSTHASH94_DIGEST_SIZE 32 0080 /* For backwards compatibility */ 0081 #define GOSTHASH94_DATA_SIZE GOSTHASH94_BLOCK_SIZE 0082 0083 #define GOSTHASH94CP_BLOCK_SIZE GOSTHASH94_BLOCK_SIZE 0084 #define GOSTHASH94CP_DIGEST_SIZE GOSTHASH94_DIGEST_SIZE 0085 0086 struct gosthash94_ctx 0087 { 0088 uint32_t hash[8]; /* algorithm 256-bit state */ 0089 uint32_t sum[8]; /* sum of processed message blocks */ 0090 uint64_t count; /* Block count */ 0091 unsigned index; /* Into buffer */ 0092 uint8_t block[GOSTHASH94_BLOCK_SIZE]; /* 256-bit buffer for leftovers */ 0093 }; 0094 #define gosthash94cp_ctx gosthash94_ctx 0095 0096 void gosthash94_init(struct gosthash94_ctx *ctx); 0097 void gosthash94_update(struct gosthash94_ctx *ctx, 0098 size_t length, const uint8_t *msg); 0099 void gosthash94_digest(struct gosthash94_ctx *ctx, 0100 size_t length, uint8_t *result); 0101 0102 #define gosthash94cp_init gosthash94_init 0103 void gosthash94cp_update(struct gosthash94_ctx *ctx, 0104 size_t length, const uint8_t *msg); 0105 void gosthash94cp_digest(struct gosthash94_ctx *ctx, 0106 size_t length, uint8_t *result); 0107 0108 #ifdef __cplusplus 0109 } 0110 #endif 0111 0112 #endif /* NETTLE_GOSTHASH94_H_INCLUDED */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |