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.
 
 
 
 
 

268 lines
12 KiB

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