Previously, we used a little bit of generation to drive a lot of Rust macros. This works, but it's a little confusing to read and write. In addition, we used a lot of implementations with variable timings based on their input, which isn't great for crypto. This is the start of an attempt to just generate all of the relevant Rust code directly, and to use timing-channel resistant implementations for most of the routines.
52 lines
1.3 KiB
Rust
52 lines
1.3 KiB
Rust
//! This module includes a large number of signed integer types for very
|
|
//! large integers, designed to try to match good performance with a high
|
|
//! assurance threshold.
|
|
//!
|
|
//! The types provided in this module, and the functions available for each
|
|
//! of those types, is derived from standard bit widths for RSA, DSA, and
|
|
//! Elliptic Curve encryption schemes. If this library does not include a
|
|
//! function you would like for another cryptographic scheme, please reach
|
|
//! out to the authors; in many cases, the relevant code can be automatically
|
|
//! generated.
|
|
//!
|
|
#[macro_use]
|
|
mod add;
|
|
#[macro_use]
|
|
mod base;
|
|
#[macro_use]
|
|
mod compare;
|
|
#[macro_use]
|
|
mod conversion;
|
|
#[macro_use]
|
|
mod div;
|
|
#[macro_use]
|
|
mod egcd;
|
|
#[macro_use]
|
|
mod moddiv;
|
|
#[macro_use]
|
|
mod modinv;
|
|
#[macro_use]
|
|
mod mul;
|
|
#[macro_use]
|
|
mod scale;
|
|
#[macro_use]
|
|
mod shift;
|
|
#[macro_use]
|
|
mod subtraction;
|
|
|
|
use quickcheck::{Arbitrary,Gen};
|
|
use std::cmp::{Ord,Ordering,PartialOrd};
|
|
use std::fmt;
|
|
use std::ops::{Add,AddAssign};
|
|
use std::ops::{Div,DivAssign};
|
|
use std::ops::{Mul,MulAssign};
|
|
use std::ops::{Rem,RemAssign};
|
|
use std::ops::{Shl,ShlAssign,Shr,ShrAssign};
|
|
use std::ops::{Sub,SubAssign};
|
|
use unsigned::*;
|
|
|
|
pub use self::egcd::EGCD;
|
|
pub use self::moddiv::ModDiv;
|
|
pub use self::modinv::ModInv;
|
|
|
|
include!("invoc.rs"); |