diff options
author | Werner Koch <[email protected]> | 2014-02-10 16:05:54 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2014-02-10 16:46:40 +0000 |
commit | 62fb86c6589f7f74dad4741db31b3aefa0848420 (patch) | |
tree | d076e3a6f23760a10509f918b384a3d6897b67c2 /tests | |
parent | tests: Handle disabled algorithms. (diff) | |
download | gnupg-62fb86c6589f7f74dad4741db31b3aefa0848420.tar.gz gnupg-62fb86c6589f7f74dad4741db31b3aefa0848420.zip |
gpg: Allow building without any trust model support.
* configure.ac: Add option --disable-trust-models
(NO_TRUST_MODELS): New ac_define and am_conditional.
* g10/Makefile.am (trust_source): New.
(gpg2_SOURCES): Factor some files out to above. Add trust.c.
* g10/gpg.c [NO_TRUST_MODELS]: Disable options --export-ownertrust,
--import-ownertrust, --update-trustdb, --check-trustdb, --fix-trustdb,
--list-trustdb, --trustdb-name, --auto-check-trustdb,
--no-auto-check-trustdb, and --force-ownertrust.
(parse_trust_model) [NO_TRUST_MODELS]: Do not build.
(main) [NO_TRUST_MODELS]: Set trust_model to always and exclude all
trustdb related option code.
* g10/keyedit.c (cmds) [NO_TRUST_MODELS]: Remove menu items "trust",
"enable", and "disable".
* g10/keylist.c (public_key_list) [NO_TRUST_MODELS]: Do not print
"tru" record.
* g10/trust.c: New.
* g10/trustdb.c (struct key_item): Move to trustdb.h.
(register_trusted_keyid): Rename to tdb_register_trusted_keyid.
(register_trusted_key): Rename to tdb_register_trusted_key.
(trust_letter, uid_trust_string_fixed, trust_value_to_string)
(string_to_trust_value, get_ownertrust_with_min, get_ownertrust_info)
(get_ownertrust_string, get_validity_info, get_validity_string)
(clean_sigs_from_uid, clean_uid_from_key, clean_key): Move to trust.c.
(mark_usable_uid_certs): Move to trust.c and make global.
(is_in_klist): Move as inline to trustdb.h.
(trustdb_check_or_update): Rename to tdb_check_or_update
(revalidation_mark): Rename to tdb_revalidation_mark.
(get_ownertrust): Rename to tdb_get_ownertrust.
(get_min_ownertrust): Rename to tdb_get_min_ownertrust.
(update_ownertrust): Rename to tdb_update_ownertrust.
(clear_ownertrusts): Rename to tdb_clear_ownertrusts.
(cache_disabled_value): Rename to tdb_cache_disabled_value.
(check_trustdb_stale): Rename to tdb_check_trustdb_stale.
(get_validity): Rename to tdb_get_validity_core, add arg MAIN_PK and
factor some code out to ...
* trust.c (get_validity): ...new.
(check_or_update_trustdb): New wrapper.
(revalidation_mark): New wrapper.
(get_ownertrust): New wrapper.
(get_ownertrust_with_min): New wrapper.
(update_ownertrust): New wrapper.
(clear_ownertrusts): New wrapper.
(cache_disabled_value): New wrapper.
(check_trustdb_stale): New wrapper.
* tests/openpgp/defs.inc (opt_always): New. Use in all tests instead
of --always-trust.
Diffstat (limited to '')
-rwxr-xr-x | tests/openpgp/armencrypt.test | 2 | ||||
-rwxr-xr-x | tests/openpgp/armencryptp.test | 2 | ||||
-rwxr-xr-x | tests/openpgp/armsignencrypt.test | 2 | ||||
-rwxr-xr-x | tests/openpgp/defs.inc | 13 | ||||
-rwxr-xr-x | tests/openpgp/ecc.test | 2 | ||||
-rwxr-xr-x | tests/openpgp/encrypt-dsa.test | 4 | ||||
-rwxr-xr-x | tests/openpgp/encrypt.test | 4 | ||||
-rwxr-xr-x | tests/openpgp/encryptp.test | 2 | ||||
-rw-r--r-- | tests/openpgp/gpg.conf.tmpl | 1 | ||||
-rwxr-xr-x | tests/openpgp/seat.test | 2 | ||||
-rwxr-xr-x | tests/openpgp/signencrypt-dsa.test | 4 | ||||
-rwxr-xr-x | tests/openpgp/signencrypt.test | 2 |
12 files changed, 25 insertions, 15 deletions
diff --git a/tests/openpgp/armencrypt.test b/tests/openpgp/armencrypt.test index df3729410..ce1067e6b 100755 --- a/tests/openpgp/armencrypt.test +++ b/tests/openpgp/armencrypt.test @@ -12,7 +12,7 @@ #info Checking armored encryption for i in $plain_files $data_files ; do - $GPG --always-trust -ea -o x --yes -r "$usrname2" $i + $GPG ${opt_always} -ea -o x --yes -r "$usrname2" $i $GPG -o y --yes x cmp $i y || error "$i: mismatch" done diff --git a/tests/openpgp/armencryptp.test b/tests/openpgp/armencryptp.test index 9246b6d27..dfebb4827 100755 --- a/tests/openpgp/armencryptp.test +++ b/tests/openpgp/armencryptp.test @@ -12,7 +12,7 @@ #info Checking armored encryption with a pipe for i in $plain_files $data_files ; do - $GPG --always-trust -ea --yes -r "$usrname2" < $i | tee x | $GPG -o y --yes + $GPG ${opt_always} -ea --yes -r "$usrname2" < $i | tee x | $GPG -o y --yes cmp $i y || error "$i: mismatch" $GPG --yes < x > y cmp $i y || error "$i: mismatch" diff --git a/tests/openpgp/armsignencrypt.test b/tests/openpgp/armsignencrypt.test index 5b392df27..c50a12dc1 100755 --- a/tests/openpgp/armsignencrypt.test +++ b/tests/openpgp/armsignencrypt.test @@ -13,7 +13,7 @@ #info Checking armored signing and encryption for i in $plain_files $data_files ; do - echo "$usrpass1" | $GPG --passphrase-fd 0 --always-trust \ + echo "$usrpass1" | $GPG --passphrase-fd 0 ${opt_always} \ -sae -o x --yes -r "$usrname2" $i $GPG -o y --yes x cmp $i y || error "$i: mismatch" diff --git a/tests/openpgp/defs.inc b/tests/openpgp/defs.inc index 49e085e8a..008d32a43 100755 --- a/tests/openpgp/defs.inc +++ b/tests/openpgp/defs.inc @@ -226,6 +226,15 @@ PINENTRY="$(cd $srcdir && /bin/pwd)/pinentry.sh" # Default to empty passphrase for pinentry.sh PINENTRY_USER_DATA= +# If --check-trustdb is not an option, GPG has been build without +# trust model support. Thus we can't use --always-trust and some +# other options. +if $GPG --dump-options | grep '^--check-trustdb$' >/dev/null ; then + opt_always="--always-trust" +else + opt_always= +fi + # Make sure we have a valid option files even with VPATH builds. for f in gpg.conf gpg-agent.conf ; do if [ -f ./$f ]; then @@ -234,8 +243,10 @@ for f in gpg.conf gpg-agent.conf ; do cat $srcdir/$f.tmpl >$f case "$f" in gpg.conf) + [ -n "${opt_always}" ] && echo "no-auto-check-trustdb" >>"$f" echo "agent-program $GPG_AGENT" >>"$f" - ;; + + ;; gpg-agent.conf) echo "pinentry-program $PINENTRY" >>"$f" ;; diff --git a/tests/openpgp/ecc.test b/tests/openpgp/ecc.test index 01e1e0617..062a1ae0f 100755 --- a/tests/openpgp/ecc.test +++ b/tests/openpgp/ecc.test @@ -203,7 +203,7 @@ info "Checking ECC encryption and decryption." for i in $plain_files $data_files ; do for k in $mainkeyids ; do info "file: $i key: $k" - $GPG --always-trust -e -o x --yes -r $k $i + $GPG ${opt_always} -e -o x --yes -r $k $i $GPG -o y --yes x cmp $i y || error "$i,$k: mismatch" done diff --git a/tests/openpgp/encrypt-dsa.test b/tests/openpgp/encrypt-dsa.test index 8ae93d817..7ce670ee0 100755 --- a/tests/openpgp/encrypt-dsa.test +++ b/tests/openpgp/encrypt-dsa.test @@ -12,7 +12,7 @@ #info Checking encryption for i in $plain_files $data_files ; do - $GPG --always-trust -e -o x --yes -r "$dsa_usrname2" $i + $GPG ${opt_always} -e -o x --yes -r "$dsa_usrname2" $i $GPG -o y --yes x cmp $i y || error "$i: mismatch" done @@ -20,7 +20,7 @@ done for ca in `all_cipher_algos` ; do progress "$ca" for i in $plain_files $data_files ; do - $GPG --always-trust --cipher-algo $ca -e \ + $GPG ${opt_always} --cipher-algo $ca -e \ -o x --yes -r "$dsa_usrname2" $i $GPG -o y --yes x cmp $i y || error "$i: mismatch" diff --git a/tests/openpgp/encrypt.test b/tests/openpgp/encrypt.test index 5ef5196d8..295a6c3a9 100755 --- a/tests/openpgp/encrypt.test +++ b/tests/openpgp/encrypt.test @@ -12,7 +12,7 @@ #info Checking encryption for i in $plain_files $data_files ; do - $GPG --always-trust -e -o x --yes -r "$usrname2" $i + $GPG ${opt_always} -e -o x --yes -r "$usrname2" $i $GPG -o y --yes x cmp $i y || error "$i: mismatch" done @@ -21,7 +21,7 @@ echo_n " > " for ca in `all_cipher_algos` ; do echo_n "$ca " for i in $plain_files $data_files ; do - $GPG --always-trust -e -o x --yes -r "$usrname2" --cipher-algo $ca $i + $GPG ${opt_always} -e -o x --yes -r "$usrname2" --cipher-algo $ca $i $GPG -o y --yes x cmp $i y || error "$i: mismatch" done diff --git a/tests/openpgp/encryptp.test b/tests/openpgp/encryptp.test index 984f56ab8..3ad7119dd 100755 --- a/tests/openpgp/encryptp.test +++ b/tests/openpgp/encryptp.test @@ -12,7 +12,7 @@ #info Checking encryption with a pipe for i in $plain_files $data_files ; do - $GPG --always-trust -e --yes -r "$usrname2" <$i | $GPG --yes > y + $GPG ${opt_always} -e --yes -r "$usrname2" <$i | $GPG --yes > y cmp $i y || error "$i: mismatch" done diff --git a/tests/openpgp/gpg.conf.tmpl b/tests/openpgp/gpg.conf.tmpl index 7060a6610..19f31808a 100644 --- a/tests/openpgp/gpg.conf.tmpl +++ b/tests/openpgp/gpg.conf.tmpl @@ -2,4 +2,3 @@ no-greeting no-secmem-warning no-permission-warning batch -no-auto-check-trustdb diff --git a/tests/openpgp/seat.test b/tests/openpgp/seat.test index 8a5f39904..b400e72dc 100755 --- a/tests/openpgp/seat.test +++ b/tests/openpgp/seat.test @@ -11,7 +11,7 @@ . $srcdir/defs.inc || exit 3 for i in $plain_files ; do - echo "$usrpass1" | $GPG --passphrase-fd 0 --always-trust -seat \ + echo "$usrpass1" | $GPG --passphrase-fd 0 ${opt_always} -seat \ -r [email protected] -o x --yes $i $GPG -o y --yes x cmp $i y || error "$i: mismatch" diff --git a/tests/openpgp/signencrypt-dsa.test b/tests/openpgp/signencrypt-dsa.test index dd724c97e..2fb2bb1aa 100755 --- a/tests/openpgp/signencrypt-dsa.test +++ b/tests/openpgp/signencrypt-dsa.test @@ -12,7 +12,7 @@ #info Checking signing and encryption for DSA for i in $plain_files $data_files ; do - $GPG --always-trust -se -o x --yes \ + $GPG ${opt_always} -se -o x --yes \ -u "$dsa_usrname1" -r "$dsa_usrname2" $i $GPG -o y --yes x cmp $i y || error "$i: mismatch" @@ -27,7 +27,7 @@ fi for da in $algos; do for i in $plain_files; do - $GPG --always-trust -se -o x --yes --digest-algo $da \ + $GPG ${opt_always} -se -o x --yes --digest-algo $da \ -u "$dsa_usrname1" -r "$dsa_usrname2" $i $GPG -o y --yes x cmp $i y || error "$i: mismatch" diff --git a/tests/openpgp/signencrypt.test b/tests/openpgp/signencrypt.test index 8ccbaf7ca..5644befa7 100755 --- a/tests/openpgp/signencrypt.test +++ b/tests/openpgp/signencrypt.test @@ -13,7 +13,7 @@ info "Checking signing and encryption" for i in $plain_files $data_files ; do - echo "$usrpass1" | $GPG --passphrase-fd 0 --always-trust \ + echo "$usrpass1" | $GPG --passphrase-fd 0 ${opt_always} \ -se -o x --yes -r "$usrname2" $i $GPG -o y --yes x cmp $i y || error "$i: mismatch" |