Skip to content

Commit 9443f59

Browse files
committed
linuxkm/linuxkm-fips-hash.c: fix overlong lines;
.wolfssl_known_macro_extras: fix lexical order.
1 parent db7a04a commit 9443f59

2 files changed

Lines changed: 37 additions & 16 deletions

File tree

.wolfssl_known_macro_extras

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,8 +1064,8 @@ __SDCC_VERSION_MAJOR
10641064
__SDCC_VERSION_MINOR
10651065
__SDCC_VERSION_PATCH
10661066
__SIZEOF_INT128__
1067-
__SIZEOF_LONG__
10681067
__SIZEOF_LONG_LONG__
1068+
__SIZEOF_LONG__
10691069
__STDC_NO_ATOMICS__
10701070
__STDC_VERSION__
10711071
__STDC__

linuxkm/linuxkm-fips-hash.c

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ int main(int argc, char **argv)
103103

104104
static const struct option long_options[] = {
105105
#define FENCEPOST_OPT_FLAG (1U << 30)
106-
#define FENCEPOST_OPT(x) { .name = #x, .has_arg = required_argument, .flag = NULL, .val = FENCEPOST_OPT_FLAG | offsetof(typeof(seg_map), x) }
106+
#define FENCEPOST_OPT(x) { .name = #x, \
107+
.has_arg = required_argument, \
108+
.flag = NULL, \
109+
.val = FENCEPOST_OPT_FLAG | offsetof(typeof(seg_map), x) }
107110
FENCEPOST_OPT(text_start),
108111
FENCEPOST_OPT(text_end),
109112
FENCEPOST_OPT(reloc_tab_start),
@@ -133,7 +136,8 @@ int main(int argc, char **argv)
133136

134137
ret = wolfCrypt_Init();
135138
if (ret < 0) {
136-
fprintf(stderr, "%s: wolfCrypt_Init() failed: %s.\n", progname, wc_GetErrorString(ret));
139+
fprintf(stderr, "%s: wolfCrypt_Init() failed: %s.\n",
140+
progname, wc_GetErrorString(ret));
137141
exit(1);
138142
}
139143

@@ -148,7 +152,8 @@ int main(int argc, char **argv)
148152
c &= ~FENCEPOST_OPT_FLAG;
149153
*((unsigned long *)((byte *)&seg_map + c)) = strtoul(optarg, &eptr, 0);
150154
if (*eptr != '\0') {
151-
fprintf(stderr, "%s: %s: supplied arg \"%s\" isn't a valid number.\n", progname, long_options[option_index].name, optarg);
155+
fprintf(stderr, "%s: %s: supplied arg \"%s\" isn't a valid number.\n",
156+
progname, long_options[option_index].name, optarg);
152157
exit(1);
153158
}
154159
continue;
@@ -223,7 +228,8 @@ int main(int argc, char **argv)
223228
(seg_map.fips_rodata_start != ~0UL) ||
224229
(seg_map.fips_rodata_end != ~0UL))
225230
{
226-
fprintf(stderr, "%s: note, ignoring explicit FIPS fenceposts because WC_USE_PIE_FENCEPOSTS_FOR_FIPS.\n", progname);
231+
fprintf(stderr, "%s: note, ignoring explicit FIPS fenceposts "
232+
"because WC_USE_PIE_FENCEPOSTS_FOR_FIPS.\n", progname);
227233
}
228234

229235
seg_map.fips_text_start = seg_map.text_start;
@@ -251,7 +257,8 @@ int main(int argc, char **argv)
251257
(seg_map.bss_start == ~0UL) ||
252258
(seg_map.bss_end == ~0UL))
253259
{
254-
fprintf(stderr, "%s: segment fencepost(s) missing. Try --help.\n", progname);
260+
fprintf(stderr, "%s: segment fencepost(s) missing. Try --help.\n",
261+
progname);
255262
exit(1);
256263
}
257264

@@ -277,13 +284,18 @@ int main(int argc, char **argv)
277284
(seg_map.reloc_tab_len_start >= seg_map.reloc_tab_len_end) ||
278285
(seg_map.reloc_tab_len_end >= (unsigned long)st.st_size))
279286
{
280-
fprintf(stderr, "%s: supplied reloc_tab fencepost(s) are out of bounds for supplied module %s with length %lu.\n", progname, mod_path, (unsigned long)st.st_size);
287+
fprintf(stderr, "%s: supplied reloc_tab fencepost(s) are out of bounds "
288+
"for supplied module %s with length %lu.\n",
289+
progname, mod_path, (unsigned long)st.st_size);
281290
exit(1);
282291
}
283292

