[tor-bugs] #16467 [Tor]: Faster Ed25519 implementation.

Tor Bug Tracker & Wiki blackhole at torproject.org
Sun Jul 5 04:20:08 UTC 2015


#16467: Faster Ed25519 implementation.
-----------------------------+------------------------------------
     Reporter:  yawning      |      Owner:
         Type:  enhancement  |     Status:  needs_review
     Priority:  normal       |  Milestone:  Tor: 0.2.7.x-final
    Component:  Tor          |    Version:  Tor: 0.2.7
   Resolution:               |   Keywords:  performance, tor-relay
Actual Points:               |  Parent ID:  #9663
       Points:               |
-----------------------------+------------------------------------

Comment (by teor):

 (I spoke too soon, it turns out I hadn't updated my Xcode project to
 include the new source files.)

 OS X defines an `ALIGN` macro to calculate pointer alignment based on a
 passed pointer value. It's not the same as the compiler alignment
 attribute. Can we rename the macro across the `ed25519/donna` codebase?
 `tor/src/ext/ed25519/donna/ed25519-donna-portable.h:23:10: 'ALIGN' macro
 redefined`

 `expand256_modm` doesn't appear to initialise the bytes of `work` above
 `len`, or, if `len` is less than 32, the bytes of `out` above 32.

 The clang static analyzer to complain about garbage values being passed to
 the `+` operator in the call stack:
 * ed25519_donna_keygen
 * ed25519_donna_pubkey
 * ge25519_scalarmult_base_niels
 * curve25519_sub_reduce
 * `tor/src/ext/ed25519/donna/ed25519.c:202:3: The left operand of '+' is a
 garbage value (within a call to 'ge25519_scalarmult_base_niels')`
   * which is actually line 85 in `curve25519-donna-64bit.h`:
 {{{
 out[0] = a[0] + fourP0    - b[0]    ; c = (out[0] >> 51); out[0] &=
 reduce_mask_51;
 }}}
 I've tried zeroing out most of the variables involved, but I might have
 missed some.
 I can't to work out how to fix this analysis issue. I wonder if the
 assembly is confusing clang, but it's worked fine with other assembly in
 the past.

 Should we be using the di_ops functions for memset, memcpy and similar?

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


More information about the tor-bugs mailing list