1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-05-31 22:18:03 +02:00
Commit Graph

62 Commits

Author SHA1 Message Date
Justus Winter
26df829fa2 tests: Write a log file for each test.
* tests/openpgp/Makefile.am (CLEANFILES): Delete logs.
* tests/openpgp/run-tests.scm (test::run-sync): Write logs.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-11-07 17:44:34 +01:00
Justus Winter
a55393cb5f tests: Move environment creation and teardown into each test.
* tests/gpgscm/tests.scm (log): New function.
* tests/openpgp/run-tests.scm (run-tests-parallel): Do not run the
startup and teardown scripts.
(run-tests-sequential): Likewise.
* tests/openpgp/setup.scm: Move all functions...
* tests/openpgp/defs.scm: ... here and make them less verbose.
(setup-environment): New function.
(setup-legacy-environment): Likewise.
(start-agent): Make less verbose, run 'stop-agent' at interpreter
exit.
(stop-agent): Make less verbose.
* tests/openpgp/finish.scm: Drop file.
* tests/openpgp/Makefile.am (EXTRA_DIST): Drop removed file.
* tests/openpgp/4gb-packet.scm: Use 'setup-environment' or
'setup-legacy-environment' as appropriate.
* tests/openpgp/armdetach.scm: Likewise.
* tests/openpgp/armdetachm.scm: Likewise.
* tests/openpgp/armencrypt.scm: Likewise.
* tests/openpgp/armencryptp.scm: Likewise.
* tests/openpgp/armor.scm: Likewise.
* tests/openpgp/armsignencrypt.scm: Likewise.
* tests/openpgp/armsigs.scm: Likewise.
* tests/openpgp/clearsig.scm: Likewise.
* tests/openpgp/conventional-mdc.scm: Likewise.
* tests/openpgp/conventional.scm: Likewise.
* tests/openpgp/decrypt-dsa.scm: Likewise.
* tests/openpgp/decrypt.scm: Likewise.
* tests/openpgp/default-key.scm: Likewise.
* tests/openpgp/detach.scm: Likewise.
* tests/openpgp/detachm.scm: Likewise.
* tests/openpgp/ecc.scm: Likewise.
* tests/openpgp/encrypt-dsa.scm: Likewise.
* tests/openpgp/encrypt.scm: Likewise.
* tests/openpgp/encryptp.scm: Likewise.
* tests/openpgp/export.scm: Likewise.
* tests/openpgp/finish.scm: Likewise.
* tests/openpgp/genkey1024.scm: Likewise.
* tests/openpgp/gpgtar.scm: Likewise.
* tests/openpgp/gpgv-forged-keyring.scm: Likewise.
* tests/openpgp/import.scm: Likewise.
* tests/openpgp/issue2015.scm: Likewise.
* tests/openpgp/issue2417.scm: Likewise.
* tests/openpgp/issue2419.scm: Likewise.
* tests/openpgp/key-selection.scm: Likewise.
* tests/openpgp/mds.scm: Likewise.
* tests/openpgp/multisig.scm: Likewise.
* tests/openpgp/quick-key-manipulation.scm: Likewise.
* tests/openpgp/seat.scm: Likewise.
* tests/openpgp/shell.scm: Likewise.
* tests/openpgp/signencrypt-dsa.scm: Likewise.
* tests/openpgp/signencrypt.scm: Likewise.
* tests/openpgp/sigs-dsa.scm: Likewise.
* tests/openpgp/sigs.scm: Likewise.
* tests/openpgp/ssh.scm: Likewise.
* tests/openpgp/tofu.scm: Likewise.
* tests/openpgp/use-exact-key.scm: Likewise.
* tests/openpgp/verify.scm: Likewise.
* tests/openpgp/version.scm: Likewise.
* tests/openpgp/issue2346.scm: Likewise and simplify.
--

The previous Bourne Shell-based test suite created the environment
before running all tests, and tore it down after executing them.  When
we created the Scheme-based test suite, we kept this design at first,
but introduced a way to run each test in its own environment to
prevent tests from interfering with each other.  Nevertheless, every
test started out with the same environment.

Move the creation of the test environment into each test.  This gives
us finer control over the environment each test is run in.  It also
makes it possible to run each test by simply executing it using gpgscm
without the use of the runner.  Furthermore, it has the neat
side-effect of speeding up the test suite if run in parallel.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-11-07 16:36:36 +01:00
Justus Winter
37751d2b19 tests: Fix build.
* tests/openpgp/Makefile.am: Drop dependency on 'mk-tdata'.

