libsodium (1.0.19)

(root)/
include/
sodium/
crypto_kdf_hkdf_sha512.h
       1  #ifndef crypto_kdf_hkdf_sha512_H
       2  #define crypto_kdf_hkdf_sha512_H
       3  
       4  #include <stddef.h>
       5  #include <stdint.h>
       6  #include <stdlib.h>
       7  
       8  #include "crypto_kdf.h"
       9  #include "crypto_auth_hmacsha512.h"
      10  #include "export.h"
      11  
      12  #ifdef __cplusplus
      13  # ifdef __GNUC__
      14  #  pragma GCC diagnostic ignored "-Wlong-long"
      15  # endif
      16  extern "C" {
      17  #endif
      18  
      19  #define crypto_kdf_hkdf_sha512_KEYBYTES crypto_auth_hmacsha512_BYTES
      20  SODIUM_EXPORT
      21  size_t crypto_kdf_hkdf_sha512_keybytes(void);
      22  
      23  #define crypto_kdf_hkdf_sha512_BYTES_MIN 0U
      24  SODIUM_EXPORT
      25  size_t crypto_kdf_hkdf_sha512_bytes_min(void);
      26  
      27  #define crypto_kdf_hkdf_sha512_BYTES_MAX (0xff * crypto_auth_hmacsha512_BYTES)
      28  SODIUM_EXPORT
      29  size_t crypto_kdf_hkdf_sha512_bytes_max(void);
      30  
      31  SODIUM_EXPORT
      32  int crypto_kdf_hkdf_sha512_extract(unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES],
      33                                     const unsigned char *salt, size_t salt_len,
      34                                     const unsigned char *ikm, size_t ikm_len)
      35              __attribute__ ((nonnull(1)));
      36  
      37  SODIUM_EXPORT
      38  void crypto_kdf_hkdf_sha512_keygen(unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES])
      39              __attribute__ ((nonnull));
      40  
      41  SODIUM_EXPORT
      42  int crypto_kdf_hkdf_sha512_expand(unsigned char *out, size_t out_len,
      43                                    const char *ctx, size_t ctx_len,
      44                                    const unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES])
      45              __attribute__ ((nonnull(1)));
      46  
      47  /* ------------------------------------------------------------------------- */
      48  
      49  typedef struct crypto_kdf_hkdf_sha512_state {
      50      crypto_auth_hmacsha512_state st;
      51  } crypto_kdf_hkdf_sha512_state;
      52  
      53  SODIUM_EXPORT
      54  size_t crypto_kdf_hkdf_sha512_statebytes(void);
      55  
      56  SODIUM_EXPORT
      57  int crypto_kdf_hkdf_sha512_extract_init(crypto_kdf_hkdf_sha512_state *state,
      58                                          const unsigned char *salt, size_t salt_len)
      59              __attribute__ ((nonnull(1)));
      60  
      61  SODIUM_EXPORT
      62  int crypto_kdf_hkdf_sha512_extract_update(crypto_kdf_hkdf_sha512_state *state,
      63                                            const unsigned char *ikm, size_t ikm_len)
      64              __attribute__ ((nonnull));
      65  
      66  SODIUM_EXPORT
      67  int crypto_kdf_hkdf_sha512_extract_final(crypto_kdf_hkdf_sha512_state *state,
      68                                           unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES])
      69              __attribute__ ((nonnull));
      70  
      71  #ifdef __cplusplus
      72  }
      73  #endif
      74  
      75  #endif