summaryrefslogtreecommitdiffstats
path: root/tests/openpgp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 21:21:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 21:21:03 +0000
commit69349561bf941cc67f1afcbbc115af8dbd624f94 (patch)
tree49d5db9fac516d5de488244d4cffd2e9d74220e7 /tests/openpgp
parentAdding debian version 2.2.40-3. (diff)
downloadgnupg2-69349561bf941cc67f1afcbbc115af8dbd624f94.tar.xz
gnupg2-69349561bf941cc67f1afcbbc115af8dbd624f94.zip
Merging upstream version 2.2.43.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/openpgp')
-rw-r--r--tests/openpgp/Makefile.am7
-rw-r--r--tests/openpgp/Makefile.in28
-rw-r--r--tests/openpgp/all-tests.scm13
-rw-r--r--tests/openpgp/defs.scm10
-rwxr-xr-xtests/openpgp/encrypt.scm65
-rwxr-xr-xtests/openpgp/issue2941.scm2
-rw-r--r--tests/openpgp/privkeys/891067FFFC6D67D37BD4BFC399191C5F3989D1B5.key5
-rw-r--r--tests/openpgp/privkeys/F27FC04CB01723A4CB6F5399F7B86CCD82C0169C.key5
-rw-r--r--tests/openpgp/run-tests.scm2
-rw-r--r--tests/openpgp/samplekeys/README1
-rw-r--r--tests/openpgp/samplekeys/ed25519-cv25519-sample-1.asc20
-rw-r--r--tests/openpgp/samplekeys/ed25519-cv25519-sample-2.asc21
12 files changed, 148 insertions, 31 deletions
diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am
index 59f39e2..2cef2fc 100644
--- a/tests/openpgp/Makefile.am
+++ b/tests/openpgp/Makefile.am
@@ -116,7 +116,7 @@ check: xcheck
.PHONY: xcheck
xcheck:
- $(TESTS_ENVIRONMENT) $(abs_top_builddir)/tests/gpgscm/gpgscm \
+ $(TESTS_ENVIRONMENT) $(abs_top_builddir)/tests/gpgscm/gpgscm$(EXEEXT) \
$(abs_srcdir)/run-tests.scm $(TESTFLAGS) $(TESTS)
TEST_FILES = pubring.asc secring.asc plain-1o.asc plain-2o.asc plain-3o.asc \
@@ -209,7 +209,9 @@ priv_keys = privkeys/50B2D4FA4122C212611048BC5FC31BD44393626E.asc \
privkeys/1E28F20E41B54C2D1234D896096495FF57E08D18.asc \
privkeys/EB33B687EB8581AB64D04852A54453E85F3DF62D.asc \
privkeys/C6A6390E9388CDBAD71EAEA698233FE5E04F001E.asc \
- privkeys/D69102E0F5AC6B6DB8E4D16DA8E18CF46D88CAE3.asc
+ privkeys/D69102E0F5AC6B6DB8E4D16DA8E18CF46D88CAE3.asc \
+ privkeys/891067FFFC6D67D37BD4BFC399191C5F3989D1B5.key \
+ privkeys/F27FC04CB01723A4CB6F5399F7B86CCD82C0169C.key
sample_keys = samplekeys/README \
samplekeys/ecc-sample-1-pub.asc \
@@ -228,6 +230,7 @@ sample_keys = samplekeys/README \
samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc \
samplekeys/rsa-rsa-sample-1.asc \
samplekeys/ed25519-cv25519-sample-1.asc \
+ samplekeys/ed25519-cv25519-sample-2.asc \
samplekeys/silent-running.asc \
samplekeys/ssh-dsa.key \
samplekeys/ssh-ecdsa.key \
diff --git a/tests/openpgp/Makefile.in b/tests/openpgp/Makefile.in
index a911259..e2056b0 100644
--- a/tests/openpgp/Makefile.in
+++ b/tests/openpgp/Makefile.in
@@ -149,17 +149,16 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/autobuild.m4 \
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gettext.m4 \
$(top_srcdir)/m4/gpg-error.m4 $(top_srcdir)/m4/iconv.m4 \
- $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/ksba.m4 \
- $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/ldap.m4 \
- $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libassuan.m4 \
- $(top_srcdir)/m4/libgcrypt.m4 $(top_srcdir)/m4/nls.m4 \
- $(top_srcdir)/m4/npth.m4 $(top_srcdir)/m4/ntbtls.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \
- $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/readline.m4 \
- $(top_srcdir)/m4/socklen.m4 $(top_srcdir)/m4/sys_socket_h.m4 \
- $(top_srcdir)/m4/tar-ustar.m4 $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/ksba.m4 $(top_srcdir)/m4/lcmessage.m4 \
+ $(top_srcdir)/m4/ldap.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/libassuan.m4 $(top_srcdir)/m4/libgcrypt.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/npth.m4 \
+ $(top_srcdir)/m4/ntbtls.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/m4/readline.m4 $(top_srcdir)/m4/socklen.m4 \
+ $(top_srcdir)/m4/sys_socket_h.m4 $(top_srcdir)/m4/tar-ustar.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
@@ -560,7 +559,9 @@ priv_keys = privkeys/50B2D4FA4122C212611048BC5FC31BD44393626E.asc \
privkeys/1E28F20E41B54C2D1234D896096495FF57E08D18.asc \
privkeys/EB33B687EB8581AB64D04852A54453E85F3DF62D.asc \
privkeys/C6A6390E9388CDBAD71EAEA698233FE5E04F001E.asc \
- privkeys/D69102E0F5AC6B6DB8E4D16DA8E18CF46D88CAE3.asc
+ privkeys/D69102E0F5AC6B6DB8E4D16DA8E18CF46D88CAE3.asc \
+ privkeys/891067FFFC6D67D37BD4BFC399191C5F3989D1B5.key \
+ privkeys/F27FC04CB01723A4CB6F5399F7B86CCD82C0169C.key
sample_keys = samplekeys/README \
samplekeys/ecc-sample-1-pub.asc \
@@ -579,6 +580,7 @@ sample_keys = samplekeys/README \
samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc \
samplekeys/rsa-rsa-sample-1.asc \
samplekeys/ed25519-cv25519-sample-1.asc \
+ samplekeys/ed25519-cv25519-sample-2.asc \
samplekeys/silent-running.asc \
samplekeys/ssh-dsa.key \
samplekeys/ssh-ecdsa.key \
@@ -925,7 +927,7 @@ check: xcheck
.PHONY: xcheck
xcheck:
- $(TESTS_ENVIRONMENT) $(abs_top_builddir)/tests/gpgscm/gpgscm \
+ $(TESTS_ENVIRONMENT) $(abs_top_builddir)/tests/gpgscm/gpgscm$(EXEEXT) \
$(abs_srcdir)/run-tests.scm $(TESTFLAGS) $(TESTS)
clean-local:
diff --git a/tests/openpgp/all-tests.scm b/tests/openpgp/all-tests.scm
index d687fe4..7d36d8d 100644
--- a/tests/openpgp/all-tests.scm
+++ b/tests/openpgp/all-tests.scm
@@ -30,6 +30,7 @@
(make-environment-cache
(test::scm
#f
+ #f
(path-join "tests" "openpgp" "setup.scm")
(in-srcdir "tests" "openpgp" "setup.scm"))))
@@ -40,7 +41,8 @@
(make-environment-cache
(test::scm
#f
- (qualify (path-join "tests" "openpgp" "setup.scm") variant)
+ variant
+ (path-join "tests" "openpgp" "setup.scm")
(in-srcdir "tests" "openpgp" "setup.scm")
(string-append "--" variant))))
@@ -55,6 +57,7 @@
(define tests
(map (lambda (name)
(test::scm setup
+ #f
(path-join "tests" "openpgp" name)
(in-srcdir "tests" "openpgp" name))) all-tests))
@@ -64,14 +67,14 @@
tests
(map (lambda (name)
(test::scm setup-use-keyring
- (qualify (path-join "tests" "openpgp" name)
- "use-keyring")
+ "use-keyring"
+ (path-join "tests" "openpgp" name)
(in-srcdir "tests" "openpgp" name)
"--use-keyring")) all-tests)
(map (lambda (name)
(test::scm setup-extended-key-format
- (qualify (path-join "tests" "openpgp" name)
- "extended-key-format")
+ "extended-key-format"
+ (path-join "tests" "openpgp" name)
(in-srcdir "tests" "openpgp" name)
"--extended-key-format")) all-tests))))
diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index b864005..8e0631e 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -215,6 +215,9 @@
(define (tr:gpg input args)
(tr:spawn input `(,@GPG --output **out** ,@args **in**)))
+(define (tr:gpgstatus input args)
+ (tr:spawn input `(,@GPG --output dummy --status-file **out** ,@args **in**)))
+
(define (pipe:gpg args)
(pipe:spawn `(,@GPG --output - ,@args -)))
@@ -410,6 +413,13 @@
"EB33B687EB8581AB64D04852A54453E85F3DF62D"
"C6A6390E9388CDBAD71EAEA698233FE5E04F001E"
"D69102E0F5AC6B6DB8E4D16DA8E18CF46D88CAE3"))
+ (for-each
+ (lambda (name)
+ (file-copy (in-srcdir "tests" "openpgp" "privkeys"
+ (string-append name ".key"))
+ (string-append "private-keys-v1.d/" name ".key")))
+ '("891067FFFC6D67D37BD4BFC399191C5F3989D1B5"
+ "F27FC04CB01723A4CB6F5399F7B86CCD82C0169C"))
(log "Importing public demo and test keys")
(for-each
diff --git a/tests/openpgp/encrypt.scm b/tests/openpgp/encrypt.scm
index f59a1f0..ef2f7b0 100755
--- a/tests/openpgp/encrypt.scm
+++ b/tests/openpgp/encrypt.scm
@@ -59,3 +59,68 @@
(tr:gpg "" '(--yes --decrypt))
(tr:assert-identity source)))
plain-files)
+
+
+(info "Importing additional sample keys for OCB tests")
+(for-each
+ (lambda (name)
+ (call `(,@GPG --yes --import ,(in-srcdir "tests" "openpgp" "samplekeys"
+ (string-append name ".asc")))))
+ '("ed25519-cv25519-sample-1"
+ "ed25519-cv25519-sample-2"
+ "rsa-rsa-sample-1"))
+
+(for-each-p
+ "Checking OCB mode"
+ (lambda (source)
+ (tr:do
+ (tr:open source)
+ (tr:gpg "" `(--yes -er ,"patrice.lumumba"))
+ (tr:gpg "" '(--yes -d))
+ (tr:assert-identity source)))
+ all-files)
+
+;; For reference:
+;; BEGIN_ENCRYPTION <mdc_method> <sym_algo> [<aead_algo>]
+
+(for-each-p
+ "Checking two OCB capable keys"
+ (lambda (source)
+ (tr:do
+ (tr:open source)
+ (tr:gpgstatus "" `(--yes -e
+ -r ,"patrice.lumumba"
+ -r ,"mahsa.amini"))
+ (tr:call-with-content
+ (lambda (c)
+ (unless (string-contains? c "[GNUPG:] BEGIN_ENCRYPTION 0 9 2")
+ (fail (string-append "Unexpected status: " c)))))))
+ '("plain-1"))
+
+(for-each-p
+ "Checking two OCB capable keys plus one not capable"
+ (lambda (source)
+ (tr:do
+ (tr:open source)
+ (tr:gpgstatus "" `(--yes -o out -e
+ -r ,"patrice.lumumba"
+ -r ,"mahsa.amini"
+ -r ,"steve.biko"))
+ (tr:call-with-content
+ (lambda (c)
+ (unless (string-contains? c "[GNUPG:] BEGIN_ENCRYPTION 2 9")
+ (fail (string-append "Unexpected status: " c)))))))
+ '("plain-1"))
+
+(for-each-p
+ "Checking non OCB capable key with --force-ocb"
+ (lambda (source)
+ (tr:do
+ (tr:open source)
+ (tr:gpgstatus "" `(--yes -e --force-ocb
+ -r ,"steve.biko"))
+ (tr:call-with-content
+ (lambda (c)
+ (unless (string-contains? c "[GNUPG:] BEGIN_ENCRYPTION 0 9 2")
+ (fail (string-append "Unexpected status: " c)))))))
+ '("plain-1"))
diff --git a/tests/openpgp/issue2941.scm b/tests/openpgp/issue2941.scm
index 8f625eb..306df6c 100755
--- a/tests/openpgp/issue2941.scm
+++ b/tests/openpgp/issue2941.scm
@@ -29,6 +29,6 @@
(for-each-p
"Checking invocation with invalid file descriptors (issue2941)."
(lambda (option)
- (check-failure `(,(string-append "--" option "=23") --sign gpg.conf)))
+ (check-failure `(,(string-append "--" option "=233") --sign gpg.conf)))
'("status-fd" "attribute-fd" "logger-fd"
"override-session-key-fd" "passphrase-fd" "command-fd"))
diff --git a/tests/openpgp/privkeys/891067FFFC6D67D37BD4BFC399191C5F3989D1B5.key b/tests/openpgp/privkeys/891067FFFC6D67D37BD4BFC399191C5F3989D1B5.key
new file mode 100644
index 0000000..3e805d4
--- /dev/null
+++ b/tests/openpgp/privkeys/891067FFFC6D67D37BD4BFC399191C5F3989D1B5.key
@@ -0,0 +1,5 @@
+Created: 20220916T120000
+Key: (private-key (ecc (curve Curve25519)(flags djb-tweak)(q
+ #409651F6DD19C8F562792274BCE044F8916609FBDA25EE3DFA21207DCE8CBA0C63#)
+ (d #778955D781825551C8B8025DF6A9D7A00613331DE35711F56C65676A98E565F8#)
+ ))
diff --git a/tests/openpgp/privkeys/F27FC04CB01723A4CB6F5399F7B86CCD82C0169C.key b/tests/openpgp/privkeys/F27FC04CB01723A4CB6F5399F7B86CCD82C0169C.key
new file mode 100644
index 0000000..5446438
--- /dev/null
+++ b/tests/openpgp/privkeys/F27FC04CB01723A4CB6F5399F7B86CCD82C0169C.key
@@ -0,0 +1,5 @@
+Created: 20220916T120000
+Key: (private-key (ecc (curve Ed25519)(flags eddsa)(q
+ #403905D615CA9A98D674F1CC7AA8B5E9F948D7D2FB2E7536ED6027B014B1F948E6#)
+ (d #F1E5A1387736A9BD0976AA1FA1D217C3A75EC636605EA8EEAF3C84A9C13E01B4#)
+ ))
diff --git a/tests/openpgp/run-tests.scm b/tests/openpgp/run-tests.scm
index d4914bd..2643310 100644
--- a/tests/openpgp/run-tests.scm
+++ b/tests/openpgp/run-tests.scm
@@ -29,6 +29,7 @@
(define setup
(make-environment-cache (test::scm
#f
+ #f
(path-join "tests" "openpgp" "setup.scm")
(in-srcdir "tests" "openpgp" "setup.scm"))))
@@ -38,5 +39,6 @@
(load-tests "tests" "openpgp")
(map (lambda (name)
(test::scm setup
+ #f
(path-join "tests" "openpgp" name)
(in-srcdir "tests" "openpgp" name))) tests)))
diff --git a/tests/openpgp/samplekeys/README b/tests/openpgp/samplekeys/README
index f8a7e9e..f850ccf 100644
--- a/tests/openpgp/samplekeys/README
+++ b/tests/openpgp/samplekeys/README
@@ -17,6 +17,7 @@ E657FB607BB4F21C90BB6651BC067AF28BC90111.asc Key with subkeys (no protection)
pgp-desktop-skr.asc Secret key with subkeys w/o signatures
rsa-rsa-sample-1.asc RSA+RSA sample key (no passphrase)
ed25519-cv25519-sample-1.asc Ed25519+CV25519 sample key (no passphrase)
+ed25519-cv25519-sample-2.asc Ed25519+CV25519 sample key (no passphrase)
silent-running.asc Collection of sample secret keys (no passphrases)
rsa-primary-auth-only.pub.asc rsa2408 primary only, usage: cert,auth
rsa-primary-auth-only.sec.asc Ditto but the secret keyblock.
diff --git a/tests/openpgp/samplekeys/ed25519-cv25519-sample-1.asc b/tests/openpgp/samplekeys/ed25519-cv25519-sample-1.asc
index 54d2044..53e2440 100644
--- a/tests/openpgp/samplekeys/ed25519-cv25519-sample-1.asc
+++ b/tests/openpgp/samplekeys/ed25519-cv25519-sample-1.asc
@@ -1,21 +1,21 @@
pub ed25519 2016-06-22 [SC]
B21DEAB4F875FB3DA42F1D1D139563682A020D0A
Keygrip = 1E28F20E41B54C2D1234D896096495FF57E08D18
-uid [ unknown] patrice.lumumba@example.net
+uid patrice.lumumba@example.net
sub cv25519 2016-06-22 [E]
8D0221D9B2877A741D69AC4E9185878E4FCD74C0
Keygrip = EB33B687EB8581AB64D04852A54453E85F3DF62D
-----BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v2
mDMEV2o9XRYJKwYBBAHaRw8BAQdAZ8zkuQDL9x7rcvvoo6s3iEF1j88Dknd9nZhL
-nTEoBRm0G3BhdHJpY2UubHVtdW1iYUBleGFtcGxlLm5ldIh5BBMWCAAhBQJXaj1d
-AhsDBQsJCAcCBhUICQoLAgQWAgMBAh4BAheAAAoJEBOVY2gqAg0KmQ0BAMUNzAlT
-OzG7tolSI92lhePi5VqutdqTEQTyYYWi1aEsAP0YfiuosNggTc0oRTSz46S3i0Qj
-AlpXwfU00888yIreDbg4BFdqPY0SCisGAQQBl1UBBQEBB0AWeeZlz31O4qTmIKr3
-CZhlRUXZFxc3YKyoCXyIZBBRawMBCAeIYQQYFggACQUCV2o9jQIbDAAKCRATlWNo
-KgINCsuFAP9BplWl813pi779V8OMsRGs/ynyihnOESft/H8qlM8PDQEAqIUPpIty
-OX/OBFy2RIlIi7J1bTp9RzcbzQ/4Fk4hWQQ=
-=qRfF
+nTEoBRm0G3BhdHJpY2UubHVtdW1iYUBleGFtcGxlLm5ldIiTBBMWCAA7AhsDAheA
+FiEEsh3qtPh1+z2kLx0dE5VjaCoCDQoFAmNkyZ0FCwkIBwICIgIGFQgJCgsCBBYC
+AwECHgcACgkQE5VjaCoCDQoKxwEAyVSPe4kwcvjlL9iZYftqwmCQpL6Sd7smgBdb
+naqvAEMA/RrGBjSTGzTvFMVlIcT0Jr1uPVHig7twPnpzbL1uWUwLuDgEV2o9jRIK
+KwYBBAGXVQEFAQEHQBZ55mXPfU7ipOYgqvcJmGVFRdkXFzdgrKgJfIhkEFFrAwEI
+B4hhBBgWCAAJBQJXaj2NAhsMAAoJEBOVY2gqAg0Ky4UA/0GmVaXzXemLvv1Xw4yx
+Eaz/KfKKGc4RJ+38fyqUzw8NAQCohQ+ki3I5f84EXLZEiUiLsnVtOn1HNxvND/gW
+TiFZBA==
+=u4Iu
-----END PGP PUBLIC KEY BLOCK-----
diff --git a/tests/openpgp/samplekeys/ed25519-cv25519-sample-2.asc b/tests/openpgp/samplekeys/ed25519-cv25519-sample-2.asc
new file mode 100644
index 0000000..2e72851
--- /dev/null
+++ b/tests/openpgp/samplekeys/ed25519-cv25519-sample-2.asc
@@ -0,0 +1,21 @@
+pub ed25519 2022-09-16 [SC]
+ 5F1438D784C8C68400645518AE08687BF38AFFF3
+ Keygrip = F27FC04CB01723A4CB6F5399F7B86CCD82C0169C
+uid mahsa.amini@example.net
+sub cv25519 2022-09-16 [E]
+ FFE7440568492D986F3B88BD9E64CB003A8D6449
+ Keygrip = 891067FFFC6D67D37BD4BFC399191C5F3989D1B5
+
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+
+mDMEYyRlQBYJKwYBBAHaRw8BAQdAOQXWFcqamNZ08cx6qLXp+UjX0vsudTbtYCew
+FLH5SOa0F21haHNhLmFtaW5pQGV4YW1wbGUubmV0iJMEExYKADsWIQRfFDjXhMjG
+hABkVRiuCGh784r/8wUCYyRlQAIbAwULCQgHAgIiAgYVCgkICwIEFgIDAQIeBwIX
+gAAKCRCuCGh784r/8wYzAQDTikkZd/G/o1DtfGq/k0R9ctcZCD9vHKH3PNj2atfX
+cwEAt5zFYyEe2OPzJ5HYffOPhcyK2kPsvkerLfdXy/K8QAe4OARjJGVAEgorBgEE
+AZdVAQUBAQdAllH23RnI9WJ5InS84ET4kWYJ+9ol7j36ISB9zoy6DGMDAQgHiHgE
+GBYKACAWIQRfFDjXhMjGhABkVRiuCGh784r/8wUCYyRlQAIbDAAKCRCuCGh784r/
+89lTAQDpupXGKLSlga2qHgtaud47oU5edY48MZ7CBnFByi5IAQEA2nJpUsVuaQl2
+XSURaPTUi0C98ny61kwGcVtOcTFpPgY=
+=r11D
+-----END PGP PUBLIC KEY BLOCK-----