/* BLAKE2 reference source code package - reference C implementations Copyright 2012, Samuel Neves . You may use this under the terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at your option. The terms of these licenses can be found at: - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0 - OpenSSL license : https://www.openssl.org/source/license.html - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0 More information about the BLAKE2 hash function can be found at https://blake2.net. Note: This file has been modified/adapted to the SLUL project. It has been changed to be compatible with C89 compilers, and code that is not needed for SLUL has been removed (e.g. blake2b, safe memory clearing, etc.). */ #ifndef BLAKE2_H #define BLAKE2_H #include #include "compiler.h" enum blake2s_constant { BLAKE2S_BLOCKBYTES = 64, BLAKE2S_OUTBYTES = 32, BLAKE2S_KEYBYTES = 32, BLAKE2S_SALTBYTES = 8, BLAKE2S_PERSONALBYTES = 8 }; typedef struct blake2s_state__ { SlulInt h[8]; SlulInt t[2]; SlulInt f[2]; unsigned char buf[BLAKE2S_BLOCKBYTES]; size_t buflen; size_t outlen; unsigned char last_node; } blake2s_state; /* Streaming API */ int blake2s_init( blake2s_state *S, size_t outlen ); int blake2s_update( blake2s_state *S, const void *in, size_t inlen ); /* Unlike the original blake2s_final, this one skips secure_zero_memory which is not needed for SLUL */ int blake2s_final( blake2s_state *S, void *out, size_t outlen ); #endif