diff --git a/platform.txt b/platform.txt index 3e9e9a88bec..a25330074bd 100644 --- a/platform.txt +++ b/platform.txt @@ -23,7 +23,7 @@ compiler.prefix={build.tarch}-{build.target}-elf- # # ESP32 Support Start # -compiler.cpreprocessor.flags.esp32=-DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX -D_GNU_SOURCE -DIDF_VER="v4.4-dev-744-g1cb31e509" -DESP_PLATFORM "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/newlib/platform_include" "-I{compiler.sdk.path}/include/freertos/include" "-I{compiler.sdk.path}/include/freertos/port/xtensa/include" "-I{compiler.sdk.path}/include/esp_hw_support/include" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32" "-I{compiler.sdk.path}/include/heap/include" "-I{compiler.sdk.path}/include/log/include" "-I{compiler.sdk.path}/include/lwip/include/apps" "-I{compiler.sdk.path}/include/lwip/include/apps/sntp" "-I{compiler.sdk.path}/include/lwip/lwip/src/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include/arch" "-I{compiler.sdk.path}/include/soc/include" "-I{compiler.sdk.path}/include/soc/esp32" "-I{compiler.sdk.path}/include/soc/esp32/include" "-I{compiler.sdk.path}/include/hal/esp32/include" "-I{compiler.sdk.path}/include/hal/include" "-I{compiler.sdk.path}/include/esp_rom/include" "-I{compiler.sdk.path}/include/esp_rom/esp32" "-I{compiler.sdk.path}/include/esp_common/include" "-I{compiler.sdk.path}/include/esp_system/include" "-I{compiler.sdk.path}/include/esp32/include" "-I{compiler.sdk.path}/include/driver/include" "-I{compiler.sdk.path}/include/driver/esp32/include" "-I{compiler.sdk.path}/include/esp_pm/include" "-I{compiler.sdk.path}/include/esp_ringbuf/include" "-I{compiler.sdk.path}/include/efuse/include" "-I{compiler.sdk.path}/include/efuse/esp32/include" "-I{compiler.sdk.path}/include/xtensa/include" "-I{compiler.sdk.path}/include/xtensa/esp32/include" "-I{compiler.sdk.path}/include/vfs/include" "-I{compiler.sdk.path}/include/esp_wifi/include" "-I{compiler.sdk.path}/include/esp_wifi/esp32/include" "-I{compiler.sdk.path}/include/esp_event/include" "-I{compiler.sdk.path}/include/esp_netif/include" "-I{compiler.sdk.path}/include/esp_eth/include" "-I{compiler.sdk.path}/include/tcpip_adapter/include" "-I{compiler.sdk.path}/include/app_trace/include" "-I{compiler.sdk.path}/include/esp_timer/include" "-I{compiler.sdk.path}/include/mbedtls/port/include" "-I{compiler.sdk.path}/include/mbedtls/mbedtls/include" "-I{compiler.sdk.path}/include/mbedtls/esp_crt_bundle/include" "-I{compiler.sdk.path}/include/app_update/include" "-I{compiler.sdk.path}/include/spi_flash/include" "-I{compiler.sdk.path}/include/bootloader_support/include" "-I{compiler.sdk.path}/include/esp_ipc/include" "-I{compiler.sdk.path}/include/nvs_flash/include" "-I{compiler.sdk.path}/include/pthread/include" "-I{compiler.sdk.path}/include/esp_gdbstub/include" "-I{compiler.sdk.path}/include/esp_gdbstub/xtensa" "-I{compiler.sdk.path}/include/esp_gdbstub/esp32" "-I{compiler.sdk.path}/include/espcoredump/include" "-I{compiler.sdk.path}/include/wpa_supplicant/include" "-I{compiler.sdk.path}/include/wpa_supplicant/port/include" "-I{compiler.sdk.path}/include/wpa_supplicant/include/esp_supplicant" "-I{compiler.sdk.path}/include/perfmon/include" "-I{compiler.sdk.path}/include/asio/asio/asio/include" "-I{compiler.sdk.path}/include/asio/port/include" "-I{compiler.sdk.path}/include/bt/common/osi/include" "-I{compiler.sdk.path}/include/bt/include/esp32/include" "-I{compiler.sdk.path}/include/bt/host/bluedroid/api/include/api" "-I{compiler.sdk.path}/include/cbor/port/include" "-I{compiler.sdk.path}/include/unity/include" "-I{compiler.sdk.path}/include/unity/unity/src" "-I{compiler.sdk.path}/include/cmock/CMock/src" "-I{compiler.sdk.path}/include/coap/port/include" "-I{compiler.sdk.path}/include/coap/port/include/coap" "-I{compiler.sdk.path}/include/coap/libcoap/include" "-I{compiler.sdk.path}/include/coap/libcoap/include/coap2" "-I{compiler.sdk.path}/include/console" "-I{compiler.sdk.path}/include/nghttp/port/include" "-I{compiler.sdk.path}/include/nghttp/nghttp2/lib/includes" "-I{compiler.sdk.path}/include/esp-tls" "-I{compiler.sdk.path}/include/esp-tls/esp-tls-crypto" "-I{compiler.sdk.path}/include/esp_adc_cal/include" "-I{compiler.sdk.path}/include/esp_hid/include" "-I{compiler.sdk.path}/include/tcp_transport/include" "-I{compiler.sdk.path}/include/esp_http_client/include" "-I{compiler.sdk.path}/include/esp_http_server/include" "-I{compiler.sdk.path}/include/esp_https_ota/include" "-I{compiler.sdk.path}/include/protobuf-c/protobuf-c" "-I{compiler.sdk.path}/include/protocomm/include/common" "-I{compiler.sdk.path}/include/protocomm/include/security" "-I{compiler.sdk.path}/include/protocomm/include/transports" "-I{compiler.sdk.path}/include/mdns/include" "-I{compiler.sdk.path}/include/esp_local_ctrl/include" "-I{compiler.sdk.path}/include/sdmmc/include" "-I{compiler.sdk.path}/include/esp_serial_slave_link/include" "-I{compiler.sdk.path}/include/esp_websocket_client/include" "-I{compiler.sdk.path}/include/expat/expat/expat/lib" "-I{compiler.sdk.path}/include/expat/port/include" "-I{compiler.sdk.path}/include/wear_levelling/include" "-I{compiler.sdk.path}/include/fatfs/diskio" "-I{compiler.sdk.path}/include/fatfs/vfs" "-I{compiler.sdk.path}/include/fatfs/src" "-I{compiler.sdk.path}/include/freemodbus/common/include" "-I{compiler.sdk.path}/include/idf_test/include" "-I{compiler.sdk.path}/include/idf_test/include/esp32" "-I{compiler.sdk.path}/include/jsmn/include" "-I{compiler.sdk.path}/include/json/cJSON" "-I{compiler.sdk.path}/include/libsodium/libsodium/src/libsodium/include" "-I{compiler.sdk.path}/include/libsodium/port_include" "-I{compiler.sdk.path}/include/mqtt/esp-mqtt/include" "-I{compiler.sdk.path}/include/openssl/include" "-I{compiler.sdk.path}/include/spiffs/include" "-I{compiler.sdk.path}/include/ulp/include" "-I{compiler.sdk.path}/include/wifi_provisioning/include" "-I{compiler.sdk.path}/include/button/button/include" "-I{compiler.sdk.path}/include/json_parser" "-I{compiler.sdk.path}/include/json_parser/jsmn/include" "-I{compiler.sdk.path}/include/json_generator" "-I{compiler.sdk.path}/include/esp_schedule/include" "-I{compiler.sdk.path}/include/esp_rainmaker/include" "-I{compiler.sdk.path}/include/qrcode/include" "-I{compiler.sdk.path}/include/ws2812_led" "-I{compiler.sdk.path}/include/esp_littlefs/src" "-I{compiler.sdk.path}/include/esp_littlefs/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/dotprod/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/support/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/hann/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman_harris/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman_nuttall/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/nuttall/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/flat_top/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/iir/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/fir/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/add/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/sub/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/mul/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/addc/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/mulc/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/sqrt/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/matrix/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/fft/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/dct/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/conv/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/common/include" "-I{compiler.sdk.path}/include/esp-face/face_detection/include" "-I{compiler.sdk.path}/include/esp-face/face_recognition/include" "-I{compiler.sdk.path}/include/esp-face/object_detection/include" "-I{compiler.sdk.path}/include/esp-face/image_util/include" "-I{compiler.sdk.path}/include/esp-face/pose_estimation/include" "-I{compiler.sdk.path}/include/esp-face/lib/include" "-I{compiler.sdk.path}/include/esp32-camera/driver/include" "-I{compiler.sdk.path}/include/esp32-camera/conversions/include" "-I{compiler.sdk.path}/include/fb_gfx/include" +compiler.cpreprocessor.flags.esp32=-DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX -D_GNU_SOURCE -DIDF_VER="v4.4-dev-960-gcf457d412" -DESP_PLATFORM "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/newlib/platform_include" "-I{compiler.sdk.path}/include/freertos/include" "-I{compiler.sdk.path}/include/freertos/port/xtensa/include" "-I{compiler.sdk.path}/include/esp_hw_support/include" "-I{compiler.sdk.path}/include/esp_hw_support/include/soc" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32" "-I{compiler.sdk.path}/include/heap/include" "-I{compiler.sdk.path}/include/log/include" "-I{compiler.sdk.path}/include/lwip/include/apps" "-I{compiler.sdk.path}/include/lwip/include/apps/sntp" "-I{compiler.sdk.path}/include/lwip/lwip/src/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include/arch" "-I{compiler.sdk.path}/include/soc/include" "-I{compiler.sdk.path}/include/soc/esp32" "-I{compiler.sdk.path}/include/soc/esp32/include" "-I{compiler.sdk.path}/include/hal/esp32/include" "-I{compiler.sdk.path}/include/hal/include" "-I{compiler.sdk.path}/include/esp_rom/include" "-I{compiler.sdk.path}/include/esp_rom/esp32" "-I{compiler.sdk.path}/include/esp_common/include" "-I{compiler.sdk.path}/include/esp_system/include" "-I{compiler.sdk.path}/include/esp_system/port/soc" "-I{compiler.sdk.path}/include/esp_system/port/public_compat" "-I{compiler.sdk.path}/include/esp32/include" "-I{compiler.sdk.path}/include/driver/include" "-I{compiler.sdk.path}/include/driver/esp32/include" "-I{compiler.sdk.path}/include/esp_pm/include" "-I{compiler.sdk.path}/include/esp_ringbuf/include" "-I{compiler.sdk.path}/include/efuse/include" "-I{compiler.sdk.path}/include/efuse/esp32/include" "-I{compiler.sdk.path}/include/xtensa/include" "-I{compiler.sdk.path}/include/xtensa/esp32/include" "-I{compiler.sdk.path}/include/vfs/include" "-I{compiler.sdk.path}/include/esp_wifi/include" "-I{compiler.sdk.path}/include/esp_wifi/esp32/include" "-I{compiler.sdk.path}/include/esp_event/include" "-I{compiler.sdk.path}/include/esp_netif/include" "-I{compiler.sdk.path}/include/esp_eth/include" "-I{compiler.sdk.path}/include/tcpip_adapter/include" "-I{compiler.sdk.path}/include/app_trace/include" "-I{compiler.sdk.path}/include/esp_timer/include" "-I{compiler.sdk.path}/include/mbedtls/port/include" "-I{compiler.sdk.path}/include/mbedtls/mbedtls/include" "-I{compiler.sdk.path}/include/mbedtls/esp_crt_bundle/include" "-I{compiler.sdk.path}/include/app_update/include" "-I{compiler.sdk.path}/include/spi_flash/include" "-I{compiler.sdk.path}/include/bootloader_support/include" "-I{compiler.sdk.path}/include/esp_ipc/include" "-I{compiler.sdk.path}/include/nvs_flash/include" "-I{compiler.sdk.path}/include/pthread/include" "-I{compiler.sdk.path}/include/esp_gdbstub/include" "-I{compiler.sdk.path}/include/esp_gdbstub/xtensa" "-I{compiler.sdk.path}/include/esp_gdbstub/esp32" "-I{compiler.sdk.path}/include/espcoredump/include" "-I{compiler.sdk.path}/include/espcoredump/include/port/xtensa" "-I{compiler.sdk.path}/include/wpa_supplicant/include" "-I{compiler.sdk.path}/include/wpa_supplicant/port/include" "-I{compiler.sdk.path}/include/wpa_supplicant/include/esp_supplicant" "-I{compiler.sdk.path}/include/perfmon/include" "-I{compiler.sdk.path}/include/asio/asio/asio/include" "-I{compiler.sdk.path}/include/asio/port/include" "-I{compiler.sdk.path}/include/bt/common/osi/include" "-I{compiler.sdk.path}/include/bt/include/esp32/include" "-I{compiler.sdk.path}/include/bt/host/bluedroid/api/include/api" "-I{compiler.sdk.path}/include/cbor/port/include" "-I{compiler.sdk.path}/include/unity/include" "-I{compiler.sdk.path}/include/unity/unity/src" "-I{compiler.sdk.path}/include/cmock/CMock/src" "-I{compiler.sdk.path}/include/coap/port/include" "-I{compiler.sdk.path}/include/coap/port/include/coap" "-I{compiler.sdk.path}/include/coap/libcoap/include" "-I{compiler.sdk.path}/include/coap/libcoap/include/coap2" "-I{compiler.sdk.path}/include/console" "-I{compiler.sdk.path}/include/nghttp/port/include" "-I{compiler.sdk.path}/include/nghttp/nghttp2/lib/includes" "-I{compiler.sdk.path}/include/esp-tls" "-I{compiler.sdk.path}/include/esp-tls/esp-tls-crypto" "-I{compiler.sdk.path}/include/esp_adc_cal/include" "-I{compiler.sdk.path}/include/esp_hid/include" "-I{compiler.sdk.path}/include/tcp_transport/include" "-I{compiler.sdk.path}/include/esp_http_client/include" "-I{compiler.sdk.path}/include/esp_http_server/include" "-I{compiler.sdk.path}/include/esp_https_ota/include" "-I{compiler.sdk.path}/include/protobuf-c/protobuf-c" "-I{compiler.sdk.path}/include/protocomm/include/common" "-I{compiler.sdk.path}/include/protocomm/include/security" "-I{compiler.sdk.path}/include/protocomm/include/transports" "-I{compiler.sdk.path}/include/mdns/include" "-I{compiler.sdk.path}/include/esp_local_ctrl/include" "-I{compiler.sdk.path}/include/sdmmc/include" "-I{compiler.sdk.path}/include/esp_serial_slave_link/include" "-I{compiler.sdk.path}/include/esp_websocket_client/include" "-I{compiler.sdk.path}/include/expat/expat/expat/lib" "-I{compiler.sdk.path}/include/expat/port/include" "-I{compiler.sdk.path}/include/wear_levelling/include" "-I{compiler.sdk.path}/include/fatfs/diskio" "-I{compiler.sdk.path}/include/fatfs/vfs" "-I{compiler.sdk.path}/include/fatfs/src" "-I{compiler.sdk.path}/include/freemodbus/common/include" "-I{compiler.sdk.path}/include/idf_test/include" "-I{compiler.sdk.path}/include/idf_test/include/esp32" "-I{compiler.sdk.path}/include/jsmn/include" "-I{compiler.sdk.path}/include/json/cJSON" "-I{compiler.sdk.path}/include/libsodium/libsodium/src/libsodium/include" "-I{compiler.sdk.path}/include/libsodium/port_include" "-I{compiler.sdk.path}/include/mqtt/esp-mqtt/include" "-I{compiler.sdk.path}/include/openssl/include" "-I{compiler.sdk.path}/include/spiffs/include" "-I{compiler.sdk.path}/include/ulp/include" "-I{compiler.sdk.path}/include/wifi_provisioning/include" "-I{compiler.sdk.path}/include/button/button/include" "-I{compiler.sdk.path}/include/json_parser" "-I{compiler.sdk.path}/include/json_parser/jsmn/include" "-I{compiler.sdk.path}/include/json_generator" "-I{compiler.sdk.path}/include/esp_schedule/include" "-I{compiler.sdk.path}/include/esp_rainmaker/include" "-I{compiler.sdk.path}/include/qrcode/include" "-I{compiler.sdk.path}/include/ws2812_led" "-I{compiler.sdk.path}/include/esp_littlefs/src" "-I{compiler.sdk.path}/include/esp_littlefs/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/dotprod/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/support/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/hann/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman_harris/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman_nuttall/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/nuttall/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/flat_top/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/iir/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/fir/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/add/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/sub/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/mul/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/addc/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/mulc/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/sqrt/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/matrix/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/fft/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/dct/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/conv/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/common/include" "-I{compiler.sdk.path}/include/esp-face/face_detection/include" "-I{compiler.sdk.path}/include/esp-face/face_recognition/include" "-I{compiler.sdk.path}/include/esp-face/object_detection/include" "-I{compiler.sdk.path}/include/esp-face/image_util/include" "-I{compiler.sdk.path}/include/esp-face/pose_estimation/include" "-I{compiler.sdk.path}/include/esp-face/lib/include" "-I{compiler.sdk.path}/include/esp32-camera/driver/include" "-I{compiler.sdk.path}/include/esp32-camera/conversions/include" "-I{compiler.sdk.path}/include/fb_gfx/include" compiler.c.elf.libs.esp32=-lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lxtensa -lperfmon -lesp32 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lasio -lbt -lcbor -lunity -lcmock -lcoap -lconsole -lnghttp -lesp-tls -lesp_adc_cal -lesp_hid -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lprotobuf-c -lprotocomm -lmdns -lesp_local_ctrl -lsdmmc -lesp_serial_slave_link -lesp_websocket_client -lexpat -lwear_levelling -lfatfs -lfreemodbus -ljsmn -ljson -llibsodium -lmqtt -lopenssl -lspiffs -lulp -lwifi_provisioning -lbutton -ljson_parser -ljson_generator -lesp_schedule -lesp_rainmaker -lqrcode -lws2812_led -lesp_littlefs -lesp-dsp -lesp-face -lesp32-camera -lfb_gfx -lasio -lcbor -lcmock -lunity -lcoap -lesp_hid -lesp_local_ctrl -lesp_websocket_client -lexpat -lfreemodbus -ljsmn -llibsodium -lbutton -lesp_rainmaker -lmqtt -lwifi_provisioning -lprotocomm -lprotobuf-c -ljson -ljson_parser -ljson_generator -lesp_schedule -lqrcode -lws2812_led -lesp-dsp -lesp-face -lpe -lfd -lfr -ldetection_cat_face -ldetection -ldl -lesp32-camera -lfb_gfx -lbt -lbtdm_app -lesp_adc_cal -lmdns -lconsole -lfatfs -lwear_levelling -lopenssl -lspiffs -lesp_littlefs -lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lxtensa -lperfmon -lesp32 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lrtc -lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lxtensa -lperfmon -lesp32 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lrtc -lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lxtensa -lperfmon -lesp32 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lrtc -lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lxtensa -lperfmon -lesp32 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lrtc -lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lxtensa -lperfmon -lesp32 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lrtc -lxt_hal -lm -lnewlib -lgcc -lstdc++ -lpthread -lapp_trace -lgcov -lapp_trace -lgcov -lc compiler.c.flags.esp32=-mlongcalls -Wno-frame-address -ffunction-sections -fdata-sections -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -O2 -fstack-protector -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -std=gnu99 -Wno-old-style-declaration -MMD -c compiler.cpp.flags.esp32=-mlongcalls -Wno-frame-address -ffunction-sections -fdata-sections -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -O2 -fstack-protector -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -std=gnu++11 -fexceptions -fno-rtti -MMD -c @@ -38,7 +38,7 @@ build.extra_flags.esp32=-DARDUINO_SERIAL_PORT=0 # # ESP32S2 Support Start # -compiler.cpreprocessor.flags.esp32s2=-DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX -D_GNU_SOURCE -DIDF_VER="v4.4-dev-744-g1cb31e509" -DESP_PLATFORM "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/newlib/platform_include" "-I{compiler.sdk.path}/include/freertos/include" "-I{compiler.sdk.path}/include/freertos/port/xtensa/include" "-I{compiler.sdk.path}/include/esp_hw_support/include" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32s2" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32s2/private_include" "-I{compiler.sdk.path}/include/heap/include" "-I{compiler.sdk.path}/include/log/include" "-I{compiler.sdk.path}/include/lwip/include/apps" "-I{compiler.sdk.path}/include/lwip/include/apps/sntp" "-I{compiler.sdk.path}/include/lwip/lwip/src/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include/arch" "-I{compiler.sdk.path}/include/soc/include" "-I{compiler.sdk.path}/include/soc/esp32s2" "-I{compiler.sdk.path}/include/soc/esp32s2/include" "-I{compiler.sdk.path}/include/hal/esp32s2/include" "-I{compiler.sdk.path}/include/hal/include" "-I{compiler.sdk.path}/include/esp_rom/include" "-I{compiler.sdk.path}/include/esp_rom/esp32s2" "-I{compiler.sdk.path}/include/esp_common/include" "-I{compiler.sdk.path}/include/esp_system/include" "-I{compiler.sdk.path}/include/esp32s2/include" "-I{compiler.sdk.path}/include/driver/include" "-I{compiler.sdk.path}/include/driver/esp32s2/include" "-I{compiler.sdk.path}/include/esp_pm/include" "-I{compiler.sdk.path}/include/esp_ringbuf/include" "-I{compiler.sdk.path}/include/efuse/include" "-I{compiler.sdk.path}/include/efuse/esp32s2/include" "-I{compiler.sdk.path}/include/xtensa/include" "-I{compiler.sdk.path}/include/xtensa/esp32s2/include" "-I{compiler.sdk.path}/include/vfs/include" "-I{compiler.sdk.path}/include/esp_wifi/include" "-I{compiler.sdk.path}/include/esp_wifi/esp32s2/include" "-I{compiler.sdk.path}/include/esp_event/include" "-I{compiler.sdk.path}/include/esp_netif/include" "-I{compiler.sdk.path}/include/esp_eth/include" "-I{compiler.sdk.path}/include/tcpip_adapter/include" "-I{compiler.sdk.path}/include/app_trace/include" "-I{compiler.sdk.path}/include/esp_timer/include" "-I{compiler.sdk.path}/include/mbedtls/port/include" "-I{compiler.sdk.path}/include/mbedtls/mbedtls/include" "-I{compiler.sdk.path}/include/mbedtls/esp_crt_bundle/include" "-I{compiler.sdk.path}/include/app_update/include" "-I{compiler.sdk.path}/include/spi_flash/include" "-I{compiler.sdk.path}/include/bootloader_support/include" "-I{compiler.sdk.path}/include/esp_ipc/include" "-I{compiler.sdk.path}/include/nvs_flash/include" "-I{compiler.sdk.path}/include/pthread/include" "-I{compiler.sdk.path}/include/esp_gdbstub/include" "-I{compiler.sdk.path}/include/esp_gdbstub/xtensa" "-I{compiler.sdk.path}/include/esp_gdbstub/esp32s2" "-I{compiler.sdk.path}/include/espcoredump/include" "-I{compiler.sdk.path}/include/wpa_supplicant/include" "-I{compiler.sdk.path}/include/wpa_supplicant/port/include" "-I{compiler.sdk.path}/include/wpa_supplicant/include/esp_supplicant" "-I{compiler.sdk.path}/include/asio/asio/asio/include" "-I{compiler.sdk.path}/include/asio/port/include" "-I{compiler.sdk.path}/include/cbor/port/include" "-I{compiler.sdk.path}/include/unity/include" "-I{compiler.sdk.path}/include/unity/unity/src" "-I{compiler.sdk.path}/include/cmock/CMock/src" "-I{compiler.sdk.path}/include/coap/port/include" "-I{compiler.sdk.path}/include/coap/port/include/coap" "-I{compiler.sdk.path}/include/coap/libcoap/include" "-I{compiler.sdk.path}/include/coap/libcoap/include/coap2" "-I{compiler.sdk.path}/include/console" "-I{compiler.sdk.path}/include/nghttp/port/include" "-I{compiler.sdk.path}/include/nghttp/nghttp2/lib/includes" "-I{compiler.sdk.path}/include/esp-tls" "-I{compiler.sdk.path}/include/esp-tls/esp-tls-crypto" "-I{compiler.sdk.path}/include/esp_adc_cal/include" "-I{compiler.sdk.path}/include/esp_hid/include" "-I{compiler.sdk.path}/include/tcp_transport/include" "-I{compiler.sdk.path}/include/esp_http_client/include" "-I{compiler.sdk.path}/include/esp_http_server/include" "-I{compiler.sdk.path}/include/esp_https_ota/include" "-I{compiler.sdk.path}/include/esp_https_server/include" "-I{compiler.sdk.path}/include/protobuf-c/protobuf-c" "-I{compiler.sdk.path}/include/protocomm/include/common" "-I{compiler.sdk.path}/include/protocomm/include/security" "-I{compiler.sdk.path}/include/protocomm/include/transports" "-I{compiler.sdk.path}/include/mdns/include" "-I{compiler.sdk.path}/include/esp_local_ctrl/include" "-I{compiler.sdk.path}/include/sdmmc/include" "-I{compiler.sdk.path}/include/esp_serial_slave_link/include" "-I{compiler.sdk.path}/include/esp_websocket_client/include" "-I{compiler.sdk.path}/include/expat/expat/expat/lib" "-I{compiler.sdk.path}/include/expat/port/include" "-I{compiler.sdk.path}/include/wear_levelling/include" "-I{compiler.sdk.path}/include/fatfs/diskio" "-I{compiler.sdk.path}/include/fatfs/vfs" "-I{compiler.sdk.path}/include/fatfs/src" "-I{compiler.sdk.path}/include/freemodbus/common/include" "-I{compiler.sdk.path}/include/idf_test/include" "-I{compiler.sdk.path}/include/idf_test/include/esp32s2" "-I{compiler.sdk.path}/include/jsmn/include" "-I{compiler.sdk.path}/include/json/cJSON" "-I{compiler.sdk.path}/include/libsodium/libsodium/src/libsodium/include" "-I{compiler.sdk.path}/include/libsodium/port_include" "-I{compiler.sdk.path}/include/mqtt/esp-mqtt/include" "-I{compiler.sdk.path}/include/openssl/include" "-I{compiler.sdk.path}/include/perfmon/include" "-I{compiler.sdk.path}/include/spiffs/include" "-I{compiler.sdk.path}/include/touch_element/include" "-I{compiler.sdk.path}/include/ulp/include" "-I{compiler.sdk.path}/include/wifi_provisioning/include" "-I{compiler.sdk.path}/include/freertos/include/freertos" "-I{compiler.sdk.path}/include/arduino_tinyusb/tinyusb/src" "-I{compiler.sdk.path}/include/arduino_tinyusb/include" "-I{compiler.sdk.path}/include/esp_littlefs/src" "-I{compiler.sdk.path}/include/esp_littlefs/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/dotprod/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/support/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/hann/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman_harris/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman_nuttall/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/nuttall/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/flat_top/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/iir/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/fir/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/add/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/sub/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/mul/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/addc/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/mulc/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/sqrt/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/matrix/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/fft/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/dct/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/conv/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/common/include" "-I{compiler.sdk.path}/include/esp-face/face_detection/include" "-I{compiler.sdk.path}/include/esp-face/face_recognition/include" "-I{compiler.sdk.path}/include/esp-face/object_detection/include" "-I{compiler.sdk.path}/include/esp-face/image_util/include" "-I{compiler.sdk.path}/include/esp-face/pose_estimation/include" "-I{compiler.sdk.path}/include/esp-face/lib/include" "-I{compiler.sdk.path}/include/fb_gfx/include" +compiler.cpreprocessor.flags.esp32s2=-DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX -D_GNU_SOURCE -DIDF_VER="v4.4-dev-960-gcf457d412" -DESP_PLATFORM "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/newlib/platform_include" "-I{compiler.sdk.path}/include/freertos/include" "-I{compiler.sdk.path}/include/freertos/port/xtensa/include" "-I{compiler.sdk.path}/include/esp_hw_support/include" "-I{compiler.sdk.path}/include/esp_hw_support/include/soc" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32s2" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32s2/private_include" "-I{compiler.sdk.path}/include/heap/include" "-I{compiler.sdk.path}/include/log/include" "-I{compiler.sdk.path}/include/lwip/include/apps" "-I{compiler.sdk.path}/include/lwip/include/apps/sntp" "-I{compiler.sdk.path}/include/lwip/lwip/src/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include/arch" "-I{compiler.sdk.path}/include/soc/include" "-I{compiler.sdk.path}/include/soc/esp32s2" "-I{compiler.sdk.path}/include/soc/esp32s2/include" "-I{compiler.sdk.path}/include/hal/esp32s2/include" "-I{compiler.sdk.path}/include/hal/include" "-I{compiler.sdk.path}/include/esp_rom/include" "-I{compiler.sdk.path}/include/esp_rom/esp32s2" "-I{compiler.sdk.path}/include/esp_common/include" "-I{compiler.sdk.path}/include/esp_system/include" "-I{compiler.sdk.path}/include/esp_system/port/soc" "-I{compiler.sdk.path}/include/esp_system/port/public_compat" "-I{compiler.sdk.path}/include/esp32s2/include" "-I{compiler.sdk.path}/include/driver/include" "-I{compiler.sdk.path}/include/driver/esp32s2/include" "-I{compiler.sdk.path}/include/esp_pm/include" "-I{compiler.sdk.path}/include/esp_ringbuf/include" "-I{compiler.sdk.path}/include/efuse/include" "-I{compiler.sdk.path}/include/efuse/esp32s2/include" "-I{compiler.sdk.path}/include/xtensa/include" "-I{compiler.sdk.path}/include/xtensa/esp32s2/include" "-I{compiler.sdk.path}/include/vfs/include" "-I{compiler.sdk.path}/include/esp_wifi/include" "-I{compiler.sdk.path}/include/esp_wifi/esp32s2/include" "-I{compiler.sdk.path}/include/esp_event/include" "-I{compiler.sdk.path}/include/esp_netif/include" "-I{compiler.sdk.path}/include/esp_eth/include" "-I{compiler.sdk.path}/include/tcpip_adapter/include" "-I{compiler.sdk.path}/include/app_trace/include" "-I{compiler.sdk.path}/include/esp_timer/include" "-I{compiler.sdk.path}/include/mbedtls/port/include" "-I{compiler.sdk.path}/include/mbedtls/mbedtls/include" "-I{compiler.sdk.path}/include/mbedtls/esp_crt_bundle/include" "-I{compiler.sdk.path}/include/app_update/include" "-I{compiler.sdk.path}/include/spi_flash/include" "-I{compiler.sdk.path}/include/bootloader_support/include" "-I{compiler.sdk.path}/include/esp_ipc/include" "-I{compiler.sdk.path}/include/nvs_flash/include" "-I{compiler.sdk.path}/include/pthread/include" "-I{compiler.sdk.path}/include/esp_gdbstub/include" "-I{compiler.sdk.path}/include/esp_gdbstub/xtensa" "-I{compiler.sdk.path}/include/esp_gdbstub/esp32s2" "-I{compiler.sdk.path}/include/espcoredump/include" "-I{compiler.sdk.path}/include/espcoredump/include/port/xtensa" "-I{compiler.sdk.path}/include/wpa_supplicant/include" "-I{compiler.sdk.path}/include/wpa_supplicant/port/include" "-I{compiler.sdk.path}/include/wpa_supplicant/include/esp_supplicant" "-I{compiler.sdk.path}/include/asio/asio/asio/include" "-I{compiler.sdk.path}/include/asio/port/include" "-I{compiler.sdk.path}/include/cbor/port/include" "-I{compiler.sdk.path}/include/unity/include" "-I{compiler.sdk.path}/include/unity/unity/src" "-I{compiler.sdk.path}/include/cmock/CMock/src" "-I{compiler.sdk.path}/include/coap/port/include" "-I{compiler.sdk.path}/include/coap/port/include/coap" "-I{compiler.sdk.path}/include/coap/libcoap/include" "-I{compiler.sdk.path}/include/coap/libcoap/include/coap2" "-I{compiler.sdk.path}/include/console" "-I{compiler.sdk.path}/include/nghttp/port/include" "-I{compiler.sdk.path}/include/nghttp/nghttp2/lib/includes" "-I{compiler.sdk.path}/include/esp-tls" "-I{compiler.sdk.path}/include/esp-tls/esp-tls-crypto" "-I{compiler.sdk.path}/include/esp_adc_cal/include" "-I{compiler.sdk.path}/include/esp_hid/include" "-I{compiler.sdk.path}/include/tcp_transport/include" "-I{compiler.sdk.path}/include/esp_http_client/include" "-I{compiler.sdk.path}/include/esp_http_server/include" "-I{compiler.sdk.path}/include/esp_https_ota/include" "-I{compiler.sdk.path}/include/esp_https_server/include" "-I{compiler.sdk.path}/include/protobuf-c/protobuf-c" "-I{compiler.sdk.path}/include/protocomm/include/common" "-I{compiler.sdk.path}/include/protocomm/include/security" "-I{compiler.sdk.path}/include/protocomm/include/transports" "-I{compiler.sdk.path}/include/mdns/include" "-I{compiler.sdk.path}/include/esp_local_ctrl/include" "-I{compiler.sdk.path}/include/sdmmc/include" "-I{compiler.sdk.path}/include/esp_serial_slave_link/include" "-I{compiler.sdk.path}/include/esp_websocket_client/include" "-I{compiler.sdk.path}/include/expat/expat/expat/lib" "-I{compiler.sdk.path}/include/expat/port/include" "-I{compiler.sdk.path}/include/wear_levelling/include" "-I{compiler.sdk.path}/include/fatfs/diskio" "-I{compiler.sdk.path}/include/fatfs/vfs" "-I{compiler.sdk.path}/include/fatfs/src" "-I{compiler.sdk.path}/include/freemodbus/common/include" "-I{compiler.sdk.path}/include/idf_test/include" "-I{compiler.sdk.path}/include/idf_test/include/esp32s2" "-I{compiler.sdk.path}/include/jsmn/include" "-I{compiler.sdk.path}/include/json/cJSON" "-I{compiler.sdk.path}/include/libsodium/libsodium/src/libsodium/include" "-I{compiler.sdk.path}/include/libsodium/port_include" "-I{compiler.sdk.path}/include/mqtt/esp-mqtt/include" "-I{compiler.sdk.path}/include/openssl/include" "-I{compiler.sdk.path}/include/perfmon/include" "-I{compiler.sdk.path}/include/spiffs/include" "-I{compiler.sdk.path}/include/touch_element/include" "-I{compiler.sdk.path}/include/ulp/include" "-I{compiler.sdk.path}/include/wifi_provisioning/include" "-I{compiler.sdk.path}/include/freertos/include/freertos" "-I{compiler.sdk.path}/include/arduino_tinyusb/tinyusb/src" "-I{compiler.sdk.path}/include/arduino_tinyusb/include" "-I{compiler.sdk.path}/include/esp_littlefs/src" "-I{compiler.sdk.path}/include/esp_littlefs/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/dotprod/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/support/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/hann/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman_harris/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman_nuttall/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/nuttall/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/flat_top/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/iir/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/fir/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/add/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/sub/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/mul/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/addc/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/mulc/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/sqrt/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/matrix/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/fft/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/dct/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/conv/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/common/include" "-I{compiler.sdk.path}/include/esp-face/face_detection/include" "-I{compiler.sdk.path}/include/esp-face/face_recognition/include" "-I{compiler.sdk.path}/include/esp-face/object_detection/include" "-I{compiler.sdk.path}/include/esp-face/image_util/include" "-I{compiler.sdk.path}/include/esp-face/pose_estimation/include" "-I{compiler.sdk.path}/include/esp-face/lib/include" "-I{compiler.sdk.path}/include/fb_gfx/include" compiler.c.elf.libs.esp32s2=-lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lxtensa -lesp32s2 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lasio -lcbor -lunity -lcmock -lcoap -lconsole -lnghttp -lesp-tls -lesp_adc_cal -lesp_hid -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lesp_https_server -lprotobuf-c -lprotocomm -lmdns -lesp_local_ctrl -lsdmmc -lesp_serial_slave_link -lesp_websocket_client -lexpat -lwear_levelling -lfatfs -lfreemodbus -ljsmn -ljson -llibsodium -lmqtt -lopenssl -lperfmon -lspiffs -ltouch_element -lulp -lusb -lwifi_provisioning -lesp_littlefs -lesp-dsp -lesp-face -lfb_gfx -lasio -lcbor -lcmock -lunity -lcoap -lesp_hid -lesp_local_ctrl -lesp_https_server -lesp_websocket_client -lexpat -lfreemodbus -ljsmn -llibsodium -lmqtt -lperfmon -ltouch_element -lusb -lwifi_provisioning -lprotocomm -lprotobuf-c -ljson -lesp-dsp -lesp-face -lpe -lfd -lfr -ldetection_cat_face -ldetection -ldl -lfb_gfx -lesp_adc_cal -lmdns -lconsole -lfatfs -lwear_levelling -lopenssl -lspiffs -larduino_tinyusb -lesp_littlefs -lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lxtensa -lesp32s2 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lxtensa -lesp32s2 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lxtensa -lesp32s2 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lxtensa -lesp32s2 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lxtensa -lesp32s2 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lxtensa -lesp32s2 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lxt_hal -lm -lnewlib -lgcc -lstdc++ -lpthread -lapp_trace -lgcov -lapp_trace -lgcov -lc compiler.c.flags.esp32s2=-mlongcalls -ffunction-sections -fdata-sections -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -O2 -fstack-protector -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -std=gnu99 -Wno-old-style-declaration -MMD -c compiler.cpp.flags.esp32s2=-mlongcalls -ffunction-sections -fdata-sections -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -O2 -fstack-protector -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -std=gnu++11 -fexceptions -fno-rtti -MMD -c @@ -53,12 +53,12 @@ build.extra_flags.esp32s2=-DARDUINO_SERIAL_PORT={build.serial} # # ESP32C3 Support Start # -compiler.cpreprocessor.flags.esp32c3=-DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX -D_GNU_SOURCE -DIDF_VER="v4.4-dev-744-g1cb31e509" -DESP_PLATFORM "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/newlib/platform_include" "-I{compiler.sdk.path}/include/freertos/include" "-I{compiler.sdk.path}/include/freertos/port/riscv/include" "-I{compiler.sdk.path}/include/esp_hw_support/include" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32c3" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32c3/private_include" "-I{compiler.sdk.path}/include/heap/include" "-I{compiler.sdk.path}/include/log/include" "-I{compiler.sdk.path}/include/lwip/include/apps" "-I{compiler.sdk.path}/include/lwip/include/apps/sntp" "-I{compiler.sdk.path}/include/lwip/lwip/src/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include/arch" "-I{compiler.sdk.path}/include/soc/include" "-I{compiler.sdk.path}/include/soc/esp32c3" "-I{compiler.sdk.path}/include/soc/esp32c3/include" "-I{compiler.sdk.path}/include/hal/esp32c3/include" "-I{compiler.sdk.path}/include/hal/include" "-I{compiler.sdk.path}/include/esp_rom/include" "-I{compiler.sdk.path}/include/esp_rom/esp32c3" "-I{compiler.sdk.path}/include/esp_common/include" "-I{compiler.sdk.path}/include/esp_system/include" "-I{compiler.sdk.path}/include/esp32c3/include" "-I{compiler.sdk.path}/include/driver/include" "-I{compiler.sdk.path}/include/driver/esp32c3/include" "-I{compiler.sdk.path}/include/esp_pm/include" "-I{compiler.sdk.path}/include/esp_ringbuf/include" "-I{compiler.sdk.path}/include/efuse/include" "-I{compiler.sdk.path}/include/efuse/esp32c3/include" "-I{compiler.sdk.path}/include/riscv/include" "-I{compiler.sdk.path}/include/vfs/include" "-I{compiler.sdk.path}/include/esp_wifi/include" "-I{compiler.sdk.path}/include/esp_wifi/esp32c3/include" "-I{compiler.sdk.path}/include/esp_event/include" "-I{compiler.sdk.path}/include/esp_netif/include" "-I{compiler.sdk.path}/include/esp_eth/include" "-I{compiler.sdk.path}/include/tcpip_adapter/include" "-I{compiler.sdk.path}/include/esp_timer/include" "-I{compiler.sdk.path}/include/mbedtls/port/include" "-I{compiler.sdk.path}/include/mbedtls/mbedtls/include" "-I{compiler.sdk.path}/include/mbedtls/esp_crt_bundle/include" "-I{compiler.sdk.path}/include/app_update/include" "-I{compiler.sdk.path}/include/spi_flash/include" "-I{compiler.sdk.path}/include/bootloader_support/include" "-I{compiler.sdk.path}/include/esp_ipc/include" "-I{compiler.sdk.path}/include/nvs_flash/include" "-I{compiler.sdk.path}/include/pthread/include" "-I{compiler.sdk.path}/include/esp_gdbstub/include" "-I{compiler.sdk.path}/include/esp_gdbstub/riscv" "-I{compiler.sdk.path}/include/esp_gdbstub/esp32c3" "-I{compiler.sdk.path}/include/espcoredump/include" "-I{compiler.sdk.path}/include/wpa_supplicant/include" "-I{compiler.sdk.path}/include/wpa_supplicant/port/include" "-I{compiler.sdk.path}/include/wpa_supplicant/include/esp_supplicant" "-I{compiler.sdk.path}/include/app_trace/include" "-I{compiler.sdk.path}/include/asio/asio/asio/include" "-I{compiler.sdk.path}/include/asio/port/include" "-I{compiler.sdk.path}/include/bt/common/osi/include" "-I{compiler.sdk.path}/include/bt/include/esp32c3/include" "-I{compiler.sdk.path}/include/bt/host/bluedroid/api/include/api" "-I{compiler.sdk.path}/include/cbor/port/include" "-I{compiler.sdk.path}/include/unity/include" "-I{compiler.sdk.path}/include/unity/unity/src" "-I{compiler.sdk.path}/include/cmock/CMock/src" "-I{compiler.sdk.path}/include/coap/port/include" "-I{compiler.sdk.path}/include/coap/port/include/coap" "-I{compiler.sdk.path}/include/coap/libcoap/include" "-I{compiler.sdk.path}/include/coap/libcoap/include/coap2" "-I{compiler.sdk.path}/include/console" "-I{compiler.sdk.path}/include/nghttp/port/include" "-I{compiler.sdk.path}/include/nghttp/nghttp2/lib/includes" "-I{compiler.sdk.path}/include/esp-tls" "-I{compiler.sdk.path}/include/esp-tls/esp-tls-crypto" "-I{compiler.sdk.path}/include/esp_adc_cal/include" "-I{compiler.sdk.path}/include/esp_hid/include" "-I{compiler.sdk.path}/include/tcp_transport/include" "-I{compiler.sdk.path}/include/esp_http_client/include" "-I{compiler.sdk.path}/include/esp_http_server/include" "-I{compiler.sdk.path}/include/esp_https_ota/include" "-I{compiler.sdk.path}/include/esp_https_server/include" "-I{compiler.sdk.path}/include/protobuf-c/protobuf-c" "-I{compiler.sdk.path}/include/protocomm/include/common" "-I{compiler.sdk.path}/include/protocomm/include/security" "-I{compiler.sdk.path}/include/protocomm/include/transports" "-I{compiler.sdk.path}/include/mdns/include" "-I{compiler.sdk.path}/include/esp_local_ctrl/include" "-I{compiler.sdk.path}/include/sdmmc/include" "-I{compiler.sdk.path}/include/esp_serial_slave_link/include" "-I{compiler.sdk.path}/include/esp_websocket_client/include" "-I{compiler.sdk.path}/include/expat/expat/expat/lib" "-I{compiler.sdk.path}/include/expat/port/include" "-I{compiler.sdk.path}/include/wear_levelling/include" "-I{compiler.sdk.path}/include/fatfs/diskio" "-I{compiler.sdk.path}/include/fatfs/vfs" "-I{compiler.sdk.path}/include/fatfs/src" "-I{compiler.sdk.path}/include/freemodbus/common/include" "-I{compiler.sdk.path}/include/idf_test/include" "-I{compiler.sdk.path}/include/idf_test/include/esp32c3" "-I{compiler.sdk.path}/include/jsmn/include" "-I{compiler.sdk.path}/include/json/cJSON" "-I{compiler.sdk.path}/include/libsodium/libsodium/src/libsodium/include" "-I{compiler.sdk.path}/include/libsodium/port_include" "-I{compiler.sdk.path}/include/mqtt/esp-mqtt/include" "-I{compiler.sdk.path}/include/openssl/include" "-I{compiler.sdk.path}/include/spiffs/include" "-I{compiler.sdk.path}/include/wifi_provisioning/include" "-I{compiler.sdk.path}/include/esp_littlefs/src" "-I{compiler.sdk.path}/include/esp_littlefs/include" "-I{compiler.sdk.path}/include/fb_gfx/include" +compiler.cpreprocessor.flags.esp32c3=-DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX -D_GNU_SOURCE -DIDF_VER="v4.4-dev-960-gcf457d412" -DESP_PLATFORM "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/newlib/platform_include" "-I{compiler.sdk.path}/include/freertos/include" "-I{compiler.sdk.path}/include/freertos/port/riscv/include" "-I{compiler.sdk.path}/include/esp_hw_support/include" "-I{compiler.sdk.path}/include/esp_hw_support/include/soc" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32c3" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32c3/private_include" "-I{compiler.sdk.path}/include/heap/include" "-I{compiler.sdk.path}/include/log/include" "-I{compiler.sdk.path}/include/lwip/include/apps" "-I{compiler.sdk.path}/include/lwip/include/apps/sntp" "-I{compiler.sdk.path}/include/lwip/lwip/src/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include/arch" "-I{compiler.sdk.path}/include/soc/include" "-I{compiler.sdk.path}/include/soc/esp32c3" "-I{compiler.sdk.path}/include/soc/esp32c3/include" "-I{compiler.sdk.path}/include/hal/esp32c3/include" "-I{compiler.sdk.path}/include/hal/include" "-I{compiler.sdk.path}/include/esp_rom/include" "-I{compiler.sdk.path}/include/esp_rom/esp32c3" "-I{compiler.sdk.path}/include/esp_common/include" "-I{compiler.sdk.path}/include/esp_system/include" "-I{compiler.sdk.path}/include/esp_system/port/soc" "-I{compiler.sdk.path}/include/esp_system/port/public_compat" "-I{compiler.sdk.path}/include/esp32c3/include" "-I{compiler.sdk.path}/include/driver/include" "-I{compiler.sdk.path}/include/driver/esp32c3/include" "-I{compiler.sdk.path}/include/esp_pm/include" "-I{compiler.sdk.path}/include/esp_ringbuf/include" "-I{compiler.sdk.path}/include/efuse/include" "-I{compiler.sdk.path}/include/efuse/esp32c3/include" "-I{compiler.sdk.path}/include/riscv/include" "-I{compiler.sdk.path}/include/vfs/include" "-I{compiler.sdk.path}/include/esp_wifi/include" "-I{compiler.sdk.path}/include/esp_wifi/esp32c3/include" "-I{compiler.sdk.path}/include/esp_event/include" "-I{compiler.sdk.path}/include/esp_netif/include" "-I{compiler.sdk.path}/include/esp_eth/include" "-I{compiler.sdk.path}/include/tcpip_adapter/include" "-I{compiler.sdk.path}/include/esp_timer/include" "-I{compiler.sdk.path}/include/mbedtls/port/include" "-I{compiler.sdk.path}/include/mbedtls/mbedtls/include" "-I{compiler.sdk.path}/include/mbedtls/esp_crt_bundle/include" "-I{compiler.sdk.path}/include/app_update/include" "-I{compiler.sdk.path}/include/spi_flash/include" "-I{compiler.sdk.path}/include/bootloader_support/include" "-I{compiler.sdk.path}/include/esp_ipc/include" "-I{compiler.sdk.path}/include/nvs_flash/include" "-I{compiler.sdk.path}/include/pthread/include" "-I{compiler.sdk.path}/include/esp_gdbstub/include" "-I{compiler.sdk.path}/include/esp_gdbstub/riscv" "-I{compiler.sdk.path}/include/esp_gdbstub/esp32c3" "-I{compiler.sdk.path}/include/espcoredump/include" "-I{compiler.sdk.path}/include/espcoredump/include/port/riscv" "-I{compiler.sdk.path}/include/wpa_supplicant/include" "-I{compiler.sdk.path}/include/wpa_supplicant/port/include" "-I{compiler.sdk.path}/include/wpa_supplicant/include/esp_supplicant" "-I{compiler.sdk.path}/include/app_trace/include" "-I{compiler.sdk.path}/include/asio/asio/asio/include" "-I{compiler.sdk.path}/include/asio/port/include" "-I{compiler.sdk.path}/include/bt/common/osi/include" "-I{compiler.sdk.path}/include/bt/include/esp32c3/include" "-I{compiler.sdk.path}/include/bt/host/bluedroid/api/include/api" "-I{compiler.sdk.path}/include/cbor/port/include" "-I{compiler.sdk.path}/include/unity/include" "-I{compiler.sdk.path}/include/unity/unity/src" "-I{compiler.sdk.path}/include/cmock/CMock/src" "-I{compiler.sdk.path}/include/coap/port/include" "-I{compiler.sdk.path}/include/coap/port/include/coap" "-I{compiler.sdk.path}/include/coap/libcoap/include" "-I{compiler.sdk.path}/include/coap/libcoap/include/coap2" "-I{compiler.sdk.path}/include/console" "-I{compiler.sdk.path}/include/nghttp/port/include" "-I{compiler.sdk.path}/include/nghttp/nghttp2/lib/includes" "-I{compiler.sdk.path}/include/esp-tls" "-I{compiler.sdk.path}/include/esp-tls/esp-tls-crypto" "-I{compiler.sdk.path}/include/esp_adc_cal/include" "-I{compiler.sdk.path}/include/esp_hid/include" "-I{compiler.sdk.path}/include/tcp_transport/include" "-I{compiler.sdk.path}/include/esp_http_client/include" "-I{compiler.sdk.path}/include/esp_http_server/include" "-I{compiler.sdk.path}/include/esp_https_ota/include" "-I{compiler.sdk.path}/include/esp_https_server/include" "-I{compiler.sdk.path}/include/protobuf-c/protobuf-c" "-I{compiler.sdk.path}/include/protocomm/include/common" "-I{compiler.sdk.path}/include/protocomm/include/security" "-I{compiler.sdk.path}/include/protocomm/include/transports" "-I{compiler.sdk.path}/include/mdns/include" "-I{compiler.sdk.path}/include/esp_local_ctrl/include" "-I{compiler.sdk.path}/include/sdmmc/include" "-I{compiler.sdk.path}/include/esp_serial_slave_link/include" "-I{compiler.sdk.path}/include/esp_websocket_client/include" "-I{compiler.sdk.path}/include/expat/expat/expat/lib" "-I{compiler.sdk.path}/include/expat/port/include" "-I{compiler.sdk.path}/include/wear_levelling/include" "-I{compiler.sdk.path}/include/fatfs/diskio" "-I{compiler.sdk.path}/include/fatfs/vfs" "-I{compiler.sdk.path}/include/fatfs/src" "-I{compiler.sdk.path}/include/freemodbus/common/include" "-I{compiler.sdk.path}/include/idf_test/include" "-I{compiler.sdk.path}/include/idf_test/include/esp32c3" "-I{compiler.sdk.path}/include/jsmn/include" "-I{compiler.sdk.path}/include/json/cJSON" "-I{compiler.sdk.path}/include/libsodium/libsodium/src/libsodium/include" "-I{compiler.sdk.path}/include/libsodium/port_include" "-I{compiler.sdk.path}/include/mqtt/esp-mqtt/include" "-I{compiler.sdk.path}/include/openssl/include" "-I{compiler.sdk.path}/include/spiffs/include" "-I{compiler.sdk.path}/include/wifi_provisioning/include" "-I{compiler.sdk.path}/include/esp_littlefs/src" "-I{compiler.sdk.path}/include/esp_littlefs/include" "-I{compiler.sdk.path}/include/fb_gfx/include" compiler.c.elf.libs.esp32c3=-lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lriscv -lesp32c3 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lasio -lbt -lcbor -lunity -lcmock -lcoap -lconsole -lnghttp -lesp-tls -lesp_adc_cal -lesp_hid -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lesp_https_server -lprotobuf-c -lprotocomm -lmdns -lesp_local_ctrl -lsdmmc -lesp_serial_slave_link -lesp_websocket_client -lexpat -lwear_levelling -lfatfs -lfreemodbus -ljsmn -ljson -llibsodium -lmqtt -lopenssl -lspiffs -lwifi_provisioning -lesp_littlefs -lfb_gfx -lasio -lcbor -lcmock -lunity -lcoap -lesp_hid -lesp_local_ctrl -lesp_https_server -lesp_websocket_client -lexpat -lfreemodbus -ljsmn -llibsodium -lmqtt -lwifi_provisioning -lprotocomm -lprotobuf-c -ljson -lfb_gfx -lbt -lbtdm_app -lbtbb -lesp_adc_cal -lmdns -lconsole -lfatfs -lwear_levelling -lopenssl -lspiffs -lesp_littlefs -lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lriscv -lesp32c3 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lriscv -lesp32c3 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lriscv -lesp32c3 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lriscv -lesp32c3 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lriscv -lesp32c3 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lmbedtls -lefuse -lapp_update -lbootloader_support -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lesp_pm -lesp_ringbuf -ldriver -lriscv -lesp32c3 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lm -lnewlib -lgcc -lstdc++ -lpthread -lapp_trace -lgcov -lapp_trace -lgcov -lc compiler.c.flags.esp32c3=-march=rv32imc -ffunction-sections -fdata-sections -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -Wno-error=format= -nostartfiles -Wno-format -Og -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -std=gnu99 -Wno-old-style-declaration -MMD -c compiler.cpp.flags.esp32c3=-march=rv32imc -ffunction-sections -fdata-sections -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -Wno-error=format= -nostartfiles -Wno-format -Og -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -std=gnu++11 -fno-exceptions -fno-rtti -MMD -c compiler.S.flags.esp32c3=-ffunction-sections -fdata-sections -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -Wno-error=format= -nostartfiles -Wno-format -Og -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -x assembler-with-cpp -MMD -c -compiler.c.elf.flags.esp32c3=-T esp32c3.rom.ld -T esp32c3.rom.api.ld -T esp32c3.rom.libgcc.ld -T esp32c3.rom.newlib.ld -T esp32c3.rom.version.ld -T esp32c3_out.ld -T esp32c3.project.ld -T esp32c3.peripherals.ld -nostartfiles -march=rv32imc --specs=nosys.specs -Wl,--cref -Wl,--gc-sections -fno-rtti -fno-lto -Wl,--wrap=mbedtls_mpi_exp_mod -u esp_app_desc -u pthread_include_pthread_impl -u pthread_include_pthread_cond_impl -u pthread_include_pthread_local_storage_impl -u start_app -u vfs_include_syscalls_impl -u call_user_start_cpu0 -Wl,--undefined=uxTopUsedPriority -u app_main -u newlib_include_heap_impl -u newlib_include_syscalls_impl -u newlib_include_pthread_impl -u __cxa_guard_dummy -u __cxx_fatal_exception +compiler.c.elf.flags.esp32c3=-T esp32c3.rom.ld -T esp32c3.rom.api.ld -T esp32c3.rom.libgcc.ld -T esp32c3.rom.newlib.ld -T esp32c3.rom.version.ld -T esp32c3_out.ld -T esp32c3.project.ld -T esp32c3.peripherals.ld -nostartfiles -march=rv32imc --specs=nosys.specs -Wl,--cref -Wl,--gc-sections -fno-rtti -fno-lto -Wl,--wrap=mbedtls_mpi_exp_mod -u esp_app_desc -u pthread_include_pthread_impl -u pthread_include_pthread_cond_impl -u pthread_include_pthread_local_storage_impl -u start_app -u vfs_include_syscalls_impl -u call_user_start_cpu0 -Wl,--undefined=uxTopUsedPriority -u app_main -u newlib_include_heap_impl -u newlib_include_syscalls_impl -u newlib_include_pthread_impl -u __cxa_guard_dummy -u __cxx_fatal_exception compiler.ar.flags.esp32c3=cr build.extra_flags.esp32c3=-DARDUINO_SERIAL_PORT=0 # diff --git a/tools/platformio-build-esp32.py b/tools/platformio-build-esp32.py index 756f131f79a..285fc791e40 100644 --- a/tools/platformio-build-esp32.py +++ b/tools/platformio-build-esp32.py @@ -110,6 +110,7 @@ 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 @@ 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 @@ 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 @@ "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", diff --git a/tools/platformio-build-esp32c3.py b/tools/platformio-build-esp32c3.py index 074dfba597a..da1464c4188 100644 --- a/tools/platformio-build-esp32c3.py +++ b/tools/platformio-build-esp32c3.py @@ -71,7 +71,6 @@ ], LINKFLAGS=[ - "-mlongcalls", "-nostartfiles", "-march=rv32imc", "--specs=nosys.specs", @@ -111,6 +110,7 @@ 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 @@ 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 @@ 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 @@ "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", diff --git a/tools/platformio-build-esp32s2.py b/tools/platformio-build-esp32s2.py index f5e08e383a0..9fc27502984 100644 --- a/tools/platformio-build-esp32s2.py +++ b/tools/platformio-build-esp32s2.py @@ -106,6 +106,7 @@ 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 @@ 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 @@ 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 @@ "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", diff --git a/tools/sdk/esp32/bin/bootloader_dio_40m.bin b/tools/sdk/esp32/bin/bootloader_dio_40m.bin index 2cb23573648..0acb2312e76 100644 Binary files a/tools/sdk/esp32/bin/bootloader_dio_40m.bin and b/tools/sdk/esp32/bin/bootloader_dio_40m.bin differ diff --git a/tools/sdk/esp32/bin/bootloader_dio_80m.bin b/tools/sdk/esp32/bin/bootloader_dio_80m.bin index a89aafb8864..791b4d2506d 100644 Binary files a/tools/sdk/esp32/bin/bootloader_dio_80m.bin and b/tools/sdk/esp32/bin/bootloader_dio_80m.bin differ diff --git a/tools/sdk/esp32/bin/bootloader_dout_40m.bin b/tools/sdk/esp32/bin/bootloader_dout_40m.bin index d17f6c90084..583b260ae31 100644 Binary files a/tools/sdk/esp32/bin/bootloader_dout_40m.bin and b/tools/sdk/esp32/bin/bootloader_dout_40m.bin differ diff --git a/tools/sdk/esp32/bin/bootloader_dout_80m.bin b/tools/sdk/esp32/bin/bootloader_dout_80m.bin index 0269cd8afaa..e88c652ad6c 100644 Binary files a/tools/sdk/esp32/bin/bootloader_dout_80m.bin and b/tools/sdk/esp32/bin/bootloader_dout_80m.bin differ diff --git a/tools/sdk/esp32/bin/bootloader_qio_40m.bin b/tools/sdk/esp32/bin/bootloader_qio_40m.bin index 74eee42f12a..e15f7e4c714 100644 Binary files a/tools/sdk/esp32/bin/bootloader_qio_40m.bin and b/tools/sdk/esp32/bin/bootloader_qio_40m.bin differ diff --git a/tools/sdk/esp32/bin/bootloader_qio_80m.bin b/tools/sdk/esp32/bin/bootloader_qio_80m.bin index d035e67aecd..53c0cad64eb 100644 Binary files a/tools/sdk/esp32/bin/bootloader_qio_80m.bin and b/tools/sdk/esp32/bin/bootloader_qio_80m.bin differ diff --git a/tools/sdk/esp32/bin/bootloader_qout_40m.bin b/tools/sdk/esp32/bin/bootloader_qout_40m.bin index a27e14bba49..0645bf9c40a 100644 Binary files a/tools/sdk/esp32/bin/bootloader_qout_40m.bin and b/tools/sdk/esp32/bin/bootloader_qout_40m.bin differ diff --git a/tools/sdk/esp32/bin/bootloader_qout_80m.bin b/tools/sdk/esp32/bin/bootloader_qout_80m.bin index 2d690db8689..90eed553716 100644 Binary files a/tools/sdk/esp32/bin/bootloader_qout_80m.bin and b/tools/sdk/esp32/bin/bootloader_qout_80m.bin differ diff --git a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_blufi_api.h b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_blufi_api.h index 5e0d9c3813d..fbd8adb7970 100644 --- a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_blufi_api.h +++ b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_blufi_api.h @@ -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 diff --git a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gattc_api.h b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gattc_api.h index 70a9b1536a9..077cca38507 100644 --- a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gattc_api.h +++ b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gattc_api.h @@ -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 */ diff --git a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h index 53849ba86cb..3d4999f8a7e 100644 --- a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h +++ b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h @@ -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); diff --git a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_hf_client_api.h b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_hf_client_api.h index 31a8fce38c4..3c5c05b178c 100644 --- a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_hf_client_api.h +++ b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_hf_client_api.h @@ -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); diff --git a/tools/sdk/esp32/include/config/sdkconfig.h b/tools/sdk/esp32/include/config/sdkconfig.h index d2713d291bd..795fb0e9c2f 100644 --- a/tools/sdk/esp32/include/config/sdkconfig.h +++ b/tools/sdk/esp32/include/config/sdkconfig.h @@ -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" diff --git a/tools/sdk/esp32/include/driver/include/driver/dedic_gpio.h b/tools/sdk/esp32/include/driver/include/driver/dedic_gpio.h index f7d9b4a6ccb..f381e2c64b0 100644 --- a/tools/sdk/esp32/include/driver/include/driver/dedic_gpio.h +++ b/tools/sdk/esp32/include/driver/include/driver/dedic_gpio.h @@ -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 diff --git a/tools/sdk/esp32/include/driver/include/driver/gpio.h b/tools/sdk/esp32/include/driver/include/driver/gpio.h index c166ffa2791..aac81566fcc 100644 --- a/tools/sdk/esp32/include/driver/include/driver/gpio.h +++ b/tools/sdk/esp32/include/driver/include/driver/gpio.h @@ -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 diff --git a/tools/sdk/esp32/include/driver/include/driver/i2c.h b/tools/sdk/esp32/include/driver/include/driver/i2c.h index 30488fc570d..a2076cc459d 100644 --- a/tools/sdk/esp32/include/driver/include/driver/i2c.h +++ b/tools/sdk/esp32/include/driver/include/driver/i2c.h @@ -33,9 +33,39 @@ extern "C" { #define I2C_APB_CLK_FREQ APB_CLK_FREQ /*!< I2C source clock is APB clock, 80MHz */ +#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 */ -#define I2C_NUM_MAX (SOC_I2C_NUM) /*!< I2C port max */ +#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 */ diff --git a/tools/sdk/esp32/include/driver/include/driver/i2s.h b/tools/sdk/esp32/include/driver/include/driver/i2s.h index e5968ad3f71..6b53db68a2a 100644 --- a/tools/sdk/esp32/include/driver/include/driver/i2s.h +++ b/tools/sdk/esp32/include/driver/include/driver/i2s.h @@ -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 } diff --git a/tools/sdk/esp32/include/driver/include/driver/rtc_io.h b/tools/sdk/esp32/include/driver/include/driver/rtc_io.h index ea8878223cd..4cdcf74ba48 100644 --- a/tools/sdk/esp32/include/driver/include/driver/rtc_io.h +++ b/tools/sdk/esp32/include/driver/include/driver/rtc_io.h @@ -17,10 +17,12 @@ #include #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 * diff --git a/tools/sdk/esp32/include/driver/include/driver/sdspi_host.h b/tools/sdk/esp32/include/driver/include/driver/sdspi_host.h index 064c68ccca5..860ba1bfed4 100644 --- a/tools/sdk/esp32/include/driver/include/driver/sdspi_host.h +++ b/tools/sdk/esp32/include/driver/include/driver/sdspi_host.h @@ -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. diff --git a/tools/sdk/esp32/include/driver/include/driver/spi_common.h b/tools/sdk/esp32/include/driver/include/driver/spi_common.h index 05d7d2c7765..5fee265c0ad 100644 --- a/tools/sdk/esp32/include/driver/include/driver/spi_common.h +++ b/tools/sdk/esp32/include/driver/include/driver/spi_common.h @@ -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 diff --git a/tools/sdk/esp32/include/driver/include/driver/spi_slave.h b/tools/sdk/esp32/include/driver/include/driver/spi_slave.h index a970159f473..f03104bbc4d 100644 --- a/tools/sdk/esp32/include/driver/include/driver/spi_slave.h +++ b/tools/sdk/esp32/include/driver/include/driver/spi_slave.h @@ -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 diff --git a/tools/sdk/esp32/include/driver/include/esp_private/gpio.h b/tools/sdk/esp32/include/driver/include/esp_private/gpio.h new file mode 100644 index 00000000000..1c4811393c0 --- /dev/null +++ b/tools/sdk/esp32/include/driver/include/esp_private/gpio.h @@ -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 + +#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 diff --git a/tools/sdk/esp32/include/esp_http_client/include/esp_http_client.h b/tools/sdk/esp32/include/esp_http_client/include/esp_http_client.h index ee19f70cd7a..249eb217baf 100644 --- a/tools/sdk/esp32/include/esp_http_client/include/esp_http_client.h +++ b/tools/sdk/esp32/include/esp_http_client/include/esp_http_client.h @@ -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) */ diff --git a/tools/sdk/esp32/include/esp_system/include/esp_async_memcpy.h b/tools/sdk/esp32/include/esp_hw_support/include/esp_async_memcpy.h similarity index 100% rename from tools/sdk/esp32/include/esp_system/include/esp_async_memcpy.h rename to tools/sdk/esp32/include/esp_hw_support/include/esp_async_memcpy.h diff --git a/tools/sdk/esp32/include/esp_hw_support/include/esp_chip_info.h b/tools/sdk/esp32/include/esp_hw_support/include/esp_chip_info.h new file mode 100644 index 00000000000..35b191ac25b --- /dev/null +++ b/tools/sdk/esp32/include/esp_hw_support/include/esp_chip_info.h @@ -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 +#include +#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 diff --git a/tools/sdk/esp32/include/esp32/include/esp_clk.h b/tools/sdk/esp32/include/esp_hw_support/include/esp_clk.h similarity index 100% rename from tools/sdk/esp32/include/esp32/include/esp_clk.h rename to tools/sdk/esp32/include/esp_hw_support/include/esp_clk.h diff --git a/tools/sdk/esp32/include/esp32/include/esp_intr.h b/tools/sdk/esp32/include/esp_hw_support/include/esp_intr.h similarity index 100% rename from tools/sdk/esp32/include/esp32/include/esp_intr.h rename to tools/sdk/esp32/include/esp_hw_support/include/esp_intr.h diff --git a/tools/sdk/esp32/include/esp_system/include/esp_intr_alloc.h b/tools/sdk/esp32/include/esp_hw_support/include/esp_intr_alloc.h similarity index 100% rename from tools/sdk/esp32/include/esp_system/include/esp_intr_alloc.h rename to tools/sdk/esp32/include/esp_hw_support/include/esp_intr_alloc.h diff --git a/tools/sdk/esp32/include/esp_hw_support/include/esp_mac.h b/tools/sdk/esp32/include/esp_hw_support/include/esp_mac.h new file mode 100644 index 00000000000..9d91d8cee41 --- /dev/null +++ b/tools/sdk/esp32/include/esp_hw_support/include/esp_mac.h @@ -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 + * `. + * 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 diff --git a/tools/sdk/esp32/include/esp32/include/esp32/clk.h b/tools/sdk/esp32/include/esp_hw_support/include/esp_private/esp_clk.h similarity index 99% rename from tools/sdk/esp32/include/esp32/include/esp32/clk.h rename to tools/sdk/esp32/include/esp_hw_support/include/esp_private/esp_clk.h index dde169a16e1..14326898bd7 100644 --- a/tools/sdk/esp32/include/esp32/include/esp32/clk.h +++ b/tools/sdk/esp32/include/esp_hw_support/include/esp_private/esp_clk.h @@ -20,7 +20,7 @@ extern "C" { #endif /** - * @file esp32/clk.h + * @file esp_clk.h * * This file contains declarations of clock related functions. */ diff --git a/tools/sdk/esp32/include/esp_hw_support/include/esp_random.h b/tools/sdk/esp32/include/esp_hw_support/include/esp_random.h new file mode 100644 index 00000000000..26756b9db87 --- /dev/null +++ b/tools/sdk/esp32/include/esp_hw_support/include/esp_random.h @@ -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 +#include + +#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 diff --git a/tools/sdk/esp32/include/esp_system/include/esp_sleep.h b/tools/sdk/esp32/include/esp_hw_support/include/esp_sleep.h similarity index 98% rename from tools/sdk/esp32/include/esp_system/include/esp_sleep.h rename to tools/sdk/esp32/include/esp_hw_support/include/esp_sleep.h index d84933cde5a..1d81f716a8c 100644 --- a/tools/sdk/esp32/include/esp_system/include/esp_sleep.h +++ b/tools/sdk/esp32/include/esp_hw_support/include/esp_sleep.h @@ -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 diff --git a/tools/sdk/esp32/include/esp_hw_support/include/soc/esp32/clk.h b/tools/sdk/esp32/include/esp_hw_support/include/soc/esp32/clk.h new file mode 100644 index 00000000000..31902ebad01 --- /dev/null +++ b/tools/sdk/esp32/include/esp_hw_support/include/soc/esp32/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" diff --git a/tools/sdk/esp32/include/esp_hw_support/include/soc/esp32c3/clk.h b/tools/sdk/esp32/include/esp_hw_support/include/soc/esp32c3/clk.h new file mode 100644 index 00000000000..31902ebad01 --- /dev/null +++ b/tools/sdk/esp32/include/esp_hw_support/include/soc/esp32c3/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" diff --git a/tools/sdk/esp32/include/esp_hw_support/include/soc/esp32s2/clk.h b/tools/sdk/esp32/include/esp_hw_support/include/soc/esp32s2/clk.h new file mode 100644 index 00000000000..31902ebad01 --- /dev/null +++ b/tools/sdk/esp32/include/esp_hw_support/include/soc/esp32s2/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" diff --git a/tools/sdk/esp32/include/esp_hw_support/include/soc/esp32s3/clk.h b/tools/sdk/esp32/include/esp_hw_support/include/soc/esp32s3/clk.h new file mode 100644 index 00000000000..31902ebad01 --- /dev/null +++ b/tools/sdk/esp32/include/esp_hw_support/include/soc/esp32s3/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" diff --git a/tools/sdk/esp32/include/esp_pm/include/esp_pm.h b/tools/sdk/esp32/include/esp_pm/include/esp_pm.h index 4d5146316b4..86a404286f8 100644 --- a/tools/sdk/esp32/include/esp_pm/include/esp_pm.h +++ b/tools/sdk/esp32/include/esp_pm/include/esp_pm.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 diff --git a/tools/sdk/esp32/include/esp_system/include/esp_debug_helpers.h b/tools/sdk/esp32/include/esp_system/include/esp_debug_helpers.h index a802cb40235..c64df641e1b 100644 --- a/tools/sdk/esp32/include/esp_system/include/esp_debug_helpers.h +++ b/tools/sdk/esp32/include/esp_system/include/esp_debug_helpers.h @@ -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 * diff --git a/tools/sdk/esp32/include/esp_system/include/esp_private/crosscore_int.h b/tools/sdk/esp32/include/esp_system/include/esp_private/crosscore_int.h index bac4afba29e..1d6ec809b9f 100644 --- a/tools/sdk/esp32/include/esp_system/include/esp_private/crosscore_int.h +++ b/tools/sdk/esp32/include/esp_system/include/esp_private/crosscore_int.h @@ -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 } diff --git a/tools/sdk/esp32/include/esp_system/include/esp_private/startup_internal.h b/tools/sdk/esp32/include/esp_system/include/esp_private/startup_internal.h index 42b901cbf4a..52ec6e09b37 100644 --- a/tools/sdk/esp32/include/esp_system/include/esp_private/startup_internal.h +++ b/tools/sdk/esp32/include/esp_system/include/esp_private/startup_internal.h @@ -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. diff --git a/tools/sdk/esp32/include/esp_system/include/esp_system.h b/tools/sdk/esp32/include/esp_system/include/esp_system.h index bd9bb1a6c42..b98b7194902 100644 --- a/tools/sdk/esp32/include/esp_system/include/esp_system.h +++ b/tools/sdk/esp32/include/esp_system/include/esp_system.h @@ -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 - * `. - * 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 diff --git a/tools/sdk/esp32s2/include/esp32s2/include/esp32s2/brownout.h b/tools/sdk/esp32/include/esp_system/port/public_compat/brownout.h similarity index 100% rename from tools/sdk/esp32s2/include/esp32s2/include/esp32s2/brownout.h rename to tools/sdk/esp32/include/esp_system/port/public_compat/brownout.h diff --git a/tools/sdk/esp32s2/include/esp32s2/include/esp32s2/cache_err_int.h b/tools/sdk/esp32/include/esp_system/port/public_compat/cache_err_int.h similarity index 80% rename from tools/sdk/esp32s2/include/esp32s2/include/esp32s2/cache_err_int.h rename to tools/sdk/esp32/include/esp_system/port/public_compat/cache_err_int.h index 9748d96bf1d..d87406f80f7 100644 --- a/tools/sdk/esp32s2/include/esp32s2/include/esp32s2/cache_err_int.h +++ b/tools/sdk/esp32/include/esp_system/port/public_compat/cache_err_int.h @@ -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 diff --git a/tools/sdk/esp32/include/esp_system/port/public_compat/trax.h b/tools/sdk/esp32/include/esp_system/port/public_compat/trax.h new file mode 100644 index 00000000000..1322b7b5850 --- /dev/null +++ b/tools/sdk/esp32/include/esp_system/port/public_compat/trax.h @@ -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 diff --git a/tools/sdk/esp32/include/esp_system/port/soc/esp32/cache_err_int.h b/tools/sdk/esp32/include/esp_system/port/soc/esp32/cache_err_int.h new file mode 100644 index 00000000000..07085f53090 --- /dev/null +++ b/tools/sdk/esp32/include/esp_system/port/soc/esp32/cache_err_int.h @@ -0,0 +1,2 @@ +#pragma once +#include "cache_err_int.h" diff --git a/tools/sdk/esp32/include/esp_system/port/soc/esp32c3/cache_err_int.h b/tools/sdk/esp32/include/esp_system/port/soc/esp32c3/cache_err_int.h new file mode 100644 index 00000000000..07085f53090 --- /dev/null +++ b/tools/sdk/esp32/include/esp_system/port/soc/esp32c3/cache_err_int.h @@ -0,0 +1,2 @@ +#pragma once +#include "cache_err_int.h" diff --git a/tools/sdk/esp32/include/esp_system/port/soc/esp32s2/cache_err_int.h b/tools/sdk/esp32/include/esp_system/port/soc/esp32s2/cache_err_int.h new file mode 100644 index 00000000000..07085f53090 --- /dev/null +++ b/tools/sdk/esp32/include/esp_system/port/soc/esp32s2/cache_err_int.h @@ -0,0 +1,2 @@ +#pragma once +#include "cache_err_int.h" diff --git a/tools/sdk/esp32/include/esp_system/port/soc/esp32s3/cache_err_int.h b/tools/sdk/esp32/include/esp_system/port/soc/esp32s3/cache_err_int.h new file mode 100644 index 00000000000..07085f53090 --- /dev/null +++ b/tools/sdk/esp32/include/esp_system/port/soc/esp32s3/cache_err_int.h @@ -0,0 +1,2 @@ +#pragma once +#include "cache_err_int.h" diff --git a/tools/sdk/esp32/include/espcoredump/include/esp_core_dump.h b/tools/sdk/esp32/include/espcoredump/include/esp_core_dump.h index fb0d44d2c81..f8b029d5b6d 100644 --- a/tools/sdk/esp32/include/espcoredump/include/esp_core_dump.h +++ b/tools/sdk/esp32/include/espcoredump/include/esp_core_dump.h @@ -17,11 +17,37 @@ #include #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 diff --git a/tools/sdk/esp32s2/include/esp_system/include/esp_private/sleep_modes.h b/tools/sdk/esp32/include/espcoredump/include/port/riscv/esp_core_dump_summary_extra_info.h similarity index 58% rename from tools/sdk/esp32s2/include/esp_system/include/esp_private/sleep_modes.h rename to tools/sdk/esp32/include/espcoredump/include/port/riscv/esp_core_dump_summary_extra_info.h index e1584a8b573..510fdc06afe 100644 --- a/tools/sdk/esp32s2/include/esp_system/include/esp_private/sleep_modes.h +++ b/tools/sdk/esp32/include/espcoredump/include/port/riscv/esp_core_dump_summary_extra_info.h @@ -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 -#include #include -#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 } diff --git a/tools/sdk/esp32/include/espcoredump/include/port/xtensa/esp_core_dump_summary_extra_info.h b/tools/sdk/esp32/include/espcoredump/include/port/xtensa/esp_core_dump_summary_extra_info.h new file mode 100644 index 00000000000..3db7a70be82 --- /dev/null +++ b/tools/sdk/esp32/include/espcoredump/include/port/xtensa/esp_core_dump_summary_extra_info.h @@ -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 +#include + +#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 diff --git a/tools/sdk/esp32/include/freertos/include/freertos/task.h b/tools/sdk/esp32/include/freertos/include/freertos/task.h index 422948a2458..559945805ee 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/task.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/task.h @@ -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 diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/gpio_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/gpio_ll.h index a421cab4134..8c1acb3a1cf 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/gpio_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/gpio_ll.h @@ -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 diff --git a/tools/sdk/esp32/include/hal/include/hal/gpio_hal.h b/tools/sdk/esp32/include/hal/include/hal/gpio_hal.h index 5a403f529c6..018b4be1288 100644 --- a/tools/sdk/esp32/include/hal/include/hal/gpio_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/gpio_hal.h @@ -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 diff --git a/tools/sdk/esp32/include/hal/include/hal/i2c_types.h b/tools/sdk/esp32/include/hal/include/hal/i2c_types.h index 3d5864dc10a..12147c78b7b 100644 --- a/tools/sdk/esp32/include/hal/include/hal/i2c_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/i2c_types.h @@ -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, /*! #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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h index 0bbc6885934..5d671df142d 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h index f863ce88ca2..6643b0cbf50 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth.h index 7174e7bcedd..540aee0e8d7 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h index deec5266e68..3da864c7d27 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h index 77a55fbc008..d992cb8163d 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h index 4842f3debc7..3fb52638924 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box.h index 614cd1e0ac1..e060dd29fc4 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h index 29c9b255202..26a3d31efa9 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h @@ -3,6 +3,7 @@ #define crypto_box_curve25519xchacha20poly1305_H #include +#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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h index 9b5a39c3fa4..e733f49995b 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h @@ -2,6 +2,7 @@ #define crypto_box_curve25519xsalsa20poly1305_H #include +#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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_ed25519.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_ed25519.h new file mode 100644 index 00000000000..3eae00c4562 --- /dev/null +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_ed25519.h @@ -0,0 +1,100 @@ +#ifndef crypto_core_ed25519_H +#define crypto_core_ed25519_H + +#include +#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 diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hchacha20.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hchacha20.h index 05e5670c10e..ece141b09b4 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hchacha20.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hchacha20.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h index 82e475b8f67..4bf7a48786f 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_ristretto255.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_ristretto255.h new file mode 100644 index 00000000000..f2820e5576e --- /dev/null +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_ristretto255.h @@ -0,0 +1,100 @@ +#ifndef crypto_core_ristretto255_H +#define crypto_core_ristretto255_H + +#include +#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 diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h index 160cc56d2c4..bd79fd9f540 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h index bdd5f9fdbb2..05957591ca7 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h index 3c13efa4ef3..d2f216af268 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash.h index 2398fb9dbba..d897e5d26c5 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h index 7b0c0820743..fee9d8ad196 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash.h index 302ed5c5ea2..8752f9cafeb 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash.h @@ -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 diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h index f64d16e0e5c..b18217e18df 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h index 6b0330f14fe..8efa7193ad9 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf.h index 52e496a7449..ac2fc6183c2 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf_blake2b.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf_blake2b.h index 5480ebe82f1..3ae47dd32c5 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf_blake2b.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf_blake2b.h @@ -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 diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kx.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kx.h index d1fce90da57..347132c320e 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kx.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kx.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h index 5951c5b82d3..7cd7b07060f 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h index 479e923dccb..f3e34d86df4 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash.h index 56eca0680c1..585a993efd2 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash.h @@ -4,6 +4,7 @@ #include #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 - diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2i.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2i.h index d414b939d1f..88ff6221d67 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2i.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2i.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2id.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2id.h new file mode 100644 index 00000000000..7183abd186b --- /dev/null +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2id.h @@ -0,0 +1,122 @@ +#ifndef crypto_pwhash_argon2id_H +#define crypto_pwhash_argon2id_H + +#include +#include +#include + +#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 diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h index 9f693e540e7..5c0bf7d390a 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h index 830c10f6473..1c685853783 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h index 953f8923c5e..60e9d0c5a40 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h @@ -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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h new file mode 100644 index 00000000000..2dfa4d7073f --- /dev/null +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h @@ -0,0 +1,51 @@ + +#ifndef crypto_scalarmult_ed25519_H +#define crypto_scalarmult_ed25519_H + +#include + +#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 diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ristretto255.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ristretto255.h new file mode 100644 index 00000000000..40a45ccef02 --- /dev/null +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ristretto255.h @@ -0,0 +1,43 @@ + +#ifndef crypto_scalarmult_ristretto255_H +#define crypto_scalarmult_ristretto255_H + +#include + +#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 diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox.h index 9b098200e0b..1d3709db128 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox.h @@ -29,23 +29,28 @@ size_t crypto_secretbox_macbytes(void); SODIUM_EXPORT const char *crypto_secretbox_primitive(void); +#define crypto_secretbox_MESSAGEBYTES_MAX crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX +SODIUM_EXPORT +size_t crypto_secretbox_messagebytes_max(void); + SODIUM_EXPORT int crypto_secretbox_easy(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_secretbox_open_easy(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_secretbox_detached(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 *k) + __attribute__ ((nonnull(1, 2, 5, 6))); SODIUM_EXPORT int crypto_secretbox_open_detached(unsigned char *m, @@ -54,10 +59,11 @@ int crypto_secretbox_open_detached(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, 3, 5, 6))); SODIUM_EXPORT -void crypto_secretbox_keygen(unsigned char k[crypto_secretbox_KEYBYTES]); +void crypto_secretbox_keygen(unsigned char k[crypto_secretbox_KEYBYTES]) + __attribute__ ((nonnull)); /* -- NaCl compatibility interface ; Requires padding -- */ @@ -72,13 +78,13 @@ size_t crypto_secretbox_boxzerobytes(void); SODIUM_EXPORT int crypto_secretbox(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_secretbox_open(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 } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h index 7a61a09174e..6ec674e3105 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h @@ -2,6 +2,7 @@ #define crypto_secretbox_xchacha20poly1305_H #include +#include "crypto_stream_xchacha20.h" #include "export.h" #ifdef __cplusplus @@ -23,12 +24,18 @@ size_t crypto_secretbox_xchacha20poly1305_noncebytes(void); SODIUM_EXPORT size_t crypto_secretbox_xchacha20poly1305_macbytes(void); +#define crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX \ + (crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_secretbox_xchacha20poly1305_MACBYTES) +SODIUM_EXPORT +size_t crypto_secretbox_xchacha20poly1305_messagebytes_max(void); + SODIUM_EXPORT int crypto_secretbox_xchacha20poly1305_easy(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_secretbox_xchacha20poly1305_open_easy(unsigned char *m, @@ -36,7 +43,7 @@ int crypto_secretbox_xchacha20poly1305_open_easy(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_secretbox_xchacha20poly1305_detached(unsigned char *c, @@ -44,7 +51,8 @@ int crypto_secretbox_xchacha20poly1305_detached(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_secretbox_xchacha20poly1305_open_detached(unsigned char *m, @@ -53,7 +61,7 @@ int crypto_secretbox_xchacha20poly1305_open_detached(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, 3, 5, 6))); #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h index 5aa30805d6c..be0874cbafa 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h @@ -2,6 +2,7 @@ #define crypto_secretbox_xsalsa20poly1305_H #include +#include "crypto_stream_xsalsa20.h" #include "export.h" #ifdef __cplusplus @@ -23,22 +24,19 @@ size_t crypto_secretbox_xsalsa20poly1305_noncebytes(void); SODIUM_EXPORT size_t crypto_secretbox_xsalsa20poly1305_macbytes(void); -#define crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES 16U -SODIUM_EXPORT -size_t crypto_secretbox_xsalsa20poly1305_boxzerobytes(void); - -#define crypto_secretbox_xsalsa20poly1305_ZEROBYTES \ - (crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES + \ - crypto_secretbox_xsalsa20poly1305_MACBYTES) +/* Only for the libsodium API - The NaCl compatibility API would require BOXZEROBYTES extra bytes */ +#define crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX \ + (crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_secretbox_xsalsa20poly1305_MACBYTES) SODIUM_EXPORT -size_t crypto_secretbox_xsalsa20poly1305_zerobytes(void); +size_t crypto_secretbox_xsalsa20poly1305_messagebytes_max(void); SODIUM_EXPORT int crypto_secretbox_xsalsa20poly1305(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_secretbox_xsalsa20poly1305_open(unsigned char *m, @@ -46,10 +44,23 @@ int crypto_secretbox_xsalsa20poly1305_open(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 -void crypto_secretbox_xsalsa20poly1305_keygen(unsigned char k[crypto_secretbox_xsalsa20poly1305_KEYBYTES]); +void crypto_secretbox_xsalsa20poly1305_keygen(unsigned char k[crypto_secretbox_xsalsa20poly1305_KEYBYTES]) + __attribute__ ((nonnull)); + +/* -- NaCl compatibility interface ; Requires padding -- */ + +#define crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES 16U +SODIUM_EXPORT +size_t crypto_secretbox_xsalsa20poly1305_boxzerobytes(void); + +#define crypto_secretbox_xsalsa20poly1305_ZEROBYTES \ + (crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES + \ + crypto_secretbox_xsalsa20poly1305_MACBYTES) +SODIUM_EXPORT +size_t crypto_secretbox_xsalsa20poly1305_zerobytes(void); #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h new file mode 100644 index 00000000000..b22e4e9313e --- /dev/null +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h @@ -0,0 +1,108 @@ +#ifndef crypto_secretstream_xchacha20poly1305_H +#define crypto_secretstream_xchacha20poly1305_H + +#include + +#include "crypto_aead_xchacha20poly1305.h" +#include "crypto_stream_chacha20.h" +#include "export.h" + +#ifdef __cplusplus +# ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wlong-long" +# endif +extern "C" { +#endif + +#define crypto_secretstream_xchacha20poly1305_ABYTES \ + (1U + crypto_aead_xchacha20poly1305_ietf_ABYTES) +SODIUM_EXPORT +size_t crypto_secretstream_xchacha20poly1305_abytes(void); + +#define crypto_secretstream_xchacha20poly1305_HEADERBYTES \ + crypto_aead_xchacha20poly1305_ietf_NPUBBYTES +SODIUM_EXPORT +size_t crypto_secretstream_xchacha20poly1305_headerbytes(void); + +#define crypto_secretstream_xchacha20poly1305_KEYBYTES \ + crypto_aead_xchacha20poly1305_ietf_KEYBYTES +SODIUM_EXPORT +size_t crypto_secretstream_xchacha20poly1305_keybytes(void); + +#define crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX \ + SODIUM_MIN(SODIUM_SIZE_MAX - crypto_secretstream_xchacha20poly1305_ABYTES, \ + (64ULL * ((1ULL << 32) - 2ULL))) +SODIUM_EXPORT +size_t crypto_secretstream_xchacha20poly1305_messagebytes_max(void); + +#define crypto_secretstream_xchacha20poly1305_TAG_MESSAGE 0x00 +SODIUM_EXPORT +unsigned char crypto_secretstream_xchacha20poly1305_tag_message(void); + +#define crypto_secretstream_xchacha20poly1305_TAG_PUSH 0x01 +SODIUM_EXPORT +unsigned char crypto_secretstream_xchacha20poly1305_tag_push(void); + +#define crypto_secretstream_xchacha20poly1305_TAG_REKEY 0x02 +SODIUM_EXPORT +unsigned char crypto_secretstream_xchacha20poly1305_tag_rekey(void); + +#define crypto_secretstream_xchacha20poly1305_TAG_FINAL \ + (crypto_secretstream_xchacha20poly1305_TAG_PUSH | \ + crypto_secretstream_xchacha20poly1305_TAG_REKEY) +SODIUM_EXPORT +unsigned char crypto_secretstream_xchacha20poly1305_tag_final(void); + +typedef struct crypto_secretstream_xchacha20poly1305_state { + unsigned char k[crypto_stream_chacha20_ietf_KEYBYTES]; + unsigned char nonce[crypto_stream_chacha20_ietf_NONCEBYTES]; + unsigned char _pad[8]; +} crypto_secretstream_xchacha20poly1305_state; + +SODIUM_EXPORT +size_t crypto_secretstream_xchacha20poly1305_statebytes(void); + +SODIUM_EXPORT +void crypto_secretstream_xchacha20poly1305_keygen + (unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES]) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +int crypto_secretstream_xchacha20poly1305_init_push + (crypto_secretstream_xchacha20poly1305_state *state, + unsigned char header[crypto_secretstream_xchacha20poly1305_HEADERBYTES], + const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES]) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +int crypto_secretstream_xchacha20poly1305_push + (crypto_secretstream_xchacha20poly1305_state *state, + unsigned char *c, unsigned long long *clen_p, + const unsigned char *m, unsigned long long mlen, + const unsigned char *ad, unsigned long long adlen, unsigned char tag) + __attribute__ ((nonnull(1))); + +SODIUM_EXPORT +int crypto_secretstream_xchacha20poly1305_init_pull + (crypto_secretstream_xchacha20poly1305_state *state, + const unsigned char header[crypto_secretstream_xchacha20poly1305_HEADERBYTES], + const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES]) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +int crypto_secretstream_xchacha20poly1305_pull + (crypto_secretstream_xchacha20poly1305_state *state, + unsigned char *m, unsigned long long *mlen_p, unsigned char *tag_p, + const unsigned char *c, unsigned long long clen, + const unsigned char *ad, unsigned long long adlen) + __attribute__ ((nonnull(1))); + +SODIUM_EXPORT +void crypto_secretstream_xchacha20poly1305_rekey + (crypto_secretstream_xchacha20poly1305_state *state); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash.h index a4988082471..fecaa88bd80 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash.h @@ -27,10 +27,12 @@ const char *crypto_shorthash_primitive(void); SODIUM_EXPORT int crypto_shorthash(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 -void crypto_shorthash_keygen(unsigned char k[crypto_shorthash_KEYBYTES]); +void crypto_shorthash_keygen(unsigned char k[crypto_shorthash_KEYBYTES]) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h index 745ed48fae9..1e6f72a620e 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h @@ -23,7 +23,8 @@ size_t crypto_shorthash_siphash24_keybytes(void); SODIUM_EXPORT int crypto_shorthash_siphash24(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))); #ifndef SODIUM_LIBRARY_MINIMAL /* -- 128-bit output -- */ @@ -38,7 +39,8 @@ size_t crypto_shorthash_siphashx24_keybytes(void); SODIUM_EXPORT int crypto_shorthash_siphashx24(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))); #endif #ifdef __cplusplus diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign.h index b0335bf274c..f5fafb123e0 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign.h @@ -41,56 +41,64 @@ size_t crypto_sign_publickeybytes(void); SODIUM_EXPORT size_t crypto_sign_secretkeybytes(void); +#define crypto_sign_MESSAGEBYTES_MAX crypto_sign_ed25519_MESSAGEBYTES_MAX +SODIUM_EXPORT +size_t crypto_sign_messagebytes_max(void); + #define crypto_sign_PRIMITIVE "ed25519" SODIUM_EXPORT const char *crypto_sign_primitive(void); SODIUM_EXPORT int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk, - const unsigned char *seed); + const unsigned char *seed) + __attribute__ ((nonnull)); SODIUM_EXPORT -int crypto_sign_keypair(unsigned char *pk, unsigned char *sk); +int crypto_sign_keypair(unsigned char *pk, unsigned char *sk) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_sign(unsigned char *sm, unsigned long long *smlen_p, const unsigned char *m, unsigned long long mlen, - const unsigned char *sk); + const unsigned char *sk) __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_open(unsigned char *m, unsigned long long *mlen_p, const unsigned char *sm, unsigned long long smlen, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5))); SODIUM_EXPORT int crypto_sign_detached(unsigned char *sig, unsigned long long *siglen_p, const unsigned char *m, unsigned long long mlen, - const unsigned char *sk); + const unsigned char *sk) __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_verify_detached(const unsigned char *sig, const unsigned char *m, unsigned long long mlen, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT int crypto_sign_init(crypto_sign_state *state); SODIUM_EXPORT int crypto_sign_update(crypto_sign_state *state, - const unsigned char *m, unsigned long long mlen); + const unsigned char *m, unsigned long long mlen) + __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_sign_final_create(crypto_sign_state *state, unsigned char *sig, unsigned long long *siglen_p, - const unsigned char *sk); + const unsigned char *sk) + __attribute__ ((nonnull(1, 2, 4))); SODIUM_EXPORT -int crypto_sign_final_verify(crypto_sign_state *state, unsigned char *sig, +int crypto_sign_final_verify(crypto_sign_state *state, const unsigned char *sig, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h index 17c150f284a..0fdac42d353 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h @@ -35,73 +35,87 @@ size_t crypto_sign_ed25519_publickeybytes(void); SODIUM_EXPORT size_t crypto_sign_ed25519_secretkeybytes(void); +#define crypto_sign_ed25519_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_ed25519_BYTES) +SODIUM_EXPORT +size_t crypto_sign_ed25519_messagebytes_max(void); + SODIUM_EXPORT int crypto_sign_ed25519(unsigned char *sm, unsigned long long *smlen_p, const unsigned char *m, unsigned long long mlen, - const unsigned char *sk); + const unsigned char *sk) + __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_ed25519_open(unsigned char *m, unsigned long long *mlen_p, const unsigned char *sm, unsigned long long smlen, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5))); SODIUM_EXPORT int crypto_sign_ed25519_detached(unsigned char *sig, unsigned long long *siglen_p, const unsigned char *m, unsigned long long mlen, - const unsigned char *sk); + const unsigned char *sk) + __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_ed25519_verify_detached(const unsigned char *sig, const unsigned char *m, unsigned long long mlen, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT -int crypto_sign_ed25519_keypair(unsigned char *pk, unsigned char *sk); +int crypto_sign_ed25519_keypair(unsigned char *pk, unsigned char *sk) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_sign_ed25519_seed_keypair(unsigned char *pk, unsigned char *sk, - const unsigned char *seed); + const unsigned char *seed) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_sign_ed25519_pk_to_curve25519(unsigned char *curve25519_pk, const unsigned char *ed25519_pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_sign_ed25519_sk_to_curve25519(unsigned char *curve25519_sk, - const unsigned char *ed25519_sk); + const unsigned char *ed25519_sk) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_sign_ed25519_sk_to_seed(unsigned char *seed, - const unsigned char *sk); + const unsigned char *sk) + __attribute__ ((nonnull)); SODIUM_EXPORT -int crypto_sign_ed25519_sk_to_pk(unsigned char *pk, const unsigned char *sk); +int crypto_sign_ed25519_sk_to_pk(unsigned char *pk, const unsigned char *sk) + __attribute__ ((nonnull)); SODIUM_EXPORT -int crypto_sign_ed25519ph_init(crypto_sign_ed25519ph_state *state); +int crypto_sign_ed25519ph_init(crypto_sign_ed25519ph_state *state) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_sign_ed25519ph_update(crypto_sign_ed25519ph_state *state, const unsigned char *m, - unsigned long long mlen); + unsigned long long mlen) + __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_sign_ed25519ph_final_create(crypto_sign_ed25519ph_state *state, unsigned char *sig, unsigned long long *siglen_p, - const unsigned char *sk); + const unsigned char *sk) + __attribute__ ((nonnull(1, 2, 4))); SODIUM_EXPORT int crypto_sign_ed25519ph_final_verify(crypto_sign_ed25519ph_state *state, - unsigned char *sig, + const unsigned char *sig, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h index 2224a94e013..eed158aa845 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h @@ -25,6 +25,7 @@ extern "C" { #define crypto_sign_edwards25519sha512batch_BYTES 64U #define crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES 32U #define crypto_sign_edwards25519sha512batch_SECRETKEYBYTES (32U + 32U) +#define crypto_sign_edwards25519sha512batch_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_edwards25519sha512batch_BYTES) SODIUM_EXPORT int crypto_sign_edwards25519sha512batch(unsigned char *sm, @@ -32,7 +33,7 @@ int crypto_sign_edwards25519sha512batch(unsigned char *sm, const unsigned char *m, unsigned long long mlen, const unsigned char *sk) - __attribute__ ((deprecated)); + __attribute__ ((deprecated)) __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_edwards25519sha512batch_open(unsigned char *m, @@ -40,12 +41,12 @@ int crypto_sign_edwards25519sha512batch_open(unsigned char *m, const unsigned char *sm, unsigned long long smlen, const unsigned char *pk) - __attribute__ ((deprecated)); + __attribute__ ((deprecated)) __attribute__ ((nonnull(3, 5))); SODIUM_EXPORT int crypto_sign_edwards25519sha512batch_keypair(unsigned char *pk, unsigned char *sk) - __attribute__ ((deprecated)); + __attribute__ ((deprecated)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream.h index 22de6ff52d3..88dab5f6111 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream.h @@ -29,21 +29,28 @@ size_t crypto_stream_keybytes(void); SODIUM_EXPORT size_t crypto_stream_noncebytes(void); +#define crypto_stream_MESSAGEBYTES_MAX crypto_stream_xsalsa20_MESSAGEBYTES_MAX +SODIUM_EXPORT +size_t crypto_stream_messagebytes_max(void); + #define crypto_stream_PRIMITIVE "xsalsa20" SODIUM_EXPORT const char *crypto_stream_primitive(void); SODIUM_EXPORT int crypto_stream(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_xor(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)); SODIUM_EXPORT -void crypto_stream_keygen(unsigned char k[crypto_stream_KEYBYTES]); +void crypto_stream_keygen(unsigned char k[crypto_stream_KEYBYTES]) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h deleted file mode 100644 index 33ee1b89714..00000000000 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef crypto_stream_aes128ctr_H -#define crypto_stream_aes128ctr_H - -/* - * WARNING: This is just a stream cipher. It is NOT authenticated encryption. - * While it provides some protection against eavesdropping, it does NOT - * provide any security against active attacks. - * Unless you know what you're doing, what you are looking for is probably - * the crypto_box functions. - */ - -#include -#include "export.h" - -#ifdef __cplusplus -# ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wlong-long" -# endif -extern "C" { -#endif - -#define crypto_stream_aes128ctr_KEYBYTES 16U -SODIUM_EXPORT -size_t crypto_stream_aes128ctr_keybytes(void); - -#define crypto_stream_aes128ctr_NONCEBYTES 16U -SODIUM_EXPORT -size_t crypto_stream_aes128ctr_noncebytes(void); - -#define crypto_stream_aes128ctr_BEFORENMBYTES 1408U -SODIUM_EXPORT -size_t crypto_stream_aes128ctr_beforenmbytes(void); - -SODIUM_EXPORT -int crypto_stream_aes128ctr(unsigned char *out, unsigned long long outlen, - const unsigned char *n, const unsigned char *k) - __attribute__ ((deprecated)); - -SODIUM_EXPORT -int crypto_stream_aes128ctr_xor(unsigned char *out, const unsigned char *in, - unsigned long long inlen, const unsigned char *n, - const unsigned char *k) - __attribute__ ((deprecated)); - -SODIUM_EXPORT -int crypto_stream_aes128ctr_beforenm(unsigned char *c, const unsigned char *k) - __attribute__ ((deprecated)); - -SODIUM_EXPORT -int crypto_stream_aes128ctr_afternm(unsigned char *out, unsigned long long len, - const unsigned char *nonce, const unsigned char *c) - __attribute__ ((deprecated)); - -SODIUM_EXPORT -int crypto_stream_aes128ctr_xor_afternm(unsigned char *out, const unsigned char *in, - unsigned long long len, - const unsigned char *nonce, - const unsigned char *c) - __attribute__ ((deprecated)); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h index cf3ffe89595..408897558b8 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h @@ -28,25 +28,33 @@ size_t crypto_stream_chacha20_keybytes(void); SODIUM_EXPORT size_t crypto_stream_chacha20_noncebytes(void); +#define crypto_stream_chacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX +SODIUM_EXPORT +size_t crypto_stream_chacha20_messagebytes_max(void); + /* ChaCha20 with a 64-bit nonce and a 64-bit counter, as originally designed */ SODIUM_EXPORT int crypto_stream_chacha20(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_chacha20_xor(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)); SODIUM_EXPORT int crypto_stream_chacha20_xor_ic(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, uint64_t ic, - const unsigned char *k); + const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_stream_chacha20_keygen(unsigned char k[crypto_stream_chacha20_KEYBYTES]); +void crypto_stream_chacha20_keygen(unsigned char k[crypto_stream_chacha20_KEYBYTES]) + __attribute__ ((nonnull)); /* ChaCha20 with a 96-bit nonce and a 32-bit counter (IETF) */ @@ -58,32 +66,38 @@ size_t crypto_stream_chacha20_ietf_keybytes(void); SODIUM_EXPORT size_t crypto_stream_chacha20_ietf_noncebytes(void); +#define crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX \ + SODIUM_MIN(SODIUM_SIZE_MAX, 64ULL * (1ULL << 32)) +SODIUM_EXPORT +size_t crypto_stream_chacha20_ietf_messagebytes_max(void); + SODIUM_EXPORT int crypto_stream_chacha20_ietf(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_chacha20_ietf_xor(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)); SODIUM_EXPORT int crypto_stream_chacha20_ietf_xor_ic(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, uint32_t ic, - const unsigned char *k); + const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_stream_chacha20_ietf_keygen(unsigned char k[crypto_stream_chacha20_ietf_KEYBYTES]); - -/* ------------------------------------------------------------------------- */ - -int _crypto_stream_chacha20_pick_best_implementation(void); +void crypto_stream_chacha20_ietf_keygen(unsigned char k[crypto_stream_chacha20_ietf_KEYBYTES]) + __attribute__ ((nonnull)); /* Aliases */ #define crypto_stream_chacha20_IETF_KEYBYTES crypto_stream_chacha20_ietf_KEYBYTES #define crypto_stream_chacha20_IETF_NONCEBYTES crypto_stream_chacha20_ietf_NONCEBYTES +#define crypto_stream_chacha20_IETF_MESSAGEBYTES_MAX crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h index 741140eb22d..45b3b3e34aa 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h @@ -28,27 +28,31 @@ size_t crypto_stream_salsa20_keybytes(void); SODIUM_EXPORT size_t crypto_stream_salsa20_noncebytes(void); +#define crypto_stream_salsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX +SODIUM_EXPORT +size_t crypto_stream_salsa20_messagebytes_max(void); + SODIUM_EXPORT int crypto_stream_salsa20(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_salsa20_xor(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)); SODIUM_EXPORT int crypto_stream_salsa20_xor_ic(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, uint64_t ic, - const unsigned char *k); + const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_stream_salsa20_keygen(unsigned char k[crypto_stream_salsa20_KEYBYTES]); - -/* ------------------------------------------------------------------------- */ - -int _crypto_stream_salsa20_pick_best_implementation(void); +void crypto_stream_salsa20_keygen(unsigned char k[crypto_stream_salsa20_KEYBYTES]) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h index d5c44282174..6c5d303cacc 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h @@ -27,17 +27,24 @@ size_t crypto_stream_salsa2012_keybytes(void); SODIUM_EXPORT size_t crypto_stream_salsa2012_noncebytes(void); +#define crypto_stream_salsa2012_MESSAGEBYTES_MAX SODIUM_SIZE_MAX +SODIUM_EXPORT +size_t crypto_stream_salsa2012_messagebytes_max(void); + SODIUM_EXPORT int crypto_stream_salsa2012(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_salsa2012_xor(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)); SODIUM_EXPORT -void crypto_stream_salsa2012_keygen(unsigned char k[crypto_stream_salsa2012_KEYBYTES]); +void crypto_stream_salsa2012_keygen(unsigned char k[crypto_stream_salsa2012_KEYBYTES]) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h index 02b4166e1ca..d574f30478a 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h @@ -21,23 +21,33 @@ extern "C" { #define crypto_stream_salsa208_KEYBYTES 32U SODIUM_EXPORT -size_t crypto_stream_salsa208_keybytes(void); +size_t crypto_stream_salsa208_keybytes(void) + __attribute__ ((deprecated)); #define crypto_stream_salsa208_NONCEBYTES 8U SODIUM_EXPORT -size_t crypto_stream_salsa208_noncebytes(void); +size_t crypto_stream_salsa208_noncebytes(void) + __attribute__ ((deprecated)); + +#define crypto_stream_salsa208_MESSAGEBYTES_MAX SODIUM_SIZE_MAX + SODIUM_EXPORT +size_t crypto_stream_salsa208_messagebytes_max(void) + __attribute__ ((deprecated)); SODIUM_EXPORT int crypto_stream_salsa208(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((deprecated)) __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_salsa208_xor(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, - const unsigned char *k); + const unsigned char *k) + __attribute__ ((deprecated)) __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_stream_salsa208_keygen(unsigned char k[crypto_stream_salsa208_KEYBYTES]); +void crypto_stream_salsa208_keygen(unsigned char k[crypto_stream_salsa208_KEYBYTES]) + __attribute__ ((deprecated)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xchacha20.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xchacha20.h index f884798e740..c4002db00a8 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xchacha20.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xchacha20.h @@ -28,23 +28,31 @@ size_t crypto_stream_xchacha20_keybytes(void); SODIUM_EXPORT size_t crypto_stream_xchacha20_noncebytes(void); +#define crypto_stream_xchacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX +SODIUM_EXPORT +size_t crypto_stream_xchacha20_messagebytes_max(void); + SODIUM_EXPORT int crypto_stream_xchacha20(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_xchacha20_xor(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)); SODIUM_EXPORT int crypto_stream_xchacha20_xor_ic(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, uint64_t ic, - const unsigned char *k); + const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_stream_xchacha20_keygen(unsigned char k[crypto_stream_xchacha20_KEYBYTES]); +void crypto_stream_xchacha20_keygen(unsigned char k[crypto_stream_xchacha20_KEYBYTES]) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h index ed5ae3c3d3c..20034e3462b 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h @@ -28,23 +28,31 @@ size_t crypto_stream_xsalsa20_keybytes(void); SODIUM_EXPORT size_t crypto_stream_xsalsa20_noncebytes(void); +#define crypto_stream_xsalsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX +SODIUM_EXPORT +size_t crypto_stream_xsalsa20_messagebytes_max(void); + SODIUM_EXPORT int crypto_stream_xsalsa20(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_xsalsa20_xor(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)); SODIUM_EXPORT int crypto_stream_xsalsa20_xor_ic(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, uint64_t ic, - const unsigned char *k); + const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_stream_xsalsa20_keygen(unsigned char k[crypto_stream_xsalsa20_KEYBYTES]); +void crypto_stream_xsalsa20_keygen(unsigned char k[crypto_stream_xsalsa20_KEYBYTES]) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_16.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_16.h index 5e9eeabee84..7b9c8077ad3 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_16.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_16.h @@ -14,7 +14,7 @@ size_t crypto_verify_16_bytes(void); SODIUM_EXPORT int crypto_verify_16(const unsigned char *x, const unsigned char *y) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_32.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_32.h index 281b5a1bb79..9b0f4529f6c 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_32.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_32.h @@ -14,7 +14,7 @@ size_t crypto_verify_32_bytes(void); SODIUM_EXPORT int crypto_verify_32(const unsigned char *x, const unsigned char *y) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_64.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_64.h index 0dc7c304a99..c83b73025a6 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_64.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_64.h @@ -14,7 +14,7 @@ size_t crypto_verify_64_bytes(void); SODIUM_EXPORT int crypto_verify_64(const unsigned char *x, const unsigned char *y) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/export.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/export.h index c33bced8188..a0074fc9cbb 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/export.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/export.h @@ -2,7 +2,11 @@ #ifndef sodium_export_H #define sodium_export_H -#ifndef __GNUC__ +#include +#include +#include + +#if !defined(__clang__) && !defined(__GNUC__) # ifdef __attribute__ # undef __attribute__ # endif @@ -11,6 +15,7 @@ #ifdef SODIUM_STATIC # define SODIUM_EXPORT +# define SODIUM_EXPORT_WEAK #else # if defined(_MSC_VER) # ifdef SODIUM_DLL_EXPORT @@ -31,6 +36,11 @@ # define SODIUM_EXPORT __attribute__ ((visibility ("default"))) # endif # endif +# if defined(__ELF__) && !defined(SODIUM_DISABLE_WEAK_FUNCTIONS) +# define SODIUM_EXPORT_WEAK SODIUM_EXPORT __attribute__((weak)) +# else +# define SODIUM_EXPORT_WEAK SODIUM_EXPORT +# endif #endif #ifndef CRYPTO_ALIGN @@ -41,4 +51,7 @@ # endif #endif +#define SODIUM_MIN(A, B) ((A) < (B) ? (A) : (B)) +#define SODIUM_SIZE_MAX SODIUM_MIN(UINT64_MAX, SIZE_MAX) + #endif diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/chacha20_ietf_ext.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/chacha20_ietf_ext.h new file mode 100644 index 00000000000..2c80b96aa72 --- /dev/null +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/chacha20_ietf_ext.h @@ -0,0 +1,16 @@ +#ifndef chacha20_ietf_ext_H +#define chacha20_ietf_ext_H + +#include + +/* The ietf_ext variant allows the internal counter to overflow into the IV */ + +int crypto_stream_chacha20_ietf_ext(unsigned char *c, unsigned long long clen, + const unsigned char *n, const unsigned char *k); + +int crypto_stream_chacha20_ietf_ext_xor_ic(unsigned char *c, const unsigned char *m, + unsigned long long mlen, + const unsigned char *n, uint32_t ic, + const unsigned char *k); +#endif + diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/common.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/common.h index 5e27e5749f9..339e725ba47 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/common.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/common.h @@ -1,12 +1,35 @@ #ifndef common_H #define common_H 1 +#if !defined(_MSC_VER) && !defined(DEV_MODE) && 0 +# warning *** This is unstable, untested, development code. +# warning It might not compile. It might not work as expected. +# warning It might be totally insecure. +# warning Do not use this except if you are planning to contribute code. +# warning Use releases available at https://download.libsodium.org/libsodium/releases/ instead. +# warning Alternatively, use the "stable" branch in the git repository. +#endif + +#if !defined(_MSC_VER) && (!defined(CONFIGURED) || CONFIGURED != 1) +# warning *** The library is being compiled using an undocumented method. +# warning This is not supported. It has not been tested, it might not +# warning work as expected, and performance is likely to be suboptimal. +#endif + #include #include #include #define COMPILER_ASSERT(X) (void) sizeof(char[(X) ? 1 : -1]) +#ifdef HAVE_TI_MODE +# if defined(__SIZEOF_INT128__) +typedef unsigned __int128 uint128_t; +# else +typedef unsigned uint128_t __attribute__((mode(TI))); +# endif +#endif + #define ROTL32(X, B) rotl32((X), (B)) static inline uint32_t rotl32(const uint32_t x, const int b) @@ -177,7 +200,18 @@ store32_be(uint8_t dst[4], uint32_t w) #endif } -#ifndef __GNUC__ +#define XOR_BUF(OUT, IN, N) xor_buf((OUT), (IN), (N)) +static inline void +xor_buf(unsigned char *out, const unsigned char *in, size_t n) +{ + size_t i; + + for (i = 0; i < n; i++) { + out[i] ^= in[i]; + } +} + +#if !defined(__clang__) && !defined(__GNUC__) # ifdef __attribute__ # undef __attribute__ # endif @@ -214,4 +248,14 @@ store32_be(uint8_t dst[4], uint32_t w) # include #endif +#ifdef HAVE_LIBCTGRIND +extern void ct_poison (const void *, size_t); +extern void ct_unpoison(const void *, size_t); +# define POISON(X, L) ct_poison((X), (L)) +# define UNPOISON(X, L) ct_unpoison((X), (L)) +#else +# define POISON(X, L) (void) 0 +# define UNPOISON(X, L) (void) 0 +#endif + #endif diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/curve25519_ref10.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/curve25519_ref10.h deleted file mode 100644 index 2b9caeb1f0d..00000000000 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/curve25519_ref10.h +++ /dev/null @@ -1,160 +0,0 @@ -#ifndef curve25519_ref10_H -#define curve25519_ref10_H - -#include -#include - -#define fe crypto_core_curve25519_ref10_fe -typedef int32_t fe[10]; - -/* - fe means field element. - Here the field is \Z/(2^255-19). - An element t, entries t[0]...t[9], represents the integer - t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9]. - Bounds on each t[i] vary depending on context. - */ - -#define fe_frombytes crypto_core_curve25519_ref10_fe_frombytes -#define fe_tobytes crypto_core_curve25519_ref10_fe_tobytes -#define fe_copy crypto_core_curve25519_ref10_fe_copy -#define fe_isnonzero crypto_core_curve25519_ref10_fe_isnonzero -#define fe_isnegative crypto_core_curve25519_ref10_fe_isnegative -#define fe_0 crypto_core_curve25519_ref10_fe_0 -#define fe_1 crypto_core_curve25519_ref10_fe_1 -#define fe_cmov crypto_core_curve25519_ref10_fe_cmov -#define fe_add crypto_core_curve25519_ref10_fe_add -#define fe_sub crypto_core_curve25519_ref10_fe_sub -#define fe_neg crypto_core_curve25519_ref10_fe_neg -#define fe_mul crypto_core_curve25519_ref10_fe_mul -#define fe_sq crypto_core_curve25519_ref10_fe_sq -#define fe_sq2 crypto_core_curve25519_ref10_fe_sq2 -#define fe_invert crypto_core_curve25519_ref10_fe_invert -#define fe_pow22523 crypto_core_curve25519_ref10_fe_pow22523 - -extern void fe_frombytes(fe,const unsigned char *); -extern void fe_tobytes(unsigned char *,const fe); - -extern void fe_copy(fe,const fe); -extern int fe_isnonzero(const fe); -extern int fe_isnegative(const fe); -extern void fe_0(fe); -extern void fe_1(fe); -extern void fe_cmov(fe,const fe,unsigned int); -extern void fe_add(fe,const fe,const fe); -extern void fe_sub(fe,const fe,const fe); -extern void fe_neg(fe,const fe); -extern void fe_mul(fe,const fe,const fe); -extern void fe_sq(fe,const fe); -extern void fe_sq2(fe,const fe); -extern void fe_invert(fe,const fe); -extern void fe_pow22523(fe,const fe); - -/* - ge means group element. - * - Here the group is the set of pairs (x,y) of field elements (see fe.h) - satisfying -x^2 + y^2 = 1 + d x^2y^2 - where d = -121665/121666. - * - Representations: - ge_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z - ge_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT - ge_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T - ge_precomp (Duif): (y+x,y-x,2dxy) - */ - -#define ge_p2 crypto_core_curve25519_ref10_ge_p2 -typedef struct { - fe X; - fe Y; - fe Z; -} ge_p2; - -#define ge_p3 crypto_core_curve25519_ref10_ge_p3 -typedef struct { - fe X; - fe Y; - fe Z; - fe T; -} ge_p3; - -#define ge_p1p1 crypto_core_curve25519_ref10_ge_p1p1 -typedef struct { - fe X; - fe Y; - fe Z; - fe T; -} ge_p1p1; - -#define ge_precomp crypto_core_curve25519_ref10_ge_precomp -typedef struct { - fe yplusx; - fe yminusx; - fe xy2d; -} ge_precomp; - -#define ge_cached crypto_core_curve25519_ref10_ge_cached -typedef struct { - fe YplusX; - fe YminusX; - fe Z; - fe T2d; -} ge_cached; - -#define ge_frombytes_negate_vartime crypto_core_curve25519_ref10_ge_frombytes_negate_vartime -#define ge_tobytes crypto_core_curve25519_ref10_ge_tobytes -#define ge_p3_tobytes crypto_core_curve25519_ref10_ge_p3_tobytes - -#define ge_p2_0 crypto_core_curve25519_ref10_ge_p2_0 -#define ge_p3_0 crypto_core_curve25519_ref10_ge_p3_0 -#define ge_precomp_0 crypto_core_curve25519_ref10_ge_precomp_0 -#define ge_p3_to_p2 crypto_core_curve25519_ref10_ge_p3_to_p2 -#define ge_p3_to_cached crypto_core_curve25519_ref10_ge_p3_to_cached -#define ge_p1p1_to_p2 crypto_core_curve25519_ref10_ge_p1p1_to_p2 -#define ge_p1p1_to_p3 crypto_core_curve25519_ref10_ge_p1p1_to_p3 -#define ge_p2_dbl crypto_core_curve25519_ref10_ge_p2_dbl -#define ge_p3_dbl crypto_core_curve25519_ref10_ge_p3_dbl - -#define ge_madd crypto_core_curve25519_ref10_ge_madd -#define ge_msub crypto_core_curve25519_ref10_ge_msub -#define ge_add crypto_core_curve25519_ref10_ge_add -#define ge_sub crypto_core_curve25519_ref10_ge_sub -#define ge_scalarmult_base crypto_core_curve25519_ref10_ge_scalarmult_base -#define ge_double_scalarmult_vartime crypto_core_curve25519_ref10_ge_double_scalarmult_vartime -#define ge_scalarmult_vartime crypto_core_curve25519_ref10_ge_scalarmult_vartime - -extern void ge_tobytes(unsigned char *,const ge_p2 *); -extern void ge_p3_tobytes(unsigned char *,const ge_p3 *); -extern int ge_frombytes_negate_vartime(ge_p3 *,const unsigned char *); - -extern void ge_p2_0(ge_p2 *); -extern void ge_p3_0(ge_p3 *); -extern void ge_precomp_0(ge_precomp *); -extern void ge_p3_to_p2(ge_p2 *,const ge_p3 *); -extern void ge_p3_to_cached(ge_cached *,const ge_p3 *); -extern void ge_p1p1_to_p2(ge_p2 *,const ge_p1p1 *); -extern void ge_p1p1_to_p3(ge_p3 *,const ge_p1p1 *); -extern void ge_p2_dbl(ge_p1p1 *,const ge_p2 *); -extern void ge_p3_dbl(ge_p1p1 *,const ge_p3 *); - -extern void ge_madd(ge_p1p1 *,const ge_p3 *,const ge_precomp *); -extern void ge_msub(ge_p1p1 *,const ge_p3 *,const ge_precomp *); -extern void ge_add(ge_p1p1 *,const ge_p3 *,const ge_cached *); -extern void ge_sub(ge_p1p1 *,const ge_p3 *,const ge_cached *); -extern void ge_scalarmult_base(ge_p3 *,const unsigned char *); -extern void ge_double_scalarmult_vartime(ge_p2 *,const unsigned char *,const ge_p3 *,const unsigned char *); -extern void ge_scalarmult_vartime(ge_p3 *,const unsigned char *,const ge_p3 *); - -/* - The set of scalars is \Z/l - where l = 2^252 + 27742317777372353535851937790883648493. - */ - -#define sc_reduce crypto_core_curve25519_ref10_sc_reduce -#define sc_muladd crypto_core_curve25519_ref10_sc_muladd - -extern void sc_reduce(unsigned char *); -extern void sc_muladd(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *); - -#endif diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10.h new file mode 100644 index 00000000000..3f4c45caf0e --- /dev/null +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10.h @@ -0,0 +1,142 @@ +#ifndef ed25519_ref10_H +#define ed25519_ref10_H + +#include +#include + +/* + fe means field element. + Here the field is \Z/(2^255-19). + */ + +#ifdef HAVE_TI_MODE +typedef uint64_t fe25519[5]; +#else +typedef int32_t fe25519[10]; +#endif + +void fe25519_invert(fe25519 out, const fe25519 z); +void fe25519_frombytes(fe25519 h, const unsigned char *s); +void fe25519_tobytes(unsigned char *s, const fe25519 h); + +#ifdef HAVE_TI_MODE +# include "ed25519_ref10_fe_51.h" +#else +# include "ed25519_ref10_fe_25_5.h" +#endif + + +/* + ge means group element. + + Here the group is the set of pairs (x,y) of field elements + satisfying -x^2 + y^2 = 1 + d x^2y^2 + where d = -121665/121666. + + Representations: + ge25519_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z + ge25519_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT + ge25519_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T + ge25519_precomp (Duif): (y+x,y-x,2dxy) + */ + +typedef struct { + fe25519 X; + fe25519 Y; + fe25519 Z; +} ge25519_p2; + +typedef struct { + fe25519 X; + fe25519 Y; + fe25519 Z; + fe25519 T; +} ge25519_p3; + +typedef struct { + fe25519 X; + fe25519 Y; + fe25519 Z; + fe25519 T; +} ge25519_p1p1; + +typedef struct { + fe25519 yplusx; + fe25519 yminusx; + fe25519 xy2d; +} ge25519_precomp; + +typedef struct { + fe25519 YplusX; + fe25519 YminusX; + fe25519 Z; + fe25519 T2d; +} ge25519_cached; + +void ge25519_tobytes(unsigned char *s, const ge25519_p2 *h); + +void ge25519_p3_tobytes(unsigned char *s, const ge25519_p3 *h); + +int ge25519_frombytes(ge25519_p3 *h, const unsigned char *s); + +int ge25519_frombytes_negate_vartime(ge25519_p3 *h, const unsigned char *s); + +void ge25519_p3_to_cached(ge25519_cached *r, const ge25519_p3 *p); + +void ge25519_p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p); + +void ge25519_p1p1_to_p3(ge25519_p3 *r, const ge25519_p1p1 *p); + +void ge25519_add(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_cached *q); + +void ge25519_sub(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_cached *q); + +void ge25519_scalarmult_base(ge25519_p3 *h, const unsigned char *a); + +void ge25519_double_scalarmult_vartime(ge25519_p2 *r, const unsigned char *a, + const ge25519_p3 *A, + const unsigned char *b); + +void ge25519_scalarmult(ge25519_p3 *h, const unsigned char *a, + const ge25519_p3 *p); + +int ge25519_is_canonical(const unsigned char *s); + +int ge25519_is_on_curve(const ge25519_p3 *p); + +int ge25519_is_on_main_subgroup(const ge25519_p3 *p); + +int ge25519_has_small_order(const unsigned char s[32]); + +void ge25519_from_uniform(unsigned char s[32], const unsigned char r[32]); + +void ge25519_from_hash(unsigned char s[32], const unsigned char h[64]); + +/* + Ristretto group + */ + +int ristretto255_frombytes(ge25519_p3 *h, const unsigned char *s); + +void ristretto255_p3_tobytes(unsigned char *s, const ge25519_p3 *h); + +void ristretto255_from_hash(unsigned char s[32], const unsigned char h[64]); + +/* + The set of scalars is \Z/l + where l = 2^252 + 27742317777372353535851937790883648493. + */ + +void sc25519_invert(unsigned char recip[32], const unsigned char s[32]); + +void sc25519_reduce(unsigned char s[64]); + +void sc25519_mul(unsigned char s[32], const unsigned char a[32], + const unsigned char b[32]); + +void sc25519_muladd(unsigned char s[32], const unsigned char a[32], + const unsigned char b[32], const unsigned char c[32]); + +int sc25519_is_canonical(const unsigned char s[32]); + +#endif diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_25_5.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_25_5.h new file mode 100644 index 00000000000..5a0b6148b7b --- /dev/null +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_25_5.h @@ -0,0 +1,1050 @@ +#include + +#include "private/common.h" +#include "utils.h" + +/* + h = 0 + */ + +static inline void +fe25519_0(fe25519 h) +{ + memset(&h[0], 0, 10 * sizeof h[0]); +} + +/* + h = 1 + */ + +static inline void +fe25519_1(fe25519 h) +{ + h[0] = 1; + h[1] = 0; + memset(&h[2], 0, 8 * sizeof h[0]); +} + +/* + h = f + g + Can overlap h with f or g. + * + Preconditions: + |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. + |g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. + * + Postconditions: + |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. + */ + +static inline void +fe25519_add(fe25519 h, const fe25519 f, const fe25519 g) +{ + int32_t h0 = f[0] + g[0]; + int32_t h1 = f[1] + g[1]; + int32_t h2 = f[2] + g[2]; + int32_t h3 = f[3] + g[3]; + int32_t h4 = f[4] + g[4]; + int32_t h5 = f[5] + g[5]; + int32_t h6 = f[6] + g[6]; + int32_t h7 = f[7] + g[7]; + int32_t h8 = f[8] + g[8]; + int32_t h9 = f[9] + g[9]; + + h[0] = h0; + h[1] = h1; + h[2] = h2; + h[3] = h3; + h[4] = h4; + h[5] = h5; + h[6] = h6; + h[7] = h7; + h[8] = h8; + h[9] = h9; +} + +/* + h = f - g + Can overlap h with f or g. + * + Preconditions: + |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. + |g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. + * + Postconditions: + |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. + */ + +static void +fe25519_sub(fe25519 h, const fe25519 f, const fe25519 g) +{ + int32_t h0 = f[0] - g[0]; + int32_t h1 = f[1] - g[1]; + int32_t h2 = f[2] - g[2]; + int32_t h3 = f[3] - g[3]; + int32_t h4 = f[4] - g[4]; + int32_t h5 = f[5] - g[5]; + int32_t h6 = f[6] - g[6]; + int32_t h7 = f[7] - g[7]; + int32_t h8 = f[8] - g[8]; + int32_t h9 = f[9] - g[9]; + + h[0] = h0; + h[1] = h1; + h[2] = h2; + h[3] = h3; + h[4] = h4; + h[5] = h5; + h[6] = h6; + h[7] = h7; + h[8] = h8; + h[9] = h9; +} + +/* + h = -f + * + Preconditions: + |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. + * + Postconditions: + |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. + */ + +static inline void +fe25519_neg(fe25519 h, const fe25519 f) +{ + int32_t h0 = -f[0]; + int32_t h1 = -f[1]; + int32_t h2 = -f[2]; + int32_t h3 = -f[3]; + int32_t h4 = -f[4]; + int32_t h5 = -f[5]; + int32_t h6 = -f[6]; + int32_t h7 = -f[7]; + int32_t h8 = -f[8]; + int32_t h9 = -f[9]; + + h[0] = h0; + h[1] = h1; + h[2] = h2; + h[3] = h3; + h[4] = h4; + h[5] = h5; + h[6] = h6; + h[7] = h7; + h[8] = h8; + h[9] = h9; +} + +/* + Replace (f,g) with (g,g) if b == 1; + replace (f,g) with (f,g) if b == 0. + * + Preconditions: b in {0,1}. + */ + +static void +fe25519_cmov(fe25519 f, const fe25519 g, unsigned int b) +{ + const uint32_t mask = (uint32_t) (-(int32_t) b); + + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + + int32_t x0 = f0 ^ g[0]; + int32_t x1 = f1 ^ g[1]; + int32_t x2 = f2 ^ g[2]; + int32_t x3 = f3 ^ g[3]; + int32_t x4 = f4 ^ g[4]; + int32_t x5 = f5 ^ g[5]; + int32_t x6 = f6 ^ g[6]; + int32_t x7 = f7 ^ g[7]; + int32_t x8 = f8 ^ g[8]; + int32_t x9 = f9 ^ g[9]; + + x0 &= mask; + x1 &= mask; + x2 &= mask; + x3 &= mask; + x4 &= mask; + x5 &= mask; + x6 &= mask; + x7 &= mask; + x8 &= mask; + x9 &= mask; + + f[0] = f0 ^ x0; + f[1] = f1 ^ x1; + f[2] = f2 ^ x2; + f[3] = f3 ^ x3; + f[4] = f4 ^ x4; + f[5] = f5 ^ x5; + f[6] = f6 ^ x6; + f[7] = f7 ^ x7; + f[8] = f8 ^ x8; + f[9] = f9 ^ x9; +} + +static void +fe25519_cswap(fe25519 f, fe25519 g, unsigned int b) +{ + const uint32_t mask = (uint32_t) (-(int64_t) b); + + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + + int32_t g0 = g[0]; + int32_t g1 = g[1]; + int32_t g2 = g[2]; + int32_t g3 = g[3]; + int32_t g4 = g[4]; + int32_t g5 = g[5]; + int32_t g6 = g[6]; + int32_t g7 = g[7]; + int32_t g8 = g[8]; + int32_t g9 = g[9]; + + int32_t x0 = f0 ^ g0; + int32_t x1 = f1 ^ g1; + int32_t x2 = f2 ^ g2; + int32_t x3 = f3 ^ g3; + int32_t x4 = f4 ^ g4; + int32_t x5 = f5 ^ g5; + int32_t x6 = f6 ^ g6; + int32_t x7 = f7 ^ g7; + int32_t x8 = f8 ^ g8; + int32_t x9 = f9 ^ g9; + + x0 &= mask; + x1 &= mask; + x2 &= mask; + x3 &= mask; + x4 &= mask; + x5 &= mask; + x6 &= mask; + x7 &= mask; + x8 &= mask; + x9 &= mask; + + f[0] = f0 ^ x0; + f[1] = f1 ^ x1; + f[2] = f2 ^ x2; + f[3] = f3 ^ x3; + f[4] = f4 ^ x4; + f[5] = f5 ^ x5; + f[6] = f6 ^ x6; + f[7] = f7 ^ x7; + f[8] = f8 ^ x8; + f[9] = f9 ^ x9; + + g[0] = g0 ^ x0; + g[1] = g1 ^ x1; + g[2] = g2 ^ x2; + g[3] = g3 ^ x3; + g[4] = g4 ^ x4; + g[5] = g5 ^ x5; + g[6] = g6 ^ x6; + g[7] = g7 ^ x7; + g[8] = g8 ^ x8; + g[9] = g9 ^ x9; +} + +/* + h = f + */ + +static inline void +fe25519_copy(fe25519 h, const fe25519 f) +{ + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + + h[0] = f0; + h[1] = f1; + h[2] = f2; + h[3] = f3; + h[4] = f4; + h[5] = f5; + h[6] = f6; + h[7] = f7; + h[8] = f8; + h[9] = f9; +} + +/* + return 1 if f is in {1,3,5,...,q-2} + return 0 if f is in {0,2,4,...,q-1} + + Preconditions: + |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. + */ + +static inline int +fe25519_isnegative(const fe25519 f) +{ + unsigned char s[32]; + + fe25519_tobytes(s, f); + + return s[0] & 1; +} + +/* + return 1 if f == 0 + return 0 if f != 0 + + Preconditions: + |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. + */ + +static inline int +fe25519_iszero(const fe25519 f) +{ + unsigned char s[32]; + + fe25519_tobytes(s, f); + + return sodium_is_zero(s, 32); +} + +/* + h = f * g + Can overlap h with f or g. + * + Preconditions: + |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc. + |g| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc. + * + Postconditions: + |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc. + */ + +/* + Notes on implementation strategy: + * + Using schoolbook multiplication. + Karatsuba would save a little in some cost models. + * + Most multiplications by 2 and 19 are 32-bit precomputations; + cheaper than 64-bit postcomputations. + * + There is one remaining multiplication by 19 in the carry chain; + one *19 precomputation can be merged into this, + but the resulting data flow is considerably less clean. + * + There are 12 carries below. + 10 of them are 2-way parallelizable and vectorizable. + Can get away with 11 carries, but then data flow is much deeper. + * + With tighter constraints on inputs can squeeze carries into int32. + */ + +static void +fe25519_mul(fe25519 h, const fe25519 f, const fe25519 g) +{ + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + + int32_t g0 = g[0]; + int32_t g1 = g[1]; + int32_t g2 = g[2]; + int32_t g3 = g[3]; + int32_t g4 = g[4]; + int32_t g5 = g[5]; + int32_t g6 = g[6]; + int32_t g7 = g[7]; + int32_t g8 = g[8]; + int32_t g9 = g[9]; + + int32_t g1_19 = 19 * g1; /* 1.959375*2^29 */ + int32_t g2_19 = 19 * g2; /* 1.959375*2^30; still ok */ + int32_t g3_19 = 19 * g3; + int32_t g4_19 = 19 * g4; + int32_t g5_19 = 19 * g5; + int32_t g6_19 = 19 * g6; + int32_t g7_19 = 19 * g7; + int32_t g8_19 = 19 * g8; + int32_t g9_19 = 19 * g9; + int32_t f1_2 = 2 * f1; + int32_t f3_2 = 2 * f3; + int32_t f5_2 = 2 * f5; + int32_t f7_2 = 2 * f7; + int32_t f9_2 = 2 * f9; + + int64_t f0g0 = f0 * (int64_t) g0; + int64_t f0g1 = f0 * (int64_t) g1; + int64_t f0g2 = f0 * (int64_t) g2; + int64_t f0g3 = f0 * (int64_t) g3; + int64_t f0g4 = f0 * (int64_t) g4; + int64_t f0g5 = f0 * (int64_t) g5; + int64_t f0g6 = f0 * (int64_t) g6; + int64_t f0g7 = f0 * (int64_t) g7; + int64_t f0g8 = f0 * (int64_t) g8; + int64_t f0g9 = f0 * (int64_t) g9; + int64_t f1g0 = f1 * (int64_t) g0; + int64_t f1g1_2 = f1_2 * (int64_t) g1; + int64_t f1g2 = f1 * (int64_t) g2; + int64_t f1g3_2 = f1_2 * (int64_t) g3; + int64_t f1g4 = f1 * (int64_t) g4; + int64_t f1g5_2 = f1_2 * (int64_t) g5; + int64_t f1g6 = f1 * (int64_t) g6; + int64_t f1g7_2 = f1_2 * (int64_t) g7; + int64_t f1g8 = f1 * (int64_t) g8; + int64_t f1g9_38 = f1_2 * (int64_t) g9_19; + int64_t f2g0 = f2 * (int64_t) g0; + int64_t f2g1 = f2 * (int64_t) g1; + int64_t f2g2 = f2 * (int64_t) g2; + int64_t f2g3 = f2 * (int64_t) g3; + int64_t f2g4 = f2 * (int64_t) g4; + int64_t f2g5 = f2 * (int64_t) g5; + int64_t f2g6 = f2 * (int64_t) g6; + int64_t f2g7 = f2 * (int64_t) g7; + int64_t f2g8_19 = f2 * (int64_t) g8_19; + int64_t f2g9_19 = f2 * (int64_t) g9_19; + int64_t f3g0 = f3 * (int64_t) g0; + int64_t f3g1_2 = f3_2 * (int64_t) g1; + int64_t f3g2 = f3 * (int64_t) g2; + int64_t f3g3_2 = f3_2 * (int64_t) g3; + int64_t f3g4 = f3 * (int64_t) g4; + int64_t f3g5_2 = f3_2 * (int64_t) g5; + int64_t f3g6 = f3 * (int64_t) g6; + int64_t f3g7_38 = f3_2 * (int64_t) g7_19; + int64_t f3g8_19 = f3 * (int64_t) g8_19; + int64_t f3g9_38 = f3_2 * (int64_t) g9_19; + int64_t f4g0 = f4 * (int64_t) g0; + int64_t f4g1 = f4 * (int64_t) g1; + int64_t f4g2 = f4 * (int64_t) g2; + int64_t f4g3 = f4 * (int64_t) g3; + int64_t f4g4 = f4 * (int64_t) g4; + int64_t f4g5 = f4 * (int64_t) g5; + int64_t f4g6_19 = f4 * (int64_t) g6_19; + int64_t f4g7_19 = f4 * (int64_t) g7_19; + int64_t f4g8_19 = f4 * (int64_t) g8_19; + int64_t f4g9_19 = f4 * (int64_t) g9_19; + int64_t f5g0 = f5 * (int64_t) g0; + int64_t f5g1_2 = f5_2 * (int64_t) g1; + int64_t f5g2 = f5 * (int64_t) g2; + int64_t f5g3_2 = f5_2 * (int64_t) g3; + int64_t f5g4 = f5 * (int64_t) g4; + int64_t f5g5_38 = f5_2 * (int64_t) g5_19; + int64_t f5g6_19 = f5 * (int64_t) g6_19; + int64_t f5g7_38 = f5_2 * (int64_t) g7_19; + int64_t f5g8_19 = f5 * (int64_t) g8_19; + int64_t f5g9_38 = f5_2 * (int64_t) g9_19; + int64_t f6g0 = f6 * (int64_t) g0; + int64_t f6g1 = f6 * (int64_t) g1; + int64_t f6g2 = f6 * (int64_t) g2; + int64_t f6g3 = f6 * (int64_t) g3; + int64_t f6g4_19 = f6 * (int64_t) g4_19; + int64_t f6g5_19 = f6 * (int64_t) g5_19; + int64_t f6g6_19 = f6 * (int64_t) g6_19; + int64_t f6g7_19 = f6 * (int64_t) g7_19; + int64_t f6g8_19 = f6 * (int64_t) g8_19; + int64_t f6g9_19 = f6 * (int64_t) g9_19; + int64_t f7g0 = f7 * (int64_t) g0; + int64_t f7g1_2 = f7_2 * (int64_t) g1; + int64_t f7g2 = f7 * (int64_t) g2; + int64_t f7g3_38 = f7_2 * (int64_t) g3_19; + int64_t f7g4_19 = f7 * (int64_t) g4_19; + int64_t f7g5_38 = f7_2 * (int64_t) g5_19; + int64_t f7g6_19 = f7 * (int64_t) g6_19; + int64_t f7g7_38 = f7_2 * (int64_t) g7_19; + int64_t f7g8_19 = f7 * (int64_t) g8_19; + int64_t f7g9_38 = f7_2 * (int64_t) g9_19; + int64_t f8g0 = f8 * (int64_t) g0; + int64_t f8g1 = f8 * (int64_t) g1; + int64_t f8g2_19 = f8 * (int64_t) g2_19; + int64_t f8g3_19 = f8 * (int64_t) g3_19; + int64_t f8g4_19 = f8 * (int64_t) g4_19; + int64_t f8g5_19 = f8 * (int64_t) g5_19; + int64_t f8g6_19 = f8 * (int64_t) g6_19; + int64_t f8g7_19 = f8 * (int64_t) g7_19; + int64_t f8g8_19 = f8 * (int64_t) g8_19; + int64_t f8g9_19 = f8 * (int64_t) g9_19; + int64_t f9g0 = f9 * (int64_t) g0; + int64_t f9g1_38 = f9_2 * (int64_t) g1_19; + int64_t f9g2_19 = f9 * (int64_t) g2_19; + int64_t f9g3_38 = f9_2 * (int64_t) g3_19; + int64_t f9g4_19 = f9 * (int64_t) g4_19; + int64_t f9g5_38 = f9_2 * (int64_t) g5_19; + int64_t f9g6_19 = f9 * (int64_t) g6_19; + int64_t f9g7_38 = f9_2 * (int64_t) g7_19; + int64_t f9g8_19 = f9 * (int64_t) g8_19; + int64_t f9g9_38 = f9_2 * (int64_t) g9_19; + + int64_t h0 = f0g0 + f1g9_38 + f2g8_19 + f3g7_38 + f4g6_19 + f5g5_38 + + f6g4_19 + f7g3_38 + f8g2_19 + f9g1_38; + int64_t h1 = f0g1 + f1g0 + f2g9_19 + f3g8_19 + f4g7_19 + f5g6_19 + f6g5_19 + + f7g4_19 + f8g3_19 + f9g2_19; + int64_t h2 = f0g2 + f1g1_2 + f2g0 + f3g9_38 + f4g8_19 + f5g7_38 + f6g6_19 + + f7g5_38 + f8g4_19 + f9g3_38; + int64_t h3 = f0g3 + f1g2 + f2g1 + f3g0 + f4g9_19 + f5g8_19 + f6g7_19 + + f7g6_19 + f8g5_19 + f9g4_19; + int64_t h4 = f0g4 + f1g3_2 + f2g2 + f3g1_2 + f4g0 + f5g9_38 + f6g8_19 + + f7g7_38 + f8g6_19 + f9g5_38; + int64_t h5 = f0g5 + f1g4 + f2g3 + f3g2 + f4g1 + f5g0 + f6g9_19 + f7g8_19 + + f8g7_19 + f9g6_19; + int64_t h6 = f0g6 + f1g5_2 + f2g4 + f3g3_2 + f4g2 + f5g1_2 + f6g0 + + f7g9_38 + f8g8_19 + f9g7_38; + int64_t h7 = f0g7 + f1g6 + f2g5 + f3g4 + f4g3 + f5g2 + f6g1 + f7g0 + + f8g9_19 + f9g8_19; + int64_t h8 = f0g8 + f1g7_2 + f2g6 + f3g5_2 + f4g4 + f5g3_2 + f6g2 + f7g1_2 + + f8g0 + f9g9_38; + int64_t h9 = + f0g9 + f1g8 + f2g7 + f3g6 + f4g5 + f5g4 + f6g3 + f7g2 + f8g1 + f9g0; + + int64_t carry0; + int64_t carry1; + int64_t carry2; + int64_t carry3; + int64_t carry4; + int64_t carry5; + int64_t carry6; + int64_t carry7; + int64_t carry8; + int64_t carry9; + + /* + |h0| <= (1.65*1.65*2^52*(1+19+19+19+19)+1.65*1.65*2^50*(38+38+38+38+38)) + i.e. |h0| <= 1.4*2^60; narrower ranges for h2, h4, h6, h8 + |h1| <= (1.65*1.65*2^51*(1+1+19+19+19+19+19+19+19+19)) + i.e. |h1| <= 1.7*2^59; narrower ranges for h3, h5, h7, h9 + */ + + carry0 = (h0 + (int64_t)(1L << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((uint64_t) 1L << 26); + carry4 = (h4 + (int64_t)(1L << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((uint64_t) 1L << 26); + /* |h0| <= 2^25 */ + /* |h4| <= 2^25 */ + /* |h1| <= 1.71*2^59 */ + /* |h5| <= 1.71*2^59 */ + + carry1 = (h1 + (int64_t)(1L << 24)) >> 25; + h2 += carry1; + h1 -= carry1 * ((uint64_t) 1L << 25); + carry5 = (h5 + (int64_t)(1L << 24)) >> 25; + h6 += carry5; + h5 -= carry5 * ((uint64_t) 1L << 25); + /* |h1| <= 2^24; from now on fits into int32 */ + /* |h5| <= 2^24; from now on fits into int32 */ + /* |h2| <= 1.41*2^60 */ + /* |h6| <= 1.41*2^60 */ + + carry2 = (h2 + (int64_t)(1L << 25)) >> 26; + h3 += carry2; + h2 -= carry2 * ((uint64_t) 1L << 26); + carry6 = (h6 + (int64_t)(1L << 25)) >> 26; + h7 += carry6; + h6 -= carry6 * ((uint64_t) 1L << 26); + /* |h2| <= 2^25; from now on fits into int32 unchanged */ + /* |h6| <= 2^25; from now on fits into int32 unchanged */ + /* |h3| <= 1.71*2^59 */ + /* |h7| <= 1.71*2^59 */ + + carry3 = (h3 + (int64_t)(1L << 24)) >> 25; + h4 += carry3; + h3 -= carry3 * ((uint64_t) 1L << 25); + carry7 = (h7 + (int64_t)(1L << 24)) >> 25; + h8 += carry7; + h7 -= carry7 * ((uint64_t) 1L << 25); + /* |h3| <= 2^24; from now on fits into int32 unchanged */ + /* |h7| <= 2^24; from now on fits into int32 unchanged */ + /* |h4| <= 1.72*2^34 */ + /* |h8| <= 1.41*2^60 */ + + carry4 = (h4 + (int64_t)(1L << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((uint64_t) 1L << 26); + carry8 = (h8 + (int64_t)(1L << 25)) >> 26; + h9 += carry8; + h8 -= carry8 * ((uint64_t) 1L << 26); + /* |h4| <= 2^25; from now on fits into int32 unchanged */ + /* |h8| <= 2^25; from now on fits into int32 unchanged */ + /* |h5| <= 1.01*2^24 */ + /* |h9| <= 1.71*2^59 */ + + carry9 = (h9 + (int64_t)(1L << 24)) >> 25; + h0 += carry9 * 19; + h9 -= carry9 * ((uint64_t) 1L << 25); + /* |h9| <= 2^24; from now on fits into int32 unchanged */ + /* |h0| <= 1.1*2^39 */ + + carry0 = (h0 + (int64_t)(1L << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((uint64_t) 1L << 26); + /* |h0| <= 2^25; from now on fits into int32 unchanged */ + /* |h1| <= 1.01*2^24 */ + + h[0] = (int32_t) h0; + h[1] = (int32_t) h1; + h[2] = (int32_t) h2; + h[3] = (int32_t) h3; + h[4] = (int32_t) h4; + h[5] = (int32_t) h5; + h[6] = (int32_t) h6; + h[7] = (int32_t) h7; + h[8] = (int32_t) h8; + h[9] = (int32_t) h9; +} + +/* + h = f * f + Can overlap h with f. + * + Preconditions: + |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc. + * + Postconditions: + |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc. + */ + +static void +fe25519_sq(fe25519 h, const fe25519 f) +{ + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + + int32_t f0_2 = 2 * f0; + int32_t f1_2 = 2 * f1; + int32_t f2_2 = 2 * f2; + int32_t f3_2 = 2 * f3; + int32_t f4_2 = 2 * f4; + int32_t f5_2 = 2 * f5; + int32_t f6_2 = 2 * f6; + int32_t f7_2 = 2 * f7; + int32_t f5_38 = 38 * f5; /* 1.959375*2^30 */ + int32_t f6_19 = 19 * f6; /* 1.959375*2^30 */ + int32_t f7_38 = 38 * f7; /* 1.959375*2^30 */ + int32_t f8_19 = 19 * f8; /* 1.959375*2^30 */ + int32_t f9_38 = 38 * f9; /* 1.959375*2^30 */ + + int64_t f0f0 = f0 * (int64_t) f0; + int64_t f0f1_2 = f0_2 * (int64_t) f1; + int64_t f0f2_2 = f0_2 * (int64_t) f2; + int64_t f0f3_2 = f0_2 * (int64_t) f3; + int64_t f0f4_2 = f0_2 * (int64_t) f4; + int64_t f0f5_2 = f0_2 * (int64_t) f5; + int64_t f0f6_2 = f0_2 * (int64_t) f6; + int64_t f0f7_2 = f0_2 * (int64_t) f7; + int64_t f0f8_2 = f0_2 * (int64_t) f8; + int64_t f0f9_2 = f0_2 * (int64_t) f9; + int64_t f1f1_2 = f1_2 * (int64_t) f1; + int64_t f1f2_2 = f1_2 * (int64_t) f2; + int64_t f1f3_4 = f1_2 * (int64_t) f3_2; + int64_t f1f4_2 = f1_2 * (int64_t) f4; + int64_t f1f5_4 = f1_2 * (int64_t) f5_2; + int64_t f1f6_2 = f1_2 * (int64_t) f6; + int64_t f1f7_4 = f1_2 * (int64_t) f7_2; + int64_t f1f8_2 = f1_2 * (int64_t) f8; + int64_t f1f9_76 = f1_2 * (int64_t) f9_38; + int64_t f2f2 = f2 * (int64_t) f2; + int64_t f2f3_2 = f2_2 * (int64_t) f3; + int64_t f2f4_2 = f2_2 * (int64_t) f4; + int64_t f2f5_2 = f2_2 * (int64_t) f5; + int64_t f2f6_2 = f2_2 * (int64_t) f6; + int64_t f2f7_2 = f2_2 * (int64_t) f7; + int64_t f2f8_38 = f2_2 * (int64_t) f8_19; + int64_t f2f9_38 = f2 * (int64_t) f9_38; + int64_t f3f3_2 = f3_2 * (int64_t) f3; + int64_t f3f4_2 = f3_2 * (int64_t) f4; + int64_t f3f5_4 = f3_2 * (int64_t) f5_2; + int64_t f3f6_2 = f3_2 * (int64_t) f6; + int64_t f3f7_76 = f3_2 * (int64_t) f7_38; + int64_t f3f8_38 = f3_2 * (int64_t) f8_19; + int64_t f3f9_76 = f3_2 * (int64_t) f9_38; + int64_t f4f4 = f4 * (int64_t) f4; + int64_t f4f5_2 = f4_2 * (int64_t) f5; + int64_t f4f6_38 = f4_2 * (int64_t) f6_19; + int64_t f4f7_38 = f4 * (int64_t) f7_38; + int64_t f4f8_38 = f4_2 * (int64_t) f8_19; + int64_t f4f9_38 = f4 * (int64_t) f9_38; + int64_t f5f5_38 = f5 * (int64_t) f5_38; + int64_t f5f6_38 = f5_2 * (int64_t) f6_19; + int64_t f5f7_76 = f5_2 * (int64_t) f7_38; + int64_t f5f8_38 = f5_2 * (int64_t) f8_19; + int64_t f5f9_76 = f5_2 * (int64_t) f9_38; + int64_t f6f6_19 = f6 * (int64_t) f6_19; + int64_t f6f7_38 = f6 * (int64_t) f7_38; + int64_t f6f8_38 = f6_2 * (int64_t) f8_19; + int64_t f6f9_38 = f6 * (int64_t) f9_38; + int64_t f7f7_38 = f7 * (int64_t) f7_38; + int64_t f7f8_38 = f7_2 * (int64_t) f8_19; + int64_t f7f9_76 = f7_2 * (int64_t) f9_38; + int64_t f8f8_19 = f8 * (int64_t) f8_19; + int64_t f8f9_38 = f8 * (int64_t) f9_38; + int64_t f9f9_38 = f9 * (int64_t) f9_38; + + int64_t h0 = f0f0 + f1f9_76 + f2f8_38 + f3f7_76 + f4f6_38 + f5f5_38; + int64_t h1 = f0f1_2 + f2f9_38 + f3f8_38 + f4f7_38 + f5f6_38; + int64_t h2 = f0f2_2 + f1f1_2 + f3f9_76 + f4f8_38 + f5f7_76 + f6f6_19; + int64_t h3 = f0f3_2 + f1f2_2 + f4f9_38 + f5f8_38 + f6f7_38; + int64_t h4 = f0f4_2 + f1f3_4 + f2f2 + f5f9_76 + f6f8_38 + f7f7_38; + int64_t h5 = f0f5_2 + f1f4_2 + f2f3_2 + f6f9_38 + f7f8_38; + int64_t h6 = f0f6_2 + f1f5_4 + f2f4_2 + f3f3_2 + f7f9_76 + f8f8_19; + int64_t h7 = f0f7_2 + f1f6_2 + f2f5_2 + f3f4_2 + f8f9_38; + int64_t h8 = f0f8_2 + f1f7_4 + f2f6_2 + f3f5_4 + f4f4 + f9f9_38; + int64_t h9 = f0f9_2 + f1f8_2 + f2f7_2 + f3f6_2 + f4f5_2; + + int64_t carry0; + int64_t carry1; + int64_t carry2; + int64_t carry3; + int64_t carry4; + int64_t carry5; + int64_t carry6; + int64_t carry7; + int64_t carry8; + int64_t carry9; + + carry0 = (h0 + (int64_t)(1L << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((uint64_t) 1L << 26); + carry4 = (h4 + (int64_t)(1L << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((uint64_t) 1L << 26); + + carry1 = (h1 + (int64_t)(1L << 24)) >> 25; + h2 += carry1; + h1 -= carry1 * ((uint64_t) 1L << 25); + carry5 = (h5 + (int64_t)(1L << 24)) >> 25; + h6 += carry5; + h5 -= carry5 * ((uint64_t) 1L << 25); + + carry2 = (h2 + (int64_t)(1L << 25)) >> 26; + h3 += carry2; + h2 -= carry2 * ((uint64_t) 1L << 26); + carry6 = (h6 + (int64_t)(1L << 25)) >> 26; + h7 += carry6; + h6 -= carry6 * ((uint64_t) 1L << 26); + + carry3 = (h3 + (int64_t)(1L << 24)) >> 25; + h4 += carry3; + h3 -= carry3 * ((uint64_t) 1L << 25); + carry7 = (h7 + (int64_t)(1L << 24)) >> 25; + h8 += carry7; + h7 -= carry7 * ((uint64_t) 1L << 25); + + carry4 = (h4 + (int64_t)(1L << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((uint64_t) 1L << 26); + carry8 = (h8 + (int64_t)(1L << 25)) >> 26; + h9 += carry8; + h8 -= carry8 * ((uint64_t) 1L << 26); + + carry9 = (h9 + (int64_t)(1L << 24)) >> 25; + h0 += carry9 * 19; + h9 -= carry9 * ((uint64_t) 1L << 25); + + carry0 = (h0 + (int64_t)(1L << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((uint64_t) 1L << 26); + + h[0] = (int32_t) h0; + h[1] = (int32_t) h1; + h[2] = (int32_t) h2; + h[3] = (int32_t) h3; + h[4] = (int32_t) h4; + h[5] = (int32_t) h5; + h[6] = (int32_t) h6; + h[7] = (int32_t) h7; + h[8] = (int32_t) h8; + h[9] = (int32_t) h9; +} + +/* + h = 2 * f * f + Can overlap h with f. + * + Preconditions: + |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc. + * + Postconditions: + |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc. + */ + +static void +fe25519_sq2(fe25519 h, const fe25519 f) +{ + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + + int32_t f0_2 = 2 * f0; + int32_t f1_2 = 2 * f1; + int32_t f2_2 = 2 * f2; + int32_t f3_2 = 2 * f3; + int32_t f4_2 = 2 * f4; + int32_t f5_2 = 2 * f5; + int32_t f6_2 = 2 * f6; + int32_t f7_2 = 2 * f7; + int32_t f5_38 = 38 * f5; /* 1.959375*2^30 */ + int32_t f6_19 = 19 * f6; /* 1.959375*2^30 */ + int32_t f7_38 = 38 * f7; /* 1.959375*2^30 */ + int32_t f8_19 = 19 * f8; /* 1.959375*2^30 */ + int32_t f9_38 = 38 * f9; /* 1.959375*2^30 */ + + int64_t f0f0 = f0 * (int64_t) f0; + int64_t f0f1_2 = f0_2 * (int64_t) f1; + int64_t f0f2_2 = f0_2 * (int64_t) f2; + int64_t f0f3_2 = f0_2 * (int64_t) f3; + int64_t f0f4_2 = f0_2 * (int64_t) f4; + int64_t f0f5_2 = f0_2 * (int64_t) f5; + int64_t f0f6_2 = f0_2 * (int64_t) f6; + int64_t f0f7_2 = f0_2 * (int64_t) f7; + int64_t f0f8_2 = f0_2 * (int64_t) f8; + int64_t f0f9_2 = f0_2 * (int64_t) f9; + int64_t f1f1_2 = f1_2 * (int64_t) f1; + int64_t f1f2_2 = f1_2 * (int64_t) f2; + int64_t f1f3_4 = f1_2 * (int64_t) f3_2; + int64_t f1f4_2 = f1_2 * (int64_t) f4; + int64_t f1f5_4 = f1_2 * (int64_t) f5_2; + int64_t f1f6_2 = f1_2 * (int64_t) f6; + int64_t f1f7_4 = f1_2 * (int64_t) f7_2; + int64_t f1f8_2 = f1_2 * (int64_t) f8; + int64_t f1f9_76 = f1_2 * (int64_t) f9_38; + int64_t f2f2 = f2 * (int64_t) f2; + int64_t f2f3_2 = f2_2 * (int64_t) f3; + int64_t f2f4_2 = f2_2 * (int64_t) f4; + int64_t f2f5_2 = f2_2 * (int64_t) f5; + int64_t f2f6_2 = f2_2 * (int64_t) f6; + int64_t f2f7_2 = f2_2 * (int64_t) f7; + int64_t f2f8_38 = f2_2 * (int64_t) f8_19; + int64_t f2f9_38 = f2 * (int64_t) f9_38; + int64_t f3f3_2 = f3_2 * (int64_t) f3; + int64_t f3f4_2 = f3_2 * (int64_t) f4; + int64_t f3f5_4 = f3_2 * (int64_t) f5_2; + int64_t f3f6_2 = f3_2 * (int64_t) f6; + int64_t f3f7_76 = f3_2 * (int64_t) f7_38; + int64_t f3f8_38 = f3_2 * (int64_t) f8_19; + int64_t f3f9_76 = f3_2 * (int64_t) f9_38; + int64_t f4f4 = f4 * (int64_t) f4; + int64_t f4f5_2 = f4_2 * (int64_t) f5; + int64_t f4f6_38 = f4_2 * (int64_t) f6_19; + int64_t f4f7_38 = f4 * (int64_t) f7_38; + int64_t f4f8_38 = f4_2 * (int64_t) f8_19; + int64_t f4f9_38 = f4 * (int64_t) f9_38; + int64_t f5f5_38 = f5 * (int64_t) f5_38; + int64_t f5f6_38 = f5_2 * (int64_t) f6_19; + int64_t f5f7_76 = f5_2 * (int64_t) f7_38; + int64_t f5f8_38 = f5_2 * (int64_t) f8_19; + int64_t f5f9_76 = f5_2 * (int64_t) f9_38; + int64_t f6f6_19 = f6 * (int64_t) f6_19; + int64_t f6f7_38 = f6 * (int64_t) f7_38; + int64_t f6f8_38 = f6_2 * (int64_t) f8_19; + int64_t f6f9_38 = f6 * (int64_t) f9_38; + int64_t f7f7_38 = f7 * (int64_t) f7_38; + int64_t f7f8_38 = f7_2 * (int64_t) f8_19; + int64_t f7f9_76 = f7_2 * (int64_t) f9_38; + int64_t f8f8_19 = f8 * (int64_t) f8_19; + int64_t f8f9_38 = f8 * (int64_t) f9_38; + int64_t f9f9_38 = f9 * (int64_t) f9_38; + + int64_t h0 = f0f0 + f1f9_76 + f2f8_38 + f3f7_76 + f4f6_38 + f5f5_38; + int64_t h1 = f0f1_2 + f2f9_38 + f3f8_38 + f4f7_38 + f5f6_38; + int64_t h2 = f0f2_2 + f1f1_2 + f3f9_76 + f4f8_38 + f5f7_76 + f6f6_19; + int64_t h3 = f0f3_2 + f1f2_2 + f4f9_38 + f5f8_38 + f6f7_38; + int64_t h4 = f0f4_2 + f1f3_4 + f2f2 + f5f9_76 + f6f8_38 + f7f7_38; + int64_t h5 = f0f5_2 + f1f4_2 + f2f3_2 + f6f9_38 + f7f8_38; + int64_t h6 = f0f6_2 + f1f5_4 + f2f4_2 + f3f3_2 + f7f9_76 + f8f8_19; + int64_t h7 = f0f7_2 + f1f6_2 + f2f5_2 + f3f4_2 + f8f9_38; + int64_t h8 = f0f8_2 + f1f7_4 + f2f6_2 + f3f5_4 + f4f4 + f9f9_38; + int64_t h9 = f0f9_2 + f1f8_2 + f2f7_2 + f3f6_2 + f4f5_2; + + int64_t carry0; + int64_t carry1; + int64_t carry2; + int64_t carry3; + int64_t carry4; + int64_t carry5; + int64_t carry6; + int64_t carry7; + int64_t carry8; + int64_t carry9; + + h0 += h0; + h1 += h1; + h2 += h2; + h3 += h3; + h4 += h4; + h5 += h5; + h6 += h6; + h7 += h7; + h8 += h8; + h9 += h9; + + carry0 = (h0 + (int64_t)(1L << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((uint64_t) 1L << 26); + carry4 = (h4 + (int64_t)(1L << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((uint64_t) 1L << 26); + + carry1 = (h1 + (int64_t)(1L << 24)) >> 25; + h2 += carry1; + h1 -= carry1 * ((uint64_t) 1L << 25); + carry5 = (h5 + (int64_t)(1L << 24)) >> 25; + h6 += carry5; + h5 -= carry5 * ((uint64_t) 1L << 25); + + carry2 = (h2 + (int64_t)(1L << 25)) >> 26; + h3 += carry2; + h2 -= carry2 * ((uint64_t) 1L << 26); + carry6 = (h6 + (int64_t)(1L << 25)) >> 26; + h7 += carry6; + h6 -= carry6 * ((uint64_t) 1L << 26); + + carry3 = (h3 + (int64_t)(1L << 24)) >> 25; + h4 += carry3; + h3 -= carry3 * ((uint64_t) 1L << 25); + carry7 = (h7 + (int64_t)(1L << 24)) >> 25; + h8 += carry7; + h7 -= carry7 * ((uint64_t) 1L << 25); + + carry4 = (h4 + (int64_t)(1L << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((uint64_t) 1L << 26); + carry8 = (h8 + (int64_t)(1L << 25)) >> 26; + h9 += carry8; + h8 -= carry8 * ((uint64_t) 1L << 26); + + carry9 = (h9 + (int64_t)(1L << 24)) >> 25; + h0 += carry9 * 19; + h9 -= carry9 * ((uint64_t) 1L << 25); + + carry0 = (h0 + (int64_t)(1L << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((uint64_t) 1L << 26); + + h[0] = (int32_t) h0; + h[1] = (int32_t) h1; + h[2] = (int32_t) h2; + h[3] = (int32_t) h3; + h[4] = (int32_t) h4; + h[5] = (int32_t) h5; + h[6] = (int32_t) h6; + h[7] = (int32_t) h7; + h[8] = (int32_t) h8; + h[9] = (int32_t) h9; +} + +static void +fe25519_scalar_product(fe25519 h, const fe25519 f, uint32_t n) +{ + int64_t sn = (int64_t) n; + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + int64_t h0 = f0 * sn; + int64_t h1 = f1 * sn; + int64_t h2 = f2 * sn; + int64_t h3 = f3 * sn; + int64_t h4 = f4 * sn; + int64_t h5 = f5 * sn; + int64_t h6 = f6 * sn; + int64_t h7 = f7 * sn; + int64_t h8 = f8 * sn; + int64_t h9 = f9 * sn; + int64_t carry0, carry1, carry2, carry3, carry4, carry5, carry6, carry7, + carry8, carry9; + + carry9 = (h9 + ((int64_t) 1 << 24)) >> 25; + h0 += carry9 * 19; + h9 -= carry9 * ((int64_t) 1 << 25); + carry1 = (h1 + ((int64_t) 1 << 24)) >> 25; + h2 += carry1; + h1 -= carry1 * ((int64_t) 1 << 25); + carry3 = (h3 + ((int64_t) 1 << 24)) >> 25; + h4 += carry3; + h3 -= carry3 * ((int64_t) 1 << 25); + carry5 = (h5 + ((int64_t) 1 << 24)) >> 25; + h6 += carry5; + h5 -= carry5 * ((int64_t) 1 << 25); + carry7 = (h7 + ((int64_t) 1 << 24)) >> 25; + h8 += carry7; + h7 -= carry7 * ((int64_t) 1 << 25); + + carry0 = (h0 + ((int64_t) 1 << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((int64_t) 1 << 26); + carry2 = (h2 + ((int64_t) 1 << 25)) >> 26; + h3 += carry2; + h2 -= carry2 * ((int64_t) 1 << 26); + carry4 = (h4 + ((int64_t) 1 << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((int64_t) 1 << 26); + carry6 = (h6 + ((int64_t) 1 << 25)) >> 26; + h7 += carry6; + h6 -= carry6 * ((int64_t) 1 << 26); + carry8 = (h8 + ((int64_t) 1 << 25)) >> 26; + h9 += carry8; + h8 -= carry8 * ((int64_t) 1 << 26); + + h[0] = (int32_t) h0; + h[1] = (int32_t) h1; + h[2] = (int32_t) h2; + h[3] = (int32_t) h3; + h[4] = (int32_t) h4; + h[5] = (int32_t) h5; + h[6] = (int32_t) h6; + h[7] = (int32_t) h7; + h[8] = (int32_t) h8; + h[9] = (int32_t) h9; +} diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_51.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_51.h new file mode 100644 index 00000000000..3a30f30148a --- /dev/null +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_51.h @@ -0,0 +1,518 @@ +#include + +#include "private/common.h" +#include "utils.h" + +/* + h = 0 + */ + +static inline void +fe25519_0(fe25519 h) +{ + memset(&h[0], 0, 5 * sizeof h[0]); +} + +/* + h = 1 + */ + +static inline void +fe25519_1(fe25519 h) +{ + h[0] = 1; + memset(&h[1], 0, 4 * sizeof h[0]); +} + +/* + h = f + g + Can overlap h with f or g. + */ + +static inline void +fe25519_add(fe25519 h, const fe25519 f, const fe25519 g) +{ + uint64_t h0 = f[0] + g[0]; + uint64_t h1 = f[1] + g[1]; + uint64_t h2 = f[2] + g[2]; + uint64_t h3 = f[3] + g[3]; + uint64_t h4 = f[4] + g[4]; + + h[0] = h0; + h[1] = h1; + h[2] = h2; + h[3] = h3; + h[4] = h4; +} + +/* + h = f - g + */ + +static void +fe25519_sub(fe25519 h, const fe25519 f, const fe25519 g) +{ + const uint64_t mask = 0x7ffffffffffffULL; + uint64_t h0, h1, h2, h3, h4; + + h0 = g[0]; + h1 = g[1]; + h2 = g[2]; + h3 = g[3]; + h4 = g[4]; + + h1 += h0 >> 51; + h0 &= mask; + h2 += h1 >> 51; + h1 &= mask; + h3 += h2 >> 51; + h2 &= mask; + h4 += h3 >> 51; + h3 &= mask; + h0 += 19ULL * (h4 >> 51); + h4 &= mask; + + h0 = (f[0] + 0xfffffffffffdaULL) - h0; + h1 = (f[1] + 0xffffffffffffeULL) - h1; + h2 = (f[2] + 0xffffffffffffeULL) - h2; + h3 = (f[3] + 0xffffffffffffeULL) - h3; + h4 = (f[4] + 0xffffffffffffeULL) - h4; + + h[0] = h0; + h[1] = h1; + h[2] = h2; + h[3] = h3; + h[4] = h4; +} + +/* + h = -f + */ + +static inline void +fe25519_neg(fe25519 h, const fe25519 f) +{ + fe25519 zero; + + fe25519_0(zero); + fe25519_sub(h, zero, f); +} + +/* + Replace (f,g) with (g,g) if b == 1; + replace (f,g) with (f,g) if b == 0. + * + Preconditions: b in {0,1}. + */ + +static void +fe25519_cmov(fe25519 f, const fe25519 g, unsigned int b) +{ + const uint64_t mask = (uint64_t) (-(int64_t) b); + + uint64_t f0 = f[0]; + uint64_t f1 = f[1]; + uint64_t f2 = f[2]; + uint64_t f3 = f[3]; + uint64_t f4 = f[4]; + + uint64_t x0 = f0 ^ g[0]; + uint64_t x1 = f1 ^ g[1]; + uint64_t x2 = f2 ^ g[2]; + uint64_t x3 = f3 ^ g[3]; + uint64_t x4 = f4 ^ g[4]; + + x0 &= mask; + x1 &= mask; + x2 &= mask; + x3 &= mask; + x4 &= mask; + + f[0] = f0 ^ x0; + f[1] = f1 ^ x1; + f[2] = f2 ^ x2; + f[3] = f3 ^ x3; + f[4] = f4 ^ x4; +} + +/* +Replace (f,g) with (g,f) if b == 1; +replace (f,g) with (f,g) if b == 0. + +Preconditions: b in {0,1}. +*/ + +static void +fe25519_cswap(fe25519 f, fe25519 g, unsigned int b) +{ + const uint64_t mask = (uint64_t) (-(int64_t) b); + + uint64_t f0 = f[0]; + uint64_t f1 = f[1]; + uint64_t f2 = f[2]; + uint64_t f3 = f[3]; + uint64_t f4 = f[4]; + + uint64_t g0 = g[0]; + uint64_t g1 = g[1]; + uint64_t g2 = g[2]; + uint64_t g3 = g[3]; + uint64_t g4 = g[4]; + + uint64_t x0 = f0 ^ g0; + uint64_t x1 = f1 ^ g1; + uint64_t x2 = f2 ^ g2; + uint64_t x3 = f3 ^ g3; + uint64_t x4 = f4 ^ g4; + + x0 &= mask; + x1 &= mask; + x2 &= mask; + x3 &= mask; + x4 &= mask; + + f[0] = f0 ^ x0; + f[1] = f1 ^ x1; + f[2] = f2 ^ x2; + f[3] = f3 ^ x3; + f[4] = f4 ^ x4; + + g[0] = g0 ^ x0; + g[1] = g1 ^ x1; + g[2] = g2 ^ x2; + g[3] = g3 ^ x3; + g[4] = g4 ^ x4; +} + +/* + h = f + */ + +static inline void +fe25519_copy(fe25519 h, const fe25519 f) +{ + uint64_t f0 = f[0]; + uint64_t f1 = f[1]; + uint64_t f2 = f[2]; + uint64_t f3 = f[3]; + uint64_t f4 = f[4]; + + h[0] = f0; + h[1] = f1; + h[2] = f2; + h[3] = f3; + h[4] = f4; +} + +/* + return 1 if f is in {1,3,5,...,q-2} + return 0 if f is in {0,2,4,...,q-1} + */ + +static inline int +fe25519_isnegative(const fe25519 f) +{ + unsigned char s[32]; + + fe25519_tobytes(s, f); + + return s[0] & 1; +} + +/* + return 1 if f == 0 + return 0 if f != 0 + */ + +static inline int +fe25519_iszero(const fe25519 f) +{ + unsigned char s[32]; + + fe25519_tobytes(s, f); + + return sodium_is_zero(s, 32); +} + +/* + h = f * g + Can overlap h with f or g. + */ + +static void +fe25519_mul(fe25519 h, const fe25519 f, const fe25519 g) +{ + const uint64_t mask = 0x7ffffffffffffULL; + uint128_t r0, r1, r2, r3, r4, carry; + uint64_t f0, f1, f2, f3, f4; + uint64_t f1_19, f2_19, f3_19, f4_19; + uint64_t g0, g1, g2, g3, g4; + uint64_t r00, r01, r02, r03, r04; + + f0 = f[0]; + f1 = f[1]; + f2 = f[2]; + f3 = f[3]; + f4 = f[4]; + + g0 = g[0]; + g1 = g[1]; + g2 = g[2]; + g3 = g[3]; + g4 = g[4]; + + f1_19 = 19ULL * f1; + f2_19 = 19ULL * f2; + f3_19 = 19ULL * f3; + f4_19 = 19ULL * f4; + + r0 = ((uint128_t) f0 ) * ((uint128_t) g0); + r0 += ((uint128_t) f1_19) * ((uint128_t) g4); + r0 += ((uint128_t) f2_19) * ((uint128_t) g3); + r0 += ((uint128_t) f3_19) * ((uint128_t) g2); + r0 += ((uint128_t) f4_19) * ((uint128_t) g1); + + r1 = ((uint128_t) f0 ) * ((uint128_t) g1); + r1 += ((uint128_t) f1 ) * ((uint128_t) g0); + r1 += ((uint128_t) f2_19) * ((uint128_t) g4); + r1 += ((uint128_t) f3_19) * ((uint128_t) g3); + r1 += ((uint128_t) f4_19) * ((uint128_t) g2); + + r2 = ((uint128_t) f0 ) * ((uint128_t) g2); + r2 += ((uint128_t) f1 ) * ((uint128_t) g1); + r2 += ((uint128_t) f2 ) * ((uint128_t) g0); + r2 += ((uint128_t) f3_19) * ((uint128_t) g4); + r2 += ((uint128_t) f4_19) * ((uint128_t) g3); + + r3 = ((uint128_t) f0 ) * ((uint128_t) g3); + r3 += ((uint128_t) f1 ) * ((uint128_t) g2); + r3 += ((uint128_t) f2 ) * ((uint128_t) g1); + r3 += ((uint128_t) f3 ) * ((uint128_t) g0); + r3 += ((uint128_t) f4_19) * ((uint128_t) g4); + + r4 = ((uint128_t) f0 ) * ((uint128_t) g4); + r4 += ((uint128_t) f1 ) * ((uint128_t) g3); + r4 += ((uint128_t) f2 ) * ((uint128_t) g2); + r4 += ((uint128_t) f3 ) * ((uint128_t) g1); + r4 += ((uint128_t) f4 ) * ((uint128_t) g0); + + r00 = ((uint64_t) r0) & mask; + carry = r0 >> 51; + r1 += carry; + r01 = ((uint64_t) r1) & mask; + carry = r1 >> 51; + r2 += carry; + r02 = ((uint64_t) r2) & mask; + carry = r2 >> 51; + r3 += carry; + r03 = ((uint64_t) r3) & mask; + carry = r3 >> 51; + r4 += carry; + r04 = ((uint64_t) r4) & mask; + carry = r4 >> 51; + r00 += 19ULL * (uint64_t) carry; + carry = r00 >> 51; + r00 &= mask; + r01 += (uint64_t) carry; + carry = r01 >> 51; + r01 &= mask; + r02 += (uint64_t) carry; + + h[0] = r00; + h[1] = r01; + h[2] = r02; + h[3] = r03; + h[4] = r04; +} + +/* + h = f * f + Can overlap h with f. + */ + +static void +fe25519_sq(fe25519 h, const fe25519 f) +{ + const uint64_t mask = 0x7ffffffffffffULL; + uint128_t r0, r1, r2, r3, r4, carry; + uint64_t f0, f1, f2, f3, f4; + uint64_t f0_2, f1_2, f1_38, f2_38, f3_38, f3_19, f4_19; + uint64_t r00, r01, r02, r03, r04; + + f0 = f[0]; + f1 = f[1]; + f2 = f[2]; + f3 = f[3]; + f4 = f[4]; + + f0_2 = f0 << 1; + f1_2 = f1 << 1; + + f1_38 = 38ULL * f1; + f2_38 = 38ULL * f2; + f3_38 = 38ULL * f3; + + f3_19 = 19ULL * f3; + f4_19 = 19ULL * f4; + + r0 = ((uint128_t) f0 ) * ((uint128_t) f0); + r0 += ((uint128_t) f1_38) * ((uint128_t) f4); + r0 += ((uint128_t) f2_38) * ((uint128_t) f3); + + r1 = ((uint128_t) f0_2 ) * ((uint128_t) f1); + r1 += ((uint128_t) f2_38) * ((uint128_t) f4); + r1 += ((uint128_t) f3_19) * ((uint128_t) f3); + + r2 = ((uint128_t) f0_2 ) * ((uint128_t) f2); + r2 += ((uint128_t) f1 ) * ((uint128_t) f1); + r2 += ((uint128_t) f3_38) * ((uint128_t) f4); + + r3 = ((uint128_t) f0_2 ) * ((uint128_t) f3); + r3 += ((uint128_t) f1_2 ) * ((uint128_t) f2); + r3 += ((uint128_t) f4_19) * ((uint128_t) f4); + + r4 = ((uint128_t) f0_2 ) * ((uint128_t) f4); + r4 += ((uint128_t) f1_2 ) * ((uint128_t) f3); + r4 += ((uint128_t) f2 ) * ((uint128_t) f2); + + r00 = ((uint64_t) r0) & mask; + carry = r0 >> 51; + r1 += carry; + r01 = ((uint64_t) r1) & mask; + carry = r1 >> 51; + r2 += carry; + r02 = ((uint64_t) r2) & mask; + carry = r2 >> 51; + r3 += carry; + r03 = ((uint64_t) r3) & mask; + carry = r3 >> 51; + r4 += carry; + r04 = ((uint64_t) r4) & mask; + carry = r4 >> 51; + r00 += 19ULL * (uint64_t) carry; + carry = r00 >> 51; + r00 &= mask; + r01 += (uint64_t) carry; + carry = r01 >> 51; + r01 &= mask; + r02 += (uint64_t) carry; + + h[0] = r00; + h[1] = r01; + h[2] = r02; + h[3] = r03; + h[4] = r04; +} + +/* + h = 2 * f * f + Can overlap h with f. +*/ + +static void +fe25519_sq2(fe25519 h, const fe25519 f) +{ + const uint64_t mask = 0x7ffffffffffffULL; + uint128_t r0, r1, r2, r3, r4, carry; + uint64_t f0, f1, f2, f3, f4; + uint64_t f0_2, f1_2, f1_38, f2_38, f3_38, f3_19, f4_19; + uint64_t r00, r01, r02, r03, r04; + + f0 = f[0]; + f1 = f[1]; + f2 = f[2]; + f3 = f[3]; + f4 = f[4]; + + f0_2 = f0 << 1; + f1_2 = f1 << 1; + + f1_38 = 38ULL * f1; + f2_38 = 38ULL * f2; + f3_38 = 38ULL * f3; + + f3_19 = 19ULL * f3; + f4_19 = 19ULL * f4; + + r0 = ((uint128_t) f0 ) * ((uint128_t) f0); + r0 += ((uint128_t) f1_38) * ((uint128_t) f4); + r0 += ((uint128_t) f2_38) * ((uint128_t) f3); + + r1 = ((uint128_t) f0_2 ) * ((uint128_t) f1); + r1 += ((uint128_t) f2_38) * ((uint128_t) f4); + r1 += ((uint128_t) f3_19) * ((uint128_t) f3); + + r2 = ((uint128_t) f0_2 ) * ((uint128_t) f2); + r2 += ((uint128_t) f1 ) * ((uint128_t) f1); + r2 += ((uint128_t) f3_38) * ((uint128_t) f4); + + r3 = ((uint128_t) f0_2 ) * ((uint128_t) f3); + r3 += ((uint128_t) f1_2 ) * ((uint128_t) f2); + r3 += ((uint128_t) f4_19) * ((uint128_t) f4); + + r4 = ((uint128_t) f0_2 ) * ((uint128_t) f4); + r4 += ((uint128_t) f1_2 ) * ((uint128_t) f3); + r4 += ((uint128_t) f2 ) * ((uint128_t) f2); + + r0 <<= 1; + r1 <<= 1; + r2 <<= 1; + r3 <<= 1; + r4 <<= 1; + + r00 = ((uint64_t) r0) & mask; + carry = r0 >> 51; + r1 += carry; + r01 = ((uint64_t) r1) & mask; + carry = r1 >> 51; + r2 += carry; + r02 = ((uint64_t) r2) & mask; + carry = r2 >> 51; + r3 += carry; + r03 = ((uint64_t) r3) & mask; + carry = r3 >> 51; + r4 += carry; + r04 = ((uint64_t) r4) & mask; + carry = r4 >> 51; + r00 += 19ULL * (uint64_t) carry; + carry = r00 >> 51; + r00 &= mask; + r01 += (uint64_t) carry; + carry = r01 >> 51; + r01 &= mask; + r02 += (uint64_t) carry; + + h[0] = r00; + h[1] = r01; + h[2] = r02; + h[3] = r03; + h[4] = r04; +} + +static void +fe25519_scalar_product(fe25519 h, const fe25519 f, uint32_t n) +{ + const uint64_t mask = 0x7ffffffffffffULL; + uint128_t a; + uint128_t sn = (uint128_t) n; + uint64_t h0, h1, h2, h3, h4; + + a = f[0] * sn; + h0 = ((uint64_t) a) & mask; + a = f[1] * sn + ((uint64_t) (a >> 51)); + h1 = ((uint64_t) a) & mask; + a = f[2] * sn + ((uint64_t) (a >> 51)); + h2 = ((uint64_t) a) & mask; + a = f[3] * sn + ((uint64_t) (a >> 51)); + h3 = ((uint64_t) a) & mask; + a = f[4] * sn + ((uint64_t) (a >> 51)); + h4 = ((uint64_t) a) & mask; + + h0 += (a >> 51) * 19ULL; + + h[0] = h0; + h[1] = h1; + h[2] = h2; + h[3] = h3; + h[4] = h4; +} diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/implementations.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/implementations.h new file mode 100644 index 00000000000..c7237f851de --- /dev/null +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/private/implementations.h @@ -0,0 +1,11 @@ +#ifndef implementations_H +#define implementations_H + +int _crypto_generichash_blake2b_pick_best_implementation(void); +int _crypto_onetimeauth_poly1305_pick_best_implementation(void); +int _crypto_pwhash_argon2_pick_best_implementation(void); +int _crypto_scalarmult_curve25519_pick_best_implementation(void); +int _crypto_stream_chacha20_pick_best_implementation(void); +int _crypto_stream_salsa20_pick_best_implementation(void); + +#endif diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes.h index d112fb293e5..a03cc657204 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes.h @@ -25,16 +25,20 @@ typedef struct randombytes_implementation { int (*close)(void); /* optional */ } randombytes_implementation; +#define randombytes_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 0xffffffffUL) + #define randombytes_SEEDBYTES 32U SODIUM_EXPORT size_t randombytes_seedbytes(void); SODIUM_EXPORT -void randombytes_buf(void * const buf, const size_t size); +void randombytes_buf(void * const buf, const size_t size) + __attribute__ ((nonnull)); SODIUM_EXPORT void randombytes_buf_deterministic(void * const buf, const size_t size, - const unsigned char seed[randombytes_SEEDBYTES]); + const unsigned char seed[randombytes_SEEDBYTES]) + __attribute__ ((nonnull)); SODIUM_EXPORT uint32_t randombytes_random(void); @@ -49,7 +53,8 @@ SODIUM_EXPORT int randombytes_close(void); SODIUM_EXPORT -int randombytes_set_implementation(randombytes_implementation *impl); +int randombytes_set_implementation(randombytes_implementation *impl) + __attribute__ ((nonnull)); SODIUM_EXPORT const char *randombytes_implementation_name(void); @@ -57,7 +62,8 @@ const char *randombytes_implementation_name(void); /* -- NaCl compatibility interface -- */ SODIUM_EXPORT -void randombytes(unsigned char * const buf, const unsigned long long buf_len); +void randombytes(unsigned char * const buf, const unsigned long long buf_len) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_internal_random.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_internal_random.h new file mode 100644 index 00000000000..2b2b7d6edc1 --- /dev/null +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_internal_random.h @@ -0,0 +1,22 @@ + +#ifndef randombytes_internal_random_H +#define randombytes_internal_random_H + +#include "export.h" +#include "randombytes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +SODIUM_EXPORT +extern struct randombytes_implementation randombytes_internal_implementation; + +/* Backwards compatibility with libsodium < 1.0.18 */ +#define randombytes_salsa20_implementation randombytes_internal_implementation + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_nativeclient.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_nativeclient.h deleted file mode 100644 index 5158d8c3c33..00000000000 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_nativeclient.h +++ /dev/null @@ -1,23 +0,0 @@ - -#ifndef randombytes_nativeclient_H -#define randombytes_nativeclient_H - -#ifdef __native_client__ - -# include "export.h" -# include "randombytes.h" - -# ifdef __cplusplus -extern "C" { -# endif - -SODIUM_EXPORT -extern struct randombytes_implementation randombytes_nativeclient_implementation; - -# ifdef __cplusplus -} -# endif - -#endif - -#endif diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h deleted file mode 100644 index 4deae15b6d9..00000000000 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h +++ /dev/null @@ -1,19 +0,0 @@ - -#ifndef randombytes_salsa20_random_H -#define randombytes_salsa20_random_H - -#include "export.h" -#include "randombytes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -SODIUM_EXPORT -extern struct randombytes_implementation randombytes_salsa20_implementation; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/runtime.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/runtime.h index 76859ea0e13..7f15d58e7c5 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/runtime.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/runtime.h @@ -8,33 +8,39 @@ extern "C" { #endif -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_neon(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_sse2(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_sse3(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_ssse3(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_sse41(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_avx(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_avx2(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK +int sodium_runtime_has_avx512f(void); + +SODIUM_EXPORT_WEAK int sodium_runtime_has_pclmul(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_aesni(void); +SODIUM_EXPORT_WEAK +int sodium_runtime_has_rdrand(void); + /* ------------------------------------------------------------------------- */ int _sodium_runtime_get_cpu_features(void); diff --git a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/utils.h b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/utils.h index 0a7aadb434c..ac801512919 100644 --- a/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/utils.h +++ b/tools/sdk/esp32/include/libsodium/libsodium/src/libsodium/include/sodium/utils.h @@ -21,6 +21,9 @@ extern "C" { SODIUM_EXPORT void sodium_memzero(void * const pnt, const size_t len); +SODIUM_EXPORT +void sodium_stackzero(const size_t len); + /* * WARNING: sodium_memcmp() must be used to verify if two secret keys * are equal, in constant time. @@ -39,8 +42,7 @@ int sodium_memcmp(const void * const b1_, const void * const b2_, size_t len) */ SODIUM_EXPORT int sodium_compare(const unsigned char *b1_, const unsigned char *b2_, - size_t len) - __attribute__ ((warn_unused_result)); + size_t len) __attribute__ ((warn_unused_result)); SODIUM_EXPORT int sodium_is_zero(const unsigned char *n, const size_t nlen); @@ -51,21 +53,57 @@ void sodium_increment(unsigned char *n, const size_t nlen); SODIUM_EXPORT void sodium_add(unsigned char *a, const unsigned char *b, const size_t len); +SODIUM_EXPORT +void sodium_sub(unsigned char *a, const unsigned char *b, const size_t len); + SODIUM_EXPORT char *sodium_bin2hex(char * const hex, const size_t hex_maxlen, - const unsigned char * const bin, const size_t bin_len); + const unsigned char * const bin, const size_t bin_len) + __attribute__ ((nonnull(1))); SODIUM_EXPORT int sodium_hex2bin(unsigned char * const bin, const size_t bin_maxlen, const char * const hex, const size_t hex_len, const char * const ignore, size_t * const bin_len, - const char ** const hex_end); + const char ** const hex_end) + __attribute__ ((nonnull(1))); + +#define sodium_base64_VARIANT_ORIGINAL 1 +#define sodium_base64_VARIANT_ORIGINAL_NO_PADDING 3 +#define sodium_base64_VARIANT_URLSAFE 5 +#define sodium_base64_VARIANT_URLSAFE_NO_PADDING 7 + +/* + * Computes the required length to encode BIN_LEN bytes as a base64 string + * using the given variant. The computed length includes a trailing \0. + */ +#define sodium_base64_ENCODED_LEN(BIN_LEN, VARIANT) \ + (((BIN_LEN) / 3U) * 4U + \ + ((((BIN_LEN) - ((BIN_LEN) / 3U) * 3U) | (((BIN_LEN) - ((BIN_LEN) / 3U) * 3U) >> 1)) & 1U) * \ + (4U - (~((((VARIANT) & 2U) >> 1) - 1U) & (3U - ((BIN_LEN) - ((BIN_LEN) / 3U) * 3U)))) + 1U) SODIUM_EXPORT -int sodium_mlock(void * const addr, const size_t len); +size_t sodium_base64_encoded_len(const size_t bin_len, const int variant); SODIUM_EXPORT -int sodium_munlock(void * const addr, const size_t len); +char *sodium_bin2base64(char * const b64, const size_t b64_maxlen, + const unsigned char * const bin, const size_t bin_len, + const int variant) __attribute__ ((nonnull(1))); + +SODIUM_EXPORT +int sodium_base642bin(unsigned char * const bin, const size_t bin_maxlen, + const char * const b64, const size_t b64_len, + const char * const ignore, size_t * const bin_len, + const char ** const b64_end, const int variant) + __attribute__ ((nonnull(1))); + +SODIUM_EXPORT +int sodium_mlock(void * const addr, const size_t len) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +int sodium_munlock(void * const addr, const size_t len) + __attribute__ ((nonnull)); /* WARNING: sodium_malloc() and sodium_allocarray() are not general-purpose * allocation functions. @@ -112,13 +150,23 @@ SODIUM_EXPORT void sodium_free(void *ptr); SODIUM_EXPORT -int sodium_mprotect_noaccess(void *ptr); +int sodium_mprotect_noaccess(void *ptr) __attribute__ ((nonnull)); + +SODIUM_EXPORT +int sodium_mprotect_readonly(void *ptr) __attribute__ ((nonnull)); + +SODIUM_EXPORT +int sodium_mprotect_readwrite(void *ptr) __attribute__ ((nonnull)); SODIUM_EXPORT -int sodium_mprotect_readonly(void *ptr); +int sodium_pad(size_t *padded_buflen_p, unsigned char *buf, + size_t unpadded_buflen, size_t blocksize, size_t max_buflen) + __attribute__ ((nonnull(2))); SODIUM_EXPORT -int sodium_mprotect_readwrite(void *ptr); +int sodium_unpad(size_t *unpadded_buflen_p, const unsigned char *buf, + size_t padded_buflen, size_t blocksize) + __attribute__ ((nonnull(2))); /* -------- */ diff --git a/tools/sdk/esp32/include/lwip/port/esp32/include/lwipopts.h b/tools/sdk/esp32/include/lwip/port/esp32/include/lwipopts.h index 442bf0e98e2..52d2d99de4f 100644 --- a/tools/sdk/esp32/include/lwip/port/esp32/include/lwipopts.h +++ b/tools/sdk/esp32/include/lwip/port/esp32/include/lwipopts.h @@ -745,16 +745,17 @@ --------- LCP Echo options --------- ------------------------------------ */ +#if CONFIG_LWIP_ENABLE_LCP_ECHO /** * LCP_ECHOINTERVAL: Interval in seconds between keepalive LCP echo requests, 0 to disable. */ -#define LCP_ECHOINTERVAL CONFIG_LCP_ECHOINTERVAL +#define LCP_ECHOINTERVAL CONFIG_LWIP_LCP_ECHOINTERVAL /** * LCP_MAXECHOFAILS: Number of consecutive unanswered echo requests before failure is indicated. */ -#define LCP_MAXECHOFAILS CONFIG_LCP_MAXECHOFAILS - +#define LCP_MAXECHOFAILS CONFIG_LWIP_LCP_MAXECHOFAILS +#endif /* CONFIG_LWIP_ENABLE_LCP_ECHO */ /* -------------------------------------- @@ -1013,7 +1014,11 @@ /** * LWIP_DEBUG: Enable lwip debugging in other modules. */ -#define LWIP_DEBUG LWIP_DBG_OFF +#ifdef CONFIG_LWIP_DEBUG +#define LWIP_DEBUG LWIP_DBG_ON +#else +#undef LWIP_DEBUG +#endif #define CHECKSUM_CHECK_UDP CONFIG_LWIP_CHECKSUM_CHECK_UDP #define CHECKSUM_CHECK_IP CONFIG_LWIP_CHECKSUM_CHECK_IP diff --git a/tools/sdk/esp32/include/soc/esp32/include/soc/soc_caps.h b/tools/sdk/esp32/include/soc/esp32/include/soc/soc_caps.h index 909659df9d4..488acd83826 100644 --- a/tools/sdk/esp32/include/soc/esp32/include/soc/soc_caps.h +++ b/tools/sdk/esp32/include/soc/esp32/include/soc/soc_caps.h @@ -60,6 +60,7 @@ /*-------------------------- COMMON CAPS ---------------------------------------*/ #define SOC_CAPS_ECO_VER_MAX 3 +#define SOC_DAC_SUPPORTED 1 #define SOC_MCPWM_SUPPORTED 1 #define SOC_SDMMC_HOST_SUPPORTED 1 #define SOC_BT_SUPPORTED 1 diff --git a/tools/sdk/esp32/include/soc/esp32/include/soc/spi_pins.h b/tools/sdk/esp32/include/soc/esp32/include/soc/spi_pins.h index 5d4a329522d..9d9424d27cd 100644 --- a/tools/sdk/esp32/include/soc/esp32/include/soc/spi_pins.h +++ b/tools/sdk/esp32/include/soc/esp32/include/soc/spi_pins.h @@ -22,8 +22,6 @@ #define SPI_IOMUX_PIN_NUM_WP 10 #define SPI_IOMUX_PIN_NUM_HD 9 -#define HSPI_FUNC_NUM 1 - //For D2WD and PICO-D4 chip #define SPI_D2WD_PIN_NUM_MISO 17 #define SPI_D2WD_PIN_NUM_MOSI 8 @@ -32,6 +30,24 @@ #define SPI_D2WD_PIN_NUM_WP 7 #define SPI_D2WD_PIN_NUM_HD 11 +#define SPI2_FUNC_NUM HSPI_FUNC_NUM +#define SPI2_IOMUX_PIN_NUM_MISO HSPI_IOMUX_PIN_NUM_MISO +#define SPI2_IOMUX_PIN_NUM_MOSI HSPI_IOMUX_PIN_NUM_MOSI +#define SPI2_IOMUX_PIN_NUM_CLK HSPI_IOMUX_PIN_NUM_CLK +#define SPI2_IOMUX_PIN_NUM_CS HSPI_IOMUX_PIN_NUM_CS +#define SPI2_IOMUX_PIN_NUM_WP HSPI_IOMUX_PIN_NUM_WP +#define SPI2_IOMUX_PIN_NUM_HD HSPI_IOMUX_PIN_NUM_HD + +#define SPI3_FUNC_NUM VSPI_FUNC_NUM +#define SPI3_IOMUX_PIN_NUM_MISO VSPI_IOMUX_PIN_NUM_MISO +#define SPI3_IOMUX_PIN_NUM_MOSI VSPI_IOMUX_PIN_NUM_MOSI +#define SPI3_IOMUX_PIN_NUM_CLK VSPI_IOMUX_PIN_NUM_CLK +#define SPI3_IOMUX_PIN_NUM_CS VSPI_IOMUX_PIN_NUM_CS +#define SPI3_IOMUX_PIN_NUM_WP VSPI_IOMUX_PIN_NUM_WP +#define SPI3_IOMUX_PIN_NUM_HD VSPI_IOMUX_PIN_NUM_HD + +//Following Macros are deprecated. Please use the Macros above +#define HSPI_FUNC_NUM 1 #define HSPI_IOMUX_PIN_NUM_MISO 12 #define HSPI_IOMUX_PIN_NUM_MOSI 13 #define HSPI_IOMUX_PIN_NUM_CLK 14 diff --git a/tools/sdk/esp32/include/tcp_transport/include/esp_transport_ssl.h b/tools/sdk/esp32/include/tcp_transport/include/esp_transport_ssl.h index d23a725c23a..b31e5b4495a 100644 --- a/tools/sdk/esp32/include/tcp_transport/include/esp_transport_ssl.h +++ b/tools/sdk/esp32/include/tcp_transport/include/esp_transport_ssl.h @@ -52,6 +52,16 @@ void esp_transport_ssl_set_cert_data(esp_transport_handle_t t, const char *data, */ void esp_transport_ssl_set_cert_data_der(esp_transport_handle_t t, const char *data, int len); +/** + * @brief Enable the use of certification bundle for server verfication for + * an SSL connection. + * It must be first enabled in menuconfig. + * + * @param t ssl transport + * @param[in] crt_bundle_attach Function pointer to esp_crt_bundle_attach + */ +void esp_transport_ssl_crt_bundle_attach(esp_transport_handle_t t, esp_err_t ((*crt_bundle_attach)(void *conf))); + /** * @brief Enable global CA store for SSL connection * @@ -141,14 +151,12 @@ void esp_transport_ssl_skip_common_name_check(esp_transport_handle_t t); */ void esp_transport_ssl_use_secure_element(esp_transport_handle_t t); - /** * @brief Set the ds_data handle in ssl context.(used for the digital signature operation) * * @param t ssl transport * ds_data the handle for ds data params */ - void esp_transport_ssl_set_ds_data(esp_transport_handle_t t, void *ds_data); /** diff --git a/tools/sdk/esp32/ld/esp32.project.ld b/tools/sdk/esp32/ld/esp32.project.ld index e85c3f547b8..c2e369ef443 100644 --- a/tools/sdk/esp32/ld/esp32.project.ld +++ b/tools/sdk/esp32/ld/esp32.project.ld @@ -1,6 +1,6 @@ /* Automatically generated file; DO NOT EDIT */ /* Espressif IoT Development Framework Linker Script */ -/* Generated from: /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp32/ld/esp32.project.ld.in */ +/* Generated from: /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/ld/esp32.project.ld.in */ /* Default entry point: */ ENTRY(call_start_cpu0); @@ -314,15 +314,10 @@ SECTIONS *libesp_hw_support.a:rtc_wdt.*(.literal .literal.* .text .text.*) *libesp_ringbuf.a:(.literal .literal.* .text .text.*) *libesp_system.a:esp_err.*(.literal .literal.* .text .text.*) - *libesp_system.a:panic.*(.literal .literal.* .text .text.*) - *libesp_system.a:panic_arch.*(.literal .literal.* .text .text.*) - *libesp_system.a:panic_handler.*(.literal .literal.* .text .text.*) - *libesp_system.a:reset_reason.*(.literal .literal.* .text .text.*) - *libesp_system.a:system_api.*(.literal.esp_system_abort .text.esp_system_abort) + *libesp_system.a:esp_system.*(.literal.esp_system_abort .text.esp_system_abort) *libfreertos.a:(EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .literal EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .literal.* EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .text EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .text.*) *libfreertos.a:port.*(.literal.pxPortInitialiseStack .literal.unlikely.vPortEndScheduler .literal.vApplicationStackOverflowHook .literal.vPortAssertIfInISR .literal.vPortEnterCritical .literal.vPortExitCritical .literal.vPortReleaseTaskMPUSettings .literal.vPortSetStackWatchpoint .literal.vPortYieldOtherCore .literal.xPortInIsrContext .literal.xPortStartScheduler .literal.xPortSysTickHandler .text .text.pxPortInitialiseStack .text.unlikely.vPortEndScheduler .text.vApplicationStackOverflowHook .text.vPortAssertIfInISR .text.vPortEnterCritical .text.vPortExitCritical .text.vPortReleaseTaskMPUSettings .text.vPortSetStackWatchpoint .text.vPortStoreTaskMPUSettings .text.vPortYieldOtherCore .text.xPortGetTickRateHz .text.xPortInIsrContext .text.xPortStartScheduler .text.xPortSysTickHandler) *libfreertos.a:port_common.*(.literal.esp_startup_start_app_common .text .text.esp_startup_start_app_common) - *libgcc.a:_divsf3.*(.literal .literal.* .text .text.*) *libgcc.a:lib2funcs.*(.literal .literal.* .text .text.*) *libgcov.a:(.literal .literal.* .text .text.*) *libhal.a:cpu_hal.*(.literal .literal.* .text .text.*) @@ -518,11 +513,6 @@ SECTIONS *libc.a:lock.*(.rodata .rodata.*) *libesp_hw_support.a:rtc_clk.*(.rodata .rodata.*) *libesp_system.a:esp_err.*(.rodata .rodata.*) - *libesp_system.a:panic.*(.rodata .rodata.*) - *libesp_system.a:panic_arch.*(.rodata .rodata.*) - *libesp_system.a:panic_handler.*(.rodata .rodata.*) - *libesp_system.a:reset_reason.*(.rodata .rodata.*) - *libgcc.a:_divsf3.*(.rodata .rodata.*) *libgcov.a:(.rodata .rodata.*) *libhal.a:cpu_hal.*(.rodata .rodata.*) *libhal.a:i2c_hal_iram.*(.rodata .rodata.*) @@ -587,8 +577,8 @@ SECTIONS _bss_start = ABSOLUTE(.); *(.bss .bss.*) - *(.ext_ram.bss .ext_ram.bss.*) *(.dynbss .dynsbss .gnu.linkonce.b .gnu.linkonce.b.* .gnu.linkonce.sb .gnu.linkonce.sb.* .gnu.linkonce.sb2 .gnu.linkonce.sb2.* .sbss .sbss.* .sbss2 .sbss2.* .scommon .share.mem) + *(.ext_ram.bss .ext_ram.bss.*) *(COMMON) _bt_bss_start = ABSOLUTE(.); *libbt.a:(.bss .bss.* COMMON) @@ -618,7 +608,7 @@ SECTIONS *(.rodata_desc .rodata_desc.*) /* Should be the first. App version info. DO NOT PUT ANYTHING BEFORE IT! */ *(.rodata_custom_desc .rodata_custom_desc.*) /* Should be the second. Custom app version info. DO NOT PUT ANYTHING BEFORE IT! */ - *(EXCLUDE_FILE(*libgcov.a *libphy.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libc.a:creat.* *libc.a:isatty.* *libc.a:lib_a-abs.* *libc.a:lib_a-asctime.* *libc.a:lib_a-asctime_r.* *libc.a:lib_a-atoi.* *libc.a:lib_a-atol.* *libc.a:lib_a-bzero.* *libc.a:lib_a-close.* *libc.a:lib_a-creat.* *libc.a:lib_a-ctime.* *libc.a:lib_a-ctime_r.* *libc.a:lib_a-ctype_.* *libc.a:lib_a-div.* *libc.a:lib_a-environ.* *libc.a:lib_a-envlock.* *libc.a:lib_a-fclose.* *libc.a:lib_a-fflush.* *libc.a:lib_a-findfp.* *libc.a:lib_a-fputwc.* *libc.a:lib_a-fvwrite.* *libc.a:lib_a-fwalk.* *libc.a:lib_a-getenv_r.* *libc.a:lib_a-gettzinfo.* *libc.a:lib_a-gmtime.* *libc.a:lib_a-gmtime_r.* *libc.a:lib_a-impure.* *libc.a:lib_a-isalnum.* *libc.a:lib_a-isalpha.* *libc.a:lib_a-isascii.* *libc.a:lib_a-isblank.* *libc.a:lib_a-iscntrl.* *libc.a:lib_a-isdigit.* *libc.a:lib_a-isgraph.* *libc.a:lib_a-islower.* *libc.a:lib_a-isprint.* *libc.a:lib_a-ispunct.* *libc.a:lib_a-isspace.* *libc.a:lib_a-isupper.* *libc.a:lib_a-itoa.* *libc.a:lib_a-labs.* *libc.a:lib_a-lcltime.* *libc.a:lib_a-lcltime_r.* *libc.a:lib_a-ldiv.* *libc.a:lib_a-longjmp.* *libc.a:lib_a-makebuf.* *libc.a:lib_a-memccpy.* *libc.a:lib_a-memchr.* *libc.a:lib_a-memcmp.* *libc.a:lib_a-memcpy.* *libc.a:lib_a-memmove.* *libc.a:lib_a-memrchr.* *libc.a:lib_a-memset.* *libc.a:lib_a-mktime.* *libc.a:lib_a-month_lengths.* *libc.a:lib_a-open.* *libc.a:lib_a-quorem.* *libc.a:lib_a-raise.* *libc.a:lib_a-rand.* *libc.a:lib_a-rand_r.* *libc.a:lib_a-read.* *libc.a:lib_a-refill.* *libc.a:lib_a-rshift.* *libc.a:lib_a-s_fpclassify.* *libc.a:lib_a-sbrk.* *libc.a:lib_a-sccl.* *libc.a:lib_a-setjmp.* *libc.a:lib_a-sf_nan.* *libc.a:lib_a-srand.* *libc.a:lib_a-stdio.* *libc.a:lib_a-strcasecmp.* *libc.a:lib_a-strcasestr.* *libc.a:lib_a-strcat.* *libc.a:lib_a-strchr.* *libc.a:lib_a-strcmp.* *libc.a:lib_a-strcoll.* *libc.a:lib_a-strcpy.* *libc.a:lib_a-strcspn.* *libc.a:lib_a-strdup.* *libc.a:lib_a-strdup_r.* *libc.a:lib_a-strftime.* *libc.a:lib_a-strlcat.* *libc.a:lib_a-strlcpy.* *libc.a:lib_a-strlen.* *libc.a:lib_a-strlwr.* *libc.a:lib_a-strncasecmp.* *libc.a:lib_a-strncat.* *libc.a:lib_a-strncmp.* *libc.a:lib_a-strncpy.* *libc.a:lib_a-strndup.* *libc.a:lib_a-strndup_r.* *libc.a:lib_a-strnlen.* *libc.a:lib_a-strptime.* *libc.a:lib_a-strrchr.* *libc.a:lib_a-strsep.* *libc.a:lib_a-strspn.* *libc.a:lib_a-strstr.* *libc.a:lib_a-strtok_r.* *libc.a:lib_a-strtol.* *libc.a:lib_a-strtoul.* *libc.a:lib_a-strupr.* *libc.a:lib_a-sysclose.* *libc.a:lib_a-sysopen.* *libc.a:lib_a-sysread.* *libc.a:lib_a-syssbrk.* *libc.a:lib_a-system.* *libc.a:lib_a-systimes.* *libc.a:lib_a-syswrite.* *libc.a:lib_a-time.* *libc.a:lib_a-timelocal.* *libc.a:lib_a-toascii.* *libc.a:lib_a-tolower.* *libc.a:lib_a-toupper.* *libc.a:lib_a-tzcalc_limits.* *libc.a:lib_a-tzlock.* *libc.a:lib_a-tzset.* *libc.a:lib_a-tzset_r.* *libc.a:lib_a-tzvars.* *libc.a:lib_a-ungetc.* *libc.a:lib_a-utoa.* *libc.a:lib_a-wbuf.* *libc.a:lib_a-wcrtomb.* *libc.a:lib_a-wctomb_r.* *libc.a:lib_a-wsetup.* *libc.a:lock.* *libesp_hw_support.a:rtc_clk.* *libesp_system.a:esp_err.* *libesp_system.a:panic.* *libesp_system.a:panic_arch.* *libesp_system.a:panic_handler.* *libesp_system.a:reset_reason.* *libgcc.a:_divsf3.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.*) .rodata EXCLUDE_FILE(*libgcov.a *libphy.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libc.a:creat.* *libc.a:isatty.* *libc.a:lib_a-abs.* *libc.a:lib_a-asctime.* *libc.a:lib_a-asctime_r.* *libc.a:lib_a-atoi.* *libc.a:lib_a-atol.* *libc.a:lib_a-bzero.* *libc.a:lib_a-close.* *libc.a:lib_a-creat.* *libc.a:lib_a-ctime.* *libc.a:lib_a-ctime_r.* *libc.a:lib_a-ctype_.* *libc.a:lib_a-div.* *libc.a:lib_a-environ.* *libc.a:lib_a-envlock.* *libc.a:lib_a-fclose.* *libc.a:lib_a-fflush.* *libc.a:lib_a-findfp.* *libc.a:lib_a-fputwc.* *libc.a:lib_a-fvwrite.* *libc.a:lib_a-fwalk.* *libc.a:lib_a-getenv_r.* *libc.a:lib_a-gettzinfo.* *libc.a:lib_a-gmtime.* *libc.a:lib_a-gmtime_r.* *libc.a:lib_a-impure.* *libc.a:lib_a-isalnum.* *libc.a:lib_a-isalpha.* *libc.a:lib_a-isascii.* *libc.a:lib_a-isblank.* *libc.a:lib_a-iscntrl.* *libc.a:lib_a-isdigit.* *libc.a:lib_a-isgraph.* *libc.a:lib_a-islower.* *libc.a:lib_a-isprint.* *libc.a:lib_a-ispunct.* *libc.a:lib_a-isspace.* *libc.a:lib_a-isupper.* *libc.a:lib_a-itoa.* *libc.a:lib_a-labs.* *libc.a:lib_a-lcltime.* *libc.a:lib_a-lcltime_r.* *libc.a:lib_a-ldiv.* *libc.a:lib_a-longjmp.* *libc.a:lib_a-makebuf.* *libc.a:lib_a-memccpy.* *libc.a:lib_a-memchr.* *libc.a:lib_a-memcmp.* *libc.a:lib_a-memcpy.* *libc.a:lib_a-memmove.* *libc.a:lib_a-memrchr.* *libc.a:lib_a-memset.* *libc.a:lib_a-mktime.* *libc.a:lib_a-month_lengths.* *libc.a:lib_a-open.* *libc.a:lib_a-quorem.* *libc.a:lib_a-raise.* *libc.a:lib_a-rand.* *libc.a:lib_a-rand_r.* *libc.a:lib_a-read.* *libc.a:lib_a-refill.* *libc.a:lib_a-rshift.* *libc.a:lib_a-s_fpclassify.* *libc.a:lib_a-sbrk.* *libc.a:lib_a-sccl.* *libc.a:lib_a-setjmp.* *libc.a:lib_a-sf_nan.* *libc.a:lib_a-srand.* *libc.a:lib_a-stdio.* *libc.a:lib_a-strcasecmp.* *libc.a:lib_a-strcasestr.* *libc.a:lib_a-strcat.* *libc.a:lib_a-strchr.* *libc.a:lib_a-strcmp.* *libc.a:lib_a-strcoll.* *libc.a:lib_a-strcpy.* *libc.a:lib_a-strcspn.* *libc.a:lib_a-strdup.* *libc.a:lib_a-strdup_r.* *libc.a:lib_a-strftime.* *libc.a:lib_a-strlcat.* *libc.a:lib_a-strlcpy.* *libc.a:lib_a-strlen.* *libc.a:lib_a-strlwr.* *libc.a:lib_a-strncasecmp.* *libc.a:lib_a-strncat.* *libc.a:lib_a-strncmp.* *libc.a:lib_a-strncpy.* *libc.a:lib_a-strndup.* *libc.a:lib_a-strndup_r.* *libc.a:lib_a-strnlen.* *libc.a:lib_a-strptime.* *libc.a:lib_a-strrchr.* *libc.a:lib_a-strsep.* *libc.a:lib_a-strspn.* *libc.a:lib_a-strstr.* *libc.a:lib_a-strtok_r.* *libc.a:lib_a-strtol.* *libc.a:lib_a-strtoul.* *libc.a:lib_a-strupr.* *libc.a:lib_a-sysclose.* *libc.a:lib_a-sysopen.* *libc.a:lib_a-sysread.* *libc.a:lib_a-syssbrk.* *libc.a:lib_a-system.* *libc.a:lib_a-systimes.* *libc.a:lib_a-syswrite.* *libc.a:lib_a-time.* *libc.a:lib_a-timelocal.* *libc.a:lib_a-toascii.* *libc.a:lib_a-tolower.* *libc.a:lib_a-toupper.* *libc.a:lib_a-tzcalc_limits.* *libc.a:lib_a-tzlock.* *libc.a:lib_a-tzset.* *libc.a:lib_a-tzset_r.* *libc.a:lib_a-tzvars.* *libc.a:lib_a-ungetc.* *libc.a:lib_a-utoa.* *libc.a:lib_a-wbuf.* *libc.a:lib_a-wcrtomb.* *libc.a:lib_a-wctomb_r.* *libc.a:lib_a-wsetup.* *libc.a:lock.* *libesp_hw_support.a:rtc_clk.* *libesp_system.a:esp_err.* *libesp_system.a:panic.* *libesp_system.a:panic_arch.* *libesp_system.a:panic_handler.* *libesp_system.a:reset_reason.* *libgcc.a:_divsf3.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.*) .rodata.*) + *(EXCLUDE_FILE(*libgcov.a *libphy.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libc.a:creat.* *libc.a:isatty.* *libc.a:lib_a-abs.* *libc.a:lib_a-asctime.* *libc.a:lib_a-asctime_r.* *libc.a:lib_a-atoi.* *libc.a:lib_a-atol.* *libc.a:lib_a-bzero.* *libc.a:lib_a-close.* *libc.a:lib_a-creat.* *libc.a:lib_a-ctime.* *libc.a:lib_a-ctime_r.* *libc.a:lib_a-ctype_.* *libc.a:lib_a-div.* *libc.a:lib_a-environ.* *libc.a:lib_a-envlock.* *libc.a:lib_a-fclose.* *libc.a:lib_a-fflush.* *libc.a:lib_a-findfp.* *libc.a:lib_a-fputwc.* *libc.a:lib_a-fvwrite.* *libc.a:lib_a-fwalk.* *libc.a:lib_a-getenv_r.* *libc.a:lib_a-gettzinfo.* *libc.a:lib_a-gmtime.* *libc.a:lib_a-gmtime_r.* *libc.a:lib_a-impure.* *libc.a:lib_a-isalnum.* *libc.a:lib_a-isalpha.* *libc.a:lib_a-isascii.* *libc.a:lib_a-isblank.* *libc.a:lib_a-iscntrl.* *libc.a:lib_a-isdigit.* *libc.a:lib_a-isgraph.* *libc.a:lib_a-islower.* *libc.a:lib_a-isprint.* *libc.a:lib_a-ispunct.* *libc.a:lib_a-isspace.* *libc.a:lib_a-isupper.* *libc.a:lib_a-itoa.* *libc.a:lib_a-labs.* *libc.a:lib_a-lcltime.* *libc.a:lib_a-lcltime_r.* *libc.a:lib_a-ldiv.* *libc.a:lib_a-longjmp.* *libc.a:lib_a-makebuf.* *libc.a:lib_a-memccpy.* *libc.a:lib_a-memchr.* *libc.a:lib_a-memcmp.* *libc.a:lib_a-memcpy.* *libc.a:lib_a-memmove.* *libc.a:lib_a-memrchr.* *libc.a:lib_a-memset.* *libc.a:lib_a-mktime.* *libc.a:lib_a-month_lengths.* *libc.a:lib_a-open.* *libc.a:lib_a-quorem.* *libc.a:lib_a-raise.* *libc.a:lib_a-rand.* *libc.a:lib_a-rand_r.* *libc.a:lib_a-read.* *libc.a:lib_a-refill.* *libc.a:lib_a-rshift.* *libc.a:lib_a-s_fpclassify.* *libc.a:lib_a-sbrk.* *libc.a:lib_a-sccl.* *libc.a:lib_a-setjmp.* *libc.a:lib_a-sf_nan.* *libc.a:lib_a-srand.* *libc.a:lib_a-stdio.* *libc.a:lib_a-strcasecmp.* *libc.a:lib_a-strcasestr.* *libc.a:lib_a-strcat.* *libc.a:lib_a-strchr.* *libc.a:lib_a-strcmp.* *libc.a:lib_a-strcoll.* *libc.a:lib_a-strcpy.* *libc.a:lib_a-strcspn.* *libc.a:lib_a-strdup.* *libc.a:lib_a-strdup_r.* *libc.a:lib_a-strftime.* *libc.a:lib_a-strlcat.* *libc.a:lib_a-strlcpy.* *libc.a:lib_a-strlen.* *libc.a:lib_a-strlwr.* *libc.a:lib_a-strncasecmp.* *libc.a:lib_a-strncat.* *libc.a:lib_a-strncmp.* *libc.a:lib_a-strncpy.* *libc.a:lib_a-strndup.* *libc.a:lib_a-strndup_r.* *libc.a:lib_a-strnlen.* *libc.a:lib_a-strptime.* *libc.a:lib_a-strrchr.* *libc.a:lib_a-strsep.* *libc.a:lib_a-strspn.* *libc.a:lib_a-strstr.* *libc.a:lib_a-strtok_r.* *libc.a:lib_a-strtol.* *libc.a:lib_a-strtoul.* *libc.a:lib_a-strupr.* *libc.a:lib_a-sysclose.* *libc.a:lib_a-sysopen.* *libc.a:lib_a-sysread.* *libc.a:lib_a-syssbrk.* *libc.a:lib_a-system.* *libc.a:lib_a-systimes.* *libc.a:lib_a-syswrite.* *libc.a:lib_a-time.* *libc.a:lib_a-timelocal.* *libc.a:lib_a-toascii.* *libc.a:lib_a-tolower.* *libc.a:lib_a-toupper.* *libc.a:lib_a-tzcalc_limits.* *libc.a:lib_a-tzlock.* *libc.a:lib_a-tzset.* *libc.a:lib_a-tzset_r.* *libc.a:lib_a-tzvars.* *libc.a:lib_a-ungetc.* *libc.a:lib_a-utoa.* *libc.a:lib_a-wbuf.* *libc.a:lib_a-wcrtomb.* *libc.a:lib_a-wctomb_r.* *libc.a:lib_a-wsetup.* *libc.a:lock.* *libesp_hw_support.a:rtc_clk.* *libesp_system.a:esp_err.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.*) .rodata EXCLUDE_FILE(*libgcov.a *libphy.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libc.a:creat.* *libc.a:isatty.* *libc.a:lib_a-abs.* *libc.a:lib_a-asctime.* *libc.a:lib_a-asctime_r.* *libc.a:lib_a-atoi.* *libc.a:lib_a-atol.* *libc.a:lib_a-bzero.* *libc.a:lib_a-close.* *libc.a:lib_a-creat.* *libc.a:lib_a-ctime.* *libc.a:lib_a-ctime_r.* *libc.a:lib_a-ctype_.* *libc.a:lib_a-div.* *libc.a:lib_a-environ.* *libc.a:lib_a-envlock.* *libc.a:lib_a-fclose.* *libc.a:lib_a-fflush.* *libc.a:lib_a-findfp.* *libc.a:lib_a-fputwc.* *libc.a:lib_a-fvwrite.* *libc.a:lib_a-fwalk.* *libc.a:lib_a-getenv_r.* *libc.a:lib_a-gettzinfo.* *libc.a:lib_a-gmtime.* *libc.a:lib_a-gmtime_r.* *libc.a:lib_a-impure.* *libc.a:lib_a-isalnum.* *libc.a:lib_a-isalpha.* *libc.a:lib_a-isascii.* *libc.a:lib_a-isblank.* *libc.a:lib_a-iscntrl.* *libc.a:lib_a-isdigit.* *libc.a:lib_a-isgraph.* *libc.a:lib_a-islower.* *libc.a:lib_a-isprint.* *libc.a:lib_a-ispunct.* *libc.a:lib_a-isspace.* *libc.a:lib_a-isupper.* *libc.a:lib_a-itoa.* *libc.a:lib_a-labs.* *libc.a:lib_a-lcltime.* *libc.a:lib_a-lcltime_r.* *libc.a:lib_a-ldiv.* *libc.a:lib_a-longjmp.* *libc.a:lib_a-makebuf.* *libc.a:lib_a-memccpy.* *libc.a:lib_a-memchr.* *libc.a:lib_a-memcmp.* *libc.a:lib_a-memcpy.* *libc.a:lib_a-memmove.* *libc.a:lib_a-memrchr.* *libc.a:lib_a-memset.* *libc.a:lib_a-mktime.* *libc.a:lib_a-month_lengths.* *libc.a:lib_a-open.* *libc.a:lib_a-quorem.* *libc.a:lib_a-raise.* *libc.a:lib_a-rand.* *libc.a:lib_a-rand_r.* *libc.a:lib_a-read.* *libc.a:lib_a-refill.* *libc.a:lib_a-rshift.* *libc.a:lib_a-s_fpclassify.* *libc.a:lib_a-sbrk.* *libc.a:lib_a-sccl.* *libc.a:lib_a-setjmp.* *libc.a:lib_a-sf_nan.* *libc.a:lib_a-srand.* *libc.a:lib_a-stdio.* *libc.a:lib_a-strcasecmp.* *libc.a:lib_a-strcasestr.* *libc.a:lib_a-strcat.* *libc.a:lib_a-strchr.* *libc.a:lib_a-strcmp.* *libc.a:lib_a-strcoll.* *libc.a:lib_a-strcpy.* *libc.a:lib_a-strcspn.* *libc.a:lib_a-strdup.* *libc.a:lib_a-strdup_r.* *libc.a:lib_a-strftime.* *libc.a:lib_a-strlcat.* *libc.a:lib_a-strlcpy.* *libc.a:lib_a-strlen.* *libc.a:lib_a-strlwr.* *libc.a:lib_a-strncasecmp.* *libc.a:lib_a-strncat.* *libc.a:lib_a-strncmp.* *libc.a:lib_a-strncpy.* *libc.a:lib_a-strndup.* *libc.a:lib_a-strndup_r.* *libc.a:lib_a-strnlen.* *libc.a:lib_a-strptime.* *libc.a:lib_a-strrchr.* *libc.a:lib_a-strsep.* *libc.a:lib_a-strspn.* *libc.a:lib_a-strstr.* *libc.a:lib_a-strtok_r.* *libc.a:lib_a-strtol.* *libc.a:lib_a-strtoul.* *libc.a:lib_a-strupr.* *libc.a:lib_a-sysclose.* *libc.a:lib_a-sysopen.* *libc.a:lib_a-sysread.* *libc.a:lib_a-syssbrk.* *libc.a:lib_a-system.* *libc.a:lib_a-systimes.* *libc.a:lib_a-syswrite.* *libc.a:lib_a-time.* *libc.a:lib_a-timelocal.* *libc.a:lib_a-toascii.* *libc.a:lib_a-tolower.* *libc.a:lib_a-toupper.* *libc.a:lib_a-tzcalc_limits.* *libc.a:lib_a-tzlock.* *libc.a:lib_a-tzset.* *libc.a:lib_a-tzset_r.* *libc.a:lib_a-tzvars.* *libc.a:lib_a-ungetc.* *libc.a:lib_a-utoa.* *libc.a:lib_a-wbuf.* *libc.a:lib_a-wcrtomb.* *libc.a:lib_a-wctomb_r.* *libc.a:lib_a-wsetup.* *libc.a:lock.* *libesp_hw_support.a:rtc_clk.* *libesp_system.a:esp_err.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.*) .rodata.*) *(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */ @@ -680,7 +670,7 @@ SECTIONS _stext = .; _text_start = ABSOLUTE(.); - *(EXCLUDE_FILE(*libesp_ringbuf.a *libfreertos.a *libgcov.a *librtc.a *libxt_hal.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libc.a:creat.* *libc.a:isatty.* *libc.a:lib_a-abs.* *libc.a:lib_a-asctime.* *libc.a:lib_a-asctime_r.* *libc.a:lib_a-atoi.* *libc.a:lib_a-atol.* *libc.a:lib_a-bzero.* *libc.a:lib_a-close.* *libc.a:lib_a-creat.* *libc.a:lib_a-ctime.* *libc.a:lib_a-ctime_r.* *libc.a:lib_a-ctype_.* *libc.a:lib_a-div.* *libc.a:lib_a-environ.* *libc.a:lib_a-envlock.* *libc.a:lib_a-fclose.* *libc.a:lib_a-fflush.* *libc.a:lib_a-findfp.* *libc.a:lib_a-fputwc.* *libc.a:lib_a-fvwrite.* *libc.a:lib_a-fwalk.* *libc.a:lib_a-getenv_r.* *libc.a:lib_a-gettzinfo.* *libc.a:lib_a-gmtime.* *libc.a:lib_a-gmtime_r.* *libc.a:lib_a-impure.* *libc.a:lib_a-isalnum.* *libc.a:lib_a-isalpha.* *libc.a:lib_a-isascii.* *libc.a:lib_a-isblank.* *libc.a:lib_a-iscntrl.* *libc.a:lib_a-isdigit.* *libc.a:lib_a-isgraph.* *libc.a:lib_a-islower.* *libc.a:lib_a-isprint.* *libc.a:lib_a-ispunct.* *libc.a:lib_a-isspace.* *libc.a:lib_a-isupper.* *libc.a:lib_a-itoa.* *libc.a:lib_a-labs.* *libc.a:lib_a-lcltime.* *libc.a:lib_a-lcltime_r.* *libc.a:lib_a-ldiv.* *libc.a:lib_a-longjmp.* *libc.a:lib_a-makebuf.* *libc.a:lib_a-memccpy.* *libc.a:lib_a-memchr.* *libc.a:lib_a-memcmp.* *libc.a:lib_a-memcpy.* *libc.a:lib_a-memmove.* *libc.a:lib_a-memrchr.* *libc.a:lib_a-memset.* *libc.a:lib_a-mktime.* *libc.a:lib_a-month_lengths.* *libc.a:lib_a-open.* *libc.a:lib_a-quorem.* *libc.a:lib_a-raise.* *libc.a:lib_a-rand.* *libc.a:lib_a-rand_r.* *libc.a:lib_a-read.* *libc.a:lib_a-refill.* *libc.a:lib_a-rshift.* *libc.a:lib_a-s_fpclassify.* *libc.a:lib_a-sbrk.* *libc.a:lib_a-sccl.* *libc.a:lib_a-setjmp.* *libc.a:lib_a-sf_nan.* *libc.a:lib_a-srand.* *libc.a:lib_a-stdio.* *libc.a:lib_a-strcasecmp.* *libc.a:lib_a-strcasestr.* *libc.a:lib_a-strcat.* *libc.a:lib_a-strchr.* *libc.a:lib_a-strcmp.* *libc.a:lib_a-strcoll.* *libc.a:lib_a-strcpy.* *libc.a:lib_a-strcspn.* *libc.a:lib_a-strdup.* *libc.a:lib_a-strdup_r.* *libc.a:lib_a-strftime.* *libc.a:lib_a-strlcat.* *libc.a:lib_a-strlcpy.* *libc.a:lib_a-strlen.* *libc.a:lib_a-strlwr.* *libc.a:lib_a-strncasecmp.* *libc.a:lib_a-strncat.* *libc.a:lib_a-strncmp.* *libc.a:lib_a-strncpy.* *libc.a:lib_a-strndup.* *libc.a:lib_a-strndup_r.* *libc.a:lib_a-strnlen.* *libc.a:lib_a-strptime.* *libc.a:lib_a-strrchr.* *libc.a:lib_a-strsep.* *libc.a:lib_a-strspn.* *libc.a:lib_a-strstr.* *libc.a:lib_a-strtok_r.* *libc.a:lib_a-strtol.* *libc.a:lib_a-strtoul.* *libc.a:lib_a-strupr.* *libc.a:lib_a-sysclose.* *libc.a:lib_a-sysopen.* *libc.a:lib_a-sysread.* *libc.a:lib_a-syssbrk.* *libc.a:lib_a-system.* *libc.a:lib_a-systimes.* *libc.a:lib_a-syswrite.* *libc.a:lib_a-time.* *libc.a:lib_a-timelocal.* *libc.a:lib_a-toascii.* *libc.a:lib_a-tolower.* *libc.a:lib_a-toupper.* *libc.a:lib_a-tzcalc_limits.* *libc.a:lib_a-tzlock.* *libc.a:lib_a-tzset.* *libc.a:lib_a-tzset_r.* *libc.a:lib_a-tzvars.* *libc.a:lib_a-ungetc.* *libc.a:lib_a-utoa.* *libc.a:lib_a-wbuf.* *libc.a:lib_a-wcrtomb.* *libc.a:lib_a-wctomb_r.* *libc.a:lib_a-wsetup.* *libc.a:lock.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_wdt.* *libesp_system.a:esp_err.* *libesp_system.a:panic.* *libesp_system.a:panic_arch.* *libesp_system.a:panic_handler.* *libesp_system.a:reset_reason.* *libesp_system.a:system_api.* *libgcc.a:_divsf3.* *libgcc.a:lib2funcs.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *liblog.a:log.* *liblog.a:log_freertos.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.* *libxtensa.a:eri.*) .literal EXCLUDE_FILE(*libesp_ringbuf.a *libfreertos.a *libgcov.a *librtc.a *libxt_hal.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libc.a:creat.* *libc.a:isatty.* *libc.a:lib_a-abs.* *libc.a:lib_a-asctime.* *libc.a:lib_a-asctime_r.* *libc.a:lib_a-atoi.* *libc.a:lib_a-atol.* *libc.a:lib_a-bzero.* *libc.a:lib_a-close.* *libc.a:lib_a-creat.* *libc.a:lib_a-ctime.* *libc.a:lib_a-ctime_r.* *libc.a:lib_a-ctype_.* *libc.a:lib_a-div.* *libc.a:lib_a-environ.* *libc.a:lib_a-envlock.* *libc.a:lib_a-fclose.* *libc.a:lib_a-fflush.* *libc.a:lib_a-findfp.* *libc.a:lib_a-fputwc.* *libc.a:lib_a-fvwrite.* *libc.a:lib_a-fwalk.* *libc.a:lib_a-getenv_r.* *libc.a:lib_a-gettzinfo.* *libc.a:lib_a-gmtime.* *libc.a:lib_a-gmtime_r.* *libc.a:lib_a-impure.* *libc.a:lib_a-isalnum.* *libc.a:lib_a-isalpha.* *libc.a:lib_a-isascii.* *libc.a:lib_a-isblank.* *libc.a:lib_a-iscntrl.* *libc.a:lib_a-isdigit.* *libc.a:lib_a-isgraph.* *libc.a:lib_a-islower.* *libc.a:lib_a-isprint.* *libc.a:lib_a-ispunct.* *libc.a:lib_a-isspace.* *libc.a:lib_a-isupper.* *libc.a:lib_a-itoa.* *libc.a:lib_a-labs.* *libc.a:lib_a-lcltime.* *libc.a:lib_a-lcltime_r.* *libc.a:lib_a-ldiv.* *libc.a:lib_a-longjmp.* *libc.a:lib_a-makebuf.* *libc.a:lib_a-memccpy.* *libc.a:lib_a-memchr.* *libc.a:lib_a-memcmp.* *libc.a:lib_a-memcpy.* *libc.a:lib_a-memmove.* *libc.a:lib_a-memrchr.* *libc.a:lib_a-memset.* *libc.a:lib_a-mktime.* *libc.a:lib_a-month_lengths.* *libc.a:lib_a-open.* *libc.a:lib_a-quorem.* *libc.a:lib_a-raise.* *libc.a:lib_a-rand.* *libc.a:lib_a-rand_r.* *libc.a:lib_a-read.* *libc.a:lib_a-refill.* *libc.a:lib_a-rshift.* *libc.a:lib_a-s_fpclassify.* *libc.a:lib_a-sbrk.* *libc.a:lib_a-sccl.* *libc.a:lib_a-setjmp.* *libc.a:lib_a-sf_nan.* *libc.a:lib_a-srand.* *libc.a:lib_a-stdio.* *libc.a:lib_a-strcasecmp.* *libc.a:lib_a-strcasestr.* *libc.a:lib_a-strcat.* *libc.a:lib_a-strchr.* *libc.a:lib_a-strcmp.* *libc.a:lib_a-strcoll.* *libc.a:lib_a-strcpy.* *libc.a:lib_a-strcspn.* *libc.a:lib_a-strdup.* *libc.a:lib_a-strdup_r.* *libc.a:lib_a-strftime.* *libc.a:lib_a-strlcat.* *libc.a:lib_a-strlcpy.* *libc.a:lib_a-strlen.* *libc.a:lib_a-strlwr.* *libc.a:lib_a-strncasecmp.* *libc.a:lib_a-strncat.* *libc.a:lib_a-strncmp.* *libc.a:lib_a-strncpy.* *libc.a:lib_a-strndup.* *libc.a:lib_a-strndup_r.* *libc.a:lib_a-strnlen.* *libc.a:lib_a-strptime.* *libc.a:lib_a-strrchr.* *libc.a:lib_a-strsep.* *libc.a:lib_a-strspn.* *libc.a:lib_a-strstr.* *libc.a:lib_a-strtok_r.* *libc.a:lib_a-strtol.* *libc.a:lib_a-strtoul.* *libc.a:lib_a-strupr.* *libc.a:lib_a-sysclose.* *libc.a:lib_a-sysopen.* *libc.a:lib_a-sysread.* *libc.a:lib_a-syssbrk.* *libc.a:lib_a-system.* *libc.a:lib_a-systimes.* *libc.a:lib_a-syswrite.* *libc.a:lib_a-time.* *libc.a:lib_a-timelocal.* *libc.a:lib_a-toascii.* *libc.a:lib_a-tolower.* *libc.a:lib_a-toupper.* *libc.a:lib_a-tzcalc_limits.* *libc.a:lib_a-tzlock.* *libc.a:lib_a-tzset.* *libc.a:lib_a-tzset_r.* *libc.a:lib_a-tzvars.* *libc.a:lib_a-ungetc.* *libc.a:lib_a-utoa.* *libc.a:lib_a-wbuf.* *libc.a:lib_a-wcrtomb.* *libc.a:lib_a-wctomb_r.* *libc.a:lib_a-wsetup.* *libc.a:lock.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_wdt.* *libesp_system.a:esp_err.* *libesp_system.a:panic.* *libesp_system.a:panic_arch.* *libesp_system.a:panic_handler.* *libesp_system.a:reset_reason.* *libesp_system.a:system_api.* *libgcc.a:_divsf3.* *libgcc.a:lib2funcs.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *liblog.a:log.* *liblog.a:log_freertos.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.* *libxtensa.a:eri.*) .literal.* EXCLUDE_FILE(*libesp_ringbuf.a *libfreertos.a *libgcov.a *librtc.a *libxt_hal.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libc.a:creat.* *libc.a:isatty.* *libc.a:lib_a-abs.* *libc.a:lib_a-asctime.* *libc.a:lib_a-asctime_r.* *libc.a:lib_a-atoi.* *libc.a:lib_a-atol.* *libc.a:lib_a-bzero.* *libc.a:lib_a-close.* *libc.a:lib_a-creat.* *libc.a:lib_a-ctime.* *libc.a:lib_a-ctime_r.* *libc.a:lib_a-ctype_.* *libc.a:lib_a-div.* *libc.a:lib_a-environ.* *libc.a:lib_a-envlock.* *libc.a:lib_a-fclose.* *libc.a:lib_a-fflush.* *libc.a:lib_a-findfp.* *libc.a:lib_a-fputwc.* *libc.a:lib_a-fvwrite.* *libc.a:lib_a-fwalk.* *libc.a:lib_a-getenv_r.* *libc.a:lib_a-gettzinfo.* *libc.a:lib_a-gmtime.* *libc.a:lib_a-gmtime_r.* *libc.a:lib_a-impure.* *libc.a:lib_a-isalnum.* *libc.a:lib_a-isalpha.* *libc.a:lib_a-isascii.* *libc.a:lib_a-isblank.* *libc.a:lib_a-iscntrl.* *libc.a:lib_a-isdigit.* *libc.a:lib_a-isgraph.* *libc.a:lib_a-islower.* *libc.a:lib_a-isprint.* *libc.a:lib_a-ispunct.* *libc.a:lib_a-isspace.* *libc.a:lib_a-isupper.* *libc.a:lib_a-itoa.* *libc.a:lib_a-labs.* *libc.a:lib_a-lcltime.* *libc.a:lib_a-lcltime_r.* *libc.a:lib_a-ldiv.* *libc.a:lib_a-longjmp.* *libc.a:lib_a-makebuf.* *libc.a:lib_a-memccpy.* *libc.a:lib_a-memchr.* *libc.a:lib_a-memcmp.* *libc.a:lib_a-memcpy.* *libc.a:lib_a-memmove.* *libc.a:lib_a-memrchr.* *libc.a:lib_a-memset.* *libc.a:lib_a-mktime.* *libc.a:lib_a-month_lengths.* *libc.a:lib_a-open.* *libc.a:lib_a-quorem.* *libc.a:lib_a-raise.* *libc.a:lib_a-rand.* *libc.a:lib_a-rand_r.* *libc.a:lib_a-read.* *libc.a:lib_a-refill.* *libc.a:lib_a-rshift.* *libc.a:lib_a-s_fpclassify.* *libc.a:lib_a-sbrk.* *libc.a:lib_a-sccl.* *libc.a:lib_a-setjmp.* *libc.a:lib_a-sf_nan.* *libc.a:lib_a-srand.* *libc.a:lib_a-stdio.* *libc.a:lib_a-strcasecmp.* *libc.a:lib_a-strcasestr.* *libc.a:lib_a-strcat.* *libc.a:lib_a-strchr.* *libc.a:lib_a-strcmp.* *libc.a:lib_a-strcoll.* *libc.a:lib_a-strcpy.* *libc.a:lib_a-strcspn.* *libc.a:lib_a-strdup.* *libc.a:lib_a-strdup_r.* *libc.a:lib_a-strftime.* *libc.a:lib_a-strlcat.* *libc.a:lib_a-strlcpy.* *libc.a:lib_a-strlen.* *libc.a:lib_a-strlwr.* *libc.a:lib_a-strncasecmp.* *libc.a:lib_a-strncat.* *libc.a:lib_a-strncmp.* *libc.a:lib_a-strncpy.* *libc.a:lib_a-strndup.* *libc.a:lib_a-strndup_r.* *libc.a:lib_a-strnlen.* *libc.a:lib_a-strptime.* *libc.a:lib_a-strrchr.* *libc.a:lib_a-strsep.* *libc.a:lib_a-strspn.* *libc.a:lib_a-strstr.* *libc.a:lib_a-strtok_r.* *libc.a:lib_a-strtol.* *libc.a:lib_a-strtoul.* *libc.a:lib_a-strupr.* *libc.a:lib_a-sysclose.* *libc.a:lib_a-sysopen.* *libc.a:lib_a-sysread.* *libc.a:lib_a-syssbrk.* *libc.a:lib_a-system.* *libc.a:lib_a-systimes.* *libc.a:lib_a-syswrite.* *libc.a:lib_a-time.* *libc.a:lib_a-timelocal.* *libc.a:lib_a-toascii.* *libc.a:lib_a-tolower.* *libc.a:lib_a-toupper.* *libc.a:lib_a-tzcalc_limits.* *libc.a:lib_a-tzlock.* *libc.a:lib_a-tzset.* *libc.a:lib_a-tzset_r.* *libc.a:lib_a-tzvars.* *libc.a:lib_a-ungetc.* *libc.a:lib_a-utoa.* *libc.a:lib_a-wbuf.* *libc.a:lib_a-wcrtomb.* *libc.a:lib_a-wctomb_r.* *libc.a:lib_a-wsetup.* *libc.a:lock.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_wdt.* *libesp_system.a:esp_err.* *libesp_system.a:panic.* *libesp_system.a:panic_arch.* *libesp_system.a:panic_handler.* *libesp_system.a:reset_reason.* *libesp_system.a:system_api.* *libgcc.a:_divsf3.* *libgcc.a:lib2funcs.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *liblog.a:log.* *liblog.a:log_freertos.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.* *libxtensa.a:eri.*) .text EXCLUDE_FILE(*libesp_ringbuf.a *libfreertos.a *libgcov.a *librtc.a *libxt_hal.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libc.a:creat.* *libc.a:isatty.* *libc.a:lib_a-abs.* *libc.a:lib_a-asctime.* *libc.a:lib_a-asctime_r.* *libc.a:lib_a-atoi.* *libc.a:lib_a-atol.* *libc.a:lib_a-bzero.* *libc.a:lib_a-close.* *libc.a:lib_a-creat.* *libc.a:lib_a-ctime.* *libc.a:lib_a-ctime_r.* *libc.a:lib_a-ctype_.* *libc.a:lib_a-div.* *libc.a:lib_a-environ.* *libc.a:lib_a-envlock.* *libc.a:lib_a-fclose.* *libc.a:lib_a-fflush.* *libc.a:lib_a-findfp.* *libc.a:lib_a-fputwc.* *libc.a:lib_a-fvwrite.* *libc.a:lib_a-fwalk.* *libc.a:lib_a-getenv_r.* *libc.a:lib_a-gettzinfo.* *libc.a:lib_a-gmtime.* *libc.a:lib_a-gmtime_r.* *libc.a:lib_a-impure.* *libc.a:lib_a-isalnum.* *libc.a:lib_a-isalpha.* *libc.a:lib_a-isascii.* *libc.a:lib_a-isblank.* *libc.a:lib_a-iscntrl.* *libc.a:lib_a-isdigit.* *libc.a:lib_a-isgraph.* *libc.a:lib_a-islower.* *libc.a:lib_a-isprint.* *libc.a:lib_a-ispunct.* *libc.a:lib_a-isspace.* *libc.a:lib_a-isupper.* *libc.a:lib_a-itoa.* *libc.a:lib_a-labs.* *libc.a:lib_a-lcltime.* *libc.a:lib_a-lcltime_r.* *libc.a:lib_a-ldiv.* *libc.a:lib_a-longjmp.* *libc.a:lib_a-makebuf.* *libc.a:lib_a-memccpy.* *libc.a:lib_a-memchr.* *libc.a:lib_a-memcmp.* *libc.a:lib_a-memcpy.* *libc.a:lib_a-memmove.* *libc.a:lib_a-memrchr.* *libc.a:lib_a-memset.* *libc.a:lib_a-mktime.* *libc.a:lib_a-month_lengths.* *libc.a:lib_a-open.* *libc.a:lib_a-quorem.* *libc.a:lib_a-raise.* *libc.a:lib_a-rand.* *libc.a:lib_a-rand_r.* *libc.a:lib_a-read.* *libc.a:lib_a-refill.* *libc.a:lib_a-rshift.* *libc.a:lib_a-s_fpclassify.* *libc.a:lib_a-sbrk.* *libc.a:lib_a-sccl.* *libc.a:lib_a-setjmp.* *libc.a:lib_a-sf_nan.* *libc.a:lib_a-srand.* *libc.a:lib_a-stdio.* *libc.a:lib_a-strcasecmp.* *libc.a:lib_a-strcasestr.* *libc.a:lib_a-strcat.* *libc.a:lib_a-strchr.* *libc.a:lib_a-strcmp.* *libc.a:lib_a-strcoll.* *libc.a:lib_a-strcpy.* *libc.a:lib_a-strcspn.* *libc.a:lib_a-strdup.* *libc.a:lib_a-strdup_r.* *libc.a:lib_a-strftime.* *libc.a:lib_a-strlcat.* *libc.a:lib_a-strlcpy.* *libc.a:lib_a-strlen.* *libc.a:lib_a-strlwr.* *libc.a:lib_a-strncasecmp.* *libc.a:lib_a-strncat.* *libc.a:lib_a-strncmp.* *libc.a:lib_a-strncpy.* *libc.a:lib_a-strndup.* *libc.a:lib_a-strndup_r.* *libc.a:lib_a-strnlen.* *libc.a:lib_a-strptime.* *libc.a:lib_a-strrchr.* *libc.a:lib_a-strsep.* *libc.a:lib_a-strspn.* *libc.a:lib_a-strstr.* *libc.a:lib_a-strtok_r.* *libc.a:lib_a-strtol.* *libc.a:lib_a-strtoul.* *libc.a:lib_a-strupr.* *libc.a:lib_a-sysclose.* *libc.a:lib_a-sysopen.* *libc.a:lib_a-sysread.* *libc.a:lib_a-syssbrk.* *libc.a:lib_a-system.* *libc.a:lib_a-systimes.* *libc.a:lib_a-syswrite.* *libc.a:lib_a-time.* *libc.a:lib_a-timelocal.* *libc.a:lib_a-toascii.* *libc.a:lib_a-tolower.* *libc.a:lib_a-toupper.* *libc.a:lib_a-tzcalc_limits.* *libc.a:lib_a-tzlock.* *libc.a:lib_a-tzset.* *libc.a:lib_a-tzset_r.* *libc.a:lib_a-tzvars.* *libc.a:lib_a-ungetc.* *libc.a:lib_a-utoa.* *libc.a:lib_a-wbuf.* *libc.a:lib_a-wcrtomb.* *libc.a:lib_a-wctomb_r.* *libc.a:lib_a-wsetup.* *libc.a:lock.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_wdt.* *libesp_system.a:esp_err.* *libesp_system.a:panic.* *libesp_system.a:panic_arch.* *libesp_system.a:panic_handler.* *libesp_system.a:reset_reason.* *libesp_system.a:system_api.* *libgcc.a:_divsf3.* *libgcc.a:lib2funcs.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *liblog.a:log.* *liblog.a:log_freertos.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.* *libxtensa.a:eri.*) .text.*) + *(EXCLUDE_FILE(*libesp_ringbuf.a *libfreertos.a *libgcov.a *librtc.a *libxt_hal.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libc.a:creat.* *libc.a:isatty.* *libc.a:lib_a-abs.* *libc.a:lib_a-asctime.* *libc.a:lib_a-asctime_r.* *libc.a:lib_a-atoi.* *libc.a:lib_a-atol.* *libc.a:lib_a-bzero.* *libc.a:lib_a-close.* *libc.a:lib_a-creat.* *libc.a:lib_a-ctime.* *libc.a:lib_a-ctime_r.* *libc.a:lib_a-ctype_.* *libc.a:lib_a-div.* *libc.a:lib_a-environ.* *libc.a:lib_a-envlock.* *libc.a:lib_a-fclose.* *libc.a:lib_a-fflush.* *libc.a:lib_a-findfp.* *libc.a:lib_a-fputwc.* *libc.a:lib_a-fvwrite.* *libc.a:lib_a-fwalk.* *libc.a:lib_a-getenv_r.* *libc.a:lib_a-gettzinfo.* *libc.a:lib_a-gmtime.* *libc.a:lib_a-gmtime_r.* *libc.a:lib_a-impure.* *libc.a:lib_a-isalnum.* *libc.a:lib_a-isalpha.* *libc.a:lib_a-isascii.* *libc.a:lib_a-isblank.* *libc.a:lib_a-iscntrl.* *libc.a:lib_a-isdigit.* *libc.a:lib_a-isgraph.* *libc.a:lib_a-islower.* *libc.a:lib_a-isprint.* *libc.a:lib_a-ispunct.* *libc.a:lib_a-isspace.* *libc.a:lib_a-isupper.* *libc.a:lib_a-itoa.* *libc.a:lib_a-labs.* *libc.a:lib_a-lcltime.* *libc.a:lib_a-lcltime_r.* *libc.a:lib_a-ldiv.* *libc.a:lib_a-longjmp.* *libc.a:lib_a-makebuf.* *libc.a:lib_a-memccpy.* *libc.a:lib_a-memchr.* *libc.a:lib_a-memcmp.* *libc.a:lib_a-memcpy.* *libc.a:lib_a-memmove.* *libc.a:lib_a-memrchr.* *libc.a:lib_a-memset.* *libc.a:lib_a-mktime.* *libc.a:lib_a-month_lengths.* *libc.a:lib_a-open.* *libc.a:lib_a-quorem.* *libc.a:lib_a-raise.* *libc.a:lib_a-rand.* *libc.a:lib_a-rand_r.* *libc.a:lib_a-read.* *libc.a:lib_a-refill.* *libc.a:lib_a-rshift.* *libc.a:lib_a-s_fpclassify.* *libc.a:lib_a-sbrk.* *libc.a:lib_a-sccl.* *libc.a:lib_a-setjmp.* *libc.a:lib_a-sf_nan.* *libc.a:lib_a-srand.* *libc.a:lib_a-stdio.* *libc.a:lib_a-strcasecmp.* *libc.a:lib_a-strcasestr.* *libc.a:lib_a-strcat.* *libc.a:lib_a-strchr.* *libc.a:lib_a-strcmp.* *libc.a:lib_a-strcoll.* *libc.a:lib_a-strcpy.* *libc.a:lib_a-strcspn.* *libc.a:lib_a-strdup.* *libc.a:lib_a-strdup_r.* *libc.a:lib_a-strftime.* *libc.a:lib_a-strlcat.* *libc.a:lib_a-strlcpy.* *libc.a:lib_a-strlen.* *libc.a:lib_a-strlwr.* *libc.a:lib_a-strncasecmp.* *libc.a:lib_a-strncat.* *libc.a:lib_a-strncmp.* *libc.a:lib_a-strncpy.* *libc.a:lib_a-strndup.* *libc.a:lib_a-strndup_r.* *libc.a:lib_a-strnlen.* *libc.a:lib_a-strptime.* *libc.a:lib_a-strrchr.* *libc.a:lib_a-strsep.* *libc.a:lib_a-strspn.* *libc.a:lib_a-strstr.* *libc.a:lib_a-strtok_r.* *libc.a:lib_a-strtol.* *libc.a:lib_a-strtoul.* *libc.a:lib_a-strupr.* *libc.a:lib_a-sysclose.* *libc.a:lib_a-sysopen.* *libc.a:lib_a-sysread.* *libc.a:lib_a-syssbrk.* *libc.a:lib_a-system.* *libc.a:lib_a-systimes.* *libc.a:lib_a-syswrite.* *libc.a:lib_a-time.* *libc.a:lib_a-timelocal.* *libc.a:lib_a-toascii.* *libc.a:lib_a-tolower.* *libc.a:lib_a-toupper.* *libc.a:lib_a-tzcalc_limits.* *libc.a:lib_a-tzlock.* *libc.a:lib_a-tzset.* *libc.a:lib_a-tzset_r.* *libc.a:lib_a-tzvars.* *libc.a:lib_a-ungetc.* *libc.a:lib_a-utoa.* *libc.a:lib_a-wbuf.* *libc.a:lib_a-wcrtomb.* *libc.a:lib_a-wctomb_r.* *libc.a:lib_a-wsetup.* *libc.a:lock.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_wdt.* *libesp_system.a:esp_err.* *libesp_system.a:esp_system.* *libgcc.a:lib2funcs.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *liblog.a:log.* *liblog.a:log_freertos.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.* *libxtensa.a:eri.*) .literal EXCLUDE_FILE(*libesp_ringbuf.a *libfreertos.a *libgcov.a *librtc.a *libxt_hal.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libc.a:creat.* *libc.a:isatty.* *libc.a:lib_a-abs.* *libc.a:lib_a-asctime.* *libc.a:lib_a-asctime_r.* *libc.a:lib_a-atoi.* *libc.a:lib_a-atol.* *libc.a:lib_a-bzero.* *libc.a:lib_a-close.* *libc.a:lib_a-creat.* *libc.a:lib_a-ctime.* *libc.a:lib_a-ctime_r.* *libc.a:lib_a-ctype_.* *libc.a:lib_a-div.* *libc.a:lib_a-environ.* *libc.a:lib_a-envlock.* *libc.a:lib_a-fclose.* *libc.a:lib_a-fflush.* *libc.a:lib_a-findfp.* *libc.a:lib_a-fputwc.* *libc.a:lib_a-fvwrite.* *libc.a:lib_a-fwalk.* *libc.a:lib_a-getenv_r.* *libc.a:lib_a-gettzinfo.* *libc.a:lib_a-gmtime.* *libc.a:lib_a-gmtime_r.* *libc.a:lib_a-impure.* *libc.a:lib_a-isalnum.* *libc.a:lib_a-isalpha.* *libc.a:lib_a-isascii.* *libc.a:lib_a-isblank.* *libc.a:lib_a-iscntrl.* *libc.a:lib_a-isdigit.* *libc.a:lib_a-isgraph.* *libc.a:lib_a-islower.* *libc.a:lib_a-isprint.* *libc.a:lib_a-ispunct.* *libc.a:lib_a-isspace.* *libc.a:lib_a-isupper.* *libc.a:lib_a-itoa.* *libc.a:lib_a-labs.* *libc.a:lib_a-lcltime.* *libc.a:lib_a-lcltime_r.* *libc.a:lib_a-ldiv.* *libc.a:lib_a-longjmp.* *libc.a:lib_a-makebuf.* *libc.a:lib_a-memccpy.* *libc.a:lib_a-memchr.* *libc.a:lib_a-memcmp.* *libc.a:lib_a-memcpy.* *libc.a:lib_a-memmove.* *libc.a:lib_a-memrchr.* *libc.a:lib_a-memset.* *libc.a:lib_a-mktime.* *libc.a:lib_a-month_lengths.* *libc.a:lib_a-open.* *libc.a:lib_a-quorem.* *libc.a:lib_a-raise.* *libc.a:lib_a-rand.* *libc.a:lib_a-rand_r.* *libc.a:lib_a-read.* *libc.a:lib_a-refill.* *libc.a:lib_a-rshift.* *libc.a:lib_a-s_fpclassify.* *libc.a:lib_a-sbrk.* *libc.a:lib_a-sccl.* *libc.a:lib_a-setjmp.* *libc.a:lib_a-sf_nan.* *libc.a:lib_a-srand.* *libc.a:lib_a-stdio.* *libc.a:lib_a-strcasecmp.* *libc.a:lib_a-strcasestr.* *libc.a:lib_a-strcat.* *libc.a:lib_a-strchr.* *libc.a:lib_a-strcmp.* *libc.a:lib_a-strcoll.* *libc.a:lib_a-strcpy.* *libc.a:lib_a-strcspn.* *libc.a:lib_a-strdup.* *libc.a:lib_a-strdup_r.* *libc.a:lib_a-strftime.* *libc.a:lib_a-strlcat.* *libc.a:lib_a-strlcpy.* *libc.a:lib_a-strlen.* *libc.a:lib_a-strlwr.* *libc.a:lib_a-strncasecmp.* *libc.a:lib_a-strncat.* *libc.a:lib_a-strncmp.* *libc.a:lib_a-strncpy.* *libc.a:lib_a-strndup.* *libc.a:lib_a-strndup_r.* *libc.a:lib_a-strnlen.* *libc.a:lib_a-strptime.* *libc.a:lib_a-strrchr.* *libc.a:lib_a-strsep.* *libc.a:lib_a-strspn.* *libc.a:lib_a-strstr.* *libc.a:lib_a-strtok_r.* *libc.a:lib_a-strtol.* *libc.a:lib_a-strtoul.* *libc.a:lib_a-strupr.* *libc.a:lib_a-sysclose.* *libc.a:lib_a-sysopen.* *libc.a:lib_a-sysread.* *libc.a:lib_a-syssbrk.* *libc.a:lib_a-system.* *libc.a:lib_a-systimes.* *libc.a:lib_a-syswrite.* *libc.a:lib_a-time.* *libc.a:lib_a-timelocal.* *libc.a:lib_a-toascii.* *libc.a:lib_a-tolower.* *libc.a:lib_a-toupper.* *libc.a:lib_a-tzcalc_limits.* *libc.a:lib_a-tzlock.* *libc.a:lib_a-tzset.* *libc.a:lib_a-tzset_r.* *libc.a:lib_a-tzvars.* *libc.a:lib_a-ungetc.* *libc.a:lib_a-utoa.* *libc.a:lib_a-wbuf.* *libc.a:lib_a-wcrtomb.* *libc.a:lib_a-wctomb_r.* *libc.a:lib_a-wsetup.* *libc.a:lock.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_wdt.* *libesp_system.a:esp_err.* *libesp_system.a:esp_system.* *libgcc.a:lib2funcs.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *liblog.a:log.* *liblog.a:log_freertos.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.* *libxtensa.a:eri.*) .literal.* EXCLUDE_FILE(*libesp_ringbuf.a *libfreertos.a *libgcov.a *librtc.a *libxt_hal.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libc.a:creat.* *libc.a:isatty.* *libc.a:lib_a-abs.* *libc.a:lib_a-asctime.* *libc.a:lib_a-asctime_r.* *libc.a:lib_a-atoi.* *libc.a:lib_a-atol.* *libc.a:lib_a-bzero.* *libc.a:lib_a-close.* *libc.a:lib_a-creat.* *libc.a:lib_a-ctime.* *libc.a:lib_a-ctime_r.* *libc.a:lib_a-ctype_.* *libc.a:lib_a-div.* *libc.a:lib_a-environ.* *libc.a:lib_a-envlock.* *libc.a:lib_a-fclose.* *libc.a:lib_a-fflush.* *libc.a:lib_a-findfp.* *libc.a:lib_a-fputwc.* *libc.a:lib_a-fvwrite.* *libc.a:lib_a-fwalk.* *libc.a:lib_a-getenv_r.* *libc.a:lib_a-gettzinfo.* *libc.a:lib_a-gmtime.* *libc.a:lib_a-gmtime_r.* *libc.a:lib_a-impure.* *libc.a:lib_a-isalnum.* *libc.a:lib_a-isalpha.* *libc.a:lib_a-isascii.* *libc.a:lib_a-isblank.* *libc.a:lib_a-iscntrl.* *libc.a:lib_a-isdigit.* *libc.a:lib_a-isgraph.* *libc.a:lib_a-islower.* *libc.a:lib_a-isprint.* *libc.a:lib_a-ispunct.* *libc.a:lib_a-isspace.* *libc.a:lib_a-isupper.* *libc.a:lib_a-itoa.* *libc.a:lib_a-labs.* *libc.a:lib_a-lcltime.* *libc.a:lib_a-lcltime_r.* *libc.a:lib_a-ldiv.* *libc.a:lib_a-longjmp.* *libc.a:lib_a-makebuf.* *libc.a:lib_a-memccpy.* *libc.a:lib_a-memchr.* *libc.a:lib_a-memcmp.* *libc.a:lib_a-memcpy.* *libc.a:lib_a-memmove.* *libc.a:lib_a-memrchr.* *libc.a:lib_a-memset.* *libc.a:lib_a-mktime.* *libc.a:lib_a-month_lengths.* *libc.a:lib_a-open.* *libc.a:lib_a-quorem.* *libc.a:lib_a-raise.* *libc.a:lib_a-rand.* *libc.a:lib_a-rand_r.* *libc.a:lib_a-read.* *libc.a:lib_a-refill.* *libc.a:lib_a-rshift.* *libc.a:lib_a-s_fpclassify.* *libc.a:lib_a-sbrk.* *libc.a:lib_a-sccl.* *libc.a:lib_a-setjmp.* *libc.a:lib_a-sf_nan.* *libc.a:lib_a-srand.* *libc.a:lib_a-stdio.* *libc.a:lib_a-strcasecmp.* *libc.a:lib_a-strcasestr.* *libc.a:lib_a-strcat.* *libc.a:lib_a-strchr.* *libc.a:lib_a-strcmp.* *libc.a:lib_a-strcoll.* *libc.a:lib_a-strcpy.* *libc.a:lib_a-strcspn.* *libc.a:lib_a-strdup.* *libc.a:lib_a-strdup_r.* *libc.a:lib_a-strftime.* *libc.a:lib_a-strlcat.* *libc.a:lib_a-strlcpy.* *libc.a:lib_a-strlen.* *libc.a:lib_a-strlwr.* *libc.a:lib_a-strncasecmp.* *libc.a:lib_a-strncat.* *libc.a:lib_a-strncmp.* *libc.a:lib_a-strncpy.* *libc.a:lib_a-strndup.* *libc.a:lib_a-strndup_r.* *libc.a:lib_a-strnlen.* *libc.a:lib_a-strptime.* *libc.a:lib_a-strrchr.* *libc.a:lib_a-strsep.* *libc.a:lib_a-strspn.* *libc.a:lib_a-strstr.* *libc.a:lib_a-strtok_r.* *libc.a:lib_a-strtol.* *libc.a:lib_a-strtoul.* *libc.a:lib_a-strupr.* *libc.a:lib_a-sysclose.* *libc.a:lib_a-sysopen.* *libc.a:lib_a-sysread.* *libc.a:lib_a-syssbrk.* *libc.a:lib_a-system.* *libc.a:lib_a-systimes.* *libc.a:lib_a-syswrite.* *libc.a:lib_a-time.* *libc.a:lib_a-timelocal.* *libc.a:lib_a-toascii.* *libc.a:lib_a-tolower.* *libc.a:lib_a-toupper.* *libc.a:lib_a-tzcalc_limits.* *libc.a:lib_a-tzlock.* *libc.a:lib_a-tzset.* *libc.a:lib_a-tzset_r.* *libc.a:lib_a-tzvars.* *libc.a:lib_a-ungetc.* *libc.a:lib_a-utoa.* *libc.a:lib_a-wbuf.* *libc.a:lib_a-wcrtomb.* *libc.a:lib_a-wctomb_r.* *libc.a:lib_a-wsetup.* *libc.a:lock.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_wdt.* *libesp_system.a:esp_err.* *libesp_system.a:esp_system.* *libgcc.a:lib2funcs.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *liblog.a:log.* *liblog.a:log_freertos.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.* *libxtensa.a:eri.*) .text EXCLUDE_FILE(*libesp_ringbuf.a *libfreertos.a *libgcov.a *librtc.a *libxt_hal.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libc.a:creat.* *libc.a:isatty.* *libc.a:lib_a-abs.* *libc.a:lib_a-asctime.* *libc.a:lib_a-asctime_r.* *libc.a:lib_a-atoi.* *libc.a:lib_a-atol.* *libc.a:lib_a-bzero.* *libc.a:lib_a-close.* *libc.a:lib_a-creat.* *libc.a:lib_a-ctime.* *libc.a:lib_a-ctime_r.* *libc.a:lib_a-ctype_.* *libc.a:lib_a-div.* *libc.a:lib_a-environ.* *libc.a:lib_a-envlock.* *libc.a:lib_a-fclose.* *libc.a:lib_a-fflush.* *libc.a:lib_a-findfp.* *libc.a:lib_a-fputwc.* *libc.a:lib_a-fvwrite.* *libc.a:lib_a-fwalk.* *libc.a:lib_a-getenv_r.* *libc.a:lib_a-gettzinfo.* *libc.a:lib_a-gmtime.* *libc.a:lib_a-gmtime_r.* *libc.a:lib_a-impure.* *libc.a:lib_a-isalnum.* *libc.a:lib_a-isalpha.* *libc.a:lib_a-isascii.* *libc.a:lib_a-isblank.* *libc.a:lib_a-iscntrl.* *libc.a:lib_a-isdigit.* *libc.a:lib_a-isgraph.* *libc.a:lib_a-islower.* *libc.a:lib_a-isprint.* *libc.a:lib_a-ispunct.* *libc.a:lib_a-isspace.* *libc.a:lib_a-isupper.* *libc.a:lib_a-itoa.* *libc.a:lib_a-labs.* *libc.a:lib_a-lcltime.* *libc.a:lib_a-lcltime_r.* *libc.a:lib_a-ldiv.* *libc.a:lib_a-longjmp.* *libc.a:lib_a-makebuf.* *libc.a:lib_a-memccpy.* *libc.a:lib_a-memchr.* *libc.a:lib_a-memcmp.* *libc.a:lib_a-memcpy.* *libc.a:lib_a-memmove.* *libc.a:lib_a-memrchr.* *libc.a:lib_a-memset.* *libc.a:lib_a-mktime.* *libc.a:lib_a-month_lengths.* *libc.a:lib_a-open.* *libc.a:lib_a-quorem.* *libc.a:lib_a-raise.* *libc.a:lib_a-rand.* *libc.a:lib_a-rand_r.* *libc.a:lib_a-read.* *libc.a:lib_a-refill.* *libc.a:lib_a-rshift.* *libc.a:lib_a-s_fpclassify.* *libc.a:lib_a-sbrk.* *libc.a:lib_a-sccl.* *libc.a:lib_a-setjmp.* *libc.a:lib_a-sf_nan.* *libc.a:lib_a-srand.* *libc.a:lib_a-stdio.* *libc.a:lib_a-strcasecmp.* *libc.a:lib_a-strcasestr.* *libc.a:lib_a-strcat.* *libc.a:lib_a-strchr.* *libc.a:lib_a-strcmp.* *libc.a:lib_a-strcoll.* *libc.a:lib_a-strcpy.* *libc.a:lib_a-strcspn.* *libc.a:lib_a-strdup.* *libc.a:lib_a-strdup_r.* *libc.a:lib_a-strftime.* *libc.a:lib_a-strlcat.* *libc.a:lib_a-strlcpy.* *libc.a:lib_a-strlen.* *libc.a:lib_a-strlwr.* *libc.a:lib_a-strncasecmp.* *libc.a:lib_a-strncat.* *libc.a:lib_a-strncmp.* *libc.a:lib_a-strncpy.* *libc.a:lib_a-strndup.* *libc.a:lib_a-strndup_r.* *libc.a:lib_a-strnlen.* *libc.a:lib_a-strptime.* *libc.a:lib_a-strrchr.* *libc.a:lib_a-strsep.* *libc.a:lib_a-strspn.* *libc.a:lib_a-strstr.* *libc.a:lib_a-strtok_r.* *libc.a:lib_a-strtol.* *libc.a:lib_a-strtoul.* *libc.a:lib_a-strupr.* *libc.a:lib_a-sysclose.* *libc.a:lib_a-sysopen.* *libc.a:lib_a-sysread.* *libc.a:lib_a-syssbrk.* *libc.a:lib_a-system.* *libc.a:lib_a-systimes.* *libc.a:lib_a-syswrite.* *libc.a:lib_a-time.* *libc.a:lib_a-timelocal.* *libc.a:lib_a-toascii.* *libc.a:lib_a-tolower.* *libc.a:lib_a-toupper.* *libc.a:lib_a-tzcalc_limits.* *libc.a:lib_a-tzlock.* *libc.a:lib_a-tzset.* *libc.a:lib_a-tzset_r.* *libc.a:lib_a-tzvars.* *libc.a:lib_a-ungetc.* *libc.a:lib_a-utoa.* *libc.a:lib_a-wbuf.* *libc.a:lib_a-wcrtomb.* *libc.a:lib_a-wctomb_r.* *libc.a:lib_a-wsetup.* *libc.a:lock.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_wdt.* *libesp_system.a:esp_err.* *libesp_system.a:esp_system.* *libgcc.a:lib2funcs.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *liblog.a:log.* *liblog.a:log_freertos.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.* *libxtensa.a:eri.*) .text.*) *(.phyiram .phyiram.*) *(.wifi0iram .wifi0iram.*) *(.wifiorslpiram .wifiorslpiram.*) @@ -690,7 +680,7 @@ SECTIONS *libesp_event.a:default_event_loop.*(.literal.esp_event_handler_instance_register .literal.esp_event_handler_instance_unregister .literal.esp_event_handler_register .literal.esp_event_handler_unregister .literal.esp_event_loop_create_default .literal.esp_event_loop_delete_default .literal.esp_event_post .literal.esp_event_send_to_default_loop .text .text.esp_event_handler_instance_register .text.esp_event_handler_instance_unregister .text.esp_event_handler_register .text.esp_event_handler_unregister .text.esp_event_loop_create_default .text.esp_event_loop_delete_default .text.esp_event_post .text.esp_event_send_to_default_loop) *libesp_event.a:esp_event.*(.literal.base_node_add_handler .literal.esp_event_handler_instance_register_with .literal.esp_event_handler_instance_unregister_with .literal.esp_event_handler_register_with .literal.esp_event_handler_register_with_internal .literal.esp_event_handler_unregister_with .literal.esp_event_handler_unregister_with_internal .literal.esp_event_loop_create .literal.esp_event_loop_delete .literal.esp_event_loop_run .literal.esp_event_loop_run_task .literal.esp_event_post_to .literal.handler_instances_add .literal.handler_instances_remove .literal.handler_instances_remove_all$isra$1 .literal.loop_node_add_handler .text .text.base_node_add_handler .text.esp_event_dump .text.esp_event_handler_instance_register_with .text.esp_event_handler_instance_unregister_with .text.esp_event_handler_register_with .text.esp_event_handler_register_with_internal .text.esp_event_handler_unregister_with .text.esp_event_handler_unregister_with_internal .text.esp_event_loop_create .text.esp_event_loop_delete .text.esp_event_loop_run .text.esp_event_loop_run_task .text.esp_event_post_to .text.handler_instances_add .text.handler_instances_remove .text.handler_instances_remove_all$isra$1 .text.loop_node_add_handler) *libesp_hw_support.a:rtc_init.*(.literal.rtc_init .literal.rtc_vddsdio_get_config .text .text.rtc_init .text.rtc_vddsdio_get_config) - *libesp_system.a:system_api.*(.literal.esp_get_free_heap_size .literal.esp_get_free_internal_heap_size .literal.esp_get_idf_version .literal.esp_get_minimum_free_heap_size .literal.esp_register_shutdown_handler .literal.esp_unregister_shutdown_handler .text .text.esp_get_free_heap_size .text.esp_get_free_internal_heap_size .text.esp_get_idf_version .text.esp_get_minimum_free_heap_size .text.esp_register_shutdown_handler .text.esp_unregister_shutdown_handler) + *libesp_system.a:esp_system.*(.literal.esp_get_free_heap_size .literal.esp_get_free_internal_heap_size .literal.esp_get_idf_version .literal.esp_get_minimum_free_heap_size .literal.esp_register_shutdown_handler .literal.esp_unregister_shutdown_handler .text .text.esp_get_free_heap_size .text.esp_get_free_internal_heap_size .text.esp_get_idf_version .text.esp_get_minimum_free_heap_size .text.esp_register_shutdown_handler .text.esp_unregister_shutdown_handler) *libfreertos.a:port.*(.literal.esp_startup_start_app .text.esp_startup_start_app) *libfreertos.a:port.*(.literal.esp_startup_start_app_other_cores .text.esp_startup_start_app_other_cores) *libfreertos.a:port_common.*(.literal.main_task .text.main_task) diff --git a/tools/sdk/esp32/ld/libbtdm_app.a b/tools/sdk/esp32/ld/libbtdm_app.a index 72e27380c8b..e03b5bbd1d6 100644 Binary files a/tools/sdk/esp32/ld/libbtdm_app.a and b/tools/sdk/esp32/ld/libbtdm_app.a differ diff --git a/tools/sdk/esp32/lib/libapp_trace.a b/tools/sdk/esp32/lib/libapp_trace.a index 46061945dfb..8e19dd3f6a8 100644 Binary files a/tools/sdk/esp32/lib/libapp_trace.a and b/tools/sdk/esp32/lib/libapp_trace.a differ diff --git a/tools/sdk/esp32/lib/libapp_update.a b/tools/sdk/esp32/lib/libapp_update.a index 3170b568251..14a016e62dd 100644 Binary files a/tools/sdk/esp32/lib/libapp_update.a and b/tools/sdk/esp32/lib/libapp_update.a differ diff --git a/tools/sdk/esp32/lib/libasio.a b/tools/sdk/esp32/lib/libasio.a index 68fc0f79d8b..e1739da7f9b 100644 Binary files a/tools/sdk/esp32/lib/libasio.a and b/tools/sdk/esp32/lib/libasio.a differ diff --git a/tools/sdk/esp32/lib/libbootloader_support.a b/tools/sdk/esp32/lib/libbootloader_support.a index 1b73a653035..7cfab06ee66 100644 Binary files a/tools/sdk/esp32/lib/libbootloader_support.a and b/tools/sdk/esp32/lib/libbootloader_support.a differ diff --git a/tools/sdk/esp32/lib/libbt.a b/tools/sdk/esp32/lib/libbt.a index 2adc4ed3818..b9563de857f 100644 Binary files a/tools/sdk/esp32/lib/libbt.a and b/tools/sdk/esp32/lib/libbt.a differ diff --git a/tools/sdk/esp32/lib/libbutton.a b/tools/sdk/esp32/lib/libbutton.a index 7ecc2b1a7f9..c562d6f90e4 100644 Binary files a/tools/sdk/esp32/lib/libbutton.a and b/tools/sdk/esp32/lib/libbutton.a differ diff --git a/tools/sdk/esp32/lib/libcbor.a b/tools/sdk/esp32/lib/libcbor.a index 47e741d5507..1eb17ed3bfc 100644 Binary files a/tools/sdk/esp32/lib/libcbor.a and b/tools/sdk/esp32/lib/libcbor.a differ diff --git a/tools/sdk/esp32/lib/libcmock.a b/tools/sdk/esp32/lib/libcmock.a index 15bb2661249..6af3d84dcde 100644 Binary files a/tools/sdk/esp32/lib/libcmock.a and b/tools/sdk/esp32/lib/libcmock.a differ diff --git a/tools/sdk/esp32/lib/libcoap.a b/tools/sdk/esp32/lib/libcoap.a index 4fdca8ecf19..195ed5e4544 100644 Binary files a/tools/sdk/esp32/lib/libcoap.a and b/tools/sdk/esp32/lib/libcoap.a differ diff --git a/tools/sdk/esp32/lib/libcoexist.a b/tools/sdk/esp32/lib/libcoexist.a index d3ad46a1c4b..c25c69e1280 100644 Binary files a/tools/sdk/esp32/lib/libcoexist.a and b/tools/sdk/esp32/lib/libcoexist.a differ diff --git a/tools/sdk/esp32/lib/libconsole.a b/tools/sdk/esp32/lib/libconsole.a index 7fec2e83a94..ce25312c3d8 100644 Binary files a/tools/sdk/esp32/lib/libconsole.a and b/tools/sdk/esp32/lib/libconsole.a differ diff --git a/tools/sdk/esp32/lib/libcore.a b/tools/sdk/esp32/lib/libcore.a index 9ecb44f3f59..42ab873d6a9 100644 Binary files a/tools/sdk/esp32/lib/libcore.a and b/tools/sdk/esp32/lib/libcore.a differ diff --git a/tools/sdk/esp32/lib/libcxx.a b/tools/sdk/esp32/lib/libcxx.a index 6a8e44061bb..7df98410b8f 100644 Binary files a/tools/sdk/esp32/lib/libcxx.a and b/tools/sdk/esp32/lib/libcxx.a differ diff --git a/tools/sdk/esp32/lib/libdriver.a b/tools/sdk/esp32/lib/libdriver.a index f1c23bcc6a9..e6a6db70d93 100644 Binary files a/tools/sdk/esp32/lib/libdriver.a and b/tools/sdk/esp32/lib/libdriver.a differ diff --git a/tools/sdk/esp32/lib/libefuse.a b/tools/sdk/esp32/lib/libefuse.a index ae9259ea6bc..70fe7b2549c 100644 Binary files a/tools/sdk/esp32/lib/libefuse.a and b/tools/sdk/esp32/lib/libefuse.a differ diff --git a/tools/sdk/esp32/lib/libesp-dsp.a b/tools/sdk/esp32/lib/libesp-dsp.a index 9224a4d99de..54c15cd6fef 100644 Binary files a/tools/sdk/esp32/lib/libesp-dsp.a and b/tools/sdk/esp32/lib/libesp-dsp.a differ diff --git a/tools/sdk/esp32/lib/libesp-face.a b/tools/sdk/esp32/lib/libesp-face.a index e7d0f46a341..95e010dcf2f 100644 Binary files a/tools/sdk/esp32/lib/libesp-face.a and b/tools/sdk/esp32/lib/libesp-face.a differ diff --git a/tools/sdk/esp32/lib/libesp-tls.a b/tools/sdk/esp32/lib/libesp-tls.a index 517c2f09934..5ed69ae420e 100644 Binary files a/tools/sdk/esp32/lib/libesp-tls.a and b/tools/sdk/esp32/lib/libesp-tls.a differ diff --git a/tools/sdk/esp32/lib/libesp32-camera.a b/tools/sdk/esp32/lib/libesp32-camera.a index b8e4a797336..8e219b3da65 100644 Binary files a/tools/sdk/esp32/lib/libesp32-camera.a and b/tools/sdk/esp32/lib/libesp32-camera.a differ diff --git a/tools/sdk/esp32/lib/libesp32.a b/tools/sdk/esp32/lib/libesp32.a index 9a9ac2b7732..aba17f7fa0b 100644 Binary files a/tools/sdk/esp32/lib/libesp32.a and b/tools/sdk/esp32/lib/libesp32.a differ diff --git a/tools/sdk/esp32/lib/libesp_adc_cal.a b/tools/sdk/esp32/lib/libesp_adc_cal.a index bcccef9ea4c..f10bec21a21 100644 Binary files a/tools/sdk/esp32/lib/libesp_adc_cal.a and b/tools/sdk/esp32/lib/libesp_adc_cal.a differ diff --git a/tools/sdk/esp32/lib/libesp_common.a b/tools/sdk/esp32/lib/libesp_common.a index 3141ceca728..f6bce8c725e 100644 Binary files a/tools/sdk/esp32/lib/libesp_common.a and b/tools/sdk/esp32/lib/libesp_common.a differ diff --git a/tools/sdk/esp32/lib/libesp_eth.a b/tools/sdk/esp32/lib/libesp_eth.a index 530d6ecf4a7..7c0c2c2ee54 100644 Binary files a/tools/sdk/esp32/lib/libesp_eth.a and b/tools/sdk/esp32/lib/libesp_eth.a differ diff --git a/tools/sdk/esp32/lib/libesp_event.a b/tools/sdk/esp32/lib/libesp_event.a index 90486fdf98f..f66aa4b4fa3 100644 Binary files a/tools/sdk/esp32/lib/libesp_event.a and b/tools/sdk/esp32/lib/libesp_event.a differ diff --git a/tools/sdk/esp32/lib/libesp_gdbstub.a b/tools/sdk/esp32/lib/libesp_gdbstub.a index 1ee86f1edc4..57f5e1a449e 100644 Binary files a/tools/sdk/esp32/lib/libesp_gdbstub.a and b/tools/sdk/esp32/lib/libesp_gdbstub.a differ diff --git a/tools/sdk/esp32/lib/libesp_hid.a b/tools/sdk/esp32/lib/libesp_hid.a index 722f0eaad6b..77f946e1e7d 100644 Binary files a/tools/sdk/esp32/lib/libesp_hid.a and b/tools/sdk/esp32/lib/libesp_hid.a differ diff --git a/tools/sdk/esp32/lib/libesp_http_client.a b/tools/sdk/esp32/lib/libesp_http_client.a index 43842c2713d..7a10e97afe0 100644 Binary files a/tools/sdk/esp32/lib/libesp_http_client.a and b/tools/sdk/esp32/lib/libesp_http_client.a differ diff --git a/tools/sdk/esp32/lib/libesp_http_server.a b/tools/sdk/esp32/lib/libesp_http_server.a index d3bb40ef8ff..d4306e7c2da 100644 Binary files a/tools/sdk/esp32/lib/libesp_http_server.a and b/tools/sdk/esp32/lib/libesp_http_server.a differ diff --git a/tools/sdk/esp32/lib/libesp_https_ota.a b/tools/sdk/esp32/lib/libesp_https_ota.a index 346f2ab4a58..e422e3f4177 100644 Binary files a/tools/sdk/esp32/lib/libesp_https_ota.a and b/tools/sdk/esp32/lib/libesp_https_ota.a differ diff --git a/tools/sdk/esp32/lib/libesp_hw_support.a b/tools/sdk/esp32/lib/libesp_hw_support.a index fda5838d471..2d9ada3b3bb 100644 Binary files a/tools/sdk/esp32/lib/libesp_hw_support.a and b/tools/sdk/esp32/lib/libesp_hw_support.a differ diff --git a/tools/sdk/esp32/lib/libesp_ipc.a b/tools/sdk/esp32/lib/libesp_ipc.a index 90849d813c3..9ecf6b20c88 100644 Binary files a/tools/sdk/esp32/lib/libesp_ipc.a and b/tools/sdk/esp32/lib/libesp_ipc.a differ diff --git a/tools/sdk/esp32/lib/libesp_littlefs.a b/tools/sdk/esp32/lib/libesp_littlefs.a index ac97874c881..f2d6e6c5010 100644 Binary files a/tools/sdk/esp32/lib/libesp_littlefs.a and b/tools/sdk/esp32/lib/libesp_littlefs.a differ diff --git a/tools/sdk/esp32/lib/libesp_local_ctrl.a b/tools/sdk/esp32/lib/libesp_local_ctrl.a index 6daf6f3f9a3..dec8fd65381 100644 Binary files a/tools/sdk/esp32/lib/libesp_local_ctrl.a and b/tools/sdk/esp32/lib/libesp_local_ctrl.a differ diff --git a/tools/sdk/esp32/lib/libesp_netif.a b/tools/sdk/esp32/lib/libesp_netif.a index d4fa48dd204..0cfe9bfd4d3 100644 Binary files a/tools/sdk/esp32/lib/libesp_netif.a and b/tools/sdk/esp32/lib/libesp_netif.a differ diff --git a/tools/sdk/esp32/lib/libesp_pm.a b/tools/sdk/esp32/lib/libesp_pm.a index 101010ff54b..09d9c9e14bb 100644 Binary files a/tools/sdk/esp32/lib/libesp_pm.a and b/tools/sdk/esp32/lib/libesp_pm.a differ diff --git a/tools/sdk/esp32/lib/libesp_rainmaker.a b/tools/sdk/esp32/lib/libesp_rainmaker.a index 5ac410d5930..d6dca18c90a 100644 Binary files a/tools/sdk/esp32/lib/libesp_rainmaker.a and b/tools/sdk/esp32/lib/libesp_rainmaker.a differ diff --git a/tools/sdk/esp32/lib/libesp_ringbuf.a b/tools/sdk/esp32/lib/libesp_ringbuf.a index 2e630fdcd1c..340c0105ac0 100644 Binary files a/tools/sdk/esp32/lib/libesp_ringbuf.a and b/tools/sdk/esp32/lib/libesp_ringbuf.a differ diff --git a/tools/sdk/esp32/lib/libesp_rom.a b/tools/sdk/esp32/lib/libesp_rom.a index 8e9e2d5603a..21865471479 100644 Binary files a/tools/sdk/esp32/lib/libesp_rom.a and b/tools/sdk/esp32/lib/libesp_rom.a differ diff --git a/tools/sdk/esp32/lib/libesp_schedule.a b/tools/sdk/esp32/lib/libesp_schedule.a index de341d7e272..9165071e333 100644 Binary files a/tools/sdk/esp32/lib/libesp_schedule.a and b/tools/sdk/esp32/lib/libesp_schedule.a differ diff --git a/tools/sdk/esp32/lib/libesp_serial_slave_link.a b/tools/sdk/esp32/lib/libesp_serial_slave_link.a index a743c938991..0a76aa84af4 100644 Binary files a/tools/sdk/esp32/lib/libesp_serial_slave_link.a and b/tools/sdk/esp32/lib/libesp_serial_slave_link.a differ diff --git a/tools/sdk/esp32/lib/libesp_system.a b/tools/sdk/esp32/lib/libesp_system.a index 742b6c6404c..4ee6ea5102e 100644 Binary files a/tools/sdk/esp32/lib/libesp_system.a and b/tools/sdk/esp32/lib/libesp_system.a differ diff --git a/tools/sdk/esp32/lib/libesp_timer.a b/tools/sdk/esp32/lib/libesp_timer.a index 09f3158c4c4..1238562f253 100644 Binary files a/tools/sdk/esp32/lib/libesp_timer.a and b/tools/sdk/esp32/lib/libesp_timer.a differ diff --git a/tools/sdk/esp32/lib/libesp_websocket_client.a b/tools/sdk/esp32/lib/libesp_websocket_client.a index a0ad70a7e86..508c8bdcad5 100644 Binary files a/tools/sdk/esp32/lib/libesp_websocket_client.a and b/tools/sdk/esp32/lib/libesp_websocket_client.a differ diff --git a/tools/sdk/esp32/lib/libesp_wifi.a b/tools/sdk/esp32/lib/libesp_wifi.a index b502f1b8940..1b3787c1150 100644 Binary files a/tools/sdk/esp32/lib/libesp_wifi.a and b/tools/sdk/esp32/lib/libesp_wifi.a differ diff --git a/tools/sdk/esp32/lib/libespcoredump.a b/tools/sdk/esp32/lib/libespcoredump.a index 203be705c6c..a4ca469718a 100644 Binary files a/tools/sdk/esp32/lib/libespcoredump.a and b/tools/sdk/esp32/lib/libespcoredump.a differ diff --git a/tools/sdk/esp32/lib/libespnow.a b/tools/sdk/esp32/lib/libespnow.a index 118d01f0a8a..4c67a2819fa 100644 Binary files a/tools/sdk/esp32/lib/libespnow.a and b/tools/sdk/esp32/lib/libespnow.a differ diff --git a/tools/sdk/esp32/lib/libexpat.a b/tools/sdk/esp32/lib/libexpat.a index bace4b9199c..bf824e2e12a 100644 Binary files a/tools/sdk/esp32/lib/libexpat.a and b/tools/sdk/esp32/lib/libexpat.a differ diff --git a/tools/sdk/esp32/lib/libfatfs.a b/tools/sdk/esp32/lib/libfatfs.a index b864dde22b5..1986d92d6ab 100644 Binary files a/tools/sdk/esp32/lib/libfatfs.a and b/tools/sdk/esp32/lib/libfatfs.a differ diff --git a/tools/sdk/esp32/lib/libfb_gfx.a b/tools/sdk/esp32/lib/libfb_gfx.a index e7b4fc8f205..227fc090738 100644 Binary files a/tools/sdk/esp32/lib/libfb_gfx.a and b/tools/sdk/esp32/lib/libfb_gfx.a differ diff --git a/tools/sdk/esp32/lib/libfreemodbus.a b/tools/sdk/esp32/lib/libfreemodbus.a index 1928f6d32d9..c922cafa0b6 100644 Binary files a/tools/sdk/esp32/lib/libfreemodbus.a and b/tools/sdk/esp32/lib/libfreemodbus.a differ diff --git a/tools/sdk/esp32/lib/libfreertos.a b/tools/sdk/esp32/lib/libfreertos.a index 5f236821510..8f0f918d1aa 100644 Binary files a/tools/sdk/esp32/lib/libfreertos.a and b/tools/sdk/esp32/lib/libfreertos.a differ diff --git a/tools/sdk/esp32/lib/libhal.a b/tools/sdk/esp32/lib/libhal.a index ff89d23d90d..1c9be443ac2 100644 Binary files a/tools/sdk/esp32/lib/libhal.a and b/tools/sdk/esp32/lib/libhal.a differ diff --git a/tools/sdk/esp32/lib/libheap.a b/tools/sdk/esp32/lib/libheap.a index 28e5d074932..5d0c355cf91 100644 Binary files a/tools/sdk/esp32/lib/libheap.a and b/tools/sdk/esp32/lib/libheap.a differ diff --git a/tools/sdk/esp32/lib/libjsmn.a b/tools/sdk/esp32/lib/libjsmn.a index 5d84cdcdbe7..d1f5411f20d 100644 Binary files a/tools/sdk/esp32/lib/libjsmn.a and b/tools/sdk/esp32/lib/libjsmn.a differ diff --git a/tools/sdk/esp32/lib/libjson.a b/tools/sdk/esp32/lib/libjson.a index 29dcd704036..46ee8f5dad6 100644 Binary files a/tools/sdk/esp32/lib/libjson.a and b/tools/sdk/esp32/lib/libjson.a differ diff --git a/tools/sdk/esp32/lib/libjson_generator.a b/tools/sdk/esp32/lib/libjson_generator.a index 64ff333d201..42da5d95c25 100644 Binary files a/tools/sdk/esp32/lib/libjson_generator.a and b/tools/sdk/esp32/lib/libjson_generator.a differ diff --git a/tools/sdk/esp32/lib/libjson_parser.a b/tools/sdk/esp32/lib/libjson_parser.a index 5109a21841c..2424b09091e 100644 Binary files a/tools/sdk/esp32/lib/libjson_parser.a and b/tools/sdk/esp32/lib/libjson_parser.a differ diff --git a/tools/sdk/esp32/lib/liblibsodium.a b/tools/sdk/esp32/lib/liblibsodium.a index f1917e6fbce..2d6fea2d6d4 100644 Binary files a/tools/sdk/esp32/lib/liblibsodium.a and b/tools/sdk/esp32/lib/liblibsodium.a differ diff --git a/tools/sdk/esp32/lib/liblog.a b/tools/sdk/esp32/lib/liblog.a index 7bb12ee9627..bed3a98c744 100644 Binary files a/tools/sdk/esp32/lib/liblog.a and b/tools/sdk/esp32/lib/liblog.a differ diff --git a/tools/sdk/esp32/lib/liblwip.a b/tools/sdk/esp32/lib/liblwip.a index d7981359827..fa819c0b6dd 100644 Binary files a/tools/sdk/esp32/lib/liblwip.a and b/tools/sdk/esp32/lib/liblwip.a differ diff --git a/tools/sdk/esp32/lib/libmbedcrypto.a b/tools/sdk/esp32/lib/libmbedcrypto.a index 485399bd2ab..a6dd100fe55 100644 Binary files a/tools/sdk/esp32/lib/libmbedcrypto.a and b/tools/sdk/esp32/lib/libmbedcrypto.a differ diff --git a/tools/sdk/esp32/lib/libmbedtls.a b/tools/sdk/esp32/lib/libmbedtls.a index 4cd5867ca02..bcf496dbd50 100644 Binary files a/tools/sdk/esp32/lib/libmbedtls.a and b/tools/sdk/esp32/lib/libmbedtls.a differ diff --git a/tools/sdk/esp32/lib/libmbedx509.a b/tools/sdk/esp32/lib/libmbedx509.a index 7d25a435bc0..956eab1358b 100644 Binary files a/tools/sdk/esp32/lib/libmbedx509.a and b/tools/sdk/esp32/lib/libmbedx509.a differ diff --git a/tools/sdk/esp32/lib/libmdns.a b/tools/sdk/esp32/lib/libmdns.a index 4d37adc201f..3d4d2aa06dc 100644 Binary files a/tools/sdk/esp32/lib/libmdns.a and b/tools/sdk/esp32/lib/libmdns.a differ diff --git a/tools/sdk/esp32/lib/libmesh.a b/tools/sdk/esp32/lib/libmesh.a index da01e0ee38c..a075a8fff44 100644 Binary files a/tools/sdk/esp32/lib/libmesh.a and b/tools/sdk/esp32/lib/libmesh.a differ diff --git a/tools/sdk/esp32/lib/libmqtt.a b/tools/sdk/esp32/lib/libmqtt.a index 54780744093..a2186c19d96 100644 Binary files a/tools/sdk/esp32/lib/libmqtt.a and b/tools/sdk/esp32/lib/libmqtt.a differ diff --git a/tools/sdk/esp32/lib/libnet80211.a b/tools/sdk/esp32/lib/libnet80211.a index e8863ae1a84..ca50bcdd6f9 100644 Binary files a/tools/sdk/esp32/lib/libnet80211.a and b/tools/sdk/esp32/lib/libnet80211.a differ diff --git a/tools/sdk/esp32/lib/libnewlib.a b/tools/sdk/esp32/lib/libnewlib.a index 56221595bbb..76311d9d60f 100644 Binary files a/tools/sdk/esp32/lib/libnewlib.a and b/tools/sdk/esp32/lib/libnewlib.a differ diff --git a/tools/sdk/esp32/lib/libnghttp.a b/tools/sdk/esp32/lib/libnghttp.a index 545bb77bc64..f0970437135 100644 Binary files a/tools/sdk/esp32/lib/libnghttp.a and b/tools/sdk/esp32/lib/libnghttp.a differ diff --git a/tools/sdk/esp32/lib/libnvs_flash.a b/tools/sdk/esp32/lib/libnvs_flash.a index c501bd992ac..61979d277a3 100644 Binary files a/tools/sdk/esp32/lib/libnvs_flash.a and b/tools/sdk/esp32/lib/libnvs_flash.a differ diff --git a/tools/sdk/esp32/lib/libopenssl.a b/tools/sdk/esp32/lib/libopenssl.a index 6c1833ecc2b..1aad4248afb 100644 Binary files a/tools/sdk/esp32/lib/libopenssl.a and b/tools/sdk/esp32/lib/libopenssl.a differ diff --git a/tools/sdk/esp32/lib/libperfmon.a b/tools/sdk/esp32/lib/libperfmon.a index 7487b02afba..d0b4f35dcbc 100644 Binary files a/tools/sdk/esp32/lib/libperfmon.a and b/tools/sdk/esp32/lib/libperfmon.a differ diff --git a/tools/sdk/esp32/lib/libpp.a b/tools/sdk/esp32/lib/libpp.a index 732f3f64713..b34ed662c14 100644 Binary files a/tools/sdk/esp32/lib/libpp.a and b/tools/sdk/esp32/lib/libpp.a differ diff --git a/tools/sdk/esp32/lib/libprotobuf-c.a b/tools/sdk/esp32/lib/libprotobuf-c.a index 23dcb7995cc..4a324932243 100644 Binary files a/tools/sdk/esp32/lib/libprotobuf-c.a and b/tools/sdk/esp32/lib/libprotobuf-c.a differ diff --git a/tools/sdk/esp32/lib/libprotocomm.a b/tools/sdk/esp32/lib/libprotocomm.a index d1a0fa3be13..e982fd3d49c 100644 Binary files a/tools/sdk/esp32/lib/libprotocomm.a and b/tools/sdk/esp32/lib/libprotocomm.a differ diff --git a/tools/sdk/esp32/lib/libpthread.a b/tools/sdk/esp32/lib/libpthread.a index 847a09db493..90a79480349 100644 Binary files a/tools/sdk/esp32/lib/libpthread.a and b/tools/sdk/esp32/lib/libpthread.a differ diff --git a/tools/sdk/esp32/lib/libqrcode.a b/tools/sdk/esp32/lib/libqrcode.a index 0737aac116d..01a168076c2 100644 Binary files a/tools/sdk/esp32/lib/libqrcode.a and b/tools/sdk/esp32/lib/libqrcode.a differ diff --git a/tools/sdk/esp32/lib/libsdmmc.a b/tools/sdk/esp32/lib/libsdmmc.a index e31baa46444..259861f09f3 100644 Binary files a/tools/sdk/esp32/lib/libsdmmc.a and b/tools/sdk/esp32/lib/libsdmmc.a differ diff --git a/tools/sdk/esp32/lib/libsmartconfig.a b/tools/sdk/esp32/lib/libsmartconfig.a index ef3dfb41bff..a782b333ed7 100644 Binary files a/tools/sdk/esp32/lib/libsmartconfig.a and b/tools/sdk/esp32/lib/libsmartconfig.a differ diff --git a/tools/sdk/esp32/lib/libsoc.a b/tools/sdk/esp32/lib/libsoc.a index 8603e691a60..d28cc94263d 100644 Binary files a/tools/sdk/esp32/lib/libsoc.a and b/tools/sdk/esp32/lib/libsoc.a differ diff --git a/tools/sdk/esp32/lib/libspi_flash.a b/tools/sdk/esp32/lib/libspi_flash.a index c5d6f4feae7..dce0f3c0a16 100644 Binary files a/tools/sdk/esp32/lib/libspi_flash.a and b/tools/sdk/esp32/lib/libspi_flash.a differ diff --git a/tools/sdk/esp32/lib/libspiffs.a b/tools/sdk/esp32/lib/libspiffs.a index 7cbd700c6f5..c447422e845 100644 Binary files a/tools/sdk/esp32/lib/libspiffs.a and b/tools/sdk/esp32/lib/libspiffs.a differ diff --git a/tools/sdk/esp32/lib/libtcp_transport.a b/tools/sdk/esp32/lib/libtcp_transport.a index 57f40bdb846..83e6944b7b9 100644 Binary files a/tools/sdk/esp32/lib/libtcp_transport.a and b/tools/sdk/esp32/lib/libtcp_transport.a differ diff --git a/tools/sdk/esp32/lib/libtcpip_adapter.a b/tools/sdk/esp32/lib/libtcpip_adapter.a index 19ffbc6ec64..0ddef26c0ed 100644 Binary files a/tools/sdk/esp32/lib/libtcpip_adapter.a and b/tools/sdk/esp32/lib/libtcpip_adapter.a differ diff --git a/tools/sdk/esp32/lib/libulp.a b/tools/sdk/esp32/lib/libulp.a index 05d5018f2e2..2fa8b2d4b3c 100644 Binary files a/tools/sdk/esp32/lib/libulp.a and b/tools/sdk/esp32/lib/libulp.a differ diff --git a/tools/sdk/esp32/lib/libunity.a b/tools/sdk/esp32/lib/libunity.a index 35e35260138..1574393590c 100644 Binary files a/tools/sdk/esp32/lib/libunity.a and b/tools/sdk/esp32/lib/libunity.a differ diff --git a/tools/sdk/esp32/lib/libvfs.a b/tools/sdk/esp32/lib/libvfs.a index 82b0229a873..805865c40c1 100644 Binary files a/tools/sdk/esp32/lib/libvfs.a and b/tools/sdk/esp32/lib/libvfs.a differ diff --git a/tools/sdk/esp32/lib/libwapi.a b/tools/sdk/esp32/lib/libwapi.a index 7b38cf1a955..0532882e65d 100644 Binary files a/tools/sdk/esp32/lib/libwapi.a and b/tools/sdk/esp32/lib/libwapi.a differ diff --git a/tools/sdk/esp32/lib/libwear_levelling.a b/tools/sdk/esp32/lib/libwear_levelling.a index 5ac8c272fc3..4e4275a596a 100644 Binary files a/tools/sdk/esp32/lib/libwear_levelling.a and b/tools/sdk/esp32/lib/libwear_levelling.a differ diff --git a/tools/sdk/esp32/lib/libwifi_provisioning.a b/tools/sdk/esp32/lib/libwifi_provisioning.a index efa00536f66..49724f0ffc8 100644 Binary files a/tools/sdk/esp32/lib/libwifi_provisioning.a and b/tools/sdk/esp32/lib/libwifi_provisioning.a differ diff --git a/tools/sdk/esp32/lib/libwpa_supplicant.a b/tools/sdk/esp32/lib/libwpa_supplicant.a index 9ad335f9321..e5d97f24338 100644 Binary files a/tools/sdk/esp32/lib/libwpa_supplicant.a and b/tools/sdk/esp32/lib/libwpa_supplicant.a differ diff --git a/tools/sdk/esp32/lib/libws2812_led.a b/tools/sdk/esp32/lib/libws2812_led.a index 4d8f16cf099..b9e22b595a8 100644 Binary files a/tools/sdk/esp32/lib/libws2812_led.a and b/tools/sdk/esp32/lib/libws2812_led.a differ diff --git a/tools/sdk/esp32/lib/libxtensa.a b/tools/sdk/esp32/lib/libxtensa.a index e6881f0544c..84de315b03e 100644 Binary files a/tools/sdk/esp32/lib/libxtensa.a and b/tools/sdk/esp32/lib/libxtensa.a differ diff --git a/tools/sdk/esp32/sdkconfig b/tools/sdk/esp32/sdkconfig index 763ac0be1a6..211a303feef 100644 --- a/tools/sdk/esp32/sdkconfig +++ b/tools/sdk/esp32/sdkconfig @@ -553,9 +553,6 @@ CONFIG_SPIRAM_SPIWP_SD3_PIN=7 # CONFIG_ESP32_TRAX is not set CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 -# CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set -CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y -CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 CONFIG_ESP32_ULP_COPROC_ENABLED=y CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=512 CONFIG_ESP32_DEBUG_OCDAWARE=y @@ -569,7 +566,6 @@ CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0=y # CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 is not set # CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 is not set CONFIG_ESP32_BROWNOUT_DET_LVL=0 -CONFIG_ESP32_REDUCE_PHY_TX_POWER=y CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y # CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set # CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set @@ -678,7 +674,15 @@ CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y +# CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set +CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y +CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 # end of MAC Config + +# +# Sleep Config +# +# end of Sleep Config # end of Hardware Settings # @@ -785,6 +789,7 @@ CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y # CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 CONFIG_ESP32_PHY_MAX_TX_POWER=20 +CONFIG_ESP32_REDUCE_PHY_TX_POWER=y # end of PHY # @@ -1035,6 +1040,7 @@ CONFIG_LWIP_PPP_PAP_SUPPORT=y CONFIG_LWIP_PPP_CHAP_SUPPORT=y CONFIG_LWIP_PPP_MSCHAP_SUPPORT=y CONFIG_LWIP_PPP_MPPE_SUPPORT=y +# CONFIG_LWIP_ENABLE_LCP_ECHO is not set # CONFIG_LWIP_PPP_DEBUG_ON is not set # CONFIG_LWIP_SLIP_SUPPORT is not set @@ -1058,13 +1064,6 @@ CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1 CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 # end of SNTP -# -# LCP -# -CONFIG_LCP_ECHOINTERVAL=0 -CONFIG_LCP_MAXECHOFAILS=3 -# end of LCP - CONFIG_LWIP_ESP_LWIP_ASSERT=y # @@ -1081,22 +1080,7 @@ CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y # CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set # end of Hooks -# -# Debug -# -# CONFIG_LWIP_NETIF_DEBUG is not set -# CONFIG_LWIP_PBUF_DEBUG is not set -# CONFIG_LWIP_ETHARP_DEBUG is not set -# CONFIG_LWIP_API_LIB_DEBUG is not set -# CONFIG_LWIP_SOCKETS_DEBUG is not set -# CONFIG_LWIP_IP_DEBUG is not set -# CONFIG_LWIP_ICMP_DEBUG is not set -# CONFIG_LWIP_DHCP_STATE_DEBUG is not set -# CONFIG_LWIP_DHCP_DEBUG is not set -# CONFIG_LWIP_IP6_DEBUG is not set -# CONFIG_LWIP_ICMP6_DEBUG is not set -# CONFIG_LWIP_TCP_DEBUG is not set -# end of Debug +# CONFIG_LWIP_DEBUG is not set # end of LWIP # @@ -1229,6 +1213,7 @@ CONFIG_MDNS_TASK_AFFINITY_CPU0=y # CONFIG_MDNS_TASK_AFFINITY_CPU1 is not set CONFIG_MDNS_TASK_AFFINITY=0x0 CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 +# CONFIG_MDNS_STRICT_MODE is not set CONFIG_MDNS_TIMER_PERIOD_MS=100 # end of mDNS @@ -1273,6 +1258,12 @@ CONFIG_OPENSSL_ASSERT_DO_NOTHING=y # CONFIG_OPENSSL_ASSERT_EXIT is not set # end of OpenSSL +# +# OpenThread +# +# CONFIG_OPENTHREAD_ENABLED is not set +# end of OpenThread + # # PThreads # @@ -1609,9 +1600,6 @@ CONFIG_ADC2_DISABLE_DAC=y CONFIG_SPIRAM_SUPPORT=y # CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST is not set CONFIG_TRACEMEM_RESERVE_DRAM=0x0 -# CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set -CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y -CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 CONFIG_ULP_COPROC_ENABLED=y CONFIG_ULP_COPROC_RESERVE_MEM=512 CONFIG_BROWNOUT_DET=y @@ -1624,7 +1612,6 @@ CONFIG_BROWNOUT_DET_LVL_SEL_0=y # CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set # CONFIG_BROWNOUT_DET_LVL_SEL_7 is not set CONFIG_BROWNOUT_DET_LVL=0 -CONFIG_REDUCE_PHY_TX_POWER=y CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y # CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL is not set # CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC is not set @@ -1634,6 +1621,9 @@ CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y # CONFIG_EVENT_LOOP_PROFILING is not set CONFIG_POST_EVENTS_FROM_ISR=y CONFIG_POST_EVENTS_FROM_IRAM_ISR=y +# CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set +CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y +CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 # CONFIG_ESP32S2_PANIC_PRINT_HALT is not set CONFIG_ESP32S2_PANIC_PRINT_REBOOT=y # CONFIG_ESP32S2_PANIC_SILENT_REBOOT is not set @@ -1658,6 +1648,7 @@ CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y CONFIG_IPC_TASK_STACK_SIZE=1024 CONFIG_TIMER_TASK_STACK_SIZE=4096 CONFIG_SW_COEXIST_ENABLE=y +CONFIG_REDUCE_PHY_TX_POWER=y # CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set # CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y diff --git a/tools/sdk/esp32c3/bin/bootloader_dio_40m.bin b/tools/sdk/esp32c3/bin/bootloader_dio_40m.bin index 9cdc475a39d..043a7613082 100644 Binary files a/tools/sdk/esp32c3/bin/bootloader_dio_40m.bin and b/tools/sdk/esp32c3/bin/bootloader_dio_40m.bin differ diff --git a/tools/sdk/esp32c3/bin/bootloader_dio_80m.bin b/tools/sdk/esp32c3/bin/bootloader_dio_80m.bin index 1e8218dd2a5..8b900914652 100644 Binary files a/tools/sdk/esp32c3/bin/bootloader_dio_80m.bin and b/tools/sdk/esp32c3/bin/bootloader_dio_80m.bin differ diff --git a/tools/sdk/esp32c3/bin/bootloader_dout_40m.bin b/tools/sdk/esp32c3/bin/bootloader_dout_40m.bin index 5bc2c800e39..96fc3173385 100644 Binary files a/tools/sdk/esp32c3/bin/bootloader_dout_40m.bin and b/tools/sdk/esp32c3/bin/bootloader_dout_40m.bin differ diff --git a/tools/sdk/esp32c3/bin/bootloader_dout_80m.bin b/tools/sdk/esp32c3/bin/bootloader_dout_80m.bin index 8b2b6b8f0c6..1b0cb18e624 100644 Binary files a/tools/sdk/esp32c3/bin/bootloader_dout_80m.bin and b/tools/sdk/esp32c3/bin/bootloader_dout_80m.bin differ diff --git a/tools/sdk/esp32c3/bin/bootloader_qio_40m.bin b/tools/sdk/esp32c3/bin/bootloader_qio_40m.bin index 07d8c76d62a..207c7c577c1 100644 Binary files a/tools/sdk/esp32c3/bin/bootloader_qio_40m.bin and b/tools/sdk/esp32c3/bin/bootloader_qio_40m.bin differ diff --git a/tools/sdk/esp32c3/bin/bootloader_qio_80m.bin b/tools/sdk/esp32c3/bin/bootloader_qio_80m.bin index 5cc9a78fdc5..2d797df8065 100644 Binary files a/tools/sdk/esp32c3/bin/bootloader_qio_80m.bin and b/tools/sdk/esp32c3/bin/bootloader_qio_80m.bin differ diff --git a/tools/sdk/esp32c3/bin/bootloader_qout_40m.bin b/tools/sdk/esp32c3/bin/bootloader_qout_40m.bin index 65e965a35cd..78c50287b09 100644 Binary files a/tools/sdk/esp32c3/bin/bootloader_qout_40m.bin and b/tools/sdk/esp32c3/bin/bootloader_qout_40m.bin differ diff --git a/tools/sdk/esp32c3/bin/bootloader_qout_80m.bin b/tools/sdk/esp32c3/bin/bootloader_qout_80m.bin index 5d4e6f331f9..3f7a24ecccf 100644 Binary files a/tools/sdk/esp32c3/bin/bootloader_qout_80m.bin and b/tools/sdk/esp32c3/bin/bootloader_qout_80m.bin differ diff --git a/tools/sdk/esp32c3/include/bt/host/bluedroid/api/include/api/esp_blufi_api.h b/tools/sdk/esp32c3/include/bt/host/bluedroid/api/include/api/esp_blufi_api.h index 5e0d9c3813d..fbd8adb7970 100644 --- a/tools/sdk/esp32c3/include/bt/host/bluedroid/api/include/api/esp_blufi_api.h +++ b/tools/sdk/esp32c3/include/bt/host/bluedroid/api/include/api/esp_blufi_api.h @@ -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 diff --git a/tools/sdk/esp32c3/include/bt/host/bluedroid/api/include/api/esp_gattc_api.h b/tools/sdk/esp32c3/include/bt/host/bluedroid/api/include/api/esp_gattc_api.h index 70a9b1536a9..077cca38507 100644 --- a/tools/sdk/esp32c3/include/bt/host/bluedroid/api/include/api/esp_gattc_api.h +++ b/tools/sdk/esp32c3/include/bt/host/bluedroid/api/include/api/esp_gattc_api.h @@ -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 */ diff --git a/tools/sdk/esp32c3/include/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h b/tools/sdk/esp32c3/include/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h index 53849ba86cb..3d4999f8a7e 100644 --- a/tools/sdk/esp32c3/include/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h +++ b/tools/sdk/esp32c3/include/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h @@ -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); diff --git a/tools/sdk/esp32c3/include/bt/host/bluedroid/api/include/api/esp_hf_client_api.h b/tools/sdk/esp32c3/include/bt/host/bluedroid/api/include/api/esp_hf_client_api.h index 31a8fce38c4..3c5c05b178c 100644 --- a/tools/sdk/esp32c3/include/bt/host/bluedroid/api/include/api/esp_hf_client_api.h +++ b/tools/sdk/esp32c3/include/bt/host/bluedroid/api/include/api/esp_hf_client_api.h @@ -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); diff --git a/tools/sdk/esp32c3/include/config/sdkconfig.h b/tools/sdk/esp32c3/include/config/sdkconfig.h index f1c25868839..cc548951b2b 100644 --- a/tools/sdk/esp32c3/include/config/sdkconfig.h +++ b/tools/sdk/esp32c3/include/config/sdkconfig.h @@ -164,6 +164,7 @@ #define CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT 30 #define CONFIG_BT_BLE_RPA_SUPPORTED 1 #define CONFIG_BT_BLE_50_FEATURES_SUPPORTED 1 +#define CONFIG_BT_BLE_42_FEATURES_SUPPORTED 1 #define CONFIG_BT_RESERVE_DRAM 0xdb5c #define CONFIG_COAP_MBEDTLS_PSK 1 #define CONFIG_COAP_LOG_DEFAULT_LEVEL 0 @@ -178,8 +179,6 @@ #define CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ 160 #define CONFIG_ESP32C3_REV_MIN_0 1 #define CONFIG_ESP32C3_REV_MIN 0 -#define CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES_FOUR 1 -#define CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES 4 #define CONFIG_ESP32C3_DEBUG_OCDAWARE 1 #define CONFIG_ESP32C3_BROWNOUT_DET 1 #define CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_7 1 @@ -205,15 +204,17 @@ #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_ESP32C3_UNIVERSAL_MAC_ADDRESSES_FOUR 1 +#define CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES 4 +#define CONFIG_ESP_SLEEP_POWER_DOWN_FLASH 1 #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 +#define CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP 1 #define CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT 1 #define CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE 1 #define CONFIG_ESP_SYSTEM_RTC_FAST_MEM_AS_HEAP_DEPCHECK 1 #define CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP 1 -#define CONFIG_ESP_SYSTEM_PD_FLASH 1 -#define CONFIG_ESP_SYSTEM_PM_POWER_DOWN_CPU 1 #define CONFIG_ESP_SYSTEM_MEMPROT_FEATURE 1 #define CONFIG_ESP_SYSTEM_MEMPROT_FEATURE_LOCK 1 #define CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE 32 @@ -356,8 +357,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 @@ -526,6 +525,8 @@ #define CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT CONFIG_PTHREAD_TASK_PRIO_DEFAULT #define CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT #define CONFIG_ESP_GRATUITOUS_ARP CONFIG_LWIP_ESP_GRATUITOUS_ARP +#define CONFIG_ESP_SYSTEM_PD_FLASH CONFIG_ESP_SLEEP_POWER_DOWN_FLASH +#define CONFIG_ESP_SYSTEM_PM_POWER_DOWN_CPU CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP #define CONFIG_FLASHMODE_DIO CONFIG_ESPTOOLPY_FLASHMODE_DIO #define CONFIG_GAP_TRACE_LEVEL_WARNING CONFIG_BT_LOG_GAP_TRACE_LEVEL_WARNING #define CONFIG_GARP_TMR_INTERVAL CONFIG_LWIP_GARP_TMR_INTERVAL @@ -597,5 +598,5 @@ #define CONFIG_TIMER_TASK_STACK_SIZE CONFIG_ESP_TIMER_TASK_STACK_SIZE #define CONFIG_TOOLPREFIX CONFIG_SDK_TOOLPREFIX #define CONFIG_UDP_RECVMBOX_SIZE CONFIG_LWIP_UDP_RECVMBOX_SIZE -#define CONFIG_ARDUINO_IDF_COMMIT "1cb31e509" +#define CONFIG_ARDUINO_IDF_COMMIT "cf457d412" #define CONFIG_ARDUINO_IDF_BRANCH "master" diff --git a/tools/sdk/esp32c3/include/driver/include/driver/dedic_gpio.h b/tools/sdk/esp32c3/include/driver/include/driver/dedic_gpio.h index f7d9b4a6ccb..f381e2c64b0 100644 --- a/tools/sdk/esp32c3/include/driver/include/driver/dedic_gpio.h +++ b/tools/sdk/esp32c3/include/driver/include/driver/dedic_gpio.h @@ -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 diff --git a/tools/sdk/esp32c3/include/driver/include/driver/gpio.h b/tools/sdk/esp32c3/include/driver/include/driver/gpio.h index c166ffa2791..aac81566fcc 100644 --- a/tools/sdk/esp32c3/include/driver/include/driver/gpio.h +++ b/tools/sdk/esp32c3/include/driver/include/driver/gpio.h @@ -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 diff --git a/tools/sdk/esp32c3/include/driver/include/driver/i2c.h b/tools/sdk/esp32c3/include/driver/include/driver/i2c.h index 30488fc570d..a2076cc459d 100644 --- a/tools/sdk/esp32c3/include/driver/include/driver/i2c.h +++ b/tools/sdk/esp32c3/include/driver/include/driver/i2c.h @@ -33,9 +33,39 @@ extern "C" { #define I2C_APB_CLK_FREQ APB_CLK_FREQ /*!< I2C source clock is APB clock, 80MHz */ +#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 */ -#define I2C_NUM_MAX (SOC_I2C_NUM) /*!< I2C port max */ +#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 */ diff --git a/tools/sdk/esp32c3/include/driver/include/driver/i2s.h b/tools/sdk/esp32c3/include/driver/include/driver/i2s.h index e5968ad3f71..6b53db68a2a 100644 --- a/tools/sdk/esp32c3/include/driver/include/driver/i2s.h +++ b/tools/sdk/esp32c3/include/driver/include/driver/i2s.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/driver/include/driver/rtc_io.h b/tools/sdk/esp32c3/include/driver/include/driver/rtc_io.h index ea8878223cd..4cdcf74ba48 100644 --- a/tools/sdk/esp32c3/include/driver/include/driver/rtc_io.h +++ b/tools/sdk/esp32c3/include/driver/include/driver/rtc_io.h @@ -17,10 +17,12 @@ #include #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 * diff --git a/tools/sdk/esp32c3/include/driver/include/driver/sdspi_host.h b/tools/sdk/esp32c3/include/driver/include/driver/sdspi_host.h index 064c68ccca5..860ba1bfed4 100644 --- a/tools/sdk/esp32c3/include/driver/include/driver/sdspi_host.h +++ b/tools/sdk/esp32c3/include/driver/include/driver/sdspi_host.h @@ -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. diff --git a/tools/sdk/esp32c3/include/driver/include/driver/spi_common.h b/tools/sdk/esp32c3/include/driver/include/driver/spi_common.h index 05d7d2c7765..5fee265c0ad 100644 --- a/tools/sdk/esp32c3/include/driver/include/driver/spi_common.h +++ b/tools/sdk/esp32c3/include/driver/include/driver/spi_common.h @@ -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 diff --git a/tools/sdk/esp32c3/include/driver/include/driver/spi_slave.h b/tools/sdk/esp32c3/include/driver/include/driver/spi_slave.h index a970159f473..f03104bbc4d 100644 --- a/tools/sdk/esp32c3/include/driver/include/driver/spi_slave.h +++ b/tools/sdk/esp32c3/include/driver/include/driver/spi_slave.h @@ -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 diff --git a/tools/sdk/esp32c3/include/driver/include/esp_private/gpio.h b/tools/sdk/esp32c3/include/driver/include/esp_private/gpio.h new file mode 100644 index 00000000000..1c4811393c0 --- /dev/null +++ b/tools/sdk/esp32c3/include/driver/include/esp_private/gpio.h @@ -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 + +#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 diff --git a/tools/sdk/esp32c3/include/esp32c3/include/esp32c3/clk.h b/tools/sdk/esp32c3/include/esp32c3/include/esp32c3/clk.h deleted file mode 100644 index 1d4e462bcc9..00000000000 --- a/tools/sdk/esp32c3/include/esp32c3/include/esp32c3/clk.h +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2015-2020 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 - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @file esp_clk.h - * - * This file contains declarations of clock related functions. - */ - -/** - * @brief Get the calibration value of RTC slow clock - * - * The value is in the same format as returned by rtc_clk_cal (microseconds, - * in Q13.19 fixed-point format). - * - * @return the calibration value obtained using rtc_clk_cal, at startup time - */ -uint32_t esp_clk_slowclk_cal_get(void); - -/** - * @brief Update the calibration value of RTC slow clock - * - * The value has to be in the same format as returned by rtc_clk_cal (microseconds, - * in Q13.19 fixed-point format). - * This value is used by timekeeping functions (such as gettimeofday) to - * calculate current time based on RTC counter value. - * @param value calibration value obtained using rtc_clk_cal - */ -void esp_clk_slowclk_cal_set(uint32_t value); - -/** - * @brief Return current CPU clock frequency - * When frequency switching is performed, this frequency may change. - * However it is guaranteed that the frequency never changes with a critical - * section. - * - * @return CPU clock frequency, in Hz - */ -int esp_clk_cpu_freq(void); - -/** - * @brief Return current APB clock frequency - * - * When frequency switching is performed, this frequency may change. - * However it is guaranteed that the frequency never changes with a critical - * section. - * - * @return APB clock frequency, in Hz - */ -int esp_clk_apb_freq(void); - - -/** - * @brief Read value of RTC counter, converting it to microseconds - * @attention The value returned by this function may change abruptly when - * calibration value of RTC counter is updated via esp_clk_slowclk_cal_set - * function. This should not happen unless application calls esp_clk_slowclk_cal_set. - * In ESP-IDF, esp_clk_slowclk_cal_set is only called in startup code. - * - * @return Value or RTC counter, expressed in microseconds - */ -uint64_t esp_clk_rtc_time(void); - -#ifdef __cplusplus -} -#endif diff --git a/tools/sdk/esp32c3/include/esp32c3/include/esp32c3/memprot.h b/tools/sdk/esp32c3/include/esp32c3/include/esp32c3/memprot.h index 9085fd8e066..094f28f42e0 100644 --- a/tools/sdk/esp32c3/include/esp32c3/include/esp32c3/memprot.h +++ b/tools/sdk/esp32c3/include/esp32c3/include/esp32c3/memprot.h @@ -26,6 +26,22 @@ extern "C" { #endif +#ifndef IRAM_SRAM_START +#define IRAM_SRAM_START 0x4037C000 +#endif + +#ifndef DRAM_SRAM_START +#define DRAM_SRAM_START 0x3FC7C000 +#endif + +#ifndef MAP_DRAM_TO_IRAM +#define MAP_DRAM_TO_IRAM(addr) (addr - DRAM_SRAM_START + IRAM_SRAM_START) +#endif + +#ifndef MAP_IRAM_TO_DRAM +#define MAP_IRAM_TO_DRAM(addr) (addr - IRAM_SRAM_START + DRAM_SRAM_START) +#endif + typedef enum { MEMPROT_NONE = 0x00000000, MEMPROT_IRAM0_SRAM = 0x00000001, @@ -34,6 +50,7 @@ typedef enum { } mem_type_prot_t; typedef enum { + MEMPROT_SPLITLINE_NONE = 0, MEMPROT_IRAM0_DRAM0_SPLITLINE, MEMPROT_IRAM0_LINE_0_SPLITLINE, MEMPROT_IRAM0_LINE_1_SPLITLINE, @@ -42,6 +59,7 @@ typedef enum { } split_line_t; typedef enum { + MEMPROT_PMS_AREA_NONE = 0, MEMPROT_IRAM0_PMS_AREA_0, MEMPROT_IRAM0_PMS_AREA_1, MEMPROT_IRAM0_PMS_AREA_2, @@ -52,43 +70,386 @@ typedef enum { MEMPROT_DRAM0_PMS_AREA_3 } pms_area_t; +typedef enum +{ + MEMPROT_PMS_WORLD_0 = 0, + MEMPROT_PMS_WORLD_1, + MEMPROT_PMS_WORLD_2, + MEMPROT_PMS_WORLD_INVALID = 0xFFFFFFFF +} pms_world_t; + +typedef enum +{ + MEMPROT_PMS_OP_READ = 0, + MEMPROT_PMS_OP_WRITE, + MEMPROT_PMS_OP_FETCH, + MEMPROT_PMS_OP_INVALID = 0xFFFFFFFF +} pms_operation_type_t; + +/** + * @brief Converts Memory protection type to string + * + * @param mem_type Memory protection type (see mem_type_prot_t enum) + */ +const char *esp_memprot_mem_type_to_str(mem_type_prot_t mem_type); + +/** + * @brief Converts Split line type to string + * + * @param line_type Split line type (see split_line_t enum) + */ +const char *esp_memprot_split_line_to_str(split_line_t line_type); + +/** + * @brief Converts PMS Area type to string + * + * @param area_type PMS Area type (see pms_area_t enum) + */ +const char *esp_memprot_pms_to_str(pms_area_t area_type); + +/** + * @brief Returns PMS splitting address for given Split line type + * + * The value is taken from PMS configuration registers (IRam0 range) + * For details on split lines see 'esp_memprot_set_prot_int' function description + * + * @param line_type Split line type (see split_line_t enum) + * + * @return appropriate split line address + */ +uint32_t *esp_memprot_get_split_addr(split_line_t line_type); + +/** + * @brief Returns default main IRAM/DRAM splitting address + * + * The address value is given by _iram_text_end global (IRam0 range) + + * @return Main I/D split line (IRam0_DRam0_Split_Addr) + */ +void *esp_memprot_get_default_main_split_addr(void); -const char *mem_type_to_str(mem_type_prot_t mem_type); -const char *split_line_to_str(split_line_t line_type); -const char *pms_to_str(pms_area_t area_type); +/** + * @brief Sets a lock for the main IRAM/DRAM splitting address + * + * Locks can be unlocked only by digital system reset + */ +void esp_memprot_set_split_line_lock(void); -void *esp_memprot_get_main_split_addr(void); -void esp_memprot_set_split_line_lock(bool lock); +/** + * @brief Gets a lock status for the main IRAM/DRAM splitting address + * + * @return true/false (locked/unlocked) + */ bool esp_memprot_get_split_line_lock(void); + +/** + * @brief Sets required split line address + * + * @param line_type Split line type (see split_line_t enum) + * @param line_addr target address from a memory range relevant to given line_type (IRAM/DRAM) + */ void esp_memprot_set_split_line(split_line_t line_type, const void *line_addr); -void esp_memprot_set_pms_lock(mem_type_prot_t mem_type, bool lock); +/** + * @brief Sets a lock for PMS Area settings of required Memory type + * + * Locks can be unlocked only by digital system reset + * + * @param mem_type Memory protection type (see mem_type_prot_t enum) + */ +void esp_memprot_set_pms_lock(mem_type_prot_t mem_type); + +/** + * @brief Gets a lock status for PMS Area settings of required Memory type + * + * @param mem_type Memory protection type (see mem_type_prot_t enum) + * + * @return true/false (locked/unlocked) + */ bool esp_memprot_get_pms_lock(mem_type_prot_t mem_type); + +/** + * @brief Sets permissions for given PMS Area in IRam0 memory range (MEMPROT_IRAM0_SRAM) + * + * @param area_type IRam0 PMS Area type (see pms_area_t enum) + * @param r Read permission flag + * @param w Write permission flag + * @param x Execute permission flag + */ void esp_memprot_iram_set_pms_area(pms_area_t area_type, bool r, bool w, bool x); + +/** + * @brief Gets current permissions for given PMS Area in IRam0 memory range (MEMPROT_IRAM0_SRAM) + * + * @param area_type IRam0 PMS Area type (see pms_area_t enum) + * @param r Read permission flag holder + * @param w Write permission flag holder + * @param x Execute permission flag holder + */ +void esp_memprot_iram_get_pms_area(pms_area_t area_type, bool *r, bool *w, bool *x); + +/** + * @brief Sets permissions for given PMS Area in DRam0 memory range (MEMPROT_DRAM0_SRAM) + * + * @param area_type DRam0 PMS Area type (see pms_area_t enum) + * @param r Read permission flag + * @param w Write permission flag + */ void esp_memprot_dram_set_pms_area(pms_area_t area_type, bool r, bool w); -void esp_memprot_set_monitor_lock(mem_type_prot_t mem_type, bool lock); +/** + * @brief Gets current permissions for given PMS Area in DRam0 memory range (MEMPROT_DRAM0_SRAM) + * + * @param area_type DRam0 PMS Area type (see pms_area_t enum) + * @param r Read permission flag holder + * @param w Write permission flag holder + */ +void esp_memprot_dram_get_pms_area(pms_area_t area_type, bool *r, bool *w); + +/** + * @brief Sets a lock for PMS interrupt monitor settings of required Memory type + * + * Locks can be unlocked only by digital system reset + * + * @param mem_type Memory protection type (see mem_type_prot_t enum) + */ +void esp_memprot_set_monitor_lock(mem_type_prot_t mem_type); + +/** + * @brief Gets a lock status for PMS interrupt monitor settings of required Memory type + * + * @param mem_type Memory protection type (see mem_type_prot_t enum) + * + * @return true/false (locked/unlocked) + */ bool esp_memprot_get_monitor_lock(mem_type_prot_t mem_type); + +/** + * @brief Enable PMS violation interrupt monitoring of required Memory type + * + * @param mem_type Memory protection type (see mem_type_prot_t enum) + * @param enable/disable + */ void esp_memprot_set_monitor_en(mem_type_prot_t mem_type, bool enable); + +/** + * @brief Gets enable/disable status for PMS interrupt monitor settings of required Memory type + * + * @param mem_type Memory protection type (see mem_type_prot_t enum) + * + * @return true/false (enabled/disabled) + */ bool esp_memprot_get_monitor_en(mem_type_prot_t mem_type); +/** + * @brief Gets CPU ID for currently active PMS violation interrupt + * + * @return CPU ID (CPU_PRO for ESP32C3) + */ int IRAM_ATTR esp_memprot_intr_get_cpuid(void); + +/** + * @brief Clears current interrupt ON flag for given Memory type + * + * Interrupt clearing happens in two steps: + * 1. Interrupt CLR flag is set (to clear the interrupt ON status) + * 2. Interrupt CLR flag is reset (to allow further monitoring) + * This operation is non-atomic by PMS module design + * + * @param mem_type Memory protection type (see mem_type_prot_t enum) + */ void IRAM_ATTR esp_memprot_monitor_clear_intr(mem_type_prot_t mem_type); + +/** + * @brief Returns active PMS violation interrupt (if any) + * + * This function iterates through supported Memory type status registers + * and returns the first interrupt-on flag. If none is found active, + * MEMPROT_NONE is returned. + * Order of checking (in current version): + * 1. MEMPROT_IRAM0_SRAM + * 2. MEMPROT_DRAM0_SRAM + * + * @return mem_type Memory protection type related to active interrupt found (see mem_type_prot_t enum) + */ mem_type_prot_t IRAM_ATTR esp_memprot_get_active_intr_memtype(void); + +/** + * @brief Checks whether any violation interrupt is active + * + * @return true/false (yes/no) + */ bool IRAM_ATTR esp_memprot_is_locked_any(void); + +/** + * @brief Checks whether any violation interrupt is enabled + * + * @return true/false (yes/no) + */ bool IRAM_ATTR esp_memprot_is_intr_ena_any(void); -uint32_t IRAM_ATTR esp_memprot_get_violate_intr_on(mem_type_prot_t mem_type); +/** + * @brief Checks whether any violation interrupt is enabled + * + * @return true/false (yes/no) + */ +bool IRAM_ATTR esp_memprot_get_violate_intr_on(mem_type_prot_t mem_type); + +/** + * @brief Returns the address which caused the violation interrupt (if any) + * + * The address is taken from appropriate PMS violation status register, based given Memory type + * + * @param mem_type Memory protection type (see mem_type_prot_t enum) + * + * @return faulting address + */ uint32_t IRAM_ATTR esp_memprot_get_violate_addr(mem_type_prot_t mem_type); -uint32_t IRAM_ATTR esp_memprot_get_violate_world(mem_type_prot_t mem_type); -uint32_t IRAM_ATTR esp_memprot_get_violate_wr(mem_type_prot_t mem_type); -uint32_t IRAM_ATTR esp_memprot_get_violate_loadstore(mem_type_prot_t mem_type); + +/** + * @brief Returns the World identifier of the code causing the violation interrupt (if any) + * + * The value is taken from appropriate PMS violation status register, based given Memory type + * + * @param mem_type Memory protection type (see mem_type_prot_t enum) + * + * @return World identifier (see pms_world_t enum) + */ +pms_world_t IRAM_ATTR esp_memprot_get_violate_world(mem_type_prot_t mem_type); + +/** + * @brief Returns Read or Write operation type which caused the violation interrupt (if any) + * + * The value (bit) is taken from appropriate PMS violation status register, based given Memory type + * + * @param mem_type Memory protection type (see mem_type_prot_t enum) + * + * @return PMS operation type relevant to mem_type parameter (se pms_operation_type_t) + */ +pms_operation_type_t IRAM_ATTR esp_memprot_get_violate_wr(mem_type_prot_t mem_type); + +/** + * @brief Returns LoadStore flag of the operation type which caused the violation interrupt (if any) + * + * The value (bit) is taken from appropriate PMS violation status register, based given Memory type + * Effective only on IRam0 access + * + * @param mem_type Memory protection type (see mem_type_prot_t enum) + * + * @return true/false (LoadStore bit on/off) + */ +bool IRAM_ATTR esp_memprot_get_violate_loadstore(mem_type_prot_t mem_type); + +/** + * @brief Returns byte-enables for the address which caused the violation interrupt (if any) + * + * The value is taken from appropriate PMS violation status register, based given Memory type + * + * @param mem_type Memory protection type (see mem_type_prot_t enum) + * + * @return byte-enables + */ uint32_t IRAM_ATTR esp_memprot_get_violate_byte_en(mem_type_prot_t mem_type); +/** + * @brief Returns raw contents of DRam0 status register 1 + * + * @return 32-bit register value + */ +uint32_t IRAM_ATTR esp_memprot_get_dram_status_reg_1(void); + +/** + * @brief Returns raw contents of DRam0 status register 2 + * + * @return 32-bit register value + */ +uint32_t IRAM_ATTR esp_memprot_get_dram_status_reg_2(void); + +/** + * @brief Returns raw contents of IRam0 status register + * + * @return 32-bit register value + */ +uint32_t IRAM_ATTR esp_memprot_get_iram_status_reg(void); + +/** + * @brief Register PMS violation interrupt in global interrupt matrix for given Memory type + * + * Memory protection components uses specific interrupt number, see ETS_MEMPROT_ERR_INUM + * The registration makes the panic-handler routine being called when the interrupt appears + * + * @param mem_type Memory protection type (see mem_type_prot_t enum) + */ void esp_memprot_set_intr_matrix(mem_type_prot_t mem_type); + +/** + * @brief Convenient routine for setting the PMS defaults + * + * Called on application startup, depending on CONFIG_ESP_SYSTEM_MEMPROT_FEATURE Kconfig settings + * For implementation details see 'esp_memprot_set_prot_int' description + * + * @param invoke_panic_handler register all interrupts for panic handling (true/false) + * @param lock_feature lock the defaults to prevent further PMS settings changes (true/false) + * @param mem_type_mask 32-bit field of specific PMS parts to configure (see 'esp_memprot_set_prot_int') + */ void esp_memprot_set_prot(bool invoke_panic_handler, bool lock_feature, uint32_t *mem_type_mask); + +/** + * @brief Internal routine for setting the PMS defaults + * + * Called on application startup from within 'esp_memprot_set_prot'. Allows setting a specific splitting address + * (main I/D split line) - see the parameter 'split_addr'. If the 'split_addr' equals to NULL, default I/D split line + * is used (&_iram_text_end) and all the remaining lines share the same address. + * The function sets all the split lines and PMS areas to the same space, + * ie there is a single instruction space and single data space at the end. + * The PMS split lines and permission areas scheme described below: + * + * DRam0/DMA IRam0 + * ----------------------------------------------- + * ... | IRam0_PMS_0 | + * DRam0_PMS_0 ----------------------------------------------- IRam0_line1_Split_addr + * ... | IRam0_PMS_1 | + * ... ----------------------------------------------- IRam0_line0_Split_addr + * | IRam0_PMS_2 | + * =============================================== IRam0_DRam0_Split_addr (main I/D) + * | DRam0_PMS_1 | + * DRam0_DMA_line0_Split_addr ----------------------------------------------- ... + * | DRam0_PMS_2 | ... + * DRam0_DMA_line1_Split_addr ----------------------------------------------- IRam0_PMS_3 + * | DRam0_PMS_3 | ... + * ----------------------------------------------- + * + * Default settings provided by 'esp_memprot_set_prot_int' are as follows: + * + * DRam0/DMA IRam0 + * ----------------------------------------------- + * | IRam0_PMS_0 = IRam0_PMS_1 = IRam0_PMS_2 | + * | DRam0_PMS_0 | IRam0_line1_Split_addr + * DRam0_DMA_line0_Split_addr | | = + * = =============================================== IRam0_line0_Split_addr + * DRam0_DMA_line1_Split_addr | | = + * | DRam0_PMS_1 = DRam0_PMS_2 = DRam0_PMS_3 | IRam0_DRam0_Split_addr (main I/D) + * | IRam0_PMS_3 | + * ----------------------------------------------- + * + * Once the memprot feature is locked, it can be unlocked only by digital system reset + * + * @param invoke_panic_handler register all the violation interrupts for panic handling (true/false) + * @param lock_feature lock the defaults to prevent further PMS settings changes (true/false) + * @param split_addr specific main I/D adrees or NULL to use default ($_iram_text_end) + * @param mem_type_mask 32-bit field of specific PMS parts to configure (members of mem_type_prot_t) + */ void esp_memprot_set_prot_int(bool invoke_panic_handler, bool lock_feature, void *split_addr, uint32_t *mem_type_mask); +/** + * @brief Returns raw contents of PMS interrupt monitor register for given Memory type + * + * @param mem_type Memory protection type (see mem_type_prot_t enum) + * + * @return 32-bit register value + */ +uint32_t esp_memprot_get_monitor_enable_reg(mem_type_prot_t mem_type); + #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32c3/include/esp32c3/include/esp_clk.h b/tools/sdk/esp32c3/include/esp32c3/include/esp_clk.h deleted file mode 100644 index 78f6678aace..00000000000 --- a/tools/sdk/esp32c3/include/esp32c3/include/esp_clk.h +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2015-2020 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 - -/** - * @file esp_clk.h - * - * This file contains declarations of clock related functions. - */ - -/** - * @brief Get the calibration value of RTC slow clock - * - * The value is in the same format as returned by rtc_clk_cal (microseconds, - * in Q13.19 fixed-point format). - * - * @return the calibration value obtained using rtc_clk_cal, at startup time - */ -uint32_t esp_clk_slowclk_cal_get(void); - -/** - * @brief Update the calibration value of RTC slow clock - * - * The value has to be in the same format as returned by rtc_clk_cal (microseconds, - * in Q13.19 fixed-point format). - * This value is used by timekeeping functions (such as gettimeofday) to - * calculate current time based on RTC counter value. - * @param value calibration value obtained using rtc_clk_cal - */ -void esp_clk_slowclk_cal_set(uint32_t value); - -/** - * @brief Return current CPU clock frequency - * When frequency switching is performed, this frequency may change. - * However it is guaranteed that the frequency never changes with a critical - * section. - * - * @return CPU clock frequency, in Hz - */ -int esp_clk_cpu_freq(void); - -/** - * @brief Return current APB clock frequency - * - * When frequency switching is performed, this frequency may change. - * However it is guaranteed that the frequency never changes with a critical - * section. - * - * @return APB clock frequency, in Hz - */ -int esp_clk_apb_freq(void); - - -/** - * @brief Read value of RTC counter, converting it to microseconds - * @attention The value returned by this function may change abruptly when - * calibration value of RTC counter is updated via esp_clk_slowclk_cal_set - * function. This should not happen unless application calls esp_clk_slowclk_cal_set. - * In ESP-IDF, esp_clk_slowclk_cal_set is only called in startup code. - * - * @return Value or RTC counter, expressed in microseconds - */ -uint64_t esp_clk_rtc_time(void); diff --git a/tools/sdk/esp32c3/include/esp_http_client/include/esp_http_client.h b/tools/sdk/esp32c3/include/esp_http_client/include/esp_http_client.h index ee19f70cd7a..249eb217baf 100644 --- a/tools/sdk/esp32c3/include/esp_http_client/include/esp_http_client.h +++ b/tools/sdk/esp32c3/include/esp_http_client/include/esp_http_client.h @@ -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) */ diff --git a/tools/sdk/esp32c3/include/esp_system/include/esp_async_memcpy.h b/tools/sdk/esp32c3/include/esp_hw_support/include/esp_async_memcpy.h similarity index 100% rename from tools/sdk/esp32c3/include/esp_system/include/esp_async_memcpy.h rename to tools/sdk/esp32c3/include/esp_hw_support/include/esp_async_memcpy.h diff --git a/tools/sdk/esp32c3/include/esp_hw_support/include/esp_chip_info.h b/tools/sdk/esp32c3/include/esp_hw_support/include/esp_chip_info.h new file mode 100644 index 00000000000..35b191ac25b --- /dev/null +++ b/tools/sdk/esp32c3/include/esp_hw_support/include/esp_chip_info.h @@ -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 +#include +#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 diff --git a/tools/sdk/esp32c3/include/esp_hw_support/include/esp_clk.h b/tools/sdk/esp32c3/include/esp_hw_support/include/esp_clk.h new file mode 100644 index 00000000000..920f310c920 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp_hw_support/include/esp_clk.h @@ -0,0 +1,2 @@ +#warning esp_clk.h has been replaced by esp32/clk.h, please include esp32/clk.h instead +#include "esp32/clk.h" diff --git a/tools/sdk/esp32s2/include/esp32s2/include/esp_intr.h b/tools/sdk/esp32c3/include/esp_hw_support/include/esp_intr.h similarity index 100% rename from tools/sdk/esp32s2/include/esp32s2/include/esp_intr.h rename to tools/sdk/esp32c3/include/esp_hw_support/include/esp_intr.h diff --git a/tools/sdk/esp32c3/include/esp_system/include/esp_intr_alloc.h b/tools/sdk/esp32c3/include/esp_hw_support/include/esp_intr_alloc.h similarity index 100% rename from tools/sdk/esp32c3/include/esp_system/include/esp_intr_alloc.h rename to tools/sdk/esp32c3/include/esp_hw_support/include/esp_intr_alloc.h diff --git a/tools/sdk/esp32c3/include/esp_hw_support/include/esp_mac.h b/tools/sdk/esp32c3/include/esp_hw_support/include/esp_mac.h new file mode 100644 index 00000000000..9d91d8cee41 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp_hw_support/include/esp_mac.h @@ -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 + * `. + * 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 diff --git a/tools/sdk/esp32s2/include/esp32s2/include/esp32s2/clk.h b/tools/sdk/esp32c3/include/esp_hw_support/include/esp_private/esp_clk.h similarity index 88% rename from tools/sdk/esp32s2/include/esp32s2/include/esp32s2/clk.h rename to tools/sdk/esp32c3/include/esp_hw_support/include/esp_private/esp_clk.h index 8a0952fadcb..14326898bd7 100644 --- a/tools/sdk/esp32s2/include/esp32s2/include/esp32s2/clk.h +++ b/tools/sdk/esp32c3/include/esp_hw_support/include/esp_private/esp_clk.h @@ -67,6 +67,17 @@ int esp_clk_cpu_freq(void); */ int esp_clk_apb_freq(void); +/** + * @brief Return frequency of the main XTAL + * + * Frequency of the main XTAL can be either auto-detected or set at compile + * time (see CONFIG_ESP32_XTAL_FREQ_SEL sdkconfig option). In both cases, this + * function returns the actual value at run time. + * + * @return XTAL frequency, in Hz + */ +int esp_clk_xtal_freq(void); + /** * @brief Read value of RTC counter, converting it to microseconds diff --git a/tools/sdk/esp32c3/include/esp_hw_support/include/esp_random.h b/tools/sdk/esp32c3/include/esp_hw_support/include/esp_random.h new file mode 100644 index 00000000000..26756b9db87 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp_hw_support/include/esp_random.h @@ -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 +#include + +#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 diff --git a/tools/sdk/esp32c3/include/esp_system/include/esp_sleep.h b/tools/sdk/esp32c3/include/esp_hw_support/include/esp_sleep.h similarity index 98% rename from tools/sdk/esp32c3/include/esp_system/include/esp_sleep.h rename to tools/sdk/esp32c3/include/esp_hw_support/include/esp_sleep.h index d84933cde5a..1d81f716a8c 100644 --- a/tools/sdk/esp32c3/include/esp_system/include/esp_sleep.h +++ b/tools/sdk/esp32c3/include/esp_hw_support/include/esp_sleep.h @@ -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 diff --git a/tools/sdk/esp32c3/include/esp_hw_support/include/soc/esp32/clk.h b/tools/sdk/esp32c3/include/esp_hw_support/include/soc/esp32/clk.h new file mode 100644 index 00000000000..31902ebad01 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp_hw_support/include/soc/esp32/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" diff --git a/tools/sdk/esp32c3/include/esp_hw_support/include/soc/esp32c3/clk.h b/tools/sdk/esp32c3/include/esp_hw_support/include/soc/esp32c3/clk.h new file mode 100644 index 00000000000..31902ebad01 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp_hw_support/include/soc/esp32c3/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" diff --git a/tools/sdk/esp32c3/include/esp_hw_support/include/soc/esp32s2/clk.h b/tools/sdk/esp32c3/include/esp_hw_support/include/soc/esp32s2/clk.h new file mode 100644 index 00000000000..31902ebad01 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp_hw_support/include/soc/esp32s2/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" diff --git a/tools/sdk/esp32c3/include/esp_hw_support/include/soc/esp32s3/clk.h b/tools/sdk/esp32c3/include/esp_hw_support/include/soc/esp32s3/clk.h new file mode 100644 index 00000000000..31902ebad01 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp_hw_support/include/soc/esp32s3/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" diff --git a/tools/sdk/esp32c3/include/esp_pm/include/esp_pm.h b/tools/sdk/esp32c3/include/esp_pm/include/esp_pm.h index 4d5146316b4..86a404286f8 100644 --- a/tools/sdk/esp32c3/include/esp_pm/include/esp_pm.h +++ b/tools/sdk/esp32c3/include/esp_pm/include/esp_pm.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 diff --git a/tools/sdk/esp32c3/include/esp_system/include/esp_debug_helpers.h b/tools/sdk/esp32c3/include/esp_system/include/esp_debug_helpers.h index a802cb40235..c64df641e1b 100644 --- a/tools/sdk/esp32c3/include/esp_system/include/esp_debug_helpers.h +++ b/tools/sdk/esp32c3/include/esp_system/include/esp_debug_helpers.h @@ -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 * diff --git a/tools/sdk/esp32c3/include/esp_system/include/esp_private/crosscore_int.h b/tools/sdk/esp32c3/include/esp_system/include/esp_private/crosscore_int.h index bac4afba29e..1d6ec809b9f 100644 --- a/tools/sdk/esp32c3/include/esp_system/include/esp_private/crosscore_int.h +++ b/tools/sdk/esp32c3/include/esp_system/include/esp_private/crosscore_int.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/esp_system/include/esp_private/startup_internal.h b/tools/sdk/esp32c3/include/esp_system/include/esp_private/startup_internal.h index 42b901cbf4a..52ec6e09b37 100644 --- a/tools/sdk/esp32c3/include/esp_system/include/esp_private/startup_internal.h +++ b/tools/sdk/esp32c3/include/esp_system/include/esp_private/startup_internal.h @@ -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. diff --git a/tools/sdk/esp32c3/include/esp_system/include/esp_system.h b/tools/sdk/esp32c3/include/esp_system/include/esp_system.h index bd9bb1a6c42..b98b7194902 100644 --- a/tools/sdk/esp32c3/include/esp_system/include/esp_system.h +++ b/tools/sdk/esp32c3/include/esp_system/include/esp_system.h @@ -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 - * `. - * 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 diff --git a/tools/sdk/esp32c3/include/esp32c3/include/esp32c3/brownout.h b/tools/sdk/esp32c3/include/esp_system/port/public_compat/brownout.h similarity index 99% rename from tools/sdk/esp32c3/include/esp32c3/include/esp32c3/brownout.h rename to tools/sdk/esp32c3/include/esp_system/port/public_compat/brownout.h index da58a093093..397092cd440 100644 --- a/tools/sdk/esp32c3/include/esp32c3/include/esp32c3/brownout.h +++ b/tools/sdk/esp32c3/include/esp_system/port/public_compat/brownout.h @@ -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 diff --git a/tools/sdk/esp32/include/esp32/include/esp32/cache_err_int.h b/tools/sdk/esp32c3/include/esp_system/port/public_compat/cache_err_int.h similarity index 75% rename from tools/sdk/esp32/include/esp32/include/esp32/cache_err_int.h rename to tools/sdk/esp32c3/include/esp_system/port/public_compat/cache_err_int.h index efd7da06c01..d87406f80f7 100644 --- a/tools/sdk/esp32/include/esp32/include/esp32/cache_err_int.h +++ b/tools/sdk/esp32c3/include/esp_system/port/public_compat/cache_err_int.h @@ -12,22 +12,34 @@ // See the License for the specific language governing permissions and // limitations under the License. +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif /** * @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 * - (-1) otherwise */ int esp_cache_err_get_cpuid(void); + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/esp32c3/include/esp_system/port/public_compat/trax.h b/tools/sdk/esp32c3/include/esp_system/port/public_compat/trax.h new file mode 100644 index 00000000000..1322b7b5850 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp_system/port/public_compat/trax.h @@ -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 diff --git a/tools/sdk/esp32c3/include/esp_system/port/soc/esp32/cache_err_int.h b/tools/sdk/esp32c3/include/esp_system/port/soc/esp32/cache_err_int.h new file mode 100644 index 00000000000..07085f53090 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp_system/port/soc/esp32/cache_err_int.h @@ -0,0 +1,2 @@ +#pragma once +#include "cache_err_int.h" diff --git a/tools/sdk/esp32c3/include/esp_system/port/soc/esp32c3/cache_err_int.h b/tools/sdk/esp32c3/include/esp_system/port/soc/esp32c3/cache_err_int.h new file mode 100644 index 00000000000..07085f53090 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp_system/port/soc/esp32c3/cache_err_int.h @@ -0,0 +1,2 @@ +#pragma once +#include "cache_err_int.h" diff --git a/tools/sdk/esp32c3/include/esp_system/port/soc/esp32s2/cache_err_int.h b/tools/sdk/esp32c3/include/esp_system/port/soc/esp32s2/cache_err_int.h new file mode 100644 index 00000000000..07085f53090 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp_system/port/soc/esp32s2/cache_err_int.h @@ -0,0 +1,2 @@ +#pragma once +#include "cache_err_int.h" diff --git a/tools/sdk/esp32c3/include/esp_system/port/soc/esp32s3/cache_err_int.h b/tools/sdk/esp32c3/include/esp_system/port/soc/esp32s3/cache_err_int.h new file mode 100644 index 00000000000..07085f53090 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp_system/port/soc/esp32s3/cache_err_int.h @@ -0,0 +1,2 @@ +#pragma once +#include "cache_err_int.h" diff --git a/tools/sdk/esp32c3/include/espcoredump/include/esp_core_dump.h b/tools/sdk/esp32c3/include/espcoredump/include/esp_core_dump.h index fb0d44d2c81..f8b029d5b6d 100644 --- a/tools/sdk/esp32c3/include/espcoredump/include/esp_core_dump.h +++ b/tools/sdk/esp32c3/include/espcoredump/include/esp_core_dump.h @@ -17,11 +17,37 @@ #include #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 diff --git a/tools/sdk/esp32c3/include/esp_system/include/esp_private/sleep_modes.h b/tools/sdk/esp32c3/include/espcoredump/include/port/riscv/esp_core_dump_summary_extra_info.h similarity index 58% rename from tools/sdk/esp32c3/include/esp_system/include/esp_private/sleep_modes.h rename to tools/sdk/esp32c3/include/espcoredump/include/port/riscv/esp_core_dump_summary_extra_info.h index e1584a8b573..510fdc06afe 100644 --- a/tools/sdk/esp32c3/include/esp_system/include/esp_private/sleep_modes.h +++ b/tools/sdk/esp32c3/include/espcoredump/include/port/riscv/esp_core_dump_summary_extra_info.h @@ -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 -#include #include -#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 } diff --git a/tools/sdk/esp32c3/include/espcoredump/include/port/xtensa/esp_core_dump_summary_extra_info.h b/tools/sdk/esp32c3/include/espcoredump/include/port/xtensa/esp_core_dump_summary_extra_info.h new file mode 100644 index 00000000000..3db7a70be82 --- /dev/null +++ b/tools/sdk/esp32c3/include/espcoredump/include/port/xtensa/esp_core_dump_summary_extra_info.h @@ -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 +#include + +#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 diff --git a/tools/sdk/esp32c3/include/freertos/include/freertos/task.h b/tools/sdk/esp32c3/include/freertos/include/freertos/task.h index 422948a2458..559945805ee 100644 --- a/tools/sdk/esp32c3/include/freertos/include/freertos/task.h +++ b/tools/sdk/esp32c3/include/freertos/include/freertos/task.h @@ -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 diff --git a/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/gpio_ll.h b/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/gpio_ll.h index 5fdd8f38bb2..6ba4d601b9f 100644 --- a/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/gpio_ll.h +++ b/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/gpio_ll.h @@ -32,6 +32,17 @@ extern "C" { #endif +/* + * The following defines are used to disable USB JTAG when pins 18 and pins 19 + * are set to be used as GPIO. + * See gpio_pad_select_gpio() below. + * + * TODO: Delete these definitions once the USB device registers definition is + * merged. + */ +#define USB_DEVICE_CONF0_REG (0x60043018) +#define USB_DEVICE_USB_PAD_ENABLE (BIT(14)) + // Get GPIO hardware instance with giving gpio num #define GPIO_LL_GET_HW(num) (((num) == 0) ? (&GPIO) : NULL) @@ -379,6 +390,20 @@ 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) +{ + if (pin_name == IO_MUX_GPIO18_REG || pin_name == IO_MUX_GPIO19_REG) { + CLEAR_PERI_REG_MASK(USB_DEVICE_CONF0_REG, USB_DEVICE_USB_PAD_ENABLE); + } + PIN_FUNC_SELECT(pin_name, func); +} + /** * @brief Set peripheral output to an GPIO pad through the IOMUX. * @@ -392,7 +417,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); } static inline void gpio_ll_force_hold_all(gpio_dev_t *hw) diff --git a/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/i2c_ll.h b/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/i2c_ll.h index eb23135ee92..88d4493b0e1 100644 --- a/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/i2c_ll.h +++ b/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/i2c_ll.h @@ -905,6 +905,7 @@ static inline void i2c_ll_slave_init(i2c_dev_t *hw) ctrl_reg.sda_force_out = 1; ctrl_reg.scl_force_out = 1; hw->ctr.val = ctrl_reg.val; + hw->ctr.slv_tx_auto_start_en = 1; hw->fifo_conf.fifo_addr_cfg_en = 0; } diff --git a/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/memprot_ll.h b/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/memprot_ll.h index 127d51b3078..5da2b452d32 100644 --- a/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/memprot_ll.h +++ b/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/memprot_ll.h @@ -15,21 +15,19 @@ #pragma once #include "soc/sensitive_reg.h" +#include "soc/cache_memory.h" #ifdef __cplusplus extern "C" { #endif -/** - * === globals ==== +/* ****************************************************************************************************** + * *** GLOBALS *** + * NOTE: in this version, all the configurations apply only to WORLD_0 */ -#ifndef SRAM_IRAM_START -#define SRAM_IRAM_START 0x4037C000 -#endif -#ifndef SRAM_DRAM_START -#define SRAM_DRAM_START 0x3FC7C000 -#endif +#define IRAM_SRAM_START 0x4037C000 +#define DRAM_SRAM_START 0x3FC7C000 /* ICache size is fixed to 16KB on ESP32-C3 */ #ifndef ICACHE_SIZE @@ -40,36 +38,12 @@ extern "C" { #define I_D_SRAM_SEGMENT_SIZE 0x20000 #endif -#ifndef I_D_SRAM_OFFSET -#define I_D_SRAM_OFFSET (SRAM_IRAM_START - SRAM_DRAM_START) -#endif - -/* 2nd stage bootloader iram_loader_seg start address */ -#ifndef SRAM_DRAM_END -#define SRAM_DRAM_END (0x403D0000 - I_D_SRAM_OFFSET) -#endif - -#ifndef SRAM_IRAM_ORG -#define SRAM_IRAM_ORG (SRAM_IRAM_START + ICACHE_SIZE) -#endif - -#ifndef SRAM_DRAM_ORG -#define SRAM_DRAM_ORG (SRAM_DRAM_START + ICACHE_SIZE) -#endif - -#ifndef I_D_SRAM_SIZE -#define I_D_SRAM_SIZE SRAM_DRAM_END - SRAM_DRAM_ORG -#endif - #define I_D_SPLIT_LINE_SHIFT 0x9 +#define I_D_FAULT_ADDR_SHIFT 0x2 -#define MAP_DRAM_TO_IRAM(addr) (addr - SRAM_DRAM_START + SRAM_IRAM_START) -#define MAP_IRAM_TO_DRAM(addr) (addr - SRAM_IRAM_START + SRAM_DRAM_START) - - -static inline void memprot_ll_set_iram0_dram0_split_line_lock(bool lock) +static inline void memprot_ll_set_iram0_dram0_split_line_lock(void) { - REG_WRITE(SENSITIVE_CORE_X_IRAM0_DRAM0_DMA_SPLIT_LINE_CONSTRAIN_0_REG, lock ? 1 : 0); + REG_WRITE(SENSITIVE_CORE_X_IRAM0_DRAM0_DMA_SPLIT_LINE_CONSTRAIN_0_REG, 1); } static inline bool memprot_ll_get_iram0_dram0_split_line_lock(void) @@ -77,12 +51,19 @@ static inline bool memprot_ll_get_iram0_dram0_split_line_lock(void) return REG_READ(SENSITIVE_CORE_X_IRAM0_DRAM0_DMA_SPLIT_LINE_CONSTRAIN_0_REG) == 1; } +static inline void* memprot_ll_get_split_addr_from_reg(uint32_t regval, uint32_t base) +{ + return (void*) + (base + ((regval & SENSITIVE_CORE_X_IRAM0_DRAM0_DMA_SRAM_SPLITADDR_M) + >> (SENSITIVE_CORE_X_IRAM0_DRAM0_DMA_SRAM_SPLITADDR_S - I_D_SPLIT_LINE_SHIFT))); +} -/** - * === IRAM0 ==== +/* ****************************************************************************************************** + * *** IRAM0 *** */ + //16kB (CACHE) -#define IRAM0_SRAM_LEVEL_0_LOW SRAM_IRAM_START //0x40370000 +#define IRAM0_SRAM_LEVEL_0_LOW IRAM_SRAM_START //0x40370000 #define IRAM0_SRAM_LEVEL_0_HIGH (IRAM0_SRAM_LEVEL_0_LOW + ICACHE_SIZE - 0x1) //0x4037FFFF //128kB (LEVEL 1) @@ -107,7 +88,10 @@ static inline uint32_t memprot_ll_iram0_get_intr_source_num(void) return ETS_CORE0_IRAM0_PMS_INTR_SOURCE; } -/* SPLIT LINE */ + +/////////////////////////////////// +// IRAM0 - SPLIT LINES +/////////////////////////////////// static inline void memprot_ll_set_iram0_split_line(const void *line_addr, uint32_t sensitive_reg) { @@ -125,7 +109,7 @@ static inline void memprot_ll_set_iram0_split_line(const void *line_addr, uint32 category[2] = 0x2; } - //category bits are the same for all areas + //NOTE: category & split line address bits are the same for all the areas uint32_t category_bits = (category[0] << SENSITIVE_CORE_X_IRAM0_DRAM0_DMA_SRAM_CATEGORY_0_S) | (category[1] << SENSITIVE_CORE_X_IRAM0_DRAM0_DMA_SRAM_CATEGORY_1_S) | @@ -154,12 +138,30 @@ static inline void memprot_ll_set_iram0_split_line_I_1(const void *line_addr) memprot_ll_set_iram0_split_line(line_addr, SENSITIVE_CORE_X_IRAM0_DRAM0_DMA_SPLIT_LINE_CONSTRAIN_3_REG); } +static inline void* memprot_ll_get_iram0_split_line_main_I_D(void) +{ + return memprot_ll_get_split_addr_from_reg(REG_READ(SENSITIVE_CORE_X_IRAM0_DRAM0_DMA_SPLIT_LINE_CONSTRAIN_1_REG), SOC_DIRAM_IRAM_LOW); +} + +static inline void* memprot_ll_get_iram0_split_line_I_0(void) +{ + return memprot_ll_get_split_addr_from_reg(REG_READ(SENSITIVE_CORE_X_IRAM0_DRAM0_DMA_SPLIT_LINE_CONSTRAIN_2_REG), SOC_DIRAM_IRAM_LOW); +} + +static inline void* memprot_ll_get_iram0_split_line_I_1(void) +{ + return memprot_ll_get_split_addr_from_reg(REG_READ(SENSITIVE_CORE_X_IRAM0_DRAM0_DMA_SPLIT_LINE_CONSTRAIN_3_REG), SOC_DIRAM_IRAM_LOW); +} + -/* PMS */ +/////////////////////////////////// +// IRAM0 - PMS CONFIGURATION +/////////////////////////////////// -static inline void memprot_ll_iram0_set_pms_lock(bool lock) +// lock +static inline void memprot_ll_iram0_set_pms_lock(void) { - REG_WRITE(SENSITIVE_CORE_X_IRAM0_PMS_CONSTRAIN_0_REG, lock ? 1 : 0); + REG_WRITE(SENSITIVE_CORE_X_IRAM0_PMS_CONSTRAIN_0_REG, 1); } static inline bool memprot_ll_iram0_get_pms_lock(void) @@ -167,7 +169,7 @@ static inline bool memprot_ll_iram0_get_pms_lock(void) return REG_READ(SENSITIVE_CORE_X_IRAM0_PMS_CONSTRAIN_0_REG) == 1; } -//world_0 permissions +// permission settings static inline uint32_t memprot_ll_iram0_set_permissions(bool r, bool w, bool x) { uint32_t permissions = 0; @@ -204,11 +206,46 @@ static inline void memprot_ll_iram0_set_pms_area_3(bool r, bool w, bool x) REG_SET_FIELD(SENSITIVE_CORE_X_IRAM0_PMS_CONSTRAIN_2_REG, SENSITIVE_CORE_X_IRAM0_PMS_CONSTRAIN_SRAM_WORLD_0_PMS_3, memprot_ll_iram0_set_permissions(r, w, x)); } -/* MONITOR */ +static inline void memprot_ll_iram0_get_permissions(uint32_t perms, bool *r, bool *w, bool *x) +{ + *r = perms & SENSITIVE_CORE_X_IRAM0_PMS_CONSTRAIN_SRAM_WORLD_0_R; + *w = perms & SENSITIVE_CORE_X_IRAM0_PMS_CONSTRAIN_SRAM_WORLD_0_W; + *x = perms & SENSITIVE_CORE_X_IRAM0_PMS_CONSTRAIN_SRAM_WORLD_0_F; +} + +static inline void memprot_ll_iram0_get_pms_area_0(bool *r, bool *w, bool *x) +{ + uint32_t permissions = REG_GET_FIELD(SENSITIVE_CORE_X_IRAM0_PMS_CONSTRAIN_2_REG, SENSITIVE_CORE_X_IRAM0_PMS_CONSTRAIN_SRAM_WORLD_0_PMS_0); + memprot_ll_iram0_get_permissions( permissions, r, w, x); +} -static inline void memprot_ll_iram0_set_monitor_lock(bool lock) +static inline void memprot_ll_iram0_get_pms_area_1(bool *r, bool *w, bool *x) { - REG_WRITE(SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_0_REG, lock ? 1 : 0); + uint32_t permissions = REG_GET_FIELD(SENSITIVE_CORE_X_IRAM0_PMS_CONSTRAIN_2_REG, SENSITIVE_CORE_X_IRAM0_PMS_CONSTRAIN_SRAM_WORLD_0_PMS_1); + memprot_ll_iram0_get_permissions( permissions, r, w, x); +} + +static inline void memprot_ll_iram0_get_pms_area_2(bool *r, bool *w, bool *x) +{ + uint32_t permissions = REG_GET_FIELD(SENSITIVE_CORE_X_IRAM0_PMS_CONSTRAIN_2_REG, SENSITIVE_CORE_X_IRAM0_PMS_CONSTRAIN_SRAM_WORLD_0_PMS_2); + memprot_ll_iram0_get_permissions( permissions, r, w, x); +} + +static inline void memprot_ll_iram0_get_pms_area_3(bool *r, bool *w, bool *x) +{ + uint32_t permissions = REG_GET_FIELD(SENSITIVE_CORE_X_IRAM0_PMS_CONSTRAIN_2_REG, SENSITIVE_CORE_X_IRAM0_PMS_CONSTRAIN_SRAM_WORLD_0_PMS_3); + memprot_ll_iram0_get_permissions( permissions, r, w, x); +} + + +/////////////////////////////////// +// IRAM0 - MONITOR +/////////////////////////////////// + +// lock +static inline void memprot_ll_iram0_set_monitor_lock(void) +{ + REG_WRITE(SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_0_REG, 1); } static inline bool memprot_ll_iram0_get_monitor_lock(void) @@ -216,6 +253,7 @@ static inline bool memprot_ll_iram0_get_monitor_lock(void) return REG_READ(SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_0_REG) == 1; } +// interrupt enable/clear static inline void memprot_ll_iram0_set_monitor_en(bool enable) { if ( enable ) { @@ -227,27 +265,38 @@ static inline void memprot_ll_iram0_set_monitor_en(bool enable) static inline bool memprot_ll_iram0_get_monitor_en(void) { - return REG_GET_BIT( SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_1_REG, SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_VIOLATE_EN ) == 1; + return REG_GET_FIELD( SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_1_REG, SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_VIOLATE_EN ) == 1; } static inline void memprot_ll_iram0_clear_monitor_intr(void) +{ + REG_SET_BIT( SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_1_REG, SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_VIOLATE_CLR ); +} + +static inline void memprot_ll_iram0_reset_clear_monitor_intr(void) { REG_CLR_BIT( SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_1_REG, SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_VIOLATE_CLR ); } +static inline uint32_t memprot_ll_iram0_get_monitor_enable_register(void) +{ + return REG_READ(SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_1_REG); +} + +// // permission violation status static inline uint32_t memprot_ll_iram0_get_monitor_status_intr(void) { - return REG_GET_BIT( SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_2_REG, SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_VIOLATE_INTR ); + return REG_GET_FIELD( SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_2_REG, SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_VIOLATE_INTR ); } static inline uint32_t memprot_ll_iram0_get_monitor_status_fault_wr(void) { - return REG_GET_BIT( SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_2_REG, SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_VIOLATE_STATUS_WR ); + return REG_GET_FIELD( SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_2_REG, SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_VIOLATE_STATUS_WR ); } static inline uint32_t memprot_ll_iram0_get_monitor_status_fault_loadstore(void) { - return REG_GET_BIT( SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_2_REG, SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_VIOLATE_STATUS_LOADSTORE ); + return REG_GET_FIELD( SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_2_REG, SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_VIOLATE_STATUS_LOADSTORE ); } static inline uint32_t memprot_ll_iram0_get_monitor_status_fault_world(void) @@ -257,16 +306,22 @@ static inline uint32_t memprot_ll_iram0_get_monitor_status_fault_world(void) static inline uint32_t memprot_ll_iram0_get_monitor_status_fault_addr(void) { - return REG_GET_FIELD( SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_2_REG, SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_VIOLATE_STATUS_ADDR ); + uint32_t addr = REG_GET_FIELD( SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_2_REG, SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_VIOLATE_STATUS_ADDR ); + return addr > 0 ? (addr << I_D_FAULT_ADDR_SHIFT) + IRAM0_ADDRESS_LOW : 0; } +static inline uint32_t memprot_ll_iram0_get_monitor_status_register(void) +{ + return REG_READ(SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_2_REG); +} -/** - * === DRAM0 ==== + +/* ****************************************************************************************************** + * *** DRAM0 *** */ -//cache not available from DRAM -#define DRAM0_SRAM_LEVEL_0_LOW SRAM_DRAM_START //0x3FC7C000 +//cache not available from DRAM (!) +#define DRAM0_SRAM_LEVEL_0_LOW DRAM_SRAM_START //0x3FC7C000 #define DRAM0_SRAM_LEVEL_0_HIGH (DRAM0_SRAM_LEVEL_0_LOW + ICACHE_SIZE - 0x1) //0x3FC7FFFF //128kB @@ -291,7 +346,9 @@ static inline uint32_t memprot_ll_dram0_get_intr_source_num(void) } -/* SPLIT LINE */ +/////////////////////////////////// +// DRAM0 - SPLIT LINES +/////////////////////////////////// static inline void memprot_ll_set_dram0_split_line(const void *line_addr, uint32_t sensitive_reg) { @@ -309,7 +366,7 @@ static inline void memprot_ll_set_dram0_split_line(const void *line_addr, uint32 category[2] = 0x2; } - //category bits are the same for all areas + //NOTE: line address & category bits, shifts and masks are the same for all the areas uint32_t category_bits = (category[0] << SENSITIVE_CORE_X_IRAM0_DRAM0_DMA_SRAM_CATEGORY_0_S) | (category[1] << SENSITIVE_CORE_X_IRAM0_DRAM0_DMA_SRAM_CATEGORY_1_S) | @@ -332,12 +389,25 @@ static inline void memprot_ll_set_dram0_split_line_D_1(const void *line_addr) memprot_ll_set_dram0_split_line(line_addr, SENSITIVE_CORE_X_IRAM0_DRAM0_DMA_SPLIT_LINE_CONSTRAIN_3_REG); } +static inline void* memprot_ll_get_dram0_split_line_D_0(void) +{ + return memprot_ll_get_split_addr_from_reg(REG_READ(SENSITIVE_CORE_X_IRAM0_DRAM0_DMA_SPLIT_LINE_CONSTRAIN_2_REG), SOC_DIRAM_DRAM_LOW); +} + +static inline void* memprot_ll_get_dram0_split_line_D_1(void) +{ + return memprot_ll_get_split_addr_from_reg(REG_READ(SENSITIVE_CORE_X_IRAM0_DRAM0_DMA_SPLIT_LINE_CONSTRAIN_3_REG), SOC_DIRAM_DRAM_LOW); +} + -/* PMS */ +/////////////////////////////////// +// DRAM0 - PMS CONFIGURATION +/////////////////////////////////// -static inline void memprot_ll_dram0_set_pms_lock(bool lock) +// lock +static inline void memprot_ll_dram0_set_pms_lock(void) { - REG_WRITE(SENSITIVE_CORE_X_DRAM0_PMS_CONSTRAIN_0_REG, lock ? 1 : 0); + REG_WRITE(SENSITIVE_CORE_X_DRAM0_PMS_CONSTRAIN_0_REG, 1); } static inline bool memprot_ll_dram0_get_pms_lock(void) @@ -345,6 +415,7 @@ static inline bool memprot_ll_dram0_get_pms_lock(void) return REG_READ(SENSITIVE_CORE_X_DRAM0_PMS_CONSTRAIN_0_REG) == 1; } +// permission settings static inline uint32_t memprot_ll_dram0_set_permissions(bool r, bool w) { uint32_t permissions = 0; @@ -378,12 +449,44 @@ static inline void memprot_ll_dram0_set_pms_area_3(bool r, bool w) REG_SET_FIELD(SENSITIVE_CORE_X_DRAM0_PMS_CONSTRAIN_1_REG, SENSITIVE_CORE_X_DRAM0_PMS_CONSTRAIN_SRAM_WORLD_0_PMS_3, memprot_ll_dram0_set_permissions(r, w)); } +static inline void memprot_ll_dram0_get_permissions(uint32_t perms, bool *r, bool *w ) +{ + *r = perms & SENSITIVE_CORE_X_DRAM0_PMS_CONSTRAIN_SRAM_WORLD_0_R; + *w = perms & SENSITIVE_CORE_X_DRAM0_PMS_CONSTRAIN_SRAM_WORLD_0_W; +} -/* MONITOR */ +static inline void memprot_ll_dram0_get_pms_area_0(bool *r, bool *w) +{ + uint32_t permissions = REG_GET_FIELD(SENSITIVE_CORE_X_DRAM0_PMS_CONSTRAIN_1_REG, SENSITIVE_CORE_X_DRAM0_PMS_CONSTRAIN_SRAM_WORLD_0_PMS_0); + memprot_ll_dram0_get_permissions( permissions, r, w); +} -static inline void memprot_ll_dram0_set_monitor_lock(bool lock) +static inline void memprot_ll_dram0_get_pms_area_1(bool *r, bool *w) { - REG_WRITE(SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_0_REG, lock ? 1 : 0); + uint32_t permissions = REG_GET_FIELD(SENSITIVE_CORE_X_DRAM0_PMS_CONSTRAIN_1_REG, SENSITIVE_CORE_X_DRAM0_PMS_CONSTRAIN_SRAM_WORLD_0_PMS_1); + memprot_ll_dram0_get_permissions( permissions, r, w); +} + +static inline void memprot_ll_dram0_get_pms_area_2(bool *r, bool *w) +{ + uint32_t permissions = REG_GET_FIELD(SENSITIVE_CORE_X_DRAM0_PMS_CONSTRAIN_1_REG, SENSITIVE_CORE_X_DRAM0_PMS_CONSTRAIN_SRAM_WORLD_0_PMS_2); + memprot_ll_dram0_get_permissions( permissions, r, w); +} + +static inline void memprot_ll_dram0_get_pms_area_3(bool *r, bool *w) +{ + uint32_t permissions = REG_GET_FIELD(SENSITIVE_CORE_X_DRAM0_PMS_CONSTRAIN_1_REG, SENSITIVE_CORE_X_DRAM0_PMS_CONSTRAIN_SRAM_WORLD_0_PMS_3); + memprot_ll_dram0_get_permissions( permissions, r, w); +} + +/////////////////////////////////// +// DRAM0 - MONITOR +/////////////////////////////////// + +// lock +static inline void memprot_ll_dram0_set_monitor_lock(void) +{ + REG_WRITE(SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_0_REG, 1); } static inline bool memprot_ll_dram0_get_monitor_lock(void) @@ -391,6 +494,7 @@ static inline bool memprot_ll_dram0_get_monitor_lock(void) return REG_READ(SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_0_REG) == 1; } +// interrupt enable/clear static inline void memprot_ll_dram0_set_monitor_en(bool enable) { if ( enable ) { @@ -406,18 +510,29 @@ static inline bool memprot_ll_dram0_get_monitor_en(void) } static inline void memprot_ll_dram0_clear_monitor_intr(void) +{ + REG_SET_BIT( SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_1_REG, SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_VIOLATE_CLR ); +} + +static inline void memprot_ll_dram0_reset_clear_monitor_intr(void) { REG_CLR_BIT( SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_1_REG, SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_VIOLATE_CLR ); } +static inline uint32_t memprot_ll_dram0_get_monitor_enable_register(void) +{ + return REG_READ(SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_1_REG); +} + +// permission violation status static inline uint32_t memprot_ll_dram0_get_monitor_status_intr(void) { - return REG_GET_BIT( SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_2_REG, SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_VIOLATE_INTR ); + return REG_GET_FIELD( SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_2_REG, SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_VIOLATE_INTR ); } static inline uint32_t memprot_ll_dram0_get_monitor_status_fault_lock(void) { - return REG_GET_BIT( SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_2_REG, SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_VIOLATE_STATUS_LOCK ); + return REG_GET_FIELD( SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_2_REG, SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_VIOLATE_STATUS_LOCK ); } static inline uint32_t memprot_ll_dram0_get_monitor_status_fault_world(void) @@ -427,19 +542,29 @@ static inline uint32_t memprot_ll_dram0_get_monitor_status_fault_world(void) static inline uint32_t memprot_ll_dram0_get_monitor_status_fault_addr(void) { - return REG_GET_FIELD( SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_2_REG, SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_VIOLATE_STATUS_ADDR ); + uint32_t addr = REG_GET_FIELD( SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_2_REG, SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_VIOLATE_STATUS_ADDR ); + return addr > 0 ? (addr << I_D_FAULT_ADDR_SHIFT) + DRAM0_ADDRESS_LOW : 0; } static inline uint32_t memprot_ll_dram0_get_monitor_status_fault_wr(void) { - return REG_GET_BIT( SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_3_REG, SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_VIOLATE_STATUS_WR ); + return REG_GET_FIELD( SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_3_REG, SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_VIOLATE_STATUS_WR ); } static inline uint32_t memprot_ll_dram0_get_monitor_status_fault_byte_en(void) { - return REG_GET_BIT( SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_2_REG, SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_VIOLATE_STATUS_BYTEEN ); + return REG_GET_FIELD( SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_2_REG, SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_VIOLATE_STATUS_BYTEEN ); } +static inline uint32_t memprot_ll_dram0_get_monitor_status_register_1(void) +{ + return REG_READ(SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_2_REG); +} + +static inline uint32_t memprot_ll_dram0_get_monitor_status_register_2(void) +{ + return REG_READ(SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_3_REG); +} #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/hal/include/hal/gpio_hal.h b/tools/sdk/esp32c3/include/hal/include/hal/gpio_hal.h index 5a403f529c6..018b4be1288 100644 --- a/tools/sdk/esp32c3/include/hal/include/hal/gpio_hal.h +++ b/tools/sdk/esp32c3/include/hal/include/hal/gpio_hal.h @@ -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 diff --git a/tools/sdk/esp32c3/include/hal/include/hal/i2c_types.h b/tools/sdk/esp32c3/include/hal/include/hal/i2c_types.h index 3d5864dc10a..12147c78b7b 100644 --- a/tools/sdk/esp32c3/include/hal/include/hal/i2c_types.h +++ b/tools/sdk/esp32c3/include/hal/include/hal/i2c_types.h @@ -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, /*! #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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h index 0bbc6885934..5d671df142d 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h index f863ce88ca2..6643b0cbf50 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth.h index 7174e7bcedd..540aee0e8d7 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h index deec5266e68..3da864c7d27 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h index 77a55fbc008..d992cb8163d 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h index 4842f3debc7..3fb52638924 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box.h index 614cd1e0ac1..e060dd29fc4 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h index 29c9b255202..26a3d31efa9 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h @@ -3,6 +3,7 @@ #define crypto_box_curve25519xchacha20poly1305_H #include +#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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h index 9b5a39c3fa4..e733f49995b 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h @@ -2,6 +2,7 @@ #define crypto_box_curve25519xsalsa20poly1305_H #include +#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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_ed25519.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_ed25519.h new file mode 100644 index 00000000000..3eae00c4562 --- /dev/null +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_ed25519.h @@ -0,0 +1,100 @@ +#ifndef crypto_core_ed25519_H +#define crypto_core_ed25519_H + +#include +#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 diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hchacha20.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hchacha20.h index 05e5670c10e..ece141b09b4 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hchacha20.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hchacha20.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h index 82e475b8f67..4bf7a48786f 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_ristretto255.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_ristretto255.h new file mode 100644 index 00000000000..f2820e5576e --- /dev/null +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_ristretto255.h @@ -0,0 +1,100 @@ +#ifndef crypto_core_ristretto255_H +#define crypto_core_ristretto255_H + +#include +#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 diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h index 160cc56d2c4..bd79fd9f540 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h index bdd5f9fdbb2..05957591ca7 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h index 3c13efa4ef3..d2f216af268 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash.h index 2398fb9dbba..d897e5d26c5 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h index 7b0c0820743..fee9d8ad196 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash.h index 302ed5c5ea2..8752f9cafeb 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash.h @@ -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 diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h index f64d16e0e5c..b18217e18df 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h index 6b0330f14fe..8efa7193ad9 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf.h index 52e496a7449..ac2fc6183c2 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf_blake2b.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf_blake2b.h index 5480ebe82f1..3ae47dd32c5 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf_blake2b.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf_blake2b.h @@ -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 diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kx.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kx.h index d1fce90da57..347132c320e 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kx.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kx.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h index 5951c5b82d3..7cd7b07060f 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h index 479e923dccb..f3e34d86df4 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash.h index 56eca0680c1..585a993efd2 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash.h @@ -4,6 +4,7 @@ #include #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 - diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2i.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2i.h index d414b939d1f..88ff6221d67 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2i.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2i.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2id.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2id.h new file mode 100644 index 00000000000..7183abd186b --- /dev/null +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2id.h @@ -0,0 +1,122 @@ +#ifndef crypto_pwhash_argon2id_H +#define crypto_pwhash_argon2id_H + +#include +#include +#include + +#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 diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h index 9f693e540e7..5c0bf7d390a 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h index 830c10f6473..1c685853783 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h index 953f8923c5e..60e9d0c5a40 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h @@ -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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h new file mode 100644 index 00000000000..2dfa4d7073f --- /dev/null +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h @@ -0,0 +1,51 @@ + +#ifndef crypto_scalarmult_ed25519_H +#define crypto_scalarmult_ed25519_H + +#include + +#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 diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ristretto255.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ristretto255.h new file mode 100644 index 00000000000..40a45ccef02 --- /dev/null +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ristretto255.h @@ -0,0 +1,43 @@ + +#ifndef crypto_scalarmult_ristretto255_H +#define crypto_scalarmult_ristretto255_H + +#include + +#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 diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox.h index 9b098200e0b..1d3709db128 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox.h @@ -29,23 +29,28 @@ size_t crypto_secretbox_macbytes(void); SODIUM_EXPORT const char *crypto_secretbox_primitive(void); +#define crypto_secretbox_MESSAGEBYTES_MAX crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX +SODIUM_EXPORT +size_t crypto_secretbox_messagebytes_max(void); + SODIUM_EXPORT int crypto_secretbox_easy(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_secretbox_open_easy(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_secretbox_detached(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 *k) + __attribute__ ((nonnull(1, 2, 5, 6))); SODIUM_EXPORT int crypto_secretbox_open_detached(unsigned char *m, @@ -54,10 +59,11 @@ int crypto_secretbox_open_detached(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, 3, 5, 6))); SODIUM_EXPORT -void crypto_secretbox_keygen(unsigned char k[crypto_secretbox_KEYBYTES]); +void crypto_secretbox_keygen(unsigned char k[crypto_secretbox_KEYBYTES]) + __attribute__ ((nonnull)); /* -- NaCl compatibility interface ; Requires padding -- */ @@ -72,13 +78,13 @@ size_t crypto_secretbox_boxzerobytes(void); SODIUM_EXPORT int crypto_secretbox(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_secretbox_open(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 } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h index 7a61a09174e..6ec674e3105 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h @@ -2,6 +2,7 @@ #define crypto_secretbox_xchacha20poly1305_H #include +#include "crypto_stream_xchacha20.h" #include "export.h" #ifdef __cplusplus @@ -23,12 +24,18 @@ size_t crypto_secretbox_xchacha20poly1305_noncebytes(void); SODIUM_EXPORT size_t crypto_secretbox_xchacha20poly1305_macbytes(void); +#define crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX \ + (crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_secretbox_xchacha20poly1305_MACBYTES) +SODIUM_EXPORT +size_t crypto_secretbox_xchacha20poly1305_messagebytes_max(void); + SODIUM_EXPORT int crypto_secretbox_xchacha20poly1305_easy(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_secretbox_xchacha20poly1305_open_easy(unsigned char *m, @@ -36,7 +43,7 @@ int crypto_secretbox_xchacha20poly1305_open_easy(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_secretbox_xchacha20poly1305_detached(unsigned char *c, @@ -44,7 +51,8 @@ int crypto_secretbox_xchacha20poly1305_detached(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_secretbox_xchacha20poly1305_open_detached(unsigned char *m, @@ -53,7 +61,7 @@ int crypto_secretbox_xchacha20poly1305_open_detached(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, 3, 5, 6))); #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h index 5aa30805d6c..be0874cbafa 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h @@ -2,6 +2,7 @@ #define crypto_secretbox_xsalsa20poly1305_H #include +#include "crypto_stream_xsalsa20.h" #include "export.h" #ifdef __cplusplus @@ -23,22 +24,19 @@ size_t crypto_secretbox_xsalsa20poly1305_noncebytes(void); SODIUM_EXPORT size_t crypto_secretbox_xsalsa20poly1305_macbytes(void); -#define crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES 16U -SODIUM_EXPORT -size_t crypto_secretbox_xsalsa20poly1305_boxzerobytes(void); - -#define crypto_secretbox_xsalsa20poly1305_ZEROBYTES \ - (crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES + \ - crypto_secretbox_xsalsa20poly1305_MACBYTES) +/* Only for the libsodium API - The NaCl compatibility API would require BOXZEROBYTES extra bytes */ +#define crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX \ + (crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_secretbox_xsalsa20poly1305_MACBYTES) SODIUM_EXPORT -size_t crypto_secretbox_xsalsa20poly1305_zerobytes(void); +size_t crypto_secretbox_xsalsa20poly1305_messagebytes_max(void); SODIUM_EXPORT int crypto_secretbox_xsalsa20poly1305(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_secretbox_xsalsa20poly1305_open(unsigned char *m, @@ -46,10 +44,23 @@ int crypto_secretbox_xsalsa20poly1305_open(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 -void crypto_secretbox_xsalsa20poly1305_keygen(unsigned char k[crypto_secretbox_xsalsa20poly1305_KEYBYTES]); +void crypto_secretbox_xsalsa20poly1305_keygen(unsigned char k[crypto_secretbox_xsalsa20poly1305_KEYBYTES]) + __attribute__ ((nonnull)); + +/* -- NaCl compatibility interface ; Requires padding -- */ + +#define crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES 16U +SODIUM_EXPORT +size_t crypto_secretbox_xsalsa20poly1305_boxzerobytes(void); + +#define crypto_secretbox_xsalsa20poly1305_ZEROBYTES \ + (crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES + \ + crypto_secretbox_xsalsa20poly1305_MACBYTES) +SODIUM_EXPORT +size_t crypto_secretbox_xsalsa20poly1305_zerobytes(void); #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h new file mode 100644 index 00000000000..b22e4e9313e --- /dev/null +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h @@ -0,0 +1,108 @@ +#ifndef crypto_secretstream_xchacha20poly1305_H +#define crypto_secretstream_xchacha20poly1305_H + +#include + +#include "crypto_aead_xchacha20poly1305.h" +#include "crypto_stream_chacha20.h" +#include "export.h" + +#ifdef __cplusplus +# ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wlong-long" +# endif +extern "C" { +#endif + +#define crypto_secretstream_xchacha20poly1305_ABYTES \ + (1U + crypto_aead_xchacha20poly1305_ietf_ABYTES) +SODIUM_EXPORT +size_t crypto_secretstream_xchacha20poly1305_abytes(void); + +#define crypto_secretstream_xchacha20poly1305_HEADERBYTES \ + crypto_aead_xchacha20poly1305_ietf_NPUBBYTES +SODIUM_EXPORT +size_t crypto_secretstream_xchacha20poly1305_headerbytes(void); + +#define crypto_secretstream_xchacha20poly1305_KEYBYTES \ + crypto_aead_xchacha20poly1305_ietf_KEYBYTES +SODIUM_EXPORT +size_t crypto_secretstream_xchacha20poly1305_keybytes(void); + +#define crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX \ + SODIUM_MIN(SODIUM_SIZE_MAX - crypto_secretstream_xchacha20poly1305_ABYTES, \ + (64ULL * ((1ULL << 32) - 2ULL))) +SODIUM_EXPORT +size_t crypto_secretstream_xchacha20poly1305_messagebytes_max(void); + +#define crypto_secretstream_xchacha20poly1305_TAG_MESSAGE 0x00 +SODIUM_EXPORT +unsigned char crypto_secretstream_xchacha20poly1305_tag_message(void); + +#define crypto_secretstream_xchacha20poly1305_TAG_PUSH 0x01 +SODIUM_EXPORT +unsigned char crypto_secretstream_xchacha20poly1305_tag_push(void); + +#define crypto_secretstream_xchacha20poly1305_TAG_REKEY 0x02 +SODIUM_EXPORT +unsigned char crypto_secretstream_xchacha20poly1305_tag_rekey(void); + +#define crypto_secretstream_xchacha20poly1305_TAG_FINAL \ + (crypto_secretstream_xchacha20poly1305_TAG_PUSH | \ + crypto_secretstream_xchacha20poly1305_TAG_REKEY) +SODIUM_EXPORT +unsigned char crypto_secretstream_xchacha20poly1305_tag_final(void); + +typedef struct crypto_secretstream_xchacha20poly1305_state { + unsigned char k[crypto_stream_chacha20_ietf_KEYBYTES]; + unsigned char nonce[crypto_stream_chacha20_ietf_NONCEBYTES]; + unsigned char _pad[8]; +} crypto_secretstream_xchacha20poly1305_state; + +SODIUM_EXPORT +size_t crypto_secretstream_xchacha20poly1305_statebytes(void); + +SODIUM_EXPORT +void crypto_secretstream_xchacha20poly1305_keygen + (unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES]) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +int crypto_secretstream_xchacha20poly1305_init_push + (crypto_secretstream_xchacha20poly1305_state *state, + unsigned char header[crypto_secretstream_xchacha20poly1305_HEADERBYTES], + const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES]) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +int crypto_secretstream_xchacha20poly1305_push + (crypto_secretstream_xchacha20poly1305_state *state, + unsigned char *c, unsigned long long *clen_p, + const unsigned char *m, unsigned long long mlen, + const unsigned char *ad, unsigned long long adlen, unsigned char tag) + __attribute__ ((nonnull(1))); + +SODIUM_EXPORT +int crypto_secretstream_xchacha20poly1305_init_pull + (crypto_secretstream_xchacha20poly1305_state *state, + const unsigned char header[crypto_secretstream_xchacha20poly1305_HEADERBYTES], + const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES]) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +int crypto_secretstream_xchacha20poly1305_pull + (crypto_secretstream_xchacha20poly1305_state *state, + unsigned char *m, unsigned long long *mlen_p, unsigned char *tag_p, + const unsigned char *c, unsigned long long clen, + const unsigned char *ad, unsigned long long adlen) + __attribute__ ((nonnull(1))); + +SODIUM_EXPORT +void crypto_secretstream_xchacha20poly1305_rekey + (crypto_secretstream_xchacha20poly1305_state *state); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash.h index a4988082471..fecaa88bd80 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash.h @@ -27,10 +27,12 @@ const char *crypto_shorthash_primitive(void); SODIUM_EXPORT int crypto_shorthash(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 -void crypto_shorthash_keygen(unsigned char k[crypto_shorthash_KEYBYTES]); +void crypto_shorthash_keygen(unsigned char k[crypto_shorthash_KEYBYTES]) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h index 745ed48fae9..1e6f72a620e 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h @@ -23,7 +23,8 @@ size_t crypto_shorthash_siphash24_keybytes(void); SODIUM_EXPORT int crypto_shorthash_siphash24(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))); #ifndef SODIUM_LIBRARY_MINIMAL /* -- 128-bit output -- */ @@ -38,7 +39,8 @@ size_t crypto_shorthash_siphashx24_keybytes(void); SODIUM_EXPORT int crypto_shorthash_siphashx24(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))); #endif #ifdef __cplusplus diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign.h index b0335bf274c..f5fafb123e0 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign.h @@ -41,56 +41,64 @@ size_t crypto_sign_publickeybytes(void); SODIUM_EXPORT size_t crypto_sign_secretkeybytes(void); +#define crypto_sign_MESSAGEBYTES_MAX crypto_sign_ed25519_MESSAGEBYTES_MAX +SODIUM_EXPORT +size_t crypto_sign_messagebytes_max(void); + #define crypto_sign_PRIMITIVE "ed25519" SODIUM_EXPORT const char *crypto_sign_primitive(void); SODIUM_EXPORT int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk, - const unsigned char *seed); + const unsigned char *seed) + __attribute__ ((nonnull)); SODIUM_EXPORT -int crypto_sign_keypair(unsigned char *pk, unsigned char *sk); +int crypto_sign_keypair(unsigned char *pk, unsigned char *sk) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_sign(unsigned char *sm, unsigned long long *smlen_p, const unsigned char *m, unsigned long long mlen, - const unsigned char *sk); + const unsigned char *sk) __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_open(unsigned char *m, unsigned long long *mlen_p, const unsigned char *sm, unsigned long long smlen, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5))); SODIUM_EXPORT int crypto_sign_detached(unsigned char *sig, unsigned long long *siglen_p, const unsigned char *m, unsigned long long mlen, - const unsigned char *sk); + const unsigned char *sk) __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_verify_detached(const unsigned char *sig, const unsigned char *m, unsigned long long mlen, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT int crypto_sign_init(crypto_sign_state *state); SODIUM_EXPORT int crypto_sign_update(crypto_sign_state *state, - const unsigned char *m, unsigned long long mlen); + const unsigned char *m, unsigned long long mlen) + __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_sign_final_create(crypto_sign_state *state, unsigned char *sig, unsigned long long *siglen_p, - const unsigned char *sk); + const unsigned char *sk) + __attribute__ ((nonnull(1, 2, 4))); SODIUM_EXPORT -int crypto_sign_final_verify(crypto_sign_state *state, unsigned char *sig, +int crypto_sign_final_verify(crypto_sign_state *state, const unsigned char *sig, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h index 17c150f284a..0fdac42d353 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h @@ -35,73 +35,87 @@ size_t crypto_sign_ed25519_publickeybytes(void); SODIUM_EXPORT size_t crypto_sign_ed25519_secretkeybytes(void); +#define crypto_sign_ed25519_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_ed25519_BYTES) +SODIUM_EXPORT +size_t crypto_sign_ed25519_messagebytes_max(void); + SODIUM_EXPORT int crypto_sign_ed25519(unsigned char *sm, unsigned long long *smlen_p, const unsigned char *m, unsigned long long mlen, - const unsigned char *sk); + const unsigned char *sk) + __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_ed25519_open(unsigned char *m, unsigned long long *mlen_p, const unsigned char *sm, unsigned long long smlen, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5))); SODIUM_EXPORT int crypto_sign_ed25519_detached(unsigned char *sig, unsigned long long *siglen_p, const unsigned char *m, unsigned long long mlen, - const unsigned char *sk); + const unsigned char *sk) + __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_ed25519_verify_detached(const unsigned char *sig, const unsigned char *m, unsigned long long mlen, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT -int crypto_sign_ed25519_keypair(unsigned char *pk, unsigned char *sk); +int crypto_sign_ed25519_keypair(unsigned char *pk, unsigned char *sk) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_sign_ed25519_seed_keypair(unsigned char *pk, unsigned char *sk, - const unsigned char *seed); + const unsigned char *seed) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_sign_ed25519_pk_to_curve25519(unsigned char *curve25519_pk, const unsigned char *ed25519_pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_sign_ed25519_sk_to_curve25519(unsigned char *curve25519_sk, - const unsigned char *ed25519_sk); + const unsigned char *ed25519_sk) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_sign_ed25519_sk_to_seed(unsigned char *seed, - const unsigned char *sk); + const unsigned char *sk) + __attribute__ ((nonnull)); SODIUM_EXPORT -int crypto_sign_ed25519_sk_to_pk(unsigned char *pk, const unsigned char *sk); +int crypto_sign_ed25519_sk_to_pk(unsigned char *pk, const unsigned char *sk) + __attribute__ ((nonnull)); SODIUM_EXPORT -int crypto_sign_ed25519ph_init(crypto_sign_ed25519ph_state *state); +int crypto_sign_ed25519ph_init(crypto_sign_ed25519ph_state *state) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_sign_ed25519ph_update(crypto_sign_ed25519ph_state *state, const unsigned char *m, - unsigned long long mlen); + unsigned long long mlen) + __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_sign_ed25519ph_final_create(crypto_sign_ed25519ph_state *state, unsigned char *sig, unsigned long long *siglen_p, - const unsigned char *sk); + const unsigned char *sk) + __attribute__ ((nonnull(1, 2, 4))); SODIUM_EXPORT int crypto_sign_ed25519ph_final_verify(crypto_sign_ed25519ph_state *state, - unsigned char *sig, + const unsigned char *sig, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h index 2224a94e013..eed158aa845 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h @@ -25,6 +25,7 @@ extern "C" { #define crypto_sign_edwards25519sha512batch_BYTES 64U #define crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES 32U #define crypto_sign_edwards25519sha512batch_SECRETKEYBYTES (32U + 32U) +#define crypto_sign_edwards25519sha512batch_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_edwards25519sha512batch_BYTES) SODIUM_EXPORT int crypto_sign_edwards25519sha512batch(unsigned char *sm, @@ -32,7 +33,7 @@ int crypto_sign_edwards25519sha512batch(unsigned char *sm, const unsigned char *m, unsigned long long mlen, const unsigned char *sk) - __attribute__ ((deprecated)); + __attribute__ ((deprecated)) __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_edwards25519sha512batch_open(unsigned char *m, @@ -40,12 +41,12 @@ int crypto_sign_edwards25519sha512batch_open(unsigned char *m, const unsigned char *sm, unsigned long long smlen, const unsigned char *pk) - __attribute__ ((deprecated)); + __attribute__ ((deprecated)) __attribute__ ((nonnull(3, 5))); SODIUM_EXPORT int crypto_sign_edwards25519sha512batch_keypair(unsigned char *pk, unsigned char *sk) - __attribute__ ((deprecated)); + __attribute__ ((deprecated)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream.h index 22de6ff52d3..88dab5f6111 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream.h @@ -29,21 +29,28 @@ size_t crypto_stream_keybytes(void); SODIUM_EXPORT size_t crypto_stream_noncebytes(void); +#define crypto_stream_MESSAGEBYTES_MAX crypto_stream_xsalsa20_MESSAGEBYTES_MAX +SODIUM_EXPORT +size_t crypto_stream_messagebytes_max(void); + #define crypto_stream_PRIMITIVE "xsalsa20" SODIUM_EXPORT const char *crypto_stream_primitive(void); SODIUM_EXPORT int crypto_stream(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_xor(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)); SODIUM_EXPORT -void crypto_stream_keygen(unsigned char k[crypto_stream_KEYBYTES]); +void crypto_stream_keygen(unsigned char k[crypto_stream_KEYBYTES]) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h deleted file mode 100644 index 33ee1b89714..00000000000 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef crypto_stream_aes128ctr_H -#define crypto_stream_aes128ctr_H - -/* - * WARNING: This is just a stream cipher. It is NOT authenticated encryption. - * While it provides some protection against eavesdropping, it does NOT - * provide any security against active attacks. - * Unless you know what you're doing, what you are looking for is probably - * the crypto_box functions. - */ - -#include -#include "export.h" - -#ifdef __cplusplus -# ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wlong-long" -# endif -extern "C" { -#endif - -#define crypto_stream_aes128ctr_KEYBYTES 16U -SODIUM_EXPORT -size_t crypto_stream_aes128ctr_keybytes(void); - -#define crypto_stream_aes128ctr_NONCEBYTES 16U -SODIUM_EXPORT -size_t crypto_stream_aes128ctr_noncebytes(void); - -#define crypto_stream_aes128ctr_BEFORENMBYTES 1408U -SODIUM_EXPORT -size_t crypto_stream_aes128ctr_beforenmbytes(void); - -SODIUM_EXPORT -int crypto_stream_aes128ctr(unsigned char *out, unsigned long long outlen, - const unsigned char *n, const unsigned char *k) - __attribute__ ((deprecated)); - -SODIUM_EXPORT -int crypto_stream_aes128ctr_xor(unsigned char *out, const unsigned char *in, - unsigned long long inlen, const unsigned char *n, - const unsigned char *k) - __attribute__ ((deprecated)); - -SODIUM_EXPORT -int crypto_stream_aes128ctr_beforenm(unsigned char *c, const unsigned char *k) - __attribute__ ((deprecated)); - -SODIUM_EXPORT -int crypto_stream_aes128ctr_afternm(unsigned char *out, unsigned long long len, - const unsigned char *nonce, const unsigned char *c) - __attribute__ ((deprecated)); - -SODIUM_EXPORT -int crypto_stream_aes128ctr_xor_afternm(unsigned char *out, const unsigned char *in, - unsigned long long len, - const unsigned char *nonce, - const unsigned char *c) - __attribute__ ((deprecated)); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h index cf3ffe89595..408897558b8 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h @@ -28,25 +28,33 @@ size_t crypto_stream_chacha20_keybytes(void); SODIUM_EXPORT size_t crypto_stream_chacha20_noncebytes(void); +#define crypto_stream_chacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX +SODIUM_EXPORT +size_t crypto_stream_chacha20_messagebytes_max(void); + /* ChaCha20 with a 64-bit nonce and a 64-bit counter, as originally designed */ SODIUM_EXPORT int crypto_stream_chacha20(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_chacha20_xor(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)); SODIUM_EXPORT int crypto_stream_chacha20_xor_ic(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, uint64_t ic, - const unsigned char *k); + const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_stream_chacha20_keygen(unsigned char k[crypto_stream_chacha20_KEYBYTES]); +void crypto_stream_chacha20_keygen(unsigned char k[crypto_stream_chacha20_KEYBYTES]) + __attribute__ ((nonnull)); /* ChaCha20 with a 96-bit nonce and a 32-bit counter (IETF) */ @@ -58,32 +66,38 @@ size_t crypto_stream_chacha20_ietf_keybytes(void); SODIUM_EXPORT size_t crypto_stream_chacha20_ietf_noncebytes(void); +#define crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX \ + SODIUM_MIN(SODIUM_SIZE_MAX, 64ULL * (1ULL << 32)) +SODIUM_EXPORT +size_t crypto_stream_chacha20_ietf_messagebytes_max(void); + SODIUM_EXPORT int crypto_stream_chacha20_ietf(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_chacha20_ietf_xor(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)); SODIUM_EXPORT int crypto_stream_chacha20_ietf_xor_ic(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, uint32_t ic, - const unsigned char *k); + const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_stream_chacha20_ietf_keygen(unsigned char k[crypto_stream_chacha20_ietf_KEYBYTES]); - -/* ------------------------------------------------------------------------- */ - -int _crypto_stream_chacha20_pick_best_implementation(void); +void crypto_stream_chacha20_ietf_keygen(unsigned char k[crypto_stream_chacha20_ietf_KEYBYTES]) + __attribute__ ((nonnull)); /* Aliases */ #define crypto_stream_chacha20_IETF_KEYBYTES crypto_stream_chacha20_ietf_KEYBYTES #define crypto_stream_chacha20_IETF_NONCEBYTES crypto_stream_chacha20_ietf_NONCEBYTES +#define crypto_stream_chacha20_IETF_MESSAGEBYTES_MAX crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h index 741140eb22d..45b3b3e34aa 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h @@ -28,27 +28,31 @@ size_t crypto_stream_salsa20_keybytes(void); SODIUM_EXPORT size_t crypto_stream_salsa20_noncebytes(void); +#define crypto_stream_salsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX +SODIUM_EXPORT +size_t crypto_stream_salsa20_messagebytes_max(void); + SODIUM_EXPORT int crypto_stream_salsa20(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_salsa20_xor(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)); SODIUM_EXPORT int crypto_stream_salsa20_xor_ic(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, uint64_t ic, - const unsigned char *k); + const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_stream_salsa20_keygen(unsigned char k[crypto_stream_salsa20_KEYBYTES]); - -/* ------------------------------------------------------------------------- */ - -int _crypto_stream_salsa20_pick_best_implementation(void); +void crypto_stream_salsa20_keygen(unsigned char k[crypto_stream_salsa20_KEYBYTES]) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h index d5c44282174..6c5d303cacc 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h @@ -27,17 +27,24 @@ size_t crypto_stream_salsa2012_keybytes(void); SODIUM_EXPORT size_t crypto_stream_salsa2012_noncebytes(void); +#define crypto_stream_salsa2012_MESSAGEBYTES_MAX SODIUM_SIZE_MAX +SODIUM_EXPORT +size_t crypto_stream_salsa2012_messagebytes_max(void); + SODIUM_EXPORT int crypto_stream_salsa2012(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_salsa2012_xor(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)); SODIUM_EXPORT -void crypto_stream_salsa2012_keygen(unsigned char k[crypto_stream_salsa2012_KEYBYTES]); +void crypto_stream_salsa2012_keygen(unsigned char k[crypto_stream_salsa2012_KEYBYTES]) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h index 02b4166e1ca..d574f30478a 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h @@ -21,23 +21,33 @@ extern "C" { #define crypto_stream_salsa208_KEYBYTES 32U SODIUM_EXPORT -size_t crypto_stream_salsa208_keybytes(void); +size_t crypto_stream_salsa208_keybytes(void) + __attribute__ ((deprecated)); #define crypto_stream_salsa208_NONCEBYTES 8U SODIUM_EXPORT -size_t crypto_stream_salsa208_noncebytes(void); +size_t crypto_stream_salsa208_noncebytes(void) + __attribute__ ((deprecated)); + +#define crypto_stream_salsa208_MESSAGEBYTES_MAX SODIUM_SIZE_MAX + SODIUM_EXPORT +size_t crypto_stream_salsa208_messagebytes_max(void) + __attribute__ ((deprecated)); SODIUM_EXPORT int crypto_stream_salsa208(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((deprecated)) __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_salsa208_xor(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, - const unsigned char *k); + const unsigned char *k) + __attribute__ ((deprecated)) __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_stream_salsa208_keygen(unsigned char k[crypto_stream_salsa208_KEYBYTES]); +void crypto_stream_salsa208_keygen(unsigned char k[crypto_stream_salsa208_KEYBYTES]) + __attribute__ ((deprecated)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xchacha20.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xchacha20.h index f884798e740..c4002db00a8 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xchacha20.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xchacha20.h @@ -28,23 +28,31 @@ size_t crypto_stream_xchacha20_keybytes(void); SODIUM_EXPORT size_t crypto_stream_xchacha20_noncebytes(void); +#define crypto_stream_xchacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX +SODIUM_EXPORT +size_t crypto_stream_xchacha20_messagebytes_max(void); + SODIUM_EXPORT int crypto_stream_xchacha20(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_xchacha20_xor(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)); SODIUM_EXPORT int crypto_stream_xchacha20_xor_ic(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, uint64_t ic, - const unsigned char *k); + const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_stream_xchacha20_keygen(unsigned char k[crypto_stream_xchacha20_KEYBYTES]); +void crypto_stream_xchacha20_keygen(unsigned char k[crypto_stream_xchacha20_KEYBYTES]) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h index ed5ae3c3d3c..20034e3462b 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h @@ -28,23 +28,31 @@ size_t crypto_stream_xsalsa20_keybytes(void); SODIUM_EXPORT size_t crypto_stream_xsalsa20_noncebytes(void); +#define crypto_stream_xsalsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX +SODIUM_EXPORT +size_t crypto_stream_xsalsa20_messagebytes_max(void); + SODIUM_EXPORT int crypto_stream_xsalsa20(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_xsalsa20_xor(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)); SODIUM_EXPORT int crypto_stream_xsalsa20_xor_ic(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, uint64_t ic, - const unsigned char *k); + const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_stream_xsalsa20_keygen(unsigned char k[crypto_stream_xsalsa20_KEYBYTES]); +void crypto_stream_xsalsa20_keygen(unsigned char k[crypto_stream_xsalsa20_KEYBYTES]) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_16.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_16.h index 5e9eeabee84..7b9c8077ad3 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_16.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_16.h @@ -14,7 +14,7 @@ size_t crypto_verify_16_bytes(void); SODIUM_EXPORT int crypto_verify_16(const unsigned char *x, const unsigned char *y) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_32.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_32.h index 281b5a1bb79..9b0f4529f6c 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_32.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_32.h @@ -14,7 +14,7 @@ size_t crypto_verify_32_bytes(void); SODIUM_EXPORT int crypto_verify_32(const unsigned char *x, const unsigned char *y) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_64.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_64.h index 0dc7c304a99..c83b73025a6 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_64.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_64.h @@ -14,7 +14,7 @@ size_t crypto_verify_64_bytes(void); SODIUM_EXPORT int crypto_verify_64(const unsigned char *x, const unsigned char *y) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/export.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/export.h index c33bced8188..a0074fc9cbb 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/export.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/export.h @@ -2,7 +2,11 @@ #ifndef sodium_export_H #define sodium_export_H -#ifndef __GNUC__ +#include +#include +#include + +#if !defined(__clang__) && !defined(__GNUC__) # ifdef __attribute__ # undef __attribute__ # endif @@ -11,6 +15,7 @@ #ifdef SODIUM_STATIC # define SODIUM_EXPORT +# define SODIUM_EXPORT_WEAK #else # if defined(_MSC_VER) # ifdef SODIUM_DLL_EXPORT @@ -31,6 +36,11 @@ # define SODIUM_EXPORT __attribute__ ((visibility ("default"))) # endif # endif +# if defined(__ELF__) && !defined(SODIUM_DISABLE_WEAK_FUNCTIONS) +# define SODIUM_EXPORT_WEAK SODIUM_EXPORT __attribute__((weak)) +# else +# define SODIUM_EXPORT_WEAK SODIUM_EXPORT +# endif #endif #ifndef CRYPTO_ALIGN @@ -41,4 +51,7 @@ # endif #endif +#define SODIUM_MIN(A, B) ((A) < (B) ? (A) : (B)) +#define SODIUM_SIZE_MAX SODIUM_MIN(UINT64_MAX, SIZE_MAX) + #endif diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/chacha20_ietf_ext.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/chacha20_ietf_ext.h new file mode 100644 index 00000000000..2c80b96aa72 --- /dev/null +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/chacha20_ietf_ext.h @@ -0,0 +1,16 @@ +#ifndef chacha20_ietf_ext_H +#define chacha20_ietf_ext_H + +#include + +/* The ietf_ext variant allows the internal counter to overflow into the IV */ + +int crypto_stream_chacha20_ietf_ext(unsigned char *c, unsigned long long clen, + const unsigned char *n, const unsigned char *k); + +int crypto_stream_chacha20_ietf_ext_xor_ic(unsigned char *c, const unsigned char *m, + unsigned long long mlen, + const unsigned char *n, uint32_t ic, + const unsigned char *k); +#endif + diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/common.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/common.h index 5e27e5749f9..339e725ba47 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/common.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/common.h @@ -1,12 +1,35 @@ #ifndef common_H #define common_H 1 +#if !defined(_MSC_VER) && !defined(DEV_MODE) && 0 +# warning *** This is unstable, untested, development code. +# warning It might not compile. It might not work as expected. +# warning It might be totally insecure. +# warning Do not use this except if you are planning to contribute code. +# warning Use releases available at https://download.libsodium.org/libsodium/releases/ instead. +# warning Alternatively, use the "stable" branch in the git repository. +#endif + +#if !defined(_MSC_VER) && (!defined(CONFIGURED) || CONFIGURED != 1) +# warning *** The library is being compiled using an undocumented method. +# warning This is not supported. It has not been tested, it might not +# warning work as expected, and performance is likely to be suboptimal. +#endif + #include #include #include #define COMPILER_ASSERT(X) (void) sizeof(char[(X) ? 1 : -1]) +#ifdef HAVE_TI_MODE +# if defined(__SIZEOF_INT128__) +typedef unsigned __int128 uint128_t; +# else +typedef unsigned uint128_t __attribute__((mode(TI))); +# endif +#endif + #define ROTL32(X, B) rotl32((X), (B)) static inline uint32_t rotl32(const uint32_t x, const int b) @@ -177,7 +200,18 @@ store32_be(uint8_t dst[4], uint32_t w) #endif } -#ifndef __GNUC__ +#define XOR_BUF(OUT, IN, N) xor_buf((OUT), (IN), (N)) +static inline void +xor_buf(unsigned char *out, const unsigned char *in, size_t n) +{ + size_t i; + + for (i = 0; i < n; i++) { + out[i] ^= in[i]; + } +} + +#if !defined(__clang__) && !defined(__GNUC__) # ifdef __attribute__ # undef __attribute__ # endif @@ -214,4 +248,14 @@ store32_be(uint8_t dst[4], uint32_t w) # include #endif +#ifdef HAVE_LIBCTGRIND +extern void ct_poison (const void *, size_t); +extern void ct_unpoison(const void *, size_t); +# define POISON(X, L) ct_poison((X), (L)) +# define UNPOISON(X, L) ct_unpoison((X), (L)) +#else +# define POISON(X, L) (void) 0 +# define UNPOISON(X, L) (void) 0 +#endif + #endif diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/curve25519_ref10.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/curve25519_ref10.h deleted file mode 100644 index 2b9caeb1f0d..00000000000 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/curve25519_ref10.h +++ /dev/null @@ -1,160 +0,0 @@ -#ifndef curve25519_ref10_H -#define curve25519_ref10_H - -#include -#include - -#define fe crypto_core_curve25519_ref10_fe -typedef int32_t fe[10]; - -/* - fe means field element. - Here the field is \Z/(2^255-19). - An element t, entries t[0]...t[9], represents the integer - t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9]. - Bounds on each t[i] vary depending on context. - */ - -#define fe_frombytes crypto_core_curve25519_ref10_fe_frombytes -#define fe_tobytes crypto_core_curve25519_ref10_fe_tobytes -#define fe_copy crypto_core_curve25519_ref10_fe_copy -#define fe_isnonzero crypto_core_curve25519_ref10_fe_isnonzero -#define fe_isnegative crypto_core_curve25519_ref10_fe_isnegative -#define fe_0 crypto_core_curve25519_ref10_fe_0 -#define fe_1 crypto_core_curve25519_ref10_fe_1 -#define fe_cmov crypto_core_curve25519_ref10_fe_cmov -#define fe_add crypto_core_curve25519_ref10_fe_add -#define fe_sub crypto_core_curve25519_ref10_fe_sub -#define fe_neg crypto_core_curve25519_ref10_fe_neg -#define fe_mul crypto_core_curve25519_ref10_fe_mul -#define fe_sq crypto_core_curve25519_ref10_fe_sq -#define fe_sq2 crypto_core_curve25519_ref10_fe_sq2 -#define fe_invert crypto_core_curve25519_ref10_fe_invert -#define fe_pow22523 crypto_core_curve25519_ref10_fe_pow22523 - -extern void fe_frombytes(fe,const unsigned char *); -extern void fe_tobytes(unsigned char *,const fe); - -extern void fe_copy(fe,const fe); -extern int fe_isnonzero(const fe); -extern int fe_isnegative(const fe); -extern void fe_0(fe); -extern void fe_1(fe); -extern void fe_cmov(fe,const fe,unsigned int); -extern void fe_add(fe,const fe,const fe); -extern void fe_sub(fe,const fe,const fe); -extern void fe_neg(fe,const fe); -extern void fe_mul(fe,const fe,const fe); -extern void fe_sq(fe,const fe); -extern void fe_sq2(fe,const fe); -extern void fe_invert(fe,const fe); -extern void fe_pow22523(fe,const fe); - -/* - ge means group element. - * - Here the group is the set of pairs (x,y) of field elements (see fe.h) - satisfying -x^2 + y^2 = 1 + d x^2y^2 - where d = -121665/121666. - * - Representations: - ge_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z - ge_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT - ge_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T - ge_precomp (Duif): (y+x,y-x,2dxy) - */ - -#define ge_p2 crypto_core_curve25519_ref10_ge_p2 -typedef struct { - fe X; - fe Y; - fe Z; -} ge_p2; - -#define ge_p3 crypto_core_curve25519_ref10_ge_p3 -typedef struct { - fe X; - fe Y; - fe Z; - fe T; -} ge_p3; - -#define ge_p1p1 crypto_core_curve25519_ref10_ge_p1p1 -typedef struct { - fe X; - fe Y; - fe Z; - fe T; -} ge_p1p1; - -#define ge_precomp crypto_core_curve25519_ref10_ge_precomp -typedef struct { - fe yplusx; - fe yminusx; - fe xy2d; -} ge_precomp; - -#define ge_cached crypto_core_curve25519_ref10_ge_cached -typedef struct { - fe YplusX; - fe YminusX; - fe Z; - fe T2d; -} ge_cached; - -#define ge_frombytes_negate_vartime crypto_core_curve25519_ref10_ge_frombytes_negate_vartime -#define ge_tobytes crypto_core_curve25519_ref10_ge_tobytes -#define ge_p3_tobytes crypto_core_curve25519_ref10_ge_p3_tobytes - -#define ge_p2_0 crypto_core_curve25519_ref10_ge_p2_0 -#define ge_p3_0 crypto_core_curve25519_ref10_ge_p3_0 -#define ge_precomp_0 crypto_core_curve25519_ref10_ge_precomp_0 -#define ge_p3_to_p2 crypto_core_curve25519_ref10_ge_p3_to_p2 -#define ge_p3_to_cached crypto_core_curve25519_ref10_ge_p3_to_cached -#define ge_p1p1_to_p2 crypto_core_curve25519_ref10_ge_p1p1_to_p2 -#define ge_p1p1_to_p3 crypto_core_curve25519_ref10_ge_p1p1_to_p3 -#define ge_p2_dbl crypto_core_curve25519_ref10_ge_p2_dbl -#define ge_p3_dbl crypto_core_curve25519_ref10_ge_p3_dbl - -#define ge_madd crypto_core_curve25519_ref10_ge_madd -#define ge_msub crypto_core_curve25519_ref10_ge_msub -#define ge_add crypto_core_curve25519_ref10_ge_add -#define ge_sub crypto_core_curve25519_ref10_ge_sub -#define ge_scalarmult_base crypto_core_curve25519_ref10_ge_scalarmult_base -#define ge_double_scalarmult_vartime crypto_core_curve25519_ref10_ge_double_scalarmult_vartime -#define ge_scalarmult_vartime crypto_core_curve25519_ref10_ge_scalarmult_vartime - -extern void ge_tobytes(unsigned char *,const ge_p2 *); -extern void ge_p3_tobytes(unsigned char *,const ge_p3 *); -extern int ge_frombytes_negate_vartime(ge_p3 *,const unsigned char *); - -extern void ge_p2_0(ge_p2 *); -extern void ge_p3_0(ge_p3 *); -extern void ge_precomp_0(ge_precomp *); -extern void ge_p3_to_p2(ge_p2 *,const ge_p3 *); -extern void ge_p3_to_cached(ge_cached *,const ge_p3 *); -extern void ge_p1p1_to_p2(ge_p2 *,const ge_p1p1 *); -extern void ge_p1p1_to_p3(ge_p3 *,const ge_p1p1 *); -extern void ge_p2_dbl(ge_p1p1 *,const ge_p2 *); -extern void ge_p3_dbl(ge_p1p1 *,const ge_p3 *); - -extern void ge_madd(ge_p1p1 *,const ge_p3 *,const ge_precomp *); -extern void ge_msub(ge_p1p1 *,const ge_p3 *,const ge_precomp *); -extern void ge_add(ge_p1p1 *,const ge_p3 *,const ge_cached *); -extern void ge_sub(ge_p1p1 *,const ge_p3 *,const ge_cached *); -extern void ge_scalarmult_base(ge_p3 *,const unsigned char *); -extern void ge_double_scalarmult_vartime(ge_p2 *,const unsigned char *,const ge_p3 *,const unsigned char *); -extern void ge_scalarmult_vartime(ge_p3 *,const unsigned char *,const ge_p3 *); - -/* - The set of scalars is \Z/l - where l = 2^252 + 27742317777372353535851937790883648493. - */ - -#define sc_reduce crypto_core_curve25519_ref10_sc_reduce -#define sc_muladd crypto_core_curve25519_ref10_sc_muladd - -extern void sc_reduce(unsigned char *); -extern void sc_muladd(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *); - -#endif diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10.h new file mode 100644 index 00000000000..3f4c45caf0e --- /dev/null +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10.h @@ -0,0 +1,142 @@ +#ifndef ed25519_ref10_H +#define ed25519_ref10_H + +#include +#include + +/* + fe means field element. + Here the field is \Z/(2^255-19). + */ + +#ifdef HAVE_TI_MODE +typedef uint64_t fe25519[5]; +#else +typedef int32_t fe25519[10]; +#endif + +void fe25519_invert(fe25519 out, const fe25519 z); +void fe25519_frombytes(fe25519 h, const unsigned char *s); +void fe25519_tobytes(unsigned char *s, const fe25519 h); + +#ifdef HAVE_TI_MODE +# include "ed25519_ref10_fe_51.h" +#else +# include "ed25519_ref10_fe_25_5.h" +#endif + + +/* + ge means group element. + + Here the group is the set of pairs (x,y) of field elements + satisfying -x^2 + y^2 = 1 + d x^2y^2 + where d = -121665/121666. + + Representations: + ge25519_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z + ge25519_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT + ge25519_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T + ge25519_precomp (Duif): (y+x,y-x,2dxy) + */ + +typedef struct { + fe25519 X; + fe25519 Y; + fe25519 Z; +} ge25519_p2; + +typedef struct { + fe25519 X; + fe25519 Y; + fe25519 Z; + fe25519 T; +} ge25519_p3; + +typedef struct { + fe25519 X; + fe25519 Y; + fe25519 Z; + fe25519 T; +} ge25519_p1p1; + +typedef struct { + fe25519 yplusx; + fe25519 yminusx; + fe25519 xy2d; +} ge25519_precomp; + +typedef struct { + fe25519 YplusX; + fe25519 YminusX; + fe25519 Z; + fe25519 T2d; +} ge25519_cached; + +void ge25519_tobytes(unsigned char *s, const ge25519_p2 *h); + +void ge25519_p3_tobytes(unsigned char *s, const ge25519_p3 *h); + +int ge25519_frombytes(ge25519_p3 *h, const unsigned char *s); + +int ge25519_frombytes_negate_vartime(ge25519_p3 *h, const unsigned char *s); + +void ge25519_p3_to_cached(ge25519_cached *r, const ge25519_p3 *p); + +void ge25519_p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p); + +void ge25519_p1p1_to_p3(ge25519_p3 *r, const ge25519_p1p1 *p); + +void ge25519_add(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_cached *q); + +void ge25519_sub(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_cached *q); + +void ge25519_scalarmult_base(ge25519_p3 *h, const unsigned char *a); + +void ge25519_double_scalarmult_vartime(ge25519_p2 *r, const unsigned char *a, + const ge25519_p3 *A, + const unsigned char *b); + +void ge25519_scalarmult(ge25519_p3 *h, const unsigned char *a, + const ge25519_p3 *p); + +int ge25519_is_canonical(const unsigned char *s); + +int ge25519_is_on_curve(const ge25519_p3 *p); + +int ge25519_is_on_main_subgroup(const ge25519_p3 *p); + +int ge25519_has_small_order(const unsigned char s[32]); + +void ge25519_from_uniform(unsigned char s[32], const unsigned char r[32]); + +void ge25519_from_hash(unsigned char s[32], const unsigned char h[64]); + +/* + Ristretto group + */ + +int ristretto255_frombytes(ge25519_p3 *h, const unsigned char *s); + +void ristretto255_p3_tobytes(unsigned char *s, const ge25519_p3 *h); + +void ristretto255_from_hash(unsigned char s[32], const unsigned char h[64]); + +/* + The set of scalars is \Z/l + where l = 2^252 + 27742317777372353535851937790883648493. + */ + +void sc25519_invert(unsigned char recip[32], const unsigned char s[32]); + +void sc25519_reduce(unsigned char s[64]); + +void sc25519_mul(unsigned char s[32], const unsigned char a[32], + const unsigned char b[32]); + +void sc25519_muladd(unsigned char s[32], const unsigned char a[32], + const unsigned char b[32], const unsigned char c[32]); + +int sc25519_is_canonical(const unsigned char s[32]); + +#endif diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_25_5.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_25_5.h new file mode 100644 index 00000000000..5a0b6148b7b --- /dev/null +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_25_5.h @@ -0,0 +1,1050 @@ +#include + +#include "private/common.h" +#include "utils.h" + +/* + h = 0 + */ + +static inline void +fe25519_0(fe25519 h) +{ + memset(&h[0], 0, 10 * sizeof h[0]); +} + +/* + h = 1 + */ + +static inline void +fe25519_1(fe25519 h) +{ + h[0] = 1; + h[1] = 0; + memset(&h[2], 0, 8 * sizeof h[0]); +} + +/* + h = f + g + Can overlap h with f or g. + * + Preconditions: + |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. + |g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. + * + Postconditions: + |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. + */ + +static inline void +fe25519_add(fe25519 h, const fe25519 f, const fe25519 g) +{ + int32_t h0 = f[0] + g[0]; + int32_t h1 = f[1] + g[1]; + int32_t h2 = f[2] + g[2]; + int32_t h3 = f[3] + g[3]; + int32_t h4 = f[4] + g[4]; + int32_t h5 = f[5] + g[5]; + int32_t h6 = f[6] + g[6]; + int32_t h7 = f[7] + g[7]; + int32_t h8 = f[8] + g[8]; + int32_t h9 = f[9] + g[9]; + + h[0] = h0; + h[1] = h1; + h[2] = h2; + h[3] = h3; + h[4] = h4; + h[5] = h5; + h[6] = h6; + h[7] = h7; + h[8] = h8; + h[9] = h9; +} + +/* + h = f - g + Can overlap h with f or g. + * + Preconditions: + |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. + |g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. + * + Postconditions: + |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. + */ + +static void +fe25519_sub(fe25519 h, const fe25519 f, const fe25519 g) +{ + int32_t h0 = f[0] - g[0]; + int32_t h1 = f[1] - g[1]; + int32_t h2 = f[2] - g[2]; + int32_t h3 = f[3] - g[3]; + int32_t h4 = f[4] - g[4]; + int32_t h5 = f[5] - g[5]; + int32_t h6 = f[6] - g[6]; + int32_t h7 = f[7] - g[7]; + int32_t h8 = f[8] - g[8]; + int32_t h9 = f[9] - g[9]; + + h[0] = h0; + h[1] = h1; + h[2] = h2; + h[3] = h3; + h[4] = h4; + h[5] = h5; + h[6] = h6; + h[7] = h7; + h[8] = h8; + h[9] = h9; +} + +/* + h = -f + * + Preconditions: + |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. + * + Postconditions: + |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. + */ + +static inline void +fe25519_neg(fe25519 h, const fe25519 f) +{ + int32_t h0 = -f[0]; + int32_t h1 = -f[1]; + int32_t h2 = -f[2]; + int32_t h3 = -f[3]; + int32_t h4 = -f[4]; + int32_t h5 = -f[5]; + int32_t h6 = -f[6]; + int32_t h7 = -f[7]; + int32_t h8 = -f[8]; + int32_t h9 = -f[9]; + + h[0] = h0; + h[1] = h1; + h[2] = h2; + h[3] = h3; + h[4] = h4; + h[5] = h5; + h[6] = h6; + h[7] = h7; + h[8] = h8; + h[9] = h9; +} + +/* + Replace (f,g) with (g,g) if b == 1; + replace (f,g) with (f,g) if b == 0. + * + Preconditions: b in {0,1}. + */ + +static void +fe25519_cmov(fe25519 f, const fe25519 g, unsigned int b) +{ + const uint32_t mask = (uint32_t) (-(int32_t) b); + + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + + int32_t x0 = f0 ^ g[0]; + int32_t x1 = f1 ^ g[1]; + int32_t x2 = f2 ^ g[2]; + int32_t x3 = f3 ^ g[3]; + int32_t x4 = f4 ^ g[4]; + int32_t x5 = f5 ^ g[5]; + int32_t x6 = f6 ^ g[6]; + int32_t x7 = f7 ^ g[7]; + int32_t x8 = f8 ^ g[8]; + int32_t x9 = f9 ^ g[9]; + + x0 &= mask; + x1 &= mask; + x2 &= mask; + x3 &= mask; + x4 &= mask; + x5 &= mask; + x6 &= mask; + x7 &= mask; + x8 &= mask; + x9 &= mask; + + f[0] = f0 ^ x0; + f[1] = f1 ^ x1; + f[2] = f2 ^ x2; + f[3] = f3 ^ x3; + f[4] = f4 ^ x4; + f[5] = f5 ^ x5; + f[6] = f6 ^ x6; + f[7] = f7 ^ x7; + f[8] = f8 ^ x8; + f[9] = f9 ^ x9; +} + +static void +fe25519_cswap(fe25519 f, fe25519 g, unsigned int b) +{ + const uint32_t mask = (uint32_t) (-(int64_t) b); + + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + + int32_t g0 = g[0]; + int32_t g1 = g[1]; + int32_t g2 = g[2]; + int32_t g3 = g[3]; + int32_t g4 = g[4]; + int32_t g5 = g[5]; + int32_t g6 = g[6]; + int32_t g7 = g[7]; + int32_t g8 = g[8]; + int32_t g9 = g[9]; + + int32_t x0 = f0 ^ g0; + int32_t x1 = f1 ^ g1; + int32_t x2 = f2 ^ g2; + int32_t x3 = f3 ^ g3; + int32_t x4 = f4 ^ g4; + int32_t x5 = f5 ^ g5; + int32_t x6 = f6 ^ g6; + int32_t x7 = f7 ^ g7; + int32_t x8 = f8 ^ g8; + int32_t x9 = f9 ^ g9; + + x0 &= mask; + x1 &= mask; + x2 &= mask; + x3 &= mask; + x4 &= mask; + x5 &= mask; + x6 &= mask; + x7 &= mask; + x8 &= mask; + x9 &= mask; + + f[0] = f0 ^ x0; + f[1] = f1 ^ x1; + f[2] = f2 ^ x2; + f[3] = f3 ^ x3; + f[4] = f4 ^ x4; + f[5] = f5 ^ x5; + f[6] = f6 ^ x6; + f[7] = f7 ^ x7; + f[8] = f8 ^ x8; + f[9] = f9 ^ x9; + + g[0] = g0 ^ x0; + g[1] = g1 ^ x1; + g[2] = g2 ^ x2; + g[3] = g3 ^ x3; + g[4] = g4 ^ x4; + g[5] = g5 ^ x5; + g[6] = g6 ^ x6; + g[7] = g7 ^ x7; + g[8] = g8 ^ x8; + g[9] = g9 ^ x9; +} + +/* + h = f + */ + +static inline void +fe25519_copy(fe25519 h, const fe25519 f) +{ + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + + h[0] = f0; + h[1] = f1; + h[2] = f2; + h[3] = f3; + h[4] = f4; + h[5] = f5; + h[6] = f6; + h[7] = f7; + h[8] = f8; + h[9] = f9; +} + +/* + return 1 if f is in {1,3,5,...,q-2} + return 0 if f is in {0,2,4,...,q-1} + + Preconditions: + |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. + */ + +static inline int +fe25519_isnegative(const fe25519 f) +{ + unsigned char s[32]; + + fe25519_tobytes(s, f); + + return s[0] & 1; +} + +/* + return 1 if f == 0 + return 0 if f != 0 + + Preconditions: + |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. + */ + +static inline int +fe25519_iszero(const fe25519 f) +{ + unsigned char s[32]; + + fe25519_tobytes(s, f); + + return sodium_is_zero(s, 32); +} + +/* + h = f * g + Can overlap h with f or g. + * + Preconditions: + |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc. + |g| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc. + * + Postconditions: + |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc. + */ + +/* + Notes on implementation strategy: + * + Using schoolbook multiplication. + Karatsuba would save a little in some cost models. + * + Most multiplications by 2 and 19 are 32-bit precomputations; + cheaper than 64-bit postcomputations. + * + There is one remaining multiplication by 19 in the carry chain; + one *19 precomputation can be merged into this, + but the resulting data flow is considerably less clean. + * + There are 12 carries below. + 10 of them are 2-way parallelizable and vectorizable. + Can get away with 11 carries, but then data flow is much deeper. + * + With tighter constraints on inputs can squeeze carries into int32. + */ + +static void +fe25519_mul(fe25519 h, const fe25519 f, const fe25519 g) +{ + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + + int32_t g0 = g[0]; + int32_t g1 = g[1]; + int32_t g2 = g[2]; + int32_t g3 = g[3]; + int32_t g4 = g[4]; + int32_t g5 = g[5]; + int32_t g6 = g[6]; + int32_t g7 = g[7]; + int32_t g8 = g[8]; + int32_t g9 = g[9]; + + int32_t g1_19 = 19 * g1; /* 1.959375*2^29 */ + int32_t g2_19 = 19 * g2; /* 1.959375*2^30; still ok */ + int32_t g3_19 = 19 * g3; + int32_t g4_19 = 19 * g4; + int32_t g5_19 = 19 * g5; + int32_t g6_19 = 19 * g6; + int32_t g7_19 = 19 * g7; + int32_t g8_19 = 19 * g8; + int32_t g9_19 = 19 * g9; + int32_t f1_2 = 2 * f1; + int32_t f3_2 = 2 * f3; + int32_t f5_2 = 2 * f5; + int32_t f7_2 = 2 * f7; + int32_t f9_2 = 2 * f9; + + int64_t f0g0 = f0 * (int64_t) g0; + int64_t f0g1 = f0 * (int64_t) g1; + int64_t f0g2 = f0 * (int64_t) g2; + int64_t f0g3 = f0 * (int64_t) g3; + int64_t f0g4 = f0 * (int64_t) g4; + int64_t f0g5 = f0 * (int64_t) g5; + int64_t f0g6 = f0 * (int64_t) g6; + int64_t f0g7 = f0 * (int64_t) g7; + int64_t f0g8 = f0 * (int64_t) g8; + int64_t f0g9 = f0 * (int64_t) g9; + int64_t f1g0 = f1 * (int64_t) g0; + int64_t f1g1_2 = f1_2 * (int64_t) g1; + int64_t f1g2 = f1 * (int64_t) g2; + int64_t f1g3_2 = f1_2 * (int64_t) g3; + int64_t f1g4 = f1 * (int64_t) g4; + int64_t f1g5_2 = f1_2 * (int64_t) g5; + int64_t f1g6 = f1 * (int64_t) g6; + int64_t f1g7_2 = f1_2 * (int64_t) g7; + int64_t f1g8 = f1 * (int64_t) g8; + int64_t f1g9_38 = f1_2 * (int64_t) g9_19; + int64_t f2g0 = f2 * (int64_t) g0; + int64_t f2g1 = f2 * (int64_t) g1; + int64_t f2g2 = f2 * (int64_t) g2; + int64_t f2g3 = f2 * (int64_t) g3; + int64_t f2g4 = f2 * (int64_t) g4; + int64_t f2g5 = f2 * (int64_t) g5; + int64_t f2g6 = f2 * (int64_t) g6; + int64_t f2g7 = f2 * (int64_t) g7; + int64_t f2g8_19 = f2 * (int64_t) g8_19; + int64_t f2g9_19 = f2 * (int64_t) g9_19; + int64_t f3g0 = f3 * (int64_t) g0; + int64_t f3g1_2 = f3_2 * (int64_t) g1; + int64_t f3g2 = f3 * (int64_t) g2; + int64_t f3g3_2 = f3_2 * (int64_t) g3; + int64_t f3g4 = f3 * (int64_t) g4; + int64_t f3g5_2 = f3_2 * (int64_t) g5; + int64_t f3g6 = f3 * (int64_t) g6; + int64_t f3g7_38 = f3_2 * (int64_t) g7_19; + int64_t f3g8_19 = f3 * (int64_t) g8_19; + int64_t f3g9_38 = f3_2 * (int64_t) g9_19; + int64_t f4g0 = f4 * (int64_t) g0; + int64_t f4g1 = f4 * (int64_t) g1; + int64_t f4g2 = f4 * (int64_t) g2; + int64_t f4g3 = f4 * (int64_t) g3; + int64_t f4g4 = f4 * (int64_t) g4; + int64_t f4g5 = f4 * (int64_t) g5; + int64_t f4g6_19 = f4 * (int64_t) g6_19; + int64_t f4g7_19 = f4 * (int64_t) g7_19; + int64_t f4g8_19 = f4 * (int64_t) g8_19; + int64_t f4g9_19 = f4 * (int64_t) g9_19; + int64_t f5g0 = f5 * (int64_t) g0; + int64_t f5g1_2 = f5_2 * (int64_t) g1; + int64_t f5g2 = f5 * (int64_t) g2; + int64_t f5g3_2 = f5_2 * (int64_t) g3; + int64_t f5g4 = f5 * (int64_t) g4; + int64_t f5g5_38 = f5_2 * (int64_t) g5_19; + int64_t f5g6_19 = f5 * (int64_t) g6_19; + int64_t f5g7_38 = f5_2 * (int64_t) g7_19; + int64_t f5g8_19 = f5 * (int64_t) g8_19; + int64_t f5g9_38 = f5_2 * (int64_t) g9_19; + int64_t f6g0 = f6 * (int64_t) g0; + int64_t f6g1 = f6 * (int64_t) g1; + int64_t f6g2 = f6 * (int64_t) g2; + int64_t f6g3 = f6 * (int64_t) g3; + int64_t f6g4_19 = f6 * (int64_t) g4_19; + int64_t f6g5_19 = f6 * (int64_t) g5_19; + int64_t f6g6_19 = f6 * (int64_t) g6_19; + int64_t f6g7_19 = f6 * (int64_t) g7_19; + int64_t f6g8_19 = f6 * (int64_t) g8_19; + int64_t f6g9_19 = f6 * (int64_t) g9_19; + int64_t f7g0 = f7 * (int64_t) g0; + int64_t f7g1_2 = f7_2 * (int64_t) g1; + int64_t f7g2 = f7 * (int64_t) g2; + int64_t f7g3_38 = f7_2 * (int64_t) g3_19; + int64_t f7g4_19 = f7 * (int64_t) g4_19; + int64_t f7g5_38 = f7_2 * (int64_t) g5_19; + int64_t f7g6_19 = f7 * (int64_t) g6_19; + int64_t f7g7_38 = f7_2 * (int64_t) g7_19; + int64_t f7g8_19 = f7 * (int64_t) g8_19; + int64_t f7g9_38 = f7_2 * (int64_t) g9_19; + int64_t f8g0 = f8 * (int64_t) g0; + int64_t f8g1 = f8 * (int64_t) g1; + int64_t f8g2_19 = f8 * (int64_t) g2_19; + int64_t f8g3_19 = f8 * (int64_t) g3_19; + int64_t f8g4_19 = f8 * (int64_t) g4_19; + int64_t f8g5_19 = f8 * (int64_t) g5_19; + int64_t f8g6_19 = f8 * (int64_t) g6_19; + int64_t f8g7_19 = f8 * (int64_t) g7_19; + int64_t f8g8_19 = f8 * (int64_t) g8_19; + int64_t f8g9_19 = f8 * (int64_t) g9_19; + int64_t f9g0 = f9 * (int64_t) g0; + int64_t f9g1_38 = f9_2 * (int64_t) g1_19; + int64_t f9g2_19 = f9 * (int64_t) g2_19; + int64_t f9g3_38 = f9_2 * (int64_t) g3_19; + int64_t f9g4_19 = f9 * (int64_t) g4_19; + int64_t f9g5_38 = f9_2 * (int64_t) g5_19; + int64_t f9g6_19 = f9 * (int64_t) g6_19; + int64_t f9g7_38 = f9_2 * (int64_t) g7_19; + int64_t f9g8_19 = f9 * (int64_t) g8_19; + int64_t f9g9_38 = f9_2 * (int64_t) g9_19; + + int64_t h0 = f0g0 + f1g9_38 + f2g8_19 + f3g7_38 + f4g6_19 + f5g5_38 + + f6g4_19 + f7g3_38 + f8g2_19 + f9g1_38; + int64_t h1 = f0g1 + f1g0 + f2g9_19 + f3g8_19 + f4g7_19 + f5g6_19 + f6g5_19 + + f7g4_19 + f8g3_19 + f9g2_19; + int64_t h2 = f0g2 + f1g1_2 + f2g0 + f3g9_38 + f4g8_19 + f5g7_38 + f6g6_19 + + f7g5_38 + f8g4_19 + f9g3_38; + int64_t h3 = f0g3 + f1g2 + f2g1 + f3g0 + f4g9_19 + f5g8_19 + f6g7_19 + + f7g6_19 + f8g5_19 + f9g4_19; + int64_t h4 = f0g4 + f1g3_2 + f2g2 + f3g1_2 + f4g0 + f5g9_38 + f6g8_19 + + f7g7_38 + f8g6_19 + f9g5_38; + int64_t h5 = f0g5 + f1g4 + f2g3 + f3g2 + f4g1 + f5g0 + f6g9_19 + f7g8_19 + + f8g7_19 + f9g6_19; + int64_t h6 = f0g6 + f1g5_2 + f2g4 + f3g3_2 + f4g2 + f5g1_2 + f6g0 + + f7g9_38 + f8g8_19 + f9g7_38; + int64_t h7 = f0g7 + f1g6 + f2g5 + f3g4 + f4g3 + f5g2 + f6g1 + f7g0 + + f8g9_19 + f9g8_19; + int64_t h8 = f0g8 + f1g7_2 + f2g6 + f3g5_2 + f4g4 + f5g3_2 + f6g2 + f7g1_2 + + f8g0 + f9g9_38; + int64_t h9 = + f0g9 + f1g8 + f2g7 + f3g6 + f4g5 + f5g4 + f6g3 + f7g2 + f8g1 + f9g0; + + int64_t carry0; + int64_t carry1; + int64_t carry2; + int64_t carry3; + int64_t carry4; + int64_t carry5; + int64_t carry6; + int64_t carry7; + int64_t carry8; + int64_t carry9; + + /* + |h0| <= (1.65*1.65*2^52*(1+19+19+19+19)+1.65*1.65*2^50*(38+38+38+38+38)) + i.e. |h0| <= 1.4*2^60; narrower ranges for h2, h4, h6, h8 + |h1| <= (1.65*1.65*2^51*(1+1+19+19+19+19+19+19+19+19)) + i.e. |h1| <= 1.7*2^59; narrower ranges for h3, h5, h7, h9 + */ + + carry0 = (h0 + (int64_t)(1L << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((uint64_t) 1L << 26); + carry4 = (h4 + (int64_t)(1L << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((uint64_t) 1L << 26); + /* |h0| <= 2^25 */ + /* |h4| <= 2^25 */ + /* |h1| <= 1.71*2^59 */ + /* |h5| <= 1.71*2^59 */ + + carry1 = (h1 + (int64_t)(1L << 24)) >> 25; + h2 += carry1; + h1 -= carry1 * ((uint64_t) 1L << 25); + carry5 = (h5 + (int64_t)(1L << 24)) >> 25; + h6 += carry5; + h5 -= carry5 * ((uint64_t) 1L << 25); + /* |h1| <= 2^24; from now on fits into int32 */ + /* |h5| <= 2^24; from now on fits into int32 */ + /* |h2| <= 1.41*2^60 */ + /* |h6| <= 1.41*2^60 */ + + carry2 = (h2 + (int64_t)(1L << 25)) >> 26; + h3 += carry2; + h2 -= carry2 * ((uint64_t) 1L << 26); + carry6 = (h6 + (int64_t)(1L << 25)) >> 26; + h7 += carry6; + h6 -= carry6 * ((uint64_t) 1L << 26); + /* |h2| <= 2^25; from now on fits into int32 unchanged */ + /* |h6| <= 2^25; from now on fits into int32 unchanged */ + /* |h3| <= 1.71*2^59 */ + /* |h7| <= 1.71*2^59 */ + + carry3 = (h3 + (int64_t)(1L << 24)) >> 25; + h4 += carry3; + h3 -= carry3 * ((uint64_t) 1L << 25); + carry7 = (h7 + (int64_t)(1L << 24)) >> 25; + h8 += carry7; + h7 -= carry7 * ((uint64_t) 1L << 25); + /* |h3| <= 2^24; from now on fits into int32 unchanged */ + /* |h7| <= 2^24; from now on fits into int32 unchanged */ + /* |h4| <= 1.72*2^34 */ + /* |h8| <= 1.41*2^60 */ + + carry4 = (h4 + (int64_t)(1L << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((uint64_t) 1L << 26); + carry8 = (h8 + (int64_t)(1L << 25)) >> 26; + h9 += carry8; + h8 -= carry8 * ((uint64_t) 1L << 26); + /* |h4| <= 2^25; from now on fits into int32 unchanged */ + /* |h8| <= 2^25; from now on fits into int32 unchanged */ + /* |h5| <= 1.01*2^24 */ + /* |h9| <= 1.71*2^59 */ + + carry9 = (h9 + (int64_t)(1L << 24)) >> 25; + h0 += carry9 * 19; + h9 -= carry9 * ((uint64_t) 1L << 25); + /* |h9| <= 2^24; from now on fits into int32 unchanged */ + /* |h0| <= 1.1*2^39 */ + + carry0 = (h0 + (int64_t)(1L << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((uint64_t) 1L << 26); + /* |h0| <= 2^25; from now on fits into int32 unchanged */ + /* |h1| <= 1.01*2^24 */ + + h[0] = (int32_t) h0; + h[1] = (int32_t) h1; + h[2] = (int32_t) h2; + h[3] = (int32_t) h3; + h[4] = (int32_t) h4; + h[5] = (int32_t) h5; + h[6] = (int32_t) h6; + h[7] = (int32_t) h7; + h[8] = (int32_t) h8; + h[9] = (int32_t) h9; +} + +/* + h = f * f + Can overlap h with f. + * + Preconditions: + |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc. + * + Postconditions: + |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc. + */ + +static void +fe25519_sq(fe25519 h, const fe25519 f) +{ + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + + int32_t f0_2 = 2 * f0; + int32_t f1_2 = 2 * f1; + int32_t f2_2 = 2 * f2; + int32_t f3_2 = 2 * f3; + int32_t f4_2 = 2 * f4; + int32_t f5_2 = 2 * f5; + int32_t f6_2 = 2 * f6; + int32_t f7_2 = 2 * f7; + int32_t f5_38 = 38 * f5; /* 1.959375*2^30 */ + int32_t f6_19 = 19 * f6; /* 1.959375*2^30 */ + int32_t f7_38 = 38 * f7; /* 1.959375*2^30 */ + int32_t f8_19 = 19 * f8; /* 1.959375*2^30 */ + int32_t f9_38 = 38 * f9; /* 1.959375*2^30 */ + + int64_t f0f0 = f0 * (int64_t) f0; + int64_t f0f1_2 = f0_2 * (int64_t) f1; + int64_t f0f2_2 = f0_2 * (int64_t) f2; + int64_t f0f3_2 = f0_2 * (int64_t) f3; + int64_t f0f4_2 = f0_2 * (int64_t) f4; + int64_t f0f5_2 = f0_2 * (int64_t) f5; + int64_t f0f6_2 = f0_2 * (int64_t) f6; + int64_t f0f7_2 = f0_2 * (int64_t) f7; + int64_t f0f8_2 = f0_2 * (int64_t) f8; + int64_t f0f9_2 = f0_2 * (int64_t) f9; + int64_t f1f1_2 = f1_2 * (int64_t) f1; + int64_t f1f2_2 = f1_2 * (int64_t) f2; + int64_t f1f3_4 = f1_2 * (int64_t) f3_2; + int64_t f1f4_2 = f1_2 * (int64_t) f4; + int64_t f1f5_4 = f1_2 * (int64_t) f5_2; + int64_t f1f6_2 = f1_2 * (int64_t) f6; + int64_t f1f7_4 = f1_2 * (int64_t) f7_2; + int64_t f1f8_2 = f1_2 * (int64_t) f8; + int64_t f1f9_76 = f1_2 * (int64_t) f9_38; + int64_t f2f2 = f2 * (int64_t) f2; + int64_t f2f3_2 = f2_2 * (int64_t) f3; + int64_t f2f4_2 = f2_2 * (int64_t) f4; + int64_t f2f5_2 = f2_2 * (int64_t) f5; + int64_t f2f6_2 = f2_2 * (int64_t) f6; + int64_t f2f7_2 = f2_2 * (int64_t) f7; + int64_t f2f8_38 = f2_2 * (int64_t) f8_19; + int64_t f2f9_38 = f2 * (int64_t) f9_38; + int64_t f3f3_2 = f3_2 * (int64_t) f3; + int64_t f3f4_2 = f3_2 * (int64_t) f4; + int64_t f3f5_4 = f3_2 * (int64_t) f5_2; + int64_t f3f6_2 = f3_2 * (int64_t) f6; + int64_t f3f7_76 = f3_2 * (int64_t) f7_38; + int64_t f3f8_38 = f3_2 * (int64_t) f8_19; + int64_t f3f9_76 = f3_2 * (int64_t) f9_38; + int64_t f4f4 = f4 * (int64_t) f4; + int64_t f4f5_2 = f4_2 * (int64_t) f5; + int64_t f4f6_38 = f4_2 * (int64_t) f6_19; + int64_t f4f7_38 = f4 * (int64_t) f7_38; + int64_t f4f8_38 = f4_2 * (int64_t) f8_19; + int64_t f4f9_38 = f4 * (int64_t) f9_38; + int64_t f5f5_38 = f5 * (int64_t) f5_38; + int64_t f5f6_38 = f5_2 * (int64_t) f6_19; + int64_t f5f7_76 = f5_2 * (int64_t) f7_38; + int64_t f5f8_38 = f5_2 * (int64_t) f8_19; + int64_t f5f9_76 = f5_2 * (int64_t) f9_38; + int64_t f6f6_19 = f6 * (int64_t) f6_19; + int64_t f6f7_38 = f6 * (int64_t) f7_38; + int64_t f6f8_38 = f6_2 * (int64_t) f8_19; + int64_t f6f9_38 = f6 * (int64_t) f9_38; + int64_t f7f7_38 = f7 * (int64_t) f7_38; + int64_t f7f8_38 = f7_2 * (int64_t) f8_19; + int64_t f7f9_76 = f7_2 * (int64_t) f9_38; + int64_t f8f8_19 = f8 * (int64_t) f8_19; + int64_t f8f9_38 = f8 * (int64_t) f9_38; + int64_t f9f9_38 = f9 * (int64_t) f9_38; + + int64_t h0 = f0f0 + f1f9_76 + f2f8_38 + f3f7_76 + f4f6_38 + f5f5_38; + int64_t h1 = f0f1_2 + f2f9_38 + f3f8_38 + f4f7_38 + f5f6_38; + int64_t h2 = f0f2_2 + f1f1_2 + f3f9_76 + f4f8_38 + f5f7_76 + f6f6_19; + int64_t h3 = f0f3_2 + f1f2_2 + f4f9_38 + f5f8_38 + f6f7_38; + int64_t h4 = f0f4_2 + f1f3_4 + f2f2 + f5f9_76 + f6f8_38 + f7f7_38; + int64_t h5 = f0f5_2 + f1f4_2 + f2f3_2 + f6f9_38 + f7f8_38; + int64_t h6 = f0f6_2 + f1f5_4 + f2f4_2 + f3f3_2 + f7f9_76 + f8f8_19; + int64_t h7 = f0f7_2 + f1f6_2 + f2f5_2 + f3f4_2 + f8f9_38; + int64_t h8 = f0f8_2 + f1f7_4 + f2f6_2 + f3f5_4 + f4f4 + f9f9_38; + int64_t h9 = f0f9_2 + f1f8_2 + f2f7_2 + f3f6_2 + f4f5_2; + + int64_t carry0; + int64_t carry1; + int64_t carry2; + int64_t carry3; + int64_t carry4; + int64_t carry5; + int64_t carry6; + int64_t carry7; + int64_t carry8; + int64_t carry9; + + carry0 = (h0 + (int64_t)(1L << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((uint64_t) 1L << 26); + carry4 = (h4 + (int64_t)(1L << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((uint64_t) 1L << 26); + + carry1 = (h1 + (int64_t)(1L << 24)) >> 25; + h2 += carry1; + h1 -= carry1 * ((uint64_t) 1L << 25); + carry5 = (h5 + (int64_t)(1L << 24)) >> 25; + h6 += carry5; + h5 -= carry5 * ((uint64_t) 1L << 25); + + carry2 = (h2 + (int64_t)(1L << 25)) >> 26; + h3 += carry2; + h2 -= carry2 * ((uint64_t) 1L << 26); + carry6 = (h6 + (int64_t)(1L << 25)) >> 26; + h7 += carry6; + h6 -= carry6 * ((uint64_t) 1L << 26); + + carry3 = (h3 + (int64_t)(1L << 24)) >> 25; + h4 += carry3; + h3 -= carry3 * ((uint64_t) 1L << 25); + carry7 = (h7 + (int64_t)(1L << 24)) >> 25; + h8 += carry7; + h7 -= carry7 * ((uint64_t) 1L << 25); + + carry4 = (h4 + (int64_t)(1L << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((uint64_t) 1L << 26); + carry8 = (h8 + (int64_t)(1L << 25)) >> 26; + h9 += carry8; + h8 -= carry8 * ((uint64_t) 1L << 26); + + carry9 = (h9 + (int64_t)(1L << 24)) >> 25; + h0 += carry9 * 19; + h9 -= carry9 * ((uint64_t) 1L << 25); + + carry0 = (h0 + (int64_t)(1L << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((uint64_t) 1L << 26); + + h[0] = (int32_t) h0; + h[1] = (int32_t) h1; + h[2] = (int32_t) h2; + h[3] = (int32_t) h3; + h[4] = (int32_t) h4; + h[5] = (int32_t) h5; + h[6] = (int32_t) h6; + h[7] = (int32_t) h7; + h[8] = (int32_t) h8; + h[9] = (int32_t) h9; +} + +/* + h = 2 * f * f + Can overlap h with f. + * + Preconditions: + |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc. + * + Postconditions: + |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc. + */ + +static void +fe25519_sq2(fe25519 h, const fe25519 f) +{ + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + + int32_t f0_2 = 2 * f0; + int32_t f1_2 = 2 * f1; + int32_t f2_2 = 2 * f2; + int32_t f3_2 = 2 * f3; + int32_t f4_2 = 2 * f4; + int32_t f5_2 = 2 * f5; + int32_t f6_2 = 2 * f6; + int32_t f7_2 = 2 * f7; + int32_t f5_38 = 38 * f5; /* 1.959375*2^30 */ + int32_t f6_19 = 19 * f6; /* 1.959375*2^30 */ + int32_t f7_38 = 38 * f7; /* 1.959375*2^30 */ + int32_t f8_19 = 19 * f8; /* 1.959375*2^30 */ + int32_t f9_38 = 38 * f9; /* 1.959375*2^30 */ + + int64_t f0f0 = f0 * (int64_t) f0; + int64_t f0f1_2 = f0_2 * (int64_t) f1; + int64_t f0f2_2 = f0_2 * (int64_t) f2; + int64_t f0f3_2 = f0_2 * (int64_t) f3; + int64_t f0f4_2 = f0_2 * (int64_t) f4; + int64_t f0f5_2 = f0_2 * (int64_t) f5; + int64_t f0f6_2 = f0_2 * (int64_t) f6; + int64_t f0f7_2 = f0_2 * (int64_t) f7; + int64_t f0f8_2 = f0_2 * (int64_t) f8; + int64_t f0f9_2 = f0_2 * (int64_t) f9; + int64_t f1f1_2 = f1_2 * (int64_t) f1; + int64_t f1f2_2 = f1_2 * (int64_t) f2; + int64_t f1f3_4 = f1_2 * (int64_t) f3_2; + int64_t f1f4_2 = f1_2 * (int64_t) f4; + int64_t f1f5_4 = f1_2 * (int64_t) f5_2; + int64_t f1f6_2 = f1_2 * (int64_t) f6; + int64_t f1f7_4 = f1_2 * (int64_t) f7_2; + int64_t f1f8_2 = f1_2 * (int64_t) f8; + int64_t f1f9_76 = f1_2 * (int64_t) f9_38; + int64_t f2f2 = f2 * (int64_t) f2; + int64_t f2f3_2 = f2_2 * (int64_t) f3; + int64_t f2f4_2 = f2_2 * (int64_t) f4; + int64_t f2f5_2 = f2_2 * (int64_t) f5; + int64_t f2f6_2 = f2_2 * (int64_t) f6; + int64_t f2f7_2 = f2_2 * (int64_t) f7; + int64_t f2f8_38 = f2_2 * (int64_t) f8_19; + int64_t f2f9_38 = f2 * (int64_t) f9_38; + int64_t f3f3_2 = f3_2 * (int64_t) f3; + int64_t f3f4_2 = f3_2 * (int64_t) f4; + int64_t f3f5_4 = f3_2 * (int64_t) f5_2; + int64_t f3f6_2 = f3_2 * (int64_t) f6; + int64_t f3f7_76 = f3_2 * (int64_t) f7_38; + int64_t f3f8_38 = f3_2 * (int64_t) f8_19; + int64_t f3f9_76 = f3_2 * (int64_t) f9_38; + int64_t f4f4 = f4 * (int64_t) f4; + int64_t f4f5_2 = f4_2 * (int64_t) f5; + int64_t f4f6_38 = f4_2 * (int64_t) f6_19; + int64_t f4f7_38 = f4 * (int64_t) f7_38; + int64_t f4f8_38 = f4_2 * (int64_t) f8_19; + int64_t f4f9_38 = f4 * (int64_t) f9_38; + int64_t f5f5_38 = f5 * (int64_t) f5_38; + int64_t f5f6_38 = f5_2 * (int64_t) f6_19; + int64_t f5f7_76 = f5_2 * (int64_t) f7_38; + int64_t f5f8_38 = f5_2 * (int64_t) f8_19; + int64_t f5f9_76 = f5_2 * (int64_t) f9_38; + int64_t f6f6_19 = f6 * (int64_t) f6_19; + int64_t f6f7_38 = f6 * (int64_t) f7_38; + int64_t f6f8_38 = f6_2 * (int64_t) f8_19; + int64_t f6f9_38 = f6 * (int64_t) f9_38; + int64_t f7f7_38 = f7 * (int64_t) f7_38; + int64_t f7f8_38 = f7_2 * (int64_t) f8_19; + int64_t f7f9_76 = f7_2 * (int64_t) f9_38; + int64_t f8f8_19 = f8 * (int64_t) f8_19; + int64_t f8f9_38 = f8 * (int64_t) f9_38; + int64_t f9f9_38 = f9 * (int64_t) f9_38; + + int64_t h0 = f0f0 + f1f9_76 + f2f8_38 + f3f7_76 + f4f6_38 + f5f5_38; + int64_t h1 = f0f1_2 + f2f9_38 + f3f8_38 + f4f7_38 + f5f6_38; + int64_t h2 = f0f2_2 + f1f1_2 + f3f9_76 + f4f8_38 + f5f7_76 + f6f6_19; + int64_t h3 = f0f3_2 + f1f2_2 + f4f9_38 + f5f8_38 + f6f7_38; + int64_t h4 = f0f4_2 + f1f3_4 + f2f2 + f5f9_76 + f6f8_38 + f7f7_38; + int64_t h5 = f0f5_2 + f1f4_2 + f2f3_2 + f6f9_38 + f7f8_38; + int64_t h6 = f0f6_2 + f1f5_4 + f2f4_2 + f3f3_2 + f7f9_76 + f8f8_19; + int64_t h7 = f0f7_2 + f1f6_2 + f2f5_2 + f3f4_2 + f8f9_38; + int64_t h8 = f0f8_2 + f1f7_4 + f2f6_2 + f3f5_4 + f4f4 + f9f9_38; + int64_t h9 = f0f9_2 + f1f8_2 + f2f7_2 + f3f6_2 + f4f5_2; + + int64_t carry0; + int64_t carry1; + int64_t carry2; + int64_t carry3; + int64_t carry4; + int64_t carry5; + int64_t carry6; + int64_t carry7; + int64_t carry8; + int64_t carry9; + + h0 += h0; + h1 += h1; + h2 += h2; + h3 += h3; + h4 += h4; + h5 += h5; + h6 += h6; + h7 += h7; + h8 += h8; + h9 += h9; + + carry0 = (h0 + (int64_t)(1L << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((uint64_t) 1L << 26); + carry4 = (h4 + (int64_t)(1L << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((uint64_t) 1L << 26); + + carry1 = (h1 + (int64_t)(1L << 24)) >> 25; + h2 += carry1; + h1 -= carry1 * ((uint64_t) 1L << 25); + carry5 = (h5 + (int64_t)(1L << 24)) >> 25; + h6 += carry5; + h5 -= carry5 * ((uint64_t) 1L << 25); + + carry2 = (h2 + (int64_t)(1L << 25)) >> 26; + h3 += carry2; + h2 -= carry2 * ((uint64_t) 1L << 26); + carry6 = (h6 + (int64_t)(1L << 25)) >> 26; + h7 += carry6; + h6 -= carry6 * ((uint64_t) 1L << 26); + + carry3 = (h3 + (int64_t)(1L << 24)) >> 25; + h4 += carry3; + h3 -= carry3 * ((uint64_t) 1L << 25); + carry7 = (h7 + (int64_t)(1L << 24)) >> 25; + h8 += carry7; + h7 -= carry7 * ((uint64_t) 1L << 25); + + carry4 = (h4 + (int64_t)(1L << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((uint64_t) 1L << 26); + carry8 = (h8 + (int64_t)(1L << 25)) >> 26; + h9 += carry8; + h8 -= carry8 * ((uint64_t) 1L << 26); + + carry9 = (h9 + (int64_t)(1L << 24)) >> 25; + h0 += carry9 * 19; + h9 -= carry9 * ((uint64_t) 1L << 25); + + carry0 = (h0 + (int64_t)(1L << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((uint64_t) 1L << 26); + + h[0] = (int32_t) h0; + h[1] = (int32_t) h1; + h[2] = (int32_t) h2; + h[3] = (int32_t) h3; + h[4] = (int32_t) h4; + h[5] = (int32_t) h5; + h[6] = (int32_t) h6; + h[7] = (int32_t) h7; + h[8] = (int32_t) h8; + h[9] = (int32_t) h9; +} + +static void +fe25519_scalar_product(fe25519 h, const fe25519 f, uint32_t n) +{ + int64_t sn = (int64_t) n; + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + int64_t h0 = f0 * sn; + int64_t h1 = f1 * sn; + int64_t h2 = f2 * sn; + int64_t h3 = f3 * sn; + int64_t h4 = f4 * sn; + int64_t h5 = f5 * sn; + int64_t h6 = f6 * sn; + int64_t h7 = f7 * sn; + int64_t h8 = f8 * sn; + int64_t h9 = f9 * sn; + int64_t carry0, carry1, carry2, carry3, carry4, carry5, carry6, carry7, + carry8, carry9; + + carry9 = (h9 + ((int64_t) 1 << 24)) >> 25; + h0 += carry9 * 19; + h9 -= carry9 * ((int64_t) 1 << 25); + carry1 = (h1 + ((int64_t) 1 << 24)) >> 25; + h2 += carry1; + h1 -= carry1 * ((int64_t) 1 << 25); + carry3 = (h3 + ((int64_t) 1 << 24)) >> 25; + h4 += carry3; + h3 -= carry3 * ((int64_t) 1 << 25); + carry5 = (h5 + ((int64_t) 1 << 24)) >> 25; + h6 += carry5; + h5 -= carry5 * ((int64_t) 1 << 25); + carry7 = (h7 + ((int64_t) 1 << 24)) >> 25; + h8 += carry7; + h7 -= carry7 * ((int64_t) 1 << 25); + + carry0 = (h0 + ((int64_t) 1 << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((int64_t) 1 << 26); + carry2 = (h2 + ((int64_t) 1 << 25)) >> 26; + h3 += carry2; + h2 -= carry2 * ((int64_t) 1 << 26); + carry4 = (h4 + ((int64_t) 1 << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((int64_t) 1 << 26); + carry6 = (h6 + ((int64_t) 1 << 25)) >> 26; + h7 += carry6; + h6 -= carry6 * ((int64_t) 1 << 26); + carry8 = (h8 + ((int64_t) 1 << 25)) >> 26; + h9 += carry8; + h8 -= carry8 * ((int64_t) 1 << 26); + + h[0] = (int32_t) h0; + h[1] = (int32_t) h1; + h[2] = (int32_t) h2; + h[3] = (int32_t) h3; + h[4] = (int32_t) h4; + h[5] = (int32_t) h5; + h[6] = (int32_t) h6; + h[7] = (int32_t) h7; + h[8] = (int32_t) h8; + h[9] = (int32_t) h9; +} diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_51.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_51.h new file mode 100644 index 00000000000..3a30f30148a --- /dev/null +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_51.h @@ -0,0 +1,518 @@ +#include + +#include "private/common.h" +#include "utils.h" + +/* + h = 0 + */ + +static inline void +fe25519_0(fe25519 h) +{ + memset(&h[0], 0, 5 * sizeof h[0]); +} + +/* + h = 1 + */ + +static inline void +fe25519_1(fe25519 h) +{ + h[0] = 1; + memset(&h[1], 0, 4 * sizeof h[0]); +} + +/* + h = f + g + Can overlap h with f or g. + */ + +static inline void +fe25519_add(fe25519 h, const fe25519 f, const fe25519 g) +{ + uint64_t h0 = f[0] + g[0]; + uint64_t h1 = f[1] + g[1]; + uint64_t h2 = f[2] + g[2]; + uint64_t h3 = f[3] + g[3]; + uint64_t h4 = f[4] + g[4]; + + h[0] = h0; + h[1] = h1; + h[2] = h2; + h[3] = h3; + h[4] = h4; +} + +/* + h = f - g + */ + +static void +fe25519_sub(fe25519 h, const fe25519 f, const fe25519 g) +{ + const uint64_t mask = 0x7ffffffffffffULL; + uint64_t h0, h1, h2, h3, h4; + + h0 = g[0]; + h1 = g[1]; + h2 = g[2]; + h3 = g[3]; + h4 = g[4]; + + h1 += h0 >> 51; + h0 &= mask; + h2 += h1 >> 51; + h1 &= mask; + h3 += h2 >> 51; + h2 &= mask; + h4 += h3 >> 51; + h3 &= mask; + h0 += 19ULL * (h4 >> 51); + h4 &= mask; + + h0 = (f[0] + 0xfffffffffffdaULL) - h0; + h1 = (f[1] + 0xffffffffffffeULL) - h1; + h2 = (f[2] + 0xffffffffffffeULL) - h2; + h3 = (f[3] + 0xffffffffffffeULL) - h3; + h4 = (f[4] + 0xffffffffffffeULL) - h4; + + h[0] = h0; + h[1] = h1; + h[2] = h2; + h[3] = h3; + h[4] = h4; +} + +/* + h = -f + */ + +static inline void +fe25519_neg(fe25519 h, const fe25519 f) +{ + fe25519 zero; + + fe25519_0(zero); + fe25519_sub(h, zero, f); +} + +/* + Replace (f,g) with (g,g) if b == 1; + replace (f,g) with (f,g) if b == 0. + * + Preconditions: b in {0,1}. + */ + +static void +fe25519_cmov(fe25519 f, const fe25519 g, unsigned int b) +{ + const uint64_t mask = (uint64_t) (-(int64_t) b); + + uint64_t f0 = f[0]; + uint64_t f1 = f[1]; + uint64_t f2 = f[2]; + uint64_t f3 = f[3]; + uint64_t f4 = f[4]; + + uint64_t x0 = f0 ^ g[0]; + uint64_t x1 = f1 ^ g[1]; + uint64_t x2 = f2 ^ g[2]; + uint64_t x3 = f3 ^ g[3]; + uint64_t x4 = f4 ^ g[4]; + + x0 &= mask; + x1 &= mask; + x2 &= mask; + x3 &= mask; + x4 &= mask; + + f[0] = f0 ^ x0; + f[1] = f1 ^ x1; + f[2] = f2 ^ x2; + f[3] = f3 ^ x3; + f[4] = f4 ^ x4; +} + +/* +Replace (f,g) with (g,f) if b == 1; +replace (f,g) with (f,g) if b == 0. + +Preconditions: b in {0,1}. +*/ + +static void +fe25519_cswap(fe25519 f, fe25519 g, unsigned int b) +{ + const uint64_t mask = (uint64_t) (-(int64_t) b); + + uint64_t f0 = f[0]; + uint64_t f1 = f[1]; + uint64_t f2 = f[2]; + uint64_t f3 = f[3]; + uint64_t f4 = f[4]; + + uint64_t g0 = g[0]; + uint64_t g1 = g[1]; + uint64_t g2 = g[2]; + uint64_t g3 = g[3]; + uint64_t g4 = g[4]; + + uint64_t x0 = f0 ^ g0; + uint64_t x1 = f1 ^ g1; + uint64_t x2 = f2 ^ g2; + uint64_t x3 = f3 ^ g3; + uint64_t x4 = f4 ^ g4; + + x0 &= mask; + x1 &= mask; + x2 &= mask; + x3 &= mask; + x4 &= mask; + + f[0] = f0 ^ x0; + f[1] = f1 ^ x1; + f[2] = f2 ^ x2; + f[3] = f3 ^ x3; + f[4] = f4 ^ x4; + + g[0] = g0 ^ x0; + g[1] = g1 ^ x1; + g[2] = g2 ^ x2; + g[3] = g3 ^ x3; + g[4] = g4 ^ x4; +} + +/* + h = f + */ + +static inline void +fe25519_copy(fe25519 h, const fe25519 f) +{ + uint64_t f0 = f[0]; + uint64_t f1 = f[1]; + uint64_t f2 = f[2]; + uint64_t f3 = f[3]; + uint64_t f4 = f[4]; + + h[0] = f0; + h[1] = f1; + h[2] = f2; + h[3] = f3; + h[4] = f4; +} + +/* + return 1 if f is in {1,3,5,...,q-2} + return 0 if f is in {0,2,4,...,q-1} + */ + +static inline int +fe25519_isnegative(const fe25519 f) +{ + unsigned char s[32]; + + fe25519_tobytes(s, f); + + return s[0] & 1; +} + +/* + return 1 if f == 0 + return 0 if f != 0 + */ + +static inline int +fe25519_iszero(const fe25519 f) +{ + unsigned char s[32]; + + fe25519_tobytes(s, f); + + return sodium_is_zero(s, 32); +} + +/* + h = f * g + Can overlap h with f or g. + */ + +static void +fe25519_mul(fe25519 h, const fe25519 f, const fe25519 g) +{ + const uint64_t mask = 0x7ffffffffffffULL; + uint128_t r0, r1, r2, r3, r4, carry; + uint64_t f0, f1, f2, f3, f4; + uint64_t f1_19, f2_19, f3_19, f4_19; + uint64_t g0, g1, g2, g3, g4; + uint64_t r00, r01, r02, r03, r04; + + f0 = f[0]; + f1 = f[1]; + f2 = f[2]; + f3 = f[3]; + f4 = f[4]; + + g0 = g[0]; + g1 = g[1]; + g2 = g[2]; + g3 = g[3]; + g4 = g[4]; + + f1_19 = 19ULL * f1; + f2_19 = 19ULL * f2; + f3_19 = 19ULL * f3; + f4_19 = 19ULL * f4; + + r0 = ((uint128_t) f0 ) * ((uint128_t) g0); + r0 += ((uint128_t) f1_19) * ((uint128_t) g4); + r0 += ((uint128_t) f2_19) * ((uint128_t) g3); + r0 += ((uint128_t) f3_19) * ((uint128_t) g2); + r0 += ((uint128_t) f4_19) * ((uint128_t) g1); + + r1 = ((uint128_t) f0 ) * ((uint128_t) g1); + r1 += ((uint128_t) f1 ) * ((uint128_t) g0); + r1 += ((uint128_t) f2_19) * ((uint128_t) g4); + r1 += ((uint128_t) f3_19) * ((uint128_t) g3); + r1 += ((uint128_t) f4_19) * ((uint128_t) g2); + + r2 = ((uint128_t) f0 ) * ((uint128_t) g2); + r2 += ((uint128_t) f1 ) * ((uint128_t) g1); + r2 += ((uint128_t) f2 ) * ((uint128_t) g0); + r2 += ((uint128_t) f3_19) * ((uint128_t) g4); + r2 += ((uint128_t) f4_19) * ((uint128_t) g3); + + r3 = ((uint128_t) f0 ) * ((uint128_t) g3); + r3 += ((uint128_t) f1 ) * ((uint128_t) g2); + r3 += ((uint128_t) f2 ) * ((uint128_t) g1); + r3 += ((uint128_t) f3 ) * ((uint128_t) g0); + r3 += ((uint128_t) f4_19) * ((uint128_t) g4); + + r4 = ((uint128_t) f0 ) * ((uint128_t) g4); + r4 += ((uint128_t) f1 ) * ((uint128_t) g3); + r4 += ((uint128_t) f2 ) * ((uint128_t) g2); + r4 += ((uint128_t) f3 ) * ((uint128_t) g1); + r4 += ((uint128_t) f4 ) * ((uint128_t) g0); + + r00 = ((uint64_t) r0) & mask; + carry = r0 >> 51; + r1 += carry; + r01 = ((uint64_t) r1) & mask; + carry = r1 >> 51; + r2 += carry; + r02 = ((uint64_t) r2) & mask; + carry = r2 >> 51; + r3 += carry; + r03 = ((uint64_t) r3) & mask; + carry = r3 >> 51; + r4 += carry; + r04 = ((uint64_t) r4) & mask; + carry = r4 >> 51; + r00 += 19ULL * (uint64_t) carry; + carry = r00 >> 51; + r00 &= mask; + r01 += (uint64_t) carry; + carry = r01 >> 51; + r01 &= mask; + r02 += (uint64_t) carry; + + h[0] = r00; + h[1] = r01; + h[2] = r02; + h[3] = r03; + h[4] = r04; +} + +/* + h = f * f + Can overlap h with f. + */ + +static void +fe25519_sq(fe25519 h, const fe25519 f) +{ + const uint64_t mask = 0x7ffffffffffffULL; + uint128_t r0, r1, r2, r3, r4, carry; + uint64_t f0, f1, f2, f3, f4; + uint64_t f0_2, f1_2, f1_38, f2_38, f3_38, f3_19, f4_19; + uint64_t r00, r01, r02, r03, r04; + + f0 = f[0]; + f1 = f[1]; + f2 = f[2]; + f3 = f[3]; + f4 = f[4]; + + f0_2 = f0 << 1; + f1_2 = f1 << 1; + + f1_38 = 38ULL * f1; + f2_38 = 38ULL * f2; + f3_38 = 38ULL * f3; + + f3_19 = 19ULL * f3; + f4_19 = 19ULL * f4; + + r0 = ((uint128_t) f0 ) * ((uint128_t) f0); + r0 += ((uint128_t) f1_38) * ((uint128_t) f4); + r0 += ((uint128_t) f2_38) * ((uint128_t) f3); + + r1 = ((uint128_t) f0_2 ) * ((uint128_t) f1); + r1 += ((uint128_t) f2_38) * ((uint128_t) f4); + r1 += ((uint128_t) f3_19) * ((uint128_t) f3); + + r2 = ((uint128_t) f0_2 ) * ((uint128_t) f2); + r2 += ((uint128_t) f1 ) * ((uint128_t) f1); + r2 += ((uint128_t) f3_38) * ((uint128_t) f4); + + r3 = ((uint128_t) f0_2 ) * ((uint128_t) f3); + r3 += ((uint128_t) f1_2 ) * ((uint128_t) f2); + r3 += ((uint128_t) f4_19) * ((uint128_t) f4); + + r4 = ((uint128_t) f0_2 ) * ((uint128_t) f4); + r4 += ((uint128_t) f1_2 ) * ((uint128_t) f3); + r4 += ((uint128_t) f2 ) * ((uint128_t) f2); + + r00 = ((uint64_t) r0) & mask; + carry = r0 >> 51; + r1 += carry; + r01 = ((uint64_t) r1) & mask; + carry = r1 >> 51; + r2 += carry; + r02 = ((uint64_t) r2) & mask; + carry = r2 >> 51; + r3 += carry; + r03 = ((uint64_t) r3) & mask; + carry = r3 >> 51; + r4 += carry; + r04 = ((uint64_t) r4) & mask; + carry = r4 >> 51; + r00 += 19ULL * (uint64_t) carry; + carry = r00 >> 51; + r00 &= mask; + r01 += (uint64_t) carry; + carry = r01 >> 51; + r01 &= mask; + r02 += (uint64_t) carry; + + h[0] = r00; + h[1] = r01; + h[2] = r02; + h[3] = r03; + h[4] = r04; +} + +/* + h = 2 * f * f + Can overlap h with f. +*/ + +static void +fe25519_sq2(fe25519 h, const fe25519 f) +{ + const uint64_t mask = 0x7ffffffffffffULL; + uint128_t r0, r1, r2, r3, r4, carry; + uint64_t f0, f1, f2, f3, f4; + uint64_t f0_2, f1_2, f1_38, f2_38, f3_38, f3_19, f4_19; + uint64_t r00, r01, r02, r03, r04; + + f0 = f[0]; + f1 = f[1]; + f2 = f[2]; + f3 = f[3]; + f4 = f[4]; + + f0_2 = f0 << 1; + f1_2 = f1 << 1; + + f1_38 = 38ULL * f1; + f2_38 = 38ULL * f2; + f3_38 = 38ULL * f3; + + f3_19 = 19ULL * f3; + f4_19 = 19ULL * f4; + + r0 = ((uint128_t) f0 ) * ((uint128_t) f0); + r0 += ((uint128_t) f1_38) * ((uint128_t) f4); + r0 += ((uint128_t) f2_38) * ((uint128_t) f3); + + r1 = ((uint128_t) f0_2 ) * ((uint128_t) f1); + r1 += ((uint128_t) f2_38) * ((uint128_t) f4); + r1 += ((uint128_t) f3_19) * ((uint128_t) f3); + + r2 = ((uint128_t) f0_2 ) * ((uint128_t) f2); + r2 += ((uint128_t) f1 ) * ((uint128_t) f1); + r2 += ((uint128_t) f3_38) * ((uint128_t) f4); + + r3 = ((uint128_t) f0_2 ) * ((uint128_t) f3); + r3 += ((uint128_t) f1_2 ) * ((uint128_t) f2); + r3 += ((uint128_t) f4_19) * ((uint128_t) f4); + + r4 = ((uint128_t) f0_2 ) * ((uint128_t) f4); + r4 += ((uint128_t) f1_2 ) * ((uint128_t) f3); + r4 += ((uint128_t) f2 ) * ((uint128_t) f2); + + r0 <<= 1; + r1 <<= 1; + r2 <<= 1; + r3 <<= 1; + r4 <<= 1; + + r00 = ((uint64_t) r0) & mask; + carry = r0 >> 51; + r1 += carry; + r01 = ((uint64_t) r1) & mask; + carry = r1 >> 51; + r2 += carry; + r02 = ((uint64_t) r2) & mask; + carry = r2 >> 51; + r3 += carry; + r03 = ((uint64_t) r3) & mask; + carry = r3 >> 51; + r4 += carry; + r04 = ((uint64_t) r4) & mask; + carry = r4 >> 51; + r00 += 19ULL * (uint64_t) carry; + carry = r00 >> 51; + r00 &= mask; + r01 += (uint64_t) carry; + carry = r01 >> 51; + r01 &= mask; + r02 += (uint64_t) carry; + + h[0] = r00; + h[1] = r01; + h[2] = r02; + h[3] = r03; + h[4] = r04; +} + +static void +fe25519_scalar_product(fe25519 h, const fe25519 f, uint32_t n) +{ + const uint64_t mask = 0x7ffffffffffffULL; + uint128_t a; + uint128_t sn = (uint128_t) n; + uint64_t h0, h1, h2, h3, h4; + + a = f[0] * sn; + h0 = ((uint64_t) a) & mask; + a = f[1] * sn + ((uint64_t) (a >> 51)); + h1 = ((uint64_t) a) & mask; + a = f[2] * sn + ((uint64_t) (a >> 51)); + h2 = ((uint64_t) a) & mask; + a = f[3] * sn + ((uint64_t) (a >> 51)); + h3 = ((uint64_t) a) & mask; + a = f[4] * sn + ((uint64_t) (a >> 51)); + h4 = ((uint64_t) a) & mask; + + h0 += (a >> 51) * 19ULL; + + h[0] = h0; + h[1] = h1; + h[2] = h2; + h[3] = h3; + h[4] = h4; +} diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/implementations.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/implementations.h new file mode 100644 index 00000000000..c7237f851de --- /dev/null +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/private/implementations.h @@ -0,0 +1,11 @@ +#ifndef implementations_H +#define implementations_H + +int _crypto_generichash_blake2b_pick_best_implementation(void); +int _crypto_onetimeauth_poly1305_pick_best_implementation(void); +int _crypto_pwhash_argon2_pick_best_implementation(void); +int _crypto_scalarmult_curve25519_pick_best_implementation(void); +int _crypto_stream_chacha20_pick_best_implementation(void); +int _crypto_stream_salsa20_pick_best_implementation(void); + +#endif diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes.h index d112fb293e5..a03cc657204 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes.h @@ -25,16 +25,20 @@ typedef struct randombytes_implementation { int (*close)(void); /* optional */ } randombytes_implementation; +#define randombytes_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 0xffffffffUL) + #define randombytes_SEEDBYTES 32U SODIUM_EXPORT size_t randombytes_seedbytes(void); SODIUM_EXPORT -void randombytes_buf(void * const buf, const size_t size); +void randombytes_buf(void * const buf, const size_t size) + __attribute__ ((nonnull)); SODIUM_EXPORT void randombytes_buf_deterministic(void * const buf, const size_t size, - const unsigned char seed[randombytes_SEEDBYTES]); + const unsigned char seed[randombytes_SEEDBYTES]) + __attribute__ ((nonnull)); SODIUM_EXPORT uint32_t randombytes_random(void); @@ -49,7 +53,8 @@ SODIUM_EXPORT int randombytes_close(void); SODIUM_EXPORT -int randombytes_set_implementation(randombytes_implementation *impl); +int randombytes_set_implementation(randombytes_implementation *impl) + __attribute__ ((nonnull)); SODIUM_EXPORT const char *randombytes_implementation_name(void); @@ -57,7 +62,8 @@ const char *randombytes_implementation_name(void); /* -- NaCl compatibility interface -- */ SODIUM_EXPORT -void randombytes(unsigned char * const buf, const unsigned long long buf_len); +void randombytes(unsigned char * const buf, const unsigned long long buf_len) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_internal_random.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_internal_random.h new file mode 100644 index 00000000000..2b2b7d6edc1 --- /dev/null +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_internal_random.h @@ -0,0 +1,22 @@ + +#ifndef randombytes_internal_random_H +#define randombytes_internal_random_H + +#include "export.h" +#include "randombytes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +SODIUM_EXPORT +extern struct randombytes_implementation randombytes_internal_implementation; + +/* Backwards compatibility with libsodium < 1.0.18 */ +#define randombytes_salsa20_implementation randombytes_internal_implementation + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_nativeclient.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_nativeclient.h deleted file mode 100644 index 5158d8c3c33..00000000000 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_nativeclient.h +++ /dev/null @@ -1,23 +0,0 @@ - -#ifndef randombytes_nativeclient_H -#define randombytes_nativeclient_H - -#ifdef __native_client__ - -# include "export.h" -# include "randombytes.h" - -# ifdef __cplusplus -extern "C" { -# endif - -SODIUM_EXPORT -extern struct randombytes_implementation randombytes_nativeclient_implementation; - -# ifdef __cplusplus -} -# endif - -#endif - -#endif diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h deleted file mode 100644 index 4deae15b6d9..00000000000 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h +++ /dev/null @@ -1,19 +0,0 @@ - -#ifndef randombytes_salsa20_random_H -#define randombytes_salsa20_random_H - -#include "export.h" -#include "randombytes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -SODIUM_EXPORT -extern struct randombytes_implementation randombytes_salsa20_implementation; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/runtime.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/runtime.h index 76859ea0e13..7f15d58e7c5 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/runtime.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/runtime.h @@ -8,33 +8,39 @@ extern "C" { #endif -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_neon(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_sse2(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_sse3(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_ssse3(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_sse41(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_avx(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_avx2(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK +int sodium_runtime_has_avx512f(void); + +SODIUM_EXPORT_WEAK int sodium_runtime_has_pclmul(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_aesni(void); +SODIUM_EXPORT_WEAK +int sodium_runtime_has_rdrand(void); + /* ------------------------------------------------------------------------- */ int _sodium_runtime_get_cpu_features(void); diff --git a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/utils.h b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/utils.h index 0a7aadb434c..ac801512919 100644 --- a/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/utils.h +++ b/tools/sdk/esp32c3/include/libsodium/libsodium/src/libsodium/include/sodium/utils.h @@ -21,6 +21,9 @@ extern "C" { SODIUM_EXPORT void sodium_memzero(void * const pnt, const size_t len); +SODIUM_EXPORT +void sodium_stackzero(const size_t len); + /* * WARNING: sodium_memcmp() must be used to verify if two secret keys * are equal, in constant time. @@ -39,8 +42,7 @@ int sodium_memcmp(const void * const b1_, const void * const b2_, size_t len) */ SODIUM_EXPORT int sodium_compare(const unsigned char *b1_, const unsigned char *b2_, - size_t len) - __attribute__ ((warn_unused_result)); + size_t len) __attribute__ ((warn_unused_result)); SODIUM_EXPORT int sodium_is_zero(const unsigned char *n, const size_t nlen); @@ -51,21 +53,57 @@ void sodium_increment(unsigned char *n, const size_t nlen); SODIUM_EXPORT void sodium_add(unsigned char *a, const unsigned char *b, const size_t len); +SODIUM_EXPORT +void sodium_sub(unsigned char *a, const unsigned char *b, const size_t len); + SODIUM_EXPORT char *sodium_bin2hex(char * const hex, const size_t hex_maxlen, - const unsigned char * const bin, const size_t bin_len); + const unsigned char * const bin, const size_t bin_len) + __attribute__ ((nonnull(1))); SODIUM_EXPORT int sodium_hex2bin(unsigned char * const bin, const size_t bin_maxlen, const char * const hex, const size_t hex_len, const char * const ignore, size_t * const bin_len, - const char ** const hex_end); + const char ** const hex_end) + __attribute__ ((nonnull(1))); + +#define sodium_base64_VARIANT_ORIGINAL 1 +#define sodium_base64_VARIANT_ORIGINAL_NO_PADDING 3 +#define sodium_base64_VARIANT_URLSAFE 5 +#define sodium_base64_VARIANT_URLSAFE_NO_PADDING 7 + +/* + * Computes the required length to encode BIN_LEN bytes as a base64 string + * using the given variant. The computed length includes a trailing \0. + */ +#define sodium_base64_ENCODED_LEN(BIN_LEN, VARIANT) \ + (((BIN_LEN) / 3U) * 4U + \ + ((((BIN_LEN) - ((BIN_LEN) / 3U) * 3U) | (((BIN_LEN) - ((BIN_LEN) / 3U) * 3U) >> 1)) & 1U) * \ + (4U - (~((((VARIANT) & 2U) >> 1) - 1U) & (3U - ((BIN_LEN) - ((BIN_LEN) / 3U) * 3U)))) + 1U) SODIUM_EXPORT -int sodium_mlock(void * const addr, const size_t len); +size_t sodium_base64_encoded_len(const size_t bin_len, const int variant); SODIUM_EXPORT -int sodium_munlock(void * const addr, const size_t len); +char *sodium_bin2base64(char * const b64, const size_t b64_maxlen, + const unsigned char * const bin, const size_t bin_len, + const int variant) __attribute__ ((nonnull(1))); + +SODIUM_EXPORT +int sodium_base642bin(unsigned char * const bin, const size_t bin_maxlen, + const char * const b64, const size_t b64_len, + const char * const ignore, size_t * const bin_len, + const char ** const b64_end, const int variant) + __attribute__ ((nonnull(1))); + +SODIUM_EXPORT +int sodium_mlock(void * const addr, const size_t len) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +int sodium_munlock(void * const addr, const size_t len) + __attribute__ ((nonnull)); /* WARNING: sodium_malloc() and sodium_allocarray() are not general-purpose * allocation functions. @@ -112,13 +150,23 @@ SODIUM_EXPORT void sodium_free(void *ptr); SODIUM_EXPORT -int sodium_mprotect_noaccess(void *ptr); +int sodium_mprotect_noaccess(void *ptr) __attribute__ ((nonnull)); + +SODIUM_EXPORT +int sodium_mprotect_readonly(void *ptr) __attribute__ ((nonnull)); + +SODIUM_EXPORT +int sodium_mprotect_readwrite(void *ptr) __attribute__ ((nonnull)); SODIUM_EXPORT -int sodium_mprotect_readonly(void *ptr); +int sodium_pad(size_t *padded_buflen_p, unsigned char *buf, + size_t unpadded_buflen, size_t blocksize, size_t max_buflen) + __attribute__ ((nonnull(2))); SODIUM_EXPORT -int sodium_mprotect_readwrite(void *ptr); +int sodium_unpad(size_t *unpadded_buflen_p, const unsigned char *buf, + size_t padded_buflen, size_t blocksize) + __attribute__ ((nonnull(2))); /* -------- */ diff --git a/tools/sdk/esp32c3/include/lwip/port/esp32/include/lwipopts.h b/tools/sdk/esp32c3/include/lwip/port/esp32/include/lwipopts.h index 442bf0e98e2..52d2d99de4f 100644 --- a/tools/sdk/esp32c3/include/lwip/port/esp32/include/lwipopts.h +++ b/tools/sdk/esp32c3/include/lwip/port/esp32/include/lwipopts.h @@ -745,16 +745,17 @@ --------- LCP Echo options --------- ------------------------------------ */ +#if CONFIG_LWIP_ENABLE_LCP_ECHO /** * LCP_ECHOINTERVAL: Interval in seconds between keepalive LCP echo requests, 0 to disable. */ -#define LCP_ECHOINTERVAL CONFIG_LCP_ECHOINTERVAL +#define LCP_ECHOINTERVAL CONFIG_LWIP_LCP_ECHOINTERVAL /** * LCP_MAXECHOFAILS: Number of consecutive unanswered echo requests before failure is indicated. */ -#define LCP_MAXECHOFAILS CONFIG_LCP_MAXECHOFAILS - +#define LCP_MAXECHOFAILS CONFIG_LWIP_LCP_MAXECHOFAILS +#endif /* CONFIG_LWIP_ENABLE_LCP_ECHO */ /* -------------------------------------- @@ -1013,7 +1014,11 @@ /** * LWIP_DEBUG: Enable lwip debugging in other modules. */ -#define LWIP_DEBUG LWIP_DBG_OFF +#ifdef CONFIG_LWIP_DEBUG +#define LWIP_DEBUG LWIP_DBG_ON +#else +#undef LWIP_DEBUG +#endif #define CHECKSUM_CHECK_UDP CONFIG_LWIP_CHECKSUM_CHECK_UDP #define CHECKSUM_CHECK_IP CONFIG_LWIP_CHECKSUM_CHECK_IP diff --git a/tools/sdk/esp32c3/include/soc/esp32c3/include/soc/gpio_caps.h b/tools/sdk/esp32c3/include/soc/esp32c3/include/soc/gpio_caps.h index 770b7b2ad19..8da8d2194a9 100644 --- a/tools/sdk/esp32c3/include/soc/esp32c3/include/soc/gpio_caps.h +++ b/tools/sdk/esp32c3/include/soc/esp32c3/include/soc/gpio_caps.h @@ -30,11 +30,6 @@ extern "C" { // GPIO0~5 on ESP32C3 can support chip deep sleep wakeup #define SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP (1) -#define GPIO_MODE_DEF_DISABLE (0) -#define GPIO_MODE_DEF_INPUT (BIT0) -#define GPIO_MODE_DEF_OUTPUT (BIT1) -#define GPIO_MODE_DEF_OD (BIT2) - #define SOC_GPIO_VALID_GPIO_MASK ((1U< iram0_0_seg diff --git a/tools/sdk/esp32c3/ld/esp32c3_out.ld b/tools/sdk/esp32c3/ld/esp32c3_out.ld index 8b77cbc96b8..8d490333e88 100644 --- a/tools/sdk/esp32c3/ld/esp32c3_out.ld +++ b/tools/sdk/esp32c3/ld/esp32c3_out.ld @@ -40,7 +40,7 @@ MEMORY /** * RTC fast memory (executable). Persists over deep sleep. */ - rtc_iram_seg(RWX) : org = 0x50000000, len = 0x2000 + rtc_iram_seg(RWX) : org = 0x50000000, len = 0x2000 - 0 } _static_data_end = _bss_end; /* Heap ends at top of dram0_0_seg */ diff --git a/tools/sdk/esp32c3/lib/libapp_trace.a b/tools/sdk/esp32c3/lib/libapp_trace.a index ce25545ba96..9661e501c7d 100644 Binary files a/tools/sdk/esp32c3/lib/libapp_trace.a and b/tools/sdk/esp32c3/lib/libapp_trace.a differ diff --git a/tools/sdk/esp32c3/lib/libapp_update.a b/tools/sdk/esp32c3/lib/libapp_update.a index 56a91f31a9c..4d1e608e519 100644 Binary files a/tools/sdk/esp32c3/lib/libapp_update.a and b/tools/sdk/esp32c3/lib/libapp_update.a differ diff --git a/tools/sdk/esp32c3/lib/libasio.a b/tools/sdk/esp32c3/lib/libasio.a index 4fd88a653ea..93790dcceb7 100644 Binary files a/tools/sdk/esp32c3/lib/libasio.a and b/tools/sdk/esp32c3/lib/libasio.a differ diff --git a/tools/sdk/esp32c3/lib/libbootloader_support.a b/tools/sdk/esp32c3/lib/libbootloader_support.a index a8fe5e3b11b..dba9e4b7f77 100644 Binary files a/tools/sdk/esp32c3/lib/libbootloader_support.a and b/tools/sdk/esp32c3/lib/libbootloader_support.a differ diff --git a/tools/sdk/esp32c3/lib/libbt.a b/tools/sdk/esp32c3/lib/libbt.a index 6680f5b0533..784effb2df5 100644 Binary files a/tools/sdk/esp32c3/lib/libbt.a and b/tools/sdk/esp32c3/lib/libbt.a differ diff --git a/tools/sdk/esp32c3/lib/libcbor.a b/tools/sdk/esp32c3/lib/libcbor.a index f36e302be33..a360e67e163 100644 Binary files a/tools/sdk/esp32c3/lib/libcbor.a and b/tools/sdk/esp32c3/lib/libcbor.a differ diff --git a/tools/sdk/esp32c3/lib/libcmock.a b/tools/sdk/esp32c3/lib/libcmock.a index cb586fc9aa8..182c8a2f178 100644 Binary files a/tools/sdk/esp32c3/lib/libcmock.a and b/tools/sdk/esp32c3/lib/libcmock.a differ diff --git a/tools/sdk/esp32c3/lib/libcoap.a b/tools/sdk/esp32c3/lib/libcoap.a index fc58b6647a0..d603df02828 100644 Binary files a/tools/sdk/esp32c3/lib/libcoap.a and b/tools/sdk/esp32c3/lib/libcoap.a differ diff --git a/tools/sdk/esp32c3/lib/libcoexist.a b/tools/sdk/esp32c3/lib/libcoexist.a index 1bf5a58b2cd..4e21b1297c4 100644 Binary files a/tools/sdk/esp32c3/lib/libcoexist.a and b/tools/sdk/esp32c3/lib/libcoexist.a differ diff --git a/tools/sdk/esp32c3/lib/libconsole.a b/tools/sdk/esp32c3/lib/libconsole.a index 3e605f7d038..7e341a65185 100644 Binary files a/tools/sdk/esp32c3/lib/libconsole.a and b/tools/sdk/esp32c3/lib/libconsole.a differ diff --git a/tools/sdk/esp32c3/lib/libcore.a b/tools/sdk/esp32c3/lib/libcore.a index 8e9b3a1d553..67f5741cbf4 100644 Binary files a/tools/sdk/esp32c3/lib/libcore.a and b/tools/sdk/esp32c3/lib/libcore.a differ diff --git a/tools/sdk/esp32c3/lib/libcxx.a b/tools/sdk/esp32c3/lib/libcxx.a index ddecc39d4b5..bd18e014a42 100644 Binary files a/tools/sdk/esp32c3/lib/libcxx.a and b/tools/sdk/esp32c3/lib/libcxx.a differ diff --git a/tools/sdk/esp32c3/lib/libdriver.a b/tools/sdk/esp32c3/lib/libdriver.a index a0354a52cd7..67d17ff6e10 100644 Binary files a/tools/sdk/esp32c3/lib/libdriver.a and b/tools/sdk/esp32c3/lib/libdriver.a differ diff --git a/tools/sdk/esp32c3/lib/libefuse.a b/tools/sdk/esp32c3/lib/libefuse.a index 35d8a8330eb..51ffd467421 100644 Binary files a/tools/sdk/esp32c3/lib/libefuse.a and b/tools/sdk/esp32c3/lib/libefuse.a differ diff --git a/tools/sdk/esp32c3/lib/libesp-tls.a b/tools/sdk/esp32c3/lib/libesp-tls.a index eb77917e058..cebb8aa3c2f 100644 Binary files a/tools/sdk/esp32c3/lib/libesp-tls.a and b/tools/sdk/esp32c3/lib/libesp-tls.a differ diff --git a/tools/sdk/esp32c3/lib/libesp32c3.a b/tools/sdk/esp32c3/lib/libesp32c3.a index 00931442865..ec18a7613b0 100644 Binary files a/tools/sdk/esp32c3/lib/libesp32c3.a and b/tools/sdk/esp32c3/lib/libesp32c3.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_adc_cal.a b/tools/sdk/esp32c3/lib/libesp_adc_cal.a index 0f842583d01..e5464f28a80 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_adc_cal.a and b/tools/sdk/esp32c3/lib/libesp_adc_cal.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_common.a b/tools/sdk/esp32c3/lib/libesp_common.a index e505dc9902f..183ea904752 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_common.a and b/tools/sdk/esp32c3/lib/libesp_common.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_eth.a b/tools/sdk/esp32c3/lib/libesp_eth.a index 549a1d66544..eb635bd9416 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_eth.a and b/tools/sdk/esp32c3/lib/libesp_eth.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_event.a b/tools/sdk/esp32c3/lib/libesp_event.a index 8a390de6920..a1eebaec485 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_event.a and b/tools/sdk/esp32c3/lib/libesp_event.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_gdbstub.a b/tools/sdk/esp32c3/lib/libesp_gdbstub.a index 93b1ec8f5fc..2edbcb31cf5 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_gdbstub.a and b/tools/sdk/esp32c3/lib/libesp_gdbstub.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_hid.a b/tools/sdk/esp32c3/lib/libesp_hid.a index d29154aa379..b118b1b41f6 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_hid.a and b/tools/sdk/esp32c3/lib/libesp_hid.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_http_client.a b/tools/sdk/esp32c3/lib/libesp_http_client.a index bdf496e2b00..5e50a449816 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_http_client.a and b/tools/sdk/esp32c3/lib/libesp_http_client.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_http_server.a b/tools/sdk/esp32c3/lib/libesp_http_server.a index 3704b73d11e..352a303d191 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_http_server.a and b/tools/sdk/esp32c3/lib/libesp_http_server.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_https_ota.a b/tools/sdk/esp32c3/lib/libesp_https_ota.a index 825ae9cca92..49837aff053 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_https_ota.a and b/tools/sdk/esp32c3/lib/libesp_https_ota.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_https_server.a b/tools/sdk/esp32c3/lib/libesp_https_server.a index 5c8363974a9..09bded7b4af 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_https_server.a and b/tools/sdk/esp32c3/lib/libesp_https_server.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_hw_support.a b/tools/sdk/esp32c3/lib/libesp_hw_support.a index 1e0ff107d2b..029d8582ca9 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_hw_support.a and b/tools/sdk/esp32c3/lib/libesp_hw_support.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_ipc.a b/tools/sdk/esp32c3/lib/libesp_ipc.a index 25f48654659..a4cbae140d3 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_ipc.a and b/tools/sdk/esp32c3/lib/libesp_ipc.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_littlefs.a b/tools/sdk/esp32c3/lib/libesp_littlefs.a index 7e1a247c9bf..8dc93130089 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_littlefs.a and b/tools/sdk/esp32c3/lib/libesp_littlefs.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_local_ctrl.a b/tools/sdk/esp32c3/lib/libesp_local_ctrl.a index ceae206e2d5..a5777e3ed38 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_local_ctrl.a and b/tools/sdk/esp32c3/lib/libesp_local_ctrl.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_netif.a b/tools/sdk/esp32c3/lib/libesp_netif.a index eff0fc66845..e69c2ee035c 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_netif.a and b/tools/sdk/esp32c3/lib/libesp_netif.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_pm.a b/tools/sdk/esp32c3/lib/libesp_pm.a index 8cd29aa6065..99b64e3d48c 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_pm.a and b/tools/sdk/esp32c3/lib/libesp_pm.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_ringbuf.a b/tools/sdk/esp32c3/lib/libesp_ringbuf.a index 997fe499da1..f18ae367c44 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_ringbuf.a and b/tools/sdk/esp32c3/lib/libesp_ringbuf.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_rom.a b/tools/sdk/esp32c3/lib/libesp_rom.a index 2ab209e27ab..2e27e974110 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_rom.a and b/tools/sdk/esp32c3/lib/libesp_rom.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_serial_slave_link.a b/tools/sdk/esp32c3/lib/libesp_serial_slave_link.a index 18839696018..9803da44cd7 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_serial_slave_link.a and b/tools/sdk/esp32c3/lib/libesp_serial_slave_link.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_system.a b/tools/sdk/esp32c3/lib/libesp_system.a index c8724b83c8a..083dec030e5 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_system.a and b/tools/sdk/esp32c3/lib/libesp_system.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_timer.a b/tools/sdk/esp32c3/lib/libesp_timer.a index e8cce6e9090..c8fe62ed495 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_timer.a and b/tools/sdk/esp32c3/lib/libesp_timer.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_websocket_client.a b/tools/sdk/esp32c3/lib/libesp_websocket_client.a index 86674ba32df..032a825cfc5 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_websocket_client.a and b/tools/sdk/esp32c3/lib/libesp_websocket_client.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_wifi.a b/tools/sdk/esp32c3/lib/libesp_wifi.a index 3225ae138e8..830f011469a 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_wifi.a and b/tools/sdk/esp32c3/lib/libesp_wifi.a differ diff --git a/tools/sdk/esp32c3/lib/libespcoredump.a b/tools/sdk/esp32c3/lib/libespcoredump.a index ab67be9a4cd..e59e5d434c8 100644 Binary files a/tools/sdk/esp32c3/lib/libespcoredump.a and b/tools/sdk/esp32c3/lib/libespcoredump.a differ diff --git a/tools/sdk/esp32c3/lib/libespnow.a b/tools/sdk/esp32c3/lib/libespnow.a index f0141fd93ff..65294491630 100644 Binary files a/tools/sdk/esp32c3/lib/libespnow.a and b/tools/sdk/esp32c3/lib/libespnow.a differ diff --git a/tools/sdk/esp32c3/lib/libexpat.a b/tools/sdk/esp32c3/lib/libexpat.a index 029e1d74b72..0dc0db5f43a 100644 Binary files a/tools/sdk/esp32c3/lib/libexpat.a and b/tools/sdk/esp32c3/lib/libexpat.a differ diff --git a/tools/sdk/esp32c3/lib/libfatfs.a b/tools/sdk/esp32c3/lib/libfatfs.a index 6f8979a47c8..b7daa6be316 100644 Binary files a/tools/sdk/esp32c3/lib/libfatfs.a and b/tools/sdk/esp32c3/lib/libfatfs.a differ diff --git a/tools/sdk/esp32c3/lib/libfb_gfx.a b/tools/sdk/esp32c3/lib/libfb_gfx.a index 762674bbf9d..1fd20481b19 100644 Binary files a/tools/sdk/esp32c3/lib/libfb_gfx.a and b/tools/sdk/esp32c3/lib/libfb_gfx.a differ diff --git a/tools/sdk/esp32c3/lib/libfreemodbus.a b/tools/sdk/esp32c3/lib/libfreemodbus.a index 923c5f254b9..04b5adc59b6 100644 Binary files a/tools/sdk/esp32c3/lib/libfreemodbus.a and b/tools/sdk/esp32c3/lib/libfreemodbus.a differ diff --git a/tools/sdk/esp32c3/lib/libfreertos.a b/tools/sdk/esp32c3/lib/libfreertos.a index 8a2ab295076..7e1722d098d 100644 Binary files a/tools/sdk/esp32c3/lib/libfreertos.a and b/tools/sdk/esp32c3/lib/libfreertos.a differ diff --git a/tools/sdk/esp32c3/lib/libhal.a b/tools/sdk/esp32c3/lib/libhal.a index 7bc4e031c9e..9d97af504da 100644 Binary files a/tools/sdk/esp32c3/lib/libhal.a and b/tools/sdk/esp32c3/lib/libhal.a differ diff --git a/tools/sdk/esp32c3/lib/libheap.a b/tools/sdk/esp32c3/lib/libheap.a index 3fd8b572740..767c226dc09 100644 Binary files a/tools/sdk/esp32c3/lib/libheap.a and b/tools/sdk/esp32c3/lib/libheap.a differ diff --git a/tools/sdk/esp32c3/lib/libjsmn.a b/tools/sdk/esp32c3/lib/libjsmn.a index d1d20e38a86..c91cf8a3f95 100644 Binary files a/tools/sdk/esp32c3/lib/libjsmn.a and b/tools/sdk/esp32c3/lib/libjsmn.a differ diff --git a/tools/sdk/esp32c3/lib/libjson.a b/tools/sdk/esp32c3/lib/libjson.a index 820acf45983..01498d9b7e3 100644 Binary files a/tools/sdk/esp32c3/lib/libjson.a and b/tools/sdk/esp32c3/lib/libjson.a differ diff --git a/tools/sdk/esp32c3/lib/liblibsodium.a b/tools/sdk/esp32c3/lib/liblibsodium.a index 02311913d38..4c080308911 100644 Binary files a/tools/sdk/esp32c3/lib/liblibsodium.a and b/tools/sdk/esp32c3/lib/liblibsodium.a differ diff --git a/tools/sdk/esp32c3/lib/liblog.a b/tools/sdk/esp32c3/lib/liblog.a index d1aa6f9542f..e5fc7250593 100644 Binary files a/tools/sdk/esp32c3/lib/liblog.a and b/tools/sdk/esp32c3/lib/liblog.a differ diff --git a/tools/sdk/esp32c3/lib/liblwip.a b/tools/sdk/esp32c3/lib/liblwip.a index 1bdc98f3551..c68600b39a2 100644 Binary files a/tools/sdk/esp32c3/lib/liblwip.a and b/tools/sdk/esp32c3/lib/liblwip.a differ diff --git a/tools/sdk/esp32c3/lib/libmbedcrypto.a b/tools/sdk/esp32c3/lib/libmbedcrypto.a index 399262239a0..42192552278 100644 Binary files a/tools/sdk/esp32c3/lib/libmbedcrypto.a and b/tools/sdk/esp32c3/lib/libmbedcrypto.a differ diff --git a/tools/sdk/esp32c3/lib/libmbedtls.a b/tools/sdk/esp32c3/lib/libmbedtls.a index c28024fd7a2..478cc1d9e7a 100644 Binary files a/tools/sdk/esp32c3/lib/libmbedtls.a and b/tools/sdk/esp32c3/lib/libmbedtls.a differ diff --git a/tools/sdk/esp32c3/lib/libmbedx509.a b/tools/sdk/esp32c3/lib/libmbedx509.a index 5c4b3d945f2..5b29dd9ff3e 100644 Binary files a/tools/sdk/esp32c3/lib/libmbedx509.a and b/tools/sdk/esp32c3/lib/libmbedx509.a differ diff --git a/tools/sdk/esp32c3/lib/libmdns.a b/tools/sdk/esp32c3/lib/libmdns.a index 59b41c1688c..3ff959111d1 100644 Binary files a/tools/sdk/esp32c3/lib/libmdns.a and b/tools/sdk/esp32c3/lib/libmdns.a differ diff --git a/tools/sdk/esp32c3/lib/libmesh.a b/tools/sdk/esp32c3/lib/libmesh.a index 7bb8b56c3a2..d08a3f8d7d7 100644 Binary files a/tools/sdk/esp32c3/lib/libmesh.a and b/tools/sdk/esp32c3/lib/libmesh.a differ diff --git a/tools/sdk/esp32c3/lib/libmqtt.a b/tools/sdk/esp32c3/lib/libmqtt.a index 53be6f29aa5..51e9fcbc0ff 100644 Binary files a/tools/sdk/esp32c3/lib/libmqtt.a and b/tools/sdk/esp32c3/lib/libmqtt.a differ diff --git a/tools/sdk/esp32c3/lib/libnet80211.a b/tools/sdk/esp32c3/lib/libnet80211.a index bad74eb158f..37514461ba7 100644 Binary files a/tools/sdk/esp32c3/lib/libnet80211.a and b/tools/sdk/esp32c3/lib/libnet80211.a differ diff --git a/tools/sdk/esp32c3/lib/libnewlib.a b/tools/sdk/esp32c3/lib/libnewlib.a index fd6b99d55da..10a4f29bb09 100644 Binary files a/tools/sdk/esp32c3/lib/libnewlib.a and b/tools/sdk/esp32c3/lib/libnewlib.a differ diff --git a/tools/sdk/esp32c3/lib/libnghttp.a b/tools/sdk/esp32c3/lib/libnghttp.a index ddb3623394e..ef007ae10e3 100644 Binary files a/tools/sdk/esp32c3/lib/libnghttp.a and b/tools/sdk/esp32c3/lib/libnghttp.a differ diff --git a/tools/sdk/esp32c3/lib/libnvs_flash.a b/tools/sdk/esp32c3/lib/libnvs_flash.a index 44ad43f80a0..e2ac1fdd15e 100644 Binary files a/tools/sdk/esp32c3/lib/libnvs_flash.a and b/tools/sdk/esp32c3/lib/libnvs_flash.a differ diff --git a/tools/sdk/esp32c3/lib/libopenssl.a b/tools/sdk/esp32c3/lib/libopenssl.a index 5523cd4d16e..7e49d480dd8 100644 Binary files a/tools/sdk/esp32c3/lib/libopenssl.a and b/tools/sdk/esp32c3/lib/libopenssl.a differ diff --git a/tools/sdk/esp32c3/lib/libpp.a b/tools/sdk/esp32c3/lib/libpp.a index 8743d11743e..6cdf55cbc9b 100644 Binary files a/tools/sdk/esp32c3/lib/libpp.a and b/tools/sdk/esp32c3/lib/libpp.a differ diff --git a/tools/sdk/esp32c3/lib/libprotobuf-c.a b/tools/sdk/esp32c3/lib/libprotobuf-c.a index bf630f77665..7a46cd720f6 100644 Binary files a/tools/sdk/esp32c3/lib/libprotobuf-c.a and b/tools/sdk/esp32c3/lib/libprotobuf-c.a differ diff --git a/tools/sdk/esp32c3/lib/libprotocomm.a b/tools/sdk/esp32c3/lib/libprotocomm.a index a7f7a734761..33a67f0b0c9 100644 Binary files a/tools/sdk/esp32c3/lib/libprotocomm.a and b/tools/sdk/esp32c3/lib/libprotocomm.a differ diff --git a/tools/sdk/esp32c3/lib/libpthread.a b/tools/sdk/esp32c3/lib/libpthread.a index 8a0e9e74bf5..0ab07666ccf 100644 Binary files a/tools/sdk/esp32c3/lib/libpthread.a and b/tools/sdk/esp32c3/lib/libpthread.a differ diff --git a/tools/sdk/esp32c3/lib/libriscv.a b/tools/sdk/esp32c3/lib/libriscv.a index 8c7ad19e9c6..22241283954 100644 Binary files a/tools/sdk/esp32c3/lib/libriscv.a and b/tools/sdk/esp32c3/lib/libriscv.a differ diff --git a/tools/sdk/esp32c3/lib/libsdmmc.a b/tools/sdk/esp32c3/lib/libsdmmc.a index 08bdcb0ed28..10b629251c9 100644 Binary files a/tools/sdk/esp32c3/lib/libsdmmc.a and b/tools/sdk/esp32c3/lib/libsdmmc.a differ diff --git a/tools/sdk/esp32c3/lib/libsmartconfig.a b/tools/sdk/esp32c3/lib/libsmartconfig.a index 7ca0717b505..8ae8e2e0318 100644 Binary files a/tools/sdk/esp32c3/lib/libsmartconfig.a and b/tools/sdk/esp32c3/lib/libsmartconfig.a differ diff --git a/tools/sdk/esp32c3/lib/libsoc.a b/tools/sdk/esp32c3/lib/libsoc.a index ef5a2c8cf04..d7c2670c966 100644 Binary files a/tools/sdk/esp32c3/lib/libsoc.a and b/tools/sdk/esp32c3/lib/libsoc.a differ diff --git a/tools/sdk/esp32c3/lib/libspi_flash.a b/tools/sdk/esp32c3/lib/libspi_flash.a index 3c5484fad2e..f4926de0c9a 100644 Binary files a/tools/sdk/esp32c3/lib/libspi_flash.a and b/tools/sdk/esp32c3/lib/libspi_flash.a differ diff --git a/tools/sdk/esp32c3/lib/libspiffs.a b/tools/sdk/esp32c3/lib/libspiffs.a index 7c6fcc92747..a9708b91472 100644 Binary files a/tools/sdk/esp32c3/lib/libspiffs.a and b/tools/sdk/esp32c3/lib/libspiffs.a differ diff --git a/tools/sdk/esp32c3/lib/libtcp_transport.a b/tools/sdk/esp32c3/lib/libtcp_transport.a index 3c2f0b79d93..55316d51438 100644 Binary files a/tools/sdk/esp32c3/lib/libtcp_transport.a and b/tools/sdk/esp32c3/lib/libtcp_transport.a differ diff --git a/tools/sdk/esp32c3/lib/libtcpip_adapter.a b/tools/sdk/esp32c3/lib/libtcpip_adapter.a index 58398687c25..53e25770a67 100644 Binary files a/tools/sdk/esp32c3/lib/libtcpip_adapter.a and b/tools/sdk/esp32c3/lib/libtcpip_adapter.a differ diff --git a/tools/sdk/esp32c3/lib/libunity.a b/tools/sdk/esp32c3/lib/libunity.a index cdfdab39d76..9198aa2c019 100644 Binary files a/tools/sdk/esp32c3/lib/libunity.a and b/tools/sdk/esp32c3/lib/libunity.a differ diff --git a/tools/sdk/esp32c3/lib/libvfs.a b/tools/sdk/esp32c3/lib/libvfs.a index 8d5eb923b6f..99751366ee7 100644 Binary files a/tools/sdk/esp32c3/lib/libvfs.a and b/tools/sdk/esp32c3/lib/libvfs.a differ diff --git a/tools/sdk/esp32c3/lib/libwapi.a b/tools/sdk/esp32c3/lib/libwapi.a index 38b9be90b0f..e823d8b2906 100644 Binary files a/tools/sdk/esp32c3/lib/libwapi.a and b/tools/sdk/esp32c3/lib/libwapi.a differ diff --git a/tools/sdk/esp32c3/lib/libwear_levelling.a b/tools/sdk/esp32c3/lib/libwear_levelling.a index a6e6814c14c..cdf414b02c5 100644 Binary files a/tools/sdk/esp32c3/lib/libwear_levelling.a and b/tools/sdk/esp32c3/lib/libwear_levelling.a differ diff --git a/tools/sdk/esp32c3/lib/libwifi_provisioning.a b/tools/sdk/esp32c3/lib/libwifi_provisioning.a index beef0dbc244..9bbb089942e 100644 Binary files a/tools/sdk/esp32c3/lib/libwifi_provisioning.a and b/tools/sdk/esp32c3/lib/libwifi_provisioning.a differ diff --git a/tools/sdk/esp32c3/lib/libwpa_supplicant.a b/tools/sdk/esp32c3/lib/libwpa_supplicant.a index db8ed996d89..fc1d7b04412 100644 Binary files a/tools/sdk/esp32c3/lib/libwpa_supplicant.a and b/tools/sdk/esp32c3/lib/libwpa_supplicant.a differ diff --git a/tools/sdk/esp32c3/sdkconfig b/tools/sdk/esp32c3/sdkconfig index 2d18f29db03..337473924be 100644 --- a/tools/sdk/esp32c3/sdkconfig +++ b/tools/sdk/esp32c3/sdkconfig @@ -517,7 +517,7 @@ CONFIG_BT_SMP_ENABLE=y CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT=30 CONFIG_BT_BLE_RPA_SUPPORTED=y CONFIG_BT_BLE_50_FEATURES_SUPPORTED=y -# CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set +CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y CONFIG_BT_RESERVE_DRAM=0xdb5c # end of Bluedroid Options # end of Bluetooth @@ -595,9 +595,6 @@ CONFIG_ESP32C3_REV_MIN_0=y # CONFIG_ESP32C3_REV_MIN_2 is not set # CONFIG_ESP32C3_REV_MIN_3 is not set CONFIG_ESP32C3_REV_MIN=0 -# CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES_TWO is not set -CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES_FOUR=y -CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES=4 CONFIG_ESP32C3_DEBUG_OCDAWARE=y # CONFIG_ESP32C3_DEBUG_STUBS_ENABLE is not set CONFIG_ESP32C3_BROWNOUT_DET=y @@ -696,7 +693,16 @@ CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y +# CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES_TWO is not set +CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES_FOUR=y +CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES=4 # end of MAC Config + +# +# Sleep Config +# +CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y +# end of Sleep Config # end of Hardware Settings # @@ -712,6 +718,7 @@ CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=y # Power Management # # CONFIG_PM_ENABLE is not set +CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP=y # end of Power Management # @@ -724,8 +731,6 @@ CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE=y CONFIG_ESP_SYSTEM_RTC_FAST_MEM_AS_HEAP_DEPCHECK=y CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP=y -CONFIG_ESP_SYSTEM_PD_FLASH=y -CONFIG_ESP_SYSTEM_PM_POWER_DOWN_CPU=y # # Memory protection @@ -1067,13 +1072,6 @@ CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1 CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 # end of SNTP -# -# LCP -# -CONFIG_LCP_ECHOINTERVAL=0 -CONFIG_LCP_MAXECHOFAILS=3 -# end of LCP - CONFIG_LWIP_ESP_LWIP_ASSERT=y # @@ -1090,22 +1088,7 @@ CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y # CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set # end of Hooks -# -# Debug -# -# CONFIG_LWIP_NETIF_DEBUG is not set -# CONFIG_LWIP_PBUF_DEBUG is not set -# CONFIG_LWIP_ETHARP_DEBUG is not set -# CONFIG_LWIP_API_LIB_DEBUG is not set -# CONFIG_LWIP_SOCKETS_DEBUG is not set -# CONFIG_LWIP_IP_DEBUG is not set -# CONFIG_LWIP_ICMP_DEBUG is not set -# CONFIG_LWIP_DHCP_STATE_DEBUG is not set -# CONFIG_LWIP_DHCP_DEBUG is not set -# CONFIG_LWIP_IP6_DEBUG is not set -# CONFIG_LWIP_ICMP6_DEBUG is not set -# CONFIG_LWIP_TCP_DEBUG is not set -# end of Debug +# CONFIG_LWIP_DEBUG is not set # end of LWIP # @@ -1237,6 +1220,7 @@ CONFIG_MDNS_TASK_STACK_SIZE=4096 CONFIG_MDNS_TASK_AFFINITY_CPU0=y CONFIG_MDNS_TASK_AFFINITY=0x0 CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 +# CONFIG_MDNS_STRICT_MODE is not set CONFIG_MDNS_TIMER_PERIOD_MS=100 # end of mDNS @@ -1281,6 +1265,12 @@ CONFIG_OPENSSL_ERROR_STACK=y CONFIG_OPENSSL_ASSERT_EXIT=y # end of OpenSSL +# +# OpenThread +# +# CONFIG_OPENTHREAD_ENABLED is not set +# end of OpenThread + # # PThreads # @@ -1677,6 +1667,8 @@ CONFIG_ADC2_DISABLE_DAC=y # CONFIG_EVENT_LOOP_PROFILING is not set CONFIG_POST_EVENTS_FROM_ISR=y CONFIG_POST_EVENTS_FROM_IRAM_ISR=y +CONFIG_ESP_SYSTEM_PD_FLASH=y +CONFIG_ESP_SYSTEM_PM_POWER_DOWN_CPU=y # CONFIG_ESP32S2_PANIC_PRINT_HALT is not set CONFIG_ESP32S2_PANIC_PRINT_REBOOT=y # CONFIG_ESP32S2_PANIC_SILENT_REBOOT is not set diff --git a/tools/sdk/esp32s2/bin/bootloader_dio_40m.bin b/tools/sdk/esp32s2/bin/bootloader_dio_40m.bin index 0f112daf54c..9c4afcba51c 100644 Binary files a/tools/sdk/esp32s2/bin/bootloader_dio_40m.bin and b/tools/sdk/esp32s2/bin/bootloader_dio_40m.bin differ diff --git a/tools/sdk/esp32s2/bin/bootloader_dio_80m.bin b/tools/sdk/esp32s2/bin/bootloader_dio_80m.bin index dbc9d3bb2fa..8459a46a9e3 100644 Binary files a/tools/sdk/esp32s2/bin/bootloader_dio_80m.bin and b/tools/sdk/esp32s2/bin/bootloader_dio_80m.bin differ diff --git a/tools/sdk/esp32s2/bin/bootloader_dout_40m.bin b/tools/sdk/esp32s2/bin/bootloader_dout_40m.bin index aa503516af4..df7f99c6cd4 100644 Binary files a/tools/sdk/esp32s2/bin/bootloader_dout_40m.bin and b/tools/sdk/esp32s2/bin/bootloader_dout_40m.bin differ diff --git a/tools/sdk/esp32s2/bin/bootloader_dout_80m.bin b/tools/sdk/esp32s2/bin/bootloader_dout_80m.bin index be2e94b15f0..d87a5a7219f 100644 Binary files a/tools/sdk/esp32s2/bin/bootloader_dout_80m.bin and b/tools/sdk/esp32s2/bin/bootloader_dout_80m.bin differ diff --git a/tools/sdk/esp32s2/bin/bootloader_qio_40m.bin b/tools/sdk/esp32s2/bin/bootloader_qio_40m.bin index c809e3c4587..eb306c18ad5 100644 Binary files a/tools/sdk/esp32s2/bin/bootloader_qio_40m.bin and b/tools/sdk/esp32s2/bin/bootloader_qio_40m.bin differ diff --git a/tools/sdk/esp32s2/bin/bootloader_qio_80m.bin b/tools/sdk/esp32s2/bin/bootloader_qio_80m.bin index e5503bd9b48..2a1d55b7d0f 100644 Binary files a/tools/sdk/esp32s2/bin/bootloader_qio_80m.bin and b/tools/sdk/esp32s2/bin/bootloader_qio_80m.bin differ diff --git a/tools/sdk/esp32s2/bin/bootloader_qout_40m.bin b/tools/sdk/esp32s2/bin/bootloader_qout_40m.bin index 80a36180b0a..8ce8c3f2055 100644 Binary files a/tools/sdk/esp32s2/bin/bootloader_qout_40m.bin and b/tools/sdk/esp32s2/bin/bootloader_qout_40m.bin differ diff --git a/tools/sdk/esp32s2/bin/bootloader_qout_80m.bin b/tools/sdk/esp32s2/bin/bootloader_qout_80m.bin index 88f898aff58..3d62c3dbb4d 100644 Binary files a/tools/sdk/esp32s2/bin/bootloader_qout_80m.bin and b/tools/sdk/esp32s2/bin/bootloader_qout_80m.bin differ diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/audio/audio.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/audio/audio.h index 05e61f8df6d..936f091049a 100644 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/audio/audio.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/audio/audio.h @@ -469,44 +469,28 @@ typedef enum /// Additional Audio Device Class Codes - Source: Audio Data Formats /// A.1 - Audio Class-Format Type Codes UAC2 -//typedef enum -//{ -// AUDIO_FORMAT_TYPE_UNDEFINED = 0x00, -// AUDIO_FORMAT_TYPE_I = 0x01, -// AUDIO_FORMAT_TYPE_II = 0x02, -// AUDIO_FORMAT_TYPE_III = 0x03, -// AUDIO_FORMAT_TYPE_IV = 0x04, -// AUDIO_EXT_FORMAT_TYPE_I = 0x81, -// AUDIO_EXT_FORMAT_TYPE_II = 0x82, -// AUDIO_EXT_FORMAT_TYPE_III = 0x83, -//} audio_format_type_t; - -#define AUDIO_FORMAT_TYPE_UNDEFINED 0x00 -#define AUDIO_FORMAT_TYPE_I 0x01 -#define AUDIO_FORMAT_TYPE_II 0x02 -#define AUDIO_FORMAT_TYPE_III 0x03 -#define AUDIO_FORMAT_TYPE_IV 0x04 -#define AUDIO_EXT_FORMAT_TYPE_I 0x81 -#define AUDIO_EXT_FORMAT_TYPE_II 0x82 -#define AUDIO_EXT_FORMAT_TYPE_III 0x83 - -/// A.2.1 - Audio Class-Audio Data Format Type I UAC2 -//typedef enum -//{ -// AUDIO_DATA_FORMAT_TYPE_I_PCM = (uint32_t) (1 << 0), -// AUDIO_DATA_FORMAT_TYPE_I_PCM8 = (uint32_t) (1 << 1), -// AUDIO_DATA_FORMAT_TYPE_I_IEEE_FLOAT = (uint32_t) (1 << 2), -// AUDIO_DATA_FORMAT_TYPE_I_ALAW = (uint32_t) (1 << 3), -// AUDIO_DATA_FORMAT_TYPE_I_MULAW = (uint32_t) (1 << 4), -// AUDIO_DATA_FORMAT_TYPE_I_RAW_DATA = 0x100000000, -//} audio_data_format_type_I_t; - -#define AUDIO_DATA_FORMAT_TYPE_I_PCM ((uint32_t) (1 << 0)) -#define AUDIO_DATA_FORMAT_TYPE_I_PCM8 ((uint32_t) (1 << 1)) -#define AUDIO_DATA_FORMAT_TYPE_I_IEEE_FLOAT ((uint32_t) (1 << 2)) -#define AUDIO_DATA_FORMAT_TYPE_I_ALAW ((uint32_t) (1 << 3)) -#define AUDIO_DATA_FORMAT_TYPE_I_MULAW ((uint32_t) (1 << 4)) -#define AUDIO_DATA_FORMAT_TYPE_I_RAW_DATA 0x100000000 +typedef enum +{ + AUDIO_FORMAT_TYPE_UNDEFINED = 0x00, + AUDIO_FORMAT_TYPE_I = 0x01, + AUDIO_FORMAT_TYPE_II = 0x02, + AUDIO_FORMAT_TYPE_III = 0x03, + AUDIO_FORMAT_TYPE_IV = 0x04, + AUDIO_EXT_FORMAT_TYPE_I = 0x81, + AUDIO_EXT_FORMAT_TYPE_II = 0x82, + AUDIO_EXT_FORMAT_TYPE_III = 0x83, +} audio_format_type_t; + +// A.2.1 - Audio Class-Audio Data Format Type I UAC2 +typedef enum +{ + AUDIO_DATA_FORMAT_TYPE_I_PCM = (uint32_t) (1 << 0), + AUDIO_DATA_FORMAT_TYPE_I_PCM8 = (uint32_t) (1 << 1), + AUDIO_DATA_FORMAT_TYPE_I_IEEE_FLOAT = (uint32_t) (1 << 2), + AUDIO_DATA_FORMAT_TYPE_I_ALAW = (uint32_t) (1 << 3), + AUDIO_DATA_FORMAT_TYPE_I_MULAW = (uint32_t) (1 << 4), + AUDIO_DATA_FORMAT_TYPE_I_RAW_DATA = 0x100000000, +} audio_data_format_type_I_t; /// All remaining definitions are taken from the descriptor descriptions in the UAC2 main specification @@ -901,7 +885,7 @@ typedef struct TU_ATTR_PACKED { } subrange[numSubRanges] ; \ } - /// 5.2.3.2 2-byte Control RANGE Parameter Block +/// 5.2.3.2 2-byte Control RANGE Parameter Block #define audio_control_range_2_n_t(numSubRanges) \ struct TU_ATTR_PACKED { \ uint16_t wNumSubRanges; \ @@ -912,7 +896,7 @@ typedef struct TU_ATTR_PACKED { } subrange[numSubRanges]; \ } - // 5.2.3.3 4-byte Control RANGE Parameter Block +// 5.2.3.3 4-byte Control RANGE Parameter Block #define audio_control_range_4_n_t(numSubRanges) \ struct TU_ATTR_PACKED { \ uint16_t wNumSubRanges; \ @@ -923,12 +907,12 @@ typedef struct TU_ATTR_PACKED { } subrange[numSubRanges]; \ } - /** @} */ +/** @} */ #ifdef __cplusplus - } +} #endif #endif - /** @} */ +/** @} */ diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/audio/audio_device.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/audio/audio_device.h index 5061501cead..f91540b64ce 100644 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/audio/audio_device.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/audio/audio_device.h @@ -38,116 +38,306 @@ // Class Driver Configuration //--------------------------------------------------------------------+ -// Number of Standard AS Interface Descriptors (4.9.1) defined per audio function - this is required to be able to remember the current alternate settings of these interfaces - We restrict us here to have a constant number for all audio functions (which means this has to be the maximum number of AS interfaces an audio function has and a second audio function with less AS interfaces just waste a few bytes) -#ifndef CFG_TUD_AUDIO_N_AS_INT -#define CFG_TUD_AUDIO_N_AS_INT 0 +// All sizes are in bytes! + +#ifndef CFG_TUD_AUDIO_FUNC_1_DESC_LEN +#error You must tell the driver the length of the audio function descriptor including IAD descriptor +#endif +#if CFG_TUD_AUDIO > 1 +#ifndef CFG_TUD_AUDIO_FUNC_2_DESC_LEN +#error You must tell the driver the length of the audio function descriptor including IAD descriptor +#endif +#endif +#if CFG_TUD_AUDIO > 2 +#ifndef CFG_TUD_AUDIO_FUNC_3_DESC_LEN +#error You must tell the driver the length of the audio function descriptor including IAD descriptor +#endif +#endif + +// Number of Standard AS Interface Descriptors (4.9.1) defined per audio function - this is required to be able to remember the current alternate settings of these interfaces +#ifndef CFG_TUD_AUDIO_FUNC_1_N_AS_INT +#error You must tell the driver the number of Standard AS Interface Descriptors you have defined in the audio function descriptor! +#endif +#if CFG_TUD_AUDIO > 1 +#ifndef CFG_TUD_AUDIO_FUNC_2_N_AS_INT +#error You must tell the driver the number of Standard AS Interface Descriptors you have defined in the audio function descriptor! +#endif +#endif +#if CFG_TUD_AUDIO > 2 +#ifndef CFG_TUD_AUDIO_FUNC_3_N_AS_INT +#error You must tell the driver the number of Standard AS Interface Descriptors you have defined in the audio function descriptor! +#endif #endif // Size of control buffer used to receive and send control messages via EP0 - has to be big enough to hold your biggest request structure e.g. range requests with multiple intervals defined or cluster descriptors -#ifndef CFG_TUD_AUDIO_CTRL_BUF_SIZE +#ifndef CFG_TUD_AUDIO_FUNC_1_CTRL_BUF_SZ #error You must define an audio class control request buffer size! #endif -// Use of TX/RX FIFOs - If sizes are not zero, audio.c implements FIFOs for RX and TX (whatever defined). -// For RX: the input stream gets decoded into its corresponding channels, where for each channel a FIFO is setup to hold its data -> see: audio_rx_done_cb(). -// For TX: the output stream is composed from CFG_TUD_AUDIO_N_CHANNELS_TX channels, where for each channel a FIFO is defined. -// Further, it implements encoding and decoding of the individual channels (parameterized by the defines below). -// If you don't use the FIFOs you need to handle encoding and decoding on your own in audio_rx_done_cb() and audio_tx_done_cb(). This, however, allows for optimizations. +#if CFG_TUD_AUDIO > 1 +#ifndef CFG_TUD_AUDIO_FUNC_2_CTRL_BUF_SZ +#error You must define an audio class control request buffer size! +#endif +#endif -#ifndef CFG_TUD_AUDIO_TX_FIFO_SIZE -#define CFG_TUD_AUDIO_TX_FIFO_SIZE 0 // Buffer size per channel +#if CFG_TUD_AUDIO > 2 +#ifndef CFG_TUD_AUDIO_FUNC_3_CTRL_BUF_SZ +#error You must define an audio class control request buffer size! +#endif #endif -#ifndef CFG_TUD_AUDIO_RX_FIFO_SIZE -#define CFG_TUD_AUDIO_RX_FIFO_SIZE 0 // Buffer size per channel +// End point sizes IN BYTES - Limits: Full Speed <= 1023, High Speed <= 1024 +#ifndef CFG_TUD_AUDIO_ENABLE_EP_IN +#define CFG_TUD_AUDIO_ENABLE_EP_IN 0 // TX #endif -// End point sizes - Limits: Full Speed <= 1023, High Speed <= 1024 -#ifndef CFG_TUD_AUDIO_EPSIZE_IN -#define CFG_TUD_AUDIO_EPSIZE_IN 0 // TX +#ifndef CFG_TUD_AUDIO_ENABLE_EP_OUT +#define CFG_TUD_AUDIO_ENABLE_EP_OUT 0 // RX #endif -#ifndef CFG_TUD_AUDIO_EPSIZE_OUT -#define CFG_TUD_AUDIO_EPSIZE_OUT 0 // RX +// Maximum EP sizes for all alternate AS interface settings - used for checks and buffer allocation +#if CFG_TUD_AUDIO_ENABLE_EP_IN +#ifndef CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX +#error You must tell the driver the biggest EP IN size! +#endif +#if CFG_TUD_AUDIO > 1 +#ifndef CFG_TUD_AUDIO_FUNC_2_EP_IN_SZ_MAX +#error You must tell the driver the biggest EP IN size! +#endif #endif +#if CFG_TUD_AUDIO > 2 +#ifndef CFG_TUD_AUDIO_FUNC_3_EP_IN_SZ_MAX +#error You must tell the driver the biggest EP IN size! +#endif +#endif +#endif // CFG_TUD_AUDIO_ENABLE_EP_IN -#ifndef CFG_TUD_AUDIO_ENABLE_FEEDBACK_EP -#define CFG_TUD_AUDIO_ENABLE_FEEDBACK_EP 0 // Feedback +#if CFG_TUD_AUDIO_ENABLE_EP_OUT +#ifndef CFG_TUD_AUDIO_FUNC_1_EP_OUT_SZ_MAX +#error You must tell the driver the biggest EP OUT size! #endif +#if CFG_TUD_AUDIO > 1 +#ifndef CFG_TUD_AUDIO_FUNC_2_EP_OUT_SZ_MAX +#error You must tell the driver the biggest EP OUT size! +#endif +#endif +#if CFG_TUD_AUDIO > 2 +#ifndef CFG_TUD_AUDIO_FUNC_3_EP_OUT_SZ_MAX +#error You must tell the driver the biggest EP OUT size! +#endif +#endif +#endif // CFG_TUD_AUDIO_ENABLE_EP_OUT -#ifndef CFG_TUD_AUDIO_INT_CTR_EPSIZE_IN -#define CFG_TUD_AUDIO_INT_CTR_EPSIZE_IN 0 // Audio interrupt control +// Software EP FIFO buffer sizes - must be >= max EP SIZEs! +#ifndef CFG_TUD_AUDIO_FUNC_1_EP_IN_SW_BUF_SZ +#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SW_BUF_SZ 0 +#endif +#ifndef CFG_TUD_AUDIO_FUNC_2_EP_IN_SW_BUF_SZ +#define CFG_TUD_AUDIO_FUNC_2_EP_IN_SW_BUF_SZ 0 +#endif +#ifndef CFG_TUD_AUDIO_FUNC_3_EP_IN_SW_BUF_SZ +#define CFG_TUD_AUDIO_FUNC_3_EP_IN_SW_BUF_SZ 0 #endif -#if CFG_TUD_AUDIO_INT_CTR_EPSIZE_IN -#ifndef CFG_TUD_AUDIO_INT_CTR_BUFSIZE -#define CFG_TUD_AUDIO_INT_CTR_BUFSIZE 6 // Buffer size of audio control interrupt EP - 6 Bytes according to UAC 2 specification (p. 74) +#ifndef CFG_TUD_AUDIO_FUNC_1_EP_OUT_SW_BUF_SZ +#define CFG_TUD_AUDIO_FUNC_1_EP_OUT_SW_BUF_SZ 0 +#endif +#ifndef CFG_TUD_AUDIO_FUNC_2_EP_OUT_SW_BUF_SZ +#define CFG_TUD_AUDIO_FUNC_2_EP_OUT_SW_BUF_SZ 0 #endif +#ifndef CFG_TUD_AUDIO_FUNC_3_EP_OUT_SW_BUF_SZ +#define CFG_TUD_AUDIO_FUNC_3_EP_OUT_SW_BUF_SZ 0 #endif -#ifndef CFG_TUD_AUDIO_N_CHANNELS_TX -#define CFG_TUD_AUDIO_N_CHANNELS_TX 1 +#if CFG_TUD_AUDIO_ENABLE_EP_IN +#if CFG_TUD_AUDIO_FUNC_1_EP_IN_SW_BUF_SZ < CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX +#error EP software buffer size MUST BE at least as big as maximum EP size #endif -#ifndef CFG_TUD_AUDIO_N_CHANNELS_RX -#define CFG_TUD_AUDIO_N_CHANNELS_RX 1 +#if CFG_TUD_AUDIO > 1 +#if CFG_TUD_AUDIO_FUNC_2_EP_IN_SW_BUF_SZ < CFG_TUD_AUDIO_FUNC_2_EP_IN_SZ_MAX +#error EP software buffer size MUST BE at least as big as maximum EP size +#endif #endif -// Audio data format types -#ifndef CFG_TUD_AUDIO_FORMAT_TYPE_TX -#define CFG_TUD_AUDIO_FORMAT_TYPE_TX AUDIO_FORMAT_TYPE_UNDEFINED // If this option is used, an encoding function has to be implemented in audio_device.c +#if CFG_TUD_AUDIO > 2 +#if CFG_TUD_AUDIO_FUNC_3_EP_IN_SW_BUF_SZ < CFG_TUD_AUDIO_FUNC_3_EP_IN_SZ_MAX +#error EP software buffer size MUST BE at least as big as maximum EP size +#endif +#endif #endif -#ifndef CFG_TUD_AUDIO_FORMAT_TYPE_RX -#define CFG_TUD_AUDIO_FORMAT_TYPE_RX AUDIO_FORMAT_TYPE_UNDEFINED // If this option is used, a decoding function has to be implemented in audio_device.c +#if CFG_TUD_AUDIO_ENABLE_EP_OUT +#if CFG_TUD_AUDIO_FUNC_1_EP_OUT_SW_BUF_SZ < CFG_TUD_AUDIO_FUNC_1_EP_OUT_SZ_MAX +#error EP software buffer size MUST BE at least as big as maximum EP size #endif -// Audio data format type I specifications -#if CFG_TUD_AUDIO_FORMAT_TYPE_TX == AUDIO_FORMAT_TYPE_I +#if CFG_TUD_AUDIO > 1 +#if CFG_TUD_AUDIO_FUNC_2_EP_OUT_SW_BUF_SZ < CFG_TUD_AUDIO_FUNC_2_EP_OUT_SZ_MAX +#error EP software buffer size MUST BE at least as big as maximum EP size +#endif +#endif -// Type definitions - for possible formats see: audio_data_format_type_I_t and further in UAC2 specifications. -#ifndef CFG_TUD_AUDIO_FORMAT_TYPE_I_TX -#define CFG_TUD_AUDIO_FORMAT_TYPE_I_TX AUDIO_DATA_FORMAT_TYPE_I_PCM +#if CFG_TUD_AUDIO > 2 +#if CFG_TUD_AUDIO_FUNC_3_EP_OUT_SW_BUF_SZ < CFG_TUD_AUDIO_FUNC_3_EP_OUT_SZ_MAX +#error EP software buffer size MUST BE at least as big as maximum EP size +#endif +#endif #endif -#ifndef CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_TX // bSubslotSize -#define CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_TX 1 +// Enable/disable feedback EP (required for asynchronous RX applications) +#ifndef CFG_TUD_AUDIO_ENABLE_FEEDBACK_EP +#define CFG_TUD_AUDIO_ENABLE_FEEDBACK_EP 0 // Feedback - 0 or 1 #endif -#ifndef CFG_TUD_AUDIO_TX_ITEMSIZE -#if CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_TX == 1 -#define CFG_TUD_AUDIO_TX_ITEMSIZE 1 -#elif CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_TX == 2 -#define CFG_TUD_AUDIO_TX_ITEMSIZE 2 -#else -#define CFG_TUD_AUDIO_TX_ITEMSIZE 4 +// Audio interrupt control EP size - disabled if 0 +#ifndef CFG_TUD_AUDIO_INT_CTR_EPSIZE_IN +#define CFG_TUD_AUDIO_INT_CTR_EPSIZE_IN 0 // Audio interrupt control - if required - 6 Bytes according to UAC 2 specification (p. 74) #endif + +#ifndef CFG_TUD_AUDIO_INT_CTR_EP_IN_SW_BUFFER_SIZE +#define CFG_TUD_AUDIO_INT_CTR_EP_IN_SW_BUFFER_SIZE 6 // Buffer size of audio control interrupt EP - 6 Bytes according to UAC 2 specification (p. 74) #endif -#if CFG_TUD_AUDIO_TX_ITEMSIZE < CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_TX -#error FIFO element size (ITEMSIZE) must not be smaller then sample size +// Use software encoding/decoding + +// The software coding feature of the driver is not mandatory. It is useful if, for instance, you have two I2S streams which need to be interleaved +// into a single PCM stream as SAMPLE_1 | SAMPLE_2 | SAMPLE_3 | SAMPLE_4. +// +// Currently, only PCM type I encoding/decoding is supported! +// +// If the coding feature is to be used, support FIFOs need to be configured. Their sizes and numbers are defined below. + +// Encoding/decoding is done in software and thus time consuming. If you can encode/decode your stream more efficiently do not use the +// support FIFOs but write/read directly into/from the EP_X_SW_BUFFER_FIFOs using +// - tud_audio_n_write() or +// - tud_audio_n_read(). +// To write/read to/from the support FIFOs use +// - tud_audio_n_write_support_ff() or +// - tud_audio_n_read_support_ff(). +// +// The encoding/decoding format type done is defined below. +// +// The encoding/decoding starts when the private callback functions +// - audio_tx_done_cb() +// - audio_rx_done_cb() +// are invoked. If support FIFOs are used, the corresponding encoding/decoding functions are called from there. +// Once encoding/decoding is done the result is put directly into the EP_X_SW_BUFFER_FIFOs. You can use the public callback functions +// - tud_audio_tx_done_pre_load_cb() or tud_audio_tx_done_post_load_cb() +// - tud_audio_rx_done_pre_read_cb() or tud_audio_rx_done_post_read_cb() +// if you want to get informed what happened. +// +// If you don't use the support FIFOs you may use the public callback functions +// - tud_audio_tx_done_pre_load_cb() or tud_audio_tx_done_post_load_cb() +// - tud_audio_rx_done_pre_read_cb() or tud_audio_rx_done_post_read_cb() +// to write/read from/into the EP_X_SW_BUFFER_FIFOs at the right time. +// +// If you need a different encoding which is not support so far implement it in the +// - audio_tx_done_cb() +// - audio_rx_done_cb() +// functions. + +// Enable encoding/decodings - for these to work, support FIFOs need to be setup in appropriate numbers and size +// The actual coding parameters of active AS alternate interface is parsed from the descriptors + +// The item size of the FIFO is always fixed to one i.e. bytes! Furthermore, the actively used FIFO depth is reconfigured such that the depth is a multiple of the current sample size in order to avoid samples to get split up in case of a wrap in the FIFO ring buffer (depth = (max_depth / sampe_sz) * sampe_sz)! +// This is important to remind in case you use DMAs! If the sample sizes changes, the DMA MUST BE RECONFIGURED just like the FIFOs for a different depth!!! + +// For PCM encoding/decoding + +#ifndef CFG_TUD_AUDIO_ENABLE_ENCODING +#define CFG_TUD_AUDIO_ENABLE_ENCODING 0 +#endif + +#ifndef CFG_TUD_AUDIO_ENABLE_DECODING +#define CFG_TUD_AUDIO_ENABLE_DECODING 0 +#endif + +// This enabling allows to save the current coding parameters e.g. # of bytes per sample etc. - TYPE_I includes common PCM encoding +#ifndef CFG_TUD_AUDIO_ENABLE_TYPE_I_ENCODING +#define CFG_TUD_AUDIO_ENABLE_TYPE_I_ENCODING 0 +#endif + +#ifndef CFG_TUD_AUDIO_ENABLE_TYPE_I_DECODING +#define CFG_TUD_AUDIO_ENABLE_TYPE_I_DECODING 0 +#endif + +// Type I Coding parameters not given within UAC2 descriptors +// It would be possible to allow for a more flexible setting and not fix this parameter as done below. However, this is most often not needed and kept for later if really necessary. The more flexible setting could be implemented within set_interface(), however, how the values are saved per alternate setting is to be determined! +#if CFG_TUD_AUDIO_ENABLE_EP_IN && CFG_TUD_AUDIO_ENABLE_ENCODING && CFG_TUD_AUDIO_ENABLE_TYPE_I_ENCODING +#ifndef CFG_TUD_AUDIO_FUNC_1_CHANNEL_PER_FIFO_TX +#error You must tell the driver the number of channels per FIFO for the interleaved encoding! E.g. for an I2S interface having two channels, CHANNEL_PER_FIFO = 2 as the I2S stream having two channels is usually saved within one FIFO +#endif +#if CFG_TUD_AUDIO > 1 +#ifndef CFG_TUD_AUDIO_FUNC_2_CHANNEL_PER_FIFO_TX +#error You must tell the driver the number of channels per FIFO for the interleaved encoding! E.g. for an I2S interface having two channels, CHANNEL_PER_FIFO = 2 as the I2S stream having two channels is usually saved within one FIFO +#endif +#endif +#if CFG_TUD_AUDIO > 2 +#ifndef CFG_TUD_AUDIO_FUNC_3_CHANNEL_PER_FIFO_TX +#error You must tell the driver the number of channels per FIFO for the interleaved encoding! E.g. for an I2S interface having two channels, CHANNEL_PER_FIFO = 2 as the I2S stream having two channels is usually saved within one FIFO +#endif +#endif #endif +#if CFG_TUD_AUDIO_ENABLE_EP_OUT && CFG_TUD_AUDIO_ENABLE_DECODING && CFG_TUD_AUDIO_ENABLE_TYPE_I_DECODING +#ifndef CFG_TUD_AUDIO_FUNC_1_CHANNEL_PER_FIFO_RX +#error You must tell the driver the number of channels per FIFO for the interleaved encoding! E.g. for an I2S interface having two channels, CHANNEL_PER_FIFO = 2 as the I2S stream having two channels is usually saved within one FIFO +#endif +#if CFG_TUD_AUDIO > 1 +#ifndef CFG_TUD_AUDIO_FUNC_2_CHANNEL_PER_FIFO_RX +#error You must tell the driver the number of channels per FIFO for the interleaved encoding! E.g. for an I2S interface having two channels, CHANNEL_PER_FIFO = 2 as the I2S stream having two channels is usually saved within one FIFO +#endif +#endif +#if CFG_TUD_AUDIO > 2 +#ifndef CFG_TUD_AUDIO_FUNC_3_CHANNEL_PER_FIFO_RX +#error You must tell the driver the number of channels per FIFO for the interleaved encoding! E.g. for an I2S interface having two channels, CHANNEL_PER_FIFO = 2 as the I2S stream having two channels is usually saved within one FIFO +#endif +#endif #endif -#if CFG_TUD_AUDIO_FORMAT_TYPE_RX == AUDIO_FORMAT_TYPE_I +// Remaining types not support so far -#ifndef CFG_TUD_AUDIO_FORMAT_TYPE_I_RX -#define CFG_TUD_AUDIO_FORMAT_TYPE_I_RX AUDIO_DATA_FORMAT_TYPE_I_PCM +// Number of support FIFOs to set up - multiple channels can be handled by one FIFO - very common is two channels per FIFO stemming from one I2S interface +#ifndef CFG_TUD_AUDIO_FUNC_1_N_TX_SUPP_SW_FIFO +#define CFG_TUD_AUDIO_FUNC_1_N_TX_SUPP_SW_FIFO 0 +#endif +#ifndef CFG_TUD_AUDIO_FUNC_2_N_TX_SUPP_SW_FIFO +#define CFG_TUD_AUDIO_FUNC_2_N_TX_SUPP_SW_FIFO 0 +#endif +#ifndef CFG_TUD_AUDIO_FUNC_3_N_TX_SUPP_SW_FIFO +#define CFG_TUD_AUDIO_FUNC_3_N_TX_SUPP_SW_FIFO 0 #endif -#ifndef CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_RX // bSubslotSize -#define CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_RX 1 +#ifndef CFG_TUD_AUDIO_FUNC_1_N_RX_SUPP_SW_FIFO +#define CFG_TUD_AUDIO_FUNC_1_N_RX_SUPP_SW_FIFO 0 +#endif +#ifndef CFG_TUD_AUDIO_FUNC_2_N_RX_SUPP_SW_FIFO +#define CFG_TUD_AUDIO_FUNC_2_N_RX_SUPP_SW_FIFO 0 +#endif +#ifndef CFG_TUD_AUDIO_FUNC_3_N_RX_SUPP_SW_FIFO +#define CFG_TUD_AUDIO_FUNC_3_N_RX_SUPP_SW_FIFO 0 #endif -#if CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_RX == 1 -#define CFG_TUD_AUDIO_RX_ITEMSIZE 1 -#elif CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_RX == 2 -#define CFG_TUD_AUDIO_RX_ITEMSIZE 2 -#else -#define CFG_TUD_AUDIO_RX_ITEMSIZE 4 +// Size of support FIFOs IN BYTES - if size > 0 there are as many FIFOs set up as CFG_TUD_AUDIO_FUNC_X_N_TX_SUPP_SW_FIFO and CFG_TUD_AUDIO_FUNC_X_N_RX_SUPP_SW_FIFO +#ifndef CFG_TUD_AUDIO_FUNC_1_TX_SUPP_SW_FIFO_SZ +#define CFG_TUD_AUDIO_FUNC_1_TX_SUPP_SW_FIFO_SZ 0 // FIFO size - minimum size: ceil(f_s/1000) * max(# of TX channels) / (# of TX support FIFOs) * max(# of bytes per sample) +#endif +#ifndef CFG_TUD_AUDIO_FUNC_2_TX_SUPP_SW_FIFO_SZ +#define CFG_TUD_AUDIO_FUNC_2_TX_SUPP_SW_FIFO_SZ 0 +#endif +#ifndef CFG_TUD_AUDIO_FUNC_3_TX_SUPP_SW_FIFO_SZ +#define CFG_TUD_AUDIO_FUNC_3_TX_SUPP_SW_FIFO_SZ 0 #endif +#ifndef CFG_TUD_AUDIO_FUNC_1_RX_SUPP_SW_FIFO_SZ +#define CFG_TUD_AUDIO_FUNC_1_RX_SUPP_SW_FIFO_SZ 0 // FIFO size - minimum size: ceil(f_s/1000) * max(# of RX channels) / (# of RX support FIFOs) * max(# of bytes per sample) +#endif +#ifndef CFG_TUD_AUDIO_FUNC_2_RX_SUPP_SW_FIFO_SZ +#define CFG_TUD_AUDIO_FUNC_2_RX_SUPP_SW_FIFO_SZ 0 +#endif +#ifndef CFG_TUD_AUDIO_FUNC_3_RX_SUPP_SW_FIFO_SZ +#define CFG_TUD_AUDIO_FUNC_3_RX_SUPP_SW_FIFO_SZ 0 #endif //static_assert(sizeof(tud_audio_desc_lengths) != CFG_TUD_AUDIO, "Supply audio function descriptor pack length!"); @@ -170,69 +360,70 @@ extern "C" { //--------------------------------------------------------------------+ bool tud_audio_n_mounted (uint8_t itf); -#if CFG_TUD_AUDIO_EPSIZE_OUT && CFG_TUD_AUDIO_RX_FIFO_SIZE -#if CFG_TUD_AUDIO_RX_FIFO_COUNT > 1 -uint16_t tud_audio_n_available (uint8_t itf, uint8_t channelId); -uint16_t tud_audio_n_read (uint8_t itf, uint8_t channelId, void* buffer, uint16_t bufsize); -void tud_audio_n_read_flush (uint8_t itf, uint8_t channelId); -#else -uint16_t tud_audio_n_available (uint8_t itf); -uint16_t tud_audio_n_read (uint8_t itf, void* buffer, uint16_t bufsize); -void tud_audio_n_read_flush (uint8_t itf); -#endif +#if CFG_TUD_AUDIO_ENABLE_EP_OUT && !CFG_TUD_AUDIO_ENABLE_DECODING +uint16_t tud_audio_n_available (uint8_t itf); +uint16_t tud_audio_n_read (uint8_t itf, void* buffer, uint16_t bufsize); +bool tud_audio_n_clear_ep_out_ff (uint8_t itf); // Delete all content in the EP OUT FIFO #endif -/* This function is intended for later use once EP buffers (at least for ISO EPs) are implemented as ring buffers -#if CFG_TUD_AUDIO_EPSIZE_IN && !CFG_TUD_AUDIO_TX_FIFO_SIZE -uint16_t tud_audio_n_write_ep_in_buffer(uint8_t itf, const void * data, uint16_t len) +#if CFG_TUD_AUDIO_ENABLE_EP_OUT && CFG_TUD_AUDIO_ENABLE_DECODING +bool tud_audio_n_clear_rx_support_ff (uint8_t itf, uint8_t channelId); // Delete all content in the support RX FIFOs +uint16_t tud_audio_n_available_support_ff (uint8_t itf, uint8_t channelId); +uint16_t tud_audio_n_read_support_ff (uint8_t itf, uint8_t channelId, void* buffer, uint16_t bufsize); #endif -*/ -#ifndef CFG_TUD_AUDIO_TX_FIFO_COUNT -#define CFG_TUD_AUDIO_TX_FIFO_COUNT 1 +#if CFG_TUD_AUDIO_ENABLE_EP_IN && !CFG_TUD_AUDIO_ENABLE_ENCODING +uint16_t tud_audio_n_write (uint8_t itf, const void * data, uint16_t len); +bool tud_audio_n_clear_ep_in_ff (uint8_t itf); // Delete all content in the EP IN FIFO #endif -#if CFG_TUD_AUDIO_EPSIZE_IN && CFG_TUD_AUDIO_TX_FIFO_SIZE -#if CFG_TUD_AUDIO_TX_FIFO_COUNT > 1 -uint16_t tud_audio_n_write (uint8_t itf, uint8_t channelId, const void * data, uint16_t len); -#else -uint16_t tud_audio_n_write (uint8_t itf, const void * data, uint16_t len); -#endif -uint16_t tud_audio_n_write_flush(uint8_t itf); +#if CFG_TUD_AUDIO_ENABLE_EP_IN && CFG_TUD_AUDIO_ENABLE_ENCODING +uint16_t tud_audio_n_flush_tx_support_ff (uint8_t itf); // Force all content in the support TX FIFOs to be written into EP SW FIFO +bool tud_audio_n_clear_tx_support_ff (uint8_t itf, uint8_t channelId); +uint16_t tud_audio_n_write_support_ff (uint8_t itf, uint8_t channelId, const void * data, uint16_t len); #endif -#if CFG_TUD_AUDIO_INT_CTR_EPSIZE_IN > 0 -uint16_t tud_audio_int_ctr_n_available (uint8_t itf); -uint16_t tud_audio_int_ctr_n_read (uint8_t itf, void* buffer, uint16_t bufsize); -void tud_audio_int_ctr_n_read_flush (uint8_t itf); -uint16_t tud_audio_int_ctr_n_write (uint8_t itf, uint8_t const* buffer, uint16_t bufsize); +#if CFG_TUD_AUDIO_INT_CTR_EPSIZE_IN +uint16_t tud_audio_int_ctr_n_write (uint8_t itf, uint8_t const* buffer, uint16_t len); #endif //--------------------------------------------------------------------+ // Application API (Interface0) //--------------------------------------------------------------------+ -static inline bool tud_audio_mounted (void); +static inline bool tud_audio_mounted (void); + +// RX API -#if CFG_TUD_AUDIO_EPSIZE_OUT && CFG_TUD_AUDIO_RX_FIFO_SIZE -static inline uint16_t tud_audio_available (void); -static inline uint16_t tud_audio_read (void* buffer, uint16_t bufsize); -static inline void tud_audio_read_flush (void); +#if CFG_TUD_AUDIO_ENABLE_EP_OUT && !CFG_TUD_AUDIO_ENABLE_DECODING +static inline uint16_t tud_audio_available (void); +static inline bool tud_audio_clear_ep_out_ff (void); // Delete all content in the EP OUT FIFO +static inline uint16_t tud_audio_read (void* buffer, uint16_t bufsize); #endif -#if CFG_TUD_AUDIO_EPSIZE_IN && CFG_TUD_AUDIO_TX_FIFO_SIZE -#if CFG_TUD_AUDIO_TX_FIFO_COUNT > 1 -static inline uint16_t tud_audio_write (uint8_t channelId, uint8_t const* buffer, uint16_t bufsize); -#else -static inline uint16_t tud_audio_write (uint8_t const* buffer, uint16_t bufsize); +#if CFG_TUD_AUDIO_ENABLE_EP_OUT && CFG_TUD_AUDIO_ENABLE_DECODING +static inline bool tud_audio_clear_rx_support_ff (uint8_t channelId); +static inline uint16_t tud_audio_available_support_ff (uint8_t channelId); +static inline uint16_t tud_audio_read_support_ff (uint8_t channelId, void* buffer, uint16_t bufsize); #endif + +// TX API + +#if CFG_TUD_AUDIO_ENABLE_EP_IN && !CFG_TUD_AUDIO_ENABLE_ENCODING +static inline uint16_t tud_audio_write (const void * data, uint16_t len); +static inline bool tud_audio_clear_ep_in_ff (void); #endif -#if CFG_TUD_AUDIO_INT_CTR_EPSIZE_IN > 0 -static inline uint32_t tud_audio_int_ctr_available (void); -static inline uint32_t tud_audio_int_ctr_read (void* buffer, uint32_t bufsize); -static inline void tud_audio_int_ctr_read_flush (void); -static inline uint32_t tud_audio_int_ctr_write (uint8_t const* buffer, uint32_t bufsize); +#if CFG_TUD_AUDIO_ENABLE_EP_IN && CFG_TUD_AUDIO_ENABLE_ENCODING +static inline uint16_t tud_audio_flush_tx_support_ff (void); +static inline uint16_t tud_audio_clear_tx_support_ff (uint8_t channelId); +static inline uint16_t tud_audio_write_support_ff (uint8_t channelId, const void * data, uint16_t len); +#endif + +// INT CTR API + +#if CFG_TUD_AUDIO_INT_CTR_EPSIZE_IN +static inline uint16_t tud_audio_int_ctr_write (uint8_t const* buffer, uint16_t len); #endif // Buffer control EP data and schedule a transmit @@ -247,26 +438,28 @@ bool tud_audio_buffer_and_schedule_control_xfer(uint8_t rhport, tusb_control_req // Application Callback API (weak is optional) //--------------------------------------------------------------------+ -#if CFG_TUD_AUDIO_EPSIZE_IN +#if CFG_TUD_AUDIO_ENABLE_EP_IN TU_ATTR_WEAK bool tud_audio_tx_done_pre_load_cb(uint8_t rhport, uint8_t itf, uint8_t ep_in, uint8_t cur_alt_setting); TU_ATTR_WEAK bool tud_audio_tx_done_post_load_cb(uint8_t rhport, uint16_t n_bytes_copied, uint8_t itf, uint8_t ep_in, uint8_t cur_alt_setting); #endif -#if CFG_TUD_AUDIO_EPSIZE_OUT -TU_ATTR_WEAK bool tud_audio_rx_done_cb(uint8_t rhport, uint8_t * buffer, uint16_t bufsize); +#if CFG_TUD_AUDIO_ENABLE_EP_OUT +TU_ATTR_WEAK bool tud_audio_rx_done_pre_read_cb(uint8_t rhport, uint16_t n_bytes_received, uint8_t itf, uint8_t ep_out, uint8_t cur_alt_setting); +TU_ATTR_WEAK bool tud_audio_rx_done_post_read_cb(uint8_t rhport, uint16_t n_bytes_received, uint8_t itf, uint8_t ep_out, uint8_t cur_alt_setting); #endif -#if CFG_TUD_AUDIO_EPSIZE_OUT > 0 && CFG_TUD_AUDIO_ENABLE_FEEDBACK_EP +#if CFG_TUD_AUDIO_ENABLE_EP_OUT && CFG_TUD_AUDIO_ENABLE_FEEDBACK_EP TU_ATTR_WEAK bool tud_audio_fb_done_cb(uint8_t rhport); // User code should call this function with feedback value in 16.16 format for FS and HS. // Value will be corrected for FS to 10.14 format automatically. // (see Universal Serial Bus Specification Revision 2.0 5.12.4.2). // Feedback value will be sent at FB endpoint interval till it's changed. -bool tud_audio_fb_set(uint8_t rhport, uint32_t feedback); +bool tud_audio_n_fb_set(uint8_t itf, uint32_t feedback); +static inline bool tud_audio_fb_set(uint32_t feedback); #endif #if CFG_TUD_AUDIO_INT_CTR_EPSIZE_IN -TU_ATTR_WEAK bool tud_audio_int_ctr_done_cb(uint8_t rhport, uint16_t * n_bytes_copied); +TU_ATTR_WEAK bool tud_audio_int_ctr_done_cb(uint8_t rhport, uint16_t n_bytes_copied); #endif // Invoked when audio set interface request received @@ -302,93 +495,103 @@ static inline bool tud_audio_mounted(void) return tud_audio_n_mounted(0); } -#if CFG_TUD_AUDIO_EPSIZE_IN -#if CFG_TUD_AUDIO_TX_FIFO_SIZE && CFG_TUD_AUDIO_TX_FIFO_COUNT > 1 -static inline uint16_t tud_audio_write (uint8_t channelId, uint8_t const* buffer, uint16_t n_bytes) // Short version if only one audio function is used +// RX API + +#if CFG_TUD_AUDIO_ENABLE_EP_OUT && !CFG_TUD_AUDIO_ENABLE_DECODING + +static inline uint16_t tud_audio_available(void) { - return tud_audio_n_write(0, channelId, buffer, n_bytes); + return tud_audio_n_available(0); } -#else -static inline uint16_t tud_audio_write (uint8_t const* buffer, uint16_t n_bytes) // Short version if only one audio function is used + +static inline uint16_t tud_audio_read(void* buffer, uint16_t bufsize) { - return tud_audio_n_write(0, buffer, n_bytes); + return tud_audio_n_read(0, buffer, bufsize); } -#endif -static inline uint16_t tud_audio_write_flush (void) // Short version if only one audio function is used +static inline bool tud_audio_clear_ep_out_ff(void) { -#if CFG_TUD_AUDIO_TX_FIFO_SIZE - return tud_audio_n_write_flush(0); -#else - return 0; -#endif + return tud_audio_n_clear_ep_out_ff(0); } -#endif // CFG_TUD_AUDIO_EPSIZE_IN && CFG_TUD_AUDIO_TX_FIFO_SIZE -#if CFG_TUD_AUDIO_EPSIZE_OUT && CFG_TUD_AUDIO_RX_FIFO_SIZE -#if CFG_TUD_AUDIO_RX_FIFO_COUNT > 1 -static inline uint16_t tud_audio_available(uint8_t channelId) +#endif + +#if CFG_TUD_AUDIO_ENABLE_EP_OUT && CFG_TUD_AUDIO_ENABLE_DECODING + +static inline bool tud_audio_clear_rx_support_ff(uint8_t channelId) { - return tud_audio_n_available(0, channelId); + return tud_audio_n_clear_rx_support_ff(0, channelId); } -static inline uint16_t tud_audio_read(uint8_t channelId, void* buffer, uint16_t bufsize) +static inline uint16_t tud_audio_available_support_ff(uint8_t channelId) { - return tud_audio_n_read(0, channelId, buffer, bufsize); + return tud_audio_n_available_support_ff(0, channelId); } -static inline void tud_audio_read_flush(uint8_t channelId) +static inline uint16_t tud_audio_read_support_ff(uint8_t channelId, void* buffer, uint16_t bufsize) { - tud_audio_n_read_flush(0, channelId); + return tud_audio_n_read_support_ff(0, channelId, buffer, bufsize); } -#else -static inline uint16_t tud_audio_available(void) + +#endif + +// TX API + +#if CFG_TUD_AUDIO_ENABLE_EP_IN && !CFG_TUD_AUDIO_ENABLE_ENCODING + +static inline uint16_t tud_audio_write(const void * data, uint16_t len) { - return tud_audio_n_available(0); + return tud_audio_n_write(0, data, len); } -static inline uint16_t tud_audio_read(void *buffer, uint16_t bufsize) +static inline bool tud_audio_clear_ep_in_ff(void) { - return tud_audio_n_read(0, buffer, bufsize); + return tud_audio_n_clear_ep_in_ff(0); } -static inline void tud_audio_read_flush(void) +#endif + +#if CFG_TUD_AUDIO_ENABLE_EP_IN && CFG_TUD_AUDIO_ENABLE_ENCODING + +static inline uint16_t tud_audio_flush_tx_support_ff(void) { - tud_audio_n_read_flush(0); + return tud_audio_n_flush_tx_support_ff(0); } -#endif -#endif -#if CFG_TUD_AUDIO_INT_CTR_EPSIZE_IN > 0 -static inline uint16_t tud_audio_int_ctr_available(void) +static inline uint16_t tud_audio_clear_tx_support_ff(uint8_t channelId) { - return tud_audio_int_ctr_n_available(0); + return tud_audio_n_clear_tx_support_ff(0, channelId); } -static inline uint16_t tud_audio_int_ctr_read(void* buffer, uint16_t bufsize) +static inline uint16_t tud_audio_write_support_ff(uint8_t channelId, const void * data, uint16_t len) { - return tud_audio_int_ctr_n_read(0, buffer, bufsize); + return tud_audio_n_write_support_ff(0, channelId, data, len); } -static inline void tud_audio_int_ctr_read_flush(void) +#endif + +#if CFG_TUD_AUDIO_INT_CTR_EPSIZE_IN +static inline uint16_t tud_audio_int_ctr_write(uint8_t const* buffer, uint16_t len) { - return tud_audio_int_ctr_n_read_flush(0); + return tud_audio_int_ctr_n_write(0, buffer, len); } +#endif -static inline uint16_t tud_audio_int_ctr_write(uint8_t const* buffer, uint16_t bufsize) +#if CFG_TUD_AUDIO_ENABLE_EP_OUT && CFG_TUD_AUDIO_ENABLE_FEEDBACK_EP +static inline bool tud_audio_fb_set(uint32_t feedback) { - return tud_audio_int_ctr_n_write(0, buffer, bufsize); + return tud_audio_n_fb_set(0, feedback); } #endif //--------------------------------------------------------------------+ // Internal Class Driver API //--------------------------------------------------------------------+ -void audiod_init (void); -void audiod_reset (uint8_t rhport); -uint16_t audiod_open (uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); -bool audiod_control_xfer_cb (uint8_t rhport, uint8_t stage, tusb_control_request_t const * request); -bool audiod_xfer_cb (uint8_t rhport, uint8_t edpt_addr, xfer_result_t result, uint32_t xferred_bytes); +void audiod_init (void); +void audiod_reset (uint8_t rhport); +uint16_t audiod_open (uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); +bool audiod_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request); +bool audiod_xfer_cb (uint8_t rhport, uint8_t edpt_addr, xfer_result_t result, uint32_t xferred_bytes); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_fifo.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_fifo.h index 29437849649..b2d0b5be91a 100644 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_fifo.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_fifo.h @@ -2,6 +2,7 @@ * The MIT License (MIT) * * Copyright (c) 2019 Ha Thach (tinyusb.org) + * Copyright (c) 2020 Reinhard Panhuber - rework to unmasked pointers * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -52,10 +53,10 @@ extern "C" { #endif #if CFG_FIFO_MUTEX +#include "osal/osal.h" #define tu_fifo_mutex_t osal_mutex_t #endif - /** \struct tu_fifo_t * \brief Simple Circular FIFO */ @@ -66,14 +67,15 @@ typedef struct uint16_t item_size ; ///< size of each item bool overwritable ; - uint16_t max_pointer_idx ; ///< maximum absolute pointer index uint16_t non_used_index_space ; ///< required for non-power-of-two buffer length + uint16_t max_pointer_idx ; ///< maximum absolute pointer index volatile uint16_t wr_idx ; ///< write pointer volatile uint16_t rd_idx ; ///< read pointer #if CFG_FIFO_MUTEX - tu_fifo_mutex_t mutex; + tu_fifo_mutex_t mutex_wr; + tu_fifo_mutex_t mutex_rd; #endif } tu_fifo_t; @@ -85,29 +87,33 @@ typedef struct .item_size = sizeof(_type), \ .overwritable = _overwritable, \ .max_pointer_idx = 2*(_depth)-1, \ - .non_used_index_space = UINT16_MAX - (2*(_depth)-1) \ + .non_used_index_space = UINT16_MAX - (2*(_depth)-1), \ } #define TU_FIFO_DEF(_name, _depth, _type, _overwritable) \ uint8_t _name##_buf[_depth*sizeof(_type)]; \ tu_fifo_t _name = TU_FIFO_INIT(_name##_buf, _depth, _type, _overwritable) + bool tu_fifo_set_overwritable(tu_fifo_t *f, bool overwritable); bool tu_fifo_clear(tu_fifo_t *f); bool tu_fifo_config(tu_fifo_t *f, void* buffer, uint16_t depth, uint16_t item_size, bool overwritable); #if CFG_FIFO_MUTEX -static inline void tu_fifo_config_mutex(tu_fifo_t *f, tu_fifo_mutex_t mutex_hdl) +static inline void tu_fifo_config_mutex(tu_fifo_t *f, tu_fifo_mutex_t write_mutex_hdl, tu_fifo_mutex_t read_mutex_hdl) { - f->mutex = mutex_hdl; + f->mutex_wr = write_mutex_hdl; + f->mutex_rd = read_mutex_hdl; } #endif bool tu_fifo_write (tu_fifo_t* f, void const * p_data); -uint16_t tu_fifo_write_n (tu_fifo_t* f, void const * p_data, uint16_t count); +uint16_t tu_fifo_write_n (tu_fifo_t* f, void const * p_data, uint16_t n); +uint16_t tu_fifo_write_n_const_addr_full_words (tu_fifo_t* f, const void * data, uint16_t n); bool tu_fifo_read (tu_fifo_t* f, void * p_buffer); -uint16_t tu_fifo_read_n (tu_fifo_t* f, void * p_buffer, uint16_t count); +uint16_t tu_fifo_read_n (tu_fifo_t* f, void * p_buffer, uint16_t n); +uint16_t tu_fifo_read_n_const_addr_full_words (tu_fifo_t* f, void * buffer, uint16_t n); bool tu_fifo_peek_at (tu_fifo_t* f, uint16_t pos, void * p_buffer); uint16_t tu_fifo_peek_at_n (tu_fifo_t* f, uint16_t pos, void * p_buffer, uint16_t n); @@ -116,7 +122,7 @@ uint16_t tu_fifo_count (tu_fifo_t* f); bool tu_fifo_empty (tu_fifo_t* f); bool tu_fifo_full (tu_fifo_t* f); uint16_t tu_fifo_remaining (tu_fifo_t* f); -bool tu_fifo_overflowed (tu_fifo_t* f); +bool tu_fifo_overflowed (tu_fifo_t* f); void tu_fifo_correct_read_pointer (tu_fifo_t* f); // Pointer modifications intended to be used in combinations with DMAs. @@ -124,6 +130,13 @@ void tu_fifo_correct_read_pointer (tu_fifo_t* f); void tu_fifo_advance_write_pointer (tu_fifo_t *f, uint16_t n); void tu_fifo_advance_read_pointer (tu_fifo_t *f, uint16_t n); +// If you want to read/write from/to the FIFO by use of a DMA, you may need to conduct two copies to handle a possible wrapping part +// This functions deliver a pointer to start reading/writing from/to and a valid linear length along which no wrap occurs. +// In case not all of your data is available within one read/write, update the read/write pointer by +// tu_fifo_advance_read_pointer()/tu_fifo_advance_write_pointer and conduct a second read/write operation +uint16_t tu_fifo_get_linear_read_info (tu_fifo_t *f, uint16_t offset, void **ptr, uint16_t n); +uint16_t tu_fifo_get_linear_write_info (tu_fifo_t *f, uint16_t offset, void **ptr, uint16_t n); + static inline bool tu_fifo_peek(tu_fifo_t* f, void * p_buffer) { return tu_fifo_peek_at(f, 0, p_buffer); diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/dcd.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/dcd.h index b7e5a8da078..1e5b3ff1e53 100644 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/dcd.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/dcd.h @@ -32,6 +32,7 @@ #define _TUSB_DCD_H_ #include "common/tusb_common.h" +#include "common/tusb_fifo.h" #ifdef __cplusplus extern "C" { @@ -124,20 +125,24 @@ void dcd_disconnect(uint8_t rhport) TU_ATTR_WEAK; void dcd_edpt0_status_complete(uint8_t rhport, tusb_control_request_t const * request) TU_ATTR_WEAK; // Configure endpoint's registers according to descriptor -bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc); +bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc); // Close an endpoint. // Since it is weak, caller must TU_ASSERT this function's existence before calling it. -void dcd_edpt_close (uint8_t rhport, uint8_t ep_addr) TU_ATTR_WEAK; +void dcd_edpt_close (uint8_t rhport, uint8_t ep_addr) TU_ATTR_WEAK; // Submit a transfer, When complete dcd_event_xfer_complete() is invoked to notify the stack -bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes); +bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes); + +// Submit an transfer using fifo, When complete dcd_event_xfer_complete() is invoked to notify the stack +// This API is optional, may be useful for register-based for transferring data. +bool dcd_edpt_xfer_fifo (uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16_t total_bytes) TU_ATTR_WEAK; // Stall endpoint -void dcd_edpt_stall (uint8_t rhport, uint8_t ep_addr); +void dcd_edpt_stall (uint8_t rhport, uint8_t ep_addr); // clear stall, data toggle is also reset to DATA0 -void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr); +void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr); //--------------------------------------------------------------------+ // Event API (implemented by stack) diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/usbd.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/usbd.h index 56615b08196..7c50a6db0de 100644 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/usbd.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/usbd.h @@ -353,6 +353,10 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb #define TUD_AUDIO_DESC_FEATURE_UNIT_TWO_CHANNEL_LEN (6+(2+1)*4) #define TUD_AUDIO_DESC_FEATURE_UNIT_TWO_CHANNEL(_unitid, _srcid, _ctrlch0master, _ctrlch1, _ctrlch2, _stridx) \ TUD_AUDIO_DESC_FEATURE_UNIT_TWO_CHANNEL_LEN, TUSB_DESC_CS_INTERFACE, AUDIO_CS_AC_INTERFACE_FEATURE_UNIT, _unitid, _srcid, U32_TO_U8S_LE(_ctrlch0master), U32_TO_U8S_LE(_ctrlch1), U32_TO_U8S_LE(_ctrlch2), _stridx +// 4 - Channels +#define TUD_AUDIO_DESC_FEATURE_UNIT_FOUR_CHANNEL_LEN (6+(4+1)*4) +#define TUD_AUDIO_DESC_FEATURE_UNIT_FOUR_CHANNEL(_unitid, _srcid, _ctrlch0master, _ctrlch1, _ctrlch2, _ctrlch3, _ctrlch4, _stridx) \ + TUD_AUDIO_DESC_FEATURE_UNIT_FOUR_CHANNEL_LEN, TUSB_DESC_CS_INTERFACE, AUDIO_CS_AC_INTERFACE_FEATURE_UNIT, _unitid, _srcid, U32_TO_U8S_LE(_ctrlch0master), U32_TO_U8S_LE(_ctrlch1), U32_TO_U8S_LE(_ctrlch2), U32_TO_U8S_LE(_ctrlch3), U32_TO_U8S_LE(_ctrlch4), _stridx // For more channels, add definitions here @@ -389,7 +393,7 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb // AUDIO simple descriptor (UAC2) for 1 microphone input // - 1 Input Terminal, 1 Feature Unit (Mute and Volume Control), 1 Output Terminal, 1 Clock Source -#define TUD_AUDIO_MIC_DESC_LEN (TUD_AUDIO_DESC_IAD_LEN\ +#define TUD_AUDIO_MIC_ONE_CH_DESC_LEN (TUD_AUDIO_DESC_IAD_LEN\ + TUD_AUDIO_DESC_STD_AC_LEN\ + TUD_AUDIO_DESC_CS_AC_LEN\ + TUD_AUDIO_DESC_CLK_SRC_LEN\ @@ -403,9 +407,9 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb + TUD_AUDIO_DESC_STD_AS_ISO_EP_LEN\ + TUD_AUDIO_DESC_CS_AS_ISO_EP_LEN) -#define TUD_AUDIO_MIC_DESC_N_AS_INT 1 // Number of AS interfaces +#define TUD_AUDIO_MIC_ONE_CH_DESC_N_AS_INT 1 // Number of AS interfaces -#define TUD_AUDIO_MIC_DESCRIPTOR(_itfnum, _stridx, _nBytesPerSample, _nBitsUsedPerSample, _epin, _epsize) \ +#define TUD_AUDIO_MIC_ONE_CH_DESCRIPTOR(_itfnum, _stridx, _nBytesPerSample, _nBitsUsedPerSample, _epin, _epsize) \ /* Standard Interface Association Descriptor (IAD) */\ TUD_AUDIO_DESC_IAD(/*_firstitfs*/ _itfnum, /*_nitfs*/ 0x02, /*_stridx*/ 0x00),\ /* Standard AC Interface Descriptor(4.7.1) */\ @@ -435,6 +439,55 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb /* Class-Specific AS Isochronous Audio Data Endpoint Descriptor(4.10.1.2) */\ TUD_AUDIO_DESC_CS_AS_ISO_EP(/*_attr*/ AUDIO_CS_AS_ISO_DATA_EP_ATT_NON_MAX_PACKETS_OK, /*_ctrl*/ AUDIO_CTRL_NONE, /*_lockdelayunit*/ AUDIO_CS_AS_ISO_DATA_EP_LOCK_DELAY_UNIT_UNDEFINED, /*_lockdelay*/ 0x0000) +// AUDIO simple descriptor (UAC2) for 4 microphone input +// - 1 Input Terminal, 1 Feature Unit (Mute and Volume Control), 1 Output Terminal, 1 Clock Source + +#define TUD_AUDIO_MIC_FOUR_CH_DESC_LEN (TUD_AUDIO_DESC_IAD_LEN\ + + TUD_AUDIO_DESC_STD_AC_LEN\ + + TUD_AUDIO_DESC_CS_AC_LEN\ + + TUD_AUDIO_DESC_CLK_SRC_LEN\ + + TUD_AUDIO_DESC_INPUT_TERM_LEN\ + + TUD_AUDIO_DESC_OUTPUT_TERM_LEN\ + + TUD_AUDIO_DESC_FEATURE_UNIT_FOUR_CHANNEL_LEN\ + + TUD_AUDIO_DESC_STD_AS_INT_LEN\ + + TUD_AUDIO_DESC_STD_AS_INT_LEN\ + + TUD_AUDIO_DESC_CS_AS_INT_LEN\ + + TUD_AUDIO_DESC_TYPE_I_FORMAT_LEN\ + + TUD_AUDIO_DESC_STD_AS_ISO_EP_LEN\ + + TUD_AUDIO_DESC_CS_AS_ISO_EP_LEN) + +#define TUD_AUDIO_MIC_FOUR_CH_DESC_N_AS_INT 1 // Number of AS interfaces + +#define TUD_AUDIO_MIC_FOUR_CH_DESCRIPTOR(_itfnum, _stridx, _nBytesPerSample, _nBitsUsedPerSample, _epin, _epsize) \ + /* Standard Interface Association Descriptor (IAD) */\ + TUD_AUDIO_DESC_IAD(/*_firstitfs*/ _itfnum, /*_nitfs*/ 0x02, /*_stridx*/ 0x00),\ + /* Standard AC Interface Descriptor(4.7.1) */\ + TUD_AUDIO_DESC_STD_AC(/*_itfnum*/ _itfnum, /*_nEPs*/ 0x00, /*_stridx*/ _stridx),\ + /* Class-Specific AC Interface Header Descriptor(4.7.2) */\ + TUD_AUDIO_DESC_CS_AC(/*_bcdADC*/ 0x0200, /*_category*/ AUDIO_FUNC_MICROPHONE, /*_totallen*/ TUD_AUDIO_DESC_CLK_SRC_LEN+TUD_AUDIO_DESC_INPUT_TERM_LEN+TUD_AUDIO_DESC_OUTPUT_TERM_LEN+TUD_AUDIO_DESC_FEATURE_UNIT_FOUR_CHANNEL_LEN, /*_ctrl*/ AUDIO_CS_AS_INTERFACE_CTRL_LATENCY_POS),\ + /* Clock Source Descriptor(4.7.2.1) */\ + TUD_AUDIO_DESC_CLK_SRC(/*_clkid*/ 0x04, /*_attr*/ AUDIO_CLOCK_SOURCE_ATT_INT_FIX_CLK, /*_ctrl*/ (AUDIO_CTRL_R << AUDIO_CLOCK_SOURCE_CTRL_CLK_FRQ_POS), /*_assocTerm*/ 0x01, /*_stridx*/ 0x00),\ + /* Input Terminal Descriptor(4.7.2.4) */\ + TUD_AUDIO_DESC_INPUT_TERM(/*_termid*/ 0x01, /*_termtype*/ AUDIO_TERM_TYPE_IN_GENERIC_MIC, /*_assocTerm*/ 0x03, /*_clkid*/ 0x04, /*_nchannelslogical*/ 0x04, /*_channelcfg*/ AUDIO_CHANNEL_CONFIG_NON_PREDEFINED, /*_idxchannelnames*/ 0x00, /*_ctrl*/ AUDIO_CTRL_R << AUDIO_IN_TERM_CTRL_CONNECTOR_POS, /*_stridx*/ 0x00),\ + /* Output Terminal Descriptor(4.7.2.5) */\ + TUD_AUDIO_DESC_OUTPUT_TERM(/*_termid*/ 0x03, /*_termtype*/ AUDIO_TERM_TYPE_USB_STREAMING, /*_assocTerm*/ 0x01, /*_srcid*/ 0x02, /*_clkid*/ 0x04, /*_ctrl*/ 0x0000, /*_stridx*/ 0x00),\ + /* Feature Unit Descriptor(4.7.2.8) */\ + TUD_AUDIO_DESC_FEATURE_UNIT_FOUR_CHANNEL(/*_unitid*/ 0x02, /*_srcid*/ 0x01, /*_ctrlch0master*/ AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_MUTE_POS | AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_VOLUME_POS, /*_ctrlch1*/ AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_MUTE_POS | AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_VOLUME_POS, /*_ctrlch2*/ AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_MUTE_POS | AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_VOLUME_POS, /*_ctrlch3*/ AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_MUTE_POS | AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_VOLUME_POS, /*_ctrlch4*/ AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_MUTE_POS | AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_VOLUME_POS, /*_stridx*/ 0x00),\ + /* Standard AS Interface Descriptor(4.9.1) */\ + /* Interface 1, Alternate 0 - default alternate setting with 0 bandwidth */\ + TUD_AUDIO_DESC_STD_AS_INT(/*_itfnum*/ (uint8_t)((_itfnum)+1), /*_altset*/ 0x00, /*_nEPs*/ 0x00, /*_stridx*/ 0x00),\ + /* Standard AS Interface Descriptor(4.9.1) */\ + /* Interface 1, Alternate 1 - alternate interface for data streaming */\ + TUD_AUDIO_DESC_STD_AS_INT(/*_itfnum*/ (uint8_t)((_itfnum)+1), /*_altset*/ 0x01, /*_nEPs*/ 0x01, /*_stridx*/ 0x00),\ + /* Class-Specific AS Interface Descriptor(4.9.2) */\ + TUD_AUDIO_DESC_CS_AS_INT(/*_termid*/ 0x03, /*_ctrl*/ AUDIO_CTRL_NONE, /*_formattype*/ AUDIO_FORMAT_TYPE_I, /*_formats*/ AUDIO_DATA_FORMAT_TYPE_I_PCM, /*_nchannelsphysical*/ 0x04, /*_channelcfg*/ AUDIO_CHANNEL_CONFIG_NON_PREDEFINED, /*_stridx*/ 0x00),\ + /* Type I Format Type Descriptor(2.3.1.6 - Audio Formats) */\ + TUD_AUDIO_DESC_TYPE_I_FORMAT(_nBytesPerSample, _nBitsUsedPerSample),\ + /* Standard AS Isochronous Audio Data Endpoint Descriptor(4.10.1.1) */\ + TUD_AUDIO_DESC_STD_AS_ISO_EP(/*_ep*/ _epin, /*_attr*/ (TUSB_XFER_ISOCHRONOUS | TUSB_ISO_EP_ATT_ASYNCHRONOUS | TUSB_ISO_EP_ATT_DATA), /*_maxEPsize*/ _epsize, /*_interval*/ (CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 0x04 : 0x01),\ + /* Class-Specific AS Isochronous Audio Data Endpoint Descriptor(4.10.1.2) */\ + TUD_AUDIO_DESC_CS_AS_ISO_EP(/*_attr*/ AUDIO_CS_AS_ISO_DATA_EP_ATT_NON_MAX_PACKETS_OK, /*_ctrl*/ AUDIO_CTRL_NONE, /*_lockdelayunit*/ AUDIO_CS_AS_ISO_DATA_EP_LOCK_DELAY_UNIT_UNDEFINED, /*_lockdelay*/ 0x0000) + // AUDIO simple descriptor (UAC2) for mono speaker // - 1 Input Terminal, 2 Feature Unit (Mute and Volume Control), 3 Output Terminal, 4 Clock Source diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/usbd_pvt.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/usbd_pvt.h index 212c3a202af..412a97a5d28 100644 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/usbd_pvt.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/usbd_pvt.h @@ -72,6 +72,9 @@ void usbd_edpt_close(uint8_t rhport, uint8_t ep_addr); // Submit a usb transfer bool usbd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes); +// Submit a usb ISO transfer by use of a FIFO (ring buffer) - all bytes in FIFO get transmitted +bool usbd_edpt_iso_xfer(uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16_t total_bytes); + // Claim an endpoint before submitting a transfer. // If caller does not make any transfer, it must release endpoint for others. bool usbd_edpt_claim(uint8_t rhport, uint8_t ep_addr); diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/osal/osal_pico.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/osal/osal_pico.h index c277af27172..bae1217eba8 100644 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/osal/osal_pico.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/osal/osal_pico.h @@ -143,7 +143,7 @@ static inline bool osal_queue_receive(osal_queue_t qhdl, void* data) // TODO: revisit... docs say that mutexes are never used from IRQ context, // however osal_queue_recieve may be. therefore my assumption is that // the fifo mutex is not populated for queues used from an IRQ context - assert(!qhdl->ff.mutex); + //assert(!qhdl->ff.mutex); _osal_q_lock(qhdl); bool success = tu_fifo_read(&qhdl->ff, data); @@ -157,7 +157,7 @@ static inline bool osal_queue_send(osal_queue_t qhdl, void const * data, bool in // TODO: revisit... docs say that mutexes are never used from IRQ context, // however osal_queue_recieve may be. therefore my assumption is that // the fifo mutex is not populated for queues used from an IRQ context - assert(!qhdl->ff.mutex); + //assert(!qhdl->ff.mutex); _osal_q_lock(qhdl); bool success = tu_fifo_write(&qhdl->ff, data); diff --git a/tools/sdk/esp32s2/include/config/sdkconfig.h b/tools/sdk/esp32s2/include/config/sdkconfig.h index 84ccd770a9e..fc425af32a3 100644 --- a/tools/sdk/esp32s2/include/config/sdkconfig.h +++ b/tools/sdk/esp32s2/include/config/sdkconfig.h @@ -145,8 +145,6 @@ #define CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP 1 #define CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL 32768 #define CONFIG_ESP32S2_TRACEMEM_RESERVE_DRAM 0x0 -#define CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES_TWO 1 -#define CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES 2 #define CONFIG_ESP32S2_ULP_COPROC_RESERVE_MEM 0 #define CONFIG_ESP32S2_DEBUG_OCDAWARE 1 #define CONFIG_ESP32S2_BROWNOUT_DET 1 @@ -173,6 +171,8 @@ #define CONFIG_ESP_HTTPS_SERVER_ENABLE 1 #define CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA 1 #define CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP 1 +#define CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES_TWO 1 +#define CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES 2 #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 @@ -329,8 +329,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 @@ -551,5 +549,5 @@ #define CONFIG_TOOLPREFIX CONFIG_SDK_TOOLPREFIX #define CONFIG_UDP_RECVMBOX_SIZE CONFIG_LWIP_UDP_RECVMBOX_SIZE #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" diff --git a/tools/sdk/esp32s2/include/driver/include/driver/dedic_gpio.h b/tools/sdk/esp32s2/include/driver/include/driver/dedic_gpio.h index f7d9b4a6ccb..f381e2c64b0 100644 --- a/tools/sdk/esp32s2/include/driver/include/driver/dedic_gpio.h +++ b/tools/sdk/esp32s2/include/driver/include/driver/dedic_gpio.h @@ -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 diff --git a/tools/sdk/esp32s2/include/driver/include/driver/gpio.h b/tools/sdk/esp32s2/include/driver/include/driver/gpio.h index c166ffa2791..aac81566fcc 100644 --- a/tools/sdk/esp32s2/include/driver/include/driver/gpio.h +++ b/tools/sdk/esp32s2/include/driver/include/driver/gpio.h @@ -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 diff --git a/tools/sdk/esp32s2/include/driver/include/driver/i2c.h b/tools/sdk/esp32s2/include/driver/include/driver/i2c.h index 30488fc570d..a2076cc459d 100644 --- a/tools/sdk/esp32s2/include/driver/include/driver/i2c.h +++ b/tools/sdk/esp32s2/include/driver/include/driver/i2c.h @@ -33,9 +33,39 @@ extern "C" { #define I2C_APB_CLK_FREQ APB_CLK_FREQ /*!< I2C source clock is APB clock, 80MHz */ +#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 */ -#define I2C_NUM_MAX (SOC_I2C_NUM) /*!< I2C port max */ +#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 */ diff --git a/tools/sdk/esp32s2/include/driver/include/driver/i2s.h b/tools/sdk/esp32s2/include/driver/include/driver/i2s.h index e5968ad3f71..6b53db68a2a 100644 --- a/tools/sdk/esp32s2/include/driver/include/driver/i2s.h +++ b/tools/sdk/esp32s2/include/driver/include/driver/i2s.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/driver/include/driver/rtc_io.h b/tools/sdk/esp32s2/include/driver/include/driver/rtc_io.h index ea8878223cd..4cdcf74ba48 100644 --- a/tools/sdk/esp32s2/include/driver/include/driver/rtc_io.h +++ b/tools/sdk/esp32s2/include/driver/include/driver/rtc_io.h @@ -17,10 +17,12 @@ #include #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 * diff --git a/tools/sdk/esp32s2/include/driver/include/driver/sdspi_host.h b/tools/sdk/esp32s2/include/driver/include/driver/sdspi_host.h index 064c68ccca5..860ba1bfed4 100644 --- a/tools/sdk/esp32s2/include/driver/include/driver/sdspi_host.h +++ b/tools/sdk/esp32s2/include/driver/include/driver/sdspi_host.h @@ -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. diff --git a/tools/sdk/esp32s2/include/driver/include/driver/spi_common.h b/tools/sdk/esp32s2/include/driver/include/driver/spi_common.h index 05d7d2c7765..5fee265c0ad 100644 --- a/tools/sdk/esp32s2/include/driver/include/driver/spi_common.h +++ b/tools/sdk/esp32s2/include/driver/include/driver/spi_common.h @@ -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 diff --git a/tools/sdk/esp32s2/include/driver/include/driver/spi_slave.h b/tools/sdk/esp32s2/include/driver/include/driver/spi_slave.h index a970159f473..f03104bbc4d 100644 --- a/tools/sdk/esp32s2/include/driver/include/driver/spi_slave.h +++ b/tools/sdk/esp32s2/include/driver/include/driver/spi_slave.h @@ -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 diff --git a/tools/sdk/esp32s2/include/driver/include/esp_private/gpio.h b/tools/sdk/esp32s2/include/driver/include/esp_private/gpio.h new file mode 100644 index 00000000000..1c4811393c0 --- /dev/null +++ b/tools/sdk/esp32s2/include/driver/include/esp_private/gpio.h @@ -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 + +#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 diff --git a/tools/sdk/esp32s2/include/esp32s2/include/esp32s2/memprot.h b/tools/sdk/esp32s2/include/esp32s2/include/esp32s2/memprot.h index e86ebbe351a..c63fb395e6d 100644 --- a/tools/sdk/esp32s2/include/esp32s2/include/esp32s2/memprot.h +++ b/tools/sdk/esp32s2/include/esp32s2/include/esp32s2/memprot.h @@ -26,6 +26,32 @@ extern "C" { #endif +//convenient constants for better code readabilty +#define RD_ENA true +#define RD_DIS false +#define WR_ENA true +#define WR_DIS false +#define EX_ENA true +#define EX_DIS false +#define RD_LOW_ENA true +#define RD_LOW_DIS false +#define WR_LOW_ENA true +#define WR_LOW_DIS false +#define EX_LOW_ENA true +#define EX_LOW_DIS false +#define RD_HIGH_ENA true +#define RD_HIGH_DIS false +#define WR_HIGH_ENA true +#define WR_HIGH_DIS false +#define EX_HIGH_ENA true +#define EX_HIGH_DIS false +#define PANIC_HNDL_ON true +#define PANIC_HNDL_OFF false +#define MEMPROT_LOCK true +#define MEMPROT_UNLOCK false +#define DEF_SPLIT_LINE NULL + +//memory range types typedef enum { MEMPROT_NONE = 0x00000000, MEMPROT_IRAM0_SRAM = 0x00000001, //0x40020000-0x4006FFFF, RWX diff --git a/tools/sdk/esp32s2/include/esp_http_client/include/esp_http_client.h b/tools/sdk/esp32s2/include/esp_http_client/include/esp_http_client.h index ee19f70cd7a..249eb217baf 100644 --- a/tools/sdk/esp32s2/include/esp_http_client/include/esp_http_client.h +++ b/tools/sdk/esp32s2/include/esp_http_client/include/esp_http_client.h @@ -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) */ diff --git a/tools/sdk/esp32s2/include/esp_system/include/esp_async_memcpy.h b/tools/sdk/esp32s2/include/esp_hw_support/include/esp_async_memcpy.h similarity index 100% rename from tools/sdk/esp32s2/include/esp_system/include/esp_async_memcpy.h rename to tools/sdk/esp32s2/include/esp_hw_support/include/esp_async_memcpy.h diff --git a/tools/sdk/esp32s2/include/esp_hw_support/include/esp_chip_info.h b/tools/sdk/esp32s2/include/esp_hw_support/include/esp_chip_info.h new file mode 100644 index 00000000000..35b191ac25b --- /dev/null +++ b/tools/sdk/esp32s2/include/esp_hw_support/include/esp_chip_info.h @@ -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 +#include +#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 diff --git a/tools/sdk/esp32s2/include/esp_hw_support/include/esp_clk.h b/tools/sdk/esp32s2/include/esp_hw_support/include/esp_clk.h new file mode 100644 index 00000000000..920f310c920 --- /dev/null +++ b/tools/sdk/esp32s2/include/esp_hw_support/include/esp_clk.h @@ -0,0 +1,2 @@ +#warning esp_clk.h has been replaced by esp32/clk.h, please include esp32/clk.h instead +#include "esp32/clk.h" diff --git a/tools/sdk/esp32s2/include/esp_hw_support/include/esp_intr.h b/tools/sdk/esp32s2/include/esp_hw_support/include/esp_intr.h new file mode 100644 index 00000000000..c29dc9bfd1a --- /dev/null +++ b/tools/sdk/esp32s2/include/esp_hw_support/include/esp_intr.h @@ -0,0 +1,17 @@ +// Copyright 2010-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. + +#pragma once +#warning esp_intr.h is deprecated, please include esp_intr_alloc.h instead +#include "esp_intr_alloc.h" diff --git a/tools/sdk/esp32s2/include/esp_system/include/esp_intr_alloc.h b/tools/sdk/esp32s2/include/esp_hw_support/include/esp_intr_alloc.h similarity index 100% rename from tools/sdk/esp32s2/include/esp_system/include/esp_intr_alloc.h rename to tools/sdk/esp32s2/include/esp_hw_support/include/esp_intr_alloc.h diff --git a/tools/sdk/esp32s2/include/esp_hw_support/include/esp_mac.h b/tools/sdk/esp32s2/include/esp_hw_support/include/esp_mac.h new file mode 100644 index 00000000000..9d91d8cee41 --- /dev/null +++ b/tools/sdk/esp32s2/include/esp_hw_support/include/esp_mac.h @@ -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 + * `. + * 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 diff --git a/tools/sdk/esp32s2/include/esp32s2/include/esp_clk.h b/tools/sdk/esp32s2/include/esp_hw_support/include/esp_private/esp_clk.h similarity index 88% rename from tools/sdk/esp32s2/include/esp32s2/include/esp_clk.h rename to tools/sdk/esp32s2/include/esp_hw_support/include/esp_private/esp_clk.h index 430d1c1b7a0..14326898bd7 100644 --- a/tools/sdk/esp32s2/include/esp32s2/include/esp_clk.h +++ b/tools/sdk/esp32s2/include/esp_hw_support/include/esp_private/esp_clk.h @@ -13,6 +13,7 @@ // limitations under the License. #pragma once +#include #ifdef __cplusplus extern "C" { @@ -66,6 +67,17 @@ int esp_clk_cpu_freq(void); */ int esp_clk_apb_freq(void); +/** + * @brief Return frequency of the main XTAL + * + * Frequency of the main XTAL can be either auto-detected or set at compile + * time (see CONFIG_ESP32_XTAL_FREQ_SEL sdkconfig option). In both cases, this + * function returns the actual value at run time. + * + * @return XTAL frequency, in Hz + */ +int esp_clk_xtal_freq(void); + /** * @brief Read value of RTC counter, converting it to microseconds diff --git a/tools/sdk/esp32s2/include/esp_hw_support/include/esp_random.h b/tools/sdk/esp32s2/include/esp_hw_support/include/esp_random.h new file mode 100644 index 00000000000..26756b9db87 --- /dev/null +++ b/tools/sdk/esp32s2/include/esp_hw_support/include/esp_random.h @@ -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 +#include + +#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 diff --git a/tools/sdk/esp32s2/include/esp_system/include/esp_sleep.h b/tools/sdk/esp32s2/include/esp_hw_support/include/esp_sleep.h similarity index 98% rename from tools/sdk/esp32s2/include/esp_system/include/esp_sleep.h rename to tools/sdk/esp32s2/include/esp_hw_support/include/esp_sleep.h index d84933cde5a..1d81f716a8c 100644 --- a/tools/sdk/esp32s2/include/esp_system/include/esp_sleep.h +++ b/tools/sdk/esp32s2/include/esp_hw_support/include/esp_sleep.h @@ -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 diff --git a/tools/sdk/esp32s2/include/esp_hw_support/include/soc/esp32/clk.h b/tools/sdk/esp32s2/include/esp_hw_support/include/soc/esp32/clk.h new file mode 100644 index 00000000000..31902ebad01 --- /dev/null +++ b/tools/sdk/esp32s2/include/esp_hw_support/include/soc/esp32/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" diff --git a/tools/sdk/esp32s2/include/esp_hw_support/include/soc/esp32c3/clk.h b/tools/sdk/esp32s2/include/esp_hw_support/include/soc/esp32c3/clk.h new file mode 100644 index 00000000000..31902ebad01 --- /dev/null +++ b/tools/sdk/esp32s2/include/esp_hw_support/include/soc/esp32c3/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" diff --git a/tools/sdk/esp32s2/include/esp_hw_support/include/soc/esp32s2/clk.h b/tools/sdk/esp32s2/include/esp_hw_support/include/soc/esp32s2/clk.h new file mode 100644 index 00000000000..31902ebad01 --- /dev/null +++ b/tools/sdk/esp32s2/include/esp_hw_support/include/soc/esp32s2/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" diff --git a/tools/sdk/esp32s2/include/esp_hw_support/include/soc/esp32s3/clk.h b/tools/sdk/esp32s2/include/esp_hw_support/include/soc/esp32s3/clk.h new file mode 100644 index 00000000000..31902ebad01 --- /dev/null +++ b/tools/sdk/esp32s2/include/esp_hw_support/include/soc/esp32s3/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" diff --git a/tools/sdk/esp32s2/include/esp_pm/include/esp_pm.h b/tools/sdk/esp32s2/include/esp_pm/include/esp_pm.h index 4d5146316b4..86a404286f8 100644 --- a/tools/sdk/esp32s2/include/esp_pm/include/esp_pm.h +++ b/tools/sdk/esp32s2/include/esp_pm/include/esp_pm.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 diff --git a/tools/sdk/esp32s2/include/esp_system/include/esp_debug_helpers.h b/tools/sdk/esp32s2/include/esp_system/include/esp_debug_helpers.h index a802cb40235..c64df641e1b 100644 --- a/tools/sdk/esp32s2/include/esp_system/include/esp_debug_helpers.h +++ b/tools/sdk/esp32s2/include/esp_system/include/esp_debug_helpers.h @@ -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 * diff --git a/tools/sdk/esp32s2/include/esp_system/include/esp_private/crosscore_int.h b/tools/sdk/esp32s2/include/esp_system/include/esp_private/crosscore_int.h index bac4afba29e..1d6ec809b9f 100644 --- a/tools/sdk/esp32s2/include/esp_system/include/esp_private/crosscore_int.h +++ b/tools/sdk/esp32s2/include/esp_system/include/esp_private/crosscore_int.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/esp_system/include/esp_private/startup_internal.h b/tools/sdk/esp32s2/include/esp_system/include/esp_private/startup_internal.h index 42b901cbf4a..52ec6e09b37 100644 --- a/tools/sdk/esp32s2/include/esp_system/include/esp_private/startup_internal.h +++ b/tools/sdk/esp32s2/include/esp_system/include/esp_private/startup_internal.h @@ -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. diff --git a/tools/sdk/esp32s2/include/esp_system/include/esp_system.h b/tools/sdk/esp32s2/include/esp_system/include/esp_system.h index bd9bb1a6c42..b98b7194902 100644 --- a/tools/sdk/esp32s2/include/esp_system/include/esp_system.h +++ b/tools/sdk/esp32s2/include/esp_system/include/esp_system.h @@ -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 - * `. - * 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 diff --git a/tools/sdk/esp32/include/esp32/include/esp32/brownout.h b/tools/sdk/esp32s2/include/esp_system/port/public_compat/brownout.h similarity index 92% rename from tools/sdk/esp32/include/esp32/include/esp32/brownout.h rename to tools/sdk/esp32s2/include/esp_system/port/public_compat/brownout.h index 7fbe98c11a2..397092cd440 100644 --- a/tools/sdk/esp32/include/esp32/include/esp32/brownout.h +++ b/tools/sdk/esp32s2/include/esp_system/port/public_compat/brownout.h @@ -1,4 +1,4 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// Copyright 2015-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. diff --git a/tools/sdk/esp32c3/include/esp32c3/include/esp32c3/cache_err_int.h b/tools/sdk/esp32s2/include/esp_system/port/public_compat/cache_err_int.h similarity index 71% rename from tools/sdk/esp32c3/include/esp32c3/include/esp32c3/cache_err_int.h rename to tools/sdk/esp32s2/include/esp_system/port/public_compat/cache_err_int.h index 9c8d9ddb2fb..d87406f80f7 100644 --- a/tools/sdk/esp32c3/include/esp32c3/include/esp32c3/cache_err_int.h +++ b/tools/sdk/esp32s2/include/esp_system/port/public_compat/cache_err_int.h @@ -1,4 +1,4 @@ -// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD +// 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. @@ -12,22 +12,34 @@ // See the License for the specific language governing permissions and // limitations under the License. +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif /** * @brief initialize cache invalid access interrupt * * This function enables cache invalid access interrupt source and connects it - * to interrupt input number ETS_CACHEERR_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 * - (-1) otherwise */ int esp_cache_err_get_cpuid(void); + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/esp32s2/include/esp_system/port/public_compat/trax.h b/tools/sdk/esp32s2/include/esp_system/port/public_compat/trax.h new file mode 100644 index 00000000000..1322b7b5850 --- /dev/null +++ b/tools/sdk/esp32s2/include/esp_system/port/public_compat/trax.h @@ -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 diff --git a/tools/sdk/esp32s2/include/esp_system/port/soc/esp32/cache_err_int.h b/tools/sdk/esp32s2/include/esp_system/port/soc/esp32/cache_err_int.h new file mode 100644 index 00000000000..07085f53090 --- /dev/null +++ b/tools/sdk/esp32s2/include/esp_system/port/soc/esp32/cache_err_int.h @@ -0,0 +1,2 @@ +#pragma once +#include "cache_err_int.h" diff --git a/tools/sdk/esp32s2/include/esp_system/port/soc/esp32c3/cache_err_int.h b/tools/sdk/esp32s2/include/esp_system/port/soc/esp32c3/cache_err_int.h new file mode 100644 index 00000000000..07085f53090 --- /dev/null +++ b/tools/sdk/esp32s2/include/esp_system/port/soc/esp32c3/cache_err_int.h @@ -0,0 +1,2 @@ +#pragma once +#include "cache_err_int.h" diff --git a/tools/sdk/esp32s2/include/esp_system/port/soc/esp32s2/cache_err_int.h b/tools/sdk/esp32s2/include/esp_system/port/soc/esp32s2/cache_err_int.h new file mode 100644 index 00000000000..07085f53090 --- /dev/null +++ b/tools/sdk/esp32s2/include/esp_system/port/soc/esp32s2/cache_err_int.h @@ -0,0 +1,2 @@ +#pragma once +#include "cache_err_int.h" diff --git a/tools/sdk/esp32s2/include/esp_system/port/soc/esp32s3/cache_err_int.h b/tools/sdk/esp32s2/include/esp_system/port/soc/esp32s3/cache_err_int.h new file mode 100644 index 00000000000..07085f53090 --- /dev/null +++ b/tools/sdk/esp32s2/include/esp_system/port/soc/esp32s3/cache_err_int.h @@ -0,0 +1,2 @@ +#pragma once +#include "cache_err_int.h" diff --git a/tools/sdk/esp32s2/include/espcoredump/include/esp_core_dump.h b/tools/sdk/esp32s2/include/espcoredump/include/esp_core_dump.h index fb0d44d2c81..f8b029d5b6d 100644 --- a/tools/sdk/esp32s2/include/espcoredump/include/esp_core_dump.h +++ b/tools/sdk/esp32s2/include/espcoredump/include/esp_core_dump.h @@ -17,11 +17,37 @@ #include #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 diff --git a/tools/sdk/esp32/include/esp_system/include/esp_private/sleep_modes.h b/tools/sdk/esp32s2/include/espcoredump/include/port/riscv/esp_core_dump_summary_extra_info.h similarity index 58% rename from tools/sdk/esp32/include/esp_system/include/esp_private/sleep_modes.h rename to tools/sdk/esp32s2/include/espcoredump/include/port/riscv/esp_core_dump_summary_extra_info.h index e1584a8b573..510fdc06afe 100644 --- a/tools/sdk/esp32/include/esp_system/include/esp_private/sleep_modes.h +++ b/tools/sdk/esp32s2/include/espcoredump/include/port/riscv/esp_core_dump_summary_extra_info.h @@ -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 -#include #include -#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 } diff --git a/tools/sdk/esp32s2/include/espcoredump/include/port/xtensa/esp_core_dump_summary_extra_info.h b/tools/sdk/esp32s2/include/espcoredump/include/port/xtensa/esp_core_dump_summary_extra_info.h new file mode 100644 index 00000000000..3db7a70be82 --- /dev/null +++ b/tools/sdk/esp32s2/include/espcoredump/include/port/xtensa/esp_core_dump_summary_extra_info.h @@ -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 +#include + +#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 diff --git a/tools/sdk/esp32s2/include/freertos/include/freertos/task.h b/tools/sdk/esp32s2/include/freertos/include/freertos/task.h index 422948a2458..559945805ee 100644 --- a/tools/sdk/esp32s2/include/freertos/include/freertos/task.h +++ b/tools/sdk/esp32s2/include/freertos/include/freertos/task.h @@ -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 diff --git a/tools/sdk/esp32s2/include/hal/esp32s2/include/hal/gpio_ll.h b/tools/sdk/esp32s2/include/hal/esp32s2/include/hal/gpio_ll.h index aa02c11199d..d6330db630d 100644 --- a/tools/sdk/esp32s2/include/hal/esp32s2/include/hal/gpio_ll.h +++ b/tools/sdk/esp32s2/include/hal/esp32s2/include/hal/gpio_ll.h @@ -391,6 +391,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. * @@ -404,7 +415,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); } static inline void gpio_ll_force_hold_all(gpio_dev_t *hw) diff --git a/tools/sdk/esp32s2/include/hal/esp32s2/include/hal/memprot_ll.h b/tools/sdk/esp32s2/include/hal/esp32s2/include/hal/memprot_ll.h index ee7ea2a0686..0fbf5753376 100644 --- a/tools/sdk/esp32s2/include/hal/esp32s2/include/hal/memprot_ll.h +++ b/tools/sdk/esp32s2/include/hal/esp32s2/include/hal/memprot_ll.h @@ -26,10 +26,12 @@ extern "C" { //IRAM0 interrupt status bitmasks #define IRAM0_INTR_ST_OP_TYPE_BIT BIT(1) //instruction: 0, data: 1 #define IRAM0_INTR_ST_OP_RW_BIT BIT(0) //read: 0, write: 1 +#define CONF_REG_ADDRESS_SHIFT 2 static inline void esp_memprot_iram0_clear_intr(void) { DPORT_SET_PERI_REG_MASK(DPORT_PMS_PRO_IRAM0_4_REG, DPORT_PMS_PRO_IRAM0_ILG_CLR); + DPORT_CLEAR_PERI_REG_MASK(DPORT_PMS_PRO_IRAM0_4_REG, DPORT_PMS_PRO_IRAM0_ILG_CLR); } static inline uint32_t esp_memprot_iram0_get_intr_source_num(void) @@ -104,6 +106,7 @@ static inline uint32_t esp_memprot_iram0_get_lock_bit(void) * === IRAM0 SRAM * ======================================================================================== */ +#define IRAM0_SRAM_BASE_ADDRESS 0x40000000 #define IRAM0_SRAM_ADDRESS_LOW 0x40020000 #define IRAM0_SRAM_ADDRESS_HIGH 0x4006FFFF @@ -126,6 +129,7 @@ static inline uint32_t esp_memprot_iram0_get_lock_bit(void) #define IRAM0_INTR_ST_FAULTADDR_M 0x003FFFFC //bits 21:6 in the reg, as well as in real address #define IRAM0_SRAM_INTR_ST_FAULTADDR_HI 0x40000000 //high nonsignificant bits 31:22 of the faulting address - constant +#define IRAM0_SRAM_ADDR_TO_CONF_REG(addr) (((addr >> CONF_REG_ADDRESS_SHIFT) & DPORT_PMS_PRO_IRAM0_SRAM_4_SPLTADDR) << DPORT_PMS_PRO_IRAM0_SRAM_4_SPLTADDR_S) static inline uint32_t *esp_memprot_iram0_sram_get_fault_address(void) { @@ -290,6 +294,7 @@ static inline void esp_memprot_iram0_sram_set_prot(uint32_t *split_addr, bool lw { uint32_t addr = (uint32_t)split_addr; assert(addr <= IRAM0_SRAM_SPL_BLOCK_HIGH); + assert(addr % 0x4 == 0); //find possible split.address in low region blocks int uni_blocks_low = -1; @@ -339,11 +344,7 @@ static inline void esp_memprot_iram0_sram_set_prot(uint32_t *split_addr, bool lw uint32_t reg_split_addr = 0; if (addr >= IRAM0_SRAM_SPL_BLOCK_LOW) { - - //[16:0] - reg_split_addr = addr >> 2; - assert(addr == (reg_split_addr << 2)); - reg_split_addr &= DPORT_PMS_PRO_IRAM0_SRAM_4_SPLTADDR_M; + reg_split_addr = IRAM0_SRAM_ADDR_TO_CONF_REG( addr ); //cfg reg - [16:0] } //prepare high & low permission mask (bits: [22:20] high range, [19:17] low range) @@ -406,9 +407,11 @@ static inline void esp_memprot_iram0_sram_set_exec_perm(bool lx, bool hx) * === IRAM0 RTC FAST * ======================================================================================== */ -#define IRAM0_RTCFAST_ADDRESS_LOW 0x40070000 -#define IRAM0_RTCFAST_ADDRESS_HIGH 0x40071FFF -#define IRAM0_RTCFAST_INTR_ST_FAULTADDR_HI 0x40070000 //RTCFAST faulting address high bits (31:22, constant) +#define IRAM0_RTCFAST_ADDRESS_LOW 0x40070000 +#define IRAM0_RTCFAST_ADDRESS_HIGH 0x40071FFF +#define IRAM0_RTCFAST_INTR_ST_FAULTADDR_HI 0x40070000 //RTCFAST faulting address high bits (31:22, constant) + +#define IRAM0_RTCFAST_ADDR_TO_CONF_REG(addr) (((addr >> CONF_REG_ADDRESS_SHIFT) & DPORT_PMS_PRO_IRAM0_RTCFAST_SPLTADDR) << DPORT_PMS_PRO_IRAM0_RTCFAST_SPLTADDR_S) static inline uint32_t *esp_memprot_iram0_rtcfast_get_fault_address(void) @@ -434,14 +437,10 @@ static inline uint32_t esp_memprot_iram0_rtcfast_get_perm_split_reg(void) static inline void esp_memprot_iram0_rtcfast_set_prot(uint32_t *split_addr, bool lw, bool lr, bool lx, bool hw, bool hr, bool hx) { uint32_t addr = (uint32_t)split_addr; + assert( addr % 0x4 == 0 ); - //if splt.ddr not set yet, do required normalization to make the addr writeble into splt.mgmt cfg register - uint32_t reg_split_addr = 0; - - //[10:0] - reg_split_addr = addr >> 2; - assert(addr == (reg_split_addr << 2)); - reg_split_addr &= DPORT_PMS_PRO_IRAM0_RTCFAST_SPLTADDR_M; + //conf reg [10:0] + uint32_t reg_split_addr = IRAM0_RTCFAST_ADDR_TO_CONF_REG(addr); //prepare high & low permission mask (bits: [16:14] high range, [13:11] low range) uint32_t permission_mask = 0; @@ -531,6 +530,7 @@ static inline bool esp_memprot_dram0_is_assoc_intr(void) static inline void esp_memprot_dram0_clear_intr(void) { DPORT_SET_PERI_REG_MASK(DPORT_PMS_PRO_DRAM0_3_REG, DPORT_PMS_PRO_DRAM0_ILG_CLR); + DPORT_CLEAR_PERI_REG_MASK(DPORT_PMS_PRO_DRAM0_3_REG, DPORT_PMS_PRO_DRAM0_ILG_CLR); } static inline uint32_t esp_memprot_dram0_get_intr_ena_bit(void) @@ -606,6 +606,8 @@ static inline void esp_memprot_dram0_get_fault_op_type(uint32_t *op_type, uint32 #define DRAM0_SRAM_SPL_BLOCK_HIGH 0x3FFFFFFF //block 21 high #define DRAM0_SRAM_INTR_ST_FAULTADDR_HI 0x3FF00000 //SRAM high bits 31:22 of the faulting address - constant +#define DRAM0_SRAM_ADDR_TO_CONF_REG(addr) (((addr >> CONF_REG_ADDRESS_SHIFT) & DPORT_PMS_PRO_DRAM0_SRAM_4_SPLTADDR) << DPORT_PMS_PRO_DRAM0_SRAM_4_SPLTADDR_S) + static inline uint32_t *esp_memprot_dram0_sram_get_fault_address(void) { @@ -716,6 +718,7 @@ static inline void esp_memprot_dram0_sram_set_prot(uint32_t *split_addr, bool lw //low boundary check provided by LD script. see comment in esp_memprot_iram0_sram_set_prot() assert( addr <= DRAM0_SRAM_SPL_BLOCK_HIGH ); + assert( addr % 0x4 == 0 ); //set low region int uni_blocks_low = -1; @@ -753,10 +756,8 @@ static inline void esp_memprot_dram0_sram_set_prot(uint32_t *split_addr, bool lw } } - //[24:8] - uint32_t reg_split_addr = addr >> 2; - assert(addr == (reg_split_addr << 2)); - reg_split_addr = (reg_split_addr & DPORT_PMS_PRO_DRAM0_SRAM_4_SPLTADDR_V) << DPORT_PMS_PRO_DRAM0_SRAM_4_SPLTADDR_S; + //conf reg [24:8] + uint32_t reg_split_addr = DRAM0_SRAM_ADDR_TO_CONF_REG(addr); //prepare high & low permission mask uint32_t permission_mask = 0; @@ -803,9 +804,10 @@ static inline void esp_memprot_dram0_sram_set_write_perm(bool lw, bool hw) * === DRAM0 RTC FAST * ======================================================================================== */ -#define DRAM0_RTCFAST_ADDRESS_LOW 0x3FF9E000 -#define DRAM0_RTCFAST_ADDRESS_HIGH 0x3FF9FFFF -#define DRAM0_RTCFAST_INTR_ST_FAULTADDR_HI 0x3FF00000 //RTCFAST high bits 31:22 of the faulting address - constant +#define DRAM0_RTCFAST_ADDRESS_LOW 0x3FF9E000 +#define DRAM0_RTCFAST_ADDRESS_HIGH 0x3FF9FFFF +#define DRAM0_RTCFAST_INTR_ST_FAULTADDR_HI 0x3FF00000 //RTCFAST high bits 31:22 of the faulting address - constant +#define DRAM0_RTCFAST_ADDR_TO_CONF_REG(addr) (((addr >> CONF_REG_ADDRESS_SHIFT) & DPORT_PMS_PRO_DRAM0_RTCFAST_SPLTADDR) << DPORT_PMS_PRO_DRAM0_RTCFAST_SPLTADDR_S) static inline uint32_t *esp_memprot_dram0_rtcfast_get_fault_address(void) @@ -826,11 +828,10 @@ static inline bool esp_memprot_dram0_rtcfast_is_intr_mine(void) static inline void esp_memprot_dram0_rtcfast_set_prot(uint32_t *split_addr, bool lw, bool lr, bool hw, bool hr) { uint32_t addr = (uint32_t)split_addr; + assert( addr % 0x4 == 0 ); - //[10:0] - uint32_t reg_split_addr = addr >> 2; - assert(addr == (reg_split_addr << 2)); - reg_split_addr &= DPORT_PMS_PRO_DRAM0_RTCFAST_SPLTADDR_M; + //conf reg [10:0] + uint32_t reg_split_addr = DRAM0_RTCFAST_ADDR_TO_CONF_REG( addr ); //prepare high & low permission mask uint32_t permission_mask = 0; diff --git a/tools/sdk/esp32s2/include/hal/esp32s2/include/hal/memprot_peri_ll.h b/tools/sdk/esp32s2/include/hal/esp32s2/include/hal/memprot_peri_ll.h index 35dc03cefc8..f8abd751c66 100644 --- a/tools/sdk/esp32s2/include/hal/esp32s2/include/hal/memprot_peri_ll.h +++ b/tools/sdk/esp32s2/include/hal/esp32s2/include/hal/memprot_peri_ll.h @@ -31,9 +31,11 @@ extern "C" { #define PERI1_INTR_ST_FAULTADDR_M 0x03FFFFC0 //(bits 25:6 in the reg) #define PERI1_INTR_ST_FAULTADDR_S 0x4 //(bits 21:2 of real address) + static inline void esp_memprot_peri1_clear_intr(void) { DPORT_SET_PERI_REG_MASK(DPORT_PMS_PRO_DPORT_6_REG, DPORT_PMS_PRO_DPORT_ILG_CLR); + DPORT_CLEAR_PERI_REG_MASK(DPORT_PMS_PRO_DPORT_6_REG, DPORT_PMS_PRO_DPORT_ILG_CLR); } static inline uint32_t esp_memprot_peri1_get_intr_source_num(void) @@ -116,6 +118,7 @@ static inline uint32_t esp_memprot_peri1_get_lock_bit(void) #define PERI1_RTCSLOW_ADDRESS_HIGH PERI1_RTCSLOW_ADDRESS_LOW + RTCSLOW_MEMORY_SIZE #define PERI1_RTCSLOW_INTR_ST_FAULTADDR_HI_0 0x3F400000 +#define PERI1_RTCSLOW_ADDR_TO_CONF_REG(addr) (((addr >> CONF_REG_ADDRESS_SHIFT) & DPORT_PMS_PRO_DPORT_RTCSLOW_SPLTADDR) << DPORT_PMS_PRO_DPORT_RTCSLOW_SPLTADDR_S) static inline uint32_t *esp_memprot_peri1_rtcslow_get_fault_address(void) { @@ -137,11 +140,9 @@ static inline bool esp_memprot_peri1_rtcslow_is_intr_mine(void) static inline void esp_memprot_peri1_rtcslow_set_prot(uint32_t *split_addr, bool lw, bool lr, bool hw, bool hr) { uint32_t addr = (uint32_t)split_addr; + assert( addr % 0x4 == 0 ); - //check split address is WORD aligned - uint32_t reg_split_addr = addr >> 2; - assert(addr == (reg_split_addr << 2)); - reg_split_addr &= DPORT_PMS_PRO_DPORT_RTCSLOW_SPLTADDR_M; + uint32_t reg_split_addr = PERI1_RTCSLOW_ADDR_TO_CONF_REG(addr); //prepare high & low permission mask uint32_t permission_mask = 0; @@ -201,6 +202,7 @@ static inline uint32_t esp_memprot_peri1_rtcslow_get_conf_reg(void) static inline void esp_memprot_peri2_clear_intr(void) { DPORT_SET_PERI_REG_MASK(DPORT_PMS_PRO_AHB_3_REG, DPORT_PMS_PRO_AHB_ILG_CLR); + DPORT_CLEAR_PERI_REG_MASK(DPORT_PMS_PRO_AHB_3_REG, DPORT_PMS_PRO_AHB_ILG_CLR); } static inline uint32_t esp_memprot_peri2_get_intr_source_num(void) @@ -286,6 +288,8 @@ static inline uint32_t *esp_memprot_peri2_rtcslow_get_fault_address(void) #define PERI2_RTCSLOW_0_ADDRESS_LOW PERI2_RTCSLOW_0_ADDRESS_BASE #define PERI2_RTCSLOW_0_ADDRESS_HIGH PERI2_RTCSLOW_0_ADDRESS_LOW + RTCSLOW_MEMORY_SIZE +#define PERI2_RTCSLOW_0_ADDR_TO_CONF_REG(addr) (((addr >> CONF_REG_ADDRESS_SHIFT) & DPORT_PMS_PRO_AHB_RTCSLOW_0_SPLTADDR) << DPORT_PMS_PRO_AHB_RTCSLOW_0_SPLTADDR_S) + static inline bool esp_memprot_peri2_rtcslow_0_is_intr_mine(void) { if (esp_memprot_peri2_is_assoc_intr()) { @@ -298,11 +302,9 @@ static inline bool esp_memprot_peri2_rtcslow_0_is_intr_mine(void) static inline void esp_memprot_peri2_rtcslow_0_set_prot(uint32_t *split_addr, bool lw, bool lr, bool lx, bool hw, bool hr, bool hx) { uint32_t addr = (uint32_t)split_addr; + assert( addr % 0x4 == 0 ); - //check split address is WORD aligned - uint32_t reg_split_addr = addr >> 2; - assert(addr == (reg_split_addr << 2)); - reg_split_addr &= DPORT_PMS_PRO_AHB_RTCSLOW_0_SPLTADDR_M; + uint32_t reg_split_addr = PERI2_RTCSLOW_0_ADDR_TO_CONF_REG(addr); //prepare high & low permission mask uint32_t permission_mask = 0; @@ -371,6 +373,7 @@ static inline uint32_t esp_memprot_peri2_rtcslow_0_get_conf_reg(void) #define PERI2_RTCSLOW_1_ADDRESS_LOW PERI2_RTCSLOW_1_ADDRESS_BASE #define PERI2_RTCSLOW_1_ADDRESS_HIGH PERI2_RTCSLOW_1_ADDRESS_LOW + RTCSLOW_MEMORY_SIZE +#define PERI2_RTCSLOW_1_ADDR_TO_CONF_REG(addr) (((addr >> CONF_REG_ADDRESS_SHIFT) & DPORT_PMS_PRO_AHB_RTCSLOW_1_SPLTADDR) << DPORT_PMS_PRO_AHB_RTCSLOW_1_SPLTADDR_S) static inline bool esp_memprot_peri2_rtcslow_1_is_intr_mine(void) { @@ -384,11 +387,9 @@ static inline bool esp_memprot_peri2_rtcslow_1_is_intr_mine(void) static inline void esp_memprot_peri2_rtcslow_1_set_prot(uint32_t *split_addr, bool lw, bool lr, bool lx, bool hw, bool hr, bool hx) { uint32_t addr = (uint32_t)split_addr; + assert( addr % 0x4 == 0 ); - //check split address is WORD aligned - uint32_t reg_split_addr = addr >> 2; - assert(addr == (reg_split_addr << 2)); - reg_split_addr &= DPORT_PMS_PRO_AHB_RTCSLOW_1_SPLTADDR_M; + uint32_t reg_split_addr = PERI2_RTCSLOW_1_ADDR_TO_CONF_REG(addr); //prepare high & low permission mask uint32_t permission_mask = 0; diff --git a/tools/sdk/esp32s2/include/hal/include/hal/gpio_hal.h b/tools/sdk/esp32s2/include/hal/include/hal/gpio_hal.h index 5a403f529c6..018b4be1288 100644 --- a/tools/sdk/esp32s2/include/hal/include/hal/gpio_hal.h +++ b/tools/sdk/esp32s2/include/hal/include/hal/gpio_hal.h @@ -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 diff --git a/tools/sdk/esp32s2/include/hal/include/hal/i2c_types.h b/tools/sdk/esp32s2/include/hal/include/hal/i2c_types.h index 3d5864dc10a..12147c78b7b 100644 --- a/tools/sdk/esp32s2/include/hal/include/hal/i2c_types.h +++ b/tools/sdk/esp32s2/include/hal/include/hal/i2c_types.h @@ -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, /*! #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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h index 0bbc6885934..5d671df142d 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h index f863ce88ca2..6643b0cbf50 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth.h index 7174e7bcedd..540aee0e8d7 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h index deec5266e68..3da864c7d27 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h index 77a55fbc008..d992cb8163d 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h index 4842f3debc7..3fb52638924 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box.h index 614cd1e0ac1..e060dd29fc4 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h index 29c9b255202..26a3d31efa9 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h @@ -3,6 +3,7 @@ #define crypto_box_curve25519xchacha20poly1305_H #include +#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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h index 9b5a39c3fa4..e733f49995b 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h @@ -2,6 +2,7 @@ #define crypto_box_curve25519xsalsa20poly1305_H #include +#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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_ed25519.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_ed25519.h new file mode 100644 index 00000000000..3eae00c4562 --- /dev/null +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_ed25519.h @@ -0,0 +1,100 @@ +#ifndef crypto_core_ed25519_H +#define crypto_core_ed25519_H + +#include +#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 diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hchacha20.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hchacha20.h index 05e5670c10e..ece141b09b4 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hchacha20.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hchacha20.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h index 82e475b8f67..4bf7a48786f 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_ristretto255.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_ristretto255.h new file mode 100644 index 00000000000..f2820e5576e --- /dev/null +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_ristretto255.h @@ -0,0 +1,100 @@ +#ifndef crypto_core_ristretto255_H +#define crypto_core_ristretto255_H + +#include +#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 diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h index 160cc56d2c4..bd79fd9f540 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h index bdd5f9fdbb2..05957591ca7 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h index 3c13efa4ef3..d2f216af268 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash.h index 2398fb9dbba..d897e5d26c5 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h index 7b0c0820743..fee9d8ad196 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash.h index 302ed5c5ea2..8752f9cafeb 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash.h @@ -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 diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h index f64d16e0e5c..b18217e18df 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h index 6b0330f14fe..8efa7193ad9 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf.h index 52e496a7449..ac2fc6183c2 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf_blake2b.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf_blake2b.h index 5480ebe82f1..3ae47dd32c5 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf_blake2b.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kdf_blake2b.h @@ -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 diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kx.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kx.h index d1fce90da57..347132c320e 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kx.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_kx.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h index 5951c5b82d3..7cd7b07060f 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h index 479e923dccb..f3e34d86df4 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash.h index 56eca0680c1..585a993efd2 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash.h @@ -4,6 +4,7 @@ #include #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 - diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2i.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2i.h index d414b939d1f..88ff6221d67 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2i.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2i.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2id.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2id.h new file mode 100644 index 00000000000..7183abd186b --- /dev/null +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_argon2id.h @@ -0,0 +1,122 @@ +#ifndef crypto_pwhash_argon2id_H +#define crypto_pwhash_argon2id_H + +#include +#include +#include + +#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 diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h index 9f693e540e7..5c0bf7d390a 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h index 830c10f6473..1c685853783 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h index 953f8923c5e..60e9d0c5a40 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h @@ -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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h new file mode 100644 index 00000000000..2dfa4d7073f --- /dev/null +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h @@ -0,0 +1,51 @@ + +#ifndef crypto_scalarmult_ed25519_H +#define crypto_scalarmult_ed25519_H + +#include + +#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 diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ristretto255.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ristretto255.h new file mode 100644 index 00000000000..40a45ccef02 --- /dev/null +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_scalarmult_ristretto255.h @@ -0,0 +1,43 @@ + +#ifndef crypto_scalarmult_ristretto255_H +#define crypto_scalarmult_ristretto255_H + +#include + +#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 diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox.h index 9b098200e0b..1d3709db128 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox.h @@ -29,23 +29,28 @@ size_t crypto_secretbox_macbytes(void); SODIUM_EXPORT const char *crypto_secretbox_primitive(void); +#define crypto_secretbox_MESSAGEBYTES_MAX crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX +SODIUM_EXPORT +size_t crypto_secretbox_messagebytes_max(void); + SODIUM_EXPORT int crypto_secretbox_easy(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_secretbox_open_easy(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_secretbox_detached(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 *k) + __attribute__ ((nonnull(1, 2, 5, 6))); SODIUM_EXPORT int crypto_secretbox_open_detached(unsigned char *m, @@ -54,10 +59,11 @@ int crypto_secretbox_open_detached(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, 3, 5, 6))); SODIUM_EXPORT -void crypto_secretbox_keygen(unsigned char k[crypto_secretbox_KEYBYTES]); +void crypto_secretbox_keygen(unsigned char k[crypto_secretbox_KEYBYTES]) + __attribute__ ((nonnull)); /* -- NaCl compatibility interface ; Requires padding -- */ @@ -72,13 +78,13 @@ size_t crypto_secretbox_boxzerobytes(void); SODIUM_EXPORT int crypto_secretbox(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_secretbox_open(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 } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h index 7a61a09174e..6ec674e3105 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h @@ -2,6 +2,7 @@ #define crypto_secretbox_xchacha20poly1305_H #include +#include "crypto_stream_xchacha20.h" #include "export.h" #ifdef __cplusplus @@ -23,12 +24,18 @@ size_t crypto_secretbox_xchacha20poly1305_noncebytes(void); SODIUM_EXPORT size_t crypto_secretbox_xchacha20poly1305_macbytes(void); +#define crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX \ + (crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_secretbox_xchacha20poly1305_MACBYTES) +SODIUM_EXPORT +size_t crypto_secretbox_xchacha20poly1305_messagebytes_max(void); + SODIUM_EXPORT int crypto_secretbox_xchacha20poly1305_easy(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_secretbox_xchacha20poly1305_open_easy(unsigned char *m, @@ -36,7 +43,7 @@ int crypto_secretbox_xchacha20poly1305_open_easy(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_secretbox_xchacha20poly1305_detached(unsigned char *c, @@ -44,7 +51,8 @@ int crypto_secretbox_xchacha20poly1305_detached(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_secretbox_xchacha20poly1305_open_detached(unsigned char *m, @@ -53,7 +61,7 @@ int crypto_secretbox_xchacha20poly1305_open_detached(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, 3, 5, 6))); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h index 5aa30805d6c..be0874cbafa 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h @@ -2,6 +2,7 @@ #define crypto_secretbox_xsalsa20poly1305_H #include +#include "crypto_stream_xsalsa20.h" #include "export.h" #ifdef __cplusplus @@ -23,22 +24,19 @@ size_t crypto_secretbox_xsalsa20poly1305_noncebytes(void); SODIUM_EXPORT size_t crypto_secretbox_xsalsa20poly1305_macbytes(void); -#define crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES 16U -SODIUM_EXPORT -size_t crypto_secretbox_xsalsa20poly1305_boxzerobytes(void); - -#define crypto_secretbox_xsalsa20poly1305_ZEROBYTES \ - (crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES + \ - crypto_secretbox_xsalsa20poly1305_MACBYTES) +/* Only for the libsodium API - The NaCl compatibility API would require BOXZEROBYTES extra bytes */ +#define crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX \ + (crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_secretbox_xsalsa20poly1305_MACBYTES) SODIUM_EXPORT -size_t crypto_secretbox_xsalsa20poly1305_zerobytes(void); +size_t crypto_secretbox_xsalsa20poly1305_messagebytes_max(void); SODIUM_EXPORT int crypto_secretbox_xsalsa20poly1305(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_secretbox_xsalsa20poly1305_open(unsigned char *m, @@ -46,10 +44,23 @@ int crypto_secretbox_xsalsa20poly1305_open(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 -void crypto_secretbox_xsalsa20poly1305_keygen(unsigned char k[crypto_secretbox_xsalsa20poly1305_KEYBYTES]); +void crypto_secretbox_xsalsa20poly1305_keygen(unsigned char k[crypto_secretbox_xsalsa20poly1305_KEYBYTES]) + __attribute__ ((nonnull)); + +/* -- NaCl compatibility interface ; Requires padding -- */ + +#define crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES 16U +SODIUM_EXPORT +size_t crypto_secretbox_xsalsa20poly1305_boxzerobytes(void); + +#define crypto_secretbox_xsalsa20poly1305_ZEROBYTES \ + (crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES + \ + crypto_secretbox_xsalsa20poly1305_MACBYTES) +SODIUM_EXPORT +size_t crypto_secretbox_xsalsa20poly1305_zerobytes(void); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h new file mode 100644 index 00000000000..b22e4e9313e --- /dev/null +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h @@ -0,0 +1,108 @@ +#ifndef crypto_secretstream_xchacha20poly1305_H +#define crypto_secretstream_xchacha20poly1305_H + +#include + +#include "crypto_aead_xchacha20poly1305.h" +#include "crypto_stream_chacha20.h" +#include "export.h" + +#ifdef __cplusplus +# ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wlong-long" +# endif +extern "C" { +#endif + +#define crypto_secretstream_xchacha20poly1305_ABYTES \ + (1U + crypto_aead_xchacha20poly1305_ietf_ABYTES) +SODIUM_EXPORT +size_t crypto_secretstream_xchacha20poly1305_abytes(void); + +#define crypto_secretstream_xchacha20poly1305_HEADERBYTES \ + crypto_aead_xchacha20poly1305_ietf_NPUBBYTES +SODIUM_EXPORT +size_t crypto_secretstream_xchacha20poly1305_headerbytes(void); + +#define crypto_secretstream_xchacha20poly1305_KEYBYTES \ + crypto_aead_xchacha20poly1305_ietf_KEYBYTES +SODIUM_EXPORT +size_t crypto_secretstream_xchacha20poly1305_keybytes(void); + +#define crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX \ + SODIUM_MIN(SODIUM_SIZE_MAX - crypto_secretstream_xchacha20poly1305_ABYTES, \ + (64ULL * ((1ULL << 32) - 2ULL))) +SODIUM_EXPORT +size_t crypto_secretstream_xchacha20poly1305_messagebytes_max(void); + +#define crypto_secretstream_xchacha20poly1305_TAG_MESSAGE 0x00 +SODIUM_EXPORT +unsigned char crypto_secretstream_xchacha20poly1305_tag_message(void); + +#define crypto_secretstream_xchacha20poly1305_TAG_PUSH 0x01 +SODIUM_EXPORT +unsigned char crypto_secretstream_xchacha20poly1305_tag_push(void); + +#define crypto_secretstream_xchacha20poly1305_TAG_REKEY 0x02 +SODIUM_EXPORT +unsigned char crypto_secretstream_xchacha20poly1305_tag_rekey(void); + +#define crypto_secretstream_xchacha20poly1305_TAG_FINAL \ + (crypto_secretstream_xchacha20poly1305_TAG_PUSH | \ + crypto_secretstream_xchacha20poly1305_TAG_REKEY) +SODIUM_EXPORT +unsigned char crypto_secretstream_xchacha20poly1305_tag_final(void); + +typedef struct crypto_secretstream_xchacha20poly1305_state { + unsigned char k[crypto_stream_chacha20_ietf_KEYBYTES]; + unsigned char nonce[crypto_stream_chacha20_ietf_NONCEBYTES]; + unsigned char _pad[8]; +} crypto_secretstream_xchacha20poly1305_state; + +SODIUM_EXPORT +size_t crypto_secretstream_xchacha20poly1305_statebytes(void); + +SODIUM_EXPORT +void crypto_secretstream_xchacha20poly1305_keygen + (unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES]) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +int crypto_secretstream_xchacha20poly1305_init_push + (crypto_secretstream_xchacha20poly1305_state *state, + unsigned char header[crypto_secretstream_xchacha20poly1305_HEADERBYTES], + const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES]) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +int crypto_secretstream_xchacha20poly1305_push + (crypto_secretstream_xchacha20poly1305_state *state, + unsigned char *c, unsigned long long *clen_p, + const unsigned char *m, unsigned long long mlen, + const unsigned char *ad, unsigned long long adlen, unsigned char tag) + __attribute__ ((nonnull(1))); + +SODIUM_EXPORT +int crypto_secretstream_xchacha20poly1305_init_pull + (crypto_secretstream_xchacha20poly1305_state *state, + const unsigned char header[crypto_secretstream_xchacha20poly1305_HEADERBYTES], + const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES]) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +int crypto_secretstream_xchacha20poly1305_pull + (crypto_secretstream_xchacha20poly1305_state *state, + unsigned char *m, unsigned long long *mlen_p, unsigned char *tag_p, + const unsigned char *c, unsigned long long clen, + const unsigned char *ad, unsigned long long adlen) + __attribute__ ((nonnull(1))); + +SODIUM_EXPORT +void crypto_secretstream_xchacha20poly1305_rekey + (crypto_secretstream_xchacha20poly1305_state *state); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash.h index a4988082471..fecaa88bd80 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash.h @@ -27,10 +27,12 @@ const char *crypto_shorthash_primitive(void); SODIUM_EXPORT int crypto_shorthash(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 -void crypto_shorthash_keygen(unsigned char k[crypto_shorthash_KEYBYTES]); +void crypto_shorthash_keygen(unsigned char k[crypto_shorthash_KEYBYTES]) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h index 745ed48fae9..1e6f72a620e 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h @@ -23,7 +23,8 @@ size_t crypto_shorthash_siphash24_keybytes(void); SODIUM_EXPORT int crypto_shorthash_siphash24(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))); #ifndef SODIUM_LIBRARY_MINIMAL /* -- 128-bit output -- */ @@ -38,7 +39,8 @@ size_t crypto_shorthash_siphashx24_keybytes(void); SODIUM_EXPORT int crypto_shorthash_siphashx24(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))); #endif #ifdef __cplusplus diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign.h index b0335bf274c..f5fafb123e0 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign.h @@ -41,56 +41,64 @@ size_t crypto_sign_publickeybytes(void); SODIUM_EXPORT size_t crypto_sign_secretkeybytes(void); +#define crypto_sign_MESSAGEBYTES_MAX crypto_sign_ed25519_MESSAGEBYTES_MAX +SODIUM_EXPORT +size_t crypto_sign_messagebytes_max(void); + #define crypto_sign_PRIMITIVE "ed25519" SODIUM_EXPORT const char *crypto_sign_primitive(void); SODIUM_EXPORT int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk, - const unsigned char *seed); + const unsigned char *seed) + __attribute__ ((nonnull)); SODIUM_EXPORT -int crypto_sign_keypair(unsigned char *pk, unsigned char *sk); +int crypto_sign_keypair(unsigned char *pk, unsigned char *sk) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_sign(unsigned char *sm, unsigned long long *smlen_p, const unsigned char *m, unsigned long long mlen, - const unsigned char *sk); + const unsigned char *sk) __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_open(unsigned char *m, unsigned long long *mlen_p, const unsigned char *sm, unsigned long long smlen, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5))); SODIUM_EXPORT int crypto_sign_detached(unsigned char *sig, unsigned long long *siglen_p, const unsigned char *m, unsigned long long mlen, - const unsigned char *sk); + const unsigned char *sk) __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_verify_detached(const unsigned char *sig, const unsigned char *m, unsigned long long mlen, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT int crypto_sign_init(crypto_sign_state *state); SODIUM_EXPORT int crypto_sign_update(crypto_sign_state *state, - const unsigned char *m, unsigned long long mlen); + const unsigned char *m, unsigned long long mlen) + __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_sign_final_create(crypto_sign_state *state, unsigned char *sig, unsigned long long *siglen_p, - const unsigned char *sk); + const unsigned char *sk) + __attribute__ ((nonnull(1, 2, 4))); SODIUM_EXPORT -int crypto_sign_final_verify(crypto_sign_state *state, unsigned char *sig, +int crypto_sign_final_verify(crypto_sign_state *state, const unsigned char *sig, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h index 17c150f284a..0fdac42d353 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h @@ -35,73 +35,87 @@ size_t crypto_sign_ed25519_publickeybytes(void); SODIUM_EXPORT size_t crypto_sign_ed25519_secretkeybytes(void); +#define crypto_sign_ed25519_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_ed25519_BYTES) +SODIUM_EXPORT +size_t crypto_sign_ed25519_messagebytes_max(void); + SODIUM_EXPORT int crypto_sign_ed25519(unsigned char *sm, unsigned long long *smlen_p, const unsigned char *m, unsigned long long mlen, - const unsigned char *sk); + const unsigned char *sk) + __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_ed25519_open(unsigned char *m, unsigned long long *mlen_p, const unsigned char *sm, unsigned long long smlen, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5))); SODIUM_EXPORT int crypto_sign_ed25519_detached(unsigned char *sig, unsigned long long *siglen_p, const unsigned char *m, unsigned long long mlen, - const unsigned char *sk); + const unsigned char *sk) + __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_ed25519_verify_detached(const unsigned char *sig, const unsigned char *m, unsigned long long mlen, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); SODIUM_EXPORT -int crypto_sign_ed25519_keypair(unsigned char *pk, unsigned char *sk); +int crypto_sign_ed25519_keypair(unsigned char *pk, unsigned char *sk) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_sign_ed25519_seed_keypair(unsigned char *pk, unsigned char *sk, - const unsigned char *seed); + const unsigned char *seed) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_sign_ed25519_pk_to_curve25519(unsigned char *curve25519_pk, const unsigned char *ed25519_pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_sign_ed25519_sk_to_curve25519(unsigned char *curve25519_sk, - const unsigned char *ed25519_sk); + const unsigned char *ed25519_sk) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_sign_ed25519_sk_to_seed(unsigned char *seed, - const unsigned char *sk); + const unsigned char *sk) + __attribute__ ((nonnull)); SODIUM_EXPORT -int crypto_sign_ed25519_sk_to_pk(unsigned char *pk, const unsigned char *sk); +int crypto_sign_ed25519_sk_to_pk(unsigned char *pk, const unsigned char *sk) + __attribute__ ((nonnull)); SODIUM_EXPORT -int crypto_sign_ed25519ph_init(crypto_sign_ed25519ph_state *state); +int crypto_sign_ed25519ph_init(crypto_sign_ed25519ph_state *state) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_sign_ed25519ph_update(crypto_sign_ed25519ph_state *state, const unsigned char *m, - unsigned long long mlen); + unsigned long long mlen) + __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_sign_ed25519ph_final_create(crypto_sign_ed25519ph_state *state, unsigned char *sig, unsigned long long *siglen_p, - const unsigned char *sk); + const unsigned char *sk) + __attribute__ ((nonnull(1, 2, 4))); SODIUM_EXPORT int crypto_sign_ed25519ph_final_verify(crypto_sign_ed25519ph_state *state, - unsigned char *sig, + const unsigned char *sig, const unsigned char *pk) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h index 2224a94e013..eed158aa845 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h @@ -25,6 +25,7 @@ extern "C" { #define crypto_sign_edwards25519sha512batch_BYTES 64U #define crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES 32U #define crypto_sign_edwards25519sha512batch_SECRETKEYBYTES (32U + 32U) +#define crypto_sign_edwards25519sha512batch_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_edwards25519sha512batch_BYTES) SODIUM_EXPORT int crypto_sign_edwards25519sha512batch(unsigned char *sm, @@ -32,7 +33,7 @@ int crypto_sign_edwards25519sha512batch(unsigned char *sm, const unsigned char *m, unsigned long long mlen, const unsigned char *sk) - __attribute__ ((deprecated)); + __attribute__ ((deprecated)) __attribute__ ((nonnull(1, 5))); SODIUM_EXPORT int crypto_sign_edwards25519sha512batch_open(unsigned char *m, @@ -40,12 +41,12 @@ int crypto_sign_edwards25519sha512batch_open(unsigned char *m, const unsigned char *sm, unsigned long long smlen, const unsigned char *pk) - __attribute__ ((deprecated)); + __attribute__ ((deprecated)) __attribute__ ((nonnull(3, 5))); SODIUM_EXPORT int crypto_sign_edwards25519sha512batch_keypair(unsigned char *pk, unsigned char *sk) - __attribute__ ((deprecated)); + __attribute__ ((deprecated)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream.h index 22de6ff52d3..88dab5f6111 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream.h @@ -29,21 +29,28 @@ size_t crypto_stream_keybytes(void); SODIUM_EXPORT size_t crypto_stream_noncebytes(void); +#define crypto_stream_MESSAGEBYTES_MAX crypto_stream_xsalsa20_MESSAGEBYTES_MAX +SODIUM_EXPORT +size_t crypto_stream_messagebytes_max(void); + #define crypto_stream_PRIMITIVE "xsalsa20" SODIUM_EXPORT const char *crypto_stream_primitive(void); SODIUM_EXPORT int crypto_stream(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_xor(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)); SODIUM_EXPORT -void crypto_stream_keygen(unsigned char k[crypto_stream_KEYBYTES]); +void crypto_stream_keygen(unsigned char k[crypto_stream_KEYBYTES]) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h deleted file mode 100644 index 33ee1b89714..00000000000 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef crypto_stream_aes128ctr_H -#define crypto_stream_aes128ctr_H - -/* - * WARNING: This is just a stream cipher. It is NOT authenticated encryption. - * While it provides some protection against eavesdropping, it does NOT - * provide any security against active attacks. - * Unless you know what you're doing, what you are looking for is probably - * the crypto_box functions. - */ - -#include -#include "export.h" - -#ifdef __cplusplus -# ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wlong-long" -# endif -extern "C" { -#endif - -#define crypto_stream_aes128ctr_KEYBYTES 16U -SODIUM_EXPORT -size_t crypto_stream_aes128ctr_keybytes(void); - -#define crypto_stream_aes128ctr_NONCEBYTES 16U -SODIUM_EXPORT -size_t crypto_stream_aes128ctr_noncebytes(void); - -#define crypto_stream_aes128ctr_BEFORENMBYTES 1408U -SODIUM_EXPORT -size_t crypto_stream_aes128ctr_beforenmbytes(void); - -SODIUM_EXPORT -int crypto_stream_aes128ctr(unsigned char *out, unsigned long long outlen, - const unsigned char *n, const unsigned char *k) - __attribute__ ((deprecated)); - -SODIUM_EXPORT -int crypto_stream_aes128ctr_xor(unsigned char *out, const unsigned char *in, - unsigned long long inlen, const unsigned char *n, - const unsigned char *k) - __attribute__ ((deprecated)); - -SODIUM_EXPORT -int crypto_stream_aes128ctr_beforenm(unsigned char *c, const unsigned char *k) - __attribute__ ((deprecated)); - -SODIUM_EXPORT -int crypto_stream_aes128ctr_afternm(unsigned char *out, unsigned long long len, - const unsigned char *nonce, const unsigned char *c) - __attribute__ ((deprecated)); - -SODIUM_EXPORT -int crypto_stream_aes128ctr_xor_afternm(unsigned char *out, const unsigned char *in, - unsigned long long len, - const unsigned char *nonce, - const unsigned char *c) - __attribute__ ((deprecated)); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h index cf3ffe89595..408897558b8 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h @@ -28,25 +28,33 @@ size_t crypto_stream_chacha20_keybytes(void); SODIUM_EXPORT size_t crypto_stream_chacha20_noncebytes(void); +#define crypto_stream_chacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX +SODIUM_EXPORT +size_t crypto_stream_chacha20_messagebytes_max(void); + /* ChaCha20 with a 64-bit nonce and a 64-bit counter, as originally designed */ SODIUM_EXPORT int crypto_stream_chacha20(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_chacha20_xor(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)); SODIUM_EXPORT int crypto_stream_chacha20_xor_ic(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, uint64_t ic, - const unsigned char *k); + const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_stream_chacha20_keygen(unsigned char k[crypto_stream_chacha20_KEYBYTES]); +void crypto_stream_chacha20_keygen(unsigned char k[crypto_stream_chacha20_KEYBYTES]) + __attribute__ ((nonnull)); /* ChaCha20 with a 96-bit nonce and a 32-bit counter (IETF) */ @@ -58,32 +66,38 @@ size_t crypto_stream_chacha20_ietf_keybytes(void); SODIUM_EXPORT size_t crypto_stream_chacha20_ietf_noncebytes(void); +#define crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX \ + SODIUM_MIN(SODIUM_SIZE_MAX, 64ULL * (1ULL << 32)) +SODIUM_EXPORT +size_t crypto_stream_chacha20_ietf_messagebytes_max(void); + SODIUM_EXPORT int crypto_stream_chacha20_ietf(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_chacha20_ietf_xor(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)); SODIUM_EXPORT int crypto_stream_chacha20_ietf_xor_ic(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, uint32_t ic, - const unsigned char *k); + const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_stream_chacha20_ietf_keygen(unsigned char k[crypto_stream_chacha20_ietf_KEYBYTES]); - -/* ------------------------------------------------------------------------- */ - -int _crypto_stream_chacha20_pick_best_implementation(void); +void crypto_stream_chacha20_ietf_keygen(unsigned char k[crypto_stream_chacha20_ietf_KEYBYTES]) + __attribute__ ((nonnull)); /* Aliases */ #define crypto_stream_chacha20_IETF_KEYBYTES crypto_stream_chacha20_ietf_KEYBYTES #define crypto_stream_chacha20_IETF_NONCEBYTES crypto_stream_chacha20_ietf_NONCEBYTES +#define crypto_stream_chacha20_IETF_MESSAGEBYTES_MAX crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h index 741140eb22d..45b3b3e34aa 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h @@ -28,27 +28,31 @@ size_t crypto_stream_salsa20_keybytes(void); SODIUM_EXPORT size_t crypto_stream_salsa20_noncebytes(void); +#define crypto_stream_salsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX +SODIUM_EXPORT +size_t crypto_stream_salsa20_messagebytes_max(void); + SODIUM_EXPORT int crypto_stream_salsa20(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_salsa20_xor(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)); SODIUM_EXPORT int crypto_stream_salsa20_xor_ic(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, uint64_t ic, - const unsigned char *k); + const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_stream_salsa20_keygen(unsigned char k[crypto_stream_salsa20_KEYBYTES]); - -/* ------------------------------------------------------------------------- */ - -int _crypto_stream_salsa20_pick_best_implementation(void); +void crypto_stream_salsa20_keygen(unsigned char k[crypto_stream_salsa20_KEYBYTES]) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h index d5c44282174..6c5d303cacc 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h @@ -27,17 +27,24 @@ size_t crypto_stream_salsa2012_keybytes(void); SODIUM_EXPORT size_t crypto_stream_salsa2012_noncebytes(void); +#define crypto_stream_salsa2012_MESSAGEBYTES_MAX SODIUM_SIZE_MAX +SODIUM_EXPORT +size_t crypto_stream_salsa2012_messagebytes_max(void); + SODIUM_EXPORT int crypto_stream_salsa2012(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_salsa2012_xor(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)); SODIUM_EXPORT -void crypto_stream_salsa2012_keygen(unsigned char k[crypto_stream_salsa2012_KEYBYTES]); +void crypto_stream_salsa2012_keygen(unsigned char k[crypto_stream_salsa2012_KEYBYTES]) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h index 02b4166e1ca..d574f30478a 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h @@ -21,23 +21,33 @@ extern "C" { #define crypto_stream_salsa208_KEYBYTES 32U SODIUM_EXPORT -size_t crypto_stream_salsa208_keybytes(void); +size_t crypto_stream_salsa208_keybytes(void) + __attribute__ ((deprecated)); #define crypto_stream_salsa208_NONCEBYTES 8U SODIUM_EXPORT -size_t crypto_stream_salsa208_noncebytes(void); +size_t crypto_stream_salsa208_noncebytes(void) + __attribute__ ((deprecated)); + +#define crypto_stream_salsa208_MESSAGEBYTES_MAX SODIUM_SIZE_MAX + SODIUM_EXPORT +size_t crypto_stream_salsa208_messagebytes_max(void) + __attribute__ ((deprecated)); SODIUM_EXPORT int crypto_stream_salsa208(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((deprecated)) __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_salsa208_xor(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, - const unsigned char *k); + const unsigned char *k) + __attribute__ ((deprecated)) __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_stream_salsa208_keygen(unsigned char k[crypto_stream_salsa208_KEYBYTES]); +void crypto_stream_salsa208_keygen(unsigned char k[crypto_stream_salsa208_KEYBYTES]) + __attribute__ ((deprecated)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xchacha20.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xchacha20.h index f884798e740..c4002db00a8 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xchacha20.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xchacha20.h @@ -28,23 +28,31 @@ size_t crypto_stream_xchacha20_keybytes(void); SODIUM_EXPORT size_t crypto_stream_xchacha20_noncebytes(void); +#define crypto_stream_xchacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX +SODIUM_EXPORT +size_t crypto_stream_xchacha20_messagebytes_max(void); + SODIUM_EXPORT int crypto_stream_xchacha20(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_xchacha20_xor(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)); SODIUM_EXPORT int crypto_stream_xchacha20_xor_ic(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, uint64_t ic, - const unsigned char *k); + const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_stream_xchacha20_keygen(unsigned char k[crypto_stream_xchacha20_KEYBYTES]); +void crypto_stream_xchacha20_keygen(unsigned char k[crypto_stream_xchacha20_KEYBYTES]) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h index ed5ae3c3d3c..20034e3462b 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h @@ -28,23 +28,31 @@ size_t crypto_stream_xsalsa20_keybytes(void); SODIUM_EXPORT size_t crypto_stream_xsalsa20_noncebytes(void); +#define crypto_stream_xsalsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX +SODIUM_EXPORT +size_t crypto_stream_xsalsa20_messagebytes_max(void); + SODIUM_EXPORT int crypto_stream_xsalsa20(unsigned char *c, unsigned long long clen, - const unsigned char *n, const unsigned char *k); + const unsigned char *n, const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_stream_xsalsa20_xor(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)); SODIUM_EXPORT int crypto_stream_xsalsa20_xor_ic(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, uint64_t ic, - const unsigned char *k); + const unsigned char *k) + __attribute__ ((nonnull)); SODIUM_EXPORT -void crypto_stream_xsalsa20_keygen(unsigned char k[crypto_stream_xsalsa20_KEYBYTES]); +void crypto_stream_xsalsa20_keygen(unsigned char k[crypto_stream_xsalsa20_KEYBYTES]) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_16.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_16.h index 5e9eeabee84..7b9c8077ad3 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_16.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_16.h @@ -14,7 +14,7 @@ size_t crypto_verify_16_bytes(void); SODIUM_EXPORT int crypto_verify_16(const unsigned char *x, const unsigned char *y) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_32.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_32.h index 281b5a1bb79..9b0f4529f6c 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_32.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_32.h @@ -14,7 +14,7 @@ size_t crypto_verify_32_bytes(void); SODIUM_EXPORT int crypto_verify_32(const unsigned char *x, const unsigned char *y) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_64.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_64.h index 0dc7c304a99..c83b73025a6 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_64.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/crypto_verify_64.h @@ -14,7 +14,7 @@ size_t crypto_verify_64_bytes(void); SODIUM_EXPORT int crypto_verify_64(const unsigned char *x, const unsigned char *y) - __attribute__ ((warn_unused_result)); + __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/export.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/export.h index c33bced8188..a0074fc9cbb 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/export.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/export.h @@ -2,7 +2,11 @@ #ifndef sodium_export_H #define sodium_export_H -#ifndef __GNUC__ +#include +#include +#include + +#if !defined(__clang__) && !defined(__GNUC__) # ifdef __attribute__ # undef __attribute__ # endif @@ -11,6 +15,7 @@ #ifdef SODIUM_STATIC # define SODIUM_EXPORT +# define SODIUM_EXPORT_WEAK #else # if defined(_MSC_VER) # ifdef SODIUM_DLL_EXPORT @@ -31,6 +36,11 @@ # define SODIUM_EXPORT __attribute__ ((visibility ("default"))) # endif # endif +# if defined(__ELF__) && !defined(SODIUM_DISABLE_WEAK_FUNCTIONS) +# define SODIUM_EXPORT_WEAK SODIUM_EXPORT __attribute__((weak)) +# else +# define SODIUM_EXPORT_WEAK SODIUM_EXPORT +# endif #endif #ifndef CRYPTO_ALIGN @@ -41,4 +51,7 @@ # endif #endif +#define SODIUM_MIN(A, B) ((A) < (B) ? (A) : (B)) +#define SODIUM_SIZE_MAX SODIUM_MIN(UINT64_MAX, SIZE_MAX) + #endif diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/chacha20_ietf_ext.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/chacha20_ietf_ext.h new file mode 100644 index 00000000000..2c80b96aa72 --- /dev/null +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/chacha20_ietf_ext.h @@ -0,0 +1,16 @@ +#ifndef chacha20_ietf_ext_H +#define chacha20_ietf_ext_H + +#include + +/* The ietf_ext variant allows the internal counter to overflow into the IV */ + +int crypto_stream_chacha20_ietf_ext(unsigned char *c, unsigned long long clen, + const unsigned char *n, const unsigned char *k); + +int crypto_stream_chacha20_ietf_ext_xor_ic(unsigned char *c, const unsigned char *m, + unsigned long long mlen, + const unsigned char *n, uint32_t ic, + const unsigned char *k); +#endif + diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/common.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/common.h index 5e27e5749f9..339e725ba47 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/common.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/common.h @@ -1,12 +1,35 @@ #ifndef common_H #define common_H 1 +#if !defined(_MSC_VER) && !defined(DEV_MODE) && 0 +# warning *** This is unstable, untested, development code. +# warning It might not compile. It might not work as expected. +# warning It might be totally insecure. +# warning Do not use this except if you are planning to contribute code. +# warning Use releases available at https://download.libsodium.org/libsodium/releases/ instead. +# warning Alternatively, use the "stable" branch in the git repository. +#endif + +#if !defined(_MSC_VER) && (!defined(CONFIGURED) || CONFIGURED != 1) +# warning *** The library is being compiled using an undocumented method. +# warning This is not supported. It has not been tested, it might not +# warning work as expected, and performance is likely to be suboptimal. +#endif + #include #include #include #define COMPILER_ASSERT(X) (void) sizeof(char[(X) ? 1 : -1]) +#ifdef HAVE_TI_MODE +# if defined(__SIZEOF_INT128__) +typedef unsigned __int128 uint128_t; +# else +typedef unsigned uint128_t __attribute__((mode(TI))); +# endif +#endif + #define ROTL32(X, B) rotl32((X), (B)) static inline uint32_t rotl32(const uint32_t x, const int b) @@ -177,7 +200,18 @@ store32_be(uint8_t dst[4], uint32_t w) #endif } -#ifndef __GNUC__ +#define XOR_BUF(OUT, IN, N) xor_buf((OUT), (IN), (N)) +static inline void +xor_buf(unsigned char *out, const unsigned char *in, size_t n) +{ + size_t i; + + for (i = 0; i < n; i++) { + out[i] ^= in[i]; + } +} + +#if !defined(__clang__) && !defined(__GNUC__) # ifdef __attribute__ # undef __attribute__ # endif @@ -214,4 +248,14 @@ store32_be(uint8_t dst[4], uint32_t w) # include #endif +#ifdef HAVE_LIBCTGRIND +extern void ct_poison (const void *, size_t); +extern void ct_unpoison(const void *, size_t); +# define POISON(X, L) ct_poison((X), (L)) +# define UNPOISON(X, L) ct_unpoison((X), (L)) +#else +# define POISON(X, L) (void) 0 +# define UNPOISON(X, L) (void) 0 +#endif + #endif diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/curve25519_ref10.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/curve25519_ref10.h deleted file mode 100644 index 2b9caeb1f0d..00000000000 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/curve25519_ref10.h +++ /dev/null @@ -1,160 +0,0 @@ -#ifndef curve25519_ref10_H -#define curve25519_ref10_H - -#include -#include - -#define fe crypto_core_curve25519_ref10_fe -typedef int32_t fe[10]; - -/* - fe means field element. - Here the field is \Z/(2^255-19). - An element t, entries t[0]...t[9], represents the integer - t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9]. - Bounds on each t[i] vary depending on context. - */ - -#define fe_frombytes crypto_core_curve25519_ref10_fe_frombytes -#define fe_tobytes crypto_core_curve25519_ref10_fe_tobytes -#define fe_copy crypto_core_curve25519_ref10_fe_copy -#define fe_isnonzero crypto_core_curve25519_ref10_fe_isnonzero -#define fe_isnegative crypto_core_curve25519_ref10_fe_isnegative -#define fe_0 crypto_core_curve25519_ref10_fe_0 -#define fe_1 crypto_core_curve25519_ref10_fe_1 -#define fe_cmov crypto_core_curve25519_ref10_fe_cmov -#define fe_add crypto_core_curve25519_ref10_fe_add -#define fe_sub crypto_core_curve25519_ref10_fe_sub -#define fe_neg crypto_core_curve25519_ref10_fe_neg -#define fe_mul crypto_core_curve25519_ref10_fe_mul -#define fe_sq crypto_core_curve25519_ref10_fe_sq -#define fe_sq2 crypto_core_curve25519_ref10_fe_sq2 -#define fe_invert crypto_core_curve25519_ref10_fe_invert -#define fe_pow22523 crypto_core_curve25519_ref10_fe_pow22523 - -extern void fe_frombytes(fe,const unsigned char *); -extern void fe_tobytes(unsigned char *,const fe); - -extern void fe_copy(fe,const fe); -extern int fe_isnonzero(const fe); -extern int fe_isnegative(const fe); -extern void fe_0(fe); -extern void fe_1(fe); -extern void fe_cmov(fe,const fe,unsigned int); -extern void fe_add(fe,const fe,const fe); -extern void fe_sub(fe,const fe,const fe); -extern void fe_neg(fe,const fe); -extern void fe_mul(fe,const fe,const fe); -extern void fe_sq(fe,const fe); -extern void fe_sq2(fe,const fe); -extern void fe_invert(fe,const fe); -extern void fe_pow22523(fe,const fe); - -/* - ge means group element. - * - Here the group is the set of pairs (x,y) of field elements (see fe.h) - satisfying -x^2 + y^2 = 1 + d x^2y^2 - where d = -121665/121666. - * - Representations: - ge_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z - ge_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT - ge_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T - ge_precomp (Duif): (y+x,y-x,2dxy) - */ - -#define ge_p2 crypto_core_curve25519_ref10_ge_p2 -typedef struct { - fe X; - fe Y; - fe Z; -} ge_p2; - -#define ge_p3 crypto_core_curve25519_ref10_ge_p3 -typedef struct { - fe X; - fe Y; - fe Z; - fe T; -} ge_p3; - -#define ge_p1p1 crypto_core_curve25519_ref10_ge_p1p1 -typedef struct { - fe X; - fe Y; - fe Z; - fe T; -} ge_p1p1; - -#define ge_precomp crypto_core_curve25519_ref10_ge_precomp -typedef struct { - fe yplusx; - fe yminusx; - fe xy2d; -} ge_precomp; - -#define ge_cached crypto_core_curve25519_ref10_ge_cached -typedef struct { - fe YplusX; - fe YminusX; - fe Z; - fe T2d; -} ge_cached; - -#define ge_frombytes_negate_vartime crypto_core_curve25519_ref10_ge_frombytes_negate_vartime -#define ge_tobytes crypto_core_curve25519_ref10_ge_tobytes -#define ge_p3_tobytes crypto_core_curve25519_ref10_ge_p3_tobytes - -#define ge_p2_0 crypto_core_curve25519_ref10_ge_p2_0 -#define ge_p3_0 crypto_core_curve25519_ref10_ge_p3_0 -#define ge_precomp_0 crypto_core_curve25519_ref10_ge_precomp_0 -#define ge_p3_to_p2 crypto_core_curve25519_ref10_ge_p3_to_p2 -#define ge_p3_to_cached crypto_core_curve25519_ref10_ge_p3_to_cached -#define ge_p1p1_to_p2 crypto_core_curve25519_ref10_ge_p1p1_to_p2 -#define ge_p1p1_to_p3 crypto_core_curve25519_ref10_ge_p1p1_to_p3 -#define ge_p2_dbl crypto_core_curve25519_ref10_ge_p2_dbl -#define ge_p3_dbl crypto_core_curve25519_ref10_ge_p3_dbl - -#define ge_madd crypto_core_curve25519_ref10_ge_madd -#define ge_msub crypto_core_curve25519_ref10_ge_msub -#define ge_add crypto_core_curve25519_ref10_ge_add -#define ge_sub crypto_core_curve25519_ref10_ge_sub -#define ge_scalarmult_base crypto_core_curve25519_ref10_ge_scalarmult_base -#define ge_double_scalarmult_vartime crypto_core_curve25519_ref10_ge_double_scalarmult_vartime -#define ge_scalarmult_vartime crypto_core_curve25519_ref10_ge_scalarmult_vartime - -extern void ge_tobytes(unsigned char *,const ge_p2 *); -extern void ge_p3_tobytes(unsigned char *,const ge_p3 *); -extern int ge_frombytes_negate_vartime(ge_p3 *,const unsigned char *); - -extern void ge_p2_0(ge_p2 *); -extern void ge_p3_0(ge_p3 *); -extern void ge_precomp_0(ge_precomp *); -extern void ge_p3_to_p2(ge_p2 *,const ge_p3 *); -extern void ge_p3_to_cached(ge_cached *,const ge_p3 *); -extern void ge_p1p1_to_p2(ge_p2 *,const ge_p1p1 *); -extern void ge_p1p1_to_p3(ge_p3 *,const ge_p1p1 *); -extern void ge_p2_dbl(ge_p1p1 *,const ge_p2 *); -extern void ge_p3_dbl(ge_p1p1 *,const ge_p3 *); - -extern void ge_madd(ge_p1p1 *,const ge_p3 *,const ge_precomp *); -extern void ge_msub(ge_p1p1 *,const ge_p3 *,const ge_precomp *); -extern void ge_add(ge_p1p1 *,const ge_p3 *,const ge_cached *); -extern void ge_sub(ge_p1p1 *,const ge_p3 *,const ge_cached *); -extern void ge_scalarmult_base(ge_p3 *,const unsigned char *); -extern void ge_double_scalarmult_vartime(ge_p2 *,const unsigned char *,const ge_p3 *,const unsigned char *); -extern void ge_scalarmult_vartime(ge_p3 *,const unsigned char *,const ge_p3 *); - -/* - The set of scalars is \Z/l - where l = 2^252 + 27742317777372353535851937790883648493. - */ - -#define sc_reduce crypto_core_curve25519_ref10_sc_reduce -#define sc_muladd crypto_core_curve25519_ref10_sc_muladd - -extern void sc_reduce(unsigned char *); -extern void sc_muladd(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *); - -#endif diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10.h new file mode 100644 index 00000000000..3f4c45caf0e --- /dev/null +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10.h @@ -0,0 +1,142 @@ +#ifndef ed25519_ref10_H +#define ed25519_ref10_H + +#include +#include + +/* + fe means field element. + Here the field is \Z/(2^255-19). + */ + +#ifdef HAVE_TI_MODE +typedef uint64_t fe25519[5]; +#else +typedef int32_t fe25519[10]; +#endif + +void fe25519_invert(fe25519 out, const fe25519 z); +void fe25519_frombytes(fe25519 h, const unsigned char *s); +void fe25519_tobytes(unsigned char *s, const fe25519 h); + +#ifdef HAVE_TI_MODE +# include "ed25519_ref10_fe_51.h" +#else +# include "ed25519_ref10_fe_25_5.h" +#endif + + +/* + ge means group element. + + Here the group is the set of pairs (x,y) of field elements + satisfying -x^2 + y^2 = 1 + d x^2y^2 + where d = -121665/121666. + + Representations: + ge25519_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z + ge25519_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT + ge25519_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T + ge25519_precomp (Duif): (y+x,y-x,2dxy) + */ + +typedef struct { + fe25519 X; + fe25519 Y; + fe25519 Z; +} ge25519_p2; + +typedef struct { + fe25519 X; + fe25519 Y; + fe25519 Z; + fe25519 T; +} ge25519_p3; + +typedef struct { + fe25519 X; + fe25519 Y; + fe25519 Z; + fe25519 T; +} ge25519_p1p1; + +typedef struct { + fe25519 yplusx; + fe25519 yminusx; + fe25519 xy2d; +} ge25519_precomp; + +typedef struct { + fe25519 YplusX; + fe25519 YminusX; + fe25519 Z; + fe25519 T2d; +} ge25519_cached; + +void ge25519_tobytes(unsigned char *s, const ge25519_p2 *h); + +void ge25519_p3_tobytes(unsigned char *s, const ge25519_p3 *h); + +int ge25519_frombytes(ge25519_p3 *h, const unsigned char *s); + +int ge25519_frombytes_negate_vartime(ge25519_p3 *h, const unsigned char *s); + +void ge25519_p3_to_cached(ge25519_cached *r, const ge25519_p3 *p); + +void ge25519_p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p); + +void ge25519_p1p1_to_p3(ge25519_p3 *r, const ge25519_p1p1 *p); + +void ge25519_add(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_cached *q); + +void ge25519_sub(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_cached *q); + +void ge25519_scalarmult_base(ge25519_p3 *h, const unsigned char *a); + +void ge25519_double_scalarmult_vartime(ge25519_p2 *r, const unsigned char *a, + const ge25519_p3 *A, + const unsigned char *b); + +void ge25519_scalarmult(ge25519_p3 *h, const unsigned char *a, + const ge25519_p3 *p); + +int ge25519_is_canonical(const unsigned char *s); + +int ge25519_is_on_curve(const ge25519_p3 *p); + +int ge25519_is_on_main_subgroup(const ge25519_p3 *p); + +int ge25519_has_small_order(const unsigned char s[32]); + +void ge25519_from_uniform(unsigned char s[32], const unsigned char r[32]); + +void ge25519_from_hash(unsigned char s[32], const unsigned char h[64]); + +/* + Ristretto group + */ + +int ristretto255_frombytes(ge25519_p3 *h, const unsigned char *s); + +void ristretto255_p3_tobytes(unsigned char *s, const ge25519_p3 *h); + +void ristretto255_from_hash(unsigned char s[32], const unsigned char h[64]); + +/* + The set of scalars is \Z/l + where l = 2^252 + 27742317777372353535851937790883648493. + */ + +void sc25519_invert(unsigned char recip[32], const unsigned char s[32]); + +void sc25519_reduce(unsigned char s[64]); + +void sc25519_mul(unsigned char s[32], const unsigned char a[32], + const unsigned char b[32]); + +void sc25519_muladd(unsigned char s[32], const unsigned char a[32], + const unsigned char b[32], const unsigned char c[32]); + +int sc25519_is_canonical(const unsigned char s[32]); + +#endif diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_25_5.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_25_5.h new file mode 100644 index 00000000000..5a0b6148b7b --- /dev/null +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_25_5.h @@ -0,0 +1,1050 @@ +#include + +#include "private/common.h" +#include "utils.h" + +/* + h = 0 + */ + +static inline void +fe25519_0(fe25519 h) +{ + memset(&h[0], 0, 10 * sizeof h[0]); +} + +/* + h = 1 + */ + +static inline void +fe25519_1(fe25519 h) +{ + h[0] = 1; + h[1] = 0; + memset(&h[2], 0, 8 * sizeof h[0]); +} + +/* + h = f + g + Can overlap h with f or g. + * + Preconditions: + |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. + |g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. + * + Postconditions: + |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. + */ + +static inline void +fe25519_add(fe25519 h, const fe25519 f, const fe25519 g) +{ + int32_t h0 = f[0] + g[0]; + int32_t h1 = f[1] + g[1]; + int32_t h2 = f[2] + g[2]; + int32_t h3 = f[3] + g[3]; + int32_t h4 = f[4] + g[4]; + int32_t h5 = f[5] + g[5]; + int32_t h6 = f[6] + g[6]; + int32_t h7 = f[7] + g[7]; + int32_t h8 = f[8] + g[8]; + int32_t h9 = f[9] + g[9]; + + h[0] = h0; + h[1] = h1; + h[2] = h2; + h[3] = h3; + h[4] = h4; + h[5] = h5; + h[6] = h6; + h[7] = h7; + h[8] = h8; + h[9] = h9; +} + +/* + h = f - g + Can overlap h with f or g. + * + Preconditions: + |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. + |g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. + * + Postconditions: + |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. + */ + +static void +fe25519_sub(fe25519 h, const fe25519 f, const fe25519 g) +{ + int32_t h0 = f[0] - g[0]; + int32_t h1 = f[1] - g[1]; + int32_t h2 = f[2] - g[2]; + int32_t h3 = f[3] - g[3]; + int32_t h4 = f[4] - g[4]; + int32_t h5 = f[5] - g[5]; + int32_t h6 = f[6] - g[6]; + int32_t h7 = f[7] - g[7]; + int32_t h8 = f[8] - g[8]; + int32_t h9 = f[9] - g[9]; + + h[0] = h0; + h[1] = h1; + h[2] = h2; + h[3] = h3; + h[4] = h4; + h[5] = h5; + h[6] = h6; + h[7] = h7; + h[8] = h8; + h[9] = h9; +} + +/* + h = -f + * + Preconditions: + |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. + * + Postconditions: + |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. + */ + +static inline void +fe25519_neg(fe25519 h, const fe25519 f) +{ + int32_t h0 = -f[0]; + int32_t h1 = -f[1]; + int32_t h2 = -f[2]; + int32_t h3 = -f[3]; + int32_t h4 = -f[4]; + int32_t h5 = -f[5]; + int32_t h6 = -f[6]; + int32_t h7 = -f[7]; + int32_t h8 = -f[8]; + int32_t h9 = -f[9]; + + h[0] = h0; + h[1] = h1; + h[2] = h2; + h[3] = h3; + h[4] = h4; + h[5] = h5; + h[6] = h6; + h[7] = h7; + h[8] = h8; + h[9] = h9; +} + +/* + Replace (f,g) with (g,g) if b == 1; + replace (f,g) with (f,g) if b == 0. + * + Preconditions: b in {0,1}. + */ + +static void +fe25519_cmov(fe25519 f, const fe25519 g, unsigned int b) +{ + const uint32_t mask = (uint32_t) (-(int32_t) b); + + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + + int32_t x0 = f0 ^ g[0]; + int32_t x1 = f1 ^ g[1]; + int32_t x2 = f2 ^ g[2]; + int32_t x3 = f3 ^ g[3]; + int32_t x4 = f4 ^ g[4]; + int32_t x5 = f5 ^ g[5]; + int32_t x6 = f6 ^ g[6]; + int32_t x7 = f7 ^ g[7]; + int32_t x8 = f8 ^ g[8]; + int32_t x9 = f9 ^ g[9]; + + x0 &= mask; + x1 &= mask; + x2 &= mask; + x3 &= mask; + x4 &= mask; + x5 &= mask; + x6 &= mask; + x7 &= mask; + x8 &= mask; + x9 &= mask; + + f[0] = f0 ^ x0; + f[1] = f1 ^ x1; + f[2] = f2 ^ x2; + f[3] = f3 ^ x3; + f[4] = f4 ^ x4; + f[5] = f5 ^ x5; + f[6] = f6 ^ x6; + f[7] = f7 ^ x7; + f[8] = f8 ^ x8; + f[9] = f9 ^ x9; +} + +static void +fe25519_cswap(fe25519 f, fe25519 g, unsigned int b) +{ + const uint32_t mask = (uint32_t) (-(int64_t) b); + + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + + int32_t g0 = g[0]; + int32_t g1 = g[1]; + int32_t g2 = g[2]; + int32_t g3 = g[3]; + int32_t g4 = g[4]; + int32_t g5 = g[5]; + int32_t g6 = g[6]; + int32_t g7 = g[7]; + int32_t g8 = g[8]; + int32_t g9 = g[9]; + + int32_t x0 = f0 ^ g0; + int32_t x1 = f1 ^ g1; + int32_t x2 = f2 ^ g2; + int32_t x3 = f3 ^ g3; + int32_t x4 = f4 ^ g4; + int32_t x5 = f5 ^ g5; + int32_t x6 = f6 ^ g6; + int32_t x7 = f7 ^ g7; + int32_t x8 = f8 ^ g8; + int32_t x9 = f9 ^ g9; + + x0 &= mask; + x1 &= mask; + x2 &= mask; + x3 &= mask; + x4 &= mask; + x5 &= mask; + x6 &= mask; + x7 &= mask; + x8 &= mask; + x9 &= mask; + + f[0] = f0 ^ x0; + f[1] = f1 ^ x1; + f[2] = f2 ^ x2; + f[3] = f3 ^ x3; + f[4] = f4 ^ x4; + f[5] = f5 ^ x5; + f[6] = f6 ^ x6; + f[7] = f7 ^ x7; + f[8] = f8 ^ x8; + f[9] = f9 ^ x9; + + g[0] = g0 ^ x0; + g[1] = g1 ^ x1; + g[2] = g2 ^ x2; + g[3] = g3 ^ x3; + g[4] = g4 ^ x4; + g[5] = g5 ^ x5; + g[6] = g6 ^ x6; + g[7] = g7 ^ x7; + g[8] = g8 ^ x8; + g[9] = g9 ^ x9; +} + +/* + h = f + */ + +static inline void +fe25519_copy(fe25519 h, const fe25519 f) +{ + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + + h[0] = f0; + h[1] = f1; + h[2] = f2; + h[3] = f3; + h[4] = f4; + h[5] = f5; + h[6] = f6; + h[7] = f7; + h[8] = f8; + h[9] = f9; +} + +/* + return 1 if f is in {1,3,5,...,q-2} + return 0 if f is in {0,2,4,...,q-1} + + Preconditions: + |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. + */ + +static inline int +fe25519_isnegative(const fe25519 f) +{ + unsigned char s[32]; + + fe25519_tobytes(s, f); + + return s[0] & 1; +} + +/* + return 1 if f == 0 + return 0 if f != 0 + + Preconditions: + |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. + */ + +static inline int +fe25519_iszero(const fe25519 f) +{ + unsigned char s[32]; + + fe25519_tobytes(s, f); + + return sodium_is_zero(s, 32); +} + +/* + h = f * g + Can overlap h with f or g. + * + Preconditions: + |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc. + |g| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc. + * + Postconditions: + |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc. + */ + +/* + Notes on implementation strategy: + * + Using schoolbook multiplication. + Karatsuba would save a little in some cost models. + * + Most multiplications by 2 and 19 are 32-bit precomputations; + cheaper than 64-bit postcomputations. + * + There is one remaining multiplication by 19 in the carry chain; + one *19 precomputation can be merged into this, + but the resulting data flow is considerably less clean. + * + There are 12 carries below. + 10 of them are 2-way parallelizable and vectorizable. + Can get away with 11 carries, but then data flow is much deeper. + * + With tighter constraints on inputs can squeeze carries into int32. + */ + +static void +fe25519_mul(fe25519 h, const fe25519 f, const fe25519 g) +{ + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + + int32_t g0 = g[0]; + int32_t g1 = g[1]; + int32_t g2 = g[2]; + int32_t g3 = g[3]; + int32_t g4 = g[4]; + int32_t g5 = g[5]; + int32_t g6 = g[6]; + int32_t g7 = g[7]; + int32_t g8 = g[8]; + int32_t g9 = g[9]; + + int32_t g1_19 = 19 * g1; /* 1.959375*2^29 */ + int32_t g2_19 = 19 * g2; /* 1.959375*2^30; still ok */ + int32_t g3_19 = 19 * g3; + int32_t g4_19 = 19 * g4; + int32_t g5_19 = 19 * g5; + int32_t g6_19 = 19 * g6; + int32_t g7_19 = 19 * g7; + int32_t g8_19 = 19 * g8; + int32_t g9_19 = 19 * g9; + int32_t f1_2 = 2 * f1; + int32_t f3_2 = 2 * f3; + int32_t f5_2 = 2 * f5; + int32_t f7_2 = 2 * f7; + int32_t f9_2 = 2 * f9; + + int64_t f0g0 = f0 * (int64_t) g0; + int64_t f0g1 = f0 * (int64_t) g1; + int64_t f0g2 = f0 * (int64_t) g2; + int64_t f0g3 = f0 * (int64_t) g3; + int64_t f0g4 = f0 * (int64_t) g4; + int64_t f0g5 = f0 * (int64_t) g5; + int64_t f0g6 = f0 * (int64_t) g6; + int64_t f0g7 = f0 * (int64_t) g7; + int64_t f0g8 = f0 * (int64_t) g8; + int64_t f0g9 = f0 * (int64_t) g9; + int64_t f1g0 = f1 * (int64_t) g0; + int64_t f1g1_2 = f1_2 * (int64_t) g1; + int64_t f1g2 = f1 * (int64_t) g2; + int64_t f1g3_2 = f1_2 * (int64_t) g3; + int64_t f1g4 = f1 * (int64_t) g4; + int64_t f1g5_2 = f1_2 * (int64_t) g5; + int64_t f1g6 = f1 * (int64_t) g6; + int64_t f1g7_2 = f1_2 * (int64_t) g7; + int64_t f1g8 = f1 * (int64_t) g8; + int64_t f1g9_38 = f1_2 * (int64_t) g9_19; + int64_t f2g0 = f2 * (int64_t) g0; + int64_t f2g1 = f2 * (int64_t) g1; + int64_t f2g2 = f2 * (int64_t) g2; + int64_t f2g3 = f2 * (int64_t) g3; + int64_t f2g4 = f2 * (int64_t) g4; + int64_t f2g5 = f2 * (int64_t) g5; + int64_t f2g6 = f2 * (int64_t) g6; + int64_t f2g7 = f2 * (int64_t) g7; + int64_t f2g8_19 = f2 * (int64_t) g8_19; + int64_t f2g9_19 = f2 * (int64_t) g9_19; + int64_t f3g0 = f3 * (int64_t) g0; + int64_t f3g1_2 = f3_2 * (int64_t) g1; + int64_t f3g2 = f3 * (int64_t) g2; + int64_t f3g3_2 = f3_2 * (int64_t) g3; + int64_t f3g4 = f3 * (int64_t) g4; + int64_t f3g5_2 = f3_2 * (int64_t) g5; + int64_t f3g6 = f3 * (int64_t) g6; + int64_t f3g7_38 = f3_2 * (int64_t) g7_19; + int64_t f3g8_19 = f3 * (int64_t) g8_19; + int64_t f3g9_38 = f3_2 * (int64_t) g9_19; + int64_t f4g0 = f4 * (int64_t) g0; + int64_t f4g1 = f4 * (int64_t) g1; + int64_t f4g2 = f4 * (int64_t) g2; + int64_t f4g3 = f4 * (int64_t) g3; + int64_t f4g4 = f4 * (int64_t) g4; + int64_t f4g5 = f4 * (int64_t) g5; + int64_t f4g6_19 = f4 * (int64_t) g6_19; + int64_t f4g7_19 = f4 * (int64_t) g7_19; + int64_t f4g8_19 = f4 * (int64_t) g8_19; + int64_t f4g9_19 = f4 * (int64_t) g9_19; + int64_t f5g0 = f5 * (int64_t) g0; + int64_t f5g1_2 = f5_2 * (int64_t) g1; + int64_t f5g2 = f5 * (int64_t) g2; + int64_t f5g3_2 = f5_2 * (int64_t) g3; + int64_t f5g4 = f5 * (int64_t) g4; + int64_t f5g5_38 = f5_2 * (int64_t) g5_19; + int64_t f5g6_19 = f5 * (int64_t) g6_19; + int64_t f5g7_38 = f5_2 * (int64_t) g7_19; + int64_t f5g8_19 = f5 * (int64_t) g8_19; + int64_t f5g9_38 = f5_2 * (int64_t) g9_19; + int64_t f6g0 = f6 * (int64_t) g0; + int64_t f6g1 = f6 * (int64_t) g1; + int64_t f6g2 = f6 * (int64_t) g2; + int64_t f6g3 = f6 * (int64_t) g3; + int64_t f6g4_19 = f6 * (int64_t) g4_19; + int64_t f6g5_19 = f6 * (int64_t) g5_19; + int64_t f6g6_19 = f6 * (int64_t) g6_19; + int64_t f6g7_19 = f6 * (int64_t) g7_19; + int64_t f6g8_19 = f6 * (int64_t) g8_19; + int64_t f6g9_19 = f6 * (int64_t) g9_19; + int64_t f7g0 = f7 * (int64_t) g0; + int64_t f7g1_2 = f7_2 * (int64_t) g1; + int64_t f7g2 = f7 * (int64_t) g2; + int64_t f7g3_38 = f7_2 * (int64_t) g3_19; + int64_t f7g4_19 = f7 * (int64_t) g4_19; + int64_t f7g5_38 = f7_2 * (int64_t) g5_19; + int64_t f7g6_19 = f7 * (int64_t) g6_19; + int64_t f7g7_38 = f7_2 * (int64_t) g7_19; + int64_t f7g8_19 = f7 * (int64_t) g8_19; + int64_t f7g9_38 = f7_2 * (int64_t) g9_19; + int64_t f8g0 = f8 * (int64_t) g0; + int64_t f8g1 = f8 * (int64_t) g1; + int64_t f8g2_19 = f8 * (int64_t) g2_19; + int64_t f8g3_19 = f8 * (int64_t) g3_19; + int64_t f8g4_19 = f8 * (int64_t) g4_19; + int64_t f8g5_19 = f8 * (int64_t) g5_19; + int64_t f8g6_19 = f8 * (int64_t) g6_19; + int64_t f8g7_19 = f8 * (int64_t) g7_19; + int64_t f8g8_19 = f8 * (int64_t) g8_19; + int64_t f8g9_19 = f8 * (int64_t) g9_19; + int64_t f9g0 = f9 * (int64_t) g0; + int64_t f9g1_38 = f9_2 * (int64_t) g1_19; + int64_t f9g2_19 = f9 * (int64_t) g2_19; + int64_t f9g3_38 = f9_2 * (int64_t) g3_19; + int64_t f9g4_19 = f9 * (int64_t) g4_19; + int64_t f9g5_38 = f9_2 * (int64_t) g5_19; + int64_t f9g6_19 = f9 * (int64_t) g6_19; + int64_t f9g7_38 = f9_2 * (int64_t) g7_19; + int64_t f9g8_19 = f9 * (int64_t) g8_19; + int64_t f9g9_38 = f9_2 * (int64_t) g9_19; + + int64_t h0 = f0g0 + f1g9_38 + f2g8_19 + f3g7_38 + f4g6_19 + f5g5_38 + + f6g4_19 + f7g3_38 + f8g2_19 + f9g1_38; + int64_t h1 = f0g1 + f1g0 + f2g9_19 + f3g8_19 + f4g7_19 + f5g6_19 + f6g5_19 + + f7g4_19 + f8g3_19 + f9g2_19; + int64_t h2 = f0g2 + f1g1_2 + f2g0 + f3g9_38 + f4g8_19 + f5g7_38 + f6g6_19 + + f7g5_38 + f8g4_19 + f9g3_38; + int64_t h3 = f0g3 + f1g2 + f2g1 + f3g0 + f4g9_19 + f5g8_19 + f6g7_19 + + f7g6_19 + f8g5_19 + f9g4_19; + int64_t h4 = f0g4 + f1g3_2 + f2g2 + f3g1_2 + f4g0 + f5g9_38 + f6g8_19 + + f7g7_38 + f8g6_19 + f9g5_38; + int64_t h5 = f0g5 + f1g4 + f2g3 + f3g2 + f4g1 + f5g0 + f6g9_19 + f7g8_19 + + f8g7_19 + f9g6_19; + int64_t h6 = f0g6 + f1g5_2 + f2g4 + f3g3_2 + f4g2 + f5g1_2 + f6g0 + + f7g9_38 + f8g8_19 + f9g7_38; + int64_t h7 = f0g7 + f1g6 + f2g5 + f3g4 + f4g3 + f5g2 + f6g1 + f7g0 + + f8g9_19 + f9g8_19; + int64_t h8 = f0g8 + f1g7_2 + f2g6 + f3g5_2 + f4g4 + f5g3_2 + f6g2 + f7g1_2 + + f8g0 + f9g9_38; + int64_t h9 = + f0g9 + f1g8 + f2g7 + f3g6 + f4g5 + f5g4 + f6g3 + f7g2 + f8g1 + f9g0; + + int64_t carry0; + int64_t carry1; + int64_t carry2; + int64_t carry3; + int64_t carry4; + int64_t carry5; + int64_t carry6; + int64_t carry7; + int64_t carry8; + int64_t carry9; + + /* + |h0| <= (1.65*1.65*2^52*(1+19+19+19+19)+1.65*1.65*2^50*(38+38+38+38+38)) + i.e. |h0| <= 1.4*2^60; narrower ranges for h2, h4, h6, h8 + |h1| <= (1.65*1.65*2^51*(1+1+19+19+19+19+19+19+19+19)) + i.e. |h1| <= 1.7*2^59; narrower ranges for h3, h5, h7, h9 + */ + + carry0 = (h0 + (int64_t)(1L << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((uint64_t) 1L << 26); + carry4 = (h4 + (int64_t)(1L << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((uint64_t) 1L << 26); + /* |h0| <= 2^25 */ + /* |h4| <= 2^25 */ + /* |h1| <= 1.71*2^59 */ + /* |h5| <= 1.71*2^59 */ + + carry1 = (h1 + (int64_t)(1L << 24)) >> 25; + h2 += carry1; + h1 -= carry1 * ((uint64_t) 1L << 25); + carry5 = (h5 + (int64_t)(1L << 24)) >> 25; + h6 += carry5; + h5 -= carry5 * ((uint64_t) 1L << 25); + /* |h1| <= 2^24; from now on fits into int32 */ + /* |h5| <= 2^24; from now on fits into int32 */ + /* |h2| <= 1.41*2^60 */ + /* |h6| <= 1.41*2^60 */ + + carry2 = (h2 + (int64_t)(1L << 25)) >> 26; + h3 += carry2; + h2 -= carry2 * ((uint64_t) 1L << 26); + carry6 = (h6 + (int64_t)(1L << 25)) >> 26; + h7 += carry6; + h6 -= carry6 * ((uint64_t) 1L << 26); + /* |h2| <= 2^25; from now on fits into int32 unchanged */ + /* |h6| <= 2^25; from now on fits into int32 unchanged */ + /* |h3| <= 1.71*2^59 */ + /* |h7| <= 1.71*2^59 */ + + carry3 = (h3 + (int64_t)(1L << 24)) >> 25; + h4 += carry3; + h3 -= carry3 * ((uint64_t) 1L << 25); + carry7 = (h7 + (int64_t)(1L << 24)) >> 25; + h8 += carry7; + h7 -= carry7 * ((uint64_t) 1L << 25); + /* |h3| <= 2^24; from now on fits into int32 unchanged */ + /* |h7| <= 2^24; from now on fits into int32 unchanged */ + /* |h4| <= 1.72*2^34 */ + /* |h8| <= 1.41*2^60 */ + + carry4 = (h4 + (int64_t)(1L << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((uint64_t) 1L << 26); + carry8 = (h8 + (int64_t)(1L << 25)) >> 26; + h9 += carry8; + h8 -= carry8 * ((uint64_t) 1L << 26); + /* |h4| <= 2^25; from now on fits into int32 unchanged */ + /* |h8| <= 2^25; from now on fits into int32 unchanged */ + /* |h5| <= 1.01*2^24 */ + /* |h9| <= 1.71*2^59 */ + + carry9 = (h9 + (int64_t)(1L << 24)) >> 25; + h0 += carry9 * 19; + h9 -= carry9 * ((uint64_t) 1L << 25); + /* |h9| <= 2^24; from now on fits into int32 unchanged */ + /* |h0| <= 1.1*2^39 */ + + carry0 = (h0 + (int64_t)(1L << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((uint64_t) 1L << 26); + /* |h0| <= 2^25; from now on fits into int32 unchanged */ + /* |h1| <= 1.01*2^24 */ + + h[0] = (int32_t) h0; + h[1] = (int32_t) h1; + h[2] = (int32_t) h2; + h[3] = (int32_t) h3; + h[4] = (int32_t) h4; + h[5] = (int32_t) h5; + h[6] = (int32_t) h6; + h[7] = (int32_t) h7; + h[8] = (int32_t) h8; + h[9] = (int32_t) h9; +} + +/* + h = f * f + Can overlap h with f. + * + Preconditions: + |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc. + * + Postconditions: + |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc. + */ + +static void +fe25519_sq(fe25519 h, const fe25519 f) +{ + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + + int32_t f0_2 = 2 * f0; + int32_t f1_2 = 2 * f1; + int32_t f2_2 = 2 * f2; + int32_t f3_2 = 2 * f3; + int32_t f4_2 = 2 * f4; + int32_t f5_2 = 2 * f5; + int32_t f6_2 = 2 * f6; + int32_t f7_2 = 2 * f7; + int32_t f5_38 = 38 * f5; /* 1.959375*2^30 */ + int32_t f6_19 = 19 * f6; /* 1.959375*2^30 */ + int32_t f7_38 = 38 * f7; /* 1.959375*2^30 */ + int32_t f8_19 = 19 * f8; /* 1.959375*2^30 */ + int32_t f9_38 = 38 * f9; /* 1.959375*2^30 */ + + int64_t f0f0 = f0 * (int64_t) f0; + int64_t f0f1_2 = f0_2 * (int64_t) f1; + int64_t f0f2_2 = f0_2 * (int64_t) f2; + int64_t f0f3_2 = f0_2 * (int64_t) f3; + int64_t f0f4_2 = f0_2 * (int64_t) f4; + int64_t f0f5_2 = f0_2 * (int64_t) f5; + int64_t f0f6_2 = f0_2 * (int64_t) f6; + int64_t f0f7_2 = f0_2 * (int64_t) f7; + int64_t f0f8_2 = f0_2 * (int64_t) f8; + int64_t f0f9_2 = f0_2 * (int64_t) f9; + int64_t f1f1_2 = f1_2 * (int64_t) f1; + int64_t f1f2_2 = f1_2 * (int64_t) f2; + int64_t f1f3_4 = f1_2 * (int64_t) f3_2; + int64_t f1f4_2 = f1_2 * (int64_t) f4; + int64_t f1f5_4 = f1_2 * (int64_t) f5_2; + int64_t f1f6_2 = f1_2 * (int64_t) f6; + int64_t f1f7_4 = f1_2 * (int64_t) f7_2; + int64_t f1f8_2 = f1_2 * (int64_t) f8; + int64_t f1f9_76 = f1_2 * (int64_t) f9_38; + int64_t f2f2 = f2 * (int64_t) f2; + int64_t f2f3_2 = f2_2 * (int64_t) f3; + int64_t f2f4_2 = f2_2 * (int64_t) f4; + int64_t f2f5_2 = f2_2 * (int64_t) f5; + int64_t f2f6_2 = f2_2 * (int64_t) f6; + int64_t f2f7_2 = f2_2 * (int64_t) f7; + int64_t f2f8_38 = f2_2 * (int64_t) f8_19; + int64_t f2f9_38 = f2 * (int64_t) f9_38; + int64_t f3f3_2 = f3_2 * (int64_t) f3; + int64_t f3f4_2 = f3_2 * (int64_t) f4; + int64_t f3f5_4 = f3_2 * (int64_t) f5_2; + int64_t f3f6_2 = f3_2 * (int64_t) f6; + int64_t f3f7_76 = f3_2 * (int64_t) f7_38; + int64_t f3f8_38 = f3_2 * (int64_t) f8_19; + int64_t f3f9_76 = f3_2 * (int64_t) f9_38; + int64_t f4f4 = f4 * (int64_t) f4; + int64_t f4f5_2 = f4_2 * (int64_t) f5; + int64_t f4f6_38 = f4_2 * (int64_t) f6_19; + int64_t f4f7_38 = f4 * (int64_t) f7_38; + int64_t f4f8_38 = f4_2 * (int64_t) f8_19; + int64_t f4f9_38 = f4 * (int64_t) f9_38; + int64_t f5f5_38 = f5 * (int64_t) f5_38; + int64_t f5f6_38 = f5_2 * (int64_t) f6_19; + int64_t f5f7_76 = f5_2 * (int64_t) f7_38; + int64_t f5f8_38 = f5_2 * (int64_t) f8_19; + int64_t f5f9_76 = f5_2 * (int64_t) f9_38; + int64_t f6f6_19 = f6 * (int64_t) f6_19; + int64_t f6f7_38 = f6 * (int64_t) f7_38; + int64_t f6f8_38 = f6_2 * (int64_t) f8_19; + int64_t f6f9_38 = f6 * (int64_t) f9_38; + int64_t f7f7_38 = f7 * (int64_t) f7_38; + int64_t f7f8_38 = f7_2 * (int64_t) f8_19; + int64_t f7f9_76 = f7_2 * (int64_t) f9_38; + int64_t f8f8_19 = f8 * (int64_t) f8_19; + int64_t f8f9_38 = f8 * (int64_t) f9_38; + int64_t f9f9_38 = f9 * (int64_t) f9_38; + + int64_t h0 = f0f0 + f1f9_76 + f2f8_38 + f3f7_76 + f4f6_38 + f5f5_38; + int64_t h1 = f0f1_2 + f2f9_38 + f3f8_38 + f4f7_38 + f5f6_38; + int64_t h2 = f0f2_2 + f1f1_2 + f3f9_76 + f4f8_38 + f5f7_76 + f6f6_19; + int64_t h3 = f0f3_2 + f1f2_2 + f4f9_38 + f5f8_38 + f6f7_38; + int64_t h4 = f0f4_2 + f1f3_4 + f2f2 + f5f9_76 + f6f8_38 + f7f7_38; + int64_t h5 = f0f5_2 + f1f4_2 + f2f3_2 + f6f9_38 + f7f8_38; + int64_t h6 = f0f6_2 + f1f5_4 + f2f4_2 + f3f3_2 + f7f9_76 + f8f8_19; + int64_t h7 = f0f7_2 + f1f6_2 + f2f5_2 + f3f4_2 + f8f9_38; + int64_t h8 = f0f8_2 + f1f7_4 + f2f6_2 + f3f5_4 + f4f4 + f9f9_38; + int64_t h9 = f0f9_2 + f1f8_2 + f2f7_2 + f3f6_2 + f4f5_2; + + int64_t carry0; + int64_t carry1; + int64_t carry2; + int64_t carry3; + int64_t carry4; + int64_t carry5; + int64_t carry6; + int64_t carry7; + int64_t carry8; + int64_t carry9; + + carry0 = (h0 + (int64_t)(1L << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((uint64_t) 1L << 26); + carry4 = (h4 + (int64_t)(1L << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((uint64_t) 1L << 26); + + carry1 = (h1 + (int64_t)(1L << 24)) >> 25; + h2 += carry1; + h1 -= carry1 * ((uint64_t) 1L << 25); + carry5 = (h5 + (int64_t)(1L << 24)) >> 25; + h6 += carry5; + h5 -= carry5 * ((uint64_t) 1L << 25); + + carry2 = (h2 + (int64_t)(1L << 25)) >> 26; + h3 += carry2; + h2 -= carry2 * ((uint64_t) 1L << 26); + carry6 = (h6 + (int64_t)(1L << 25)) >> 26; + h7 += carry6; + h6 -= carry6 * ((uint64_t) 1L << 26); + + carry3 = (h3 + (int64_t)(1L << 24)) >> 25; + h4 += carry3; + h3 -= carry3 * ((uint64_t) 1L << 25); + carry7 = (h7 + (int64_t)(1L << 24)) >> 25; + h8 += carry7; + h7 -= carry7 * ((uint64_t) 1L << 25); + + carry4 = (h4 + (int64_t)(1L << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((uint64_t) 1L << 26); + carry8 = (h8 + (int64_t)(1L << 25)) >> 26; + h9 += carry8; + h8 -= carry8 * ((uint64_t) 1L << 26); + + carry9 = (h9 + (int64_t)(1L << 24)) >> 25; + h0 += carry9 * 19; + h9 -= carry9 * ((uint64_t) 1L << 25); + + carry0 = (h0 + (int64_t)(1L << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((uint64_t) 1L << 26); + + h[0] = (int32_t) h0; + h[1] = (int32_t) h1; + h[2] = (int32_t) h2; + h[3] = (int32_t) h3; + h[4] = (int32_t) h4; + h[5] = (int32_t) h5; + h[6] = (int32_t) h6; + h[7] = (int32_t) h7; + h[8] = (int32_t) h8; + h[9] = (int32_t) h9; +} + +/* + h = 2 * f * f + Can overlap h with f. + * + Preconditions: + |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc. + * + Postconditions: + |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc. + */ + +static void +fe25519_sq2(fe25519 h, const fe25519 f) +{ + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + + int32_t f0_2 = 2 * f0; + int32_t f1_2 = 2 * f1; + int32_t f2_2 = 2 * f2; + int32_t f3_2 = 2 * f3; + int32_t f4_2 = 2 * f4; + int32_t f5_2 = 2 * f5; + int32_t f6_2 = 2 * f6; + int32_t f7_2 = 2 * f7; + int32_t f5_38 = 38 * f5; /* 1.959375*2^30 */ + int32_t f6_19 = 19 * f6; /* 1.959375*2^30 */ + int32_t f7_38 = 38 * f7; /* 1.959375*2^30 */ + int32_t f8_19 = 19 * f8; /* 1.959375*2^30 */ + int32_t f9_38 = 38 * f9; /* 1.959375*2^30 */ + + int64_t f0f0 = f0 * (int64_t) f0; + int64_t f0f1_2 = f0_2 * (int64_t) f1; + int64_t f0f2_2 = f0_2 * (int64_t) f2; + int64_t f0f3_2 = f0_2 * (int64_t) f3; + int64_t f0f4_2 = f0_2 * (int64_t) f4; + int64_t f0f5_2 = f0_2 * (int64_t) f5; + int64_t f0f6_2 = f0_2 * (int64_t) f6; + int64_t f0f7_2 = f0_2 * (int64_t) f7; + int64_t f0f8_2 = f0_2 * (int64_t) f8; + int64_t f0f9_2 = f0_2 * (int64_t) f9; + int64_t f1f1_2 = f1_2 * (int64_t) f1; + int64_t f1f2_2 = f1_2 * (int64_t) f2; + int64_t f1f3_4 = f1_2 * (int64_t) f3_2; + int64_t f1f4_2 = f1_2 * (int64_t) f4; + int64_t f1f5_4 = f1_2 * (int64_t) f5_2; + int64_t f1f6_2 = f1_2 * (int64_t) f6; + int64_t f1f7_4 = f1_2 * (int64_t) f7_2; + int64_t f1f8_2 = f1_2 * (int64_t) f8; + int64_t f1f9_76 = f1_2 * (int64_t) f9_38; + int64_t f2f2 = f2 * (int64_t) f2; + int64_t f2f3_2 = f2_2 * (int64_t) f3; + int64_t f2f4_2 = f2_2 * (int64_t) f4; + int64_t f2f5_2 = f2_2 * (int64_t) f5; + int64_t f2f6_2 = f2_2 * (int64_t) f6; + int64_t f2f7_2 = f2_2 * (int64_t) f7; + int64_t f2f8_38 = f2_2 * (int64_t) f8_19; + int64_t f2f9_38 = f2 * (int64_t) f9_38; + int64_t f3f3_2 = f3_2 * (int64_t) f3; + int64_t f3f4_2 = f3_2 * (int64_t) f4; + int64_t f3f5_4 = f3_2 * (int64_t) f5_2; + int64_t f3f6_2 = f3_2 * (int64_t) f6; + int64_t f3f7_76 = f3_2 * (int64_t) f7_38; + int64_t f3f8_38 = f3_2 * (int64_t) f8_19; + int64_t f3f9_76 = f3_2 * (int64_t) f9_38; + int64_t f4f4 = f4 * (int64_t) f4; + int64_t f4f5_2 = f4_2 * (int64_t) f5; + int64_t f4f6_38 = f4_2 * (int64_t) f6_19; + int64_t f4f7_38 = f4 * (int64_t) f7_38; + int64_t f4f8_38 = f4_2 * (int64_t) f8_19; + int64_t f4f9_38 = f4 * (int64_t) f9_38; + int64_t f5f5_38 = f5 * (int64_t) f5_38; + int64_t f5f6_38 = f5_2 * (int64_t) f6_19; + int64_t f5f7_76 = f5_2 * (int64_t) f7_38; + int64_t f5f8_38 = f5_2 * (int64_t) f8_19; + int64_t f5f9_76 = f5_2 * (int64_t) f9_38; + int64_t f6f6_19 = f6 * (int64_t) f6_19; + int64_t f6f7_38 = f6 * (int64_t) f7_38; + int64_t f6f8_38 = f6_2 * (int64_t) f8_19; + int64_t f6f9_38 = f6 * (int64_t) f9_38; + int64_t f7f7_38 = f7 * (int64_t) f7_38; + int64_t f7f8_38 = f7_2 * (int64_t) f8_19; + int64_t f7f9_76 = f7_2 * (int64_t) f9_38; + int64_t f8f8_19 = f8 * (int64_t) f8_19; + int64_t f8f9_38 = f8 * (int64_t) f9_38; + int64_t f9f9_38 = f9 * (int64_t) f9_38; + + int64_t h0 = f0f0 + f1f9_76 + f2f8_38 + f3f7_76 + f4f6_38 + f5f5_38; + int64_t h1 = f0f1_2 + f2f9_38 + f3f8_38 + f4f7_38 + f5f6_38; + int64_t h2 = f0f2_2 + f1f1_2 + f3f9_76 + f4f8_38 + f5f7_76 + f6f6_19; + int64_t h3 = f0f3_2 + f1f2_2 + f4f9_38 + f5f8_38 + f6f7_38; + int64_t h4 = f0f4_2 + f1f3_4 + f2f2 + f5f9_76 + f6f8_38 + f7f7_38; + int64_t h5 = f0f5_2 + f1f4_2 + f2f3_2 + f6f9_38 + f7f8_38; + int64_t h6 = f0f6_2 + f1f5_4 + f2f4_2 + f3f3_2 + f7f9_76 + f8f8_19; + int64_t h7 = f0f7_2 + f1f6_2 + f2f5_2 + f3f4_2 + f8f9_38; + int64_t h8 = f0f8_2 + f1f7_4 + f2f6_2 + f3f5_4 + f4f4 + f9f9_38; + int64_t h9 = f0f9_2 + f1f8_2 + f2f7_2 + f3f6_2 + f4f5_2; + + int64_t carry0; + int64_t carry1; + int64_t carry2; + int64_t carry3; + int64_t carry4; + int64_t carry5; + int64_t carry6; + int64_t carry7; + int64_t carry8; + int64_t carry9; + + h0 += h0; + h1 += h1; + h2 += h2; + h3 += h3; + h4 += h4; + h5 += h5; + h6 += h6; + h7 += h7; + h8 += h8; + h9 += h9; + + carry0 = (h0 + (int64_t)(1L << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((uint64_t) 1L << 26); + carry4 = (h4 + (int64_t)(1L << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((uint64_t) 1L << 26); + + carry1 = (h1 + (int64_t)(1L << 24)) >> 25; + h2 += carry1; + h1 -= carry1 * ((uint64_t) 1L << 25); + carry5 = (h5 + (int64_t)(1L << 24)) >> 25; + h6 += carry5; + h5 -= carry5 * ((uint64_t) 1L << 25); + + carry2 = (h2 + (int64_t)(1L << 25)) >> 26; + h3 += carry2; + h2 -= carry2 * ((uint64_t) 1L << 26); + carry6 = (h6 + (int64_t)(1L << 25)) >> 26; + h7 += carry6; + h6 -= carry6 * ((uint64_t) 1L << 26); + + carry3 = (h3 + (int64_t)(1L << 24)) >> 25; + h4 += carry3; + h3 -= carry3 * ((uint64_t) 1L << 25); + carry7 = (h7 + (int64_t)(1L << 24)) >> 25; + h8 += carry7; + h7 -= carry7 * ((uint64_t) 1L << 25); + + carry4 = (h4 + (int64_t)(1L << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((uint64_t) 1L << 26); + carry8 = (h8 + (int64_t)(1L << 25)) >> 26; + h9 += carry8; + h8 -= carry8 * ((uint64_t) 1L << 26); + + carry9 = (h9 + (int64_t)(1L << 24)) >> 25; + h0 += carry9 * 19; + h9 -= carry9 * ((uint64_t) 1L << 25); + + carry0 = (h0 + (int64_t)(1L << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((uint64_t) 1L << 26); + + h[0] = (int32_t) h0; + h[1] = (int32_t) h1; + h[2] = (int32_t) h2; + h[3] = (int32_t) h3; + h[4] = (int32_t) h4; + h[5] = (int32_t) h5; + h[6] = (int32_t) h6; + h[7] = (int32_t) h7; + h[8] = (int32_t) h8; + h[9] = (int32_t) h9; +} + +static void +fe25519_scalar_product(fe25519 h, const fe25519 f, uint32_t n) +{ + int64_t sn = (int64_t) n; + int32_t f0 = f[0]; + int32_t f1 = f[1]; + int32_t f2 = f[2]; + int32_t f3 = f[3]; + int32_t f4 = f[4]; + int32_t f5 = f[5]; + int32_t f6 = f[6]; + int32_t f7 = f[7]; + int32_t f8 = f[8]; + int32_t f9 = f[9]; + int64_t h0 = f0 * sn; + int64_t h1 = f1 * sn; + int64_t h2 = f2 * sn; + int64_t h3 = f3 * sn; + int64_t h4 = f4 * sn; + int64_t h5 = f5 * sn; + int64_t h6 = f6 * sn; + int64_t h7 = f7 * sn; + int64_t h8 = f8 * sn; + int64_t h9 = f9 * sn; + int64_t carry0, carry1, carry2, carry3, carry4, carry5, carry6, carry7, + carry8, carry9; + + carry9 = (h9 + ((int64_t) 1 << 24)) >> 25; + h0 += carry9 * 19; + h9 -= carry9 * ((int64_t) 1 << 25); + carry1 = (h1 + ((int64_t) 1 << 24)) >> 25; + h2 += carry1; + h1 -= carry1 * ((int64_t) 1 << 25); + carry3 = (h3 + ((int64_t) 1 << 24)) >> 25; + h4 += carry3; + h3 -= carry3 * ((int64_t) 1 << 25); + carry5 = (h5 + ((int64_t) 1 << 24)) >> 25; + h6 += carry5; + h5 -= carry5 * ((int64_t) 1 << 25); + carry7 = (h7 + ((int64_t) 1 << 24)) >> 25; + h8 += carry7; + h7 -= carry7 * ((int64_t) 1 << 25); + + carry0 = (h0 + ((int64_t) 1 << 25)) >> 26; + h1 += carry0; + h0 -= carry0 * ((int64_t) 1 << 26); + carry2 = (h2 + ((int64_t) 1 << 25)) >> 26; + h3 += carry2; + h2 -= carry2 * ((int64_t) 1 << 26); + carry4 = (h4 + ((int64_t) 1 << 25)) >> 26; + h5 += carry4; + h4 -= carry4 * ((int64_t) 1 << 26); + carry6 = (h6 + ((int64_t) 1 << 25)) >> 26; + h7 += carry6; + h6 -= carry6 * ((int64_t) 1 << 26); + carry8 = (h8 + ((int64_t) 1 << 25)) >> 26; + h9 += carry8; + h8 -= carry8 * ((int64_t) 1 << 26); + + h[0] = (int32_t) h0; + h[1] = (int32_t) h1; + h[2] = (int32_t) h2; + h[3] = (int32_t) h3; + h[4] = (int32_t) h4; + h[5] = (int32_t) h5; + h[6] = (int32_t) h6; + h[7] = (int32_t) h7; + h[8] = (int32_t) h8; + h[9] = (int32_t) h9; +} diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_51.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_51.h new file mode 100644 index 00000000000..3a30f30148a --- /dev/null +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/ed25519_ref10_fe_51.h @@ -0,0 +1,518 @@ +#include + +#include "private/common.h" +#include "utils.h" + +/* + h = 0 + */ + +static inline void +fe25519_0(fe25519 h) +{ + memset(&h[0], 0, 5 * sizeof h[0]); +} + +/* + h = 1 + */ + +static inline void +fe25519_1(fe25519 h) +{ + h[0] = 1; + memset(&h[1], 0, 4 * sizeof h[0]); +} + +/* + h = f + g + Can overlap h with f or g. + */ + +static inline void +fe25519_add(fe25519 h, const fe25519 f, const fe25519 g) +{ + uint64_t h0 = f[0] + g[0]; + uint64_t h1 = f[1] + g[1]; + uint64_t h2 = f[2] + g[2]; + uint64_t h3 = f[3] + g[3]; + uint64_t h4 = f[4] + g[4]; + + h[0] = h0; + h[1] = h1; + h[2] = h2; + h[3] = h3; + h[4] = h4; +} + +/* + h = f - g + */ + +static void +fe25519_sub(fe25519 h, const fe25519 f, const fe25519 g) +{ + const uint64_t mask = 0x7ffffffffffffULL; + uint64_t h0, h1, h2, h3, h4; + + h0 = g[0]; + h1 = g[1]; + h2 = g[2]; + h3 = g[3]; + h4 = g[4]; + + h1 += h0 >> 51; + h0 &= mask; + h2 += h1 >> 51; + h1 &= mask; + h3 += h2 >> 51; + h2 &= mask; + h4 += h3 >> 51; + h3 &= mask; + h0 += 19ULL * (h4 >> 51); + h4 &= mask; + + h0 = (f[0] + 0xfffffffffffdaULL) - h0; + h1 = (f[1] + 0xffffffffffffeULL) - h1; + h2 = (f[2] + 0xffffffffffffeULL) - h2; + h3 = (f[3] + 0xffffffffffffeULL) - h3; + h4 = (f[4] + 0xffffffffffffeULL) - h4; + + h[0] = h0; + h[1] = h1; + h[2] = h2; + h[3] = h3; + h[4] = h4; +} + +/* + h = -f + */ + +static inline void +fe25519_neg(fe25519 h, const fe25519 f) +{ + fe25519 zero; + + fe25519_0(zero); + fe25519_sub(h, zero, f); +} + +/* + Replace (f,g) with (g,g) if b == 1; + replace (f,g) with (f,g) if b == 0. + * + Preconditions: b in {0,1}. + */ + +static void +fe25519_cmov(fe25519 f, const fe25519 g, unsigned int b) +{ + const uint64_t mask = (uint64_t) (-(int64_t) b); + + uint64_t f0 = f[0]; + uint64_t f1 = f[1]; + uint64_t f2 = f[2]; + uint64_t f3 = f[3]; + uint64_t f4 = f[4]; + + uint64_t x0 = f0 ^ g[0]; + uint64_t x1 = f1 ^ g[1]; + uint64_t x2 = f2 ^ g[2]; + uint64_t x3 = f3 ^ g[3]; + uint64_t x4 = f4 ^ g[4]; + + x0 &= mask; + x1 &= mask; + x2 &= mask; + x3 &= mask; + x4 &= mask; + + f[0] = f0 ^ x0; + f[1] = f1 ^ x1; + f[2] = f2 ^ x2; + f[3] = f3 ^ x3; + f[4] = f4 ^ x4; +} + +/* +Replace (f,g) with (g,f) if b == 1; +replace (f,g) with (f,g) if b == 0. + +Preconditions: b in {0,1}. +*/ + +static void +fe25519_cswap(fe25519 f, fe25519 g, unsigned int b) +{ + const uint64_t mask = (uint64_t) (-(int64_t) b); + + uint64_t f0 = f[0]; + uint64_t f1 = f[1]; + uint64_t f2 = f[2]; + uint64_t f3 = f[3]; + uint64_t f4 = f[4]; + + uint64_t g0 = g[0]; + uint64_t g1 = g[1]; + uint64_t g2 = g[2]; + uint64_t g3 = g[3]; + uint64_t g4 = g[4]; + + uint64_t x0 = f0 ^ g0; + uint64_t x1 = f1 ^ g1; + uint64_t x2 = f2 ^ g2; + uint64_t x3 = f3 ^ g3; + uint64_t x4 = f4 ^ g4; + + x0 &= mask; + x1 &= mask; + x2 &= mask; + x3 &= mask; + x4 &= mask; + + f[0] = f0 ^ x0; + f[1] = f1 ^ x1; + f[2] = f2 ^ x2; + f[3] = f3 ^ x3; + f[4] = f4 ^ x4; + + g[0] = g0 ^ x0; + g[1] = g1 ^ x1; + g[2] = g2 ^ x2; + g[3] = g3 ^ x3; + g[4] = g4 ^ x4; +} + +/* + h = f + */ + +static inline void +fe25519_copy(fe25519 h, const fe25519 f) +{ + uint64_t f0 = f[0]; + uint64_t f1 = f[1]; + uint64_t f2 = f[2]; + uint64_t f3 = f[3]; + uint64_t f4 = f[4]; + + h[0] = f0; + h[1] = f1; + h[2] = f2; + h[3] = f3; + h[4] = f4; +} + +/* + return 1 if f is in {1,3,5,...,q-2} + return 0 if f is in {0,2,4,...,q-1} + */ + +static inline int +fe25519_isnegative(const fe25519 f) +{ + unsigned char s[32]; + + fe25519_tobytes(s, f); + + return s[0] & 1; +} + +/* + return 1 if f == 0 + return 0 if f != 0 + */ + +static inline int +fe25519_iszero(const fe25519 f) +{ + unsigned char s[32]; + + fe25519_tobytes(s, f); + + return sodium_is_zero(s, 32); +} + +/* + h = f * g + Can overlap h with f or g. + */ + +static void +fe25519_mul(fe25519 h, const fe25519 f, const fe25519 g) +{ + const uint64_t mask = 0x7ffffffffffffULL; + uint128_t r0, r1, r2, r3, r4, carry; + uint64_t f0, f1, f2, f3, f4; + uint64_t f1_19, f2_19, f3_19, f4_19; + uint64_t g0, g1, g2, g3, g4; + uint64_t r00, r01, r02, r03, r04; + + f0 = f[0]; + f1 = f[1]; + f2 = f[2]; + f3 = f[3]; + f4 = f[4]; + + g0 = g[0]; + g1 = g[1]; + g2 = g[2]; + g3 = g[3]; + g4 = g[4]; + + f1_19 = 19ULL * f1; + f2_19 = 19ULL * f2; + f3_19 = 19ULL * f3; + f4_19 = 19ULL * f4; + + r0 = ((uint128_t) f0 ) * ((uint128_t) g0); + r0 += ((uint128_t) f1_19) * ((uint128_t) g4); + r0 += ((uint128_t) f2_19) * ((uint128_t) g3); + r0 += ((uint128_t) f3_19) * ((uint128_t) g2); + r0 += ((uint128_t) f4_19) * ((uint128_t) g1); + + r1 = ((uint128_t) f0 ) * ((uint128_t) g1); + r1 += ((uint128_t) f1 ) * ((uint128_t) g0); + r1 += ((uint128_t) f2_19) * ((uint128_t) g4); + r1 += ((uint128_t) f3_19) * ((uint128_t) g3); + r1 += ((uint128_t) f4_19) * ((uint128_t) g2); + + r2 = ((uint128_t) f0 ) * ((uint128_t) g2); + r2 += ((uint128_t) f1 ) * ((uint128_t) g1); + r2 += ((uint128_t) f2 ) * ((uint128_t) g0); + r2 += ((uint128_t) f3_19) * ((uint128_t) g4); + r2 += ((uint128_t) f4_19) * ((uint128_t) g3); + + r3 = ((uint128_t) f0 ) * ((uint128_t) g3); + r3 += ((uint128_t) f1 ) * ((uint128_t) g2); + r3 += ((uint128_t) f2 ) * ((uint128_t) g1); + r3 += ((uint128_t) f3 ) * ((uint128_t) g0); + r3 += ((uint128_t) f4_19) * ((uint128_t) g4); + + r4 = ((uint128_t) f0 ) * ((uint128_t) g4); + r4 += ((uint128_t) f1 ) * ((uint128_t) g3); + r4 += ((uint128_t) f2 ) * ((uint128_t) g2); + r4 += ((uint128_t) f3 ) * ((uint128_t) g1); + r4 += ((uint128_t) f4 ) * ((uint128_t) g0); + + r00 = ((uint64_t) r0) & mask; + carry = r0 >> 51; + r1 += carry; + r01 = ((uint64_t) r1) & mask; + carry = r1 >> 51; + r2 += carry; + r02 = ((uint64_t) r2) & mask; + carry = r2 >> 51; + r3 += carry; + r03 = ((uint64_t) r3) & mask; + carry = r3 >> 51; + r4 += carry; + r04 = ((uint64_t) r4) & mask; + carry = r4 >> 51; + r00 += 19ULL * (uint64_t) carry; + carry = r00 >> 51; + r00 &= mask; + r01 += (uint64_t) carry; + carry = r01 >> 51; + r01 &= mask; + r02 += (uint64_t) carry; + + h[0] = r00; + h[1] = r01; + h[2] = r02; + h[3] = r03; + h[4] = r04; +} + +/* + h = f * f + Can overlap h with f. + */ + +static void +fe25519_sq(fe25519 h, const fe25519 f) +{ + const uint64_t mask = 0x7ffffffffffffULL; + uint128_t r0, r1, r2, r3, r4, carry; + uint64_t f0, f1, f2, f3, f4; + uint64_t f0_2, f1_2, f1_38, f2_38, f3_38, f3_19, f4_19; + uint64_t r00, r01, r02, r03, r04; + + f0 = f[0]; + f1 = f[1]; + f2 = f[2]; + f3 = f[3]; + f4 = f[4]; + + f0_2 = f0 << 1; + f1_2 = f1 << 1; + + f1_38 = 38ULL * f1; + f2_38 = 38ULL * f2; + f3_38 = 38ULL * f3; + + f3_19 = 19ULL * f3; + f4_19 = 19ULL * f4; + + r0 = ((uint128_t) f0 ) * ((uint128_t) f0); + r0 += ((uint128_t) f1_38) * ((uint128_t) f4); + r0 += ((uint128_t) f2_38) * ((uint128_t) f3); + + r1 = ((uint128_t) f0_2 ) * ((uint128_t) f1); + r1 += ((uint128_t) f2_38) * ((uint128_t) f4); + r1 += ((uint128_t) f3_19) * ((uint128_t) f3); + + r2 = ((uint128_t) f0_2 ) * ((uint128_t) f2); + r2 += ((uint128_t) f1 ) * ((uint128_t) f1); + r2 += ((uint128_t) f3_38) * ((uint128_t) f4); + + r3 = ((uint128_t) f0_2 ) * ((uint128_t) f3); + r3 += ((uint128_t) f1_2 ) * ((uint128_t) f2); + r3 += ((uint128_t) f4_19) * ((uint128_t) f4); + + r4 = ((uint128_t) f0_2 ) * ((uint128_t) f4); + r4 += ((uint128_t) f1_2 ) * ((uint128_t) f3); + r4 += ((uint128_t) f2 ) * ((uint128_t) f2); + + r00 = ((uint64_t) r0) & mask; + carry = r0 >> 51; + r1 += carry; + r01 = ((uint64_t) r1) & mask; + carry = r1 >> 51; + r2 += carry; + r02 = ((uint64_t) r2) & mask; + carry = r2 >> 51; + r3 += carry; + r03 = ((uint64_t) r3) & mask; + carry = r3 >> 51; + r4 += carry; + r04 = ((uint64_t) r4) & mask; + carry = r4 >> 51; + r00 += 19ULL * (uint64_t) carry; + carry = r00 >> 51; + r00 &= mask; + r01 += (uint64_t) carry; + carry = r01 >> 51; + r01 &= mask; + r02 += (uint64_t) carry; + + h[0] = r00; + h[1] = r01; + h[2] = r02; + h[3] = r03; + h[4] = r04; +} + +/* + h = 2 * f * f + Can overlap h with f. +*/ + +static void +fe25519_sq2(fe25519 h, const fe25519 f) +{ + const uint64_t mask = 0x7ffffffffffffULL; + uint128_t r0, r1, r2, r3, r4, carry; + uint64_t f0, f1, f2, f3, f4; + uint64_t f0_2, f1_2, f1_38, f2_38, f3_38, f3_19, f4_19; + uint64_t r00, r01, r02, r03, r04; + + f0 = f[0]; + f1 = f[1]; + f2 = f[2]; + f3 = f[3]; + f4 = f[4]; + + f0_2 = f0 << 1; + f1_2 = f1 << 1; + + f1_38 = 38ULL * f1; + f2_38 = 38ULL * f2; + f3_38 = 38ULL * f3; + + f3_19 = 19ULL * f3; + f4_19 = 19ULL * f4; + + r0 = ((uint128_t) f0 ) * ((uint128_t) f0); + r0 += ((uint128_t) f1_38) * ((uint128_t) f4); + r0 += ((uint128_t) f2_38) * ((uint128_t) f3); + + r1 = ((uint128_t) f0_2 ) * ((uint128_t) f1); + r1 += ((uint128_t) f2_38) * ((uint128_t) f4); + r1 += ((uint128_t) f3_19) * ((uint128_t) f3); + + r2 = ((uint128_t) f0_2 ) * ((uint128_t) f2); + r2 += ((uint128_t) f1 ) * ((uint128_t) f1); + r2 += ((uint128_t) f3_38) * ((uint128_t) f4); + + r3 = ((uint128_t) f0_2 ) * ((uint128_t) f3); + r3 += ((uint128_t) f1_2 ) * ((uint128_t) f2); + r3 += ((uint128_t) f4_19) * ((uint128_t) f4); + + r4 = ((uint128_t) f0_2 ) * ((uint128_t) f4); + r4 += ((uint128_t) f1_2 ) * ((uint128_t) f3); + r4 += ((uint128_t) f2 ) * ((uint128_t) f2); + + r0 <<= 1; + r1 <<= 1; + r2 <<= 1; + r3 <<= 1; + r4 <<= 1; + + r00 = ((uint64_t) r0) & mask; + carry = r0 >> 51; + r1 += carry; + r01 = ((uint64_t) r1) & mask; + carry = r1 >> 51; + r2 += carry; + r02 = ((uint64_t) r2) & mask; + carry = r2 >> 51; + r3 += carry; + r03 = ((uint64_t) r3) & mask; + carry = r3 >> 51; + r4 += carry; + r04 = ((uint64_t) r4) & mask; + carry = r4 >> 51; + r00 += 19ULL * (uint64_t) carry; + carry = r00 >> 51; + r00 &= mask; + r01 += (uint64_t) carry; + carry = r01 >> 51; + r01 &= mask; + r02 += (uint64_t) carry; + + h[0] = r00; + h[1] = r01; + h[2] = r02; + h[3] = r03; + h[4] = r04; +} + +static void +fe25519_scalar_product(fe25519 h, const fe25519 f, uint32_t n) +{ + const uint64_t mask = 0x7ffffffffffffULL; + uint128_t a; + uint128_t sn = (uint128_t) n; + uint64_t h0, h1, h2, h3, h4; + + a = f[0] * sn; + h0 = ((uint64_t) a) & mask; + a = f[1] * sn + ((uint64_t) (a >> 51)); + h1 = ((uint64_t) a) & mask; + a = f[2] * sn + ((uint64_t) (a >> 51)); + h2 = ((uint64_t) a) & mask; + a = f[3] * sn + ((uint64_t) (a >> 51)); + h3 = ((uint64_t) a) & mask; + a = f[4] * sn + ((uint64_t) (a >> 51)); + h4 = ((uint64_t) a) & mask; + + h0 += (a >> 51) * 19ULL; + + h[0] = h0; + h[1] = h1; + h[2] = h2; + h[3] = h3; + h[4] = h4; +} diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/implementations.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/implementations.h new file mode 100644 index 00000000000..c7237f851de --- /dev/null +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/private/implementations.h @@ -0,0 +1,11 @@ +#ifndef implementations_H +#define implementations_H + +int _crypto_generichash_blake2b_pick_best_implementation(void); +int _crypto_onetimeauth_poly1305_pick_best_implementation(void); +int _crypto_pwhash_argon2_pick_best_implementation(void); +int _crypto_scalarmult_curve25519_pick_best_implementation(void); +int _crypto_stream_chacha20_pick_best_implementation(void); +int _crypto_stream_salsa20_pick_best_implementation(void); + +#endif diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes.h index d112fb293e5..a03cc657204 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes.h @@ -25,16 +25,20 @@ typedef struct randombytes_implementation { int (*close)(void); /* optional */ } randombytes_implementation; +#define randombytes_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 0xffffffffUL) + #define randombytes_SEEDBYTES 32U SODIUM_EXPORT size_t randombytes_seedbytes(void); SODIUM_EXPORT -void randombytes_buf(void * const buf, const size_t size); +void randombytes_buf(void * const buf, const size_t size) + __attribute__ ((nonnull)); SODIUM_EXPORT void randombytes_buf_deterministic(void * const buf, const size_t size, - const unsigned char seed[randombytes_SEEDBYTES]); + const unsigned char seed[randombytes_SEEDBYTES]) + __attribute__ ((nonnull)); SODIUM_EXPORT uint32_t randombytes_random(void); @@ -49,7 +53,8 @@ SODIUM_EXPORT int randombytes_close(void); SODIUM_EXPORT -int randombytes_set_implementation(randombytes_implementation *impl); +int randombytes_set_implementation(randombytes_implementation *impl) + __attribute__ ((nonnull)); SODIUM_EXPORT const char *randombytes_implementation_name(void); @@ -57,7 +62,8 @@ const char *randombytes_implementation_name(void); /* -- NaCl compatibility interface -- */ SODIUM_EXPORT -void randombytes(unsigned char * const buf, const unsigned long long buf_len); +void randombytes(unsigned char * const buf, const unsigned long long buf_len) + __attribute__ ((nonnull)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_internal_random.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_internal_random.h new file mode 100644 index 00000000000..2b2b7d6edc1 --- /dev/null +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_internal_random.h @@ -0,0 +1,22 @@ + +#ifndef randombytes_internal_random_H +#define randombytes_internal_random_H + +#include "export.h" +#include "randombytes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +SODIUM_EXPORT +extern struct randombytes_implementation randombytes_internal_implementation; + +/* Backwards compatibility with libsodium < 1.0.18 */ +#define randombytes_salsa20_implementation randombytes_internal_implementation + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_nativeclient.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_nativeclient.h deleted file mode 100644 index 5158d8c3c33..00000000000 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_nativeclient.h +++ /dev/null @@ -1,23 +0,0 @@ - -#ifndef randombytes_nativeclient_H -#define randombytes_nativeclient_H - -#ifdef __native_client__ - -# include "export.h" -# include "randombytes.h" - -# ifdef __cplusplus -extern "C" { -# endif - -SODIUM_EXPORT -extern struct randombytes_implementation randombytes_nativeclient_implementation; - -# ifdef __cplusplus -} -# endif - -#endif - -#endif diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h deleted file mode 100644 index 4deae15b6d9..00000000000 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h +++ /dev/null @@ -1,19 +0,0 @@ - -#ifndef randombytes_salsa20_random_H -#define randombytes_salsa20_random_H - -#include "export.h" -#include "randombytes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -SODIUM_EXPORT -extern struct randombytes_implementation randombytes_salsa20_implementation; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/runtime.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/runtime.h index 76859ea0e13..7f15d58e7c5 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/runtime.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/runtime.h @@ -8,33 +8,39 @@ extern "C" { #endif -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_neon(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_sse2(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_sse3(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_ssse3(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_sse41(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_avx(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_avx2(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK +int sodium_runtime_has_avx512f(void); + +SODIUM_EXPORT_WEAK int sodium_runtime_has_pclmul(void); -SODIUM_EXPORT +SODIUM_EXPORT_WEAK int sodium_runtime_has_aesni(void); +SODIUM_EXPORT_WEAK +int sodium_runtime_has_rdrand(void); + /* ------------------------------------------------------------------------- */ int _sodium_runtime_get_cpu_features(void); diff --git a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/utils.h b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/utils.h index 0a7aadb434c..ac801512919 100644 --- a/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/utils.h +++ b/tools/sdk/esp32s2/include/libsodium/libsodium/src/libsodium/include/sodium/utils.h @@ -21,6 +21,9 @@ extern "C" { SODIUM_EXPORT void sodium_memzero(void * const pnt, const size_t len); +SODIUM_EXPORT +void sodium_stackzero(const size_t len); + /* * WARNING: sodium_memcmp() must be used to verify if two secret keys * are equal, in constant time. @@ -39,8 +42,7 @@ int sodium_memcmp(const void * const b1_, const void * const b2_, size_t len) */ SODIUM_EXPORT int sodium_compare(const unsigned char *b1_, const unsigned char *b2_, - size_t len) - __attribute__ ((warn_unused_result)); + size_t len) __attribute__ ((warn_unused_result)); SODIUM_EXPORT int sodium_is_zero(const unsigned char *n, const size_t nlen); @@ -51,21 +53,57 @@ void sodium_increment(unsigned char *n, const size_t nlen); SODIUM_EXPORT void sodium_add(unsigned char *a, const unsigned char *b, const size_t len); +SODIUM_EXPORT +void sodium_sub(unsigned char *a, const unsigned char *b, const size_t len); + SODIUM_EXPORT char *sodium_bin2hex(char * const hex, const size_t hex_maxlen, - const unsigned char * const bin, const size_t bin_len); + const unsigned char * const bin, const size_t bin_len) + __attribute__ ((nonnull(1))); SODIUM_EXPORT int sodium_hex2bin(unsigned char * const bin, const size_t bin_maxlen, const char * const hex, const size_t hex_len, const char * const ignore, size_t * const bin_len, - const char ** const hex_end); + const char ** const hex_end) + __attribute__ ((nonnull(1))); + +#define sodium_base64_VARIANT_ORIGINAL 1 +#define sodium_base64_VARIANT_ORIGINAL_NO_PADDING 3 +#define sodium_base64_VARIANT_URLSAFE 5 +#define sodium_base64_VARIANT_URLSAFE_NO_PADDING 7 + +/* + * Computes the required length to encode BIN_LEN bytes as a base64 string + * using the given variant. The computed length includes a trailing \0. + */ +#define sodium_base64_ENCODED_LEN(BIN_LEN, VARIANT) \ + (((BIN_LEN) / 3U) * 4U + \ + ((((BIN_LEN) - ((BIN_LEN) / 3U) * 3U) | (((BIN_LEN) - ((BIN_LEN) / 3U) * 3U) >> 1)) & 1U) * \ + (4U - (~((((VARIANT) & 2U) >> 1) - 1U) & (3U - ((BIN_LEN) - ((BIN_LEN) / 3U) * 3U)))) + 1U) SODIUM_EXPORT -int sodium_mlock(void * const addr, const size_t len); +size_t sodium_base64_encoded_len(const size_t bin_len, const int variant); SODIUM_EXPORT -int sodium_munlock(void * const addr, const size_t len); +char *sodium_bin2base64(char * const b64, const size_t b64_maxlen, + const unsigned char * const bin, const size_t bin_len, + const int variant) __attribute__ ((nonnull(1))); + +SODIUM_EXPORT +int sodium_base642bin(unsigned char * const bin, const size_t bin_maxlen, + const char * const b64, const size_t b64_len, + const char * const ignore, size_t * const bin_len, + const char ** const b64_end, const int variant) + __attribute__ ((nonnull(1))); + +SODIUM_EXPORT +int sodium_mlock(void * const addr, const size_t len) + __attribute__ ((nonnull)); + +SODIUM_EXPORT +int sodium_munlock(void * const addr, const size_t len) + __attribute__ ((nonnull)); /* WARNING: sodium_malloc() and sodium_allocarray() are not general-purpose * allocation functions. @@ -112,13 +150,23 @@ SODIUM_EXPORT void sodium_free(void *ptr); SODIUM_EXPORT -int sodium_mprotect_noaccess(void *ptr); +int sodium_mprotect_noaccess(void *ptr) __attribute__ ((nonnull)); + +SODIUM_EXPORT +int sodium_mprotect_readonly(void *ptr) __attribute__ ((nonnull)); + +SODIUM_EXPORT +int sodium_mprotect_readwrite(void *ptr) __attribute__ ((nonnull)); SODIUM_EXPORT -int sodium_mprotect_readonly(void *ptr); +int sodium_pad(size_t *padded_buflen_p, unsigned char *buf, + size_t unpadded_buflen, size_t blocksize, size_t max_buflen) + __attribute__ ((nonnull(2))); SODIUM_EXPORT -int sodium_mprotect_readwrite(void *ptr); +int sodium_unpad(size_t *unpadded_buflen_p, const unsigned char *buf, + size_t padded_buflen, size_t blocksize) + __attribute__ ((nonnull(2))); /* -------- */ diff --git a/tools/sdk/esp32s2/include/lwip/port/esp32/include/lwipopts.h b/tools/sdk/esp32s2/include/lwip/port/esp32/include/lwipopts.h index 442bf0e98e2..52d2d99de4f 100644 --- a/tools/sdk/esp32s2/include/lwip/port/esp32/include/lwipopts.h +++ b/tools/sdk/esp32s2/include/lwip/port/esp32/include/lwipopts.h @@ -745,16 +745,17 @@ --------- LCP Echo options --------- ------------------------------------ */ +#if CONFIG_LWIP_ENABLE_LCP_ECHO /** * LCP_ECHOINTERVAL: Interval in seconds between keepalive LCP echo requests, 0 to disable. */ -#define LCP_ECHOINTERVAL CONFIG_LCP_ECHOINTERVAL +#define LCP_ECHOINTERVAL CONFIG_LWIP_LCP_ECHOINTERVAL /** * LCP_MAXECHOFAILS: Number of consecutive unanswered echo requests before failure is indicated. */ -#define LCP_MAXECHOFAILS CONFIG_LCP_MAXECHOFAILS - +#define LCP_MAXECHOFAILS CONFIG_LWIP_LCP_MAXECHOFAILS +#endif /* CONFIG_LWIP_ENABLE_LCP_ECHO */ /* -------------------------------------- @@ -1013,7 +1014,11 @@ /** * LWIP_DEBUG: Enable lwip debugging in other modules. */ -#define LWIP_DEBUG LWIP_DBG_OFF +#ifdef CONFIG_LWIP_DEBUG +#define LWIP_DEBUG LWIP_DBG_ON +#else +#undef LWIP_DEBUG +#endif #define CHECKSUM_CHECK_UDP CONFIG_LWIP_CHECKSUM_CHECK_UDP #define CHECKSUM_CHECK_IP CONFIG_LWIP_CHECKSUM_CHECK_IP diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc.h index 131a8cde6a1..878819a595f 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc.h @@ -406,11 +406,6 @@ bool rtc_clk_8md256_enabled(void); */ void rtc_clk_apll_enable(bool enable, uint32_t sdm0, uint32_t sdm1, uint32_t sdm2, uint32_t o_div); -/** - * @brief Set XTAL wait cycles by RTC slow clock's period - */ -void rtc_clk_set_xtal_wait(void); - /** * @brief Select source for RTC_SLOW_CLK * @param slow_freq clock source (one of rtc_slow_freq_t values) diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/soc_caps.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/soc_caps.h index 29f4d92572b..5d16add7a8f 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/soc_caps.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/soc_caps.h @@ -37,6 +37,7 @@ #pragma once /*-------------------------- COMMON CAPS ---------------------------------------*/ +#define SOC_DAC_SUPPORTED 1 #define SOC_TWAI_SUPPORTED 1 #define SOC_CP_DMA_SUPPORTED 1 #define SOC_CPU_CORES_NUM 1 @@ -87,7 +88,6 @@ /*-------------------------- DAC CAPS ----------------------------------------*/ #define SOC_DAC_PERIPH_NUM 2 - #define SOC_DAC_RESOLUTION 8 // DAC resolution ratio 8 bit /*-------------------------- GPIO CAPS ---------------------------------------*/ diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/spi_pins.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/spi_pins.h index df2f4855487..c334e01fe1c 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/spi_pins.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/spi_pins.h @@ -22,6 +22,17 @@ #define SPI_IOMUX_PIN_NUM_MISO 31 #define SPI_IOMUX_PIN_NUM_WP 28 +#define SPI2_FUNC_NUM FSPI_FUNC_NUM +#define SPI2_IOMUX_PIN_NUM_HD FSPI_IOMUX_PIN_NUM_HD +#define SPI2_IOMUX_PIN_NUM_CS FSPI_IOMUX_PIN_NUM_CS +#define SPI2_IOMUX_PIN_NUM_MOSI FSPI_IOMUX_PIN_NUM_MOSI +#define SPI2_IOMUX_PIN_NUM_CLK FSPI_IOMUX_PIN_NUM_CLK +#define SPI2_IOMUX_PIN_NUM_MISO FSPI_IOMUX_PIN_NUM_MISO +#define SPI2_IOMUX_PIN_NUM_WP FSPI_IOMUX_PIN_NUM_WP + +//SPI3 has no iomux pins + +//Following Macros are deprecated. Please use the Macros above #define FSPI_FUNC_NUM 4 #define FSPI_IOMUX_PIN_NUM_HD 9 #define FSPI_IOMUX_PIN_NUM_CS 10 @@ -29,5 +40,3 @@ #define FSPI_IOMUX_PIN_NUM_CLK 12 #define FSPI_IOMUX_PIN_NUM_MISO 13 #define FSPI_IOMUX_PIN_NUM_WP 14 - -//SPI3 has no iomux pins diff --git a/tools/sdk/esp32s2/include/tcp_transport/include/esp_transport_ssl.h b/tools/sdk/esp32s2/include/tcp_transport/include/esp_transport_ssl.h index d23a725c23a..b31e5b4495a 100644 --- a/tools/sdk/esp32s2/include/tcp_transport/include/esp_transport_ssl.h +++ b/tools/sdk/esp32s2/include/tcp_transport/include/esp_transport_ssl.h @@ -52,6 +52,16 @@ void esp_transport_ssl_set_cert_data(esp_transport_handle_t t, const char *data, */ void esp_transport_ssl_set_cert_data_der(esp_transport_handle_t t, const char *data, int len); +/** + * @brief Enable the use of certification bundle for server verfication for + * an SSL connection. + * It must be first enabled in menuconfig. + * + * @param t ssl transport + * @param[in] crt_bundle_attach Function pointer to esp_crt_bundle_attach + */ +void esp_transport_ssl_crt_bundle_attach(esp_transport_handle_t t, esp_err_t ((*crt_bundle_attach)(void *conf))); + /** * @brief Enable global CA store for SSL connection * @@ -141,14 +151,12 @@ void esp_transport_ssl_skip_common_name_check(esp_transport_handle_t t); */ void esp_transport_ssl_use_secure_element(esp_transport_handle_t t); - /** * @brief Set the ds_data handle in ssl context.(used for the digital signature operation) * * @param t ssl transport * ds_data the handle for ds data params */ - void esp_transport_ssl_set_ds_data(esp_transport_handle_t t, void *ds_data); /** diff --git a/tools/sdk/esp32s2/ld/esp32s2.project.ld b/tools/sdk/esp32s2/ld/esp32s2.project.ld index a7e02c0f67d..3be79c3101f 100644 --- a/tools/sdk/esp32s2/ld/esp32s2.project.ld +++ b/tools/sdk/esp32s2/ld/esp32s2.project.ld @@ -1,6 +1,6 @@ /* Automatically generated file; DO NOT EDIT */ /* Espressif IoT Development Framework Linker Script */ -/* Generated from: /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp32s2/ld/esp32s2.project.ld.in */ +/* Generated from: /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32s2/ld/esp32s2.project.ld.in */ /* Default entry point: */ ENTRY(call_start_cpu0); @@ -95,7 +95,7 @@ SECTIONS and will be retained during deep sleep. User data marked with RTC_NOINIT_ATTR will be placed into this section. See the file "esp_attr.h" for more information. - The memory location of the data is dependent on + The memory location of the data is dependent on CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM option. */ .rtc_noinit (NOLOAD): @@ -195,14 +195,11 @@ SECTIONS *libesp_hw_support.a:rtc_wdt.*(.literal .literal.* .text .text.*) *libesp_ringbuf.a:(.literal .literal.* .text .text.*) *libesp_system.a:esp_err.*(.literal .literal.* .text .text.*) - *libesp_system.a:panic.*(.literal .literal.* .text .text.*) - *libesp_system.a:panic_arch.*(.literal .literal.* .text .text.*) - *libesp_system.a:panic_handler.*(.literal .literal.* .text .text.*) - *libesp_system.a:reset_reason.*(.literal .literal.* .text .text.*) - *libesp_system.a:system_api.*(.literal.esp_system_abort .text.esp_system_abort) + *libesp_system.a:esp_system.*(.literal.esp_system_abort .text.esp_system_abort) *libfreertos.a:(EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .literal EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .literal.* EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .text EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .text.*) *libfreertos.a:port.*(.literal.pxPortInitialiseStack .literal.unlikely.vPortEndScheduler .literal.vApplicationStackOverflowHook .literal.vPortAssertIfInISR .literal.vPortEnterCritical .literal.vPortExitCritical .literal.vPortSetStackWatchpoint .literal.vPortYieldOtherCore .literal.xPortInIsrContext .literal.xPortStartScheduler .literal.xPortSysTickHandler .text .text.pxPortInitialiseStack .text.unlikely.vPortEndScheduler .text.vApplicationStackOverflowHook .text.vPortAssertIfInISR .text.vPortEnterCritical .text.vPortExitCritical .text.vPortSetStackWatchpoint .text.vPortYieldOtherCore .text.xPortGetTickRateHz .text.xPortInIsrContext .text.xPortStartScheduler .text.xPortSysTickHandler) *libfreertos.a:port_common.*(.literal.esp_startup_start_app_common .text .text.esp_startup_start_app_common) + *libgcc.a:_divsf3.*(.literal .literal.* .text .text.*) *libgcc.a:lib2funcs.*(.literal .literal.* .text .text.*) *libgcov.a:(.literal .literal.* .text .text.*) *libhal.a:cpu_hal.*(.literal .literal.* .text .text.*) @@ -246,6 +243,8 @@ SECTIONS /* align + add 16B for CPU dummy speculative instr. fetch */ . = ALIGN(4) + 16; + /* iram_end_test section exists for use by memprot unit tests only */ + *(.iram_end_test) _iram_text_end = ABSOLUTE(.); _iram_end = ABSOLUTE(.); } > iram0_0_seg @@ -290,10 +289,7 @@ SECTIONS *libesp_hw_support.a:regi2c_ctrl.*(.rodata .rodata.*) *libesp_hw_support.a:rtc_clk.*(.rodata .rodata.*) *libesp_system.a:esp_err.*(.rodata .rodata.*) - *libesp_system.a:panic.*(.rodata .rodata.*) - *libesp_system.a:panic_arch.*(.rodata .rodata.*) - *libesp_system.a:panic_handler.*(.rodata .rodata.*) - *libesp_system.a:reset_reason.*(.rodata .rodata.*) + *libgcc.a:_divsf3.*(.rodata .rodata.*) *libgcov.a:(.rodata .rodata.*) *libhal.a:cpu_hal.*(.rodata .rodata.*) *libhal.a:i2c_hal_iram.*(.rodata .rodata.*) @@ -352,6 +348,8 @@ SECTIONS *(.ext_ram.bss*) *(.bss .bss.*) + *(.dynbss .dynsbss .gnu.linkonce.b .gnu.linkonce.b.* .gnu.linkonce.sb .gnu.linkonce.sb.* .gnu.linkonce.sb2 .gnu.linkonce.sb2.* .sbss .sbss.* .sbss2 .sbss2.* .scommon .share.mem) + *(.ext_ram.bss .ext_ram.bss.*) *(COMMON) _bt_bss_start = ABSOLUTE(.); *libbt.a:(.bss .bss.* COMMON) @@ -391,7 +389,7 @@ SECTIONS *(.rodata_desc .rodata_desc.*) /* Should be the first. App version info. DO NOT PUT ANYTHING BEFORE IT! */ *(.rodata_custom_desc .rodata_custom_desc.*) /* Should be the second. Custom app version info. DO NOT PUT ANYTHING BEFORE IT! */ - *(EXCLUDE_FILE(*libgcov.a *libphy.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libesp_hw_support.a:regi2c_ctrl.* *libesp_hw_support.a:rtc_clk.* *libesp_system.a:esp_err.* *libesp_system.a:panic.* *libesp_system.a:panic_arch.* *libesp_system.a:panic_handler.* *libesp_system.a:reset_reason.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_boya.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.*) .rodata EXCLUDE_FILE(*libgcov.a *libphy.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libesp_hw_support.a:regi2c_ctrl.* *libesp_hw_support.a:rtc_clk.* *libesp_system.a:esp_err.* *libesp_system.a:panic.* *libesp_system.a:panic_arch.* *libesp_system.a:panic_handler.* *libesp_system.a:reset_reason.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_boya.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.*) .rodata.*) + *(EXCLUDE_FILE(*libgcov.a *libphy.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libesp_hw_support.a:regi2c_ctrl.* *libesp_hw_support.a:rtc_clk.* *libesp_system.a:esp_err.* *libgcc.a:_divsf3.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_boya.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.*) .rodata EXCLUDE_FILE(*libgcov.a *libphy.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libesp_hw_support.a:regi2c_ctrl.* *libesp_hw_support.a:rtc_clk.* *libesp_system.a:esp_err.* *libgcc.a:_divsf3.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_boya.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.*) .rodata.*) *(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */ *(.gnu.linkonce.r.*) @@ -453,7 +451,7 @@ SECTIONS _instruction_reserved_start = ABSOLUTE(.); _text_start = ABSOLUTE(.); - *(EXCLUDE_FILE(*libesp_ringbuf.a *libfreertos.a *libgcov.a *librtc.a *libxt_hal.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:regi2c_ctrl.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_wdt.* *libesp_system.a:esp_err.* *libesp_system.a:panic.* *libesp_system.a:panic_arch.* *libesp_system.a:panic_handler.* *libesp_system.a:reset_reason.* *libesp_system.a:system_api.* *libgcc.a:lib2funcs.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *liblog.a:log.* *liblog.a:log_freertos.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_boya.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.* *libxtensa.a:eri.*) .literal EXCLUDE_FILE(*libesp_ringbuf.a *libfreertos.a *libgcov.a *librtc.a *libxt_hal.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:regi2c_ctrl.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_wdt.* *libesp_system.a:esp_err.* *libesp_system.a:panic.* *libesp_system.a:panic_arch.* *libesp_system.a:panic_handler.* *libesp_system.a:reset_reason.* *libesp_system.a:system_api.* *libgcc.a:lib2funcs.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *liblog.a:log.* *liblog.a:log_freertos.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_boya.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.* *libxtensa.a:eri.*) .literal.* EXCLUDE_FILE(*libesp_ringbuf.a *libfreertos.a *libgcov.a *librtc.a *libxt_hal.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:regi2c_ctrl.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_wdt.* *libesp_system.a:esp_err.* *libesp_system.a:panic.* *libesp_system.a:panic_arch.* *libesp_system.a:panic_handler.* *libesp_system.a:reset_reason.* *libesp_system.a:system_api.* *libgcc.a:lib2funcs.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *liblog.a:log.* *liblog.a:log_freertos.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_boya.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.* *libxtensa.a:eri.*) .text EXCLUDE_FILE(*libesp_ringbuf.a *libfreertos.a *libgcov.a *librtc.a *libxt_hal.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:regi2c_ctrl.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_wdt.* *libesp_system.a:esp_err.* *libesp_system.a:panic.* *libesp_system.a:panic_arch.* *libesp_system.a:panic_handler.* *libesp_system.a:reset_reason.* *libesp_system.a:system_api.* *libgcc.a:lib2funcs.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *liblog.a:log.* *liblog.a:log_freertos.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_boya.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.* *libxtensa.a:eri.*) .text.*) + *(EXCLUDE_FILE(*libesp_ringbuf.a *libfreertos.a *libgcov.a *librtc.a *libxt_hal.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:regi2c_ctrl.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_wdt.* *libesp_system.a:esp_err.* *libesp_system.a:esp_system.* *libgcc.a:_divsf3.* *libgcc.a:lib2funcs.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *liblog.a:log.* *liblog.a:log_freertos.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_boya.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.* *libxtensa.a:eri.*) .literal EXCLUDE_FILE(*libesp_ringbuf.a *libfreertos.a *libgcov.a *librtc.a *libxt_hal.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:regi2c_ctrl.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_wdt.* *libesp_system.a:esp_err.* *libesp_system.a:esp_system.* *libgcc.a:_divsf3.* *libgcc.a:lib2funcs.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *liblog.a:log.* *liblog.a:log_freertos.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_boya.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.* *libxtensa.a:eri.*) .literal.* EXCLUDE_FILE(*libesp_ringbuf.a *libfreertos.a *libgcov.a *librtc.a *libxt_hal.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:regi2c_ctrl.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_wdt.* *libesp_system.a:esp_err.* *libesp_system.a:esp_system.* *libgcc.a:_divsf3.* *libgcc.a:lib2funcs.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *liblog.a:log.* *liblog.a:log_freertos.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_boya.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.* *libxtensa.a:eri.*) .text EXCLUDE_FILE(*libesp_ringbuf.a *libfreertos.a *libgcov.a *librtc.a *libxt_hal.a *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:regi2c_ctrl.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_wdt.* *libesp_system.a:esp_err.* *libesp_system.a:esp_system.* *libgcc.a:_divsf3.* *libgcc.a:lib2funcs.* *libhal.a:cpu_hal.* *libhal.a:i2c_hal_iram.* *libhal.a:ledc_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:spi_flash_hal_iram.* *libhal.a:spi_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libheap.a:heap_tlsf.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *liblog.a:log.* *liblog.a:log_freertos.* *libnewlib.a:abort.* *libnewlib.a:heap.* *libnewlib.a:stdatomic.* *libsoc.a:lldesc.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_boya.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:spi_flash_chip_generic.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_rom_patch.* *libxtensa.a:eri.*) .text.*) *(.wifi0iram .wifi0iram.*) *(.wifiorslpiram .wifiorslpiram.*) *(.wifirxiram .wifirxiram.*) @@ -462,7 +460,7 @@ SECTIONS *libesp_event.a:default_event_loop.*(.literal.esp_event_handler_instance_register .literal.esp_event_handler_instance_unregister .literal.esp_event_handler_register .literal.esp_event_handler_unregister .literal.esp_event_loop_create_default .literal.esp_event_loop_delete_default .literal.esp_event_post .literal.esp_event_send_to_default_loop .text .text.esp_event_handler_instance_register .text.esp_event_handler_instance_unregister .text.esp_event_handler_register .text.esp_event_handler_unregister .text.esp_event_loop_create_default .text.esp_event_loop_delete_default .text.esp_event_post .text.esp_event_send_to_default_loop) *libesp_event.a:esp_event.*(.literal.base_node_add_handler .literal.esp_event_handler_instance_register_with .literal.esp_event_handler_instance_unregister_with .literal.esp_event_handler_register_with .literal.esp_event_handler_register_with_internal .literal.esp_event_handler_unregister_with .literal.esp_event_handler_unregister_with_internal .literal.esp_event_loop_create .literal.esp_event_loop_delete .literal.esp_event_loop_run .literal.esp_event_loop_run_task .literal.esp_event_post_to .literal.handler_instances_add .literal.handler_instances_remove .literal.handler_instances_remove_all$isra$1 .literal.loop_node_add_handler .text .text.base_node_add_handler .text.esp_event_dump .text.esp_event_handler_instance_register_with .text.esp_event_handler_instance_unregister_with .text.esp_event_handler_register_with .text.esp_event_handler_register_with_internal .text.esp_event_handler_unregister_with .text.esp_event_handler_unregister_with_internal .text.esp_event_loop_create .text.esp_event_loop_delete .text.esp_event_loop_run .text.esp_event_loop_run_task .text.esp_event_post_to .text.handler_instances_add .text.handler_instances_remove .text.handler_instances_remove_all$isra$1 .text.loop_node_add_handler) *libesp_hw_support.a:rtc_init.*(.literal.rtc_init .literal.rtc_vddsdio_get_config .text .text.rtc_init .text.rtc_vddsdio_get_config) - *libesp_system.a:system_api.*(.literal.esp_get_free_heap_size .literal.esp_get_free_internal_heap_size .literal.esp_get_idf_version .literal.esp_get_minimum_free_heap_size .literal.esp_register_shutdown_handler .literal.esp_unregister_shutdown_handler .text .text.esp_get_free_heap_size .text.esp_get_free_internal_heap_size .text.esp_get_idf_version .text.esp_get_minimum_free_heap_size .text.esp_register_shutdown_handler .text.esp_unregister_shutdown_handler) + *libesp_system.a:esp_system.*(.literal.esp_get_free_heap_size .literal.esp_get_free_internal_heap_size .literal.esp_get_idf_version .literal.esp_get_minimum_free_heap_size .literal.esp_register_shutdown_handler .literal.esp_unregister_shutdown_handler .text .text.esp_get_free_heap_size .text.esp_get_free_internal_heap_size .text.esp_get_idf_version .text.esp_get_minimum_free_heap_size .text.esp_register_shutdown_handler .text.esp_unregister_shutdown_handler) *libfreertos.a:port.*(.literal.esp_startup_start_app .text.esp_startup_start_app) *libfreertos.a:port_common.*(.literal.main_task .text.main_task) *liblog.a:log.*(.literal.esp_log_level_set .literal.esp_log_set_vprintf .literal.esp_log_writev .literal.heap_bubble_down .text .text.esp_log_level_set .text.esp_log_set_vprintf .text.esp_log_writev .text.heap_bubble_down) diff --git a/tools/sdk/esp32s2/lib/libapp_trace.a b/tools/sdk/esp32s2/lib/libapp_trace.a index 8ff0a22842e..958202c4b8b 100644 Binary files a/tools/sdk/esp32s2/lib/libapp_trace.a and b/tools/sdk/esp32s2/lib/libapp_trace.a differ diff --git a/tools/sdk/esp32s2/lib/libapp_update.a b/tools/sdk/esp32s2/lib/libapp_update.a index 8268da69016..ba2ca13cae5 100644 Binary files a/tools/sdk/esp32s2/lib/libapp_update.a and b/tools/sdk/esp32s2/lib/libapp_update.a differ diff --git a/tools/sdk/esp32s2/lib/libarduino_tinyusb.a b/tools/sdk/esp32s2/lib/libarduino_tinyusb.a index 28f395aca9e..1505ccc502c 100644 Binary files a/tools/sdk/esp32s2/lib/libarduino_tinyusb.a and b/tools/sdk/esp32s2/lib/libarduino_tinyusb.a differ diff --git a/tools/sdk/esp32s2/lib/libasio.a b/tools/sdk/esp32s2/lib/libasio.a index 23d7dd9e31a..2c48108ea12 100644 Binary files a/tools/sdk/esp32s2/lib/libasio.a and b/tools/sdk/esp32s2/lib/libasio.a differ diff --git a/tools/sdk/esp32s2/lib/libbootloader_support.a b/tools/sdk/esp32s2/lib/libbootloader_support.a index fd47bd2923e..b81ce68669f 100644 Binary files a/tools/sdk/esp32s2/lib/libbootloader_support.a and b/tools/sdk/esp32s2/lib/libbootloader_support.a differ diff --git a/tools/sdk/esp32s2/lib/libcbor.a b/tools/sdk/esp32s2/lib/libcbor.a index b3d01ad8266..9fa3e0c9efe 100644 Binary files a/tools/sdk/esp32s2/lib/libcbor.a and b/tools/sdk/esp32s2/lib/libcbor.a differ diff --git a/tools/sdk/esp32s2/lib/libcmock.a b/tools/sdk/esp32s2/lib/libcmock.a index 9327ebacf79..b9186cee30f 100644 Binary files a/tools/sdk/esp32s2/lib/libcmock.a and b/tools/sdk/esp32s2/lib/libcmock.a differ diff --git a/tools/sdk/esp32s2/lib/libcoap.a b/tools/sdk/esp32s2/lib/libcoap.a index f7a5634b085..6ffea84e275 100644 Binary files a/tools/sdk/esp32s2/lib/libcoap.a and b/tools/sdk/esp32s2/lib/libcoap.a differ diff --git a/tools/sdk/esp32s2/lib/libcoexist.a b/tools/sdk/esp32s2/lib/libcoexist.a index 906fe1cdd2e..f5072249294 100644 Binary files a/tools/sdk/esp32s2/lib/libcoexist.a and b/tools/sdk/esp32s2/lib/libcoexist.a differ diff --git a/tools/sdk/esp32s2/lib/libconsole.a b/tools/sdk/esp32s2/lib/libconsole.a index 054a81fa8bb..2bd82b0e5e3 100644 Binary files a/tools/sdk/esp32s2/lib/libconsole.a and b/tools/sdk/esp32s2/lib/libconsole.a differ diff --git a/tools/sdk/esp32s2/lib/libcore.a b/tools/sdk/esp32s2/lib/libcore.a index 53d05500c29..901f8ddaf37 100644 Binary files a/tools/sdk/esp32s2/lib/libcore.a and b/tools/sdk/esp32s2/lib/libcore.a differ diff --git a/tools/sdk/esp32s2/lib/libcxx.a b/tools/sdk/esp32s2/lib/libcxx.a index cc76dac6067..780b93ba5c3 100644 Binary files a/tools/sdk/esp32s2/lib/libcxx.a and b/tools/sdk/esp32s2/lib/libcxx.a differ diff --git a/tools/sdk/esp32s2/lib/libdriver.a b/tools/sdk/esp32s2/lib/libdriver.a index d10c78a5f05..e6191512a6b 100644 Binary files a/tools/sdk/esp32s2/lib/libdriver.a and b/tools/sdk/esp32s2/lib/libdriver.a differ diff --git a/tools/sdk/esp32s2/lib/libefuse.a b/tools/sdk/esp32s2/lib/libefuse.a index 21d4fe4f805..17f2a6c9f22 100644 Binary files a/tools/sdk/esp32s2/lib/libefuse.a and b/tools/sdk/esp32s2/lib/libefuse.a differ diff --git a/tools/sdk/esp32s2/lib/libesp-dsp.a b/tools/sdk/esp32s2/lib/libesp-dsp.a index 4e25dc876fb..0dbc21951ca 100644 Binary files a/tools/sdk/esp32s2/lib/libesp-dsp.a and b/tools/sdk/esp32s2/lib/libesp-dsp.a differ diff --git a/tools/sdk/esp32s2/lib/libesp-face.a b/tools/sdk/esp32s2/lib/libesp-face.a index 6760d7c33dc..5dcbc030395 100644 Binary files a/tools/sdk/esp32s2/lib/libesp-face.a and b/tools/sdk/esp32s2/lib/libesp-face.a differ diff --git a/tools/sdk/esp32s2/lib/libesp-tls.a b/tools/sdk/esp32s2/lib/libesp-tls.a index e4dc9d26f41..2605e0f1ca3 100644 Binary files a/tools/sdk/esp32s2/lib/libesp-tls.a and b/tools/sdk/esp32s2/lib/libesp-tls.a differ diff --git a/tools/sdk/esp32s2/lib/libesp32s2.a b/tools/sdk/esp32s2/lib/libesp32s2.a index 2f4248f643d..f29543b9100 100644 Binary files a/tools/sdk/esp32s2/lib/libesp32s2.a and b/tools/sdk/esp32s2/lib/libesp32s2.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_adc_cal.a b/tools/sdk/esp32s2/lib/libesp_adc_cal.a index 0db71cfcca9..ed6f8889d38 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_adc_cal.a and b/tools/sdk/esp32s2/lib/libesp_adc_cal.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_common.a b/tools/sdk/esp32s2/lib/libesp_common.a index 0c1ce28fff5..eab643aecda 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_common.a and b/tools/sdk/esp32s2/lib/libesp_common.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_eth.a b/tools/sdk/esp32s2/lib/libesp_eth.a index 19606846a50..e7320288958 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_eth.a and b/tools/sdk/esp32s2/lib/libesp_eth.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_event.a b/tools/sdk/esp32s2/lib/libesp_event.a index 62df8476bb2..5d1f04bf16f 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_event.a and b/tools/sdk/esp32s2/lib/libesp_event.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_gdbstub.a b/tools/sdk/esp32s2/lib/libesp_gdbstub.a index 2cc9175c276..4f5c1267322 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_gdbstub.a and b/tools/sdk/esp32s2/lib/libesp_gdbstub.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_hid.a b/tools/sdk/esp32s2/lib/libesp_hid.a index 8d6695a5ae7..b95977bf82b 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_hid.a and b/tools/sdk/esp32s2/lib/libesp_hid.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_http_client.a b/tools/sdk/esp32s2/lib/libesp_http_client.a index 7fd6c41b22e..eee0038ca6f 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_http_client.a and b/tools/sdk/esp32s2/lib/libesp_http_client.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_http_server.a b/tools/sdk/esp32s2/lib/libesp_http_server.a index 7f0ee738789..0ffa15f7b8f 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_http_server.a and b/tools/sdk/esp32s2/lib/libesp_http_server.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_https_ota.a b/tools/sdk/esp32s2/lib/libesp_https_ota.a index 3ded69dc830..fbc0df6054e 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_https_ota.a and b/tools/sdk/esp32s2/lib/libesp_https_ota.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_https_server.a b/tools/sdk/esp32s2/lib/libesp_https_server.a index c5a72303746..710fbdf13c2 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_https_server.a and b/tools/sdk/esp32s2/lib/libesp_https_server.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_hw_support.a b/tools/sdk/esp32s2/lib/libesp_hw_support.a index ccef1244aba..fff5c162f01 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_hw_support.a and b/tools/sdk/esp32s2/lib/libesp_hw_support.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_ipc.a b/tools/sdk/esp32s2/lib/libesp_ipc.a index 108afc26515..619a0cc2087 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_ipc.a and b/tools/sdk/esp32s2/lib/libesp_ipc.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_littlefs.a b/tools/sdk/esp32s2/lib/libesp_littlefs.a index d13451c316e..bee08fb87dd 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_littlefs.a and b/tools/sdk/esp32s2/lib/libesp_littlefs.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_local_ctrl.a b/tools/sdk/esp32s2/lib/libesp_local_ctrl.a index 769830610b9..1a9903f2b02 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_local_ctrl.a and b/tools/sdk/esp32s2/lib/libesp_local_ctrl.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_netif.a b/tools/sdk/esp32s2/lib/libesp_netif.a index 16f6044a44b..b138570af81 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_netif.a and b/tools/sdk/esp32s2/lib/libesp_netif.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_pm.a b/tools/sdk/esp32s2/lib/libesp_pm.a index 58b9b4690d5..f6e59c08577 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_pm.a and b/tools/sdk/esp32s2/lib/libesp_pm.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_ringbuf.a b/tools/sdk/esp32s2/lib/libesp_ringbuf.a index fbea9f88046..0a8a88940a3 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_ringbuf.a and b/tools/sdk/esp32s2/lib/libesp_ringbuf.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_rom.a b/tools/sdk/esp32s2/lib/libesp_rom.a index 987196270e2..741f7395d73 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_rom.a and b/tools/sdk/esp32s2/lib/libesp_rom.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_serial_slave_link.a b/tools/sdk/esp32s2/lib/libesp_serial_slave_link.a index 002f5baa8c2..cab76b2f6b8 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_serial_slave_link.a and b/tools/sdk/esp32s2/lib/libesp_serial_slave_link.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_system.a b/tools/sdk/esp32s2/lib/libesp_system.a index a9c34631a8e..4f40dd03f99 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_system.a and b/tools/sdk/esp32s2/lib/libesp_system.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_timer.a b/tools/sdk/esp32s2/lib/libesp_timer.a index 3aecfc3a2de..75d6c1e7cea 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_timer.a and b/tools/sdk/esp32s2/lib/libesp_timer.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_websocket_client.a b/tools/sdk/esp32s2/lib/libesp_websocket_client.a index ef91583e438..625e8817808 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_websocket_client.a and b/tools/sdk/esp32s2/lib/libesp_websocket_client.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_wifi.a b/tools/sdk/esp32s2/lib/libesp_wifi.a index 5aeef4530c9..e2307872c8f 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_wifi.a and b/tools/sdk/esp32s2/lib/libesp_wifi.a differ diff --git a/tools/sdk/esp32s2/lib/libespcoredump.a b/tools/sdk/esp32s2/lib/libespcoredump.a index 5cad21ba8c0..0e783b3cf7e 100644 Binary files a/tools/sdk/esp32s2/lib/libespcoredump.a and b/tools/sdk/esp32s2/lib/libespcoredump.a differ diff --git a/tools/sdk/esp32s2/lib/libespnow.a b/tools/sdk/esp32s2/lib/libespnow.a index ad62c954de6..0544b05cd44 100644 Binary files a/tools/sdk/esp32s2/lib/libespnow.a and b/tools/sdk/esp32s2/lib/libespnow.a differ diff --git a/tools/sdk/esp32s2/lib/libexpat.a b/tools/sdk/esp32s2/lib/libexpat.a index 26a030647c9..1efb41916c2 100644 Binary files a/tools/sdk/esp32s2/lib/libexpat.a and b/tools/sdk/esp32s2/lib/libexpat.a differ diff --git a/tools/sdk/esp32s2/lib/libfatfs.a b/tools/sdk/esp32s2/lib/libfatfs.a index 207af11b672..506ccd073ac 100644 Binary files a/tools/sdk/esp32s2/lib/libfatfs.a and b/tools/sdk/esp32s2/lib/libfatfs.a differ diff --git a/tools/sdk/esp32s2/lib/libfb_gfx.a b/tools/sdk/esp32s2/lib/libfb_gfx.a index 3af77fbf653..ce65f20108b 100644 Binary files a/tools/sdk/esp32s2/lib/libfb_gfx.a and b/tools/sdk/esp32s2/lib/libfb_gfx.a differ diff --git a/tools/sdk/esp32s2/lib/libfreemodbus.a b/tools/sdk/esp32s2/lib/libfreemodbus.a index 55014583940..381340bb632 100644 Binary files a/tools/sdk/esp32s2/lib/libfreemodbus.a and b/tools/sdk/esp32s2/lib/libfreemodbus.a differ diff --git a/tools/sdk/esp32s2/lib/libfreertos.a b/tools/sdk/esp32s2/lib/libfreertos.a index b1bbf98da49..be761a47bd9 100644 Binary files a/tools/sdk/esp32s2/lib/libfreertos.a and b/tools/sdk/esp32s2/lib/libfreertos.a differ diff --git a/tools/sdk/esp32s2/lib/libhal.a b/tools/sdk/esp32s2/lib/libhal.a index e954c7ef5c1..6c122c634fb 100644 Binary files a/tools/sdk/esp32s2/lib/libhal.a and b/tools/sdk/esp32s2/lib/libhal.a differ diff --git a/tools/sdk/esp32s2/lib/libheap.a b/tools/sdk/esp32s2/lib/libheap.a index 8dfd914ed06..3cb174c59ef 100644 Binary files a/tools/sdk/esp32s2/lib/libheap.a and b/tools/sdk/esp32s2/lib/libheap.a differ diff --git a/tools/sdk/esp32s2/lib/libjsmn.a b/tools/sdk/esp32s2/lib/libjsmn.a index ba2fab70fa6..a81a8a31303 100644 Binary files a/tools/sdk/esp32s2/lib/libjsmn.a and b/tools/sdk/esp32s2/lib/libjsmn.a differ diff --git a/tools/sdk/esp32s2/lib/libjson.a b/tools/sdk/esp32s2/lib/libjson.a index 37010009021..7e9b4d1db6a 100644 Binary files a/tools/sdk/esp32s2/lib/libjson.a and b/tools/sdk/esp32s2/lib/libjson.a differ diff --git a/tools/sdk/esp32s2/lib/liblibsodium.a b/tools/sdk/esp32s2/lib/liblibsodium.a index 3598bbc0535..29f61808ed9 100644 Binary files a/tools/sdk/esp32s2/lib/liblibsodium.a and b/tools/sdk/esp32s2/lib/liblibsodium.a differ diff --git a/tools/sdk/esp32s2/lib/liblog.a b/tools/sdk/esp32s2/lib/liblog.a index 78b3a687c95..86aac42e412 100644 Binary files a/tools/sdk/esp32s2/lib/liblog.a and b/tools/sdk/esp32s2/lib/liblog.a differ diff --git a/tools/sdk/esp32s2/lib/liblwip.a b/tools/sdk/esp32s2/lib/liblwip.a index 6edf39fb64e..93c51dd5c6a 100644 Binary files a/tools/sdk/esp32s2/lib/liblwip.a and b/tools/sdk/esp32s2/lib/liblwip.a differ diff --git a/tools/sdk/esp32s2/lib/libmbedcrypto.a b/tools/sdk/esp32s2/lib/libmbedcrypto.a index 6445f81d5e9..e7e01ac5677 100644 Binary files a/tools/sdk/esp32s2/lib/libmbedcrypto.a and b/tools/sdk/esp32s2/lib/libmbedcrypto.a differ diff --git a/tools/sdk/esp32s2/lib/libmbedtls.a b/tools/sdk/esp32s2/lib/libmbedtls.a index 07957644d48..d9720dffd1f 100644 Binary files a/tools/sdk/esp32s2/lib/libmbedtls.a and b/tools/sdk/esp32s2/lib/libmbedtls.a differ diff --git a/tools/sdk/esp32s2/lib/libmbedx509.a b/tools/sdk/esp32s2/lib/libmbedx509.a index 34740174ecc..dd53ac0370a 100644 Binary files a/tools/sdk/esp32s2/lib/libmbedx509.a and b/tools/sdk/esp32s2/lib/libmbedx509.a differ diff --git a/tools/sdk/esp32s2/lib/libmdns.a b/tools/sdk/esp32s2/lib/libmdns.a index 2a2b6af78e9..72cd26b0f6e 100644 Binary files a/tools/sdk/esp32s2/lib/libmdns.a and b/tools/sdk/esp32s2/lib/libmdns.a differ diff --git a/tools/sdk/esp32s2/lib/libmesh.a b/tools/sdk/esp32s2/lib/libmesh.a index 9f94a62768b..7fe1bcf28dc 100644 Binary files a/tools/sdk/esp32s2/lib/libmesh.a and b/tools/sdk/esp32s2/lib/libmesh.a differ diff --git a/tools/sdk/esp32s2/lib/libmqtt.a b/tools/sdk/esp32s2/lib/libmqtt.a index 6c30229cecd..ed516e33046 100644 Binary files a/tools/sdk/esp32s2/lib/libmqtt.a and b/tools/sdk/esp32s2/lib/libmqtt.a differ diff --git a/tools/sdk/esp32s2/lib/libnet80211.a b/tools/sdk/esp32s2/lib/libnet80211.a index 7efc67f6ff6..2e7d668e894 100644 Binary files a/tools/sdk/esp32s2/lib/libnet80211.a and b/tools/sdk/esp32s2/lib/libnet80211.a differ diff --git a/tools/sdk/esp32s2/lib/libnewlib.a b/tools/sdk/esp32s2/lib/libnewlib.a index 22e6873c4f4..3aa909ddcb4 100644 Binary files a/tools/sdk/esp32s2/lib/libnewlib.a and b/tools/sdk/esp32s2/lib/libnewlib.a differ diff --git a/tools/sdk/esp32s2/lib/libnghttp.a b/tools/sdk/esp32s2/lib/libnghttp.a index 91b273d61a4..c6879ab824d 100644 Binary files a/tools/sdk/esp32s2/lib/libnghttp.a and b/tools/sdk/esp32s2/lib/libnghttp.a differ diff --git a/tools/sdk/esp32s2/lib/libnvs_flash.a b/tools/sdk/esp32s2/lib/libnvs_flash.a index 248b9d7b288..2649179615a 100644 Binary files a/tools/sdk/esp32s2/lib/libnvs_flash.a and b/tools/sdk/esp32s2/lib/libnvs_flash.a differ diff --git a/tools/sdk/esp32s2/lib/libopenssl.a b/tools/sdk/esp32s2/lib/libopenssl.a index e4077d21b1c..1c2cec05f15 100644 Binary files a/tools/sdk/esp32s2/lib/libopenssl.a and b/tools/sdk/esp32s2/lib/libopenssl.a differ diff --git a/tools/sdk/esp32s2/lib/libperfmon.a b/tools/sdk/esp32s2/lib/libperfmon.a index 088f7c8e12c..e607b5babe1 100644 Binary files a/tools/sdk/esp32s2/lib/libperfmon.a and b/tools/sdk/esp32s2/lib/libperfmon.a differ diff --git a/tools/sdk/esp32s2/lib/libpp.a b/tools/sdk/esp32s2/lib/libpp.a index 95ff82747d7..db0aced957c 100644 Binary files a/tools/sdk/esp32s2/lib/libpp.a and b/tools/sdk/esp32s2/lib/libpp.a differ diff --git a/tools/sdk/esp32s2/lib/libprotobuf-c.a b/tools/sdk/esp32s2/lib/libprotobuf-c.a index 1e5232715d6..1f3ddbdb493 100644 Binary files a/tools/sdk/esp32s2/lib/libprotobuf-c.a and b/tools/sdk/esp32s2/lib/libprotobuf-c.a differ diff --git a/tools/sdk/esp32s2/lib/libprotocomm.a b/tools/sdk/esp32s2/lib/libprotocomm.a index 1cb1ccf5ad5..788cb4bff41 100644 Binary files a/tools/sdk/esp32s2/lib/libprotocomm.a and b/tools/sdk/esp32s2/lib/libprotocomm.a differ diff --git a/tools/sdk/esp32s2/lib/libpthread.a b/tools/sdk/esp32s2/lib/libpthread.a index 4466bea210b..bb9b0f660fc 100644 Binary files a/tools/sdk/esp32s2/lib/libpthread.a and b/tools/sdk/esp32s2/lib/libpthread.a differ diff --git a/tools/sdk/esp32s2/lib/libsdmmc.a b/tools/sdk/esp32s2/lib/libsdmmc.a index 3ae291aa5b3..180ca9e5b46 100644 Binary files a/tools/sdk/esp32s2/lib/libsdmmc.a and b/tools/sdk/esp32s2/lib/libsdmmc.a differ diff --git a/tools/sdk/esp32s2/lib/libsmartconfig.a b/tools/sdk/esp32s2/lib/libsmartconfig.a index e6a4a14c577..c6ce468de2c 100644 Binary files a/tools/sdk/esp32s2/lib/libsmartconfig.a and b/tools/sdk/esp32s2/lib/libsmartconfig.a differ diff --git a/tools/sdk/esp32s2/lib/libsoc.a b/tools/sdk/esp32s2/lib/libsoc.a index de470a5abb6..47d73c48a4c 100644 Binary files a/tools/sdk/esp32s2/lib/libsoc.a and b/tools/sdk/esp32s2/lib/libsoc.a differ diff --git a/tools/sdk/esp32s2/lib/libspi_flash.a b/tools/sdk/esp32s2/lib/libspi_flash.a index 2c3b8c6ff3d..015ad0e38a4 100644 Binary files a/tools/sdk/esp32s2/lib/libspi_flash.a and b/tools/sdk/esp32s2/lib/libspi_flash.a differ diff --git a/tools/sdk/esp32s2/lib/libspiffs.a b/tools/sdk/esp32s2/lib/libspiffs.a index 4e52c8e0a05..8a6ecc0f4d2 100644 Binary files a/tools/sdk/esp32s2/lib/libspiffs.a and b/tools/sdk/esp32s2/lib/libspiffs.a differ diff --git a/tools/sdk/esp32s2/lib/libtcp_transport.a b/tools/sdk/esp32s2/lib/libtcp_transport.a index 627c9b505f3..d84850cda7f 100644 Binary files a/tools/sdk/esp32s2/lib/libtcp_transport.a and b/tools/sdk/esp32s2/lib/libtcp_transport.a differ diff --git a/tools/sdk/esp32s2/lib/libtcpip_adapter.a b/tools/sdk/esp32s2/lib/libtcpip_adapter.a index dcc8f0d10ff..cb5edc65f17 100644 Binary files a/tools/sdk/esp32s2/lib/libtcpip_adapter.a and b/tools/sdk/esp32s2/lib/libtcpip_adapter.a differ diff --git a/tools/sdk/esp32s2/lib/libtouch_element.a b/tools/sdk/esp32s2/lib/libtouch_element.a index cab5cec9eda..c67e07456ae 100644 Binary files a/tools/sdk/esp32s2/lib/libtouch_element.a and b/tools/sdk/esp32s2/lib/libtouch_element.a differ diff --git a/tools/sdk/esp32s2/lib/libulp.a b/tools/sdk/esp32s2/lib/libulp.a index cd15d321479..a79a6f122c2 100644 Binary files a/tools/sdk/esp32s2/lib/libulp.a and b/tools/sdk/esp32s2/lib/libulp.a differ diff --git a/tools/sdk/esp32s2/lib/libunity.a b/tools/sdk/esp32s2/lib/libunity.a index 567084d2682..75eff52ebb1 100644 Binary files a/tools/sdk/esp32s2/lib/libunity.a and b/tools/sdk/esp32s2/lib/libunity.a differ diff --git a/tools/sdk/esp32s2/lib/libusb.a b/tools/sdk/esp32s2/lib/libusb.a index 8b0e2e92e78..4d6925ab723 100644 Binary files a/tools/sdk/esp32s2/lib/libusb.a and b/tools/sdk/esp32s2/lib/libusb.a differ diff --git a/tools/sdk/esp32s2/lib/libvfs.a b/tools/sdk/esp32s2/lib/libvfs.a index f74e7dadcfb..5b023928c73 100644 Binary files a/tools/sdk/esp32s2/lib/libvfs.a and b/tools/sdk/esp32s2/lib/libvfs.a differ diff --git a/tools/sdk/esp32s2/lib/libwapi.a b/tools/sdk/esp32s2/lib/libwapi.a index d549cc06e14..c8c18acec09 100644 Binary files a/tools/sdk/esp32s2/lib/libwapi.a and b/tools/sdk/esp32s2/lib/libwapi.a differ diff --git a/tools/sdk/esp32s2/lib/libwear_levelling.a b/tools/sdk/esp32s2/lib/libwear_levelling.a index 266ef6652e7..ec34ef07d6b 100644 Binary files a/tools/sdk/esp32s2/lib/libwear_levelling.a and b/tools/sdk/esp32s2/lib/libwear_levelling.a differ diff --git a/tools/sdk/esp32s2/lib/libwifi_provisioning.a b/tools/sdk/esp32s2/lib/libwifi_provisioning.a index 77df1e59b43..870c0743d8a 100644 Binary files a/tools/sdk/esp32s2/lib/libwifi_provisioning.a and b/tools/sdk/esp32s2/lib/libwifi_provisioning.a differ diff --git a/tools/sdk/esp32s2/lib/libwpa_supplicant.a b/tools/sdk/esp32s2/lib/libwpa_supplicant.a index fdc3270bb99..58d3ecf2bcd 100644 Binary files a/tools/sdk/esp32s2/lib/libwpa_supplicant.a and b/tools/sdk/esp32s2/lib/libwpa_supplicant.a differ diff --git a/tools/sdk/esp32s2/lib/libxtensa.a b/tools/sdk/esp32s2/lib/libxtensa.a index 318141f3440..8d9454c9757 100644 Binary files a/tools/sdk/esp32s2/lib/libxtensa.a and b/tools/sdk/esp32s2/lib/libxtensa.a differ diff --git a/tools/sdk/esp32s2/sdkconfig b/tools/sdk/esp32s2/sdkconfig index 2b0fde80073..a3a9bfb9411 100644 --- a/tools/sdk/esp32s2/sdkconfig +++ b/tools/sdk/esp32s2/sdkconfig @@ -428,9 +428,6 @@ CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768 # CONFIG_ESP32S2_TRAX is not set CONFIG_ESP32S2_TRACEMEM_RESERVE_DRAM=0x0 -# CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES_ONE is not set -CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES_TWO=y -CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES=2 # CONFIG_ESP32S2_ULP_COPROC_ENABLED is not set CONFIG_ESP32S2_ULP_COPROC_RESERVE_MEM=0 CONFIG_ESP32S2_DEBUG_OCDAWARE=y @@ -533,7 +530,15 @@ CONFIG_ESP_HTTPS_SERVER_ENABLE=y # CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y +# CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES_ONE is not set +CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES_TWO=y +CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES=2 # end of MAC Config + +# +# Sleep Config +# +# end of Sleep Config # end of Hardware Settings # @@ -890,6 +895,7 @@ CONFIG_LWIP_PPP_PAP_SUPPORT=y CONFIG_LWIP_PPP_CHAP_SUPPORT=y CONFIG_LWIP_PPP_MSCHAP_SUPPORT=y CONFIG_LWIP_PPP_MPPE_SUPPORT=y +# CONFIG_LWIP_ENABLE_LCP_ECHO is not set # CONFIG_LWIP_PPP_DEBUG_ON is not set # CONFIG_LWIP_SLIP_SUPPORT is not set @@ -913,13 +919,6 @@ CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1 CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 # end of SNTP -# -# LCP -# -CONFIG_LCP_ECHOINTERVAL=0 -CONFIG_LCP_MAXECHOFAILS=3 -# end of LCP - CONFIG_LWIP_ESP_LWIP_ASSERT=y # @@ -936,22 +935,7 @@ CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y # CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set # end of Hooks -# -# Debug -# -# CONFIG_LWIP_NETIF_DEBUG is not set -# CONFIG_LWIP_PBUF_DEBUG is not set -# CONFIG_LWIP_ETHARP_DEBUG is not set -# CONFIG_LWIP_API_LIB_DEBUG is not set -# CONFIG_LWIP_SOCKETS_DEBUG is not set -# CONFIG_LWIP_IP_DEBUG is not set -# CONFIG_LWIP_ICMP_DEBUG is not set -# CONFIG_LWIP_DHCP_STATE_DEBUG is not set -# CONFIG_LWIP_DHCP_DEBUG is not set -# CONFIG_LWIP_IP6_DEBUG is not set -# CONFIG_LWIP_ICMP6_DEBUG is not set -# CONFIG_LWIP_TCP_DEBUG is not set -# end of Debug +# CONFIG_LWIP_DEBUG is not set # end of LWIP # @@ -1083,6 +1067,7 @@ CONFIG_MDNS_TASK_STACK_SIZE=4096 CONFIG_MDNS_TASK_AFFINITY_CPU0=y CONFIG_MDNS_TASK_AFFINITY=0x0 CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 +# CONFIG_MDNS_STRICT_MODE is not set CONFIG_MDNS_TIMER_PERIOD_MS=100 # end of mDNS @@ -1127,6 +1112,12 @@ CONFIG_OPENSSL_ASSERT_DO_NOTHING=y # CONFIG_OPENSSL_ASSERT_EXIT is not set # end of OpenSSL +# +# OpenThread +# +# CONFIG_OPENTHREAD_ENABLED is not set +# end of OpenThread + # # PThreads #