diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-12-23 10:56:36 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-12-23 10:56:36 -0500 |
commit | 0a0e513d42581a8ae110307d1bac58ddb89a8df1 (patch) | |
tree | 17512643e19a66ab26b4337e342da6080043fd03 /src/or | |
parent | 04f21f03221a3888bde376ee1c2daa1effccbb4e (diff) | |
parent | e76b072defa5f5d6f5429d4df9afdd1335591658 (diff) | |
download | tor-0a0e513d42581a8ae110307d1bac58ddb89a8df1.tar.gz tor-0a0e513d42581a8ae110307d1bac58ddb89a8df1.zip |
Merge remote-tracking branch 'dgoulet/bug20991_030_01'
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/hs_intropoint.c | 8 | ||||
-rw-r--r-- | src/or/hs_service.c | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/or/hs_intropoint.c b/src/or/hs_intropoint.c index bfc7ec3876..b37c9a1b9f 100644 --- a/src/or/hs_intropoint.c +++ b/src/or/hs_intropoint.c @@ -70,7 +70,11 @@ verify_establish_intro_cell(const hs_cell_establish_intro_t *cell, ed25519_signature_t sig_struct; const uint8_t *sig_array = hs_cell_establish_intro_getconstarray_sig(cell); - if (hs_cell_establish_intro_getlen_sig(cell) != sizeof(sig_struct.sig)) { + /* Make sure the signature length is of the right size. For EXTRA safety, + * we check both the size of the array and the length which must be the + * same. Safety first!*/ + if (hs_cell_establish_intro_getlen_sig(cell) != sizeof(sig_struct.sig) || + hs_cell_establish_intro_get_sig_len(cell) != sizeof(sig_struct.sig)) { log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, "ESTABLISH_INTRO sig len is invalid"); return -1; @@ -83,7 +87,7 @@ verify_establish_intro_cell(const hs_cell_establish_intro_t *cell, const size_t sig_msg_len = cell->end_sig_fields - msg; int sig_mismatch = ed25519_checksig_prefixed(&sig_struct, - (uint8_t*) msg, sig_msg_len, + msg, sig_msg_len, ESTABLISH_INTRO_SIG_PREFIX, &auth_key); if (sig_mismatch) { diff --git a/src/or/hs_service.c b/src/or/hs_service.c index 3b5a3e7853..7b12b63065 100644 --- a/src/or/hs_service.c +++ b/src/or/hs_service.c @@ -152,8 +152,9 @@ generate_establish_intro_cell(const uint8_t *circuit_key_material, tor_assert(encoded_len > ED25519_SIG_LEN); if (ed25519_sign_prefixed(&sig, - (uint8_t*) cell_bytes_tmp, - encoded_len - ED25519_SIG_LEN, + cell_bytes_tmp, + encoded_len - + (ED25519_SIG_LEN + sizeof(cell->sig_len)), ESTABLISH_INTRO_SIG_PREFIX, &key_struct)) { log_warn(LD_BUG, "Unable to gen signature for ESTABLISH_INTRO cell."); |