]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/man/2/ec
fix bugs and cleanup cryptsetup code
[plan9front.git] / sys / man / 2 / ec
index d556ffedff46e59b528414865bf5b13ada0f9f75..b4e0cc19ebb893f491704dfb434c0f3c95987981 100644 (file)
@@ -8,7 +8,7 @@ ecgen,
 ecverify,
 ecpubverify,
 ecdsasign,
-ecdsaverify \- Elliptic Curve Cryptography
+ecdsaverify \- elliptic curve cryptography
 .SH SYNOPSIS
 .B #include <u.h>
 .br
@@ -19,6 +19,12 @@ ecdsaverify \- Elliptic Curve Cryptography
 .B #include <libsec.h>
 .PP
 .B
+void   ecdominit(ECdomain *dom, void (*init)(mpint *p, mpint *a, mpint *b, mpint *x, mpint *y, mpint *n, mpint *h));
+.PP
+.B
+void   ecdomfree(ECdomain *dom);
+.PP
+.B
 void   ecassign(ECdomain *dom, ECpoint *old, ECpoint *new);
 .PP
 .B
@@ -46,20 +52,35 @@ void        ecdsasign(ECdomain *dom, ECpriv *priv, uchar *dig, int dlen, mpint *r, mpin
 int    ecdsaverify(ECdomain *dom, ECpub *pub, uchar *dig, int dlen, mpint *r, mpint *s);
 .DT
 .SH DESCRIPTION
-These function implement elliptic curve cryptography.
-An elliptic curve together with cryptographic parameters are specified using a 
+These functions implement elliptic curve cryptography.
+An elliptic curve together with cryptographic parameters are specified using an
 .B ECdomain
 struct.
 Points on the curve are represented by 
 .B ECpoint
 structs.
 .PP
+.B ecdominit
+initializes a
+.B ECdomain
+struct and calls the
+.B init
+function such as
+.B secp256r1
+which fills in the parameters of the curve.
+.PP
+.B ecdomfree
+frees the parameters of the curve and zeros the struct. It does
+not free the memory of the struct itself.
+.PP
 .BR ecassign ", " ecadd " and " ecmul
-work analogous to their counterparts in
+are analogous to their counterparts in
 .IR mp (2).
 .PP
 .B strtoec
-converts a hex string representing an octet string as specified in SEC 1 to a
+converts a hex string representing an octet string as specified in
+.I Standards for Efficient Cryptography (SEC) 1
+to an
 .B ECpoint
 struct. Both uncompressed and compressed formats are supported.
 If 
@@ -74,7 +95,7 @@ space is allocated automatically, else the given struct is used.
 .B ecverify
 and
 .B ecpubverify
-verify that the given point or public key, resp., is valid.
+verify that the given point or public key, respectively, is valid.
 .PP
 .B ecgen
 generates a keypair and returns a pointer to it.
@@ -85,7 +106,8 @@ space is allocated automatically, else the given struct is used.
 .B ecdsasign
 and
 .B ecdsaverify
-create or verify, resp., a signature using the ECDSA scheme specified in SEC 1.
+create or verify, respectively, a signature using the ECDSA scheme specified in
+.I SEC 1.
 It is absolutely vital that
 .B dig
 is a cryptographic hash to the message.
@@ -100,9 +122,15 @@ functions return
 for a positive result.
 Functions returning pointers may return
 .B nil
-in case of error (e.g. failing
+in case of error
+.I (e.g.
+failing
 .IR malloc (2)).
 .SH SOURCE
-.B /sys/src/libsec/ec.c
+.B /sys/src/libsec/port/ecc.c
 .SH SEE ALSO
-Standards for Efficient Cryptography (SEC) 1: Elliptic Curve Cryptography, Certicom Research, 2009
+.I
+Standards for Efficient Cryptography (SEC) 1: Elliptic Curve Cryptography
+- Certicom Research, 2009
+.SH HISTORY
+This implementation of elliptic curve cryptography first appeared in 9front (June, 2012).