Most software domains rely on compilers to translate high-level code to multiple different machine languages, with performance not too much worse than what developers would have the patience to write directly in assembly language. However, cryptography has been an exception, where many performance-critical routines have been written directly in assembly (sometimes through metaprogramming layers). Some past work has shown how to do formal verification of that assembly, and other work has shown how to generate C code automatically along with formal proof, but with consequent performance penalties vs. the best-known assembly. We present CryptOpt, the first compilation pipeline that specializes high-level cryptographic functional programs into assembly code significantly faster than what GCC or Clang produce, with mechanized proof (in Coq) whose final theorem statement mentions little beyond the input functional program and the operational semantics of x86-64 assembly. On the optimization side, we apply randomized search through the space of assembly programs, with repeated automatic benchmarking on target CPUs. On the formal-verification side, we connect to the Fiat Cryptography framework (which translates functional programs into C-like IR code) and extend it with a new formally verified program-equivalence checker, incorporating a modest subset of known features of SMT solvers and symbolic-execution engines. The overall prototype is quite practical, e.g. producing new fastest-known implementations of finite-field arithmetic for both Curve25519 (part of the TLS standard) and the Bitcoin elliptic curve secp256k1 for the Intel $12^{th}$ and $13^{th}$ generations.


翻译:摘要:大多数软件领域依赖编译器将高级代码翻译为多种不同的机器语言,其性能与开发者愿意直接编写汇编语言的耐心水平相比不会差太多。然而,密码学是一个例外,其许多性能关键型例程直接以汇编语言编写(有时通过元编程层)。过去的一些工作展示了如何对该汇编代码进行形式化验证,另一些工作则展示了如何自动生成C代码及其形式化证明,但会引入与已知最优汇编代码相比的性能损失。我们提出CryptOpt,这是首个专用编译流水线,能将高级密码学函数式程序编译为显著优于GCC或Clang生成的汇编代码,并提供机械化证明(基于Coq),其最终定理陈述几乎仅涉及输入函数式程序和x86-64汇编的操作语义。在优化方面,我们通过对汇编程序空间进行随机化搜索,并在目标CPU上重复自动基准测试。在形式化验证方面,我们连接了Fiat Cryptography框架(该框架将函数式程序翻译为类C的IR代码),并扩展了一个新的经形式化验证的程序等价检查器,该检查器整合了SMT求解器和符号执行引擎的已知功能的适度子集。整体原型非常实用,例如为Curve25519(TLS标准的一部分)和比特币椭圆曲线secp256k1生成了已知最快的有限域算术实现,适用于Intel第12代和第13代处理器。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
【ICDM 2022教程】图挖掘中的公平性:度量、算法和应用
专知会员服务
28+阅读 · 2022年12月26日
【开放书】《命令行数据科学指南(第二版)》
专知会员服务
43+阅读 · 2021年12月13日
【干货书】数值计算C编程,319页pdf,Numerical C
专知会员服务
72+阅读 · 2020年4月7日
强化学习最新教程,17页pdf
专知会员服务
182+阅读 · 2019年10月11日
【SIGGRAPH2019】TensorFlow 2.0深度学习计算机图形学应用
专知会员服务
41+阅读 · 2019年10月9日
编程语言Zig有什么与众不同的
InfoQ
0+阅读 · 2022年11月9日
微软全力拥抱 Java !
CSDN
0+阅读 · 2022年9月7日
“我最想要的六种编程语言!”
CSDN
1+阅读 · 2022年7月22日
借助 Spring Boot 和 GraalVM 实现原生 Java
InfoQ
0+阅读 · 2022年7月12日
通过 Play Integrity API 的 nonce 字段提高应用安全性
谷歌开发者
1+阅读 · 2022年7月6日
通过 Java 来学习 Apache Beam
InfoQ
0+阅读 · 2022年6月29日
已删除
将门创投
14+阅读 · 2019年5月29日
Hierarchically Structured Meta-learning
CreateAMind
27+阅读 · 2019年5月22日
人脸检测库:libfacedetection
Python程序员
15+阅读 · 2019年3月22日
【跟踪Tracking】15篇论文+代码 | 中秋快乐~
专知
18+阅读 · 2018年9月24日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
1+阅读 · 2011年12月31日
国家自然科学基金
1+阅读 · 2011年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
Arxiv
0+阅读 · 2023年6月6日
Arxiv
0+阅读 · 2023年6月6日
Arxiv
0+阅读 · 2023年6月2日
VIP会员
最新内容
《无人机对海面作战影响评估》
专知会员服务
10+阅读 · 7月21日
印度精确打击与指挥架构的断层
专知会员服务
5+阅读 · 7月20日
美空军AI完成F-16战斗机自主空战历史性试飞
专知会员服务
6+阅读 · 7月20日
深入Project Maven:为何人工智能在战场上依然失灵
锻造未来士兵:外骨骼、基因工程与赛博格
专知会员服务
8+阅读 · 7月19日
相关资讯
编程语言Zig有什么与众不同的
InfoQ
0+阅读 · 2022年11月9日
微软全力拥抱 Java !
CSDN
0+阅读 · 2022年9月7日
“我最想要的六种编程语言!”
CSDN
1+阅读 · 2022年7月22日
借助 Spring Boot 和 GraalVM 实现原生 Java
InfoQ
0+阅读 · 2022年7月12日
通过 Play Integrity API 的 nonce 字段提高应用安全性
谷歌开发者
1+阅读 · 2022年7月6日
通过 Java 来学习 Apache Beam
InfoQ
0+阅读 · 2022年6月29日
已删除
将门创投
14+阅读 · 2019年5月29日
Hierarchically Structured Meta-learning
CreateAMind
27+阅读 · 2019年5月22日
人脸检测库:libfacedetection
Python程序员
15+阅读 · 2019年3月22日
【跟踪Tracking】15篇论文+代码 | 中秋快乐~
专知
18+阅读 · 2018年9月24日
相关基金
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
1+阅读 · 2011年12月31日
国家自然科学基金
1+阅读 · 2011年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
Top
微信扫码咨询专知VIP会员