123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329 |
- .\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
- .\"
- .\" Standard preamble:
- .\" ========================================================================
- .de Sp \" Vertical space (when we can't use .PP)
- .if t .sp .5v
- .if n .sp
- ..
- .de Vb \" Begin verbatim text
- .ft CW
- .nf
- .ne \\$1
- ..
- .de Ve \" End verbatim text
- .ft R
- .fi
- ..
- .\" Set up some character translations and predefined strings. \*(-- will
- .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
- .\" double quote, and \*(R" will give a right double quote. \*(C+ will
- .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
- .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
- .\" nothing in troff, for use with C<>.
- .tr \(*W-
- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
- .ie n \{\
- . ds -- \(*W-
- . ds PI pi
- . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
- . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
- . ds L" ""
- . ds R" ""
- . ds C` ""
- . ds C' ""
- 'br\}
- .el\{\
- . ds -- \|\(em\|
- . ds PI \(*p
- . ds L" ``
- . ds R" ''
- . ds C`
- . ds C'
- 'br\}
- .\"
- .\" Escape single quotes in literal strings from groff's Unicode transform.
- .ie \n(.g .ds Aq \(aq
- .el .ds Aq '
- .\"
- .\" If the F register is >0, we'll generate index entries on stderr for
- .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
- .\" entries marked with X<> in POD. Of course, you'll have to process the
- .\" output yourself in some meaningful fashion.
- .\"
- .\" Avoid warning from groff about undefined register 'F'.
- .de IX
- ..
- .if !\nF .nr F 0
- .if \nF>0 \{\
- . de IX
- . tm Index:\\$1\t\\n%\t"\\$2"
- ..
- . if !\nF==2 \{\
- . nr % 0
- . nr F 2
- . \}
- .\}
- .\"
- .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
- .\" Fear. Run. Save yourself. No user-serviceable parts.
- . \" fudge factors for nroff and troff
- .if n \{\
- . ds #H 0
- . ds #V .8m
- . ds #F .3m
- . ds #[ \f1
- . ds #] \fP
- .\}
- .if t \{\
- . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
- . ds #V .6m
- . ds #F 0
- . ds #[ \&
- . ds #] \&
- .\}
- . \" simple accents for nroff and troff
- .if n \{\
- . ds ' \&
- . ds ` \&
- . ds ^ \&
- . ds , \&
- . ds ~ ~
- . ds /
- .\}
- .if t \{\
- . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
- . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
- . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
- . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
- . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
- . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
- .\}
- . \" troff and (daisy-wheel) nroff accents
- .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
- .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
- .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
- .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
- .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
- .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
- .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
- .ds ae a\h'-(\w'a'u*4/10)'e
- .ds Ae A\h'-(\w'A'u*4/10)'E
- . \" corrections for vroff
- .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
- .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
- . \" for low resolution devices (crt and lpr)
- .if \n(.H>23 .if \n(.V>19 \
- \{\
- . ds : e
- . ds 8 ss
- . ds o a
- . ds d- d\h'-1'\(ga
- . ds D- D\h'-1'\(hy
- . ds th \o'bp'
- . ds Th \o'LP'
- . ds ae ae
- . ds Ae AE
- .\}
- .rm #[ #] #H #V #F C
- .\" ========================================================================
- .\"
- .IX Title "ec 3"
- .TH ec 3 "2019-09-12" "1.0.2g" "OpenSSL"
- .\" For nroff, turn off justification. Always turn off hyphenation; it makes
- .\" way too many mistakes in technical documents.
- .if n .ad l
- .nh
- .SH "NAME"
- ec \- Elliptic Curve functions
- .SH "SYNOPSIS"
- .IX Header "SYNOPSIS"
- .Vb 2
- \& #include <openssl/ec.h>
- \& #include <openssl/bn.h>
- \&
- \& const EC_METHOD *EC_GFp_simple_method(void);
- \& const EC_METHOD *EC_GFp_mont_method(void);
- \& const EC_METHOD *EC_GFp_nist_method(void);
- \& const EC_METHOD *EC_GFp_nistp224_method(void);
- \& const EC_METHOD *EC_GFp_nistp256_method(void);
- \& const EC_METHOD *EC_GFp_nistp521_method(void);
- \&
- \& const EC_METHOD *EC_GF2m_simple_method(void);
- \&
- \& EC_GROUP *EC_GROUP_new(const EC_METHOD *meth);
- \& void EC_GROUP_free(EC_GROUP *group);
- \& void EC_GROUP_clear_free(EC_GROUP *group);
- \& int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src);
- \& EC_GROUP *EC_GROUP_dup(const EC_GROUP *src);
- \& const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group);
- \& int EC_METHOD_get_field_type(const EC_METHOD *meth);
- \& int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor);
- \& const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group);
- \& int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx);
- \& int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx);
- \& void EC_GROUP_set_curve_name(EC_GROUP *group, int nid);
- \& int EC_GROUP_get_curve_name(const EC_GROUP *group);
- \& void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag);
- \& int EC_GROUP_get_asn1_flag(const EC_GROUP *group);
- \& void EC_GROUP_set_point_conversion_form(EC_GROUP *group, point_conversion_form_t form);
- \& point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *);
- \& unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x);
- \& size_t EC_GROUP_get_seed_len(const EC_GROUP *);
- \& size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len);
- \& int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
- \& int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx);
- \& int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
- \& int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx);
- \& int EC_GROUP_get_degree(const EC_GROUP *group);
- \& int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx);
- \& int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx);
- \& int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx);
- \& EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
- \& EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
- \& EC_GROUP *EC_GROUP_new_by_curve_name(int nid);
- \&
- \& size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems);
- \&
- \& EC_POINT *EC_POINT_new(const EC_GROUP *group);
- \& void EC_POINT_free(EC_POINT *point);
- \& void EC_POINT_clear_free(EC_POINT *point);
- \& int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src);
- \& EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group);
- \& const EC_METHOD *EC_POINT_method_of(const EC_POINT *point);
- \& int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point);
- \& int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
- \& const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx);
- \& int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
- \& const EC_POINT *p, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx);
- \& int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
- \& const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx);
- \& int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
- \& const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
- \& int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
- \& const BIGNUM *x, int y_bit, BN_CTX *ctx);
- \& int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p,
- \& const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx);
- \& int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group,
- \& const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
- \& int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p,
- \& const BIGNUM *x, int y_bit, BN_CTX *ctx);
- \& size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p,
- \& point_conversion_form_t form,
- \& unsigned char *buf, size_t len, BN_CTX *ctx);
- \& int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p,
- \& const unsigned char *buf, size_t len, BN_CTX *ctx);
- \& BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *,
- \& point_conversion_form_t form, BIGNUM *, BN_CTX *);
- \& EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *,
- \& EC_POINT *, BN_CTX *);
- \& char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *,
- \& point_conversion_form_t form, BN_CTX *);
- \& EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *,
- \& EC_POINT *, BN_CTX *);
- \&
- \& int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx);
- \& int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx);
- \& int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx);
- \& int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p);
- \& int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx);
- \& int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx);
- \& int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx);
- \& int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx);
- \& int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, size_t num, const EC_POINT *p[], const BIGNUM *m[], BN_CTX *ctx);
- \& int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx);
- \& int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx);
- \& int EC_GROUP_have_precompute_mult(const EC_GROUP *group);
- \&
- \& int EC_GROUP_get_basis_type(const EC_GROUP *);
- \& int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k);
- \& int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1,
- \& unsigned int *k2, unsigned int *k3);
- \& EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len);
- \& int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out);
- \& #define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x)
- \& #define i2d_ECPKParameters_bio(bp,x) ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x)
- \& #define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL, \e
- \& (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x))
- \& #define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \e
- \& (unsigned char *)(x))
- \& int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off);
- \& int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off);
- \&
- \& EC_KEY *EC_KEY_new(void);
- \& int EC_KEY_get_flags(const EC_KEY *key);
- \& void EC_KEY_set_flags(EC_KEY *key, int flags);
- \& void EC_KEY_clear_flags(EC_KEY *key, int flags);
- \& EC_KEY *EC_KEY_new_by_curve_name(int nid);
- \& void EC_KEY_free(EC_KEY *key);
- \& EC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src);
- \& EC_KEY *EC_KEY_dup(const EC_KEY *src);
- \& int EC_KEY_up_ref(EC_KEY *key);
- \& const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key);
- \& int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group);
- \& const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key);
- \& int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv);
- \& const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key);
- \& int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub);
- \& unsigned EC_KEY_get_enc_flags(const EC_KEY *key);
- \& void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags);
- \& point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key);
- \& void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform);
- \& void *EC_KEY_get_key_method_data(EC_KEY *key,
- \& void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));
- \& void EC_KEY_insert_key_method_data(EC_KEY *key, void *data,
- \& void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));
- \& void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag);
- \& int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx);
- \& int EC_KEY_generate_key(EC_KEY *key);
- \& int EC_KEY_check_key(const EC_KEY *key);
- \& int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, BIGNUM *y);
- \&
- \& EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len);
- \& int i2d_ECPrivateKey(EC_KEY *key, unsigned char **out);
- \&
- \& EC_KEY *d2i_ECParameters(EC_KEY **key, const unsigned char **in, long len);
- \& int i2d_ECParameters(EC_KEY *key, unsigned char **out);
- \&
- \& EC_KEY *o2i_ECPublicKey(EC_KEY **key, const unsigned char **in, long len);
- \& int i2o_ECPublicKey(EC_KEY *key, unsigned char **out);
- \& int ECParameters_print(BIO *bp, const EC_KEY *key);
- \& int EC_KEY_print(BIO *bp, const EC_KEY *key, int off);
- \& int ECParameters_print_fp(FILE *fp, const EC_KEY *key);
- \& int EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off);
- \& #define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x)
- \& #define EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid) \e
- \& EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, EVP_PKEY_OP_PARAMGEN, \e
- \& EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID, nid, NULL)
- .Ve
- .SH "DESCRIPTION"
- .IX Header "DESCRIPTION"
- This library provides an extensive set of functions for performing operations on elliptic curves over finite fields.
- In general an elliptic curve is one with an equation of the form:
- .PP
- y^2 = x^3 + ax + b
- .PP
- An \fB\s-1EC_GROUP\s0\fR structure is used to represent the definition of an elliptic curve. Points on a curve are stored using an
- \&\fB\s-1EC_POINT\s0\fR structure. An \fB\s-1EC_KEY\s0\fR is used to hold a private/public key pair, where a private key is simply a \s-1BIGNUM\s0 and a
- public key is a point on a curve (represented by an \fB\s-1EC_POINT\s0\fR).
- .PP
- The library contains a number of alternative implementations of the different functions. Each implementation is optimised
- for different scenarios. No matter which implementation is being used, the interface remains the same. The library
- handles calling the correct implementation when an interface function is invoked. An implementation is represented by
- an \fB\s-1EC_METHOD\s0\fR structure.
- .PP
- The creation and destruction of \fB\s-1EC_GROUP\s0\fR objects is described in \fIEC_GROUP_new\fR\|(3). Functions for
- manipulating \fB\s-1EC_GROUP\s0\fR objects are described in \fIEC_GROUP_copy\fR\|(3).
- .PP
- Functions for creating, destroying and manipulating \fB\s-1EC_POINT\s0\fR objects are explained in \fIEC_POINT_new\fR\|(3),
- whilst functions for performing mathematical operations and tests on \fBEC_POINTs\fR are coverd in \fIEC_POINT_add\fR\|(3).
- .PP
- For working with private and public keys refer to \fIEC_KEY_new\fR\|(3). Implementations are covered in
- \&\fIEC_GFp_simple_method\fR\|(3).
- .PP
- For information on encoding and decoding curve parameters to and from \s-1ASN1\s0 see \fId2i_ECPKParameters\fR\|(3).
- .SH "SEE ALSO"
- .IX Header "SEE ALSO"
- \&\fIcrypto\fR\|(3), \fIEC_GROUP_new\fR\|(3), \fIEC_GROUP_copy\fR\|(3),
- \&\fIEC_POINT_new\fR\|(3), \fIEC_POINT_add\fR\|(3), \fIEC_KEY_new\fR\|(3),
- \&\fIEC_GFp_simple_method\fR\|(3), \fId2i_ECPKParameters\fR\|(3)
|