On Thu, Aug 20, 2009 at 08:18:11PM +0200, Miloslav Trma?? wrote:
(The implementation is not very generic, but that can be very
easily rectified if/when new encryption formats appear.)
---
src/storage_backend_fs.c | 61 +++++++++++++++++++++++++++++++++++----------
1 files changed, 47 insertions(+), 14 deletions(-)
@@ -375,6 +384,16 @@ static int virStorageBackendProbeTarget(virConnectPtr conn,
*capacity *= fileTypeInfo[i].sizeMultiplier;
}
+ if (fileTypeInfo[i].qcowCryptOffset != -1) {
+ int crypt_format;
+
+ crypt_format = (head[fileTypeInfo[i].qcowCryptOffset] << 24) |
+ (head[fileTypeInfo[i].qcowCryptOffset+1] << 16) |
+ (head[fileTypeInfo[i].qcowCryptOffset+2] << 8) |
+ head[fileTypeInfo[i].qcowCryptOffset+3];
+ encrypted_qcow = crypt_format != 0;
+ }
I was going to suggest that we check 'crypt_format' == 1, since
that indicates AES, but that seems needlessly strict - our code
would almost certainly work for any other encryption algorithms
they added.
So, ACK to this patch
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|