mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
Fix possible sign extension problem with newer compilers.
* cipher/des.c (READ_64BIT_DATA): Cast to u32 before shifting by 24.
* cipher/blowfish.c (do_encrypt_block): Ditto.
(do_decrypt_block): Ditto.
* cipher/camellia.c (CAMELLIA_RR8): Ditto.
* cipher/cast5.c (do_encrypt_block): Ditto.
(do_decrypt_block): Ditto.
(do_cast_setkey): Ditto.
* cipher/twofish.c (INPACK): Ditto.
* util/iobuf.c (block_filter): Ditto.
--
For cipher/des.c
Reported-by: Balint Reczey <balint@balintreczey.hu>
See commit 57af33d9e7
for details.
Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
aa4a3aa3e7
commit
22caa5c2d4
6 changed files with 42 additions and 42 deletions
|
@ -549,7 +549,7 @@ static void
|
|||
burn_stack (int bytes)
|
||||
{
|
||||
char buf[64];
|
||||
|
||||
|
||||
wipememory(buf,sizeof buf);
|
||||
bytes -= sizeof buf;
|
||||
if (bytes > 0)
|
||||
|
@ -702,7 +702,7 @@ twofish_setkey (void *ctx, const byte *key, unsigned int keylen)
|
|||
burn_stack (23+6*sizeof(void*));
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Macros to compute the g() function in the encryption and decryption
|
||||
|
@ -756,7 +756,7 @@ twofish_setkey (void *ctx, const byte *key, unsigned int keylen)
|
|||
|
||||
#define INPACK(n, x, m) \
|
||||
x = in[4 * (n)] ^ (in[4 * (n) + 1] << 8) \
|
||||
^ (in[4 * (n) + 2] << 16) ^ (in[4 * (n) + 3] << 24) ^ ctx->w[m]
|
||||
^ (in[4 * (n) + 2] << 16) ^ ((u32)in[4 * (n) + 3] << 24) ^ ctx->w[m]
|
||||
|
||||
#define OUTUNPACK(n, x, m) \
|
||||
x ^= ctx->w[m]; \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue