summaryrefslogtreecommitdiff
path: root/src/feature/hs
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2019-02-26 12:33:23 +0200
committerGeorge Kadianakis <desnacked@riseup.net>2019-02-26 12:33:23 +0200
commit7fbfdf2af731f500e3df3ca8207e6822f87f1bc9 (patch)
tree7dd1beac6cc0854d7b4930ec111ec0cb261cb588 /src/feature/hs
parent626e6d2c394673ca46a44616a76b33699d0cf763 (diff)
parentf632335feb27b45a3ee5eb64690826bda52467bd (diff)
downloadtor-7fbfdf2af731f500e3df3ca8207e6822f87f1bc9.tar.gz
tor-7fbfdf2af731f500e3df3ca8207e6822f87f1bc9.zip
Merge branch 'tor-github/pr/611'
Diffstat (limited to 'src/feature/hs')
-rw-r--r--src/feature/hs/hs_client.c5
-rw-r--r--src/feature/hs/hs_common.c3
-rw-r--r--src/feature/hs/hs_service.c3
3 files changed, 8 insertions, 3 deletions
diff --git a/src/feature/hs/hs_client.c b/src/feature/hs/hs_client.c
index e1d0e8613a..075f1d5c41 100644
--- a/src/feature/hs/hs_client.c
+++ b/src/feature/hs/hs_client.c
@@ -1561,7 +1561,10 @@ parse_auth_file_content(const char *client_key_str)
auth = tor_malloc_zero(sizeof(hs_client_service_authorization_t));
if (base32_decode((char *) auth->enc_seckey.secret_key,
sizeof(auth->enc_seckey.secret_key),
- seckey_b32, strlen(seckey_b32)) < 0) {
+ seckey_b32, strlen(seckey_b32)) !=
+ sizeof(auth->enc_seckey.secret_key)) {
+ log_warn(LD_REND, "Client authorization encoded base32 private key "
+ "can't be decoded: %s", seckey_b32);
goto err;
}
strncpy(auth->onion_address, onion_address, HS_SERVICE_ADDR_LEN_BASE32);
diff --git a/src/feature/hs/hs_common.c b/src/feature/hs/hs_common.c
index ebe49f09a5..14655c53a5 100644
--- a/src/feature/hs/hs_common.c
+++ b/src/feature/hs/hs_common.c
@@ -926,7 +926,8 @@ hs_parse_address(const char *address, ed25519_public_key_t *key_out,
}
/* Decode address so we can extract needed fields. */
- if (base32_decode(decoded, sizeof(decoded), address, strlen(address)) < 0) {
+ if (base32_decode(decoded, sizeof(decoded), address, strlen(address))
+ != sizeof(decoded)) {
log_warn(LD_REND, "Service address %s can't be decoded.",
escaped_safe_str(address));
goto invalid;
diff --git a/src/feature/hs/hs_service.c b/src/feature/hs/hs_service.c
index b94dd9a481..8d286f2bad 100644
--- a/src/feature/hs/hs_service.c
+++ b/src/feature/hs/hs_service.c
@@ -1179,7 +1179,8 @@ parse_authorized_client(const char *client_key_str)
client = tor_malloc_zero(sizeof(hs_service_authorized_client_t));
if (base32_decode((char *) client->client_pk.public_key,
sizeof(client->client_pk.public_key),
- pubkey_b32, strlen(pubkey_b32)) < 0) {
+ pubkey_b32, strlen(pubkey_b32)) !=
+ sizeof(client->client_pk.public_key)) {
log_warn(LD_REND, "Client authorization public key cannot be decoded: %s",
pubkey_b32);
goto err;