mirror of
https://github.com/polhenarejos/pico-fido
synced 2026-06-09 03:23:42 +02:00
Compare commits
3 Commits
v6.6
...
513642663b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
513642663b | ||
|
|
e4ed703b6b | ||
|
|
a61bb91824 |
@@ -98,6 +98,7 @@ set(SOURCES ${SOURCES}
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/src/fido/cbor_vendor.c
|
${CMAKE_CURRENT_LIST_DIR}/src/fido/cbor_vendor.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/fido/cbor_large_blobs.c
|
${CMAKE_CURRENT_LIST_DIR}/src/fido/cbor_large_blobs.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/fido/management.c
|
${CMAKE_CURRENT_LIST_DIR}/src/fido/management.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/fido/defs.c
|
||||||
)
|
)
|
||||||
if (${ENABLE_OATH_APP})
|
if (${ENABLE_OATH_APP})
|
||||||
set(SOURCES ${SOURCES}
|
set(SOURCES ${SOURCES}
|
||||||
|
|||||||
@@ -42,6 +42,6 @@ if [[ $NO_EDDSA -eq 0 ]]; then
|
|||||||
rm -rf -- ./*
|
rm -rf -- ./*
|
||||||
PICO_SDK_PATH="${PICO_SDK_PATH}" cmake .. -DPICO_BOARD=$board_name -DSECURE_BOOT_PKEY=../../ec_private_key.pem -DENABLE_EDDSA=1
|
PICO_SDK_PATH="${PICO_SDK_PATH}" cmake .. -DPICO_BOARD=$board_name -DSECURE_BOOT_PKEY=../../ec_private_key.pem -DENABLE_EDDSA=1
|
||||||
make -j`nproc`
|
make -j`nproc`
|
||||||
mv pico_fido.uf2 ../release/pico_fido_$board_name-$SUFFIX-eddsa1.uf2
|
mv pico_fido.uf2 ../release_eddsa/pico_fido_$board_name-$SUFFIX-eddsa1.uf2
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
int cmd_authenticate() {
|
int cmd_authenticate() {
|
||||||
CTAP_AUTHENTICATE_REQ *req = (CTAP_AUTHENTICATE_REQ *) apdu.data;
|
CTAP_AUTHENTICATE_REQ *req = (CTAP_AUTHENTICATE_REQ *) apdu.data;
|
||||||
CTAP_AUTHENTICATE_RESP *resp = (CTAP_AUTHENTICATE_RESP *) res_APDU;
|
CTAP_AUTHENTICATE_RESP *resp = (CTAP_AUTHENTICATE_RESP *) res_APDU;
|
||||||
//if (scan_files(true) != PICOKEY_OK)
|
//if (scan_files_fido(true) != PICOKEY_OK)
|
||||||
// return SW_EXEC_ERROR();
|
// return SW_EXEC_ERROR();
|
||||||
if (apdu.nc < CTAP_CHAL_SIZE + CTAP_APPID_SIZE + 1 + 1) {
|
if (apdu.nc < CTAP_CHAL_SIZE + CTAP_APPID_SIZE + 1 + 1) {
|
||||||
return SW_WRONG_DATA();
|
return SW_WRONG_DATA();
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ int cmd_register() {
|
|||||||
CTAP_REGISTER_RESP *resp = (CTAP_REGISTER_RESP *) res_APDU;
|
CTAP_REGISTER_RESP *resp = (CTAP_REGISTER_RESP *) res_APDU;
|
||||||
resp->registerId = CTAP_REGISTER_ID;
|
resp->registerId = CTAP_REGISTER_ID;
|
||||||
resp->keyHandleLen = KEY_HANDLE_LEN;
|
resp->keyHandleLen = KEY_HANDLE_LEN;
|
||||||
//if (scan_files(true) != PICOKEY_OK)
|
//if (scan_files_fido(true) != PICOKEY_OK)
|
||||||
// return SW_EXEC_ERROR();
|
// return SW_EXEC_ERROR();
|
||||||
if (apdu.nc != CTAP_APPID_SIZE + CTAP_CHAL_SIZE) {
|
if (apdu.nc != CTAP_APPID_SIZE + CTAP_CHAL_SIZE) {
|
||||||
return SW_WRONG_LENGTH();
|
return SW_WRONG_LENGTH();
|
||||||
|
|||||||
20
src/fido/defs.c
Normal file
20
src/fido/defs.c
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Pico FIDO distribution (https://github.com/polhenarejos/pico-fido).
|
||||||
|
* Copyright (c) 2022 Pol Henarejos.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "fido.h"
|
||||||
|
|
||||||
|
uint8_t PICO_PRODUCT = 2; // Pico FIDO
|
||||||
@@ -41,8 +41,6 @@
|
|||||||
int fido_process_apdu();
|
int fido_process_apdu();
|
||||||
int fido_unload();
|
int fido_unload();
|
||||||
|
|
||||||
uint8_t PICO_PRODUCT = 2; // Pico FIDO
|
|
||||||
|
|
||||||
pinUvAuthToken_t paut = { 0 };
|
pinUvAuthToken_t paut = { 0 };
|
||||||
|
|
||||||
uint8_t keydev_dec[32];
|
uint8_t keydev_dec[32];
|
||||||
@@ -307,7 +305,7 @@ int derive_key(const uint8_t *app_id, bool new_key, uint8_t *key_handle, int cur
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
int scan_files() {
|
int scan_files_fido() {
|
||||||
ef_keydev = search_by_fid(EF_KEY_DEV, NULL, SPECIFY_EF);
|
ef_keydev = search_by_fid(EF_KEY_DEV, NULL, SPECIFY_EF);
|
||||||
ef_keydev_enc = search_by_fid(EF_KEY_DEV_ENC, NULL, SPECIFY_EF);
|
ef_keydev_enc = search_by_fid(EF_KEY_DEV_ENC, NULL, SPECIFY_EF);
|
||||||
ef_mkek = search_by_fid(EF_MKEK, NULL, SPECIFY_EF);
|
ef_mkek = search_by_fid(EF_MKEK, NULL, SPECIFY_EF);
|
||||||
@@ -432,7 +430,7 @@ int scan_files() {
|
|||||||
|
|
||||||
void scan_all() {
|
void scan_all() {
|
||||||
scan_flash();
|
scan_flash();
|
||||||
scan_files();
|
scan_files_fido();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void init_otp();
|
extern void init_otp();
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
#define SHA256_DIGEST_LENGTH (32)
|
#define SHA256_DIGEST_LENGTH (32)
|
||||||
#define KEY_HANDLE_LEN (KEY_PATH_LEN + SHA256_DIGEST_LENGTH)
|
#define KEY_HANDLE_LEN (KEY_PATH_LEN + SHA256_DIGEST_LENGTH)
|
||||||
|
|
||||||
extern int scan_files();
|
extern int scan_files_fido();
|
||||||
extern int derive_key(const uint8_t *app_id,
|
extern int derive_key(const uint8_t *app_id,
|
||||||
bool new_key,
|
bool new_key,
|
||||||
uint8_t *key_handle,
|
uint8_t *key_handle,
|
||||||
|
|||||||
Reference in New Issue
Block a user