284-
mod_map = (byte *)mmap(NULL, st.st_size, inplace ? PROT_READ | PROT_WRITE : PROT_READ, MAP_SHARED | MAP_POPULATE, mod_fd, 0);
293+
mod_map = (byte *)mmap(NULL, st.st_size,
294+
inplace ? PROT_READ | PROT_WRITE : PROT_READ,
295+
MAP_SHARED | MAP_POPULATE, mod_fd, 0);
285296
if (mod_map == MAP_FAILED) {
286-
fprintf(stderr, "%s: mmap() of %s, length %zu: %m.\n", progname, mod_path, st.st_size);
297+
fprintf(stderr, "%s: mmap() of %s, length %zu: %m.\n",
298+
progname, mod_path, st.st_size);
287299
exit(1);
288300
}
289301

@@ -313,12 +325,14 @@ int main(int argc, char **argv)
313325

314326
ret = wc_HmacInit(&hmac, NULL, INVALID_DEVID);
315327
if (ret != 0) {
316-
fprintf(stderr, "%s: wc_HmacInit() failed: %s.\n", progname, wc_GetErrorString(ret));
328+
fprintf(stderr, "%s: wc_HmacInit() failed: %s.\n",
329+
progname, wc_GetErrorString(ret));
317330
exit(1);
318331
}
319332

320333
if (seg_map.verifyCore_end - seg_map.verifyCore_start != new_verifyCore_size) {
321-
fprintf(stderr, "%s: unexpected verifyCore length %zu.\n", progname, (size_t)(seg_map.verifyCore_end - seg_map.verifyCore_start));
334+
fprintf(stderr, "%s: unexpected verifyCore length %zu.\n",
335+
progname, (size_t)(seg_map.verifyCore_end - seg_map.verifyCore_start));
322336
ret = -1;
323337
goto out;
324338
}
@@ -338,16 +352,22 @@ int main(int argc, char **argv)
338352
&reloc_counts);
339353

340354
if (ret < 0) {
341-
fprintf(stderr, "%s: wc_fips_generate_hash() failed: %s.\n", progname, wc_GetErrorString(ret));
355+
fprintf(stderr, "%s: wc_fips_generate_hash() failed: %s.\n",
356+
progname, wc_GetErrorString(ret));
342357
goto out;
343358
}
344359

345360
if (verbose)
346-
fprintf(inplace ? stdout : stderr, "FIPS-bounded relocation normalizations: text=%d, rodata=%d, rwdata=%d, bss=%d, other=%d\n",
347-
reloc_counts.text, reloc_counts.rodata, reloc_counts.rwdata, reloc_counts.bss, reloc_counts.other);
361+
fprintf(inplace ? stdout : stderr,
362+
"FIPS-bounded relocation normalizations: text=%d, rodata=%d, "
363+
"rwdata=%d, bss=%d, other=%d\n",
364+
reloc_counts.text, reloc_counts.rodata, reloc_counts.rwdata,
365+
reloc_counts.bss, reloc_counts.other);
348366

349367
if (new_verifyCore_size < sizeof new_verifyCore) {
350-
fprintf(stderr, "%s: wc_fips_generate_hash() returned unexpected verifyCore length %u.\n", progname, new_verifyCore_size);
368+
fprintf(stderr, "%s: wc_fips_generate_hash() returned unexpected "
369+
"verifyCore length %u.\n",
370+
progname, new_verifyCore_size);
351371
ret = -1;
352372
goto out;
353373
}
@@ -359,7 +379,8 @@ int main(int argc, char **argv)
359379
fprintf(stderr, "%s: note, verifyCore already matches.\n", progname);
360380
}
361381
else if (inplace) {
362-
XMEMCPY((void *)seg_map.verifyCore_start, new_verifyCore, new_verifyCore_size);
382+
XMEMCPY((void *)seg_map.verifyCore_start, new_verifyCore,
383+
new_verifyCore_size);
363384
ret = munmap(mod_map, st.st_size);
364385
if (ret < 0) {
365386
fprintf(stderr, "%s: munmap: %m\n", progname);

0 commit comments

Comments
 (0)