From: job Date: Tue, 30 Aug 2022 22:48:16 +0000 (+0000) Subject: Add ASPA regress bits X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f8535127a3ef7d3bd4e7effea1c1599ecc60985d;p=openbsd Add ASPA regress bits --- diff --git a/regress/usr.sbin/rpki-client/Makefile.inc b/regress/usr.sbin/rpki-client/Makefile.inc index b69fb7dbda4..e35dcf67db5 100644 --- a/regress/usr.sbin/rpki-client/Makefile.inc +++ b/regress/usr.sbin/rpki-client/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.24 2022/05/09 17:20:25 job Exp $ +# $OpenBSD: Makefile.inc,v 1.25 2022/08/30 22:48:16 job Exp $ .PATH: ${.CURDIR}/../../../../usr.sbin/rpki-client @@ -10,6 +10,7 @@ PROGS += test-roa PROGS += test-rsc PROGS += test-tal PROGS += test-rrdp +PROGS += test-aspa .for p in ${PROGS} REGRESS_TARGETS += run-regress-$p @@ -59,6 +60,11 @@ SRCS_test-tal+= test-tal.c tal.c ip.c io.c log.c validate.c \ run-regress-test-tal: test-tal ./test-tal -v ${.CURDIR}/../tal/*.tal +SRCS_test-aspa+= test-aspa.c aspa.c cms.c x509.c ip.c as.c io.c log.c \ + encoding.c print.c validate.c cert.c mft.c +run-regress-test-aspa: test-aspa + ./test-aspa -v ${.CURDIR}/../aspa/*.asa + SRCS_test-rrdp+= test-rrdp.c rrdp_delta.c rrdp_notification.c \ rrdp_snapshot.c rrdp_util.c \ log.c encoding.c ip.c validate.c dummy.c x509.c diff --git a/regress/usr.sbin/rpki-client/aspa/2338bd30cba1ff30fe3cf930824f39b45569d458de356729cb0121400ee3616a.asa b/regress/usr.sbin/rpki-client/aspa/2338bd30cba1ff30fe3cf930824f39b45569d458de356729cb0121400ee3616a.asa new file mode 100644 index 00000000000..f5754d6c84b Binary files /dev/null and b/regress/usr.sbin/rpki-client/aspa/2338bd30cba1ff30fe3cf930824f39b45569d458de356729cb0121400ee3616a.asa differ diff --git a/regress/usr.sbin/rpki-client/aspa/5c67c85c9fbdf4daea0034480c2c3da10ef241738cb4f5a16e6cf60ec812713d.asa b/regress/usr.sbin/rpki-client/aspa/5c67c85c9fbdf4daea0034480c2c3da10ef241738cb4f5a16e6cf60ec812713d.asa new file mode 100644 index 00000000000..f08316f5584 Binary files /dev/null and b/regress/usr.sbin/rpki-client/aspa/5c67c85c9fbdf4daea0034480c2c3da10ef241738cb4f5a16e6cf60ec812713d.asa differ diff --git a/regress/usr.sbin/rpki-client/aspa/63bbc4571294a06f5e7533166179bafcb0252e0484708e6d45924e1e479c8636.asa b/regress/usr.sbin/rpki-client/aspa/63bbc4571294a06f5e7533166179bafcb0252e0484708e6d45924e1e479c8636.asa new file mode 100644 index 00000000000..961793647bd Binary files /dev/null and b/regress/usr.sbin/rpki-client/aspa/63bbc4571294a06f5e7533166179bafcb0252e0484708e6d45924e1e479c8636.asa differ diff --git a/regress/usr.sbin/rpki-client/aspa/c27f17d94c8a2f9e4c6d07e69f58c33c48c28c77ff602040e02bb19f6ffd3dfd.asa b/regress/usr.sbin/rpki-client/aspa/c27f17d94c8a2f9e4c6d07e69f58c33c48c28c77ff602040e02bb19f6ffd3dfd.asa new file mode 100644 index 00000000000..cbd61d598db Binary files /dev/null and b/regress/usr.sbin/rpki-client/aspa/c27f17d94c8a2f9e4c6d07e69f58c33c48c28c77ff602040e02bb19f6ffd3dfd.asa differ diff --git a/regress/usr.sbin/rpki-client/openssl11/Makefile b/regress/usr.sbin/rpki-client/openssl11/Makefile index 12c6926a12b..f9a0eae1ce2 100644 --- a/regress/usr.sbin/rpki-client/openssl11/Makefile +++ b/regress/usr.sbin/rpki-client/openssl11/Makefile @@ -29,6 +29,7 @@ SRCS_test-tal = a_time_tm_gen.c o_time.c bs_ber.c bs_cbb.c bs_cbs.c SRCS_test-bgpsec = a_time_tm_gen.c o_time.c bs_ber.c bs_cbb.c bs_cbs.c SRCS_test-rrdp = a_time_tm_gen.c o_time.c bs_ber.c bs_cbb.c bs_cbs.c SRCS_test-rsc = a_time_tm_gen.c o_time.c bs_ber.c bs_cbb.c bs_cbs.c +SRCS_test-aspa = a_time_tm_gen.c o_time.c bs_ber.c bs_cbb.c bs_cbs.c CFLAGS += -I${.CURDIR}/../../../../lib/libcrypto/ CFLAGS += -I${.CURDIR}/../../../../lib/libcrypto/bytestring diff --git a/regress/usr.sbin/rpki-client/test-aspa.c b/regress/usr.sbin/rpki-client/test-aspa.c new file mode 100644 index 00000000000..fa95eaaf437 --- /dev/null +++ b/regress/usr.sbin/rpki-client/test-aspa.c @@ -0,0 +1,97 @@ +/* $Id: test-aspa.c,v 1.1 2022/08/30 22:48:16 job Exp $ */ +/* + * Copyright (c) 2022 Job Snijders + * Copyright (c) 2019 Kristaps Dzonsons + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "extern.h" + +int outformats; +int verbose; + +int +main(int argc, char *argv[]) +{ + int c, i, ppem = 0, verb = 0; + X509 *xp = NULL; + struct aspa *p; + unsigned char *buf; + size_t len; + + ERR_load_crypto_strings(); + OpenSSL_add_all_ciphers(); + OpenSSL_add_all_digests(); + x509_init_oid(); + + while ((c = getopt(argc, argv, "pv")) != -1) + switch (c) { + case 'p': + if (ppem) + break; + ppem = 1; + break; + case 'v': + verb++; + break; + default: + errx(1, "bad argument %c", c); + } + + argv += optind; + argc -= optind; + + if (argc == 0) + errx(1, "argument missing"); + + for (i = 0; i < argc; i++) { + buf = load_file(argv[i], &len); + if ((p = aspa_parse(&xp, argv[i], buf, len)) == NULL) { + free(buf); + break; + } + if (verb) + aspa_print(xp, p); + if (ppem) { + if (!PEM_write_X509(stdout, xp)) + errx(1, "PEM_write_X509: unable to write cert"); + } + free(buf); + aspa_free(p); + X509_free(xp); + } + + EVP_cleanup(); + CRYPTO_cleanup_all_ex_data(); + ERR_free_strings(); + + if (i < argc) + errx(1, "test failed for %s", argv[i]); + + printf("OK\n"); + return 0; +}