|
||||
File indexing completed on 2025-01-18 10:02:16
0001 /* sm3.h 0002 0003 The SM3 hash function. 0004 0005 Copyright (C) 2017 Jia Zhang 0006 Copyright (C) 2021 Tianjia Zhang <tianjia.zhang@linux.alibaba.com> 0007 0008 This file is part of GNU Nettle. 0009 0010 GNU Nettle is free software: you can redistribute it and/or 0011 modify it under the terms of either: 0012 0013 * the GNU Lesser General Public License as published by the Free 0014 Software Foundation; either version 3 of the License, or (at your 0015 option) any later version. 0016 0017 or 0018 0019 * the GNU General Public License as published by the Free 0020 Software Foundation; either version 2 of the License, or (at your 0021 option) any later version. 0022 0023 or both in parallel, as here. 0024 0025 GNU Nettle is distributed in the hope that it will be useful, 0026 but WITHOUT ANY WARRANTY; without even the implied warranty of 0027 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0028 General Public License for more details. 0029 0030 You should have received copies of the GNU General Public License and 0031 the GNU Lesser General Public License along with this program. If 0032 not, see http://www.gnu.org/licenses/. 0033 */ 0034 0035 #ifndef NETTLE_SM3_H_INCLUDED 0036 #define NETTLE_SM3_H_INCLUDED 0037 0038 #include "nettle-types.h" 0039 0040 #ifdef __cplusplus 0041 extern "C" { 0042 #endif 0043 0044 /* Name mangling */ 0045 #define sm3_init nettle_sm3_init 0046 #define sm3_update nettle_sm3_update 0047 #define sm3_digest nettle_sm3_digest 0048 0049 #define SM3_DIGEST_SIZE 32 0050 #define SM3_BLOCK_SIZE 64 0051 0052 /* Digest is kept internally as 8 32-bit words. */ 0053 #define _SM3_DIGEST_LENGTH 8 0054 0055 struct sm3_ctx 0056 { 0057 uint32_t state[_SM3_DIGEST_LENGTH]; 0058 uint64_t count; /* Block count */ 0059 unsigned index; /* Into buffer */ 0060 uint8_t block[SM3_BLOCK_SIZE]; /* Block buffer */ 0061 }; 0062 0063 void 0064 sm3_init(struct sm3_ctx *ctx); 0065 0066 void 0067 sm3_update(struct sm3_ctx *ctx, 0068 size_t length, 0069 const uint8_t *data); 0070 0071 void 0072 sm3_digest(struct sm3_ctx *ctx, 0073 size_t length, 0074 uint8_t *digest); 0075 0076 #ifdef __cplusplus 0077 } 0078 #endif 0079 0080 #endif /* NETTLE_SM3_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 |