[Pkg-gnupg-commit] [gnupg2] 03/124: tests: Log information about ssh, add comments to test.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Wed Apr 5 15:55:27 UTC 2017
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch experimental
in repository gnupg2.
commit 74cb3b230c1f99afc5fd09bccc24186a63b154b0
Author: Justus Winter <justus at g10code.com>
Date: Thu Mar 2 10:41:03 2017 +0100
tests: Log information about ssh, add comments to test.
* tests/openpgp/ssh-import.scm (ssh-version-string): New variable, and
log the binary and version used in the test.
(ssh-supports?): Document how we test what algorithms are supported by
ssh, and log ssh-keygen's replies.
--
We have some trouble with this test on macOS, and adding some more
information in verbose mode will hopefully make tracking down these
problems easier in the future.
GnuPG-bug-id: 2980
Signed-off-by: Justus Winter <justus at g10code.com>
---
tests/openpgp/ssh-import.scm | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/tests/openpgp/ssh-import.scm b/tests/openpgp/ssh-import.scm
index 7a4364c..d210056 100755
--- a/tests/openpgp/ssh-import.scm
+++ b/tests/openpgp/ssh-import.scm
@@ -36,8 +36,13 @@
(catch (skip "ssh-keygen not found")
(set! ssh-keygen (path-expand "ssh-keygen" path)))
+(define ssh-version-string
+ (:stderr (call-with-io `(,ssh "-V") "")))
+
+(log "Using" ssh "version:" ssh-version-string)
+
(define ssh-version
- (let ((tmp (:stderr (call-with-io `(,ssh "-V") "")))
+ (let ((tmp ssh-version-string)
(prefix "OpenSSH_"))
(unless (string-prefix? tmp prefix)
(skip "This doesn't look like OpenSSH:" tmp))
@@ -45,14 +50,22 @@
(+ 3 (string-length prefix))))))
(define (ssh-supports? algorithm)
+ ;; We exploit ssh-keygen as an oracle to test what algorithms ssh
+ ;; supports.
(cond
((equal? algorithm "ed25519")
+ ;; Unfortunately, our oracle does not work for ed25519 because
+ ;; this is a specific curve and not a family, so the key size
+ ;; parameter is ignored.
(>= ssh-version 6.5))
(else
- (not (string-contains? (:stderr (call-with-io `(,ssh-keygen
- -t ,algorithm
- -b "1009") ""))
- "unknown key type")))))
+ ;; We call ssh-keygen with the algorithm to test, specify an
+ ;; invalid key size, and observe the error message.
+ (let ((output (:stderr (call-with-io `(,ssh-keygen
+ -t ,algorithm
+ -b "1009") ""))))
+ (log "(ssh-supports?" algorithm "), ssh algorithm oracle replied:" output)
+ (not (string-contains? output "unknown key type"))))))
(define keys
'(("dsa" "9a:e1:f1:5f:46:ea:a5:06:e1:e2:f8:38:8e:06:54:58")
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git
More information about the Pkg-gnupg-commit
mailing list