| 1 | /* |
| 2 | * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved. |
| 3 | * |
| 4 | * Licensed under the Apache License 2.0 (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 |
| 8 | */ |
| 9 | |
| 10 | #include <openssl/opensslconf.h> |
| 11 | |
| 12 | #ifndef OPENSSL_NO_BLAKE2 |
| 13 | |
| 14 | # include <openssl/obj_mac.h> |
| 15 | # include "crypto/evp.h" |
| 16 | # include "prov/blake2.h" /* diverse BLAKE2 macros */ |
| 17 | |
| 18 | static const EVP_MD blake2b_md = { |
| 19 | NID_blake2b512, |
| 20 | 0, |
| 21 | BLAKE2B_DIGEST_LENGTH, |
| 22 | 0, |
| 23 | NULL, |
| 24 | NULL, |
| 25 | NULL, |
| 26 | NULL, |
| 27 | NULL, |
| 28 | BLAKE2B_BLOCKBYTES, |
| 29 | }; |
| 30 | |
| 31 | const EVP_MD *EVP_blake2b512(void) |
| 32 | { |
| 33 | return &blake2b_md; |
| 34 | } |
| 35 | |
| 36 | static const EVP_MD blake2s_md = { |
| 37 | NID_blake2s256, |
| 38 | 0, |
| 39 | BLAKE2S_DIGEST_LENGTH, |
| 40 | 0, |
| 41 | NULL, |
| 42 | NULL, |
| 43 | NULL, |
| 44 | NULL, |
| 45 | NULL, |
| 46 | BLAKE2S_BLOCKBYTES, |
| 47 | }; |
| 48 | |
| 49 | const EVP_MD *EVP_blake2s256(void) |
| 50 | { |
| 51 | return &blake2s_md; |
| 52 | } |
| 53 | |
| 54 | #endif /* OPENSSL_NO_BLAKE2 */ |
| 55 | |