Merge branch 'main' into eddsa
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
35
.github/workflows/nightly.yml
vendored
Normal file
35
.github/workflows/nightly.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: "Nightly deploy"
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 2 * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
nightly:
|
||||||
|
name: Deploy nightly
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
refs: [main]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ matrix.refs }}
|
||||||
|
submodules: 'recursive'
|
||||||
|
- name : Build
|
||||||
|
env:
|
||||||
|
PICO_SDK_PATH: ../pico-sdk
|
||||||
|
run: |
|
||||||
|
./workflows/autobuild.sh pico
|
||||||
|
./build_pico_openpgp.sh
|
||||||
|
./workflows/autobuild.sh esp32
|
||||||
|
- name: Update nightly release
|
||||||
|
uses: pyTooling/Actions/releaser@main
|
||||||
|
with:
|
||||||
|
tag: nightly-${{ matrix.refs }}
|
||||||
|
rm: true
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
files: release/*.*
|
||||||
102
CMakeLists.txt
102
CMakeLists.txt
@@ -18,79 +18,83 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
if(ESP_PLATFORM)
|
if(ESP_PLATFORM)
|
||||||
set(EXTRA_COMPONENT_DIRS src pico-keys-sdk/src)
|
set(EXTRA_COMPONENT_DIRS src pico-keys-sdk/src)
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
else()
|
else()
|
||||||
if(ENABLE_EMULATION)
|
|
||||||
else()
|
|
||||||
include(pico_sdk_import.cmake)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
project(pico_openpgp C CXX ASM)
|
if(ENABLE_EMULATION)
|
||||||
set(CMAKE_C_STANDARD 11)
|
else()
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
include(pico_sdk_import.cmake)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(ENABLE_EMULATION)
|
project(pico_openpgp C CXX ASM)
|
||||||
else()
|
|
||||||
pico_sdk_init()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_executable(pico_openpgp)
|
set(CMAKE_C_STANDARD 11)
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
if(ENABLE_EMULATION)
|
||||||
|
else()
|
||||||
|
pico_sdk_init()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_executable(pico_openpgp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(SOURCES ${SOURCES}
|
set(SOURCES ${SOURCES}
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/openpgp/openpgp.c
|
${CMAKE_CURRENT_LIST_DIR}/src/openpgp/openpgp.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/openpgp/files.c
|
${CMAKE_CURRENT_LIST_DIR}/src/openpgp/files.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/openpgp/piv.c
|
${CMAKE_CURRENT_LIST_DIR}/src/openpgp/piv.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/openpgp/management.c
|
${CMAKE_CURRENT_LIST_DIR}/src/openpgp/management.c
|
||||||
)
|
)
|
||||||
|
|
||||||
set(USB_ITF_CCID 1)
|
set(USB_ITF_CCID 1)
|
||||||
set(USB_ITF_WCID 1)
|
set(USB_ITF_WCID 1)
|
||||||
include(pico-keys-sdk/pico_keys_sdk_import.cmake)
|
include(pico-keys-sdk/pico_keys_sdk_import.cmake)
|
||||||
if(ESP_PLATFORM)
|
if(ESP_PLATFORM)
|
||||||
project(pico_openpgp)
|
project(pico_openpgp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(INCLUDES ${INCLUDES}
|
set(INCLUDES ${INCLUDES}
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/openpgp
|
${CMAKE_CURRENT_LIST_DIR}/src/openpgp
|
||||||
)
|
)
|
||||||
if(NOT ESP_PLATFORM)
|
if(NOT ESP_PLATFORM)
|
||||||
target_sources(pico_openpgp PUBLIC ${SOURCES})
|
target_sources(pico_openpgp PUBLIC ${SOURCES})
|
||||||
target_include_directories(pico_openpgp PUBLIC ${INCLUDES})
|
target_include_directories(pico_openpgp PUBLIC ${INCLUDES})
|
||||||
|
|
||||||
target_compile_options(pico_openpgp PUBLIC
|
|
||||||
-Wall
|
|
||||||
)
|
|
||||||
if(NOT MSVC)
|
|
||||||
target_compile_options(pico_openpgp PUBLIC
|
target_compile_options(pico_openpgp PUBLIC
|
||||||
-Werror
|
-Wall
|
||||||
)
|
)
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_EMULATION)
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
target_compile_options(pico_openpgp PUBLIC
|
target_compile_options(pico_openpgp PUBLIC
|
||||||
-fdata-sections
|
-Werror
|
||||||
-ffunction-sections
|
)
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
if(APPLE)
|
|
||||||
target_link_options(pico_openpgp PUBLIC
|
|
||||||
-Wl,-dead_strip
|
|
||||||
)
|
|
||||||
elseif(MSVC)
|
|
||||||
target_compile_options(pico_openpgp PUBLIC
|
|
||||||
-WX
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(pico_openpgp PUBLIC wsock32 ws2_32 Bcrypt)
|
if(ENABLE_EMULATION)
|
||||||
|
if(NOT MSVC)
|
||||||
|
target_compile_options(pico_openpgp PUBLIC
|
||||||
|
-fdata-sections
|
||||||
|
-ffunction-sections
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
if(APPLE)
|
||||||
|
target_link_options(pico_openpgp PUBLIC
|
||||||
|
-Wl,-dead_strip
|
||||||
|
)
|
||||||
|
elseif(MSVC)
|
||||||
|
target_compile_options(pico_openpgp PUBLIC
|
||||||
|
-WX
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(pico_openpgp PUBLIC wsock32 ws2_32 Bcrypt)
|
||||||
|
else()
|
||||||
|
target_link_options(pico_openpgp PUBLIC
|
||||||
|
-Wl,--gc-sections
|
||||||
|
)
|
||||||
|
endif(APPLE)
|
||||||
|
target_link_libraries(pico_openpgp PRIVATE pthread m)
|
||||||
else()
|
else()
|
||||||
target_link_options(pico_openpgp PUBLIC
|
pico_add_extra_outputs(${CMAKE_PROJECT_NAME})
|
||||||
-Wl,--gc-sections
|
endif()
|
||||||
)
|
|
||||||
endif(APPLE)
|
|
||||||
target_link_libraries(pico_openpgp PRIVATE pthread m)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
Submodule pico-keys-sdk updated: 1d86efa33b...83e6d0c89f
@@ -4,6 +4,7 @@
|
|||||||
IGNORE_UNKNOWN_FILES_FOR_MANAGED_COMPONENTS=1
|
IGNORE_UNKNOWN_FILES_FOR_MANAGED_COMPONENTS=1
|
||||||
|
|
||||||
CONFIG_TINYUSB=y
|
CONFIG_TINYUSB=y
|
||||||
|
CONFIG_TINYUSB_TASK_STACK_SIZE=16384
|
||||||
|
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="pico-keys-sdk/config/esp32/partitions.csv"
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="pico-keys-sdk/config/esp32/partitions.csv"
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ static int cmd_select() {
|
|||||||
uint16_t fid = 0x0;
|
uint16_t fid = 0x0;
|
||||||
|
|
||||||
if (apdu.nc >= 2) {
|
if (apdu.nc >= 2) {
|
||||||
fid = get_uint16_t(apdu.data, 0);
|
fid = get_uint16_t_be(apdu.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pe) {
|
if (!pe) {
|
||||||
@@ -1338,14 +1338,14 @@ void make_rsa_response(mbedtls_rsa_context *rsa) {
|
|||||||
res_APDU_size = 5;
|
res_APDU_size = 5;
|
||||||
res_APDU[res_APDU_size++] = 0x81;
|
res_APDU[res_APDU_size++] = 0x81;
|
||||||
res_APDU[res_APDU_size++] = 0x82;
|
res_APDU[res_APDU_size++] = 0x82;
|
||||||
put_uint16_t(mbedtls_mpi_size(&rsa->N), res_APDU + res_APDU_size); res_APDU_size += 2;
|
put_uint16_t_be(mbedtls_mpi_size(&rsa->N), res_APDU + res_APDU_size); res_APDU_size += 2;
|
||||||
mbedtls_mpi_write_binary(&rsa->N, res_APDU + res_APDU_size, mbedtls_mpi_size(&rsa->N));
|
mbedtls_mpi_write_binary(&rsa->N, res_APDU + res_APDU_size, mbedtls_mpi_size(&rsa->N));
|
||||||
res_APDU_size += mbedtls_mpi_size(&rsa->N);
|
res_APDU_size += mbedtls_mpi_size(&rsa->N);
|
||||||
res_APDU[res_APDU_size++] = 0x82;
|
res_APDU[res_APDU_size++] = 0x82;
|
||||||
res_APDU[res_APDU_size++] = mbedtls_mpi_size(&rsa->E) & 0xff;
|
res_APDU[res_APDU_size++] = mbedtls_mpi_size(&rsa->E) & 0xff;
|
||||||
mbedtls_mpi_write_binary(&rsa->E, res_APDU + res_APDU_size, mbedtls_mpi_size(&rsa->E));
|
mbedtls_mpi_write_binary(&rsa->E, res_APDU + res_APDU_size, mbedtls_mpi_size(&rsa->E));
|
||||||
res_APDU_size += mbedtls_mpi_size(&rsa->E);
|
res_APDU_size += mbedtls_mpi_size(&rsa->E);
|
||||||
put_uint16_t(res_APDU_size - 5, res_APDU + 3);
|
put_uint16_t_be(res_APDU_size - 5, res_APDU + 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void make_ecdsa_response(mbedtls_ecp_keypair *ecdsa) {
|
void make_ecdsa_response(mbedtls_ecp_keypair *ecdsa) {
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ static int cmd_get_metadata() {
|
|||||||
}
|
}
|
||||||
res_APDU[res_APDU_size++] = 0x81;
|
res_APDU[res_APDU_size++] = 0x81;
|
||||||
res_APDU[res_APDU_size++] = 0x82;
|
res_APDU[res_APDU_size++] = 0x82;
|
||||||
put_uint16_t(mbedtls_mpi_size(&ctx.N), res_APDU + res_APDU_size); res_APDU_size += 2;
|
put_uint16_t_be(mbedtls_mpi_size(&ctx.N), res_APDU + res_APDU_size); res_APDU_size += 2;
|
||||||
mbedtls_mpi_write_binary(&ctx.N, res_APDU + res_APDU_size, mbedtls_mpi_size(&ctx.N));
|
mbedtls_mpi_write_binary(&ctx.N, res_APDU + res_APDU_size, mbedtls_mpi_size(&ctx.N));
|
||||||
res_APDU_size += mbedtls_mpi_size(&ctx.N);
|
res_APDU_size += mbedtls_mpi_size(&ctx.N);
|
||||||
res_APDU[res_APDU_size++] = 0x82;
|
res_APDU[res_APDU_size++] = 0x82;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ mkdir build_pico
|
|||||||
cd build_pico
|
cd build_pico
|
||||||
cmake -DPICO_SDK_PATH=../pico-sdk ..
|
cmake -DPICO_SDK_PATH=../pico-sdk ..
|
||||||
make
|
make
|
||||||
|
cd ..
|
||||||
elif [[ $1 == "esp32" ]]; then
|
elif [[ $1 == "esp32" ]]; then
|
||||||
sudo apt install -y git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
|
sudo apt install -y git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
|
||||||
git clone --recursive https://github.com/espressif/esp-idf.git
|
git clone --recursive https://github.com/espressif/esp-idf.git
|
||||||
@@ -31,6 +32,10 @@ cd esp-idf
|
|||||||
cd ..
|
cd ..
|
||||||
idf.py set-target esp32s3
|
idf.py set-target esp32s3
|
||||||
idf.py all
|
idf.py all
|
||||||
|
mkdir -p release
|
||||||
|
cd build
|
||||||
|
esptool.py --chip ESP32-S3 merge_bin -o ../release/pico_openpgp_esp32-s3.bin @flash_args
|
||||||
|
cd ..
|
||||||
else
|
else
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
|
|||||||
Reference in New Issue
Block a user