aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorvojtechsu2023-11-07 16:32:19 +0100
committervojtechsu2023-11-07 16:32:19 +0100
commit82dc198ae6cca542ed99b4740a639dda870e6dda (patch)
tree1cb04e6b61b24cb88a8ce1556a9a2bcf225377c0 /docs
parente56da07d7fcb998f89929f05ca3b9eee91f14570 (diff)
downloadpyecsca-82dc198ae6cca542ed99b4740a639dda870e6dda.tar.gz
pyecsca-82dc198ae6cca542ed99b4740a639dda870e6dda.tar.zst
pyecsca-82dc198ae6cca542ed99b4740a639dda870e6dda.zip
add libsecp256k1 docs
Diffstat (limited to 'docs')
-rw-r--r--docs/libraries.rst83
1 files changed, 83 insertions, 0 deletions
diff --git a/docs/libraries.rst b/docs/libraries.rst
index 5417fca..4455a11 100644
--- a/docs/libraries.rst
+++ b/docs/libraries.rst
@@ -682,6 +682,89 @@ NSS
libsecp256k1
============
+| Version: ``v0.4.0``
+| Repository: https://github.com/bitcoin-core/secp256k1
+| Docs:
+
+Primitives
+----------
+
+Supports ECDSA, ECDH and Schnorr signatures over secp256k1.
+
+ECDH
+^^^^
+
+KeyGen:
+ - Short-Weierstrass
+ - `Fixed findow with full precomputation <https://github.com/bitcoin-core/secp256k1/blob/v0.4.0/src/ecmult_gen_impl.h#L45>`__ via ``secp256k1_ec_pubkey_create -> secp256k1_ec_pubkey_create_helper -> secp256k1_ecmult_gen``. Window of size 4.
+ - Uses scalar blinding.
+ - `Jacobian version of add-2002-bj <https://github.com/bitcoin-core/secp256k1/blob/v0.4.0/src/group_impl.h#L670>`__ (via ``secp256k1_gej_add_ge``).
+ - No doubling.
+
+
+Derive:
+ - Uses GLV decomposition and `interleaving with width-5 NAFs <https://github.com/bitcoin-core/secp256k1/blob/v0.4.0/src/ecmult_const_impl.h#L133>`__ via ``secp256k1_ecdh -> secp256k1_ecmult_const``.
+ - Addition same as in Keygen.
+ - `DBL <https://github.com/bitcoin-core/secp256k1/blob/v0.4.0/src/group_impl.h#L406>`__ (via ``secp256k1_gej_double``)::
+
+ Z3 = Y1*Z1
+ S = Y1^2
+ L = X1^2
+ L = 3*L
+ L = L/2
+ T = -S
+ T = T*X1
+ X3 = L^2
+ X3 = X3+T
+ X3 = X3+T
+ S = S^2
+ T = T+X3
+ Y3 = T*L
+ Y3 = Y3+S
+ Y3 = -Y3
+
+ECDSA
+^^^^^
+
+Keygen:
+ - Same as ECDH.
+
+Sign:
+ - Same as Keygen via ``secp256k1_ecdsa_sign -> secp256k1_ecdsa_sign_inner -> secp256k1_ecdsa_sig_sign -> secp256k1_ecmult_gen``.
+
+Verify:
+ - Split both scalars using GLV and then interleaving with width-5 NAFS on 4 scalars via ``secp256k1_ecdsa_verify -> secp256k1_ecdsa_sig_verify -> secp256k1_ecmult -> secp256k1_ecmult_strauss_wnaf``.
+ - DBL same as in ECDH DERIVE. Two formulas for addition are implemented. For the generator part, same addition as in Keygen is used. For public key, the following::
+
+ assume iZ2 = 1/Z2
+ az = Z_1*iZ2
+ Z12 = az^2
+ u1 = X1
+ u2 = X2*Z12
+ s1 = Y1
+ s2 = Y2*Z12
+ s2 = s2*az
+ h = -u1
+ h = h+u2
+ i = -s2
+ i = i+s1
+ Z3 = Z1*h
+ h2 = h^2
+ h2 = -h2
+ h3 = h2*h
+ t = u1*h2
+ X3 = i^2
+ X3 = X3+h3
+ X3 = X3+t
+ X3 = X3+t
+ t = t+X3
+ Y3 = t*i
+ h3 = h3*s1
+ Y3 = Y3+h3
+
+ - Before the addition the Jacobian coordinates are mapped to an isomorphic curve.
+
+
Nettle
======