Code that is highly optimized poses a problem for program-level verification: programmers can employ various clever tricks that are non-trivial to reason about. For cryptography on low-power devices, it is nonetheless crucial that implementations be functionally correct, secure, and efficient. These are usually crafted in hand-optimized machine code that eschew conventional control flow as much as possible. We have formally verified such code: a library which implements elliptic curve cryptography on 8-bit AVR microcontrollers. The chosen implementation is the most efficient currently known for this microarchitecture. It consists of over 3000 lines of assembly instructions. Building on earlier work, we use the Why3 platform to model the code and prove verification conditions, using automated provers. We expect the approach to be re-usable and adaptable, and it allows for validation. Furthermore, an error in the original implementation was found and corrected, at the same time reducing its memory footprint. This shows that practical verification of cutting-edge code is not only possible, but can in fact add to its efficiency -- and is clearly necessary.
翻译:高度优化的代码会给程序级的核查造成问题: 程序员可以使用各种非三维的巧妙技巧。 对于低功率装置的加密来说, 关键是执行功能正确、安全和高效。 这些通常是用手动优化的机器代码制作的, 尽可能避免常规控制流。 我们已经正式验证了这种代码: 一个在 8 位 AVR 微控制器上安装 椭圆曲线密码的图书馆。 所选择的实施是目前已知的这个微缩结构中最有效的。 它由3,000多行的组装指令组成。 在早期工作的基础上, 我们使用 Whis3 平台来模拟代码并验证核查条件, 使用自动验证器。 我们期望该方法能够重新使用并适应, 并允许验证。 此外, 在减少记忆足迹的同时, 发现并纠正了最初执行过程中的错误。 这显示, 对尖端代码的实际核查不仅可能, 而且事实上可以增加其效率, 而且显然是必要的 。