Skip to contentSkip to conversation

Change signedness of hash in x509_get_sha1_hash(), fixes compiler warning.

PATCH In review Steffan Karger 2 participants 3 messages Apr 27, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Change signedness of hash in x509_get_sha1_hash(), fixes compiler warning.

hash was cast from char * to unsigned char * at the return of the function. This patch removes the implicit cast by declaring hash as unsigned char * .

---
 src/openvpn/ssl_verify_openssl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/ssl_verify_openssl.c +1 -1
index a9205f3..0f571d9 100644
@@ -241,7 +241,7 @@ backend_x509_get_serial (openvpn_x509_cert_t *cert, struct gc_arena *gc)
 unsigned char *
 x509_get_sha1_hash (X509 *cert, struct gc_arena *gc)
 {
-  char *hash = gc_malloc(SHA_DIGEST_LENGTH, false, gc);
+  unsigned char *hash = gc_malloc(SHA_DIGEST_LENGTH, false, gc);
   memcpy(hash, cert->sha1_hash, SHA_DIGEST_LENGTH);
   return hash;
 }
Signature · 1 line
1.8.3.2
#1 lore raw
Quoted 2 lines · Steffan Karger

hash was cast from char * to unsigned char * at the return of the function. This patch removes the implicit cast by declaring hash as unsigned char * .

Ignore the "1/2". This was meant as a separate patch, but git format-patch added the "1/2" without me noticing.

-Steffan

#2 lore raw
In reply to Steffan Karger

ACK ("obviously correct")

Your patch has been applied to the master and release/2.3 branches.

commit d4309c21d9cde43c777985e373242afa78afefa1 (master) commit b36515a7115cec9a0f1c4240a83d4b5d184235f1 (release/2.3)

Author: Steffan Karger
Date:   Sun Apr 27 09:55:48 2014 +0200
     Change signedness of hash in x509_get_sha1_hash(), fixes compiler warning.

     Signed-off-by: Steffan Karger <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/8647
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering