├── .codespellrc ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── dependabot.yml ├── stale.yml └── workflows │ ├── auto-github-actions.yml │ ├── report-size-deltas.yml │ └── spell-check.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── LibraryPatches ├── Ethernet │ └── src │ │ ├── Ethernet.cpp │ │ ├── Ethernet.h │ │ ├── EthernetServer.cpp │ │ └── utility │ │ ├── w5100.cpp │ │ └── w5100.h ├── Ethernet2 │ └── src │ │ ├── Ethernet2.cpp │ │ ├── Ethernet2.h │ │ ├── EthernetUdp2.cpp │ │ └── EthernetUdp2.h ├── Ethernet3 │ └── src │ │ ├── Ethernet3.cpp │ │ └── Ethernet3.h ├── EthernetLarge │ └── src │ │ ├── EthernetLarge.cpp │ │ ├── EthernetLarge.h │ │ ├── EthernetServer.cpp │ │ └── utility │ │ ├── w5100.cpp │ │ └── w5100.h ├── UIPEthernet-2.0.9 │ ├── UIPEthernet.cpp │ ├── UIPEthernet.h │ └── utility │ │ ├── Enc28J60Network.cpp │ │ └── Enc28J60Network.h ├── UIPEthernet │ ├── UIPEthernet.cpp │ ├── UIPEthernet.h │ └── utility │ │ ├── Enc28J60Network.cpp │ │ └── Enc28J60Network.h └── esp32 │ └── cores │ └── esp32 │ └── Server.h ├── Packages_Patches ├── Fab_SAM_Arduino │ └── hardware │ │ └── samd │ │ ├── 1.6.18-alpha2 │ │ └── boards.txt │ │ ├── 1.7.0 │ │ └── boards.txt │ │ ├── 1.8.0 │ │ └── boards.txt │ │ └── 1.9.0 │ │ └── boards.txt ├── Maixduino │ └── hardware │ │ └── k210 │ │ ├── 0.3.10 │ │ └── cores │ │ │ └── arduino │ │ │ └── Stream.h │ │ └── 0.3.11 │ │ └── cores │ │ └── arduino │ │ └── Stream.h ├── STM32 │ └── hardware │ │ └── stm32 │ │ ├── 1.9.0 │ │ ├── system │ │ │ ├── STM32F4xx │ │ │ │ └── stm32f4xx_hal_conf_default.h │ │ │ └── STM32F7xx │ │ │ │ └── stm32f7xx_hal_conf_default.h │ │ └── variants │ │ │ ├── NUCLEO_F767ZI │ │ │ └── variant.h │ │ │ └── NUCLEO_L053R8 │ │ │ └── variant.h │ │ ├── 2.0.0 │ │ ├── system │ │ │ ├── STM32F4xx │ │ │ │ └── stm32f4xx_hal_conf_default.h │ │ │ └── STM32F7xx │ │ │ │ └── stm32f7xx_hal_conf_default.h │ │ └── variants │ │ │ ├── F765Z(G-I)T_F767Z(G-I)T_F777ZIT │ │ │ └── variant_NUCLEO_F767ZI.h │ │ │ ├── L052R(6-8)H_L053R(6-8)H │ │ │ └── variant_generic.h │ │ │ ├── STM32F7xx │ │ │ └── F765Z(G-I)T_F767Z(G-I)T_F777ZIT │ │ │ │ └── variant_NUCLEO_F767ZI.h │ │ │ └── STM32L0xx │ │ │ └── L052R(6-8)T_L053R(6-8)T_L063R8T │ │ │ └── variant_generic.h │ │ ├── 2.1.0 │ │ ├── system │ │ │ ├── STM32F4xx │ │ │ │ └── stm32f4xx_hal_conf_default.h │ │ │ └── STM32F7xx │ │ │ │ └── stm32f7xx_hal_conf_default.h │ │ └── variants │ │ │ ├── STM32F7xx │ │ │ └── F765Z(G-I)T_F767Z(G-I)T_F777ZIT │ │ │ │ └── variant_NUCLEO_F767ZI.h │ │ │ └── STM32L0xx │ │ │ └── L052R(6-8)T_L053R(6-8)T_L063R8T │ │ │ └── variant_generic.h │ │ ├── 2.2.0 │ │ ├── system │ │ │ ├── STM32F4xx │ │ │ │ └── stm32f4xx_hal_conf_default.h │ │ │ └── STM32F7xx │ │ │ │ └── stm32f7xx_hal_conf_default.h │ │ └── variants │ │ │ ├── STM32F7xx │ │ │ └── F765Z(G-I)T_F767Z(G-I)T_F777ZIT │ │ │ │ └── variant_NUCLEO_F767ZI.h │ │ │ └── STM32L0xx │ │ │ └── L052R(6-8)T_L053R(6-8)T_L063R8T │ │ │ └── variant_generic.h │ │ └── 2.3.0 │ │ ├── system │ │ ├── STM32F4xx │ │ │ └── stm32f4xx_hal_conf_default.h │ │ └── STM32F7xx │ │ │ └── stm32f7xx_hal_conf_default.h │ │ └── variants │ │ ├── STM32F7xx │ │ └── F765Z(G-I)T_F767Z(G-I)T_F777ZIT │ │ │ └── variant_NUCLEO_F767ZI.h │ │ └── STM32L0xx │ │ └── L052R(6-8)T_L053R(6-8)T_L063R8T │ │ └── variant_generic.h ├── Seeeduino │ └── hardware │ │ ├── nrf52 │ │ └── 1.0.0 │ │ │ ├── cores │ │ │ └── nRF5 │ │ │ │ ├── Print.cpp │ │ │ │ ├── Print.h │ │ │ │ └── Udp.h │ │ │ └── platform.txt │ │ ├── rp2040 │ │ ├── 1.9.3 │ │ │ └── variants │ │ │ │ └── rpipico │ │ │ │ └── pins_arduino.h │ │ └── 2.7.2 │ │ │ ├── boards.txt │ │ │ └── variants │ │ │ └── Seeed_XIAO_RP2040 │ │ │ └── pins_arduino.h │ │ └── samd │ │ ├── 1.7.0 │ │ └── boards.txt │ │ ├── 1.7.7 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Arduino.h │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.8 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Arduino.h │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.9 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Arduino.h │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.8.1 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Arduino.h │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.8.2 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Arduino.h │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ └── 1.8.3 │ │ ├── cores │ │ └── arduino │ │ │ ├── Arduino.h │ │ │ ├── Print.cpp │ │ │ └── Print.h │ │ └── platform.txt ├── SparkFun │ └── hardware │ │ └── samd │ │ └── 1.8.3 │ │ └── cores │ │ ├── arduino │ │ ├── Print.cpp │ │ └── Print.h │ │ └── arduino51 │ │ ├── Print.cpp │ │ └── Print.h ├── adafruit │ └── hardware │ │ ├── nrf52 │ │ ├── 0.19.0 │ │ │ ├── boards.txt │ │ │ ├── cores │ │ │ │ └── nRF5 │ │ │ │ │ ├── Print.cpp │ │ │ │ │ ├── Print.h │ │ │ │ │ └── Udp.h │ │ │ ├── platform.txt │ │ │ └── variants │ │ │ │ ├── NINA_B112_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ │ │ └── NINA_B302_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ ├── 0.20.1 │ │ │ ├── boards.txt │ │ │ ├── cores │ │ │ │ └── nRF5 │ │ │ │ │ ├── Print.cpp │ │ │ │ │ ├── Print.h │ │ │ │ │ └── Udp.h │ │ │ ├── platform.txt │ │ │ └── variants │ │ │ │ ├── NINA_B112_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ │ │ └── NINA_B302_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ ├── 0.20.5 │ │ │ ├── boards.txt │ │ │ ├── cores │ │ │ │ └── nRF5 │ │ │ │ │ ├── Print.cpp │ │ │ │ │ ├── Print.h │ │ │ │ │ └── Udp.h │ │ │ ├── platform.txt │ │ │ └── variants │ │ │ │ ├── NINA_B112_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ │ │ └── NINA_B302_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ ├── 0.21.0 │ │ │ ├── boards.txt │ │ │ ├── cores │ │ │ │ └── nRF5 │ │ │ │ │ ├── Print.cpp │ │ │ │ │ ├── Print.h │ │ │ │ │ └── Udp.h │ │ │ ├── platform.txt │ │ │ └── variants │ │ │ │ ├── NINA_B112_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ │ │ └── NINA_B302_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ ├── 0.22.0 │ │ │ ├── boards.txt │ │ │ ├── cores │ │ │ │ └── nRF5 │ │ │ │ │ ├── Print.cpp │ │ │ │ │ ├── Print.h │ │ │ │ │ └── Udp.h │ │ │ ├── platform.txt │ │ │ └── variants │ │ │ │ ├── NINA_B112_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ │ │ └── NINA_B302_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ ├── 0.22.1 │ │ │ ├── boards.txt │ │ │ ├── cores │ │ │ │ └── nRF5 │ │ │ │ │ ├── Print.cpp │ │ │ │ │ ├── Print.h │ │ │ │ │ └── Udp.h │ │ │ ├── platform.txt │ │ │ └── variants │ │ │ │ ├── NINA_B112_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ │ │ └── NINA_B302_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ ├── 0.23.0 │ │ │ ├── boards.txt │ │ │ ├── cores │ │ │ │ └── nRF5 │ │ │ │ │ ├── Print.cpp │ │ │ │ │ ├── Print.h │ │ │ │ │ └── Udp.h │ │ │ ├── platform.txt │ │ │ └── variants │ │ │ │ ├── NINA_B112_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ │ │ └── NINA_B302_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ ├── 0.24.0 │ │ │ ├── boards.txt │ │ │ ├── cores │ │ │ │ └── nRF5 │ │ │ │ │ ├── Print.cpp │ │ │ │ │ ├── Print.h │ │ │ │ │ └── Udp.h │ │ │ ├── platform.txt │ │ │ └── variants │ │ │ │ ├── NINA_B112_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ │ │ └── NINA_B302_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ ├── 1.0.0 │ │ │ ├── boards.txt │ │ │ ├── cores │ │ │ │ └── nRF5 │ │ │ │ │ ├── Print.cpp │ │ │ │ │ ├── Print.h │ │ │ │ │ └── Udp.h │ │ │ ├── platform.txt │ │ │ └── variants │ │ │ │ ├── NINA_B112_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ │ │ ├── NINA_B302_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ │ │ └── sparkfun_nrf52840_mini │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ ├── 1.1.0 │ │ │ ├── boards.txt │ │ │ ├── cores │ │ │ │ └── nRF5 │ │ │ │ │ ├── Print.cpp │ │ │ │ │ ├── Print.h │ │ │ │ │ └── Udp.h │ │ │ ├── platform.txt │ │ │ └── variants │ │ │ │ ├── NINA_B112_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ │ │ ├── NINA_B302_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ │ │ └── sparkfun_nrf52840_mini │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ ├── 1.2.0 │ │ │ ├── boards.txt │ │ │ ├── cores │ │ │ │ └── nRF5 │ │ │ │ │ ├── Print.cpp │ │ │ │ │ ├── Print.h │ │ │ │ │ └── Udp.h │ │ │ ├── platform.txt │ │ │ └── variants │ │ │ │ ├── NINA_B112_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ │ │ ├── NINA_B302_ublox │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ │ │ └── sparkfun_nrf52840_mini │ │ │ │ ├── variant.cpp │ │ │ │ └── variant.h │ │ └── 1.3.0 │ │ │ ├── boards.txt │ │ │ ├── cores │ │ │ └── nRF5 │ │ │ │ ├── Print.cpp │ │ │ │ ├── Print.h │ │ │ │ └── Udp.h │ │ │ ├── platform.txt │ │ │ └── variants │ │ │ ├── NINA_B112_ublox │ │ │ ├── pins_arduino.h │ │ │ ├── variant.cpp │ │ │ └── variant.h │ │ │ ├── NINA_B302_ublox │ │ │ ├── pins_arduino.h │ │ │ ├── variant.cpp │ │ │ └── variant.h │ │ │ └── sparkfun_nrf52840_mini │ │ │ ├── variant.cpp │ │ │ └── variant.h │ │ └── samd │ │ ├── 1.5.14 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.6.0 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.6.3 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.6.4 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.6.5 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.6.6 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.6.7 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.6.8 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.0 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.1 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.10 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.11 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.2 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.3 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.4 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.5 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.6 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.7 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.8 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ └── 1.7.9 │ │ ├── cores │ │ └── arduino │ │ │ ├── Print.cpp │ │ │ └── Print.h │ │ └── platform.txt ├── arduino │ └── hardware │ │ ├── mbed_portenta │ │ ├── 2.4.1 │ │ │ ├── cores │ │ │ │ └── arduino │ │ │ │ │ └── mbed │ │ │ │ │ └── connectivity │ │ │ │ │ └── lwipstack │ │ │ │ │ └── include │ │ │ │ │ └── lwipstack │ │ │ │ │ └── lwipopts.h │ │ │ ├── libraries │ │ │ │ └── SocketWrapper │ │ │ │ │ └── src │ │ │ │ │ ├── MbedUdp.cpp │ │ │ │ │ └── MbedUdp.h │ │ │ └── portenta_post_install.sh │ │ ├── 2.5.2 │ │ │ ├── cores │ │ │ │ └── arduino │ │ │ │ │ └── mbed │ │ │ │ │ └── connectivity │ │ │ │ │ └── lwipstack │ │ │ │ │ └── include │ │ │ │ │ └── lwipstack │ │ │ │ │ └── lwipopts.h │ │ │ ├── libraries │ │ │ │ └── SocketWrapper │ │ │ │ │ └── src │ │ │ │ │ ├── MbedUdp.cpp │ │ │ │ │ └── MbedUdp.h │ │ │ └── portenta_post_install.sh │ │ ├── 2.6.1 │ │ │ ├── cores │ │ │ │ └── arduino │ │ │ │ │ └── mbed │ │ │ │ │ └── connectivity │ │ │ │ │ └── lwipstack │ │ │ │ │ └── include │ │ │ │ │ └── lwipstack │ │ │ │ │ └── lwipopts.h │ │ │ ├── libraries │ │ │ │ └── SocketWrapper │ │ │ │ │ └── src │ │ │ │ │ ├── MbedUdp.cpp │ │ │ │ │ └── MbedUdp.h │ │ │ └── portenta_post_install.sh │ │ ├── 2.7.2 │ │ │ ├── cores │ │ │ │ └── arduino │ │ │ │ │ └── mbed │ │ │ │ │ └── connectivity │ │ │ │ │ └── lwipstack │ │ │ │ │ └── include │ │ │ │ │ └── lwipstack │ │ │ │ │ └── lwipopts.h │ │ │ └── portenta_post_install.sh │ │ ├── 2.8.0 │ │ │ ├── cores │ │ │ │ └── arduino │ │ │ │ │ └── mbed │ │ │ │ │ └── connectivity │ │ │ │ │ └── lwipstack │ │ │ │ │ └── include │ │ │ │ │ └── lwipstack │ │ │ │ │ └── lwipopts.h │ │ │ └── portenta_post_install.sh │ │ ├── 3.0.0 │ │ │ ├── cores │ │ │ │ └── arduino │ │ │ │ │ └── mbed │ │ │ │ │ └── connectivity │ │ │ │ │ └── lwipstack │ │ │ │ │ └── include │ │ │ │ │ └── lwipstack │ │ │ │ │ └── lwipopts.h │ │ │ └── portenta_post_install.sh │ │ ├── 3.0.1 │ │ │ ├── cores │ │ │ │ └── arduino │ │ │ │ │ └── mbed │ │ │ │ │ └── connectivity │ │ │ │ │ └── lwipstack │ │ │ │ │ └── include │ │ │ │ │ └── lwipstack │ │ │ │ │ └── lwipopts.h │ │ │ └── portenta_post_install.sh │ │ ├── 3.1.1 │ │ │ ├── cores │ │ │ │ └── arduino │ │ │ │ │ └── mbed │ │ │ │ │ └── connectivity │ │ │ │ │ └── lwipstack │ │ │ │ │ └── include │ │ │ │ │ └── lwipstack │ │ │ │ │ └── lwipopts.h │ │ │ └── portenta_post_install.sh │ │ ├── 3.3.0 │ │ │ └── portenta_post_install.sh │ │ └── 3.4.1 │ │ │ └── portenta_post_install.sh │ │ ├── sam │ │ └── 1.6.12 │ │ │ └── platform.txt │ │ └── samd │ │ ├── 1.8.10 │ │ └── platform.txt │ │ ├── 1.8.11 │ │ └── platform.txt │ │ ├── 1.8.12 │ │ └── platform.txt │ │ ├── 1.8.13 │ │ └── platform.txt │ │ ├── 1.8.6 │ │ ├── cores │ │ │ └── arduino │ │ │ │ └── Arduino.h │ │ └── platform.txt │ │ ├── 1.8.7 │ │ ├── cores │ │ │ └── arduino │ │ │ │ └── Arduino.h │ │ └── platform.txt │ │ ├── 1.8.8 │ │ ├── cores │ │ │ ├── Arduino.h │ │ │ └── arduino │ │ │ │ └── Arduino.h │ │ └── platform.txt │ │ └── 1.8.9 │ │ ├── cores │ │ └── arduino │ │ │ └── Arduino.h │ │ └── platform.txt ├── hardware │ └── teensy │ │ └── avr │ │ ├── boards.txt │ │ └── cores │ │ ├── teensy │ │ ├── Stream.cpp │ │ └── Stream.h │ │ ├── teensy3 │ │ ├── Stream.cpp │ │ └── Stream.h │ │ └── teensy4 │ │ ├── Stream.cpp │ │ └── Stream.h ├── industrialshields │ └── hardware │ │ └── avr │ │ ├── 1.1.36 │ │ └── cores │ │ │ └── industrialshields │ │ │ └── Udp.h │ │ └── 1.1.37 │ │ └── cores │ │ └── industrialshields │ │ └── Udp.h ├── realtek │ └── hardware │ │ └── AmebaD │ │ ├── 3.0.10 │ │ └── cores │ │ │ └── arduino │ │ │ └── avr │ │ │ └── pgmspace.h │ │ ├── 3.0.8 │ │ └── cores │ │ │ └── arduino │ │ │ └── avr │ │ │ └── pgmspace.h │ │ ├── 3.1.0 │ │ └── cores │ │ │ └── arduino │ │ │ └── avr │ │ │ └── pgmspace.h │ │ ├── 3.1.1 │ │ └── cores │ │ │ └── arduino │ │ │ └── avr │ │ │ └── pgmspace.h │ │ ├── 3.1.2 │ │ └── cores │ │ │ └── arduino │ │ │ └── avr │ │ │ └── pgmspace.h │ │ ├── 3.1.3 │ │ └── cores │ │ │ └── ambd │ │ │ └── avr │ │ │ └── pgmspace.h │ │ └── 3.1.4 │ │ └── cores │ │ └── ambd │ │ └── avr │ │ └── pgmspace.h └── rp2040 │ └── hardware │ └── rp2040 │ ├── 1.2.1 │ └── platform.txt │ ├── 1.2.2 │ └── platform.txt │ ├── 1.3.0 │ └── platform.txt │ ├── 1.3.1 │ ├── cores │ │ └── rp2040 │ │ │ └── Arduino.h │ └── platform.txt │ └── 1.4.0 │ ├── cores │ └── rp2040 │ │ └── Arduino.h │ └── platform.txt ├── README.md ├── TrustAnchors.md ├── changelog.md ├── examples ├── AWS_IoT │ ├── AWS_IoT.ino │ ├── AWS_Root_CA.h │ └── defines.h ├── AdvancedWebServer │ ├── AdvancedWebServer.ino │ └── defines.h ├── AdvancedWebServer_NativeEthernet │ ├── AdvancedWebServer_NativeEthernet.ino │ └── defines.h ├── AdvancedWebServer_RP2040_SPI1 │ ├── AdvancedWebServer_RP2040_SPI1.ino │ └── defines.h ├── AdvancedWebServer_Teensy4x_SPI1 │ ├── AdvancedWebServer_Teensy4x_SPI1.ino │ └── defines.h ├── HTTPClient │ ├── BasicAuthGet │ │ ├── BasicAuthGet.ino │ │ └── defines.h │ ├── CustomHeader │ │ ├── CustomHeader.ino │ │ └── defines.h │ ├── DweetGet │ │ ├── DweetGet.ino │ │ └── defines.h │ ├── DweetPost │ │ ├── DweetPost.ino │ │ └── defines.h │ ├── HueBlink │ │ ├── HueBlink.ino │ │ └── defines.h │ ├── PostWithHeaders │ │ ├── PostWithHeaders.ino │ │ └── defines.h │ ├── SimpleDelete │ │ ├── SimpleDelete.ino │ │ └── defines.h │ ├── SimpleGet │ │ ├── SimpleGet.ino │ │ └── defines.h │ ├── SimpleHTTPExample │ │ ├── SimpleHTTPExample.ino │ │ └── defines.h │ ├── SimplePost │ │ ├── SimplePost.ino │ │ └── defines.h │ ├── SimplePut │ │ ├── SimplePut.ino │ │ └── defines.h │ ├── SimpleWebSocket │ │ ├── SimpleWebSocket.ino │ │ └── defines.h │ └── node_test_server │ │ ├── getPostPutDelete.js │ │ └── package.json ├── HelloServer │ ├── HelloServer.ino │ └── defines.h ├── HelloServer2 │ ├── HelloServer2.ino │ └── defines.h ├── HttpBasicAuth │ ├── HttpBasicAuth.ino │ └── defines.h ├── MQTTClient_Auth │ ├── MQTTClient_Auth.ino │ └── defines.h ├── MQTTClient_Basic │ ├── MQTTClient_Basic.ino │ └── defines.h ├── MQTTClient_SSL │ ├── MQTTClient_SSL.ino │ ├── certificates.h │ └── defines.h ├── MQTTClient_SSL_Auth │ ├── MQTTClient_SSL_Auth.ino │ ├── certificates.h │ └── defines.h ├── MQTTClient_SSL_Complex │ ├── MQTTClient_SSL_Complex.ino │ ├── certificates.h │ └── defines.h ├── MQTTS_ThingStream │ ├── MQTTS_ThingStream.ino │ ├── broker.emqx.io-ca.crt │ ├── certificates.h │ └── defines.h ├── MQTT_ThingStream │ ├── MQTT_ThingStream.ino │ └── defines.h ├── PostServer │ ├── PostServer.ino │ └── defines.h ├── QNEthernet │ ├── AdvancedWebServer_QNEthernet │ │ ├── AdvancedWebServer_QNEthernet.ino │ │ └── defines.h │ ├── MQTTClient_SSL │ │ ├── MQTTClient_SSL.ino │ │ ├── certificates.h │ │ └── defines.h │ ├── MQTTClient_SSL_Auth │ │ ├── MQTTClient_SSL_Auth.ino │ │ ├── certificates.h │ │ └── defines.h │ ├── MQTTClient_SSL_Complex │ │ ├── MQTTClient_SSL_Complex.ino │ │ ├── certificates.h │ │ └── defines.h │ ├── MQTTS_ThingStream │ │ ├── MQTTS_ThingStream.ino │ │ ├── broker.emqx.io-ca.crt │ │ ├── certificates.h │ │ └── defines.h │ ├── WebClientMulti_SSL │ │ ├── WebClientMulti_SSL.ino │ │ ├── defines.h │ │ └── trustanchors.h │ └── WebClient_SSL │ │ ├── WebClient_SSL.ino │ │ ├── defines.h │ │ └── trust_anchors.h ├── SimpleAuthentication │ ├── SimpleAuthentication.ino │ └── defines.h ├── UdpNTPClient │ ├── UdpNTPClient.ino │ └── defines.h ├── UdpSendReceive │ ├── UdpSendReceive.ino │ └── defines.h ├── WebClient │ ├── WebClient.ino │ └── defines.h ├── WebClientMulti_SSL │ ├── WebClientMulti_SSL.ino │ ├── defines.h │ └── trustanchors.h ├── WebClientMulti_SSL_NativeEthernet │ ├── WebClientMulti_SSL_NativeEthernet.ino │ ├── defines.h │ └── trustanchors.h ├── WebClientRepeating │ ├── WebClientRepeating.ino │ └── defines.h ├── WebClientRepeating_ESP │ ├── WebClientRepeating_ESP.ino │ └── defines.h ├── WebClient_ESP │ ├── WebClient_ESP.ino │ └── defines.h ├── WebClient_SSL │ ├── WebClient_SSL.ino │ ├── defines.h │ └── trust_anchors.h ├── WebServer │ ├── WebServer.ino │ └── defines.h └── multiFileProject │ ├── multiFileProject.cpp │ ├── multiFileProject.h │ └── multiFileProject.ino ├── keywords.txt ├── library.json ├── library.properties ├── pics ├── AdvancedWebServer.png ├── AdvancedWebServer_ESP32_SPI2.png ├── AdvancedWebServer_Mbed_RPi_Pico.png ├── AdvancedWebServer_Mbed_RPi_Pico_SPI1.png ├── AdvancedWebServer_PortentaH7.png ├── AdvancedWebServer_QNEthernet.png ├── AdvancedWebServer_RPi_Pico.png ├── AdvancedWebServer_RPi_Pico_SPI1.png ├── AdvancedWebServer_Teensy41_SPI1.png └── Teensy41_pinout.png ├── platformio └── platformio.ini ├── src ├── EthernetHttpClient_SSL.h ├── EthernetWebServer_SSL-impl.h ├── EthernetWebServer_SSL.h ├── EthernetWebServer_SSL.hpp ├── Ethernet_HTTPClient │ ├── Ethernet_HttpClient.cpp │ ├── Ethernet_HttpClient.h │ ├── Ethernet_URLEncoder.cpp │ ├── Ethernet_URLEncoder.h │ ├── Ethernet_WebSocketClient.cpp │ └── Ethernet_WebSocketClient.h ├── Parsing_SSL-impl.h ├── SSLClient │ ├── SSLClient.h │ ├── SSLClientParameters.cpp │ ├── SSLClientParameters.h │ ├── SSLClient_Impl.h │ ├── SSLSession.h │ ├── TLS12_only_profile.c │ ├── bearssl.h │ ├── bearssl │ │ └── src │ │ │ ├── aead │ │ │ ├── ccm.c │ │ │ ├── eax.c │ │ │ └── gcm.c │ │ │ ├── codec │ │ │ ├── ccopy.c │ │ │ ├── dec16be.c │ │ │ ├── dec16le.c │ │ │ ├── dec32be.c │ │ │ ├── dec32le.c │ │ │ ├── dec64be.c │ │ │ ├── dec64le.c │ │ │ ├── enc16be.c │ │ │ ├── enc16le.c │ │ │ ├── enc32be.c │ │ │ ├── enc32le.c │ │ │ ├── enc64be.c │ │ │ ├── enc64le.c │ │ │ ├── pemdec.c │ │ │ ├── pemdec.t0 │ │ │ └── pemenc.c │ │ │ ├── ec │ │ │ ├── ec_all_m15.c │ │ │ ├── ec_all_m31.c │ │ │ ├── ec_c25519_i15.c │ │ │ ├── ec_c25519_i31.c │ │ │ ├── ec_c25519_m15.c │ │ │ ├── ec_c25519_m31.c │ │ │ ├── ec_c25519_m62.c │ │ │ ├── ec_c25519_m64.c │ │ │ ├── ec_curve25519.c │ │ │ ├── ec_default.c │ │ │ ├── ec_keygen.c │ │ │ ├── ec_p256_m15.c │ │ │ ├── ec_p256_m31.c │ │ │ ├── ec_p256_m62.c │ │ │ ├── ec_p256_m64.c │ │ │ ├── ec_prime_i15.c │ │ │ ├── ec_prime_i31.c │ │ │ ├── ec_pubkey.c │ │ │ ├── ec_secp256r1.c │ │ │ ├── ec_secp384r1.c │ │ │ ├── ec_secp521r1.c │ │ │ ├── ecdsa_atr.c │ │ │ ├── ecdsa_default_sign_asn1.c │ │ │ ├── ecdsa_default_sign_raw.c │ │ │ ├── ecdsa_default_vrfy_asn1.c │ │ │ ├── ecdsa_default_vrfy_raw.c │ │ │ ├── ecdsa_i15_bits.c │ │ │ ├── ecdsa_i15_sign_asn1.c │ │ │ ├── ecdsa_i15_sign_raw.c │ │ │ ├── ecdsa_i15_vrfy_asn1.c │ │ │ ├── ecdsa_i15_vrfy_raw.c │ │ │ ├── ecdsa_i31_bits.c │ │ │ ├── ecdsa_i31_sign_asn1.c │ │ │ ├── ecdsa_i31_sign_raw.c │ │ │ ├── ecdsa_i31_vrfy_asn1.c │ │ │ ├── ecdsa_i31_vrfy_raw.c │ │ │ └── ecdsa_rta.c │ │ │ ├── hash │ │ │ ├── dig_oid.c │ │ │ ├── dig_size.c │ │ │ ├── ghash_ctmul.c │ │ │ ├── ghash_ctmul32.c │ │ │ ├── ghash_ctmul64.c │ │ │ ├── ghash_pclmul.c │ │ │ ├── ghash_pwr8.c │ │ │ ├── md5.c │ │ │ ├── md5sha1.c │ │ │ ├── mgf1.c │ │ │ ├── multihash.c │ │ │ ├── sha1.c │ │ │ ├── sha2big.c │ │ │ └── sha2small.c │ │ │ ├── int │ │ │ ├── i15_add.c │ │ │ ├── i15_bitlen.c │ │ │ ├── i15_decmod.c │ │ │ ├── i15_decode.c │ │ │ ├── i15_decred.c │ │ │ ├── i15_encode.c │ │ │ ├── i15_fmont.c │ │ │ ├── i15_iszero.c │ │ │ ├── i15_moddiv.c │ │ │ ├── i15_modpow.c │ │ │ ├── i15_modpow2.c │ │ │ ├── i15_montmul.c │ │ │ ├── i15_mulacc.c │ │ │ ├── i15_muladd.c │ │ │ ├── i15_ninv15.c │ │ │ ├── i15_reduce.c │ │ │ ├── i15_rshift.c │ │ │ ├── i15_sub.c │ │ │ ├── i15_tmont.c │ │ │ ├── i31_add.c │ │ │ ├── i31_bitlen.c │ │ │ ├── i31_decmod.c │ │ │ ├── i31_decode.c │ │ │ ├── i31_decred.c │ │ │ ├── i31_encode.c │ │ │ ├── i31_fmont.c │ │ │ ├── i31_iszero.c │ │ │ ├── i31_moddiv.c │ │ │ ├── i31_modpow.c │ │ │ ├── i31_modpow2.c │ │ │ ├── i31_montmul.c │ │ │ ├── i31_mulacc.c │ │ │ ├── i31_muladd.c │ │ │ ├── i31_ninv31.c │ │ │ ├── i31_reduce.c │ │ │ ├── i31_rshift.c │ │ │ ├── i31_sub.c │ │ │ ├── i31_tmont.c │ │ │ ├── i32_add.c │ │ │ ├── i32_bitlen.c │ │ │ ├── i32_decmod.c │ │ │ ├── i32_decode.c │ │ │ ├── i32_decred.c │ │ │ ├── i32_div32.c │ │ │ ├── i32_encode.c │ │ │ ├── i32_fmont.c │ │ │ ├── i32_iszero.c │ │ │ ├── i32_modpow.c │ │ │ ├── i32_montmul.c │ │ │ ├── i32_mulacc.c │ │ │ ├── i32_muladd.c │ │ │ ├── i32_ninv32.c │ │ │ ├── i32_reduce.c │ │ │ ├── i32_sub.c │ │ │ ├── i32_tmont.c │ │ │ └── i62_modpow2.c │ │ │ ├── kdf │ │ │ ├── hkdf.c │ │ │ └── shake.c │ │ │ ├── mac │ │ │ ├── hmac.c │ │ │ └── hmac_ct.c │ │ │ ├── rand │ │ │ ├── aesctr_drbg.c │ │ │ ├── hmac_drbg.c │ │ │ └── sysrng.c │ │ │ ├── rsa │ │ │ ├── rsa_default_keygen.c │ │ │ ├── rsa_default_modulus.c │ │ │ ├── rsa_default_oaep_decrypt.c │ │ │ ├── rsa_default_oaep_encrypt.c │ │ │ ├── rsa_default_pkcs1_sign.c │ │ │ ├── rsa_default_pkcs1_vrfy.c │ │ │ ├── rsa_default_priv.c │ │ │ ├── rsa_default_privexp.c │ │ │ ├── rsa_default_pss_sign.c │ │ │ ├── rsa_default_pss_vrfy.c │ │ │ ├── rsa_default_pub.c │ │ │ ├── rsa_default_pubexp.c │ │ │ ├── rsa_i15_keygen.c │ │ │ ├── rsa_i15_modulus.c │ │ │ ├── rsa_i15_oaep_decrypt.c │ │ │ ├── rsa_i15_oaep_encrypt.c │ │ │ ├── rsa_i15_pkcs1_sign.c │ │ │ ├── rsa_i15_pkcs1_vrfy.c │ │ │ ├── rsa_i15_priv.c │ │ │ ├── rsa_i15_privexp.c │ │ │ ├── rsa_i15_pss_sign.c │ │ │ ├── rsa_i15_pss_vrfy.c │ │ │ ├── rsa_i15_pub.c │ │ │ ├── rsa_i15_pubexp.c │ │ │ ├── rsa_i31_keygen.c │ │ │ ├── rsa_i31_keygen_inner.c │ │ │ ├── rsa_i31_modulus.c │ │ │ ├── rsa_i31_oaep_decrypt.c │ │ │ ├── rsa_i31_oaep_encrypt.c │ │ │ ├── rsa_i31_pkcs1_sign.c │ │ │ ├── rsa_i31_pkcs1_vrfy.c │ │ │ ├── rsa_i31_priv.c │ │ │ ├── rsa_i31_privexp.c │ │ │ ├── rsa_i31_pss_sign.c │ │ │ ├── rsa_i31_pss_vrfy.c │ │ │ ├── rsa_i31_pub.c │ │ │ ├── rsa_i31_pubexp.c │ │ │ ├── rsa_i32_oaep_decrypt.c │ │ │ ├── rsa_i32_oaep_encrypt.c │ │ │ ├── rsa_i32_pkcs1_sign.c │ │ │ ├── rsa_i32_pkcs1_vrfy.c │ │ │ ├── rsa_i32_priv.c │ │ │ ├── rsa_i32_pss_sign.c │ │ │ ├── rsa_i32_pss_vrfy.c │ │ │ ├── rsa_i32_pub.c │ │ │ ├── rsa_i62_keygen.c │ │ │ ├── rsa_i62_oaep_decrypt.c │ │ │ ├── rsa_i62_oaep_encrypt.c │ │ │ ├── rsa_i62_pkcs1_sign.c │ │ │ ├── rsa_i62_pkcs1_vrfy.c │ │ │ ├── rsa_i62_priv.c │ │ │ ├── rsa_i62_pss_sign.c │ │ │ ├── rsa_i62_pss_vrfy.c │ │ │ ├── rsa_i62_pub.c │ │ │ ├── rsa_oaep_pad.c │ │ │ ├── rsa_oaep_unpad.c │ │ │ ├── rsa_pkcs1_sig_pad.c │ │ │ ├── rsa_pkcs1_sig_unpad.c │ │ │ ├── rsa_pss_sig_pad.c │ │ │ ├── rsa_pss_sig_unpad.c │ │ │ └── rsa_ssl_decrypt.c │ │ │ ├── settings.c │ │ │ ├── ssl │ │ │ ├── prf.c │ │ │ ├── prf_md5sha1.c │ │ │ ├── prf_sha256.c │ │ │ ├── prf_sha384.c │ │ │ ├── ssl_ccert_single_ec.c │ │ │ ├── ssl_ccert_single_rsa.c │ │ │ ├── ssl_client.c │ │ │ ├── ssl_client_default_rsapub.c │ │ │ ├── ssl_client_full.c │ │ │ ├── ssl_engine.c │ │ │ ├── ssl_engine_default_aescbc.c │ │ │ ├── ssl_engine_default_aesccm.c │ │ │ ├── ssl_engine_default_aesgcm.c │ │ │ ├── ssl_engine_default_chapol.c │ │ │ ├── ssl_engine_default_descbc.c │ │ │ ├── ssl_engine_default_ec.c │ │ │ ├── ssl_engine_default_ecdsa.c │ │ │ ├── ssl_engine_default_rsavrfy.c │ │ │ ├── ssl_hashes.c │ │ │ ├── ssl_hs_client.c │ │ │ ├── ssl_hs_client.t0 │ │ │ ├── ssl_hs_common.t0 │ │ │ ├── ssl_hs_server.c │ │ │ ├── ssl_hs_server.t0 │ │ │ ├── ssl_io.c │ │ │ ├── ssl_keyexport.c │ │ │ ├── ssl_lru.c │ │ │ ├── ssl_rec_cbc.c │ │ │ ├── ssl_rec_ccm.c │ │ │ ├── ssl_rec_chapol.c │ │ │ ├── ssl_rec_gcm.c │ │ │ ├── ssl_scert_single_ec.c │ │ │ ├── ssl_scert_single_rsa.c │ │ │ ├── ssl_server.c │ │ │ ├── ssl_server_full_ec.c │ │ │ ├── ssl_server_full_rsa.c │ │ │ ├── ssl_server_mine2c.c │ │ │ ├── ssl_server_mine2g.c │ │ │ ├── ssl_server_minf2c.c │ │ │ ├── ssl_server_minf2g.c │ │ │ ├── ssl_server_minr2g.c │ │ │ ├── ssl_server_minu2g.c │ │ │ └── ssl_server_minv2g.c │ │ │ ├── symcipher │ │ │ ├── aes_big_cbcdec.c │ │ │ ├── aes_big_cbcenc.c │ │ │ ├── aes_big_ctr.c │ │ │ ├── aes_big_ctrcbc.c │ │ │ ├── aes_big_dec.c │ │ │ ├── aes_big_enc.c │ │ │ ├── aes_common.c │ │ │ ├── aes_ct.c │ │ │ ├── aes_ct64.c │ │ │ ├── aes_ct64_cbcdec.c │ │ │ ├── aes_ct64_cbcenc.c │ │ │ ├── aes_ct64_ctr.c │ │ │ ├── aes_ct64_ctrcbc.c │ │ │ ├── aes_ct64_dec.c │ │ │ ├── aes_ct64_enc.c │ │ │ ├── aes_ct_cbcdec.c │ │ │ ├── aes_ct_cbcenc.c │ │ │ ├── aes_ct_ctr.c │ │ │ ├── aes_ct_ctrcbc.c │ │ │ ├── aes_ct_dec.c │ │ │ ├── aes_ct_enc.c │ │ │ ├── aes_pwr8.c │ │ │ ├── aes_pwr8_cbcdec.c │ │ │ ├── aes_pwr8_cbcenc.c │ │ │ ├── aes_pwr8_ctr.c │ │ │ ├── aes_pwr8_ctrcbc.c │ │ │ ├── aes_small_cbcdec.c │ │ │ ├── aes_small_cbcenc.c │ │ │ ├── aes_small_ctr.c │ │ │ ├── aes_small_ctrcbc.c │ │ │ ├── aes_small_dec.c │ │ │ ├── aes_small_enc.c │ │ │ ├── aes_x86ni.c │ │ │ ├── aes_x86ni_cbcdec.c │ │ │ ├── aes_x86ni_cbcenc.c │ │ │ ├── aes_x86ni_ctr.c │ │ │ ├── aes_x86ni_ctrcbc.c │ │ │ ├── chacha20_ct.c │ │ │ ├── chacha20_sse2.c │ │ │ ├── des_ct.c │ │ │ ├── des_ct_cbcdec.c │ │ │ ├── des_ct_cbcenc.c │ │ │ ├── des_support.c │ │ │ ├── des_tab.c │ │ │ ├── des_tab_cbcdec.c │ │ │ ├── des_tab_cbcenc.c │ │ │ ├── poly1305_ctmul.c │ │ │ ├── poly1305_ctmul32.c │ │ │ ├── poly1305_ctmulq.c │ │ │ └── poly1305_i15.c │ │ │ └── x509 │ │ │ ├── asn1.t0 │ │ │ ├── asn1enc.c │ │ │ ├── encode_ec_pk8der.c │ │ │ ├── encode_ec_rawder.c │ │ │ ├── encode_rsa_pk8der.c │ │ │ ├── encode_rsa_rawder.c │ │ │ ├── skey_decoder.c │ │ │ ├── skey_decoder.t0 │ │ │ ├── x509_decoder.c │ │ │ ├── x509_decoder.t0 │ │ │ ├── x509_knownkey.c │ │ │ ├── x509_minimal.c │ │ │ ├── x509_minimal.t0 │ │ │ └── x509_minimal_full.c │ ├── bearssl_aead.h │ ├── bearssl_block.h │ ├── bearssl_ec.h │ ├── bearssl_hash.h │ ├── bearssl_hmac.h │ ├── bearssl_kdf.h │ ├── bearssl_pem.h │ ├── bearssl_prf.h │ ├── bearssl_rand.h │ ├── bearssl_rsa.h │ ├── bearssl_ssl.h │ ├── bearssl_x509.h │ ├── config.h │ ├── ec_prime_fast_256.c │ ├── inner.h │ └── time_macros.h ├── detail │ ├── Debug.h │ ├── ESP_RequestHandlersImpl.h │ ├── RequestHandler.h │ ├── RequestHandlersImpl.h │ ├── esp_detail │ │ ├── mimetable.cpp │ │ └── mimetable.h │ └── mimetable.h ├── inner.h ├── libb64 │ ├── base64.cpp │ ├── base64.h │ ├── cdecode.c │ ├── cdecode.h │ ├── cencode.c │ └── cencode.h └── time_macros.h ├── tools └── pycert_bearssl │ ├── cert_util.py │ └── pycert_bearssl.py └── utils ├── astyle_library.conf └── restyle.sh /.codespellrc: -------------------------------------------------------------------------------- 1 | # See: https://github.com/codespell-project/codespell#using-a-config-file 2 | [codespell] 3 | # In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: 4 | ignore-words-list = , 5 | check-filenames = 6 | check-hidden = 7 | skip = ./.git,./src,./examples,./Packages_Patches,./LibraryPatches 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### Is your feature request related to a problem? Please describe. 11 | 12 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 13 | 14 | ### Describe the solution you'd like 15 | 16 | A clear and concise description of what you want to happen. 17 | 18 | ### Describe alternatives you've considered 19 | 20 | A clear and concise description of any alternative solutions or features you've considered. 21 | 22 | ### Additional context 23 | 24 | Add any other context or screenshots about the feature request here. 25 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # See: https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#about-the-dependabotyml-file 2 | version: 2 3 | 4 | updates: 5 | # Configure check for outdated GitHub Actions actions in workflows. 6 | # See: https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-dependabot 7 | - package-ecosystem: github-actions 8 | directory: / # Check the repository's workflows under /.github/workflows/ 9 | schedule: 10 | interval: daily 11 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-stale - https://github.com/probot/stale 2 | 3 | daysUntilStale: 60 4 | daysUntilClose: 14 5 | limitPerRun: 30 6 | staleLabel: stale 7 | exemptLabels: 8 | - pinned 9 | - security 10 | - "to be implemented" 11 | - "for reference" 12 | - "move to PR" 13 | - "enhancement" 14 | 15 | only: issues 16 | onlyLabels: [] 17 | exemptProjects: false 18 | exemptMilestones: false 19 | exemptAssignees: false 20 | 21 | markComment: > 22 | [STALE_SET] This issue has been automatically marked as stale because it has not had 23 | recent activity. It will be closed in 14 days if no further activity occurs. Thank you 24 | for your contributions. 25 | 26 | unmarkComment: > 27 | [STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it opening the future. 28 | 29 | closeComment: > 30 | [STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions. 31 | 32 | -------------------------------------------------------------------------------- /.github/workflows/auto-github-actions.yml: -------------------------------------------------------------------------------- 1 | name: auto-github-actions 2 | on: [push] 3 | jobs: 4 | check-bats-version: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v3 8 | - uses: actions/setup-node@v3 9 | with: 10 | node-version: '14' 11 | - run: npm install -g bats 12 | - run: bats -v 13 | -------------------------------------------------------------------------------- /.github/workflows/report-size-deltas.yml: -------------------------------------------------------------------------------- 1 | name: Report Size Deltas 2 | 3 | on: 4 | schedule: 5 | - cron: '*/5 * * * *' 6 | 7 | jobs: 8 | report: 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - name: Comment size deltas reports to PRs 13 | uses: arduino/report-size-deltas@v1 14 | with: 15 | # The name of the workflow artifact created by the "Compile Examples" workflow 16 | sketches-reports-source: sketches-reports 17 | -------------------------------------------------------------------------------- /.github/workflows/spell-check.yml: -------------------------------------------------------------------------------- 1 | name: Spell Check 2 | 3 | on: 4 | pull_request: 5 | push: 6 | schedule: 7 | # run every Tuesday at 3 AM UTC 8 | - cron: "0 3 * * 2" 9 | workflow_dispatch: 10 | repository_dispatch: 11 | 12 | jobs: 13 | spellcheck: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v3 19 | 20 | # See: https://github.com/codespell-project/actions-codespell/blob/master/README.md 21 | - name: Spell check 22 | uses: codespell-project/actions-codespell@master 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | -------------------------------------------------------------------------------- /LibraryPatches/esp32/cores/esp32/Server.h: -------------------------------------------------------------------------------- 1 | /* 2 | Server.h - Base class that provides Server 3 | Copyright (c) 2011 Adrian McEwen. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef server_h 21 | #define server_h 22 | 23 | #include "Print.h" 24 | 25 | class Server: public Print 26 | { 27 | public: 28 | // KH, change to fix compiler error for EthernetWebServer 29 | // error: cannot declare field 'EthernetWebServer::_server' to be of abstract type 'EthernetServer' 30 | // virtual void begin(uint16_t port=0) =0; 31 | //virtual void begin() = 0; 32 | void begin() {}; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/0.19.0/variants/NINA_B112_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/0.19.0/variants/NINA_B302_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/0.20.1/variants/NINA_B112_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/0.20.1/variants/NINA_B302_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/0.20.5/variants/NINA_B112_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/0.20.5/variants/NINA_B302_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/0.21.0/variants/NINA_B112_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/0.21.0/variants/NINA_B302_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/0.22.0/variants/NINA_B112_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/0.22.0/variants/NINA_B302_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/0.22.1/variants/NINA_B112_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/0.22.1/variants/NINA_B302_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/0.23.0/variants/NINA_B112_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/0.23.0/variants/NINA_B302_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/0.24.0/variants/NINA_B112_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/0.24.0/variants/NINA_B302_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B112_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B302_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/sparkfun_nrf52840_mini/variant.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | Copyright (c) 2016 Sandeep Mistry All right reserved. 4 | Copyright (c) 2018, Adafruit Industries (adafruit.com) 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | See the GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "variant.h" 22 | #include "wiring_constants.h" 23 | #include "wiring_digital.h" 24 | #include "nrf.h" 25 | 26 | const uint32_t g_ADigitalPinMap[] = 27 | { 28 | // P0 29 | 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 30 | 8 , 9 , 10, 11, 12, 13, 14, 15, 31 | 16, 17, 18, 19, 20, 21, 22, 23, 32 | 24, 25, 26, 27, 28, 29, 30, 31, 33 | 34 | // P1 35 | 32, 33, 34, 35, 36, 37, 38, 39, 36 | 40, 41, 42, 43, 44, 45, 46, 47, 37 | 48, 49, 50, 51, 52, 53, 54, 55, 38 | 56, 57, 58, 59, 60, 61, 62, 63 39 | }; 40 | void initVariant() 41 | { 42 | // LED1 & LED2 43 | pinMode(PIN_LED1, OUTPUT); 44 | ledOff(PIN_LED1); 45 | 46 | pinMode(PIN_LED2, OUTPUT); 47 | ledOff(PIN_LED2); 48 | } 49 | 50 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B112_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/NINA_B302_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/1.1.0/variants/sparkfun_nrf52840_mini/variant.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | Copyright (c) 2016 Sandeep Mistry All right reserved. 4 | Copyright (c) 2018, Adafruit Industries (adafruit.com) 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | See the GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "variant.h" 22 | #include "wiring_constants.h" 23 | #include "wiring_digital.h" 24 | #include "nrf.h" 25 | 26 | const uint32_t g_ADigitalPinMap[] = 27 | { 28 | // P0 29 | 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 30 | 8 , 9 , 10, 11, 12, 13, 14, 15, 31 | 16, 17, 18, 19, 20, 21, 22, 23, 32 | 24, 25, 26, 27, 28, 29, 30, 31, 33 | 34 | // P1 35 | 32, 33, 34, 35, 36, 37, 38, 39, 36 | 40, 41, 42, 43, 44, 45, 46, 47, 37 | 48, 49, 50, 51, 52, 53, 54, 55, 38 | 56, 57, 58, 59, 60, 61, 62, 63 39 | }; 40 | void initVariant() 41 | { 42 | // LED1 & LED2 43 | pinMode(PIN_LED1, OUTPUT); 44 | ledOff(PIN_LED1); 45 | 46 | pinMode(PIN_LED2, OUTPUT); 47 | ledOff(PIN_LED2); 48 | } 49 | 50 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B112_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/NINA_B302_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/1.2.0/variants/sparkfun_nrf52840_mini/variant.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | Copyright (c) 2016 Sandeep Mistry All right reserved. 4 | Copyright (c) 2018, Adafruit Industries (adafruit.com) 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | See the GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "variant.h" 22 | #include "wiring_constants.h" 23 | #include "wiring_digital.h" 24 | #include "nrf.h" 25 | 26 | const uint32_t g_ADigitalPinMap[] = 27 | { 28 | // P0 29 | 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 30 | 8 , 9 , 10, 11, 12, 13, 14, 15, 31 | 16, 17, 18, 19, 20, 21, 22, 23, 32 | 24, 25, 26, 27, 28, 29, 30, 31, 33 | 34 | // P1 35 | 32, 33, 34, 35, 36, 37, 38, 39, 36 | 40, 41, 42, 43, 44, 45, 46, 47, 37 | 48, 49, 50, 51, 52, 53, 54, 55, 38 | 56, 57, 58, 59, 60, 61, 62, 63 39 | }; 40 | void initVariant() 41 | { 42 | // LED1 & LED2 43 | pinMode(PIN_LED1, OUTPUT); 44 | ledOff(PIN_LED1); 45 | 46 | pinMode(PIN_LED2, OUTPUT); 47 | ledOff(PIN_LED2); 48 | } 49 | 50 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B112_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/NINA_B302_ublox/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | */ 15 | 16 | // API compatibility 17 | #include "variant.h" 18 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/nrf52/1.3.0/variants/sparkfun_nrf52840_mini/variant.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. All right reserved. 3 | Copyright (c) 2016 Sandeep Mistry All right reserved. 4 | Copyright (c) 2018, Adafruit Industries (adafruit.com) 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | See the GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "variant.h" 22 | #include "wiring_constants.h" 23 | #include "wiring_digital.h" 24 | #include "nrf.h" 25 | 26 | const uint32_t g_ADigitalPinMap[] = 27 | { 28 | // P0 29 | 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 30 | 8 , 9 , 10, 11, 12, 13, 14, 15, 31 | 16, 17, 18, 19, 20, 21, 22, 23, 32 | 24, 25, 26, 27, 28, 29, 30, 31, 33 | 34 | // P1 35 | 32, 33, 34, 35, 36, 37, 38, 39, 36 | 40, 41, 42, 43, 44, 45, 46, 47, 37 | 48, 49, 50, 51, 52, 53, 54, 55, 38 | 56, 57, 58, 59, 60, 61, 62, 63 39 | }; 40 | void initVariant() 41 | { 42 | // LED1 & LED2 43 | pinMode(PIN_LED1, OUTPUT); 44 | ledOff(PIN_LED1); 45 | 46 | pinMode(PIN_LED2, OUTPUT); 47 | ledOff(PIN_LED2); 48 | } 49 | 50 | -------------------------------------------------------------------------------- /Packages_Patches/arduino/hardware/mbed_portenta/2.4.1/portenta_post_install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | portenta_h7_rules () { 4 | echo "" 5 | echo "# Portenta H7 bootloader mode UDEV rules" 6 | echo "" 7 | cat < /etc/udev/rules.d/49-portenta_h7.rules 18 | 19 | # reload udev rules 20 | echo "Reload rules..." 21 | udevadm trigger 22 | udevadm control --reload-rules 23 | -------------------------------------------------------------------------------- /Packages_Patches/arduino/hardware/mbed_portenta/2.5.2/portenta_post_install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | portenta_h7_rules () { 4 | echo "" 5 | echo "# Portenta H7 bootloader mode UDEV rules" 6 | echo "" 7 | cat < /etc/udev/rules.d/49-portenta_h7.rules 18 | 19 | # reload udev rules 20 | echo "Reload rules..." 21 | udevadm trigger 22 | udevadm control --reload-rules 23 | -------------------------------------------------------------------------------- /Packages_Patches/arduino/hardware/mbed_portenta/2.6.1/portenta_post_install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | portenta_h7_rules () { 4 | echo "" 5 | echo "# Portenta H7 bootloader mode UDEV rules" 6 | echo "" 7 | cat < /etc/udev/rules.d/49-portenta_h7.rules 18 | 19 | # reload udev rules 20 | echo "Reload rules..." 21 | udevadm trigger 22 | udevadm control --reload-rules 23 | -------------------------------------------------------------------------------- /Packages_Patches/arduino/hardware/mbed_portenta/2.7.2/portenta_post_install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | portenta_h7_rules () { 4 | echo "" 5 | echo "# Portenta H7 bootloader mode UDEV rules" 6 | echo "" 7 | cat < /etc/udev/rules.d/49-portenta_h7.rules 18 | 19 | # reload udev rules 20 | echo "Reload rules..." 21 | udevadm trigger 22 | udevadm control --reload-rules 23 | -------------------------------------------------------------------------------- /Packages_Patches/arduino/hardware/mbed_portenta/2.8.0/portenta_post_install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | portenta_h7_rules () { 4 | echo "" 5 | echo "# Portenta H7 bootloader mode UDEV rules" 6 | echo "" 7 | cat < /etc/udev/rules.d/49-portenta_h7.rules 18 | 19 | # reload udev rules 20 | echo "Reload rules..." 21 | udevadm trigger 22 | udevadm control --reload-rules 23 | -------------------------------------------------------------------------------- /Packages_Patches/arduino/hardware/mbed_portenta/3.0.0/portenta_post_install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | portenta_h7_rules () { 4 | echo "" 5 | echo "# Portenta H7 bootloader mode UDEV rules" 6 | echo "" 7 | cat < /etc/udev/rules.d/49-portenta_h7.rules 18 | 19 | # reload udev rules 20 | echo "Reload rules..." 21 | udevadm trigger 22 | udevadm control --reload-rules 23 | -------------------------------------------------------------------------------- /Packages_Patches/arduino/hardware/mbed_portenta/3.0.1/portenta_post_install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | portenta_h7_rules () { 4 | echo "" 5 | echo "# Portenta H7 bootloader mode UDEV rules" 6 | echo "" 7 | cat < /etc/udev/rules.d/49-portenta_h7.rules 18 | 19 | # reload udev rules 20 | echo "Reload rules..." 21 | udevadm trigger 22 | udevadm control --reload-rules 23 | -------------------------------------------------------------------------------- /Packages_Patches/arduino/hardware/mbed_portenta/3.1.1/portenta_post_install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | portenta_h7_rules () { 4 | echo "" 5 | echo "# Portenta H7 bootloader mode UDEV rules" 6 | echo "" 7 | cat < /etc/udev/rules.d/49-portenta_h7.rules 18 | 19 | # reload udev rules 20 | echo "Reload rules..." 21 | udevadm trigger 22 | udevadm control --reload-rules 23 | -------------------------------------------------------------------------------- /Packages_Patches/arduino/hardware/mbed_portenta/3.3.0/portenta_post_install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | portenta_h7_rules () { 4 | echo "" 5 | echo "# Portenta H7 bootloader mode UDEV rules" 6 | echo "" 7 | cat < /etc/udev/rules.d/49-portenta_h7.rules 18 | 19 | # reload udev rules 20 | echo "Reload rules..." 21 | udevadm trigger 22 | udevadm control --reload-rules 23 | -------------------------------------------------------------------------------- /Packages_Patches/arduino/hardware/mbed_portenta/3.4.1/portenta_post_install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | portenta_h7_rules () { 4 | echo "" 5 | echo "# Portenta H7 bootloader mode UDEV rules" 6 | echo "" 7 | cat < /etc/udev/rules.d/49-portenta_h7.rules 18 | 19 | # reload udev rules 20 | echo "Reload rules..." 21 | udevadm trigger 22 | udevadm control --reload-rules 23 | -------------------------------------------------------------------------------- /examples/HTTPClient/node_test_server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node_test_server", 3 | "version": "0.0.1", 4 | "author": { 5 | "name": "Tom Igoe" 6 | }, 7 | "dependencies": { 8 | "body-parser": ">=1.11.0", 9 | "express": ">=4.0.0", 10 | "multer": "*", 11 | "ws": ">=5.2.3" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /examples/multiFileProject/multiFileProject.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | multiFileProject.cpp 3 | EthernetWebServer_SSL is a library for the Ethernet shields to run WebServer and Client with/without SSL 4 | 5 | Use SSLClient Library code from https://github.com/OPEnSLab-OSU/SSLClient 6 | 7 | Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer_SSL 8 | *****************************************************************************************************************************/ 9 | 10 | // To demo how to include files in multi-file Projects 11 | 12 | #include "multiFileProject.h" 13 | -------------------------------------------------------------------------------- /examples/multiFileProject/multiFileProject.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | multiFileProject.h 3 | EthernetWebServer_SSL is a library for the Ethernet shields to run WebServer and Client with/without SSL 4 | 5 | Use SSLClient Library code from https://github.com/OPEnSLab-OSU/SSLClient 6 | 7 | Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer_SSL 8 | *****************************************************************************************************************************/ 9 | 10 | // To demo how to include files in multi-file Projects 11 | 12 | #pragma once 13 | 14 | #define _ETHERNET_WEBSERVER_LOGLEVEL_ 1 15 | 16 | // Can be included as many times as necessary, without `Multiple Definitions` Linker Error 17 | #include // https://github.com/khoih-prog/EthernetWebServer_SSL 18 | 19 | #include // https://github.com/khoih-prog/EthernetWebServer_SSL 20 | -------------------------------------------------------------------------------- /examples/multiFileProject/multiFileProject.ino: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | multiFileProject.ino 3 | EthernetWebServer_SSL is a library for the Ethernet shields to run WebServer and Client with/without SSL 4 | 5 | Use SSLClient Library code from https://github.com/OPEnSLab-OSU/SSLClient 6 | 7 | Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer_SSL 8 | *****************************************************************************************************************************/ 9 | 10 | // To demo how to include files in multi-file Projects 11 | 12 | #define ETHERNET_WEBSERVER_SSL_VERSION_MIN_TARGET "EthernetWebServer_SSL v1.9.3" 13 | #define ETHERNET_WEBSERVER_SSL_VERSION_MIN 1009003 14 | 15 | #include "multiFileProject.h" 16 | 17 | // To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error 18 | #include // https://github.com/khoih-prog/EthernetWebServer_SSL 19 | 20 | void setup() 21 | { 22 | Serial.begin(115200); 23 | 24 | while (!Serial); 25 | 26 | delay(500); 27 | 28 | Serial.println("\nStart multiFileProject"); 29 | Serial.println(ETHERNET_WEBSERVER_SSL_VERSION); 30 | 31 | #if defined(ETHERNET_WEBSERVER_SSL_VERSION_MIN) 32 | 33 | if (ETHERNET_WEBSERVER_SSL_VERSION_INT < ETHERNET_WEBSERVER_SSL_VERSION_MIN) 34 | { 35 | Serial.print("Warning. Must use this example on Version equal or later than : "); 36 | Serial.println(ETHERNET_WEBSERVER_SSL_VERSION_MIN_TARGET); 37 | } 38 | 39 | #endif 40 | 41 | Serial.print("You're OK now"); 42 | } 43 | 44 | void loop() 45 | { 46 | // put your main code here, to run repeatedly: 47 | } 48 | -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=EthernetWebServer_SSL 2 | version=1.10.0 3 | author=Khoi Hoang 4 | license=GPLv3 5 | maintainer=Khoi Hoang 6 | sentence=Simple TLS/SSL Ethernet WebServer, HTTP Client and WebSocket Client library for for AVR, Portenta_H7, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52 and RASPBERRY_PI_PICO boards using Ethernet shields W5100, W5200, W5500, ENC28J60 or Teensy 4.1 NativeEthernet/QNEthernet. It now supports Ethernet TLS/SSL Client. 7 | paragraph=The WebServer supports HTTP/HTTPS GET and POST requests, provides argument parsing, handles one client at a time. It now provides HTTP Client and WebSocket Client. It supports Arduino boards (SAM DUE, Atmel SAM3X8E ARM Cortex-M3, SAMD21, SAMD51, ESP8266, ESP32, Adafruit nRF52, Teensy and RASPBERRY_PI_PICO boards) using Wiznet W5x00, ENC28J60 network shields or Teensy 4.1 built-in NativeEthernet/QNEthernet. Ethernet_Generic library is used as default for W5x00 with custom SPI 8 | category=Communication 9 | url=https://github.com/khoih-prog/EthernetWebServer_SSL 10 | architectures=* 11 | depends=Functional-Vlpp, Ethernet_Generic 12 | includes=EthernetWebServer_SSL.h, EthernetWebServer_SSL.hpp, EthernetHttpClient_SSL.h 13 | -------------------------------------------------------------------------------- /pics/AdvancedWebServer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/EthernetWebServer_SSL/6b0b412c940d35b122748d78df6de74dbf8e7398/pics/AdvancedWebServer.png -------------------------------------------------------------------------------- /pics/AdvancedWebServer_ESP32_SPI2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/EthernetWebServer_SSL/6b0b412c940d35b122748d78df6de74dbf8e7398/pics/AdvancedWebServer_ESP32_SPI2.png -------------------------------------------------------------------------------- /pics/AdvancedWebServer_Mbed_RPi_Pico.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/EthernetWebServer_SSL/6b0b412c940d35b122748d78df6de74dbf8e7398/pics/AdvancedWebServer_Mbed_RPi_Pico.png -------------------------------------------------------------------------------- /pics/AdvancedWebServer_Mbed_RPi_Pico_SPI1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/EthernetWebServer_SSL/6b0b412c940d35b122748d78df6de74dbf8e7398/pics/AdvancedWebServer_Mbed_RPi_Pico_SPI1.png -------------------------------------------------------------------------------- /pics/AdvancedWebServer_PortentaH7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/EthernetWebServer_SSL/6b0b412c940d35b122748d78df6de74dbf8e7398/pics/AdvancedWebServer_PortentaH7.png -------------------------------------------------------------------------------- /pics/AdvancedWebServer_QNEthernet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/EthernetWebServer_SSL/6b0b412c940d35b122748d78df6de74dbf8e7398/pics/AdvancedWebServer_QNEthernet.png -------------------------------------------------------------------------------- /pics/AdvancedWebServer_RPi_Pico.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/EthernetWebServer_SSL/6b0b412c940d35b122748d78df6de74dbf8e7398/pics/AdvancedWebServer_RPi_Pico.png -------------------------------------------------------------------------------- /pics/AdvancedWebServer_RPi_Pico_SPI1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/EthernetWebServer_SSL/6b0b412c940d35b122748d78df6de74dbf8e7398/pics/AdvancedWebServer_RPi_Pico_SPI1.png -------------------------------------------------------------------------------- /pics/AdvancedWebServer_Teensy41_SPI1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/EthernetWebServer_SSL/6b0b412c940d35b122748d78df6de74dbf8e7398/pics/AdvancedWebServer_Teensy41_SPI1.png -------------------------------------------------------------------------------- /pics/Teensy41_pinout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/EthernetWebServer_SSL/6b0b412c940d35b122748d78df6de74dbf8e7398/pics/Teensy41_pinout.png -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/codec/ccopy.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_ccopy(uint32_t ctl, void *dst, const void *src, size_t len) 30 | { 31 | unsigned char *d; 32 | const unsigned char *s; 33 | 34 | d = dst; 35 | s = src; 36 | 37 | while (len -- > 0) 38 | { 39 | uint32_t x, y; 40 | 41 | x = *s ++; 42 | y = *d; 43 | *d = MUX(ctl, x, y); 44 | d ++; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/codec/dec16be.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_range_dec16be(uint16_t *v, size_t num, const void *src) 30 | { 31 | const unsigned char *buf; 32 | 33 | buf = src; 34 | 35 | while (num -- > 0) 36 | { 37 | *v ++ = br_dec16be(buf); 38 | buf += 2; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/codec/dec16le.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_range_dec16le(uint16_t *v, size_t num, const void *src) 30 | { 31 | const unsigned char *buf; 32 | 33 | buf = src; 34 | 35 | while (num -- > 0) 36 | { 37 | *v ++ = br_dec16le(buf); 38 | buf += 2; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/codec/dec32be.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_range_dec32be(uint32_t *v, size_t num, const void *src) 30 | { 31 | const unsigned char *buf; 32 | 33 | buf = src; 34 | 35 | while (num -- > 0) 36 | { 37 | *v ++ = br_dec32be(buf); 38 | buf += 4; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/codec/dec32le.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_range_dec32le(uint32_t *v, size_t num, const void *src) 30 | { 31 | const unsigned char *buf; 32 | 33 | buf = src; 34 | 35 | while (num -- > 0) 36 | { 37 | *v ++ = br_dec32le(buf); 38 | buf += 4; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/codec/dec64be.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_range_dec64be(uint64_t *v, size_t num, const void *src) 30 | { 31 | const unsigned char *buf; 32 | 33 | buf = src; 34 | 35 | while (num -- > 0) 36 | { 37 | *v ++ = br_dec64be(buf); 38 | buf += 8; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/codec/dec64le.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_range_dec64le(uint64_t *v, size_t num, const void *src) 30 | { 31 | const unsigned char *buf; 32 | 33 | buf = src; 34 | 35 | while (num -- > 0) 36 | { 37 | *v ++ = br_dec64le(buf); 38 | buf += 8; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/codec/enc16be.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_range_enc16be(void *dst, const uint16_t *v, size_t num) 30 | { 31 | unsigned char *buf; 32 | 33 | buf = dst; 34 | 35 | while (num -- > 0) 36 | { 37 | br_enc16be(buf, *v ++); 38 | buf += 2; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/codec/enc16le.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_range_enc16le(void *dst, const uint16_t *v, size_t num) 30 | { 31 | unsigned char *buf; 32 | 33 | buf = dst; 34 | 35 | while (num -- > 0) 36 | { 37 | br_enc16le(buf, *v ++); 38 | buf += 2; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/codec/enc32be.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_range_enc32be(void *dst, const uint32_t *v, size_t num) 30 | { 31 | unsigned char *buf; 32 | 33 | buf = dst; 34 | 35 | while (num -- > 0) 36 | { 37 | br_enc32be(buf, *v ++); 38 | buf += 4; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/codec/enc32le.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_range_enc32le(void *dst, const uint32_t *v, size_t num) 30 | { 31 | unsigned char *buf; 32 | 33 | buf = dst; 34 | 35 | while (num -- > 0) 36 | { 37 | br_enc32le(buf, *v ++); 38 | buf += 4; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/codec/enc64be.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_range_enc64be(void *dst, const uint64_t *v, size_t num) 30 | { 31 | unsigned char *buf; 32 | 33 | buf = dst; 34 | 35 | while (num -- > 0) 36 | { 37 | br_enc64be(buf, *v ++); 38 | buf += 8; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/codec/enc64le.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_range_enc64le(void *dst, const uint64_t *v, size_t num) 30 | { 31 | unsigned char *buf; 32 | 33 | buf = dst; 34 | 35 | while (num -- > 0) 36 | { 37 | br_enc64le(buf, *v ++); 38 | buf += 8; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ec/ec_curve25519.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | static const unsigned char GEN[] = 28 | { 29 | 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 30 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 31 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 32 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 33 | }; 34 | 35 | static const unsigned char ORDER[] = 36 | { 37 | 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 38 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 39 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 40 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF 41 | }; 42 | 43 | /* see inner.h */ 44 | const br_ec_curve_def br_curve25519 = 45 | { 46 | BR_EC_curve25519, 47 | ORDER, sizeof ORDER, 48 | GEN, sizeof GEN 49 | }; 50 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ec/ec_default.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_ec.h */ 28 | const br_ec_impl * 29 | br_ec_get_default(void) 30 | { 31 | #if BR_LOMUL 32 | return &br_ec_all_m15; 33 | #else 34 | return &br_ec_all_m31; 35 | #endif 36 | } 37 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ec/ecdsa_default_sign_asn1.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_ec.h */ 28 | br_ecdsa_sign 29 | br_ecdsa_sign_asn1_get_default(void) 30 | { 31 | #if BR_LOMUL 32 | return &br_ecdsa_i15_sign_asn1; 33 | #else 34 | return &br_ecdsa_i31_sign_asn1; 35 | #endif 36 | } 37 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ec/ecdsa_default_sign_raw.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_ec.h */ 28 | br_ecdsa_sign 29 | br_ecdsa_sign_raw_get_default(void) 30 | { 31 | #if BR_LOMUL 32 | return &br_ecdsa_i15_sign_raw; 33 | #else 34 | return &br_ecdsa_i31_sign_raw; 35 | #endif 36 | } 37 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ec/ecdsa_default_vrfy_asn1.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_ec.h */ 28 | br_ecdsa_vrfy 29 | br_ecdsa_vrfy_asn1_get_default(void) 30 | { 31 | #if BR_LOMUL 32 | return &br_ecdsa_i15_vrfy_asn1; 33 | #else 34 | return &br_ecdsa_i31_vrfy_asn1; 35 | #endif 36 | } 37 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ec/ecdsa_default_vrfy_raw.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_ec.h */ 28 | br_ecdsa_vrfy 29 | br_ecdsa_vrfy_raw_get_default(void) 30 | { 31 | #if BR_LOMUL 32 | return &br_ecdsa_i15_vrfy_raw; 33 | #else 34 | return &br_ecdsa_i31_vrfy_raw; 35 | #endif 36 | } 37 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ec/ecdsa_i15_bits.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_ecdsa_i15_bits2int(uint16_t *x, 30 | const void *src, size_t len, uint32_t ebitlen) 31 | { 32 | uint32_t bitlen, hbitlen; 33 | int sc; 34 | 35 | bitlen = ebitlen - (ebitlen >> 4); 36 | hbitlen = (uint32_t)len << 3; 37 | 38 | if (hbitlen > bitlen) 39 | { 40 | len = (bitlen + 7) >> 3; 41 | sc = (int)((hbitlen - bitlen) & 7); 42 | } 43 | else 44 | { 45 | sc = 0; 46 | } 47 | 48 | br_i15_zero(x, ebitlen); 49 | br_i15_decode(x, src, len); 50 | br_i15_rshift(x, sc); 51 | x[0] = ebitlen; 52 | } 53 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ec/ecdsa_i15_sign_asn1.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | #define ORDER_LEN ((BR_MAX_EC_SIZE + 7) >> 3) 28 | 29 | /* see bearssl_ec.h */ 30 | size_t 31 | br_ecdsa_i15_sign_asn1(const br_ec_impl *impl, 32 | const br_hash_class *hf, const void *hash_value, 33 | const br_ec_private_key *sk, void *sig) 34 | { 35 | unsigned char rsig[(ORDER_LEN << 1) + 12]; 36 | size_t sig_len; 37 | 38 | sig_len = br_ecdsa_i15_sign_raw(impl, hf, hash_value, sk, rsig); 39 | 40 | if (sig_len == 0) 41 | { 42 | return 0; 43 | } 44 | 45 | sig_len = br_ecdsa_raw_to_asn1(rsig, sig_len); 46 | memcpy(sig, rsig, sig_len); 47 | return sig_len; 48 | } 49 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ec/ecdsa_i31_bits.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_ecdsa_i31_bits2int(uint32_t *x, 30 | const void *src, size_t len, uint32_t ebitlen) 31 | { 32 | uint32_t bitlen, hbitlen; 33 | int sc; 34 | 35 | bitlen = ebitlen - (ebitlen >> 5); 36 | hbitlen = (uint32_t)len << 3; 37 | 38 | if (hbitlen > bitlen) 39 | { 40 | len = (bitlen + 7) >> 3; 41 | sc = (int)((hbitlen - bitlen) & 7); 42 | } 43 | else 44 | { 45 | sc = 0; 46 | } 47 | 48 | br_i31_zero(x, ebitlen); 49 | br_i31_decode(x, src, len); 50 | br_i31_rshift(x, sc); 51 | x[0] = ebitlen; 52 | } 53 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ec/ecdsa_i31_sign_asn1.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | #define ORDER_LEN ((BR_MAX_EC_SIZE + 7) >> 3) 28 | 29 | /* see bearssl_ec.h */ 30 | size_t 31 | br_ecdsa_i31_sign_asn1(const br_ec_impl *impl, 32 | const br_hash_class *hf, const void *hash_value, 33 | const br_ec_private_key *sk, void *sig) 34 | { 35 | unsigned char rsig[(ORDER_LEN << 1) + 12]; 36 | size_t sig_len; 37 | 38 | sig_len = br_ecdsa_i31_sign_raw(impl, hf, hash_value, sk, rsig); 39 | 40 | if (sig_len == 0) 41 | { 42 | return 0; 43 | } 44 | 45 | sig_len = br_ecdsa_raw_to_asn1(rsig, sig_len); 46 | memcpy(sig, rsig, sig_len); 47 | return sig_len; 48 | } 49 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/hash/dig_size.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | size_t 29 | br_digest_size_by_ID(int digest_id) 30 | { 31 | switch (digest_id) 32 | { 33 | case br_md5sha1_ID: 34 | return br_md5_SIZE + br_sha1_SIZE; 35 | 36 | case br_md5_ID: 37 | return br_md5_SIZE; 38 | 39 | case br_sha1_ID: 40 | return br_sha1_SIZE; 41 | 42 | case br_sha224_ID: 43 | return br_sha224_SIZE; 44 | 45 | case br_sha256_ID: 46 | return br_sha256_SIZE; 47 | 48 | case br_sha384_ID: 49 | return br_sha384_SIZE; 50 | 51 | case br_sha512_ID: 52 | return br_sha512_SIZE; 53 | 54 | default: 55 | /* abort(); */ 56 | return 0; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i15_add.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | uint32_t 29 | br_i15_add(uint16_t *a, const uint16_t *b, uint32_t ctl) 30 | { 31 | uint32_t cc; 32 | size_t u, m; 33 | 34 | cc = 0; 35 | m = (a[0] + 31) >> 4; 36 | 37 | for (u = 1; u < m; u ++) 38 | { 39 | uint32_t aw, bw, naw; 40 | 41 | aw = a[u]; 42 | bw = b[u]; 43 | naw = aw + bw + cc; 44 | cc = naw >> 15; 45 | a[u] = MUX(ctl, naw & 0x7FFF, aw); 46 | } 47 | 48 | return cc; 49 | } 50 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i15_bitlen.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | uint32_t 29 | br_i15_bit_length(uint16_t *x, size_t xlen) 30 | { 31 | uint32_t tw, twk; 32 | 33 | tw = 0; 34 | twk = 0; 35 | 36 | while (xlen -- > 0) 37 | { 38 | uint32_t w, c; 39 | 40 | c = EQ(tw, 0); 41 | w = x[xlen]; 42 | tw = MUX(c, w, tw); 43 | twk = MUX(c, (uint32_t)xlen, twk); 44 | } 45 | 46 | return (twk << 4) + BIT_LENGTH(tw); 47 | } 48 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i15_decode.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_i15_decode(uint16_t *x, const void *src, size_t len) 30 | { 31 | const unsigned char *buf; 32 | size_t v; 33 | uint32_t acc; 34 | int acc_len; 35 | 36 | buf = src; 37 | v = 1; 38 | acc = 0; 39 | acc_len = 0; 40 | 41 | while (len -- > 0) 42 | { 43 | uint32_t b; 44 | 45 | b = buf[len]; 46 | acc |= (b << acc_len); 47 | acc_len += 8; 48 | 49 | if (acc_len >= 15) 50 | { 51 | x[v ++] = acc & 0x7FFF; 52 | acc_len -= 15; 53 | acc >>= 15; 54 | } 55 | } 56 | 57 | if (acc_len != 0) 58 | { 59 | x[v ++] = acc; 60 | } 61 | 62 | x[0] = br_i15_bit_length(x + 1, v - 1); 63 | } 64 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i15_encode.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_i15_encode(void *dst, size_t len, const uint16_t *x) 30 | { 31 | unsigned char *buf; 32 | size_t u, xlen; 33 | uint32_t acc; 34 | int acc_len; 35 | 36 | xlen = (x[0] + 15) >> 4; 37 | 38 | if (xlen == 0) 39 | { 40 | memset(dst, 0, len); 41 | return; 42 | } 43 | 44 | u = 1; 45 | acc = 0; 46 | acc_len = 0; 47 | buf = dst; 48 | 49 | while (len -- > 0) 50 | { 51 | if (acc_len < 8) 52 | { 53 | if (u <= xlen) 54 | { 55 | acc += (uint32_t)x[u ++] << acc_len; 56 | } 57 | 58 | acc_len += 15; 59 | } 60 | 61 | buf[len] = (unsigned char)acc; 62 | acc >>= 8; 63 | acc_len -= 8; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i15_iszero.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | uint32_t 29 | br_i15_iszero(const uint16_t *x) 30 | { 31 | uint32_t z; 32 | size_t u; 33 | 34 | z = 0; 35 | 36 | for (u = (x[0] + 15) >> 4; u > 0; u --) 37 | { 38 | z |= x[u]; 39 | } 40 | 41 | return ~(z | -z) >> 31; 42 | } 43 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i15_modpow.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_i15_modpow(uint16_t *x, 30 | const unsigned char *e, size_t elen, 31 | const uint16_t *m, uint16_t m0i, uint16_t *t1, uint16_t *t2) 32 | { 33 | size_t mlen; 34 | unsigned k; 35 | 36 | mlen = ((m[0] + 31) >> 4) * sizeof m[0]; 37 | memcpy(t1, x, mlen); 38 | br_i15_to_monty(t1, m); 39 | br_i15_zero(x, m[0]); 40 | x[1] = 1; 41 | 42 | for (k = 0; k < ((unsigned)elen << 3); k ++) 43 | { 44 | uint32_t ctl; 45 | 46 | ctl = (e[elen - 1 - (k >> 3)] >> (k & 7)) & 1; 47 | br_i15_montymul(t2, x, t1, m, m0i); 48 | CCOPY(ctl, x, t2, mlen); 49 | br_i15_montymul(t2, t1, t1, m, m0i); 50 | memcpy(t1, t2, mlen); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i15_ninv15.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | uint16_t 29 | br_i15_ninv15(uint16_t x) 30 | { 31 | uint32_t y; 32 | 33 | y = 2 - x; 34 | y = MUL15(y, 2 - MUL15(x, y)); 35 | y = MUL15(y, 2 - MUL15(x, y)); 36 | y = MUL15(y, 2 - MUL15(x, y)); 37 | return MUX(x & 1, -y, 0) & 0x7FFF; 38 | } 39 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i15_rshift.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_i15_rshift(uint16_t *x, int count) 30 | { 31 | size_t u, len; 32 | unsigned r; 33 | 34 | len = (x[0] + 15) >> 4; 35 | 36 | if (len == 0) 37 | { 38 | return; 39 | } 40 | 41 | r = x[1] >> count; 42 | 43 | for (u = 2; u <= len; u ++) 44 | { 45 | unsigned w; 46 | 47 | w = x[u]; 48 | x[u - 1] = ((w << (15 - count)) | r) & 0x7FFF; 49 | r = w >> count; 50 | } 51 | 52 | x[len] = r; 53 | } 54 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i15_sub.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | uint32_t 29 | br_i15_sub(uint16_t *a, const uint16_t *b, uint32_t ctl) 30 | { 31 | uint32_t cc; 32 | size_t u, m; 33 | 34 | cc = 0; 35 | m = (a[0] + 31) >> 4; 36 | 37 | for (u = 1; u < m; u ++) 38 | { 39 | uint32_t aw, bw, naw; 40 | 41 | aw = a[u]; 42 | bw = b[u]; 43 | naw = aw - bw - cc; 44 | cc = naw >> 31; 45 | a[u] = MUX(ctl, naw & 0x7FFF, aw); 46 | } 47 | 48 | return cc; 49 | } 50 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i15_tmont.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_i15_to_monty(uint16_t *x, const uint16_t *m) 30 | { 31 | unsigned k; 32 | 33 | for (k = (m[0] + 15) >> 4; k > 0; k --) 34 | { 35 | br_i15_muladd_small(x, 0, m); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i31_add.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | uint32_t 29 | br_i31_add(uint32_t *a, const uint32_t *b, uint32_t ctl) 30 | { 31 | uint32_t cc; 32 | size_t u, m; 33 | 34 | cc = 0; 35 | m = (a[0] + 63) >> 5; 36 | 37 | for (u = 1; u < m; u ++) 38 | { 39 | uint32_t aw, bw, naw; 40 | 41 | aw = a[u]; 42 | bw = b[u]; 43 | naw = aw + bw + cc; 44 | cc = naw >> 31; 45 | a[u] = MUX(ctl, naw & (uint32_t)0x7FFFFFFF, aw); 46 | } 47 | 48 | return cc; 49 | } 50 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i31_bitlen.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | uint32_t 29 | br_i31_bit_length(uint32_t *x, size_t xlen) 30 | { 31 | uint32_t tw, twk; 32 | 33 | tw = 0; 34 | twk = 0; 35 | 36 | while (xlen -- > 0) 37 | { 38 | uint32_t w, c; 39 | 40 | c = EQ(tw, 0); 41 | w = x[xlen]; 42 | tw = MUX(c, w, tw); 43 | twk = MUX(c, (uint32_t)xlen, twk); 44 | } 45 | 46 | return (twk << 5) + BIT_LENGTH(tw); 47 | } 48 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i31_decode.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_i31_decode(uint32_t *x, const void *src, size_t len) 30 | { 31 | const unsigned char *buf; 32 | size_t u, v; 33 | uint32_t acc; 34 | int acc_len; 35 | 36 | buf = src; 37 | u = len; 38 | v = 1; 39 | acc = 0; 40 | acc_len = 0; 41 | 42 | while (u -- > 0) 43 | { 44 | uint32_t b; 45 | 46 | b = buf[u]; 47 | acc |= (b << acc_len); 48 | acc_len += 8; 49 | 50 | if (acc_len >= 31) 51 | { 52 | x[v ++] = acc & (uint32_t)0x7FFFFFFF; 53 | acc_len -= 31; 54 | acc = b >> (8 - acc_len); 55 | } 56 | } 57 | 58 | if (acc_len != 0) 59 | { 60 | x[v ++] = acc; 61 | } 62 | 63 | x[0] = br_i31_bit_length(x + 1, v - 1); 64 | } 65 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i31_iszero.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | uint32_t 29 | br_i31_iszero(const uint32_t *x) 30 | { 31 | uint32_t z; 32 | size_t u; 33 | 34 | z = 0; 35 | 36 | for (u = (x[0] + 31) >> 5; u > 0; u --) 37 | { 38 | z |= x[u]; 39 | } 40 | 41 | return ~(z | -z) >> 31; 42 | } 43 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i31_ninv31.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | uint32_t 29 | br_i31_ninv31(uint32_t x) 30 | { 31 | uint32_t y; 32 | 33 | y = 2 - x; 34 | y *= 2 - y * x; 35 | y *= 2 - y * x; 36 | y *= 2 - y * x; 37 | y *= 2 - y * x; 38 | return MUX(x & 1, -y, 0) & 0x7FFFFFFF; 39 | } 40 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i31_rshift.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_i31_rshift(uint32_t *x, int count) 30 | { 31 | size_t u, len; 32 | uint32_t r; 33 | 34 | len = (x[0] + 31) >> 5; 35 | 36 | if (len == 0) 37 | { 38 | return; 39 | } 40 | 41 | r = x[1] >> count; 42 | 43 | for (u = 2; u <= len; u ++) 44 | { 45 | uint32_t w; 46 | 47 | w = x[u]; 48 | x[u - 1] = ((w << (31 - count)) | r) & 0x7FFFFFFF; 49 | r = w >> count; 50 | } 51 | 52 | x[len] = r; 53 | } 54 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i31_sub.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | uint32_t 29 | br_i31_sub(uint32_t *a, const uint32_t *b, uint32_t ctl) 30 | { 31 | uint32_t cc; 32 | size_t u, m; 33 | 34 | cc = 0; 35 | m = (a[0] + 63) >> 5; 36 | 37 | for (u = 1; u < m; u ++) 38 | { 39 | uint32_t aw, bw, naw; 40 | 41 | aw = a[u]; 42 | bw = b[u]; 43 | naw = aw - bw - cc; 44 | cc = naw >> 31; 45 | a[u] = MUX(ctl, naw & 0x7FFFFFFF, aw); 46 | } 47 | 48 | return cc; 49 | } 50 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i31_tmont.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_i31_to_monty(uint32_t *x, const uint32_t *m) 30 | { 31 | uint32_t k; 32 | 33 | for (k = (m[0] + 31) >> 5; k > 0; k --) 34 | { 35 | br_i31_muladd_small(x, 0, m); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i32_add.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | uint32_t 29 | br_i32_add(uint32_t *a, const uint32_t *b, uint32_t ctl) 30 | { 31 | uint32_t cc; 32 | size_t u, m; 33 | 34 | cc = 0; 35 | m = (a[0] + 63) >> 5; 36 | 37 | for (u = 1; u < m; u ++) 38 | { 39 | uint32_t aw, bw, naw; 40 | 41 | aw = a[u]; 42 | bw = b[u]; 43 | naw = aw + bw + cc; 44 | 45 | /* 46 | Carry is 1 if naw < aw. Carry is also 1 if naw == aw 47 | AND the carry was already 1. 48 | */ 49 | cc = (cc & EQ(naw, aw)) | LT(naw, aw); 50 | a[u] = MUX(ctl, naw, aw); 51 | } 52 | 53 | return cc; 54 | } 55 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i32_bitlen.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | uint32_t 29 | br_i32_bit_length(uint32_t *x, size_t xlen) 30 | { 31 | uint32_t tw, twk; 32 | 33 | tw = 0; 34 | twk = 0; 35 | 36 | while (xlen -- > 0) 37 | { 38 | uint32_t w, c; 39 | 40 | c = EQ(tw, 0); 41 | w = x[xlen]; 42 | tw = MUX(c, w, tw); 43 | twk = MUX(c, (uint32_t)xlen, twk); 44 | } 45 | 46 | return (twk << 5) + BIT_LENGTH(tw); 47 | } 48 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i32_div32.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | uint32_t 29 | br_divrem(uint32_t hi, uint32_t lo, uint32_t d, uint32_t *r) 30 | { 31 | /* TODO: optimize this */ 32 | uint32_t q; 33 | uint32_t ch, cf; 34 | int k; 35 | 36 | q = 0; 37 | ch = EQ(hi, d); 38 | hi = MUX(ch, 0, hi); 39 | 40 | for (k = 31; k > 0; k --) 41 | { 42 | int j; 43 | uint32_t w, ctl, hi2, lo2; 44 | 45 | j = 32 - k; 46 | w = (hi << j) | (lo >> k); 47 | ctl = GE(w, d) | (hi >> k); 48 | hi2 = (w - d) >> j; 49 | lo2 = lo - (d << k); 50 | hi = MUX(ctl, hi2, hi); 51 | lo = MUX(ctl, lo2, lo); 52 | q |= ctl << k; 53 | } 54 | 55 | cf = GE(lo, d) | hi; 56 | q |= cf; 57 | *r = MUX(cf, lo - d, lo); 58 | return q; 59 | } 60 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i32_iszero.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | uint32_t 29 | br_i32_iszero(const uint32_t *x) 30 | { 31 | uint32_t z; 32 | size_t u; 33 | 34 | z = 0; 35 | 36 | for (u = (x[0] + 31) >> 5; u > 0; u --) 37 | { 38 | z |= x[u]; 39 | } 40 | 41 | return ~(z | -z) >> 31; 42 | } 43 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i32_mulacc.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_i32_mulacc(uint32_t *d, const uint32_t *a, const uint32_t *b) 30 | { 31 | size_t alen, blen, u; 32 | 33 | alen = (a[0] + 31) >> 5; 34 | blen = (b[0] + 31) >> 5; 35 | d[0] = a[0] + b[0]; 36 | 37 | for (u = 0; u < blen; u ++) 38 | { 39 | uint32_t f; 40 | size_t v; 41 | #if BR_64 42 | uint64_t cc; 43 | #else 44 | uint32_t cc; 45 | #endif 46 | 47 | f = b[1 + u]; 48 | cc = 0; 49 | 50 | for (v = 0; v < alen; v ++) 51 | { 52 | uint64_t z; 53 | 54 | z = (uint64_t)d[1 + u + v] + MUL(f, a[1 + v]) + cc; 55 | cc = z >> 32; 56 | d[1 + u + v] = (uint32_t)z; 57 | } 58 | 59 | d[1 + u + alen] = (uint32_t)cc; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i32_ninv32.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | uint32_t 29 | br_i32_ninv32(uint32_t x) 30 | { 31 | uint32_t y; 32 | 33 | y = 2 - x; 34 | y *= 2 - y * x; 35 | y *= 2 - y * x; 36 | y *= 2 - y * x; 37 | y *= 2 - y * x; 38 | return MUX(x & 1, -y, 0); 39 | } 40 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i32_sub.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | uint32_t 29 | br_i32_sub(uint32_t *a, const uint32_t *b, uint32_t ctl) 30 | { 31 | uint32_t cc; 32 | size_t u, m; 33 | 34 | cc = 0; 35 | m = (a[0] + 63) >> 5; 36 | 37 | for (u = 1; u < m; u ++) 38 | { 39 | uint32_t aw, bw, naw; 40 | 41 | aw = a[u]; 42 | bw = b[u]; 43 | naw = aw - bw - cc; 44 | 45 | /* 46 | Carry is 1 if naw > aw. Carry is 1 also if naw == aw 47 | AND the carry was already 1. 48 | */ 49 | cc = (cc & EQ(naw, aw)) | GT(naw, aw); 50 | a[u] = MUX(ctl, naw, aw); 51 | } 52 | 53 | return cc; 54 | } 55 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/int/i32_tmont.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | void 29 | br_i32_to_monty(uint32_t *x, const uint32_t *m) 30 | { 31 | uint32_t k; 32 | 33 | for (k = (m[0] + 31) >> 5; k > 0; k --) 34 | { 35 | br_i32_muladd_small(x, 0, m); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_default_keygen.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | br_rsa_keygen 29 | br_rsa_keygen_get_default(void) 30 | { 31 | #if BR_INT128 || BR_UMUL128 32 | return &br_rsa_i62_keygen; 33 | #elif BR_LOMUL 34 | return &br_rsa_i15_keygen; 35 | #else 36 | return &br_rsa_i31_keygen; 37 | #endif 38 | } 39 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_default_modulus.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | br_rsa_compute_modulus 29 | br_rsa_compute_modulus_get_default(void) 30 | { 31 | #if BR_LOMUL 32 | return &br_rsa_i15_compute_modulus; 33 | #else 34 | return &br_rsa_i31_compute_modulus; 35 | #endif 36 | } 37 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_default_oaep_decrypt.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | br_rsa_oaep_decrypt 29 | br_rsa_oaep_decrypt_get_default(void) 30 | { 31 | #if BR_INT128 || BR_UMUL128 32 | return &br_rsa_i62_oaep_decrypt; 33 | #elif BR_LOMUL 34 | return &br_rsa_i15_oaep_decrypt; 35 | #else 36 | return &br_rsa_i31_oaep_decrypt; 37 | #endif 38 | } 39 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_default_oaep_encrypt.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | br_rsa_oaep_encrypt 29 | br_rsa_oaep_encrypt_get_default(void) 30 | { 31 | #if BR_INT128 || BR_UMUL128 32 | return &br_rsa_i62_oaep_encrypt; 33 | #elif BR_LOMUL 34 | return &br_rsa_i15_oaep_encrypt; 35 | #else 36 | return &br_rsa_i31_oaep_encrypt; 37 | #endif 38 | } 39 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_default_pkcs1_sign.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | br_rsa_pkcs1_sign 29 | br_rsa_pkcs1_sign_get_default(void) 30 | { 31 | #if BR_INT128 || BR_UMUL128 32 | return &br_rsa_i62_pkcs1_sign; 33 | #elif BR_LOMUL 34 | return &br_rsa_i15_pkcs1_sign; 35 | #else 36 | return &br_rsa_i31_pkcs1_sign; 37 | #endif 38 | } 39 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_default_pkcs1_vrfy.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | br_rsa_pkcs1_vrfy 29 | br_rsa_pkcs1_vrfy_get_default(void) 30 | { 31 | #if BR_INT128 || BR_UMUL128 32 | return &br_rsa_i62_pkcs1_vrfy; 33 | #elif BR_LOMUL 34 | return &br_rsa_i15_pkcs1_vrfy; 35 | #else 36 | return &br_rsa_i31_pkcs1_vrfy; 37 | #endif 38 | } 39 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_default_priv.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | br_rsa_private 29 | br_rsa_private_get_default(void) 30 | { 31 | #if BR_INT128 || BR_UMUL128 32 | return &br_rsa_i62_private; 33 | #elif BR_LOMUL 34 | return &br_rsa_i15_private; 35 | #else 36 | return &br_rsa_i31_private; 37 | #endif 38 | } 39 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_default_privexp.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | br_rsa_compute_privexp 29 | br_rsa_compute_privexp_get_default(void) 30 | { 31 | #if BR_LOMUL 32 | return &br_rsa_i15_compute_privexp; 33 | #else 34 | return &br_rsa_i31_compute_privexp; 35 | #endif 36 | } 37 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_default_pss_sign.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | br_rsa_pss_sign 29 | br_rsa_pss_sign_get_default(void) 30 | { 31 | #if BR_INT128 || BR_UMUL128 32 | return &br_rsa_i62_pss_sign; 33 | #elif BR_LOMUL 34 | return &br_rsa_i15_pss_sign; 35 | #else 36 | return &br_rsa_i31_pss_sign; 37 | #endif 38 | } 39 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_default_pss_vrfy.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | br_rsa_pss_vrfy 29 | br_rsa_pss_vrfy_get_default(void) 30 | { 31 | #if BR_INT128 || BR_UMUL128 32 | return &br_rsa_i62_pss_vrfy; 33 | #elif BR_LOMUL 34 | return &br_rsa_i15_pss_vrfy; 35 | #else 36 | return &br_rsa_i31_pss_vrfy; 37 | #endif 38 | } 39 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_default_pub.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | br_rsa_public 29 | br_rsa_public_get_default(void) 30 | { 31 | #if BR_INT128 || BR_UMUL128 32 | return &br_rsa_i62_public; 33 | #elif BR_LOMUL 34 | return &br_rsa_i15_public; 35 | #else 36 | return &br_rsa_i31_public; 37 | #endif 38 | } 39 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_default_pubexp.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | br_rsa_compute_pubexp 29 | br_rsa_compute_pubexp_get_default(void) 30 | { 31 | #if BR_LOMUL 32 | return &br_rsa_i15_compute_pubexp; 33 | #else 34 | return &br_rsa_i31_compute_pubexp; 35 | #endif 36 | } 37 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i15_oaep_decrypt.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | uint32_t 29 | br_rsa_i15_oaep_decrypt(const br_hash_class *dig, 30 | const void *label, size_t label_len, 31 | const br_rsa_private_key *sk, void *data, size_t *len) 32 | { 33 | uint32_t r; 34 | 35 | if (*len != ((sk->n_bitlen + 7) >> 3)) 36 | { 37 | return 0; 38 | } 39 | 40 | r = br_rsa_i15_private(data, sk); 41 | r &= br_rsa_oaep_unpad(dig, label, label_len, data, len); 42 | return r; 43 | } 44 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i15_oaep_encrypt.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | size_t 29 | br_rsa_i15_oaep_encrypt( 30 | const br_prng_class **rnd, const br_hash_class *dig, 31 | const void *label, size_t label_len, 32 | const br_rsa_public_key *pk, 33 | void *dst, size_t dst_max_len, 34 | const void *src, size_t src_len) 35 | { 36 | size_t dlen; 37 | 38 | dlen = br_rsa_oaep_pad(rnd, dig, label, label_len, 39 | pk, dst, dst_max_len, src, src_len); 40 | 41 | if (dlen == 0) 42 | { 43 | return 0; 44 | } 45 | 46 | return dlen & -(size_t)br_rsa_i15_public(dst, dlen, pk); 47 | } 48 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i15_pkcs1_sign.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | uint32_t 29 | br_rsa_i15_pkcs1_sign(const unsigned char *hash_oid, 30 | const unsigned char *hash, size_t hash_len, 31 | const br_rsa_private_key *sk, unsigned char *x) 32 | { 33 | if (!br_rsa_pkcs1_sig_pad(hash_oid, hash, hash_len, sk->n_bitlen, x)) 34 | { 35 | return 0; 36 | } 37 | 38 | return br_rsa_i15_private(x, sk); 39 | } 40 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i15_pkcs1_vrfy.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | uint32_t 29 | br_rsa_i15_pkcs1_vrfy(const unsigned char *x, size_t xlen, 30 | const unsigned char *hash_oid, size_t hash_len, 31 | const br_rsa_public_key *pk, unsigned char *hash_out) 32 | { 33 | unsigned char sig[BR_MAX_RSA_SIZE >> 3]; 34 | 35 | if (xlen > (sizeof sig)) 36 | { 37 | return 0; 38 | } 39 | 40 | memcpy(sig, x, xlen); 41 | 42 | if (!br_rsa_i15_public(sig, xlen, pk)) 43 | { 44 | return 0; 45 | } 46 | 47 | return br_rsa_pkcs1_sig_unpad(sig, xlen, hash_oid, hash_len, hash_out); 48 | } 49 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i15_pss_sign.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | uint32_t 29 | br_rsa_i15_pss_sign(const br_prng_class **rng, 30 | const br_hash_class *hf_data, const br_hash_class *hf_mgf1, 31 | const unsigned char *hash, size_t salt_len, 32 | const br_rsa_private_key *sk, unsigned char *x) 33 | { 34 | if (!br_rsa_pss_sig_pad(rng, hf_data, hf_mgf1, hash, 35 | salt_len, sk->n_bitlen, x)) 36 | { 37 | return 0; 38 | } 39 | 40 | return br_rsa_i15_private(x, sk); 41 | } 42 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i15_pss_vrfy.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | uint32_t 29 | br_rsa_i15_pss_vrfy(const unsigned char *x, size_t xlen, 30 | const br_hash_class *hf_data, const br_hash_class *hf_mgf1, 31 | const void *hash, size_t salt_len, const br_rsa_public_key *pk) 32 | { 33 | unsigned char sig[BR_MAX_RSA_SIZE >> 3]; 34 | 35 | if (xlen > (sizeof sig)) 36 | { 37 | return 0; 38 | } 39 | 40 | memcpy(sig, x, xlen); 41 | 42 | if (!br_rsa_i15_public(sig, xlen, pk)) 43 | { 44 | return 0; 45 | } 46 | 47 | return br_rsa_pss_sig_unpad(hf_data, hf_mgf1, 48 | hash, salt_len, pk, sig); 49 | } 50 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i31_keygen.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | uint32_t 29 | br_rsa_i31_keygen(const br_prng_class **rng, 30 | br_rsa_private_key *sk, void *kbuf_priv, 31 | br_rsa_public_key *pk, void *kbuf_pub, 32 | unsigned size, uint32_t pubexp) 33 | { 34 | return br_rsa_i31_keygen_inner(rng, 35 | sk, kbuf_priv, pk, kbuf_pub, size, pubexp, 36 | &br_i31_modpow_opt); 37 | } 38 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i31_oaep_decrypt.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | uint32_t 29 | br_rsa_i31_oaep_decrypt(const br_hash_class *dig, 30 | const void *label, size_t label_len, 31 | const br_rsa_private_key *sk, void *data, size_t *len) 32 | { 33 | uint32_t r; 34 | 35 | if (*len != ((sk->n_bitlen + 7) >> 3)) 36 | { 37 | return 0; 38 | } 39 | 40 | r = br_rsa_i31_private(data, sk); 41 | r &= br_rsa_oaep_unpad(dig, label, label_len, data, len); 42 | return r; 43 | } 44 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i31_oaep_encrypt.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | size_t 29 | br_rsa_i31_oaep_encrypt( 30 | const br_prng_class **rnd, const br_hash_class *dig, 31 | const void *label, size_t label_len, 32 | const br_rsa_public_key *pk, 33 | void *dst, size_t dst_max_len, 34 | const void *src, size_t src_len) 35 | { 36 | size_t dlen; 37 | 38 | dlen = br_rsa_oaep_pad(rnd, dig, label, label_len, 39 | pk, dst, dst_max_len, src, src_len); 40 | 41 | if (dlen == 0) 42 | { 43 | return 0; 44 | } 45 | 46 | return dlen & -(size_t)br_rsa_i31_public(dst, dlen, pk); 47 | } 48 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i31_pkcs1_sign.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | uint32_t 29 | br_rsa_i31_pkcs1_sign(const unsigned char *hash_oid, 30 | const unsigned char *hash, size_t hash_len, 31 | const br_rsa_private_key *sk, unsigned char *x) 32 | { 33 | if (!br_rsa_pkcs1_sig_pad(hash_oid, hash, hash_len, sk->n_bitlen, x)) 34 | { 35 | return 0; 36 | } 37 | 38 | return br_rsa_i31_private(x, sk); 39 | } 40 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i31_pkcs1_vrfy.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | uint32_t 29 | br_rsa_i31_pkcs1_vrfy(const unsigned char *x, size_t xlen, 30 | const unsigned char *hash_oid, size_t hash_len, 31 | const br_rsa_public_key *pk, unsigned char *hash_out) 32 | { 33 | unsigned char sig[BR_MAX_RSA_SIZE >> 3]; 34 | 35 | if (xlen > (sizeof sig)) 36 | { 37 | return 0; 38 | } 39 | 40 | memcpy(sig, x, xlen); 41 | 42 | if (!br_rsa_i31_public(sig, xlen, pk)) 43 | { 44 | return 0; 45 | } 46 | 47 | return br_rsa_pkcs1_sig_unpad(sig, xlen, hash_oid, hash_len, hash_out); 48 | } 49 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i31_pss_sign.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | uint32_t 29 | br_rsa_i31_pss_sign(const br_prng_class **rng, 30 | const br_hash_class *hf_data, const br_hash_class *hf_mgf1, 31 | const unsigned char *hash, size_t salt_len, 32 | const br_rsa_private_key *sk, unsigned char *x) 33 | { 34 | if (!br_rsa_pss_sig_pad(rng, hf_data, hf_mgf1, hash, 35 | salt_len, sk->n_bitlen, x)) 36 | { 37 | return 0; 38 | } 39 | 40 | return br_rsa_i31_private(x, sk); 41 | } 42 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i31_pss_vrfy.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | uint32_t 29 | br_rsa_i31_pss_vrfy(const unsigned char *x, size_t xlen, 30 | const br_hash_class *hf_data, const br_hash_class *hf_mgf1, 31 | const void *hash, size_t salt_len, const br_rsa_public_key *pk) 32 | { 33 | unsigned char sig[BR_MAX_RSA_SIZE >> 3]; 34 | 35 | if (xlen > (sizeof sig)) 36 | { 37 | return 0; 38 | } 39 | 40 | memcpy(sig, x, xlen); 41 | 42 | if (!br_rsa_i31_public(sig, xlen, pk)) 43 | { 44 | return 0; 45 | } 46 | 47 | return br_rsa_pss_sig_unpad(hf_data, hf_mgf1, 48 | hash, salt_len, pk, sig); 49 | } 50 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i32_oaep_decrypt.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | uint32_t 29 | br_rsa_i32_oaep_decrypt(const br_hash_class *dig, 30 | const void *label, size_t label_len, 31 | const br_rsa_private_key *sk, void *data, size_t *len) 32 | { 33 | uint32_t r; 34 | 35 | if (*len != ((sk->n_bitlen + 7) >> 3)) 36 | { 37 | return 0; 38 | } 39 | 40 | r = br_rsa_i32_private(data, sk); 41 | r &= br_rsa_oaep_unpad(dig, label, label_len, data, len); 42 | return r; 43 | } 44 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i32_oaep_encrypt.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | size_t 29 | br_rsa_i32_oaep_encrypt( 30 | const br_prng_class **rnd, const br_hash_class *dig, 31 | const void *label, size_t label_len, 32 | const br_rsa_public_key *pk, 33 | void *dst, size_t dst_max_len, 34 | const void *src, size_t src_len) 35 | { 36 | size_t dlen; 37 | 38 | dlen = br_rsa_oaep_pad(rnd, dig, label, label_len, 39 | pk, dst, dst_max_len, src, src_len); 40 | 41 | if (dlen == 0) 42 | { 43 | return 0; 44 | } 45 | 46 | return dlen & -(size_t)br_rsa_i32_public(dst, dlen, pk); 47 | } 48 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i32_pkcs1_sign.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | uint32_t 29 | br_rsa_i32_pkcs1_sign(const unsigned char *hash_oid, 30 | const unsigned char *hash, size_t hash_len, 31 | const br_rsa_private_key *sk, unsigned char *x) 32 | { 33 | if (!br_rsa_pkcs1_sig_pad(hash_oid, hash, hash_len, sk->n_bitlen, x)) 34 | { 35 | return 0; 36 | } 37 | 38 | return br_rsa_i32_private(x, sk); 39 | } 40 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i32_pkcs1_vrfy.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | uint32_t 29 | br_rsa_i32_pkcs1_vrfy(const unsigned char *x, size_t xlen, 30 | const unsigned char *hash_oid, size_t hash_len, 31 | const br_rsa_public_key *pk, unsigned char *hash_out) 32 | { 33 | unsigned char sig[BR_MAX_RSA_SIZE >> 3]; 34 | 35 | if (xlen > (sizeof sig)) 36 | { 37 | return 0; 38 | } 39 | 40 | memcpy(sig, x, xlen); 41 | 42 | if (!br_rsa_i32_public(sig, xlen, pk)) 43 | { 44 | return 0; 45 | } 46 | 47 | return br_rsa_pkcs1_sig_unpad(sig, xlen, hash_oid, hash_len, hash_out); 48 | } 49 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i32_pss_sign.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | uint32_t 29 | br_rsa_i32_pss_sign(const br_prng_class **rng, 30 | const br_hash_class *hf_data, const br_hash_class *hf_mgf1, 31 | const unsigned char *hash, size_t salt_len, 32 | const br_rsa_private_key *sk, unsigned char *x) 33 | { 34 | if (!br_rsa_pss_sig_pad(rng, hf_data, hf_mgf1, hash, 35 | salt_len, sk->n_bitlen, x)) 36 | { 37 | return 0; 38 | } 39 | 40 | return br_rsa_i32_private(x, sk); 41 | } 42 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i32_pss_vrfy.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_rsa.h */ 28 | uint32_t 29 | br_rsa_i32_pss_vrfy(const unsigned char *x, size_t xlen, 30 | const br_hash_class *hf_data, const br_hash_class *hf_mgf1, 31 | const void *hash, size_t salt_len, const br_rsa_public_key *pk) 32 | { 33 | unsigned char sig[BR_MAX_RSA_SIZE >> 3]; 34 | 35 | if (xlen > (sizeof sig)) 36 | { 37 | return 0; 38 | } 39 | 40 | memcpy(sig, x, xlen); 41 | 42 | if (!br_rsa_i32_public(sig, xlen, pk)) 43 | { 44 | return 0; 45 | } 46 | 47 | return br_rsa_pss_sig_unpad(hf_data, hf_mgf1, 48 | hash, salt_len, pk, sig); 49 | } 50 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/rsa/rsa_i62_pkcs1_sign.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | #if BR_INT128 || BR_UMUL128 28 | 29 | /* see bearssl_rsa.h */ 30 | uint32_t 31 | br_rsa_i62_pkcs1_sign(const unsigned char *hash_oid, 32 | const unsigned char *hash, size_t hash_len, 33 | const br_rsa_private_key *sk, unsigned char *x) 34 | { 35 | if (!br_rsa_pkcs1_sig_pad(hash_oid, hash, hash_len, sk->n_bitlen, x)) 36 | { 37 | return 0; 38 | } 39 | 40 | return br_rsa_i62_private(x, sk); 41 | } 42 | 43 | /* see bearssl_rsa.h */ 44 | br_rsa_pkcs1_sign 45 | br_rsa_i62_pkcs1_sign_get(void) 46 | { 47 | return &br_rsa_i62_pkcs1_sign; 48 | } 49 | 50 | #else 51 | 52 | /* see bearssl_rsa.h */ 53 | br_rsa_pkcs1_sign 54 | br_rsa_i62_pkcs1_sign_get(void) 55 | { 56 | return 0; 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ssl/prf_md5sha1.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl.h */ 28 | void 29 | br_tls10_prf(void *dst, size_t len, 30 | const void *secret, size_t secret_len, const char *label, 31 | size_t seed_num, const br_tls_prf_seed_chunk *seed) 32 | { 33 | const unsigned char *s1; 34 | size_t slen; 35 | 36 | s1 = secret; 37 | slen = (secret_len + 1) >> 1; 38 | memset(dst, 0, len); 39 | br_tls_phash(dst, len, &br_md5_vtable, 40 | s1, slen, label, seed_num, seed); 41 | br_tls_phash(dst, len, &br_sha1_vtable, 42 | s1 + secret_len - slen, slen, label, seed_num, seed); 43 | } 44 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ssl/prf_sha256.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl.h */ 28 | void 29 | br_tls12_sha256_prf(void *dst, size_t len, 30 | const void *secret, size_t secret_len, const char *label, 31 | size_t seed_num, const br_tls_prf_seed_chunk *seed) 32 | { 33 | memset(dst, 0, len); 34 | br_tls_phash(dst, len, &br_sha256_vtable, 35 | secret, secret_len, label, seed_num, seed); 36 | } 37 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ssl/prf_sha384.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl.h */ 28 | void 29 | br_tls12_sha384_prf(void *dst, size_t len, 30 | const void *secret, size_t secret_len, const char *label, 31 | size_t seed_num, const br_tls_prf_seed_chunk *seed) 32 | { 33 | memset(dst, 0, len); 34 | br_tls_phash(dst, len, &br_sha384_vtable, 35 | secret, secret_len, label, seed_num, seed); 36 | } 37 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ssl/ssl_client_default_rsapub.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_ssl.h */ 28 | void 29 | br_ssl_client_set_default_rsapub(br_ssl_client_context *cc) 30 | { 31 | br_ssl_client_set_rsapub(cc, br_rsa_public_get_default()); 32 | } 33 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ssl/ssl_engine_default_descbc.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_ssl.h */ 28 | void 29 | br_ssl_engine_set_default_des_cbc(br_ssl_engine_context *cc) 30 | { 31 | br_ssl_engine_set_cbc(cc, 32 | &br_sslrec_in_cbc_vtable, 33 | &br_sslrec_out_cbc_vtable); 34 | br_ssl_engine_set_des_cbc(cc, 35 | &br_des_ct_cbcenc_vtable, 36 | &br_des_ct_cbcdec_vtable); 37 | } 38 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ssl/ssl_engine_default_ec.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_ssl.h */ 28 | void 29 | br_ssl_engine_set_default_ec(br_ssl_engine_context *cc) 30 | { 31 | #if BR_LOMUL 32 | br_ssl_engine_set_ec(cc, &br_ec_all_m15); 33 | #else 34 | br_ssl_engine_set_ec(cc, &br_ec_all_m31); 35 | #endif 36 | } 37 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ssl/ssl_engine_default_ecdsa.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_ssl.h */ 28 | void 29 | br_ssl_engine_set_default_ecdsa(br_ssl_engine_context *cc) 30 | { 31 | #if BR_LOMUL 32 | br_ssl_engine_set_ec(cc, &br_ec_all_m15); 33 | br_ssl_engine_set_ecdsa(cc, &br_ecdsa_i15_vrfy_asn1); 34 | #else 35 | br_ssl_engine_set_ec(cc, &br_ec_all_m31); 36 | br_ssl_engine_set_ecdsa(cc, &br_ecdsa_i31_vrfy_asn1); 37 | #endif 38 | } 39 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ssl/ssl_engine_default_rsavrfy.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see bearssl_ssl.h */ 28 | void 29 | br_ssl_engine_set_default_rsavrfy(br_ssl_engine_context *cc) 30 | { 31 | br_ssl_engine_set_rsavrfy(cc, br_rsa_pkcs1_vrfy_get_default()); 32 | } 33 | -------------------------------------------------------------------------------- /src/SSLClient/bearssl/src/ssl/ssl_hashes.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Thomas Pornin 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "inner.h" 26 | 27 | /* see inner.h */ 28 | int 29 | br_ssl_choose_hash(unsigned bf) 30 | { 31 | static const unsigned char pref[] = 32 | { 33 | br_sha256_ID, br_sha384_ID, br_sha512_ID, 34 | br_sha224_ID, br_sha1_ID 35 | }; 36 | size_t u; 37 | 38 | for (u = 0; u < sizeof pref; u ++) 39 | { 40 | int x; 41 | 42 | x = pref[u]; 43 | 44 | if ((bf >> x) & 1) 45 | { 46 | return x; 47 | } 48 | } 49 | 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /src/inner.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | inner.h 3 | 4 | EthernetWebServer_SSL is a library for the Ethernet shields to run WebServer and Client with/without SSL 5 | 6 | Use SSLClient Library code from https://github.com/OPEnSLab-OSU/SSLClient 7 | 8 | Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer_SSL 9 | 10 | Version: 1.10.0 11 | 12 | Version Modified By Date Comments 13 | ------- ----------- ---------- ----------- 14 | 1.1.0 K Hoang 14/11/2020 Initial coding for SAMD21/SAMD51, nRF52, SAM DUE to support Ethernet shields using SSL. 15 | Supporting W5x00 using Ethernetx, ENC28J60 using EthernetENC and UIPEthernet libraries 16 | ... 17 | 1.8.0 K Hoang 05/04/2022 Use Ethernet_Generic library as default. Support SPI2 for ESP32 18 | 1.8.1 K Hoang 09/04/2022 Add support to SPI1 for RP2040 using arduino-pico core 19 | 1.8.2 K Hoang 27/04/2022 Change from `arduino.cc` to `arduino.tips` in examples 20 | 1.9.0 K Hoang 05/05/2022 Add support to custom SPI for Teensy, Mbed RP2040, Portenta_H7, etc. 21 | 1.9.1 K Hoang 25/08/2022 Auto-select SPI SS/CS pin according to board package 22 | 1.9.2 K Hoang 07/09/2022 Slow SPI clock for old W5100 shield or SAMD Zero. Improve support for SAMD21 23 | 1.9.3 K Hoang 26/10/2022 Add support to Seeed XIAO_NRF52840 and XIAO_NRF52840_SENSE using `mbed` or `nRF52` core 24 | 1.10.0 K Hoang 22/12/2022 Fix compile errors for new ESP32 core v2.0.6 25 | *****************************************************************************************************************************/ 26 | 27 | #include "SSLClient/inner.h" 28 | 29 | -------------------------------------------------------------------------------- /src/libb64/base64.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | base64.h - c source to a base64 encoding algorithm implementation 3 | 4 | EthernetWebServer_SSL is a library for the Ethernet shields to run WebServer and Client with/without SSL 5 | 6 | Use SSLClient Library code from https://github.com/OPEnSLab-OSU/SSLClient 7 | 8 | Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer_SSL 9 | *****************************************************************************************************************************/ 10 | 11 | #pragma once 12 | 13 | // Reintroduce to prevent duplication compile error if other lib/core already has LIB64 14 | // pragma once can't prevent that 15 | #ifndef BASE64_H 16 | #define BASE64_H 17 | 18 | int base64_encode(const unsigned char* aInput, int aInputLen, unsigned char* aOutput, int aOutputLen); 19 | 20 | #endif // BASE64_H 21 | 22 | -------------------------------------------------------------------------------- /src/libb64/cdecode.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | cdecoder.h - c source to a base64 decoding algorithm implementation 3 | 4 | EthernetWebServer_SSL is a library for the Ethernet shields to run WebServer and Client with/without SSL 5 | 6 | Use SSLClient Library code from https://github.com/OPEnSLab-OSU/SSLClient 7 | 8 | Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer_SSL 9 | *****************************************************************************************************************************/ 10 | 11 | #pragma once 12 | 13 | // Reintroduce to prevent duplication compile error if other lib/core already has LIB64 14 | // pragma once can't prevent that 15 | #ifndef BASE64_CDECODE_H 16 | #define BASE64_CDECODE_H 17 | 18 | #define base64_decode_expected_len(n) ((n * 3) / 4) 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | typedef enum 25 | { 26 | step_a, step_b, step_c, step_d 27 | } base64_decodestep; 28 | 29 | typedef struct 30 | { 31 | base64_decodestep step; 32 | char plainchar; 33 | } base64_decodestate; 34 | 35 | void base64_init_decodestate(base64_decodestate* state_in); 36 | 37 | int base64_decode_value(int value_in); 38 | 39 | int base64_decode_block(const char* code_in, const int length_in, char* plaintext_out, base64_decodestate* state_in); 40 | 41 | int base64_decode_chars(const char* code_in, const int length_in, char* plaintext_out); 42 | 43 | #ifdef __cplusplus 44 | } // extern "C" 45 | #endif 46 | 47 | #endif /* BASE64_CDECODE_H */ 48 | 49 | -------------------------------------------------------------------------------- /src/libb64/cencode.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | cencoder.h - c source to a base64 decoding algorithm implementation 3 | 4 | EthernetWebServer_SSL is a library for the Ethernet shields to run WebServer and Client with/without SSL 5 | 6 | Use SSLClient Library code from https://github.com/OPEnSLab-OSU/SSLClient 7 | 8 | Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer_SSL 9 | *****************************************************************************************************************************/ 10 | 11 | #pragma once 12 | 13 | // Reintroduce to prevent duplication compile error if other lib/core already has LIB64 14 | // pragma once can't prevent that 15 | #ifndef BASE64_CENCODE_H 16 | #define BASE64_CENCODE_H 17 | 18 | #define base64_encode_expected_len(n) ((((4 * n) / 3) + 3) & ~3) 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | typedef enum 25 | { 26 | step_A, step_B, step_C 27 | } base64_encodestep; 28 | 29 | typedef struct 30 | { 31 | base64_encodestep step; 32 | char result; 33 | int stepcount; 34 | } base64_encodestate; 35 | 36 | void base64_init_encodestate(base64_encodestate* state_in); 37 | 38 | char base64_encode_value(char value_in); 39 | 40 | int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, base64_encodestate* state_in); 41 | 42 | int base64_encode_blockend(char* code_out, base64_encodestate* state_in); 43 | 44 | int base64_encode_chars(const char* plaintext_in, int length_in, char* code_out); 45 | 46 | #ifdef __cplusplus 47 | } // extern "C" 48 | #endif 49 | 50 | #endif /* BASE64_CENCODE_H */ 51 | 52 | -------------------------------------------------------------------------------- /src/time_macros.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | time_macros.h 3 | 4 | EthernetWebServer_SSL is a library for the Ethernet shields to run WebServer and Client with/without SSL 5 | 6 | Use SSLClient Library code from https://github.com/OPEnSLab-OSU/SSLClient 7 | 8 | Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer_SSL 9 | 10 | Version: 1.10.0 11 | 12 | Version Modified By Date Comments 13 | ------- ----------- ---------- ----------- 14 | 1.1.0 K Hoang 14/11/2020 Initial coding for SAMD21/SAMD51, nRF52, SAM DUE to support Ethernet shields using SSL. 15 | Supporting W5x00 using Ethernetx, ENC28J60 using EthernetENC and UIPEthernet libraries 16 | ... 17 | 1.8.0 K Hoang 05/04/2022 Use Ethernet_Generic library as default. Support SPI2 for ESP32 18 | 1.8.1 K Hoang 09/04/2022 Add support to SPI1 for RP2040 using arduino-pico core 19 | 1.8.2 K Hoang 27/04/2022 Change from `arduino.cc` to `arduino.tips` in examples 20 | 1.9.0 K Hoang 05/05/2022 Add support to custom SPI for Teensy, Mbed RP2040, Portenta_H7, etc. 21 | 1.9.1 K Hoang 25/08/2022 Auto-select SPI SS/CS pin according to board package 22 | 1.9.2 K Hoang 07/09/2022 Slow SPI clock for old W5100 shield or SAMD Zero. Improve support for SAMD21 23 | 1.9.3 K Hoang 26/10/2022 Add support to Seeed XIAO_NRF52840 and XIAO_NRF52840_SENSE using `mbed` or `nRF52` core 24 | 1.10.0 K Hoang 22/12/2022 Fix compile errors for new ESP32 core v2.0.6 25 | *****************************************************************************************************************************/ 26 | 27 | #include "SSLClient/time_macros.h" 28 | -------------------------------------------------------------------------------- /utils/astyle_library.conf: -------------------------------------------------------------------------------- 1 | # Code formatting rules for Arduino libraries, modified from for KH libraries: 2 | # 3 | # https://github.com/arduino/Arduino/blob/master/build/shared/examples_formatter.conf 4 | # 5 | 6 | # astyle --style=allman -s2 -t2 -C -S -xW -Y -M120 -f -p -xg -H -xb -c --xC120 -xL *.h *.cpp *.ino 7 | 8 | --mode=c 9 | --lineend=linux 10 | --style=allman 11 | 12 | # -r or -R 13 | #--recursive 14 | 15 | # -c => Converts tabs into spaces 16 | convert-tabs 17 | 18 | # -s2 => 2 spaces indentation 19 | --indent=spaces=2 20 | 21 | # -t2 => tab =2 spaces 22 | #--indent=tab=2 23 | 24 | # -C 25 | --indent-classes 26 | 27 | # -S 28 | --indent-switches 29 | 30 | # -xW 31 | --indent-preproc-block 32 | 33 | # -Y => indent classes, switches (and cases), comments starting at column 1 34 | --indent-col1-comments 35 | 36 | # -M120 => maximum of 120 spaces to indent a continuation line 37 | --max-continuation-indent=120 38 | 39 | # -xC120 => max‑code‑length will break a line if the code exceeds # characters 40 | --max-code-length=120 41 | 42 | # -f => 43 | --break-blocks 44 | 45 | # -p => put a space around operators 46 | --pad-oper 47 | 48 | # -xg => Insert space padding after commas 49 | --pad-comma 50 | 51 | # -H => put a space after if/for/while 52 | pad-header 53 | 54 | # -xb => Break one line headers (e.g. if/for/while) 55 | --break-one-line-headers 56 | 57 | # -c => Converts tabs into spaces 58 | #--convert-tabs 59 | 60 | # if you like one-liners, keep them 61 | #keep-one-line-statements 62 | 63 | # -xV 64 | --attach-closing-while 65 | 66 | #unpad-paren 67 | 68 | # -xp 69 | remove-comment-prefix 70 | 71 | -------------------------------------------------------------------------------- /utils/restyle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for dir in . ; do 4 | find $dir -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.ino" \) -exec astyle --suffix=none --options=./utils/astyle_library.conf \{\} \; 5 | done 6 | 7 | --------------------------------------------------------------------------------