Fixes: 70215ff470
Signed-off-by: Justus Winter <justus@g10code.com>
2016-11-07 14:10:38 +01:00
Werner Koch
4d7dc432b5
Change all http://www.gnu.org in license notices to https://
--
2016-11-05 12:02:19 +01:00
Justus Winter
ab89164be0 g10: Improve and unify key selection for -r and --locate-keys.
* g10/getkey.c (struct pubkey_cmp_cookie): New type.
(key_is_ok, uid_is_ok, subkey_is_ok): New functions.
(pubkey_cmp): Likewise.
(get_best_pubkey_byname): Likewise.
* g10/keydb.h (get_best_pubkey_byname): New prototype.
* g10/keylist.c (locate_one): Use the new function.
* g10/pkclist.c (find_and_check_key): Likewise.
* tests/openpgp/Makefile.am (XTESTS): Add new test.
(TEST_FILES): Add new files.
* tests/openpgp/key-selection.scm: New file.
* tests/openpgp/key-selection/0.asc: Likewise.
* tests/openpgp/key-selection/1.asc: Likewise.
* tests/openpgp/key-selection/2.asc: Likewise.
* tests/openpgp/key-selection/3.asc: Likewise.
* tests/openpgp/key-selection/4.asc: Likewise.
--

When a name resembling a mail address is given to either --locate-keys
or --recipient, rank the search results and use only the most relevant
key.

This also lets us query which key will be used for encryption using
--locate-keys.  However, note that --locate-keys may also return keys
incapable of encryption, though it will prefer keys that have an
encryption subkey.

GnuPG-bug-id: 2359
Signed-off-by: Justus Winter <justus@g10code.com>
2016-11-03 15:04:18 +01:00
Justus Winter
1ec07cbc20 gpgscm,tests: Add new functions to the test environment.
* tests/gpgscm/lib.scm (first, last, powerset): New functions.
* tests/gpgscm/tests.scm (interactive-shell): New function.
* tests/openpgp/Makefile.am (EXTRA_DIST): Add new file.
* tests/openpgp/README: Document 'interactive-shell'.
* tests/openpgp/shell.scm: New file.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-11-03 14:43:23 +01:00
Neal H. Walfield
0c56ad5a8d tests: Use shorter filenames.
* tests/openpgp/tofu/cross-sigs/
  1938C3A0E4674B6C217AC0B987DB2814EC38277E-1.gpg: Rename from this...
* tests/openpgp/tofu/cross-sigs/EC38277E-1.gpg: .. to this.
* tests/openpgp/tofu/cross-sigs/
  1938C3A0E4674B6C217AC0B987DB2814EC38277E-1.txt: Rename from this...
* tests/openpgp/tofu/cross-sigs/EC38277E-1.txt: .. to this.
* tests/openpgp/tofu/cross-sigs/
  1938C3A0E4674B6C217AC0B987DB2814EC38277E-2.gpg: Rename from this...
* tests/openpgp/tofu/cross-sigs/EC38277E-2.gpg: .. to this.
* tests/openpgp/tofu/cross-sigs/
  1938C3A0E4674B6C217AC0B987DB2814EC38277E-2.txt: Rename from this...
* tests/openpgp/tofu/cross-sigs/EC38277E-2.txt: .. to this.
* tests/openpgp/tofu/cross-sigs/
  1938C3A0E4674B6C217AC0B987DB2814EC38277E-3.txt: Rename from this...
* tests/openpgp/tofu/cross-sigs/EC38277E-3.txt: .. to this.
* tests/openpgp/tofu/cross-sigs/
  1938C3A0E4674B6C217AC0B987DB2814EC38277E-secret.gpg: Rename from
  this...
* tests/openpgp/tofu/cross-sigs/EC38277E-secret.gpg: .. to this.
* tests/openpgp/tofu/cross-sigs/
  DC463A16E42F03240D76E8BA8B48C6BD871C2247-1.gpg: Rename from this...
* tests/openpgp/tofu/cross-sigs/871C2247-1.gpg: .. to this.
* tests/openpgp/tofu/cross-sigs/
  DC463A16E42F03240D76E8BA8B48C6BD871C2247-1.txt: Rename from this...
