blob: 7a39bf34bd282608d078e9bbf5603a7848834e78 [file] [log] [blame]
Lev Walkin40b8a7a2017-10-08 22:36:29 -07001ASN_PROGRAM = x509dump
2CFLAGS += -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE
3begin: Certificate.c maybe-wip-pause all
Lev Walkin60a14032004-09-23 22:02:52 +00004
Jon Ringle3016fd52017-11-15 02:06:47 -05005-include converter-example.mk
Lev Walkin60a14032004-09-23 22:02:52 +00006
Lev Walkinc33a59e2006-09-18 20:04:14 +00007Certificate.c: ../sample.makefile.regen ../rfc3280-*.asn1
Lev Walkincc7c94e2006-09-17 04:01:29 +00008 make regen-makefile
9 @touch Certificate.c
10 make
11
12regen-makefile:
Lev Walkin40b8a7a2017-10-08 22:36:29 -070013 ASN_CMDOPTS="-fcompound-names -fwide-types" \
14 ASN_MODULES="../rfc3280-*.asn1" \
15 ASN_PDU=Certificate \
16 ASN_PROGRAM=x509dump \
Lev Walkin2fd86de2006-09-13 02:10:23 +000017 ../sample.makefile.regen
Lev Walkin60a14032004-09-23 22:02:52 +000018
Lev Walkin40b8a7a2017-10-08 22:36:29 -070019check: ${ASN_PROGRAM} check-ber check-xer check-oer check-per
Lev Walkin1f12da42006-09-24 19:47:07 +000020 @echo ================
21 @echo All tests passed
22 @echo ================
23
24check-ber:
Lev Walkin13afe532006-09-18 21:30:04 +000025 @if test -f sample-Certificate-1.[db]er ; then \
Lev Walkina926fce2017-08-27 12:54:25 -070026 for f in sample-*-*.[db]er; do \
Lev Walkinad775912017-09-26 22:55:22 -070027 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin13afe532006-09-18 21:30:04 +000028 for b in 1 17 33 980 8192; do \
Lev Walkina926fce2017-08-27 12:54:25 -070029 echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070030 ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
31 ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
Lev Walkin3cd82c32007-06-26 08:37:20 +000032 diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
Lev Walkinc33a59e2006-09-18 20:04:14 +000033 rm -f ./.tmp.[12].$$$$; \
Lev Walkin1f12da42006-09-24 19:47:07 +000034 echo "Test junking $$f (please wait)..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070035 ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \
36 ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \
Lev Walkin13afe532006-09-18 21:30:04 +000037 done; done; fi
Lev Walkin1f12da42006-09-24 19:47:07 +000038
39check-xer:
Lev Walkin13afe532006-09-18 21:30:04 +000040 @if test -f sample-Certificate-1.xer ; then \
Lev Walkina926fce2017-08-27 12:54:25 -070041 for f in sample-*-*.xer; do \
Lev Walkinad775912017-09-26 22:55:22 -070042 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin13afe532006-09-18 21:30:04 +000043 for b in 1 17 33 980 8192; do \
Lev Walkina926fce2017-08-27 12:54:25 -070044 echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070045 ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
46 ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
Lev Walkin3cd82c32007-06-26 08:37:20 +000047 diff $$f ./.tmp.2.$$$$ || exit 4; \
Lev Walkinc33a59e2006-09-18 20:04:14 +000048 rm -f ./.tmp.[12].$$$$; \
Lev Walkin1f12da42006-09-24 19:47:07 +000049 echo "Test junking $$f (please wait)..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070050 ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \
51 ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \
Lev Walkin13afe532006-09-18 21:30:04 +000052 done; done; fi
Lev Walkin1f12da42006-09-24 19:47:07 +000053
Lev Walkinad775912017-09-26 22:55:22 -070054check-oer:
55 @if test -f sample-Certificate-1.*oer ; then \
56 for f in sample-*-*.*oer; do \
57 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
58 for b in 1 17 33 980 8192; do \
59 echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070060 ./${ASN_PROGRAM} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
61 ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
Lev Walkinad775912017-09-26 22:55:22 -070062 diff $$f ./.tmp.2.$$$$ || exit 4; \
63 rm -f ./.tmp.[12].$$$$; \
64 echo "Test junking $$f (please wait) ($$b) ..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070065 ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \
66 ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \
Lev Walkinad775912017-09-26 22:55:22 -070067 done; done; fi
68
Lev Walkin1f12da42006-09-24 19:47:07 +000069check-per:
Lev Walkin3cd82c32007-06-26 08:37:20 +000070 @if test -f sample-Certificate-1-nopad.per ; then \
Lev Walkina926fce2017-08-27 12:54:25 -070071 for f in sample-*-[1-9]-nopad.per; do \
Lev Walkinad775912017-09-26 22:55:22 -070072 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin13afe532006-09-18 21:30:04 +000073 for b in 1 17 33 980 8192; do \
Lev Walkina926fce2017-08-27 12:54:25 -070074 echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070075 ./${ASN_PROGRAM} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
76 ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
77 ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \
Lev Walkin3cd82c32007-06-26 08:37:20 +000078 diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
Lev Walkin13afe532006-09-18 21:30:04 +000079 rm -f ./.tmp.[123].$$$$; \
Lev Walkin1f12da42006-09-24 19:47:07 +000080 echo "Test junking $$f (please wait)..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070081 ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \
82 ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \
Lev Walkin13afe532006-09-18 21:30:04 +000083 done; done; fi
Lev Walkin3cd82c32007-06-26 08:37:20 +000084 @if test -f sample-Certificate-1.per ; then \
85 for f in sample-*-[1-9].per; do \
Lev Walkinad775912017-09-26 22:55:22 -070086 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin13afe532006-09-18 21:30:04 +000087 for b in 1 17 33 980 8192; do \
Lev Walkina926fce2017-08-27 12:54:25 -070088 echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070089 ./${ASN_PROGRAM} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \
90 ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \
91 ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \
Lev Walkin3cd82c32007-06-26 08:37:20 +000092 diff $$f ./.tmp.1.$$$$ || exit 6; \
Lev Walkin13afe532006-09-18 21:30:04 +000093 rm -f ./.tmp.[12].$$$$; \
Lev Walkin1f12da42006-09-24 19:47:07 +000094 echo "Test junking $$f (please wait)..."; \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070095 ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \
96 ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \
Lev Walkin13afe532006-09-18 21:30:04 +000097 done; done; fi
Lev Walkinc744a022006-09-15 18:33:25 +000098
Lev Walkin0c050a82017-08-27 12:39:47 -070099maybe-wip-pause:
100 @if [ -f WIP ]; then cat WIP; sleep 2; fi
101
Lev Walkin60a14032004-09-23 22:02:52 +0000102distclean: clean
Jon Ringle7871abf2017-11-13 21:29:40 -0500103 rm -f $(ASN_MODULE_SRCS)
104 rm -f $(ASN_MODULE_HDRS)
105 rm -f $(ASN_PROGRAM_SRCS) $(ASN_PROGRAM_HDRS)
Jon Ringle3016fd52017-11-15 02:06:47 -0500106 rm -f converter-example.mk