An Approach to Formal Verification of Arithmetic Functions in Assembly

  • Reynald Affeldt
  • Nicolas Marti
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4435)

Abstract

It is customary to write performance-critical parts of arithmetic functions in assembly: this enables finely-tuned algorithms that use specialized processor instructions. However, such optimizations make formal verification of arithmetic functions technically challenging, mainly because of many bit-level manipulations of data. In this paper, we propose an approach for formal verification of arithmetic functions in assembly. It consists in the implementation in the Coq proof assistant of (1) a Hoare logic for assembly programs augmented with loops and (2) a certified translator to ready-to-run assembly with jumps. To properly handle formal verification of bit-level manipulations of data, we propose an original encoding of machine integers. For concreteness, we use the SmartMIPS assembly language, an extension of the MIPS instruction set for smartcards, and we explain the formal verification of an optimized implementation of the Montgomery multiplication, a de facto-standard for the implementation of many cryptosystems.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Hoare, C.A.R.: An Axiomatic Basis for Computer Programming. Communications of the ACM 12(10), 576–585 (1969)CrossRefMATHGoogle Scholar
  2. 2.
    Montgomery, P.L.: Modular multiplication without trial division. Mathematics of Computation 44(170), 519–521 (1985)MathSciNetCrossRefMATHGoogle Scholar
  3. 3.
    Various contributors. The Coq Proof assistant. http://coq.inria.fr
  4. 4.
    Koc, C.K., Acar, T., Kaliski Jr, B.S.: Analyzing and Comparing Montgomery Multiplication Algorithms. IEEE Micro 16(3), 23–26 (1996)Google Scholar
  5. 5.
    MIPS Technologies. MIPS32 4KS Processor Core Family Software User’s Manual MIPS Technologies, Inc., 1225 Charleston Road, Mountain View, CA 94043-1353Google Scholar
  6. 6.
    Reynolds, J.C.: Separation Logic: A Logic for Shared Mutable Data Structures. In: LICS 2002. 17th IEEE Symposium on Logic in Computer Science, pp. 55–74 (2002)Google Scholar
  7. 7.
    Hamid, N.A., Shao, Z., Trifonov, V., Monnier, S., Ni, Z.: A Syntactic Approach to Foundational Proof-Carrying Code. In: LICS 2002. 7th IEEE Symposium on Logic In Computer Science, pp. 89–100 (2002)Google Scholar
  8. 8.
    Yu, D., Hamid, N.A., Shao, Z.: Building Certified Libraries for PCC: Dynamic Storage Allocation. In: Degano, P. (ed.) ESOP 2003 and ETAPS 2003. LNCS, vol. 2618, pp. 363–379. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  9. 9.
    Hamid, N.A., Shao, Z.: Interfacing Hoare Logic and Type Systems for Foundational Proof-Carrying Code. In: Slind, K., Bunker, A., Gopalakrishnan, G.C. (eds.) TPHOLs 2004. LNCS, vol. 3223, pp. 118–135. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  10. 10.
    Weber, T.: Towards Mechanized Program Verification with Separation Logic. In: Marcinkowski, J., Tarlecki, A. (eds.) CSL 2004. LNCS, vol. 3210, Springer, Heidelberg (2004)CrossRefGoogle Scholar
  11. 11.
    Babić, D., Musuvathi, M.: Modular Arithmetic Decision Procedure. Microsoft Research Technical Report. MSR-TR-2005-114Google Scholar
  12. 12.
    Saabas, A., Uustalu, T.: A Compositional Natural Semantics and Hoare Logic for Low-Level Languages. Electronic Notes in Theoretical Computer Science 156, 151–168 (2006)CrossRefMATHGoogle Scholar
  13. 13.
    Tan, G., Appel, A.W.: A Compositional Logic for Control Flow. In: Emerson, E.A., Namjoshi, K.S. (eds.) VMCAI 2006. LNCS, vol. 3855, pp. 80–94. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  14. 14.
    Leroy, X.: Formal certification of a compiler back-end, or: programming a compiler with a proof assistant. In: POPL 2006. 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 42–65Google Scholar
  15. 15.
    Chlipala, A.J.: Modular development of certified program verifiers with a proof assistant. In: ICFP 2006. 11th ACM SIGPLAN International Conference on Functional Programming, pp. 160–171 (2006)Google Scholar
  16. 16.
    Marti, N., Affeldt, R., Yonezawa, A.: Formal Verification of the Heap Manager of an Operating System using Separation Logic. In: Liu, Z., He, J. (eds.) ICFEM 2006. LNCS, vol. 4260, pp. 400–419. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  17. 17.
    Affeldt, R., Marti, N.: An Approach to Formal Verification of Arithmetic Functions in Assembly|Proof Scripts, http://staff.aist.go.jp/reynald.affeldt/seplog/asian2006

Copyright information

© Springer-Verlag Berlin Heidelberg 2007

Authors and Affiliations

  • Reynald Affeldt
    • 1
  • Nicolas Marti
    • 2
  1. 1.Research Center for Information SecurityNational Institute of Advanced Industrial Science and TechnologyJapan
  2. 2.Department of Computer ScienceUniversity of TokyoJapan

Personalised recommendations