Paper 2024/442

Fastcrypto: Pioneering Cryptography Via Continuous Benchmarking

Kostas Kryptos Chalkias, Mysten Labs
Jonas Lindstrøm, Mysten Labs
Deepak Maram, Mysten Labs
Ben Riva, Mysten Labs
Arnab Roy, Mysten Labs
Alberto Sonnino, Mysten Labs, University College London
Joy Wang, Mysten Labs
Abstract

In the rapidly evolving fields of encryption and blockchain technologies, the efficiency and security of cryptographic schemes significantly impact performance. This paper introduces a comprehensive framework for continuous benchmarking in one of the most popular cryptography Rust libraries, fastcrypto. What makes our analysis unique is the realization that automated benchmarking is not just a performance monitor and optimization tool, but it can be used for cryptanalysis and innovation discovery as well. Surprisingly, benchmarks can uncover spectacular security flaws and inconsistencies in various cryptographic implementations and standards, while at the same time they can identify unique opportunities for innovation not previously known to science, such as providing a) hints for novel algorithms, b) indications for mix-and-match library functions that result in world record speeds, and c) evidences of biased or untested real world algorithm comparisons in the literature. Our approach transcends traditional benchmarking methods by identifying inconsistencies in multi-threaded code, which previously resulted in unfair comparisons. We demonstrate the effectiveness of our methodology in identifying the fastest algorithms for specific cryptographic operations like signing, while revealing hidden performance characteristics and security flaws. The process of continuous benchmarking allowed fastcrypto to break many crypto-operations speed records in the Rust language ecosystem. A notable discovery in our research is the identification of vulnerabilities and unfair speed claims due to missing padding checks in high-performance Base64 encoding libraries. We also uncover insights into algorithmic implementations such as multi-scalar elliptic curve multiplications, which exhibit different performance gains when applied in different schemes and libraries. This was not evident in conventional benchmarking practices. Further, our analysis highlights bottlenecks in cryptographic algorithms where pre-computed tables can be strategically applied, accounting for L1 and L2 CPU cache limitations. Our benchmarking framework also reveals that certain algorithmic implementations incur additional overheads due to serialization processes, necessitating a refined `apples to apples' comparison approach. We identified unique performance patterns in some schemes, where efficiency scales with input size, aiding blockchain technologies in optimal parameter selection and data compression. Crucially, continuous benchmarking serves as a tool for ongoing audit and security assurance. Variations in performance can signal potential security issues during upgrades, such as cleptography, hardware manipulation or supply chain attacks. This was evidenced by critical private key leakage vulnerabilities we found in one of the most popular EdDSA Rust libraries. By providing a dynamic and thorough benchmarking approach, our framework empowers stakeholders to make informed decisions, enhance security measures, and optimize cryptographic operations in an ever-changing digital landscape.

Metadata
Available format(s)
PDF
Category
Implementation
Publication info
Published elsewhere. Companion of the 15th ACM/SPEC International Conference on Performance Engineering (ICPE ’24 Companion)
DOI
10.1145/3629527.3652266
Keywords
cryptographycryptanalysiscontinuous benchmarkingRust languageblockchaincrypto auditssupply chain attacks
Contact author(s)
kostas @ mystenlabs com
jonas @ mystenlabs com
deepak @ mystenlabs com
benriva @ mystenlabs com
arnab @ mystenlabs com
alberto @ mystenlabs com
joy @ mystenlabs com
History
2024-03-15: approved
2024-03-14: received
See all versions
Short URL
https://ia.cr/2024/442
License
Creative Commons Attribution
CC BY

BibTeX

@misc{cryptoeprint:2024/442,
      author = {Kostas Kryptos Chalkias and Jonas Lindstrøm and Deepak Maram and Ben Riva and Arnab Roy and Alberto Sonnino and Joy Wang},
      title = {Fastcrypto: Pioneering Cryptography Via Continuous Benchmarking},
      howpublished = {Cryptology {ePrint} Archive, Paper 2024/442},
      year = {2024},
      doi = {10.1145/3629527.3652266},
      url = {https://eprint.iacr.org/2024/442}
}
Note: In order to protect the privacy of readers, eprint.iacr.org does not use cookies or embedded third party content.