Signatures Archive mirror
 help / color / mirror / Atom feed
From: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
To: signatures@kernel.org
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Subject: [PATCH 4/4] Fix in-header attestation code
Date: Fri, 20 Nov 2020 16:27:31 -0500	[thread overview]
Message-ID: <20201120212731.1645654-5-konstantin@linuxfoundation.org> (raw)
In-Reply-To: <20201120212731.1645654-1-konstantin@linuxfoundation.org>

We've moved some constant declarations around, so fix the code to look
for them in the right places.

Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
---
 b4/attest.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/b4/attest.py b/b4/attest.py
index a4012d7..1b464d0 100644
--- a/b4/attest.py
+++ b/b4/attest.py
@@ -19,12 +19,12 @@ logger = b4.logger
 
 
 def in_header_attest(lmsg: b4.LoreMessage, mode: str = 'pgp', replace: bool = False) -> None:
-    if lmsg.msg.get(lmsg.attestation.hashes_header_name):
+    if lmsg.msg.get(b4.HDR_PATCH_HASHES):
         if not replace:
             logger.info(' attest: message already attested')
             return
-        del lmsg.msg[lmsg.attestation.hashes_header_name]
-        del lmsg.msg[lmsg.attestation.sig_header_name]
+        del lmsg.msg[b4.HDR_PATCH_HASHES]
+        del lmsg.msg[b4.HDR_PATCH_SIG]
 
     logger.info(' attest: generating attestation hashes')
     if not lmsg.attestation:
@@ -39,7 +39,7 @@ def in_header_attest(lmsg: b4.LoreMessage, mode: str = 'pgp', replace: bool = Fa
         f'm={lmsg.attestation.mb}',
         f'p={lmsg.attestation.pb}',
     ]
-    hhname, hhval = b4.dkim_canonicalize_header(lmsg.attestation.hashes_header_name, '; '.join(hparts))
+    hhname, hhval = b4.dkim_canonicalize_header(b4.HDR_PATCH_HASHES, '; '.join(hparts))
     headers.append(f'{hhname}:{hhval}')
 
     logger.debug('Signing with mode=%s', mode)
@@ -59,7 +59,7 @@ def in_header_attest(lmsg: b4.LoreMessage, mode: str = 'pgp', replace: bool = Fa
             'b=',
         ]
 
-        shname, shval = b4.dkim_canonicalize_header(lmsg.attestation.sig_header_name, '; '.join(hparts))
+        shname, shval = b4.dkim_canonicalize_header(b4.HDR_PATCH_SIG, '; '.join(hparts))
         headers.append(f'{shname}:{shval}')
         payload = '\r\n'.join(headers).encode()
         ecode, out, err = b4.gpg_run_command(gpgargs, payload)
@@ -74,8 +74,8 @@ def in_header_attest(lmsg: b4.LoreMessage, mode: str = 'pgp', replace: bool = Fa
 
     hhdr = email.header.make_header([(hhval.encode(), 'us-ascii')], maxlinelen=78)
     shdr = email.header.make_header([(shval.encode(), 'us-ascii')], maxlinelen=78)
-    lmsg.msg[lmsg.attestation.hashes_header_name] = hhdr
-    lmsg.msg[lmsg.attestation.sig_header_name] = shdr
+    lmsg.msg[b4.HDR_PATCH_HASHES] = hhdr
+    lmsg.msg[b4.HDR_PATCH_SIG] = shdr
 
 
 def header_splitter(longstr: str, limit: int = 77) -> str:
-- 
2.26.2



      parent reply	other threads:[~2020-11-20 21:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20 21:27 [PATCH 0/4] b4: Initial DKIM attestation implementation Konstantin Ryabitsev
2020-11-20 21:27 ` [PATCH 1/4] Add initial support for DKIM attestation Konstantin Ryabitsev
2020-11-20 21:27 ` [PATCH 2/4] Add very simple dkim key caching Konstantin Ryabitsev
2020-11-20 21:27 ` [PATCH 3/4] Fix signature verification for b4 pr Konstantin Ryabitsev
2020-11-20 21:27 ` Konstantin Ryabitsev [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201120212731.1645654-5-konstantin@linuxfoundation.org \
    --to=konstantin@linuxfoundation.org \
    --cc=signatures@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).