[tor-commits] [tor/master] Use uint8_t for rend descriptor_cookie fields

nickm at torproject.org nickm at torproject.org
Mon May 9 18:41:48 UTC 2016


commit 896271d525b2b31950572293c512224ca57cee02
Author: John Brooks <special at torproject.org>
Date:   Mon May 9 13:43:14 2016 -0400

    Use uint8_t for rend descriptor_cookie fields
---
 src/or/connection_edge.c | 4 ++--
 src/or/or.h              | 4 ++--
 src/or/rendservice.c     | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 729ef8a..3ff0293 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -1503,7 +1503,7 @@ connection_ap_handshake_rewrite_and_attach(entry_connection_t *conn,
     rend_service_authorization_t *client_auth =
       rend_client_lookup_service_authorization(socks->address);
 
-    const char *cookie = NULL;
+    const uint8_t *cookie = NULL;
     rend_auth_type_t auth_type = REND_NO_AUTH;
     if (client_auth) {
       log_info(LD_REND, "Using previously configured client authorization "
@@ -1515,7 +1515,7 @@ connection_ap_handshake_rewrite_and_attach(entry_connection_t *conn,
     /* Fill in the rend_data field so we can start doing a connection to
      * a hidden service. */
     rend_data_t *rend_data = ENTRY_TO_EDGE_CONN(conn)->rend_data =
-      rend_data_client_create(socks->address, NULL, cookie, auth_type);
+      rend_data_client_create(socks->address, NULL, (char *) cookie, auth_type);
     if (rend_data == NULL) {
       return -1;
     }
diff --git a/src/or/or.h b/src/or/or.h
index 8c40f1a..54e05e3 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -778,7 +778,7 @@ typedef enum rend_auth_type_t {
 
 /** Client-side configuration of authorization for a hidden service. */
 typedef struct rend_service_authorization_t {
-  char descriptor_cookie[REND_DESC_COOKIE_LEN];
+  uint8_t descriptor_cookie[REND_DESC_COOKIE_LEN];
   char onion_address[REND_SERVICE_ADDRESS_LEN+1];
   rend_auth_type_t auth_type;
 } rend_service_authorization_t;
@@ -4851,7 +4851,7 @@ typedef enum {
 /** Hidden-service side configuration of client authorization. */
 typedef struct rend_authorized_client_t {
   char *client_name;
-  char descriptor_cookie[REND_DESC_COOKIE_LEN];
+  uint8_t descriptor_cookie[REND_DESC_COOKIE_LEN];
   crypto_pk_t *client_key;
 } rend_authorized_client_t;
 
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index db6bc4b..22a01c9 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -1208,10 +1208,10 @@ rend_service_load_auth_keys(rend_service_t *s, const char *hfname)
       memcpy(client->descriptor_cookie, parsed->descriptor_cookie,
              REND_DESC_COOKIE_LEN);
     } else {
-      crypto_rand(client->descriptor_cookie, REND_DESC_COOKIE_LEN);
+      crypto_rand((char *) client->descriptor_cookie, REND_DESC_COOKIE_LEN);
     }
     if (base64_encode(desc_cook_out, 3*REND_DESC_COOKIE_LEN_BASE64+1,
-                      client->descriptor_cookie,
+                      (char *) client->descriptor_cookie,
                       REND_DESC_COOKIE_LEN, 0) < 0) {
       log_warn(LD_BUG, "Could not base64-encode descriptor cookie.");
       goto err;





More information about the tor-commits mailing list