Skip to content

Commit 62e7ab6

Browse files
committed
Use new der_print_flexi() API
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
1 parent a163a6e commit 62e7ab6

File tree

2 files changed

+39
-349
lines changed

2 files changed

+39
-349
lines changed

demos/x509_verify.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,22 @@ static void print_err(const char *fmt, ...)
2424
#define print_stderr(...) fprintf(stderr, ##__VA_ARGS__)
2525
#endif
2626

27+
#if defined(LTC_TEST_DBG) && LTC_TEST_DBG > 1
28+
#define LTC_DER_PRINT_FLEXI_NO_MAIN
29+
#include "der_print_flexi.c"
30+
31+
static void s_der_print_flexi(const ltc_asn1_list* l)
32+
{
33+
print_stderr("\n\n");
34+
s_der_print_flexi_i(l, 0);
35+
print_stderr("\n\n");
36+
}
37+
#else
38+
static void s_der_print_flexi(const ltc_asn1_list* l)
39+
{
40+
LTC_UNUSED_PARAM(l);
41+
}
42+
#endif
2743

2844
static unsigned long num_certs;
2945
static const ltc_x509_certificate *cert[256] = {0};
@@ -68,7 +84,7 @@ int main(int argc, char **argv)
6884
if (f != stdin) {
6985
fseek(f, 0, SEEK_END);
7086
tot_data = ftell(f);
71-
rewind(f);
87+
fseek(f, 0, SEEK_SET);
7288
tell = 0;
7389
} else {
7490
tell = -1;
@@ -82,6 +98,8 @@ int main(int argc, char **argv)
8298
continue;
8399
else if (err != CRYPT_OK)
84100
break;
101+
if (cert[n] && cert[n]->asn1)
102+
s_der_print_flexi(cert[n]->asn1);
85103
if (f != stdin) {
86104
tell = ftell(f);
87105
print_stderr("%2lu len: %ld - tot: %ld - processed: %lu (%s)\n", n, tell, tot_data, processed, error_to_string(err));

0 commit comments

Comments
 (0)