18d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* 28d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * SHA256 hash implementation and interface functions 3e4663044d3a689fb5458247e9bc0f8b58cf72fcaDmitry Shmidt * Copyright (c) 2003-2016, Jouni Malinen <j@w1.fi> 48d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * This software may be distributed under the terms of the BSD license. 6c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * See README for more details. 78d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 88d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 98d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifndef SHA256_H 108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define SHA256_H 118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define SHA256_MAC_LEN 32 138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1461d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem, 1561d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt const u8 *addr[], const size_t *len, u8 *mac); 1661d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint hmac_sha256(const u8 *key, size_t key_len, const u8 *data, 1761d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt size_t data_len, u8 *mac); 18e4663044d3a689fb5458247e9bc0f8b58cf72fcaDmitry Shmidtint sha256_prf(const u8 *key, size_t key_len, const char *label, 19e4663044d3a689fb5458247e9bc0f8b58cf72fcaDmitry Shmidt const u8 *data, size_t data_len, u8 *buf, size_t buf_len); 20e4663044d3a689fb5458247e9bc0f8b58cf72fcaDmitry Shmidtint sha256_prf_bits(const u8 *key, size_t key_len, const char *label, 21e4663044d3a689fb5458247e9bc0f8b58cf72fcaDmitry Shmidt const u8 *data, size_t data_len, u8 *buf, 22e4663044d3a689fb5458247e9bc0f8b58cf72fcaDmitry Shmidt size_t buf_len_bits); 231f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtvoid tls_prf_sha256(const u8 *secret, size_t secret_len, 241f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt const char *label, const u8 *seed, size_t seed_len, 251f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt u8 *out, size_t outlen); 26fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidtint hmac_sha256_kdf(const u8 *secret, size_t secret_len, 27fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt const char *label, const u8 *seed, size_t seed_len, 28fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt u8 *out, size_t outlen); 298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* SHA256_H */ 31