mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 19:28:53 +03:00
Remove checks for null out value in encryption paths
These paths are never exercised, as the parameters given are always different cipher and plaintext `crypto_data_t` pointers. Reviewed-by: Richard Laager <rlaager@wiktel.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Attila Fueloep <attila@fueloep.org> Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com> Closes #9661 Closes #10015
This commit is contained in:
+14
-24
@@ -68,8 +68,7 @@ ccm_mode_encrypt_contiguous_blocks(ccm_ctx_t *ctx, char *data, size_t length,
|
||||
}
|
||||
|
||||
lastp = (uint8_t *)ctx->ccm_cb;
|
||||
if (out != NULL)
|
||||
crypto_init_ptrs(out, &iov_or_mp, &offset);
|
||||
crypto_init_ptrs(out, &iov_or_mp, &offset);
|
||||
|
||||
mac_buf = (uint8_t *)ctx->ccm_mac_buf;
|
||||
|
||||
@@ -126,31 +125,22 @@ ccm_mode_encrypt_contiguous_blocks(ccm_ctx_t *ctx, char *data, size_t length,
|
||||
|
||||
ctx->ccm_processed_data_len += block_size;
|
||||
|
||||
if (out == NULL) {
|
||||
if (ctx->ccm_remainder_len > 0) {
|
||||
bcopy(blockp, ctx->ccm_copy_to,
|
||||
ctx->ccm_remainder_len);
|
||||
bcopy(blockp + ctx->ccm_remainder_len, datap,
|
||||
need);
|
||||
}
|
||||
} else {
|
||||
crypto_get_ptrs(out, &iov_or_mp, &offset, &out_data_1,
|
||||
&out_data_1_len, &out_data_2, block_size);
|
||||
crypto_get_ptrs(out, &iov_or_mp, &offset, &out_data_1,
|
||||
&out_data_1_len, &out_data_2, block_size);
|
||||
|
||||
/* copy block to where it belongs */
|
||||
if (out_data_1_len == block_size) {
|
||||
copy_block(lastp, out_data_1);
|
||||
} else {
|
||||
bcopy(lastp, out_data_1, out_data_1_len);
|
||||
if (out_data_2 != NULL) {
|
||||
bcopy(lastp + out_data_1_len,
|
||||
out_data_2,
|
||||
block_size - out_data_1_len);
|
||||
}
|
||||
/* copy block to where it belongs */
|
||||
if (out_data_1_len == block_size) {
|
||||
copy_block(lastp, out_data_1);
|
||||
} else {
|
||||
bcopy(lastp, out_data_1, out_data_1_len);
|
||||
if (out_data_2 != NULL) {
|
||||
bcopy(lastp + out_data_1_len,
|
||||
out_data_2,
|
||||
block_size - out_data_1_len);
|
||||
}
|
||||
/* update offset */
|
||||
out->cd_offset += block_size;
|
||||
}
|
||||
/* update offset */
|
||||
out->cd_offset += block_size;
|
||||
|
||||
/* Update pointer to next block of data to be processed. */
|
||||
if (ctx->ccm_remainder_len != 0) {
|
||||
|
||||
Reference in New Issue
Block a user