crypto.c (32cc71def9e3885f9527af713e6d8dc7521ddc08) | crypto.c (353a5d84b25c335b259f37c4f43dad96e6d60ba8) |
---|---|
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 --- 56 unchanged lines hidden (view full) --- 65 BlockDriverState *bs = opaque; 66 ssize_t ret; 67 68 ret = bdrv_pread(bs->file, offset, buflen, buf, 0); 69 if (ret < 0) { 70 error_setg_errno(errp, -ret, "Could not read encryption header"); 71 return ret; 72 } | 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 --- 56 unchanged lines hidden (view full) --- 65 BlockDriverState *bs = opaque; 66 ssize_t ret; 67 68 ret = bdrv_pread(bs->file, offset, buflen, buf, 0); 69 if (ret < 0) { 70 error_setg_errno(errp, -ret, "Could not read encryption header"); 71 return ret; 72 } |
73 return ret; | 73 return buflen; |
74} 75 76static ssize_t block_crypto_write_func(QCryptoBlock *block, 77 size_t offset, 78 const uint8_t *buf, 79 size_t buflen, 80 void *opaque, 81 Error **errp) 82{ 83 BlockDriverState *bs = opaque; 84 ssize_t ret; 85 86 ret = bdrv_pwrite(bs->file, offset, buflen, buf, 0); 87 if (ret < 0) { 88 error_setg_errno(errp, -ret, "Could not write encryption header"); 89 return ret; 90 } | 74} 75 76static ssize_t block_crypto_write_func(QCryptoBlock *block, 77 size_t offset, 78 const uint8_t *buf, 79 size_t buflen, 80 void *opaque, 81 Error **errp) 82{ 83 BlockDriverState *bs = opaque; 84 ssize_t ret; 85 86 ret = bdrv_pwrite(bs->file, offset, buflen, buf, 0); 87 if (ret < 0) { 88 error_setg_errno(errp, -ret, "Could not write encryption header"); 89 return ret; 90 } |
91 return ret; | 91 return buflen; |
92} 93 94 95struct BlockCryptoCreateData { 96 BlockBackend *blk; 97 uint64_t size; 98 PreallocMode prealloc; 99}; --- 875 unchanged lines hidden --- | 92} 93 94 95struct BlockCryptoCreateData { 96 BlockBackend *blk; 97 uint64_t size; 98 PreallocMode prealloc; 99}; --- 875 unchanged lines hidden --- |