* tests/openpgp/tofu/cross-sigs/871C2247-1.txt: .. to this.
* tests/openpgp/tofu/cross-sigs/
  DC463A16E42F03240D76E8BA8B48C6BD871C2247-2.gpg: Rename from this...
* tests/openpgp/tofu/cross-sigs/871C2247-2.gpg: .. to this.
* tests/openpgp/tofu/cross-sigs/
  DC463A16E42F03240D76E8BA8B48C6BD871C2247-2.txt: Rename from this...
* tests/openpgp/tofu/cross-sigs/871C2247-2.txt: .. to this.
* tests/openpgp/tofu/cross-sigs/
  DC463A16E42F03240D76E8BA8B48C6BD871C2247-3.gpg: Rename from this...
* tests/openpgp/tofu/cross-sigs/871C2247-3.gpg: .. to this.
* tests/openpgp/tofu/cross-sigs/
  DC463A16E42F03240D76E8BA8B48C6BD871C2247-3.txt: Rename from this...
* tests/openpgp/tofu/cross-sigs/871C2247-3.txt: .. to this.
* tests/openpgp/tofu/cross-sigs/
  DC463A16E42F03240D76E8BA8B48C6BD871C2247-4.gpg: Rename from this...
* tests/openpgp/tofu/cross-sigs/871C2247-4.gpg: .. to this.
* tests/openpgp/tofu/cross-sigs/
  DC463A16E42F03240D76E8BA8B48C6BD871C2247-secret.gpg: Rename from
  this...
* tests/openpgp/tofu/cross-sigs/871C2247-secret.gpg: .. to this.
* tests/openpgp/Makefile.am (TEST_FILES): Update accordingly.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Fixed-commit: d2d936fbe8
2016-10-13 21:45:44 +02:00
Neal H. Walfield
d2d936fbe8 tests: Add test data to TEST_FILES.
* tests/openpgp/Makefile.am (TEST_FILES): Add new test data.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Fixes-commit: 4c0389f8eb
2016-10-13 14:26:53 +02:00
Justus Winter
c644962fcf tests: Drop the old shell-based tests.
--
Signed-off-by: Justus Winter <justus@g10code.com>
2016-09-20 15:55:02 +02:00
Justus Winter
6c4c0e3ac2 tests: Port the quick key manipulation test to Scheme.
* tests/openpgp/Makefile.am (XTESTS): Add new test.
* tests/openpgp/quick-key-manipulation.scm: New file.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-09-20 15:33:57 +02:00
Justus Winter
059c79d8b4 tests: Pass flags to test driver.
* tests/openpgp/Makefile.am (xcheck): Pass flags to 'run-tests.scm'.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-09-05 14:05:19 +02:00
Justus Winter
a27410a251 g10: Fix opening of trust database.
* g10/tdbio.c (tdbio_set_dbname): This function explicitly checks for
the file size, but handled the case of a zero-sized file incorrectly
by returning success.  Fix this by initializing the database in that
case.
* tests/openpgp/Makefile.am (XTESTS): Add new test.
* tests/openpgp/issue2417.scm: New file.

GnuPG-bug-id: 2417
Signed-off-by: Justus Winter <justus@g10code.com>
2016-08-10 16:50:29 +02:00
Justus Winter
194b1e979c tests: Fix distcheck.
* tests/openpgp/Makefile.am (EXTRA_DIST): Explicitly add setup and
teardown scripts now that they no longer are included in the list of
tests.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-08-10 11:59:42 +02:00
Justus Winter
e13f1ea8ff tests: Run each test in a clean environment.
* tests/openpgp/Makefile.am (TESTS_ENVIRONMENT): Drop obsolete
variables, add 'srcdir', use absolute paths.
(TESTS): Rename to 'XTESTS' to avoid emitting the automake test
runner.  Drop 'setup.scm' and 'finish.scm'.
(xcheck): New target that runs 'run-tests.scm', our Scheme test suite
runner.  It will run each test in a clean environment, isolated from
the other tests.
(EXTRA_DIST): Adapt accordingly.
* tests/openpgp/README: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-08-10 09:42:00 +02:00
NIIBE Yutaka
7dcad0d350 tests: Add openpgp/gpgv-forged-keyring.scm.
* tests/openpgp/gpgv-forged-keyring.scm: New.
* tests/openpgp/forged-keyring.gpg: New.
* tests/openpgp/Makefile.am (TESTS): Add gpgv-forged-keyring.scm.
* tests/openpgp/defs.scm (tools): Add GPGV.
(GPGV): New.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2016-08-08 13:24:02 +09:00
Justus Winter
c971ff0823 tests: Distribute standalone test runner.
* tests/openpgp/Makefile.am (EXTRA_DIST): Add missing file
'run-tests.scm'.

