A Performant, Misuse-Resistant API for Primality Testing
Jake Massimo, Kenneth G. Paterson
Abstract
Primality testing is a basic cryptographic task. But developers today are faced with complex APIs for primality testing, along with documentation that fails to clearly state the reliability of the tests being performed. This leads to the APIs being incorrectly used in practice, with potentially disastrous consequences. In an effort to overcome this, we present a primality test having a simplest-possible API: the test accepts a number to be tested and returns a Boolean indicating whether the input was composite or probably prime. For all inputs, the output is guaranteed to be correct with probability at least 1 - 2-128. The test is performant: on random, odd, 1024-bit inputs, it is faster than the default test used in OpenSSL by 17%. We investigate the impact of our new test on the cost of random prime generation, a key use case for primality testing. The OpenSSL developers have adopted our suggestions in full; our new API and primality test are scheduled for release in OpenSSL 3.0.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext f1321a8d-ceab-40fc-b57b-b5a81e5b5412Cited by top-tier papers1
Ask how each one uses itBuilds on4
- Comparing the Usability of Cryptographic APIsYasemin Acar, Michael Backes, Sascha Fahl, Simson L. Garfinkel et al.S&P 2017 · 261 citations
- Why Do Developers Get Password Storage Wrong?: A Qualitative Usability StudyAlena Naiakshina, Anastasia Danilova, Christian Tiefenau, Marco Herzog et al.CCS 2017 · 146 citations
- Prime and Prejudice: Primality Testing Under Adversarial ConditionsMartin R. Albrecht, Jake Massimo, Kenneth G. Paterson, Juraj SomorovskyCCS 2018 · 21 citations
- Partially Specified Channels: The TLS 1.3 Record Layer without ElisionChristopher Patton, Thomas ShrimptonCCS 2018 · 11 citations
Related papers
- The Secure Socket API: TLS as an Operating System ServiceMark O'Neill, Scott Heidbrink, Jordan Whitehead, Tanner Perdue et al.USENIX Security 2018 · 20 citations
- Simple High-Level Code for Cryptographic Arithmetic - With Proofs, Without CompromisesAndres Erbsen, Jade Philipoom, Jason Gross, Robert Sloan et al.S&P 2019 · 147 citations
- HACL*: A Verified Modern Cryptographic LibraryJean Karim Zinzindohoué, Karthikeyan Bhargavan, Jonathan Protzenko, Benjamin BeurdoucheCCS 2017 · 258 citations
- "I'm Pretty Expert and I Still Screw It Up": Qualitative Insights into Experiences and Challenges of Designing and Implementing Cryptographic Library APIsJuliane Schmüser, Philip Klostermeyer, Kay Friedrich, Sascha FahlS&P 2025
- Secure Distributed RSA Modulus Generation Revisited: A Faster and More Communication-Efficient ConstructionShaojing Zhang, Chengliang Tian, Ruixue Wang, Hequn Xian et al.USENIX Security 2026
