crypto_kdf.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef crypto_kdf_H
  2. #define crypto_kdf_H
  3. #include <stddef.h>
  4. #include <stdint.h>
  5. #include "crypto_kdf_blake2b.h"
  6. #include "export.h"
  7. #ifdef __cplusplus
  8. # ifdef __GNUC__
  9. # pragma GCC diagnostic ignored "-Wlong-long"
  10. # endif
  11. extern "C" {
  12. #endif
  13. #define crypto_kdf_BYTES_MIN crypto_kdf_blake2b_BYTES_MIN
  14. SODIUM_EXPORT
  15. size_t crypto_kdf_bytes_min(void);
  16. #define crypto_kdf_BYTES_MAX crypto_kdf_blake2b_BYTES_MAX
  17. SODIUM_EXPORT
  18. size_t crypto_kdf_bytes_max(void);
  19. #define crypto_kdf_CONTEXTBYTES crypto_kdf_blake2b_CONTEXTBYTES
  20. SODIUM_EXPORT
  21. size_t crypto_kdf_contextbytes(void);
  22. #define crypto_kdf_KEYBYTES crypto_kdf_blake2b_KEYBYTES
  23. SODIUM_EXPORT
  24. size_t crypto_kdf_keybytes(void);
  25. #define crypto_kdf_PRIMITIVE "blake2b"
  26. SODIUM_EXPORT
  27. const char *crypto_kdf_primitive(void)
  28. __attribute__ ((warn_unused_result));
  29. SODIUM_EXPORT
  30. int crypto_kdf_derive_from_key(unsigned char *subkey, size_t subkey_len,
  31. uint64_t subkey_id,
  32. const char ctx[crypto_kdf_CONTEXTBYTES],
  33. const unsigned char key[crypto_kdf_KEYBYTES])
  34. __attribute__ ((nonnull));
  35. SODIUM_EXPORT
  36. void crypto_kdf_keygen(unsigned char k[crypto_kdf_KEYBYTES])
  37. __attribute__ ((nonnull));
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41. #endif