Skip to content

Commit 419623d

Browse files
authored
Merge pull request #2342 from triska/curve_doc
DOC: Add DocLog comments for reasoning about elliptic curves.
2 parents c7934ca + 1dd0c59 commit 419623d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/lib/crypto.pl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,9 +828,26 @@
828828
curve_b(curve(_,_,_,B,_,_,_,_), B).
829829
curve_field_length(curve(_,_,_,_,_,_,FieldLength,_), FieldLength).
830830

831+
%% crypto_curve_generator(+Curve, -G)
832+
%
833+
% Yields the generator point G of Curve.
834+
831835
crypto_curve_generator(curve(_,_,_,_,G,_,_,_), G).
836+
837+
%% crypto_curve_order(+Curve, -Order)
838+
%
839+
% Yields the order of Curve.
840+
832841
crypto_curve_order(curve(_,_,_,_,_,Order,_,_), Order).
833842

843+
%% crypto_curve_scalar_mult(+Curve, +Scalar, +Point, -Result)
844+
%
845+
% Computes the point _Result = Scalar*Point_. Scalar must be an
846+
% integer, and Point must be a point on Curve. This operation can be
847+
% used to negotiate a shared secret over a public channel. Consider
848+
% using `curve25519_scalar_mult/3` instead for more desirable
849+
% security properties.
850+
834851
crypto_curve_scalar_mult(Curve, Scalar, point(X,Y), point(RX, RY)) :-
835852
must_be(integer, Scalar),
836853
must_be_on_curve(Curve, point(X,Y)),
@@ -897,6 +914,12 @@
897914
fitting_exponent(N, E1, E)
898915
).
899916

917+
%% crypto_name_curve(+Name, -Curve)
918+
%
919+
% Yields a representation of the elliptic curve with name Name.
920+
% Currently, the only supported name is `secp256k1`, a Koblitz curve
921+
% regarded as secure.
922+
900923
crypto_name_curve(secp256k1,
901924
curve(secp256k1,
902925
0x00fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f,

0 commit comments

Comments
 (0)