]> git.e2factory.org Git - e2factory.git/commitdiff
digest: allow writing SHA256 digests
authorTobias Ulmer <tu@emlix.com>
Fri, 10 Mar 2017 19:13:58 +0000 (20:13 +0100)
committerTobias Ulmer <tu@emlix.com>
Wed, 25 Apr 2018 15:36:18 +0000 (17:36 +0200)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
local/digest.lua

index 81ecbaf5df0439bf92e3f8c43a57e86f5cd86b75..be4a63721719febea04a3a8f9dc139474a3b4ce3 100644 (file)
@@ -537,7 +537,8 @@ function digest.sanity_check(dt)
             digest_type = entry.digest
         end
 
-        if entry.digest ~= digest.MD5 and entry.digest ~= digest.SHA1 then
+        if not (entry.digest == digest.MD5 or entry.digest == digest.SHA1
+            or entry.digest == digest.SHA256) then
             return false,
                 err.new("digest entry %d has unknown digest type", pos)
         end
@@ -548,7 +549,10 @@ function digest.sanity_check(dt)
         end
 
         local len = string.len(entry.checksum)
-        if len ~= digest.MD5_LEN and len ~= digest.SHA1_LEN then
+        if not (
+            (entry.digest == digest.MD5 and len == digest.MD5_LEN) or
+            (entry.digest == digest.SHA1 and len == digest.SHA1_LEN) or
+            (entry.digest == digest.SHA256 and len == digest.SHA256_LEN)) then
             return false, err.new("digest entry %d has unknown checksum "..
                 "length (%d)", pos, len)
         end