GnuPG-bug-id: 2431
Signed-off-by: Justus Winter <justus@g10code.com>
2016-08-01 11:08:43 +02:00
Justus Winter
9e799b0e4f tests: Fix distcheck.
* tests/openpgp/Makefile.am (sample_msgs): New variable.
(EXTRA_DIST): Also ship the sample msgs.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-28 18:11:50 +02:00
Justus Winter
b2572b0c38 common: Fix iobuf_peek corner case.
Previously, iobuf_peek on a file smaller than 'buflen' would hang.

* common/iobuf.c (underflow): Generalize by adding a target parameter.
(iobuf_peek): Use this to prevent looping here.
* tests/openpgp/Makefile.am (TESTS): Add new test.
* tests/openpgp/setup.scm (dearmor): Move function...
* tests/openpgp/defs.scm (dearmor): ... here.
* tests/openpgp/issue2419.scm: New file.
* tests/openpgp/samplemsgs/issue2419.asc: Likewise.

GnuPG-bug-id: 2419
Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-26 18:37:37 +02:00
Justus Winter
66c0dab3c7 tests: Fix distcheck.
* tests/openpgp/Makefile.am (samplekeys): Add missing key.

Fixes-commit: 4ba11251
Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-26 16:03:06 +02:00
Justus Winter
4ba11251af g10: Fix key import statistics.
'transfer_secret_keys' collects statistics on a subkey-basis, while
the other code does not.  This leads to inflated numbers when
importing secret keys.  E.g. 'count' is incremented by the main
parsing loop in 'import', and again in 'transfer_secret_keys', leading
to a total of 3 if one key with two secret subkeys is imported.

* g10/import.c (import_secret_one): Adjust to the fact that
'transfer_secret_keys' collects subkey statistics.
* tests/openpgp/Makefile.am (TESTS): Add new test.
* tests/openpgp/issue2346.scm: New file.
* tests/openpgp/samplekeys/issue2346.gpg: Likewise.

GnuPG-bug-id: 2346
Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-25 12:50:35 +02:00
Justus Winter
d7a405de83 tests: Add test for ssh support.
* tests/gpgscm/tests.scm (path-expand): New function.
* tests/openpgp/Makefile.am (TESTS): Add new test.
(sample_keys): Add new keys.
(CLEANFILES): Clean ssh socket and control file.
* tests/openpgp/fake-pinentry.c (main): Add a default passphrase.
* tests/openpgp/gpg-agent.conf.tmpl: Enable ssh support.
* tests/openpgp/samplekeys/ssh-dsa.key: New file.
* tests/openpgp/samplekeys/ssh-ecdsa.key: Likewise.
* tests/openpgp/samplekeys/ssh-ed25519.key: Likewise.
* tests/openpgp/samplekeys/ssh-rsa.key: Likewise.
* tests/openpgp/ssh.scm: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-19 16:38:21 +02:00
Justus Winter
f474249366 agent: Fix passphrase cache lookups.
CACHE_MODE_ANY is supposed to match any cache mode except
CACHE_MODE_IGNORE, but the code used '==' to compare cache modes.

* agent/cache.c (cache_mode_equal): New function.
(agent_set_cache): Use the new function to compare cache modes.
(agent_get_cache): Likewise.
* tests/openpgp/Makefile.am (TESTS): Add new test.
* tests/openpgp/issue2015.scm: New file.

GnuPG-bug-id: 2015
Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-18 12:51:38 +02:00
Justus Winter
8270580a5a tests: Honor environment variable 'TMP'.
This fixes problems with long socket names, e.g. when doing distcheck.

