tests: Avoid relying on implicit gpg commands.

* tests/openpgp/armdetach.scm: Always use an explicit command instead
of relying on gpg to guess what we want.
* 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/compression.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/detach.scm: Likewise.
* tests/openpgp/detachm.scm: Likewise.
* tests/openpgp/ecc.scm: Likewise.
* tests/openpgp/encrypt-dsa.scm: Likewise.
* tests/openpgp/encrypt-multifile.scm: Likewise.
* tests/openpgp/encrypt.scm: Likewise.
* tests/openpgp/encryptp.scm: Likewise.
* tests/openpgp/seat.scm: Likewise.
* tests/openpgp/signencrypt-dsa.scm: Likewise.
* tests/openpgp/signencrypt.scm: Likewise.
* tests/openpgp/sigs-dsa.scm: Likewise.
* tests/openpgp/sigs.scm: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2017-04-11 11:37:37 +02:00
parent 1b28d9dbe0
commit cde626e7f7
No known key found for this signature in database
GPG Key ID: DD1A52F9DA8C9020
25 changed files with 38 additions and 39 deletions

View File

@ -28,5 +28,5 @@
--output ,tmp ,source ) usrpass1) --output ,tmp ,source ) usrpass1)
(pipe:do (pipe:do
(pipe:open source (logior O_RDONLY O_BINARY)) (pipe:open source (logior O_RDONLY O_BINARY))
(pipe:spawn `(,@GPG --yes ,tmp))))) (pipe:spawn `(,@GPG --yes --verify ,tmp -)))))
(append plain-files data-files)) (append plain-files data-files))

View File

@ -33,4 +33,4 @@
(pipe:open file (logior O_RDONLY O_BINARY)) (pipe:open file (logior O_RDONLY O_BINARY))
(pipe:splice sink))) (pipe:splice sink)))
files))) files)))
(pipe:spawn `(,@GPG --yes ,tmp)))) (pipe:spawn `(,@GPG --yes --verify ,tmp -))))

View File

@ -26,6 +26,6 @@
(tr:do (tr:do
(tr:open source) (tr:open source)
(tr:gpg usrpass1 `(--yes --passphrase-fd "0" -ea --recipient ,usrname2)) (tr:gpg usrpass1 `(--yes --passphrase-fd "0" -ea --recipient ,usrname2))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity source))) (tr:assert-identity source)))
(append plain-files data-files)) (append plain-files data-files))

View File

@ -27,6 +27,6 @@
(tr:open source) (tr:open source)
(tr:pipe-do (tr:pipe-do
(pipe:gpg `(--yes -ea --recipient ,usrname2)) (pipe:gpg `(--yes -ea --recipient ,usrname2))
(pipe:gpg '(--yes))) (pipe:gpg '(--yes --decrypt)))
(tr:assert-identity source))) (tr:assert-identity source)))
(append plain-files data-files)) (append plain-files data-files))

View File

@ -764,4 +764,4 @@ wg7Md81a5RI3F2FG8747t9gX
(tr:do (tr:do
(tr:pipe-do (tr:pipe-do
(pipe:echo nopad_armored_msg) (pipe:echo nopad_armored_msg)
(pipe:gpg '()))) (pipe:gpg '(--decrypt))))

View File

@ -26,6 +26,6 @@
(tr:do (tr:do
(tr:open source) (tr:open source)
(tr:gpg usrpass1 `(--yes --passphrase-fd "0" -sea --recipient ,usrname2)) (tr:gpg usrpass1 `(--yes --passphrase-fd "0" -sea --recipient ,usrname2))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity source))) (tr:assert-identity source)))
(append plain-files data-files)) (append plain-files data-files))

View File

@ -26,6 +26,6 @@
(tr:do (tr:do
(tr:open source) (tr:open source)
(tr:gpg usrpass1 `(--yes --passphrase-fd "0" -sa --recipient ,usrname2)) (tr:gpg usrpass1 `(--yes --passphrase-fd "0" -sa --recipient ,usrname2))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity source))) (tr:assert-identity source)))
(append plain-files data-files)) (append plain-files data-files))

View File

