On construction of a library of formally verified low-level arithmetic functions

Arithmetic functions are used in many important computer programs such as computer algebra systems and cryptographic software. The latter are critical applications whose correct implementation deserves to be formally guaranteed. They are also computation-intensive applications, so that programmers often resort to low-level assembly code to implement arithmetic functions. We propose an approach for the construction of a library of formally verified low-level arithmetic functions. To build our library, we first introduce a formalization of data structures for signed multi-precision arithmetic in low-level programs. We use this formalization to verify the implementation of several primitive arithmetic functions using Separation logic, an extension of Hoare logic to deal with pointers. Since this direct style of formal verification leads to technically involved specifications, we also propose for larger functions to show a formal simulation relation between pseudo-code and assembly. This style of verification is illustrated with a concrete implementation of the binary extended gcd algorithm.

[1]  P ? ? ? ? ? ? ? % ? ? ? ? , 1991 .

[2]  Christine Paulin-Mohring,et al.  The coq proof assistant reference manual , 2000 .

[3]  Enrico Tassi,et al.  A Small Scale Reflection Extension for the Coq system , 2008 .

[4]  Xavier Leroy,et al.  A Formally Verified Compiler Back-end , 2009, Journal of Automated Reasoning.

[5]  Nancy A. Lynch,et al.  Forward and Backward Simulations: I. Untimed Systems , 1995, Inf. Comput..

[6]  John C. Reynolds,et al.  The craft of programming , 1981, Prentice Hall International series in computer science.

[7]  Taher ElGamal,et al.  A public key cyryptosystem and signature scheme based on discrete logarithms , 1985 .

[8]  Reynald Affeldt,et al.  Towards formal verification of TLS network packet processing written in C , 2013, PLPV.

[9]  Hongseok Yang,et al.  Relational separation logic , 2007, Theor. Comput. Sci..

[10]  Michael Norrish,et al.  Mind the Gap , 2009, TPHOLs.

[11]  Juan Manuel Crespo,et al.  A Machine-Checked Framework for Relational Separation Logic , 2011, SEFM.

[12]  Nick Benton,et al.  Simple relational correctness proofs for static analyses and program transformations , 2004, POPL.

[13]  Andrew W. Appel,et al.  A Compositional Logic for Control Flow , 2006, VMCAI.

[14]  Stefan Berghofer Verification of Dependable Software using SPARK and Isabelle , 2011, SSV.

[15]  John C. Reynolds,et al.  Separation logic: a logic for shared mutable data structures , 2002, Proceedings 17th Annual IEEE Symposium on Logic in Computer Science.

[16]  Magnus O. Myreen Verified just-in-time compiler on x86 , 2010, POPL '10.

[17]  Donald Ervin Knuth,et al.  The Art of Computer Programming , 1968 .

[18]  Reynald Affeldt On construction of a library of formally verified low-level arithmetic functions , 2012, SAC.

[19]  Tobias Nipkow,et al.  Proceedings of the 22nd International Conference on Theorem Proving in Higher Order Logics , 2009 .

[20]  Chung-Kil Hur,et al.  A kripke logical relation between ML and assembly , 2011, POPL '11.

[21]  Magnus O. Myreen,et al.  Hoare Logic for Realistically Modelled Machine Code , 2007, TACAS.

[22]  Alfred Menezes,et al.  Handbook of Applied Cryptography , 2018 .

[23]  F. Vaandrager Forward and Backward Simulations Part I : Untimed Systems , 1993 .

[24]  Reynald Affeldt,et al.  Certifying assembly with formal security proofs: The case of BBS , 2012, Sci. Comput. Program..

[25]  Arrow Buttons Frequently asked questions , 2009 .

[26]  Akinori Yonezawa,et al.  Formal Verification of the Heap Manager of an Operating System Using Separation Logic , 2006, ICFEM.

[27]  BentonNick Simple relational correctness proofs for static analyses and program transformations , 2004 .

[28]  Gerwin Klein,et al.  Secure Microkernels, State Monads and Scalable Refinement , 2008, TPHOLs.

[29]  Anna Philippou,et al.  Tools and Algorithms for the Construction and Analysis of Systems , 2018, Lecture Notes in Computer Science.

[30]  Reynald Affeldt,et al.  An Approach to Formal Verification of Arithmetic Functions in Assembly , 2006, ASIAN.

[31]  Richard P. Brent,et al.  Modern Computer Arithmetic , 2010 .

[32]  Reynald Affeldt,et al.  A Certified Verifier for a Fragment of Separation Logic , 2009 .

[33]  Guillaume Melquiond,et al.  Flocq: A Unified Library for Proving Floating-Point Algorithms in Coq , 2011, 2011 IEEE 20th Symposium on Computer Arithmetic.