From 4992a925d0aa159555aa839b4d09019c8d7064ef Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Thu, 13 Dec 2001 21:51:30 +0000 Subject: [PATCH] 2001-12-13 Marcus Brinkmann * gpgsm/cert_dfn_pca01.der: New file. * gpgsm/cert_dfn_pca15.der: Likewise. * gpgsm/cert_g10code_test1.der: Likewise. * gpgsm/t-import.c: Likewise. * gpgsm/Makefile.am (EXTRADIST): Add new files. (TESTS): Add t-import. --- trunk/tests/ChangeLog | 9 ++ trunk/tests/gpgsm/Makefile.am | 4 +- trunk/tests/gpgsm/cert_dfn_pca01.der | Bin 0 -> 1224 bytes trunk/tests/gpgsm/cert_dfn_pca15.der | Bin 0 -> 1560 bytes trunk/tests/gpgsm/cert_g10code_test1.der | Bin 0 -> 793 bytes trunk/tests/gpgsm/t-import.c | 104 +++++++++++++++++++++++ 6 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 trunk/tests/gpgsm/cert_dfn_pca01.der create mode 100644 trunk/tests/gpgsm/cert_dfn_pca15.der create mode 100644 trunk/tests/gpgsm/cert_g10code_test1.der create mode 100644 trunk/tests/gpgsm/t-import.c diff --git a/trunk/tests/ChangeLog b/trunk/tests/ChangeLog index 61f67f9..897885a 100644 --- a/trunk/tests/ChangeLog +++ b/trunk/tests/ChangeLog @@ -1,3 +1,12 @@ +2001-12-13 Marcus Brinkmann + + * gpgsm/cert_dfn_pca01.der: New file. + * gpgsm/cert_dfn_pca15.der: Likewise. + * gpgsm/cert_g10code_test1.der: Likewise. + * gpgsm/t-import.c: Likewise. + * gpgsm/Makefile.am (EXTRADIST): Add new files. + (TESTS): Add t-import. + 2001-11-22 Marcus Brinkmann * gpg/: New directory. diff --git a/trunk/tests/gpgsm/Makefile.am b/trunk/tests/gpgsm/Makefile.am index 4419031..89d5467 100644 --- a/trunk/tests/gpgsm/Makefile.am +++ b/trunk/tests/gpgsm/Makefile.am @@ -22,9 +22,9 @@ TESTS_ENVIRONMENT = GNUPGHOME=. -TESTS = +TESTS = t-import -#EXTRA_DIST = +EXTRA_DIST = cert_dfn_pca01.der cert_dfn_pca15.der cert_g10code_test1.der INCLUDES = -I$(top_srcdir)/gpgme diff --git a/trunk/tests/gpgsm/cert_dfn_pca01.der b/trunk/tests/gpgsm/cert_dfn_pca01.der new file mode 100644 index 0000000000000000000000000000000000000000..f8b61d339cc47f9028b5dc7b5709b57042ca891a GIT binary patch literal 1224 zcmXqLVmV^a#Jpw!GZP~d6Cdm#~COYH3Mvaz<*gf?IwOkWreKUYwU&Qe`M$zz0&oEzIuX=BFFr>}aTGpaT+N z7FGp{D1_t}DEOq7rRFF&rxulDre!84mSpDVDL9svWaJlRmQ;c*fw_W{QA{Wqtgh0b zAURPlB`r@cCDlMqoXgU}(7?#j(89pj&>%{j%fQgk$k-6d9klLlVpKv7Vn$X5<|amd z27@L>E~X|%MushUHzs|pzwzt(tPY90hhKdt&b~Zl_MQV}n}d%T6&+U2+_>CP*2F_r zxJK){K9|+AbHOQ_tv4PJe{)-?jO*Ork8eMgxV*3R5nrbLU#PCxQ~2tYpC?2fQ^#r}<{ZpE(;YZ*mapY>i>icscQq z)clTjCI1>P+hmu0ug^WvVtTw|!v3r|f23b(yiU;+dvo0K{zTu+Q{u09yU%|jHf7Gm zD}nF5I1Jue6~5dQa((NDHLeO`Tb?s9GcqtPZeo-MhKRUFeiK7MElu>mibezJVh`DF=&*m=Q=RP-S^}IkGZff&yyN zFUZfyOs)h;LRfkkCAm2U76>D_ShU47Lo!koh)Tl-iU^&|EF!=(oSvx<%q_{;x<#pF zdO)7Nfh0l+3k#1J7sMrc$wfH^{J{JoE6m9FpM}+c8Aus$g9P}&VZer*fPi@vn1C1= z6cXa1tt?`iQ_ZJ~AJm$v`ZlmtYKybImHscUEk|Dqc7~-N@7`D*Fg2As%(y7= N`o<=IH_=T~ngQcOx!V8$ literal 0 HcmV?d00001 diff --git a/trunk/tests/gpgsm/cert_dfn_pca15.der b/trunk/tests/gpgsm/cert_dfn_pca15.der new file mode 100644 index 0000000000000000000000000000000000000000..8d96650653bba1b4b41886f1f2bd8e332ec30173 GIT binary patch literal 1560 zcmXqLViPfFV)?UxnTe5!iBZ&mi;YvO&79)&ShX=XlP($Xl7z=WD*7B8X6iI8yH#`06~;N<0LA$TiZYr;%+67 zyMt4U%2JCcadZ=-5_0%5vNA9?G4eAQG%<29H8CPGAGQ`aI&S84_> zJ$GZ*$?ey^M0(`@Ibz8Ds^qI=?83<=Yj0hXwXe~gJ6*5gpOZ%B!@t7iZ12o^4Lg@URjS}x2n9GBP3 zyeNB_v&^6#BrVTUVNhmZxxjpZX`69INlAf~zJ7UmxgH`N=>wA!kf#q#Vfw|zIZz?J zN|4VWEWM19+#Fz{VnGnSgep) zTwI!(qL5UnP?C|V0L`;HU=A>=a^cOY3i)YZh3=_ExruoSL8-;5iABj7Tz;t~<@rU~ z3L3ad2_29{ntEIzKr6FTD;4s~^HPh{fsRQ@%_{+x0brLU0!suC7v$6wh0Hvz#N_1s zqLjqEWT4A4OEO>%RtV28%1KcO2WnObPfbz?00)SULK(2+F;GN=0yB#UurNu_)CU$@ z$=SL^sbzXVo;`A&1eSTgJjuwgF~(W*cT%r98pr=DO7xZ>F+IM-&b(DhvUxUeLJof0|2UKDhvPs literal 0 HcmV?d00001 diff --git a/trunk/tests/gpgsm/cert_g10code_test1.der b/trunk/tests/gpgsm/cert_g10code_test1.der new file mode 100644 index 0000000000000000000000000000000000000000..a2199d27b39d313f5a52ee04a004b2d2fcc13766 GIT binary patch literal 793 zcmXqLViq-MVyauf%*4pV#K>U4#m1@C=F#?@i; zEoPOj{LiTR5S7$p2M*3v&vR8f$I_9pe5J@=6Pv>;YOgy@{C_kxAUArq>ghFEe7YBZ z>{+$p%Az^?<|hL_Cwq8*%KY9b;^5}JzOt!~d2wFB4w1=yukR$kOi`(R9(%N#(YtO@ zAQLkq1LNYx69$b(4P=1D-YYcmKuBS;MLb99{*~T8`%FF?G)@J{E3-8A z8Z>q_U{$j)e@QM~!?p>S&Uir15@umFU}j|ej~vp#RL2Yq;+%FCxh{(px1`0>#atAk zxTaosSuQRe>7(=PwXgb)tfO4NAO8GSus>UVgHgfNwP`g?KAhG;Yh-e2Kfh4UP^p{p z&;P%orS;*%Z;e-ecrhb2X2U=3b&j1sR=!d%Q@avyC{9KFxBqha{g0FNCh2|(39e&t TY_*$Y)p{wdJ@E7ANE=B2c=iHE literal 0 HcmV?d00001 diff --git a/trunk/tests/gpgsm/t-import.c b/trunk/tests/gpgsm/t-import.c new file mode 100644 index 0000000..b0f8c36 --- /dev/null +++ b/trunk/tests/gpgsm/t-import.c @@ -0,0 +1,104 @@ +/* t-import.c - regression test + * Copyright (C) 2000 Werner Koch + * Copyright (C) 2001 g10 Code GmbH + * + * This file is part of GPGME. + * + * GPGME is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GPGME is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include + +#include + + +#define fail_if_err(a) do { if(a) { int my_errno = errno; \ + fprintf (stderr, "%s:%d: GpgmeError %s\n", \ + __FILE__, __LINE__, gpgme_strerror(a)); \ + if ((a) == GPGME_File_Error) \ + fprintf (stderr, "\terrno=`%s'\n", strerror (my_errno)); \ + exit (1); } \ + } while(0) + +static char * +make_filename (const char *fname) +{ + const char *srcdir = getenv ("srcdir"); + char *buf; + + if (!srcdir) + srcdir = "."; + buf = malloc (strlen(srcdir) + strlen(fname) + 2 ); + if (!buf) + { + fprintf (stderr, "%s:%d: could not allocate string: %s\n", + __FILE__, __LINE__, strerror (errno)); + exit (1); + } + strcpy (buf, srcdir); + strcat (buf, "/"); + strcat (buf, fname); + return buf; +} + +int +main (int argc, char **argv) +{ + GpgmeCtx ctx; + GpgmeError err; + GpgmeData in; + const char *cert_1 = make_filename ("cert_dfn_pca01.der"); + const char *cert_2 = make_filename ("cert_dfn_pca15.der"); + const char *cert_3 = make_filename ("cert_g10code_test1.der"); + + do + { + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); + + err = gpgme_data_new_from_file (&in, cert_1, 1); + fail_if_err (err); + + err = gpgme_op_import (ctx, in); + fail_if_err (err); + + gpgme_data_release (in); + + err = gpgme_data_new_from_file (&in, cert_2, 1); + fail_if_err (err); + + err = gpgme_op_import (ctx, in); + fail_if_err (err); + + gpgme_data_release (in); + + err = gpgme_data_new_from_file (&in, cert_3, 1); + fail_if_err (err); + + err = gpgme_op_import (ctx, in); + fail_if_err (err); + + gpgme_data_release (in); + gpgme_release (ctx); + } + while (argc > 1 && !strcmp (argv[1], "--loop")); + + return 0; +} -- 2.26.2