Why does my assembly code even work at this point?! I hope one day one doesn't need to be a PhD to formally verify it...

Interesting, DJB and Peter Schwabe have a demo program for verifying the correctness of finite-field arithmetic in Curve25519 code, it's almost fully automatic, only needs minimum annotations. It simply extracts the calculation you are trying do to, generates a SageMath script, and calls SageMath to crosscheck the math. Not real "formal verification", but certainly better than staring at the screen with pen and paper...

Perhaps it's really possible to hack the code and use it to verify my PDP-11 assembly code. gfverif.cryptojedi.org/index.s

Oh no, the program correctness verifier has SIGSEGVed and crashed. "You've become the very thing you swore to destroy"...

gfverif's way of doing quick and dirty verification of existing C code is somewhere between genius and madness - define a new "mockup" integer type and use C++ to overload the operators like plus or minus, instead of doing calculations, it generates SageMath scripts of equivalent operations in algebra. This way, the entire C algorithm can be automatically extracted without writing any parser or compiler... The only problem: conditional branches using data are not supported, but you're not supposed to do that in crypto anyway... 🤣


@niconiconi 之前上课的时候请外面的人来讲他们搞形式证明就是用的他们自己搞的C parser。这里直接不要parser就很有意思。

· · Web · 0 · 0 · 0
Sign in to participate in the conversation

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!