1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-13 08:40:26 +01:00

sys/fido2: Small fix to dependencies && cleanup

This commit is contained in:
Ollrogge 2024-11-21 09:49:27 +01:00
parent 7e0a86ba32
commit db95ef6f10
8 changed files with 29 additions and 14 deletions

View File

@ -28,4 +28,5 @@ endif
USEMODULE += crypto_aes_256
USEMODULE += hashes
USEMODULE += fido2
USEMODULE += fmt
endif

View File

@ -921,7 +921,6 @@ static int _get_key_agreement(void)
int ret;
ctap_public_key_cose_t key = { 0 };
/* generate key agreement key */
ret =
fido2_ctap_crypto_gen_keypair(&_state.ag_key.pub, _state.ag_key.priv,

View File

@ -107,14 +107,16 @@ static ctap_status_code_t _parse_int(CborValue *it, int *num);
/**
* @brief Parse credential description
*/
static ctap_status_code_t _fido2_ctap_cbor_parse_cred_desc(CborValue *arr, ctap_cred_desc_alt_t *cred);
static ctap_status_code_t _fido2_ctap_cbor_parse_cred_desc(CborValue *arr,
ctap_cred_desc_alt_t *cred);
/**
* @brief Encode public key into COSE_KEY format
*
* See https://tools.ietf.org/html/rfc8152#page-34 Section 13.1.1 for details.
*/
static ctap_status_code_t _encode_public_key_cose(CborEncoder *cose_key, const ctap_public_key_cose_t *key);
static ctap_status_code_t _encode_public_key_cose(CborEncoder *cose_key,
const ctap_public_key_cose_t *key);
/**
* @brief Encode PublicKeyCredentialDescriptor into CBOR format
@ -743,7 +745,8 @@ static ctap_status_code_t _encode_user_entity(CborEncoder *encoder,
return CTAP2_OK;
}
static ctap_status_code_t _encode_public_key_cose(CborEncoder *cose_key, const ctap_public_key_cose_t *key)
static ctap_status_code_t _encode_public_key_cose(CborEncoder *cose_key,
const ctap_public_key_cose_t *key)
{
int ret;
CborEncoder map;
@ -1620,7 +1623,8 @@ static ctap_status_code_t _parse_exclude_list(CborValue *it, ctap_cred_desc_alt_
return CTAP2_OK;
}
static ctap_status_code_t _fido2_ctap_cbor_parse_cred_desc(CborValue *arr, ctap_cred_desc_alt_t *cred)
static ctap_status_code_t _fido2_ctap_cbor_parse_cred_desc(CborValue *arr,
ctap_cred_desc_alt_t *cred)
{
int ret;
int type;

View File

@ -44,8 +44,6 @@ static ctap_status_code_t _sig_to_der_format(uint8_t *r, uint8_t *s, uint8_t *si
*
* wrapper for @ref fido2_ctap_crypto_prng
*/
static int _RNG(uint8_t *dest, unsigned size);
static int _RNG(uint8_t *dest, unsigned size)
{
fido2_ctap_crypto_prng(dest, (size_t)size);
@ -71,7 +69,8 @@ ctap_status_code_t fido2_ctap_crypto_sha256_init(sha256_context_t *ctx)
return CTAP2_OK;
}
ctap_status_code_t fido2_ctap_crypto_sha256_update(sha256_context_t *ctx, const void *data, size_t len)
ctap_status_code_t fido2_ctap_crypto_sha256_update(sha256_context_t *ctx,
const void *data, size_t len)
{
sha256_update(ctx, data, len);
return CTAP2_OK;
@ -97,7 +96,8 @@ ctap_status_code_t fido2_ctap_crypto_hmac_sha256_init(hmac_context_t *ctx, const
return CTAP2_OK;
}
ctap_status_code_t fido2_ctap_crypto_hmac_sha256_update(hmac_context_t *ctx, const void *data, size_t len)
ctap_status_code_t fido2_ctap_crypto_hmac_sha256_update(hmac_context_t *ctx,
const void *data, size_t len)
{
hmac_sha256_update(ctx, data, len);
return CTAP2_OK;

View File

@ -30,7 +30,7 @@
#ifdef BOARD_NATIVE
#include "mtd_default.h"
// native mtd is file backed => Start address of flash is 0.
/* native mtd is file backed => Start address of flash is 0. */
char *_backing_memory = NULL;
static mtd_dev_t *_mtd_dev = NULL;
#else

View File

@ -1,4 +1,11 @@
include ../Makefile.tests_common
BOARD ?= native
include ../Makefile.sys_common
BOARD_WHITELIST = \
native \
nrf52840dk \
nrf52840dongle
# same as CTAP_STACKSIZE
CFLAGS += -DTHREAD_STACKSIZE_MAIN=15000

View File

@ -1,7 +1,11 @@
BOARD ?= nrf52840dk
#BOARD ?= nrf52840dongle
include ../Makefile.tests_common
include ../Makefile.sys_common
BOARD_WHITELIST = \
nrf52840dk \
nrf52840dongle
USEMODULE += fido2_ctap_transport_hid
USEPKG += fido2_tests

View File

@ -19,13 +19,13 @@
#define ENABLE_DEBUG (0)
#include "debug.h"
#include "xtimer.h"
#include "ztimer.h"
#include "fido2/ctap/transport/ctap_transport.h"
int main(void)
{
/* sleep in order to see early DEBUG outputs */
xtimer_sleep(3);
ztimer_sleep(ZTIMER_MSEC, 3000);
fido2_ctap_transport_init();
}