From f8535127a3ef7d3bd4e7effea1c1599ecc60985d Mon Sep 17 00:00:00 2001 From: job Date: Tue, 30 Aug 2022 22:48:16 +0000 Subject: [PATCH] Add ASPA regress bits --- regress/usr.sbin/rpki-client/Makefile.inc | 8 +- ...4f39b45569d458de356729cb0121400ee3616a.asa | Bin 0 -> 1720 bytes ...2c3da10ef241738cb4f5a16e6cf60ec812713d.asa | Bin 0 -> 1689 bytes ...79bafcb0252e0484708e6d45924e1e479c8636.asa | Bin 0 -> 1672 bytes ...58c33c48c28c77ff602040e02bb19f6ffd3dfd.asa | Bin 0 -> 1686 bytes .../usr.sbin/rpki-client/openssl11/Makefile | 1 + regress/usr.sbin/rpki-client/test-aspa.c | 97 ++++++++++++++++++ 7 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 regress/usr.sbin/rpki-client/aspa/2338bd30cba1ff30fe3cf930824f39b45569d458de356729cb0121400ee3616a.asa create mode 100644 regress/usr.sbin/rpki-client/aspa/5c67c85c9fbdf4daea0034480c2c3da10ef241738cb4f5a16e6cf60ec812713d.asa create mode 100644 regress/usr.sbin/rpki-client/aspa/63bbc4571294a06f5e7533166179bafcb0252e0484708e6d45924e1e479c8636.asa create mode 100644 regress/usr.sbin/rpki-client/aspa/c27f17d94c8a2f9e4c6d07e69f58c33c48c28c77ff602040e02bb19f6ffd3dfd.asa create mode 100644 regress/usr.sbin/rpki-client/test-aspa.c 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 0000000000000000000000000000000000000000..f5754d6c84b78fd228058d14f911c99f135f09fb GIT binary patch literal 1720 zcmbtUX;4#F6wZ5jNeCgajO;Xkf`DL>o4h~>ON%HXMFa;?$RHskFUY1676HXV&{*N~8rSi6^u~7=mF40`z}+LNpQqEaKV%CYczH5RJ^F z5|&hwim{T@lhWc@5_vo;O_7cP8*@632Ru-~6#yP86yYv9&jmr;KoIZ_!k34l9tK4%dbgz5TWN6#foJ&6bGaKuTI3cXK#z)MQ`_GH11J_D; z(+FVX8Z|B?ruOaprA6+>pK2U334ZxZ<8zf_9JKS^g~}f^aa+CHbw@XBXin5Oxpdsm z;*7p-BJ``jOFbL+0472Ns8R{_;~Tm5_Hs-HVuqN|He4nAtn0Sgemhau#fC+RebzUC zEq)cIJz@dOa!u@B_866s2bxaVm`0=9Uubf?a=ig#wqOASy+IHnOvwf7XMI~F7zBYp zZGhHawL+1awMFX5;V8Bx#P3fDtg9n~MPht2rAom`&3FRZDsIlSk*1AOD{?`60r$4N*GB-Dzy&+eS2B z+l+^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ysv1^KrsqD%<`QjhX+Kx(q?I02odHXgmQZ4QK+5$(d*{ zm^Eob>Jw=ypeWQn?P&j0!mIXCMRZ9Al}~j6<(y@Men*06~C)*_5FA% z1zsyMXYSZsn4FS9*;d@*}z88|Ut2kZm6yI(X6ZjE$6MZPD;GL`o2{BLqk)kDQ<6~2?gNl~fgKjaZG z|IQ&S6T}$16WwXTNVBLfj(WsN-n?eByx_IeBk#HM*qY&>`}aR;?Pqya(H4gYGuEGQ z-Da9_l4_J<7GZd*X4i|wgWpDK6Qkt^+xE|4~kwXg>Q zDJ@4#y_!d4*KDqu3V~(QnW8~jTWxblW8TID<#Az3bwgXNINgq%R8r{?7b~&vFW?xA zT`kscAHNZ4`(00L=}-c(YfgwX{7>JZRi1<-5S{CAVi{Q3c zUOh6~dUw!?ee`Fy)#Zm{qjjhO<%ycyWp5~HAIcxd%@_4vynMOiWO?((^cSl_j}_hQ z4a9zltuu+s?p}XMoZDmFoxCkJc**qGm3iC;-yfE+UbgHg-NkG>p=_1V^}YWBWvO_L literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..961793647bd0fd71233f1e0162cd1533f3f6c0e5 GIT binary patch literal 1672 zcmbtUdo>S`sR> z#R$cguocx%6WP;6r;<9yW!qRyDryyL?Qz+$Ww-Y1Kb`&Wd*1i`p7WmPJnsWB(ms;5 zO}bn9m@d%5D=?A_Vx%ZMAfURCLedUOcLO2Pcmi&601_bq z4{!<$IRi1I5@Ljd3QYlz2LS5+%?&6-99)3ThsGp=FG83@6$+LK1rpIR@s5aP(rB3o znj7n~SkRsgQ66Nmp}z*QKY-8!b%$%;eO|+52L}r|c082D=LjG-)K0{+W3y2%7v=GT z1);)V$g*RJAjh7=gZ3hB2*-}k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nN3%CCY?7ngFjPFNnD5M-ODJUg@hblRlF%wr!z#u?WOP2`BWf^w7Q zGPCZB2Hy(k>2aa;S=U;gcd%9_E+j6GKKw~h)bmLp>-t#p)<)IM>T3VvEl*0?`1ykp z>C|fn%OUY$NoopFR1CE|?x?gVSWp?P>4i5IT8)T9Gzjt(M)IhL|G84uyGoFYGtHQu;QBe6+i-TER6yfsLkZhnNG?WaEK_ zkbOn5FEZTyitY|Mc6)eMG}Qx|W&zi^fC@R3-s|WNk+>L?UTH5Ta%Uo{Jd3 za_)z)Gf+$hQt}sRAPSOl45Xxkl(fYXpvaRxgqit&-OC7%3kT*J4Q(}=(tsY&U0jL= ztB-6^3T;iB0(6w`?sR0S=hZi<_B=$$ZXPDr`}mO}dlHJJ-<%k&@bW@;Cgu{XU(y9> zeteVmu3KRt+b)x09s9aQZO#Q*?>BBvtb5xr($7fnY13a*TYCEm0!Yt158Mf*#<#X6 z6kA42UxL5tE%geR?O}D;70k@9@1#t*-Huu&^W%FrAsK$%5hK(d-v-X!J%hrMuu>9H zduOyojN$zqobKv%`89WSe-0E->J?cBXCJ*dKWchTxaLsC-c&E+%e!ud1l8Es%i3dQ z4~Hj%vl6;)tjdp6WH#9Bb1TV*bMvjncV{&C|JHwJUfi>p)9IYNX??<3`gi_l}iKirM~m6)YUeP`g~N4!-2~`+I2^Dt*-YE~ciAIx7E@jez-Y z4`HoBY>j`9>UBS$y+x=xS5oE-;XPj_22m={r%so5pv0J7mL_Q5Wvkk_I7GN&1nX9r zy2lFTym&>?Mfp^6(E23ROy-X>*4ipVPm1w_`A)r|N`*&~z%h-~RgT5;R2_ujXIX5n zz-+_g+N$B~@{#iIPqq4*JV;F6L}}s`_H~Q|;BUF^H!jW4zvES&Ot#=& + * 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; +} -- 2.20.1