2 * BLAKE2 reference source code package - reference C implementations
4 * Copyright 2012, Samuel Neves <sneves@dei.uc.pt>.
5 * You may use this under the terms of the CC0, the OpenSSL Licence, or the
6 * Apache Public License 2.0, at your option. The terms of these licenses can
9 * - OpenSSL license : https://www.openssl.org/source/license.html
10 * - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
11 * - CC0 1.0 Universal : http://www.apache.org/licenses/LICENSE-2.0
13 * More information about the BLAKE2 hash function can be found at
17 /* crypto/evp/m_blake2s.c */
20 #include "internal/cryptlib.h"
22 #ifndef OPENSSL_NO_BLAKE2
24 # include <openssl/evp.h>
25 # include <openssl/objects.h>
26 # include "internal/blake2_locl.h"
27 # include "internal/evp_int.h"
29 static int init(EVP_MD_CTX *ctx)
31 return BLAKE2s_Init(EVP_MD_CTX_md_data(ctx));
34 static int update(EVP_MD_CTX *ctx, const void *data, size_t count)
36 return BLAKE2s_Update(EVP_MD_CTX_md_data(ctx), data, count);
39 static int final(EVP_MD_CTX *ctx, unsigned char *md)
41 return BLAKE2s_Final(md, EVP_MD_CTX_md_data(ctx));
44 static const EVP_MD blake2s_md = {
47 BLAKE2S_DIGEST_LENGTH,
55 sizeof(EVP_MD *) + sizeof(BLAKE2S_CTX),
58 const EVP_MD *EVP_blake2s(void)