2 * Copyright 2012, Samuel Neves <sneves@dei.uc.pt>.
3 * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
5 * Licensed under the OpenSSL licenses, (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 * https://www.openssl.org/source/license.html
9 * or in the file LICENSE in the source distribution.
13 * Derived from the BLAKE2 reference implementation written by Samuel Neves.
14 * More information about the BLAKE2 hash function and its implementations
15 * can be found at https://blake2.net.
18 #include "internal/cryptlib.h"
20 #ifndef OPENSSL_NO_BLAKE2
22 # include <openssl/evp.h>
23 # include <openssl/objects.h>
24 # include "internal/blake2_locl.h"
25 # include "internal/evp_int.h"
27 static int init(EVP_MD_CTX *ctx)
29 return BLAKE2s_Init(EVP_MD_CTX_md_data(ctx));
32 static int update(EVP_MD_CTX *ctx, const void *data, size_t count)
34 return BLAKE2s_Update(EVP_MD_CTX_md_data(ctx), data, count);
37 static int final(EVP_MD_CTX *ctx, unsigned char *md)
39 return BLAKE2s_Final(md, EVP_MD_CTX_md_data(ctx));
42 static const EVP_MD blake2s_md = {
45 BLAKE2S_DIGEST_LENGTH,
53 sizeof(EVP_MD *) + sizeof(BLAKE2S_CTX),
56 const EVP_MD *EVP_blake2s256(void)