diff options
Diffstat (limited to 'tests')
67 files changed, 12826 insertions, 0 deletions
diff --git a/tests/ChangeLog-2011 b/tests/ChangeLog-2011 new file mode 100644 index 0000000..596c2df --- /dev/null +++ b/tests/ChangeLog-2011 @@ -0,0 +1,941 @@ +2011-12-02 Werner Koch <wk@g10code.com> + + NB: ChangeLog files are no longer manually maintained. Starting + on December 1st, 2011 we put change information only in the GIT + commit log, and generate a top-level ChangeLog file from logs at + "make dist". See doc/HACKING for details. + +2011-05-11 Marcus Brinkmann <marcus@g10code.com> + + * gpgsm/Makefile.am (DISTCLEANFILES): Move to ... + (CLEANFILES): ... here. + (clean-local): New rule. + * gpg/Makefile.am (DISTCLEANFILES): Move to ... + (CLEANFILES): ... here. + +2011-05-05 Marcus Brinkmann <marcus@g10code.com> + + * gpg/Makefile.am: Unset GPG_AGENT_INFO when setting up local + configuration. + (clean-local): Shut down local gpg-agent. + +2011-05-04 Marcus Brinkmann <marcus@g10code.com> + + * gpg/t-import.c (check_result): Complete secret key pair counting + and disable status check, as GPG 2.1 currently emits two IMPORT_OK + lines and we only look at the first. + +2011-04-27 Marcus Brinkmann <marcus@g10code.com> + + * gpg/Makefile.am (DISTCLEANFILES): Add S.gpg-agent. + (mkdemodirs, ./Alpha/Secret.gpg): Remove targets. + (GNUPGHOME): Export as absolute build directory (for gpg-agent). + (./pubring.gpg): Remove --homedir option, import secdemo.asc. + (clean-local): Rewrite. + * gpg/secdemo.asc: New file. + * gpg/pubkey-1.asc, gpg/seckey-1.asc: Change passphrase to + "abc" (now needed as GnuPG 2.1 asks for secret key passphrase on + import). + * gpg/t-keylist.c (keys): Update key info for Joe Random Hacker. + (main): Disable check for can_encrypt, as this is now in a + different subkey. + * gpg/t-encrypt-sign.c (check_result): Allow RMD160 hash + algorithm. + * gpg/t-import.c (check_result): One secret key pair now counts as + two secret keys, allow that. + +2009-11-03 Werner Koch <wk@g10code.com> + + * run-support.h (fail_if_err): Include program name. + + * run-sign.c (main): Add option --uiserver. + +2009-10-26 Marcus Brinkmann <marcus@g10code.de> + + * opassuan/t-command.c: Update to new interface. + +2009-10-15 Werner Koch <wk@g10code.com> + + * run-verify.c: New. + +2009-08-06 Werner Koch <wk@g10code.com> + + * run-sign.c: New. + +2009-07-07 Werner Koch <wk@g10code.com> + + * run-keylist.c (main): Add options --cms and --openpgp. + + * gpg/pgp-keylist.c: Rename to ... + * run-keylist.c: ... this. + * gpg/pgp-import.c: Rename to ... + * run-import.c: ... this. + * gpg/pgp-export.c: Rename to ... + * run-export.c: ... this. + * run-support.h: New. Copied from gpg/t-support.h. + * gpg/Makefile.am (noinst_PROGRAMS): Remove them. + * Makefile.am (noinst_PROGRAMS): Add them. + (noinst_HEADERS): New. + +2009-06-22 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-support.h (passphrase_cb): Implement write() according to + the book to silence compiler warning. + * gpgsm/t-support.h (passphrase_cb): Likewise. + +2009-06-16 Werner Koch <wk@g10code.com> + + * gpg/pgp-import.c: New. + * gpg/t-support.h (print_import_result, nonnull): Factored out + from other tools. + + * gpg/pgp-export.c, gpg/pgp-keylist.c: New. + +2009-06-09 Werner Koch <wk@g10code.com> + + * gpg/Makefile.am (./pubring.gpg): Ignore errors in case of + already imported keys. Add --no-permission-warning and remove + obsolete --allow-secret-key-import. + * gpg/mkdemodirs.in (GPG): Add --no-permission-warning. + + * gpg/t-edit.c (edit_fnc): Use gpgme_io_write. + +2009-04-19 Moritz <moritz@gnu.org> + + * gpg/Makefile.am (EXTRA_DIST): Replaced mkdemodirs with mkdemodirs.in. + (mkdemodirs): New target. + (clean-local): Added command for removing mkdemodirs script. + (./Alpha/Secret.gpg): Added dependency on mkdemodirs. + + * gpg/mkdemodirs: Renamed to ... + * gpg/mkdemodirs.in: ... here. + * gpg/mkdemodirs.in (GPG): Derive value from @GPG@ instead of + hard-coding "gpg". + +2009-02-24 Werner Koch <wk@g10code.com> + + * opassuan/t-command.c: Adjust for changed new op_assuan interface. + +2009-02-03 Werner Koch <wk@g10code.com> + + * gpg/t-keylist.c (main): Check that new fields is_cardkey and + card_number are not set. + +2009-01-26 Werner Koch <wk@g10code.com> + + * opassuan/: New. + * opassuan/Makefile.am: New. + * opassuan/t-command.c: New. + +2008-12-03 Marcus Brinkmann <marcus@g10code.de> + + * Makefile.am (INCLUDES): Fix path to include file. + * gpg/Makefile.am (INCLUDES), gpgsm/Makefile.am (INCLUDES): Likewise. + +2008-11-18 Werner Koch <wk@g10code.com> + + * gpgsm/cms-decrypt.c: New. + +2008-11-03 Marcus Brinkmann <marcus@g10code.com> + + * gpgsm/Makefile.am (INCLUDES, LDADD): Replace gpgme path with src. + * gpg/Makefile.am (INCLUDES, LDADD, t_thread1_LDADD): Likewise. + * Makefile.am (LDADD): Likewise. + +2008-10-30 Werner Koch <wk@g10code.com> + + * gpgsm/cms-keylist.c: New. + +2008-06-19 Werner Koch <wk@g10code.com> + + * gpg/t-gpgconf.c (dump_arg): Add new types. Print strings in + quotes. + +2008-01-28 Marcus Brinkmann <marcus@g10code.de> + + * gpg/Makefile.am (DISTCLEANFILES): Add pubring.kbx~. + +2008-01-10 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-gpgconf.c (main): Allow for dirmngr not to be available. + + * gpg/Makefile.am (./gpg-agent.conf): Correct pinentry path. + + * gpg/pinentry: New file. + * gpg/Makefile.am (DISTCLEANFILES, all-local): Add gpg-agent.conf + (./gpg-agent.conf): New target. + (EXTRA_DIST): Add pinentry. + + * gpg/t-gpgconf.c (main): Exit early if compiled without gpgconf. + +2008-01-04 Marcus Brinkmann <marcus@g10code.de> + + * gpg/Makefile.am (CLEANFILES): Add pubring.kbx and dirmngr.conf. + + * Makefile.am (TESTS_ENVIRONMENT): Use absolute path for + GNUPGHOME. + * gpg/Makefile.am (TESTS_ENVIRONMENT): Use absolute path for + GNUPGHOME. + * gpgsm/Makefile.am (TESTS_ENVIRONMENT): Use absolute path for + GNUPGHOME. + * gpg/Makefile.am (TESTS): Add t-gpgconf. + t-gpgconf.c: New file. + +2007-11-23 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/t-verify.c (show_auditlog): Check for GPG_ERR_ASS_UNKNOWN_CMD. + +2007-11-23 Werner Koch <wk@g10code.com> + + * gpgsm/t-verify.c (check_result): Don't exit on error but set a flag. + (main): Cosnult flag for return value. + (show_auditlog): New. + (main): Use it. + +2007-09-27 Marcus Brinkmann <marcus@g10code.de> + + * t-engine-info.c (check_engine_info): Fix debug output. + * gpg/Makefile.am (tests_unix): New variable. + (TESTS): Use it. + * gpg/t-support.h (passphrase_cb) [HAVE_W32_SYSTEM]: Use WriteFile instead of write. + * gpg/t-wait.c [HAVE_W32_SYSTEM]: Define sleep as _sleep. + +2007-09-14 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/t-verify.c (main): Release TEXT and SIG. + +2007-07-12 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/Makefile.am (key_id): Change := into =. + +2007-07-12 Werner Koch <wk@g10code.com> + + * gpgsm/t-support.h (init_gpgme) [W32]: Do not init the locales as + the constants are not available. + +2007-02-26 Werner Koch <wk@g10code.com> + + * gpg/t-verify.c (double_plaintext_sig): New. + (main): Check it. + +2006-12-02 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/t-keylist.c (main): Skip unknown keys. Newer versions of + GPGSM import more keys than older ones. + +2005-12-06 Werner Koch <wk@g10code.com> + + * gpg/t-keylist.c (main): Changed for that secondary keys now have + a fingerprint. + * gpg/t-keylist-sig.c (main): Ditto. + * gpgsm/t-keylist.c (main): Ditto. The test used to be wrong. + +2005-10-18 Werner Koch <wk@g10code.com> + + * gpg/pubdemo.asc, gpg/secdemo.asc: Add 2 expired subkeys to + Whisky. + * gpg/t-keylist.c: Reordered list to match new demo keyring. Add + arg for number of subkeys and for extra checking function. + (main): Enhanced a few error outputs. Changed subkey + counting. Call extra checking fucntion. + (check_whisky): New. + +2005-10-07 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/t-keylist.c (main): Allow for an email address as a second + uid. + + * gpg/t-sig-notation.c: Change critical notation to something + GnuPG understands. + +2005-10-01 Marcus Brinkmann <marcus@g10code.de> + + * gpg/Makefile.am (EXTRA_DIST): Remove gpg.conf. + (DISTCLEANFILES): Add gpg.conf. + (all-local): Add gpg.conf. + (./gpg.conf): New target. + * gpg/gpg.conf: Remove file. + + * gpg/Makefile.am (EXTRA_DIST): Add gpg.conf. + + * gpg/Makefile.am (TESTS): Add t-sig-notation. + * gpg/t-sig-notation.c (check_result): New file. + * gpg/t-verify.c (check_result): Also check the length of the + notation data. + * gpg/gpg.conf: New file. + +2005-09-30 Marcus Brinkmann <marcus@g10code.de> + + * gpg/Makefile.am (TESTS): Add t-filename. + * gpg/t-filename.c: New file. + +2005-09-23 Werner Koch <wk@g10code.com> + + * gpg/t-support.h (init_gpgme) [W32]: Don't use LC_MESSAGES. + + * gpg/t-encrypt-large.c: New test. + * gpg/Makefile.am (TESTS): Add t-encrypt-large. + +2005-06-03 Marcus Brinkmann <marcus@g10code.de> + + * gpg/Makefile.am (TESTS): Add t-wait. + * gpg/t-wait.c (main): New test. + +2004-12-07 Marcus Brinkmann <marcus@g10code.de> + + * gpg/mkdemodirs: Add copyright notice. + + * gpgsm/Makefile.am, gpgsm/t-support.h, gpgsm/t-decrypt.c, + gpgsm/t-encrypt.c, gpgsm/t-export.c, gpgsm/t-genkey.c, + gpgsm/t-import.c, gpgsm/t-keylist.c, gpgsm/t-sign.c, + gpgsm/t-verify.c, gpg/Makefile.am, gpg/t-decrypt.c, + gpg/t-decrypt-verify.c, gpg/t-edit.c, gpg/t-encrypt.c, + gpg/t-encrypt-sign.c, gpg/t-encrypt-sym.c, gpg/t-eventloop.c, + gpg/t-export.c, gpg/t-genkey.c, gpg/t-import.c, gpg/t-keylist.c, + gpg/t-keylist-sig.c, gpg/t-sign.c, gpg/t-signers.c, + gpg/t-support.h, gpg/t-thread1.c, gpg/t-trustlist.c, + gpg/t-verify.c, Makefile.am, t-data.c, t-engine-info.c, + t-version.c: Change license to LGPL. + +2004-08-17 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/t-keylist.c (struct): Add new fields VALIDITY and + KEY_LENGTH. + (main): Use them. + * gpgsm/t-import.c (check_result): New argument total_stat. + (main): Pass this argument. Reduce number of total considered + keys to 1 for the second test. + +2004-04-05 Werner Koch <wk@gnupg.org> + + * gpgsm/Makefile.am: Changed the faked system time to 20011213T12000. + +2004-03-07 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/t-keylist.c: Add chain IDs. + +2004-03-03 Werner Koch <wk@gnupg.org> + + * gpgsm/t-export.c (main): Also check exporting 2 certificates. + +2004-02-17 Werner Koch <wk@gnupg.org> + + * gpgsm/t-import.c (check_result): gpgsm does now return info in + the result->imports; adjust for that. + + * gpgsm/Makefile.am (TESTS_ENVIRONMENT): Reset the GPG_AGENT_INFO. + + Include config.h at the top of each C source. This is required + due to LFS support. + + * gpg/t-keylist-sig.c (main): s/class/sig_class/. + * gpg/t-signers.c (check_result): Ditto. + * gpg/t-sign.c (check_result): Ditto. + * gpg/t-encrypt-sign.c (check_result): Ditto. + * gpgsm/t-sign.c (check_result): Ditto. + +2004-01-12 Werner Koch <wk@gnupg.org> + + * gpg/t-keylist-sig.c (main): Temporary disabled one test due top + gpg 1.3.4 problems. + * gpg/t-import.c (check_result): Likewise. + +2003-11-19 Werner Koch <wk@gnupg.org> + + * gpg/t-support.h (DIM): Added. + + * gpg/t-verify.c (check_result): Rewrote test for notations + because the order of notaions is not guaranteed. + + * gpgsm/t-support.h (fail_if_err): Also print the numeric values. + +2003-10-06 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-eventloop.c: Include <sys/types.h> for old systems. + + * gpgsm/Makefile.am (DISTCLEANFILES): Add random_seed. + + * gpg/t-thread1.c (thread_one): Do not call initialize_gpgme. + Likewise. + +2003-09-14 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-thread1.c (main): Call init_gpgme here. + (initialize_gpgme): Function removed. + + * gpg/t-thread1.c: New file. + * gpg/Makefile.am (TESTS): Add t-thread1.c. + (t_thread1_LDADD): New variable. + (LDADD): Remove GPG Error lib. + * gpgsm/Makefile.am (LDADD): Likewise. + + * gpg/t-import.c (main): Likewise. + * gpg/t-keylist-sig.c (main): Likewise. + * gpg/t-keylist.c (main): Likewise. + * gpg/t-sign.c (main): Likewise. + * gpg/t-signers.c (main): Likewise. + * gpg/t-trustlist.c (main): Likewise. + * gpgsm/t-support.h: Include <stdlib.h> and <locale.h>. + (init_gpgme): New function. + * gpg/t-support.h: Likewise. + * gpgsm/t-verify.c (main): Call init_gpgme. + * gpgsm/t-decrypt.c (main): Likewise. + * gpgsm/t-encrypt.c (main): Likewise. + * gpgsm/t-export.c (main): Likewise. + * gpgsm/t-genkey.c (main): Likewise. + * gpgsm/t-import.c (main): Likewise. + * gpgsm/t-keylist.c (main): Likewise. + * gpgsm/t-sign.c (main): Likewise. + * gpg/t-verify.c (main): Call init_gpgme. + * gpg/t-decrypt-verify.c (main): Likewise. + * gpg/t-decrypt.c (main): Likewise. + * gpg/t-edit.c (main): Likewise. + * gpg/t-encrypt-sign.c (main): Likewise. + * gpg/t-encrypt-sym.c (main): Likewise. + * gpg/t-encrypt.c (main): Likewise. + * gpg/t-eventloop.c (main): Likewise. + * gpg/t-export.c (main): Likewise. + * gpg/t-genkey.c (main): Likewise. + +2003-08-14 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-sign.c (check_result): Change output format for signature + class to unsigned int. + * gpg/t-signers.c (check_result): Likewise. + * gpg/t-encrypt-sign.c (check_result): Likewise. + * gpgsm/t-sign.c (check_result): Likewise. + +2003-07-31 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-verify.c (check_result): Change type of SUMMARY to + unsigned int. + * gpg/t-decrypt-verify.c (check_verify_result): Likewise. + * gpg/t-keylist-sig.c (keys): Change type of member CLASS to + unsigned int. + * t-data.c (read_cb): Change type of AMOUNT to unsigned int. + * t-version.c (version): Remove unused variable. + +2003-07-22 Marcus Brinkmann <marcus@g10code.de> + + * Makefile.am (AM_CPPFLAGS): New variable. + (LDADD): Add @GPG_ERROR_LIBS@. + * gpg/Makefile.am (AM_CPPFLAGS): New variable. + (LDADD): Add @GPG_ERROR_LIBS@. + * gpgsm/Makefile.am (AM_CPPFLAGS): New variable. + (LDADD): Add @GPG_ERROR_LIBS@. + +2003-06-06 Marcus Brinkmann <marcus@g10code.de> + + Everywhere: Use libgpg-error error codes. + + * gpg/Makefile.am (noinst_HEADERS): New variable. + * gpg/t-support.h: New file. + * gpgsm/Makefile.am (noinst_HEADERS): New variable. + * gpgsm/t-support.h: New file. + +2003-05-29 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-encrypt-sym.c (main): Adapt to new syntax. + * gpg/t-encrypt.c (main): Likewise. + * gpg/t-eventloop.c (main): Likewise. + * gpg/t-encrypt-sign.c (main): Likewise. + * gpgsm/t-export.c (main): Likewise. + * gpgsm/t-encrypt.c (main): Likewise. + +2003-05-28 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-eventloop.c (main): Rewrite recipient management. + * gpg/t-encrypt-sign.c (main): Likewise. + * gpg/t-encrypt.c (main): Likewise. + * gpg/t-export.c (main): Likewise. + * gpgsm/t-encrypt.c (main): Likewise. + * gpgsm/t-export.c (main): Likewise. + +2003-05-27 Marcus Brinkmann <marcus@g10code.de> + + * gpg/Makefile.am (TESTS): Order t-keylist and t-keylist-sig after + t-import. + * gpg/t-edit.c (edit_fnc): Fix primary UID for keylisting tests. + * gpg/t-keylist.c: Change order of user IDs. + * gpg/t-keylist-sig.c: Likewise. + * gpg/t-import.c: Add support for gpg in CVS. + +2003-05-27 Marcus Brinkmann <marcus@g10code.de> + + * t-data.c: Remove TEST_OUT_CB. + (main): Likewise. + * gpg/t-trustlist.c (main): Access ITEM directly. + + * (t-decrypt-verify.c, t-decrypt.c, t-edit.c, t-encrypt-sign.c, + t-encrypt-sym.c, t-sign.c, t-signers.c): Include <unistd.h>. + (passphrase_cb): Rewritten. + * t-edit.c (edit_fnc): Rewritten. + +2003-05-04 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-keylist-sig.c (main): Remove timestamp check. + + * gpgsm/t-keylist.c: Add check for timestamp. + + * gpg/Makefile.am (TESTS): Add t-keylist-sig. + * gpg/t-keylist-sig.c: New file. + +2003-04-30 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-eventloop.c (main): Do not call print_op_info. + (print_op_info): Function removed. + + * gpg/t-keylist.c: Rewritten. + * gpgsm/t-keylist.c (main): Rewritten. + * gpg/t-edit.c (main): Do not use gpgme_key_get_as_xml. Use + gpgme_key_unref instead gpgme_key_release. + * gpg/t-signers.c (main): Use gpgme_key_unref instead + gpgme_key_release. + +2003-04-29 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-trustlist.c: Rewritten. + + * gpg/t-verify.c (main): Rewritten. + * gpg/t-decrypt-verify.c: Rewritten. + * gpgsm/t-verify.c (main): Rewritten. + +2003-04-28 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/t-decrypt.c (main): Rewritten. + + * gpg/t-decrypt.c: Rewritten. + + * gpg/t-signers.c: Rewritten. + +2003-04-27 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-encrypt-sign.c (check_result): Rewritten. + + * gpg/t-sign.c: Rewritten. + * gpgsm/t-sign.c: Rewritten. + * gpg/t-encrypt.c: Check for invalid recipients. + * gpgsm/t-encrypt.c: Likewise. + + * gpg/t-import.c (check_result): Really use FPR. + * gpgsm/t-import.c (check_result): Rewritten. + +2003-04-25 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-import.c: Rewritten. + + * gpgsm/t-genkey.c: Rewritten. + * gpgsm/Makefile.am (noinst_PROGRAMS): Add t-genkey. + * gpg/t-genkey.c: Include <stdlib.h>. + (main): Check result->fpr before checking its length. + +2003-04-24 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-genkey.c: Rewritten to match new semantics. + +2003-02-06 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-decrypt.c (passphrase_cb): Fix to new prototype. + * gpg/t-decrypt-verify.c (passphrase_cb): Likewise. + * gpg/t-edit.c (passphrase_cb): Likewise. + * gpg/t-encrypt-sign.c (passphrase_cb): Likewise. + * gpg/t-encrypt-sym.c (passphrase_cb): Likewise. + * gpg/t-sign.c (passphrase_cb): Likewise. + * gpg/t-signers.c (passphrase_cb): Likewise. + +2003-01-30 Marcus Brinkmann <marcus@g10code.de> + + * t-engine-info.c: Use file_name instead path throughout. + + * Makefile.am (TESTS): Add t-engine-info. + * t-engine-info.c: New file. + * gpg/t-encrypt.c (main): Don't print engine info. + * gpg/t-eventloop.c (main): Likewise. + * gpg/t-encrypt-sign.c (main): Likewise. + * gpgsm/t-encrypt.c (main): Likewise. + +2002-12-24 Marcus Brinkmann <marcus@g10code.de> + + * 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 <marcus@g10code.de> + + * gpgsm/Makefile.am (./gpgsm.conf): Add a faked system time to + avoid certification's expiry. + * gpgsm/t-encrypt.c (main): Use the short certification name. + +2002-11-19 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-genkey.c (main): Add missing argument to gpgme_op_genkey + invocation. + +2002-10-09 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-decrypt.c (print_data): Update to new gpgme_data_read + interface, and use gpgme_engine_check_version instead + gpgme_check_version. + * gpg/t-decrypt-verify.c (print_data): Likewise. + * gpg/t-edit.c (main): Likewise. + * gpg/t-encrypt.c (print_data): Likewise. + * gpg/t-encrypt-sign.c (print_data): Likewise. + * gpg/t-encrypt-sym.c (print_data): Likewise. + * gpg/t-eventloop.c (print_data): Likewise. + * gpg/t-export.c (print_data): Likewise. + * gpg/t-sign.c (print_data): Likewise. + * gpg/t-signers.c (print_data): Likewise. + * gpgsm/t-decrypt.c (print_data): Likewise. + * gpgsm/t-encrypt.c (print_data): Likewise. + * gpgsm/t-export.c (print_data): Likewise. + * gpgsm/t-sign.c (print_data): Likewise. + * gpg/t-verify.c (main): Likewise for gpgme_op_verify. + * gpgsm/t-verify.c (main): Likewise for gpgme_op_verify. + * t-data.c (read_once_test): Likewise. + (write_test): Update for new behaviour of data objects. + (main): Remove type test. + +2002-09-30 Werner Koch <wk@gnupg.org> + + * gpgsm/t-keylist.c (doit): Add arg SECRET. + (main): Add option --secret. + +2002-09-28 Marcus Brinkmann <marcus@g10code.de> + + * t-version.c: Include <string.h>. Reported by Stéphane Corthésy. + +2002-09-02 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-keylist.c (main): Test PATTERN for NULL before printing. + Reported by Dr. Stefan Dalibor <Dr.Stefan.Dalibor@bfa.de>. + +2002-08-01 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-edit.c: Also add a test for the expire command (testing + the passphrase callback). + +2002-07-28 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-edit.c: New file. + * gpg/Makefile (TESTS): Add t-edit. + +2002-07-25 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-encrypt-sym.c (main): Change type of I to size_t and + rename to LEN. + * gpg/t-verify.c (main): Likewise. Submitted by Stéphane + Corthésy. + +2002-07-03 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-eventloop.c: New file. + * gpg/Makefile (TESTS): Add t-eventloop. + +2002-06-26 Werner Koch <wk@gnupg.org> + + * gpgsm/t-import.c (print_op_info): New. + (main): Print operation info. + +2002-06-25 Werner Koch <wk@gnupg.org> + + * gpgsm/Makefile.am (DISTCLEANFILES): new. + +2002-06-25 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/Makefile.am (TESTS): Add t-export. + gpgsm/t-export.c: New file. + +2002-06-20 Werner Koch <wk@gnupg.org> + + * gpgsm/t-sign.c (main): Also test a normal signature. + + * gpg/Makefile (TESTS_ENVIRONMENT): Set GPG_AGENT_INFO empty. + * gpg/t-signers.c, gpg/t-sign.c, gpg/t-encrypt-sym.c + * gpg/t-encrypt-sign.c, gpg/t-decrypt.c + * gpg/t-decrypt-verify.c (main): Changed the GPG_AGENT_INFO check to + match the one in ../../gpgme/rungpg.c. + +2002-06-12 Werner Koch <wk@gnupg.org> + + * gpgsm/t-keylist.c (doit): Print operation info if available. + +2002-06-10 Werner Koch <wk@gnupg.org> + + * gpgsm/t-verify.c (print_sig_stat): Print the error token. + +2002-06-04 Werner Koch <wk@gnupg.org> + + * gpgsm/t-encrypt.c (main): Add a simple option parser and allow + to specify an encryption key. + +2002-05-26 Marcus Brinkmann <marcus@g10code.de> + + * gpg/Makefile.am (all-local): Remove dependency on ./secring.gpg. + (./secring.gpg): Remove target, and move all rules for this target + to ... + (./pubring.gpg): ... here. This was necessary because GnuPG 1.0.7 + does create an empty secring.gpg file when importing public keys. + +2002-05-08 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/t-verify.c (validity_string): New. + (print_sig_stat): Print expire time and validity. + (status_string): Add new exipred stati. + +2002-05-03 Werner Koch <wk@gnupg.org> + + * gpg/t-verify.c (validity_string): New. + (print_sig_stat): Print expire time and validity. + (status_string): Add new exipred stati. + +2002-04-05 Marcus Brinkmann <marcus@g10code,de> + + * gpgsm/Makefile.am (./trustlist.txt): Put more into this file to + prevent use of gpg-agent. + (./gpg-agent.conf): Remove target. + (all-local): Remove ./gpg-agent.conf. + +2002-04-05 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/t-keylist.c (main): Use gpgme_engine_check_version instead + gpgme_check_engine. + * gpgsm/t-encrypt.c (main): Likewise. + +2002-03-06 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-encrypt-sym.c: New file. + * gpg/Makefile.am (TESTS): Add t-encrypt-sym. + +2002-03-05 Marcus Brinkmann <marcus@g10code.de> + + * gpg/Makefile.am (CLEANFILES): Remove random_seed, which is now + in DISTCLEANFILES. + +2002-03-04 Werner Koch <wk@gnupg.org> + + * gpg/Makefile.am (DISTCLEANFILES): Added. + +2002-03-03 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-verify.c (main): Add a few more sanity checks, and a check + for normal signatures. + +2002-02-26 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-encrypt-sign.c: New file. + * gpg/Makefile.am (TESTS): Add t-encrypt-sign. + +2002-02-13 Werner Koch <wk@gnupg.org> + + * gpgsm/Makefile.am (private-keys-v1.d): Don't + fail when the directory already exists. + +2002-02-12 Marcus Brinkmann <marcus@g10code.de> + + * gpg/Makefile.am (CLEANFILES): New target. + (distclean-local): Rename to ... + (clean-local): ... this. + +2002-02-09 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/Makefile.am (./private-keys-v1.d/$(key_id).key): Fix rule. + +2002-02-09 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/t-genkey.c: New file (not added to Makefile.am because of + gpg-agent bug). + +2002-02-08 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/Makefile.am (key_id): Update value. + (all-local): Add .key to keyid filename. + (./private-keys-v1.d/$(key_id)): Renamed to ... + (./private-keys-v1.d/$(key_id).key): ... this. + (all-local): Add ./gpgsm.conf, ./trustlist.txt. + (./gpgsm.conf, ./trustlist.txt): New target. + * gpgsm/567064FE6D14A17B2D811ABB407728BC558AA455: Renamed to ... + * gpgsm/32100C27173EF6E9C4E9A25D3D69F86D37A4F939: ... this. + +2002-01-30 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-import.c (print_op_info): New function. + (main): Use it. + +2002-01-22 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-signers.c (passphrase_cb): Change type of r_hd to void**. + * gpg/t-sign.c (passphrase_cb): Likewise. + * gpg/t-decrypt-verify.c (passphrase_cb): Likewise. + * gpg/t-decrypt.c (passphrase_cb): Likewise. + +2001-12-19 Marcus Brinkmann <marcus@g10code.de> + + * gpg/t-decrypt-verify.c: Don't include `mcheck.h'. Reported by + Stéphane Corthésy. + +2001-12-19 Marcus Brinkmann <marcus@g10code.de> + + * gpg/Makefile.am (EXTRA_DIST): Add missing line continuation. + +2001-12-19 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/Makefile.am (EXTRA_DIST): Add $(key_id). + +2001-12-16 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/Makefile: Rename `pubcerts.kbx' to `pubring.kbx'. + +2001-12-15 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/t-keylist.c (check_two_contexts): Set protocols. + +2001-12-14 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/t-sign.c: New file. + * gpgsm/Makefile.am (TESTS): Add t-sign. + +2001-12-14 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/t-decrypt.c: New file. + * gpgsm/567064FE6D14A17B2D811ABB407728BC558AA455: Likewise. + * gpgsm/Makefile.am (TESTS): Add t-decrypt. + (key_id): New variable. + (all-local): New target ./private-keys-v1.d/$(key_id) added. + (./private-keys-v1.d/$(key_id)): New target. + +2001-12-14 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/t-verify.c: New file. + * gpgsm/Makefile.am (TESTS): Add t-verify. + +2001-12-14 Marcus Brinkmann <marcus@g10code.de> + + * gpg/Makefile.am (GPG): Set to @GPG_PATH@. + (./pubring.gpg): Use $(GPG) instead gpg. + (./secring.gpg): Likewise. + + * gpgsm/t-import.c (main): Remove third test case. + * gpgsm/Makefile.am (GPGSM): Set to @GPGSM@. + (all-local): New target. + (./pubcerts.kbx): Likewise. + * gpgsm/t-encrypt.c: New file. + * gpgsm/Makefile.am (TESTS): Add t-encrypt. + +2001-12-14 Marcus Brinkmann <marcus@g10code.de> + + * gpgsm/t-keylist.c: New file. + * gpgsm/Makefile.am (TESTS): Add t-keylist. + +2001-12-13 Marcus Brinkmann <marcus@g10code.de> + + * 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 <marcus@g10code.de> + + * gpg/: New directory. + * Makefile.am, t-verify.c, t-encrypt.c, t-signers.c, t-trustlist.c, + t-sign.c, t-keylist.c, t-import.c, t-genkey.c, t-export.c, + t-decrypt-verify.c, t-decrypt.c, t-version.c, t-data.c, mkdemodirs. + cipher-1.asc, cipher-2.asc, geheim.txt, pubdemo.asc, pubkey-1.asc, + secdemo.asc, seckey-1.asc): Move to sub directory gpg/. + + * gpg/Makefile.am (INCLUDES): Include gpgme/, not include/ and + intl/. + (LDD): Correct relative path to gpgme library. + (TESTS): Remove t-version and t-data. + * gpg/t-verify.c, gpg/t-encrypt.c, gpg/t-signers.c, gpg/t-trustlist.c, + gpg/t-sign.c, gpg/t-keylist.c, gpg/t-import.c, gpg/t-genkey.c, + gpg/t-export.c, gpg/t-decrypt-verify.c, gpg/t-decrypt.c, + t-version.c, t-data.c): Include gpgme.h, not "../gpgme/gpgme.h". + + * Makefile.am: New file. + * gpgsm/: New directory. + * gpgsm/Makefile.am: New file. + +2001-11-16 Marcus Brinkmann <marcus@g10code.de> + + * Makefile.am (TESTS): Add t-decrypt-verify. + * t-decrypt-verify.c: New file. + * cipher-2.asc: Likewise. + +2001-11-02 Marcus Brinkmann <marcus@g10code.de> + + * t-data.c: Include stddef.h. + (read_once_test): Change type of READ to size_t. + (read_test): Likewise. + (write_test): Likewise. + +2001-10-29 Marcus Brinkmann <marcus@g10code.de> + + * t-signers.c: New file. + * Makefile.am (TESTS): Add t-signers. + +2001-10-22 Marcus Brinkmann <marcus@g10code.de> + + * Makefile.am (TEST_ENVIRONMENT): Revert last change. + +2001-10-22 Marcus Brinkmann <marcus@g10code.de> + + * Makefile.am (TEST_ENVIRONMENT): Set environment to $(srcdir), + not current directory. + +2001-10-22 Marcus Brinkmann <marcus@g10code.de> + + * t-data.c (write_test): New function. + (main): Invoke write_test for all rounds except TEST_OUT_CB. + +2001-10-22 Marcus Brinkmann <marcus@g10code.de> + + * Makefile.am (INCLUDES): Remove spurious duplicate to silence + automake. + +2001-10-16 Marcus Brinkmann <marcus@g10code.de> + + * t-version.c: New file. + * t-data.c: Likewise. + * t-data-1.txt: Likewise. + * t-data-2.txt: Likewise. + * Makefile.am (TESTS): Add t-version, t-data. + +2001-09-17 Werner Koch <wk@gnupg.org> + + * t-keylist.c (check_two_contexts): New. + +2001-09-03 Werner Koch <wk@gnupg.org> + + * t-encrypt.c (print_op_info): New and use it after each operation. + +2001-08-28 Werner Koch <wk@gnupg.org> + + * t-sign.c (print_op_info): New and use it after each operation. + +2001-03-15 Werner Koch <wk@gnupg.org> + + * t-keylist.c (doit): List subkeys too, show caps. + +2001-02-13 Werner Koch <wk@gnupg.org> + + * t-verify.c (print_sig_stat): Repaled ulong by unsigned long + because we don't use the config stuff here. + +2001-02-12 Werner Koch <wk@gnupg.org> + + * tests/t-verify.c (print_sig_stat): Print info about the keys. + + + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, + 2011 g10 Code GmbH + + This file is free software; as a special exception the author gives + unlimited permission to copy and/or distribute it, with or without + modifications, as long as this notice is preserved. + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY, to the extent permitted by law; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..0ecdab2 --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,51 @@ +# Makefile.am - Makefile for GPGME tests. +# Copyright (C) 2000 Werner Koch (dd9jn) +# Copyright (C) 2001, 2004 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 Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 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 Lesser General +# Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, see <http://www.gnu.org/licenses/>. + +## Process this file with automake to produce Makefile.in + +TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) + +TESTS = t-version t-data t-engine-info + +EXTRA_DIST = t-data-1.txt t-data-2.txt ChangeLog-2011 + +INCLUDES = -I$(top_builddir)/src + +AM_CPPFLAGS = @GPG_ERROR_CFLAGS@ +LDADD = ../src/libgpgme.la @GPG_ERROR_LIBS@ + +noinst_HEADERS = run-support.h + +noinst_PROGRAMS = $(TESTS) run-keylist run-export run-import run-sign \ + run-verify + + +if RUN_GPG_TESTS +gpgtests = gpg +else +gpgtests = +endif + +if RUN_GPGSM_TESTS +gpgsmtests = gpgsm opassuan +else +gpgsmtests = +endif + +SUBDIRS = ${gpgtests} ${gpgsmtests} diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000..5ce550a --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,859 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Makefile.am - Makefile for GPGME tests. +# Copyright (C) 2000 Werner Koch (dd9jn) +# Copyright (C) 2001, 2004 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 Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 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 Lesser General +# Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, see <http://www.gnu.org/licenses/>. + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +TESTS = t-version$(EXEEXT) t-data$(EXEEXT) t-engine-info$(EXEEXT) +noinst_PROGRAMS = $(am__EXEEXT_1) run-keylist$(EXEEXT) \ + run-export$(EXEEXT) run-import$(EXEEXT) run-sign$(EXEEXT) \ + run-verify$(EXEEXT) +subdir = tests +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/glib-2.0.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnupg-ttyname.m4 \ + $(top_srcdir)/m4/gpg-error.m4 $(top_srcdir)/m4/libassuan.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__EXEEXT_1 = t-version$(EXEEXT) t-data$(EXEEXT) \ + t-engine-info$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +run_export_SOURCES = run-export.c +run_export_OBJECTS = run-export.$(OBJEXT) +run_export_LDADD = $(LDADD) +run_export_DEPENDENCIES = ../src/libgpgme.la +run_import_SOURCES = run-import.c +run_import_OBJECTS = run-import.$(OBJEXT) +run_import_LDADD = $(LDADD) +run_import_DEPENDENCIES = ../src/libgpgme.la +run_keylist_SOURCES = run-keylist.c +run_keylist_OBJECTS = run-keylist.$(OBJEXT) +run_keylist_LDADD = $(LDADD) +run_keylist_DEPENDENCIES = ../src/libgpgme.la +run_sign_SOURCES = run-sign.c +run_sign_OBJECTS = run-sign.$(OBJEXT) +run_sign_LDADD = $(LDADD) +run_sign_DEPENDENCIES = ../src/libgpgme.la +run_verify_SOURCES = run-verify.c +run_verify_OBJECTS = run-verify.$(OBJEXT) +run_verify_LDADD = $(LDADD) +run_verify_DEPENDENCIES = ../src/libgpgme.la +t_data_SOURCES = t-data.c +t_data_OBJECTS = t-data.$(OBJEXT) +t_data_LDADD = $(LDADD) +t_data_DEPENDENCIES = ../src/libgpgme.la +t_engine_info_SOURCES = t-engine-info.c +t_engine_info_OBJECTS = t-engine-info.$(OBJEXT) +t_engine_info_LDADD = $(LDADD) +t_engine_info_DEPENDENCIES = ../src/libgpgme.la +t_version_SOURCES = t-version.c +t_version_OBJECTS = t-version.$(OBJEXT) +t_version_LDADD = $(LDADD) +t_version_DEPENDENCIES = ../src/libgpgme.la +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = run-export.c run-import.c run-keylist.c run-sign.c \ + run-verify.c t-data.c t-engine-info.c t-version.c +DIST_SOURCES = run-export.c run-import.c run-keylist.c run-sign.c \ + run-verify.c t-data.c t-engine-info.c t-version.c +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +HEADERS = $(noinst_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= +DIST_SUBDIRS = gpg gpgsm opassuan +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_FILEVERSION = @BUILD_FILEVERSION@ +BUILD_NUMBER = @BUILD_NUMBER@ +BUILD_TIMESTAMP = @BUILD_TIMESTAMP@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +G13 = @G13@ +GITLOG_TO_CHANGELOG = @GITLOG_TO_CHANGELOG@ +GLIBC21 = @GLIBC21@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GPG = @GPG@ +GPGCONF = @GPGCONF@ +GPGME_CONFIG_API_VERSION = @GPGME_CONFIG_API_VERSION@ +GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@ +GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@ +GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@ +GPGSM = @GPGSM@ +GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@ +GPG_ERROR_CONFIG = @GPG_ERROR_CONFIG@ +GPG_ERROR_LIBS = @GPG_ERROR_LIBS@ +GPG_PATH = @GPG_PATH@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBASSUAN_CFLAGS = @LIBASSUAN_CFLAGS@ +LIBASSUAN_CONFIG = @LIBASSUAN_CONFIG@ +LIBASSUAN_LIBS = @LIBASSUAN_LIBS@ +LIBGPGME_LT_AGE = @LIBGPGME_LT_AGE@ +LIBGPGME_LT_CURRENT = @LIBGPGME_LT_CURRENT@ +LIBGPGME_LT_REVISION = @LIBGPGME_LT_REVISION@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NEED__FILE_OFFSET_BITS = @NEED__FILE_OFFSET_BITS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +QT4_CORE_CFLAGS = @QT4_CORE_CFLAGS@ +QT4_CORE_LIBS = @QT4_CORE_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +emacs_local_vars_begin = @emacs_local_vars_begin@ +emacs_local_vars_end = @emacs_local_vars_end@ +emacs_local_vars_read_only = @emacs_local_vars_read_only@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) +EXTRA_DIST = t-data-1.txt t-data-2.txt ChangeLog-2011 +INCLUDES = -I$(top_builddir)/src +AM_CPPFLAGS = @GPG_ERROR_CFLAGS@ +LDADD = ../src/libgpgme.la @GPG_ERROR_LIBS@ +noinst_HEADERS = run-support.h +@RUN_GPG_TESTS_FALSE@gpgtests = +@RUN_GPG_TESTS_TRUE@gpgtests = gpg +@RUN_GPGSM_TESTS_FALSE@gpgsmtests = +@RUN_GPGSM_TESTS_TRUE@gpgsmtests = gpgsm opassuan +SUBDIRS = ${gpgtests} ${gpgsmtests} +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +run-export$(EXEEXT): $(run_export_OBJECTS) $(run_export_DEPENDENCIES) + @rm -f run-export$(EXEEXT) + $(LINK) $(run_export_OBJECTS) $(run_export_LDADD) $(LIBS) +run-import$(EXEEXT): $(run_import_OBJECTS) $(run_import_DEPENDENCIES) + @rm -f run-import$(EXEEXT) + $(LINK) $(run_import_OBJECTS) $(run_import_LDADD) $(LIBS) +run-keylist$(EXEEXT): $(run_keylist_OBJECTS) $(run_keylist_DEPENDENCIES) + @rm -f run-keylist$(EXEEXT) + $(LINK) $(run_keylist_OBJECTS) $(run_keylist_LDADD) $(LIBS) +run-sign$(EXEEXT): $(run_sign_OBJECTS) $(run_sign_DEPENDENCIES) + @rm -f run-sign$(EXEEXT) + $(LINK) $(run_sign_OBJECTS) $(run_sign_LDADD) $(LIBS) +run-verify$(EXEEXT): $(run_verify_OBJECTS) $(run_verify_DEPENDENCIES) + @rm -f run-verify$(EXEEXT) + $(LINK) $(run_verify_OBJECTS) $(run_verify_LDADD) $(LIBS) +t-data$(EXEEXT): $(t_data_OBJECTS) $(t_data_DEPENDENCIES) + @rm -f t-data$(EXEEXT) + $(LINK) $(t_data_OBJECTS) $(t_data_LDADD) $(LIBS) +t-engine-info$(EXEEXT): $(t_engine_info_OBJECTS) $(t_engine_info_DEPENDENCIES) + @rm -f t-engine-info$(EXEEXT) + $(LINK) $(t_engine_info_OBJECTS) $(t_engine_info_LDADD) $(LIBS) +t-version$(EXEEXT): $(t_version_OBJECTS) $(t_version_DEPENDENCIES) + @rm -f t-version$(EXEEXT) + $(LINK) $(t_version_OBJECTS) $(t_version_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-export.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-import.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-keylist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-sign.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-verify.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-data.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-engine-info.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-version.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes$$std"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-recursive +all-am: Makefile $(PROGRAMS) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \ + ctags-recursive install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-TESTS check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS ctags ctags-recursive \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am new file mode 100644 index 0000000..dd28d5e --- /dev/null +++ b/tests/gpg/Makefile.am @@ -0,0 +1,78 @@ +# Copyright (C) 2000 Werner Koch (dd9jn) +# Copyright (C) 2001, 2004, 2005, 2009 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 Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 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 Lesser General +# Public License for more details. +# +# You should have received a copy of the GNU Lesser 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 + +## Process this file with automake to produce Makefile.in + +GPG = @GPG@ + +TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO= + +# The keylist tests must come after the import and the edit test. +noinst_HEADERS = t-support.h + +if HAVE_W32_SYSTEM +tests_unix = +else +tests_unix = t-eventloop t-thread1 +endif + +TESTS = t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \ + t-decrypt t-verify t-decrypt-verify t-sig-notation t-export \ + t-import t-trustlist t-edit t-keylist t-keylist-sig t-wait \ + t-encrypt-large t-file-name t-gpgconf $(tests_unix) + +CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \ + gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \ + random_seed + +EXTRA_DIST = pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \ + geheim.txt pubkey-1.asc seckey-1.asc pinentry + +INCLUDES = -I$(top_builddir)/src + +AM_CPPFLAGS = @GPG_ERROR_CFLAGS@ +LDADD = ../../src/libgpgme.la +t_thread1_LDADD = ../../src/libgpgme-pthread.la -lpthread + +# We don't run t-genkey in the test suite, because it takes too long +noinst_PROGRAMS = $(TESTS) t-genkey + +clean-local: + -gpg-connect-agent KILLAGENT /bye + -rm -fR private-keys-v1.d + +all-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg + +export GNUPGHOME := $(abs_builddir) + +export GPG_AGENT_INFO := + +./pubring.gpg: $(srcdir)/pubdemo.asc + -$(GPG) --no-permission-warning \ + --import $(srcdir)/pubdemo.asc + -$(GPG) --no-permission-warning \ + --import $(srcdir)/secdemo.asc + +./gpg.conf: +# This is required for t-sig-notations. + echo no-force-v3-sigs > ./gpg.conf + +./gpg-agent.conf: +# This is required for gpg2, which does not support command fd. + echo pinentry-program $(abs_srcdir)/pinentry > ./gpg-agent.conf diff --git a/tests/gpg/Makefile.in b/tests/gpg/Makefile.in new file mode 100644 index 0000000..8118139 --- /dev/null +++ b/tests/gpg/Makefile.in @@ -0,0 +1,870 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright (C) 2000 Werner Koch (dd9jn) +# Copyright (C) 2001, 2004, 2005, 2009 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 Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 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 Lesser General +# Public License for more details. +# +# You should have received a copy of the GNU Lesser 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 + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +TESTS = t-encrypt$(EXEEXT) t-encrypt-sym$(EXEEXT) \ + t-encrypt-sign$(EXEEXT) t-sign$(EXEEXT) t-signers$(EXEEXT) \ + t-decrypt$(EXEEXT) t-verify$(EXEEXT) t-decrypt-verify$(EXEEXT) \ + t-sig-notation$(EXEEXT) t-export$(EXEEXT) t-import$(EXEEXT) \ + t-trustlist$(EXEEXT) t-edit$(EXEEXT) t-keylist$(EXEEXT) \ + t-keylist-sig$(EXEEXT) t-wait$(EXEEXT) \ + t-encrypt-large$(EXEEXT) t-file-name$(EXEEXT) \ + t-gpgconf$(EXEEXT) $(am__EXEEXT_1) +noinst_PROGRAMS = $(am__EXEEXT_2) t-genkey$(EXEEXT) +subdir = tests/gpg +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/glib-2.0.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnupg-ttyname.m4 \ + $(top_srcdir)/m4/gpg-error.m4 $(top_srcdir)/m4/libassuan.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +@HAVE_W32_SYSTEM_FALSE@am__EXEEXT_1 = t-eventloop$(EXEEXT) \ +@HAVE_W32_SYSTEM_FALSE@ t-thread1$(EXEEXT) +am__EXEEXT_2 = t-encrypt$(EXEEXT) t-encrypt-sym$(EXEEXT) \ + t-encrypt-sign$(EXEEXT) t-sign$(EXEEXT) t-signers$(EXEEXT) \ + t-decrypt$(EXEEXT) t-verify$(EXEEXT) t-decrypt-verify$(EXEEXT) \ + t-sig-notation$(EXEEXT) t-export$(EXEEXT) t-import$(EXEEXT) \ + t-trustlist$(EXEEXT) t-edit$(EXEEXT) t-keylist$(EXEEXT) \ + t-keylist-sig$(EXEEXT) t-wait$(EXEEXT) \ + t-encrypt-large$(EXEEXT) t-file-name$(EXEEXT) \ + t-gpgconf$(EXEEXT) $(am__EXEEXT_1) +PROGRAMS = $(noinst_PROGRAMS) +t_decrypt_SOURCES = t-decrypt.c +t_decrypt_OBJECTS = t-decrypt.$(OBJEXT) +t_decrypt_LDADD = $(LDADD) +t_decrypt_DEPENDENCIES = ../../src/libgpgme.la +t_decrypt_verify_SOURCES = t-decrypt-verify.c +t_decrypt_verify_OBJECTS = t-decrypt-verify.$(OBJEXT) +t_decrypt_verify_LDADD = $(LDADD) +t_decrypt_verify_DEPENDENCIES = ../../src/libgpgme.la +t_edit_SOURCES = t-edit.c +t_edit_OBJECTS = t-edit.$(OBJEXT) +t_edit_LDADD = $(LDADD) +t_edit_DEPENDENCIES = ../../src/libgpgme.la +t_encrypt_SOURCES = t-encrypt.c +t_encrypt_OBJECTS = t-encrypt.$(OBJEXT) +t_encrypt_LDADD = $(LDADD) +t_encrypt_DEPENDENCIES = ../../src/libgpgme.la +t_encrypt_large_SOURCES = t-encrypt-large.c +t_encrypt_large_OBJECTS = t-encrypt-large.$(OBJEXT) +t_encrypt_large_LDADD = $(LDADD) +t_encrypt_large_DEPENDENCIES = ../../src/libgpgme.la +t_encrypt_sign_SOURCES = t-encrypt-sign.c +t_encrypt_sign_OBJECTS = t-encrypt-sign.$(OBJEXT) +t_encrypt_sign_LDADD = $(LDADD) +t_encrypt_sign_DEPENDENCIES = ../../src/libgpgme.la +t_encrypt_sym_SOURCES = t-encrypt-sym.c +t_encrypt_sym_OBJECTS = t-encrypt-sym.$(OBJEXT) +t_encrypt_sym_LDADD = $(LDADD) +t_encrypt_sym_DEPENDENCIES = ../../src/libgpgme.la +t_eventloop_SOURCES = t-eventloop.c +t_eventloop_OBJECTS = t-eventloop.$(OBJEXT) +t_eventloop_LDADD = $(LDADD) +t_eventloop_DEPENDENCIES = ../../src/libgpgme.la +t_export_SOURCES = t-export.c +t_export_OBJECTS = t-export.$(OBJEXT) +t_export_LDADD = $(LDADD) +t_export_DEPENDENCIES = ../../src/libgpgme.la +t_file_name_SOURCES = t-file-name.c +t_file_name_OBJECTS = t-file-name.$(OBJEXT) +t_file_name_LDADD = $(LDADD) +t_file_name_DEPENDENCIES = ../../src/libgpgme.la +t_genkey_SOURCES = t-genkey.c +t_genkey_OBJECTS = t-genkey.$(OBJEXT) +t_genkey_LDADD = $(LDADD) +t_genkey_DEPENDENCIES = ../../src/libgpgme.la +t_gpgconf_SOURCES = t-gpgconf.c +t_gpgconf_OBJECTS = t-gpgconf.$(OBJEXT) +t_gpgconf_LDADD = $(LDADD) +t_gpgconf_DEPENDENCIES = ../../src/libgpgme.la +t_import_SOURCES = t-import.c +t_import_OBJECTS = t-import.$(OBJEXT) +t_import_LDADD = $(LDADD) +t_import_DEPENDENCIES = ../../src/libgpgme.la +t_keylist_SOURCES = t-keylist.c +t_keylist_OBJECTS = t-keylist.$(OBJEXT) +t_keylist_LDADD = $(LDADD) +t_keylist_DEPENDENCIES = ../../src/libgpgme.la +t_keylist_sig_SOURCES = t-keylist-sig.c +t_keylist_sig_OBJECTS = t-keylist-sig.$(OBJEXT) +t_keylist_sig_LDADD = $(LDADD) +t_keylist_sig_DEPENDENCIES = ../../src/libgpgme.la +t_sig_notation_SOURCES = t-sig-notation.c +t_sig_notation_OBJECTS = t-sig-notation.$(OBJEXT) +t_sig_notation_LDADD = $(LDADD) +t_sig_notation_DEPENDENCIES = ../../src/libgpgme.la +t_sign_SOURCES = t-sign.c +t_sign_OBJECTS = t-sign.$(OBJEXT) +t_sign_LDADD = $(LDADD) +t_sign_DEPENDENCIES = ../../src/libgpgme.la +t_signers_SOURCES = t-signers.c +t_signers_OBJECTS = t-signers.$(OBJEXT) +t_signers_LDADD = $(LDADD) +t_signers_DEPENDENCIES = ../../src/libgpgme.la +t_thread1_SOURCES = t-thread1.c +t_thread1_OBJECTS = t-thread1.$(OBJEXT) +t_thread1_DEPENDENCIES = ../../src/libgpgme-pthread.la +t_trustlist_SOURCES = t-trustlist.c +t_trustlist_OBJECTS = t-trustlist.$(OBJEXT) +t_trustlist_LDADD = $(LDADD) +t_trustlist_DEPENDENCIES = ../../src/libgpgme.la +t_verify_SOURCES = t-verify.c +t_verify_OBJECTS = t-verify.$(OBJEXT) +t_verify_LDADD = $(LDADD) +t_verify_DEPENDENCIES = ../../src/libgpgme.la +t_wait_SOURCES = t-wait.c +t_wait_OBJECTS = t-wait.$(OBJEXT) +t_wait_LDADD = $(LDADD) +t_wait_DEPENDENCIES = ../../src/libgpgme.la +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = t-decrypt.c t-decrypt-verify.c t-edit.c t-encrypt.c \ + t-encrypt-large.c t-encrypt-sign.c t-encrypt-sym.c \ + t-eventloop.c t-export.c t-file-name.c t-genkey.c t-gpgconf.c \ + t-import.c t-keylist.c t-keylist-sig.c t-sig-notation.c \ + t-sign.c t-signers.c t-thread1.c t-trustlist.c t-verify.c \ + t-wait.c +DIST_SOURCES = t-decrypt.c t-decrypt-verify.c t-edit.c t-encrypt.c \ + t-encrypt-large.c t-encrypt-sign.c t-encrypt-sym.c \ + t-eventloop.c t-export.c t-file-name.c t-genkey.c t-gpgconf.c \ + t-import.c t-keylist.c t-keylist-sig.c t-sig-notation.c \ + t-sign.c t-signers.c t-thread1.c t-trustlist.c t-verify.c \ + t-wait.c +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_FILEVERSION = @BUILD_FILEVERSION@ +BUILD_NUMBER = @BUILD_NUMBER@ +BUILD_TIMESTAMP = @BUILD_TIMESTAMP@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +G13 = @G13@ +GITLOG_TO_CHANGELOG = @GITLOG_TO_CHANGELOG@ +GLIBC21 = @GLIBC21@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GPG = @GPG@ +GPGCONF = @GPGCONF@ +GPGME_CONFIG_API_VERSION = @GPGME_CONFIG_API_VERSION@ +GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@ +GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@ +GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@ +GPGSM = @GPGSM@ +GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@ +GPG_ERROR_CONFIG = @GPG_ERROR_CONFIG@ +GPG_ERROR_LIBS = @GPG_ERROR_LIBS@ +GPG_PATH = @GPG_PATH@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBASSUAN_CFLAGS = @LIBASSUAN_CFLAGS@ +LIBASSUAN_CONFIG = @LIBASSUAN_CONFIG@ +LIBASSUAN_LIBS = @LIBASSUAN_LIBS@ +LIBGPGME_LT_AGE = @LIBGPGME_LT_AGE@ +LIBGPGME_LT_CURRENT = @LIBGPGME_LT_CURRENT@ +LIBGPGME_LT_REVISION = @LIBGPGME_LT_REVISION@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NEED__FILE_OFFSET_BITS = @NEED__FILE_OFFSET_BITS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +QT4_CORE_CFLAGS = @QT4_CORE_CFLAGS@ +QT4_CORE_LIBS = @QT4_CORE_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +emacs_local_vars_begin = @emacs_local_vars_begin@ +emacs_local_vars_end = @emacs_local_vars_end@ +emacs_local_vars_read_only = @emacs_local_vars_read_only@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO= + +# The keylist tests must come after the import and the edit test. +noinst_HEADERS = t-support.h +@HAVE_W32_SYSTEM_FALSE@tests_unix = t-eventloop t-thread1 +@HAVE_W32_SYSTEM_TRUE@tests_unix = +CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \ + gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \ + random_seed + +EXTRA_DIST = pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \ + geheim.txt pubkey-1.asc seckey-1.asc pinentry + +INCLUDES = -I$(top_builddir)/src +AM_CPPFLAGS = @GPG_ERROR_CFLAGS@ +LDADD = ../../src/libgpgme.la +t_thread1_LDADD = ../../src/libgpgme-pthread.la -lpthread +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/gpg/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/gpg/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +t-decrypt$(EXEEXT): $(t_decrypt_OBJECTS) $(t_decrypt_DEPENDENCIES) + @rm -f t-decrypt$(EXEEXT) + $(LINK) $(t_decrypt_OBJECTS) $(t_decrypt_LDADD) $(LIBS) +t-decrypt-verify$(EXEEXT): $(t_decrypt_verify_OBJECTS) $(t_decrypt_verify_DEPENDENCIES) + @rm -f t-decrypt-verify$(EXEEXT) + $(LINK) $(t_decrypt_verify_OBJECTS) $(t_decrypt_verify_LDADD) $(LIBS) +t-edit$(EXEEXT): $(t_edit_OBJECTS) $(t_edit_DEPENDENCIES) + @rm -f t-edit$(EXEEXT) + $(LINK) $(t_edit_OBJECTS) $(t_edit_LDADD) $(LIBS) +t-encrypt$(EXEEXT): $(t_encrypt_OBJECTS) $(t_encrypt_DEPENDENCIES) + @rm -f t-encrypt$(EXEEXT) + $(LINK) $(t_encrypt_OBJECTS) $(t_encrypt_LDADD) $(LIBS) +t-encrypt-large$(EXEEXT): $(t_encrypt_large_OBJECTS) $(t_encrypt_large_DEPENDENCIES) + @rm -f t-encrypt-large$(EXEEXT) + $(LINK) $(t_encrypt_large_OBJECTS) $(t_encrypt_large_LDADD) $(LIBS) +t-encrypt-sign$(EXEEXT): $(t_encrypt_sign_OBJECTS) $(t_encrypt_sign_DEPENDENCIES) + @rm -f t-encrypt-sign$(EXEEXT) + $(LINK) $(t_encrypt_sign_OBJECTS) $(t_encrypt_sign_LDADD) $(LIBS) +t-encrypt-sym$(EXEEXT): $(t_encrypt_sym_OBJECTS) $(t_encrypt_sym_DEPENDENCIES) + @rm -f t-encrypt-sym$(EXEEXT) + $(LINK) $(t_encrypt_sym_OBJECTS) $(t_encrypt_sym_LDADD) $(LIBS) +t-eventloop$(EXEEXT): $(t_eventloop_OBJECTS) $(t_eventloop_DEPENDENCIES) + @rm -f t-eventloop$(EXEEXT) + $(LINK) $(t_eventloop_OBJECTS) $(t_eventloop_LDADD) $(LIBS) +t-export$(EXEEXT): $(t_export_OBJECTS) $(t_export_DEPENDENCIES) + @rm -f t-export$(EXEEXT) + $(LINK) $(t_export_OBJECTS) $(t_export_LDADD) $(LIBS) +t-file-name$(EXEEXT): $(t_file_name_OBJECTS) $(t_file_name_DEPENDENCIES) + @rm -f t-file-name$(EXEEXT) + $(LINK) $(t_file_name_OBJECTS) $(t_file_name_LDADD) $(LIBS) +t-genkey$(EXEEXT): $(t_genkey_OBJECTS) $(t_genkey_DEPENDENCIES) + @rm -f t-genkey$(EXEEXT) + $(LINK) $(t_genkey_OBJECTS) $(t_genkey_LDADD) $(LIBS) +t-gpgconf$(EXEEXT): $(t_gpgconf_OBJECTS) $(t_gpgconf_DEPENDENCIES) + @rm -f t-gpgconf$(EXEEXT) + $(LINK) $(t_gpgconf_OBJECTS) $(t_gpgconf_LDADD) $(LIBS) +t-import$(EXEEXT): $(t_import_OBJECTS) $(t_import_DEPENDENCIES) + @rm -f t-import$(EXEEXT) + $(LINK) $(t_import_OBJECTS) $(t_import_LDADD) $(LIBS) +t-keylist$(EXEEXT): $(t_keylist_OBJECTS) $(t_keylist_DEPENDENCIES) + @rm -f t-keylist$(EXEEXT) + $(LINK) $(t_keylist_OBJECTS) $(t_keylist_LDADD) $(LIBS) +t-keylist-sig$(EXEEXT): $(t_keylist_sig_OBJECTS) $(t_keylist_sig_DEPENDENCIES) + @rm -f t-keylist-sig$(EXEEXT) + $(LINK) $(t_keylist_sig_OBJECTS) $(t_keylist_sig_LDADD) $(LIBS) +t-sig-notation$(EXEEXT): $(t_sig_notation_OBJECTS) $(t_sig_notation_DEPENDENCIES) + @rm -f t-sig-notation$(EXEEXT) + $(LINK) $(t_sig_notation_OBJECTS) $(t_sig_notation_LDADD) $(LIBS) +t-sign$(EXEEXT): $(t_sign_OBJECTS) $(t_sign_DEPENDENCIES) + @rm -f t-sign$(EXEEXT) + $(LINK) $(t_sign_OBJECTS) $(t_sign_LDADD) $(LIBS) +t-signers$(EXEEXT): $(t_signers_OBJECTS) $(t_signers_DEPENDENCIES) + @rm -f t-signers$(EXEEXT) + $(LINK) $(t_signers_OBJECTS) $(t_signers_LDADD) $(LIBS) +t-thread1$(EXEEXT): $(t_thread1_OBJECTS) $(t_thread1_DEPENDENCIES) + @rm -f t-thread1$(EXEEXT) + $(LINK) $(t_thread1_OBJECTS) $(t_thread1_LDADD) $(LIBS) +t-trustlist$(EXEEXT): $(t_trustlist_OBJECTS) $(t_trustlist_DEPENDENCIES) + @rm -f t-trustlist$(EXEEXT) + $(LINK) $(t_trustlist_OBJECTS) $(t_trustlist_LDADD) $(LIBS) +t-verify$(EXEEXT): $(t_verify_OBJECTS) $(t_verify_DEPENDENCIES) + @rm -f t-verify$(EXEEXT) + $(LINK) $(t_verify_OBJECTS) $(t_verify_LDADD) $(LIBS) +t-wait$(EXEEXT): $(t_wait_OBJECTS) $(t_wait_DEPENDENCIES) + @rm -f t-wait$(EXEEXT) + $(LINK) $(t_wait_OBJECTS) $(t_wait_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-decrypt-verify.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-decrypt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-edit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-encrypt-large.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-encrypt-sign.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-encrypt-sym.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-encrypt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-eventloop.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-export.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-file-name.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-genkey.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-gpgconf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-import.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-keylist-sig.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-keylist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-sig-notation.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-sign.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-signers.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-thread1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-trustlist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-verify.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-wait.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes$$std"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(PROGRAMS) $(HEADERS) all-local +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \ + clean clean-generic clean-libtool clean-local \ + clean-noinstPROGRAMS ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +clean-local: + -gpg-connect-agent KILLAGENT /bye + -rm -fR private-keys-v1.d + +all-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg + +export GNUPGHOME := $(abs_builddir) + +export GPG_AGENT_INFO := + +./pubring.gpg: $(srcdir)/pubdemo.asc + -$(GPG) --no-permission-warning \ + --import $(srcdir)/pubdemo.asc + -$(GPG) --no-permission-warning \ + --import $(srcdir)/secdemo.asc + +./gpg.conf: +# This is required for t-sig-notations. + echo no-force-v3-sigs > ./gpg.conf + +./gpg-agent.conf: +# This is required for gpg2, which does not support command fd. + echo pinentry-program $(abs_srcdir)/pinentry > ./gpg-agent.conf + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/gpg/cipher-1.asc b/tests/gpg/cipher-1.asc new file mode 100644 index 0000000..f0a8ca4 --- /dev/null +++ b/tests/gpg/cipher-1.asc @@ -0,0 +1,15 @@ +-----BEGIN PGP MESSAGE----- +Version: GnuPG v1.0.4-2 (GNU/Linux) +Comment: For info see http://www.gnupg.org + +hQEOA2rm1+5GqHH4EAP/Tcqiuhvrjj+RFBKnWn2A7f1ztV17U2EngYFy8TbZYGNp +JoMNdpA7GNZs7iqc/x1epaZDKfaQwWEtARZmK/4nlhB48N+oZeKTm7PXIkRPqrCZ +3fxJjCJaU0yrNGuO345DOr0QwDImVhubVEkfgs8yXK2Szx2G8X3LmiaILHAqA2oD +/1ZqjY8k+ovrLL/qe8un/NTwzSjKIPVGR6mhLFXmj8fnp2kSsbo+Bhh4MczTRR6l +SA32z25vcakKu2qn5Wa4yDcx9NcMt8RHXzmfMDLj6UFq99QqKeLK2ywcIpY9p/GL +fQyaf7r3HTVugBSaoOzegLJ+L7MfWohrStkMeLnJQnro0nYBjADVcUQuSS4N3lst +Df3XrxxA/iJvxt4F9K27u4tp5U1HDg1CIxVrkMs92LBri3S6ZtfjdoqQ7QghFwGP +Kw1lKiWayM6NH9rcCKSgk4kl4P/2l3f78XeFgiywN7UGeSoH3BLMSv9gSxl5KrAz +d2imhTMrfEvZ +=y4ng +-----END PGP MESSAGE----- diff --git a/tests/gpg/cipher-2.asc b/tests/gpg/cipher-2.asc new file mode 100644 index 0000000..210f3e9 --- /dev/null +++ b/tests/gpg/cipher-2.asc @@ -0,0 +1,16 @@ +-----BEGIN PGP MESSAGE----- +Version: GnuPG v1.0.6 (GNU/Linux) +Comment: Weitere Infos: siehe http://www.gnupg.org + +hQEOA++dwnahcsiBEAP9HgkC1ElQwZRX1X/MBF54Q28dpXKr84IviO4QcbnnhmYk +2IlaNe6mr8R7kNM1aqJFK3fnobqnSWwM/VBObMqqYnzZSfclCNsy66sojQJxwXcz +DKQKi69BLaC6aTMnX048tOl8pJpR72fkffUOUa5ywDHVVVUClDG3XkIrfM1du3YD +/A6vFSrRylupKhQBxdtSUx5IDmpDYwG2vqqbYKoMaQ4pPSKLYV2zskU+pQWRlk6y +nwPGY5h9eGz0xYHMPxhe9VnwljeTEDwz5U4CHF3wQ8h5WBxOVx5QN/H/UyjpmoJT +ddrIu+8GgajhBVKVYAOqr577exkiSDA60/JrYbKZBvzL0sAJAUu+HoeMPJ+5/RYF +pLSdz/3MbVDRJJqzV2TJnEBvFtPa6urzx99P0u4xr+RJMFmR9/99YXhYz7+Y6d/B +44F6B3YouYxiK39IoOUcYPZTwb5kaudD5a3mU3XxEhSDUpnyvowPiKQO1T8CPd2u +2HsD3KeaOc2VFE0gnvqECvUTQfSCZCk/kil8XVAMHZrEA0bWAYiaHfHEOB8SRCy8 +rW0wsON4uDXmZpUkfOjFoYZdpJI7fDKkb5uYUzFZDasharEaXb1X/5xSAclx +=+eYk +-----END PGP MESSAGE----- diff --git a/tests/gpg/geheim.txt b/tests/gpg/geheim.txt new file mode 100644 index 0000000..99a5478 --- /dev/null +++ b/tests/gpg/geheim.txt @@ -0,0 +1,2 @@ +Wenn Sie dies lesen können, ist es wohl nicht +geheim genug. diff --git a/tests/gpg/pinentry b/tests/gpg/pinentry new file mode 100755 index 0000000..3b99726 --- /dev/null +++ b/tests/gpg/pinentry @@ -0,0 +1,22 @@ +#! /bin/bash +# Dummy pinentry +# +# Copyright 2008 g10 Code GmbH +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This file is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. + +echo OK Your orders please + +while read cmd; do + case $cmd in + GETPIN) echo D abc; echo OK;; + *) echo OK;; + esac +done diff --git a/tests/gpg/pubdemo.asc b/tests/gpg/pubdemo.asc new file mode 100644 index 0000000..be600c7 --- /dev/null +++ b/tests/gpg/pubdemo.asc @@ -0,0 +1,586 @@ +26 demo keys [2005-10-18] + +pub 1024D/68697734 1999-03-08 Alpha Test (demo key) <alpha@example.net> +uid Alice (demo key) +uid Alfa Test (demo key) <alfa@example.net> +sub 1024g/46A871F8 1999-03-08 +pub 1024D/A9E3B0B2 1999-03-08 Bravo Test (demo key) <bravo@example.net> +uid Bob (demo key) +sub 1024g/E29BA37F 1999-03-08 +pub 1024D/1AFDAB6C 1999-03-08 Charlie Test (demo key) <charlie@example.net> +sub 1024g/BC43DA60 1999-03-08 +pub 1024D/EB9DC9E6 1999-03-08 Delta Test (demo key) <delta@example.net> +sub 1024g/B0C45424 1999-03-08 +pub 1024D/FAEF6D1B 1999-03-08 Echo Test (demo key) <echo@example.net> +uid Eve (demo key) +uid Echelon (demo key) +sub 1024g/7272144D 1999-03-08 +pub 1024D/7372E243 1999-03-08 Foxtrot Test (demo key) <foxtrot@example.net> +sub 1024g/EE45198E 1999-03-08 +pub 1024D/8FC282E6 1999-03-08 Golf Test (demo key) <golf@example.net> +sub 1024g/9DCAD354 1999-03-08 +pub 1024D/34C6E3F1 1999-03-08 Hotel Test (demo key) <hotel@example.net> +sub 1024g/D622AD0A 1999-03-08 +pub 1024D/04259677 1999-03-08 India Test (demo key) <india@example.net> +sub 1024g/61F76C73 1999-03-08 +pub 1024D/D2699313 1999-03-08 Juliet Test (demo key) <juliet@example.net> +sub 1024g/35F8F136 1999-03-08 +pub 1024D/43C2D0C7 1999-03-08 Kilo Test (demo key) <kilo@example.net> +sub 1024g/9AF64D02 1999-03-08 +pub 1024D/B79103F8 1999-03-08 Lima Test (demo key) <lima@example.net> +sub 1024g/FE56350C 1999-03-08 +pub 1024D/BE5CF886 1999-03-08 Mike Test (demo key) <mike@example.net> +uid Mallory (demo key) +sub 1024g/4F31EAE8 1999-03-08 +pub 1024D/30CEC684 1999-03-08 November Test (demo key) <november@example.net> +sub 1024g/8B70E472 1999-03-08 +pub 1024D/6D9732AC 1999-03-08 Oscar Test (demo key) <oscar@example.net> +sub 1024g/2681619F 1999-03-08 +pub 1024D/3FF13206 1999-03-08 Papa test (demo key) <papa@example.net> +sub 1024g/63330D9C 1999-03-08 +pub 1024D/3C661C84 1999-03-08 Quebec Test (demo key) <quebec@example.net> +sub 1024g/A029ACF4 1999-03-08 +pub 1024D/777FBED3 1999-03-08 Romeo Test (demo key) <romeo@example.net> +sub 1024g/11D102EA 1999-03-08 +pub 1024D/A3AE3EA1 1999-03-08 Sierra Test (demo key) <sierra@example.net> +sub 1024g/0F1B50B4 1999-03-08 +pub 1024D/85A81F38 1999-03-08 Tango Test (demo key) <tango@example.net> +sub 1024g/101C0402 1999-03-08 +pub 1024D/653244D6 1999-03-08 Uniform Test (demo key) <uniform@example.net> +sub 1024g/5522BDB9 1999-03-08 +pub 1024D/61F04784 1999-03-08 Victor Test (demo key) <victor@example.org> +sub 1024g/07287134 1999-03-08 +pub 1024D/EC67DBDE 1999-03-08 Whisky Test (demo key) <whisky@example.net> +sub 1024g/FD6E27F6 1999-03-08 +sub 1024D/E51987C9 2005-10-18 [expires: 2005-10-18] +sub 1024R/40DB9D43 2005-10-18 [expires: 2005-10-18] +pub 1024D/567FB34A 1999-03-08 XRay Test (demo key) <xray@example.net> +sub 1024g/41E408BE 1999-03-08 +pub 1024D/4B11B25F 1999-03-08 Yankee Test (demo key) <yankee@example.net> +sub 1024g/F7B080AD 1999-03-08 +pub 1024D/54ACD246 1999-03-08 Zulu Test (demo key) <zulu@example.net> +sub 1024g/A172C881 1999-03-08 + +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQGiBDbjjp4RBAC2ZbFDX0wmJI8yLDYQdIiZeAuHLmfyHsqXaLGUMZtWiAvn/hNp +ctwahmzKm5oXinHUvUkLOQ0s8rOlu15nhw4azc30rTP1LsIkn5zORNnFdgYC6RKy +hOeim/63+/yGtdnTm49lVfaCqwsEmBCEkXaeWDGq+ie1b89J89T6n/JquwCgoQkj +VeVGG+B/SzJ6+yifdH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BhJoXVdFQ6PN9yEEXUbtcrfkC51kTBk2NaEGqbB+kC8GEmXwyZcW7AQN7 +X6ikraUUm3RjTU7CvkSHobBnXYt7FhqZURpuV7eSqZGP5nP7SxWmCTTKgIH1kHCp +WRwaexKFjIIkYgyVFqtEx9cEQ6D2kXPh+RnaiEYEGBECAAYFAjbjtfIACgkQa8R3 +gFSs0kZ9YwCguRqebBzPbFnWXjOqn7ueBdjsDEAAn042F36TAKQETj5I4YRTah9H +fMeR +=oe6c +-----END PGP PUBLIC KEY BLOCK----- + diff --git a/tests/gpg/pubkey-1.asc b/tests/gpg/pubkey-1.asc new file mode 100644 index 0000000..5f913e5 --- /dev/null +++ b/tests/gpg/pubkey-1.asc @@ -0,0 +1,26 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v2.1.0-gitb3c71eb (GNU/Linux) + +mQGiBDo41NoRBADSfQazKGYf8nokq6zUKH/6INtV6MypSzSGmX2XErnARkIIPPYj +cQRQ8zCbGV7ZU2ezVbzhFLUSJveE8PZUzzCrLp1O2NSyBTRcR5HVSXW95nJfY8eV +pOvZRAKul0BVLh81kYTsrfzaaCjh9VWNP26LoeN2r+PjZyktXe7gM3C4SwCgoTxK +WUVi9HoT2HCLY7p7oig5hEcEALdCJal0UYomX3nJapIVLVZg3vkidr1RICYMb2vz +58i17h8sxEtobD1vdIKNejulntaRAXs4n0tDYD9z7pRlwG1CLz1R9WxYzeOOqUDr +fnVXdmU8L/oVWABat8v1V7QQhjMMf+41fuzVwDMMGqjVPLhu4X6wp3A8uyM3YDnQ +VMN1A/4n2G5gHoOvjqxn8Ch5tBAdMGfO8gH4RjQOwzm2R1wPQss/yzUN1+tlMZGX +K2dQ2FCWC/hDUSNaEQRlI15wxxBNZ2RQwlzE2A8v113DpvyzOtv0QO95gJ1teCXC +7j/BN9asgHaBBc39JLO/TcpuI7Hf8PQ5VcP2F0UE3lczGhXbLLRESm9lIFJhbmRv +bSBIYWNrZXIgKHRlc3Qga2V5IHdpdGggcGFzc3BocmFzZSAiYWJjIikgPGpvZUBl +eGFtcGxlLmNvbT6IYgQTEQIAIgUCTbdXqQIbIwYLCQgHAwIGFQgCCQoLBBYCAwEC +HgECF4AACgkQr4IkT5zZ/VUcCACfQvSPi//9/gBv8SVrK6O4DiyD+jAAn3LEnfF1 +4j6MjwlqXTqol2VgQn1yuQENBDo41N0QBACedJb7Qhm50JSPe1V+rSZKLHT5nc3l +2k1n7//wNsJkgDW2J7snIRjGtSzeNxMPh+hVzFidzAf3sbOlARQoBrMPPKpnJWtm +6LEDf2lSwO36l0/bo6qDRmiFRJoHWytTJEjxVwRclVt4bXqHfNw9FKhZZbcKeAN2 +oHgmBVSU6edHdwADBQP+OGAkEG4PcfSb8x191R+wkV/q2hA5Ay9z289Dx2rO28CO +4M2fhhcjSmgr6x0DsrkfESCiG47UGJ169eu+QqJwk3HiF4crGN9rE5+VelBVFtrd +MWkX2rPLGQWyw8iCZKbeH8g/ujmkaLovSmalzDcLe4v1xSLaP7Fnfzit0iIGZAGI +RgQYEQIABgUCOjjU3QAKCRCvgiRPnNn9VVSaAJ9+rj1lIQnRl20i8Rom2Hwbe3re +9QCfSYFnkZUw0yKF2DfCfqrDzdGAsbaIRgQYEQIABgUCOjjU3gAKCRCvgiRPnNn9 +Ve4iAJ9FrGMlFR7s+GWf1scTeeyrthKrPQCfSpc/Yps72aFI7hPfyIa9MuerVZ4= +=QRit +-----END PGP PUBLIC KEY BLOCK----- diff --git a/tests/gpg/secdemo.asc b/tests/gpg/secdemo.asc new file mode 100644 index 0000000..f9d1456 --- /dev/null +++ b/tests/gpg/secdemo.asc @@ -0,0 +1,62 @@ +-----BEGIN PGP PRIVATE KEY BLOCK----- +Version: GnuPG v2.1.0-gitb3c71eb (GNU/Linux) + +lQHpBDbjjp4RBAC2ZbFDX0wmJI8yLDYQdIiZeAuHLmfyHsqXaLGUMZtWiAvn/hNp +ctwahmzKm5oXinHUvUkLOQ0s8rOlu15nhw4azc30rTP1LsIkn5z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ow5H8f24gW0461q02MigdIzk00fAjc8xNZI9dN0HaICqif +tbbPCezutLGtXEb4rOhAttuMVswdGF8aerhA6lwVF8lbvLTOyf2HbLAgVs/zvEgy +LVHmXwNhoaLMcytlRL7ZpLA59C6mywH83OMYF+NHLsMRu5VwSF0ZHE3VMLb6APdI +J1qfpeQesrudHES5wb5OgX8TosiEeJ0RmEB8oU+/MIhGBBgRAgAGBQI247XyAAoJ +EGvEd4BUrNJGfWMAoLkanmwcz2xZ1l4zqp+7ngXY7AxAAJ9ONhd+kwCkBE4+SOGE +U2ofR3zHkQ== +=c9V4 +-----END PGP PRIVATE KEY BLOCK----- diff --git a/tests/gpg/seckey-1.asc b/tests/gpg/seckey-1.asc new file mode 100644 index 0000000..011061e --- /dev/null +++ b/tests/gpg/seckey-1.asc @@ -0,0 +1,30 @@ +-----BEGIN PGP PRIVATE KEY BLOCK----- +Version: GnuPG v2.1.0-gitb3c71eb (GNU/Linux) + +lQHpBDo41NoRBADSfQazKGYf8nokq6zUKH/6INtV6MypSzSGmX2XErnARkIIPPYj +cQRQ8zCbGV7ZU2ezVbzhFLUSJveE8PZUzzCrLp1O2NSyBTRcR5HVSXW95nJfY8eV +pOvZRAKul0BVLh81kYTsrfzaaCjh9VWNP26LoeN2r+PjZyktXe7gM3C4SwCgoTxK +WUVi9HoT2HCLY7p7oig5hEcEALdCJal0UYomX3nJapIVLVZg3vkidr1RICYMb2vz +58i17h8sxEtobD1vdIKNejulntaRAXs4n0tDYD9z7pRlwG1CLz1R9WxYzeOOqUDr +fnVXdmU8L/oVWABat8v1V7QQhjMMf+41fuzVwDMMGqjVPLhu4X6wp3A8uyM3YDnQ +VMN1A/4n2G5gHoOvjqxn8Ch5tBAdMGfO8gH4RjQOwzm2R1wPQss/yzUN1+tlMZGX +K2dQ2FCWC/hDUSNaEQRlI15wxxBNZ2RQwlzE2A8v113DpvyzOtv0QO95gJ1teCXC +7j/BN9asgHaBBc39JLO/TcpuI7Hf8PQ5VcP2F0UE3lczGhXbLP4HAwL0A7A1a/jY +6s5JxysLUpKA31U2SrKxePmkmzYSuAiValUVdfkmLRrLSwmNJSy5NcrBHGimja1O +fUUmPTg465j1+vD/tERKb2UgUmFuZG9tIEhhY2tlciAodGVzdCBrZXkgd2l0aCBw +YXNzcGhyYXNlICJhYmMiKSA8am9lQGV4YW1wbGUuY29tPohiBBMRAgAiBQJNt1ep +AhsjBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRCvgiRPnNn9VRwIAJ9C9I+L +//3+AG/xJWsro7gOLIP6MACfcsSd8XXiPoyPCWpdOqiXZWBCfXKdAWAEOjjU3RAE +AJ50lvtCGbnQlI97VX6tJkosdPmdzeXaTWfv//A2wmSANbYnuychGMa1LN43Ew+H +6FXMWJ3MB/exs6UBFCgGsw88qmcla2bosQN/aVLA7fqXT9ujqoNGaIVEmgdbK1Mk +SPFXBFyVW3hteod83D0UqFlltwp4A3ageCYFVJTp50d3AAMFA/44YCQQbg9x9Jvz +HX3VH7CRX+raEDkDL3Pbz0PHas7bwI7gzZ+GFyNKaCvrHQOyuR8RIKIbjtQYnXr1 +675ConCTceIXhysY32sTn5V6UFUW2t0xaRfas8sZBbLDyIJkpt4fyD+6OaRoui9K +ZqXMNwt7i/XFIto/sWd/OK3SIgZkAf4HAwIoimqPHVJZM85dNw6JtvLKFvvmkm3X +uoCUG5nU6cgk6vetUYiykuKpU4zG3mDtdZdIZf76hJJ6lZTSHH9frLy7bRYPfu/k +U1AFd1T1OxENiEYEGBECAAYFAjo41N0ACgkQr4IkT5zZ/VVUmgCffq49ZSEJ0Zdt +IvEaJth8G3t63vUAn0mBZ5GVMNMihdg3wn6qw83RgLG2iEYEGBECAAYFAjo41N4A +CgkQr4IkT5zZ/VXuIgCfRaxjJRUe7Phln9bHE3nsq7YSqz0An0qXP2KbO9mhSO4T +38iGvTLnq1We +=m0YJ +-----END PGP PRIVATE KEY BLOCK----- diff --git a/tests/gpg/t-decrypt-verify.c b/tests/gpg/t-decrypt-verify.c new file mode 100644 index 0000000..113aec1 --- /dev/null +++ b/tests/gpg/t-decrypt-verify.c @@ -0,0 +1,141 @@ +/* t-decrypt-verify.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <unistd.h> + +#include <gpgme.h> + +#include "t-support.h" + + +static void +check_verify_result (gpgme_verify_result_t result, unsigned int summary, + char *fpr, gpgme_error_t status) +{ + gpgme_signature_t sig; + + sig = result->signatures; + if (!sig || sig->next) + { + fprintf (stderr, "%s:%i: Unexpected number of signatures\n", + __FILE__, __LINE__); + exit (1); + } + if (sig->summary != summary) + { + fprintf (stderr, "%s:%i: Unexpected signature summary: 0x%x\n", + __FILE__, __LINE__, sig->summary); + exit (1); + } + if (strcmp (sig->fpr, fpr)) + { + fprintf (stderr, "%s:%i: Unexpected fingerprint: %s\n", + __FILE__, __LINE__, sig->fpr); + exit (1); + } + if (gpgme_err_code (sig->status) != status) + { + fprintf (stderr, "%s:%i: Unexpected signature status: %s\n", + __FILE__, __LINE__, gpgme_strerror (sig->status)); + exit (1); + } + if (sig->notations) + { + fprintf (stderr, "%s:%i: Unexpected notation data\n", + __FILE__, __LINE__); + exit (1); + } + if (sig->wrong_key_usage) + { + fprintf (stderr, "%s:%i: Unexpectedly wrong key usage\n", + __FILE__, __LINE__); + exit (1); + } + if (sig->validity != GPGME_VALIDITY_UNKNOWN) + { + fprintf (stderr, "%s:%i: Unexpected validity: %i\n", + __FILE__, __LINE__, sig->validity); + exit (1); + } + if (gpgme_err_code (sig->validity_reason) != GPG_ERR_NO_ERROR) + { + fprintf (stderr, "%s:%i: Unexpected validity reason: %s\n", + __FILE__, __LINE__, gpgme_strerror (sig->validity_reason)); + exit (1); + } +} + + +int +main (int argc, char *argv[]) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t in, out; + gpgme_decrypt_result_t decrypt_result; + gpgme_verify_result_t verify_result; + const char *cipher_2_asc = make_filename ("cipher-2.asc"); + char *agent_info; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + + agent_info = getenv("GPG_AGENT_INFO"); + if (!(agent_info && strchr (agent_info, ':'))) + gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL); + + err = gpgme_data_new_from_file (&in, cipher_2_asc, 1); + fail_if_err (err); + err = gpgme_data_new (&out); + fail_if_err (err); + + err = gpgme_op_decrypt_verify (ctx, in, out); + fail_if_err (err); + decrypt_result = gpgme_op_decrypt_result (ctx); + if (decrypt_result->unsupported_algorithm) + { + fprintf (stderr, "%s:%i: unsupported algorithm: %s\n", + __FILE__, __LINE__, decrypt_result->unsupported_algorithm); + exit (1); + } + print_data (out); + verify_result = gpgme_op_verify_result (ctx); + check_verify_result (verify_result, 0, + "A0FF4590BB6122EDEF6E3C542D727CC768697734", + GPG_ERR_NO_ERROR); + + gpgme_data_release (in); + gpgme_data_release (out); + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpg/t-decrypt.c b/tests/gpg/t-decrypt.c new file mode 100644 index 0000000..2a2f4d7 --- /dev/null +++ b/tests/gpg/t-decrypt.c @@ -0,0 +1,79 @@ +/* t-decrypt.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <unistd.h> + +#include <gpgme.h> + +#include "t-support.h" + + +int +main (int argc, char *argv[]) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t in, out; + gpgme_decrypt_result_t result; + const char *cipher_1_asc = make_filename ("cipher-1.asc"); + char *agent_info; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + + agent_info = getenv("GPG_AGENT_INFO"); + if (!(agent_info && strchr (agent_info, ':'))) + gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL); + + err = gpgme_data_new_from_file (&in, cipher_1_asc, 1); + fail_if_err (err); + + err = gpgme_data_new (&out); + fail_if_err (err); + + err = gpgme_op_decrypt (ctx, in, out); + fail_if_err (err); + result = gpgme_op_decrypt_result (ctx); + if (result->unsupported_algorithm) + { + fprintf (stderr, "%s:%i: unsupported algorithm: %s\n", + __FILE__, __LINE__, result->unsupported_algorithm); + exit (1); + } + print_data (out); + + gpgme_data_release (in); + gpgme_data_release (out); + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpg/t-edit.c b/tests/gpg/t-edit.c new file mode 100644 index 0000000..545db73 --- /dev/null +++ b/tests/gpg/t-edit.c @@ -0,0 +1,152 @@ +/* t-edit.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <errno.h> +#include <unistd.h> +#include <errno.h> + +#include <gpgme.h> + +#include "t-support.h" + + +static void +flush_data (gpgme_data_t dh) +{ + char buf[100]; + int ret; + + ret = gpgme_data_seek (dh, 0, SEEK_SET); + if (ret) + fail_if_err (gpgme_error_from_errno (errno)); + while ((ret = gpgme_data_read (dh, buf, 100)) > 0) + fwrite (buf, ret, 1, stdout); + if (ret < 0) + fail_if_err (gpgme_error_from_errno (errno)); +} + + +gpgme_error_t +edit_fnc (void *opaque, gpgme_status_code_t status, const char *args, int fd) +{ + char *result = NULL; + gpgme_data_t out = (gpgme_data_t) opaque; + + fputs ("[-- Response --]\n", stdout); + flush_data (out); + + fprintf (stdout, "[-- Code: %i, %s --]\n", status, args); + + if (fd >= 0) + { + if (!strcmp (args, "keyedit.prompt")) + { + static int step = 0; + + switch (step) + { + case 0: + result = "fpr"; + break; + case 1: + result = "expire"; + break; + + /* This fixes the primary user ID so the keylisting + tests will have predictable output. */ + case 2: + result = "1"; + break; + case 3: + result = "primary"; + break; + + default: + result = "quit"; + break; + } + step++; + } + else if (!strcmp (args, "keyedit.save.okay")) + result = "Y"; + else if (!strcmp (args, "keygen.valid")) + result = "0"; + } + + if (result) + { + gpgme_io_write (fd, result, strlen (result)); + gpgme_io_write (fd, "\n", 1); + } + return 0; +} + + +int +main (int argc, char **argv) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t out = NULL; + gpgme_key_t key = NULL; + const char *pattern = "Alpha"; + char *agent_info; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + err = gpgme_data_new (&out); + fail_if_err (err); + + agent_info = getenv("GPG_AGENT_INFO"); + if (!(agent_info && strchr (agent_info, ':'))) + gpgme_set_passphrase_cb (ctx, passphrase_cb, 0); + + err = gpgme_op_keylist_start (ctx, pattern, 0); + fail_if_err (err); + err = gpgme_op_keylist_next (ctx, &key); + fail_if_err (err); + err = gpgme_op_keylist_end (ctx); + fail_if_err (err); + + err = gpgme_op_edit (ctx, key, edit_fnc, out, out); + fail_if_err (err); + + fputs ("[-- Last response --]\n", stdout); + flush_data (out); + + gpgme_data_release (out); + gpgme_key_unref (key); + gpgme_release (ctx); + + return 0; +} diff --git a/tests/gpg/t-encrypt-large.c b/tests/gpg/t-encrypt-large.c new file mode 100644 index 0000000..6cc6138 --- /dev/null +++ b/tests/gpg/t-encrypt-large.c @@ -0,0 +1,143 @@ +/* t-encrypt-large.c - Regression test for large amounts of data. + Copyright (C) 2005 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#include "t-support.h" + + +struct cb_parms +{ + size_t bytes_to_send; + size_t bytes_received; +}; + + + +/* The read callback used by GPGME to read data. */ +static ssize_t +read_cb (void *handle, void *buffer, size_t size) +{ + struct cb_parms *parms = handle; + char *p = buffer; + + for (; size && parms->bytes_to_send; size--, parms->bytes_to_send--) + *p++ = rand (); + + return (p - (char*)buffer); +} + +/* The write callback used by GPGME to write data. */ +static ssize_t +write_cb (void *handle, const void *buffer, size_t size) +{ + struct cb_parms *parms = handle; + + parms->bytes_received += size; + + return size; +} + + +static void +progress_cb (void *opaque, const char *what, int type, int current, int total) +{ + /* This is just a dummy. */ +} + + + + + +int +main (int argc, char *argv[]) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + struct gpgme_data_cbs cbs; + gpgme_data_t in, out; + gpgme_key_t key[3] = { NULL, NULL, NULL }; + gpgme_encrypt_result_t result; + size_t nbytes; + struct cb_parms parms; + + if (argc > 1) + nbytes = atoi (argv[1]); + else + nbytes = 100000; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + memset (&cbs, 0, sizeof cbs); + cbs.read = read_cb; + cbs.write = write_cb; + memset (&parms, 0, sizeof parms); + parms.bytes_to_send = nbytes; + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_armor (ctx, 0); + + /* Install a progress handler to enforce a bit of more work to the + gpgme i/o system. */ + gpgme_set_progress_cb (ctx, progress_cb, NULL); + + err = gpgme_data_new_from_cbs (&in, &cbs, &parms); + fail_if_err (err); + + err = gpgme_data_new_from_cbs (&out, &cbs, &parms); + fail_if_err (err); + + err = gpgme_get_key (ctx, "A0FF4590BB6122EDEF6E3C542D727CC768697734", + &key[0], 0); + fail_if_err (err); + err = gpgme_get_key (ctx, "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", + &key[1], 0); + fail_if_err (err); + + err = gpgme_op_encrypt (ctx, key, GPGME_ENCRYPT_ALWAYS_TRUST, in, out); + fail_if_err (err); + result = gpgme_op_encrypt_result (ctx); + if (result->invalid_recipients) + { + fprintf (stderr, "Invalid recipient encountered: %s\n", + result->invalid_recipients->fpr); + exit (1); + } + printf ("plaintext=%u bytes, ciphertext=%u bytes\n", + (unsigned int)nbytes, (unsigned int)parms.bytes_received); + + gpgme_key_unref (key[0]); + gpgme_key_unref (key[1]); + gpgme_data_release (in); + gpgme_data_release (out); + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpg/t-encrypt-sign.c b/tests/gpg/t-encrypt-sign.c new file mode 100644 index 0000000..9d00340 --- /dev/null +++ b/tests/gpg/t-encrypt-sign.c @@ -0,0 +1,140 @@ +/* t-encrypt-sign.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> + +#include <gpgme.h> + +#include "t-support.h" + + +static void +check_result (gpgme_sign_result_t result, gpgme_sig_mode_t type) +{ + if (result->invalid_signers) + { + fprintf (stderr, "Invalid signer found: %s\n", + result->invalid_signers->fpr); + exit (1); + } + if (!result->signatures || result->signatures->next) + { + fprintf (stderr, "Unexpected number of signatures created\n"); + exit (1); + } + if (result->signatures->type != type) + { + fprintf (stderr, "Wrong type of signature created\n"); + exit (1); + } + if (result->signatures->pubkey_algo != GPGME_PK_DSA) + { + fprintf (stderr, "Wrong pubkey algorithm reported: %i\n", + result->signatures->pubkey_algo); + exit (1); + } + if (result->signatures->hash_algo != GPGME_MD_SHA1 + && result->signatures->hash_algo != GPGME_MD_RMD160) + { + fprintf (stderr, "Wrong hash algorithm reported: %i\n", + result->signatures->hash_algo); + exit (1); + } + if (result->signatures->sig_class != 0) + { + fprintf (stderr, "Wrong signature class reported: %u\n", + result->signatures->sig_class); + exit (1); + } + if (strcmp ("A0FF4590BB6122EDEF6E3C542D727CC768697734", + result->signatures->fpr)) + { + fprintf (stderr, "Wrong fingerprint reported: %s\n", + result->signatures->fpr); + exit (1); + } +} + + +int +main (int argc, char **argv) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t in, out; + gpgme_key_t key[3] = { NULL, NULL, NULL }; + gpgme_encrypt_result_t result; + gpgme_sign_result_t sign_result; + char *agent_info; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_textmode (ctx, 1); + gpgme_set_armor (ctx, 1); + + agent_info = getenv("GPG_AGENT_INFO"); + if (!(agent_info && strchr (agent_info, ':'))) + gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL); + + err = gpgme_data_new_from_mem (&in, "Hallo Leute\n", 12, 0); + fail_if_err (err); + + err = gpgme_data_new (&out); + fail_if_err (err); + + err = gpgme_get_key (ctx, "A0FF4590BB6122EDEF6E3C542D727CC768697734", + &key[0], 0); + fail_if_err (err); + err = gpgme_get_key (ctx, "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", + &key[1], 0); + fail_if_err (err); + + err = gpgme_op_encrypt_sign (ctx, key, GPGME_ENCRYPT_ALWAYS_TRUST, in, out); + fail_if_err (err); + result = gpgme_op_encrypt_result (ctx); + if (result->invalid_recipients) + { + fprintf (stderr, "Invalid recipient encountered: %s\n", + result->invalid_recipients->fpr); + exit (1); + } + sign_result = gpgme_op_sign_result (ctx); + check_result (sign_result, GPGME_SIG_MODE_NORMAL); + print_data (out); + + gpgme_key_unref (key[0]); + gpgme_key_unref (key[1]); + gpgme_data_release (in); + gpgme_data_release (out); + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpg/t-encrypt-sym.c b/tests/gpg/t-encrypt-sym.c new file mode 100644 index 0000000..51a3fc1 --- /dev/null +++ b/tests/gpg/t-encrypt-sym.c @@ -0,0 +1,98 @@ +/* t-encrypt-sym.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <unistd.h> + +#include <gpgme.h> + +#include "t-support.h" + + +int +main (int argc, char *argv[]) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t plain, cipher; + const char *text = "Hallo Leute\n"; + char *text2; + char *p; + size_t len; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_armor (ctx, 1); + + p = getenv("GPG_AGENT_INFO"); + if (!(p && strchr (p, ':'))) + gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL); + + err = gpgme_data_new_from_mem (&plain, text, strlen (text), 0); + fail_if_err (err); + + err = gpgme_data_new (&cipher); + fail_if_err (err); + + err = gpgme_op_encrypt (ctx, 0, 0, plain, cipher); + fail_if_err (err); + + fflush (NULL); + fputs ("Begin Result Encryption:\n", stdout); + print_data (cipher); + fputs ("End Result.\n", stdout); + + gpgme_data_seek (cipher, 0, SEEK_SET); + + gpgme_data_release (plain); + err = gpgme_data_new (&plain); + fail_if_err (err); + + err = gpgme_op_decrypt (ctx, cipher, plain); + fail_if_err (err); + + fputs ("Begin Result Decryption:\n", stdout); + print_data (plain); + fputs ("End Result.\n", stdout); + + text2 = gpgme_data_release_and_get_mem (plain, &len); + if (strncmp (text, text2, len)) + { + fprintf (stderr, "%s:%d: Wrong plaintext\n", __FILE__, __LINE__); + exit (1); + } + + gpgme_data_release (cipher); + gpgme_release (ctx); + + return 0; +} diff --git a/tests/gpg/t-encrypt.c b/tests/gpg/t-encrypt.c new file mode 100644 index 0000000..264f31a --- /dev/null +++ b/tests/gpg/t-encrypt.c @@ -0,0 +1,82 @@ +/* t-encrypt.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#include "t-support.h" + + +int +main (int argc, char *argv[]) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t in, out; + gpgme_key_t key[3] = { NULL, NULL, NULL }; + gpgme_encrypt_result_t result; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_armor (ctx, 1); + + err = gpgme_data_new_from_mem (&in, "Hallo Leute\n", 12, 0); + fail_if_err (err); + + err = gpgme_data_new (&out); + fail_if_err (err); + + err = gpgme_get_key (ctx, "A0FF4590BB6122EDEF6E3C542D727CC768697734", + &key[0], 0); + fail_if_err (err); + err = gpgme_get_key (ctx, "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", + &key[1], 0); + fail_if_err (err); + + err = gpgme_op_encrypt (ctx, key, GPGME_ENCRYPT_ALWAYS_TRUST, in, out); + fail_if_err (err); + result = gpgme_op_encrypt_result (ctx); + if (result->invalid_recipients) + { + fprintf (stderr, "Invalid recipient encountered: %s\n", + result->invalid_recipients->fpr); + exit (1); + } + print_data (out); + + gpgme_key_unref (key[0]); + gpgme_key_unref (key[1]); + gpgme_data_release (in); + gpgme_data_release (out); + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpg/t-eventloop.c b/tests/gpg/t-eventloop.c new file mode 100644 index 0000000..cb1e57c --- /dev/null +++ b/tests/gpg/t-eventloop.c @@ -0,0 +1,225 @@ +/* t-eventloop.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/select.h> + +#include <gpgme.h> + +#include "t-support.h" + + +/* Stripped down version of gpgme/wait.c. */ + +struct op_result +{ + int done; + gpgme_error_t err; +}; + +struct op_result op_result; + +struct one_fd +{ + int fd; + int dir; + gpgme_io_cb_t fnc; + void *fnc_data; +}; + +#define FDLIST_MAX 32 +struct one_fd fdlist[FDLIST_MAX]; + +gpgme_error_t +add_io_cb (void *data, int fd, int dir, gpgme_io_cb_t fnc, void *fnc_data, + void **r_tag) +{ + struct one_fd *fds = data; + int i; + + for (i = 0; i < FDLIST_MAX; i++) + { + if (fds[i].fd == -1) + { + fds[i].fd = fd; + fds[i].dir = dir; + fds[i].fnc = fnc; + fds[i].fnc_data = fnc_data; + break; + } + } + if (i == FDLIST_MAX) + return gpgme_err_make (GPG_ERR_SOURCE_USER_1, GPG_ERR_GENERAL); + *r_tag = &fds[i]; + return 0; +} + +void +remove_io_cb (void *tag) +{ + struct one_fd *fd = tag; + + fd->fd = -1; +} + +void +io_event (void *data, gpgme_event_io_t type, void *type_data) +{ + struct op_result *result = data; + + if (type == GPGME_EVENT_DONE) + { + result->done = 1; + result->err = * (gpgme_error_t *) type_data; + } +} + + +int +do_select (void) +{ + fd_set rfds; + fd_set wfds; + int i, n; + int any = 0; + + FD_ZERO (&rfds); + FD_ZERO (&wfds); + for (i = 0; i < FDLIST_MAX; i++) + if (fdlist[i].fd != -1) + FD_SET (fdlist[i].fd, fdlist[i].dir ? &rfds : &wfds); + + do + { + n = select (FD_SETSIZE, &rfds, &wfds, NULL, 0); + } + while (n < 0 && errno == EINTR); + + if (n < 0) + return n; /* Error or timeout. */ + + for (i = 0; i < FDLIST_MAX && n; i++) + { + if (fdlist[i].fd != -1) + { + if (FD_ISSET (fdlist[i].fd, fdlist[i].dir ? &rfds : &wfds)) + { + assert (n); + n--; + any = 1; + (*fdlist[i].fnc) (fdlist[i].fnc_data, fdlist[i].fd); + } + } + } + return any; +} + +int +my_wait (void) +{ + int n; + + do + { + n = do_select (); + } + while (n >= 0 && !op_result.done); + return 0; +} + + +struct gpgme_io_cbs io_cbs = + { + add_io_cb, + fdlist, + remove_io_cb, + io_event, + &op_result + }; + + +int +main (int argc, char *argv[]) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t in, out; + gpgme_key_t key[3] = { NULL, NULL, NULL }; + int i; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + for (i = 0; i < FDLIST_MAX; i++) + fdlist[i].fd = -1; + + err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP); + fail_if_err (err); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_armor (ctx, 1); + gpgme_set_io_cbs (ctx, &io_cbs); + op_result.done = 0; + + err = gpgme_data_new_from_mem (&in, "Hallo Leute\n", 12, 0); + fail_if_err (err); + + err = gpgme_data_new (&out); + fail_if_err (err); + + err = gpgme_get_key (ctx, "A0FF4590BB6122EDEF6E3C542D727CC768697734", + &key[0], 0); + fail_if_err (err); + err = gpgme_get_key (ctx, "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", + &key[1], 0); + fail_if_err (err); + + err = gpgme_op_encrypt_start (ctx, key, GPGME_ENCRYPT_ALWAYS_TRUST, in, out); + fail_if_err (err); + + my_wait (); + fail_if_err (op_result.err); + fail_if_err (err); + + fflush (NULL); + fputs ("Begin Result:\n", stdout); + print_data (out); + fputs ("End Result.\n", stdout); + + gpgme_key_unref (key[0]); + gpgme_key_unref (key[1]); + gpgme_data_release (in); + gpgme_data_release (out); + gpgme_release (ctx); + + return 0; +} diff --git a/tests/gpg/t-export.c b/tests/gpg/t-export.c new file mode 100644 index 0000000..85cff23 --- /dev/null +++ b/tests/gpg/t-export.c @@ -0,0 +1,94 @@ +/* t-export.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#include <gpgme.h> + +#include "t-support.h" + + +int +main (int argc, char **argv) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t out; + const char *pattern[] = { "Alpha", "Bob", NULL }; + gpgme_key_t keyarray[3]; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + + err = gpgme_data_new (&out); + fail_if_err (err); + + gpgme_set_armor (ctx, 1); + err = gpgme_op_export_ext (ctx, pattern, 0, out); + fail_if_err (err); + + fflush (NULL); + fputs ("Begin Result:\n", stdout); + print_data (out); + fputs ("End Result.\n", stdout); + + gpgme_data_release (out); + + /* Again. Now using a key array. */ + err = gpgme_data_new (&out); + fail_if_err (err); + + err = gpgme_get_key (ctx, "0x68697734" /* Alpha */, keyarray+0, 0); + fail_if_err (err); + err = gpgme_get_key (ctx, "0xA9E3B0B2" /* Bob */, keyarray+1, 0); + fail_if_err (err); + keyarray[2] = NULL; + + gpgme_set_armor (ctx, 1); + err = gpgme_op_export_keys (ctx, keyarray, 0, out); + fail_if_err (err); + + gpgme_key_unref (keyarray[0]); + gpgme_key_unref (keyarray[1]); + + fflush (NULL); + fputs ("Begin Result:\n", stdout); + print_data (out); + fputs ("End Result.\n", stdout); + + gpgme_data_release (out); + + + gpgme_release (ctx); + + return 0; +} diff --git a/tests/gpg/t-file-name.c b/tests/gpg/t-file-name.c new file mode 100644 index 0000000..eb20fc0 --- /dev/null +++ b/tests/gpg/t-file-name.c @@ -0,0 +1,99 @@ +/* t-file-name.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#include "t-support.h" + +#define TESTNAME "abcde12345" + + +int +main (int argc, char *argv[]) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t in, out; + gpgme_key_t key[2] = { NULL, NULL }; + gpgme_decrypt_result_t result; + char *agent_info; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_armor (ctx, 1); + + agent_info = getenv("GPG_AGENT_INFO"); + if (!(agent_info && strchr (agent_info, ':'))) + gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL); + + err = gpgme_data_new_from_mem (&in, "Hallo Leute\n", 12, 0); + fail_if_err (err); + + err = gpgme_data_set_file_name (in, TESTNAME); + fail_if_err (err); + + err = gpgme_data_new (&out); + fail_if_err (err); + + err = gpgme_get_key (ctx, "A0FF4590BB6122EDEF6E3C542D727CC768697734", + &key[0], 0); + fail_if_err (err); + + err = gpgme_op_encrypt (ctx, key, GPGME_ENCRYPT_ALWAYS_TRUST, in, out); + fail_if_err (err); + + gpgme_data_release (in); + err = gpgme_data_new (&in); + fail_if_err (err); + + err = gpgme_data_seek (out, 0, SEEK_SET); + fail_if_err (err); + + err = gpgme_op_decrypt (ctx, out, in); + fail_if_err (err); + result = gpgme_op_decrypt_result (ctx); + + if (strcmp (TESTNAME, result->file_name)) + { + fprintf (stderr, "%s:%i: Unexpected result file name: %s\n", + __FILE__, __LINE__, + result->file_name ? "(null)" : result->file_name); + exit (1); + } + + gpgme_key_unref (key[0]); + gpgme_data_release (in); + gpgme_data_release (out); + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpg/t-genkey.c b/tests/gpg/t-genkey.c new file mode 100644 index 0000000..407824f --- /dev/null +++ b/tests/gpg/t-genkey.c @@ -0,0 +1,122 @@ +/* t-genkey.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#include "t-support.h" + + +/* True if progress function printed something on the screen. */ +static int progress_called; + +static void +progress (void *self, const char *what, int type, int current, int total) +{ + if (!strcmp (what, "primegen") && !current && !total + && (type == '.' || type == '+' || type == '!' + || type == '^' || type == '<' || type == '>')) + { + printf ("%c", type); + fflush (stdout); + progress_called = 1; + } + else + { + fprintf (stderr, "unknown progress `%s' %d %d %d\n", what, type, + current, total); + exit (1); + } +} + + +int +main (int argc, char **argv) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + const char *parms = "<GnupgKeyParms format=\"internal\">\n" + "Key-Type: DSA\n" + "Key-Length: 1024\n" + "Subkey-Type: ELG-E\n" + "Subkey-Length: 1024\n" + "Name-Real: Joe Tester\n" + "Name-Comment: (pp=abc)\n" + "Name-Email: joe@foo.bar\n" + "Expire-Date: 0\n" + "Passphrase: abc\n" + "</GnupgKeyParms>\n"; + gpgme_genkey_result_t result; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + + gpgme_set_progress_cb (ctx, progress, NULL); + + err = gpgme_op_genkey (ctx, parms, NULL, NULL); + fail_if_err (err); + + result = gpgme_op_genkey_result (ctx); + if (!result) + { + fprintf (stderr, "%s:%d: gpgme_op_genkey_result returns NULL\n", + __FILE__, __LINE__); + exit (1); + } + if (progress_called) + printf ("\n"); + + printf ("Generated key: %s (%s)\n", result->fpr ? result->fpr : "none", + result->primary ? (result->sub ? "primary, sub" : "primary") + : (result->sub ? "sub" : "none")); + + if (result->fpr && strlen (result->fpr) != 40) + { + fprintf (stderr, "%s:%d: generated key has unexpected fingerprint\n", + __FILE__, __LINE__); + exit (1); + } + if (!result->primary) + { + fprintf (stderr, "%s:%d: primary key was not generated\n", + __FILE__, __LINE__); + exit (1); + } + if (!result->sub) + { + fprintf (stderr, "%s:%d: sub key was not generated\n", + __FILE__, __LINE__); + exit (1); + } + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpg/t-gpgconf.c b/tests/gpg/t-gpgconf.c new file mode 100644 index 0000000..8e487b7 --- /dev/null +++ b/tests/gpg/t-gpgconf.c @@ -0,0 +1,322 @@ +/* t-gpgconf.c - Regression test. + Copyright (C) 2001, 2004, 2007 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <unistd.h> +#include <errno.h> +#include <stdlib.h> +#include <locale.h> +#include <string.h> + +#ifdef HAVE_W32_SYSTEM +#include <windows.h> +#endif + +#include <gpgme.h> + + +#define fail_if_err(err) \ + do \ + { \ + if (err) \ + { \ + fprintf (stderr, "%s:%d: %s: %s\n", \ + __FILE__, __LINE__, gpgme_strsource (err), \ + gpgme_strerror (err)); \ + exit (1); \ + } \ + } \ + while (0) + + +void +init_gpgme (gpgme_protocol_t proto) +{ + gpgme_error_t err; + + gpgme_check_version (NULL); + setlocale (LC_ALL, ""); + gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL)); +#ifndef HAVE_W32_SYSTEM + gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL)); +#endif + + err = gpgme_engine_check_version (proto); + fail_if_err (err); +} + + +static char * +spaces (char *str, int extra) +{ + static char buf[80]; + int len = str ? strlen (str) : 0; + int n; + +#define TABSTOP 30 + n = TABSTOP - len - extra; + + memset (buf, ' ', sizeof (buf)); + if (n < 1 || n > (sizeof (buf) - 1)) + { + buf[0] = '\n'; + n = TABSTOP + 1; + } + + buf[n] = '\0'; + return buf; +} + + +void +dump_arg (int type, gpgme_conf_arg_t arg) +{ + if (!arg) + { + printf ("(none)"); + return; + } + + while (arg) + { + switch (type) + { + case GPGME_CONF_STRING: + case GPGME_CONF_PATHNAME: + case GPGME_CONF_LDAP_SERVER: + case GPGME_CONF_KEY_FPR: + case GPGME_CONF_PUB_KEY: + case GPGME_CONF_SEC_KEY: + case GPGME_CONF_ALIAS_LIST: + printf ("`%s'", arg->value.string); + break; + + case GPGME_CONF_UINT32: + printf ("%u", arg->value.uint32); + break; + + case GPGME_CONF_INT32: + printf ("%i", arg->value.int32); + break; + + case GPGME_CONF_NONE: + printf ("%i (times)", arg->value.count); + break; + + default: + printf ("(unknown type)"); + } + + arg = arg->next; + if (arg) + printf (" "); + } +} + + +void +dump_opt (gpgme_conf_opt_t opt) +{ + char level; + char runtime = (opt->flags & GPGME_CONF_RUNTIME) ? 'r' : ' '; + + switch (opt->level) + { + case GPGME_CONF_BASIC: + level = 'b'; + break; + case GPGME_CONF_ADVANCED: + level = 'a'; + break; + case GPGME_CONF_EXPERT: + level = 'e'; + break; + case GPGME_CONF_INVISIBLE: + level = 'i'; + break; + case GPGME_CONF_INTERNAL: + level = '#'; + break; + default: + level = '?'; + } + + if (opt->flags & GPGME_CONF_GROUP) + { + printf ("\n"); + printf ("%c%c [%s]%s%s\n", level, runtime, opt->name, spaces (opt->name, 5), + opt->description + ? opt->description : ""); + } + else + { + if (opt->argname) + { + char *more = (opt->flags & GPGME_CONF_LIST) ? "..." : ""; + + if (opt->flags & GPGME_CONF_OPTIONAL) + { + printf ("%c%c --%s [%s%s] %s", level, runtime, opt->name, opt->argname, more, + spaces (opt->name, 9 + strlen (opt->argname) + strlen (more))); + } + else + { + printf ("%c%c --%s %s%s %s", level, runtime, opt->name, opt->argname, more, + spaces (opt->name, 7 + strlen (opt->argname) + strlen (more))); + } + } + else + printf ("%c%c --%s%s", level, runtime, opt->name, spaces (opt->name, 5)); + + if (opt->description) + printf ("%s", opt->description); + printf ("\n"); + + if (opt->flags & GPGME_CONF_DEFAULT) + { + printf ("%s%s = ", spaces (NULL, 0), opt->argname ? opt->argname : "(default)"); + dump_arg (opt->type, opt->default_value); + printf ("\n"); + } + else if (opt->flags & GPGME_CONF_DEFAULT_DESC) + printf ("%s%s = %s\n", spaces (NULL, 0), opt->argname ? opt->argname : "(default)", + opt->default_description); + + if (opt->no_arg_value) + { + printf ("%sNo Arg Def = ", spaces (NULL, 0)); + dump_arg (opt->type, opt->no_arg_value); + printf ("\n"); + } + if (opt->value) + { + printf ("%sCurrent = ", spaces (NULL, 0)); + dump_arg (opt->type, opt->value); + printf ("\n"); + } + } + +#if 0 + arg = comp->options; + while (opt) + { + dump_opt (opt); + opt = opt->next; + } +#endif +} + + +void +dump_comp (gpgme_conf_comp_t comp) +{ + gpgme_conf_opt_t opt; + + printf ("COMPONENT\n"); + printf ("=========\n"); + printf (" Name: %s\n", comp->name); + if (comp->description) + printf (" Desc: %s\n", comp->description); + if (comp->program_name) + printf (" Path: %s\n", comp->program_name); + printf ("\n"); + + opt = comp->options; + while (opt) + { + dump_opt (opt); + opt = opt->next; + } +} + + +int +main (int argc, char **argv) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_conf_comp_t conf; + gpgme_conf_comp_t comp; + int first; + +#ifndef ENABLE_GPGCONF + return 0; +#endif + + init_gpgme (GPGME_PROTOCOL_GPGCONF); + + err = gpgme_new (&ctx); + fail_if_err (err); + + err = gpgme_op_conf_load (ctx, &conf); + fail_if_err (err); + + comp = conf; + first = 1; + while (comp) + { + if (!first) + printf ("\n"); + else + first = 0; + dump_comp (comp); + comp = comp->next; + } + +#if 1 + /* Now change something. */ + { + unsigned int count = 1; + gpgme_conf_arg_t arg; + gpgme_conf_opt_t opt; + + err = gpgme_conf_arg_new (&arg, GPGME_CONF_NONE, &count); + fail_if_err (err); + + comp = conf; + while (comp && strcmp (comp->name, "dirmngr")) + comp = comp->next; + + if (comp) + { + opt = comp->options; + while (opt && strcmp (opt->name, "verbose")) + opt = opt->next; + + /* Allow for the verbose option not to be there. */ + if (opt) + { + err = gpgme_conf_opt_change (opt, 0, arg); + fail_if_err (err); + + err = gpgme_op_conf_save (ctx, comp); + fail_if_err (err); + } + } + } +#endif + + gpgme_conf_release (conf); + + return 0; +} diff --git a/tests/gpg/t-import.c b/tests/gpg/t-import.c new file mode 100644 index 0000000..d673f87 --- /dev/null +++ b/tests/gpg/t-import.c @@ -0,0 +1,245 @@ +/* t-import.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> + +#include <gpgme.h> + +#include "t-support.h" + + +void +check_result (gpgme_import_result_t result, char *fpr, int secret) +{ + if (result->considered != 1 && (secret && result->considered != 3)) + { + fprintf (stderr, "Unexpected number of considered keys %i\n", + result->considered); + exit (1); + } + if (result->no_user_id != 0) + { + fprintf (stderr, "Unexpected number of user ids %i\n", + result->no_user_id); + exit (1); + } + if ((secret && result->imported != 0) + || (!secret && (result->imported != 0 && result->imported != 1))) + { + fprintf (stderr, "Unexpected number of imported keys %i\n", + result->imported); + exit (1); + } + if (result->imported_rsa != 0) + { + fprintf (stderr, "Unexpected number of imported RSA keys %i\n", + result->imported_rsa); + exit (1); + } + if ((secret && (result->unchanged != 0 && result->unchanged != 1)) + || (!secret && ((result->imported == 0 && result->unchanged != 1) + || (result->imported == 1 && result->unchanged != 0)))) + { + fprintf (stderr, "Unexpected number of unchanged keys %i\n", + result->unchanged); + exit (1); + } + if (result->new_user_ids != 0) + { + fprintf (stderr, "Unexpected number of new user IDs %i\n", + result->new_user_ids); + exit (1); + } + if (result->new_sub_keys != 0) + { + fprintf (stderr, "Unexpected number of new sub keys %i\n", + result->new_sub_keys); + exit (1); + } + if ((secret + && ((result->secret_imported == 0 && result->new_signatures != 0) + || (result->secret_imported == 1 && result->new_signatures > 1))) + || (!secret && result->new_signatures != 0)) + { + fprintf (stderr, "Unexpected number of new signatures %i\n", + result->new_signatures); + if (result->new_signatures == 2) + fprintf (stderr, "### ignored due to gpg 1.3.4 problems\n"); + else + exit (1); + } + if (result->new_revocations != 0) + { + fprintf (stderr, "Unexpected number of new revocations %i\n", + result->new_revocations); + exit (1); + } + if ((secret && result->secret_read != 1 && result->secret_read != 3) + || (!secret && result->secret_read != 0)) + { + fprintf (stderr, "Unexpected number of secret keys read %i\n", + result->secret_read); + exit (1); + } + if ((secret && result->secret_imported != 0 && result->secret_imported != 1 + && result->secret_imported != 2) + || (!secret && result->secret_imported != 0)) + { + fprintf (stderr, "Unexpected number of secret keys imported %i\n", + result->secret_imported); + exit (1); + } + if ((secret + && ((result->secret_imported == 0 && result->secret_unchanged != 1 + && result->secret_unchanged != 2) + || (result->secret_imported == 1 && result->secret_unchanged != 0))) + || (!secret && result->secret_unchanged != 0)) + { + fprintf (stderr, "Unexpected number of secret keys unchanged %i\n", + result->secret_unchanged); + exit (1); + } + if (result->not_imported != 0) + { + fprintf (stderr, "Unexpected number of secret keys not imported %i\n", + result->not_imported); + exit (1); + } + if (secret) + { + if (!result->imports + || (result->imports->next && result->imports->next->next)) + { + fprintf (stderr, "Unexpected number of status reports\n"); + exit (1); + } + } + else + { + if (!result->imports || result->imports->next) + { + fprintf (stderr, "Unexpected number of status reports\n"); + exit (1); + } + } + if (strcmp (fpr, result->imports->fpr)) + { + fprintf (stderr, "Unexpected fingerprint %s\n", + result->imports->fpr); + exit (1); + } + if (result->imports->next && strcmp (fpr, result->imports->next->fpr)) + { + fprintf (stderr, "Unexpected fingerprint on second status %s\n", + result->imports->next->fpr); + exit (1); + } + if (result->imports->result != 0) + { + fprintf (stderr, "Unexpected status result %s\n", + gpgme_strerror (result->imports->result)); + exit (1); + } +#if 0 + if (secret) + { + if (result->secret_imported == 0) + { + if (result->imports->status != GPGME_IMPORT_SECRET) + { + fprintf (stderr, "Unexpected status %i\n", + result->imports->status); + exit (1); + } + } + else + { + if (result->imports->status + != (GPGME_IMPORT_SECRET | GPGME_IMPORT_NEW) + || (result->imports->next + && result->imports->next->status != GPGME_IMPORT_SIG)) + { + fprintf (stderr, "Unexpected status %i\n", + result->imports->status); + exit (1); + } + } + } + else + { + if ((result->imported == 0 && result->imports->status != 0) + || (result->imported == 1 + && result->imports->status != GPGME_IMPORT_NEW)) + { + fprintf (stderr, "Unexpected status %i\n", + result->imports->status); + exit (1); + } + } +#endif +} + + +int +main (int argc, char *argv[]) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t in; + gpgme_import_result_t result; + const char *pubkey_1_asc = make_filename ("pubkey-1.asc"); + const char *seckey_1_asc = make_filename ("seckey-1.asc"); + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + + err = gpgme_data_new_from_file (&in, pubkey_1_asc, 1); + fail_if_err (err); + + err = gpgme_op_import (ctx, in); + fail_if_err (err); + result = gpgme_op_import_result (ctx); + check_result (result, "ADAB7FCC1F4DE2616ECFA402AF82244F9CD9FD55", 0); + gpgme_data_release (in); + + err = gpgme_data_new_from_file (&in, seckey_1_asc, 1); + fail_if_err (err); + + err = gpgme_op_import (ctx, in); + fail_if_err (err); + result = gpgme_op_import_result (ctx); + check_result (result, "ADAB7FCC1F4DE2616ECFA402AF82244F9CD9FD55", 1); + gpgme_data_release (in); + + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpg/t-keylist-sig.c b/tests/gpg/t-keylist-sig.c new file mode 100644 index 0000000..9482c74 --- /dev/null +++ b/tests/gpg/t-keylist-sig.c @@ -0,0 +1,631 @@ +/* t-keylist-sig.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#include "t-support.h" + + +struct +{ + char *fpr; + char *sec_keyid; + struct + { + char *name; + char *comment; + char *email; + struct + { + gpgme_pubkey_algo_t algo; + char *keyid; + char *name; + char *comment; + char *email; + unsigned int sig_class; + int exportable; + } sig; + } uid[3]; +} +keys[] = + { + { "A0FF4590BB6122EDEF6E3C542D727CC768697734", "6AE6D7EE46A871F8", + { { "Alfa Test", "demo key", "alfa@example.net", + { GPGME_PK_DSA, "2D727CC768697734", + "Alfa Test", "demo key", "alfa@example.net", 19, 1 } }, + { "Alpha Test", "demo key", "alpha@example.net", + { GPGME_PK_DSA, "2D727CC768697734", + "Alfa Test", "demo key", "alfa@example.net", 19, 1 } }, + { "Alice", "demo key", NULL, + { GPGME_PK_DSA, "2D727CC768697734", + "Alfa Test", "demo key", "alfa@example.net", 19, 1 } } } }, + { NULL } + }; + + +int +main (int argc, char **argv) +{ + gpgme_error_t err; + gpgme_ctx_t ctx; + gpgme_key_t key; + gpgme_keylist_result_t result; + int mode; + int i = 0; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + + mode = gpgme_get_keylist_mode (ctx); + mode |= GPGME_KEYLIST_MODE_SIGS; + err = gpgme_set_keylist_mode (ctx, mode); + fail_if_err (err); + + err = gpgme_op_keylist_start (ctx, "Alpha", 0); + fail_if_err (err); + + while (!(err = gpgme_op_keylist_next (ctx, &key))) + { + if (!keys[i].fpr) + { + fprintf (stderr, "More keys returned than expected\n"); + exit (1); + } + + /* Global key flags. */ + if (key->revoked) + { + fprintf (stderr, "Key unexpectedly revoked\n"); + exit (1); + } + if (key->expired) + { + fprintf (stderr, "Key unexpectedly expired\n"); + exit (1); + } + if (key->disabled) + { + fprintf (stderr, "Key unexpectedly disabled\n"); + exit (1); + } + if (key->invalid) + { + fprintf (stderr, "Key unexpectedly invalid\n"); + exit (1); + } + if (!key->can_encrypt) + { + fprintf (stderr, "Key unexpectedly unusable for encryption\n"); + exit (1); + } + if (!key->can_sign) + { + fprintf (stderr, "Key unexpectedly unusable for signing\n"); + exit (1); + } + if (!key->can_certify) + { + fprintf (stderr, "Key unexpectedly unusable for certifications\n"); + exit (1); + } + if (key->secret) + { + fprintf (stderr, "Key unexpectedly secret\n"); + exit (1); + } + if (key->protocol != GPGME_PROTOCOL_OpenPGP) + { + fprintf (stderr, "Key has unexpected protocol: %s\n", + gpgme_get_protocol_name (key->protocol)); + exit (1); + } + if (key->issuer_serial) + { + fprintf (stderr, "Key unexpectedly carries issuer serial: %s\n", + key->issuer_serial); + exit (1); + } + if (key->issuer_name) + { + fprintf (stderr, "Key unexpectedly carries issuer name: %s\n", + key->issuer_name); + exit (1); + } + if (key->chain_id) + { + fprintf (stderr, "Key unexpectedly carries chain ID: %s\n", + key->chain_id); + exit (1); + } + if (key->owner_trust != GPGME_VALIDITY_UNKNOWN) + { + fprintf (stderr, "Key has unexpected owner trust: %i\n", + key->owner_trust); + exit (1); + } + if (!key->subkeys || !key->subkeys->next || key->subkeys->next->next) + { + fprintf (stderr, "Key has unexpected number of subkeys\n"); + exit (1); + } + + /* Primary key. */ + if (key->subkeys->revoked) + { + fprintf (stderr, "Primary key unexpectedly revoked\n"); + exit (1); + } + if (key->subkeys->expired) + { + fprintf (stderr, "Primary key unexpectedly expired\n"); + exit (1); + } + if (key->subkeys->disabled) + { + fprintf (stderr, "Primary key unexpectedly disabled\n"); + exit (1); + } + if (key->subkeys->invalid) + { + fprintf (stderr, "Primary key unexpectedly invalid\n"); + exit (1); + } + if (key->subkeys->can_encrypt) + { + fprintf (stderr, "Primary key unexpectedly usable for encryption\n"); + exit (1); + } + if (!key->subkeys->can_sign) + { + fprintf (stderr, "Primary key unexpectedly unusable for signing\n"); + exit (1); + } + if (!key->subkeys->can_certify) + { + fprintf (stderr, "Primary key unexpectedly unusable for certifications\n"); + exit (1); + } + if (key->subkeys->secret) + { + fprintf (stderr, "Primary key unexpectedly secret\n"); + exit (1); + } + if (key->subkeys->pubkey_algo != GPGME_PK_DSA) + { + fprintf (stderr, "Primary key has unexpected public key algo: %s\n", + gpgme_pubkey_algo_name (key->subkeys->pubkey_algo)); + exit (1); + } + if (key->subkeys->length != 1024) + { + fprintf (stderr, "Primary key has unexpected length: %i\n", + key->subkeys->length); + exit (1); + } + if (strcmp (key->subkeys->keyid, &keys[i].fpr[40 - 16])) + { + fprintf (stderr, "Primary key has unexpected key ID: %s\n", + key->subkeys->keyid); + exit (1); + } + if (strcmp (key->subkeys->fpr, keys[i].fpr)) + { + fprintf (stderr, "Primary key has unexpected fingerprint: %s\n", + key->subkeys->fpr); + exit (1); + } + if (key->subkeys->expires) + { + fprintf (stderr, "Primary key unexpectedly expires: %lu\n", + key->subkeys->expires); + exit (1); + } + + /* Secondary key. */ + if (key->subkeys->next->revoked) + { + fprintf (stderr, "Secondary key unexpectedly revoked\n"); + exit (1); + } + if (key->subkeys->next->expired) + { + fprintf (stderr, "Secondary key unexpectedly expired\n"); + exit (1); + } + if (key->subkeys->next->disabled) + { + fprintf (stderr, "Secondary key unexpectedly disabled\n"); + exit (1); + } + if (key->subkeys->next->invalid) + { + fprintf (stderr, "Secondary key unexpectedly invalid\n"); + exit (1); + } + if (!key->subkeys->next->can_encrypt) + { + fprintf (stderr, "Secondary key unexpectedly unusable for encryption\n"); + exit (1); + } + if (key->subkeys->next->can_sign) + { + fprintf (stderr, "Secondary key unexpectedly usable for signing\n"); + exit (1); + } + if (key->subkeys->next->can_certify) + { + fprintf (stderr, "Secondary key unexpectedly usable for certifications\n"); + exit (1); + } + if (key->subkeys->next->secret) + { + fprintf (stderr, "Secondary key unexpectedly secret\n"); + exit (1); + } + if (key->subkeys->next->pubkey_algo != GPGME_PK_ELG_E) + { + fprintf (stderr, "Secondary key has unexpected public key algo: %s\n", + gpgme_pubkey_algo_name (key->subkeys->next->pubkey_algo)); + exit (1); + } + if (key->subkeys->next->length != 1024) + { + fprintf (stderr, "Secondary key has unexpected length: %i\n", + key->subkeys->next->length); + exit (1); + } + if (strcmp (key->subkeys->next->keyid, keys[i].sec_keyid)) + { + fprintf (stderr, "Secondary key has unexpected key ID: %s\n", + key->subkeys->next->keyid); + exit (1); + } + if (!key->subkeys->next->fpr) + { + fprintf (stderr, "Secondary key has unexpectedly no fingerprint\n"); + exit (1); + } + if (key->subkeys->next->expires) + { + fprintf (stderr, "Secondary key unexpectedly expires: %lu\n", + key->subkeys->next->expires); + exit (1); + } + + /* FIXME: The below test will crash if we want to check for a + name, comment or email that doesn't exist in the key's user + IDs. */ + if (!((!keys[i].uid[0].name && !key->uids) + || (keys[i].uid[0].name && !keys[i].uid[1].name + && key->uids && !key->uids->next) + || (keys[i].uid[0].name && keys[i].uid[1].name + && !keys[i].uid[2].name + && key->uids && key->uids->next && !key->uids->next->next) + || (keys[i].uid[0].name && keys[i].uid[1].name + && keys[i].uid[2].name + && key->uids && key->uids->next && key->uids->next->next + && !key->uids->next->next->next))) + { + fprintf (stderr, "Key has unexpected number of user IDs\n"); + exit (1); + } + if (key->uids && key->uids->revoked) + { + fprintf (stderr, "First user ID unexpectedly revoked\n"); + exit (1); + } + if (key->uids && key->uids->invalid) + { + fprintf (stderr, "First user ID unexpectedly invalid\n"); + exit (1); + } + if (key->uids && key->uids->validity != GPGME_VALIDITY_UNKNOWN) + { + fprintf (stderr, "First user ID has unexpectedly validity: %i\n", + key->uids->validity); + exit (1); + } + if (keys[i].uid[0].name + && strcmp (keys[i].uid[0].name, key->uids->name)) + { + fprintf (stderr, "Unexpected name in first user ID: %s\n", + key->uids->name); + exit (1); + } + if (keys[i].uid[0].comment + && strcmp (keys[i].uid[0].comment, key->uids->comment)) + { + fprintf (stderr, "Unexpected comment in first user ID: %s\n", + key->uids->comment); + exit (1); + } + if (keys[i].uid[0].email + && strcmp (keys[i].uid[0].email, key->uids->email)) + { + fprintf (stderr, "Unexpected email in first user ID: %s\n", + key->uids->email); + exit (1); + } + if (key->uids && (!key->uids->signatures || key->uids->signatures->next)) + { + fprintf (stderr, "First user ID unexpected number of signatures\n"); + exit (1); + } + if (keys[i].uid[0].sig.algo != key->uids->signatures->pubkey_algo) + { + fprintf (stderr, "Unexpected algorithm in first user ID sig: %s\n", + gpgme_pubkey_algo_name (key->uids->signatures->pubkey_algo)); + exit (1); + } + if (strcmp (keys[i].uid[0].sig.keyid, key->uids->signatures->keyid)) + { + fprintf (stderr, "Unexpected key ID in first user ID sig: %s\n", + key->uids->signatures->keyid); + exit (1); + } + if (strcmp (keys[i].uid[0].sig.name, key->uids->signatures->name)) + { + fprintf (stderr, "Unexpected name in first user ID sig: %s\n", + key->uids->signatures->name); + exit (1); + } + if (strcmp (keys[i].uid[0].sig.comment, key->uids->signatures->comment)) + { + fprintf (stderr, "Unexpected comment in first user ID sig: %s\n", + key->uids->signatures->comment); + exit (1); + } + if (strcmp (keys[i].uid[0].sig.email, key->uids->signatures->email)) + { + fprintf (stderr, "Unexpected email in first user ID sig: %s\n", + key->uids->signatures->email); + exit (1); + } + if (keys[i].uid[0].sig.sig_class != key->uids->signatures->sig_class) + { + fprintf (stderr, "Unexpected class in first user ID sig: %i\n", + key->uids->signatures->sig_class); + exit (1); + } + if (keys[i].uid[0].sig.exportable != key->uids->signatures->exportable) + { + fprintf (stderr, "Unexpected exportable stat in first user ID sig: %i\n", + key->uids->signatures->exportable); + exit (1); + } + + if (key->uids && key->uids->next && key->uids->next->revoked) + { + fprintf (stderr, "Second user ID unexpectedly revoked\n"); + exit (1); + } + if (key->uids && key->uids->next && key->uids->next->invalid) + { + fprintf (stderr, "Second user ID unexpectedly invalid\n"); + exit (1); + } + if (key->uids && key->uids->next + && key->uids->next->validity != GPGME_VALIDITY_UNKNOWN) + { + fprintf (stderr, "Second user ID has unexpectedly validity: %i\n", + key->uids->next->validity); + exit (1); + } + if (keys[i].uid[1].name + && strcmp (keys[i].uid[1].name, key->uids->next->name)) + { + fprintf (stderr, "Unexpected name in second user ID: %s\n", + key->uids->next->name); + exit (1); + } + if (keys[i].uid[1].comment + && strcmp (keys[i].uid[1].comment, key->uids->next->comment)) + { + fprintf (stderr, "Unexpected comment in second user ID: %s\n", + key->uids->next->comment); + exit (1); + } + if (keys[i].uid[1].email + && strcmp (keys[i].uid[1].email, key->uids->next->email)) + { + fprintf (stderr, "Unexpected email in second user ID: %s\n", + key->uids->next->email); + exit (1); + } + /*FIXME: There is a bug in gpg 1.3.4 which duplicates a signaure + after importing the secret key. We disable this test for + now. */ +#ifdef __GNUC__ +#warning test disabled due to problems with gpg 1.3.4 generated key +#endif + if (key->uids && (!key->uids->next->signatures /*|| key->uids->next->signatures->next*/)) + { + fprintf (stderr, "Second user ID unexpected number of signatures\n"); + exit (1); + } + if (keys[i].uid[1].sig.algo != key->uids->next->signatures->pubkey_algo) + { + fprintf (stderr, "Unexpected algorithm in second user ID sig: %s\n", + gpgme_pubkey_algo_name (key->uids->next->signatures->pubkey_algo)); + exit (1); + } + if (strcmp (keys[i].uid[1].sig.keyid, key->uids->next->signatures->keyid)) + { + fprintf (stderr, "Unexpected key ID in second user ID sig: %s\n", + key->uids->next->signatures->keyid); + exit (1); + } + if (strcmp (keys[i].uid[1].sig.name, key->uids->next->signatures->name)) + { + fprintf (stderr, "Unexpected name in second user ID sig: %s\n", + key->uids->next->signatures->name); + exit (1); + } + if (strcmp (keys[i].uid[1].sig.comment, key->uids->next->signatures->comment)) + { + fprintf (stderr, "Unexpected comment in second user ID sig: %s\n", + key->uids->next->signatures->comment); + exit (1); + } + if (strcmp (keys[i].uid[1].sig.email, key->uids->next->signatures->email)) + { + fprintf (stderr, "Unexpected email in second user ID sig: %s\n", + key->uids->next->signatures->email); + exit (1); + } + if (keys[i].uid[1].sig.sig_class != key->uids->next->signatures->sig_class) + { + fprintf (stderr, "Unexpected class in second user ID sig: %i\n", + key->uids->next->signatures->sig_class); + exit (1); + } + if (keys[i].uid[1].sig.exportable != key->uids->next->signatures->exportable) + { + fprintf (stderr, "Unexpected exportable stat in second user ID sig: %i\n", + key->uids->next->signatures->exportable); + exit (1); + } + + if (key->uids && key->uids->next && key->uids->next->next + && key->uids->next->next->revoked) + { + fprintf (stderr, "Third user ID unexpectedly revoked\n"); + exit (1); + } + if (key->uids && key->uids->next && key->uids->next->next + && key->uids->next->next->invalid) + { + fprintf (stderr, "Third user ID unexpectedly invalid\n"); + exit (1); + } + if (key->uids && key->uids->next && key->uids->next->next + && key->uids->next->next->validity != GPGME_VALIDITY_UNKNOWN) + { + fprintf (stderr, "Third user ID has unexpectedly validity: %i\n", + key->uids->next->next->validity); + exit (1); + } + if (keys[i].uid[2].name + && strcmp (keys[i].uid[2].name, key->uids->next->next->name)) + { + fprintf (stderr, "Unexpected name in third user ID: %s\n", + key->uids->next->next->name); + exit (1); + } + if (keys[i].uid[2].comment + && strcmp (keys[i].uid[2].comment, key->uids->next->next->comment)) + { + fprintf (stderr, "Unexpected comment in third user ID: %s\n", + key->uids->next->next->comment); + exit (1); + } + if (keys[i].uid[2].email + && strcmp (keys[i].uid[2].email, key->uids->next->next->email)) + { + fprintf (stderr, "Unexpected email in third user ID: %s\n", + key->uids->next->next->email); + exit (1); + } + if (key->uids && (!key->uids->next->next->signatures + || key->uids->next->next->signatures->next)) + { + fprintf (stderr, "Third user ID unexpected number of signatures\n"); + exit (1); + } + if (keys[i].uid[2].sig.algo != key->uids->next->next->signatures->pubkey_algo) + { + fprintf (stderr, "Unexpected algorithm in third user ID sig: %s\n", + gpgme_pubkey_algo_name (key->uids->next->next->signatures->pubkey_algo)); + exit (1); + } + if (strcmp (keys[i].uid[2].sig.keyid, key->uids->next->next->signatures->keyid)) + { + fprintf (stderr, "Unexpected key ID in third user ID sig: %s\n", + key->uids->next->next->signatures->keyid); + exit (1); + } + if (strcmp (keys[i].uid[2].sig.name, key->uids->next->next->signatures->name)) + { + fprintf (stderr, "Unexpected name in third user ID sig: %s\n", + key->uids->next->next->signatures->name); + exit (1); + } + if (strcmp (keys[i].uid[2].sig.comment, key->uids->next->next->signatures->comment)) + { + fprintf (stderr, "Unexpected comment in third user ID sig: %s\n", + key->uids->next->next->signatures->comment); + exit (1); + } + if (strcmp (keys[i].uid[2].sig.email, key->uids->next->next->signatures->email)) + { + fprintf (stderr, "Unexpected email in third user ID sig: %s\n", + key->uids->next->next->signatures->email); + exit (1); + } + if (keys[i].uid[2].sig.sig_class != key->uids->next->next->signatures->sig_class) + { + fprintf (stderr, "Unexpected class in third user ID sig: %i\n", + key->uids->next->next->signatures->sig_class); + exit (1); + } + if (keys[i].uid[2].sig.exportable != key->uids->next->next->signatures->exportable) + { + fprintf (stderr, "Unexpected exportable stat in third user ID sig: %i\n", + key->uids->next->next->signatures->exportable); + exit (1); + } + + gpgme_key_unref (key); + i++; + } + if (gpgme_err_code (err) != GPG_ERR_EOF) + fail_if_err (err); + err = gpgme_op_keylist_end (ctx); + fail_if_err (err); + + result = gpgme_op_keylist_result (ctx); + if (result->truncated) + { + fprintf (stderr, "Key listing unexpectedly truncated\n"); + exit (1); + } + + if (keys[i].fpr) + { + fprintf (stderr, "Less keys returned than expected\n"); + exit (1); + } + + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpg/t-keylist.c b/tests/gpg/t-keylist.c new file mode 100644 index 0000000..67844cb --- /dev/null +++ b/tests/gpg/t-keylist.c @@ -0,0 +1,602 @@ +/* t-keylist.c - regression test + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#include "t-support.h" + + +struct key_info_s +{ + char *fpr; + char *sec_keyid; + struct + { + char *name; + char *comment; + char *email; + } uid[3]; + int n_subkeys; + void (*misc_check)(struct key_info_s *keyinfo, gpgme_key_t key); +}; + + +static void check_whisky (struct key_info_s *keyinfo, gpgme_key_t key); + + + +struct key_info_s keys[] = + { + { "A0FF4590BB6122EDEF6E3C542D727CC768697734", "6AE6D7EE46A871F8", + { { "Alfa Test", "demo key", "alfa@example.net" }, + { "Alpha Test", "demo key", "alpha@example.net" }, + { "Alice", "demo key", NULL } }, 1 }, + { "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", "5381EA4EE29BA37F", + { { "Bob", "demo key", NULL }, + { "Bravo Test", "demo key", "bravo@example.net" } }, 1 }, + { "61EE841A2A27EB983B3B3C26413F4AF31AFDAB6C", "E71E72ACBC43DA60", + { { "Charlie Test", "demo key", "charlie@example.net" } }, 1 }, + { "6560C59C43D031C54D7C588EEBA9F240EB9DC9E6", "06F22880B0C45424", + { { "Delta Test", "demo key", "delta@example.net" } }, 1 }, + { "3531152DE293E26A07F504BC318C1FAEFAEF6D1B", "B5C79E1A7272144D", + { { "Echelon", "demo key", NULL }, + { "Echo Test", "demo key", "echo@example.net" }, + { "Eve", "demo key", NULL } }, 1 }, + { "56D33268F7FE693FBB594762D4BF57F37372E243", "0A32EE79EE45198E", + { { "Foxtrot Test", "demo key", "foxtrot@example.net" } }, 1 }, + { "C9C07DCC6621B9FB8D071B1D168410A48FC282E6", "247491CC9DCAD354", + { { "Golf Test", "demo key", "golf@example.net" } }, 1 }, + { "9E91CBB11E4D4135583EF90513DB965534C6E3F1", "76E26537D622AD0A", + { { "Hotel Test", "demo key", "hotel@example.net" } }, 1 }, + { "CD538D6CC9FB3D745ECDA5201FE8FC6F04259677", "C1C8EFDE61F76C73", + { { "India Test", "demo key", "india@example.net" } }, 1 }, + { "F8F1EDC73995AB739AD54B380C820C71D2699313", "BD0B108735F8F136", + { { "Juliet Test", "demo key", "juliet@example.net" } }, 1 }, + { "3FD11083779196C2ECDD9594AD1B0FAD43C2D0C7", "86CBB34A9AF64D02", + { { "Kilo Test", "demo key", "kilo@example.net" } }, 1 }, + { "1DDD28CEF714F5B03B8C246937CAB51FB79103F8", "0363B449FE56350C", + { { "Lima Test", "demo key", "lima@example.net" } }, 1 }, + { "2686AA191A278013992C72EBBE794852BE5CF886", "5F600A834F31EAE8", + { { "Mallory", "demo key", NULL }, + { "Mike Test", "demo key", "mike@example.net" } }, 1 }, + { "5AB9D6D7BAA1C95B3BAA3D9425B00FD430CEC684", "4C1D63308B70E472", + { { "November Test", "demo key", "november@example.net" } }, 1 }, + { "43929E89F8F79381678CAE515F6356BA6D9732AC", "FF0785712681619F", + { { "Oscar Test", "demo key", "oscar@example.net" } }, 1 }, + { "6FAA9C201E5E26DCBAEC39FD5D15E01D3FF13206", "2764E18263330D9C", + { { "Papa test", "demo key", "papa@example.net" } }, 1 }, + { "A7969DA1C3297AA96D49843F1C67EC133C661C84", "6CDCFC44A029ACF4", + { { "Quebec Test", "demo key", "quebec@example.net" } }, 1 }, + { "38FBE1E4BF6A5E1242C8F6A13BDBEDB1777FBED3", "9FAB805A11D102EA", + { { "Romeo Test", "demo key", "romeo@example.net" } }, 1 }, + { "045B2334ADD69FC221076841A5E67F7FA3AE3EA1", "93B88B0F0F1B50B4", + { { "Sierra Test", "demo key", "sierra@example.net" } }, 1 }, + { "ECAC774F4EEEB0620767044A58CB9A4C85A81F38", "97B60E01101C0402", + { { "Tango Test", "demo key", "tango@example.net" } }, 1 }, + { "0DBCAD3F08843B9557C6C4D4A94C0F75653244D6", "93079B915522BDB9", + { { "Uniform Test", "demo key", "uniform@example.net" } }, 1 }, + { "E8143C489C8D41124DC40D0B47AF4B6961F04784", "04071FB807287134", + { { "Victor Test", "demo key", "victor@example.org" } }, 1 }, + { "E8D6C90B683B0982BD557A99DEF0F7B8EC67DBDE", "D7FBB421FD6E27F6", + { { "Whisky Test", "demo key", "whisky@example.net" } }, 3, + check_whisky }, + { "04C1DF62EFA0EBB00519B06A8979A6C5567FB34A", "5CC6F87F41E408BE", + { { "XRay Test", "demo key", "xray@example.net" } }, 1 }, + { "ED9B316F78644A58D042655A9EEF34CD4B11B25F", "5ADFD255F7B080AD", + { { "Yankee Test", "demo key", "yankee@example.net" } }, 1 }, + { "23FD347A419429BACCD5E72D6BC4778054ACD246", "EF9DC276A172C881", + { { "Zulu Test", "demo key", "zulu@example.net" } }, 1 }, + { "ADAB7FCC1F4DE2616ECFA402AF82244F9CD9FD55", "087DD7E0381701C4", + { { "Joe Random Hacker", "test key with passphrase \"abc\"", + "joe@example.com" } }, 1 }, + { NULL } + }; + + +int +main (int argc, char **argv) +{ + gpgme_error_t err; + gpgme_ctx_t ctx; + gpgme_key_t key; + gpgme_keylist_result_t result; + int i = 0; + int n; + gpgme_subkey_t subkey; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + + err = gpgme_op_keylist_start (ctx, NULL, 0); + fail_if_err (err); + + while (!(err = gpgme_op_keylist_next (ctx, &key))) + { + if (!keys[i].fpr) + { + fprintf (stderr, "More keys returned than expected\n"); + exit (1); + } + + /* Global key flags. */ + if (key->revoked) + { + fprintf (stderr, "Key unexpectedly revoked\n"); + exit (1); + } + if (key->expired) + { + fprintf (stderr, "Key unexpectedly expired\n"); + exit (1); + } + if (key->disabled) + { + fprintf (stderr, "Key unexpectedly disabled\n"); + exit (1); + } + if (key->invalid) + { + fprintf (stderr, "Key unexpectedly invalid\n"); + exit (1); + } +#if 0 + /* GnuPG 2.1+ have a different subkey for encryption. */ + if (!key->can_encrypt) + { + fprintf (stderr, "Key unexpectedly unusable for encryption\n"); + exit (1); + } +#endif + if (!key->can_sign) + { + fprintf (stderr, "Key unexpectedly unusable for signing\n"); + exit (1); + } + if (!key->can_certify) + { + fprintf (stderr, "Key unexpectedly unusable for certifications\n"); + exit (1); + } + if (key->secret) + { + fprintf (stderr, "Key unexpectedly secret\n"); + exit (1); + } + if (key->protocol != GPGME_PROTOCOL_OpenPGP) + { + fprintf (stderr, "Key has unexpected protocol: %s\n", + gpgme_get_protocol_name (key->protocol)); + exit (1); + } + if (key->issuer_serial) + { + fprintf (stderr, "Key unexpectedly carries issuer serial: %s\n", + key->issuer_serial); + exit (1); + } + if (key->issuer_name) + { + fprintf (stderr, "Key unexpectedly carries issuer name: %s\n", + key->issuer_name); + exit (1); + } + if (key->chain_id) + { + fprintf (stderr, "Key unexpectedly carries chain ID: %s\n", + key->chain_id); + exit (1); + } + if (key->owner_trust != GPGME_VALIDITY_UNKNOWN) + { + fprintf (stderr, "Key has unexpected owner trust: %i\n", + key->owner_trust); + exit (1); + } + + for (n=0, subkey = key->subkeys; subkey; subkey = subkey->next) + n++; + if (!n || n-1 != keys[i].n_subkeys) + { + fprintf (stderr, "Key `%s' has unexpected number of subkeys\n", + keys[i].uid[0].name); + exit (1); + } + + /* Primary key. */ + if (key->subkeys->revoked) + { + fprintf (stderr, "Primary key unexpectedly revoked\n"); + exit (1); + } + if (key->subkeys->expired) + { + fprintf (stderr, "Primary key unexpectedly expired\n"); + exit (1); + } + if (key->subkeys->disabled) + { + fprintf (stderr, "Primary key unexpectedly disabled\n"); + exit (1); + } + if (key->subkeys->invalid) + { + fprintf (stderr, "Primary key unexpectedly invalid\n"); + exit (1); + } + if (key->subkeys->can_encrypt) + { + fprintf (stderr, "Primary key unexpectedly usable for encryption\n"); + exit (1); + } + if (!key->subkeys->can_sign) + { + fprintf (stderr, "Primary key unexpectedly unusable for signing\n"); + exit (1); + } + if (!key->subkeys->can_certify) + { + fprintf (stderr, "Primary key unexpectedly unusable for certifications\n"); + exit (1); + } + if (key->subkeys->secret) + { + fprintf (stderr, "Primary key unexpectedly secret\n"); + exit (1); + } + if (key->subkeys->is_cardkey) + { + fprintf (stderr, "Public key marked as card key\n"); + exit (1); + } + if (key->subkeys->card_number) + { + fprintf (stderr, "Public key with card number set\n"); + exit (1); + } + if (key->subkeys->pubkey_algo != GPGME_PK_DSA) + { + fprintf (stderr, "Primary key has unexpected public key algo: %s\n", + gpgme_pubkey_algo_name (key->subkeys->pubkey_algo)); + exit (1); + } + if (key->subkeys->length != 1024) + { + fprintf (stderr, "Primary key has unexpected length: %i\n", + key->subkeys->length); + exit (1); + } + if (strcmp (key->subkeys->keyid, &keys[i].fpr[40 - 16])) + { + fprintf (stderr, "Primary key `%s' has unexpected key ID: %s\n", + keys[i].uid[0].name, key->subkeys->keyid); + exit (1); + } + if (strcmp (key->subkeys->fpr, keys[i].fpr)) + { + fprintf (stderr, "Primary key has unexpected fingerprint: %s\n", + key->subkeys->fpr); + exit (1); + } + if (key->subkeys->expires) + { + fprintf (stderr, "Primary key `%s' unexpectedly expires: %lu\n", + keys[i].uid[0].name, key->subkeys->expires); + exit (1); + } + + /* Secondary key. */ + if (key->subkeys->next->revoked) + { + fprintf (stderr, "Secondary key unexpectedly revoked\n"); + exit (1); + } + if (key->subkeys->next->expired) + { + fprintf (stderr, "Secondary key unexpectedly expired\n"); + exit (1); + } + if (key->subkeys->next->disabled) + { + fprintf (stderr, "Secondary key unexpectedly disabled\n"); + exit (1); + } + if (key->subkeys->next->invalid) + { + fprintf (stderr, "Secondary key unexpectedly invalid\n"); + exit (1); + } + if (!key->subkeys->next->can_encrypt) + { + fprintf (stderr, "Secondary key unexpectedly unusable for encryption\n"); + exit (1); + } + if (key->subkeys->next->can_sign) + { + fprintf (stderr, "Secondary key unexpectedly usable for signing\n"); + exit (1); + } + if (key->subkeys->next->can_certify) + { + fprintf (stderr, "Secondary key unexpectedly usable for certifications\n"); + exit (1); + } + if (key->subkeys->next->secret) + { + fprintf (stderr, "Secondary key unexpectedly secret\n"); + exit (1); + } + if (key->subkeys->next->is_cardkey) + { + fprintf (stderr, "Secondary public key marked as card key\n"); + exit (1); + } + if (key->subkeys->next->card_number) + { + fprintf (stderr, "Secondary public key with card number set\n"); + exit (1); + } + if (key->subkeys->next->pubkey_algo != GPGME_PK_ELG_E) + { + fprintf (stderr, "Secondary key has unexpected public key algo: %s\n", + gpgme_pubkey_algo_name (key->subkeys->next->pubkey_algo)); + exit (1); + } + if (key->subkeys->next->length != 1024) + { + fprintf (stderr, "Secondary key has unexpected length: %i\n", + key->subkeys->next->length); + exit (1); + } + if (strcmp (key->subkeys->next->keyid, keys[i].sec_keyid)) + { + fprintf (stderr, "Secondary key `%s' has unexpected key ID: %s/%s\n", + keys[i].uid[0].name, + key->subkeys->next->keyid, keys[i].sec_keyid ); + exit (1); + } + if (!key->subkeys->next->fpr) + { + fprintf (stderr, "Secondary key has unexpectedly no fingerprint\n"); + exit (1); + } + if (key->subkeys->next->expires) + { + fprintf (stderr, "Secondary key unexpectedly expires: %lu\n", + key->subkeys->next->expires); + exit (1); + } + + /* FIXME: The below test will crash if we want to check for a + name, comment or email that doesn't exist in the key's user + IDs. */ + if (!((!keys[i].uid[0].name && !key->uids) + || (keys[i].uid[0].name && !keys[i].uid[1].name + && key->uids && !key->uids->next) + || (keys[i].uid[0].name && keys[i].uid[1].name + && !keys[i].uid[2].name + && key->uids && key->uids->next && !key->uids->next->next) + || (keys[i].uid[0].name && keys[i].uid[1].name + && keys[i].uid[2].name + && key->uids && key->uids->next && key->uids->next->next + && !key->uids->next->next->next))) + { + fprintf (stderr, "Key has unexpected number of user IDs\n"); + exit (1); + } + if (key->uids && key->uids->revoked) + { + fprintf (stderr, "First user ID unexpectedly revoked\n"); + exit (1); + } + if (key->uids && key->uids->invalid) + { + fprintf (stderr, "First user ID unexpectedly invalid\n"); + exit (1); + } + if (key->uids && key->uids->validity != GPGME_VALIDITY_UNKNOWN) + { + fprintf (stderr, "First user ID has unexpectedly validity: %i\n", + key->uids->validity); + exit (1); + } + if (key->uids && key->uids->signatures) + { + fprintf (stderr, "First user ID unexpectedly signed\n"); + exit (1); + } + if (keys[i].uid[0].name + && strcmp (keys[i].uid[0].name, key->uids->name)) + { + fprintf (stderr, "Unexpected name in first user ID: %s\n", + key->uids->name); + exit (1); + } + if (keys[i].uid[0].comment + && strcmp (keys[i].uid[0].comment, key->uids->comment)) + { + fprintf (stderr, "Unexpected comment in first user ID: %s\n", + key->uids->comment); + exit (1); + } + if (keys[i].uid[0].email + && strcmp (keys[i].uid[0].email, key->uids->email)) + { + fprintf (stderr, "Unexpected email in first user ID: %s\n", + key->uids->email); + exit (1); + } + if (key->uids && key->uids->next && key->uids->next->revoked) + { + fprintf (stderr, "Second user ID unexpectedly revoked\n"); + exit (1); + } + if (key->uids && key->uids->next && key->uids->next->invalid) + { + fprintf (stderr, "Second user ID unexpectedly invalid\n"); + exit (1); + } + if (key->uids && key->uids->next + && key->uids->next->validity != GPGME_VALIDITY_UNKNOWN) + { + fprintf (stderr, "Second user ID has unexpectedly validity: %i\n", + key->uids->next->validity); + exit (1); + } + if (key->uids && key->uids->next && key->uids->next->signatures) + { + fprintf (stderr, "Second user ID unexpectedly signed\n"); + exit (1); + } + if (keys[i].uid[1].name + && strcmp (keys[i].uid[1].name, key->uids->next->name)) + { + fprintf (stderr, "Unexpected name in second user ID: %s\n", + key->uids->next->name); + exit (1); + } + if (keys[i].uid[1].comment + && strcmp (keys[i].uid[1].comment, key->uids->next->comment)) + { + fprintf (stderr, "Unexpected comment in second user ID: %s\n", + key->uids->next->comment); + exit (1); + } + if (keys[i].uid[1].email + && strcmp (keys[i].uid[1].email, key->uids->next->email)) + { + fprintf (stderr, "Unexpected email in second user ID: %s\n", + key->uids->next->email); + exit (1); + } + if (key->uids && key->uids->next && key->uids->next->next + && key->uids->next->next->revoked) + { + fprintf (stderr, "Third user ID unexpectedly revoked\n"); + exit (1); + } + if (key->uids && key->uids->next && key->uids->next->next + && key->uids->next->next->invalid) + { + fprintf (stderr, "Third user ID unexpectedly invalid\n"); + exit (1); + } + if (key->uids && key->uids->next && key->uids->next->next + && key->uids->next->next->validity != GPGME_VALIDITY_UNKNOWN) + { + fprintf (stderr, "Third user ID has unexpectedly validity: %i\n", + key->uids->next->next->validity); + exit (1); + } + if (key->uids && key->uids->next && key->uids->next->next + && key->uids->next->next->signatures) + { + fprintf (stderr, "Third user ID unexpectedly signed\n"); + exit (1); + } + if (keys[i].uid[2].name + && strcmp (keys[i].uid[2].name, key->uids->next->next->name)) + { + fprintf (stderr, "Unexpected name in third user ID: %s\n", + key->uids->next->next->name); + exit (1); + } + if (keys[i].uid[2].comment + && strcmp (keys[i].uid[2].comment, key->uids->next->next->comment)) + { + fprintf (stderr, "Unexpected comment in third user ID: %s\n", + key->uids->next->next->comment); + exit (1); + } + if (keys[i].uid[2].email + && strcmp (keys[i].uid[2].email, key->uids->next->next->email)) + { + fprintf (stderr, "Unexpected email in third user ID: %s\n", + key->uids->next->next->email); + exit (1); + } + + if (keys[i].misc_check) + keys[i].misc_check (keys+i, key); + + gpgme_key_unref (key); + i++; + } + if (gpgme_err_code (err) != GPG_ERR_EOF) + fail_if_err (err); + err = gpgme_op_keylist_end (ctx); + fail_if_err (err); + + result = gpgme_op_keylist_result (ctx); + if (result->truncated) + { + fprintf (stderr, "Key listing unexpectedly truncated\n"); + exit (1); + } + + if (keys[i].fpr) + { + fprintf (stderr, "Less keys returned than expected\n"); + exit (1); + } + + gpgme_release (ctx); + return 0; +} + + + +/* Check expration of keys. This test assumes three subkeys of which + 2 are expired; it is used with the "Whisky" test key. It has + already been checked that these 3 subkeys are available. */ +static void +check_whisky (struct key_info_s *keyinfo, gpgme_key_t key) +{ + const char *name = keyinfo->uid[0].name; + gpgme_subkey_t sub1, sub2; + + sub1 = key->subkeys->next->next; + sub2 = sub1->next; + + if (!sub1->expired || !sub2->expired) + { + fprintf (stderr, "Subkey of `%s' not flagged as expired\n", name); + exit (1); + } + if (sub1->expires != 1129636886 || sub2->expires != 1129636939) + { + fprintf (stderr, "Subkey of `%s' has wrong expiration date\n", name); + exit (1); + } + +} + diff --git a/tests/gpg/t-sig-notation.c b/tests/gpg/t-sig-notation.c new file mode 100644 index 0000000..7345a52 --- /dev/null +++ b/tests/gpg/t-sig-notation.c @@ -0,0 +1,166 @@ +/* t-sig-notation.c - Regression test. + Copyright (C) 2005 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#include "t-support.h" + + +static struct { + const char *name; + const char *value; + gpgme_sig_notation_flags_t flags; + int seen; +} expected_notations[] = { + { "laughing@me", + "Just Squeeze Me", + GPGME_SIG_NOTATION_HUMAN_READABLE }, + { "preferred-email-encoding@pgp.com", + "pgpmime", + GPGME_SIG_NOTATION_HUMAN_READABLE | GPGME_SIG_NOTATION_CRITICAL }, + { NULL, + "http://www.gnu.org/policy/", + 0 } +}; + +static void +check_result (gpgme_verify_result_t result) +{ + int i; + gpgme_sig_notation_t r; + + gpgme_signature_t sig; + + sig = result->signatures; + if (!sig || sig->next) + { + fprintf (stderr, "%s:%i: Unexpected number of signatures\n", + __FILE__, __LINE__); + exit (1); + } + + for (i=0; i < DIM(expected_notations); i++ ) + expected_notations[i].seen = 0; + + for (r = result->signatures->notations; r; r = r->next) + { + int any = 0; + for (i=0; i < DIM(expected_notations); i++) + { + if ( ((r->name && expected_notations[i].name + && !strcmp (r->name, expected_notations[i].name) + && r->name_len + == strlen (expected_notations[i].name)) + || (!r->name && !expected_notations[i].name + && r->name_len == 0)) + && r->value + && !strcmp (r->value, expected_notations[i].value) + && r->value_len == strlen (expected_notations[i].value) + && r->flags + == (expected_notations[i].flags & ~GPGME_SIG_NOTATION_CRITICAL) + && r->human_readable + == !!(r->flags & GPGME_SIG_NOTATION_HUMAN_READABLE) + && r->critical == 0) + { + expected_notations[i].seen++; + any++; + } + } + if (!any) + { + fprintf (stderr, "%s:%i: Unexpected notation data\n", + __FILE__, __LINE__); + exit (1); + } + } + for (i=0; i < DIM(expected_notations); i++ ) + { + if (expected_notations[i].seen != 1) + { + fprintf (stderr, "%s:%i: Missing or duplicate notation data\n", + __FILE__, __LINE__); + exit (1); + } + } +} + + +int +main (int argc, char *argv[]) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t in, out; + gpgme_verify_result_t result; + char *agent_info; + int i; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + + agent_info = getenv ("GPG_AGENT_INFO"); + if (!(agent_info && strchr (agent_info, ':'))) + gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL); + + err = gpgme_data_new_from_mem (&in, "Hallo Leute\n", 12, 0); + fail_if_err (err); + err = gpgme_data_new (&out); + fail_if_err (err); + + for (i = 0; i < sizeof (expected_notations) / sizeof (expected_notations[0]); + i++) + { + err = gpgme_sig_notation_add (ctx, expected_notations[i].name, + expected_notations[i].value, + expected_notations[i].flags); + fail_if_err (err); + } + + err = gpgme_op_sign (ctx, in, out, GPGME_SIG_MODE_NORMAL); + fail_if_err (err); + + gpgme_data_release (in); + err = gpgme_data_new (&in); + fail_if_err (err); + + gpgme_data_seek (out, 0, SEEK_SET); + + err = gpgme_op_verify (ctx, out, NULL, in); + fail_if_err (err); + result = gpgme_op_verify_result (ctx); + check_result (result); + + gpgme_data_release (in); + gpgme_data_release (out); + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpg/t-sign.c b/tests/gpg/t-sign.c new file mode 100644 index 0000000..bdd3323 --- /dev/null +++ b/tests/gpg/t-sign.c @@ -0,0 +1,155 @@ +/* t-sign.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> + +#include <gpgme.h> + +#include "t-support.h" + + +static void +check_result (gpgme_sign_result_t result, gpgme_sig_mode_t type) +{ + if (result->invalid_signers) + { + fprintf (stderr, "Invalid signer found: %s\n", + result->invalid_signers->fpr); + exit (1); + } + if (!result->signatures || result->signatures->next) + { + fprintf (stderr, "Unexpected number of signatures created\n"); + exit (1); + } + if (result->signatures->type != type) + { + fprintf (stderr, "Wrong type of signature created\n"); + exit (1); + } + if (result->signatures->pubkey_algo != GPGME_PK_DSA) + { + fprintf (stderr, "Wrong pubkey algorithm reported: %i\n", + result->signatures->pubkey_algo); + exit (1); + } + if (result->signatures->hash_algo != GPGME_MD_SHA1) + { + fprintf (stderr, "Wrong hash algorithm reported: %i\n", + result->signatures->hash_algo); + exit (1); + } + if (result->signatures->sig_class != 1) + { + fprintf (stderr, "Wrong signature class reported: %u\n", + result->signatures->sig_class); + exit (1); + } + if (strcmp ("A0FF4590BB6122EDEF6E3C542D727CC768697734", + result->signatures->fpr)) + { + fprintf (stderr, "Wrong fingerprint reported: %s\n", + result->signatures->fpr); + exit (1); + } +} + + +int +main (int argc, char **argv) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t in, out; + gpgme_sign_result_t result; + char *agent_info; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + + agent_info = getenv ("GPG_AGENT_INFO"); + if (!(agent_info && strchr (agent_info, ':'))) + gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL); + + gpgme_set_textmode (ctx, 1); + gpgme_set_armor (ctx, 1); + +#if 0 + { + gpgme_key_t akey; + err = gpgme_get_key (ctx, "0x68697734", &akey, 0); + fail_if_err (err); + err = gpgme_signers_add (ctx, akey); + fail_if_err (err); + gpgme_key_unref (akey); + } +#endif + + err = gpgme_data_new_from_mem (&in, "Hallo Leute\n", 12, 0); + fail_if_err (err); + + /* First a normal signature. */ + err = gpgme_data_new (&out); + fail_if_err (err); + err = gpgme_op_sign (ctx, in, out, GPGME_SIG_MODE_NORMAL); + fail_if_err (err); + result = gpgme_op_sign_result (ctx); + check_result (result, GPGME_SIG_MODE_NORMAL); + print_data (out); + gpgme_data_release (out); + + /* Now a detached signature. */ + gpgme_data_seek (in, 0, SEEK_SET); + err = gpgme_data_new (&out); + fail_if_err (err); + err = gpgme_op_sign (ctx, in, out, GPGME_SIG_MODE_DETACH); + fail_if_err (err); + result = gpgme_op_sign_result (ctx); + check_result (result, GPGME_SIG_MODE_DETACH); + print_data (out); + gpgme_data_release (out); + + /* And finally a cleartext signature. */ + gpgme_data_seek (in, 0, SEEK_SET); + err = gpgme_data_new (&out); + fail_if_err (err); + err = gpgme_op_sign (ctx, in, out, GPGME_SIG_MODE_CLEAR); + fail_if_err (err); + result = gpgme_op_sign_result (ctx); + check_result (result, GPGME_SIG_MODE_CLEAR); + print_data (out); + gpgme_data_release (out); + + gpgme_data_release (in); + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpg/t-signers.c b/tests/gpg/t-signers.c new file mode 100644 index 0000000..c75c1d4 --- /dev/null +++ b/tests/gpg/t-signers.c @@ -0,0 +1,174 @@ +/* t-signers.c - Regression tests for the multiple signers interface. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> + +#include <gpgme.h> + +#include "t-support.h" + + +static void +check_result (gpgme_sign_result_t result, gpgme_sig_mode_t type) +{ + gpgme_new_signature_t signature; + + if (result->invalid_signers) + { + fprintf (stderr, "Invalid signer found: %s\n", + result->invalid_signers->fpr); + exit (1); + } + if (!result->signatures || !result->signatures->next + || result->signatures->next->next) + { + fprintf (stderr, "Unexpected number of signatures created\n"); + exit (1); + } + + signature = result->signatures; + while (signature) + { + if (signature->type != type) + { + fprintf (stderr, "Wrong type of signature created\n"); + exit (1); + } + if (signature->pubkey_algo != GPGME_PK_DSA) + { + fprintf (stderr, "Wrong pubkey algorithm reported: %i\n", + signature->pubkey_algo); + exit (1); + } + if (signature->hash_algo != GPGME_MD_SHA1) + { + fprintf (stderr, "Wrong hash algorithm reported: %i\n", + signature->hash_algo); + exit (1); + } + if (signature->sig_class != 1) + { + fprintf (stderr, "Wrong signature class reported: %u\n", + signature->sig_class); + exit (1); + } + if (strcmp ("A0FF4590BB6122EDEF6E3C542D727CC768697734", + signature->fpr) + && strcmp ("23FD347A419429BACCD5E72D6BC4778054ACD246", + signature->fpr)) + { + fprintf (stderr, "Wrong fingerprint reported: %s\n", + signature->fpr); + exit (1); + } + signature = signature->next; + } +} + + +int +main (int argc, char *argv[]) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t in, out; + gpgme_key_t key[2]; + gpgme_sign_result_t result; + char *agent_info; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + + agent_info = getenv("GPG_AGENT_INFO"); + if (!(agent_info && strchr (agent_info, ':'))) + gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL); + + gpgme_set_textmode (ctx, 1); + gpgme_set_armor (ctx, 1); + + err = gpgme_op_keylist_start (ctx, NULL, 1); + fail_if_err (err); + err = gpgme_op_keylist_next (ctx, &key[0]); + fail_if_err (err); + err = gpgme_op_keylist_next (ctx, &key[1]); + fail_if_err (err); + err = gpgme_op_keylist_end (ctx); + fail_if_err (err); + + err = gpgme_signers_add (ctx, key[0]); + fail_if_err (err); + err = gpgme_signers_add (ctx, key[1]); + fail_if_err (err); + + err = gpgme_data_new_from_mem (&in, "Hallo Leute\n", 12, 0); + fail_if_err (err); + + /* First a normal signature. */ + err = gpgme_data_new (&out); + fail_if_err (err); + err = gpgme_op_sign (ctx, in, out, GPGME_SIG_MODE_NORMAL); + fail_if_err (err); + result = gpgme_op_sign_result (ctx); + check_result (result, GPGME_SIG_MODE_NORMAL); + print_data (out); + gpgme_data_release (out); + + /* Now a detached signature. */ + gpgme_data_seek (in, 0, SEEK_SET); + err = gpgme_data_new (&out); + fail_if_err (err); + err = gpgme_op_sign (ctx, in, out, GPGME_SIG_MODE_DETACH); + fail_if_err (err); + result = gpgme_op_sign_result (ctx); + check_result (result, GPGME_SIG_MODE_DETACH); + print_data (out); + gpgme_data_release (out); + + /* And finally a cleartext signature. */ + gpgme_data_seek (in, 0, SEEK_SET); + err = gpgme_data_new (&out); + fail_if_err (err); + err = gpgme_op_sign (ctx, in, out, GPGME_SIG_MODE_CLEAR); + fail_if_err (err); + result = gpgme_op_sign_result (ctx); + check_result (result, GPGME_SIG_MODE_CLEAR); + print_data (out); + gpgme_data_release (out); + gpgme_data_seek (in, 0, SEEK_SET); + + gpgme_data_release (in); + gpgme_release (ctx); + + gpgme_key_unref (key[0]); + gpgme_key_unref (key[1]); + return 0; +} diff --git a/tests/gpg/t-support.h b/tests/gpg/t-support.h new file mode 100644 index 0000000..6a18b5c --- /dev/null +++ b/tests/gpg/t-support.h @@ -0,0 +1,189 @@ +/* t-support.h - Helper routines for regression tests. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 <unistd.h> +#include <errno.h> +#include <stdlib.h> +#include <locale.h> + +#ifdef HAVE_W32_SYSTEM +#include <windows.h> +#endif + +#include <gpgme.h> + +#ifndef DIM +#define DIM(v) (sizeof(v)/sizeof((v)[0])) +#endif + +#define fail_if_err(err) \ + do \ + { \ + if (err) \ + { \ + fprintf (stderr, "%s:%d: %s: %s\n", \ + __FILE__, __LINE__, gpgme_strsource (err), \ + gpgme_strerror (err)); \ + exit (1); \ + } \ + } \ + while (0) + + +static const char * +nonnull (const char *s) +{ + return s? s :"[none]"; +} + + +void +print_data (gpgme_data_t dh) +{ +#define BUF_SIZE 512 + char buf[BUF_SIZE + 1]; + int ret; + + ret = gpgme_data_seek (dh, 0, SEEK_SET); + if (ret) + fail_if_err (gpgme_err_code_from_errno (errno)); + while ((ret = gpgme_data_read (dh, buf, BUF_SIZE)) > 0) + fwrite (buf, ret, 1, stdout); + if (ret < 0) + fail_if_err (gpgme_err_code_from_errno (errno)); +} + + +gpgme_error_t +passphrase_cb (void *opaque, const char *uid_hint, const char *passphrase_info, + int last_was_bad, int fd) +{ +#ifdef HAVE_W32_SYSTEM + DWORD written; + WriteFile ((HANDLE) fd, "abc\n", 4, &written, 0); +#else + int res; + char *pass = "abc\n"; + int passlen = strlen (pass); + int off = 0; + + do + { + res = write (fd, &pass[off], passlen - off); + if (res > 0) + off += res; + } + while (res > 0 && off != passlen); + + return off == passlen ? 0 : gpgme_error_from_errno (errno); +#endif + + return 0; +} + + +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) + exit (8); + strcpy (buf, srcdir); + strcat (buf, "/"); + strcat (buf, fname); + return buf; +} + + +void +init_gpgme (gpgme_protocol_t proto) +{ + gpgme_error_t err; + + gpgme_check_version (NULL); + setlocale (LC_ALL, ""); + gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL)); +#ifndef HAVE_W32_SYSTEM + gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL)); +#endif + + err = gpgme_engine_check_version (proto); + fail_if_err (err); +} + + +void +print_import_result (gpgme_import_result_t r) +{ + gpgme_import_status_t st; + + for (st=r->imports; st; st = st->next) + { + printf (" fpr: %s err: %d (%s) status:", nonnull (st->fpr), + st->result, gpgme_strerror (st->result)); + if (st->status & GPGME_IMPORT_NEW) + fputs (" new", stdout); + if (st->status & GPGME_IMPORT_UID) + fputs (" uid", stdout); + if (st->status & GPGME_IMPORT_SIG) + fputs (" sig", stdout); + if (st->status & GPGME_IMPORT_SUBKEY) + fputs (" subkey", stdout); + if (st->status & GPGME_IMPORT_SECRET) + fputs (" secret", stdout); + putchar ('\n'); + } + printf ("key import summary:\n" + " considered: %d\n" + " no user id: %d\n" + " imported: %d\n" + " imported_rsa: %d\n" + " unchanged: %d\n" + " new user ids: %d\n" + " new subkeys: %d\n" + " new signatures: %d\n" + " new revocations: %d\n" + " secret read: %d\n" + " secret imported: %d\n" + " secret unchanged: %d\n" + " skipped new keys: %d\n" + " not imported: %d\n", + r->considered, + r->no_user_id, + r->imported, + r->imported_rsa, + r->unchanged, + r->new_user_ids, + r->new_sub_keys, + r->new_signatures, + r->new_revocations, + r->secret_read, + r->secret_imported, + r->secret_unchanged, + r->skipped_new_keys, + r->not_imported); +} + diff --git a/tests/gpg/t-thread1.c b/tests/gpg/t-thread1.c new file mode 100644 index 0000000..86ea51a --- /dev/null +++ b/tests/gpg/t-thread1.c @@ -0,0 +1,156 @@ +/* t-thread1.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <unistd.h> +#include <pthread.h> + +#include <gpgme.h> + +#include "t-support.h" + +#define ROUNDS 20 + + +void * +thread_one (void *name) +{ + int i; + + for (i = 0; i < ROUNDS; i++) + { + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t in, out; + gpgme_key_t key[3] = { NULL, NULL, NULL }; + gpgme_encrypt_result_t result; + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_armor (ctx, 1); + + err = gpgme_data_new_from_mem (&in, "Hallo Leute\n", 12, 0); + fail_if_err (err); + + err = gpgme_data_new (&out); + fail_if_err (err); + + err = gpgme_get_key (ctx, "A0FF4590BB6122EDEF6E3C542D727CC768697734", + &key[0], 0); + fail_if_err (err); + err = gpgme_get_key (ctx, "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", + &key[1], 0); + fail_if_err (err); + + err = gpgme_op_encrypt (ctx, key, GPGME_ENCRYPT_ALWAYS_TRUST, in, out); + fail_if_err (err); + result = gpgme_op_encrypt_result (ctx); + if (result->invalid_recipients) + { + fprintf (stderr, "Invalid recipient encountered: %s\n", + result->invalid_recipients->fpr); + exit (1); + } + printf ("Encrypt %s %i\n", (char *) name, i); + + gpgme_key_unref (key[0]); + gpgme_key_unref (key[1]); + gpgme_data_release (in); + gpgme_data_release (out); + gpgme_release (ctx); + } + return NULL; +} + + +void * +thread_two (void *name) +{ + int i; + const char *cipher_1_asc = make_filename ("cipher-1.asc"); + char *agent_info; + + agent_info = getenv("GPG_AGENT_INFO"); + + for (i = 0; i < ROUNDS; i++) + { + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t in, out; + gpgme_decrypt_result_t result; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + + if (!(agent_info && strchr (agent_info, ':'))) + gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL); + + err = gpgme_data_new_from_file (&in, cipher_1_asc, 1); + fail_if_err (err); + + err = gpgme_data_new (&out); + fail_if_err (err); + + err = gpgme_op_decrypt (ctx, in, out); + fail_if_err (err); + result = gpgme_op_decrypt_result (ctx); + if (result->unsupported_algorithm) + { + fprintf (stderr, "%s:%i: unsupported algorithm: %s\n", + __FILE__, __LINE__, result->unsupported_algorithm); + exit (1); + } + printf ("Decrypt %s %i\n", (char *) name, i); + + gpgme_data_release (in); + gpgme_data_release (out); + gpgme_release (ctx); + } + return NULL; +} + +int +main (int argc, char *argv[]) +{ + pthread_t tone; + pthread_t ttwo; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + pthread_create (&tone, NULL, thread_one, "A"); + pthread_create (&ttwo, NULL, thread_two, "B"); + + pthread_join (tone, NULL); + pthread_join (ttwo, NULL); + + return 0; +} diff --git a/tests/gpg/t-trustlist.c b/tests/gpg/t-trustlist.c new file mode 100644 index 0000000..5d24518 --- /dev/null +++ b/tests/gpg/t-trustlist.c @@ -0,0 +1,64 @@ +/* t-trustlist.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#include "t-support.h" + + +int +main (int argc, char *argv[]) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_trust_item_t item; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + + err = gpgme_op_trustlist_start (ctx, "alice", 0); + fail_if_err (err); + + while (!(err = gpgme_op_trustlist_next (ctx, &item))) + { + printf ("l=%d k=%s t=%d o=%s v=%s u=%s\n", + item->level, item->keyid, item->type, item->owner_trust, + item->validity, item->name); + gpgme_trust_item_unref (item); + } + if (gpgme_err_code (err) != GPG_ERR_EOF) + fail_if_err (err); + + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpg/t-verify.c b/tests/gpg/t-verify.c new file mode 100644 index 0000000..dceabac --- /dev/null +++ b/tests/gpg/t-verify.c @@ -0,0 +1,273 @@ +/* t-verify.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#include "t-support.h" + + +static const char test_text1[] = "Just GNU it!\n"; +static const char test_text1f[]= "Just GNU it?\n"; +static const char test_sig1[] = +#if 0 +"-----BEGIN PGP SIGNATURE-----\n" +"\n" +"iEYEABECAAYFAjoKgjIACgkQLXJ8x2hpdzQMSwCeO/xUrhysZ7zJKPf/FyXA//u1\n" +"ZgIAn0204PBR7yxSdQx6CFxugstNqmRv\n" +"=yku6\n" +"-----END PGP SIGNATURE-----\n" +#elif 0 +"-----BEGIN PGP SIGNATURE-----\n" +"Version: GnuPG v1.0.4-2 (GNU/Linux)\n" +"Comment: For info see http://www.gnupg.org\n" +"\n" +"iJcEABECAFcFAjoS8/E1FIAAAAAACAAkZm9vYmFyLjF0aGlzIGlzIGEgbm90YXRp\n" +"b24gZGF0YSB3aXRoIDIgbGluZXMaGmh0dHA6Ly93d3cuZ3Uub3JnL3BvbGljeS8A\n" +"CgkQLXJ8x2hpdzQLyQCbBW/fgU8ZeWSlWPM1F8umHX17bAAAoIfSNDSp5zM85XcG\n" +"iwxMrf+u8v4r\n" +"=88Zo\n" +"-----END PGP SIGNATURE-----\n" +#elif 1 +"-----BEGIN PGP SIGNATURE-----\n" +"\n" +"iN0EABECAJ0FAjoS+i9FFIAAAAAAAwA5YmFyw7bDpMO8w58gZGFzIHdhcmVuIFVt\n" +"bGF1dGUgdW5kIGpldHp0IGVpbiBwcm96ZW50JS1aZWljaGVuNRSAAAAAAAgAJGZv\n" +"b2Jhci4xdGhpcyBpcyBhIG5vdGF0aW9uIGRhdGEgd2l0aCAyIGxpbmVzGhpodHRw\n" +"Oi8vd3d3Lmd1Lm9yZy9wb2xpY3kvAAoJEC1yfMdoaXc0JBIAoIiLlUsvpMDOyGEc\n" +"dADGKXF/Hcb+AKCJWPphZCphduxSvrzH0hgzHdeQaA==\n" +"=nts1\n" +"-----END PGP SIGNATURE-----\n" +#endif +; +static const char test_sig2[] = +"-----BEGIN PGP MESSAGE-----\n" +"\n" +"owGbwMvMwCSoW1RzPCOz3IRxjXQSR0lqcYleSUWJTZOvjVdpcYmCu1+oQmaJIleH\n" +"GwuDIBMDGysTSIqBi1MApi+nlGGuwDeHao53HBr+FoVGP3xX+kvuu9fCMJvl6IOf\n" +"y1kvP4y+8D5a11ang0udywsA\n" +"=Crq6\n" +"-----END PGP MESSAGE-----\n"; + +/* A message with a prepended but unsigned plaintext packet. */ +static const char double_plaintext_sig[] = +"-----BEGIN PGP MESSAGE-----\n" +"\n" +"rDRiCmZvb2Jhci50eHRF4pxNVGhpcyBpcyBteSBzbmVha3kgcGxhaW50ZXh0IG1l\n" +"c3NhZ2UKowGbwMvMwCSoW1RzPCOz3IRxTWISa6JebnG666MFD1wzSzJSixQ81XMV\n" +"UlITUxTyixRyKxXKE0uSMxQyEosVikvyCwpSU/S4FNCArq6Ce1F+aXJGvoJvYlGF\n" +"erFCTmJxiUJ5flFKMVeHGwuDIBMDGysTyA4GLk4BmO036xgWzMgzt9V85jCtfDFn\n" +"UqVooWlGXHwNw/xg/fVzt9VNbtjtJ/fhUqYo0/LyCGEA\n" +"=6+AK\n" +"-----END PGP MESSAGE-----\n"; + + + + +static void +check_result (gpgme_verify_result_t result, unsigned int summary, char *fpr, + gpgme_error_t status, int notation) +{ + gpgme_signature_t sig; + + sig = result->signatures; + if (!sig || sig->next) + { + fprintf (stderr, "%s:%i: Unexpected number of signatures\n", + __FILE__, __LINE__); + exit (1); + } + if (sig->summary != summary) + { + fprintf (stderr, "%s:%i: Unexpected signature summary: " + "want=0x%x have=0x%x\n", + __FILE__, __LINE__, summary, sig->summary); + exit (1); + } + if (strcmp (sig->fpr, fpr)) + { + fprintf (stderr, "%s:%i: Unexpected fingerprint: %s\n", + __FILE__, __LINE__, sig->fpr); + exit (1); + } + if (gpgme_err_code (sig->status) != status) + { + fprintf (stderr, "%s:%i: Unexpected signature status: %s\n", + __FILE__, __LINE__, gpgme_strerror (sig->status)); + exit (1); + } + if (notation) + { + static struct { + const char *name; + const char *value; + int seen; + } expected_notations[] = { + { "bar", + "\xc3\xb6\xc3\xa4\xc3\xbc\xc3\x9f" + " das waren Umlaute und jetzt ein prozent%-Zeichen" }, + { "foobar.1", + "this is a notation data with 2 lines" }, + { NULL, + "http://www.gu.org/policy/" } + }; + int i; + gpgme_sig_notation_t r; + + for (i=0; i < DIM(expected_notations); i++ ) + expected_notations[i].seen = 0; + + for (r = sig->notations; r; r = r->next) + { + int any = 0; + for (i=0; i < DIM(expected_notations); i++) + { + if ( ((r->name && expected_notations[i].name + && !strcmp (r->name, expected_notations[i].name) + && r->name_len + == strlen (expected_notations[i].name)) + || (!r->name && !expected_notations[i].name + && r->name_len == 0)) + && r->value + && !strcmp (r->value, expected_notations[i].value) + && r->value_len == strlen (expected_notations[i].value)) + { + expected_notations[i].seen++; + any++; + } + } + if (!any) + { + fprintf (stderr, "%s:%i: Unexpected notation data\n", + __FILE__, __LINE__); + exit (1); + } + } + for (i=0; i < DIM(expected_notations); i++ ) + { + if (expected_notations[i].seen != 1) + { + fprintf (stderr, "%s:%i: Missing or duplicate notation data\n", + __FILE__, __LINE__); + exit (1); + } + } + } + if (sig->wrong_key_usage) + { + fprintf (stderr, "%s:%i: Unexpectedly wrong key usage\n", + __FILE__, __LINE__); + exit (1); + } + if (sig->validity != GPGME_VALIDITY_UNKNOWN) + { + fprintf (stderr, "%s:%i: Unexpected validity: %i\n", + __FILE__, __LINE__, sig->validity); + exit (1); + } + if (gpgme_err_code (sig->validity_reason) != GPG_ERR_NO_ERROR) + { + fprintf (stderr, "%s:%i: Unexpected validity reason: %s\n", + __FILE__, __LINE__, gpgme_strerror (sig->validity_reason)); + exit (1); + } +} + + +int +main (int argc, char *argv[]) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t sig, text; + gpgme_verify_result_t result; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + + /* Checking a valid message. */ + err = gpgme_data_new_from_mem (&text, test_text1, strlen (test_text1), 0); + fail_if_err (err); + err = gpgme_data_new_from_mem (&sig, test_sig1, strlen (test_sig1), 0); + fail_if_err (err); + err = gpgme_op_verify (ctx, sig, text, NULL); + fail_if_err (err); + result = gpgme_op_verify_result (ctx); + check_result (result, 0, "A0FF4590BB6122EDEF6E3C542D727CC768697734", + GPG_ERR_NO_ERROR, 1); + + /* Checking a manipulated message. */ + gpgme_data_release (text); + err = gpgme_data_new_from_mem (&text, test_text1f, strlen (test_text1f), 0); + fail_if_err (err); + gpgme_data_seek (sig, 0, SEEK_SET); + err = gpgme_op_verify (ctx, sig, text, NULL); + fail_if_err (err); + result = gpgme_op_verify_result (ctx); + check_result (result, GPGME_SIGSUM_RED, "2D727CC768697734", + GPG_ERR_BAD_SIGNATURE, 0); + + /* Checking a normal signature. */ + gpgme_data_release (sig); + gpgme_data_release (text); + err = gpgme_data_new_from_mem (&sig, test_sig2, strlen (test_sig2), 0); + fail_if_err (err); + err = gpgme_data_new (&text); + fail_if_err (err); + err = gpgme_op_verify (ctx, sig, NULL, text); + fail_if_err (err); + result = gpgme_op_verify_result (ctx); + check_result (result, 0, "A0FF4590BB6122EDEF6E3C542D727CC768697734", + GPG_ERR_NO_ERROR, 0); + + + /* Checking an invalid message. */ + gpgme_data_release (sig); + gpgme_data_release (text); + err = gpgme_data_new_from_mem (&sig, double_plaintext_sig, + strlen (double_plaintext_sig), 0); + fail_if_err (err); + err = gpgme_data_new (&text); + fail_if_err (err); + err = gpgme_op_verify (ctx, sig, NULL, text); + if (gpgme_err_code (err) != GPG_ERR_BAD_DATA) + { + fprintf (stderr, "%s:%i: Double plaintext message not detected\n", + __FILE__, __LINE__); + exit (1); + } + + gpgme_data_release (sig); + gpgme_data_release (text); + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpg/t-wait.c b/tests/gpg/t-wait.c new file mode 100644 index 0000000..e58adad --- /dev/null +++ b/tests/gpg/t-wait.c @@ -0,0 +1,76 @@ +/* t-wait.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#ifdef HAVE_W32_SYSTEM +#define sleep _sleep +#endif + +#include <gpgme.h> + +#include "t-support.h" + + +int +main (int argc, char *argv[]) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t sig, text; + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + + /* Checking a message without a signature. */ + err = gpgme_data_new_from_mem (&sig, "foo\n", 4, 0); + fail_if_err (err); + err = gpgme_data_new (&text); + fail_if_err (err); + err = gpgme_op_verify_start (ctx, sig, NULL, text); + fail_if_err (err); + + while (gpgme_wait (ctx, &err, 0) == NULL && err == 0) + sleep(1); + + if (gpgme_err_code (err) != GPG_ERR_NO_DATA) + { + fprintf (stderr, "%s:%d: %s: %s\n", + __FILE__, __LINE__, gpgme_strsource (err), + gpgme_strerror (err)); + exit (1); + } + + gpgme_data_release (sig); + gpgme_data_release (text); + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpgsm/32100C27173EF6E9C4E9A25D3D69F86D37A4F939 b/tests/gpgsm/32100C27173EF6E9C4E9A25D3D69F86D37A4F939 new file mode 100644 index 0000000..cf0535f --- /dev/null +++ b/tests/gpgsm/32100C27173EF6E9C4E9A25D3D69F86D37A4F939 @@ -0,0 +1,18 @@ +(private-key + (oid.1.2.840.113549.1.1.1 + (n #00e0ce96f90b6c9e02f3922beada93fe50a875eac6bcc18bb9a9cf2e84965caa2d1ff95a7f542465c6c0c19d276e4526ce048868a7a914fd343cc3a87dd74291ffc565506d5bbb25cbac6a0e2dd1f8bcaab0d4a29c2f37c950f363484bf269f7891440464baf79827e03a36e70b814938eebdc63e964247be75dc58b014b7ea251#) + (e #010001#) + (d #046129F2489D71579BE0A75FE029BD6CDB574EBF57EA8A5B0FDA942CAB943B117D7BB95E5D28875E0F9FC5FCC06A72F6D502464DABDED78EF6B716177B83D5BDC543DC5D3FED932E59F5897E92E6F58A0F33424106A3B6FA2CBF877510E4AC21C3EE47851E97D12996222AC3566D4CCB0B83D164074ABF7DE655FC2446DA1781#) + (p #00e861b700e17e8afe6837e7512e35b6ca11d0ae47d8b85161c67baf64377213fe52d772f2035b3ca830af41d8a4120e1c1c70d12cc22f00d28d31dd48a8d424f1#) + (q #00f7a7ca5367c661f8e62df34f0d05c10c88e5492348dd7bddc942c9a8f369f935a07785d2db805215ed786e4285df1658eed3ce84f469b81b50d358407b4ad361#) + (u #304559a9ead56d2309d203811a641bb1a09626bc8eb36fffa23c968ec5bd891eebbafc73ae666e01ba7c8990bae06cc2bbe10b75e69fcacb353a6473079d8e9b#) + ) +) + + + + + + + + diff --git a/tests/gpgsm/Makefile.am b/tests/gpgsm/Makefile.am new file mode 100644 index 0000000..9086134 --- /dev/null +++ b/tests/gpgsm/Makefile.am @@ -0,0 +1,72 @@ +# 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 Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 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 Lesser General +# Public License for more details. +# +# You should have received a copy of the GNU Lesser 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 + +## Process this file with automake to produce Makefile.in + +GPGSM = @GPGSM@ + +TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO= + +noinst_HEADERS = t-support.h +TESTS = t-import t-keylist t-encrypt t-verify t-decrypt t-sign t-export + +EXTRA_DIST = cert_dfn_pca01.der cert_dfn_pca15.der cert_g10code_test1.der \ + $(key_id) + +INCLUDES = -I$(top_builddir)/src + +AM_CPPFLAGS = @GPG_ERROR_CFLAGS@ +LDADD = ../../src/libgpgme.la + +# We don't run t-genkey in the test suite, because it takes too long +# and needs a working pinentry. +noinst_PROGRAMS = $(TESTS) t-genkey cms-keylist cms-decrypt + +key_id = 32100C27173EF6E9C4E9A25D3D69F86D37A4F939 + +CLEANFILES = pubring.kbx pubring.kbx~ gpgsm.conf trustlist.txt \ + random_seed S.gpg-agent + +clean-local: + -gpg-connect-agent KILLAGENT /bye + -rm -fR private-keys-v1.d + +all-local: ./pubring.kbx ./gpgsm.conf ./private-keys-v1.d/$(key_id).key ./trustlist.txt + +export GNUPGHOME := $(abs_builddir) + +export GPG_AGENT_INFO := + +./pubring.kbx: $(srcdir)/cert_g10code_test1.der + $(GPGSM) --import $(srcdir)/cert_g10code_test1.der + +./gpgsm.conf: + echo disable-crl-checks > ./gpgsm.conf + echo faked-system-time 1008241200 >> ./gpgsm.conf + +./private-keys-v1.d/$(key_id).key: $(srcdir)/$(key_id) + test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d + cp $(srcdir)/$(key_id) private-keys-v1.d/$(key_id).key + +./trustlist.txt: + echo $(key_id) > ./trustlist.txt + echo >> ./trustlist.txt + echo "# CN=test cert 1,OU=Aegypten Project,O=g10 Code GmbH,L=Düsseldorf,C=DE" >> ./trustlist.txt + echo "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E S" >> ./trustlist.txt + diff --git a/tests/gpgsm/Makefile.in b/tests/gpgsm/Makefile.in new file mode 100644 index 0000000..8c9ba31 --- /dev/null +++ b/tests/gpgsm/Makefile.in @@ -0,0 +1,756 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# 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 Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 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 Lesser General +# Public License for more details. +# +# You should have received a copy of the GNU Lesser 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 + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +TESTS = t-import$(EXEEXT) t-keylist$(EXEEXT) t-encrypt$(EXEEXT) \ + t-verify$(EXEEXT) t-decrypt$(EXEEXT) t-sign$(EXEEXT) \ + t-export$(EXEEXT) +noinst_PROGRAMS = $(am__EXEEXT_1) t-genkey$(EXEEXT) \ + cms-keylist$(EXEEXT) cms-decrypt$(EXEEXT) +subdir = tests/gpgsm +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/glib-2.0.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnupg-ttyname.m4 \ + $(top_srcdir)/m4/gpg-error.m4 $(top_srcdir)/m4/libassuan.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__EXEEXT_1 = t-import$(EXEEXT) t-keylist$(EXEEXT) t-encrypt$(EXEEXT) \ + t-verify$(EXEEXT) t-decrypt$(EXEEXT) t-sign$(EXEEXT) \ + t-export$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +cms_decrypt_SOURCES = cms-decrypt.c +cms_decrypt_OBJECTS = cms-decrypt.$(OBJEXT) +cms_decrypt_LDADD = $(LDADD) +cms_decrypt_DEPENDENCIES = ../../src/libgpgme.la +cms_keylist_SOURCES = cms-keylist.c +cms_keylist_OBJECTS = cms-keylist.$(OBJEXT) +cms_keylist_LDADD = $(LDADD) +cms_keylist_DEPENDENCIES = ../../src/libgpgme.la +t_decrypt_SOURCES = t-decrypt.c +t_decrypt_OBJECTS = t-decrypt.$(OBJEXT) +t_decrypt_LDADD = $(LDADD) +t_decrypt_DEPENDENCIES = ../../src/libgpgme.la +t_encrypt_SOURCES = t-encrypt.c +t_encrypt_OBJECTS = t-encrypt.$(OBJEXT) +t_encrypt_LDADD = $(LDADD) +t_encrypt_DEPENDENCIES = ../../src/libgpgme.la +t_export_SOURCES = t-export.c +t_export_OBJECTS = t-export.$(OBJEXT) +t_export_LDADD = $(LDADD) +t_export_DEPENDENCIES = ../../src/libgpgme.la +t_genkey_SOURCES = t-genkey.c +t_genkey_OBJECTS = t-genkey.$(OBJEXT) +t_genkey_LDADD = $(LDADD) +t_genkey_DEPENDENCIES = ../../src/libgpgme.la +t_import_SOURCES = t-import.c +t_import_OBJECTS = t-import.$(OBJEXT) +t_import_LDADD = $(LDADD) +t_import_DEPENDENCIES = ../../src/libgpgme.la +t_keylist_SOURCES = t-keylist.c +t_keylist_OBJECTS = t-keylist.$(OBJEXT) +t_keylist_LDADD = $(LDADD) +t_keylist_DEPENDENCIES = ../../src/libgpgme.la +t_sign_SOURCES = t-sign.c +t_sign_OBJECTS = t-sign.$(OBJEXT) +t_sign_LDADD = $(LDADD) +t_sign_DEPENDENCIES = ../../src/libgpgme.la +t_verify_SOURCES = t-verify.c +t_verify_OBJECTS = t-verify.$(OBJEXT) +t_verify_LDADD = $(LDADD) +t_verify_DEPENDENCIES = ../../src/libgpgme.la +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = cms-decrypt.c cms-keylist.c t-decrypt.c t-encrypt.c \ + t-export.c t-genkey.c t-import.c t-keylist.c t-sign.c \ + t-verify.c +DIST_SOURCES = cms-decrypt.c cms-keylist.c t-decrypt.c t-encrypt.c \ + t-export.c t-genkey.c t-import.c t-keylist.c t-sign.c \ + t-verify.c +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_FILEVERSION = @BUILD_FILEVERSION@ +BUILD_NUMBER = @BUILD_NUMBER@ +BUILD_TIMESTAMP = @BUILD_TIMESTAMP@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +G13 = @G13@ +GITLOG_TO_CHANGELOG = @GITLOG_TO_CHANGELOG@ +GLIBC21 = @GLIBC21@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GPG = @GPG@ +GPGCONF = @GPGCONF@ +GPGME_CONFIG_API_VERSION = @GPGME_CONFIG_API_VERSION@ +GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@ +GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@ +GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@ +GPGSM = @GPGSM@ +GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@ +GPG_ERROR_CONFIG = @GPG_ERROR_CONFIG@ +GPG_ERROR_LIBS = @GPG_ERROR_LIBS@ +GPG_PATH = @GPG_PATH@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBASSUAN_CFLAGS = @LIBASSUAN_CFLAGS@ +LIBASSUAN_CONFIG = @LIBASSUAN_CONFIG@ +LIBASSUAN_LIBS = @LIBASSUAN_LIBS@ +LIBGPGME_LT_AGE = @LIBGPGME_LT_AGE@ +LIBGPGME_LT_CURRENT = @LIBGPGME_LT_CURRENT@ +LIBGPGME_LT_REVISION = @LIBGPGME_LT_REVISION@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NEED__FILE_OFFSET_BITS = @NEED__FILE_OFFSET_BITS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +QT4_CORE_CFLAGS = @QT4_CORE_CFLAGS@ +QT4_CORE_LIBS = @QT4_CORE_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +emacs_local_vars_begin = @emacs_local_vars_begin@ +emacs_local_vars_end = @emacs_local_vars_end@ +emacs_local_vars_read_only = @emacs_local_vars_read_only@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO= +noinst_HEADERS = t-support.h +EXTRA_DIST = cert_dfn_pca01.der cert_dfn_pca15.der cert_g10code_test1.der \ + $(key_id) + +INCLUDES = -I$(top_builddir)/src +AM_CPPFLAGS = @GPG_ERROR_CFLAGS@ +LDADD = ../../src/libgpgme.la +key_id = 32100C27173EF6E9C4E9A25D3D69F86D37A4F939 +CLEANFILES = pubring.kbx pubring.kbx~ gpgsm.conf trustlist.txt \ + random_seed S.gpg-agent + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/gpgsm/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/gpgsm/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +cms-decrypt$(EXEEXT): $(cms_decrypt_OBJECTS) $(cms_decrypt_DEPENDENCIES) + @rm -f cms-decrypt$(EXEEXT) + $(LINK) $(cms_decrypt_OBJECTS) $(cms_decrypt_LDADD) $(LIBS) +cms-keylist$(EXEEXT): $(cms_keylist_OBJECTS) $(cms_keylist_DEPENDENCIES) + @rm -f cms-keylist$(EXEEXT) + $(LINK) $(cms_keylist_OBJECTS) $(cms_keylist_LDADD) $(LIBS) +t-decrypt$(EXEEXT): $(t_decrypt_OBJECTS) $(t_decrypt_DEPENDENCIES) + @rm -f t-decrypt$(EXEEXT) + $(LINK) $(t_decrypt_OBJECTS) $(t_decrypt_LDADD) $(LIBS) +t-encrypt$(EXEEXT): $(t_encrypt_OBJECTS) $(t_encrypt_DEPENDENCIES) + @rm -f t-encrypt$(EXEEXT) + $(LINK) $(t_encrypt_OBJECTS) $(t_encrypt_LDADD) $(LIBS) +t-export$(EXEEXT): $(t_export_OBJECTS) $(t_export_DEPENDENCIES) + @rm -f t-export$(EXEEXT) + $(LINK) $(t_export_OBJECTS) $(t_export_LDADD) $(LIBS) +t-genkey$(EXEEXT): $(t_genkey_OBJECTS) $(t_genkey_DEPENDENCIES) + @rm -f t-genkey$(EXEEXT) + $(LINK) $(t_genkey_OBJECTS) $(t_genkey_LDADD) $(LIBS) +t-import$(EXEEXT): $(t_import_OBJECTS) $(t_import_DEPENDENCIES) + @rm -f t-import$(EXEEXT) + $(LINK) $(t_import_OBJECTS) $(t_import_LDADD) $(LIBS) +t-keylist$(EXEEXT): $(t_keylist_OBJECTS) $(t_keylist_DEPENDENCIES) + @rm -f t-keylist$(EXEEXT) + $(LINK) $(t_keylist_OBJECTS) $(t_keylist_LDADD) $(LIBS) +t-sign$(EXEEXT): $(t_sign_OBJECTS) $(t_sign_DEPENDENCIES) + @rm -f t-sign$(EXEEXT) + $(LINK) $(t_sign_OBJECTS) $(t_sign_LDADD) $(LIBS) +t-verify$(EXEEXT): $(t_verify_OBJECTS) $(t_verify_DEPENDENCIES) + @rm -f t-verify$(EXEEXT) + $(LINK) $(t_verify_OBJECTS) $(t_verify_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cms-decrypt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cms-keylist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-decrypt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-encrypt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-export.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-genkey.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-import.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-keylist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-sign.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-verify.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes$$std"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(PROGRAMS) $(HEADERS) all-local +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \ + clean clean-generic clean-libtool clean-local \ + clean-noinstPROGRAMS ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +clean-local: + -gpg-connect-agent KILLAGENT /bye + -rm -fR private-keys-v1.d + +all-local: ./pubring.kbx ./gpgsm.conf ./private-keys-v1.d/$(key_id).key ./trustlist.txt + +export GNUPGHOME := $(abs_builddir) + +export GPG_AGENT_INFO := + +./pubring.kbx: $(srcdir)/cert_g10code_test1.der + $(GPGSM) --import $(srcdir)/cert_g10code_test1.der + +./gpgsm.conf: + echo disable-crl-checks > ./gpgsm.conf + echo faked-system-time 1008241200 >> ./gpgsm.conf + +./private-keys-v1.d/$(key_id).key: $(srcdir)/$(key_id) + test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d + cp $(srcdir)/$(key_id) private-keys-v1.d/$(key_id).key + +./trustlist.txt: + echo $(key_id) > ./trustlist.txt + echo >> ./trustlist.txt + echo "# CN=test cert 1,OU=Aegypten Project,O=g10 Code GmbH,L=Düsseldorf,C=DE" >> ./trustlist.txt + echo "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E S" >> ./trustlist.txt + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/gpgsm/cert_dfn_pca01.der b/tests/gpgsm/cert_dfn_pca01.der Binary files differnew file mode 100644 index 0000000..4c8593c --- /dev/null +++ b/tests/gpgsm/cert_dfn_pca01.der diff --git a/tests/gpgsm/cert_dfn_pca15.der b/tests/gpgsm/cert_dfn_pca15.der Binary files differnew file mode 100644 index 0000000..c28f137 --- /dev/null +++ b/tests/gpgsm/cert_dfn_pca15.der diff --git a/tests/gpgsm/cert_g10code_test1.der b/tests/gpgsm/cert_g10code_test1.der Binary files differnew file mode 100644 index 0000000..67c7db6 --- /dev/null +++ b/tests/gpgsm/cert_g10code_test1.der diff --git a/tests/gpgsm/cms-decrypt.c b/tests/gpgsm/cms-decrypt.c new file mode 100644 index 0000000..580832d --- /dev/null +++ b/tests/gpgsm/cms-decrypt.c @@ -0,0 +1,108 @@ +/* cms-decrypt.c - Helper to debug the decrupt operation. + Copyright (C) 2008 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#define PGM "cms-decrypt" + +#include "t-support.h" + +static const char * +nonnull (const char *s) +{ + return s? s :"[none]"; +} + + +int +main (int argc, char **argv) +{ + gpgme_error_t err; + gpgme_ctx_t ctx; + gpgme_data_t in, out; + gpgme_decrypt_result_t result; + gpgme_recipient_t recp; + + if (argc) + { argc--; argv++; } + + if (argc != 1) + { + fputs ("usage: " PGM " FILE\n", stderr); + exit (1); + } + + init_gpgme (GPGME_PROTOCOL_CMS); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); + + + err = gpgme_data_new_from_file (&in, *argv, 1); + fail_if_err (err); + + err = gpgme_data_new (&out); + fail_if_err (err); + + err = gpgme_op_decrypt (ctx, in, out); + printf ("gpgme_op_decrypt: %s <%s> (%u)\n", + gpgme_strerror (err), gpgme_strsource (err), err); + result = gpgme_op_decrypt_result (ctx); + if (!result) + { + fputs (PGM ": error: decryption result missing\n", stderr); + exit (1); + } + + printf ("unsupported_algorithm: %s\n", + nonnull (result->unsupported_algorithm)); + printf ("wrong_key_usage: %u\n", result->wrong_key_usage); + printf ("file_name: %s\n", nonnull (result->file_name)); + for (recp = result->recipients; recp; recp = recp->next) + { + printf ("recipient.status: %s <%s> (%u)\n", + gpgme_strerror (recp->status), gpgme_strsource (recp->status), + recp->status); + printf ("recipient.pkalgo: %d\n", recp->pubkey_algo); + printf ("recipient.keyid : %s\n", nonnull (recp->keyid)); + } + + if (!err) + { + puts ("plaintext:"); + print_data (out); + gpgme_data_release (out); + } + + gpgme_data_release (in); + + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpgsm/cms-keylist.c b/tests/gpgsm/cms-keylist.c new file mode 100644 index 0000000..7ed3a4e --- /dev/null +++ b/tests/gpgsm/cms-keylist.c @@ -0,0 +1,125 @@ +/* cms-keylist.c - Helper to show a key listing. + Copyright (C) 2008 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#define PGM "cms-keylist" + +#include "t-support.h" + +static const char * +nonnull (const char *s) +{ + return s? s :"[none]"; +} + + +int +main (int argc, char **argv) +{ + gpgme_error_t err; + gpgme_ctx_t ctx; + gpgme_key_t key; + gpgme_keylist_result_t result; + + if (argc) + { argc--; argv++; } + + if (argc > 1) + { + fputs ("usage: " PGM " [USERID]\n", stderr); + exit (1); + } + + init_gpgme (GPGME_PROTOCOL_CMS); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); + + gpgme_set_keylist_mode (ctx, (gpgme_get_keylist_mode (ctx) + | GPGME_KEYLIST_MODE_VALIDATE)); + + err = gpgme_op_keylist_start (ctx, argc? argv[0]:NULL, 0); + fail_if_err (err); + + while (!(err = gpgme_op_keylist_next (ctx, &key))) + { + gpgme_user_id_t uid; + int nuids; + + for (nuids=0, uid=key->uids; uid; uid = uid->next) + nuids++; + + printf ("serial : %s\n", nonnull (key->issuer_serial)); + printf ("issuer : %s\n", nonnull (key->issuer_name)); + printf ("chain-id: %s\n", nonnull (key->chain_id)); + printf ("caps : %s%s%s%s\n", + key->can_encrypt? "e":"", + key->can_sign? "s":"", + key->can_certify? "c":"", + key->can_authenticate? "a":""); + printf ("flags :%s%s%s%s%s%s\n", + key->secret? " secret":"", + key->revoked? " revoked":"", + key->expired? " expired":"", + key->disabled? " disabled":"", + key->invalid? " invalid":"", + key->is_qualified? " qualifid":""); + for (nuids=0, uid=key->uids; uid; uid = uid->next, nuids++) + { + printf ("userid %d: %s\n", nuids, nonnull(uid->uid)); + printf ("valid %d: %s\n", nuids, + uid->validity == GPGME_VALIDITY_UNKNOWN? "unknown": + uid->validity == GPGME_VALIDITY_UNDEFINED? "undefined": + uid->validity == GPGME_VALIDITY_NEVER? "never": + uid->validity == GPGME_VALIDITY_MARGINAL? "marginal": + uid->validity == GPGME_VALIDITY_FULL? "full": + uid->validity == GPGME_VALIDITY_ULTIMATE? "ultimate": "[?]"); + } + + putchar ('\n'); + + gpgme_key_unref (key); + } + if (gpgme_err_code (err) != GPG_ERR_EOF) + fail_if_err (err); + err = gpgme_op_keylist_end (ctx); + fail_if_err (err); + + result = gpgme_op_keylist_result (ctx); + if (result->truncated) + { + fprintf (stderr, PGM ": key listing unexpectedly truncated\n"); + exit (1); + } + + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpgsm/t-decrypt.c b/tests/gpgsm/t-decrypt.c new file mode 100644 index 0000000..654c7e1 --- /dev/null +++ b/tests/gpgsm/t-decrypt.c @@ -0,0 +1,86 @@ +/* t-encrypt.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> + +#include <gpgme.h> +#include "t-support.h" + + +static const char test_text1[] = "Hallo Leute!\n"; +static const char test_cip1[] = +"-----BEGIN CMS OBJECT-----\n" +"MIAGCSqGSIb3DQEHA6CAMIACAQAxggEJMIIBBQIBADBwMGsxCzAJBgNVBAYTAkRF\n" +"MRMwEQYDVQQHFApE/HNzZWxkb3JmMRYwFAYDVQQKEw1nMTAgQ29kZSBHbWJIMRkw\n" +"FwYDVQQLExBBZWd5cHRlbiBQcm9qZWN0MRQwEgYDVQQDEwt0ZXN0IGNlcnQgMQIB\n" +"ADALBgkqhkiG9w0BAQEEgYBOFcOfUtAav+XjKGM1RJtF+8JLkbnu46S3T3709Iok\n" +"u+Z9dwpOyfHwxXOmjzkSKQSBBxxi6ar+sKjU/KfPIvaMpARwT+NfIVSCZRWIJ27z\n" +"wbSrav/kcRRDDA0wXV7dHVmSLPUJNCpiFMNZbkYtI+ai15g0PVeDw+szYd9zdsjJ\n" +"2zCABgkqhkiG9w0BBwEwFAYIKoZIhvcNAwcECA8gPQY2NtJToIAECAeoY3MIcz9h\n" +"BAiiytWtOSmqnwAA\n" +"-----END CMS OBJECT-----\n"; + + +int +main (int argc, char *argv[]) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t in, out; + gpgme_decrypt_result_t result; + + init_gpgme (GPGME_PROTOCOL_CMS); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); + + err = gpgme_data_new_from_mem (&in, test_cip1, strlen (test_cip1), 0); + fail_if_err (err); + + err = gpgme_data_new (&out); + fail_if_err (err); + + err = gpgme_op_decrypt (ctx, in, out); + fail_if_err (err); + result = gpgme_op_decrypt_result (ctx); + if (result->unsupported_algorithm) + { + fprintf (stderr, "%s:%i: unsupported algorithm: %s\n", + __FILE__, __LINE__, result->unsupported_algorithm); + exit (1); + } + print_data (out); + + gpgme_data_release (in); + gpgme_data_release (out); + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpgsm/t-encrypt.c b/tests/gpgsm/t-encrypt.c new file mode 100644 index 0000000..45c772b --- /dev/null +++ b/tests/gpgsm/t-encrypt.c @@ -0,0 +1,78 @@ +/* t-encrypt.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#include "t-support.h" + +int +main (int argc, char **argv) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t in, out; + gpgme_key_t key[] = { NULL, NULL }; + gpgme_encrypt_result_t result; + + init_gpgme (GPGME_PROTOCOL_CMS); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); + gpgme_set_armor (ctx, 1); + + err = gpgme_data_new_from_mem (&in, "Hallo Leute\n", 12, 0); + fail_if_err (err); + + err = gpgme_data_new (&out); + fail_if_err (err); + + err = gpgme_get_key (ctx, "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E", + &key[0], 0); + fail_if_err (err); + + err = gpgme_op_encrypt (ctx, key, 0, in, out); + fail_if_err (err); + result = gpgme_op_encrypt_result (ctx); + if (result->invalid_recipients) + { + fprintf (stderr, "Invalid recipient encountered: %s\n", + result->invalid_recipients->fpr); + exit (1); + } + print_data (out); + + gpgme_key_unref (key[0]); + gpgme_data_release (in); + gpgme_data_release (out); + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpgsm/t-export.c b/tests/gpgsm/t-export.c new file mode 100644 index 0000000..d8856f2 --- /dev/null +++ b/tests/gpgsm/t-export.c @@ -0,0 +1,86 @@ +/* t-export.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#include <gpgme.h> +#include "t-support.h" + + +int +main (int argc, char *argv[]) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t out; + const char *pattern1[] = { "DFN Top Level Certification Authority", NULL }; + const char *pattern2[] = { "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E", + "DFN Server Certification Authority", + NULL }; + + init_gpgme (GPGME_PROTOCOL_CMS); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); + + gpgme_set_armor (ctx, 1); + + /* Check exporting of one certificate. */ + err = gpgme_data_new (&out); + fail_if_err (err); + err = gpgme_op_export_ext (ctx, pattern1, 0, out); + fail_if_err (err); + + fflush (NULL); + fputs ("Begin Result:\n", stdout); + print_data (out); + fputs ("End Result.\n", stdout); + + gpgme_data_release (out); + + /* Check exporting of 2 certificates. */ + err = gpgme_data_new (&out); + fail_if_err (err); + err = gpgme_op_export_ext (ctx, pattern2, 0, out); + fail_if_err (err); + + fflush (NULL); + fputs ("Begin Result:\n", stdout); + print_data (out); + fputs ("End Result.\n", stdout); + + gpgme_data_release (out); + + + gpgme_release (ctx); + + return 0; +} diff --git a/tests/gpgsm/t-genkey.c b/tests/gpgsm/t-genkey.c new file mode 100644 index 0000000..9de9d54 --- /dev/null +++ b/tests/gpgsm/t-genkey.c @@ -0,0 +1,128 @@ +/* t-genkey.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> + +#include <gpgme.h> +#include "t-support.h" + + +/* True if progress function printed something on the screen. */ +static int progress_called; + +static void +progress (void *self, const char *what, int type, int current, int total) +{ + if (!strcmp (what, "primegen") && !current && !total + && (type == '.' || type == '+' || type == '!' + || type == '^' || type == '<' || type == '>')) + { + printf ("%c", type); + fflush (stdout); + progress_called = 1; + } + else + { + fprintf (stderr, "unknown progress `%s' %d %d %d\n", what, type, + current, total); + exit (1); + } +} + + +int +main (int argc, char *argv[]) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + const char *parms = "<GnupgKeyParms format=\"internal\">\n" + "Key-Type: RSA\n" + "Key-Length: 1024\n" + "Name-DN: C=de,O=g10 code,OU=Testlab,CN=Joe 2 Tester\n" + "Name-Email: joe@foo.bar\n" + "</GnupgKeyParms>\n"; + gpgme_genkey_result_t result; + gpgme_data_t certreq; + + init_gpgme (GPGME_PROTOCOL_CMS); + + err = gpgme_data_new (&certreq); + fail_if_err (err); + + err = gpgme_new (&ctx); + fail_if_err (err); + + gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); + gpgme_set_armor (ctx, 1); + + gpgme_set_progress_cb (ctx, progress, NULL); + + err = gpgme_op_genkey (ctx, parms, certreq, NULL); + fail_if_err (err); + + result = gpgme_op_genkey_result (ctx); + if (!result) + { + fprintf (stderr, "%s:%d: gpgme_op_genkey_result returns NULL\n", + __FILE__, __LINE__); + exit (1); + } + if (progress_called) + printf ("\n"); + + printf ("Generated key: %s (%s)\n", result->fpr ? result->fpr : "none", + result->primary ? (result->sub ? "primary, sub" : "primary") + : (result->sub ? "sub" : "none")); + + if (result->fpr) + { + fprintf (stderr, "%s:%d: generated key has (unexpectdly) a fingerprint\n", + __FILE__, __LINE__); + exit (1); + } + if (!result->primary) + { + fprintf (stderr, "%s:%d: primary key was not generated\n", + __FILE__, __LINE__); + exit (1); + } + if (result->sub) + { + fprintf (stderr, "%s:%d: sub key was (unexpectedly) generated\n", + __FILE__, __LINE__); + exit (1); + } + gpgme_release (ctx); + + print_data (certreq); + gpgme_data_release (certreq); + + return 0; +} diff --git a/tests/gpgsm/t-import.c b/tests/gpgsm/t-import.c new file mode 100644 index 0000000..2d23779 --- /dev/null +++ b/tests/gpgsm/t-import.c @@ -0,0 +1,175 @@ +/* t-import.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> + +#include <gpgme.h> + +#include "t-support.h" + + +void +check_result (gpgme_import_result_t result, char *fpr, int total, + int total_stat) +{ + if (result->considered != total) + { + fprintf (stderr, "Unexpected number of considered keys %i\n", + result->considered); + exit (1); + } + if (result->no_user_id != 0) + { + fprintf (stderr, "Unexpected number of user ids %i\n", + result->no_user_id); + exit (1); + } + if (result->imported != 0 && result->imported != 1) + { + fprintf (stderr, "Unexpected number of imported keys %i\n", + result->imported); + exit (1); + } + if (result->imported_rsa != 0) + { + fprintf (stderr, "Unexpected number of imported RSA keys %i\n", + result->imported_rsa); + exit (1); + } + if ((result->imported == 0 && result->unchanged != total) + || (result->imported == 1 && result->unchanged != total - 1)) + { + fprintf (stderr, "Unexpected number of unchanged keys %i\n", + result->unchanged); + exit (1); + } + if (result->new_user_ids != 0) + { + fprintf (stderr, "Unexpected number of new user IDs %i\n", + result->new_user_ids); + exit (1); + } + if (result->new_sub_keys != 0) + { + fprintf (stderr, "Unexpected number of new sub keys %i\n", + result->new_sub_keys); + exit (1); + } + if (result->new_signatures != 0) + { + fprintf (stderr, "Unexpected number of new signatures %i\n", + result->new_signatures); + exit (1); + } + if (result->new_revocations != 0) + { + fprintf (stderr, "Unexpected number of new revocations %i\n", + result->new_revocations); + exit (1); + } + if (result->secret_read != 0) + { + fprintf (stderr, "Unexpected number of secret keys read %i\n", + result->secret_read); + exit (1); + } + if (result->secret_imported != 0) + { + fprintf (stderr, "Unexpected number of secret keys imported %i\n", + result->secret_imported); + exit (1); + } + if (result->secret_unchanged != 0) + { + fprintf (stderr, "Unexpected number of secret keys unchanged %i\n", + result->secret_unchanged); + exit (1); + } + if (result->not_imported != 0) + { + fprintf (stderr, "Unexpected number of secret keys not imported %i\n", + result->not_imported); + exit (1); + } + + { + int n; + gpgme_import_status_t r; + + for (n=0, r=result->imports; r; r=r->next) + n++; + + if (n != total_stat) + { + fprintf (stderr, "Unexpected number of status reports\n"); + exit (1); + } + } +} + + +int +main (int argc, char **argv) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t in; + gpgme_import_result_t result; + const char *cert_1 = make_filename ("cert_dfn_pca01.der"); + const char *cert_2 = make_filename ("cert_dfn_pca15.der"); + + init_gpgme (GPGME_PROTOCOL_CMS); + + 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); + result = gpgme_op_import_result (ctx); + check_result (result, "DFA56FB5FC41E3A8921F77AD1622EEFD9152A5AD", 1, 1); + 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); + result = gpgme_op_import_result (ctx); + check_result (result, "2C8F3C356AB761CB3674835B792CDA52937F9285", 1, 2); + gpgme_data_release (in); + + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpgsm/t-keylist.c b/tests/gpgsm/t-keylist.c new file mode 100644 index 0000000..bebd9d6 --- /dev/null +++ b/tests/gpgsm/t-keylist.c @@ -0,0 +1,389 @@ +/* t-keylist.c - regression test + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#include "t-support.h" + + +struct +{ + char *fpr; + int secret; + long timestamp; + long expires; + char *issuer_serial; + char *issuer_name; + char *chain_id; + char *uid; + char *email; + gpgme_validity_t validity; + unsigned int key_length; +} +keys[] = + { + { "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E", 1, 1007372198, 1038908198, "00", + "CN=test cert 1,OU=Aegypten Project,O=g10 Code GmbH,L=D\xc3\xbcsseldorf,C=DE", + "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E", + "CN=test cert 1,OU=Aegypten Project,O=g10 Code GmbH,L=D\xc3\xbcsseldorf,C=DE", + NULL, GPGME_VALIDITY_ULTIMATE, 1024 + }, + { "DFA56FB5FC41E3A8921F77AD1622EEFD9152A5AD", 0, 909684190, 1009821790, "01", + "1.2.840.113549.1.9.1=#63657274696679407063612E64666E2E6465," + "CN=DFN Top Level Certification Authority,OU=DFN-PCA," + "O=Deutsches Forschungsnetz,C=DE", + "DFA56FB5FC41E3A8921F77AD1622EEFD9152A5AD", + "1.2.840.113549.1.9.1=#63657274696679407063612E64666E2E6465," + "CN=DFN Top Level Certification Authority,OU=DFN-PCA," + "O=Deutsches Forschungsnetz,C=DE", + "<certify@pca.dfn.de>", GPGME_VALIDITY_NEVER, 2048 + }, + { "2C8F3C356AB761CB3674835B792CDA52937F9285", 0, 973183644, 1009735200, "15", + "1.2.840.113549.1.9.1=#63657274696679407063612E64666E2E6465," + "CN=DFN Top Level Certification Authority,OU=DFN-PCA," + "O=Deutsches Forschungsnetz,C=DE", + "DFA56FB5FC41E3A8921F77AD1622EEFD9152A5AD", + "1.2.840.113549.1.9.1=#63657274696679407063612E64666E2E6465," + "CN=DFN Server Certification Authority,OU=DFN-PCA," + "O=Deutsches Forschungsnetz,C=DE", + "<certify@pca.dfn.de>", GPGME_VALIDITY_UNKNOWN, 2048 + }, + { NULL } + }; + + +int +main (int argc, char **argv) +{ + gpgme_error_t err; + gpgme_ctx_t ctx; + gpgme_key_t key; + gpgme_keylist_result_t result; + int i = 0; + + init_gpgme (GPGME_PROTOCOL_CMS); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); + + err = gpgme_op_keylist_start (ctx, NULL, 0); + fail_if_err (err); + + while (!(err = gpgme_op_keylist_next (ctx, &key))) + { + if (!keys[i].fpr) + { + fprintf (stderr, "More keys returned than expected\n"); + exit (1); + } + + if (strcmp (key->subkeys->fpr, keys[i].fpr)) + { + fprintf (stderr, "Warning: Skipping unknown key %s\n", + key->subkeys->fpr); + continue; + } + else + printf ("Checking key %s\n", key->subkeys->fpr); + + /* Global key flags. */ + if (key->revoked) + { + fprintf (stderr, "Key unexpectedly revoked\n"); + exit (1); + } + if (key->expired) + { + fprintf (stderr, "Key unexpectedly expired\n"); + exit (1); + } + if (key->disabled) + { + fprintf (stderr, "Key unexpectedly disabled\n"); + exit (1); + } + if (key->invalid) + { + fprintf (stderr, "Key unexpectedly invalid\n"); + exit (1); + } + if (key->can_encrypt != keys[i].secret) + { + fprintf (stderr, "Key unexpectedly%s usable for encryption\n", + key->can_encrypt ? "" : " not"); + exit (1); + } + if (key->can_sign != keys[i].secret) + { + fprintf (stderr, "Key unexpectedly%s usable for signing\n", + key->can_sign ? "" : " not"); + exit (1); + } + if (!key->can_certify) + { + fprintf (stderr, "Key unexpectedly unusable for certifications\n"); + exit (1); + } + if (key->secret != keys[i].secret) + { + fprintf (stderr, "Key unexpectedly%s secret\n", + key->secret ? "" : " not"); + exit (1); + } + if (key->protocol != GPGME_PROTOCOL_CMS) + { + fprintf (stderr, "Key has unexpected protocol: %s\n", + gpgme_get_protocol_name (key->protocol)); + exit (1); + } + if (!key->issuer_serial) + { + fprintf (stderr, "Key unexpectedly misses issuer serial\n"); + exit (1); + } + if (strcmp (key->issuer_serial, keys[i].issuer_serial)) + { + fprintf (stderr, "Key has unexpected issuer serial: %s\n", + key->issuer_serial); + exit (1); + } + if (!key->issuer_name) + { + fprintf (stderr, "Key unexpectedly misses issuer name\n"); + exit (1); + } + if (strcmp (key->issuer_name, keys[i].issuer_name)) + { + fprintf (stderr, "Key has unexpected issuer name: %s\n", + key->issuer_name); + exit (1); + } + if (key->chain_id && !keys[i].chain_id) + { + fprintf (stderr, "Key unexpectedly carries chain ID: %s\n", + key->chain_id); + exit (1); + } + if (!key->chain_id && keys[i].chain_id) + { + fprintf (stderr, "Key unexpectedly carries no chain ID\n"); + exit (1); + } + if (key->chain_id && strcmp (key->chain_id, keys[i].chain_id)) + { + fprintf (stderr, "Key carries unexpected chain ID: %s\n", + key->chain_id); + exit (1); + } + if (key->owner_trust != GPGME_VALIDITY_UNKNOWN) + { + fprintf (stderr, "Key has unexpected owner trust: %i\n", + key->owner_trust); + exit (1); + } + if (!key->subkeys || key->subkeys->next) + { + fprintf (stderr, "Key has unexpected number of subkeys\n"); + exit (1); + } + + /* Primary key. */ + if (key->subkeys->revoked) + { + fprintf (stderr, "Primary key unexpectedly revoked\n"); + exit (1); + } + if (key->subkeys->expired) + { + fprintf (stderr, "Primary key unexpectedly expired\n"); + exit (1); + } + if (key->subkeys->disabled) + { + fprintf (stderr, "Primary key unexpectedly disabled\n"); + exit (1); + } + if (key->subkeys->invalid) + { + fprintf (stderr, "Primary key unexpectedly invalid\n"); + exit (1); + } + if (key->subkeys->can_encrypt != keys[i].secret) + { + fprintf (stderr, "Key unexpectedly%s usable for encryption\n", + key->subkeys->can_encrypt ? "" : " not"); + exit (1); + } + if (key->subkeys->can_sign != keys[i].secret) + { + fprintf (stderr, "Key unexpectedly%s usable for signing\n", + key->subkeys->can_sign ? "" : " not"); + exit (1); + } + if (!key->subkeys->can_certify) + { + fprintf (stderr, "Primary key unexpectedly unusable for certifications\n"); + exit (1); + } + if (key->subkeys->secret != keys[i].secret) + { + fprintf (stderr, "Primary Key unexpectedly%s secret\n", + key->secret ? "" : " not"); + exit (1); + } + if (key->subkeys->pubkey_algo != GPGME_PK_RSA) + { + fprintf (stderr, "Primary key has unexpected public key algo: %s\n", + gpgme_pubkey_algo_name (key->subkeys->pubkey_algo)); + exit (1); + } + if (key->subkeys->length != keys[i].key_length) + { + fprintf (stderr, "Primary key has unexpected length: %i\n", + key->subkeys->length); + exit (1); + } + if (strcmp (key->subkeys->keyid, &keys[i].fpr[40 - 16])) + { + fprintf (stderr, "Primary key has unexpected key ID: %s\n", + key->subkeys->keyid); + exit (1); + } + if (strcmp (key->subkeys->fpr, keys[i].fpr)) + { + fprintf (stderr, "Primary key has unexpected fingerprint: %s\n", + key->subkeys->fpr); + exit (1); + } + if (key->subkeys->timestamp != keys[i].timestamp) + { + fprintf (stderr, "Primary key unexpected timestamp: %lu\n", + key->subkeys->timestamp); + exit (1); + } + if (key->subkeys->expires != keys[i].expires) + { + fprintf (stderr, "Primary key unexpectedly expires: %lu\n", + key->subkeys->expires); + exit (1); + } + + /* Be tolerant against a missing email (ie, older gpgsm versions). */ + if (!key->uids || (key->uids->next && !keys[i].email)) + { + fprintf (stderr, "Key has unexpected number of user IDs\n"); + exit (1); + } + if (key->uids->revoked) + { + fprintf (stderr, "User ID unexpectedly revoked\n"); + exit (1); + } + if (key->uids->invalid) + { + fprintf (stderr, "User ID unexpectedly invalid\n"); + exit (1); + } + if (key->uids->validity != keys[i].validity) + { + fprintf (stderr, "User ID unexpectedly validity: %i\n", + key->uids->validity); + exit (1); + } + if (key->uids->signatures) + { + fprintf (stderr, "User ID unexpectedly signed\n"); + exit (1); + } + if (!key->uids->name || key->uids->name[0]) + { + fprintf (stderr, "Unexpected name in user ID: %s\n", + key->uids->name); + exit (1); + } + if (!key->uids->comment || key->uids->comment[0]) + { + fprintf (stderr, "Unexpected comment in user ID: %s\n", + key->uids->comment); + exit (1); + } + if (!key->uids->email || key->uids->email[0]) + { + fprintf (stderr, "Unexpected email in user ID: %s\n", + key->uids->email); + exit (1); + } + if (!key->uids->uid || strcmp (key->uids->uid, keys[i].uid)) + { + fprintf (stderr, "Unexpected uid in user ID: %s\n", + key->uids->uid); + exit (1); + } + if (key->uids->next && strcmp (key->uids->next->uid, keys[i].email)) + { + fprintf (stderr, "Unexpected email in user ID: %s\n", + key->uids->next->uid); + exit (1); + } + if (key->uids->next && strcmp (key->uids->next->uid, keys[i].email)) + { + fprintf (stderr, "Unexpected email in user ID: %s\n", + key->uids->next->uid); + exit (1); + } + + + + gpgme_key_unref (key); + i++; + } + if (gpgme_err_code (err) != GPG_ERR_EOF) + fail_if_err (err); + err = gpgme_op_keylist_end (ctx); + fail_if_err (err); + + result = gpgme_op_keylist_result (ctx); + if (result->truncated) + { + fprintf (stderr, "Key listing unexpectedly truncated\n"); + exit (1); + } + + if (keys[i].fpr) + { + fprintf (stderr, "Less keys returned than expected\n"); + exit (1); + } + + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpgsm/t-sign.c b/tests/gpgsm/t-sign.c new file mode 100644 index 0000000..dc2d841 --- /dev/null +++ b/tests/gpgsm/t-sign.c @@ -0,0 +1,127 @@ +/* t-sign.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> +#include "t-support.h" + + +static void +check_result (gpgme_sign_result_t result, gpgme_sig_mode_t type) +{ + if (result->invalid_signers) + { + fprintf (stderr, "Invalid signer found: %s\n", + result->invalid_signers->fpr); + exit (1); + } + if (!result->signatures || result->signatures->next) + { + fprintf (stderr, "Unexpected number of signatures created\n"); + exit (1); + } + if (result->signatures->type != type) + { + fprintf (stderr, "Wrong type of signature created\n"); + exit (1); + } + if (result->signatures->pubkey_algo != GPGME_PK_RSA) + { + fprintf (stderr, "Wrong pubkey algorithm reported: %i\n", + result->signatures->pubkey_algo); + exit (1); + } + if (result->signatures->hash_algo != GPGME_MD_SHA1) + { + fprintf (stderr, "Wrong hash algorithm reported: %i\n", + result->signatures->hash_algo); + exit (1); + } + if (result->signatures->sig_class != 0) + { + fprintf (stderr, "Wrong signature class reported: %u\n", + result->signatures->sig_class); + exit (1); + } + if (strcmp ("3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E", + result->signatures->fpr)) + { + fprintf (stderr, "Wrong fingerprint reported: %s\n", + result->signatures->fpr); + exit (1); + } +} + + +int +main (int argc, char *argv[]) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t in, out; + gpgme_sign_result_t result; + + init_gpgme (GPGME_PROTOCOL_CMS); + + err = gpgme_new (&ctx); + fail_if_err (err); + + gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); + gpgme_set_textmode (ctx, 1); + gpgme_set_armor (ctx, 1); + + err = gpgme_data_new_from_mem (&in, "Hallo Leute!\n", 13, 0); + fail_if_err (err); + + /* First a normal signature. */ + err = gpgme_data_new (&out); + fail_if_err (err); + err = gpgme_op_sign (ctx, in, out, GPGME_SIG_MODE_NORMAL); + fail_if_err (err); + result = gpgme_op_sign_result (ctx); + check_result (result, GPGME_SIG_MODE_NORMAL); + print_data (out); + gpgme_data_release (out); + + /* Now a detached signature. */ + gpgme_data_seek (in, 0, SEEK_SET); + err = gpgme_data_new (&out); + fail_if_err (err); + err = gpgme_op_sign (ctx, in, out, GPGME_SIG_MODE_DETACH); + fail_if_err (err); + result = gpgme_op_sign_result (ctx); + check_result (result, GPGME_SIG_MODE_DETACH); + print_data (out); + gpgme_data_release (out); + + gpgme_data_release (in); + gpgme_release (ctx); + return 0; +} diff --git a/tests/gpgsm/t-support.h b/tests/gpgsm/t-support.h new file mode 100644 index 0000000..cc1a7db --- /dev/null +++ b/tests/gpgsm/t-support.h @@ -0,0 +1,114 @@ +/* t-support.h - Helper routines for regression tests. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 <unistd.h> +#include <errno.h> +#include <stdlib.h> +#include <locale.h> + +#include <gpgme.h> + +#define fail_if_err(err) \ + do \ + { \ + if (err) \ + { \ + fprintf (stderr, "%s:%d: %s: %s (%d.%d)\n", \ + __FILE__, __LINE__, gpgme_strsource (err), \ + gpgme_strerror (err), \ + gpgme_err_source (err), gpgme_err_code (err)); \ + exit (1); \ + } \ + } \ + while (0) + + +void +print_data (gpgme_data_t dh) +{ +#define BUF_SIZE 512 + char buf[BUF_SIZE + 1]; + int ret; + + ret = gpgme_data_seek (dh, 0, SEEK_SET); + if (ret) + fail_if_err (gpgme_error_from_errno (errno)); + while ((ret = gpgme_data_read (dh, buf, BUF_SIZE)) > 0) + fwrite (buf, ret, 1, stdout); + if (ret < 0) + fail_if_err (gpgme_error_from_errno (errno)); +} + + +gpgme_error_t +passphrase_cb (void *opaque, const char *uid_hint, const char *passphrase_info, + int last_was_bad, int fd) +{ + int res; + char *pass = "abc\n"; + int passlen = strlen (pass); + int off = 0; + + do + { + res = write (fd, &pass[off], passlen - off); + if (res > 0) + off += res; + } + while (res > 0 && off != passlen); + + return off == passlen ? 0 : gpgme_error_from_errno (errno); +} + + +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) + exit (8); + strcpy (buf, srcdir); + strcat (buf, "/"); + strcat (buf, fname); + return buf; +} + + +void +init_gpgme (gpgme_protocol_t proto) +{ + gpgme_error_t err; + + gpgme_check_version (NULL); +#ifndef HAVE_W32_SYSTEM + setlocale (LC_ALL, ""); + gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL)); + gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL)); +#endif + + err = gpgme_engine_check_version (proto); + fail_if_err (err); +} diff --git a/tests/gpgsm/t-verify.c b/tests/gpgsm/t-verify.c new file mode 100644 index 0000000..062c5a1 --- /dev/null +++ b/tests/gpgsm/t-verify.c @@ -0,0 +1,182 @@ +/* t-verify.c - Regression test. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#include "t-support.h" + + +static int got_errors; + +static const char test_text1[] = "Hallo Leute!\n"; +static const char test_text1f[]= "Hallo Leute?\n"; +static const char test_sig1[] = +"-----BEGIN CMS OBJECT-----\n" +"MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAA\n" +"MYIBOTCCATUCAQEwcDBrMQswCQYDVQQGEwJERTETMBEGA1UEBxQKRPxzc2VsZG9y\n" +"ZjEWMBQGA1UEChMNZzEwIENvZGUgR21iSDEZMBcGA1UECxMQQWVneXB0ZW4gUHJv\n" +"amVjdDEUMBIGA1UEAxMLdGVzdCBjZXJ0IDECAQAwBwYFKw4DAhqgJTAjBgkqhkiG\n" +"9w0BCQQxFgQU7FC/ibH3lC9GE24RJJxa8zqP7wEwCwYJKoZIhvcNAQEBBIGAA3oC\n" +"DUmKERmD1eoJYFw38y/qnncS/6ZPjWINDIphZeK8mzAANpvpIaRPf3sNBznb89QF\n" +"mRgCXIWcjlHT0DTRLBf192Ve22IyKH00L52CqFsSN3a2sajqRUlXH8RY2D+Al71e\n" +"MYdRclgjObCcoilA8fZ13VR4DiMJVFCxJL4qVWI=\n" +"-----END CMS OBJECT-----\n"; + + +static void +check_result (gpgme_verify_result_t result, int summary, char *fpr, + gpgme_error_t status, gpgme_validity_t validity) +{ + gpgme_signature_t sig; + + sig = result->signatures; + if (!sig || sig->next) + { + fprintf (stderr, "%s:%i: Unexpected number of signatures\n", + __FILE__, __LINE__); + got_errors = 1; + } + if (sig->summary != summary) + { + fprintf (stderr, "%s:%i: Unexpected signature summary: " + "want=0x%x have=0x%x\n", + __FILE__, __LINE__, summary, sig->summary); + got_errors = 1; + } + if (strcmp (sig->fpr, fpr)) + { + fprintf (stderr, "%s:%i: Unexpected fingerprint: %s\n", + __FILE__, __LINE__, sig->fpr); + got_errors = 1; + } + if (gpgme_err_code (sig->status) != status) + { + fprintf (stderr, "%s:%i: Unexpected signature status: %s\n", + __FILE__, __LINE__, gpgme_strerror (sig->status)); + got_errors = 1; + } + if (sig->notations) + { + fprintf (stderr, "%s:%i: Unexpected notation data\n", + __FILE__, __LINE__); + got_errors = 1; + } + if (sig->wrong_key_usage) + { + fprintf (stderr, "%s:%i: Unexpectedly wrong key usage\n", + __FILE__, __LINE__); + got_errors = 1; + } + if (sig->validity != validity) + { + fprintf (stderr, "%s:%i: Unexpected validity: %i\n", + __FILE__, __LINE__, sig->validity); + got_errors = 1; + } + if (gpgme_err_code (sig->validity_reason) != GPG_ERR_NO_ERROR) + { + fprintf (stderr, "%s:%i: Unexpected validity reason: %s\n", + __FILE__, __LINE__, gpgme_strerror (sig->validity_reason)); + got_errors = 1; + } +} + + +static void +show_auditlog (gpgme_ctx_t ctx) +{ + gpgme_error_t err; + gpgme_data_t data; + + err = gpgme_data_new (&data); + fail_if_err (err); + err = gpgme_op_getauditlog (ctx, data, GPGME_AUDITLOG_HTML); + if (err) + { + fprintf (stderr, "%s:%i: Can't get audit log: %s\n", + __FILE__, __LINE__, gpgme_strerror (err)); + if (gpgme_err_code (err) != GPG_ERR_ASS_UNKNOWN_CMD) + got_errors = 1; + } + print_data (data); + gpgme_data_release (data); +} + + + +int +main (int argc, char **argv) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t sig, text; + gpgme_verify_result_t result; + + init_gpgme (GPGME_PROTOCOL_CMS); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); + + /* Checking a valid message. */ + err = gpgme_data_new_from_mem (&text, test_text1, strlen (test_text1), 0); + fail_if_err (err); + err = gpgme_data_new_from_mem (&sig, test_sig1, strlen (test_sig1), 0); + fail_if_err (err); + + err = gpgme_op_verify (ctx, sig, text, NULL); + fail_if_err (err); + result = gpgme_op_verify_result (ctx); + check_result (result, GPGME_SIGSUM_VALID | GPGME_SIGSUM_GREEN, + "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E", + GPG_ERR_NO_ERROR, GPGME_VALIDITY_FULL); + + show_auditlog (ctx); + + /* Checking a manipulated message. */ + gpgme_data_release (text); + err = gpgme_data_new_from_mem (&text, test_text1f, strlen (test_text1f), 0); + fail_if_err (err); + gpgme_data_seek (sig, 0, SEEK_SET); + err = gpgme_op_verify (ctx, sig, text, NULL); + fail_if_err (err); + result = gpgme_op_verify_result (ctx); + check_result (result, GPGME_SIGSUM_RED, + "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E", + GPG_ERR_BAD_SIGNATURE, GPGME_VALIDITY_UNKNOWN); + + show_auditlog (ctx); + + gpgme_data_release (text); + gpgme_data_release (sig); + gpgme_release (ctx); + return got_errors? 1 : 0; +} diff --git a/tests/opassuan/Makefile.am b/tests/opassuan/Makefile.am new file mode 100644 index 0000000..2446007 --- /dev/null +++ b/tests/opassuan/Makefile.am @@ -0,0 +1,35 @@ +# Copyright (C) 2009 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 Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 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 Lesser General +# Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, see <http://www.gnu.org/licenses/>. + +## Process this file with automake to produce Makefile.in + +TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO= + +noinst_HEADERS = +TESTS = + +EXTRA_DIST = + +INCLUDES = -I$(top_builddir)/src + +AM_CPPFLAGS = @GPG_ERROR_CFLAGS@ +LDADD = ../../src/libgpgme.la + +noinst_PROGRAMS = $(TESTS) t-command + +DISTCLEANFILES = + diff --git a/tests/opassuan/Makefile.in b/tests/opassuan/Makefile.in new file mode 100644 index 0000000..2698737 --- /dev/null +++ b/tests/opassuan/Makefile.in @@ -0,0 +1,641 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright (C) 2009 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 Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 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 Lesser General +# Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, see <http://www.gnu.org/licenses/>. + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +TESTS = +noinst_PROGRAMS = $(am__EXEEXT_1) t-command$(EXEEXT) +subdir = tests/opassuan +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/glib-2.0.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnupg-ttyname.m4 \ + $(top_srcdir)/m4/gpg-error.m4 $(top_srcdir)/m4/libassuan.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__EXEEXT_1 = +PROGRAMS = $(noinst_PROGRAMS) +t_command_SOURCES = t-command.c +t_command_OBJECTS = t-command.$(OBJEXT) +t_command_LDADD = $(LDADD) +t_command_DEPENDENCIES = ../../src/libgpgme.la +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = t-command.c +DIST_SOURCES = t-command.c +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_FILEVERSION = @BUILD_FILEVERSION@ +BUILD_NUMBER = @BUILD_NUMBER@ +BUILD_TIMESTAMP = @BUILD_TIMESTAMP@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +G13 = @G13@ +GITLOG_TO_CHANGELOG = @GITLOG_TO_CHANGELOG@ +GLIBC21 = @GLIBC21@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GPG = @GPG@ +GPGCONF = @GPGCONF@ +GPGME_CONFIG_API_VERSION = @GPGME_CONFIG_API_VERSION@ +GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@ +GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@ +GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@ +GPGSM = @GPGSM@ +GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@ +GPG_ERROR_CONFIG = @GPG_ERROR_CONFIG@ +GPG_ERROR_LIBS = @GPG_ERROR_LIBS@ +GPG_PATH = @GPG_PATH@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBASSUAN_CFLAGS = @LIBASSUAN_CFLAGS@ +LIBASSUAN_CONFIG = @LIBASSUAN_CONFIG@ +LIBASSUAN_LIBS = @LIBASSUAN_LIBS@ +LIBGPGME_LT_AGE = @LIBGPGME_LT_AGE@ +LIBGPGME_LT_CURRENT = @LIBGPGME_LT_CURRENT@ +LIBGPGME_LT_REVISION = @LIBGPGME_LT_REVISION@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NEED__FILE_OFFSET_BITS = @NEED__FILE_OFFSET_BITS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +QT4_CORE_CFLAGS = @QT4_CORE_CFLAGS@ +QT4_CORE_LIBS = @QT4_CORE_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +emacs_local_vars_begin = @emacs_local_vars_begin@ +emacs_local_vars_end = @emacs_local_vars_end@ +emacs_local_vars_read_only = @emacs_local_vars_read_only@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO= +noinst_HEADERS = +EXTRA_DIST = +INCLUDES = -I$(top_builddir)/src +AM_CPPFLAGS = @GPG_ERROR_CFLAGS@ +LDADD = ../../src/libgpgme.la +DISTCLEANFILES = +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/opassuan/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/opassuan/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +t-command$(EXEEXT): $(t_command_OBJECTS) $(t_command_DEPENDENCIES) + @rm -f t-command$(EXEEXT) + $(LINK) $(t_command_OBJECTS) $(t_command_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-command.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes$$std"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(PROGRAMS) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-generic clean-libtool clean-noinstPROGRAMS ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/opassuan/t-command.c b/tests/opassuan/t-command.c new file mode 100644 index 0000000..87f8202 --- /dev/null +++ b/tests/opassuan/t-command.c @@ -0,0 +1,137 @@ +/* t-command.c - Regression test. + Copyright (C) 2009 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <string.h> +#include <locale.h> +#include <assert.h> + +#include <gpgme.h> + +#define fail_if_err(err) \ + do \ + { \ + if (err) \ + { \ + fprintf (stderr, "%s:%d: %s: %s (%d.%d)\n", \ + __FILE__, __LINE__, gpgme_strsource (err), \ + gpgme_strerror (err), \ + gpgme_err_source (err), gpgme_err_code (err)); \ + exit (1); \ + } \ + } \ + while (0) + + +static gpgme_error_t +data_cb (void *opaque, const void *data, size_t datalen) +{ + printf ("DATA_CB: datalen=%d\n", (int)datalen); + return 0; +} + + +static gpgme_error_t +inq_cb (void *opaque, const char *name, const char *args, + gpgme_data_t *r_data) +{ + gpgme_data_t data; + gpgme_error_t err; + + if (name) + { + printf ("INQ_CB: name=`%s' args=`%s'\n", name, args); + /* There shall be no data object. */ + assert (!*r_data); + + err = gpgme_data_new (&data); + fail_if_err (err); + *r_data = data; + printf (" sending data object %p\n", data); + } + else /* Finished using the formerly returned data object. */ + { + printf ("INQ_CB: data object %p finished\n", *r_data); + /* There shall be a data object so that it can be cleaned up. */ + assert (r_data); + + gpgme_data_release (*r_data); + } + + /* Uncomment the next lines and send a "SCD LEARN" to test sending + cancel from in inquiry. */ + /* if (name && !strcmp (name, "KNOWNCARDP")) */ + /* return gpgme_error (GPG_ERR_ASS_CANCELED); */ + + + return 0; +} + + +static gpgme_error_t +status_cb (void *opaque, const char *status, const char *args) +{ + printf ("STATUS_CB: status=`%s' args=`%s'\n", status, args); + return 0; +} + + + +int +main (int argc, char **argv) +{ + gpgme_error_t err; + gpgme_error_t op_err; + gpgme_ctx_t ctx; + const char *command; + + gpgme_check_version (NULL); +#ifndef HAVE_W32_SYSTEM + setlocale (LC_ALL, ""); + gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL)); + gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL)); +#endif + + if (argc) + { + argc--; + argv++; + } + command = argc? *argv : "NOP"; + + + err = gpgme_new (&ctx); + fail_if_err (err); + + err = gpgme_set_protocol (ctx, GPGME_PROTOCOL_ASSUAN); + fail_if_err (err); + + err = gpgme_op_assuan_transact_ext (ctx, command, data_cb, NULL, + inq_cb, NULL, status_cb, NULL, &op_err); + fail_if_err (err || op_err); + + gpgme_release (ctx); + + return 0; +} + diff --git a/tests/run-export.c b/tests/run-export.c new file mode 100644 index 0000000..b70ed91 --- /dev/null +++ b/tests/run-export.c @@ -0,0 +1,161 @@ +/* pgp-export.c - Helper to run an export command + Copyright (C) 2008, 2009 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#define PGM "run-export" + +#include "run-support.h" + + +static int verbose; + + +static int +show_usage (int ex) +{ + fputs ("usage: " PGM " [options] USERIDS\n\n" + "Options:\n" + " --verbose run in verbose mode\n" + " --extern send keys to the keyserver (TAKE CARE!)\n" + , stderr); + exit (ex); +} + +int +main (int argc, char **argv) +{ + int last_argc = -1; + gpgme_error_t err; + gpgme_ctx_t ctx; + gpgme_key_t key; + gpgme_keylist_result_t result; + gpgme_key_t keyarray[100]; + int keyidx = 0; + gpgme_data_t out; + gpgme_export_mode_t mode = 0; + + if (argc) + { argc--; argv++; } + + while (argc && last_argc != argc ) + { + last_argc = argc; + if (!strcmp (*argv, "--")) + { + argc--; argv++; + break; + } + else if (!strcmp (*argv, "--help")) + show_usage (0); + else if (!strcmp (*argv, "--verbose")) + { + verbose = 1; + argc--; argv++; + } + else if (!strcmp (*argv, "--extern")) + { + mode |= GPGME_KEYLIST_MODE_EXTERN; + argc--; argv++; + } + else if (!strncmp (*argv, "--", 2)) + show_usage (1); + + } + + if (!argc) + show_usage (1); + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_protocol (ctx, GPGME_PROTOCOL_OpenPGP); + + /* Lookup the keys. */ + err = gpgme_op_keylist_ext_start (ctx, (const char**)argv, 0, 0); + fail_if_err (err); + + while (!(err = gpgme_op_keylist_next (ctx, &key))) + { + printf ("keyid: %s (fpr: %s)\n", + key->subkeys?nonnull (key->subkeys->keyid):"?", + key->subkeys?nonnull (key->subkeys->fpr):"?"); + + if (keyidx < DIM (keyarray)-1) + keyarray[keyidx++] = key; + else + { + fprintf (stderr, PGM": too many keys" + "- skipping this key\n"); + gpgme_key_unref (key); + } + } + if (gpgme_err_code (err) != GPG_ERR_EOF) + fail_if_err (err); + err = gpgme_op_keylist_end (ctx); + fail_if_err (err); + keyarray[keyidx] = NULL; + + result = gpgme_op_keylist_result (ctx); + if (result->truncated) + { + fprintf (stderr, PGM ": key listing unexpectedly truncated\n"); + exit (1); + } + + /* Now for the actual export. */ + if ((mode & GPGME_KEYLIST_MODE_EXTERN)) + printf ("sending keys to keyserver\n"); + + err = gpgme_data_new (&out); + fail_if_err (err); + + gpgme_set_armor (ctx, 1); + err = gpgme_op_export_keys (ctx, keyarray, mode, + (mode & GPGME_KEYLIST_MODE_EXTERN)? NULL:out); + fail_if_err (err); + + fflush (NULL); + if (!(mode & GPGME_KEYLIST_MODE_EXTERN)) + { + fputs ("Begin Result:\n", stdout); + print_data (out); + fputs ("End Result.\n", stdout); + } + + /* Cleanup. */ + gpgme_data_release (out); + + for (keyidx=0; keyarray[keyidx]; keyidx++) + gpgme_key_unref (keyarray[keyidx]); + + gpgme_release (ctx); + return 0; +} diff --git a/tests/run-import.c b/tests/run-import.c new file mode 100644 index 0000000..cd101b0 --- /dev/null +++ b/tests/run-import.c @@ -0,0 +1,129 @@ +/* pgp-import.c - Helper to run an import command + Copyright (C) 2008, 2009 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#define PGM "run-import" + +#include "run-support.h" + + +static int verbose; + + +static int +show_usage (int ex) +{ + fputs ("usage: " PGM " [options] FILENAMEs\n\n" + "Options:\n" + " --verbose run in verbose mode\n" + " --url import from given URLs\n" + " -0 URLs are delimited by a nul\n" + , stderr); + exit (ex); +} + +int +main (int argc, char **argv) +{ + int last_argc = -1; + gpgme_error_t err; + gpgme_ctx_t ctx; + int url_mode = 0; + int nul_mode = 0; + gpgme_import_result_t impres; + gpgme_data_t data; + + if (argc) + { argc--; argv++; } + while (argc && last_argc != argc ) + { + last_argc = argc; + if (!strcmp (*argv, "--")) + { + argc--; argv++; + break; + } + else if (!strcmp (*argv, "--help")) + show_usage (0); + else if (!strcmp (*argv, "--verbose")) + { + verbose = 1; + argc--; argv++; + } + else if (!strcmp (*argv, "--url")) + { + url_mode = 1; + argc--; argv++; + } + else if (!strcmp (*argv, "-0")) + { + nul_mode = 1; + argc--; argv++; + } + else if (!strncmp (*argv, "--", 2)) + show_usage (1); + + } + + if (!argc) + show_usage (1); + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_protocol (ctx, GPGME_PROTOCOL_OpenPGP); + + for (; argc; argc--, argv++) + { + printf ("reading file `%s'\n", *argv); + err = gpgme_data_new_from_file (&data, *argv, 1); + fail_if_err (err); + + if (url_mode) + gpgme_data_set_encoding (data, (nul_mode? GPGME_DATA_ENCODING_URL0 + : GPGME_DATA_ENCODING_URL)); + + err = gpgme_op_import (ctx, data); + fail_if_err (err); + impres = gpgme_op_import_result (ctx); + if (!impres) + { + fprintf (stderr, PGM ": no import result returned\n"); + exit (1); + } + print_import_result (impres); + + gpgme_data_release (data); + } + + gpgme_release (ctx); + return 0; +} diff --git a/tests/run-keylist.c b/tests/run-keylist.c new file mode 100644 index 0000000..0f2154a --- /dev/null +++ b/tests/run-keylist.c @@ -0,0 +1,237 @@ +/* run-keylist.c - Helper to show a key listing. + Copyright (C) 2008, 2009 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#define PGM "run-keylist" + +#include "run-support.h" + + +static int verbose; + + +static int +show_usage (int ex) +{ + fputs ("usage: " PGM " [options] [USERID]\n\n" + "Options:\n" + " --verbose run in verbose mode\n" + " --openpgp use the OpenPGP protocol (default)\n" + " --cms use the CMS protocol\n" + " --local use GPGME_KEYLIST_MODE_LOCAL\n" + " --extern use GPGME_KEYLIST_MODE_EXTERN\n" + " --sigs use GPGME_KEYLIST_MODE_SIGS\n" + " --sig-notations use GPGME_KEYLIST_MODE_SIG_NOTATIONS\n" + " --ephemeral use GPGME_KEYLIST_MODE_EPHEMERAL\n" + " --validate use GPGME_KEYLIST_MODE_VALIDATE\n" + " --import import all keys\n" + , stderr); + exit (ex); +} + + +int +main (int argc, char **argv) +{ + int last_argc = -1; + gpgme_error_t err; + gpgme_ctx_t ctx; + gpgme_keylist_mode_t mode = 0; + gpgme_key_t key; + gpgme_keylist_result_t result; + int import = 0; + gpgme_key_t keyarray[100]; + int keyidx = 0; + gpgme_protocol_t protocol = GPGME_PROTOCOL_OpenPGP; + + if (argc) + { argc--; argv++; } + + while (argc && last_argc != argc ) + { + last_argc = argc; + if (!strcmp (*argv, "--")) + { + argc--; argv++; + break; + } + else if (!strcmp (*argv, "--help")) + show_usage (0); + else if (!strcmp (*argv, "--verbose")) + { + verbose = 1; + argc--; argv++; + } + else if (!strcmp (*argv, "--openpgp")) + { + protocol = GPGME_PROTOCOL_OpenPGP; + argc--; argv++; + } + else if (!strcmp (*argv, "--cms")) + { + protocol = GPGME_PROTOCOL_CMS; + argc--; argv++; + } + else if (!strcmp (*argv, "--local")) + { + mode |= GPGME_KEYLIST_MODE_LOCAL; + argc--; argv++; + } + else if (!strcmp (*argv, "--extern")) + { + mode |= GPGME_KEYLIST_MODE_EXTERN; + argc--; argv++; + } + else if (!strcmp (*argv, "--sigs")) + { + mode |= GPGME_KEYLIST_MODE_SIGS; + argc--; argv++; + } + else if (!strcmp (*argv, "--sig-notations")) + { + mode |= GPGME_KEYLIST_MODE_SIG_NOTATIONS; + argc--; argv++; + } + else if (!strcmp (*argv, "--ephemeral")) + { + mode |= GPGME_KEYLIST_MODE_EPHEMERAL; + argc--; argv++; + } + else if (!strcmp (*argv, "--validate")) + { + mode |= GPGME_KEYLIST_MODE_VALIDATE; + argc--; argv++; + } + else if (!strcmp (*argv, "--import")) + { + import = 1; + argc--; argv++; + } + else if (!strncmp (*argv, "--", 2)) + show_usage (1); + + } + + if (argc > 1) + show_usage (1); + + init_gpgme (protocol); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_protocol (ctx, protocol); + + gpgme_set_keylist_mode (ctx, mode); + + err = gpgme_op_keylist_start (ctx, argc? argv[0]:NULL, 0); + fail_if_err (err); + + while (!(err = gpgme_op_keylist_next (ctx, &key))) + { + gpgme_user_id_t uid; + int nuids; + + + printf ("keyid : %s\n", key->subkeys?nonnull (key->subkeys->keyid):"?"); + printf ("fpr : %s\n", key->subkeys?nonnull (key->subkeys->fpr):"?"); + printf ("caps : %s%s%s%s\n", + key->can_encrypt? "e":"", + key->can_sign? "s":"", + key->can_certify? "c":"", + key->can_authenticate? "a":""); + printf ("flags :%s%s%s%s%s%s\n", + key->secret? " secret":"", + key->revoked? " revoked":"", + key->expired? " expired":"", + key->disabled? " disabled":"", + key->invalid? " invalid":"", + key->is_qualified? " qualifid":""); + for (nuids=0, uid=key->uids; uid; uid = uid->next, nuids++) + { + printf ("userid %d: %s\n", nuids, nonnull(uid->uid)); + printf ("valid %d: %s\n", nuids, + uid->validity == GPGME_VALIDITY_UNKNOWN? "unknown": + uid->validity == GPGME_VALIDITY_UNDEFINED? "undefined": + uid->validity == GPGME_VALIDITY_NEVER? "never": + uid->validity == GPGME_VALIDITY_MARGINAL? "marginal": + uid->validity == GPGME_VALIDITY_FULL? "full": + uid->validity == GPGME_VALIDITY_ULTIMATE? "ultimate": "[?]"); + } + + putchar ('\n'); + + if (import) + { + if (keyidx < DIM (keyarray)-1) + keyarray[keyidx++] = key; + else + { + fprintf (stderr, PGM": too many keys in import mode" + "- skipping this key\n"); + gpgme_key_unref (key); + } + } + else + gpgme_key_unref (key); + } + if (gpgme_err_code (err) != GPG_ERR_EOF) + fail_if_err (err); + err = gpgme_op_keylist_end (ctx); + fail_if_err (err); + keyarray[keyidx] = NULL; + + result = gpgme_op_keylist_result (ctx); + if (result->truncated) + { + fprintf (stderr, PGM ": key listing unexpectedly truncated\n"); + exit (1); + } + + if (import) + { + gpgme_import_result_t impres; + + err = gpgme_op_import_keys (ctx, keyarray); + fail_if_err (err); + impres = gpgme_op_import_result (ctx); + if (!impres) + { + fprintf (stderr, PGM ": no import result returned\n"); + exit (1); + } + print_import_result (impres); + } + + for (keyidx=0; keyarray[keyidx]; keyidx++) + gpgme_key_unref (keyarray[keyidx]); + + gpgme_release (ctx); + return 0; +} diff --git a/tests/run-sign.c b/tests/run-sign.c new file mode 100644 index 0000000..b16b9ef --- /dev/null +++ b/tests/run-sign.c @@ -0,0 +1,197 @@ +/* run-sign.c - Helper to perform a sign operation + Copyright (C) 2009 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#define PGM "run-sign" + +#include "run-support.h" + + +static int verbose; + + +static void +print_result (gpgme_sign_result_t result, gpgme_sig_mode_t type) +{ + gpgme_invalid_key_t invkey; + gpgme_new_signature_t sig; + + for (invkey = result->invalid_signers; invkey; invkey = invkey->next) + printf ("Signing key `%s' not used: %s <%s>\n", + nonnull (invkey->fpr), + gpg_strerror (invkey->reason), gpg_strsource (invkey->reason)); + + for (sig = result->signatures; sig; sig = sig->next) + { + printf ("Key fingerprint: %s\n", nonnull (sig->fpr)); + printf ("Signature type : %d\n", sig->type); + printf ("Public key algo: %d\n", sig->pubkey_algo); + printf ("Hash algo .....: %d\n", sig->hash_algo); + printf ("Creation time .: %ld\n", sig->timestamp); + printf ("Sig class .....: 0x%u\n", sig->sig_class); + } +} + + + +static int +show_usage (int ex) +{ + fputs ("usage: " PGM " [options] FILE\n\n" + "Options:\n" + " --verbose run in verbose mode\n" + " --openpgp use the OpenPGP protocol (default)\n" + " --cms use the CMS protocol\n" + " --uiserver use the UI server\n" + " --key NAME use key NAME for signing\n" + , stderr); + exit (ex); +} + + +int +main (int argc, char **argv) +{ + int last_argc = -1; + gpgme_error_t err; + gpgme_ctx_t ctx; + const char *key_string = NULL; + gpgme_protocol_t protocol = GPGME_PROTOCOL_OpenPGP; + gpgme_sig_mode_t sigmode = GPGME_SIG_MODE_NORMAL; + gpgme_data_t in, out; + gpgme_sign_result_t result; + + if (argc) + { argc--; argv++; } + + while (argc && last_argc != argc ) + { + last_argc = argc; + if (!strcmp (*argv, "--")) + { + argc--; argv++; + break; + } + else if (!strcmp (*argv, "--help")) + show_usage (0); + else if (!strcmp (*argv, "--verbose")) + { + verbose = 1; + argc--; argv++; + } + else if (!strcmp (*argv, "--openpgp")) + { + protocol = GPGME_PROTOCOL_OpenPGP; + argc--; argv++; + } + else if (!strcmp (*argv, "--cms")) + { + protocol = GPGME_PROTOCOL_CMS; + argc--; argv++; + } + else if (!strcmp (*argv, "--uiserver")) + { + protocol = GPGME_PROTOCOL_UISERVER; + argc--; argv++; + } + else if (!strcmp (*argv, "--key")) + { + argc--; argv++; + if (!argc) + show_usage (1); + key_string = *argv; + argc--; argv++; + } + else if (!strncmp (*argv, "--", 2)) + show_usage (1); + + } + + if (argc != 1) + show_usage (1); + + if (key_string && protocol == GPGME_PROTOCOL_UISERVER) + { + fprintf (stderr, PGM ": ignoring --key in UI-server mode\n"); + key_string = NULL; + } + + init_gpgme (protocol); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_protocol (ctx, protocol); + gpgme_set_armor (ctx, 1); + + if (key_string) + { + gpgme_key_t akey; + + err = gpgme_get_key (ctx, key_string, &akey, 1); + if (err) + { + exit (1); + } + err = gpgme_signers_add (ctx, akey); + fail_if_err (err); + gpgme_key_unref (akey); + } + + err = gpgme_data_new_from_file (&in, *argv, 1); + if (err) + { + fprintf (stderr, PGM ": error reading `%s': %s\n", + *argv, gpg_strerror (err)); + exit (1); + } + + err = gpgme_data_new (&out); + fail_if_err (err); + + err = gpgme_op_sign (ctx, in, out, sigmode); + result = gpgme_op_sign_result (ctx); + if (result) + print_result (result, sigmode); + if (err) + { + fprintf (stderr, PGM ": signing failed: %s\n", gpg_strerror (err)); + exit (1); + } + + fputs ("Begin Output:\n", stdout); + print_data (out); + fputs ("End Output.\n", stdout); + gpgme_data_release (out); + + gpgme_data_release (in); + + gpgme_release (ctx); + return 0; +} diff --git a/tests/run-support.h b/tests/run-support.h new file mode 100644 index 0000000..db7b7d5 --- /dev/null +++ b/tests/run-support.h @@ -0,0 +1,188 @@ +/* run-support.h - Helper routines for run-* test programs. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003, 2004, 2009 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#include <unistd.h> +#include <errno.h> +#include <stdlib.h> +#include <locale.h> + +#ifdef HAVE_W32_SYSTEM +#include <windows.h> +#endif + +#include <gpgme.h> + +#ifndef DIM +#define DIM(v) (sizeof(v)/sizeof((v)[0])) +#endif + +#define fail_if_err(err) \ + do \ + { \ + if (err) \ + { \ + fprintf (stderr, PGM": file %s line %d: <%s> %s\n", \ + __FILE__, __LINE__, gpgme_strsource (err), \ + gpgme_strerror (err)); \ + exit (1); \ + } \ + } \ + while (0) + + +static const char * +nonnull (const char *s) +{ + return s? s :"[none]"; +} + + +void +print_data (gpgme_data_t dh) +{ +#define BUF_SIZE 512 + char buf[BUF_SIZE + 1]; + int ret; + + ret = gpgme_data_seek (dh, 0, SEEK_SET); + if (ret) + fail_if_err (gpgme_err_code_from_errno (errno)); + while ((ret = gpgme_data_read (dh, buf, BUF_SIZE)) > 0) + fwrite (buf, ret, 1, stdout); + if (ret < 0) + fail_if_err (gpgme_err_code_from_errno (errno)); +} + + +gpgme_error_t +passphrase_cb (void *opaque, const char *uid_hint, const char *passphrase_info, + int last_was_bad, int fd) +{ +#ifdef HAVE_W32_SYSTEM + DWORD written; + WriteFile ((HANDLE) fd, "abc\n", 4, &written, 0); +#else + int res; + char *pass = "abc\n"; + int passlen = strlen (pass); + int off = 0; + + do + { + res = write (fd, &pass[off], passlen - off); + if (res > 0) + off += res; + } + while (res > 0 && off != passlen); + + return off == passlen ? 0 : gpgme_error_from_errno (errno); +#endif + + return 0; +} + + +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) + exit (8); + strcpy (buf, srcdir); + strcat (buf, "/"); + strcat (buf, fname); + return buf; +} + + +void +init_gpgme (gpgme_protocol_t proto) +{ + gpgme_error_t err; + + gpgme_check_version (NULL); + setlocale (LC_ALL, ""); + gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL)); +#ifndef HAVE_W32_SYSTEM + gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL)); +#endif + + err = gpgme_engine_check_version (proto); + fail_if_err (err); +} + + +void +print_import_result (gpgme_import_result_t r) +{ + gpgme_import_status_t st; + + for (st=r->imports; st; st = st->next) + { + printf (" fpr: %s err: %d (%s) status:", nonnull (st->fpr), + st->result, gpgme_strerror (st->result)); + if (st->status & GPGME_IMPORT_NEW) + fputs (" new", stdout); + if (st->status & GPGME_IMPORT_UID) + fputs (" uid", stdout); + if (st->status & GPGME_IMPORT_SIG) + fputs (" sig", stdout); + if (st->status & GPGME_IMPORT_SUBKEY) + fputs (" subkey", stdout); + if (st->status & GPGME_IMPORT_SECRET) + fputs (" secret", stdout); + putchar ('\n'); + } + printf ("key import summary:\n" + " considered: %d\n" + " no user id: %d\n" + " imported: %d\n" + " imported_rsa: %d\n" + " unchanged: %d\n" + " new user ids: %d\n" + " new subkeys: %d\n" + " new signatures: %d\n" + " new revocations: %d\n" + " secret read: %d\n" + " secret imported: %d\n" + " secret unchanged: %d\n" + " skipped new keys: %d\n" + " not imported: %d\n", + r->considered, + r->no_user_id, + r->imported, + r->imported_rsa, + r->unchanged, + r->new_user_ids, + r->new_sub_keys, + r->new_signatures, + r->new_revocations, + r->secret_read, + r->secret_imported, + r->secret_unchanged, + r->skipped_new_keys, + r->not_imported); +} + diff --git a/tests/run-verify.c b/tests/run-verify.c new file mode 100644 index 0000000..4837d9c --- /dev/null +++ b/tests/run-verify.c @@ -0,0 +1,244 @@ +/* run-verify.c - Helper to perform a verify operation + Copyright (C) 2009 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + +#define PGM "run-verify" + +#include "run-support.h" + + +static int verbose; + +static void +print_summary (gpgme_sigsum_t summary) +{ + if ( (summary & GPGME_SIGSUM_VALID )) + fputs (" valid", stdout); + if ( (summary & GPGME_SIGSUM_GREEN )) + fputs (" green", stdout); + if ( (summary & GPGME_SIGSUM_RED )) + fputs (" red", stdout); + if ( (summary & GPGME_SIGSUM_KEY_REVOKED)) + fputs (" revoked", stdout); + if ( (summary & GPGME_SIGSUM_KEY_EXPIRED)) + fputs (" key-expired", stdout); + if ( (summary & GPGME_SIGSUM_SIG_EXPIRED)) + fputs (" sig-expired", stdout); + if ( (summary & GPGME_SIGSUM_KEY_MISSING)) + fputs (" key-missing", stdout); + if ( (summary & GPGME_SIGSUM_CRL_MISSING)) + fputs (" crl-missing", stdout); + if ( (summary & GPGME_SIGSUM_CRL_TOO_OLD)) + fputs (" crl-too-old", stdout); + if ( (summary & GPGME_SIGSUM_BAD_POLICY )) + fputs (" bad-policy", stdout); + if ( (summary & GPGME_SIGSUM_SYS_ERROR )) + fputs (" sys-error", stdout); +} + +static void +print_validity (gpgme_validity_t val) +{ + const char *s = NULL; + + switch (val) + { + case GPGME_VALIDITY_UNKNOWN: s = "unknown"; break; + case GPGME_VALIDITY_UNDEFINED:s = "undefined"; break; + case GPGME_VALIDITY_NEVER: s = "never"; break; + case GPGME_VALIDITY_MARGINAL: s = "marginal"; break; + case GPGME_VALIDITY_FULL: s = "full"; break; + case GPGME_VALIDITY_ULTIMATE: s = "ultimate"; break; + } + if (s) + fputs (s, stdout); + else + printf ("[bad validity value %u]", (unsigned int)val); +} + + +static void +print_result (gpgme_verify_result_t result) +{ + gpgme_signature_t sig; + int count = 0; + + printf ("Original file name: %s\n", nonnull(result->file_name)); + for (sig = result->signatures; sig; sig = sig->next) + { + printf ("Signature %d\n", count++); + printf (" status ....: %s\n", gpgme_strerror (sig->status)); + printf (" summary ...:"); print_summary (sig->summary); putchar ('\n'); + printf (" fingerprint: %s\n", nonnull (sig->fpr)); + printf (" created ...: %lu\n", sig->timestamp); + printf (" expires ...: %lu\n", sig->exp_timestamp); + printf (" validity ..: "); + print_validity (sig->validity); putchar ('\n'); + printf (" val.reason : %s\n", gpgme_strerror (sig->status)); + printf (" pubkey algo: %d\n", sig->pubkey_algo); + printf (" digest algo: %d\n", sig->hash_algo); + printf (" pka address: %s\n", nonnull (sig->pka_address)); + printf (" pka trust .: %s\n", + sig->pka_trust == 0? "n/a" : + sig->pka_trust == 1? "bad" : + sig->pka_trust == 2? "okay": "RFU"); + printf (" other flags:%s%s\n", + sig->wrong_key_usage? " wrong-key-usage":"", + sig->chain_model? " chain-model":"" + ); + printf (" notations .: %s\n", + sig->notations? "yes":"no"); + } +} + + + +static int +show_usage (int ex) +{ + fputs ("usage: " PGM " [options] [DETACHEDSIGFILE] FILE\n\n" + "Options:\n" + " --verbose run in verbose mode\n" + " --openpgp use the OpenPGP protocol (default)\n" + " --cms use the CMS protocol\n" + , stderr); + exit (ex); +} + + +int +main (int argc, char **argv) +{ + int last_argc = -1; + gpgme_error_t err; + gpgme_ctx_t ctx; + gpgme_protocol_t protocol = GPGME_PROTOCOL_OpenPGP; + FILE *fp_sig = NULL; + gpgme_data_t sig = NULL; + FILE *fp_msg = NULL; + gpgme_data_t msg = NULL; + gpgme_verify_result_t result; + + if (argc) + { argc--; argv++; } + + while (argc && last_argc != argc ) + { + last_argc = argc; + if (!strcmp (*argv, "--")) + { + argc--; argv++; + break; + } + else if (!strcmp (*argv, "--help")) + show_usage (0); + else if (!strcmp (*argv, "--verbose")) + { + verbose = 1; + argc--; argv++; + } + else if (!strcmp (*argv, "--openpgp")) + { + protocol = GPGME_PROTOCOL_OpenPGP; + argc--; argv++; + } + else if (!strcmp (*argv, "--cms")) + { + protocol = GPGME_PROTOCOL_CMS; + argc--; argv++; + } + else if (!strncmp (*argv, "--", 2)) + show_usage (1); + + } + + if (argc < 1 || argc > 2) + show_usage (1); + + fp_sig = fopen (argv[0], "rb"); + if (!fp_sig) + { + err = gpgme_error_from_syserror (); + fprintf (stderr, PGM ": can't open `%s': %s\n", + argv[0], gpgme_strerror (err)); + exit (1); + } + if (argc > 1) + { + fp_msg = fopen (argv[1], "rb"); + if (!fp_msg) + { + err = gpgme_error_from_syserror (); + fprintf (stderr, PGM ": can't open `%s': %s\n", + argv[1], gpgme_strerror (err)); + exit (1); + } + } + + init_gpgme (protocol); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_protocol (ctx, protocol); + + err = gpgme_data_new_from_stream (&sig, fp_sig); + if (err) + { + fprintf (stderr, PGM ": error allocating data object: %s\n", + gpgme_strerror (err)); + exit (1); + } + if (fp_msg) + { + err = gpgme_data_new_from_stream (&msg, fp_msg); + if (err) + { + fprintf (stderr, PGM ": error allocating data object: %s\n", + gpgme_strerror (err)); + exit (1); + } + } + + err = gpgme_op_verify (ctx, sig, msg, NULL); + result = gpgme_op_verify_result (ctx); + if (result) + print_result (result); + if (err) + { + fprintf (stderr, PGM ": signing failed: %s\n", gpgme_strerror (err)); + exit (1); + } + + gpgme_data_release (msg); + gpgme_data_release (sig); + + gpgme_release (ctx); + return 0; +} diff --git a/tests/t-data-1.txt b/tests/t-data-1.txt new file mode 100644 index 0000000..16a15f2 --- /dev/null +++ b/tests/t-data-1.txt @@ -0,0 +1 @@ +Just GNU it! diff --git a/tests/t-data-2.txt b/tests/t-data-2.txt new file mode 100644 index 0000000..9ae851c --- /dev/null +++ b/tests/t-data-2.txt @@ -0,0 +1,3 @@ +Just GNU it! +Just GNU it! +Just GNU it! diff --git a/tests/t-data.c b/tests/t-data.c new file mode 100644 index 0000000..a319484 --- /dev/null +++ b/tests/t-data.c @@ -0,0 +1,285 @@ +/* t-data - Regression tests for the gpgme_data_t abstraction. + Copyright (C) 2001, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +#include <gpgme.h> + +#define fail_if_err(a) do { if(a) { \ + fprintf (stderr, "%s:%d: (%i) gpgme_error_t " \ + "%s\n", __FILE__, __LINE__, round, \ + gpgme_strerror(a)); \ + 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; +} + +typedef enum + { + TEST_INITIALIZER, + TEST_INVALID_ARGUMENT, + TEST_INOUT_NONE, + TEST_INOUT_MEM_NO_COPY, + TEST_INOUT_MEM_COPY, + TEST_INOUT_MEM_FROM_FILE_COPY, + TEST_INOUT_MEM_FROM_INEXISTANT_FILE, + TEST_INOUT_MEM_FROM_FILE_NO_COPY, + TEST_INOUT_MEM_FROM_FILE_PART_BY_NAME, + TEST_INOUT_MEM_FROM_INEXISTANT_FILE_PART, + TEST_INOUT_MEM_FROM_FILE_PART_BY_FP, + TEST_END + } round_t; + +const char *text = "Just GNU it!\n"; +const char *text2 = "Just GNU it!\nJust GNU it!\n"; + +int +read_cb (void *cb_value, char *buffer, size_t count, size_t *nread) +{ + static int off = 0; + unsigned int amount = strlen (text) - off; + /* round_t round = *((round_t *) cb_value); */ + + if (!buffer && !count && !nread) + { + /* Rewind requested. */ + off = 0; + return 0; + } + if (! buffer || !nread) + return -1; + if (amount <= 0) + { + /* End of file. */ + *nread = 0; + return -1; + } + if (amount > count) + amount = count; + memcpy (buffer, text, amount); + off += amount; + *nread = amount; + return 0; +} + +void +read_once_test (round_t round, gpgme_data_t data) +{ + char buffer[1024]; + size_t read; + + read = gpgme_data_read (data, buffer, sizeof (buffer)); + + if (read != strlen (text) || strncmp (buffer, text, strlen (text))) + { + fprintf (stderr, "%s:%d: (%i) gpgme_data_read returned wrong data\n", + __FILE__, __LINE__, round); + exit (1); + } + + read = gpgme_data_read (data, buffer, sizeof (buffer)); + if (read) + { + fprintf (stderr, "%s:%d: (%i) gpgme_data_read did not signal EOF\n", + __FILE__, __LINE__, round); + exit (1); + } +} + +void +read_test (round_t round, gpgme_data_t data) +{ + char buffer[1024]; + size_t read; + + if (round == TEST_INOUT_NONE) + { + read = gpgme_data_read (data, buffer, sizeof (buffer)); + if (read > 0) + { + fprintf (stderr, "%s:%d: (%i) gpgme_data_read succeded unexpectedly\n", + __FILE__, __LINE__, round); + exit (1); + } + return; + } + + read_once_test (round, data); + gpgme_data_seek (data, 0, SEEK_SET); + read_once_test (round, data); +} + +void +write_test (round_t round, gpgme_data_t data) +{ + char buffer[1024]; + size_t amt; + + amt = gpgme_data_write (data, text, strlen (text)); + if (amt != strlen (text)) + fail_if_err (gpgme_error_from_errno (errno)); + + gpgme_data_seek (data, 0, SEEK_SET); + + if (round == TEST_INOUT_NONE) + read_once_test (round, data); + else + { + amt = gpgme_data_read (data, buffer, sizeof (buffer)); + + if (amt != strlen (text2) || strncmp (buffer, text2, strlen (text2))) + { + fprintf (stderr, "%s:%d: (%i) gpgme_data_read returned wrong data\n", + __FILE__, __LINE__, round); + exit (1); + } + + amt = gpgme_data_read (data, buffer, sizeof (buffer)); + if (amt) + { + fprintf (stderr, "%s:%d: (%i) gpgme_data_read did not signal EOF\n", + __FILE__, __LINE__, round); + exit (1); + } + } +} + +int +main (int argc, char **argv) +{ + round_t round = TEST_INITIALIZER; + const char *text_filename = make_filename ("t-data-1.txt"); + const char *longer_text_filename = make_filename ("t-data-2.txt"); + const char *missing_filename = "this-file-surely-does-not-exist"; + gpgme_error_t err = 0; + gpgme_data_t data; + + while (++round) + { + switch (round) + { + case TEST_INVALID_ARGUMENT: + err = gpgme_data_new (NULL); + if (!err) + { + fprintf (stderr, "%s:%d: gpgme_data_new on NULL pointer succeeded " + "unexpectedly\n", __FILE__, __LINE__); + exit (1); + } + continue; + case TEST_INOUT_NONE: + err = gpgme_data_new (&data); + break; + case TEST_INOUT_MEM_NO_COPY: + err = gpgme_data_new_from_mem (&data, text, strlen (text), 0); + break; + case TEST_INOUT_MEM_COPY: + err = gpgme_data_new_from_mem (&data, text, strlen (text), 1); + break; + case TEST_INOUT_MEM_FROM_FILE_COPY: + err = gpgme_data_new_from_file (&data, text_filename, 1); + break; + case TEST_INOUT_MEM_FROM_INEXISTANT_FILE: + err = gpgme_data_new_from_file (&data, missing_filename, 1); + if (!err) + { + fprintf (stderr, "%s:%d: gpgme_data_new_from_file on inexistant " + "file succeeded unexpectedly\n", __FILE__, __LINE__); + exit (1); + } + continue; + case TEST_INOUT_MEM_FROM_FILE_NO_COPY: + err = gpgme_data_new_from_file (&data, text_filename, 0); + /* This is not implemented yet. */ + if (gpgme_err_code (err) == GPG_ERR_NOT_IMPLEMENTED + || gpgme_err_code (err) == GPG_ERR_INV_VALUE) + continue; + break; + case TEST_INOUT_MEM_FROM_FILE_PART_BY_NAME: + err = gpgme_data_new_from_filepart (&data, longer_text_filename, 0, + strlen (text), strlen (text)); + break; + case TEST_INOUT_MEM_FROM_INEXISTANT_FILE_PART: + err = gpgme_data_new_from_filepart (&data, missing_filename, 0, + strlen (text), strlen (text)); + if (!err) + { + fprintf (stderr, "%s:%d: gpgme_data_new_from_file on inexistant " + "file succeeded unexpectedly\n", __FILE__, __LINE__); + exit (1); + } + continue; + case TEST_INOUT_MEM_FROM_FILE_PART_BY_FP: + { + FILE *fp = fopen (longer_text_filename, "rb"); + if (! fp) + { + fprintf (stderr, "%s:%d: fopen: %s\n", __FILE__, __LINE__, + strerror (errno)); + exit (1); + } + err = gpgme_data_new_from_filepart (&data, 0, fp, + strlen (text), strlen (text)); + } + break; + case TEST_END: + return 0; + case TEST_INITIALIZER: + /* Shouldn't happen. */ + fprintf (stderr, "%s:%d: impossible condition\n", __FILE__, __LINE__); + exit (1); + } + fail_if_err (err); + + read_test (round, data); + write_test (round, data); + gpgme_data_release (data); + } + return 0; +} diff --git a/tests/t-engine-info.c b/tests/t-engine-info.c new file mode 100644 index 0000000..3864fe5 --- /dev/null +++ b/tests/t-engine-info.c @@ -0,0 +1,93 @@ +/* t-engine-info.c - Regression test for gpgme_get_engine_info. + Copyright (C) 2003, 2004, 2007 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gpgme.h> + + +#define fail_if_err(err) \ + do \ + { \ + if (err) \ + { \ + fprintf (stderr, "%s:%d: gpgme_error_t %s\n", \ + __FILE__, __LINE__, gpgme_strerror (err)); \ + exit (1); \ + } \ + } \ + while (0) + + +void +check_engine_info (gpgme_engine_info_t info, gpgme_protocol_t protocol, + const char *file_name, const char *req_version) +{ + if (info->protocol != protocol) + { + fprintf (stderr, "Unexpected protocol %i (expected %i instead)\n", + info->protocol, protocol); + exit (1); + } + if (strcmp (info->file_name, file_name)) + { + fprintf (stderr, "Unexpected file name to executable %s (expected %s instead)\n", + info->file_name, file_name); + exit (1); + } + if (strcmp (info->req_version, req_version)) + { + fprintf (stderr, "Unexpected required version %s (expected %s instead)\n", + info->req_version, req_version); + exit (1); + } +} + + +int +main (int argc, char **argv ) +{ + gpgme_engine_info_t info; + gpgme_error_t err; + + err = gpgme_get_engine_info (&info); + fail_if_err (err); + + check_engine_info (info, GPGME_PROTOCOL_OpenPGP, GPG_PATH, NEED_GPG_VERSION); + + info = info->next; +#ifdef GPGSM_PATH + check_engine_info (info, GPGME_PROTOCOL_CMS, GPGSM_PATH, NEED_GPGSM_VERSION); +#else + if (info) + { + fprintf (stderr, "Unexpected engine info.\n"); + exit (1); + } +#endif + + return 0; +} diff --git a/tests/t-version.c b/tests/t-version.c new file mode 100644 index 0000000..06bff60 --- /dev/null +++ b/tests/t-version.c @@ -0,0 +1,45 @@ +/* t-version.c - Regression test. + Copyright (C) 2001, 2004 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 Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <string.h> + +#include <gpgme.h> + +int +main (int argc, char **argv) +{ + const char *null_result; + const char *current_result; + const char *future_result; + + null_result = gpgme_check_version (NULL); + current_result = gpgme_check_version (VERSION); + future_result = gpgme_check_version (VERSION ".1"); + + return !(null_result + && ! strcmp (null_result, VERSION) + && current_result + && ! strcmp (current_result, VERSION) + && ! future_result); +} |