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.
 
 
 
 
 

315 lines
14 KiB

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