mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 19:04:45 +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:
+6
-11
@@ -92,11 +92,6 @@ static crypto_mech_info_t aes_mech_info_tab[] = {
|
||||
AES_MIN_KEY_BYTES, AES_MAX_KEY_BYTES, CRYPTO_KEYSIZE_UNIT_IN_BYTES}
|
||||
};
|
||||
|
||||
/* operations are in-place if the output buffer is NULL */
|
||||
#define AES_ARG_INPLACE(input, output) \
|
||||
if ((output) == NULL) \
|
||||
(output) = (input);
|
||||
|
||||
static void aes_provider_status(crypto_provider_handle_t, uint_t *);
|
||||
|
||||
static crypto_control_ops_t aes_control_ops = {
|
||||
@@ -413,7 +408,7 @@ aes_encrypt(crypto_ctx_t *ctx, crypto_data_t *plaintext,
|
||||
== 0) && (plaintext->cd_length & (AES_BLOCK_LEN - 1)) != 0)
|
||||
return (CRYPTO_DATA_LEN_RANGE);
|
||||
|
||||
AES_ARG_INPLACE(plaintext, ciphertext);
|
||||
ASSERT(ciphertext != NULL);
|
||||
|
||||
/*
|
||||
* We need to just return the length needed to store the output.
|
||||
@@ -530,7 +525,7 @@ aes_decrypt(crypto_ctx_t *ctx, crypto_data_t *ciphertext,
|
||||
return (CRYPTO_ENCRYPTED_DATA_LEN_RANGE);
|
||||
}
|
||||
|
||||
AES_ARG_INPLACE(ciphertext, plaintext);
|
||||
ASSERT(plaintext != NULL);
|
||||
|
||||
/*
|
||||
* Return length needed to store the output.
|
||||
@@ -635,7 +630,7 @@ aes_encrypt_update(crypto_ctx_t *ctx, crypto_data_t *plaintext,
|
||||
ASSERT(ctx->cc_provider_private != NULL);
|
||||
aes_ctx = ctx->cc_provider_private;
|
||||
|
||||
AES_ARG_INPLACE(plaintext, ciphertext);
|
||||
ASSERT(ciphertext != NULL);
|
||||
|
||||
/* compute number of bytes that will hold the ciphertext */
|
||||
out_len = aes_ctx->ac_remainder_len;
|
||||
@@ -705,7 +700,7 @@ aes_decrypt_update(crypto_ctx_t *ctx, crypto_data_t *ciphertext,
|
||||
ASSERT(ctx->cc_provider_private != NULL);
|
||||
aes_ctx = ctx->cc_provider_private;
|
||||
|
||||
AES_ARG_INPLACE(ciphertext, plaintext);
|
||||
ASSERT(plaintext != NULL);
|
||||
|
||||
/*
|
||||
* Compute number of bytes that will hold the plaintext.
|
||||
@@ -947,7 +942,7 @@ aes_encrypt_atomic(crypto_provider_handle_t provider,
|
||||
size_t length_needed;
|
||||
int ret;
|
||||
|
||||
AES_ARG_INPLACE(plaintext, ciphertext);
|
||||
ASSERT(ciphertext != NULL);
|
||||
|
||||
/*
|
||||
* CTR, CCM, GCM, and GMAC modes do not require that plaintext
|
||||
@@ -1073,7 +1068,7 @@ aes_decrypt_atomic(crypto_provider_handle_t provider,
|
||||
size_t length_needed;
|
||||
int ret;
|
||||
|
||||
AES_ARG_INPLACE(ciphertext, plaintext);
|
||||
ASSERT(plaintext != NULL);
|
||||
|
||||
/*
|
||||
* CCM, GCM, CTR, and GMAC modes do not require that ciphertext
|
||||
|
||||
Reference in New Issue
Block a user