[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH 2/2] v2v: ova: support SHA256 hashes in manifest

On Thursday, 29 September 2016 14:59:31 CEST Tomáš Golembiovský wrote:
> The OVF standard allows the use of SHA256 hashes in the manifest file.
> Adding support for this.
> Signed-off-by: Tomáš Golembiovský <tgolembi redhat com>
> ---

Maybe it would be a better idea to move the Checksums module from
virt-builder to e.g. mllib, making it slightly more generic in error
reporting, add SHA1 support to it, and use it in this case as well.

>  v2v/input_ova.ml | 21 ++++++++++++---------
>  1 file changed, 12 insertions(+), 9 deletions(-)
> diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
> index 513fe30..5420c85 100644
> --- a/v2v/input_ova.ml
> +++ b/v2v/input_ova.ml
> @@ -133,7 +133,7 @@ object
>      (* Read any .mf (manifest) files and verify sha1. *)
>      let mf = find_files exploded ".mf" in
> -    let rex = Str.regexp "SHA1(\\(.*\\))= \\([0-9a-fA-F]+\\)\r?" in
> +    let rex = Str.regexp "SHA\\(1\\|256\\)(\\(.*\\))= \\([0-9a-fA-F]+\\)\r?" in

For example, with the above suggestion, catching the whole checksum
type in regex and passing it to a new Checksums.from_string function
could allow to support any checksum type that Checksums knows about.

Pino Toscano

Attachment: signature.asc
Description: This is a digitally signed message part.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]