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

Pino Toscano ptoscano at redhat.com
Thu Sep 29 13:56:36 UTC 2016


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 at 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.

Thanks,
-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20160929/94f6f772/attachment.sig>


More information about the Libguestfs mailing list