blake2_prov.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 <openssl/crypto.h>
  10. #include "internal/blake2.h"
  11. #include "internal/digestcommon.h"
  12. #include "internal/provider_algs.h"
  13. OSSL_OP_digest_init_fn blake2s256_init;
  14. OSSL_OP_digest_init_fn blake2b512_init;
  15. int blake2s256_init(void *ctx)
  16. {
  17. BLAKE2S_PARAM P;
  18. blake2s_param_init(&P);
  19. return blake2s_init((BLAKE2S_CTX *)ctx, &P);
  20. }
  21. int blake2b512_init(void *ctx)
  22. {
  23. BLAKE2B_PARAM P;
  24. blake2b_param_init(&P);
  25. return blake2b_init((BLAKE2B_CTX *)ctx, &P);
  26. }
  27. /* blake2s256_functions */
  28. IMPLEMENT_digest_functions(blake2s256, BLAKE2S_CTX,
  29. BLAKE2S_BLOCKBYTES, BLAKE2S_DIGEST_LENGTH, 0,
  30. blake2s256_init, blake2s_update, blake2s_final)
  31. /* blake2b512_functions */
  32. IMPLEMENT_digest_functions(blake2b512, BLAKE2B_CTX,
  33. BLAKE2B_BLOCKBYTES, BLAKE2B_DIGEST_LENGTH, 0,
  34. blake2b512_init, blake2b_update, blake2b_final)