Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libcrypt Silence -Wpointer-sign on crypt-sha1.c.



details:   https://anonhg.NetBSD.org/src/rev/3aec99312acd
branches:  trunk
changeset: 789178:3aec99312acd
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat Aug 10 18:42:29 2013 +0000

description:
Silence -Wpointer-sign on crypt-sha1.c.
This requires casts, which is not entirely desirable; however, this way
at least no *more* pointer sign issues can creep in.

Output object files are unchanged on amd64.

diffstat:

 lib/libcrypt/Makefile     |   4 +---
 lib/libcrypt/crypt-sha1.c |  10 ++++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diffs (54 lines):

diff -r 85198fdbcaaa -r 3aec99312acd lib/libcrypt/Makefile
--- a/lib/libcrypt/Makefile     Sat Aug 10 18:40:19 2013 +0000
+++ b/lib/libcrypt/Makefile     Sat Aug 10 18:42:29 2013 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.24 2012/08/10 04:30:47 joerg Exp $
+#      $NetBSD: Makefile,v 1.25 2013/08/10 18:42:29 dholland Exp $
 
 USE_SHLIBDIR=  yes
 
@@ -24,5 +24,3 @@
 .else
 .include <bsd.lib.mk>
 .endif
-
-COPTS.crypt-sha1.c+=   -Wno-pointer-sign
diff -r 85198fdbcaaa -r 3aec99312acd lib/libcrypt/crypt-sha1.c
--- a/lib/libcrypt/crypt-sha1.c Sat Aug 10 18:40:19 2013 +0000
+++ b/lib/libcrypt/crypt-sha1.c Sat Aug 10 18:42:29 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crypt-sha1.c,v 1.6 2013/06/24 04:21:20 riastradh Exp $ */
+/* $NetBSD: crypt-sha1.c,v 1.7 2013/08/10 18:42:29 dholland Exp $ */
 
 /*
  * Copyright (c) 2004, Juniper Networks, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: crypt-sha1.c,v 1.6 2013/06/24 04:21:20 riastradh Exp $");
+__RCSID("$NetBSD: crypt-sha1.c,v 1.7 2013/08/10 18:42:29 dholland Exp $");
 #endif /* not lint */
 
 #include <stdlib.h>
@@ -130,6 +130,8 @@
     int dl;
     unsigned int iterations;
     unsigned int i;
+    /* XXX silence -Wpointer-sign (would be nice to fix this some other way) */
+    const unsigned char *pwu = (const unsigned char *)pw;
 
     /*
      * Salt format is
@@ -166,9 +168,9 @@
     /*
      * Then hmac using <pw> as key, and repeat...
      */
-    __hmac_sha1(passwd, dl, pw, pl, hmac_buf);
+    __hmac_sha1((unsigned char *)passwd, dl, pwu, pl, hmac_buf);
     for (i = 1; i < iterations; i++) {
-       __hmac_sha1(hmac_buf, SHA1_SIZE, pw, pl, hmac_buf);
+       __hmac_sha1(hmac_buf, SHA1_SIZE, pwu, pl, hmac_buf);
     }
     /* Now output... */
     pl = snprintf(passwd, sizeof(passwd), "%s%u$%.*s$",



Home | Main Index | Thread Index | Old Index