Commit graph

2423 commits

Author SHA1 Message Date
Henry de Valence
14163131f9 Lift the reduction state of the field elements into the type system.
This splits the `FieldElement51x4` type into two types:

- `F51x4Reduced` (with reduced limbs)
- `F51x4Unreduced` (with unreduced limbs)

The reduction is implemented as a `From` impl to convert one type to the other.

The output of a multiplication is now a `F51x4Unreduced`.  The reason is that
the inputs to IFMA operations must be at most 52 bits, so it's not possible to
perform an addition of (51+epsilon)-bit values and still be small enough to be
used as an input to multiplication.  So, it doesn't make sense to perform a
reduction at the end of a multiplication, because the reduced values will be
fed into an addition or subtraction, which then needs to be re-reduced.
2019-01-18 14:19:30 -08:00
Henry de Valence
ff49673214 Add impl Mul<(u32, u32, u32, u32)> for FieldElement51x4. 2019-01-18 14:19:30 -08:00
Henry de Valence
70199d6094 Add impl Mul<FieldElement51x4> for FieldElement51x4. 2019-01-18 14:19:30 -08:00
Henry de Valence
aa73d7b1bc Add a FieldElement51x4 type. 2019-01-18 14:19:30 -08:00
Henry de Valence
3233e2eac6 Fix: cfg_target_feature is stable since 1.27. 2019-01-18 14:19:20 -08:00
Henry de Valence
be77af1cd8 Remove unnecessary feature gate.
The vector backend doesn't generate constants in build.rs, so this isn't necessary.
2019-01-18 14:18:55 -08:00
Henry de Valence
e91cc685b1 Don't generate unused constants in build.rs. 2019-01-18 14:15:28 -08:00
Henry de Valence
47a164da4d Replace avx2_backend with simd_backend (autoselects AVX2/IFMA) 2019-01-18 01:52:17 -08:00
Henry de Valence
9ed2128a10 Add stub code for IFMA intrinsics in Rust. 2019-01-18 01:52:17 -08:00
Henry de Valence
0a97f5fe8c Don't compile the serial scalar_mul when using the vector one. 2019-01-18 01:52:07 -08:00
Henry de Valence
f1d2b5182b Restructure source tree into serial and vector backends.
This begins to attempt to restructure the source tree so that the common parts
are common and the different parts are different.

The backend is now split into two parts:
- serial (containing the implementation using serial formulas and mixed-model arithmetic).
- vector (containing the implementation using parallel formulas and single-model arithmetic).

The serial scalar_mul tree is now under backend::serial::scalar_mul.
The avx2 scalar_mul tree is now under backend::avx2::scalar_mul.
2019-01-18 01:49:40 -08:00
Henry de Valence
94cb3e7842 Rename field types based on radix.
`FieldElement32` -> `FieldElement2625`
`FieldElement64` -> `FieldElement51`
`Scalar32` -> `Scalar29`
`Scalar64` -> `Scalar52`

