1e1051a39Sopenharmony_ci/* 2e1051a39Sopenharmony_ci * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. 3e1051a39Sopenharmony_ci * 4e1051a39Sopenharmony_ci * Licensed under the Apache License 2.0 (the "License"). You may not use 5e1051a39Sopenharmony_ci * this file except in compliance with the License. You can obtain a copy 6e1051a39Sopenharmony_ci * in the file LICENSE in the source distribution or at 7e1051a39Sopenharmony_ci * https://www.openssl.org/source/license.html 8e1051a39Sopenharmony_ci */ 9e1051a39Sopenharmony_ci 10e1051a39Sopenharmony_ci#include "crypto/evp.h" 11e1051a39Sopenharmony_ci#include "prov/blake2.h" /* diverse BLAKE2 macros */ 12e1051a39Sopenharmony_ci#include "legacy_meth.h" 13e1051a39Sopenharmony_ci 14e1051a39Sopenharmony_ci#define ossl_blake2b_init ossl_blake2b512_init 15e1051a39Sopenharmony_ci#define ossl_blake2s_init ossl_blake2s256_init 16e1051a39Sopenharmony_ci 17e1051a39Sopenharmony_ciIMPLEMENT_LEGACY_EVP_MD_METH_LC(blake2s_int, ossl_blake2s) 18e1051a39Sopenharmony_ciIMPLEMENT_LEGACY_EVP_MD_METH_LC(blake2b_int, ossl_blake2b) 19e1051a39Sopenharmony_ci 20e1051a39Sopenharmony_cistatic const EVP_MD blake2b_md = { 21e1051a39Sopenharmony_ci NID_blake2b512, 22e1051a39Sopenharmony_ci 0, 23e1051a39Sopenharmony_ci BLAKE2B_DIGEST_LENGTH, 24e1051a39Sopenharmony_ci 0, 25e1051a39Sopenharmony_ci EVP_ORIG_GLOBAL, 26e1051a39Sopenharmony_ci LEGACY_EVP_MD_METH_TABLE(blake2b_int_init, blake2b_int_update, 27e1051a39Sopenharmony_ci blake2b_int_final, NULL, BLAKE2B_BLOCKBYTES), 28e1051a39Sopenharmony_ci}; 29e1051a39Sopenharmony_ci 30e1051a39Sopenharmony_ciconst EVP_MD *EVP_blake2b512(void) 31e1051a39Sopenharmony_ci{ 32e1051a39Sopenharmony_ci return &blake2b_md; 33e1051a39Sopenharmony_ci} 34e1051a39Sopenharmony_ci 35e1051a39Sopenharmony_cistatic const EVP_MD blake2s_md = { 36e1051a39Sopenharmony_ci NID_blake2s256, 37e1051a39Sopenharmony_ci 0, 38e1051a39Sopenharmony_ci BLAKE2S_DIGEST_LENGTH, 39e1051a39Sopenharmony_ci 0, 40e1051a39Sopenharmony_ci EVP_ORIG_GLOBAL, 41e1051a39Sopenharmony_ci LEGACY_EVP_MD_METH_TABLE(blake2s_int_init, blake2s_int_update, 42e1051a39Sopenharmony_ci blake2s_int_final, NULL, BLAKE2S_BLOCKBYTES), 43e1051a39Sopenharmony_ci}; 44e1051a39Sopenharmony_ci 45e1051a39Sopenharmony_ciconst EVP_MD *EVP_blake2s256(void) 46e1051a39Sopenharmony_ci{ 47e1051a39Sopenharmony_ci return &blake2s_md; 48e1051a39Sopenharmony_ci} 49