Skip to content

Commit 0cf71d9

Browse files
rettichschnididkalowsk
authored andcommitted
samples: drivers: crypto: Make clang-format happy
Without this, check_compliance.py suggests to run clang-format on the changed code lines. Signed-off-by: Reto Schneider <[email protected]>
1 parent 09dc9dc commit 0cf71d9

File tree

1 file changed

+26
-38
lines changed
  • samples/drivers/crypto/src

1 file changed

+26
-38
lines changed

samples/drivers/crypto/src/main.c

Lines changed: 26 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,16 @@ LOG_MODULE_REGISTER(main);
4040
/* Some crypto drivers require IO buffers to be aligned, i.e. due to underlying DMA requirements. */
4141
#define IO_ALIGNMENT_BYTES 4
4242

43-
const static uint8_t key[16] __aligned(IO_ALIGNMENT_BYTES) = {
44-
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88,
45-
0x09, 0xcf, 0x4f, 0x3c
46-
};
43+
const static uint8_t key[16]
44+
__aligned(IO_ALIGNMENT_BYTES) = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
45+
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c};
4746

4847
static uint8_t plaintext[64] __aligned(IO_ALIGNMENT_BYTES) = {
49-
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11,
50-
0x73, 0x93, 0x17, 0x2a, 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
51-
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, 0x30, 0xc8, 0x1c, 0x46,
52-
0xa3, 0x5c, 0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
53-
0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b,
54-
0xe6, 0x6c, 0x37, 0x10
55-
};
48+
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73,
49+
0x93, 0x17, 0x2a, 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 0x9e, 0xb7,
50+
0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4,
51+
0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, 0xf6, 0x9f, 0x24, 0x45,
52+
0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10};
5653

5754
uint32_t cap_flags;
5855

@@ -122,14 +119,12 @@ void ecb_mode(const struct device *dev)
122119
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
123120
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
124121
};
125-
uint8_t ecb_plaintext[16] __aligned(IO_ALIGNMENT_BYTES) = {
126-
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
127-
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
128-
};
129-
uint8_t ecb_ciphertext[16] __aligned(IO_ALIGNMENT_BYTES) = {
130-
0x69, 0xC4, 0xE0, 0xD8, 0x6A, 0x7B, 0x04, 0x30,
131-
0xD8, 0xCD, 0xB7, 0x80, 0x70, 0xB4, 0xC5, 0x5A
132-
};
122+
uint8_t ecb_plaintext[16]
123+
__aligned(IO_ALIGNMENT_BYTES) = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
124+
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF};
125+
uint8_t ecb_ciphertext[16]
126+
__aligned(IO_ALIGNMENT_BYTES) = {0x69, 0xC4, 0xE0, 0xD8, 0x6A, 0x7B, 0x04, 0x30,
127+
0xD8, 0xCD, 0xB7, 0x80, 0x70, 0xB4, 0xC5, 0x5A};
133128

134129
uint8_t encrypted[16] __aligned(IO_ALIGNMENT_BYTES) = {0};
135130
uint8_t decrypted[16] __aligned(IO_ALIGNMENT_BYTES) = {0};
@@ -392,13 +387,11 @@ static uint8_t ccm_hdr[8] = {
392387
};
393388
static uint8_t ccm_data[23] __aligned(IO_ALIGNMENT_BYTES) = {
394389
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
395-
0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e
396-
};
397-
static const uint8_t ccm_expected[31] = {
398-
0x58, 0x8c, 0x97, 0x9a, 0x61, 0xc6, 0x63, 0xd2, 0xf0, 0x66, 0xd0, 0xc2,
399-
0xc0, 0xf9, 0x89, 0x80, 0x6d, 0x5f, 0x6b, 0x61, 0xda, 0xc3, 0x84, 0x17,
400-
0xe8, 0xd1, 0x2c, 0xfd, 0xf9, 0x26, 0xe0
401-
};
390+
0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e};
391+
static const uint8_t ccm_expected[31] = {0x58, 0x8c, 0x97, 0x9a, 0x61, 0xc6, 0x63, 0xd2,
392+
0xf0, 0x66, 0xd0, 0xc2, 0xc0, 0xf9, 0x89, 0x80,
393+
0x6d, 0x5f, 0x6b, 0x61, 0xda, 0xc3, 0x84, 0x17,
394+
0xe8, 0xd1, 0x2c, 0xfd, 0xf9, 0x26, 0xe0};
402395

403396
void ccm_mode(const struct device *dev)
404397
{
@@ -503,19 +496,14 @@ static uint8_t gcm_hdr[20] = {
503496
0x88, 0xe5, 0x4c, 0x2a, 0x76, 0xd4, 0x57, 0xed
504497
};
505498
static uint8_t gcm_data[42] __aligned(IO_ALIGNMENT_BYTES) = {
506-
0x08, 0x00, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
507-
0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24,
508-
0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
509-
0x31, 0x32, 0x33, 0x34, 0x00, 0x04
510-
};
499+
0x08, 0x00, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a,
500+
0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
501+
0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x00, 0x04};
511502
static const uint8_t gcm_expected[58] = {
512-
0x13, 0xb4, 0xc7, 0x2b, 0x38, 0x9d, 0xc5, 0x01, 0x8e, 0x72, 0xa1, 0x71,
513-
0xdd, 0x85, 0xa5, 0xd3, 0x75, 0x22, 0x74, 0xd3, 0xa0, 0x19, 0xfb, 0xca,
514-
0xed, 0x09, 0xa4, 0x25, 0xcd, 0x9b, 0x2e, 0x1c, 0x9b, 0x72, 0xee, 0xe7,
515-
0xc9, 0xde, 0x7d, 0x52, 0xb3, 0xf3,
516-
0xd6, 0xa5, 0x28, 0x4f, 0x4a, 0x6d, 0x3f, 0xe2, 0x2a, 0x5d, 0x6c, 0x2b,
517-
0x96, 0x04, 0x94, 0xc3
518-
};
503+
0x13, 0xb4, 0xc7, 0x2b, 0x38, 0x9d, 0xc5, 0x01, 0x8e, 0x72, 0xa1, 0x71, 0xdd, 0x85, 0xa5,
504+
0xd3, 0x75, 0x22, 0x74, 0xd3, 0xa0, 0x19, 0xfb, 0xca, 0xed, 0x09, 0xa4, 0x25, 0xcd, 0x9b,
505+
0x2e, 0x1c, 0x9b, 0x72, 0xee, 0xe7, 0xc9, 0xde, 0x7d, 0x52, 0xb3, 0xf3, 0xd6, 0xa5, 0x28,
506+
0x4f, 0x4a, 0x6d, 0x3f, 0xe2, 0x2a, 0x5d, 0x6c, 0x2b, 0x96, 0x04, 0x94, 0xc3};
519507

520508
void gcm_mode(const struct device *dev)
521509
{

0 commit comments

Comments
 (0)