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.
 
 
 
 
 

420 regels
19 KiB

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