Commit ccebb5f3 authored by Chen Qun's avatar Chen Qun Committed by Daniel P. Berrangé
Browse files

crypto: Redundant type conversion for AES_KEY pointer



We can delete the redundant type conversion if
we set the the AES_KEY parameter with 'const' in
qcrypto_cipher_aes_ecb_(en|de)crypt() function.

Reported-by: default avatarEuler Robot <euler.robot@huawei.com>
Signed-off-by: default avatarChen Qun <kuhn.chenqun@huawei.com>
Signed-off-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
parent 861c50bf
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ static void qcrypto_cipher_free_aes(QCryptoCipher *cipher)
}


static void qcrypto_cipher_aes_ecb_encrypt(AES_KEY *key,
static void qcrypto_cipher_aes_ecb_encrypt(const AES_KEY *key,
                                           const void *in,
                                           void *out,
                                           size_t len)
@@ -100,7 +100,7 @@ static void qcrypto_cipher_aes_ecb_encrypt(AES_KEY *key,
}


static void qcrypto_cipher_aes_ecb_decrypt(AES_KEY *key,
static void qcrypto_cipher_aes_ecb_decrypt(const AES_KEY *key,
                                           const void *in,
                                           void *out,
                                           size_t len)
@@ -133,8 +133,7 @@ static void qcrypto_cipher_aes_xts_encrypt(const void *ctx,
{
    const QCryptoCipherBuiltinAESContext *aesctx = ctx;

    qcrypto_cipher_aes_ecb_encrypt((AES_KEY *)&aesctx->enc,
                                   src, dst, length);
    qcrypto_cipher_aes_ecb_encrypt(&aesctx->enc, src, dst, length);
}


@@ -145,8 +144,7 @@ static void qcrypto_cipher_aes_xts_decrypt(const void *ctx,
{
    const QCryptoCipherBuiltinAESContext *aesctx = ctx;

    qcrypto_cipher_aes_ecb_decrypt((AES_KEY *)&aesctx->dec,
                                   src, dst, length);
    qcrypto_cipher_aes_ecb_decrypt(&aesctx->dec, src, dst, length);
}