[PATCH 6/8] DES: Silence compiler warnings on Windows
Jussi Kivilinna
jussi.kivilinna at iki.fi
Fri May 1 19:39:59 CEST 2015
* cipher/des.c (working_memcmp): Make pointer arguments 'const void *'.
--
Following warning seen on Windows target build:
des.c: In function 'is_weak_key':
des.c:1019:40: warning: pointer targets in passing argument 1 of 'working_memcmp' differ in signedness [-Wpointer-sign]
if ( !(cmp_result=working_memcmp(work, weak_keys[middle], 8)) )
^
des.c:149:1: note: expected 'const char *' but argument is of type 'unsigned char *'
working_memcmp( const char *a, const char *b, size_t n )
^
des.c:1019:46: warning: pointer targets in passing argument 2 of 'working_memcmp' differ in signedness [-Wpointer-sign]
if ( !(cmp_result=working_memcmp(work, weak_keys[middle], 8)) )
^
des.c:149:1: note: expected 'const char *' but argument is of type 'unsigned char *'
working_memcmp( const char *a, const char *b, size_t n )
^
Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
cipher/des.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/cipher/des.c b/cipher/des.c
index bc2a474..d4863d1 100644
--- a/cipher/des.c
+++ b/cipher/des.c
@@ -146,8 +146,10 @@
* depending on whether characters are signed or not.
*/
static int
-working_memcmp( const char *a, const char *b, size_t n )
+working_memcmp( const void *_a, const void *_b, size_t n )
{
+ const char *a = _a;
+ const char *b = _b;
for( ; n; n--, a++, b++ )
if( *a != *b )
return (int)(*(byte*)a) - (int)(*(byte*)b);
More information about the Gcrypt-devel
mailing list