feat(wps): add the CONFIG_ESP_SHA macro definition

This commit is contained in:
Chen Wen
2019-09-19 11:44:33 +08:00
parent 62cc5052fe
commit 8254a61e73
3 changed files with 7 additions and 15 deletions

View File

@ -15,9 +15,7 @@
#ifndef SHA1_I_H
#define SHA1_I_H
#if 0
#include "sdkconfig.h"
#ifdef CONFIG_ESP_SHA
#include "esp_sha.h"
@ -38,15 +36,5 @@ void SHA1Update(struct SHA1Context *context, const void *data, u32 len);
void SHA1Final(unsigned char digest[20], struct SHA1Context *context);
void SHA1Transform(u32 state[5], const unsigned char buffer[64]);
#endif /* CONFIG_ESP_SHA */
#endif
struct SHA1Context {
u32 state[5];
u32 count[2];
unsigned char buffer[64];
};
void SHA1Init(struct SHA1Context *context);
void SHA1Update(struct SHA1Context *context, const void *data, u32 len);
void SHA1Final(unsigned char digest[20], struct SHA1Context *context);
void SHA1Transform(u32 state[5], const unsigned char buffer[64]);
#endif /* SHA1_I_H */

View File

@ -20,12 +20,12 @@
#include "crypto/md5.h"
#include "crypto/crypto.h"
//#ifndef CONFIG_ESP_SHA
#ifndef CONFIG_ESP_SHA
typedef struct SHA1Context SHA1_CTX;
void SHA1Transform(u32 state[5], const unsigned char buffer[64]);
//#endif
#endif
/**
* sha1_vector - SHA-1 hash for data vector
@ -49,7 +49,7 @@ sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
}
#if 1//ndef CONFIG_ESP_SHA
#ifndef CONFIG_ESP_SHA
/* ===== start - public domain SHA1 implementation ===== */
/*

View File

@ -27,7 +27,11 @@ struct fast_crypto_hash {
enum crypto_hash_alg alg;
union {
struct MD5Context md5;
#ifndef CONFIG_ESP_SHA
struct SHA1Context sha1;
#else
SHA1_CTX sha1;
#endif
#ifdef CONFIG_SHA256
mbedtls_sha256_context sha256;
#endif /* CONFIG_SHA256 */