[tor-bugs] #4283 [Tor Client]: crypto_pk_cmp_keys does not document its error behaviour

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Sat Sep 15 13:38:27 UTC 2012


#4283: crypto_pk_cmp_keys does not document its error behaviour
------------------------+---------------------------------------------------
 Reporter:  rransom     |          Owner:  rransom           
     Type:  defect      |         Status:  needs_revision    
 Priority:  normal      |      Milestone:  Tor: 0.2.4.x-final
Component:  Tor Client  |        Version:                    
 Keywords:              |         Parent:                    
   Points:              |   Actualpoints:                    
------------------------+---------------------------------------------------
Changes (by rransom):

  * status:  needs_review => needs_revision


Comment:

 On second thought, this isn't quite guaranteed to stay correct --
 `crypto_pk_cmp_keys` is documented as returning -1, 0, or 1 (even though
 nothing relies on those exact values), and `tor_memcmp` isn't.  (For the
 particular inputs it could operate on here, it does currently produce -1,
 0, or 1, but that's a lucky accident.)

 I'm in favor of changing the documented behaviour of `crypto_pk_cmp_keys`.
 If some later use would be easier if its result were clamped to 0 or ±1,
 that should be implemented as a separate function (preferably constant-
 time and in di_ops.c).

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


More information about the tor-bugs mailing list