1 | /*
|
---|
2 | * Copyright 2019-2021 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 "crypto/evp.h"
|
---|
11 | #include "prov/blake2.h" /* diverse BLAKE2 macros */
|
---|
12 | #include "legacy_meth.h"
|
---|
13 |
|
---|
14 | #ifdef OPENSSL_MANGLER /* VBOX */
|
---|
15 | # undef ossl_blake2b_init /* VBOX */
|
---|
16 | # undef ossl_blake2s_init /* VBOX */
|
---|
17 | # define ossl_blake2b_init OPENSSL_MANGLER(ossl_blake2b512_init) /* VBOX */
|
---|
18 | # define ossl_blake2s_init OPENSSL_MANGLER(ossl_blake2s256_init) /* VBOX */
|
---|
19 | #else /* VBOX */
|
---|
20 | #define ossl_blake2b_init ossl_blake2b512_init
|
---|
21 | #define ossl_blake2s_init ossl_blake2s256_init
|
---|
22 | #endif /* VBOX */
|
---|
23 |
|
---|
24 | IMPLEMENT_LEGACY_EVP_MD_METH_LC(blake2s_int, ossl_blake2s)
|
---|
25 | IMPLEMENT_LEGACY_EVP_MD_METH_LC(blake2b_int, ossl_blake2b)
|
---|
26 |
|
---|
27 | static const EVP_MD blake2b_md = {
|
---|
28 | NID_blake2b512,
|
---|
29 | 0,
|
---|
30 | BLAKE2B_DIGEST_LENGTH,
|
---|
31 | 0,
|
---|
32 | EVP_ORIG_GLOBAL,
|
---|
33 | LEGACY_EVP_MD_METH_TABLE(blake2b_int_init, blake2b_int_update,
|
---|
34 | blake2b_int_final, NULL, BLAKE2B_BLOCKBYTES),
|
---|
35 | };
|
---|
36 |
|
---|
37 | const EVP_MD *EVP_blake2b512(void)
|
---|
38 | {
|
---|
39 | return &blake2b_md;
|
---|
40 | }
|
---|
41 |
|
---|
42 | static const EVP_MD blake2s_md = {
|
---|
43 | NID_blake2s256,
|
---|
44 | 0,
|
---|
45 | BLAKE2S_DIGEST_LENGTH,
|
---|
46 | 0,
|
---|
47 | EVP_ORIG_GLOBAL,
|
---|
48 | LEGACY_EVP_MD_METH_TABLE(blake2s_int_init, blake2s_int_update,
|
---|
49 | blake2s_int_final, NULL, BLAKE2S_BLOCKBYTES),
|
---|
50 | };
|
---|
51 |
|
---|
52 | const EVP_MD *EVP_blake2s256(void)
|
---|
53 | {
|
---|
54 | return &blake2s_md;
|
---|
55 | }
|
---|