OK, I did some preliminary investigation for this ticket. IMO, there are two steps here:
a) Fix the HSDir code to conform to prop224
Only fixing the HSDir part here is the minimum viable product for 0.3.0, so that the network is prepared. It will basically make HSDirs understand the newest prop224 format (with superencrypted etc.). Since this is HSDir-only, we don't need to implement the whole client-auth logic; we just need to be able to parse the plaintext part of the descriptor.
b) Fix the rest of the descriptor code to conform to prop224
This part would involve actually implementing the client-auth parts of the descriptor, and making clients and hidden services actually be able to parse those. IMO, this is a much bigger project than the above, and it's not strictly required for 0.3.0 since it belongs to the client/HS code.
My plan is to finish (a) ASAP, and then only do (b) if there is enough time.
Agree. (a) is the priority. I think (b) has its own ticket already for 031 so if you can do it, great! But I would say not a priority for 030. Thanks!
Side note, this change will bring quite a much bigger descriptor that we have now so we should just make sure the current code doesn't actually have "max length" check too low.
Changes encrypted to superencrypted in the outter HS desc layer.
Changes the max descriptor size to 50kb and introduces a consensus param HSV3MaxDescriptorSize that controls it.
I believe these two things address everything that was pending in prop224 and has to do with HSDir parsing of HS descriptors. Please check out the branch. I'm gonna do another pass of prop224 to make sure I didn't miss something.
Changes encrypted to superencrypted in the outter HS desc layer.
Changes the max descriptor size to 50kb and introduces a consensus param HSV3MaxDescriptorSize that controls it.
I like that this can be controlled by a consensus parameters which will be very helpful because we also plan to have a param for the number of introduction points which will ultimately affect the max size.
One thing I would change is hs_cache_get_max_hs_descriptor_size(). The second "hs" in there is redundant as we are already in the HS subsystem here so `hs_cache_get_max_descriptor_size()" is enough imo.
Also, networkstatus_get_param() returns a int32_t so we should NOT make it unsigned int for the max size but rather make sure we are in range and convert it before return. Even though it's probably not possible to have something not in range of what we ask, MORE safety net is good.
I believe these two things address everything that was pending in prop224 and has to do with HSDir parsing of HS descriptors. Please check out the branch. I'm gonna do another pass of prop224 to make sure I didn't miss something.
Trac: Status: needs_review to needs_revision Reviewer: N/Ato dgoulet
Changes encrypted to superencrypted in the outter HS desc layer.
Changes the max descriptor size to 50kb and introduces a consensus param HSV3MaxDescriptorSize that controls it.
I like that this can be controlled by a consensus parameters which will be very helpful because we also plan to have a param for the number of introduction points which will ultimately affect the max size.
One thing I would change is hs_cache_get_max_hs_descriptor_size(). The second "hs" in there is redundant as we are already in the HS subsystem here so `hs_cache_get_max_descriptor_size()" is enough imo.
Also, networkstatus_get_param() returns a int32_t so we should NOT make it unsigned int for the max size but rather make sure we are in range and convert it before return. Even though it's probably not possible to have something not in range of what we ask, MORE safety net is good.
Thanks for the review, David. It was helpful!
I pushed a branch called bug20852_david which addresses both comments above. Please review it, and if you like it I will squash the fixups into a more compact branch for Nick's review.
WRT the networkstatus_get_param() issue I spent quite some time thinking of the right casting logic, and I ended up with restricting the max size to INT32_MAX and then casting to unsinged directly. Let me know if you think that's not the right logic.
The INT32_MAX is OK with me as cast to an unsigned int should not overflow. And if your arch considers a int to be 2 bytes, well we'll hit the maximum which is ok.
The INT32_MAX is OK with me as cast to an unsigned int should not overflow. And if your arch considers a int to be 2 bytes, well we'll hit the maximum which is ok.
lgtm!
Thanks for the review David. I squashed everything into bug20852_v1 which should be ready for Nick's eyes.
Trac: Summary: prop224: Update HSDir prop224 code based on newest descriptor changes to prop224: Update prop224 HSDir code to understand latest descriptor format