You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

319 lines
14 KiB

  1. March 1, 2015:
  2. Not much to report. Most of the fixes since Oct 27 last year have
  3. been bug fixes or simplifications, or in the Decaf branch.
  4. October 27, 2014:
  5. Added more support for >512-bit primes. Changed shared secret
  6. to not overflow the buffer in this case. Changed hashing to
  7. SHA512-PRNG; this doesn't change the behavior in the case that
  8. only one block is required.
  9. E-521 appears to be working. Needs more testing, and maybe some
  10. careful analysis since the carry-handling bounds are awfully tight
  11. under the current analysis (the "< 5<<57" that it #if0 asserts is
  12. not actually tight enough under the current analysis; need
  13. it to be < (1+epsilon) << 59).
  14. So you actually do need to reduce often, at least in the x86_64_r12
  15. version.
  16. p521/arch_ref64: simple and relatively slow impl. Like
  17. p448/arch_ref64, this arch reduces after every add or sub.
  18. p521/arch_x86_64_r12: aggressive, fast implementation. This impl
  19. stores 521 bits not in 9 limbs, but 12! Limbs 3,7,11 are 0, and
  20. are there only for vector alignment. (TODO: remove those limbs
  21. from precomputed tables, so that we don't have to look them up!).
  22. The carry handling on this build is very tight, and probably could
  23. stand more analysis. This is why I have the careful balancing of
  24. "hexad" and "nonad" multiplies in its Chung-Hasan mul routine.
  25. (TODO: reconsider whether this is even worthwhile on machines
  26. without AVX2.)
  27. The 'r12 build is a work in progress, and currently only works on
  28. clang (because it rearranges vectors in the timesW function).
  29. Timings for the fast, aggressive arch on Haswell:
  30. mul: 146cy
  31. sqr: 111cy
  32. invert: 62kcy
  33. keygen: 270kcy
  34. ecdh: 803kcy
  35. sign: 283kcy
  36. verif: 907kcy
  37. Same rules as other Goldi benchmarks. Turbo off, HT off,
  38. timing-channel protected (no dataflow from secrets to branches,
  39. memory lookups or known vt instructions), compressed points.
  40. October 23, 2014:
  41. Pushing through changes for curve flexibility. First up is
  42. Ed480-Ridinghood, because it has the same number of words. Next
  43. is E-521.
  44. Experimental support for Ed480-Ridinghood. To use, compile with
  45. make ... FIELD=p480 -XCFLAGS=-DGOLDI_FIELD_BITS=480
  46. I still need to figure out what to do about the fact that the library
  47. is called "goldilocks", but in will soon support curves that are not
  48. ed448-goldilocks, at least experimentally.
  49. Currently the whole system's header "goldilocks.h" doesn't have
  50. a simpler way to override field size, but it does work (as a hack)
  51. with -DGOLDI_FIELD_BITS=...
  52. There is no support yet for coexistence of multiple fields in one
  53. library. The field routines will have unique names, but scalarmul*
  54. won't, and the top-level goldilocks routines have fixed names.
  55. Current timings on Haswell:
  56. Goldilocks: 178kcy keygen, 536kcy ecdh
  57. Ridinghood: 193kcy keygen, 617kcy ecdh
  58. Note that Ridinghood ECDH does worse than 480/448. This is at least
  59. in part because I haven't calculated the overflow handling limits yet
  60. in ec_point.h (this is a disadvantage of dropping the automated
  61. tool for generating that file). So I'm reducing much more often
  62. than I need to. (There's a really loud TODO in ec_point.h for that.)
  63. Also, I haven't tested the limits on these reductions in a while, so
  64. it could be that there are actual (security-critical) bugs in this
  65. area, at least for p448. Now that there's field flexibility, it's
  66. probably a good idea to make a field impl with extra words to check
  67. this.
  68. Furthermore, field_mulw_scc will perform differently on these two
  69. curves based on whether the curve constant is positive or negative.
  70. I should probably go optimize the "hot" routines like montgomery_step
  71. to have separate cases for positive and negative.
  72. September 29, 2014:
  73. Yesterday I put in some more architecture detection, but it should
  74. really be based on the arch directory, because what's in there really
  75. was a terrible hack. So I've changed it to use $arch/arch_config.h
  76. to get WORD_BITS.
  77. I've tweaked the eBAT construction code to rename the architectures
  78. using test/batarch.map. Maybe I should also rename them internally,
  79. but not yet.
  80. I added some new TODO.txt items. Some folks have been asking for a
  81. more factored library, instead of this combined arithmetic, curve code,
  82. encodings and protocol all-in-one jumble. Likewise the hash and RNG
  83. should be flexible.
  84. I've also been meaning to put more work in on SPAKE2EE, which would
  85. also mean finalizing the Elligator code.
  86. September 18, 2014:
  87. Begin work on a "ref" implementation. Currently this is just the
  88. arch_ref64 architecture. The ref implementation always weak_reduces
  89. after arithmetic, and doesn't use vectors or other hackery. Currently
  90. it still must declare field elements as vector aligned, though,
  91. other code outside the arch directory can be vectorized.
  92. Change goldilocks.c to use field_eq instead of calling deep into field
  93. apis.
  94. September 6, 2014:
  95. Pull in minor changes from David Leon Gil and Nicholas Wilson, with
  96. some adjustments. I hope the adjustments don't break their compiles.
  97. `make bat` now makes a bat which passes supercop-fastbuild, though
  98. the benchmarks are rather different from `make bench`. I need to track
  99. down why.
  100. August 4, 2014:
  101. Experiments and bug fixes.
  102. Add really_memset = memset_s (except not because I'm setting -std=c99),
  103. thanks David Leon Gil. I think I put it in the right places.
  104. Try to work around what I think is a compiler bug in GCC -O3 on non-AVX
  105. platforms. I can't seem to work around it as -Os, so I'm just flagging
  106. a warning (-Werror makes it an error) for now. Will take more
  107. investigation. Thanks Samuel Neves.
  108. Added an experimental (not ready yet!) ARM NEON implementation in
  109. arch_neon_experimental. This implementation seems to work, but needs
  110. more testing. It is currently asm-heavy and not GCC clean. I am
  111. planning to have a flag for it to use intrinsics instead of asm;
  112. currently the intrinsics are commented out. On clang this does ECDH
  113. in 1850kcy on my BeagleBone Black, comparable to Curve41417. Once this
  114. is ready, I will probably move it to arch_neon proper, since arch_neon
  115. isn't particularly tuned.
  116. July 11, 2014:
  117. This is mostly a cleanup release.
  118. Added CRANDOM_MIGHT_IS_MUST config flag (default: 1). When set, this
  119. causes crandom to assume that all features in the target arch will
  120. be available, instead of detecting them. This makes sense because
  121. the rest of the Goldilocks code is not (yet?) able to detect features.
  122. Also, I'd like to submit this to SUPERCOP eventually, and SUPERCOP won't
  123. pass -DMUST_HAVE_XXX on the command line the way the Makefile here did.
  124. Flag EXPERIMENT_CRANDOM_BUFFER_CUTOFF_BYTES to disable the crandom
  125. output buffer. This buffer improves performance (very marginally at
  126. Goldilocks sizes), but can cause problems with forking and VM
  127. snapshotting. By default, the buffer is now disabled.
  128. I've slightly tweaked the Elligator implementation (which is still
  129. unused) to make it easier to invert. This makes anything using Elligator
  130. (i.e. nothing) incompatible with previous releases.
  131. I've been factoring "magic" constants such as curve orders, window sizes,
  132. etc into a few headers, to reduce the effort to port the code to other
  133. primes, curves, etc. For example, I could test the Microsoft curves, and
  134. something like:
  135. x^2 + y^2 = 1 +- 5382[45] x^2 y^2 mod 2^480-2^240-1
  136. ("Goldeneye"? "Ridinghood"?) might be a reasonable thing to try for
  137. 64-bit CPUs.
  138. In a similar vein, most of the internal code has been changed to say
  139. "field" instead of p448, so that a future version of magic.h can decide
  140. which field header to include.
  141. You can now `make bat` to create an eBAT in build/ed448-goldilocks. This
  142. is only minimally tested, though, because SUPERCOP doesn't work on my
  143. machine and I'm too lazy to reverse engineer it. It sets a new macro,
  144. SUPERCOP_WONT_LET_ME_OPEN_FILES, which causes goldilocks_init() to fall
  145. back to something horribly insecure if crandom_init_from_file raises
  146. EMFILE.
  147. Slightly improved documentation.
  148. Removed some old commented-out code; restored the /* C-style */ comment
  149. discipline.
  150. The AMD-64 version should now be GCC clean, at least for reasonably
  151. recent GCC (tested on OS X.9.3, Haswell, gcc-4.9).
  152. History no longer says "2104".
  153. May 3, 2014:
  154. Minor changes to internal routines mean that this version is not
  155. compatible with the previous one.
  156. Added ARM NEON code.
  157. Added the ability to precompute multiples of a partner's public key. This
  158. takes slightly longer than a signature verification, but reduces future
  159. verifications with the precomputed key by ~63% and ECDH by ~70%.
  160. goldilocks_precompute_public_key
  161. goldilocks_destroy_precomputed_public_key
  162. goldilocks_verify_precomputed
  163. goldilocks_shared_secret_precomputed
  164. The precomputation feature are is protected by a macro
  165. GOLDI_IMPLEMENT_PRECOMPUTED_KEYS
  166. which can be #defined to 0 to compile these functions out. Unlike most
  167. of Goldilocks' functions, goldilocks_precompute_public_key uses malloc()
  168. (and goldilocks_destroy_precomputed_public_key uses free()).
  169. Changed private keys to be derived from just the symmetric part. This
  170. means that you can compress them to 32 bytes for cold storage, or derive
  171. keypairs from crypto secrets from other systems.
  172. goldilocks_derive_private_key
  173. goldilocks_underive_private_key
  174. goldilocks_private_to_public
  175. Fixed a number of bugs related to vector alignment on Sandy Bridge, which
  176. has AVX but uses SSE2 alignment (because it doesn't have AVX2). Maybe I
  177. should just switch it to use AVX2 alignment?
  178. Beginning to factor out curve-specific magic, so as to build other curves
  179. with the Goldilocks framework. That would enable fair tests against eg
  180. E-521, Ed25519 etc. Still would be a lot of work.
  181. More thorough testing of arithmetic. Now uses GMP for testing framework,
  182. but not in the actual library.
  183. Added some high-level tests for the whole library, including some (bs)
  184. negative testing. Obviously, effective negative testing is a very difficult
  185. proposition in a crypto library.
  186. March 29, 2014:
  187. Added a test directory with various tests. Currently testing SHA512 Monte
  188. Carlo, compatibility of the different scalarmul functions, and some
  189. identities on EC point ops. Began moving these tests out of benchmarker.
  190. Added scan-build support.
  191. Improved some internal interfaces. Made a structure for Barrett primes
  192. instead of passing parameters individually. Moved some field operations
  193. to places that make more sense, eg Barrett serialize and deserialize. The
  194. deserialize operation now checks that its argument is in [0,q).
  195. Added more documentation.
  196. Changed the names of a bunch of functions. Still not entirely consistent,
  197. but getting more so.
  198. Some minor speed improvements. For example, multiply is now a couple cycles
  199. faster.
  200. Added a hackish attempt at thread-safety and initialization sanity checking
  201. in the Goldilocks top-level routines.
  202. Fixed some vector alignment bugs. Compiling with -O0 should now work.
  203. Slightly simplified recode_wnaf.
  204. Add a config.h file for future configuration. EXPERIMENT flags moved here.
  205. I've decided against major changes to SHA512 for the moment. They add speed
  206. but also significantly bloat the code, which is going to hurt L1 cache
  207. performance. Perhaps we should link to OpenSSL if a faster SHA512 is desired.
  208. Reorganize the source tree into src, test; factor arch stuff into src/arch_*.
  209. Make most of the code 32-bit clean. There's now a 32-bit generic and 32-bit
  210. vectorless ARM version. No NEON version yet because I don't have a test
  211. machine (could use my phone in a pinch I guess?). The 32-bit version still
  212. isn't heavily optimized, but on ARM it's using a nicely reworked signed/phi-adic
  213. multiplier. The squaring is also based on this, but could really stand some
  214. improvement.
  215. When passed an even exponent (or extra doubles), the Montgomery ladder should
  216. now be accept points if and only if they lie on the curve. This needs
  217. additional testing, but it passes the zero bit exponent test.
  218. On 32-bit, use 8x4x14 instead of 5x5x18 table organization. Probably there's
  219. a better heuristic.
  220. March 5, 2014:
  221. First revision.
  222. Private keys are now longer. They now store a copy of the public key, and
  223. a secret symmetric key for signing purposes.
  224. Signatures are now supported, though like everything else in this library,
  225. their format is not stable. They use a deterministic Schnorr mode,
  226. similar to EdDSA. Precomputed low-latency signing is not supported (yet?).
  227. The hash function is SHA-512.
  228. The deterministic hashing mode needs to be changed to HMAC (TODO!). It's
  229. currently envelope-MAC.
  230. Probably in the future there will be a distinction between ECDH key and
  231. signing keys (and possibly also MQV keys etc).
  232. Began renaming internal functions. Removing p448_ prefixes from EC point
  233. operations. Trying to put the verb first. For example,
  234. "p448_isogeny_un_to_tw" is now called "twist_and_double".
  235. Began documenting with Doxygen. Use "make doc" to make a very incomplete
  236. documentation directory.
  237. There have been many other internal changes.
  238. Feb 21, 2014:
  239. Initial import and benchmarking scripts.
  240. Keygen and ECDH are implemented, but there's no hash function.