* tests/gpgscm/tests.scm (path-join): New function.
(with-temporary-working-directory): Honor 'TMP'.
(make-temporary-file): Likewise.
* tests/migrations/Makefile.am (TMP): Default to '/tmp'.
(TESTS_ENVIRONMENT): Set 'TMP'.
* tests/openpgp/Makefile.am (TMP): Default to '/tmp'.
(TESTS_ENVIRONMENT): Set 'TMP'.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-05 16:25:21 +02:00
Werner Koch
0fc80208db
Add another collection of sample keys
--
2016-06-28 15:53:59 +02:00
Werner Koch
ea78b37f0d
tests: Add two more sample keys for OpenPGP.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-06-22 11:25:22 +02:00
Justus Winter
0340fcdac8 tests/openpgp: Port the remaining tests to Scheme.
* tests/openpgp/Makefile.am (TESTS): Add new tests.
* tests/openpgp/defs.scm (gpg-with-colons): New function.
(get-config): Use new function.
* tests/openpgp/export.scm: New file.
* tests/openpgp/tofu.scm: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-06-21 16:22:11 +02:00
Werner Koch
ce1689ea07
tests: Make make distcheck work again.
* Makefile.am (tests): Remove test code which would led to doubling
calls to for e.g. "make distclean".
* tests/Makefile.am: Typo fixes.
* tests/gpgscm/Makefile.am (EXTRA_DIST): Fix name of License file.
Add repl.scm.
(check): Replace by check-local because check is a standard automake
target.
* tests/openpgp/Makefile.am (TESTS_ENVIRONMENT): Replace gmake0sim by
automake generated macro.
(EXTRA_DIST): Add defs.scm

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-06-17 21:16:37 +02:00
Justus Winter
9609cb20e4 tests/openpgp: Reimplement tests in Scheme.
* Makefile.am: Build the test infrastructure on Windows.
* tests/openpgp/Makefile.am (required_pgms): Add gpgscm.
(TESTS_ENVIRONMENT): Make sure gpgscm and the libraries are found.
(TESTS): Replace tests with the new Scheme implementations.
* tests/openpgp/4gb-packet.scm: New file.
* tests/openpgp/README: Likewise.
* tests/openpgp/armdetach.scm: Likewise.
* tests/openpgp/armdetachm.scm: Likewise.
* tests/openpgp/armencrypt.scm: Likewise.
* tests/openpgp/armencryptp.scm: Likewise.
* tests/openpgp/armor.scm: Likewise.
* tests/openpgp/armsignencrypt.scm: Likewise.
* tests/openpgp/armsigs.scm: Likewise.
* tests/openpgp/clearsig.scm: Likewise.
* tests/openpgp/conventional-mdc.scm: Likewise.
* tests/openpgp/conventional.scm: Likewise.
* tests/openpgp/decrypt-dsa.scm: Likewise.
* tests/openpgp/decrypt.scm: Likewise.
* tests/openpgp/default-key.scm: Likewise.
* tests/openpgp/defs.scm: Likewise.
* tests/openpgp/detach.scm: Likewise.
* tests/openpgp/detachm.scm: Likewise.
* tests/openpgp/ecc.scm: Likewise.
* tests/openpgp/encrypt-dsa.scm: Likewise.
* tests/openpgp/encrypt.scm: Likewise.
* tests/openpgp/encryptp.scm: Likewise.
* tests/openpgp/finish.scm: Likewise.
* tests/openpgp/genkey1024.scm: Likewise.
* tests/openpgp/gpgtar.scm: Likewise.
* tests/openpgp/import.scm: Likewise.
* tests/openpgp/mds.scm: Likewise.
* tests/openpgp/multisig.scm: Likewise.
* tests/openpgp/run-tests.scm: Likewise.
* tests/openpgp/seat.scm: Likewise.
* tests/openpgp/setup.scm: Likewise.
* tests/openpgp/signencrypt-dsa.scm: Likewise.
* tests/openpgp/signencrypt.scm: Likewise.
* tests/openpgp/sigs-dsa.scm: Likewise.
* tests/openpgp/sigs.scm: Likewise.
* tests/openpgp/use-exact-key.scm: Likewise.
* tests/openpgp/verify.scm: Likewise.
* tests/openpgp/version.scm: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-06-17 11:57:12 +02:00
Werner Koch
4d7d292cd5
Add missing files so that make distcheck works again,
* tests/openpgp/Makefile.am (CLEANFILES): Add created file
"passphrases".
* tools/Makefile.am (EXTRA_DIST): Add no-libgcrypt.c.
--

