[Libguestfs] [PATCH 03/10] builder: add SHA256 support in Checksums

Pino Toscano
Tue, 28 Jul 2015 09:24:43 -0000

---
 builder/checksums.ml  | 4 ++++
 builder/checksums.mli | 1 +
 2 files changed, 5 insertions(+)

diff --git a/builder/checksums.ml b/builder/checksums.ml
index 73d541f..25b3328 100644
--- a/builder/checksums.ml
+++ b/builder/checksums.ml
@@ -24,17 +24,21 @@ open Utils
 open Printf

 type csum_t +| SHA256 of string
 | SHA512 of string

 let string_of_csum_t = function
+  | SHA256 _ -> "sha256"
   | SHA512 _ -> "sha512"

 let string_of_csum = function
+  | SHA256 c -> c
   | SHA512 c -> c

 let verify_checksum csum filename    let prog, csum_ref      match csum with
+    | SHA256 c -> "sha256sum", c
     | SHA512 c -> "sha512sum", c
   in

diff --git a/builder/checksums.mli b/builder/checksums.mli
index 6833879..4dc9dc0 100644
--- a/builder/checksums.mli
+++ b/builder/checksums.mli
@@ -17,6 +17,7 @@
  *)

 type csum_t +| SHA256 of string
 | SHA512 of string

 val verify_checksum : csum_t -> string -> unit
--
2.1.0