From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 41xMHO3wcl/jAQAA0tVLHw (envelope-from ) for ; Tue, 29 Sep 2020 08:31:41 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id SI2VF+3wcl/hYgAAbx9fmQ (envelope-from ) for ; Tue, 29 Sep 2020 08:31:41 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C10509402A4 for ; Tue, 29 Sep 2020 08:31:40 +0000 (UTC) Received: from localhost ([::1]:35118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kNB2x-0006dT-Ki for larch@yhetil.org; Tue, 29 Sep 2020 04:31:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kNB1P-0005t8-5s for guix-patches@gnu.org; Tue, 29 Sep 2020 04:30:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43378) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kNB1O-0004vG-Pu for guix-patches@gnu.org; Tue, 29 Sep 2020 04:30:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kNB1O-0004QP-Lp for guix-patches@gnu.org; Tue, 29 Sep 2020 04:30:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43699] [PATCH] guix: Fix argument order of fxbit-set? Resent-From: Lars-Dominik Braun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 29 Sep 2020 08:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 43699 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43699@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.160136817216939 (code B ref -1); Tue, 29 Sep 2020 08:30:02 +0000 Received: (at submit) by debbugs.gnu.org; 29 Sep 2020 08:29:32 +0000 Received: from localhost ([127.0.0.1]:54924 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kNB0t-0004P9-N6 for submit@debbugs.gnu.org; Tue, 29 Sep 2020 04:29:32 -0400 Received: from lists.gnu.org ([209.51.188.17]:49146) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kNB0s-0004P1-AC for submit@debbugs.gnu.org; Tue, 29 Sep 2020 04:29:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kNB0s-0005IK-1l for guix-patches@gnu.org; Tue, 29 Sep 2020 04:29:30 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:36950) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kNB0p-0004mL-Sg for guix-patches@gnu.org; Tue, 29 Sep 2020 04:29:29 -0400 Received: by mail-wm1-x343.google.com with SMTP id a9so3870236wmm.2 for ; Tue, 29 Sep 2020 01:29:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leibniz-psychology-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=M3VdajoPivBZ2WRL8iUhksjAHNlTPd00SRQAm5a7T6Q=; b=HSYgKu4xLMKFv9s3lLKkZi1X7Lpme9P+4CajUGTOEFT2Eb00hsQZ4EigJt6oUntxoo 312BKp6JI5v3ValBOy24QiQhgxMb2BJ0fEXs1CH0PbUf0rpAkfn7s/XC0q78IaEzoT1R 5BXIneq+fTD/kDSF0RrcWTCzioQku3MdppCUVHO3dAvbxbMW7JWFSIj3BMuh7jtK9PtT 6muL7WFoTuWpS6M5Ie82iI9/L7mIFqY/3MI/JZ/OFQqjJfhHWJOL1ujqlI2NicX3AEPK pjSTS40I7+ns7AqyQS0iRYPU2YpbrOsHbUW1bQpA8pl3eq8rSeIzH111xfTR55+bh89d mNpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=M3VdajoPivBZ2WRL8iUhksjAHNlTPd00SRQAm5a7T6Q=; b=q8hkv+g1NOi/1aSTsjFmJuSsUWGZRf/9nybsS2DGRWfI+yI6pPVunySquTyXKMq9Oc JjZXOhUwt7IM6y0BgCMRc5j9ZfniYeOM/PmMhuK0Db00kEKiwXy/+7HjrrPByZdMrKtr 3DWlUPJUeI3AbunI6WYFhdOwq/LR48x1upCEHXgEZ/5Gaq2EFESyAFE0V8dlK/Jx5pCb csO+nDHRuREyGGdouZLrk0IIecZq+gIVfq9/DgOJ86iKWBbI4SKnx0uaYtWoaNhPATCi 1g23tgc7CoQmXqE+uiN6dFBF336m2OLxpxOn/+kxGIWTX2pIGH4zxstqtQnvVHjxOuRL AcPg== X-Gm-Message-State: AOAM530Ig0DaCxc213JhhyJJRtNigXTPH8lTSC1LLJraI6WUXBmIrFIv hXfhOrbv/ICxEU0f/arX48iXi93d2JKfQzVt/p9F9x0+LDJWN3zxEC/S5CfIpzg7pULbf6FnuL5 JSae1swqAC1yJeMHeCfufPn7JmLJsn/x4zOJKb/3SnaA4KIRcLn3gi3MUoz9XRy4Sj3vBl2a8PJ /CQ4pRyNgl0w== X-Google-Smtp-Source: ABdhPJwglxu+uO/qpSVWIzhLBucqakqIJgi1CrQv0GNW2Gjvd+FGDvSgkXs7kU9uqcfxUyHUFW+nJg== X-Received: by 2002:a7b:ca42:: with SMTP id m2mr3336179wml.145.1601368164781; Tue, 29 Sep 2020 01:29:24 -0700 (PDT) Received: from localhost (dynamic-2a01-0c22-c87d-b300-bcd8-0534-6f01-510b.c22.pool.telefonica.de. [2a01:c22:c87d:b300:bcd8:534:6f01:510b]) by smtp.gmail.com with ESMTPSA id p1sm12803899wma.0.2020.09.29.01.29.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 01:29:23 -0700 (PDT) Date: Tue, 29 Sep 2020 10:29:23 +0200 From: Lars-Dominik Braun Message-ID: <20200929082923.GA7294@zpidnp36> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="vtzGhvizbBRQ85DL" Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Received-SPF: none client-ip=2a00:1450:4864:20::343; envelope-from=ldb@leibniz-psychology.org; helo=mail-wm1-x343.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=leibniz-psychology-org.20150623.gappssmtp.com header.s=20150623 header.b=HSYgKu4x; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -0.61 X-TUID: tY7d9VYS3ieQ --vtzGhvizbBRQ85DL Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * guix/openpgp.scm (port-ascii-armored?): Fix it here=E2=80=A6 (get-packet*): =E2=80=A6and here=E2=80=A6 (parse-subpackets): =E2=80=A6and also here. * tests/openpgp.scm (%binary-sample): New test vector. ("port-ascii-armored?, #t"): Add test. ("port-ascii-armored?, #f"): Add another test. --- guix/openpgp.scm | 14 +++++++------- tests/openpgp.scm | 12 ++++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/guix/openpgp.scm b/guix/openpgp.scm index 33c851255b..f6c9f8ac78 100644 --- a/guix/openpgp.scm +++ b/guix/openpgp.scm @@ -239,7 +239,7 @@ writes to PORT the value 42 as an 8-bit integer and the= value #x7777 as a (let ((idx (fxarithmetic-shift-right i 3)) (bit (fxand i #b111))) (and (< idx (bytevector-length bv)) - (fxbit-set? (bytevector-u8-ref bv idx) bit)))) + (fxbit-set? bit (bytevector-u8-ref bv idx))))) (do ((names names (cdr names)) (i 0 (fx+ i 1)) (bits '() @@ -410,9 +410,9 @@ hexadecimal format for fingerprints." (define (port-ascii-armored? p) (let ((tag (lookahead-u8 p))) (cond ((eof-object? tag) #f) - ((not (fxbit-set? tag 7)) #t) + ((not (fxbit-set? 7 tag)) #t) (else - (let ((type (if (fxbit-set? tag 6) + (let ((type (if (fxbit-set? 6 tag) (fxbit-field tag 0 6) (fxbit-field tag 2 6)))) (not (<=3D PACKET-SESSION-KEY type PACKET-MDC))))))) @@ -444,7 +444,7 @@ hexadecimal format for fingerprints." (define (get-packet* p get-data) (let ((tag (get-u8 p))) ;; (unless (fxbit-set? tag 7) (error 'get-packet "Invalid tag" tag)) - (cond ((fxbit-set? tag 6) ;New packet format + (cond ((fxbit-set? 6 tag) ;New packet format (let ((tag (fxbit-field tag 0 6)) (len (get-v4-length p))) (get-data p tag len))) @@ -726,7 +726,7 @@ FINGERPRINT, a bytevector." (define (parse-subpackets bv signature-port) (define (parse tag data) (let ((type (fxbit-field tag 0 7)) - (critical? (fxbit-set? tag 7))) + (critical? (fxbit-set? 7 tag))) (cond ((=3D type SUBPACKET-SIGNATURE-CTIME) (cons 'signature-ctime @@ -764,7 +764,7 @@ FINGERPRINT, a bytevector." (value (get-bytevector-n p vlen))) (cons 'notation-data (list (utf8->string name) - (if (fxbit-set? f1 7) + (if (fxbit-set? 7 f1) (utf8->string value) value))))))) ((=3D type SUBPACKET-PREFERRED-HASH-ALGORITHMS) @@ -777,7 +777,7 @@ FINGERPRINT, a bytevector." ((=3D type SUBPACKET-KEY-SERVER-PREFERENCES) (cons 'key-server-preferences (if (and (>=3D (bytevector-length data) 1) - (fxbit-set? (bytevector-u8-ref data 0) 7)) + (fxbit-set? 7 (bytevector-u8-ref data 0))) (list 'no-modify) (list)))) ((=3D type SUBPACKET-PREFERRED-KEY-SERVER) diff --git a/tests/openpgp.scm b/tests/openpgp.scm index 0beab6f88b..c2be26fa49 100644 --- a/tests/openpgp.scm +++ b/tests/openpgp.scm @@ -50,6 +50,12 @@ vBSFjNSiVHsuAA=3D=3D =3DAAAA -----END PGP MESSAGE-----\n") =20 +(define %binary-sample + ;; Same message as %radix-64-sample, decoded into bytevector. + (base16-string->bytevector + "c838013b6d96c411efecef17ecefe3ca0004ce8979ea250a897995f979a9\ +0ad9a9a9050a890ac5a9c945a940c1a2fcd2bc14858cd4a2547b2e00")) + (define %civodul-fingerprint "3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5") =20 @@ -155,6 +161,12 @@ Pz7oopeN72xgggYUNT37ezqN3MeCqw0=3D read-radix-64)) list)) =20 +(test-assert "port-ascii-armored?, #t" + (call-with-input-string %radix-64-sample port-ascii-armored?)) + +(test-assert "port-ascii-armored?, #f" + (not (port-ascii-armored? (open-bytevector-input-port %binary-sample)))) + (test-assert "get-openpgp-keyring" (let* ((key (search-path %load-path "tests/civodul.key")) (keyring (get-openpgp-keyring --=20 2.26.2 --vtzGhvizbBRQ85DL Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEyk+M9DfXR4/aBV/UQhN3ARo3hEYFAl9y8GAACgkQQhN3ARo3 hEatvgwAiONOjd/cVr5mG6ADfDI+yMKyzsIMa8yZII6U161e7ShRuYwiy/h0Vpmv 008FDUBPOt74Ckszh4bz5NkWwgXlGuhatHgDjkNV6OKNBlWDHhlM1dVeWKhVcA7i Glrx6sJNx+zqDx++cZvE5EhP4pVRZtboB6mG0tfGpGJvPnbgkG9rTTcMgp55CH+x 2i90sMywKVhajlr0vY2gyp4zoHc/4l1kFm8pD8FtrRCIR1eve1m7S2DrybFTbOg1 8Wlj7ZUWzj7fzL5kIuJpIqUh2SGbTCGFa2iANB2/B9aPvE4HCtSbyBTSTmUxQoFI nxL/y4VpNgDG3M4AQN63DfjK9VBdVE87ogXVQIvVm5PErLz6gNszYSwSFJ6qqQlt WHoXYMI86HXPph/TdMEbcmIjj1k54qj+zdc3SjUOJQ2Ndw+3/GAfts/L7cefuj6h WWdFiK81euhcqKT5dO96KMG/2a6Z4o6Mfyfba98EWeI3y8OucR+pWWtVhJxGl2oB MoMD3HFP =M725 -----END PGP SIGNATURE----- --vtzGhvizbBRQ85DL--