dirmngr/Makefile uses a copy no-libgcrypt.c from tools/.  tools/ does
not anymore require no-libgcrypt.c but we keep it there in case we
eventually make use of it again.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-06-16 16:56:42 +02:00
Justus Winter
a54e89a585 tests: Add export test.
* tests/openpgp/Makefile.am (TESTS): Add new file.
* tests/openpgp/export.test: New file.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-05-23 16:06:53 +02:00
Werner Koch
96bcd4220f
Now build "gpg" binary but install as "gpg2"
* configure.ac (USE_GPG2_HACK): New ac_define am_conditional.
* common/homedir.c (gnupg_module_name): Replace use of macro
NAME_OF_INSTALLED_GPG.
* g10/keygen.c (generate_keypair): Ditto.
* g10/Makefile.am (bin_PROGRAMS): Remove.
(noinst_PROGRAMS): Add gpg or gpg2 and gpgv or gpg2.
(gpg2_hack_list): New.
(use_gpg2_hack): New.
(gpg2_SOURCES): Rename to gpg_SOURCES.
(gpgv2_SOURCES): Rename to gpgv_SOURCES.
(gpg2_LDADD): Rename to gpg_LDADD.
(gpgv2_LDADD): Rename to gpgv_LDADD.
(gpg2_LDFLAGS): Rename to gpg_LDFLAGS.
(gpgv2_LDFLAGS): Rename to gpgv2_LDFLAGS.
(install-exec-hook): Remove WinCE specific rules and add new rules.
(uninstall-local): Uninstall gpg/gpg2 and gpgv/gpgv2.
* tests/openpgp/Makefile.am (required_pgms): s/gpg2/gpg/.
* tests/openpgp/defs.inc: Ditto.
* tests/openpgp/gpgtar.test: Ditto.
* tests/openpgp/mkdemodirs: Ditto.
* tests/openpgp/signdemokey: Ditto.

* Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Remove obsolete
--enable-mailto, add --enable-gpg2-is-gpg.
--

Although we need to duplicate some automake generated code this method
allows to easily switch the name of the installed target using the
configure option "--enable-gpg2-is-gpg".

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-04-04 18:40:25 +02:00
Werner Koch
c6ed863491
tests: Add missing file.
* tests/openpgp/Makefile.am (TEST_FILES): Add plain-largeo.asc.
--

Fixes-commit: 785a7f463e
2016-04-04 18:40:25 +02:00
Justus Winter
ede0061feb tests/openpgp: Qualify executables with extension.
* tests/openpgp/Makefile.am (required_pgms): Qualify executables with
'$EXEEXT'.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-02-23 11:58:52 +01:00
Justus Winter
01dcc2cf2f tests/openpgp: Reimplement 'pinentry.sh' in c.
* tests/openpgp/Makefile.am: Build new program.
* tests/openpgp/defs.inc: Use the new program.
* tests/openpgp/fake-pinentry.c: New file.
--
Building an executable that does not require an interpreter makes it
easier to use on Windows.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-02-23 11:58:52 +01:00
Neal H. Walfield
dc52995d85 gpg: Lazily evaluate --default-key.
* g10/gpg.c (main): If --encrypt-to-default-key is specified, don't
add --default-key's value to REMUSR here...
* g10/pkclist.c (build_pk_list): ... do it here.
* tests/openpgp/Makefile.am (TESTS): Add default-key.test.
* tests/openpgp/default-key.test: New file.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2015-12-22 15:03:54 +01:00
Neal H. Walfield
cedbd4709e gpg: Use the matching key if the search description is exact.
* g10/gpg.c (check_user_ids): If the search description is for an
exact match (a keyid or fingerprint that ends in '!'), then use the
matching key, not the primary key.
* tests/openpgp/Makefile.am (TESTS): Add use-exact-key.test.
(priv_keys): Add privkeys/00FE67F28A52A8AA08FFAED20AF832DA916D1985.asc,
privkeys/1DF48228FEFF3EC2481B106E0ACA8C465C662CC5.asc,
privkeys/A2832820DC9F40751BDCD375BB0945BA33EC6B4C.asc,
privkeys/ADE710D74409777B7729A7653373D820F67892E0.asc and
privkeys/CEFC51AF91F68A2904FBFF62C4F075A4785B803F.asc.
(sample_keys): Add
samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc.
* tests/openpgp/privkeys/00FE67F28A52A8AA08FFAED20AF832DA916D1985.asc:
New file.
* tests/openpgp/privkeys/1DF48228FEFF3EC2481B106E0ACA8C465C662CC5.asc:
New file.
* tests/openpgp/privkeys/A2832820DC9F40751BDCD375BB0945BA33EC6B4C.asc:
New file.
* tests/openpgp/privkeys/ADE710D74409777B7729A7653373D820F67892E0.asc:
New file.
* tests/openpgp/privkeys/CEFC51AF91F68A2904FBFF62C4F075A4785B803F.asc:
New file.
* tests/openpgp/samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc:
New file.
* tests/openpgp/use-exact-key.test: New file.
* tests/openpgp/version.test: Install the new private keys.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Reported-by: Reported-by: Kristian Fiskerstrand
  <kristian.fiskerstrand@sumptuouscapital.com>
