[pisa-src] r1455 - in trunk/libpisa: crypto.c crypto.h

  • From: Thomas Jansen <mithi@xxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Fri, 30 Oct 2009 12:20:20 +0100

Author: tjansen
Date: Fri Oct 30 12:20:20 2009
New Revision: 1455

Log:
Fix -Wcast-qual warning:

libpisa/crypto.c: In function ‘pisa_build_hmac’:
libpisa/crypto.c:310: warning: cast discards qualifiers from pointer target type
libpisa/crypto.c:311: warning: cast discards qualifiers from pointer target type

Modified:
   trunk/libpisa/crypto.c
   trunk/libpisa/crypto.h

Modified: trunk/libpisa/crypto.c
==============================================================================
--- trunk/libpisa/crypto.c      Fri Oct 30 12:14:33 2009        (r1454)
+++ trunk/libpisa/crypto.c      Fri Oct 30 12:20:20 2009        (r1455)
@@ -265,7 +265,7 @@
  * @warning      This function returns 1 for success which is against the 
policy
  *               defined in @c /doc/HACKING.
  */
-int pisa_write_hmac(int type, void *key, void *in, int in_len, void *out)
+int pisa_write_hmac(int type, const void *key, const void *in, int in_len, 
void *out)
 {
        switch(type) {
         case PISA_DIGEST_SHA1_HMAC:
@@ -307,8 +307,8 @@
 int pisa_build_hmac(pisa_generic_hash hmac, const char *msg, int msglen, const 
char *key)
 {
        if (pisa_write_hmac(PISA_DIGEST_SHA1_HMAC,      /* type */
-                       (void *)key,    /* key */
-                       (void *)msg,    /* message */
+                       (const void *)key,      /* key */
+                       (const void *)msg,      /* message */
                        msglen, /* message length */
                        (void *)hmac) < 0) {
 

Modified: trunk/libpisa/crypto.h
==============================================================================
--- trunk/libpisa/crypto.h      Fri Oct 30 12:14:33 2009        (r1454)
+++ trunk/libpisa/crypto.h      Fri Oct 30 12:20:20 2009        (r1455)
@@ -68,7 +68,7 @@
 void pisa_build_puzzle(pisa_puzzle *puzzle, uint8_t lifetime);
 uint64_t pisa_verify_puzzle(void *solution, struct in6_addr *hits, struct 
in6_addr *hitr);
 uint64_t pisa_solve_puzzle(void *puzzle, struct in6_addr *hits, struct 
in6_addr *hitr);
-int pisa_write_hmac(int type, void *key, void *in, int in_len, void *out);
+int pisa_write_hmac(int type, const void *key, const void *in, int in_len, 
void *out);
 int pisa_build_hmac(pisa_generic_hash hmac, const char *msg, int msglen, const 
char *key);
 
 #endif /* PISA_CRYPTO_H */

Other related posts:

  • » [pisa-src] r1455 - in trunk/libpisa: crypto.c crypto.h - Thomas Jansen