This naming is more accurate and would let us add an ADX backend later.
2019-01-17 22:21:55 -08:00
Isis Lovecruft
f5f79f56c8
Fix link to now-missing katex header.
This fixes https://github.com/dalek-cryptography/x25519-dalek/issues/23 as
reported by @DebugSteven.
2019-01-18 06:13:15 +00:00
Isis Lovecruft
ebd9ad6a6e
Merge branch 'master' into develop 2019-01-18 05:58:49 +00:00
Isis Lovecruft
a65683accd
Merge branch 'release/1.0.0-pre.1' 2019-01-18 05:58:42 +00:00
Isis Lovecruft
e527280d2e
Remove TravisCI test for the sha2 feature which was removed. 2019-01-18 04:59:12 +00:00
Isis Lovecruft
ae8764fbef
Update copyright year to 2019 and destroy capitalism. 2019-01-18 04:59:12 +00:00
Isis Lovecruft
131fc2b07f
Bump ed25519-dalek version to 1.0.0-pre.1. 2019-01-18 04:59:12 +00:00
Isis Lovecruft
6d1d3ff5ea
Remove outdated comment about Fuchsia dependencies from Cargo.toml. 2019-01-18 04:59:12 +00:00
Isis Lovecruft
adf4c0ea03
Merge branch 'master' into develop 2019-01-18 04:57:49 +00:00
Isis Lovecruft
14e093925f
Merge branch 'release/0.9.1' 2019-01-18 04:50:45 +00:00
Isis Lovecruft
d447efbd59
Bump ed25519-dalek to 0.9.1. 2019-01-18 04:47:54 +00:00
Isis Lovecruft
84abd4855a
Update curve25519-dalek dependency to 1.0. 2019-01-18 04:45:23 +00:00
Henry de Valence
4814242d00 Merge branch 'master' into develop 2019-01-17 19:26:50 -08:00
Henry de Valence
3564d18ff8 Merge branch 'release/1.0.2' 2019-01-17 19:26:35 -08:00
Henry de Valence
0328fb1342 Bump patch version 2019-01-17 19:25:34 -08:00
Isis Lovecruft
454fb5d09e
Merge branch 'master' into develop 2019-01-17 23:22:12 +00:00
Isis Lovecruft
8c8c04cb32
Merge branch 'release/0.9.0' 2019-01-17 23:17:40 +00:00
Isis Lovecruft
f851aaf464
Bump ed25519-dalek version to 0.9. 2019-01-17 22:41:18 +00:00
Isis Lovecruft
35b4dfd24d
Bump rand dependency version to 0.6. 2019-01-17 22:39:48 +00:00
Henry de Valence
f48980cb5b
Merge pull request #223 from hdevalence/ristretto-fix
Fix variable naming in Ristretto decoding formulas
2019-01-16 17:54:23 -08:00
Henry de Valence
3c5f18215e Merge branch 'master' into develop 2019-01-15 22:57:17 -08:00
Henry de Valence
c232c2de3b Merge branch 'release/0.4.2' 2019-01-15 22:57:04 -08:00
Henry de Valence
b21ab1324f Bump minor version 2019-01-15 22:47:35 -08:00
Henry de Valence
9bef799510
Merge pull request #22 from dalek-cryptography/add-x25519-constant
Add an X25519 basepoint constant
2019-01-15 22:46:35 -08:00
Henry de Valence
dd8b61da4a Add an X25519 basepoint constant 2019-01-15 21:44:56 -08:00
Isis Lovecruft
9d606a38e8
Merge branch 'master' into develop 2019-01-16 04:14:29 +00:00
Isis Lovecruft
3e487c81f9
Merge branch 'release/0.4.1' 2019-01-16 04:14:17 +00:00
Isis Lovecruft
47e8689b2d
Bump x25519-dalek version to 0.4.1. 2019-01-16 02:23:14 +00:00
isis agora lovecruft
19f95439a9
Merge pull request #21 from isislovecruft/fix/15-ignore-readme-tests
Ignore README doctests for now
2019-01-16 02:20:59 +00:00
Isis Lovecruft
95b12934d7
Ignore README doctests for now. 2019-01-16 02:18:22 +00:00
Isis Lovecruft
46d0051cda
Merge branch 'master' into develop 2019-01-16 02:07:12 +00:00
Isis Lovecruft
b71d49e12f
Merge branch 'release/0.4.0' 2019-01-16 02:07:04 +00:00
Isis Lovecruft
53ba2f3bcc
Merge remote-tracking branch 'newpavlov/rand_os' into release/0.4.0 2019-01-16 01:29:46 +00:00
Henry de Valence
e6f27ca996 Fix Ristretto variable naming in decoding function
The code swaps u_1 and u_2 relative to the formulas (probably when doing the change for a=-1)
2019-01-13 18:01:00 -08:00
Isis Lovecruft
bab903cb65
Bump x25519-dalek version to 0.4.0. 2019-01-12 23:35:03 +00:00
Isis Lovecruft
c9a1ef6a36
Credit @DebugSteven as an author. 2019-01-12 23:34:49 +00:00
Isis Lovecruft
a58b4cf189
Fix two links to repos in CONTRIBUTING.md. 2019-01-12 23:33:49 +00:00
Henry de Valence
b8716bb82b Pull source docs from README 2019-01-10 10:30:30 -08:00
Henry de Valence
65f94124f4 Reformat dependencies, add docs.rs metadata 2019-01-10 10:08:08 -08:00