2 * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
11 * Derived from the BLAKE2 reference implementation written by Samuel Neves.
12 * Copyright 2012, Samuel Neves <sneves@dei.uc.pt>
13 * More information about the BLAKE2 hash function and its implementations
14 * can be found at https://blake2.net.
17 #include "internal/cryptlib.h"
19 #ifndef OPENSSL_NO_BLAKE2
21 # include <openssl/evp.h>
22 # include <openssl/objects.h>
23 # include "blake2_locl.h"
24 # include "internal/evp_int.h"
26 static int init(EVP_MD_CTX *ctx)
28 return BLAKE2b_Init(EVP_MD_CTX_md_data(ctx));
31 static int update(EVP_MD_CTX *ctx, const void *data, size_t count)
33 return BLAKE2b_Update(EVP_MD_CTX_md_data(ctx), data, count);
36 static int final(EVP_MD_CTX *ctx, unsigned char *md)
38 return BLAKE2b_Final(md, EVP_MD_CTX_md_data(ctx));
41 static const EVP_MD blake2b_md = {
44 BLAKE2B_DIGEST_LENGTH,
52 sizeof(EVP_MD *) + sizeof(BLAKE2B_CTX),
55 const EVP_MD *EVP_blake2b512(void)