mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Fix unused parameter in crypto backend handlers.
This commit is contained in:
@@ -29,14 +29,12 @@
|
||||
|
||||
#define CONST_CAST(x) (x)(uintptr_t)
|
||||
|
||||
#if USE_INTERNAL_ARGON2 || HAVE_ARGON2_H
|
||||
int argon2(const char *type, const char *password, size_t password_length,
|
||||
const char *salt, size_t salt_length,
|
||||
char *key, size_t key_length,
|
||||
uint32_t iterations, uint32_t memory, uint32_t parallel)
|
||||
{
|
||||
#if !USE_INTERNAL_ARGON2 && !HAVE_ARGON2_H
|
||||
return -EINVAL;
|
||||
#else
|
||||
argon2_type atype;
|
||||
argon2_context context = {
|
||||
.flags = ARGON2_DEFAULT_FLAGS,
|
||||
@@ -75,5 +73,17 @@ int argon2(const char *type, const char *password, size_t password_length,
|
||||
}
|
||||
|
||||
return r;
|
||||
#endif
|
||||
}
|
||||
|
||||
#else /* USE_INTERNAL_ARGON2 || HAVE_ARGON2_H */
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
|
||||
int argon2(const char *type, const char *password, size_t password_length,
|
||||
const char *salt, size_t salt_length,
|
||||
char *key, size_t key_length,
|
||||
uint32_t iterations, uint32_t memory, uint32_t parallel)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -312,6 +312,8 @@ int crypt_bitlk_decrypt_key_kernel(const void *key, size_t key_length,
|
||||
}
|
||||
|
||||
#else /* ENABLE_AF_ALG */
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
|
||||
int crypt_cipher_init_kernel(struct crypt_cipher_kernel *ctx, const char *name,
|
||||
const char *mode, const void *key, size_t key_length)
|
||||
{
|
||||
|
||||
@@ -57,6 +57,7 @@ static uint64_t OSSL_get_max_threads(OSSL_LIB_CTX *ctx __attribute__((unused)))
|
||||
#endif
|
||||
|
||||
#define CONST_CAST(x) (x)(uintptr_t)
|
||||
#define UNUSED(x) (void)(x)
|
||||
|
||||
static int crypto_backend_initialised = 0;
|
||||
|
||||
@@ -207,6 +208,8 @@ static int openssl_backend_init(bool fips)
|
||||
openssl_backend_exit();
|
||||
return -EINVAL;
|
||||
}
|
||||
#else
|
||||
UNUSED(fips);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@@ -297,6 +300,8 @@ static void hash_id_free(const EVP_MD *hash_id)
|
||||
{
|
||||
#if OPENSSL_VERSION_MAJOR >= 3
|
||||
EVP_MD_free(CONST_CAST(EVP_MD*)hash_id);
|
||||
#else
|
||||
UNUSED(hash_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -313,6 +318,8 @@ static void cipher_type_free(const EVP_CIPHER *cipher_type)
|
||||
{
|
||||
#if OPENSSL_VERSION_MAJOR >= 3
|
||||
EVP_CIPHER_free(CONST_CAST(EVP_CIPHER*)cipher_type);
|
||||
#else
|
||||
UNUSED(cipher_type);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user