]> Git Repo - secp256k1.git/blame - README.md
[build] Update ax_jni_include_dir.m4 macro to deal with recent versions of macOS
[secp256k1.git] / README.md
CommitLineData
3f37bcc2
PW
1libsecp256k1
2============
3
faa2a11c 4[![Build Status](https://travis-ci.org/bitcoin-core/secp256k1.svg?branch=master)](https://travis-ci.org/bitcoin-core/secp256k1)
70ef4f54 5
8622cc25 6Optimized C library for EC operations on curve secp256k1.
3f37bcc2 7
b5bbce62 8This library is a work in progress and is being used to research best practices. Use at your own risk.
3f37bcc2 9
8622cc25 10Features:
b5bbce62 11* secp256k1 ECDSA signing/verification and key generation.
8622cc25
PW
12* Adding/multiplying private/public keys.
13* Serialization/parsing of private keys, public keys, signatures.
b5bbce62
GM
14* Constant time, constant memory access signing and pubkey generation.
15* Derandomized DSA (via RFC6979 or with a caller provided function.)
8622cc25
PW
16* Very efficient implementation.
17
3f37bcc2
PW
18Implementation details
19----------------------
20
21* General
b5bbce62
GM
22 * No runtime heap allocation.
23 * Extensive testing infrastructure.
24 * Structured to facilitate review and analysis.
25 * Intended to be portable to any system with a C89 compiler and uint64_t support.
26 * Expose only higher level interfaces to minimize the API surface and improve application security. ("Be difficult to use insecurely.")
3f37bcc2
PW
27* Field operations
28 * Optimized implementation of arithmetic modulo the curve's field size (2^256 - 0x1000003D1).
29 * Using 5 52-bit limbs (including hand-optimized assembly for x86_64, by Diederik Huys).
30 * Using 10 26-bit limbs.
3f37bcc2 31 * Field inverses and square roots using a sliding window over blocks of 1s (by Peter Dettman).
6c7f0c62
PW
32* Scalar operations
33 * Optimized implementation without data-dependent branches of arithmetic modulo the curve's order.
34 * Using 4 64-bit limbs (relying on __int128 support in the compiler).
35 * Using 8 32-bit limbs.
3f37bcc2
PW
36* Group operations
37 * Point addition formula specifically simplified for the curve equation (y^2 = x^3 + 7).
38 * Use addition between points in Jacobian and affine coordinates where possible.
6c7f0c62 39 * Use a unified addition/doubling formula where necessary to avoid data-dependent branches.
b5bbce62 40 * Point/x comparison without a field inversion by comparison in the Jacobian coordinate space.
3f37bcc2
PW
41* Point multiplication for verification (a*P + b*G).
42 * Use wNAF notation for point multiplicands.
43 * Use a much larger window for multiples of G, using precomputed multiples.
44 * Use Shamir's trick to do the multiplication with the public key and the generator simultaneously.
b5bbce62 45 * Optionally (off by default) use secp256k1's efficiently-computable endomorphism to split the P multiplicand into 2 half-sized ones.
3f37bcc2
PW
46* Point multiplication for signing
47 * Use a precomputed table of multiples of powers of 16 multiplied with the generator, so general multiplication becomes a series of additions.
b5bbce62 48 * Access the table with branch-free conditional moves so memory access is uniform.
6c7f0c62
PW
49 * No data-dependent branches
50 * The precomputed tables add and eventually subtract points for which no known scalar (private key) is known, preventing even an attacker with control over the private key used to control the data internally.
7fc1fb4f
JD
51
52Build steps
53-----------
54
55libsecp256k1 is built using autotools:
56
62c58902 57 $ ./autogen.sh
7fc1fb4f
JD
58 $ ./configure
59 $ make
b5bbce62 60 $ ./tests
7fc1fb4f 61 $ sudo make install # optional
This page took 0.032972 seconds and 4 git commands to generate.