crypto_generichash_blake2b.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #ifndef crypto_generichash_blake2b_H
  2. #define crypto_generichash_blake2b_H
  3. #include <stddef.h>
  4. #include <stdint.h>
  5. #include <stdlib.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. #if defined(__IBMC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
  14. # pragma pack(1)
  15. #else
  16. # pragma pack(push, 1)
  17. #endif
  18. typedef struct CRYPTO_ALIGN(64) crypto_generichash_blake2b_state {
  19. unsigned char opaque[384];
  20. } crypto_generichash_blake2b_state;
  21. #if defined(__IBMC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
  22. # pragma pack()
  23. #else
  24. # pragma pack(pop)
  25. #endif
  26. #define crypto_generichash_blake2b_BYTES_MIN 16U
  27. SODIUM_EXPORT
  28. size_t crypto_generichash_blake2b_bytes_min(void);
  29. #define crypto_generichash_blake2b_BYTES_MAX 64U
  30. SODIUM_EXPORT
  31. size_t crypto_generichash_blake2b_bytes_max(void);
  32. #define crypto_generichash_blake2b_BYTES 32U
  33. SODIUM_EXPORT
  34. size_t crypto_generichash_blake2b_bytes(void);
  35. #define crypto_generichash_blake2b_KEYBYTES_MIN 16U
  36. SODIUM_EXPORT
  37. size_t crypto_generichash_blake2b_keybytes_min(void);
  38. #define crypto_generichash_blake2b_KEYBYTES_MAX 64U
  39. SODIUM_EXPORT
  40. size_t crypto_generichash_blake2b_keybytes_max(void);
  41. #define crypto_generichash_blake2b_KEYBYTES 32U
  42. SODIUM_EXPORT
  43. size_t crypto_generichash_blake2b_keybytes(void);
  44. #define crypto_generichash_blake2b_SALTBYTES 16U
  45. SODIUM_EXPORT
  46. size_t crypto_generichash_blake2b_saltbytes(void);
  47. #define crypto_generichash_blake2b_PERSONALBYTES 16U
  48. SODIUM_EXPORT
  49. size_t crypto_generichash_blake2b_personalbytes(void);
  50. SODIUM_EXPORT
  51. size_t crypto_generichash_blake2b_statebytes(void);
  52. SODIUM_EXPORT
  53. int crypto_generichash_blake2b(unsigned char *out, size_t outlen,
  54. const unsigned char *in,
  55. unsigned long long inlen,
  56. const unsigned char *key, size_t keylen)
  57. __attribute__ ((nonnull(1)));
  58. SODIUM_EXPORT
  59. int crypto_generichash_blake2b_salt_personal(unsigned char *out, size_t outlen,
  60. const unsigned char *in,
  61. unsigned long long inlen,
  62. const unsigned char *key,
  63. size_t keylen,
  64. const unsigned char *salt,
  65. const unsigned char *personal)
  66. __attribute__ ((nonnull(1)));
  67. SODIUM_EXPORT
  68. int crypto_generichash_blake2b_init(crypto_generichash_blake2b_state *state,
  69. const unsigned char *key,
  70. const size_t keylen, const size_t outlen)
  71. __attribute__ ((nonnull(1)));
  72. SODIUM_EXPORT
  73. int crypto_generichash_blake2b_init_salt_personal(crypto_generichash_blake2b_state *state,
  74. const unsigned char *key,
  75. const size_t keylen, const size_t outlen,
  76. const unsigned char *salt,
  77. const unsigned char *personal)
  78. __attribute__ ((nonnull(1)));
  79. SODIUM_EXPORT
  80. int crypto_generichash_blake2b_update(crypto_generichash_blake2b_state *state,
  81. const unsigned char *in,
  82. unsigned long long inlen)
  83. __attribute__ ((nonnull(1)));
  84. SODIUM_EXPORT
  85. int crypto_generichash_blake2b_final(crypto_generichash_blake2b_state *state,
  86. unsigned char *out,
  87. const size_t outlen) __attribute__ ((nonnull));
  88. SODIUM_EXPORT
  89. void crypto_generichash_blake2b_keygen(unsigned char k[crypto_generichash_blake2b_KEYBYTES])
  90. __attribute__ ((nonnull));
  91. #ifdef __cplusplus
  92. }
  93. #endif
  94. #endif