@ -25,7 +25,7 @@
(lettmp (signed) (lettmp (signed)
(call-popen `(,@GPG --output ,signed --yes (call-popen `(,@GPG --output ,signed --yes
,@args ,source) input) ,@args ,source) input)
(call-popen `(,@GPG --output ,sink --yes ,signed) "")))) (call-popen `(,@GPG --output ,sink --yes --verify ,signed) ""))))
(for-each-p (for-each-p
"Checking signing and verifying plain text messages" "Checking signing and verifying plain text messages"

View File

@ -30,7 +30,7 @@
(tr:open source) (tr:open source)
(tr:gpg "" `(--yes --encrypt --recipient ,usrname2 (tr:gpg "" `(--yes --encrypt --recipient ,usrname2
--compress-algo ,compression)) --compress-algo ,compression))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity source))) (tr:assert-identity source)))
(append plain-files data-files))) (append plain-files data-files)))
(force all-compression-algos)) (force all-compression-algos))

View File

@ -34,7 +34,7 @@
(tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k
--force-mdc -c --force-mdc -c
--cipher-algo ,algo)) --cipher-algo ,algo))
(tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k)) (tr:gpg passphrase `(--yes --passphrase-fd "0" --decrypt ,s2k))
(tr:assert-identity source))) (tr:assert-identity source)))
'("plain-1" "data-80000"))) '("plain-1" "data-80000")))
(force all-cipher-algos)) (force all-cipher-algos))
@ -45,6 +45,6 @@
(tr:do (tr:do
(tr:open source) (tr:open source)
(tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k -cs)) (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k -cs))
(tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k)) (tr:gpg passphrase `(--yes --passphrase-fd "0" --decrypt ,s2k))
(tr:assert-identity source))) (tr:assert-identity source)))
(append plain-files data-files)) (append plain-files data-files))

View File

@ -29,7 +29,7 @@
(tr:do (tr:do
(tr:open source) (tr:open source)
(tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k -c)) (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k -c))
(tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k)) (tr:gpg passphrase `(--yes --passphrase-fd "0" --decrypt ,s2k))
(tr:assert-identity source))) (tr:assert-identity source)))
'("plain-2" "data-32000")) '("plain-2" "data-32000"))
@ -43,7 +43,7 @@
(tr:open source) (tr:open source)
(tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k -c (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k -c
--cipher-algo ,algo)) --cipher-algo ,algo))
(tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k)) (tr:gpg passphrase `(--yes --passphrase-fd "0" --decrypt ,s2k))
(tr:assert-identity source))) (tr:assert-identity source)))
'("plain-1" "data-80000"))) '("plain-1" "data-80000")))
(force all-cipher-algos)) (force all-cipher-algos))

View File

@ -25,6 +25,6 @@
(lambda (name) (lambda (name)
(tr:do (tr:do
(tr:open (in-srcdir (string-append name "-pgp.asc"))) (tr:open (in-srcdir (string-append name "-pgp.asc")))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity name))) (tr:assert-identity name)))
(list (car plain-files))) (list (car plain-files)))

View File

@ -25,6 +25,6 @@
(lambda (name) (lambda (name)
(tr:do (tr:do
(tr:open (in-srcdir (string-append name ".asc"))) (tr:open (in-srcdir (string-append name ".asc")))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity name))) (tr:assert-identity name)))
plain-files) plain-files)

View File

@ -28,5 +28,5 @@
--output ,tmp ,source ) usrpass1) --output ,tmp ,source ) usrpass1)
(pipe:do (pipe:do
(pipe:open source (logior O_RDONLY O_BINARY)) (pipe:open source (logior O_RDONLY O_BINARY))
(pipe:spawn `(,@GPG --yes ,tmp))))) (pipe:spawn `(,@GPG --yes --verify ,tmp -)))))
(append plain-files data-files)) (append plain-files data-files))

View File

@ -33,4 +33,4 @@
(pipe:open file (logior O_RDONLY O_BINARY)) (pipe:open file (logior O_RDONLY O_BINARY))
(pipe:splice sink))) (pipe:splice sink)))
files))) files)))
(pipe:spawn `(,@GPG --yes ,tmp)))) (pipe:spawn `(,@GPG --yes --verify ,tmp -))))

View File

