mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ad7cb5f5c1
This commit add following crypto changes 1. Update current crypto code with upstream supplicant code 2. Add a proper porting layer to use mbedtls APIs for all the crypto operations used by supplicant. Internal crypto will be used when USE_MBEDLTS flag is disabled in supplicant's menuconfig. This commit also removes the clutter in crypto files due to partial porting of some APIs to mbedtls, all the code from those files have been removed and rewritten in a generic way, this is inspired from current upstream code. This also reduces the lib size significantly, supplicant's lib size reduces around ~567kb after this change(NB: lib size doesn't indicate reduction in final bin size).
31 lines
1.1 KiB
C
31 lines
1.1 KiB
C
/*
|
|
* SHA256 hash implementation and interface functions
|
|
* Copyright (c) 2003-2016, Jouni Malinen <j@w1.fi>
|
|
*
|
|
* This software may be distributed under the terms of the BSD license.
|
|
* See README for more details.
|
|
*/
|
|
|
|
#ifndef SHA256_H
|
|
#define SHA256_H
|
|
|
|
#define SHA256_MAC_LEN 32
|
|
|
|
int hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem,
|
|
const u8 *addr[], const size_t *len, u8 *mac);
|
|
int hmac_sha256(const u8 *key, size_t key_len, const u8 *data,
|
|
size_t data_len, u8 *mac);
|
|
int sha256_prf(const u8 *key, size_t key_len, const char *label,
|
|
const u8 *data, size_t data_len, u8 *buf, size_t buf_len);
|
|
int sha256_prf_bits(const u8 *key, size_t key_len, const char *label,
|
|
const u8 *data, size_t data_len, u8 *buf,
|
|
size_t buf_len_bits);
|
|
int tls_prf_sha256(const u8 *secret, size_t secret_len,
|
|
const char *label, const u8 *seed, size_t seed_len,
|
|
u8 *out, size_t outlen);
|
|
int hmac_sha256_kdf(const u8 *secret, size_t secret_len,
|
|
const char *label, const u8 *seed, size_t seed_len,
|
|
u8 *out, size_t outlen);
|
|
|
|
#endif /* SHA256_H */
|