hkdf.h 1013 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the License); you may
  5. * not use this file except in compliance with the License.
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. */
  9. // RFC 5869
  10. #ifndef GMSSL_HKDF_H
  11. #define GMSSL_HKDF_H
  12. #include <string.h>
  13. #include <gmssl/digest.h>
  14. #include <gmssl/hmac.h>
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. int hkdf_extract(const DIGEST *digest, const uint8_t *salt, size_t saltlen,
  19. const uint8_t *ikm, size_t ikmlen,
  20. uint8_t *prk, size_t *prklen);
  21. int hkdf_expand(const DIGEST *digest, const uint8_t *prk, size_t prklen,
  22. const uint8_t *opt_info, size_t opt_infolen,
  23. size_t L, uint8_t *okm);
  24. int sm3_hkdf_extract(const uint8_t *salt, size_t saltlen,
  25. const uint8_t *ikm, size_t ikmlen,
  26. uint8_t *prk, size_t *prklen);
  27. int sm3_hkdf_expand(const uint8_t *prk, size_t prklen,
  28. const uint8_t *opt_info, size_t opt_infolen,
  29. size_t L, uint8_t *okm);
  30. #ifdef __cplusplus
  31. }
  32. #endif
  33. #endif