libsodium (1.0.19)

(root)/
include/
sodium/
crypto_kdf_hkdf_sha256.h
       1  #ifndef crypto_kdf_hkdf_sha256_H
       2  #define crypto_kdf_hkdf_sha256_H
       3  
       4  #include <stddef.h>
       5  #include <stdint.h>
       6  #include <stdlib.h>
       7  
       8  #include "crypto_kdf.h"
       9  #include "crypto_auth_hmacsha256.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_sha256_KEYBYTES crypto_auth_hmacsha256_BYTES
      20  SODIUM_EXPORT
      21  size_t crypto_kdf_hkdf_sha256_keybytes(void);
      22  
      23  #define crypto_kdf_hkdf_sha256_BYTES_MIN 0U
      24  SODIUM_EXPORT
      25  size_t crypto_kdf_hkdf_sha256_bytes_min(void);
      26  
      27  #define crypto_kdf_hkdf_sha256_BYTES_MAX (0xff * crypto_auth_hmacsha256_BYTES)
      28  SODIUM_EXPORT
      29  size_t crypto_kdf_hkdf_sha256_bytes_max(void);
      30  
      31  SODIUM_EXPORT
      32  int crypto_kdf_hkdf_sha256_extract(unsigned char prk[crypto_kdf_hkdf_sha256_KEYBYTES],
      33                                     const unsigned char *salt, size_t salt_len,
      34                                     const unsigned char *ikm, size_t ikm_len)
      35              __attribute__ ((nonnull(4)));
      36  
      37  SODIUM_EXPORT
      38  void crypto_kdf_hkdf_sha256_keygen(unsigned char prk[crypto_kdf_hkdf_sha256_KEYBYTES]);
      39  
      40  SODIUM_EXPORT
      41  int crypto_kdf_hkdf_sha256_expand(unsigned char *out, size_t out_len,
      42                                    const char *ctx, size_t ctx_len,
      43                                    const unsigned char prk[crypto_kdf_hkdf_sha256_KEYBYTES])
      44              __attribute__ ((nonnull(1)));
      45  
      46  /* ------------------------------------------------------------------------- */
      47  
      48  typedef struct crypto_kdf_hkdf_sha256_state {
      49      crypto_auth_hmacsha256_state st;
      50  } crypto_kdf_hkdf_sha256_state;
      51  
      52  SODIUM_EXPORT
      53  size_t crypto_kdf_hkdf_sha256_statebytes(void);
      54  
      55  SODIUM_EXPORT
      56  int crypto_kdf_hkdf_sha256_extract_init(crypto_kdf_hkdf_sha256_state *state,
      57                                          const unsigned char *salt, size_t salt_len)
      58              __attribute__ ((nonnull(1)));
      59  
      60  SODIUM_EXPORT
      61  int crypto_kdf_hkdf_sha256_extract_update(crypto_kdf_hkdf_sha256_state *state,
      62                                            const unsigned char *ikm, size_t ikm_len)
      63              __attribute__ ((nonnull));
      64  
      65  SODIUM_EXPORT
      66  int crypto_kdf_hkdf_sha256_extract_final(crypto_kdf_hkdf_sha256_state *state,
      67                                           unsigned char prk[crypto_kdf_hkdf_sha256_KEYBYTES])
      68              __attribute__ ((nonnull));
      69  
      70  #ifdef __cplusplus
      71  }
      72  #endif
      73  
      74  #endif