legacy_blake2.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #include "crypto/evp.h"
  10. #include "prov/blake2.h" /* diverse BLAKE2 macros */
  11. #include "legacy_meth.h"
  12. #define blake2b_init blake2b512_init
  13. #define blake2s_init blake2s256_init
  14. IMPLEMENT_LEGACY_EVP_MD_METH_LC(blake2s_int, blake2s)
  15. IMPLEMENT_LEGACY_EVP_MD_METH_LC(blake2b_int, blake2b)
  16. static const EVP_MD blake2b_md = {
  17. NID_blake2b512,
  18. 0,
  19. BLAKE2B_DIGEST_LENGTH,
  20. 0,
  21. LEGACY_EVP_MD_METH_TABLE(blake2b_int_init, blake2b_int_update,
  22. blake2b_int_final, NULL, BLAKE2B_BLOCKBYTES),
  23. };
  24. const EVP_MD *EVP_blake2b512(void)
  25. {
  26. return &blake2b_md;
  27. }
  28. static const EVP_MD blake2s_md = {
  29. NID_blake2s256,
  30. 0,
  31. BLAKE2S_DIGEST_LENGTH,
  32. 0,
  33. LEGACY_EVP_MD_METH_TABLE(blake2s_int_init, blake2s_int_update,
  34. blake2s_int_final, NULL, BLAKE2S_BLOCKBYTES),
  35. };
  36. const EVP_MD *EVP_blake2s256(void)
  37. {
  38. return &blake2s_md;
  39. }