Ideas for a New Elliptic Curve Library
briansmith.org
briansmith.org
I like the idea of using a simpler DSL to interact with ECC.
One project that tries to do something like this is Nadeko: https://www.reddit.com/r/rust/comments/3696wt/checking_that_...
I wrote the paper mostly in the context of implementing signature verification, which doesn't require side-channel protection since there are no secrets in verification. But, I think the DSL approach is even more important for ECDH and signing, where side-channel protection is important.
Finally, given that processors don't even promise us that any instruction is constant-time, and given that other types of attacks are possible where constant-timesness doesn't help so much (e.g. power analysis), I think it is worth considering other approaches to side-channel protection (e.g. blinding). For many applications, constant-timeness isn't sufficient and I'd love to learn that it isn't necessary.
And write the non-crypto TLS protocol part in a safe language like Rust while we are at it.
I've already written a prototype that compiles that DSL into C, which requires a leap of faith that the C compiler won't ruin things for us. That prototype convinced me that it would likely be much less work to go the DSL route than the C++/Rust library route. Note that I prefer writing C++ and Rust libraries to creating DSLs, so this was a disappointing conclusion for me.
Remember that one of the goals is to become confident that the implementation is correct without also having to analyze whether rustc is correct or whether the Rust language has meaningful semantics. If we involve rustc in it, then we've greatly expanded the scope of what we have to analyze.
Even if asm! were stable in Rust, I would still prefer to have my assembly language in separate .s/.asm files. rustc gets updated every 6 weeks, which is great, but I'd really kind of like my assembler to be more static than that. Assembly language benefits massively from having macros, but Rust actually is not as good of a macro language for assembly as existing assembler macro languages. I'd rather see rustc improve at compiling Rust code than have it try to also compile ASM code.
I don't think there's a question about whether the goals can be met so much as a lack of uptake of methods and tools that meet them. Uptake and improvement on their capabilities, that is. So go for it people. :)
[1] https://www.acsac.org/2012/workshops/law/pdf/Launchbury.pdf
[2] https://galois.com/blog/2012/03/verifying-ecc-implementation...
[3] http://www.cps-vo.org/file/19230/download/59388
[5] https://www.easycrypt.info/trac/raw-attachment/wiki/BibTex/C...
Yes.
> I don't think there's a question about whether the goals can be met so much as a lack of uptake of methods and tools that meet them.
I agree. And, that's a big part of the reason I didn't spend a lot of time on formal verification when I wrote what I wrote. The target audience of my writing is people think that the result must be as fast as the fastest implementation, but that only think that formal verification of correctness is nice to have and/or impractical to the point of not being worth trying. That isn't my own personal prioritization, but I think that actually describes the prioritization of almost everybody deploying open source crypto software today.
Anyway, I hope to have more to say about formal verification of ECC implementations later.
More likely an informal method. In the distant past, my method was to use a language with compile-time macro's to decompose the overall algorithm into simplest functions. In dev mode, I could manually run checks to hopefully ensure my assumptions were correct. Each module was simple enough to extensively test and spot coding defects. If necessary, I could do it at ASM level while wrapping low-level stuff in HLL calls w/ checks. In production mode, it compiled to straight-forward, high-performance, low-level code.
So, two routes with different levels of formality and optimization. The 2nd method is more likely to get adopted. Just not sure how many weird corner cases can be prevented that way.
The profiling mode would generate a random seed, generate the code, compile the code, run a program that measures the performance of the code, and compares the execution time to the previously-known best execution time. Then we would just let it run until we run out of development time, take the best seed the program output, update the build system so that the new seed is used for production builds, and say we’re done. We could call our ridiculous compiler the “super dumb compiler” and hope that people confuse it for a superoptimizing compiler. To scale this incredibly inefficient optimization strategy, we could mint a new cryptocurrency, Superdumbcompilercoin, where we trick people into running the super dumb compiler on their computers, cross-certifying each others’ results, and sending us increasingly better optimization seeds in return for plausible delusions of becoming rich.