Skip to content

Commit 3b6d151

Browse files
committed
clang-format and clang-scan fixes
Signed-off-by: Stephan Mueller <smueller@chronox.de>
1 parent c201a91 commit 3b6d151

File tree

5 files changed

+66
-65
lines changed

5 files changed

+66
-65
lines changed

apps/src/lc_x509_generator_checker.c

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,16 @@ int apply_checks_x509(const struct lc_x509_certificate *x509,
171171
}
172172

173173
if (parsed_opts->issuer_cn) {
174-
struct lc_x509_certificate_name search_name = {
175-
.cn = {
176-
.value = parsed_opts->issuer_cn,
177-
.size = (uint8_t)strlen(parsed_opts->issuer_cn),
178-
}
179-
};
174+
struct lc_x509_certificate_name
175+
search_name = { .cn = {
176+
.value = parsed_opts->issuer_cn,
177+
.size = (uint8_t)strlen(
178+
parsed_opts->issuer_cn),
179+
} };
180180

181181
if (lc_x509_policy_cert_subject_match(
182-
x509, &search_name,
183-
lc_x509_policy_cert_subject_match_issuer_only) ==
182+
x509, &search_name,
183+
lc_x509_policy_cert_subject_match_issuer_only) ==
184184
LC_X509_POL_FALSE) {
185185
printf("Issuers mismatch, expected %s, actual %s\n",
186186
parsed_opts->issuer_cn, x509->issuer);
@@ -190,16 +190,17 @@ int apply_checks_x509(const struct lc_x509_certificate *x509,
190190
}
191191
}
192192
if (parsed_opts->subject_cn) {
193-
struct lc_x509_certificate_name search_name = {
194-
.cn = {
195-
.value = parsed_opts->subject_cn,
196-
.size = (uint8_t)strlen(parsed_opts->subject_cn),
197-
}
198-
};
193+
struct lc_x509_certificate_name
194+
search_name = { .cn = {
195+
.value =
196+
parsed_opts->subject_cn,
197+
.size = (uint8_t)strlen(
198+
parsed_opts->subject_cn),
199+
} };
199200

200201
if (lc_x509_policy_cert_subject_match(
201-
x509, &search_name,
202-
lc_x509_policy_cert_subject_match_dn_only) ==
202+
x509, &search_name,
203+
lc_x509_policy_cert_subject_match_dn_only) ==
203204
LC_X509_POL_FALSE) {
204205
printf("Subject mismatch, expected %s, actual %s\n",
205206
parsed_opts->subject_cn, x509->subject);
@@ -245,16 +246,17 @@ int apply_checks_x509(const struct lc_x509_certificate *x509,
245246
}
246247

247248
if (parsed_opts->san_dns) {
248-
struct lc_x509_certificate_name search_name = {
249-
.cn = {
250-
.value = parsed_opts->subject_cn,
251-
.size = (uint8_t)strlen(parsed_opts->subject_cn),
252-
}
253-
};
249+
struct lc_x509_certificate_name
250+
search_name = { .cn = {
251+
.value =
252+
parsed_opts->san_dns,
253+
.size = (uint8_t)strlen(
254+
parsed_opts->san_dns),
255+
} };
254256

255257
if (lc_x509_policy_cert_subject_match(
256-
x509, &search_name,
257-
lc_x509_policy_cert_subject_match_san_dns_only) ==
258+
x509, &search_name,
259+
lc_x509_policy_cert_subject_match_san_dns_only) ==
258260
LC_X509_POL_FALSE) {
259261
printf("SAN DNS: names mismatch (expected %s, actual %s)\n",
260262
parsed_opts->san_dns, x509->san_dns);
@@ -264,16 +266,16 @@ int apply_checks_x509(const struct lc_x509_certificate *x509,
264266
}
265267
}
266268
if (parsed_opts->san_ip) {
267-
struct lc_x509_certificate_name search_name = {
268-
.cn = {
269-
.value = parsed_opts->san_ip,
270-
.size = (uint8_t)strlen(parsed_opts->san_ip),
271-
}
272-
};
269+
struct lc_x509_certificate_name
270+
search_name = { .cn = {
271+
.value = parsed_opts->san_ip,
272+
.size = (uint8_t)strlen(
273+
parsed_opts->san_ip),
274+
} };
273275

274276
if (lc_x509_policy_cert_subject_match(
275-
x509, &search_name,
276-
lc_x509_policy_cert_subject_match_issuer_only) ==
277+
x509, &search_name,
278+
lc_x509_policy_cert_subject_match_issuer_only) ==
277279
LC_X509_POL_FALSE) {
278280
char buf[33] = { 0 };
279281

asn1/api/lc_x509_parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ enum lc_x509_policy_cert_subject_match_flag {
10931093
*
10941094
* @param [in] cert Reference to the certificate to be validated
10951095
* @param [in] search_name Search information
1096-
* @param [in] flags Flags for the search process
1096+
* @param [in] flag Flags for the search process
10971097
*
10981098
* @return 0 on success, < 0 on error
10991099
*/

asn1/src/x509_policies.c

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ static lc_x509_pol_ret_t lc_x509_policy_cert_name_one(
461461
const struct lc_x509_certificate_name_component *search_name)
462462
{
463463
/* If the search is empty, we have a match */
464-
if (!search_name || !search_name->size || ! search_name->value)
464+
if (!search_name || !search_name->size || !search_name->value)
465465
return LC_X509_POL_TRUE;
466466

467467
/* As the caller searches for the name, require it being present */
@@ -488,24 +488,22 @@ static lc_x509_pol_ret_t lc_x509_policy_cert_name_match(
488488
&search_name->email);
489489
if (ret_pol == LC_X509_POL_FALSE)
490490
return LC_X509_POL_FALSE;
491-
ret_pol = lc_x509_policy_cert_name_one(&cert_name->cn,
492-
&search_name->cn);
491+
ret_pol =
492+
lc_x509_policy_cert_name_one(&cert_name->cn, &search_name->cn);
493493
if (ret_pol == LC_X509_POL_FALSE)
494494
return LC_X509_POL_FALSE;
495-
ret_pol = lc_x509_policy_cert_name_one(&cert_name->ou,
496-
&search_name->ou);
495+
ret_pol =
496+
lc_x509_policy_cert_name_one(&cert_name->ou, &search_name->ou);
497497
if (ret_pol == LC_X509_POL_FALSE)
498498
return LC_X509_POL_FALSE;
499-
ret_pol = lc_x509_policy_cert_name_one(&cert_name->o,
500-
&search_name->o);
499+
ret_pol = lc_x509_policy_cert_name_one(&cert_name->o, &search_name->o);
501500
if (ret_pol == LC_X509_POL_FALSE)
502501
return LC_X509_POL_FALSE;
503-
ret_pol = lc_x509_policy_cert_name_one(&cert_name->st,
504-
&search_name->st);
502+
ret_pol =
503+
lc_x509_policy_cert_name_one(&cert_name->st, &search_name->st);
505504
if (ret_pol == LC_X509_POL_FALSE)
506505
return LC_X509_POL_FALSE;
507-
ret_pol = lc_x509_policy_cert_name_one(&cert_name->c,
508-
&search_name->c);
506+
ret_pol = lc_x509_policy_cert_name_one(&cert_name->c, &search_name->c);
509507
if (ret_pol == LC_X509_POL_FALSE)
510508
return LC_X509_POL_FALSE;
511509

@@ -519,14 +517,14 @@ static lc_x509_pol_ret_t lc_x509_policy_cert_subject_match_san_ip(
519517
if (cert->san_ip_len && cert->san_ip) {
520518
uint8_t ip[16];
521519
size_t ip_len;
522-
int ret = lc_x509_enc_san_ip(search_name->cn.value, ip,
523-
&ip_len);
520+
int ret =
521+
lc_x509_enc_san_ip(search_name->cn.value, ip, &ip_len);
524522

525523
if (ret)
526524
return ret;
527525
if (!lc_memcmp_secure(ip, ip_len, cert->san_ip,
528526
cert->san_ip_len))
529-
return LC_X509_POL_TRUE;
527+
return LC_X509_POL_TRUE;
530528
}
531529

532530
return LC_X509_POL_FALSE;
@@ -558,24 +556,24 @@ LC_INTERFACE_FUNCTION(lc_x509_pol_ret_t, lc_x509_policy_cert_subject_match,
558556
* Check whether the SAN matches and if so, we are good,
559557
* otherwise fall through to the DN check.
560558
*/
561-
if (lc_x509_policy_cert_subject_match_san_dns(cert, search_name) ==
562-
LC_X509_POL_TRUE)
559+
if (lc_x509_policy_cert_subject_match_san_dns(
560+
cert, search_name) == LC_X509_POL_TRUE)
563561
return LC_X509_POL_TRUE;
564562

565-
if (lc_x509_policy_cert_subject_match_san_ip(cert, search_name) ==
566-
LC_X509_POL_TRUE)
563+
if (lc_x509_policy_cert_subject_match_san_ip(
564+
cert, search_name) == LC_X509_POL_TRUE)
567565
return LC_X509_POL_TRUE;
568566

569567
if (lc_x509_policy_cert_name_match(
570-
&cert->san_directory_name_segments, search_name) ==
568+
&cert->san_directory_name_segments, search_name) ==
571569
LC_X509_POL_TRUE)
572570
return LC_X509_POL_TRUE;
573571

574572
fallthrough;
575573
case lc_x509_policy_cert_subject_match_dn_only:
576574
/* Check whether the DN matches */
577-
return lc_x509_policy_cert_name_match(
578-
&cert->subject_segments, search_name);
575+
return lc_x509_policy_cert_name_match(&cert->subject_segments,
576+
search_name);
579577

580578
case lc_x509_policy_cert_subject_match_san_ip_only:
581579
/* Check whether the SAN IP matches */

internal/src/cpufeatures_x86.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ LC_INTERFACE_FUNCTION(enum lc_cpu_features, lc_cpu_feature_available, void)
128128
#if defined(_MSC_VER) && !defined(__clang__)
129129
xcr0 = _xgetbv(0);
130130
#else
131-
__asm__ ("xgetbv" : "=a" (xcr0) : "c" (0) : "%edx");
131+
__asm__("xgetbv" : "=a"(xcr0) : "c"(0) : "%edx");
132132
#endif
133133
}
134134

@@ -142,7 +142,7 @@ LC_INTERFACE_FUNCTION(enum lc_cpu_features, lc_cpu_feature_available, void)
142142

143143
/* YMM registers are accessible */
144144
if ((ebx & LC_INTEL_AVX2_PREREQ2) ==
145-
LC_INTEL_AVX2_PREREQ2)
145+
LC_INTEL_AVX2_PREREQ2)
146146
feat |= LC_CPU_FEATURE_INTEL_AVX2;
147147
if (x86_64_cpuid[2] & LC_INTEL_PCLMUL_ECX &&
148148
ecx & LC_INTEL_VPCLMUL_ECX)

internal/src/status.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,15 @@ LC_INTERFACE_FUNCTION(int, lc_status, char *outbuf, size_t outlen)
145145
#ifdef LC_CURVE448
146146
" Curve448: %s\n"
147147
#endif
148-
" GF: %s%s%s\n"
149-
,
148+
" GF: %s%s%s\n",
150149
fips140_mode_enabled() ? "yes" : "no"
151150

152151
/* AES */
153152
#ifdef LC_AES
154153
,
155154
(lc_aes_aesni && lc_aes_aesni != lc_aes_c) ? "AESNI " : "",
156155
(lc_aes_armce && lc_aes_armce != lc_aes_c) ? "ARMv8-CE " : "",
157-
(lc_aes_riscv64 && lc_aes_riscv64 != lc_aes_c) ?
158-
"RISCV64 " : ""
156+
(lc_aes_riscv64 && lc_aes_riscv64 != lc_aes_c) ? "RISCV64 " : ""
159157
#endif
160158

161159
/* SHA2-256 */
@@ -304,17 +302,20 @@ LC_INTERFACE_FUNCTION(int, lc_status, char *outbuf, size_t outlen)
304302
""
305303
#endif /* LC_CURVE448 */
306304

307-
/* GF */
305+
/* GF */
308306
,
309307
(lc_cpu_feature_available() & LC_CPU_FEATURE_INTEL_PCLMUL) ?
310-
"PCLMULQDQ " : "",
308+
"PCLMULQDQ " :
309+
"",
311310
(lc_cpu_feature_available() & LC_CPU_FEATURE_ARM_PMULL) ?
312-
"PMULL " : "",
311+
"PMULL " :
312+
"",
313313
(lc_cpu_feature_available() & LC_CPU_FEATURE_RISCV) ?
314314
(lc_cpu_feature_available() &
315315
LC_CPU_FEATURE_RISCV_ASM_ZBB) ?
316-
"RISCV64-Zbb " : "RISCV64 " : ""
317-
);
316+
"RISCV64-Zbb " :
317+
"RISCV64 " :
318+
"");
318319

319320
#ifdef __clang__
320321
#pragma GCC diagnostic pop

0 commit comments

Comments
 (0)