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.
 
 
 
 
 

428 lines
19 KiB

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