[tor-bugs] #3122 [Tor Client]: Write and use constant-time comparison functions

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Mon May 9 18:27:29 UTC 2011


#3122: Write and use constant-time comparison functions
-------------------------+--------------------------------------------------
 Reporter:  rransom      |          Owner:  ioerror           
     Type:  enhancement  |         Status:  new               
 Priority:  major        |      Milestone:  Tor: 0.2.1.x-final
Component:  Tor Client   |        Version:                    
 Keywords:               |         Parent:                    
   Points:               |   Actualpoints:                    
-------------------------+--------------------------------------------------

Comment(by nickm):

 oops.  Bad formatting.  That should have said:

 Also, I am a little concerned with this:

 {{{
        equal_p >>= 8;
        /* Thanks to (sign-preserving) arithmetic shift, equal_p is now
         * equal to -(v1 == v2), which is exactly what we need below.
         * (Since we're assuming two's-complement arithmetic, -1 is the
         * same as ~0 (all bits set).) */
 }}}


 Right-shift of negative numbers is implementation-defined in C.  If we're
 going to rely on it, we need to verify that its behavior is what we expect
 whenever we're building.

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


More information about the tor-bugs mailing list