Skip to content

Commit

Permalink
[clean] clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
lpascal-ledger committed Nov 4, 2024
1 parent 9c2bc4e commit e8150eb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
11 changes: 8 additions & 3 deletions src/ctap2/get_assertion/get_assertion.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ static void nfc_handle_get_assertion() {
// the first one & the number of compatible credentials, so that the client is able then to
// call getNextAssertion to fetch other possible credentials.
uint16_t slotIdx;
ctap2AssertData->availableCredentials = rk_build_RKList_from_rpID(ctap2AssertData->rpIdHash);
ctap2AssertData->availableCredentials =
rk_build_RKList_from_rpID(ctap2AssertData->rpIdHash);
if (ctap2AssertData->availableCredentials > 1) {
// This settings will disable the app_nbgl_status call (nothing displayed on SK)
// Else, this would lead the app to respond too slowly, and the client to bug out
Expand All @@ -270,7 +271,10 @@ static void nfc_handle_get_assertion() {
&ctap2AssertData->nonce,
&ctap2AssertData->credential,
&ctap2AssertData->credentialLen);
PRINTF("Go for index %d - %.*H\n", slotIdx, ctap2AssertData->credentialLen, ctap2AssertData->credential);
PRINTF("Go for index %d - %.*H\n",
slotIdx,
ctap2AssertData->credentialLen,
ctap2AssertData->credential);
get_assertion_send();
}
}
Expand Down Expand Up @@ -352,7 +356,8 @@ void ctap2_get_assertion_handle(u2f_service_t *service, uint8_t *buffer, uint16_
} else {
// Look for a potential rk entry if no allow list was provided
if (!ctap2AssertData->allowListPresent) {
ctap2AssertData->availableCredentials = rk_build_RKList_from_rpID(ctap2AssertData->rpIdHash);
ctap2AssertData->availableCredentials =
rk_build_RKList_from_rpID(ctap2AssertData->rpIdHash);
if (ctap2AssertData->availableCredentials == 1) {
// Single resident credential load it to go through the usual flow
PRINTF("Single resident credential\n");
Expand Down
2 changes: 0 additions & 2 deletions src/ctap2/get_assertion/get_assertion_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ void get_assertion_ux(ctap2_ux_state_t state) {
#endif

switch (state) {

// Only one possible credential
case CTAP2_UX_STATE_GET_ASSERTION: {
ux_display_user_assertion(g.buffer2_65);
Expand Down Expand Up @@ -447,7 +446,6 @@ void get_assertion_ux(ctap2_ux_state_t state) {
break;
}
default: {

// No credential possible
#if defined(HAVE_BAGL)
ux_flow_init(0, ux_ctap2_no_assertion_flow, NULL);
Expand Down
14 changes: 5 additions & 9 deletions src/ctap2/get_assertion/get_assertion_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@
#define TAG_RESP_USER 0x04
#define TAG_RESP_NB_OF_CREDS 0x05


static int compute_hmacSecret_output(uint8_t **output,
uint32_t *outputLen,
uint8_t *credRandom) {
static int compute_hmacSecret_output(uint8_t **output, uint32_t *outputLen, uint8_t *credRandom) {
ctap2_assert_data_t *ctap2AssertData = globals_get_ctap2_assert_data();
cbipDecoder_t decoder;
cbipItem_t mapItem, tmpItem;
Expand Down Expand Up @@ -409,7 +406,6 @@ static int build_and_encode_getAssertion_response(uint8_t *buffer,
return encoder.offset;
}


int handle_allowList_item(cbipDecoder_t *decoder, cbipItem_t *item, bool unwrap) {
ctap2_assert_data_t *ctap2AssertData = globals_get_ctap2_assert_data();
int status;
Expand Down Expand Up @@ -513,10 +509,10 @@ void get_assertion_credential_idx(uint16_t idx) {
}
ctap2AssertData->multipleFlowData.allowList.currentCredential++;

status = handle_allowList_item(
&decoder,
&ctap2AssertData->multipleFlowData.allowList.credentialItem,
false);
status =
handle_allowList_item(&decoder,
&ctap2AssertData->multipleFlowData.allowList.credentialItem,
false);
if (status == ERROR_INVALID_CREDENTIAL) {
// Just ignore this credential
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/ctap2/rk_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ typedef struct __attribute__((__packed__)) rk_header_s {
uint16_t idx; // used as "age" (increases only)
} rk_header_t;

#define SLOT_SIZE 256
#define SLOT_SIZE 256
// Currently 24 on all devices, except NanoS which only allows 8
#define CREDENTIAL_MAX_NUMBER (RK_SIZE / SLOT_SIZE)
#define CREDENTIAL_MAX_SIZE (SLOT_SIZE - sizeof(rk_header_t))
Expand Down
1 change: 0 additions & 1 deletion src/globals.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ static void ctap2_display_copy_username(const char *name, uint8_t nameLength) {

static void ctap2_display_copy_rp(const char *name, uint8_t nameLength) {
copy_name_in_buffer65(g.buffer1_65, name, nameLength);

}

void ctap2_copy_info_on_buffers(void) {
Expand Down

0 comments on commit e8150eb

Please sign in to comment.