diff options
author | Dirkjan Bussink <[email protected]> | 2020-03-26 18:41:57 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-26 10:41:57 -0700 |
commit | 112c1bff9422739b0bfa8156c44f6da63ae30fd0 (patch) | |
tree | 3c1d85329ce24ff60711180f342ead1a99736127 /module/icp/io | |
parent | 1d2ddb9bb9993b9c2e942040d700a4bacd0b205b (diff) |
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 <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Attila Fueloep <[email protected]>
Signed-off-by: Dirkjan Bussink <[email protected]>
Closes #9661
Closes #10015
Diffstat (limited to 'module/icp/io')
-rw-r--r-- | module/icp/io/aes.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/module/icp/io/aes.c b/module/icp/io/aes.c index 788bcef7d..96fb6bb1a 100644 --- a/module/icp/io/aes.c +++ b/module/icp/io/aes.c @@ -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 |