mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-06-28 21:03:59 +08:00
feat(wps): optimization wps code
This commit is contained in:
@ -691,8 +691,6 @@ typedef int (*esp_wps_is_selected_pin_registrar_t)(const void *msg, unsigned cha
|
|||||||
*/
|
*/
|
||||||
typedef int (*esp_wps_is_selected_pbc_registrar_t)(const void *msg, unsigned char *bssid);
|
typedef int (*esp_wps_is_selected_pbc_registrar_t)(const void *msg, unsigned char *bssid);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The crypto callback function structure used when do station security connect.
|
* @brief The crypto callback function structure used when do station security connect.
|
||||||
* The structure can be set as software crypto or the crypto optimized by ESP32
|
* The structure can be set as software crypto or the crypto optimized by ESP32
|
||||||
@ -750,7 +748,6 @@ typedef struct{
|
|||||||
esp_eap_msg_alloc_t eap_msg_alloc;
|
esp_eap_msg_alloc_t eap_msg_alloc;
|
||||||
}wps_crypto_funcs_t;
|
}wps_crypto_funcs_t;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -78,34 +78,5 @@ fast_aes_128_cbc_decrypt(const uint8_t *key, const uint8_t *iv, uint8_t *data, s
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
/**
|
|
||||||
* fast_aes_128_cbc_encrypt - AES-128 CBC encryption
|
|
||||||
* @key: Encryption key
|
|
||||||
* @iv: Encryption IV for CBC mode (16 bytes)
|
|
||||||
* @data: Data to encrypt in-place
|
|
||||||
* @data_len: Length of data in bytes (must be divisible by 16)
|
|
||||||
* Returns: 0 on success, -1 on failure
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
fast_aes_128_cbc_encrypt(const uint8_t *key, const uint8_t *iv, uint8_t *data, size_t data_len)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fast_aes_128_cbc_decrypt - AES-128 CBC decryption
|
|
||||||
* @key: Decryption key
|
|
||||||
* @iv: Decryption IV for CBC mode (16 bytes)
|
|
||||||
* @data: Data to decrypt in-place
|
|
||||||
* @data_len: Length of data in bytes (must be divisible by 16)
|
|
||||||
* Returns: 0 on success, -1 on failure
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
fast_aes_128_cbc_decrypt(const uint8_t *key, const uint8_t *iv, uint8_t *data, size_t data_len)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@ -84,19 +84,4 @@ fast_aes_unwrap(const uint8_t *kek, int n, const uint8_t *cipher, uint8_t *plain
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
/**
|
|
||||||
* fast_aes_unwrap - Unwrap key with AES Key Wrap Algorithm (128-bit KEK) (RFC3394)
|
|
||||||
* @kek: Key encryption key (KEK)
|
|
||||||
* @n: Length of the plaintext key in 64-bit units; e.g., 2 = 128-bit = 16
|
|
||||||
* bytes
|
|
||||||
* @cipher: Wrapped key to be unwrapped, (n + 1) * 64 bits
|
|
||||||
* @plain: Plaintext key, n * 64 bits
|
|
||||||
* Returns: 0 on success, -1 on failure (e.g., integrity verification failed)
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
fast_aes_unwrap(const uint8_t *kek, int n, const uint8_t *cipher, uint8_t *plain)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
@ -85,18 +85,4 @@ int fast_aes_wrap(const uint8_t *kek, int n, const uint8_t *plain, uint8_t *ciph
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
/**
|
|
||||||
* fast_aes_wrap - Wrap keys with AES Key Wrap Algorithm (128-bit KEK) (RFC3394)
|
|
||||||
* @kek: 16-octet Key encryption key (KEK)
|
|
||||||
* @n: Length of the plaintext key in 64-bit units; e.g., 2 = 128-bit = 16
|
|
||||||
* bytes
|
|
||||||
* @plain: Plaintext key to be wrapped, n * 64 bits
|
|
||||||
* @cipher: Wrapped key, (n + 1) * 64 bits
|
|
||||||
* Returns: 0 on success, -1 on failure
|
|
||||||
*/
|
|
||||||
int fast_aes_wrap(const uint8_t *kek, int n, const uint8_t *plain, uint8_t *cipher)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
@ -61,12 +61,4 @@ int fast_crypto_mod_exp(const uint8_t *base, size_t base_len,
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int fast_crypto_mod_exp(const uint8_t *base, size_t base_len,
|
|
||||||
const uint8_t *power, size_t power_len,
|
|
||||||
const uint8_t *modulus, size_t modulus_len,
|
|
||||||
uint8_t *result, size_t *result_len)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
@ -282,6 +282,4 @@ int fast_crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -59,20 +59,4 @@ out:
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fast_sha256_vector - SHA256 hash for data vector
|
|
||||||
* @num_elem: Number of elements in the data vector
|
|
||||||
* @addr: Pointers to the data areas
|
|
||||||
* @len: Lengths of the data blocks
|
|
||||||
* @mac: Buffer for the hash
|
|
||||||
* Returns: 0 on success, -1 of failure
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
fast_sha256_vector(size_t num_elem, const uint8_t *addr[], const size_t *len,
|
|
||||||
uint8_t *mac)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
@ -22,7 +22,6 @@
|
|||||||
#include "crypto/crypto.h"
|
#include "crypto/crypto.h"
|
||||||
|
|
||||||
#if CONFIG_SSL_USING_MBEDTLS
|
#if CONFIG_SSL_USING_MBEDTLS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fast_hmac_sha256_vector - HMAC-SHA256 over data vector (RFC 2104)
|
* fast_hmac_sha256_vector - HMAC-SHA256 over data vector (RFC 2104)
|
||||||
* @key: Key for HMAC operations
|
* @key: Key for HMAC operations
|
||||||
@ -165,54 +164,4 @@ fast_sha256_prf(const uint8_t *key, size_t key_len, const char *label,
|
|||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
/**
|
|
||||||
* fast_hmac_sha256_vector - HMAC-SHA256 over data vector (RFC 2104)
|
|
||||||
* @key: Key for HMAC operations
|
|
||||||
* @key_len: Length of the key in bytes
|
|
||||||
* @num_elem: Number of elements in the data vector
|
|
||||||
* @addr: Pointers to the data areas
|
|
||||||
* @len: Lengths of the data blocks
|
|
||||||
* @mac: Buffer for the hash (32 bytes)
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
fast_hmac_sha256_vector(const uint8_t *key, size_t key_len, size_t num_elem,
|
|
||||||
const uint8_t *addr[], const size_t *len, uint8_t *mac)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fast_hmac_sha256 - HMAC-SHA256 over data buffer (RFC 2104)
|
|
||||||
* @key: Key for HMAC operations
|
|
||||||
* @key_len: Length of the key in bytes
|
|
||||||
* @data: Pointers to the data area
|
|
||||||
* @data_len: Length of the data area
|
|
||||||
* @mac: Buffer for the hash (20 bytes)
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
fast_hmac_sha256(const uint8_t *key, size_t key_len, const uint8_t *data,
|
|
||||||
size_t data_len, uint8_t *mac)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fast_sha256_prf - SHA256-based Pseudo-Random Function (IEEE 802.11r, 8.5.1.5.2)
|
|
||||||
* @key: Key for PRF
|
|
||||||
* @key_len: Length of the key in bytes
|
|
||||||
* @label: A unique label for each purpose of the PRF
|
|
||||||
* @data: Extra data to bind into the key
|
|
||||||
* @data_len: Length of the data
|
|
||||||
* @buf: Buffer for the generated pseudo-random key
|
|
||||||
* @buf_len: Number of bytes of key to generate
|
|
||||||
*
|
|
||||||
* This function is used to derive new, cryptographically separate keys from a
|
|
||||||
* given key.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
fast_sha256_prf(const uint8_t *key, size_t key_len, const char *label,
|
|
||||||
const uint8_t *data, size_t data_len, uint8_t *buf, size_t buf_len)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
@ -86,6 +86,7 @@ const wps_crypto_funcs_t g_wifi_default_wps_crypto_funcs = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The parameters is used to set the cyrpto callback function for station connect when in security mode,
|
* The parameters is used to set the cyrpto callback function for station connect when in security mode,
|
||||||
* every callback function can register as fast_xxx or normal one, i.e, fast_aes_wrap or aes_wrap, the
|
* every callback function can register as fast_xxx or normal one, i.e, fast_aes_wrap or aes_wrap, the
|
||||||
|
Reference in New Issue
Block a user