Skip to content

Commit

Permalink
sys/fido2: Small fix to dependencies && cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Ollrogge committed Nov 18, 2024
1 parent 504667c commit 65efa59
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions sys/fido2/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ ifneq (,$(filter fido2_ctap,$(USEMODULE)))
USEMODULE += crypto_aes_256
USEMODULE += hashes
USEMODULE += fido2
USEMODULE += fmt
endif
1 change: 0 additions & 1 deletion sys/fido2/ctap/ctap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 8 additions & 4 deletions sys/fido2/ctap/ctap_cbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions sys/fido2/ctap/ctap_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion sys/fido2/ctap/ctap_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/sys/fido2_ctap/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include ../Makefile.tests_common
include ../Makefile.sys_common

# same as CTAP_STACKSIZE
CFLAGS += -DTHREAD_STACKSIZE_MAIN=15000
Expand Down
1 change: 1 addition & 0 deletions tests/sys/fido2_ctap_hid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ BOARD ?= nrf52840dk
include ../Makefile.tests_common

USEMODULE += fido2_ctap_transport_hid
USEMODULE += ztimer_sec
USEPKG += fido2_tests

USB_VID ?= $(USB_VID_TESTING)
Expand Down
4 changes: 2 additions & 2 deletions tests/sys/fido2_ctap_hid/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_SEC, 3);
fido2_ctap_transport_init();
}

0 comments on commit 65efa59

Please sign in to comment.