crypto.c (d8d5fefd8657d4f7b380b3a1533340434b5b9def) | crypto.c (1bf6e9ca9234e1dbcaa18baa06eca9d55cc2dbbb) |
---|---|
1/* 2 * QEMU block full disk encryption 3 * 4 * Copyright (c) 2015-2016 Red Hat, Inc. 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either --- 580 unchanged lines hidden (view full) --- 589 590 bdi->unallocated_blocks_are_zero = false; 591 bdi->cluster_size = subbdi.cluster_size; 592 593 return 0; 594} 595 596static ImageInfoSpecific * | 1/* 2 * QEMU block full disk encryption 3 * 4 * Copyright (c) 2015-2016 Red Hat, Inc. 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either --- 580 unchanged lines hidden (view full) --- 589 590 bdi->unallocated_blocks_are_zero = false; 591 bdi->cluster_size = subbdi.cluster_size; 592 593 return 0; 594} 595 596static ImageInfoSpecific * |
597block_crypto_get_specific_info_luks(BlockDriverState *bs) | 597block_crypto_get_specific_info_luks(BlockDriverState *bs, Error **errp) |
598{ 599 BlockCrypto *crypto = bs->opaque; 600 ImageInfoSpecific *spec_info; 601 QCryptoBlockInfo *info; 602 | 598{ 599 BlockCrypto *crypto = bs->opaque; 600 ImageInfoSpecific *spec_info; 601 QCryptoBlockInfo *info; 602 |
603 info = qcrypto_block_get_info(crypto->block, NULL); | 603 info = qcrypto_block_get_info(crypto->block, errp); |
604 if (!info) { 605 return NULL; 606 } | 604 if (!info) { 605 return NULL; 606 } |
607 if (info->format != Q_CRYPTO_BLOCK_FORMAT_LUKS) { 608 qapi_free_QCryptoBlockInfo(info); 609 return NULL; 610 } | 607 assert(info->format == Q_CRYPTO_BLOCK_FORMAT_LUKS); |
611 612 spec_info = g_new(ImageInfoSpecific, 1); 613 spec_info->type = IMAGE_INFO_SPECIFIC_KIND_LUKS; 614 spec_info->u.luks.data = g_new(QCryptoBlockInfoLUKS, 1); 615 *spec_info->u.luks.data = info->u.luks; 616 617 /* Blank out pointers we've just stolen to avoid double free */ 618 memset(&info->u.luks, 0, sizeof(info->u.luks)); --- 35 unchanged lines hidden --- | 608 609 spec_info = g_new(ImageInfoSpecific, 1); 610 spec_info->type = IMAGE_INFO_SPECIFIC_KIND_LUKS; 611 spec_info->u.luks.data = g_new(QCryptoBlockInfoLUKS, 1); 612 *spec_info->u.luks.data = info->u.luks; 613 614 /* Blank out pointers we've just stolen to avoid double free */ 615 memset(&info->u.luks, 0, sizeof(info->u.luks)); --- 35 unchanged lines hidden --- |