aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2022-02-17 09:37:56 +0900
committerNIIBE Yutaka <[email protected]>2022-02-17 09:37:56 +0900
commit5420cbbd3ec7ebf081224796e8d1f8299f7ad985 (patch)
tree2eed69d6ddf4e4df56dac8b3cbf033474d29dda6
parenta340e980388243ceae6df57d101036f3f2a955be (diff)
downloadlibgcrypt-5420cbbd3ec7ebf081224796e8d1f8299f7ad985.tar.gz
libgcrypt-5420cbbd3ec7ebf081224796e8d1f8299f7ad985.tar.bz2
libgcrypt-5420cbbd3ec7ebf081224796e8d1f8299f7ad985.zip
Silence compiler warnings for possible alignment problem.
* cipher/kdf.c (balloon_final): Fix the cast. (_gcry_kdf_compute, _gcry_kdf_final, _gcry_kdf_close): Likewise. -- In the first case, we know that allocated area by calloc is properly aligned. We use unsigned char * for LAST_BLOCK for address computation. In the latter cases, the object referenced by H is actually the target object of the particular struct, so, no problem for alignment. Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--cipher/kdf.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/cipher/kdf.c b/cipher/kdf.c
index db3f43e3..3a47bed8 100644
--- a/cipher/kdf.c
+++ b/cipher/kdf.c
@@ -1356,7 +1356,7 @@ balloon_final (balloon_ctx_t b, size_t resultlen, void *result)
return t->ec;
last_block = t->block + (b->blklen * (t->b->n_blocks - 1));
- balloon_xor_block (b, out, (u64 *)last_block);
+ balloon_xor_block (b, out, (const u64 *)(void *)last_block);
}
memcpy (result, out, b->blklen);
@@ -1435,11 +1435,11 @@ _gcry_kdf_compute (gcry_kdf_hd_t h, const struct gcry_kdf_thread_ops *ops)
switch (h->algo)
{
case GCRY_KDF_ARGON2:
- ec = argon2_compute ((argon2_ctx_t)h, ops);
+ ec = argon2_compute ((argon2_ctx_t)(void *)h, ops);
break;
case GCRY_KDF_BALLOON:
- ec = balloon_compute_all ((balloon_ctx_t)h, ops);
+ ec = balloon_compute_all ((balloon_ctx_t)(void *)h, ops);
break;
default:
@@ -1459,11 +1459,11 @@ _gcry_kdf_final (gcry_kdf_hd_t h, size_t resultlen, void *result)
switch (h->algo)
{
case GCRY_KDF_ARGON2:
- ec = argon2_final ((argon2_ctx_t)h, resultlen, result);
+ ec = argon2_final ((argon2_ctx_t)(void *)h, resultlen, result);
break;
case GCRY_KDF_BALLOON:
- ec = balloon_final ((balloon_ctx_t)h, resultlen, result);
+ ec = balloon_final ((balloon_ctx_t)(void *)h, resultlen, result);
break;
default:
@@ -1480,11 +1480,11 @@ _gcry_kdf_close (gcry_kdf_hd_t h)
switch (h->algo)
{
case GCRY_KDF_ARGON2:
- argon2_close ((argon2_ctx_t)h);
+ argon2_close ((argon2_ctx_t)(void *)h);
break;
case GCRY_KDF_BALLOON:
- balloon_close ((balloon_ctx_t)h);
+ balloon_close ((balloon_ctx_t)(void *)h);
break;
default: