aboutsummaryrefslogtreecommitdiff
path: root/src/or/rendcommon.h
diff options
context:
space:
mode:
authorJohn Brooks <john.brooks@dereferenced.net>2015-04-13 21:35:06 -0600
committerNick Mathewson <nickm@torproject.org>2016-05-09 14:28:08 -0400
commitd5a23ce115bf89046cc0e9deb64b288113c8dd92 (patch)
treed6cdf06e81920f88912aae994289fe8bcfbd7875 /src/or/rendcommon.h
parente7ff23beea6f415f661821bdefda8b1df3deb7a6 (diff)
downloadtor-d5a23ce115bf89046cc0e9deb64b288113c8dd92.tar.gz
tor-d5a23ce115bf89046cc0e9deb64b288113c8dd92.zip
Move rend auth cookie en-/decoding to a function
Tor stores client authorization cookies in two slightly different forms. The service's client_keys file has the standard base64-encoded cookie, including two chars of padding. The hostname file and the client remove the two padding chars, and store an auth type flag in the unused bits. The distinction makes no sense. Refactor all decoding to use the same function, which will accept either form, and use a helper function for encoding the truncated format.
Diffstat (limited to 'src/or/rendcommon.h')
-rw-r--r--src/or/rendcommon.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/or/rendcommon.h b/src/or/rendcommon.h
index 3b2f86d614..983cd73892 100644
--- a/src/or/rendcommon.h
+++ b/src/or/rendcommon.h
@@ -67,5 +67,13 @@ rend_data_t *rend_data_service_create(const char *onion_address,
const char *pk_digest,
const uint8_t *cookie,
rend_auth_type_t auth_type);
+
+char *rend_auth_encode_cookie(const uint8_t *cookie_in,
+ rend_auth_type_t auth_type);
+int rend_auth_decode_cookie(const char *cookie_in,
+ uint8_t *cookie_out,
+ rend_auth_type_t *auth_type_out,
+ char **err_msg_out);
+
#endif