xref: /openbsd-src/lib/libcrypto/man/EC_GFp_simple_method.3 (revision 25c4e8bd056e974b28f4a0ffd39d76c190a56013)
1.\"	$OpenBSD: EC_GFp_simple_method.3,v 1.10 2022/07/02 17:09:09 jsing Exp $
2.\"	OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\"
4.\" This file was written by Matt Caswell <matt@openssl.org>.
5.\" Copyright (c) 2013 The OpenSSL Project.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\"
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\"
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in
16.\"    the documentation and/or other materials provided with the
17.\"    distribution.
18.\"
19.\" 3. All advertising materials mentioning features or use of this
20.\"    software must display the following acknowledgment:
21.\"    "This product includes software developed by the OpenSSL Project
22.\"    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
23.\"
24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25.\"    endorse or promote products derived from this software without
26.\"    prior written permission. For written permission, please contact
27.\"    openssl-core@openssl.org.
28.\"
29.\" 5. Products derived from this software may not be called "OpenSSL"
30.\"    nor may "OpenSSL" appear in their names without prior written
31.\"    permission of the OpenSSL Project.
32.\"
33.\" 6. Redistributions of any form whatsoever must retain the following
34.\"    acknowledgment:
35.\"    "This product includes software developed by the OpenSSL Project
36.\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37.\"
38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\"
51.Dd $Mdocdate: July 2 2022 $
52.Dt EC_GFP_SIMPLE_METHOD 3
53.Os
54.Sh NAME
55.Nm EC_GFp_simple_method ,
56.Nm EC_GFp_mont_method ,
57.Nm EC_GFp_nist_method ,
58.Nm EC_GFp_nistp224_method ,
59.Nm EC_GFp_nistp256_method ,
60.Nm EC_GFp_nistp521_method ,
61.Nm EC_GF2m_simple_method ,
62.Nm EC_METHOD_get_field_type
63.Nd obtain EC_METHOD objects
64.Sh SYNOPSIS
65.In openssl/ec.h
66.Ft const EC_METHOD *
67.Fn EC_GFp_simple_method void
68.Ft const EC_METHOD *
69.Fn EC_GFp_mont_method void
70.Ft const EC_METHOD *
71.Fn EC_GFp_nist_method void
72.Ft const EC_METHOD *
73.Fn EC_GFp_nistp224_method void
74.Ft const EC_METHOD *
75.Fn EC_GFp_nistp256_method void
76.Ft const EC_METHOD *
77.Fn EC_GFp_nistp521_method void
78.Ft const EC_METHOD *
79.Fn EC_GF2m_simple_method void
80.Ft int
81.Fo EC_METHOD_get_field_type
82.Fa "const EC_METHOD *meth"
83.Fc
84.Sh DESCRIPTION
85The elliptic curve library provides a number of different
86implementations through a single common interface.
87Each implementation is optimised for different scenarios.
88An implementation is represented by an
89.Vt EC_METHOD
90structure.
91.Pp
92When constructing a curve using
93.Xr EC_GROUP_new 3 ,
94an implementation method must be provided.
95The functions described here all return a const pointer to an
96.Sy EC_METHOD
97structure that can be passed to
98.Xr EC_GROUP_new 3 .
99It is important that the correct implementation type for the form
100of curve selected is used.
101.Pp
102For F2^m curves there is only one implementation choice,
103.Fn EC_GF2_simple_method .
104.Pp
105For Fp curves the lowest common denominator implementation is the
106.Fn EC_GFp_simple_method
107implementation.
108All other implementations are based on this one.
109.Fn EC_GFp_mont_method
110adds the use of Montgomery multiplication (see
111.Xr BN_mod_mul_montgomery 3 ) .
112.Fn EC_GFp_nist_method
113offers an implementation optimised for use with NIST recommended
114curves.
115NIST curves are available through
116.Xr EC_GROUP_new_by_curve_name 3 .
117.Pp
118The functions
119.Fn EC_GFp_nistp224_method ,
120.Fn EC_GFp_nistp256_method ,
121and
122.Fn EC_GFp_nistp521_method
123offer 64-bit optimised implementations for the NIST P224, P256 and
124P521 curves respectively.
125Note, however, that these implementations are not available on all
126platforms.
127.Pp
128.Fn EC_METHOD_get_field_type
129identifies what type of field the
130.Vt EC_METHOD
131structure supports, which will be either F2^m or Fp.
132If the field type is Fp, then the value
133.Dv NID_X9_62_prime_field
134is returned.
135If the field type is F2^m, then the value
136.Dv NID_X9_62_characteristic_two_field
137is returned.
138These values are defined in the
139.In openssl/objects.h
140header file.
141.Sh RETURN VALUES
142All
143.Fn EC_GFp*
144functions and
145.Fn EC_GF2m_simple_method
146always return a const pointer to an
147.Vt EC_METHOD
148structure.
149.Pp
150.Fn EC_METHOD_get_field_type
151returns an integer that identifies the type of field the
152.Vt EC_METHOD
153structure supports.
154.Sh SEE ALSO
155.Xr BN_mod_mul_montgomery 3 ,
156.Xr d2i_ECPKParameters 3 ,
157.Xr EC_GROUP_copy 3 ,
158.Xr EC_GROUP_new 3 ,
159.Xr EC_KEY_new 3 ,
160.Xr EC_POINT_add 3 ,
161.Xr EC_POINT_new 3
162.Sh HISTORY
163.Fn EC_GFp_simple_method
164and
165.Fn EC_GFp_mont_method
166first appeared in OpenSSL 0.9.7 and have been available since
167.Ox 3.2 .
168.Pp
169.Fn EC_GFp_nist_method ,
170.Fn EC_GF2m_simple_method ,
171and
172.Fn EC_METHOD_get_field_type
173first appeared in OpenSSL 0.9.8 and have been available since
174.Ox 4.5 .
175.Pp
176.Fn EC_GFp_nistp224_method ,
177.Fn EC_GFp_nistp256_method ,
178and
179.Fn EC_GFp_nistp521_method
180first appeared in OpenSSL 1.0.1 and have been available since
181.Ox 5.3 .
182