diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ChangeLog | 7 | ||||
-rw-r--r-- | tests/gpg/t-decrypt-verify.c | 50 | ||||
-rw-r--r-- | tests/gpg/t-verify.c | 59 | ||||
-rw-r--r-- | tests/gpgsm/t-verify.c | 60 |
4 files changed, 103 insertions, 73 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index 955b9e5a..1ca88b52 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,10 @@ +2002-12-24 Marcus Brinkmann <[email protected]> + + * gpgsm/t-verify.c (main): Adjust caller of gpgme_op_verify. + * gpg/t-verify.c (main): Likewise. + * gpg/t-decrypt-verify.c (main): Likewise for + gpgme_op_decrypt_verify. + 2002-12-23 Marcus Brinkmann <[email protected]> * gpgsm/Makefile.am (./gpgsm.conf): Add a faked system time to diff --git a/tests/gpg/t-decrypt-verify.c b/tests/gpg/t-decrypt-verify.c index 276f7e6d..1a129a79 100644 --- a/tests/gpg/t-decrypt-verify.c +++ b/tests/gpg/t-decrypt-verify.c @@ -1,23 +1,22 @@ /* t-decrypt-verify.c - regression test - * Copyright (C) 2000 Werner Koch (dd9jn) - * 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 - */ + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002 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 GPGME; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> @@ -102,7 +101,7 @@ main (int argc, char **argv) GpgmeData in, out, pwdata = NULL; struct passphrase_cb_info_s info; const char *cipher_2_asc = mk_fname ("cipher-2.asc"); - GpgmeSigStat stat; + GpgmeSigStat status; char *p; do @@ -124,15 +123,20 @@ main (int argc, char **argv) err = gpgme_data_new (&out); fail_if_err (err); - err = gpgme_op_decrypt_verify (ctx, in, out, &stat); + err = gpgme_op_decrypt_verify (ctx, in, out); fail_if_err (err); fflush (NULL); fputs ("Begin Result:\n", stdout); print_data (out); fputs ("End Result.\n", stdout); - - if (stat != GPGME_SIG_STAT_GOOD) + + if (!gpgme_get_sig_status (ctx, 0, &status, NULL)) + { + fprintf (stderr, "Signature check failed unexpectedly.\n"); + exit (1); + } + if (status != GPGME_SIG_STAT_GOOD) { fprintf (stderr, "Signature check failed unexpectedly.\n"); exit (1); diff --git a/tests/gpg/t-verify.c b/tests/gpg/t-verify.c index f12b6068..1dcca5db 100644 --- a/tests/gpg/t-verify.c +++ b/tests/gpg/t-verify.c @@ -1,23 +1,22 @@ /* t-verify.c - regression test - * Copyright (C) 2000 Werner Koch (dd9jn) - * Copyright (C) 2001, 2002 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 - */ + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002 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 GPGME; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> @@ -188,8 +187,13 @@ main (int argc, char **argv ) fail_if_err (err); puts ("checking a valid message:\n"); - err = gpgme_op_verify (ctx, sig, text, NULL, &status); + err = gpgme_op_verify (ctx, sig, text, NULL); fail_if_err (err); + if (!gpgme_get_sig_status (ctx, 0, &status, NULL)) + { + fprintf (stderr, "%s:%d: No signature\n", __FILE__, __LINE__); + exit (1); + } print_sig_stat (ctx, status); if (status != GPGME_SIG_STAT_GOOD) { @@ -206,9 +210,13 @@ main (int argc, char **argv ) test_text1f, strlen (test_text1f), 0); fail_if_err (err); gpgme_data_rewind (sig); - err = gpgme_op_verify (ctx, sig, text, NULL, &status); + err = gpgme_op_verify (ctx, sig, text, NULL); fail_if_err (err); - + if (!gpgme_get_sig_status (ctx, 0, &status, NULL)) + { + fprintf (stderr, "%s:%d: No signature\n", __FILE__, __LINE__); + exit (1); + } print_sig_stat (ctx, status); if (status != GPGME_SIG_STAT_BAD) { @@ -225,8 +233,13 @@ main (int argc, char **argv ) fail_if_err (err); err = gpgme_data_new (&text); fail_if_err (err); - err = gpgme_op_verify (ctx, sig, NULL, text, &status); + err = gpgme_op_verify (ctx, sig, NULL, text); fail_if_err (err); + if (!gpgme_get_sig_status (ctx, 0, &status, NULL)) + { + fprintf (stderr, "%s:%d: No signature\n", __FILE__, __LINE__); + exit (1); + } nota = gpgme_data_release_and_get_mem (text, &len); for (j = 0; j < len; j++) diff --git a/tests/gpgsm/t-verify.c b/tests/gpgsm/t-verify.c index 715b3473..0a48b3cb 100644 --- a/tests/gpgsm/t-verify.c +++ b/tests/gpgsm/t-verify.c @@ -1,23 +1,22 @@ /* t-verify.c - regression test - * Copyright (C) 2000 Werner Koch (dd9jn) - * Copyright (C) 2001, 2002 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 - */ + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002 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 GPGME; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> @@ -186,12 +185,14 @@ main (int argc, char **argv ) fail_if_err (err); puts ("checking a valid message:\n"); - err = gpgme_op_verify (ctx, sig, text, NULL, &status); - print_sig_stat (ctx, status); - print_sig_stat (ctx, status); - print_sig_stat (ctx, status); - print_sig_stat (ctx, status); + err = gpgme_op_verify (ctx, sig, text, NULL); fail_if_err (err); + if (!gpgme_get_sig_status (ctx, 0, &status, NULL)) + { + fprintf (stderr, "%s:%d: No signature\n", __FILE__, __LINE__); + exit (1); + } + print_sig_stat (ctx, status); if ( (nota=gpgme_get_notation (ctx)) ) printf ("---Begin Notation---\n%s---End Notation---\n", nota); @@ -202,10 +203,15 @@ main (int argc, char **argv ) test_text1f, strlen (test_text1f), 0); fail_if_err (err); gpgme_data_rewind ( sig ); - err = gpgme_op_verify (ctx, sig, text, NULL, &status); - - print_sig_stat (ctx, status); + err = gpgme_op_verify (ctx, sig, text, NULL); fail_if_err (err); + if (!gpgme_get_sig_status (ctx, 0, &status, NULL)) + { + fprintf (stderr, "%s:%d: No signature\n", __FILE__, __LINE__); + exit (1); + } + print_sig_stat (ctx, status); + if ((nota=gpgme_get_notation (ctx))) printf ("---Begin Notation---\n%s---End Notation---\n", nota); |