Fixes-commit: 10cca02
2015-12-03 00:00:54 +01:00
Justus Winter
556e8c4426 tests: Add tests for gpgtar and gpg-zip.
* tests/openpgp/Makefile.am (TESTS): Add new file.
* tests/openpgp/gpgtar.test: New file.

Signed-off-by: Justus Winter <justus@g10code.com>
2015-11-25 18:38:45 +01:00
Neal H. Walfield
770c06ed4e gpg: If sqlite is not available, don't build things depending on it.
* configure.ac: Define the automake conditional SQLITE3.
* tests/openpgp/Makefile.am (TESTS): Move the sqlite3 dependent tests
to...
(sqlite3_dependent_tests): ... this new variable.  If SQLITE3 is not
defined, then clear this variable.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2015-11-23 12:42:31 +01:00
Neal H. Walfield
f77913e0ff g10: Add TOFU support.
* configure.ac: Check for sqlite3.
(SQLITE3_CFLAGS): AC_SUBST it.
(SQLITE3_LIBS): Likewise.
* g10/Makefile.am (AM_CFLAGS): Add $(SQLITE3_CFLAGS).
(gpg2_SOURCES): Add tofu.h and tofu.c.
(gpg2_LDADD): Add $(SQLITE3_LIBS).
* g10/tofu.c: New file.
* g10/tofu.h: New file.
* g10/options.h (trust_model): Define TM_TOFU and TM_TOFU_PGP.
(tofu_db_format): Define.
* g10/packet.h (PKT_signature): Add fields digest and digest_len.
* g10/gpg.c: Include "tofu.h".
(cmd_and_opt_values): Declare aTOFUPolicy, oTOFUDefaultPolicy,
oTOFUDBFormat.
(opts): Add them.
(parse_trust_model): Recognize the tofu and tofu+pgp trust models.
(parse_tofu_policy): New function.
(parse_tofu_db_format): New function.
(main): Initialize opt.tofu_default_policy and opt.tofu_db_format.
Handle aTOFUPolicy, oTOFUDefaultPolicy and oTOFUDBFormat.
* g10/mainproc.c (do_check_sig): If the signature is good, copy the
hash to SIG->DIGEST and set SIG->DIGEST_LEN appropriately.
* g10/trustdb.h (get_validity): Add arguments sig and may_ask.  Update
callers.
(tdb_get_validity_core): Add arguments sig and may_ask.  Update
callers.
* g10/trust.c (get_validity) Add arguments sig and may_ask.  Pass them
to tdb_get_validity_core.
* g10/trustdb.c: Include "tofu.h".
(trust_model_string): Handle TM_TOFU and TM_TOFU_PGP.
(tdb_get_validity_core): Add arguments sig and may_ask.  If
OPT.TRUST_MODEL is TM_TOFU or TM_TOFU_PGP, compute the TOFU trust
level.  Combine it with the computed PGP trust level, if appropriate.
* g10/keyedit.c: Include "tofu.h".
(show_key_with_all_names_colon): If the trust mode is tofu or
tofu+pgp, then show the trust policy.
* g10/keylist.c: Include "tofu.h".
(public_key_list): Also show the PGP stats if the trust model is
TM_TOFU_PGP.
(list_keyblock_colon): If the trust mode is tofu or
tofu+pgp, then show the trust policy.
* g10/pkclist.c: Include "tofu.h".
* g10/gpgv.c (get_validity): Add arguments sig and may_ask.
(enum tofu_policy): Define.
(tofu_get_policy): New stub.
(tofu_policy_str): Likewise.
* g10/test-stubs.c (get_validity): Add arguments sig and may_ask.
(enum tofu_policy): Define.
(tofu_get_policy): New stub.
(tofu_policy_str): Likewise.
* doc/DETAILS: Describe the TOFU Policy field.
* doc/gpg.texi: Document --tofu-set-policy, --trust-model=tofu,
--trust-model=tofu+pgp, --tofu-default-policy and --tofu-db-format.
* tests/openpgp/Makefile.am (TESTS): Add tofu.test.
(TEST_FILES): Add tofu-keys.asc, tofu-keys-secret.asc,
tofu-2183839A-1.txt, tofu-BC15C85A-1.txt and tofu-EE37CF96-1.txt.
(CLEANFILES): Add tofu.db.
(clean-local): Add tofu.d.
* tests/openpgp/tofu.test: New file.
* tests/openpgp/tofu-2183839A-1.txt: New file.
* tests/openpgp/tofu-BC15C85A-1.txt: New file.
* tests/openpgp/tofu-EE37CF96-1.txt: New file.
* tests/openpgp/tofu-keys.asc: New file.
* tests/openpgp/tofu-keys-secret.asc: New file.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
2015-10-18 18:45:40 +02:00
Werner Koch
0bae2ff599
tests: Two new OpenPGP test keys from E2E.
--
2015-10-05 10:58:00 +02:00
Neal H. Walfield
09f2a7bca6 common: Don't incorrectly reject 4 GB - 1 sized packets.
* g10/parse-packet.c (parse): Don't reject 4 GB - 1 sized packets.
Add the constraint that the type must be 63.
* kbx/keybox-openpgp.c (next_packet): Likewise.
* tests/openpgp/4gb-packet.asc: New file.
* tests/openpgp/4gb-packet.test: New file.
* tests/openpgp/Makefile.am (TESTS): Add 4gb-packet.test.
(TEST_FILES): Add 4gb-packet.asc.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
2015-08-21 14:21:13 +02:00
Werner Koch
5038276fc4
tests: More OpenPGP test keys
--
2015-05-16 12:20:02 +02:00
Werner Koch
a256722537 tests: Add sample keys with colliding long keu ids.
--

