Skip to content

Commit aa0d319

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

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[32] = {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;
@@ -77,6 +93,8 @@ int main(int argc, char **argv)
7793
print_stderr("-=-=-=-=-=-=-\nDecode %s\n=-=-=-=-=-=-=\n", argv[argn]);
7894

7995
while (tell != tot_data && (err = x509_import_pem_filehandle(f, &cert[n])) == CRYPT_OK) {
96+
if (cert[n] && cert[n]->asn1)
97+
s_der_print_flexi(cert[n]->asn1);
8098
if (f != stdin) {
8199
tell = ftell(f);
82100
print_stderr("len: %ld - tot: %ld - processed: %lu\n", tell, tot_data, processed);

0 commit comments

Comments
 (0)