[tor-bugs] #18280 [Tor]: base32 encoding API doesn't work for a source length that is not a multiple of 5 or 8

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Feb 9 20:13:06 UTC 2016


#18280: base32 encoding API doesn't work for a source length that is not a multiple
of 5 or 8
----------------------+------------------------------------
 Reporter:  dgoulet   |          Owner:
     Type:  defect    |         Status:  needs_review
 Priority:  Medium    |      Milestone:  Tor: 0.2.9.x-final
Component:  Tor       |        Version:
 Severity:  Normal    |     Resolution:
 Keywords:            |  Actual Points:
Parent ID:  #18278    |         Points:  small
  Sponsor:  SponsorR  |
----------------------+------------------------------------

Comment (by dgoulet):

 Replying to [comment:2 nickm]:
 > Suggestion 1: Let's have unit tests for inputs of various different
 lengths?

 Yes! I actually thought that there would be tests for the base32 API but I
 see none so I'll do that. :)

 >
 > Suggestion 2: Maybe it makes more sense to make it so that we always
 encrypt all the bits we are given, and zero-pad?

 Sounds good to me! Taking the example here, encoding 32 bytes will result
 in 52 bytes with the last 4 bits zeroed. So `base32_encode()` should take
 the number of bytes and ceil it to the nearest multiple of 5 bit and test
 the `destlen` to at least take that amount (plus NUL byte). Those extra
 bits will be explicitly zeroed at the end.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/18280#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list