Skip to content

Commit 5b9a60c

Browse files
committed
Merge branch 'maint/indent-ppdirectives'
2 parents 5a00420 + 9089537 commit 5b9a60c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+676
-672
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ IndentCaseLabels: false
1313
PenaltyReturnTypeOnItsOwnLine: 1000
1414
SpacesBeforeTrailingComments: 1
1515
IncludeBlocks: Preserve
16+
IndentPPDirectives: BeforeHash
1617
# cmocka must come after some std includes
1718
IncludeCategories:
1819
- Regex: '^(<|")cmocka'

src/atecc/atecc.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ typedef enum {
5151
// The Counter0/Counter1 values are overwritten at setup via atcab_write_config_counter().
5252
// Individual slot locking is performed at setup via atcab_lock_data_slot().
5353
#if (ATCA_ECC_CONFIG_SIZE != 128)
54-
#error "Unexpected configuration size"
54+
#error "Unexpected configuration size"
5555
#endif
5656
// clang-format off
5757
static uint8_t _configuration[ATCA_ECC_CONFIG_SIZE] = {
@@ -510,7 +510,7 @@ static ATCA_STATUS _update_kdf_key(void)
510510
UTIL_CLEANUP_32(nonce_contribution);
511511
_interface_functions->random_32_bytes(nonce_contribution);
512512
#if NONCE_NUMIN_SIZE > 32
513-
#error "size mismatch"
513+
#error "size mismatch"
514514
#endif
515515

516516
ATCA_STATUS result = _authorize_key();
@@ -695,9 +695,9 @@ static bool _read_data_slot_block(uint8_t* bytes, uint16_t slot, uint8_t block)
695695
uint8_t nonce_contribution[32] = {0};
696696
UTIL_CLEANUP_32(nonce_contribution);
697697
_interface_functions->random_32_bytes(nonce_contribution);
698-
#if NONCE_NUMIN_SIZE > 32
699-
#error "size mismatch"
700-
#endif
698+
#if NONCE_NUMIN_SIZE > 32
699+
#error "size mismatch"
700+
#endif
701701

702702
ATCA_STATUS result = _authorize_key();
703703
if (result != ATCA_SUCCESS) {
@@ -718,9 +718,9 @@ static bool _write_data_slot_block(uint8_t* bytes, uint16_t slot, uint8_t block)
718718
uint8_t nonce_contribution[32] = {0};
719719
UTIL_CLEANUP_32(nonce_contribution);
720720
_interface_functions->random_32_bytes(nonce_contribution);
721-
#if NONCE_NUMIN_SIZE > 32
722-
#error "size mismatch"
723-
#endif
721+
#if NONCE_NUMIN_SIZE > 32
722+
#error "size mismatch"
723+
#endif
724724

725725
ATCA_STATUS result = _authorize_key();
726726
if (result != ATCA_SUCCESS) {

src/bootloader/bootloader.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@
3737
#include <util.h>
3838

3939
#if defined(BOOTLOADER_DEVDEVICE) || PLATFORM_BITBOX02PLUS == 1
40-
#include <memory/memory_spi.h>
41-
#include <qtouch/qtouch.h>
40+
#include <memory/memory_spi.h>
41+
#include <qtouch/qtouch.h>
4242
#endif
4343

4444
#if PLATFORM_BITBOX02PLUS == 1
45-
#include <communication_mode.h>
46-
#include <da14531/da14531.h>
47-
#include <da14531/da14531_protocol.h>
48-
#include <uart.h>
49-
#include <utils_ringbuffer.h>
45+
#include <communication_mode.h>
46+
#include <da14531/da14531.h>
47+
#include <da14531/da14531_protocol.h>
48+
#include <uart.h>
49+
#include <utils_ringbuffer.h>
5050
#endif
5151

5252
#include <assert.h>
@@ -108,7 +108,7 @@ COMPILER_PACK_RESET()
108108
#define FIRMWARE_MAX_NUM_CHUNKS \
109109
(FLASH_APP_LEN / FIRMWARE_CHUNK_LEN) // app len must be a multiple of chunk len
110110
#if (FIRMWARE_MAX_NUM_CHUNKS > UINT8_MAX)
111-
#error "incompatible variable type"
111+
#error "incompatible variable type"
112112
#endif
113113

114114
// Be sure to not overflow boot data area
@@ -120,7 +120,7 @@ static_assert(sizeof(((boot_data_t*)0)->fields) <= FLASH_BOOTDATA_LEN, "boot_dat
120120
BOOT_SIG_LEN * BOOT_NUM_ROOT_SIGNING_KEYS + 4 /* firmware data version */ + \
121121
BOOT_SIG_LEN * BOOT_NUM_FIRMWARE_SIGNING_KEYS > \
122122
FIRMWARE_CHUNK_LEN)
123-
#error "incompatible bootloader data macro"
123+
#error "incompatible bootloader data macro"
124124
#endif
125125

126126
static bool _loading_ready = false;
@@ -142,7 +142,7 @@ static const uint8_t _empty_bare_flash_hash[SHA256_DIGEST_LENGTH] = {
142142
0x00, 0xb8, 0xaf, 0x3a, 0x79, 0xf8, 0xc6, 0x56, 0x4a, 0x9b, 0x02, 0xe1, 0x8a, 0xb8, 0x21, 0xae,
143143
};
144144
#if FLASH_APP_LEN != 884736
145-
#error "FLASH_APP_LEN changed; recompute _empty_bare_flash_hash"
145+
#error "FLASH_APP_LEN changed; recompute _empty_bare_flash_hash"
146146
#endif
147147

148148
#if PLATFORM_BITBOX02PLUS == 1
@@ -272,7 +272,7 @@ static void _binary_exec(void)
272272
int i;
273273

274274
#if (FLASH_APP_START & 0x007F)
275-
#error "app start address not aligned"
275+
#error "app start address not aligned"
276276
#else
277277
void* app_start_addr = (void*)FLASH_APP_START;
278278
#endif
@@ -1023,15 +1023,15 @@ static bool _devdevice_enter(secbool_u32 firmware_verified)
10231023
} else {
10241024
UG_PutString(0, SCREEN_HEIGHT - 9, " No firmware found", false);
10251025
}
1026-
#if PLATFORM_BITBOX02PLUS == 1
1026+
#if PLATFORM_BITBOX02PLUS == 1
10271027
struct da14531_firmware_version version;
10281028
bool res = memory_spi_get_active_ble_firmware_version(&version);
10291029
if (res) {
10301030
char buf[50];
10311031
snprintf(buf, sizeof(buf), "ble: %d (%s)", version.version, util_dbg_hex(version.hash, 4));
10321032
UG_PutString(0, SCREEN_HEIGHT - 18, buf, false);
10331033
}
1034-
#endif
1034+
#endif
10351035
uint16_t ypos = SCREEN_HEIGHT / 2 - 4;
10361036
uint16_t xpos = SCREEN_WIDTH - 10;
10371037
if (firmware_verified != sectrue_u32) {

src/bootloader/mpu_regions.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616

1717
#ifndef TESTING
1818

19-
#include <flags.h>
20-
#include <memory/mpu.h>
19+
#include <flags.h>
20+
#include <memory/mpu.h>
2121

22-
#include <core_cm4.h>
23-
#include <samd51j20a.h>
22+
#include <core_cm4.h>
23+
#include <samd51j20a.h>
2424

25-
#include <stdint.h>
25+
#include <stdint.h>
2626

2727
static void _set_mpu_regions(void)
2828
{

src/bootloader/startup.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,26 @@
2727
#include <usb/usb_processing.h>
2828

2929
#if defined(BOOTLOADER_DEVDEVICE) || PLATFORM_BITBOX02PLUS == 1
30-
#include <qtouch.h>
30+
#include <qtouch.h>
3131
#endif
3232

3333
#if PLATFORM_BITBOX02PLUS == 1
34-
#include <communication_mode.h>
35-
#include <da14531/da14531.h>
36-
#include <da14531/da14531_handler.h>
37-
#include <da14531/da14531_protocol.h>
38-
#include <memory/memory.h>
39-
#include <memory/memory_shared.h>
40-
#include <uart.h>
41-
#include <utils_ringbuffer.h>
42-
43-
#if PRODUCT_BITBOX_PLUS_MULTI == 1
44-
#define DEVICE_MODE "{\"p\":\"bb02p-bl-multi\",\"v\":\"" BOOTLOADER_VERSION "\"}"
45-
#elif PRODUCT_BITBOX_PLUS_BTCONLY == 1
46-
#define DEVICE_MODE "{\"p\":\"bb02p-bl-btconly\",\"v\":\"" BOOTLOADER_VERSION "\"}"
47-
#else
48-
#error "unknown product"
49-
#endif
34+
#include <communication_mode.h>
35+
#include <da14531/da14531.h>
36+
#include <da14531/da14531_handler.h>
37+
#include <da14531/da14531_protocol.h>
38+
#include <memory/memory.h>
39+
#include <memory/memory_shared.h>
40+
#include <uart.h>
41+
#include <utils_ringbuffer.h>
42+
43+
#if PRODUCT_BITBOX_PLUS_MULTI == 1
44+
#define DEVICE_MODE "{\"p\":\"bb02p-bl-multi\",\"v\":\"" BOOTLOADER_VERSION "\"}"
45+
#elif PRODUCT_BITBOX_PLUS_BTCONLY == 1
46+
#define DEVICE_MODE "{\"p\":\"bb02p-bl-btconly\",\"v\":\"" BOOTLOADER_VERSION "\"}"
47+
#else
48+
#error "unknown product"
49+
#endif
5050
#endif // PLATFORM_BITBOX02PLUS == 1
5151

5252
extern void __attribute__((noreturn)) __stack_chk_fail(void);
@@ -63,8 +63,8 @@ uint32_t __stack_chk_guard = 0;
6363
extern volatile bool measurement_done_touch;
6464
int bootloader_pairing_request = false;
6565
uint8_t bootloader_pairing_code_bytes[4] = {0};
66-
// Must be power of 2, must fit bond_db
67-
#define UART_OUT_BUF_LEN 2048
66+
// Must be power of 2, must fit bond_db
67+
#define UART_OUT_BUF_LEN 2048
6868
struct ringbuffer uart_write_queue;
6969
uint8_t uart_write_buf[UART_OUT_BUF_LEN];
7070
#endif

src/cipher/cipher.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <rust/rust.h>
1919

2020
#ifdef TESTING
21-
#include <fake_cipher.h>
21+
#include <fake_cipher.h>
2222
#endif
2323

2424
bool cipher_aes_hmac_encrypt(

src/da14531/da14531_handler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static void _ble_pairing_callback(bool ok, void* param)
7070
_ble_pairing_component = NULL;
7171
}
7272
#else
73-
#include <bootloader/bootloader.h>
73+
#include <bootloader/bootloader.h>
7474
extern bool bootloader_pairing_request;
7575
extern uint8_t bootloader_pairing_code_bytes[4];
7676
#endif

src/da14531/da14531_protocol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <stdlib.h>
2323
#include <utils_assert.h>
2424
#ifndef TESTING
25-
#include "dap.h"
25+
#include "dap.h"
2626
#endif
2727

2828
#include <hardfault.h>

src/firmware.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include <ui/oled/oled.h>
3131

3232
#if APP_U2F == 1
33-
#include <u2f.h>
33+
#include <u2f.h>
3434
#endif
3535

3636
uint32_t __stack_chk_guard = 0;

src/firmware_main_loop.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
#include <ui/fonts/monogram_5X9.h>
3838
#include <utils_ringbuffer.h>
3939
#if APP_U2F == 1
40-
#include "u2f.h"
41-
#include "u2f/u2f_packet.h"
42-
#include "usb/class/hid/u2f/hid_u2f.h"
40+
#include "u2f.h"
41+
#include "u2f/u2f_packet.h"
42+
#include "usb/class/hid/u2f/hid_u2f.h"
4343
#endif
4444

4545
// Must be power of 2

0 commit comments

Comments
 (0)