Thanks to David Leon Gil <coruus@gmail.com> who posted these keys to
openpgp@ietf.org on Fri, 13 Dec 2013 07:09:54 -0800 (PST).
2014-10-13 13:57:00 +02:00
Werner Koch
ade531acac Some doc fixes and a fix for "make distcheck".
--
2014-10-03 13:02:23 +02:00
Werner Koch
83c2d2396c gpg: Use algorithm id 22 for EdDSA.
* common/openpgpdefs.h (PUBKEY_ALGO_EDDSA): Change to 22.
* g10/keygen.c (ask_curve): Reword the Curve25519 warning note.
--

In the hope that the IETF will eventually assign 22 for EdDSA using
the draft-koch-eddsa-for-openpgp-01 specs we start using this number.
2014-09-12 11:31:49 +02:00
Werner Koch
03018ef9ee gpg: Auto-create revocation certificates.
* configure.ac (GNUPG_OPENPGP_REVOC_DIR): New config define.
* g10/revoke.c (create_revocation): Add arg "leadin".
(gen_standard_revoke): New.
* g10/openfile.c (get_openpgp_revocdir): New.
(open_outfile): Add MODE value 3.
* g10/keyid.c (hexfingerprint): New.
* g10/keygen.c (do_generate_keypair): Call gen_standard_revoke.
--

GnuPG-bug-id: 1042
2014-06-30 16:40:55 +02:00
Werner Koch
2336b09779 Generate the ChangeLog from commit logs.
* scripts/gitlog-to-changelog: New script.  Taken from gnulib.
* scripts/git-log-fix: New file.
* scripts/git-log-footer: New file.
* doc/HACKING: Describe the ChangeLog policy
* ChangeLog: New file.
* Makefile.am (EXTRA_DIST): Add new files.
(gen-ChangeLog): New.
(dist-hook): Run gen-ChangeLog.

Rename all ChangeLog files to ChangeLog-2011.
2011-12-01 11:09:02 +01:00
Werner Koch
d290f2914a Add ECC import regression tests and fixed a regression.
The import test imports the keys as needed and because they are
passphrase protected we now need a pinentry script to convey the
passphrase to gpg-agent.
2011-02-10 20:45:37 +01:00
Werner Koch
d1bdc3f6ea Tweaks to make make distcheck work. 2010-10-15 09:16:39 +00:00
Werner Koch
764e88d4df All tests work are again working 2010-10-14 16:34:31 +00:00