• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

_aux/H03-May-2022-4,4273,535

cmake/H05-Jun-2018-5147

python/H01-Jun-2017-342211

src/H03-May-2022-24,89816,545

test/H03-May-2022-3,1202,659

Doxyfile.inH A D05-Jun-201898 KiB2,3071,778

MakefileH A D03-May-202213 KiB346248

README.mdH A D05-Jun-20185.9 KiB13298

README.md

1# Decaf elliptic curve library
2
3The libdecaf library is for elliptic curve research and practical application.
4It currently supports Ed448-Goldilocks and Curve25519.
5
6The goals of this library are:
7
8* Implementing the X25519, X448 key exchange protocols (RFC 7748).
9* Implementing the Ed25519 and EdDSA-Ed448 signature schemes (RFC 8032).
10* Providing a platform for research and development of advanced cryptographic schemes using twisted Edwards curves.
11
12This library is intended for developers who have experience with
13cryptography.  It doesn't (yet?) include documentation on how to use
14digital signatures or key exchange securely.  Consult your local
15cryptographer for advice.
16
17## Mailing lists
18
19Because this is new software, please expect it to have bugs, perhaps
20even critical security bugs.  If you are using it, please sign up for
21updates:
22
23* Security-critical announcements (very low volume, God willing):
24    decaf-security@googlegroups.com, join at https://groups.google.com/forum/#!forum/decaf-security
25* New version announcements (low volume):
26    decaf-announce@googlegroups.com, join at https://groups.google.com/forum/#!forum/decaf-annonuce
27* Library discussion (potentially more volume):
28    decaf-discuss@googlegroups.com, join at https://groups.google.com/forum/#!forum/decaf-discuss
29
30## General elliptic curve operations.
31
32This is a multi-purpose elliptic curve library.  There is a C library,
33and a set of C++ wrapper headers.  The C++ code consists entirely of
34inline calls, and has no compiled component.
35
36The library implements a fairly complete suite of operations on the
37supported curves:
38
39* Point and scalar serialization and deserialization.
40* Point addition, subtraction, doubling, and equality.
41* Point multiplication by scalars.  Accelerated double- and dual-scalar multiply.
42* Scalar addition, subtraction, multiplication, division, and equality.
43* Construction of precomputed tables from points.  Precomputed scalarmul.
44* Hashing to the curve with an Elligator variant.  Inverse of elligator for steganography.  These are useful for advanced protocols such as password-authenticated key exchange (PAKE) and verifiable random functions (VRFs).
45
46Internally, the library uses twisted Edwards curves with the "decaf"
47and "ristretto" technique to remove the curve's cofactor of 4 or 8.
48The upshot is that systems using the "decaf" interface will be using
49a prime-order group, which mitigates one of the few disadvantages of
50Edwards curves.  However, this means that it is not able to implement
51systems which care about cofactor information.
52
53The goal of this library is not only to follow best practices, but to
54make it easier for clients of the library to follow best practices.
55With a few well-marked exceptions, the functions in this library should
56be strongly constant-time: they do not allow secret data to flow to
57array indices, nor to control decisions except for a final failure
58check.  Furthermore, the C++ wrapping uses RAII to automatically clear
59sensitive data, and has interfaces designed to prevent certain mistakes.
60
61## CFRG cryptosystems.
62
63The library additionally supports two cryptosystems defined by the
64Crypto Forum Research Group (CFRG): the X448/X25519 Diffie-Hellman
65functions (RFC 7748), and the EdDSA signature scheme (RFC 8032).
66Future versions might support additional operations on these curves,
67such as precomputed signature verification.
68
69## Symmetric crypto and hashing
70
71The Decaf library doesn't implement much symmetric crypto, but it does
72contain the hash functions required by the CFRG cryptosystems: SHA512,
73SHA-3 and SHAKE.
74
75## Internals
76
77The "decaf" technique is described in https://eprint.iacr.org/2015/673
78While the title of that paper is "removing cofactors through point
79compression", it might be more accurate to say "through quotients and
80isogenies".  The internal representation of points is as "even" elements
81of a twisted Edwards curve with a=-1.  Using this subgroup removes a
82factor of 2 from the cofactor.  The remaining factor of 2 or 4 is
83removed with a quotient group: any two points which differ by an element
84of the 2- or 4-torsion subgroup are considered equal to each other.
85
86When a point is written out to wire format, it is converted (by isogeny)
87to a Jacobi quartic curve, which is halfway between an Edwards curve
88and a Montgomery curve.  One of the 4 or 8 equivalent points on the
89Jacobi quartic is chosen (it is "distinguished" according to certain
90criteria, such as having a positive x-coordinate).  The x-coordinate of
91this point is written out.  The y-coordinate is not written out, but the
92decoder knows which of the two possible y-coordinates is correct because
93of the distinguishing rules.  See the paper for more details.
94
95As of v0.9.4, libdecaf uses the "Ristretto" variant of this encoding.
96See https://www.ristretto.group for details, once that site is up.
97
98## Build and Install
99
100 cmake -DCMAKE_INSTALL_PREFIX=<Install path> <path to root directory>
101 make
102 make test
103 make install
104
105Most C source code is generated through a python script during the build.
106Some files holding tables are generated in one more step building an
107executable to generate them. They are thus stored in the source tree to help
108cross-compilation. The build script update them when their dependencies
109are modified, to build only these files:
110
111 make decaf_tables
112
113Doxygen generated documentation is located in ./doc directory in the
114binary tree after running
115
116 make doc
117
118## Licensing
119
120Most of the source files here are by Mike Hamburg.  Those files are (c)
1212014-2017 Cryptography Research, Inc (a division of Rambus). All of these
122files are usable under the MIT license contained in LICENSE.txt.
123
124## Caveats
125
126As mentioned in the license, there is absolutely NO WARRANTY on any of this
127code.  This code might well have security-critical bugs despite my best efforts.
128
129I've attempted to protect against timing attacks and invalid point attacks,
130but as of yet I've made no attempt to protect against power analysis.
131
132