IDF master cf457d412 (#5073)
esp-dsp: master 7cc5073 esp-face: master 420fc7e esp-rainmaker: f1b82c7 esp32-camera: master 2dded7c esp_littlefs: master d268e18
This commit is contained in:
parent
11f89cddf6
commit
5d9b98c9b0
File diff suppressed because one or more lines are too long
@ -110,6 +110,7 @@ env.Append(
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "freertos", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "freertos", "port", "xtensa", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_hw_support", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_hw_support", "include", "soc"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_hw_support", "port", "esp32"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "heap", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "log", "include"),
|
||||
@ -127,6 +128,8 @@ env.Append(
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_rom", "esp32"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_common", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_system", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_system", "port", "soc"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_system", "port", "public_compat"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp32", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "driver", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "driver", "esp32", "include"),
|
||||
@ -158,6 +161,7 @@ env.Append(
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_gdbstub", "xtensa"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_gdbstub", "esp32"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "espcoredump", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "espcoredump", "include", "port", "xtensa"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "wpa_supplicant", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "wpa_supplicant", "port", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "wpa_supplicant", "include", "esp_supplicant"),
|
||||
@ -273,7 +277,7 @@ env.Append(
|
||||
"UNITY_INCLUDE_CONFIG_H",
|
||||
"WITH_POSIX",
|
||||
"_GNU_SOURCE",
|
||||
("IDF_VER", '\\"v4.4-dev-744-g1cb31e509\\"'),
|
||||
("IDF_VER", '\\"v4.4-dev-960-gcf457d412\\"'),
|
||||
"ESP_PLATFORM",
|
||||
"ARDUINO_ARCH_ESP32",
|
||||
"ESP32",
|
||||
|
@ -71,7 +71,6 @@ env.Append(
|
||||
],
|
||||
|
||||
LINKFLAGS=[
|
||||
"-mlongcalls",
|
||||
"-nostartfiles",
|
||||
"-march=rv32imc",
|
||||
"--specs=nosys.specs",
|
||||
@ -111,6 +110,7 @@ env.Append(
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "freertos", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "freertos", "port", "riscv", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp_hw_support", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp_hw_support", "include", "soc"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp_hw_support", "port", "esp32c3"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp_hw_support", "port", "esp32c3", "private_include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "heap", "include"),
|
||||
@ -129,6 +129,8 @@ env.Append(
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp_rom", "esp32c3"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp_common", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp_system", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp_system", "port", "soc"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp_system", "port", "public_compat"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp32c3", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "driver", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "driver", "esp32c3", "include"),
|
||||
@ -158,6 +160,7 @@ env.Append(
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp_gdbstub", "riscv"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp_gdbstub", "esp32c3"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "espcoredump", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "espcoredump", "include", "port", "riscv"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "wpa_supplicant", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "wpa_supplicant", "port", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "wpa_supplicant", "include", "esp_supplicant"),
|
||||
@ -234,7 +237,7 @@ env.Append(
|
||||
"UNITY_INCLUDE_CONFIG_H",
|
||||
"WITH_POSIX",
|
||||
"_GNU_SOURCE",
|
||||
("IDF_VER", '\\"v4.4-dev-744-g1cb31e509\\"'),
|
||||
("IDF_VER", '\\"v4.4-dev-960-gcf457d412\\"'),
|
||||
"ESP_PLATFORM",
|
||||
"ARDUINO_ARCH_ESP32",
|
||||
"ESP32",
|
||||
|
@ -106,6 +106,7 @@ env.Append(
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "freertos", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "freertos", "port", "xtensa", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_hw_support", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_hw_support", "include", "soc"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_hw_support", "port", "esp32s2"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_hw_support", "port", "esp32s2", "private_include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "heap", "include"),
|
||||
@ -124,6 +125,8 @@ env.Append(
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_rom", "esp32s2"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_common", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_system", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_system", "port", "soc"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_system", "port", "public_compat"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp32s2", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "driver", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "driver", "esp32s2", "include"),
|
||||
@ -155,6 +158,7 @@ env.Append(
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_gdbstub", "xtensa"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_gdbstub", "esp32s2"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "espcoredump", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "espcoredump", "include", "port", "xtensa"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "wpa_supplicant", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "wpa_supplicant", "port", "include"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "wpa_supplicant", "include", "esp_supplicant"),
|
||||
@ -262,7 +266,7 @@ env.Append(
|
||||
"UNITY_INCLUDE_CONFIG_H",
|
||||
"WITH_POSIX",
|
||||
"_GNU_SOURCE",
|
||||
("IDF_VER", '\\"v4.4-dev-744-g1cb31e509\\"'),
|
||||
("IDF_VER", '\\"v4.4-dev-960-gcf457d412\\"'),
|
||||
"ESP_PLATFORM",
|
||||
"ARDUINO_ARCH_ESP32",
|
||||
"ESP32",
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -301,6 +301,7 @@ typedef void (* esp_blufi_event_cb_t)(esp_blufi_cb_event_t event, esp_blufi_cb_p
|
||||
* @param len : length of data from phone
|
||||
* @param output_data : data want to send to phone
|
||||
* @param output_len : length of data want to send to phone
|
||||
* @param need_free : output reporting if memory needs to be freed or not *
|
||||
*/
|
||||
typedef void (*esp_blufi_negotiate_data_handler_t)(uint8_t *data, int len, uint8_t **output_data, int *output_len, bool *need_free);
|
||||
|
||||
@ -311,7 +312,7 @@ typedef void (*esp_blufi_negotiate_data_handler_t)(uint8_t *data, int len, uint8
|
||||
* @param crypt_len : length of plain text
|
||||
* @return Nonnegative number is encrypted length, if error, return negative number;
|
||||
*/
|
||||
typedef int (* esp_blufi_encrypt_func_t)(uint8_t iv8, uint8_t *crypt_data, int cyprt_len);
|
||||
typedef int (* esp_blufi_encrypt_func_t)(uint8_t iv8, uint8_t *crypt_data, int crypt_len);
|
||||
|
||||
/**
|
||||
* @brief BLUFI decrypt the data after negotiate a share key
|
||||
|
@ -259,7 +259,7 @@ typedef union {
|
||||
/**
|
||||
* @brief GATT Client callback function type
|
||||
* @param event : Event type
|
||||
* @param gatts_if : GATT client access interface, normally
|
||||
* @param gattc_if : GATT client access interface, normally
|
||||
* different gattc_if correspond to different profile
|
||||
* @param param : Point to callback parameter, currently is union type
|
||||
*/
|
||||
|
@ -188,7 +188,7 @@ typedef void (* esp_hf_incoming_data_cb_t)(const uint8_t *buf, uint32_t len);
|
||||
*
|
||||
* @param[in] len : size(in bytes) in buf
|
||||
*
|
||||
* @param[out] length of data successfully read
|
||||
* @return length of data successfully read
|
||||
*/
|
||||
typedef uint32_t (* esp_hf_outgoing_data_cb_t) (uint8_t *buf, uint32_t len);
|
||||
|
||||
|
@ -273,7 +273,7 @@ typedef void (* esp_hf_client_incoming_data_cb_t)(const uint8_t *buf, uint32_t l
|
||||
*
|
||||
* @param[in] len : size(in bytes) in buf
|
||||
*
|
||||
* @param[out] length of data successfully read
|
||||
* @return length of data successfully read
|
||||
*
|
||||
*/
|
||||
typedef uint32_t (* esp_hf_client_outgoing_data_cb_t)(uint8_t *buf, uint32_t len);
|
||||
|
@ -196,15 +196,12 @@
|
||||
#define CONFIG_PICO_PSRAM_CS_IO 10
|
||||
#define CONFIG_SPIRAM_SPIWP_SD3_PIN 7
|
||||
#define CONFIG_ESP32_TRACEMEM_RESERVE_DRAM 0x0
|
||||
#define CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR 1
|
||||
#define CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES 4
|
||||
#define CONFIG_ESP32_ULP_COPROC_ENABLED 1
|
||||
#define CONFIG_ESP32_ULP_COPROC_RESERVE_MEM 512
|
||||
#define CONFIG_ESP32_DEBUG_OCDAWARE 1
|
||||
#define CONFIG_ESP32_BROWNOUT_DET 1
|
||||
#define CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0 1
|
||||
#define CONFIG_ESP32_BROWNOUT_DET_LVL 0
|
||||
#define CONFIG_ESP32_REDUCE_PHY_TX_POWER 1
|
||||
#define CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 1
|
||||
#define CONFIG_ESP32_RTC_CLK_SRC_INT_RC 1
|
||||
#define CONFIG_ESP32_RTC_CLK_CAL_CYCLES 1024
|
||||
@ -239,6 +236,8 @@
|
||||
#define CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP 1
|
||||
#define CONFIG_ESP_MAC_ADDR_UNIVERSE_BT 1
|
||||
#define CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH 1
|
||||
#define CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR 1
|
||||
#define CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES 4
|
||||
#define CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL 120
|
||||
#define CONFIG_ESP_NETIF_TCPIP_LWIP 1
|
||||
#define CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER 1
|
||||
@ -286,6 +285,7 @@
|
||||
#define CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE 1
|
||||
#define CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER 20
|
||||
#define CONFIG_ESP32_PHY_MAX_TX_POWER 20
|
||||
#define CONFIG_ESP32_REDUCE_PHY_TX_POWER 1
|
||||
#define CONFIG_ESP_COREDUMP_ENABLE_TO_NONE 1
|
||||
#define CONFIG_FATFS_CODEPAGE_850 1
|
||||
#define CONFIG_FATFS_CODEPAGE 850
|
||||
@ -391,8 +391,6 @@
|
||||
#define CONFIG_LWIP_MAX_RAW_PCBS 16
|
||||
#define CONFIG_LWIP_DHCP_MAX_NTP_SERVERS 1
|
||||
#define CONFIG_LWIP_SNTP_UPDATE_DELAY 3600000
|
||||
#define CONFIG_LCP_ECHOINTERVAL 0
|
||||
#define CONFIG_LCP_MAXECHOFAILS 3
|
||||
#define CONFIG_LWIP_ESP_LWIP_ASSERT 1
|
||||
#define CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT 1
|
||||
#define CONFIG_LWIP_HOOK_IP6_ROUTE_NONE 1
|
||||
@ -654,5 +652,5 @@
|
||||
#define CONFIG_ULP_COPROC_ENABLED CONFIG_ESP32_ULP_COPROC_ENABLED
|
||||
#define CONFIG_ULP_COPROC_RESERVE_MEM CONFIG_ESP32_ULP_COPROC_RESERVE_MEM
|
||||
#define CONFIG_WARN_WRITE_STRINGS CONFIG_COMPILER_WARN_WRITE_STRINGS
|
||||
#define CONFIG_ARDUINO_IDF_COMMIT "1cb31e509"
|
||||
#define CONFIG_ARDUINO_IDF_COMMIT "cf457d412"
|
||||
#define CONFIG_ARDUINO_IDF_BRANCH "master"
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include "esp_attr.h"
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
#if SOC_DEDICATED_GPIO_SUPPORTED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -171,3 +173,5 @@ esp_err_t dedic_gpio_bundle_set_interrupt_and_callback(dedic_gpio_bundle_handle_
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //SOC_DEDICATED_GPIO_SUPPORTED
|
||||
|
@ -3,7 +3,7 @@
|
||||
// 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
|
||||
@ -494,28 +494,6 @@ esp_err_t gpio_sleep_set_direction(gpio_num_t gpio_num, gpio_mode_t mode);
|
||||
* - ESP_ERR_INVALID_ARG : Parameter error
|
||||
*/
|
||||
esp_err_t gpio_sleep_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull);
|
||||
|
||||
#if CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
|
||||
/**
|
||||
* @brief Emulate ESP32S2 behaviour to backup FUN_PU, FUN_PD information
|
||||
*
|
||||
* @note Need to be called before sleep.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
*/
|
||||
esp_err_t gpio_sleep_pupd_config_apply(gpio_num_t gpio_num);
|
||||
|
||||
/**
|
||||
* @brief Emulate ESP32S2 behaviour to restore FUN_PU, FUN_PD information
|
||||
*
|
||||
* @note Need to be called after sleep.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
*/
|
||||
esp_err_t gpio_sleep_pupd_config_unapply(gpio_num_t gpio_num);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP
|
||||
|
@ -33,9 +33,39 @@ extern "C" {
|
||||
|
||||
#define I2C_APB_CLK_FREQ APB_CLK_FREQ /*!< I2C source clock is APB clock, 80MHz */
|
||||
|
||||
#define I2C_NUM_0 (0) /*!< I2C port 0 */
|
||||
#define I2C_NUM_1 (1) /*!< I2C port 1 */
|
||||
#define I2C_NUM_MAX (SOC_I2C_NUM) /*!< I2C port max */
|
||||
#define I2C_NUM_0 (0) /*!< I2C port 0 */
|
||||
#if SOC_I2C_NUM >= 2
|
||||
#define I2C_NUM_1 (1) /*!< I2C port 1 */
|
||||
#endif
|
||||
|
||||
// I2C clk flags for users to use, can be expanded in the future.
|
||||
#define I2C_SCLK_SRC_FLAG_FOR_NOMAL (0) /*!< Any one clock source that is available for the specified frequency may be choosen*/
|
||||
#define I2C_SCLK_SRC_FLAG_AWARE_DFS (1 << 0) /*!< For REF tick clock, it won't change with APB.*/
|
||||
#define I2C_SCLK_SRC_FLAG_LIGHT_SLEEP (1 << 1) /*!< For light sleep mode.*/
|
||||
|
||||
/**
|
||||
* @brief I2C initialization parameters
|
||||
*/
|
||||
typedef struct{
|
||||
i2c_mode_t mode; /*!< I2C mode */
|
||||
int sda_io_num; /*!< GPIO number for I2C sda signal */
|
||||
int scl_io_num; /*!< GPIO number for I2C scl signal */
|
||||
bool sda_pullup_en; /*!< Internal GPIO pull mode for I2C sda signal*/
|
||||
bool scl_pullup_en; /*!< Internal GPIO pull mode for I2C scl signal*/
|
||||
|
||||
union {
|
||||
struct {
|
||||
uint32_t clk_speed; /*!< I2C clock frequency for master mode, (no higher than 1MHz for now) */
|
||||
} master; /*!< I2C master config */
|
||||
struct {
|
||||
uint8_t addr_10bit_en; /*!< I2C 10bit address mode enable for slave mode */
|
||||
uint16_t slave_addr; /*!< I2C address for slave mode */
|
||||
} slave; /*!< I2C slave config */
|
||||
};
|
||||
uint32_t clk_flags; /*!< Bitwise of ``I2C_SCLK_SRC_FLAG_**FOR_DFS**`` for clk source choice*/
|
||||
} i2c_config_t;
|
||||
|
||||
|
||||
typedef void *i2c_cmd_handle_t; /*!< I2C command handle */
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "hal/i2s_types.h"
|
||||
#include "driver/periph_ctrl.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
|
||||
#if SOC_I2S_SUPPORTS_ADC_DAC
|
||||
#include "driver/adc.h"
|
||||
#endif
|
||||
@ -82,21 +83,6 @@ esp_err_t i2s_set_pin(i2s_port_t i2s_num, const i2s_pin_config_t *pin);
|
||||
esp_err_t i2s_set_pdm_rx_down_sample(i2s_port_t i2s_num, i2s_pdm_dsr_t dsr);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Set I2S dac mode, I2S built-in DAC is disabled by default
|
||||
*
|
||||
* @param dac_mode DAC mode configurations - see i2s_dac_mode_t
|
||||
*
|
||||
* @note Built-in DAC functions are only supported on I2S0 for current ESP32 chip.
|
||||
* If either of the built-in DAC channel are enabled, the other one can not
|
||||
* be used as RTC DAC function at the same time.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t i2s_set_dac_mode(i2s_dac_mode_t dac_mode);
|
||||
|
||||
/**
|
||||
* @brief Install and start I2S driver.
|
||||
*
|
||||
@ -331,7 +317,23 @@ esp_err_t i2s_adc_enable(i2s_port_t i2s_num);
|
||||
* - ESP_ERR_INVALID_STATE Driver state error
|
||||
*/
|
||||
esp_err_t i2s_adc_disable(i2s_port_t i2s_num);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Set I2S dac mode, I2S built-in DAC is disabled by default
|
||||
*
|
||||
* @param dac_mode DAC mode configurations - see i2s_dac_mode_t
|
||||
*
|
||||
* @note Built-in DAC functions are only supported on I2S0 for current ESP32 chip.
|
||||
* If either of the built-in DAC channel are enabled, the other one can not
|
||||
* be used as RTC DAC function at the same time.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t i2s_set_dac_mode(i2s_dac_mode_t dac_mode);
|
||||
#endif //SOC_I2S_SUPPORTS_ADC_DAC
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -17,10 +17,12 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include "esp_err.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "soc/rtc_io_periph.h"
|
||||
#include "hal/rtc_io_types.h"
|
||||
#include "driver/gpio.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -42,6 +44,7 @@ static inline bool rtc_gpio_is_valid_gpio(gpio_num_t gpio_num)
|
||||
|
||||
#define RTC_GPIO_IS_VALID_GPIO(gpio_num) rtc_gpio_is_valid_gpio(gpio_num) // Deprecated, use rtc_gpio_is_valid_gpio()
|
||||
|
||||
#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
|
||||
/**
|
||||
* @brief Get RTC IO index number by gpio number.
|
||||
*
|
||||
@ -52,15 +55,9 @@ static inline bool rtc_gpio_is_valid_gpio(gpio_num_t gpio_num)
|
||||
*/
|
||||
static inline int rtc_io_number_get(gpio_num_t gpio_num)
|
||||
{
|
||||
#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
|
||||
return rtc_io_num_map[gpio_num];
|
||||
#else
|
||||
return gpio_num;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
|
||||
|
||||
/**
|
||||
* @brief Init a GPIO as RTC GPIO
|
||||
*
|
||||
|
@ -28,6 +28,12 @@ extern "C" {
|
||||
/// Handle representing an SD SPI device
|
||||
typedef int sdspi_dev_handle_t;
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
|
||||
#define SDSPI_DEFAULT_HOST HSPI_HOST
|
||||
#else
|
||||
#define SDSPI_DEFAULT_HOST SPI2_HOST
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Default sdmmc_host_t structure initializer for SD over SPI driver
|
||||
*
|
||||
@ -37,7 +43,7 @@ typedef int sdspi_dev_handle_t;
|
||||
*/
|
||||
#define SDSPI_HOST_DEFAULT() {\
|
||||
.flags = SDMMC_HOST_FLAG_SPI | SDMMC_HOST_FLAG_DEINIT_ARG, \
|
||||
.slot = HSPI_HOST, \
|
||||
.slot = SDSPI_DEFAULT_HOST, \
|
||||
.max_freq_khz = SDMMC_FREQ_DEFAULT, \
|
||||
.io_voltage = 3.3f, \
|
||||
.init = &sdspi_host_init, \
|
||||
@ -71,7 +77,7 @@ typedef struct {
|
||||
* Macro defining default configuration of SD SPI device.
|
||||
*/
|
||||
#define SDSPI_DEVICE_CONFIG_DEFAULT() {\
|
||||
.host_id = HSPI_HOST, \
|
||||
.host_id = SDSPI_DEFAULT_HOST, \
|
||||
.gpio_cs = GPIO_NUM_13, \
|
||||
.gpio_cd = SDSPI_SLOT_NO_CD, \
|
||||
.gpio_wp = SDSPI_SLOT_NO_WP, \
|
||||
@ -228,7 +234,7 @@ typedef struct {
|
||||
*
|
||||
* @note The SDIO over sdspi needs an extra interrupt line. Call ``gpio_install_isr_service()`` before this function.
|
||||
*
|
||||
* @param slot SPI controller to use (HSPI_HOST or VSPI_HOST)
|
||||
* @param slot SPI controller to use (SPI2_HOST or SPI3_HOST)
|
||||
* @param slot_config pointer to slot configuration structure
|
||||
|
||||
* @deprecated Use `sdspi_host_init_device` instead.
|
||||
|
@ -106,7 +106,7 @@ typedef struct {
|
||||
int sclk_io_num; ///< GPIO pin for Spi CLocK signal, or -1 if not used.
|
||||
int quadwp_io_num; ///< GPIO pin for WP (Write Protect) signal which is used as D2 in 4-bit communication modes, or -1 if not used.
|
||||
int quadhd_io_num; ///< GPIO pin for HD (HolD) signal which is used as D3 in 4-bit communication modes, or -1 if not used.
|
||||
int max_transfer_sz; ///< Maximum transfer size, in bytes. Defaults to 4094 if 0.
|
||||
int max_transfer_sz; ///< Maximum transfer size, in bytes. Defaults to 4092 if 0 when DMA enabled, or to `SOC_SPI_MAXIMUM_BUFFER_SIZE` if DMA is disabled.
|
||||
uint32_t flags; ///< Abilities of bus to be checked by the driver. Or-ed value of ``SPICOMMON_BUSFLAG_*`` flags.
|
||||
int intr_flags; /**< Interrupt flag for the bus to set the priority, and IRAM attribute, see
|
||||
* ``esp_intr_alloc.h``. Note that the EDGE, INTRDISABLED attribute are ignored
|
||||
@ -119,7 +119,7 @@ typedef struct {
|
||||
/**
|
||||
* @brief Initialize a SPI bus
|
||||
*
|
||||
* @warning For now, only supports HSPI and VSPI.
|
||||
* @warning SPI0/1 is not supported
|
||||
*
|
||||
* @param host_id SPI peripheral that controls this bus
|
||||
* @param bus_config Pointer to a spi_bus_config_t struct specifying how the host should be initialized
|
||||
|
@ -88,7 +88,7 @@ struct spi_slave_transaction_t {
|
||||
/**
|
||||
* @brief Initialize a SPI bus as a slave interface
|
||||
*
|
||||
* @warning For now, only supports HSPI and VSPI.
|
||||
* @warning SPI0/1 is not supported
|
||||
*
|
||||
* @param host SPI peripheral to use as a SPI slave interface
|
||||
* @param bus_config Pointer to a spi_bus_config_t struct specifying how the host should be initialized
|
||||
|
45
tools/sdk/esp32/include/driver/include/esp_private/gpio.h
Normal file
45
tools/sdk/esp32/include/driver/include/esp_private/gpio.h
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright 2015-2019 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include <esp_types.h>
|
||||
|
||||
#include "soc/soc_caps.h"
|
||||
#include "driver/gpio.h"
|
||||
|
||||
#if SOC_GPIO_SUPPORT_SLP_SWITCH
|
||||
#if CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
|
||||
/**
|
||||
* @brief Emulate ESP32S2 behaviour to backup FUN_PU, FUN_PD information
|
||||
*
|
||||
* @note Need to be called before sleep.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
*/
|
||||
esp_err_t gpio_sleep_pupd_config_apply(gpio_num_t gpio_num);
|
||||
|
||||
/**
|
||||
* @brief Emulate ESP32S2 behaviour to restore FUN_PU, FUN_PD information
|
||||
*
|
||||
* @note Need to be called after sleep.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
*/
|
||||
esp_err_t gpio_sleep_pupd_config_unapply(gpio_num_t gpio_num);
|
||||
#endif
|
||||
#endif
|
@ -135,6 +135,8 @@ typedef struct {
|
||||
bool is_async; /*!< Set asynchronous mode, only supported with HTTPS for now */
|
||||
bool use_global_ca_store; /*!< Use a global ca_store for all the connections in which this bool is set. */
|
||||
bool skip_cert_common_name_check; /*!< Skip any validation of server certificate CN field */
|
||||
esp_err_t (*crt_bundle_attach)(void *conf); /*!< Function pointer to esp_crt_bundle_attach. Enables the use of certification
|
||||
bundle for server verification, must be enabled in menuconfig */
|
||||
bool keep_alive_enable; /*!< Enable keep-alive timeout */
|
||||
int keep_alive_idle; /*!< Keep-alive idle time. Default is 5 (second) */
|
||||
int keep_alive_interval; /*!< Keep-alive interval time. Default is 5 (second) */
|
||||
|
@ -0,0 +1,72 @@
|
||||
// Copyright 2021 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_bit_defs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @brief Chip models
|
||||
*/
|
||||
typedef enum {
|
||||
CHIP_ESP32 = 1, //!< ESP32
|
||||
CHIP_ESP32S2 = 2, //!< ESP32-S2
|
||||
CHIP_ESP32S3 = 4, //!< ESP32-S3
|
||||
CHIP_ESP32C3 = 5, //!< ESP32-C3
|
||||
} esp_chip_model_t;
|
||||
|
||||
/* Chip feature flags, used in esp_chip_info_t */
|
||||
#define CHIP_FEATURE_EMB_FLASH BIT(0) //!< Chip has embedded flash memory
|
||||
#define CHIP_FEATURE_WIFI_BGN BIT(1) //!< Chip has 2.4GHz WiFi
|
||||
#define CHIP_FEATURE_BLE BIT(4) //!< Chip has Bluetooth LE
|
||||
#define CHIP_FEATURE_BT BIT(5) //!< Chip has Bluetooth Classic
|
||||
|
||||
/**
|
||||
* @brief The structure represents information about the chip
|
||||
*/
|
||||
typedef struct {
|
||||
esp_chip_model_t model; //!< chip model, one of esp_chip_model_t
|
||||
uint32_t features; //!< bit mask of CHIP_FEATURE_x feature flags
|
||||
uint8_t cores; //!< number of CPU cores
|
||||
uint8_t revision; //!< chip revision number
|
||||
} esp_chip_info_t;
|
||||
|
||||
/**
|
||||
* @brief Fill an esp_chip_info_t structure with information about the chip
|
||||
* @param[out] out_info structure to be filled
|
||||
*/
|
||||
void esp_chip_info(esp_chip_info_t* out_info);
|
||||
|
||||
#if CONFIG_ESP32_ECO3_CACHE_LOCK_FIX
|
||||
/**
|
||||
* @brief Cache lock bug exists or not
|
||||
*
|
||||
* @return
|
||||
* - ture : bug exists
|
||||
* - false : bug not exists
|
||||
*/
|
||||
bool soc_has_cache_lock_bug(void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
134
tools/sdk/esp32/include/esp_hw_support/include/esp_mac.h
Normal file
134
tools/sdk/esp32/include/esp_hw_support/include/esp_mac.h
Normal file
@ -0,0 +1,134 @@
|
||||
// Copyright 2021 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
ESP_MAC_WIFI_STA,
|
||||
ESP_MAC_WIFI_SOFTAP,
|
||||
ESP_MAC_BT,
|
||||
ESP_MAC_ETH,
|
||||
} esp_mac_type_t;
|
||||
|
||||
/** @cond */
|
||||
#define TWO_UNIVERSAL_MAC_ADDR 2
|
||||
#define FOUR_UNIVERSAL_MAC_ADDR 4
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
#define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES
|
||||
#elif CONFIG_IDF_TARGET_ESP32S3
|
||||
#define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES
|
||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||
#define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES
|
||||
#endif
|
||||
/** @endcond */
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set base MAC address with the MAC address which is stored in BLK3 of EFUSE or
|
||||
* external storage e.g. flash and EEPROM.
|
||||
*
|
||||
* Base MAC address is used to generate the MAC addresses used by the networking interfaces.
|
||||
* If using base MAC address stored in BLK3 of EFUSE or external storage, call this API to set base MAC
|
||||
* address with the MAC address which is stored in BLK3 of EFUSE or external storage before initializing
|
||||
* WiFi/BT/Ethernet.
|
||||
*
|
||||
* @note Base MAC must be a unicast MAC (least significant bit of first byte must be zero).
|
||||
*
|
||||
* @note If not using a valid OUI, set the "locally administered" bit
|
||||
* (bit value 0x02 in the first byte) to avoid collisions.
|
||||
*
|
||||
* @param mac base MAC address, length: 6 bytes.
|
||||
*
|
||||
* @return ESP_OK on success
|
||||
* ESP_ERR_INVALID_ARG If mac is NULL or is not a unicast MAC
|
||||
*/
|
||||
esp_err_t esp_base_mac_addr_set(const uint8_t *mac);
|
||||
|
||||
/**
|
||||
* @brief Return base MAC address which is set using esp_base_mac_addr_set.
|
||||
*
|
||||
* @param mac base MAC address, length: 6 bytes.
|
||||
*
|
||||
* @return ESP_OK on success
|
||||
* ESP_ERR_INVALID_MAC base MAC address has not been set
|
||||
*/
|
||||
esp_err_t esp_base_mac_addr_get(uint8_t *mac);
|
||||
|
||||
/**
|
||||
* @brief Return base MAC address which was previously written to BLK3 of EFUSE.
|
||||
*
|
||||
* Base MAC address is used to generate the MAC addresses used by the networking interfaces.
|
||||
* This API returns the custom base MAC address which was previously written to BLK3 of EFUSE.
|
||||
* Writing this EFUSE allows setting of a different (non-Espressif) base MAC address. It is also
|
||||
* possible to store a custom base MAC address elsewhere, see esp_base_mac_addr_set() for details.
|
||||
*
|
||||
* @param mac base MAC address, length: 6 bytes.
|
||||
*
|
||||
* @return ESP_OK on success
|
||||
* ESP_ERR_INVALID_VERSION An invalid MAC version field was read from BLK3 of EFUSE
|
||||
* ESP_ERR_INVALID_CRC An invalid MAC CRC was read from BLK3 of EFUSE
|
||||
*/
|
||||
esp_err_t esp_efuse_mac_get_custom(uint8_t *mac);
|
||||
|
||||
/**
|
||||
* @brief Return base MAC address which is factory-programmed by Espressif in BLK0 of EFUSE.
|
||||
*
|
||||
* @param mac base MAC address, length: 6 bytes.
|
||||
*
|
||||
* @return ESP_OK on success
|
||||
*/
|
||||
esp_err_t esp_efuse_mac_get_default(uint8_t *mac);
|
||||
|
||||
/**
|
||||
* @brief Read base MAC address and set MAC address of the interface.
|
||||
*
|
||||
* This function first get base MAC address using esp_base_mac_addr_get or reads base MAC address
|
||||
* from BLK0 of EFUSE. Then set the MAC address of the interface including wifi station, wifi softap,
|
||||
* bluetooth and ethernet.
|
||||
*
|
||||
* @param mac MAC address of the interface, length: 6 bytes.
|
||||
* @param type type of MAC address, 0:wifi station, 1:wifi softap, 2:bluetooth, 3:ethernet.
|
||||
*
|
||||
* @return ESP_OK on success
|
||||
*/
|
||||
esp_err_t esp_read_mac(uint8_t* mac, esp_mac_type_t type);
|
||||
|
||||
/**
|
||||
* @brief Derive local MAC address from universal MAC address.
|
||||
*
|
||||
* This function derives a local MAC address from an universal MAC address.
|
||||
* A `definition of local vs universal MAC address can be found on Wikipedia
|
||||
* <https://en.wikipedia.org/wiki/MAC_address#Universal_vs._local>`.
|
||||
* In ESP32, universal MAC address is generated from base MAC address in EFUSE or other external storage.
|
||||
* Local MAC address is derived from the universal MAC address.
|
||||
*
|
||||
* @param local_mac Derived local MAC address, length: 6 bytes.
|
||||
* @param universal_mac Source universal MAC address, length: 6 bytes.
|
||||
*
|
||||
* @return ESP_OK on success
|
||||
*/
|
||||
esp_err_t esp_derive_local_mac(uint8_t* local_mac, const uint8_t* universal_mac);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -20,7 +20,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file esp32/clk.h
|
||||
* @file esp_clk.h
|
||||
*
|
||||
* This file contains declarations of clock related functions.
|
||||
*/
|
54
tools/sdk/esp32/include/esp_hw_support/include/esp_random.h
Normal file
54
tools/sdk/esp32/include/esp_hw_support/include/esp_random.h
Normal file
@ -0,0 +1,54 @@
|
||||
// Copyright 2021 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Get one random 32-bit word from hardware RNG
|
||||
*
|
||||
* The hardware RNG is fully functional whenever an RF subsystem is running (ie Bluetooth or WiFi is enabled). For
|
||||
* random values, call this function after WiFi or Bluetooth are started.
|
||||
*
|
||||
* If the RF subsystem is not used by the program, the function bootloader_random_enable() can be called to enable an
|
||||
* entropy source. bootloader_random_disable() must be called before RF subsystem or I2S peripheral are used. See these functions'
|
||||
* documentation for more details.
|
||||
*
|
||||
* Any time the app is running without an RF subsystem (or bootloader_random) enabled, RNG hardware should be
|
||||
* considered a PRNG. A very small amount of entropy is available due to pre-seeding while the IDF
|
||||
* bootloader is running, but this should not be relied upon for any use.
|
||||
*
|
||||
* @return Random value between 0 and UINT32_MAX
|
||||
*/
|
||||
uint32_t esp_random(void);
|
||||
|
||||
/**
|
||||
* @brief Fill a buffer with random bytes from hardware RNG
|
||||
*
|
||||
* @note This function has the same restrictions regarding available entropy as esp_random()
|
||||
*
|
||||
* @param buf Pointer to buffer to fill with random numbers.
|
||||
* @param len Length of buffer in bytes
|
||||
*/
|
||||
void esp_fill_random(void *buf, size_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -441,6 +441,18 @@ void esp_default_wake_deep_sleep(void);
|
||||
*/
|
||||
void esp_deep_sleep_disable_rom_logging(void);
|
||||
|
||||
#ifdef SOC_PM_SUPPORT_CPU_PD
|
||||
/**
|
||||
* @brief CPU Power down low-level initialize
|
||||
*
|
||||
* @param enable enable or disable CPU power down during light sleep
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_ERR_NO_MEM not enough retention memory
|
||||
*/
|
||||
esp_err_t esp_sleep_cpu_pd_low_init(bool enable);
|
||||
#endif
|
||||
|
||||
#if SOC_GPIO_SUPPORT_SLP_SWITCH
|
||||
/**
|
||||
* @brief Configure to isolate all GPIO pins in sleep state
|
@ -0,0 +1,16 @@
|
||||
// Copyright 2015-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.
|
||||
|
||||
#pragma once
|
||||
#include "esp_private/esp_clk.h"
|
@ -0,0 +1,16 @@
|
||||
// Copyright 2015-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.
|
||||
|
||||
#pragma once
|
||||
#include "esp_private/esp_clk.h"
|
@ -0,0 +1,16 @@
|
||||
// Copyright 2015-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.
|
||||
|
||||
#pragma once
|
||||
#include "esp_private/esp_clk.h"
|
@ -0,0 +1,16 @@
|
||||
// Copyright 2015-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.
|
||||
|
||||
#pragma once
|
||||
#include "esp_private/esp_clk.h"
|
@ -63,6 +63,14 @@ typedef enum {
|
||||
*/
|
||||
esp_err_t esp_pm_configure(const void* config);
|
||||
|
||||
/**
|
||||
* @brief Get implementation-specific power management configuration
|
||||
* @param config pointer to implementation-specific configuration structure (e.g. esp_pm_config_esp32)
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_ERR_INVALID_ARG if the pointer is null
|
||||
*/
|
||||
esp_err_t esp_pm_get_configuration(void* config);
|
||||
|
||||
/**
|
||||
* @brief Opaque handle to the power management lock
|
||||
|
@ -41,6 +41,7 @@ typedef struct {
|
||||
uint32_t pc; /* PC of the current frame */
|
||||
uint32_t sp; /* SP of the current frame */
|
||||
uint32_t next_pc; /* PC of the current frame's caller */
|
||||
const void *exc_frame; /* Pointer to the full frame data structure, if applicable */
|
||||
} esp_backtrace_frame_t;
|
||||
|
||||
/**
|
||||
@ -87,6 +88,24 @@ extern void esp_backtrace_get_start(uint32_t *pc, uint32_t *sp, uint32_t *next_p
|
||||
*/
|
||||
bool esp_backtrace_get_next_frame(esp_backtrace_frame_t *frame);
|
||||
|
||||
/**
|
||||
* @brief Print the backtrace from specified frame.
|
||||
*
|
||||
* @param depth The maximum number of stack frames to print (should be > 0)
|
||||
* @param frame Starting frame to print from
|
||||
* @param panic Indicator if backtrace print is during a system panic
|
||||
*
|
||||
* @note On the ESP32, users must call esp_backtrace_get_start() first to flush the stack.
|
||||
* @note If a esp_backtrace_frame_t* frame is obtained though a call to esp_backtrace_get_start()
|
||||
* from some example function func_a(), then frame is only valid within the frame/scope of func_a().
|
||||
* Users should not attempt to pass/use frame other frames within the same stack of different stacks.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Backtrace successfully printed to completion or to depth limit
|
||||
* - ESP_FAIL Backtrace is corrupted
|
||||
*/
|
||||
esp_err_t IRAM_ATTR esp_backtrace_print_from_frame(int depth, const esp_backtrace_frame_t* frame, bool panic);
|
||||
|
||||
/**
|
||||
* @brief Print the backtrace of the current stack
|
||||
*
|
||||
|
@ -14,6 +14,8 @@
|
||||
#ifndef __ESP_CROSSCORE_INT_H
|
||||
#define __ESP_CROSSCORE_INT_H
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -54,6 +56,8 @@ void esp_crosscore_int_send_yield(int core_id);
|
||||
*/
|
||||
void esp_crosscore_int_send_freq_switch(int core_id);
|
||||
|
||||
|
||||
#if !CONFIG_IDF_TARGET_ESP32C3
|
||||
/**
|
||||
* Send an interrupt to a CPU indicating it should print its current backtrace
|
||||
*
|
||||
@ -63,6 +67,7 @@ void esp_crosscore_int_send_freq_switch(int core_id);
|
||||
* @param core_id Core that should print its backtrace
|
||||
*/
|
||||
void esp_crosscore_int_send_print_backtrace(int core_id);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -31,10 +31,11 @@ extern bool g_spiram_ok; // [refactor-todo] better way to communicate this from
|
||||
// array, one per core.
|
||||
typedef void (*sys_startup_fn_t)(void);
|
||||
|
||||
/* This array of per-CPU system layer startup functions is initialized in the non-port part of esp_system */
|
||||
#if !CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE
|
||||
extern sys_startup_fn_t g_startup_fn[SOC_CPU_CORES_NUM];
|
||||
extern sys_startup_fn_t const g_startup_fn[SOC_CPU_CORES_NUM];
|
||||
#else
|
||||
extern sys_startup_fn_t g_startup_fn[1];
|
||||
extern sys_startup_fn_t const g_startup_fn[1];
|
||||
#endif
|
||||
|
||||
// Utility to execute `sys_startup_fn_t` for the current core.
|
||||
|
@ -24,31 +24,17 @@
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
// For backward compatibility. These headers
|
||||
// contains hardware operation functions and definitions
|
||||
// that were originally declared in this header.
|
||||
#include "esp_mac.h"
|
||||
#include "esp_chip_info.h"
|
||||
#include "esp_random.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
ESP_MAC_WIFI_STA,
|
||||
ESP_MAC_WIFI_SOFTAP,
|
||||
ESP_MAC_BT,
|
||||
ESP_MAC_ETH,
|
||||
} esp_mac_type_t;
|
||||
|
||||
/** @cond */
|
||||
#define TWO_UNIVERSAL_MAC_ADDR 2
|
||||
#define FOUR_UNIVERSAL_MAC_ADDR 4
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
#define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES
|
||||
#elif CONFIG_IDF_TARGET_ESP32S3
|
||||
#define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES
|
||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||
#define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES
|
||||
#endif
|
||||
/** @endcond */
|
||||
|
||||
/**
|
||||
* @brief Reset reasons
|
||||
*/
|
||||
@ -138,120 +124,6 @@ uint32_t esp_get_free_internal_heap_size(void);
|
||||
*/
|
||||
uint32_t esp_get_minimum_free_heap_size( void );
|
||||
|
||||
/**
|
||||
* @brief Get one random 32-bit word from hardware RNG
|
||||
*
|
||||
* The hardware RNG is fully functional whenever an RF subsystem is running (ie Bluetooth or WiFi is enabled). For
|
||||
* random values, call this function after WiFi or Bluetooth are started.
|
||||
*
|
||||
* If the RF subsystem is not used by the program, the function bootloader_random_enable() can be called to enable an
|
||||
* entropy source. bootloader_random_disable() must be called before RF subsystem or I2S peripheral are used. See these functions'
|
||||
* documentation for more details.
|
||||
*
|
||||
* Any time the app is running without an RF subsystem (or bootloader_random) enabled, RNG hardware should be
|
||||
* considered a PRNG. A very small amount of entropy is available due to pre-seeding while the IDF
|
||||
* bootloader is running, but this should not be relied upon for any use.
|
||||
*
|
||||
* @return Random value between 0 and UINT32_MAX
|
||||
*/
|
||||
uint32_t esp_random(void);
|
||||
|
||||
/**
|
||||
* @brief Fill a buffer with random bytes from hardware RNG
|
||||
*
|
||||
* @note This function has the same restrictions regarding available entropy as esp_random()
|
||||
*
|
||||
* @param buf Pointer to buffer to fill with random numbers.
|
||||
* @param len Length of buffer in bytes
|
||||
*/
|
||||
void esp_fill_random(void *buf, size_t len);
|
||||
|
||||
/**
|
||||
* @brief Set base MAC address with the MAC address which is stored in BLK3 of EFUSE or
|
||||
* external storage e.g. flash and EEPROM.
|
||||
*
|
||||
* Base MAC address is used to generate the MAC addresses used by the networking interfaces.
|
||||
* If using base MAC address stored in BLK3 of EFUSE or external storage, call this API to set base MAC
|
||||
* address with the MAC address which is stored in BLK3 of EFUSE or external storage before initializing
|
||||
* WiFi/BT/Ethernet.
|
||||
*
|
||||
* @note Base MAC must be a unicast MAC (least significant bit of first byte must be zero).
|
||||
*
|
||||
* @note If not using a valid OUI, set the "locally administered" bit
|
||||
* (bit value 0x02 in the first byte) to avoid collisions.
|
||||
*
|
||||
* @param mac base MAC address, length: 6 bytes.
|
||||
*
|
||||
* @return ESP_OK on success
|
||||
* ESP_ERR_INVALID_ARG If mac is NULL or is not a unicast MAC
|
||||
*/
|
||||
esp_err_t esp_base_mac_addr_set(const uint8_t *mac);
|
||||
|
||||
/**
|
||||
* @brief Return base MAC address which is set using esp_base_mac_addr_set.
|
||||
*
|
||||
* @param mac base MAC address, length: 6 bytes.
|
||||
*
|
||||
* @return ESP_OK on success
|
||||
* ESP_ERR_INVALID_MAC base MAC address has not been set
|
||||
*/
|
||||
esp_err_t esp_base_mac_addr_get(uint8_t *mac);
|
||||
|
||||
/**
|
||||
* @brief Return base MAC address which was previously written to BLK3 of EFUSE.
|
||||
*
|
||||
* Base MAC address is used to generate the MAC addresses used by the networking interfaces.
|
||||
* This API returns the custom base MAC address which was previously written to BLK3 of EFUSE.
|
||||
* Writing this EFUSE allows setting of a different (non-Espressif) base MAC address. It is also
|
||||
* possible to store a custom base MAC address elsewhere, see esp_base_mac_addr_set() for details.
|
||||
*
|
||||
* @param mac base MAC address, length: 6 bytes.
|
||||
*
|
||||
* @return ESP_OK on success
|
||||
* ESP_ERR_INVALID_VERSION An invalid MAC version field was read from BLK3 of EFUSE
|
||||
* ESP_ERR_INVALID_CRC An invalid MAC CRC was read from BLK3 of EFUSE
|
||||
*/
|
||||
esp_err_t esp_efuse_mac_get_custom(uint8_t *mac);
|
||||
|
||||
/**
|
||||
* @brief Return base MAC address which is factory-programmed by Espressif in BLK0 of EFUSE.
|
||||
*
|
||||
* @param mac base MAC address, length: 6 bytes.
|
||||
*
|
||||
* @return ESP_OK on success
|
||||
*/
|
||||
esp_err_t esp_efuse_mac_get_default(uint8_t *mac);
|
||||
|
||||
/**
|
||||
* @brief Read base MAC address and set MAC address of the interface.
|
||||
*
|
||||
* This function first get base MAC address using esp_base_mac_addr_get or reads base MAC address
|
||||
* from BLK0 of EFUSE. Then set the MAC address of the interface including wifi station, wifi softap,
|
||||
* bluetooth and ethernet.
|
||||
*
|
||||
* @param mac MAC address of the interface, length: 6 bytes.
|
||||
* @param type type of MAC address, 0:wifi station, 1:wifi softap, 2:bluetooth, 3:ethernet.
|
||||
*
|
||||
* @return ESP_OK on success
|
||||
*/
|
||||
esp_err_t esp_read_mac(uint8_t* mac, esp_mac_type_t type);
|
||||
|
||||
/**
|
||||
* @brief Derive local MAC address from universal MAC address.
|
||||
*
|
||||
* This function derives a local MAC address from an universal MAC address.
|
||||
* A `definition of local vs universal MAC address can be found on Wikipedia
|
||||
* <https://en.wikipedia.org/wiki/MAC_address#Universal_vs._local>`.
|
||||
* In ESP32, universal MAC address is generated from base MAC address in EFUSE or other external storage.
|
||||
* Local MAC address is derived from the universal MAC address.
|
||||
*
|
||||
* @param local_mac Derived local MAC address, length: 6 bytes.
|
||||
* @param universal_mac Source universal MAC address, length: 6 bytes.
|
||||
*
|
||||
* @return ESP_OK on success
|
||||
*/
|
||||
esp_err_t esp_derive_local_mac(uint8_t* local_mac, const uint8_t* universal_mac);
|
||||
|
||||
/**
|
||||
* @brief Trigger a software abort
|
||||
*
|
||||
@ -259,50 +131,6 @@ esp_err_t esp_derive_local_mac(uint8_t* local_mac, const uint8_t* universal_mac)
|
||||
*/
|
||||
void __attribute__((noreturn)) esp_system_abort(const char* details);
|
||||
|
||||
/**
|
||||
* @brief Chip models
|
||||
*/
|
||||
typedef enum {
|
||||
CHIP_ESP32 = 1, //!< ESP32
|
||||
CHIP_ESP32S2 = 2, //!< ESP32-S2
|
||||
CHIP_ESP32S3 = 4, //!< ESP32-S3
|
||||
CHIP_ESP32C3 = 5, //!< ESP32-C3
|
||||
} esp_chip_model_t;
|
||||
|
||||
/* Chip feature flags, used in esp_chip_info_t */
|
||||
#define CHIP_FEATURE_EMB_FLASH BIT(0) //!< Chip has embedded flash memory
|
||||
#define CHIP_FEATURE_WIFI_BGN BIT(1) //!< Chip has 2.4GHz WiFi
|
||||
#define CHIP_FEATURE_BLE BIT(4) //!< Chip has Bluetooth LE
|
||||
#define CHIP_FEATURE_BT BIT(5) //!< Chip has Bluetooth Classic
|
||||
|
||||
/**
|
||||
* @brief The structure represents information about the chip
|
||||
*/
|
||||
typedef struct {
|
||||
esp_chip_model_t model; //!< chip model, one of esp_chip_model_t
|
||||
uint32_t features; //!< bit mask of CHIP_FEATURE_x feature flags
|
||||
uint8_t cores; //!< number of CPU cores
|
||||
uint8_t revision; //!< chip revision number
|
||||
} esp_chip_info_t;
|
||||
|
||||
/**
|
||||
* @brief Fill an esp_chip_info_t structure with information about the chip
|
||||
* @param[out] out_info structure to be filled
|
||||
*/
|
||||
void esp_chip_info(esp_chip_info_t* out_info);
|
||||
|
||||
|
||||
#if CONFIG_ESP32_ECO3_CACHE_LOCK_FIX
|
||||
/**
|
||||
* @brief Cache lock bug exists or not
|
||||
*
|
||||
* @return
|
||||
* - ture : bug exists
|
||||
* - false : bug not exists
|
||||
*/
|
||||
bool soc_has_cache_lock_bug(void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -12,6 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -20,14 +22,17 @@ extern "C" {
|
||||
* @brief initialize cache invalid access interrupt
|
||||
*
|
||||
* This function enables cache invalid access interrupt source and connects it
|
||||
* to interrupt input number ETS_MEMACCESS_ERR_INUM (see soc/soc.h). It is called
|
||||
* from the startup code.
|
||||
* to interrupt input number. It is called from the startup code.
|
||||
*
|
||||
* On ESP32, the interrupt input number is ETS_MEMACCESS_ERR_INUM. On other targets
|
||||
* it is ETS_CACHEERR_INUM. See soc/soc.h for more information.
|
||||
*/
|
||||
void esp_cache_err_int_init(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief get the CPU which caused cache invalid access interrupt
|
||||
* @brief get the CPU which caused cache invalid access interrupt. Helper function in
|
||||
* panic handling.
|
||||
* @return
|
||||
* - PRO_CPU_NUM, if PRO_CPU has caused cache IA interrupt
|
||||
* - APP_CPU_NUM, if APP_CPU has caused cache IA interrupt
|
80
tools/sdk/esp32/include/esp_system/port/public_compat/trax.h
Normal file
80
tools/sdk/esp32/include/esp_system/port/public_compat/trax.h
Normal file
@ -0,0 +1,80 @@
|
||||
// Copyright 2015-2016 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.
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_err.h"
|
||||
#include "eri.h"
|
||||
#include "xtensa-debug-module.h"
|
||||
#include "xt_trax.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
TRAX_DOWNCOUNT_WORDS,
|
||||
TRAX_DOWNCOUNT_INSTRUCTIONS
|
||||
} trax_downcount_unit_t;
|
||||
|
||||
typedef enum {
|
||||
TRAX_ENA_NONE = 0,
|
||||
TRAX_ENA_PRO,
|
||||
TRAX_ENA_APP,
|
||||
TRAX_ENA_PRO_APP,
|
||||
TRAX_ENA_PRO_APP_SWAP
|
||||
} trax_ena_select_t;
|
||||
|
||||
/**
|
||||
* @brief Enable the trax memory blocks to be used as Trax memory.
|
||||
*
|
||||
* @param pro_cpu_enable : true if Trax needs to be enabled for the pro CPU
|
||||
* @param app_cpu_enable : true if Trax needs to be enabled for the pro CPU
|
||||
* @param swap_regions : Normally, the pro CPU writes to Trax mem block 0 while
|
||||
* the app cpu writes to block 1. Setting this to true
|
||||
* inverts this.
|
||||
*
|
||||
* @return esp_err_t. Fails with ESP_ERR_NO_MEM if Trax enable is requested for 2 CPUs
|
||||
* but memmap only has room for 1, or if Trax memmap is disabled
|
||||
* entirely.
|
||||
*/
|
||||
int trax_enable(trax_ena_select_t ena);
|
||||
|
||||
/**
|
||||
* @brief Start a Trax trace on the current CPU
|
||||
*
|
||||
* @param units_until_stop : Set the units of the delay that gets passed to
|
||||
* trax_trigger_traceend_after_delay. One of TRAX_DOWNCOUNT_WORDS
|
||||
* or TRAX_DOWNCOUNT_INSTRUCTIONS.
|
||||
*
|
||||
* @return esp_err_t. Fails with ESP_ERR_NO_MEM if Trax is disabled.
|
||||
*/
|
||||
int trax_start_trace(trax_downcount_unit_t units_until_stop);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Trigger a Trax trace stop after the indicated delay. If this is called
|
||||
* before and the previous delay hasn't ended yet, this will overwrite
|
||||
* that delay with the new value. The delay will always start at the time
|
||||
* the function is called.
|
||||
*
|
||||
* @param delay : The delay to stop the trace in, in the unit indicated to
|
||||
* trax_start_trace. Note: the trace memory has 4K words available.
|
||||
*
|
||||
* @return esp_err_t
|
||||
*/
|
||||
int trax_trigger_traceend_after_delay(int delay);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include "cache_err_int.h"
|
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include "cache_err_int.h"
|
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include "cache_err_int.h"
|
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include "cache_err_int.h"
|
@ -17,11 +17,37 @@
|
||||
#include <stddef.h>
|
||||
#include "esp_err.h"
|
||||
#include "esp_private/panic_internal.h"
|
||||
#include "esp_core_dump_summary_extra_info.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define APP_ELF_SHA256_SZ (CONFIG_APP_RETRIEVE_LEN_ELF_SHA + 1)
|
||||
|
||||
/**
|
||||
* @brief Backtrace information
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t bt[16]; /*!< Backtrace (array of PC) */
|
||||
uint32_t depth; /*!< Number of backtrace entries */
|
||||
bool corrupted; /*!< Status flag for backtrace is corrupt or not */
|
||||
} esp_core_dump_bt_info_t;
|
||||
|
||||
/**
|
||||
* @brief Core dump summary, Most meaningful contents of the core dump
|
||||
* are accommodated in this structure
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t exc_tcb; /*!< TCB pointer to the task causing exception */
|
||||
char exc_task[16]; /*!< Name of the task that caused exception */
|
||||
uint32_t exc_pc; /*!< Program counter for exception */
|
||||
esp_core_dump_bt_info_t exc_bt_info; /*!< Backtrace information for task causing exception */
|
||||
uint32_t core_dump_version; /*!< Core dump version */
|
||||
uint8_t app_elf_sha256[APP_ELF_SHA256_SZ]; /*!< Crashing application's SHA256 sum as a string */
|
||||
esp_core_dump_summary_extra_info_t ex_info; /*!< Architecture specific extra data */
|
||||
} esp_core_dump_summary_t;
|
||||
|
||||
/**************************************************************************************/
|
||||
/******************************** EXCEPTION MODE API **********************************/
|
||||
/**************************************************************************************/
|
||||
@ -89,6 +115,24 @@ void esp_core_dump_to_uart(panic_info_t *info);
|
||||
*/
|
||||
esp_err_t esp_core_dump_image_get(size_t* out_addr, size_t *out_size);
|
||||
|
||||
/**
|
||||
* @brief Erases coredump data in flash. esp_core_dump_image_get() will then return
|
||||
* ESP_ERR_NOT_FOUND. Can be used after a coredump has been transmitted successfully.
|
||||
* This function is always available, even when core dump is disabled in menuconfig.
|
||||
*
|
||||
* @return ESP_OK on success, otherwise \see esp_err_t
|
||||
*/
|
||||
esp_err_t esp_core_dump_image_erase(void);
|
||||
|
||||
/**
|
||||
* @brief Get the summary of a core dump. This function works only with ELF format core dumps.
|
||||
*
|
||||
* @param summary Summary of the core dump
|
||||
*
|
||||
* @return ESP_OK on success, otherwise \see esp_err_t
|
||||
*/
|
||||
esp_err_t esp_core_dump_get_summary(esp_core_dump_summary_t *summary);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,9 +1,9 @@
|
||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
||||
// Copyright 2021 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
|
||||
@ -11,29 +11,24 @@
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "esp_err.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP_SYSTEM_PM_POWER_DOWN_CPU
|
||||
/**
|
||||
* @brief CPU Power down low-level initialize
|
||||
*
|
||||
* @param enable enable or disable CPU power down during light sleep
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_ERR_NO_MEM not enough retention memory
|
||||
* @brief RISC-V architecture specific extra information
|
||||
*/
|
||||
esp_err_t esp_sleep_cpu_pd_low_init(bool enable);
|
||||
#endif
|
||||
typedef struct {
|
||||
uint32_t mstatus; /* Machine Status */
|
||||
uint32_t mtvec; /* Machine Trap-Vector Base Address */
|
||||
uint32_t mcause; /* Machine Trap Cause */
|
||||
uint32_t mtval; /* Machine Trap Value */
|
||||
uint32_t exc_a[8]; /*!< a register set when the exception caused */
|
||||
} esp_core_dump_summary_extra_info_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
// Copyright 2021 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.
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <xtensa/config/core-isa.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#define EPCx_REGISTER_COUNT XCHAL_NUM_INTLEVELS
|
||||
|
||||
/**
|
||||
* @brief Xtensa architecture specific extra information
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t exc_cause; /*!< Cause of exception */
|
||||
uint32_t exc_vaddr; /*!< Virtual address of exception */
|
||||
uint32_t exc_a[16]; /*!< a register set when the exception caused */
|
||||
uint32_t epcx[EPCx_REGISTER_COUNT]; /*!< PC register address at exception level(1 to 7) */
|
||||
uint8_t epcx_reg_bits; /*!< Bit mask of available EPCx registers */
|
||||
} esp_core_dump_summary_extra_info_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -1203,6 +1203,10 @@ BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;
|
||||
/**
|
||||
* Starts the real time kernel tick processing.
|
||||
*
|
||||
* NOTE: In ESP-IDF the scheduler is started automatically during
|
||||
* application startup, vTaskStartScheduler() should not be called from
|
||||
* ESP-IDF applications.
|
||||
*
|
||||
* After calling the kernel has control over which tasks are executed and when.
|
||||
*
|
||||
* See the demo application file main.c for an example of creating
|
||||
|
@ -567,6 +567,17 @@ static inline void gpio_ll_iomux_in(gpio_dev_t *hw, uint32_t gpio, uint32_t sign
|
||||
PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[gpio]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Select a function for the pin in the IOMUX
|
||||
*
|
||||
* @param pin_name Pin name to configure
|
||||
* @param func Function to assign to the pin
|
||||
*/
|
||||
static inline void gpio_ll_iomux_func_sel(uint32_t pin_name, uint32_t func)
|
||||
{
|
||||
PIN_FUNC_SELECT(pin_name, func);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set peripheral output to an GPIO pad through the IOMUX.
|
||||
*
|
||||
@ -580,7 +591,7 @@ static inline void gpio_ll_iomux_out(gpio_dev_t *hw, uint8_t gpio_num, int func,
|
||||
{
|
||||
hw->func_out_sel_cfg[gpio_num].oen_sel = 0;
|
||||
hw->func_out_sel_cfg[gpio_num].oen_inv_sel = oen_inv;
|
||||
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio_num], func);
|
||||
gpio_ll_iomux_func_sel(GPIO_PIN_MUX_REG[gpio_num], func);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -466,6 +466,14 @@ void gpio_hal_sleep_pupd_config_unapply(gpio_hal_context_t *hal, gpio_num_t gpio
|
||||
|
||||
#endif //SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP
|
||||
|
||||
/**
|
||||
* @brief Select a function for the pin in the IOMUX
|
||||
*
|
||||
* @param pin_name Pin name to configure
|
||||
* @param func Function to assign to the pin
|
||||
*/
|
||||
#define gpio_hal_iomux_func_sel(pin_name, func) gpio_ll_iomux_func_sel(pin_name, func)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -79,36 +79,9 @@ typedef enum {
|
||||
I2C_SCLK_MAX,
|
||||
} i2c_sclk_t;
|
||||
|
||||
// I2C clk flags for users to use, can be expanded in the future.
|
||||
#define I2C_SCLK_SRC_FLAG_FOR_NOMAL (0) /*!< Any one clock source that is available for the specified frequency may be choosen*/
|
||||
#define I2C_SCLK_SRC_FLAG_AWARE_DFS (1 << 0) /*!< For REF tick clock, it won't change with APB.*/
|
||||
#define I2C_SCLK_SRC_FLAG_LIGHT_SLEEP (1 << 1) /*!< For light sleep mode.*/
|
||||
|
||||
/// Use the highest speed that is available for the clock source picked by clk_flags
|
||||
#define I2C_CLK_FREQ_MAX (-1)
|
||||
|
||||
/**
|
||||
* @brief I2C initialization parameters
|
||||
*/
|
||||
typedef struct{
|
||||
i2c_mode_t mode; /*!< I2C mode */
|
||||
int sda_io_num; /*!< GPIO number for I2C sda signal */
|
||||
int scl_io_num; /*!< GPIO number for I2C scl signal */
|
||||
bool sda_pullup_en; /*!< Internal GPIO pull mode for I2C sda signal*/
|
||||
bool scl_pullup_en; /*!< Internal GPIO pull mode for I2C scl signal*/
|
||||
|
||||
union {
|
||||
struct {
|
||||
uint32_t clk_speed; /*!< I2C clock frequency for master mode, (no higher than 1MHz for now) */
|
||||
} master; /*!< I2C master config */
|
||||
struct {
|
||||
uint8_t addr_10bit_en; /*!< I2C 10bit address mode enable for slave mode */
|
||||
uint16_t slave_addr; /*!< I2C address for slave mode */
|
||||
} slave; /*!< I2C slave config */
|
||||
};
|
||||
uint32_t clk_flags; /*!< Bitwise of ``I2C_SCLK_SRC_FLAG_**FOR_DFS**`` for clk source choice*/
|
||||
} i2c_config_t;
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
typedef enum{
|
||||
I2C_CMD_RESTART = 0, /*!<I2C restart command */
|
||||
|
@ -115,7 +115,6 @@ typedef enum {
|
||||
I2S_CLK_APLL, /*!< Clock from APLL*/
|
||||
} i2s_clock_src_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief I2S configuration parameters for i2s_param_config function
|
||||
*
|
||||
@ -145,6 +144,7 @@ typedef enum {
|
||||
I2S_EVENT_MAX, /*!< I2S event max index*/
|
||||
} i2s_event_type_t;
|
||||
|
||||
#if SOC_I2S_SUPPORTS_ADC_DAC
|
||||
/**
|
||||
* @brief I2S DAC mode for i2s_set_dac_mode.
|
||||
*
|
||||
@ -157,6 +157,7 @@ typedef enum {
|
||||
I2S_DAC_CHANNEL_BOTH_EN = 0x3, /*!< Enable both of the I2S built-in DAC channels.*/
|
||||
I2S_DAC_CHANNEL_MAX = 0x4, /*!< I2S built-in DAC mode max index*/
|
||||
} i2s_dac_mode_t;
|
||||
#endif //SOC_I2S_SUPPORTS_ADC_DAC
|
||||
|
||||
/**
|
||||
* @brief Event structure used in I2S event queue
|
||||
|
@ -160,7 +160,7 @@ typedef struct {
|
||||
* Init the peripheral and the context.
|
||||
*
|
||||
* @param hal Context of the HAL layer.
|
||||
* @param host_id Index of the SPI peripheral. 0 for SPI1, 1 for HSPI (SPI2) and 2 for VSPI (SPI3).
|
||||
* @param host_id Index of the SPI peripheral. 0 for SPI1, 1 for SPI2 and 2 for SPI3.
|
||||
* @param hal_config Configuration of the hal defined by the upper layer.
|
||||
*/
|
||||
void spi_hal_init(spi_hal_context_t *hal, uint32_t host_id, const spi_hal_config_t *hal_config);
|
||||
|
@ -91,8 +91,8 @@ typedef struct {
|
||||
/**
|
||||
* Init the peripheral and the context.
|
||||
*
|
||||
* @param hal Context of the HAL layer.
|
||||
* @param host_id Index of the SPI peripheral. 0 for SPI1, 1 for HSPI (SPI2) and 2 for VSPI (SPI3).
|
||||
* @param hal Context of the HAL layer.
|
||||
* @param hal_config Configuration of the HAL
|
||||
*/
|
||||
void spi_slave_hal_init(spi_slave_hal_context_t *hal, const spi_slave_hal_config_t *hal_config);
|
||||
|
||||
|
@ -44,21 +44,16 @@ FLAG_ATTR(spi_event_t)
|
||||
|
||||
/** @cond */ //Doxy command to hide preprocessor definitions from docs */
|
||||
|
||||
//alias for different chips
|
||||
//alias for different chips, deprecated for the chips after esp32s2
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#define SPI_HOST SPI1_HOST
|
||||
#define HSPI_HOST SPI2_HOST
|
||||
#define VSPI_HOST SPI3_HOST
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
// SPI_HOST (SPI1_HOST) is not supported by the SPI Master and SPI Slave driver on ESP32-S2 and later
|
||||
#define SPI_HOST SPI1_HOST
|
||||
#define FSPI_HOST SPI2_HOST
|
||||
#define HSPI_HOST SPI3_HOST
|
||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||
/* No SPI3_host on C3 */
|
||||
#define SPI_HOST SPI1_HOST
|
||||
#define FSPI_HOST SPI2_HOST
|
||||
#define HSPI_HOST SPI2_HOST
|
||||
#endif
|
||||
|
||||
/** @endcond */
|
||||
|
@ -31,11 +31,11 @@
|
||||
#include "sodium/crypto_onetimeauth_poly1305.h"
|
||||
#include "sodium/crypto_pwhash.h"
|
||||
#include "sodium/crypto_pwhash_argon2i.h"
|
||||
#include "sodium/crypto_pwhash_scryptsalsa208sha256.h"
|
||||
#include "sodium/crypto_scalarmult.h"
|
||||
#include "sodium/crypto_scalarmult_curve25519.h"
|
||||
#include "sodium/crypto_secretbox.h"
|
||||
#include "sodium/crypto_secretbox_xsalsa20poly1305.h"
|
||||
#include "sodium/crypto_secretstream_xchacha20poly1305.h"
|
||||
#include "sodium/crypto_shorthash.h"
|
||||
#include "sodium/crypto_shorthash_siphash24.h"
|
||||
#include "sodium/crypto_sign.h"
|
||||
@ -48,18 +48,19 @@
|
||||
#include "sodium/crypto_verify_32.h"
|
||||
#include "sodium/crypto_verify_64.h"
|
||||
#include "sodium/randombytes.h"
|
||||
#ifdef __native_client__
|
||||
# include "sodium/randombytes_nativeclient.h"
|
||||
#endif
|
||||
#include "sodium/randombytes_salsa20_random.h"
|
||||
#include "sodium/randombytes_internal_random.h"
|
||||
#include "sodium/randombytes_sysrandom.h"
|
||||
#include "sodium/runtime.h"
|
||||
#include "sodium/utils.h"
|
||||
|
||||
#ifndef SODIUM_LIBRARY_MINIMAL
|
||||
# include "sodium/crypto_box_curve25519xchacha20poly1305.h"
|
||||
# include "sodium/crypto_core_ed25519.h"
|
||||
# include "sodium/crypto_core_ristretto255.h"
|
||||
# include "sodium/crypto_scalarmult_ed25519.h"
|
||||
# include "sodium/crypto_scalarmult_ristretto255.h"
|
||||
# include "sodium/crypto_secretbox_xchacha20poly1305.h"
|
||||
# include "sodium/crypto_stream_aes128ctr.h"
|
||||
# include "sodium/crypto_pwhash_scryptsalsa208sha256.h"
|
||||
# include "sodium/crypto_stream_salsa2012.h"
|
||||
# include "sodium/crypto_stream_salsa208.h"
|
||||
# include "sodium/crypto_stream_xchacha20.h"
|
||||
|
@ -12,6 +12,15 @@ SODIUM_EXPORT
|
||||
int sodium_init(void)
|
||||
__attribute__ ((warn_unused_result));
|
||||
|
||||
/* ---- */
|
||||
|
||||
SODIUM_EXPORT
|
||||
int sodium_set_misuse_handler(void (*handler)(void));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void sodium_misuse(void)
|
||||
__attribute__ ((noreturn));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,6 +1,26 @@
|
||||
#ifndef crypto_aead_aes256gcm_H
|
||||
#define crypto_aead_aes256gcm_H
|
||||
|
||||
/*
|
||||
* WARNING: Despite being the most popular AEAD construction due to its
|
||||
* use in TLS, safely using AES-GCM in a different context is tricky.
|
||||
*
|
||||
* No more than ~ 350 GB of input data should be encrypted with a given key.
|
||||
* This is for ~ 16 KB messages -- Actual figures vary according to
|
||||
* message sizes.
|
||||
*
|
||||
* In addition, nonces are short and repeated nonces would totally destroy
|
||||
* the security of this scheme.
|
||||
*
|
||||
* Nonces should thus come from atomic counters, which can be difficult to
|
||||
* set up in a distributed environment.
|
||||
*
|
||||
* Unless you absolutely need AES-GCM, use crypto_aead_xchacha20poly1305_ietf_*()
|
||||
* instead. It doesn't have any of these limitations.
|
||||
* Or, if you don't need to authenticate additional data, just stick to
|
||||
* crypto_secretbox().
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include "export.h"
|
||||
|
||||
@ -30,7 +50,15 @@ size_t crypto_aead_aes256gcm_npubbytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_aead_aes256gcm_abytes(void);
|
||||
|
||||
typedef CRYPTO_ALIGN(16) unsigned char crypto_aead_aes256gcm_state[512];
|
||||
#define crypto_aead_aes256gcm_MESSAGEBYTES_MAX \
|
||||
SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_aes256gcm_ABYTES, \
|
||||
(16ULL * ((1ULL << 32) - 2ULL)))
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_aead_aes256gcm_messagebytes_max(void);
|
||||
|
||||
typedef struct CRYPTO_ALIGN(16) crypto_aead_aes256gcm_state_ {
|
||||
unsigned char opaque[512];
|
||||
} crypto_aead_aes256gcm_state;
|
||||
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_aead_aes256gcm_statebytes(void);
|
||||
@ -44,7 +72,8 @@ int crypto_aead_aes256gcm_encrypt(unsigned char *c,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *nsec,
|
||||
const unsigned char *npub,
|
||||
const unsigned char *k);
|
||||
const unsigned char *k)
|
||||
__attribute__ ((nonnull(1, 8, 9)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_aes256gcm_decrypt(unsigned char *m,
|
||||
@ -56,7 +85,7 @@ int crypto_aead_aes256gcm_decrypt(unsigned char *m,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *npub,
|
||||
const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_aes256gcm_encrypt_detached(unsigned char *c,
|
||||
@ -68,7 +97,8 @@ int crypto_aead_aes256gcm_encrypt_detached(unsigned char *c,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *nsec,
|
||||
const unsigned char *npub,
|
||||
const unsigned char *k);
|
||||
const unsigned char *k)
|
||||
__attribute__ ((nonnull(1, 2, 9, 10)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_aes256gcm_decrypt_detached(unsigned char *m,
|
||||
@ -80,13 +110,14 @@ int crypto_aead_aes256gcm_decrypt_detached(unsigned char *m,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *npub,
|
||||
const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9)));
|
||||
|
||||
/* -- Precomputation interface -- */
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_aes256gcm_beforenm(crypto_aead_aes256gcm_state *ctx_,
|
||||
const unsigned char *k);
|
||||
const unsigned char *k)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_aes256gcm_encrypt_afternm(unsigned char *c,
|
||||
@ -97,7 +128,8 @@ int crypto_aead_aes256gcm_encrypt_afternm(unsigned char *c,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *nsec,
|
||||
const unsigned char *npub,
|
||||
const crypto_aead_aes256gcm_state *ctx_);
|
||||
const crypto_aead_aes256gcm_state *ctx_)
|
||||
__attribute__ ((nonnull(1, 8, 9)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_aes256gcm_decrypt_afternm(unsigned char *m,
|
||||
@ -109,7 +141,7 @@ int crypto_aead_aes256gcm_decrypt_afternm(unsigned char *m,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *npub,
|
||||
const crypto_aead_aes256gcm_state *ctx_)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_aes256gcm_encrypt_detached_afternm(unsigned char *c,
|
||||
@ -121,7 +153,8 @@ int crypto_aead_aes256gcm_encrypt_detached_afternm(unsigned char *c,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *nsec,
|
||||
const unsigned char *npub,
|
||||
const crypto_aead_aes256gcm_state *ctx_);
|
||||
const crypto_aead_aes256gcm_state *ctx_)
|
||||
__attribute__ ((nonnull(1, 2, 9, 10)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_aes256gcm_decrypt_detached_afternm(unsigned char *m,
|
||||
@ -133,10 +166,11 @@ int crypto_aead_aes256gcm_decrypt_detached_afternm(unsigned char *m,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *npub,
|
||||
const crypto_aead_aes256gcm_state *ctx_)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_aead_aes256gcm_keygen(unsigned char k[crypto_aead_aes256gcm_KEYBYTES]);
|
||||
void crypto_aead_aes256gcm_keygen(unsigned char k[crypto_aead_aes256gcm_KEYBYTES])
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -30,6 +30,12 @@ size_t crypto_aead_chacha20poly1305_ietf_npubbytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_aead_chacha20poly1305_ietf_abytes(void);
|
||||
|
||||
#define crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX \
|
||||
SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_chacha20poly1305_ietf_ABYTES, \
|
||||
(64ULL * ((1ULL << 32) - 1ULL)))
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_aead_chacha20poly1305_ietf_messagebytes_max(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_chacha20poly1305_ietf_encrypt(unsigned char *c,
|
||||
unsigned long long *clen_p,
|
||||
@ -39,7 +45,8 @@ int crypto_aead_chacha20poly1305_ietf_encrypt(unsigned char *c,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *nsec,
|
||||
const unsigned char *npub,
|
||||
const unsigned char *k);
|
||||
const unsigned char *k)
|
||||
__attribute__ ((nonnull(1, 8, 9)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_chacha20poly1305_ietf_decrypt(unsigned char *m,
|
||||
@ -51,7 +58,7 @@ int crypto_aead_chacha20poly1305_ietf_decrypt(unsigned char *m,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *npub,
|
||||
const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_chacha20poly1305_ietf_encrypt_detached(unsigned char *c,
|
||||
@ -63,7 +70,8 @@ int crypto_aead_chacha20poly1305_ietf_encrypt_detached(unsigned char *c,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *nsec,
|
||||
const unsigned char *npub,
|
||||
const unsigned char *k);
|
||||
const unsigned char *k)
|
||||
__attribute__ ((nonnull(1, 2, 9, 10)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_chacha20poly1305_ietf_decrypt_detached(unsigned char *m,
|
||||
@ -75,10 +83,11 @@ int crypto_aead_chacha20poly1305_ietf_decrypt_detached(unsigned char *m,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *npub,
|
||||
const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_aead_chacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_chacha20poly1305_ietf_KEYBYTES]);
|
||||
void crypto_aead_chacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_chacha20poly1305_ietf_KEYBYTES])
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
/* -- Original ChaCha20-Poly1305 construction with a 64-bit nonce and a 64-bit internal counter -- */
|
||||
|
||||
@ -98,6 +107,11 @@ size_t crypto_aead_chacha20poly1305_npubbytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_aead_chacha20poly1305_abytes(void);
|
||||
|
||||
#define crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX \
|
||||
(SODIUM_SIZE_MAX - crypto_aead_chacha20poly1305_ABYTES)
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_aead_chacha20poly1305_messagebytes_max(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_chacha20poly1305_encrypt(unsigned char *c,
|
||||
unsigned long long *clen_p,
|
||||
@ -107,7 +121,8 @@ int crypto_aead_chacha20poly1305_encrypt(unsigned char *c,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *nsec,
|
||||
const unsigned char *npub,
|
||||
const unsigned char *k);
|
||||
const unsigned char *k)
|
||||
__attribute__ ((nonnull(1, 8, 9)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_chacha20poly1305_decrypt(unsigned char *m,
|
||||
@ -119,7 +134,7 @@ int crypto_aead_chacha20poly1305_decrypt(unsigned char *m,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *npub,
|
||||
const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_chacha20poly1305_encrypt_detached(unsigned char *c,
|
||||
@ -131,7 +146,8 @@ int crypto_aead_chacha20poly1305_encrypt_detached(unsigned char *c,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *nsec,
|
||||
const unsigned char *npub,
|
||||
const unsigned char *k);
|
||||
const unsigned char *k)
|
||||
__attribute__ ((nonnull(1, 2, 9, 10)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_chacha20poly1305_decrypt_detached(unsigned char *m,
|
||||
@ -143,17 +159,19 @@ int crypto_aead_chacha20poly1305_decrypt_detached(unsigned char *m,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *npub,
|
||||
const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_aead_chacha20poly1305_keygen(unsigned char k[crypto_aead_chacha20poly1305_KEYBYTES]);
|
||||
void crypto_aead_chacha20poly1305_keygen(unsigned char k[crypto_aead_chacha20poly1305_KEYBYTES])
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
/* Aliases */
|
||||
|
||||
#define crypto_aead_chacha20poly1305_IETF_KEYBYTES crypto_aead_chacha20poly1305_ietf_KEYBYTES
|
||||
#define crypto_aead_chacha20poly1305_IETF_NSECBYTES crypto_aead_chacha20poly1305_ietf_NSECBYTES
|
||||
#define crypto_aead_chacha20poly1305_IETF_NPUBBYTES crypto_aead_chacha20poly1305_ietf_NPUBBYTES
|
||||
#define crypto_aead_chacha20poly1305_IETF_ABYTES crypto_aead_chacha20poly1305_ietf_ABYTES
|
||||
#define crypto_aead_chacha20poly1305_IETF_KEYBYTES crypto_aead_chacha20poly1305_ietf_KEYBYTES
|
||||
#define crypto_aead_chacha20poly1305_IETF_NSECBYTES crypto_aead_chacha20poly1305_ietf_NSECBYTES
|
||||
#define crypto_aead_chacha20poly1305_IETF_NPUBBYTES crypto_aead_chacha20poly1305_ietf_NPUBBYTES
|
||||
#define crypto_aead_chacha20poly1305_IETF_ABYTES crypto_aead_chacha20poly1305_ietf_ABYTES
|
||||
#define crypto_aead_chacha20poly1305_IETF_MESSAGEBYTES_MAX crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -27,6 +27,11 @@ size_t crypto_aead_xchacha20poly1305_ietf_npubbytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_aead_xchacha20poly1305_ietf_abytes(void);
|
||||
|
||||
#define crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX \
|
||||
(SODIUM_SIZE_MAX - crypto_aead_xchacha20poly1305_ietf_ABYTES)
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_aead_xchacha20poly1305_ietf_messagebytes_max(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_xchacha20poly1305_ietf_encrypt(unsigned char *c,
|
||||
unsigned long long *clen_p,
|
||||
@ -36,7 +41,8 @@ int crypto_aead_xchacha20poly1305_ietf_encrypt(unsigned char *c,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *nsec,
|
||||
const unsigned char *npub,
|
||||
const unsigned char *k);
|
||||
const unsigned char *k)
|
||||
__attribute__ ((nonnull(1, 8, 9)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_xchacha20poly1305_ietf_decrypt(unsigned char *m,
|
||||
@ -48,7 +54,7 @@ int crypto_aead_xchacha20poly1305_ietf_decrypt(unsigned char *m,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *npub,
|
||||
const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_xchacha20poly1305_ietf_encrypt_detached(unsigned char *c,
|
||||
@ -60,7 +66,8 @@ int crypto_aead_xchacha20poly1305_ietf_encrypt_detached(unsigned char *c,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *nsec,
|
||||
const unsigned char *npub,
|
||||
const unsigned char *k);
|
||||
const unsigned char *k)
|
||||
__attribute__ ((nonnull(1, 2, 9, 10)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_aead_xchacha20poly1305_ietf_decrypt_detached(unsigned char *m,
|
||||
@ -72,17 +79,19 @@ int crypto_aead_xchacha20poly1305_ietf_decrypt_detached(unsigned char *m,
|
||||
unsigned long long adlen,
|
||||
const unsigned char *npub,
|
||||
const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_aead_xchacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_xchacha20poly1305_ietf_KEYBYTES]);
|
||||
void crypto_aead_xchacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_xchacha20poly1305_ietf_KEYBYTES])
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
/* Aliases */
|
||||
|
||||
#define crypto_aead_xchacha20poly1305_IETF_KEYBYTES crypto_aead_xchacha20poly1305_ietf_KEYBYTES
|
||||
#define crypto_aead_xchacha20poly1305_IETF_NSECBYTES crypto_aead_xchacha20poly1305_ietf_NSECBYTES
|
||||
#define crypto_aead_xchacha20poly1305_IETF_NPUBBYTES crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
|
||||
#define crypto_aead_xchacha20poly1305_IETF_ABYTES crypto_aead_xchacha20poly1305_ietf_ABYTES
|
||||
#define crypto_aead_xchacha20poly1305_IETF_KEYBYTES crypto_aead_xchacha20poly1305_ietf_KEYBYTES
|
||||
#define crypto_aead_xchacha20poly1305_IETF_NSECBYTES crypto_aead_xchacha20poly1305_ietf_NSECBYTES
|
||||
#define crypto_aead_xchacha20poly1305_IETF_NPUBBYTES crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
|
||||
#define crypto_aead_xchacha20poly1305_IETF_ABYTES crypto_aead_xchacha20poly1305_ietf_ABYTES
|
||||
#define crypto_aead_xchacha20poly1305_IETF_MESSAGEBYTES_MAX crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -27,15 +27,17 @@ const char *crypto_auth_primitive(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_auth(unsigned char *out, const unsigned char *in,
|
||||
unsigned long long inlen, const unsigned char *k);
|
||||
unsigned long long inlen, const unsigned char *k)
|
||||
__attribute__ ((nonnull(1, 4)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_auth_verify(const unsigned char *h, const unsigned char *in,
|
||||
unsigned long long inlen, const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_auth_keygen(unsigned char k[crypto_auth_KEYBYTES]);
|
||||
void crypto_auth_keygen(unsigned char k[crypto_auth_KEYBYTES])
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -24,14 +24,14 @@ SODIUM_EXPORT
|
||||
int crypto_auth_hmacsha256(unsigned char *out,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen,
|
||||
const unsigned char *k);
|
||||
const unsigned char *k) __attribute__ ((nonnull(1, 4)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_auth_hmacsha256_verify(const unsigned char *h,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen,
|
||||
const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
@ -46,20 +46,22 @@ size_t crypto_auth_hmacsha256_statebytes(void);
|
||||
SODIUM_EXPORT
|
||||
int crypto_auth_hmacsha256_init(crypto_auth_hmacsha256_state *state,
|
||||
const unsigned char *key,
|
||||
size_t keylen);
|
||||
size_t keylen) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_auth_hmacsha256_update(crypto_auth_hmacsha256_state *state,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen);
|
||||
unsigned long long inlen)
|
||||
__attribute__ ((nonnull(1)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_auth_hmacsha256_final(crypto_auth_hmacsha256_state *state,
|
||||
unsigned char *out);
|
||||
unsigned char *out) __attribute__ ((nonnull));
|
||||
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_auth_hmacsha256_keygen(unsigned char k[crypto_auth_hmacsha256_KEYBYTES]);
|
||||
void crypto_auth_hmacsha256_keygen(unsigned char k[crypto_auth_hmacsha256_KEYBYTES])
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -24,14 +24,14 @@ SODIUM_EXPORT
|
||||
int crypto_auth_hmacsha512(unsigned char *out,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen,
|
||||
const unsigned char *k);
|
||||
const unsigned char *k) __attribute__ ((nonnull(1, 4)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_auth_hmacsha512_verify(const unsigned char *h,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen,
|
||||
const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
@ -46,19 +46,20 @@ size_t crypto_auth_hmacsha512_statebytes(void);
|
||||
SODIUM_EXPORT
|
||||
int crypto_auth_hmacsha512_init(crypto_auth_hmacsha512_state *state,
|
||||
const unsigned char *key,
|
||||
size_t keylen);
|
||||
size_t keylen) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_auth_hmacsha512_update(crypto_auth_hmacsha512_state *state,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen);
|
||||
unsigned long long inlen) __attribute__ ((nonnull(1)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_auth_hmacsha512_final(crypto_auth_hmacsha512_state *state,
|
||||
unsigned char *out);
|
||||
unsigned char *out) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_auth_hmacsha512_keygen(unsigned char k[crypto_auth_hmacsha512_KEYBYTES]);
|
||||
void crypto_auth_hmacsha512_keygen(unsigned char k[crypto_auth_hmacsha512_KEYBYTES])
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -21,15 +21,17 @@ SODIUM_EXPORT
|
||||
size_t crypto_auth_hmacsha512256_keybytes(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_auth_hmacsha512256(unsigned char *out, const unsigned char *in,
|
||||
unsigned long long inlen,const unsigned char *k);
|
||||
int crypto_auth_hmacsha512256(unsigned char *out,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen,
|
||||
const unsigned char *k) __attribute__ ((nonnull(1, 4)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_auth_hmacsha512256_verify(const unsigned char *h,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen,
|
||||
const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
@ -41,19 +43,20 @@ size_t crypto_auth_hmacsha512256_statebytes(void);
|
||||
SODIUM_EXPORT
|
||||
int crypto_auth_hmacsha512256_init(crypto_auth_hmacsha512256_state *state,
|
||||
const unsigned char *key,
|
||||
size_t keylen);
|
||||
size_t keylen) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_auth_hmacsha512256_update(crypto_auth_hmacsha512256_state *state,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen);
|
||||
unsigned long long inlen) __attribute__ ((nonnull(1)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_auth_hmacsha512256_final(crypto_auth_hmacsha512256_state *state,
|
||||
unsigned char *out);
|
||||
unsigned char *out) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_auth_hmacsha512256_keygen(unsigned char k[crypto_auth_hmacsha512256_KEYBYTES]);
|
||||
void crypto_auth_hmacsha512256_keygen(unsigned char k[crypto_auth_hmacsha512256_KEYBYTES])
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -40,35 +40,41 @@ size_t crypto_box_noncebytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_box_macbytes(void);
|
||||
|
||||
#define crypto_box_MESSAGEBYTES_MAX crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_box_messagebytes_max(void);
|
||||
|
||||
#define crypto_box_PRIMITIVE "curve25519xsalsa20poly1305"
|
||||
SODIUM_EXPORT
|
||||
const char *crypto_box_primitive(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_seed_keypair(unsigned char *pk, unsigned char *sk,
|
||||
const unsigned char *seed);
|
||||
const unsigned char *seed)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_keypair(unsigned char *pk, unsigned char *sk);
|
||||
int crypto_box_keypair(unsigned char *pk, unsigned char *sk)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_easy(unsigned char *c, const unsigned char *m,
|
||||
unsigned long long mlen, const unsigned char *n,
|
||||
const unsigned char *pk, const unsigned char *sk)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4, 5, 6)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_open_easy(unsigned char *m, const unsigned char *c,
|
||||
unsigned long long clen, const unsigned char *n,
|
||||
const unsigned char *pk, const unsigned char *sk)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5, 6)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_detached(unsigned char *c, unsigned char *mac,
|
||||
const unsigned char *m, unsigned long long mlen,
|
||||
const unsigned char *n, const unsigned char *pk,
|
||||
const unsigned char *sk)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 2, 5, 6, 7)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_open_detached(unsigned char *m, const unsigned char *c,
|
||||
@ -77,7 +83,7 @@ int crypto_box_open_detached(unsigned char *m, const unsigned char *c,
|
||||
const unsigned char *n,
|
||||
const unsigned char *pk,
|
||||
const unsigned char *sk)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6, 7)));
|
||||
|
||||
/* -- Precomputation interface -- */
|
||||
|
||||
@ -88,30 +94,31 @@ size_t crypto_box_beforenmbytes(void);
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_beforenm(unsigned char *k, const unsigned char *pk,
|
||||
const unsigned char *sk)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_easy_afternm(unsigned char *c, const unsigned char *m,
|
||||
unsigned long long mlen, const unsigned char *n,
|
||||
const unsigned char *k);
|
||||
const unsigned char *k) __attribute__ ((nonnull(1, 4, 5)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_open_easy_afternm(unsigned char *m, const unsigned char *c,
|
||||
unsigned long long clen, const unsigned char *n,
|
||||
const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_detached_afternm(unsigned char *c, unsigned char *mac,
|
||||
const unsigned char *m, unsigned long long mlen,
|
||||
const unsigned char *n, const unsigned char *k);
|
||||
const unsigned char *n, const unsigned char *k)
|
||||
__attribute__ ((nonnull(1, 2, 5, 6)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_open_detached_afternm(unsigned char *m, const unsigned char *c,
|
||||
const unsigned char *mac,
|
||||
unsigned long long clen, const unsigned char *n,
|
||||
const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6)));
|
||||
|
||||
/* -- Ephemeral SK interface -- */
|
||||
|
||||
@ -121,13 +128,14 @@ size_t crypto_box_sealbytes(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_seal(unsigned char *c, const unsigned char *m,
|
||||
unsigned long long mlen, const unsigned char *pk);
|
||||
unsigned long long mlen, const unsigned char *pk)
|
||||
__attribute__ ((nonnull(1, 4)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_seal_open(unsigned char *m, const unsigned char *c,
|
||||
unsigned long long clen,
|
||||
const unsigned char *pk, const unsigned char *sk)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
|
||||
|
||||
/* -- NaCl compatibility interface ; Requires padding -- */
|
||||
|
||||
@ -143,24 +151,24 @@ SODIUM_EXPORT
|
||||
int crypto_box(unsigned char *c, const unsigned char *m,
|
||||
unsigned long long mlen, const unsigned char *n,
|
||||
const unsigned char *pk, const unsigned char *sk)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4, 5, 6)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_open(unsigned char *m, const unsigned char *c,
|
||||
unsigned long long clen, const unsigned char *n,
|
||||
const unsigned char *pk, const unsigned char *sk)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5, 6)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_afternm(unsigned char *c, const unsigned char *m,
|
||||
unsigned long long mlen, const unsigned char *n,
|
||||
const unsigned char *k);
|
||||
const unsigned char *k) __attribute__ ((nonnull(1, 4, 5)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_open_afternm(unsigned char *m, const unsigned char *c,
|
||||
unsigned long long clen, const unsigned char *n,
|
||||
const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#define crypto_box_curve25519xchacha20poly1305_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "crypto_stream_xchacha20.h"
|
||||
#include "export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -36,14 +37,21 @@ size_t crypto_box_curve25519xchacha20poly1305_noncebytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_box_curve25519xchacha20poly1305_macbytes(void);
|
||||
|
||||
#define crypto_box_curve25519xchacha20poly1305_MESSAGEBYTES_MAX \
|
||||
(crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_box_curve25519xchacha20poly1305_MACBYTES)
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_box_curve25519xchacha20poly1305_messagebytes_max(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xchacha20poly1305_seed_keypair(unsigned char *pk,
|
||||
unsigned char *sk,
|
||||
const unsigned char *seed);
|
||||
const unsigned char *seed)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xchacha20poly1305_keypair(unsigned char *pk,
|
||||
unsigned char *sk);
|
||||
unsigned char *sk)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xchacha20poly1305_easy(unsigned char *c,
|
||||
@ -52,7 +60,7 @@ int crypto_box_curve25519xchacha20poly1305_easy(unsigned char *c,
|
||||
const unsigned char *n,
|
||||
const unsigned char *pk,
|
||||
const unsigned char *sk)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4, 5, 6)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xchacha20poly1305_open_easy(unsigned char *m,
|
||||
@ -61,7 +69,7 @@ int crypto_box_curve25519xchacha20poly1305_open_easy(unsigned char *m,
|
||||
const unsigned char *n,
|
||||
const unsigned char *pk,
|
||||
const unsigned char *sk)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5, 6)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xchacha20poly1305_detached(unsigned char *c,
|
||||
@ -71,7 +79,7 @@ int crypto_box_curve25519xchacha20poly1305_detached(unsigned char *c,
|
||||
const unsigned char *n,
|
||||
const unsigned char *pk,
|
||||
const unsigned char *sk)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 2, 5, 6, 7)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xchacha20poly1305_open_detached(unsigned char *m,
|
||||
@ -81,7 +89,7 @@ int crypto_box_curve25519xchacha20poly1305_open_detached(unsigned char *m,
|
||||
const unsigned char *n,
|
||||
const unsigned char *pk,
|
||||
const unsigned char *sk)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6, 7)));
|
||||
|
||||
/* -- Precomputation interface -- */
|
||||
|
||||
@ -89,14 +97,15 @@ SODIUM_EXPORT
|
||||
int crypto_box_curve25519xchacha20poly1305_beforenm(unsigned char *k,
|
||||
const unsigned char *pk,
|
||||
const unsigned char *sk)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xchacha20poly1305_easy_afternm(unsigned char *c,
|
||||
const unsigned char *m,
|
||||
unsigned long long mlen,
|
||||
const unsigned char *n,
|
||||
const unsigned char *k);
|
||||
const unsigned char *k)
|
||||
__attribute__ ((nonnull(1, 4, 5)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xchacha20poly1305_open_easy_afternm(unsigned char *m,
|
||||
@ -104,7 +113,7 @@ int crypto_box_curve25519xchacha20poly1305_open_easy_afternm(unsigned char *m,
|
||||
unsigned long long clen,
|
||||
const unsigned char *n,
|
||||
const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xchacha20poly1305_detached_afternm(unsigned char *c,
|
||||
@ -112,7 +121,8 @@ int crypto_box_curve25519xchacha20poly1305_detached_afternm(unsigned char *c,
|
||||
const unsigned char *m,
|
||||
unsigned long long mlen,
|
||||
const unsigned char *n,
|
||||
const unsigned char *k);
|
||||
const unsigned char *k)
|
||||
__attribute__ ((nonnull(1, 2, 5, 6)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xchacha20poly1305_open_detached_afternm(unsigned char *m,
|
||||
@ -121,7 +131,31 @@ int crypto_box_curve25519xchacha20poly1305_open_detached_afternm(unsigned char *
|
||||
unsigned long long clen,
|
||||
const unsigned char *n,
|
||||
const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6)));
|
||||
|
||||
/* -- Ephemeral SK interface -- */
|
||||
|
||||
#define crypto_box_curve25519xchacha20poly1305_SEALBYTES \
|
||||
(crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES + \
|
||||
crypto_box_curve25519xchacha20poly1305_MACBYTES)
|
||||
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_box_curve25519xchacha20poly1305_sealbytes(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xchacha20poly1305_seal(unsigned char *c,
|
||||
const unsigned char *m,
|
||||
unsigned long long mlen,
|
||||
const unsigned char *pk)
|
||||
__attribute__ ((nonnull(1, 4)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xchacha20poly1305_seal_open(unsigned char *m,
|
||||
const unsigned char *c,
|
||||
unsigned long long clen,
|
||||
const unsigned char *pk,
|
||||
const unsigned char *sk)
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define crypto_box_curve25519xsalsa20poly1305_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "crypto_stream_xsalsa20.h"
|
||||
#include "export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -35,6 +36,31 @@ size_t crypto_box_curve25519xsalsa20poly1305_noncebytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_box_curve25519xsalsa20poly1305_macbytes(void);
|
||||
|
||||
/* Only for the libsodium API - The NaCl compatibility API would require BOXZEROBYTES extra bytes */
|
||||
#define crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX \
|
||||
(crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_box_curve25519xsalsa20poly1305_MACBYTES)
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_box_curve25519xsalsa20poly1305_messagebytes_max(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xsalsa20poly1305_seed_keypair(unsigned char *pk,
|
||||
unsigned char *sk,
|
||||
const unsigned char *seed)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xsalsa20poly1305_keypair(unsigned char *pk,
|
||||
unsigned char *sk)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xsalsa20poly1305_beforenm(unsigned char *k,
|
||||
const unsigned char *pk,
|
||||
const unsigned char *sk)
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
/* -- NaCl compatibility interface ; Requires padding -- */
|
||||
|
||||
#define crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES 16U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_box_curve25519xsalsa20poly1305_boxzerobytes(void);
|
||||
@ -52,7 +78,7 @@ int crypto_box_curve25519xsalsa20poly1305(unsigned char *c,
|
||||
const unsigned char *n,
|
||||
const unsigned char *pk,
|
||||
const unsigned char *sk)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4, 5, 6)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xsalsa20poly1305_open(unsigned char *m,
|
||||
@ -61,29 +87,15 @@ int crypto_box_curve25519xsalsa20poly1305_open(unsigned char *m,
|
||||
const unsigned char *n,
|
||||
const unsigned char *pk,
|
||||
const unsigned char *sk)
|
||||
__attribute__ ((warn_unused_result));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xsalsa20poly1305_seed_keypair(unsigned char *pk,
|
||||
unsigned char *sk,
|
||||
const unsigned char *seed);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xsalsa20poly1305_keypair(unsigned char *pk,
|
||||
unsigned char *sk);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xsalsa20poly1305_beforenm(unsigned char *k,
|
||||
const unsigned char *pk,
|
||||
const unsigned char *sk)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5, 6)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xsalsa20poly1305_afternm(unsigned char *c,
|
||||
const unsigned char *m,
|
||||
unsigned long long mlen,
|
||||
const unsigned char *n,
|
||||
const unsigned char *k);
|
||||
const unsigned char *k)
|
||||
__attribute__ ((nonnull(1, 4, 5)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xsalsa20poly1305_open_afternm(unsigned char *m,
|
||||
@ -91,7 +103,7 @@ int crypto_box_curve25519xsalsa20poly1305_open_afternm(unsigned char *m,
|
||||
unsigned long long clen,
|
||||
const unsigned char *n,
|
||||
const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -0,0 +1,100 @@
|
||||
#ifndef crypto_core_ed25519_H
|
||||
#define crypto_core_ed25519_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define crypto_core_ed25519_BYTES 32
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_core_ed25519_bytes(void);
|
||||
|
||||
#define crypto_core_ed25519_UNIFORMBYTES 32
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_core_ed25519_uniformbytes(void);
|
||||
|
||||
#define crypto_core_ed25519_HASHBYTES 64
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_core_ed25519_hashbytes(void);
|
||||
|
||||
#define crypto_core_ed25519_SCALARBYTES 32
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_core_ed25519_scalarbytes(void);
|
||||
|
||||
#define crypto_core_ed25519_NONREDUCEDSCALARBYTES 64
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_core_ed25519_nonreducedscalarbytes(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_core_ed25519_is_valid_point(const unsigned char *p)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_core_ed25519_add(unsigned char *r,
|
||||
const unsigned char *p, const unsigned char *q)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_core_ed25519_sub(unsigned char *r,
|
||||
const unsigned char *p, const unsigned char *q)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_core_ed25519_from_uniform(unsigned char *p, const unsigned char *r)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_core_ed25519_from_hash(unsigned char *p, const unsigned char *h)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_core_ed25519_random(unsigned char *p)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_core_ed25519_scalar_random(unsigned char *r)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_core_ed25519_scalar_invert(unsigned char *recip, const unsigned char *s)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_core_ed25519_scalar_negate(unsigned char *neg, const unsigned char *s)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_core_ed25519_scalar_complement(unsigned char *comp, const unsigned char *s)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_core_ed25519_scalar_add(unsigned char *z, const unsigned char *x,
|
||||
const unsigned char *y)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_core_ed25519_scalar_sub(unsigned char *z, const unsigned char *x,
|
||||
const unsigned char *y)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_core_ed25519_scalar_mul(unsigned char *z, const unsigned char *x,
|
||||
const unsigned char *y)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
/*
|
||||
* The interval `s` is sampled from should be at least 317 bits to ensure almost
|
||||
* uniformity of `r` over `L`.
|
||||
*/
|
||||
SODIUM_EXPORT
|
||||
void crypto_core_ed25519_scalar_reduce(unsigned char *r, const unsigned char *s)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -26,7 +26,8 @@ size_t crypto_core_hchacha20_constbytes(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_core_hchacha20(unsigned char *out, const unsigned char *in,
|
||||
const unsigned char *k, const unsigned char *c);
|
||||
const unsigned char *k, const unsigned char *c)
|
||||
__attribute__ ((nonnull(1, 2, 3)));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -26,7 +26,8 @@ size_t crypto_core_hsalsa20_constbytes(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_core_hsalsa20(unsigned char *out, const unsigned char *in,
|
||||
const unsigned char *k, const unsigned char *c);
|
||||
const unsigned char *k, const unsigned char *c)
|
||||
__attribute__ ((nonnull(1, 2, 3)));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -0,0 +1,100 @@
|
||||
#ifndef crypto_core_ristretto255_H
|
||||
#define crypto_core_ristretto255_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define crypto_core_ristretto255_BYTES 32
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_core_ristretto255_bytes(void);
|
||||
|
||||
#define crypto_core_ristretto255_HASHBYTES 64
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_core_ristretto255_hashbytes(void);
|
||||
|
||||
#define crypto_core_ristretto255_SCALARBYTES 32
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_core_ristretto255_scalarbytes(void);
|
||||
|
||||
#define crypto_core_ristretto255_NONREDUCEDSCALARBYTES 64
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_core_ristretto255_nonreducedscalarbytes(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_core_ristretto255_is_valid_point(const unsigned char *p)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_core_ristretto255_add(unsigned char *r,
|
||||
const unsigned char *p, const unsigned char *q)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_core_ristretto255_sub(unsigned char *r,
|
||||
const unsigned char *p, const unsigned char *q)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_core_ristretto255_from_hash(unsigned char *p,
|
||||
const unsigned char *r)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_core_ristretto255_random(unsigned char *p)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_core_ristretto255_scalar_random(unsigned char *r)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_core_ristretto255_scalar_invert(unsigned char *recip,
|
||||
const unsigned char *s)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_core_ristretto255_scalar_negate(unsigned char *neg,
|
||||
const unsigned char *s)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_core_ristretto255_scalar_complement(unsigned char *comp,
|
||||
const unsigned char *s)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_core_ristretto255_scalar_add(unsigned char *z,
|
||||
const unsigned char *x,
|
||||
const unsigned char *y)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_core_ristretto255_scalar_sub(unsigned char *z,
|
||||
const unsigned char *x,
|
||||
const unsigned char *y)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_core_ristretto255_scalar_mul(unsigned char *z,
|
||||
const unsigned char *x,
|
||||
const unsigned char *y)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
/*
|
||||
* The interval `s` is sampled from should be at least 317 bits to ensure almost
|
||||
* uniformity of `r` over `L`.
|
||||
*/
|
||||
SODIUM_EXPORT
|
||||
void crypto_core_ristretto255_scalar_reduce(unsigned char *r,
|
||||
const unsigned char *s)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -26,7 +26,8 @@ size_t crypto_core_salsa20_constbytes(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_core_salsa20(unsigned char *out, const unsigned char *in,
|
||||
const unsigned char *k, const unsigned char *c);
|
||||
const unsigned char *k, const unsigned char *c)
|
||||
__attribute__ ((nonnull(1, 2, 3)));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -26,7 +26,8 @@ size_t crypto_core_salsa2012_constbytes(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_core_salsa2012(unsigned char *out, const unsigned char *in,
|
||||
const unsigned char *k, const unsigned char *c);
|
||||
const unsigned char *k, const unsigned char *c)
|
||||
__attribute__ ((nonnull(1, 2, 3)));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -10,23 +10,28 @@ extern "C" {
|
||||
|
||||
#define crypto_core_salsa208_OUTPUTBYTES 64U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_core_salsa208_outputbytes(void);
|
||||
size_t crypto_core_salsa208_outputbytes(void)
|
||||
__attribute__ ((deprecated));
|
||||
|
||||
#define crypto_core_salsa208_INPUTBYTES 16U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_core_salsa208_inputbytes(void);
|
||||
size_t crypto_core_salsa208_inputbytes(void)
|
||||
__attribute__ ((deprecated));
|
||||
|
||||
#define crypto_core_salsa208_KEYBYTES 32U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_core_salsa208_keybytes(void);
|
||||
size_t crypto_core_salsa208_keybytes(void)
|
||||
__attribute__ ((deprecated));
|
||||
|
||||
#define crypto_core_salsa208_CONSTBYTES 16U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_core_salsa208_constbytes(void);
|
||||
size_t crypto_core_salsa208_constbytes(void)
|
||||
__attribute__ ((deprecated));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_core_salsa208(unsigned char *out, const unsigned char *in,
|
||||
const unsigned char *k, const unsigned char *c);
|
||||
const unsigned char *k, const unsigned char *c)
|
||||
__attribute__ ((nonnull(1, 2, 3)));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -41,6 +41,10 @@ size_t crypto_generichash_keybytes(void);
|
||||
SODIUM_EXPORT
|
||||
const char *crypto_generichash_primitive(void);
|
||||
|
||||
/*
|
||||
* Important when writing bindings for other programming languages:
|
||||
* the state address should be 64-bytes aligned.
|
||||
*/
|
||||
typedef crypto_generichash_blake2b_state crypto_generichash_state;
|
||||
|
||||
SODIUM_EXPORT
|
||||
@ -49,24 +53,29 @@ size_t crypto_generichash_statebytes(void);
|
||||
SODIUM_EXPORT
|
||||
int crypto_generichash(unsigned char *out, size_t outlen,
|
||||
const unsigned char *in, unsigned long long inlen,
|
||||
const unsigned char *key, size_t keylen);
|
||||
const unsigned char *key, size_t keylen)
|
||||
__attribute__ ((nonnull(1)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_generichash_init(crypto_generichash_state *state,
|
||||
const unsigned char *key,
|
||||
const size_t keylen, const size_t outlen);
|
||||
const size_t keylen, const size_t outlen)
|
||||
__attribute__ ((nonnull(1)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_generichash_update(crypto_generichash_state *state,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen);
|
||||
unsigned long long inlen)
|
||||
__attribute__ ((nonnull(1)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_generichash_final(crypto_generichash_state *state,
|
||||
unsigned char *out, const size_t outlen);
|
||||
unsigned char *out, const size_t outlen)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_generichash_keygen(unsigned char k[crypto_generichash_KEYBYTES]);
|
||||
void crypto_generichash_keygen(unsigned char k[crypto_generichash_KEYBYTES])
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -20,13 +20,8 @@ extern "C" {
|
||||
# pragma pack(push, 1)
|
||||
#endif
|
||||
|
||||
typedef CRYPTO_ALIGN(64) struct crypto_generichash_blake2b_state {
|
||||
uint64_t h[8];
|
||||
uint64_t t[2];
|
||||
uint64_t f[2];
|
||||
uint8_t buf[2 * 128];
|
||||
size_t buflen;
|
||||
uint8_t last_node;
|
||||
typedef struct CRYPTO_ALIGN(64) crypto_generichash_blake2b_state {
|
||||
unsigned char opaque[384];
|
||||
} crypto_generichash_blake2b_state;
|
||||
|
||||
#if defined(__IBMC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
||||
@ -74,7 +69,8 @@ SODIUM_EXPORT
|
||||
int crypto_generichash_blake2b(unsigned char *out, size_t outlen,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen,
|
||||
const unsigned char *key, size_t keylen);
|
||||
const unsigned char *key, size_t keylen)
|
||||
__attribute__ ((nonnull(1)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_generichash_blake2b_salt_personal(unsigned char *out, size_t outlen,
|
||||
@ -83,36 +79,37 @@ int crypto_generichash_blake2b_salt_personal(unsigned char *out, size_t outlen,
|
||||
const unsigned char *key,
|
||||
size_t keylen,
|
||||
const unsigned char *salt,
|
||||
const unsigned char *personal);
|
||||
const unsigned char *personal)
|
||||
__attribute__ ((nonnull(1)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_generichash_blake2b_init(crypto_generichash_blake2b_state *state,
|
||||
const unsigned char *key,
|
||||
const size_t keylen, const size_t outlen);
|
||||
const size_t keylen, const size_t outlen)
|
||||
__attribute__ ((nonnull(1)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_generichash_blake2b_init_salt_personal(crypto_generichash_blake2b_state *state,
|
||||
const unsigned char *key,
|
||||
const size_t keylen, const size_t outlen,
|
||||
const unsigned char *salt,
|
||||
const unsigned char *personal);
|
||||
const unsigned char *personal)
|
||||
__attribute__ ((nonnull(1)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_generichash_blake2b_update(crypto_generichash_blake2b_state *state,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen);
|
||||
unsigned long long inlen)
|
||||
__attribute__ ((nonnull(1)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_generichash_blake2b_final(crypto_generichash_blake2b_state *state,
|
||||
unsigned char *out,
|
||||
const size_t outlen);
|
||||
const size_t outlen) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_generichash_blake2b_keygen(unsigned char k[crypto_generichash_blake2b_KEYBYTES]);
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
int _crypto_generichash_blake2b_pick_best_implementation(void);
|
||||
void crypto_generichash_blake2b_keygen(unsigned char k[crypto_generichash_blake2b_KEYBYTES])
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ size_t crypto_hash_bytes(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_hash(unsigned char *out, const unsigned char *in,
|
||||
unsigned long long inlen);
|
||||
unsigned long long inlen) __attribute__ ((nonnull(1)));
|
||||
|
||||
#define crypto_hash_PRIMITIVE "sha512"
|
||||
SODIUM_EXPORT
|
||||
|
@ -36,19 +36,22 @@ size_t crypto_hash_sha256_bytes(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_hash_sha256(unsigned char *out, const unsigned char *in,
|
||||
unsigned long long inlen);
|
||||
unsigned long long inlen) __attribute__ ((nonnull(1)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_hash_sha256_init(crypto_hash_sha256_state *state);
|
||||
int crypto_hash_sha256_init(crypto_hash_sha256_state *state)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_hash_sha256_update(crypto_hash_sha256_state *state,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen);
|
||||
unsigned long long inlen)
|
||||
__attribute__ ((nonnull(1)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_hash_sha256_final(crypto_hash_sha256_state *state,
|
||||
unsigned char *out);
|
||||
unsigned char *out)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -36,19 +36,22 @@ size_t crypto_hash_sha512_bytes(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_hash_sha512(unsigned char *out, const unsigned char *in,
|
||||
unsigned long long inlen);
|
||||
unsigned long long inlen) __attribute__ ((nonnull(1)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_hash_sha512_init(crypto_hash_sha512_state *state);
|
||||
int crypto_hash_sha512_init(crypto_hash_sha512_state *state)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_hash_sha512_update(crypto_hash_sha512_state *state,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen);
|
||||
unsigned long long inlen)
|
||||
__attribute__ ((nonnull(1)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_hash_sha512_final(crypto_hash_sha512_state *state,
|
||||
unsigned char *out);
|
||||
unsigned char *out)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -39,10 +39,12 @@ SODIUM_EXPORT
|
||||
int crypto_kdf_derive_from_key(unsigned char *subkey, size_t subkey_len,
|
||||
uint64_t subkey_id,
|
||||
const char ctx[crypto_kdf_CONTEXTBYTES],
|
||||
const unsigned char key[crypto_kdf_KEYBYTES]);
|
||||
const unsigned char key[crypto_kdf_KEYBYTES])
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_kdf_keygen(unsigned char k[crypto_kdf_KEYBYTES]);
|
||||
void crypto_kdf_keygen(unsigned char k[crypto_kdf_KEYBYTES])
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -34,7 +34,9 @@ SODIUM_EXPORT
|
||||
int crypto_kdf_blake2b_derive_from_key(unsigned char *subkey, size_t subkey_len,
|
||||
uint64_t subkey_id,
|
||||
const char ctx[crypto_kdf_blake2b_CONTEXTBYTES],
|
||||
const unsigned char key[crypto_kdf_blake2b_KEYBYTES]);
|
||||
const unsigned char key[crypto_kdf_blake2b_KEYBYTES])
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -35,11 +35,13 @@ const char *crypto_kx_primitive(void);
|
||||
SODIUM_EXPORT
|
||||
int crypto_kx_seed_keypair(unsigned char pk[crypto_kx_PUBLICKEYBYTES],
|
||||
unsigned char sk[crypto_kx_SECRETKEYBYTES],
|
||||
const unsigned char seed[crypto_kx_SEEDBYTES]);
|
||||
const unsigned char seed[crypto_kx_SEEDBYTES])
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_kx_keypair(unsigned char pk[crypto_kx_PUBLICKEYBYTES],
|
||||
unsigned char sk[crypto_kx_SECRETKEYBYTES]);
|
||||
unsigned char sk[crypto_kx_SECRETKEYBYTES])
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_kx_client_session_keys(unsigned char rx[crypto_kx_SESSIONKEYBYTES],
|
||||
@ -47,7 +49,7 @@ int crypto_kx_client_session_keys(unsigned char rx[crypto_kx_SESSIONKEYBYTES],
|
||||
const unsigned char client_pk[crypto_kx_PUBLICKEYBYTES],
|
||||
const unsigned char client_sk[crypto_kx_SECRETKEYBYTES],
|
||||
const unsigned char server_pk[crypto_kx_PUBLICKEYBYTES])
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 4, 5)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_kx_server_session_keys(unsigned char rx[crypto_kx_SESSIONKEYBYTES],
|
||||
@ -55,7 +57,7 @@ int crypto_kx_server_session_keys(unsigned char rx[crypto_kx_SESSIONKEYBYTES],
|
||||
const unsigned char server_pk[crypto_kx_PUBLICKEYBYTES],
|
||||
const unsigned char server_sk[crypto_kx_SECRETKEYBYTES],
|
||||
const unsigned char client_pk[crypto_kx_PUBLICKEYBYTES])
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 4, 5)));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -32,28 +32,31 @@ const char *crypto_onetimeauth_primitive(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_onetimeauth(unsigned char *out, const unsigned char *in,
|
||||
unsigned long long inlen, const unsigned char *k);
|
||||
unsigned long long inlen, const unsigned char *k)
|
||||
__attribute__ ((nonnull(1, 4)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_onetimeauth_verify(const unsigned char *h, const unsigned char *in,
|
||||
unsigned long long inlen, const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_onetimeauth_init(crypto_onetimeauth_state *state,
|
||||
const unsigned char *key);
|
||||
const unsigned char *key) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_onetimeauth_update(crypto_onetimeauth_state *state,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen);
|
||||
unsigned long long inlen)
|
||||
__attribute__ ((nonnull(1)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_onetimeauth_final(crypto_onetimeauth_state *state,
|
||||
unsigned char *out);
|
||||
unsigned char *out) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_onetimeauth_keygen(unsigned char k[crypto_onetimeauth_KEYBYTES]);
|
||||
void crypto_onetimeauth_keygen(unsigned char k[crypto_onetimeauth_KEYBYTES])
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ extern "C" {
|
||||
|
||||
#include "export.h"
|
||||
|
||||
typedef CRYPTO_ALIGN(16) struct crypto_onetimeauth_poly1305_state {
|
||||
typedef struct CRYPTO_ALIGN(16) crypto_onetimeauth_poly1305_state {
|
||||
unsigned char opaque[256];
|
||||
} crypto_onetimeauth_poly1305_state;
|
||||
|
||||
@ -35,34 +35,35 @@ SODIUM_EXPORT
|
||||
int crypto_onetimeauth_poly1305(unsigned char *out,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen,
|
||||
const unsigned char *k);
|
||||
const unsigned char *k)
|
||||
__attribute__ ((nonnull(1, 4)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_onetimeauth_poly1305_verify(const unsigned char *h,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen,
|
||||
const unsigned char *k)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_onetimeauth_poly1305_init(crypto_onetimeauth_poly1305_state *state,
|
||||
const unsigned char *key);
|
||||
const unsigned char *key)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_onetimeauth_poly1305_update(crypto_onetimeauth_poly1305_state *state,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen);
|
||||
unsigned long long inlen)
|
||||
__attribute__ ((nonnull(1)));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_onetimeauth_poly1305_final(crypto_onetimeauth_poly1305_state *state,
|
||||
unsigned char *out);
|
||||
unsigned char *out)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
void crypto_onetimeauth_poly1305_keygen(unsigned char k[crypto_onetimeauth_poly1305_KEYBYTES]);
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
int _crypto_onetimeauth_poly1305_pick_best_implementation(void);
|
||||
void crypto_onetimeauth_poly1305_keygen(unsigned char k[crypto_onetimeauth_poly1305_KEYBYTES])
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <stddef.h>
|
||||
|
||||
#include "crypto_pwhash_argon2i.h"
|
||||
#include "crypto_pwhash_argon2id.h"
|
||||
#include "export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -17,96 +18,122 @@ extern "C" {
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_alg_argon2i13(void);
|
||||
|
||||
#define crypto_pwhash_ALG_DEFAULT crypto_pwhash_ALG_ARGON2I13
|
||||
#define crypto_pwhash_ALG_ARGON2ID13 crypto_pwhash_argon2id_ALG_ARGON2ID13
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_alg_argon2id13(void);
|
||||
|
||||
#define crypto_pwhash_ALG_DEFAULT crypto_pwhash_ALG_ARGON2ID13
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_alg_default(void);
|
||||
|
||||
#define crypto_pwhash_BYTES_MIN crypto_pwhash_argon2i_BYTES_MIN
|
||||
#define crypto_pwhash_BYTES_MIN crypto_pwhash_argon2id_BYTES_MIN
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_bytes_min(void);
|
||||
|
||||
#define crypto_pwhash_BYTES_MAX crypto_pwhash_argon2i_BYTES_MAX
|
||||
#define crypto_pwhash_BYTES_MAX crypto_pwhash_argon2id_BYTES_MAX
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_bytes_max(void);
|
||||
|
||||
#define crypto_pwhash_PASSWD_MIN crypto_pwhash_argon2i_PASSWD_MIN
|
||||
#define crypto_pwhash_PASSWD_MIN crypto_pwhash_argon2id_PASSWD_MIN
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_passwd_min(void);
|
||||
|
||||
#define crypto_pwhash_PASSWD_MAX crypto_pwhash_argon2i_PASSWD_MAX
|
||||
#define crypto_pwhash_PASSWD_MAX crypto_pwhash_argon2id_PASSWD_MAX
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_passwd_max(void);
|
||||
|
||||
#define crypto_pwhash_SALTBYTES crypto_pwhash_argon2i_SALTBYTES
|
||||
#define crypto_pwhash_SALTBYTES crypto_pwhash_argon2id_SALTBYTES
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_saltbytes(void);
|
||||
|
||||
#define crypto_pwhash_STRBYTES crypto_pwhash_argon2i_STRBYTES
|
||||
#define crypto_pwhash_STRBYTES crypto_pwhash_argon2id_STRBYTES
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_strbytes(void);
|
||||
|
||||
#define crypto_pwhash_STRPREFIX crypto_pwhash_argon2i_STRPREFIX
|
||||
#define crypto_pwhash_STRPREFIX crypto_pwhash_argon2id_STRPREFIX
|
||||
SODIUM_EXPORT
|
||||
const char *crypto_pwhash_strprefix(void);
|
||||
|
||||
#define crypto_pwhash_OPSLIMIT_MIN crypto_pwhash_argon2i_OPSLIMIT_MIN
|
||||
#define crypto_pwhash_OPSLIMIT_MIN crypto_pwhash_argon2id_OPSLIMIT_MIN
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_opslimit_min(void);
|
||||
|
||||
#define crypto_pwhash_OPSLIMIT_MAX crypto_pwhash_argon2i_OPSLIMIT_MAX
|
||||
#define crypto_pwhash_OPSLIMIT_MAX crypto_pwhash_argon2id_OPSLIMIT_MAX
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_opslimit_max(void);
|
||||
|
||||
#define crypto_pwhash_MEMLIMIT_MIN crypto_pwhash_argon2i_MEMLIMIT_MIN
|
||||
#define crypto_pwhash_MEMLIMIT_MIN crypto_pwhash_argon2id_MEMLIMIT_MIN
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_memlimit_min(void);
|
||||
|
||||
#define crypto_pwhash_MEMLIMIT_MAX crypto_pwhash_argon2i_MEMLIMIT_MAX
|
||||
#define crypto_pwhash_MEMLIMIT_MAX crypto_pwhash_argon2id_MEMLIMIT_MAX
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_memlimit_max(void);
|
||||
|
||||
#define crypto_pwhash_OPSLIMIT_INTERACTIVE crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE
|
||||
#define crypto_pwhash_OPSLIMIT_INTERACTIVE crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_opslimit_interactive(void);
|
||||
|
||||
#define crypto_pwhash_MEMLIMIT_INTERACTIVE crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE
|
||||
#define crypto_pwhash_MEMLIMIT_INTERACTIVE crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_memlimit_interactive(void);
|
||||
|
||||
#define crypto_pwhash_OPSLIMIT_MODERATE crypto_pwhash_argon2i_OPSLIMIT_MODERATE
|
||||
#define crypto_pwhash_OPSLIMIT_MODERATE crypto_pwhash_argon2id_OPSLIMIT_MODERATE
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_opslimit_moderate(void);
|
||||
|
||||
#define crypto_pwhash_MEMLIMIT_MODERATE crypto_pwhash_argon2i_MEMLIMIT_MODERATE
|
||||
#define crypto_pwhash_MEMLIMIT_MODERATE crypto_pwhash_argon2id_MEMLIMIT_MODERATE
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_memlimit_moderate(void);
|
||||
|
||||
#define crypto_pwhash_OPSLIMIT_SENSITIVE crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE
|
||||
#define crypto_pwhash_OPSLIMIT_SENSITIVE crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_opslimit_sensitive(void);
|
||||
|
||||
#define crypto_pwhash_MEMLIMIT_SENSITIVE crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE
|
||||
#define crypto_pwhash_MEMLIMIT_SENSITIVE crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_memlimit_sensitive(void);
|
||||
|
||||
/*
|
||||
* With this function, do not forget to store all parameters, including the
|
||||
* algorithm identifier in order to produce deterministic output.
|
||||
* The crypto_pwhash_* definitions, including crypto_pwhash_ALG_DEFAULT,
|
||||
* may change.
|
||||
*/
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash(unsigned char * const out, unsigned long long outlen,
|
||||
const char * const passwd, unsigned long long passwdlen,
|
||||
const unsigned char * const salt,
|
||||
unsigned long long opslimit, size_t memlimit, int alg)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
/*
|
||||
* The output string already includes all the required parameters, including
|
||||
* the algorithm identifier. The string is all that has to be stored in
|
||||
* order to verify a password.
|
||||
*/
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_str(char out[crypto_pwhash_STRBYTES],
|
||||
const char * const passwd, unsigned long long passwdlen,
|
||||
unsigned long long opslimit, size_t memlimit)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_str_alg(char out[crypto_pwhash_STRBYTES],
|
||||
const char * const passwd, unsigned long long passwdlen,
|
||||
unsigned long long opslimit, size_t memlimit, int alg)
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_str_verify(const char str[crypto_pwhash_STRBYTES],
|
||||
const char * const passwd,
|
||||
unsigned long long passwdlen)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_str_needs_rehash(const char str[crypto_pwhash_STRBYTES],
|
||||
unsigned long long opslimit, size_t memlimit)
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
#define crypto_pwhash_PRIMITIVE "argon2i"
|
||||
SODIUM_EXPORT
|
||||
@ -118,4 +145,3 @@ const char *crypto_pwhash_primitive(void)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -22,7 +22,7 @@ int crypto_pwhash_argon2i_alg_argon2i13(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2i_bytes_min(void);
|
||||
|
||||
#define crypto_pwhash_argon2i_BYTES_MAX 4294967295U
|
||||
#define crypto_pwhash_argon2i_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 4294967295U)
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2i_bytes_max(void);
|
||||
|
||||
@ -54,11 +54,12 @@ size_t crypto_pwhash_argon2i_opslimit_min(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2i_opslimit_max(void);
|
||||
|
||||
#define crypto_pwhash_argon2i_MEMLIMIT_MIN 1U
|
||||
#define crypto_pwhash_argon2i_MEMLIMIT_MIN 8192U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2i_memlimit_min(void);
|
||||
|
||||
#define crypto_pwhash_argon2i_MEMLIMIT_MAX ((SIZE_MAX >= 1ULL << 48) ? 4398046510080U : (SIZE_MAX >= 1ULL << 32) ? 2147483648U : 32768U)
|
||||
#define crypto_pwhash_argon2i_MEMLIMIT_MAX \
|
||||
((SIZE_MAX >= 4398046510080U) ? 4398046510080U : (SIZE_MAX >= 2147483648U) ? 2147483648U : 32768U)
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2i_memlimit_max(void);
|
||||
|
||||
@ -94,24 +95,25 @@ int crypto_pwhash_argon2i(unsigned char * const out,
|
||||
const unsigned char * const salt,
|
||||
unsigned long long opslimit, size_t memlimit,
|
||||
int alg)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_argon2i_str(char out[crypto_pwhash_argon2i_STRBYTES],
|
||||
const char * const passwd,
|
||||
unsigned long long passwdlen,
|
||||
unsigned long long opslimit, size_t memlimit)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_argon2i_str_verify(const char str[crypto_pwhash_argon2i_STRBYTES],
|
||||
const char * const passwd,
|
||||
unsigned long long passwdlen)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
int _crypto_pwhash_argon2i_pick_best_implementation(void);
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_argon2i_str_needs_rehash(const char str[crypto_pwhash_argon2i_STRBYTES],
|
||||
unsigned long long opslimit, size_t memlimit)
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -0,0 +1,122 @@
|
||||
#ifndef crypto_pwhash_argon2id_H
|
||||
#define crypto_pwhash_argon2id_H
|
||||
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __GNUC__
|
||||
# pragma GCC diagnostic ignored "-Wlong-long"
|
||||
# endif
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define crypto_pwhash_argon2id_ALG_ARGON2ID13 2
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_argon2id_alg_argon2id13(void);
|
||||
|
||||
#define crypto_pwhash_argon2id_BYTES_MIN 16U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2id_bytes_min(void);
|
||||
|
||||
#define crypto_pwhash_argon2id_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 4294967295U)
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2id_bytes_max(void);
|
||||
|
||||
#define crypto_pwhash_argon2id_PASSWD_MIN 0U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2id_passwd_min(void);
|
||||
|
||||
#define crypto_pwhash_argon2id_PASSWD_MAX 4294967295U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2id_passwd_max(void);
|
||||
|
||||
#define crypto_pwhash_argon2id_SALTBYTES 16U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2id_saltbytes(void);
|
||||
|
||||
#define crypto_pwhash_argon2id_STRBYTES 128U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2id_strbytes(void);
|
||||
|
||||
#define crypto_pwhash_argon2id_STRPREFIX "$argon2id$"
|
||||
SODIUM_EXPORT
|
||||
const char *crypto_pwhash_argon2id_strprefix(void);
|
||||
|
||||
#define crypto_pwhash_argon2id_OPSLIMIT_MIN 1U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2id_opslimit_min(void);
|
||||
|
||||
#define crypto_pwhash_argon2id_OPSLIMIT_MAX 4294967295U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2id_opslimit_max(void);
|
||||
|
||||
#define crypto_pwhash_argon2id_MEMLIMIT_MIN 8192U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2id_memlimit_min(void);
|
||||
|
||||
#define crypto_pwhash_argon2id_MEMLIMIT_MAX \
|
||||
((SIZE_MAX >= 4398046510080U) ? 4398046510080U : (SIZE_MAX >= 2147483648U) ? 2147483648U : 32768U)
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2id_memlimit_max(void);
|
||||
|
||||
#define crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE 2U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2id_opslimit_interactive(void);
|
||||
|
||||
#define crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE 67108864U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2id_memlimit_interactive(void);
|
||||
|
||||
#define crypto_pwhash_argon2id_OPSLIMIT_MODERATE 3U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2id_opslimit_moderate(void);
|
||||
|
||||
#define crypto_pwhash_argon2id_MEMLIMIT_MODERATE 268435456U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2id_memlimit_moderate(void);
|
||||
|
||||
#define crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE 4U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2id_opslimit_sensitive(void);
|
||||
|
||||
#define crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE 1073741824U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_argon2id_memlimit_sensitive(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_argon2id(unsigned char * const out,
|
||||
unsigned long long outlen,
|
||||
const char * const passwd,
|
||||
unsigned long long passwdlen,
|
||||
const unsigned char * const salt,
|
||||
unsigned long long opslimit, size_t memlimit,
|
||||
int alg)
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_argon2id_str(char out[crypto_pwhash_argon2id_STRBYTES],
|
||||
const char * const passwd,
|
||||
unsigned long long passwdlen,
|
||||
unsigned long long opslimit, size_t memlimit)
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_argon2id_str_verify(const char str[crypto_pwhash_argon2id_STRBYTES],
|
||||
const char * const passwd,
|
||||
unsigned long long passwdlen)
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_argon2id_str_needs_rehash(const char str[crypto_pwhash_argon2id_STRBYTES],
|
||||
unsigned long long opslimit, size_t memlimit)
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -18,7 +18,8 @@ extern "C" {
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_scryptsalsa208sha256_bytes_min(void);
|
||||
|
||||
#define crypto_pwhash_scryptsalsa208sha256_BYTES_MAX SIZE_MAX
|
||||
#define crypto_pwhash_scryptsalsa208sha256_BYTES_MAX \
|
||||
SODIUM_MIN(SODIUM_SIZE_MAX, 0x1fffffffe0ULL)
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_scryptsalsa208sha256_bytes_max(void);
|
||||
|
||||
@ -26,7 +27,7 @@ size_t crypto_pwhash_scryptsalsa208sha256_bytes_max(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_scryptsalsa208sha256_passwd_min(void);
|
||||
|
||||
#define crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX SIZE_MAX
|
||||
#define crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX SODIUM_SIZE_MAX
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_scryptsalsa208sha256_passwd_max(void);
|
||||
|
||||
@ -54,7 +55,8 @@ size_t crypto_pwhash_scryptsalsa208sha256_opslimit_max(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_scryptsalsa208sha256_memlimit_min(void);
|
||||
|
||||
#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX ((SIZE_MAX >= 68719476736U) ? 68719476736U : SIZE_MAX)
|
||||
#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX \
|
||||
SODIUM_MIN(SIZE_MAX, 68719476736ULL)
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_pwhash_scryptsalsa208sha256_memlimit_max(void);
|
||||
|
||||
@ -82,7 +84,7 @@ int crypto_pwhash_scryptsalsa208sha256(unsigned char * const out,
|
||||
const unsigned char * const salt,
|
||||
unsigned long long opslimit,
|
||||
size_t memlimit)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_scryptsalsa208sha256_str(char out[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
|
||||
@ -90,20 +92,26 @@ int crypto_pwhash_scryptsalsa208sha256_str(char out[crypto_pwhash_scryptsalsa208
|
||||
unsigned long long passwdlen,
|
||||
unsigned long long opslimit,
|
||||
size_t memlimit)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_scryptsalsa208sha256_str_verify(const char str[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
|
||||
const char * const passwd,
|
||||
unsigned long long passwdlen)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_scryptsalsa208sha256_ll(const uint8_t * passwd, size_t passwdlen,
|
||||
const uint8_t * salt, size_t saltlen,
|
||||
uint64_t N, uint32_t r, uint32_t p,
|
||||
uint8_t * buf, size_t buflen)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_pwhash_scryptsalsa208sha256_str_needs_rehash(const char str[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
|
||||
unsigned long long opslimit,
|
||||
size_t memlimit)
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -23,12 +23,21 @@ SODIUM_EXPORT
|
||||
const char *crypto_scalarmult_primitive(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_scalarmult_base(unsigned char *q, const unsigned char *n);
|
||||
int crypto_scalarmult_base(unsigned char *q, const unsigned char *n)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
/*
|
||||
* NOTE: Do not use the result of this function directly for key exchange.
|
||||
*
|
||||
* Hash the result with the public keys in order to compute a shared
|
||||
* secret key: H(q || client_pk || server_pk)
|
||||
*
|
||||
* Or unless this is not an option, use the crypto_kx() API instead.
|
||||
*/
|
||||
SODIUM_EXPORT
|
||||
int crypto_scalarmult(unsigned char *q, const unsigned char *n,
|
||||
const unsigned char *p)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -17,17 +17,23 @@ size_t crypto_scalarmult_curve25519_bytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_scalarmult_curve25519_scalarbytes(void);
|
||||
|
||||
/*
|
||||
* NOTE: Do not use the result of this function directly for key exchange.
|
||||
*
|
||||
* Hash the result with the public keys in order to compute a shared
|
||||
* secret key: H(q || client_pk || server_pk)
|
||||
*
|
||||
* Or unless this is not an option, use the crypto_kx() API instead.
|
||||
*/
|
||||
SODIUM_EXPORT
|
||||
int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
|
||||
const unsigned char *p)
|
||||
__attribute__ ((warn_unused_result));
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_scalarmult_curve25519_base(unsigned char *q, const unsigned char *n);
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
int _crypto_scalarmult_curve25519_pick_best_implementation(void);
|
||||
int crypto_scalarmult_curve25519_base(unsigned char *q,
|
||||
const unsigned char *n)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -0,0 +1,51 @@
|
||||
|
||||
#ifndef crypto_scalarmult_ed25519_H
|
||||
#define crypto_scalarmult_ed25519_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define crypto_scalarmult_ed25519_BYTES 32U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_scalarmult_ed25519_bytes(void);
|
||||
|
||||
#define crypto_scalarmult_ed25519_SCALARBYTES 32U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_scalarmult_ed25519_scalarbytes(void);
|
||||
|
||||
/*
|
||||
* NOTE: Do not use the result of this function directly for key exchange.
|
||||
*
|
||||
* Hash the result with the public keys in order to compute a shared
|
||||
* secret key: H(q || client_pk || server_pk)
|
||||
*
|
||||
* Or unless this is not an option, use the crypto_kx() API instead.
|
||||
*/
|
||||
SODIUM_EXPORT
|
||||
int crypto_scalarmult_ed25519(unsigned char *q, const unsigned char *n,
|
||||
const unsigned char *p)
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_scalarmult_ed25519_noclamp(unsigned char *q, const unsigned char *n,
|
||||
const unsigned char *p)
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_scalarmult_ed25519_base(unsigned char *q, const unsigned char *n)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_scalarmult_ed25519_base_noclamp(unsigned char *q, const unsigned char *n)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,43 @@
|
||||
|
||||
#ifndef crypto_scalarmult_ristretto255_H
|
||||
#define crypto_scalarmult_ristretto255_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define crypto_scalarmult_ristretto255_BYTES 32U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_scalarmult_ristretto255_bytes(void);
|
||||
|
||||
#define crypto_scalarmult_ristretto255_SCALARBYTES 32U
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_scalarmult_ristretto255_scalarbytes(void);
|
||||
|
||||
/*
|
||||
* NOTE: Do not use the result of this function directly for key exchange.
|
||||
*
|
||||
* Hash the result with the public keys in order to compute a shared
|
||||
* secret key: H(q || client_pk || server_pk)
|
||||
*
|
||||
* Or unless this is not an option, use the crypto_kx() API instead.
|
||||
*/
|
||||
SODIUM_EXPORT
|
||||
int crypto_scalarmult_ristretto255(unsigned char *q, const unsigned char *n,
|
||||
const unsigned char *p)
|
||||
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_scalarmult_ristretto255_base(unsigned char *q,
|
||||
const unsigned char *n)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user