19 ecpubfree \- elliptic curve cryptography
27 .B #include <libsec.h>
30 void secp256r1(mpint *p, mpint *a, mpint *b, mpint *x, mpint *y, mpint *n, mpint *h)
33 void secp256k1(mpint *p, mpint *a, mpint *b, mpint *x, mpint *y, mpint *n, mpint *h)
36 void secp384r1(mpint *p, mpint *a, mpint *b, mpint *x, mpint *y, mpint *n, mpint *h)
39 void ecdominit(ECdomain *dom, void (*init)(mpint *p, mpint *a, mpint *b, mpint *x, mpint *y, mpint *n, mpint *h))
42 void ecdomfree(ECdomain *dom)
45 void ecassign(ECdomain *dom, ECpoint *old, ECpoint *new)
48 void ecadd(ECdomain *dom, ECpoint *a, ECpoint *b, ECpoint *s)
51 void ecmul(ECdomain *dom, ECpoint *a, mpint *k, ECpoint *s)
54 ECpoint* strtoec(ECdomain *dom, char *s, char **rptr, ECpoint *p)
57 ECpriv* ecgen(ECdomain *dom, ECpriv *p)
60 int ecverify(ECdomain *dom, ECpoint *p)
63 int ecpubverify(ECdomain *dom, ECpub *p)
66 void ecdsasign(ECdomain *dom, ECpriv *priv, uchar *dig, int dlen, mpint *r, mpint *s)
69 int ecdsaverify(ECdomain *dom, ECpub *pub, uchar *dig, int dlen, mpint *r, mpint *s)
72 int ecencodepub(ECdomain *dom, ECpub *pub, uchar *data, int len)
75 ECpub* ecdecodepub(ECdomain *dom, uchar *data, int len)
78 void ecpubfree(ECpub *p);
81 These functions implement elliptic curve cryptography.
82 An elliptic curve together with cryptographic parameters are specified using an
85 Points on the curve are represented by
96 which fills in the parameters of the curve.
99 frees the parameters of the curve and zeros the struct. It does
100 not free the memory of the struct itself.
102 .BR ecassign ", " ecadd " and " ecmul
103 are analogous to their counterparts in
107 converts a hex string representing an octet string as specified in
108 .I Standards for Efficient Cryptography (SEC) 1
111 struct. Both uncompressed and compressed formats are supported.
116 it is used to return the position in the string where the parser stopped.
119 space is allocated automatically, else the given struct is used.
124 verify that the given point or public key, respectively, is valid.
127 generates a keypair and returns a pointer to it.
130 space is allocated automatically, else the given struct is used.
135 create or verify, respectively, a signature using the ECDSA scheme specified in
137 It is absolutely vital that
139 is a cryptographic hash to the message.
141 writes the signature to
143 which are assumed to be allocated properly.
148 handle encoding and decoding of public keys in uncompressed format.
151 also verifies that the public key is valid in the specified domain.
156 structure and its associated members.
161 for a positive result.
162 Functions returning pointers may return
169 .B /sys/src/libsec/port/ecc.c
172 Standards for Efficient Cryptography (SEC) 1: Elliptic Curve Cryptography
173 - Certicom Research, 2009
175 This implementation of elliptic curve cryptography first appeared in 9front (June, 2012).