arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2412.07235cs.SEcs.PL
收藏

形式化可验证的生成式ASN.1/ACN编码器与解码器:一项案例研究

Formally Verifiable Generated ASN.1/ACN Encoders and Decoders: A Case Study

Mario Bucev, Samuel Chassot, Simon Felix, Filip Schramka, Viktor Kunčak

AI总结:

本研究为ASN1SCC编译器开发可验证的Scala后端,增强代码生成器输出验证所需条件与引理,借助Stainless验证生成的ASN.1/ACN编解码代码的安全性与可逆性,完成超30万条验证条件证明。

摘要:

我们为ASN1SCC(一种ASN.1/ACN编译器)提出了一种经过验证的可执行Scala后端。ASN.1是一种用于描述数据结构的语言,广泛应用于地面与空间电信领域。ACN可与ASN.1配合使用,用于描述复杂二进制格式和遗留协议。为避免编写序列化器时易出错且耗时的手动工作,我们展示了如何移植ASN.1/ACN代码生成器以生成Scala代码。随后我们增强了该生成器,使其不仅能生成可执行代码,还能输出足够强的前置条件、后置条件以及用于归纳证明的引理。这使得我们能够使用Stainless(一款Scala程序验证器)验证生成的带注解代码。我们证明的性质包括不存在运行时错误,例如越界访问或除以零。对于基础库,我们还证明了编解码函数的可逆性,即解码操作能还原出编码前的值。此外,我们的系统会自动为生成代码中的任意记录插入可逆性证明,已证明超过300000个验证条件。我们也为和类型与数组的此类证明确立了关键步骤。

英文摘要:

We propose a verified executable Scala backend for ASN1SCC, a compiler for ASN.1/ACN. ASN.1 is a language for describing data structures widely employed in ground and space telecommunications. ACN can be used along ASN.1 to describe complex binary formats and legacy protocols. To avoid error-prone and time-consuming manual writing of serializers, we show how to port an ASN.1/ACN code generator to generate Scala code. We then enhance the generator to emit not only the executable code but also strong enough pre-conditions, post-conditions, and lemmas for inductive proofs. This allowed us to verify the resulting generated annotated code using Stainless, a program verifier for Scala. The properties we prove include the absence of runtime errors, such as out-of-bound accesses or divisions by zero. For the base library, we also prove the invertibility of the decoding and encoding functions, showing that decoding yields the encoded value back. Furthermore, our system automatically inserts invertibility proofs for arbitrary records in the generated code, proving over 300'000 verification conditions. We establish key steps towards such proofs for sums and arrays as well.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