forked from espressif/arduino-esp32
Update IDF libs to 969f1bb (skip BT commits)
This update also increases BT stack size and enables reboot on exception
This commit is contained in:
@ -129,6 +129,9 @@ esp_err_t esp_ota_set_boot_partition(const esp_partition_t* partition);
|
||||
* If esp_ota_set_boot_partition() has not been called, the result is
|
||||
* equivalent to esp_ota_get_running_partition().
|
||||
*
|
||||
* Note that there is no guarantee the returned partition is a valid app. Use esp_image_load(ESP_IMAGE_VERIFY, ...) to verify if the
|
||||
* partition contains a bootable image.
|
||||
*
|
||||
* @return Pointer to info for partition structure, or NULL if no partition is found or flash read operation failed. Returned pointer is valid for the lifetime of the application.
|
||||
*/
|
||||
const esp_partition_t* esp_ota_get_boot_partition(void);
|
||||
@ -142,6 +145,9 @@ const esp_partition_t* esp_ota_get_boot_partition(void);
|
||||
* esp_ota_set_boot_partition(). Only the app whose code is currently
|
||||
* running will have its partition information returned.
|
||||
*
|
||||
* The partition returned by this function may also differ from esp_ota_get_boot_partition() if the configured boot
|
||||
* partition is somehow invalid, and the bootloader fell back to a different app partition at boot.
|
||||
*
|
||||
* @return Pointer to info for partition structure, or NULL if no partition is found or flash read operation failed. Returned pointer is valid for the lifetime of the application.
|
||||
*/
|
||||
const esp_partition_t* esp_ota_get_running_partition(void);
|
||||
|
@ -129,6 +129,9 @@ esp_err_t esp_ota_set_boot_partition(const esp_partition_t* partition);
|
||||
* If esp_ota_set_boot_partition() has not been called, the result is
|
||||
* equivalent to esp_ota_get_running_partition().
|
||||
*
|
||||
* Note that there is no guarantee the returned partition is a valid app. Use esp_image_load(ESP_IMAGE_VERIFY, ...) to verify if the
|
||||
* partition contains a bootable image.
|
||||
*
|
||||
* @return Pointer to info for partition structure, or NULL if no partition is found or flash read operation failed. Returned pointer is valid for the lifetime of the application.
|
||||
*/
|
||||
const esp_partition_t* esp_ota_get_boot_partition(void);
|
||||
@ -142,6 +145,9 @@ const esp_partition_t* esp_ota_get_boot_partition(void);
|
||||
* esp_ota_set_boot_partition(). Only the app whose code is currently
|
||||
* running will have its partition information returned.
|
||||
*
|
||||
* The partition returned by this function may also differ from esp_ota_get_boot_partition() if the configured boot
|
||||
* partition is somehow invalid, and the bootloader fell back to a different app partition at boot.
|
||||
*
|
||||
* @return Pointer to info for partition structure, or NULL if no partition is found or flash read operation failed. Returned pointer is valid for the lifetime of the application.
|
||||
*/
|
||||
const esp_partition_t* esp_ota_get_running_partition(void);
|
||||
|
@ -21,6 +21,7 @@
|
||||
/* Pre-partition table fixed flash offsets */
|
||||
#define ESP_BOOTLOADER_DIGEST_OFFSET 0x0
|
||||
#define ESP_BOOTLOADER_OFFSET 0x1000 /* Offset of bootloader image. Has matching value in bootloader KConfig.projbuild file. */
|
||||
#define ESP_BOOTLOADER_SIZE (ESP_PARTITION_TABLE_OFFSET - ESP_BOOTLOADER_OFFSET)
|
||||
#define ESP_PARTITION_TABLE_OFFSET 0x8000 /* Offset of partition table. Has matching value in partition_table Kconfig.projbuild file. */
|
||||
|
||||
#define ESP_PARTITION_TABLE_MAX_LEN 0xC00 /* Maximum length of partition table data */
|
||||
|
@ -142,7 +142,6 @@ esp_err_t esp_image_load(esp_image_load_mode_t mode, const esp_partition_pos_t *
|
||||
*/
|
||||
esp_err_t esp_image_verify_bootloader(uint32_t *length);
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint32_t drom_addr;
|
||||
uint32_t drom_load_addr;
|
||||
|
@ -15,7 +15,7 @@
|
||||
#define CONFIG_SW_COEXIST_ENABLE 1
|
||||
#define CONFIG_ESPTOOLPY_FLASHSIZE_4MB 1
|
||||
#define CONFIG_IPC_TASK_STACK_SIZE 1024
|
||||
#define CONFIG_ESPTOOLPY_FLASHFREQ "80m"
|
||||
#define CONFIG_ESPTOOLPY_FLASHFREQ "40m"
|
||||
#define CONFIG_NEWLIB_STDOUT_ADDCR 1
|
||||
#define CONFIG_UDP_RECVMBOX_SIZE 6
|
||||
#define CONFIG_TASK_WDT_CHECK_IDLE_TASK 1
|
||||
@ -26,9 +26,11 @@
|
||||
#define CONFIG_EMAC_L2_TO_L3_RX_BUF_MODE 1
|
||||
#define CONFIG_INT_WDT 1
|
||||
#define CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL 1
|
||||
#define CONFIG_ESPTOOLPY_FLASHFREQ_40M 1
|
||||
#define CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS 1
|
||||
#define CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM 10
|
||||
#define CONFIG_BT_RESERVE_DRAM 0x10000
|
||||
#define CONFIG_ESP32_PANIC_PRINT_REBOOT 1
|
||||
#define CONFIG_CONSOLE_UART_BAUDRATE 115200
|
||||
#define CONFIG_LWIP_MAX_SOCKETS 10
|
||||
#define CONFIG_EMAC_TASK_PRIORITY 20
|
||||
@ -38,6 +40,7 @@
|
||||
#define CONFIG_ULP_COPROC_RESERVE_MEM 512
|
||||
#define CONFIG_ESPTOOLPY_BAUD 921600
|
||||
#define CONFIG_INT_WDT_CHECK_CPU1 1
|
||||
#define CONFIG_FLASHMODE_DIO 1
|
||||
#define CONFIG_ESPTOOLPY_AFTER_RESET 1
|
||||
#define CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED 1
|
||||
#define CONFIG_TOOLPREFIX "xtensa-esp32-elf-"
|
||||
@ -45,6 +48,7 @@
|
||||
#define CONFIG_FATFS_LFN_STACK 1
|
||||
#define CONFIG_ESP32_WIFI_AMPDU_ENABLED 1
|
||||
#define CONFIG_CONSOLE_UART_NUM 0
|
||||
#define CONFIG_ESP32_APPTRACE_LOCK_ENABLE 1
|
||||
#define CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC 1
|
||||
#define CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX 0
|
||||
#define CONFIG_TCP_OVERSIZE_MSS 1
|
||||
@ -63,13 +67,12 @@
|
||||
#define CONFIG_MAIN_TASK_STACK_SIZE 4096
|
||||
#define CONFIG_TASK_WDT_TIMEOUT_S 5
|
||||
#define CONFIG_INT_WDT_TIMEOUT_MS 300
|
||||
#define CONFIG_ESPTOOLPY_FLASHMODE "dout"
|
||||
#define CONFIG_BTC_TASK_STACK_SIZE 2048
|
||||
#define CONFIG_ESPTOOLPY_FLASHMODE "dio"
|
||||
#define CONFIG_BTC_TASK_STACK_SIZE 8192
|
||||
#define CONFIG_BLUEDROID_ENABLED 1
|
||||
#define CONFIG_ESPTOOLPY_BEFORE "default_reset"
|
||||
#define CONFIG_LOG_DEFAULT_LEVEL 1
|
||||
#define CONFIG_TIMER_QUEUE_LENGTH 10
|
||||
#define CONFIG_FLASHMODE_DOUT 1
|
||||
#define CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM 0
|
||||
#define CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER 20
|
||||
#define CONFIG_ESP32_RTC_CLK_CAL_CYCLES 1024
|
||||
@ -87,7 +90,6 @@
|
||||
#define CONFIG_PARTITION_TABLE_SINGLE_APP 1
|
||||
#define CONFIG_ESP32_WIFI_RX_BA_WIN 6
|
||||
#define CONFIG_WIFI_ENABLED 1
|
||||
#define CONFIG_ESPTOOLPY_FLASHFREQ_80M 1
|
||||
#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 2048
|
||||
#define CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY 2000
|
||||
#define CONFIG_BROWNOUT_DET_LVL 0
|
||||
@ -113,6 +115,7 @@
|
||||
#define CONFIG_ESPTOOLPY_AFTER "hard_reset"
|
||||
#define CONFIG_LWIP_SO_REUSE 1
|
||||
#define CONFIG_DMA_TX_BUF_NUM 10
|
||||
#define CONFIG_WL_SECTOR_SIZE 4096
|
||||
#define CONFIG_TIMER_TASK_PRIORITY 1
|
||||
#define CONFIG_BT_ENABLED 1
|
||||
#define CONFIG_MONITOR_BAUD 115200
|
||||
@ -126,6 +129,7 @@
|
||||
#define CONFIG_CLASSIC_BT_ENABLED 1
|
||||
#define CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK 1
|
||||
#define CONFIG_OPENSSL_ASSERT_DO_NOTHING 1
|
||||
#define CONFIG_WL_SECTOR_SIZE_4096 1
|
||||
#define CONFIG_OPTIMIZATION_LEVEL_DEBUG 1
|
||||
#define CONFIG_SYSTEM_EVENT_QUEUE_SIZE 32
|
||||
#define CONFIG_BT_ACL_CONNECTIONS 4
|
||||
@ -138,5 +142,4 @@
|
||||
#define CONFIG_LWIP_SO_RCVBUF 1
|
||||
#define CONFIG_MONITOR_BAUD_OTHER_VAL 115200
|
||||
#define CONFIG_ESPTOOLPY_PORT "/dev/cu.usbserial-DO00EAB0"
|
||||
#define CONFIG_ESP32_PANIC_PRINT_HALT 1
|
||||
#define CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_ERROR 1
|
||||
|
@ -219,6 +219,14 @@ typedef enum {
|
||||
GPIO_FLOATING, /*!< Pad floating */
|
||||
} gpio_pull_mode_t;
|
||||
|
||||
typedef enum {
|
||||
GPIO_DRIVE_CAP_0 = 0, /*!< Pad drive capability: weak */
|
||||
GPIO_DRIVE_CAP_1 = 1, /*!< Pad drive capability: stronger */
|
||||
GPIO_DRIVE_CAP_2 = 2, /*!< Pad drive capability: default value */
|
||||
GPIO_DRIVE_CAP_DEFAULT = 2, /*!< Pad drive capability: default value */
|
||||
GPIO_DRIVE_CAP_3 = 3, /*!< Pad drive capability: strongest */
|
||||
GPIO_DRIVE_CAP_MAX,
|
||||
} gpio_drive_cap_t;
|
||||
|
||||
typedef void (*gpio_isr_t)(void*);
|
||||
typedef intr_handle_t gpio_isr_handle_t;
|
||||
@ -481,6 +489,29 @@ esp_err_t gpio_isr_handler_add(gpio_num_t gpio_num, gpio_isr_t isr_handler, void
|
||||
*/
|
||||
esp_err_t gpio_isr_handler_remove(gpio_num_t gpio_num);
|
||||
|
||||
/**
|
||||
* @brief Set GPIO pad drive capability
|
||||
*
|
||||
* @param gpio_num GPIO number, only support output GPIOs
|
||||
* @param strength Drive capability of the pad
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t gpio_set_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t strength);
|
||||
|
||||
/**
|
||||
* @brief Get GPIO pad drive capability
|
||||
*
|
||||
* @param gpio_num GPIO number, only support output GPIOs
|
||||
* @param strength Pointer to accept drive capability of the pad
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t gpio_get_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t* strength);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -40,6 +40,8 @@ typedef struct {
|
||||
uint32_t slpie; /*!< Mask of input enable in sleep mode */
|
||||
uint32_t hold; /*!< Mask of hold enable */
|
||||
uint32_t hold_force;/*!< Mask of hold_force bit for RTC IO in RTC_CNTL_HOLD_FORCE_REG */
|
||||
uint32_t drv_v; /*!< Mask of drive capability */
|
||||
uint32_t drv_s; /*!< Offset of drive capability */
|
||||
int rtc_num; /*!< RTC IO number, or -1 if not an RTC GPIO */
|
||||
} rtc_gpio_desc_t;
|
||||
|
||||
@ -232,6 +234,29 @@ esp_err_t rtc_gpio_hold_dis(gpio_num_t gpio_num);
|
||||
*/
|
||||
void rtc_gpio_force_hold_dis_all();
|
||||
|
||||
/**
|
||||
* @brief Set RTC GPIO pad drive capability
|
||||
*
|
||||
* @param gpio_num GPIO number, only support output GPIOs
|
||||
* @param strength Drive capability of the pad
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t rtc_gpio_set_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t strength);
|
||||
|
||||
/**
|
||||
* @brief Get RTC GPIO pad drive capability
|
||||
*
|
||||
* @param gpio_num GPIO number, only support output GPIOs
|
||||
* @param strength Pointer to accept drive capability of the pad
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t rtc_gpio_get_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t* strength);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -142,6 +142,8 @@ esp_err_t sdmmc_host_set_card_clk(int slot, uint32_t freq_khz);
|
||||
* can call sdmmc_host_do_transaction as long as other sdmmc_host_*
|
||||
* functions are not called.
|
||||
*
|
||||
* @attention Data buffer passed in cmdinfo->data must be in DMA capable memory
|
||||
*
|
||||
* @param slot slot number (SDMMC_HOST_SLOT_0 or SDMMC_HOST_SLOT_1)
|
||||
* @param cmdinfo pointer to structure describing command and data to transfer
|
||||
* @return
|
||||
@ -149,6 +151,8 @@ esp_err_t sdmmc_host_set_card_clk(int slot, uint32_t freq_khz);
|
||||
* - ESP_ERR_TIMEOUT if response or data transfer has timed out
|
||||
* - ESP_ERR_INVALID_CRC if response or data transfer CRC check has failed
|
||||
* - ESP_ERR_INVALID_RESPONSE if the card has sent an invalid response
|
||||
* - ESP_ERR_INVALID_SIZE if the size of data transfer is not valid in SD protocol
|
||||
* - ESP_ERR_INVALID_ARG if the data buffer is not in DMA capable memory
|
||||
*/
|
||||
esp_err_t sdmmc_host_do_transaction(int slot, sdmmc_command_t* cmdinfo);
|
||||
|
||||
|
@ -65,6 +65,7 @@
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_wifi_types.h"
|
||||
#include "esp_wifi_crypto_types.h"
|
||||
#include "esp_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -96,6 +97,7 @@ extern "C" {
|
||||
*/
|
||||
typedef struct {
|
||||
system_event_handler_t event_handler; /**< WiFi event handler */
|
||||
wpa_crypto_funcs_t wpa_crypto_funcs; /**< WiFi station crypto functions when connect */
|
||||
int static_rx_buf_num; /**< WiFi static RX buffer number */
|
||||
int dynamic_rx_buf_num; /**< WiFi dynamic RX buffer number */
|
||||
int tx_buf_type; /**< WiFi TX buffer type */
|
||||
@ -138,11 +140,14 @@ typedef struct {
|
||||
#else
|
||||
#define WIFI_NANO_FORMAT_ENABLED 0
|
||||
#endif
|
||||
|
||||
|
||||
extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
|
||||
|
||||
#define WIFI_INIT_CONFIG_MAGIC 0x1F2F3F4F
|
||||
#ifdef CONFIG_WIFI_ENABLED
|
||||
#define WIFI_INIT_CONFIG_DEFAULT() { \
|
||||
.event_handler = &esp_event_send, \
|
||||
.wpa_crypto_funcs = g_wifi_default_wpa_crypto_funcs, \
|
||||
.static_rx_buf_num = CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM,\
|
||||
.dynamic_rx_buf_num = CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM,\
|
||||
.tx_buf_type = CONFIG_ESP32_WIFI_TX_BUFFER_TYPE,\
|
||||
|
301
tools/sdk/include/esp32/esp_wifi_crypto_types.h
Normal file
301
tools/sdk/include/esp32/esp_wifi_crypto_types.h
Normal file
@ -0,0 +1,301 @@
|
||||
// Hardware crypto support Copyright 2017 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
#ifndef __ESP_WIFI_CRYPTO_TYPES_H__
|
||||
#define __ESP_WIFI_CRYPTO_TYPES_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This enumation is about alorigthm will be set when do crypt hash
|
||||
* operation.When do wpa2 connecting, after invoke crypto_hash_xxx of
|
||||
* fast_crypto_hash_xxx API, it will do relation crypt operation according
|
||||
* to the enumation.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_CRYPTO_HASH_ALG_MD5, ESP_CRYPTO_HASH_ALG_SHA1,
|
||||
ESP_CRYPTO_HASH_ALG_HMAC_MD5, ESP_CRYPTO_HASH_ALG_HMAC_SHA1,
|
||||
ESP_CRYPTO_HASH_ALG_SHA256, ESP_CRYPTO_HASH_ALG_HMAC_SHA256
|
||||
}esp_crypto_hash_alg_t;
|
||||
|
||||
/*
|
||||
* This enumation is about alorigthm will be set when do crypt cipher
|
||||
* operation.When do wpa2 connecting, after invoke crypto_cipher_xxx of
|
||||
* fast_crypto_cipher_xxx API, it will do relation crypt operation according
|
||||
* to the enumation.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_CRYPTO_CIPHER_NULL, ESP_CRYPTO_CIPHER_ALG_AES, ESP_CRYPTO_CIPHER_ALG_3DES,
|
||||
ESP_CRYPTO_CIPHER_ALG_DES, ESP_CRYPTO_CIPHER_ALG_RC2, ESP_CRYPTO_CIPHER_ALG_RC4
|
||||
} esp_crypto_cipher_alg_t;
|
||||
|
||||
/*
|
||||
* This structure is about the algorithm when do crypto_hash operation, for detail,
|
||||
* please reference to the structure crypto_hash.
|
||||
*/
|
||||
typedef struct crypto_hash esp_crypto_hash_t;
|
||||
|
||||
/*
|
||||
* This structure is about the algorithm when do crypto_cipher operation, for detail,
|
||||
* please reference to the structure crypto_cipher.
|
||||
*/
|
||||
typedef struct crypto_cipher esp_crypto_cipher_t;
|
||||
|
||||
/**
|
||||
* @brief The crypto callback function used in wpa enterprise hash operation when connect.
|
||||
* Initialize a esp_crypto_hash_t structure.
|
||||
*
|
||||
* @param alg Hash algorithm.
|
||||
* @param key Key for keyed hash (e.g., HMAC) or %NULL if not needed.
|
||||
* @param key_len Length of the key in bytes
|
||||
*
|
||||
*/
|
||||
typedef esp_crypto_hash_t * (*esp_crypto_hash_init_t)(esp_crypto_hash_alg_t alg, const unsigned char *key, int key_len);
|
||||
|
||||
/**
|
||||
* @brief The crypto callback function used in wpa enterprise hash operation when connect.
|
||||
* Add data to hash calculation.
|
||||
*
|
||||
* @param ctz Context pointer from esp_crypto_hash_init_t function.
|
||||
* @param data Data buffer to add.
|
||||
* @param len Length of the buffer.
|
||||
*
|
||||
*/
|
||||
typedef void * (*esp_crypto_hash_update_t)(esp_crypto_hash_t *ctx, const unsigned char *data, int len);
|
||||
|
||||
/**
|
||||
* @brief The crypto callback function used in wpa enterprise hash operation when connect.
|
||||
* Complete hash calculation.
|
||||
*
|
||||
* @param ctz Context pointer from esp_crypto_hash_init_t function.
|
||||
* @param hash Buffer for hash value or %NULL if caller is just freeing the hash
|
||||
* context.
|
||||
* @param len Pointer to length of the buffer or %NULL if caller is just freeing the
|
||||
* hash context; on return, this is set to the actual length of the hash value
|
||||
* Returns: 0 on success, -1 if buffer is too small (len set to needed length),
|
||||
* or -2 on other failures (including failed crypto_hash_update() operations)
|
||||
*
|
||||
*/
|
||||
typedef int * (*esp_crypto_hash_finish_t)(esp_crypto_hash_t *ctx, unsigned char *hash, int *len);
|
||||
|
||||
/**
|
||||
* @brief The AES callback function when do WPS connect.
|
||||
*
|
||||
* @param key Encryption key.
|
||||
* @param iv Encryption IV for CBC mode (16 bytes).
|
||||
* @param data Data to encrypt in-place.
|
||||
* @param data_len Length of data in bytes (must be divisible by 16)
|
||||
*/
|
||||
typedef int * (*esp_aes_128_encrypt_t)(const unsigned char *key, const unsigned char *iv, unsigned char *data, int data_len);
|
||||
|
||||
/**
|
||||
* @brief The AES callback function when do WPS connect.
|
||||
*
|
||||
* @param key Decryption key.
|
||||
* @param iv Decryption IV for CBC mode (16 bytes).
|
||||
* @param data Data to decrypt in-place.
|
||||
* @param data_len Length of data in bytes (must be divisible by 16)
|
||||
*
|
||||
*/
|
||||
typedef int * (*esp_aes_128_decrypt_t)(const unsigned char *key, const unsigned char *iv, unsigned char *data, int data_len);
|
||||
|
||||
/**
|
||||
* @brief The AES callback function when do STA connect.
|
||||
*
|
||||
* @param kek 16-octet Key encryption key (KEK).
|
||||
* @param n Length of the plaintext key in 64-bit units;
|
||||
* @param plain Plaintext key to be wrapped, n * 64 bits
|
||||
* @param cipher Wrapped key, (n + 1) * 64 bits
|
||||
*
|
||||
*/
|
||||
typedef int * (*esp_aes_wrap_t)(const unsigned char *kek, int n, const unsigned char *plain, unsigned char *cipher);
|
||||
|
||||
/**
|
||||
* @brief The AES callback function when do STA connect.
|
||||
*
|
||||
* @param kek 16-octet Key decryption key (KEK).
|
||||
* @param n Length of the plaintext key in 64-bit units;
|
||||
* @param cipher Wrapped key to be unwrapped, (n + 1) * 64 bits
|
||||
* @param plain Plaintext key, n * 64 bits
|
||||
*
|
||||
*/
|
||||
typedef int * (*esp_aes_unwrap_t)(const unsigned char *kek, int n, const unsigned char *cipher, unsigned char *plain);
|
||||
|
||||
/**
|
||||
* @brief The crypto callback function used in wpa enterprise cipher operation when connect.
|
||||
* Initialize a esp_crypto_cipher_t structure.
|
||||
*
|
||||
* @param alg cipher algorithm.
|
||||
* @param iv Initialization vector for block ciphers or %NULL for stream ciphers.
|
||||
* @param key Cipher key
|
||||
* @param key_len Length of key in bytes
|
||||
*
|
||||
*/
|
||||
typedef esp_crypto_cipher_t * (*esp_crypto_cipher_init_t)(esp_crypto_cipher_alg_t alg, const unsigned char *iv, const unsigned char *key, int key_len);
|
||||
|
||||
/**
|
||||
* @brief The crypto callback function used in wpa enterprise cipher operation when connect.
|
||||
* Cipher encrypt.
|
||||
*
|
||||
* @param ctx Context pointer from esp_crypto_cipher_init_t callback function.
|
||||
* @param plain Plaintext to cipher.
|
||||
* @param crypt Resulting ciphertext.
|
||||
* @param len Length of the plaintext.
|
||||
*
|
||||
*/
|
||||
typedef int * (*esp_crypto_cipher_encrypt_t)(esp_crypto_cipher_t *ctx,
|
||||
const unsigned char *plain, unsigned char *crypt, int len);
|
||||
/**
|
||||
* @brief The crypto callback function used in wpa enterprise cipher operation when connect.
|
||||
* Cipher decrypt.
|
||||
*
|
||||
* @param ctx Context pointer from esp_crypto_cipher_init_t callback function.
|
||||
* @param crypt Ciphertext to decrypt.
|
||||
* @param plain Resulting plaintext.
|
||||
* @param len Length of the cipher text.
|
||||
*
|
||||
*/
|
||||
typedef int * (*esp_crypto_cipher_decrypt_t)(esp_crypto_cipher_t *ctx,
|
||||
const unsigned char *crypt, unsigned char *plain, int len);
|
||||
/**
|
||||
* @brief The crypto callback function used in wpa enterprise cipher operation when connect.
|
||||
* Free cipher context.
|
||||
*
|
||||
* @param ctx Context pointer from esp_crypto_cipher_init_t callback function.
|
||||
*
|
||||
*/
|
||||
typedef void * (*esp_crypto_cipher_deinit_t)(esp_crypto_cipher_t *ctx);
|
||||
|
||||
/**
|
||||
* @brief The SHA256 callback function when do WPS connect.
|
||||
*
|
||||
* @param key Key for HMAC operations.
|
||||
* @param key_len Length of the key in bytes.
|
||||
* @param data Pointers to the data area.
|
||||
* @param data_len Length of the data area.
|
||||
* @param mac Buffer for the hash (20 bytes).
|
||||
*
|
||||
*/
|
||||
typedef void * (*esp_hmac_sha256_t)(const unsigned char *key, int key_len, const unsigned char *data,
|
||||
int data_len, unsigned char *mac);
|
||||
|
||||
/**
|
||||
* @brief The SHA256 callback function when do WPS connect.
|
||||
*
|
||||
* @param key Key for HMAC operations.
|
||||
* @param key_len Length of the key in bytes.
|
||||
* @param num_elem Number of elements in the data vector.
|
||||
* @param addr Pointers to the data areas.
|
||||
* @param len Lengths of the data blocks.
|
||||
* @param mac Buffer for the hash (32 bytes).
|
||||
*
|
||||
*/
|
||||
typedef void * (*esp_hmac_sha256_vector_t)(const unsigned char *key, int key_len, int num_elem,
|
||||
const unsigned char *addr[], const int *len, unsigned char *mac);
|
||||
|
||||
/**
|
||||
* @brief The AES callback function when do STA connect.
|
||||
*
|
||||
* @param key Key for PRF.
|
||||
* @param key_len Length of the key in bytes.
|
||||
* @param label A unique label for each purpose of the PRF.
|
||||
* @param data Extra data to bind into the key.
|
||||
* @param data_len Length of the data.
|
||||
* @param buf Buffer for the generated pseudo-random key.
|
||||
* @param buf_len Number of bytes of key to generate.
|
||||
*
|
||||
*/
|
||||
typedef void * (*esp_sha256_prf_t)(const unsigned char *key, int key_len, const char *label,
|
||||
const unsigned char *data, int data_len, unsigned char *buf, int buf_len);
|
||||
|
||||
/**
|
||||
* @brief The SHA256 callback function when do WPS connect.
|
||||
*
|
||||
* @param num_elem Number of elements in the data vector.
|
||||
* @param addr Pointers to the data areas.
|
||||
* @param len Lengths of the data blocks.
|
||||
* @param mac Buffer for the hash.
|
||||
*
|
||||
*/
|
||||
typedef int * (*esp_sha256_vector_t)(int num_elem, const unsigned char *addr[], const int *len,
|
||||
unsigned char *mac);
|
||||
|
||||
/**
|
||||
* @brief The bignum calculate callback function used when do connect.
|
||||
* In WPS process, it used to calculate public key and private key.
|
||||
*
|
||||
* @param base Base integer (big endian byte array).
|
||||
* @param base_len Length of base integer in bytes.
|
||||
* @param power Power integer (big endian byte array).
|
||||
* @param power_len Length of power integer in bytes.
|
||||
* @param modulus Modulus integer (big endian byte array).
|
||||
* @param modulus_len Length of modulus integer in bytes.
|
||||
* @param result Buffer for the result.
|
||||
* @param result_len Result length (max buffer size on input, real len on output).
|
||||
*
|
||||
*/
|
||||
typedef int * (*esp_crypto_mod_exp_t)(const unsigned char *base, int base_len,
|
||||
const unsigned char *power, int power_len,
|
||||
const unsigned char *modulus, int modulus_len,
|
||||
unsigned char *result, unsigned int *result_len);
|
||||
/**
|
||||
* @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
|
||||
* hardware.
|
||||
*/
|
||||
typedef struct {
|
||||
esp_aes_wrap_t aes_wrap; /**< station connect function used when send EAPOL frame */
|
||||
esp_aes_unwrap_t aes_unwrap; /**< station connect function used when decrypt key data */
|
||||
esp_hmac_sha256_vector_t hmac_sha256_vector; /**< station connect function used when check MIC */
|
||||
esp_sha256_prf_t sha256_prf; /**< station connect function used when check MIC */
|
||||
}wpa_crypto_funcs_t;
|
||||
|
||||
/**
|
||||
* @brief The crypto callback function structure used when do WPS process. The
|
||||
* structure can be set as software crypto or the crypto optimized by ESP32
|
||||
* hardware.
|
||||
*/
|
||||
typedef struct{
|
||||
esp_aes_128_encrypt_t aes_128_encrypt; /**< function used to process message when do WPS */
|
||||
esp_aes_128_decrypt_t aes_128_decrypt; /**< function used to process message when do WPS */
|
||||
esp_crypto_mod_exp_t crypto_mod_exp; /**< function used to calculate public key and private key */
|
||||
esp_hmac_sha256_t hmac_sha256; /**< function used to get attribute */
|
||||
esp_hmac_sha256_vector_t hmac_sha256_vector; /**< function used to process message when do WPS */
|
||||
esp_sha256_vector_t sha256_vector; /**< function used to process message when do WPS */
|
||||
}wps_crypto_funcs_t;
|
||||
|
||||
/**
|
||||
* @brief The crypto callback function structure used when do WPA enterprise connect.
|
||||
* The structure can be set as software crypto or the crypto optimized by ESP32
|
||||
* hardware.
|
||||
*/
|
||||
typedef struct {
|
||||
esp_crypto_hash_init_t crypto_hash_init; /**< function used to initialize a crypto_hash structure when use TLSV1 */
|
||||
esp_crypto_hash_update_t crypto_hash_update; /**< function used to calculate hash data when use TLSV1 */
|
||||
esp_crypto_hash_finish_t crypto_hash_finish; /**< function used to finish the hash calculate when use TLSV1 */
|
||||
esp_crypto_cipher_init_t crypto_cipher_init; /**< function used to initialize a crypt_cipher structure when use TLSV1 */
|
||||
esp_crypto_cipher_encrypt_t crypto_cipher_encrypt; /**< function used to encrypt cipher when use TLSV1 */
|
||||
esp_crypto_cipher_decrypt_t crypto_cipher_decrypt; /**< function used to decrypt cipher when use TLSV1 */
|
||||
esp_crypto_cipher_deinit_t crypto_cipher_deinit; /**< function used to free context when use TLSV1 */
|
||||
esp_sha256_vector_t sha256_vector; /**< function used to do X.509v3 certificate parsing and processing */
|
||||
esp_crypto_mod_exp_t crypto_mod_exp; /**< function used to do key exchange when use TLSV1 */
|
||||
}wpa2_crypto_funcs_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
// Hardware crypto support Copyright 2017 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
@ -16,11 +16,22 @@
|
||||
#define ESP_WPA2_H
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "esp_wifi_crypto_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const wpa2_crypto_funcs_t g_wifi_default_wpa2_crypto_funcs;
|
||||
|
||||
typedef struct {
|
||||
const wpa2_crypto_funcs_t *crypto_funcs;
|
||||
}esp_wpa2_config_t;
|
||||
|
||||
#define WPA2_CONFIG_INIT_DEFAULT() { \
|
||||
.crypto_funcs = &g_wifi_default_wpa2_crypto_funcs \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable wpa2 enterprise authentication.
|
||||
*
|
||||
@ -31,7 +42,7 @@ extern "C" {
|
||||
* - ESP_ERR_WIFI_OK: succeed.
|
||||
* - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail)
|
||||
*/
|
||||
esp_err_t esp_wifi_sta_wpa2_ent_enable(void);
|
||||
esp_err_t esp_wifi_sta_wpa2_ent_enable(const esp_wpa2_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief Disable wpa2 enterprise authentication.
|
||||
|
@ -15,8 +15,10 @@
|
||||
#ifndef __ESP_WPS_H__
|
||||
#define __ESP_WPS_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "esp_err.h"
|
||||
#include "esp_wifi_crypto_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -52,6 +54,18 @@ typedef enum wps_type {
|
||||
WPS_TYPE_MAX,
|
||||
} wps_type_t;
|
||||
|
||||
extern const wps_crypto_funcs_t g_wifi_default_wps_crypto_funcs;
|
||||
|
||||
typedef struct {
|
||||
wps_type_t wps_type;
|
||||
const wps_crypto_funcs_t *crypto_funcs;
|
||||
}esp_wps_config_t;
|
||||
|
||||
#define WPS_CONFIG_INIT_DEFAULT(type) { \
|
||||
.wps_type = type, \
|
||||
.crypto_funcs = &g_wifi_default_wps_crypto_funcs, \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable Wi-Fi WPS function.
|
||||
*
|
||||
@ -65,7 +79,7 @@ typedef enum wps_type {
|
||||
* - ESP_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on
|
||||
* - ESP_ERR_WIFI_FAIL : wps initialization fails
|
||||
*/
|
||||
esp_err_t esp_wifi_wps_enable(wps_type_t wps_type);
|
||||
esp_err_t esp_wifi_wps_enable(const esp_wps_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief Disable Wi-Fi WPS function and release resource it taken.
|
||||
|
@ -129,6 +129,9 @@ esp_err_t esp_ota_set_boot_partition(const esp_partition_t* partition);
|
||||
* If esp_ota_set_boot_partition() has not been called, the result is
|
||||
* equivalent to esp_ota_get_running_partition().
|
||||
*
|
||||
* Note that there is no guarantee the returned partition is a valid app. Use esp_image_load(ESP_IMAGE_VERIFY, ...) to verify if the
|
||||
* partition contains a bootable image.
|
||||
*
|
||||
* @return Pointer to info for partition structure, or NULL if no partition is found or flash read operation failed. Returned pointer is valid for the lifetime of the application.
|
||||
*/
|
||||
const esp_partition_t* esp_ota_get_boot_partition(void);
|
||||
@ -142,6 +145,9 @@ const esp_partition_t* esp_ota_get_boot_partition(void);
|
||||
* esp_ota_set_boot_partition(). Only the app whose code is currently
|
||||
* running will have its partition information returned.
|
||||
*
|
||||
* The partition returned by this function may also differ from esp_ota_get_boot_partition() if the configured boot
|
||||
* partition is somehow invalid, and the bootloader fell back to a different app partition at boot.
|
||||
*
|
||||
* @return Pointer to info for partition structure, or NULL if no partition is found or flash read operation failed. Returned pointer is valid for the lifetime of the application.
|
||||
*/
|
||||
const esp_partition_t* esp_ota_get_running_partition(void);
|
||||
|
@ -44,5 +44,10 @@ int __must_check aes_128_cbc_encrypt(const u8 *key, const u8 *iv, u8 *data,
|
||||
size_t data_len);
|
||||
int __must_check aes_128_cbc_decrypt(const u8 *key, const u8 *iv, u8 *data,
|
||||
size_t data_len);
|
||||
|
||||
int __must_check fast_aes_wrap(const uint8_t *kek, int n, const uint8_t *plain, uint8_t *cipher);
|
||||
int __must_check fast_aes_unwrap(const uint8_t *kek, int n, const uint8_t *cipher, uint8_t *plain);
|
||||
int __must_check fast_aes_128_cbc_encrypt(const uint8_t *key, const uint8_t *iv, uint8_t *data,
|
||||
size_t data_len);
|
||||
int __must_check fast_aes_128_cbc_decrypt(const uint8_t *key, const uint8_t *iv, uint8_t *data,
|
||||
size_t data_len);
|
||||
#endif /* AES_WRAP_H */
|
||||
|
@ -100,6 +100,17 @@ int __must_check fips186_2_prf(const u8 *seed, size_t seed_len, u8 *x,
|
||||
int sha256_vector(size_t num_elem, const u8 *addr[], const size_t *len,
|
||||
u8 *mac);
|
||||
|
||||
/**
|
||||
* fast_sha256_vector - fast 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 on failure
|
||||
*/
|
||||
int fast_sha256_vector(size_t num_elem, const uint8_t *addr[], const size_t *len,
|
||||
uint8_t *mac);
|
||||
|
||||
/**
|
||||
* des_encrypt - Encrypt one block with DES
|
||||
* @clear: 8 octets (in)
|
||||
@ -159,7 +170,6 @@ enum crypto_hash_alg {
|
||||
CRYPTO_HASH_ALG_SHA256, CRYPTO_HASH_ALG_HMAC_SHA256
|
||||
};
|
||||
|
||||
|
||||
struct crypto_hash;
|
||||
|
||||
/**
|
||||
@ -177,6 +187,21 @@ struct crypto_hash;
|
||||
struct crypto_hash * crypto_hash_init(enum crypto_hash_alg alg, const u8 *key,
|
||||
size_t key_len);
|
||||
|
||||
/**
|
||||
* fast_crypto_hash_init - Initialize hash/HMAC function
|
||||
* @alg: Hash algorithm
|
||||
* @key: Key for keyed hash (e.g., HMAC) or %NULL if not needed
|
||||
* @key_len: Length of the key in bytes
|
||||
* Returns: Pointer to hash context to use with other hash functions or %NULL
|
||||
* on failure
|
||||
*
|
||||
* This function is only used with internal TLSv1 implementation
|
||||
* (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need
|
||||
* to implement this.
|
||||
*/
|
||||
struct crypto_hash * fast_crypto_hash_init(enum crypto_hash_alg alg, const uint8_t *key,
|
||||
size_t key_len);
|
||||
|
||||
/**
|
||||
* crypto_hash_update - Add data to hash calculation
|
||||
* @ctx: Context pointer from crypto_hash_init()
|
||||
@ -189,6 +214,18 @@ struct crypto_hash * crypto_hash_init(enum crypto_hash_alg alg, const u8 *key,
|
||||
*/
|
||||
void crypto_hash_update(struct crypto_hash *ctx, const u8 *data, size_t len);
|
||||
|
||||
/**
|
||||
* fast_crypto_hash_update - Add data to hash calculation
|
||||
* @ctx: Context pointer from crypto_hash_init()
|
||||
* @data: Data buffer to add
|
||||
* @len: Length of the buffer
|
||||
*
|
||||
* This function is only used with internal TLSv1 implementation
|
||||
* (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need
|
||||
* to implement this.
|
||||
*/
|
||||
void fast_crypto_hash_update(struct crypto_hash *ctx, const uint8_t *data, size_t len);
|
||||
|
||||
/**
|
||||
* crypto_hash_finish - Complete hash calculation
|
||||
* @ctx: Context pointer from crypto_hash_init()
|
||||
@ -208,6 +245,25 @@ void crypto_hash_update(struct crypto_hash *ctx, const u8 *data, size_t len);
|
||||
*/
|
||||
int crypto_hash_finish(struct crypto_hash *ctx, u8 *hash, size_t *len);
|
||||
|
||||
/**
|
||||
* fast_crypto_hash_finish - Complete hash calculation
|
||||
* @ctx: Context pointer from crypto_hash_init()
|
||||
* @hash: Buffer for hash value or %NULL if caller is just freeing the hash
|
||||
* context
|
||||
* @len: Pointer to length of the buffer or %NULL if caller is just freeing the
|
||||
* hash context; on return, this is set to the actual length of the hash value
|
||||
* Returns: 0 on success, -1 if buffer is too small (len set to needed length),
|
||||
* or -2 on other failures (including failed crypto_hash_update() operations)
|
||||
*
|
||||
* This function calculates the hash value and frees the context buffer that
|
||||
* was used for hash calculation.
|
||||
*
|
||||
* This function is only used with internal TLSv1 implementation
|
||||
* (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need
|
||||
* to implement this.
|
||||
*/
|
||||
int fast_crypto_hash_finish(struct crypto_hash *ctx, uint8_t *hash, size_t *len);
|
||||
|
||||
|
||||
enum crypto_cipher_alg {
|
||||
CRYPTO_CIPHER_NULL = 0, CRYPTO_CIPHER_ALG_AES, CRYPTO_CIPHER_ALG_3DES,
|
||||
@ -233,6 +289,22 @@ struct crypto_cipher * crypto_cipher_init(enum crypto_cipher_alg alg,
|
||||
const u8 *iv, const u8 *key,
|
||||
size_t key_len);
|
||||
|
||||
/**
|
||||
* fast_crypto_cipher_init - Initialize block/stream cipher function
|
||||
* @alg: Cipher algorithm
|
||||
* @iv: Initialization vector for block ciphers or %NULL for stream ciphers
|
||||
* @key: Cipher key
|
||||
* @key_len: Length of key in bytes
|
||||
* Returns: Pointer to cipher context to use with other cipher functions or
|
||||
* %NULL on failure
|
||||
*
|
||||
* This function is only used with internal TLSv1 implementation
|
||||
* (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need
|
||||
* to implement this.
|
||||
*/
|
||||
struct crypto_cipher * fast_crypto_cipher_init(enum crypto_cipher_alg alg,
|
||||
const uint8_t *iv, const uint8_t *key,
|
||||
size_t key_len);
|
||||
/**
|
||||
* crypto_cipher_encrypt - Cipher encrypt
|
||||
* @ctx: Context pointer from crypto_cipher_init()
|
||||
@ -248,6 +320,21 @@ struct crypto_cipher * crypto_cipher_init(enum crypto_cipher_alg alg,
|
||||
int __must_check crypto_cipher_encrypt(struct crypto_cipher *ctx,
|
||||
const u8 *plain, u8 *crypt, size_t len);
|
||||
|
||||
/**
|
||||
* fast_crypto_cipher_encrypt - Cipher encrypt
|
||||
* @ctx: Context pointer from crypto_cipher_init()
|
||||
* @plain: Plaintext to cipher
|
||||
* @crypt: Resulting ciphertext
|
||||
* @len: Length of the plaintext
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*
|
||||
* This function is only used with internal TLSv1 implementation
|
||||
* (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need
|
||||
* to implement this.
|
||||
*/
|
||||
int __must_check fast_crypto_cipher_encrypt(struct crypto_cipher *ctx,
|
||||
const uint8_t *plain, uint8_t *crypt, size_t len);
|
||||
|
||||
/**
|
||||
* crypto_cipher_decrypt - Cipher decrypt
|
||||
* @ctx: Context pointer from crypto_cipher_init()
|
||||
@ -263,6 +350,21 @@ int __must_check crypto_cipher_encrypt(struct crypto_cipher *ctx,
|
||||
int __must_check crypto_cipher_decrypt(struct crypto_cipher *ctx,
|
||||
const u8 *crypt, u8 *plain, size_t len);
|
||||
|
||||
/**
|
||||
* fast_crypto_cipher_decrypt - Cipher decrypt
|
||||
* @ctx: Context pointer from crypto_cipher_init()
|
||||
* @crypt: Ciphertext to decrypt
|
||||
* @plain: Resulting plaintext
|
||||
* @len: Length of the cipher text
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*
|
||||
* This function is only used with internal TLSv1 implementation
|
||||
* (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need
|
||||
* to implement this.
|
||||
*/
|
||||
int __must_check fast_crypto_cipher_decrypt(struct crypto_cipher *ctx,
|
||||
const uint8_t *crypt, uint8_t *plain, size_t len);
|
||||
|
||||
/**
|
||||
* crypto_cipher_decrypt - Free cipher context
|
||||
* @ctx: Context pointer from crypto_cipher_init()
|
||||
@ -273,6 +375,15 @@ int __must_check crypto_cipher_decrypt(struct crypto_cipher *ctx,
|
||||
*/
|
||||
void crypto_cipher_deinit(struct crypto_cipher *ctx);
|
||||
|
||||
/**
|
||||
* fast_crypto_cipher_decrypt - Free cipher context
|
||||
* @ctx: Context pointer from crypto_cipher_init()
|
||||
*
|
||||
* This function is only used with internal TLSv1 implementation
|
||||
* (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need
|
||||
* to implement this.
|
||||
*/
|
||||
void fast_crypto_cipher_deinit(struct crypto_cipher *ctx);
|
||||
|
||||
struct crypto_public_key;
|
||||
struct crypto_private_key;
|
||||
@ -452,6 +563,31 @@ int __must_check crypto_mod_exp(const u8 *base, size_t base_len,
|
||||
const u8 *modulus, size_t modulus_len,
|
||||
u8 *result, size_t *result_len);
|
||||
|
||||
/**
|
||||
* fast_crypto_mod_exp - Modular exponentiation of large integers
|
||||
* @base: Base integer (big endian byte array)
|
||||
* @base_len: Length of base integer in bytes
|
||||
* @power: Power integer (big endian byte array)
|
||||
* @power_len: Length of power integer in bytes
|
||||
* @modulus: Modulus integer (big endian byte array)
|
||||
* @modulus_len: Length of modulus integer in bytes
|
||||
* @result: Buffer for the result
|
||||
* @result_len: Result length (max buffer size on input, real len on output)
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*
|
||||
* This function calculates result = base ^ power mod modulus. modules_len is
|
||||
* used as the maximum size of modulus buffer. It is set to the used size on
|
||||
* success.
|
||||
*
|
||||
* This function is only used with internal TLSv1 implementation
|
||||
* (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need
|
||||
* to implement this.
|
||||
*/
|
||||
int __must_check 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);
|
||||
|
||||
/**
|
||||
* rc4_skip - XOR RC4 stream to given data with skip-stream-start
|
||||
* @key: RC4 key
|
||||
|
@ -24,4 +24,10 @@ void hmac_sha256(const u8 *key, size_t key_len, const u8 *data,
|
||||
void 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);
|
||||
|
||||
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);
|
||||
void fast_hmac_sha256(const uint8_t *key, size_t key_len, const uint8_t *data,
|
||||
size_t data_len, uint8_t *mac);
|
||||
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 /* SHA256_H */
|
||||
|
Reference in New Issue
Block a user