/* Copyright (c) 2021, Google Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <openssl/blake2.h> #include <assert.h> #include "../internal.h" // https://tools.ietf.org/html/rfc7693#section-2.6 static const uint64_t kIV[8] = …; // https://tools.ietf.org/html/rfc7693#section-2.7 static const uint8_t kSigma[10 * 16] = …; // https://tools.ietf.org/html/rfc7693#section-3.1 static void blake2b_mix(uint64_t v[16], int a, int b, int c, int d, uint64_t x, uint64_t y) { … } static uint64_t blake2b_load(const uint8_t block[BLAKE2B_CBLOCK], size_t i) { … } static void blake2b_transform(BLAKE2B_CTX *b2b, const uint8_t block[BLAKE2B_CBLOCK], size_t num_bytes, int is_final_block) { … } void BLAKE2B256_Init(BLAKE2B_CTX *b2b) { … } void BLAKE2B256_Update(BLAKE2B_CTX *b2b, const void *in_data, size_t len) { … } void BLAKE2B256_Final(uint8_t out[BLAKE2B256_DIGEST_LENGTH], BLAKE2B_CTX *b2b) { … } void BLAKE2B256(const uint8_t *data, size_t len, uint8_t out[BLAKE2B256_DIGEST_LENGTH]) { … }