22 X509ecdsaverifydigest \- elliptic curve cryptography
30 .B #include <libsec.h>
33 void secp256r1(mpint *p, mpint *a, mpint *b, mpint *x, mpint *y, mpint *n, mpint *h)
36 void secp256k1(mpint *p, mpint *a, mpint *b, mpint *x, mpint *y, mpint *n, mpint *h)
39 void secp384r1(mpint *p, mpint *a, mpint *b, mpint *x, mpint *y, mpint *n, mpint *h)
42 void ecdominit(ECdomain *dom, void (*init)(mpint *p, mpint *a, mpint *b, mpint *x, mpint *y, mpint *n, mpint *h))
45 void ecdomfree(ECdomain *dom)
48 void ecassign(ECdomain *dom, ECpoint *old, ECpoint *new)
51 void ecadd(ECdomain *dom, ECpoint *a, ECpoint *b, ECpoint *s)
54 void ecmul(ECdomain *dom, ECpoint *a, mpint *k, ECpoint *s)
57 ECpoint* strtoec(ECdomain *dom, char *s, char **rptr, ECpoint *p)
60 ECpriv* ecgen(ECdomain *dom, ECpriv *p)
63 int ecverify(ECdomain *dom, ECpoint *p)
66 int ecpubverify(ECdomain *dom, ECpub *p)
69 void ecdsasign(ECdomain *dom, ECpriv *priv, uchar *dig, int dlen, mpint *r, mpint *s)
72 int ecdsaverify(ECdomain *dom, ECpub *pub, uchar *dig, int dlen, mpint *r, mpint *s)
75 int ecencodepub(ECdomain *dom, ECpub *pub, uchar *data, int len)
78 ECpub* ecdecodepub(ECdomain *dom, uchar *data, int len)
81 void ecpubfree(ECpub *p);
84 ECpub* X509toECpub(uchar *cert, int ncert, char *name, int nname, ECdomain *dom)
87 char* X509ecdsaverify(uchar *cert, int ncert, ECdomain *dom, ECpub *pub)
90 char* X509ecdsaverifydigest(uchar *sig, int siglen, uchar *edigest, int edigestlen, ECdomain *dom, ECpub *pub)
93 These functions implement elliptic curve cryptography.
94 An elliptic curve together with cryptographic parameters are specified using an
97 Points on the curve are represented by
108 which fills in the parameters of the curve.
111 frees the parameters of the curve and zeros the struct. It does
112 not free the memory of the struct itself.
114 .BR ecassign ", " ecadd " and " ecmul
115 are analogous to their counterparts in
119 converts a hex string representing an octet string as specified in
120 .I Standards for Efficient Cryptography (SEC) 1
123 struct. Both uncompressed and compressed formats are supported.
128 it is used to return the position in the string where the parser stopped.
131 space is allocated automatically, else the given struct is used.
136 verify that the given point or public key, respectively, is valid.
139 generates a keypair and returns a pointer to it.
142 space is allocated automatically, else the given struct is used.
147 create or verify, respectively, a signature using the ECDSA scheme specified in
149 It is absolutely vital that
151 is a cryptographic hash to the message.
153 writes the signature to
155 which are assumed to be allocated properly.
160 handle encoding and decoding of public keys in uncompressed format.
163 also verifies that the public key is valid in the specified domain.
168 structure and its associated members.
170 Given a binary X.509 cert, the function
172 initializes domain parameters and returns the ECDSA public key. if
176 the CN part of the Distinguished Name of the certificate's Subject is returned.
179 .B X509ecdsaverifydigest
180 are analogs to the routines described by
186 for a positive result.
187 Functions returning pointers may return
194 .B /sys/src/libsec/port/ecc.c
199 Standards for Efficient Cryptography (SEC) 1: Elliptic Curve Cryptography
200 - Certicom Research, 2009
202 This implementation of elliptic curve cryptography first appeared in 9front (June, 2012).