mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
crypto: Make block callbacks return 0 on success
They currently return the value of their headerlen/buflen parameter on success. Returning 0 instead makes it clear that short reads/writes are not possible. Signed-off-by: Alberto Faria <afaria@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20220609152744.3891847-5-afaria@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
This commit is contained in:
parent
353a5d84b2
commit
757dda54b4
6 changed files with 79 additions and 79 deletions
|
@ -495,7 +495,7 @@ qcrypto_block_luks_load_header(QCryptoBlock *block,
|
|||
void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
ssize_t rv;
|
||||
int rv;
|
||||
size_t i;
|
||||
QCryptoBlockLUKS *luks = block->opaque;
|
||||
|
||||
|
@ -856,7 +856,7 @@ qcrypto_block_luks_store_key(QCryptoBlock *block,
|
|||
QCRYPTO_BLOCK_LUKS_SECTOR_SIZE,
|
||||
splitkey, splitkeylen,
|
||||
opaque,
|
||||
errp) != splitkeylen) {
|
||||
errp) < 0) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -903,7 +903,7 @@ qcrypto_block_luks_load_key(QCryptoBlock *block,
|
|||
g_autofree uint8_t *splitkey = NULL;
|
||||
size_t splitkeylen;
|
||||
g_autofree uint8_t *possiblekey = NULL;
|
||||
ssize_t rv;
|
||||
int rv;
|
||||
g_autoptr(QCryptoCipher) cipher = NULL;
|
||||
uint8_t keydigest[QCRYPTO_BLOCK_LUKS_DIGEST_LEN];
|
||||
g_autoptr(QCryptoIVGen) ivgen = NULL;
|
||||
|
@ -1193,7 +1193,7 @@ qcrypto_block_luks_erase_key(QCryptoBlock *block,
|
|||
garbagesplitkey,
|
||||
splitkeylen,
|
||||
opaque,
|
||||
&local_err) != splitkeylen) {
|
||||
&local_err) < 0) {
|
||||
error_propagate(errp, local_err);
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue