Multiprecision Arithmetic for Cryptology in C++ - Compile-Time Computations and Beating the Performance of Hand-Optimized Assembly at Run-Time

04/19/2018
by   Niek J. Bouman, et al.
0

We describe a new C++ library for multiprecision arithmetic for numbers in the order of 100–500 bits, i.e., representable with just a few limbs. The library is written in "optimizing-compiler-friendly" C++, with an emphasis on the use of fixed-size arrays and particular function-argument-passing styles (including the avoidance of naked pointers) to allow the limbs to be allocated on the stack or even in registers. Depending on the particular functionality, we get close to, or significantly beat the performance of existing libraries for multiprecision arithmetic that employ hand-optimized assembly code. Most functions in the library are constant-time, which is a necessity for secure implementations of cryptographic protocols. Beyond the favorable runtime performance, our library is, to the best of the author's knowledge, the first library that offers big-integer computations during compile-time. For example, when implementing finite-field arithmetic with a fixed modulus, this feature enables the automatic precomputation (at compile time) of the special modulus-dependent constants required for Barrett and Montgomery reduction. Another application is to parse (at compile-time) a base-10-encoded big-integer literal.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
01/29/2021

lrsarith: a small fixed/hybrid arithmetic C library

We describe lrsarith which is a small fixed precision and hybrid arithme...
research
11/29/2016

Moore: Interval Arithmetic in Modern C++

We present the library Moore, which implements Interval Arithmetic in mo...
research
12/20/2020

Universal Numbers Library: design and implementation of a high-performance reproducible number systems library

With the proliferation of embedded systems requiring intelligent behavio...
research
06/13/2019

A JIT Compiler for Neural Network Inference

This paper describes a C++ library that compiles neural network models a...
research
09/28/2022

FV Time: a formally verified Coq library

FV Time is a small-scale verification project developed in the Coq proof...
research
05/01/2017

Computing Tropical Prevarieties in Parallel

The computation of the tropical prevariety is the first step in the appl...
research
09/09/2023

A Further Study of Linux Kernel Hugepages on A64FX with FLASH, an Astrophysical Simulation Code

We present an expanded study of the performance of FLASH when using Linu...

Please sign up or login with your details

Forgot password? Click here to reset