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