public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: "Peter Müller" <peter.mueller@link38.eu>
To: development@lists.ipfire.org
Subject: [PATCH] use SHA256 for image checksums
Date: Fri, 14 Sep 2018 17:10:15 +0200	[thread overview]
Message-ID: <20180914151015.5605-1-peter.mueller@link38.eu> (raw)

[-- Attachment #1: Type: text/plain, Size: 961 bytes --]

SHA1 is legacy crypto and known to be weak (collision attacks). Thereof,
SHA256 is used instead to provide strong checksums for verifying our
release images.

Partially fixes: #11345

Signed-off-by: Peter Müller <peter.mueller(a)link38.eu>
---
 webapp/backend/releases.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/webapp/backend/releases.py b/webapp/backend/releases.py
index 79e3468..fa63a44 100644
--- a/webapp/backend/releases.py
+++ b/webapp/backend/releases.py
@@ -279,16 +279,16 @@ class Release(Object):
 				return file
 
 	def __file_hash(self, filename):
-		sha1 = hashlib.sha1()
+		sha256 = hashlib.sha256()
 
 		with open(filename) as f:
 			buf_size = 1024
 			buf = f.read(buf_size)
 			while buf:
-				sha1.update(buf)
+				sha256.update(buf)
 				buf = f.read(buf_size)
 
-		return sha1.hexdigest()
+		return sha256.hexdigest()
 
 	def scan_files(self, basepath="/srv/mirror0"):
 		if not self.path:
-- 
2.16.4


                 reply	other threads:[~2018-09-14 15:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180914151015.5605-1-peter.mueller@link38.eu \
    --to=peter.mueller@link38.eu \
    --cc=development@lists.ipfire.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