1.\" $OpenBSD: EC_GFp_simple_method.3,v 1.12 2023/04/27 08:47:04 tb 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: April 27 2023 $ 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_METHOD_get_field_type 58.Nd obtain EC_METHOD objects 59.Sh SYNOPSIS 60.In openssl/ec.h 61.Ft const EC_METHOD * 62.Fn EC_GFp_simple_method void 63.Ft const EC_METHOD * 64.Fn EC_GFp_mont_method void 65.Ft int 66.Fo EC_METHOD_get_field_type 67.Fa "const EC_METHOD *meth" 68.Fc 69.Sh DESCRIPTION 70The elliptic curve library provides a number of different 71implementations through a single common interface. 72Each implementation is optimised for different scenarios. 73An implementation is represented by an 74.Vt EC_METHOD 75structure. 76.Pp 77When constructing a curve using 78.Xr EC_GROUP_new 3 , 79an implementation method must be provided. 80The functions described here all return a const pointer to an 81.Sy EC_METHOD 82structure that can be passed to 83.Xr EC_GROUP_new 3 . 84It is important that the correct implementation type for the form 85of curve selected is used. 86.Pp 87For Fp curves the lowest common denominator implementation is the 88.Fn EC_GFp_simple_method 89implementation. 90All other implementations are based on this one. 91.Fn EC_GFp_mont_method 92adds the use of Montgomery multiplication (see 93.Xr BN_mod_mul_montgomery 3 ) . 94.Pp 95.Fn EC_METHOD_get_field_type 96identifies what type of field the 97.Vt EC_METHOD 98structure supports. 99If the field type is Fp, then the value 100.Dv NID_X9_62_prime_field 101is returned. 102If the field type is F2^m, then the value 103.Dv NID_X9_62_characteristic_two_field 104is returned. 105These values are defined in the 106.In openssl/objects.h 107header file. 108.Sh RETURN VALUES 109All 110.Fn EC_GFp* 111functions always return a const pointer to an 112.Vt EC_METHOD 113structure. 114.Pp 115.Fn EC_METHOD_get_field_type 116returns an integer that identifies the type of field the 117.Vt EC_METHOD 118structure supports. 119.Sh SEE ALSO 120.Xr BN_mod_mul_montgomery 3 , 121.Xr d2i_ECPKParameters 3 , 122.Xr EC_GROUP_copy 3 , 123.Xr EC_GROUP_new 3 , 124.Xr EC_KEY_new 3 , 125.Xr EC_POINT_add 3 , 126.Xr EC_POINT_new 3 127.Sh HISTORY 128.Fn EC_GFp_simple_method 129and 130.Fn EC_GFp_mont_method 131first appeared in OpenSSL 0.9.7 and have been available since 132.Ox 3.2 . 133.Pp 134.Fn EC_METHOD_get_field_type 135first appeared in OpenSSL 0.9.8 and has been available since 136.Ox 4.5 . 137