@ -101,8 +101,7 @@ Ic1RdzgeCfosMF+l/zVRchcLKzenEQA=
(lettmp (x y) (lettmp (x y)
(call-with-output-file (call-with-output-file
x (lambda (p) (display (eval test (current-environment)) p))) x (lambda (p) (display (eval test (current-environment)) p)))
(call-check `(,(tool 'gpg) --verify ,x)) (call-check `(,(tool 'gpg) --output ,y --verify ,x))
(call-check `(,(tool 'gpg) --output ,y ,x))
(unless (file=? y z) (fail "mismatch")))) (unless (file=? y z) (fail "mismatch"))))
'(msg_opaque_signed_256 msg_opaque_signed_384 msg_opaque_signed_521))) '(msg_opaque_signed_256 msg_opaque_signed_384 msg_opaque_signed_521)))
@ -181,7 +180,7 @@ Rg==
(lettmp (x y) (lettmp (x y)
(call-with-output-file (call-with-output-file
x (lambda (p) (display (eval test (current-environment)) p))) x (lambda (p) (display (eval test (current-environment)) p)))
(call-check `(,@GPG --yes --output ,y ,x)) (call-check `(,@GPG --yes --output ,y --decrypt ,x))
(unless (file=? y z) (fail "mismatch")))) (unless (file=? y z) (fail "mismatch"))))
'(msg_encrypted_256 msg_encrypted_384 msg_encrypted_521))) '(msg_encrypted_256 msg_encrypted_384 msg_encrypted_521)))
@ -200,7 +199,7 @@ Rg==
(tr:do (tr:do
(tr:open source) (tr:open source)
(tr:gpg "" `(--yes --encrypt --recipient ,keyid)) (tr:gpg "" `(--yes --encrypt --recipient ,keyid))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity source))) (tr:assert-identity source)))
mainkeyids)) mainkeyids))
(append plain-files data-files)) (append plain-files data-files))
@ -217,7 +216,7 @@ Rg==
(tr:do (tr:do
(tr:open source) (tr:open source)
(tr:gpg "" `(--yes --sign --local-user ,keyid)) (tr:gpg "" `(--yes --sign --local-user ,keyid))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity source))) (tr:assert-identity source)))
mainkeyids)) mainkeyids))
(append plain-files data-files)) (append plain-files data-files))

View File

@ -26,7 +26,7 @@
(tr:do (tr:do
(tr:open source) (tr:open source)
(tr:gpg "" `(--yes --encrypt --recipient ,dsa-usrname2)) (tr:gpg "" `(--yes --encrypt --recipient ,dsa-usrname2))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity source))) (tr:assert-identity source)))
(append plain-files data-files)) (append plain-files data-files))
@ -40,7 +40,7 @@
(tr:open source) (tr:open source)
(tr:gpg "" `(--yes --encrypt --recipient ,dsa-usrname2 (tr:gpg "" `(--yes --encrypt --recipient ,dsa-usrname2
--cipher-algo ,cipher)) --cipher-algo ,cipher))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity source))) (tr:assert-identity source)))
(append plain-files data-files))) (append plain-files data-files)))
(force all-cipher-algos)) (force all-cipher-algos))

View File

@ -34,6 +34,6 @@
(lambda (source) (lambda (source)
(tr:do (tr:do
(tr:open (string-append source ".gpg")) (tr:open (string-append source ".gpg"))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity source))) (tr:assert-identity source)))
files) files)

View File

@ -26,7 +26,7 @@
(tr:do (tr:do
(tr:open source) (tr:open source)
(tr:gpg "" `(--yes --encrypt --recipient ,usrname2)) (tr:gpg "" `(--yes --encrypt --recipient ,usrname2))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity source))) (tr:assert-identity source)))
(append plain-files data-files)) (append plain-files data-files))
@ -40,7 +40,7 @@
(tr:open source) (tr:open source)
(tr:gpg "" `(--yes --encrypt --recipient ,usrname2 (tr:gpg "" `(--yes --encrypt --recipient ,usrname2
--cipher-algo ,cipher)) --cipher-algo ,cipher))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity source))) (tr:assert-identity source)))
(append plain-files data-files))) (append plain-files data-files)))
(force all-cipher-algos)) (force all-cipher-algos))
@ -56,6 +56,6 @@
(tr:gpg "" `(--yes -v --no-keyring --encrypt (tr:gpg "" `(--yes -v --no-keyring --encrypt
--recipient-file ,(in-srcdir key-file1) --recipient-file ,(in-srcdir key-file1)
--hidden-recipient-file ,(in-srcdir key-file2))) --hidden-recipient-file ,(in-srcdir key-file2)))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity source))) (tr:assert-identity source)))
plain-files) plain-files)

View File

@ -27,6 +27,6 @@
(tr:open source) (tr:open source)
(tr:pipe-do (tr:pipe-do
(pipe:gpg `(--yes --encrypt --recipient ,usrname2)) (pipe:gpg `(--yes --encrypt --recipient ,usrname2))
(pipe:gpg '(--yes))) (pipe:gpg '(--yes --decrypt)))
(tr:assert-identity source))) (tr:assert-identity source)))
(append plain-files data-files)) (append plain-files data-files))

View File

@ -26,6 +26,6 @@
(tr:do (tr:do
(tr:open source) (tr:open source)
(tr:gpg usrpass1 '(--yes -seat -r two@example.com --passphrase-fd "0")) (tr:gpg usrpass1 '(--yes -seat -r two@example.com --passphrase-fd "0"))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-weak-identity source))) (tr:assert-weak-identity source)))
plain-files) plain-files)

View File

@ -28,7 +28,7 @@
(tr:gpg usrpass1 `(--yes --passphrase-fd "0" -se (tr:gpg usrpass1 `(--yes --passphrase-fd "0" -se
-u ,dsa-usrname1 -u ,dsa-usrname1
--recipient ,dsa-usrname2)) --recipient ,dsa-usrname2))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity source))) (tr:assert-identity source)))
(append plain-files data-files)) (append plain-files data-files))
@ -44,6 +44,6 @@
-u ,dsa-usrname1 -u ,dsa-usrname1
--recipient ,dsa-usrname2 --recipient ,dsa-usrname2
--digest-algo ,hash)) --digest-algo ,hash))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity (car plain-files)))) (tr:assert-identity (car plain-files))))
algos) algos)

View File

@ -26,14 +26,14 @@
(tr:do (tr:do
(tr:open source) (tr:open source)
(tr:gpg usrpass1 `(--yes --passphrase-fd "0" -se --recipient ,usrname2)) (tr:gpg usrpass1 `(--yes --passphrase-fd "0" -se --recipient ,usrname2))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity source))) (tr:assert-identity source)))
(append plain-files data-files)) (append plain-files data-files))
(info "Checking bug 537: MDC problem with old style compressed packets.") (info "Checking bug 537: MDC problem with old style compressed packets.")
(lettmp (tmp) (lettmp (tmp)
(call-popen `(,@GPG --yes --passphrase-fd "0" (call-popen `(,@GPG --yes --passphrase-fd "0"
--output ,tmp ,(in-srcdir "bug537-test.data.asc")) --output ,tmp --decrypt ,(in-srcdir "bug537-test.data.asc"))
usrpass1) usrpass1)
(if (not (string=? "4336AE2A528FAE091E73E59E325B588FEE795F9B" (if (not (string=? "4336AE2A528FAE091E73E59E325B588FEE795F9B"
(cadar (gpg-hash-string `(--print-md SHA1 ,tmp) "")))) (cadar (gpg-hash-string `(--print-md SHA1 ,tmp) ""))))

View File

@ -26,7 +26,7 @@
(tr:do (tr:do
(tr:open source) (tr:open source)
(tr:gpg "" `(--yes --sign --user ,dsa-usrname1)) (tr:gpg "" `(--yes --sign --user ,dsa-usrname1))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity source))) (tr:assert-identity source)))
(append plain-files data-files)) (append plain-files data-files))
@ -39,6 +39,6 @@
(tr:do (tr:do
(tr:open (car plain-files)) (tr:open (car plain-files))
(tr:gpg "" `(--yes --sign --user ,dsa-usrname1 --digest-algo ,hash)) (tr:gpg "" `(--yes --sign --user ,dsa-usrname1 --digest-algo ,hash))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity (car plain-files)))) (tr:assert-identity (car plain-files))))
algos) algos)

View File

@ -26,7 +26,7 @@
(tr:do (tr:do
(tr:open source) (tr:open source)
(tr:gpg "" '(--yes --sign)) (tr:gpg "" '(--yes --sign))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity source))) (tr:assert-identity source)))
(append plain-files data-files)) (append plain-files data-files))
@ -38,7 +38,7 @@
(tr:do (tr:do
(tr:open (car plain-files)) (tr:open (car plain-files))
(tr:gpg "" `(--yes --sign --user ,usrname3 --digest-algo ,hash)) (tr:gpg "" `(--yes --sign --user ,usrname3 --digest-algo ,hash))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity (car plain-files)))) (tr:assert-identity (car plain-files))))
(if (not (equal? "MD5" hash)) (if (not (equal? "MD5" hash))
;; Using the DSA sig key - only 160 bit or larger hashes ;; Using the DSA sig key - only 160 bit or larger hashes
@ -46,6 +46,6 @@
(tr:open (car plain-files)) (tr:open (car plain-files))
(tr:gpg usrpass1 (tr:gpg usrpass1
`(--yes --sign --passphrase-fd "0" --digest-algo ,hash)) `(--yes --sign --passphrase-fd "0" --digest-algo ,hash))
(tr:gpg "" '(--yes)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity (car plain-files))))) (tr:assert-identity (car plain-files)))))
(force all-hash-algos)) (force all-hash-algos))