EC_GROUP_copy.3ossl 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. .\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)
  2. .\"
  3. .\" Standard preamble:
  4. .\" ========================================================================
  5. .de Sp \" Vertical space (when we can't use .PP)
  6. .if t .sp .5v
  7. .if n .sp
  8. ..
  9. .de Vb \" Begin verbatim text
  10. .ft CW
  11. .nf
  12. .ne \\$1
  13. ..
  14. .de Ve \" End verbatim text
  15. .ft R
  16. .fi
  17. ..
  18. .\" Set up some character translations and predefined strings. \*(-- will
  19. .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
  20. .\" double quote, and \*(R" will give a right double quote. \*(C+ will
  21. .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
  22. .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
  23. .\" nothing in troff, for use with C<>.
  24. .tr \(*W-
  25. .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
  26. .ie n \{\
  27. . ds -- \(*W-
  28. . ds PI pi
  29. . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
  30. . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
  31. . ds L" ""
  32. . ds R" ""
  33. . ds C` ""
  34. . ds C' ""
  35. 'br\}
  36. .el\{\
  37. . ds -- \|\(em\|
  38. . ds PI \(*p
  39. . ds L" ``
  40. . ds R" ''
  41. . ds C`
  42. . ds C'
  43. 'br\}
  44. .\"
  45. .\" Escape single quotes in literal strings from groff's Unicode transform.
  46. .ie \n(.g .ds Aq \(aq
  47. .el .ds Aq '
  48. .\"
  49. .\" If the F register is >0, we'll generate index entries on stderr for
  50. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  51. .\" entries marked with X<> in POD. Of course, you'll have to process the
  52. .\" output yourself in some meaningful fashion.
  53. .\"
  54. .\" Avoid warning from groff about undefined register 'F'.
  55. .de IX
  56. ..
  57. .nr rF 0
  58. .if \n(.g .if rF .nr rF 1
  59. .if (\n(rF:(\n(.g==0)) \{\
  60. . if \nF \{\
  61. . de IX
  62. . tm Index:\\$1\t\\n%\t"\\$2"
  63. ..
  64. . if !\nF==2 \{\
  65. . nr % 0
  66. . nr F 2
  67. . \}
  68. . \}
  69. .\}
  70. .rr rF
  71. .\"
  72. .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
  73. .\" Fear. Run. Save yourself. No user-serviceable parts.
  74. . \" fudge factors for nroff and troff
  75. .if n \{\
  76. . ds #H 0
  77. . ds #V .8m
  78. . ds #F .3m
  79. . ds #[ \f1
  80. . ds #] \fP
  81. .\}
  82. .if t \{\
  83. . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
  84. . ds #V .6m
  85. . ds #F 0
  86. . ds #[ \&
  87. . ds #] \&
  88. .\}
  89. . \" simple accents for nroff and troff
  90. .if n \{\
  91. . ds ' \&
  92. . ds ` \&
  93. . ds ^ \&
  94. . ds , \&
  95. . ds ~ ~
  96. . ds /
  97. .\}
  98. .if t \{\
  99. . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
  100. . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  101. . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  102. . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  103. . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  104. . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  105. .\}
  106. . \" troff and (daisy-wheel) nroff accents
  107. .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  108. .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  109. .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  110. .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  111. .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  112. .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  113. .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  114. .ds ae a\h'-(\w'a'u*4/10)'e
  115. .ds Ae A\h'-(\w'A'u*4/10)'E
  116. . \" corrections for vroff
  117. .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  118. .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  119. . \" for low resolution devices (crt and lpr)
  120. .if \n(.H>23 .if \n(.V>19 \
  121. \{\
  122. . ds : e
  123. . ds 8 ss
  124. . ds o a
  125. . ds d- d\h'-1'\(ga
  126. . ds D- D\h'-1'\(hy
  127. . ds th \o'bp'
  128. . ds Th \o'LP'
  129. . ds ae ae
  130. . ds Ae AE
  131. .\}
  132. .rm #[ #] #H #V #F C
  133. .\" ========================================================================
  134. .\"
  135. .IX Title "EC_GROUP_COPY 3ossl"
  136. .TH EC_GROUP_COPY 3ossl "2024-09-03" "3.3.2" "OpenSSL"
  137. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  138. .\" way too many mistakes in technical documents.
  139. .if n .ad l
  140. .nh
  141. .SH "NAME"
  142. EC_GROUP_get0_order, EC_GROUP_order_bits, EC_GROUP_get0_cofactor,
  143. EC_GROUP_copy, EC_GROUP_dup, EC_GROUP_method_of, EC_GROUP_set_generator,
  144. EC_GROUP_get0_generator, EC_GROUP_get_order, EC_GROUP_get_cofactor,
  145. EC_GROUP_set_curve_name, EC_GROUP_get_curve_name, EC_GROUP_set_asn1_flag,
  146. EC_GROUP_get_asn1_flag, EC_GROUP_set_point_conversion_form,
  147. EC_GROUP_get_point_conversion_form, EC_GROUP_get0_seed,
  148. EC_GROUP_get_seed_len, EC_GROUP_set_seed, EC_GROUP_get_degree,
  149. EC_GROUP_check, EC_GROUP_check_named_curve,
  150. EC_GROUP_check_discriminant, EC_GROUP_cmp,
  151. EC_GROUP_get_basis_type, EC_GROUP_get_trinomial_basis,
  152. EC_GROUP_get_pentanomial_basis, EC_GROUP_get0_field,
  153. EC_GROUP_get_field_type
  154. \&\- Functions for manipulating EC_GROUP objects
  155. .SH "SYNOPSIS"
  156. .IX Header "SYNOPSIS"
  157. .Vb 1
  158. \& #include <openssl/ec.h>
  159. \&
  160. \& int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src);
  161. \& EC_GROUP *EC_GROUP_dup(const EC_GROUP *src);
  162. \&
  163. \& int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator,
  164. \& const BIGNUM *order, const BIGNUM *cofactor);
  165. \& const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group);
  166. \&
  167. \& int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx);
  168. \& const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group);
  169. \& int EC_GROUP_order_bits(const EC_GROUP *group);
  170. \& int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx);
  171. \& const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group);
  172. \& const BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group);
  173. \&
  174. \& void EC_GROUP_set_curve_name(EC_GROUP *group, int nid);
  175. \& int EC_GROUP_get_curve_name(const EC_GROUP *group);
  176. \&
  177. \& void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag);
  178. \& int EC_GROUP_get_asn1_flag(const EC_GROUP *group);
  179. \&
  180. \& void EC_GROUP_set_point_conversion_form(EC_GROUP *group, point_conversion_form_t form);
  181. \& point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *group);
  182. \&
  183. \& unsigned char *EC_GROUP_get0_seed(const EC_GROUP *group);
  184. \& size_t EC_GROUP_get_seed_len(const EC_GROUP *group);
  185. \& size_t EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *, size_t len);
  186. \&
  187. \& int EC_GROUP_get_degree(const EC_GROUP *group);
  188. \&
  189. \& int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx);
  190. \& int EC_GROUP_check_named_curve(const EC_GROUP *group, int nist_only,
  191. \& BN_CTX *ctx);
  192. \&
  193. \& int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx);
  194. \&
  195. \& int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx);
  196. \&
  197. \& int EC_GROUP_get_basis_type(const EC_GROUP *group);
  198. \& int EC_GROUP_get_trinomial_basis(const EC_GROUP *group, unsigned int *k);
  199. \& int EC_GROUP_get_pentanomial_basis(const EC_GROUP *group, unsigned int *k1,
  200. \& unsigned int *k2, unsigned int *k3);
  201. \&
  202. \& int EC_GROUP_get_field_type(const EC_GROUP *group);
  203. .Ve
  204. .PP
  205. The following function has been deprecated since OpenSSL 3.0, and can be
  206. hidden entirely by defining \fB\s-1OPENSSL_API_COMPAT\s0\fR with a suitable version value,
  207. see \fBopenssl_user_macros\fR\|(7):
  208. .PP
  209. .Vb 1
  210. \& const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group);
  211. .Ve
  212. .SH "DESCRIPTION"
  213. .IX Header "DESCRIPTION"
  214. \&\fBEC_GROUP_copy()\fR copies the curve \fBsrc\fR into \fBdst\fR. Both \fBsrc\fR and \fBdst\fR must use the same \s-1EC_METHOD.\s0
  215. .PP
  216. \&\fBEC_GROUP_dup()\fR creates a new \s-1EC_GROUP\s0 object and copies the content from \fBsrc\fR to the newly created
  217. \&\s-1EC_GROUP\s0 object.
  218. .PP
  219. \&\fBEC_GROUP_method_of()\fR obtains the \s-1EC_METHOD\s0 of \fBgroup\fR.
  220. This function was deprecated in OpenSSL 3.0, since \s-1EC_METHOD\s0 is no longer a public concept.
  221. .PP
  222. \&\fBEC_GROUP_set_generator()\fR sets curve parameters that must be agreed by all participants using the curve. These
  223. parameters include the \fBgenerator\fR, the \fBorder\fR and the \fBcofactor\fR. The \fBgenerator\fR is a well defined point on the
  224. curve chosen for cryptographic operations. Integers used for point multiplications will be between 0 and
  225. n\-1 where n is the \fBorder\fR. The \fBorder\fR multiplied by the \fBcofactor\fR gives the number of points on the curve.
  226. .PP
  227. \&\fBEC_GROUP_get0_generator()\fR returns the generator for the identified \fBgroup\fR.
  228. .PP
  229. \&\fBEC_GROUP_get_order()\fR retrieves the order of \fBgroup\fR and copies its value into
  230. \&\fBorder\fR. It fails in case \fBgroup\fR is not fully initialized (i.e., its order
  231. is not set or set to zero).
  232. .PP
  233. \&\fBEC_GROUP_get_cofactor()\fR retrieves the cofactor of \fBgroup\fR and copies its value
  234. into \fBcofactor\fR. It fails in case \fBgroup\fR is not fully initialized or if the
  235. cofactor is not set (or set to zero).
  236. .PP
  237. The functions \fBEC_GROUP_set_curve_name()\fR and \fBEC_GROUP_get_curve_name()\fR, set and get the \s-1NID\s0 for the curve respectively
  238. (see \fBEC_GROUP_new\fR\|(3)). If a curve does not have a \s-1NID\s0 associated with it, then EC_GROUP_get_curve_name
  239. will return NID_undef.
  240. .PP
  241. The asn1_flag value is used to determine whether the curve encoding uses
  242. explicit parameters or a named curve using an \s-1ASN1 OID:\s0 many applications only
  243. support the latter form. If asn1_flag is \fB\s-1OPENSSL_EC_NAMED_CURVE\s0\fR then the
  244. named curve form is used and the parameters must have a corresponding
  245. named curve \s-1NID\s0 set. If asn1_flags is \fB\s-1OPENSSL_EC_EXPLICIT_CURVE\s0\fR the
  246. parameters are explicitly encoded. The functions \fBEC_GROUP_get_asn1_flag()\fR and
  247. \&\fBEC_GROUP_set_asn1_flag()\fR get and set the status of the asn1_flag for the curve.
  248. Note: \fB\s-1OPENSSL_EC_EXPLICIT_CURVE\s0\fR was added in OpenSSL 1.1.0, for
  249. previous versions of OpenSSL the value 0 must be used instead. Before OpenSSL
  250. 1.1.0 the default form was to use explicit parameters (meaning that
  251. applications would have to explicitly set the named curve form) in OpenSSL
  252. 1.1.0 and later the named curve form is the default.
  253. .PP
  254. The point_conversion_form for a curve controls how \s-1EC_POINT\s0 data is encoded as \s-1ASN1\s0 as defined in X9.62 (\s-1ECDSA\s0).
  255. point_conversion_form_t is an enum defined as follows:
  256. .PP
  257. .Vb 10
  258. \& typedef enum {
  259. \& /** the point is encoded as z||x, where the octet z specifies
  260. \& * which solution of the quadratic equation y is */
  261. \& POINT_CONVERSION_COMPRESSED = 2,
  262. \& /** the point is encoded as z||x||y, where z is the octet 0x04 */
  263. \& POINT_CONVERSION_UNCOMPRESSED = 4,
  264. \& /** the point is encoded as z||x||y, where the octet z specifies
  265. \& * which solution of the quadratic equation y is */
  266. \& POINT_CONVERSION_HYBRID = 6
  267. \& } point_conversion_form_t;
  268. .Ve
  269. .PP
  270. For \s-1POINT_CONVERSION_UNCOMPRESSED\s0 the point is encoded as an octet signifying the \s-1UNCOMPRESSED\s0 form has been used followed by
  271. the octets for x, followed by the octets for y.
  272. .PP
  273. For any given x coordinate for a point on a curve it is possible to derive two possible y values. For
  274. \&\s-1POINT_CONVERSION_COMPRESSED\s0 the point is encoded as an octet signifying that the \s-1COMPRESSED\s0 form has been used \s-1AND\s0 which of
  275. the two possible solutions for y has been used, followed by the octets for x.
  276. .PP
  277. For \s-1POINT_CONVERSION_HYBRID\s0 the point is encoded as an octet signifying the \s-1HYBRID\s0 form has been used \s-1AND\s0 which of the two
  278. possible solutions for y has been used, followed by the octets for x, followed by the octets for y.
  279. .PP
  280. The functions \fBEC_GROUP_set_point_conversion_form()\fR and \fBEC_GROUP_get_point_conversion_form()\fR, set and get the point_conversion_form
  281. for the curve respectively.
  282. .PP
  283. \&\s-1ANSI X9.62\s0 (\s-1ECDSA\s0 standard) defines a method of generating the curve parameter b from a random number. This provides advantages
  284. in that a parameter obtained in this way is highly unlikely to be susceptible to special purpose attacks, or have any trapdoors in it.
  285. If the seed is present for a curve then the b parameter was generated in a verifiable fashion using that seed. The OpenSSL \s-1EC\s0 library
  286. does not use this seed value but does enable you to inspect it using \fBEC_GROUP_get0_seed()\fR. This returns a pointer to a memory block
  287. containing the seed that was used. The length of the memory block can be obtained using \fBEC_GROUP_get_seed_len()\fR. A number of the
  288. built-in curves within the library provide seed values that can be obtained. It is also possible to set a custom seed using
  289. \&\fBEC_GROUP_set_seed()\fR and passing a pointer to a memory block, along with the length of the seed. Again, the \s-1EC\s0 library will not use
  290. this seed value, although it will be preserved in any \s-1ASN1\s0 based communications.
  291. .PP
  292. \&\fBEC_GROUP_get_degree()\fR gets the degree of the field.
  293. For Fp fields this will be the number of bits in p.
  294. For F2^m fields this will be the value m.
  295. .PP
  296. \&\fBEC_GROUP_get_field_type()\fR identifies what type of field the \s-1EC_GROUP\s0 structure supports,
  297. which will be either F2^m or Fp.
  298. .PP
  299. The function \fBEC_GROUP_check_discriminant()\fR calculates the discriminant for the curve and verifies that it is valid.
  300. For a curve defined over Fp the discriminant is given by the formula 4*a^3 + 27*b^2 whilst for F2^m curves the discriminant is
  301. simply b. In either case for the curve to be valid the discriminant must be non zero.
  302. .PP
  303. The function \fBEC_GROUP_check()\fR behaves in the following way:
  304. For the OpenSSL default provider it performs a number of checks on a curve to verify that it is valid. Checks performed include
  305. verifying that the discriminant is non zero; that a generator has been defined; that the generator is on the curve and has
  306. the correct order. For the OpenSSL \s-1FIPS\s0 provider it uses \fBEC_GROUP_check_named_curve()\fR to conform to SP800\-56Ar3.
  307. .PP
  308. The function \fBEC_GROUP_check_named_curve()\fR determines if the group's domain parameters match one of the built-in curves supported by the library.
  309. The curve name is returned as a \fB\s-1NID\s0\fR if it matches. If the group's domain parameters have been modified then no match will be found.
  310. If the curve name of the given group is \fBNID_undef\fR (e.g. it has been created by using explicit parameters with no curve name),
  311. then this method can be used to lookup the name of the curve that matches the group domain parameters. The built-in curves contain
  312. aliases, so that multiple \s-1NID\s0's can map to the same domain parameters. For such curves it is unspecified which of the aliases will be
  313. returned if the curve name of the given group is NID_undef.
  314. If \fBnist_only\fR is 1 it will only look for \s-1NIST\s0 approved curves, otherwise it searches all built-in curves.
  315. This function may be passed a \s-1BN_CTX\s0 object in the \fBctx\fR parameter.
  316. The \fBctx\fR parameter may be \s-1NULL.\s0
  317. .PP
  318. \&\fBEC_GROUP_cmp()\fR compares \fBa\fR and \fBb\fR to determine whether they represent the same curve or not.
  319. .PP
  320. The functions \fBEC_GROUP_get_basis_type()\fR, \fBEC_GROUP_get_trinomial_basis()\fR and \fBEC_GROUP_get_pentanomial_basis()\fR should only be called for curves
  321. defined over an F2^m field. Addition and multiplication operations within an F2^m field are performed using an irreducible polynomial
  322. function f(x). This function is either a trinomial of the form:
  323. .PP
  324. f(x) = x^m + x^k + 1 with m > k >= 1
  325. .PP
  326. or a pentanomial of the form:
  327. .PP
  328. f(x) = x^m + x^k3 + x^k2 + x^k1 + 1 with m > k3 > k2 > k1 >= 1
  329. .PP
  330. The function \fBEC_GROUP_get_basis_type()\fR returns a \s-1NID\s0 identifying whether a trinomial or pentanomial is in use for the field. The
  331. function \fBEC_GROUP_get_trinomial_basis()\fR must only be called where f(x) is of the trinomial form, and returns the value of \fBk\fR. Similarly
  332. the function \fBEC_GROUP_get_pentanomial_basis()\fR must only be called where f(x) is of the pentanomial form, and returns the values of \fBk1\fR,
  333. \&\fBk2\fR and \fBk3\fR respectively.
  334. .SH "RETURN VALUES"
  335. .IX Header "RETURN VALUES"
  336. The following functions return 1 on success or 0 on error: \fBEC_GROUP_copy()\fR, \fBEC_GROUP_set_generator()\fR, \fBEC_GROUP_check()\fR,
  337. \&\fBEC_GROUP_check_discriminant()\fR, \fBEC_GROUP_get_trinomial_basis()\fR and \fBEC_GROUP_get_pentanomial_basis()\fR.
  338. .PP
  339. \&\fBEC_GROUP_dup()\fR returns a pointer to the duplicated curve, or \s-1NULL\s0 on error.
  340. .PP
  341. \&\fBEC_GROUP_method_of()\fR returns the \s-1EC_METHOD\s0 implementation in use for the given curve or \s-1NULL\s0 on error.
  342. .PP
  343. \&\fBEC_GROUP_get0_generator()\fR returns the generator for the given curve or \s-1NULL\s0 on error.
  344. .PP
  345. \&\fBEC_GROUP_get_order()\fR returns 0 if the order is not set (or set to zero) for
  346. \&\fBgroup\fR or if copying into \fBorder\fR fails, 1 otherwise.
  347. .PP
  348. \&\fBEC_GROUP_get_cofactor()\fR returns 0 if the cofactor is not set (or is set to zero) for \fBgroup\fR or if copying into \fBcofactor\fR fails, 1 otherwise.
  349. .PP
  350. \&\fBEC_GROUP_get_curve_name()\fR returns the curve name (\s-1NID\s0) for \fBgroup\fR or will return NID_undef if no curve name is associated.
  351. .PP
  352. \&\fBEC_GROUP_get_asn1_flag()\fR returns the \s-1ASN1\s0 flag for the specified \fBgroup\fR .
  353. .PP
  354. \&\fBEC_GROUP_get_point_conversion_form()\fR returns the point_conversion_form for \fBgroup\fR.
  355. .PP
  356. \&\fBEC_GROUP_get_degree()\fR returns the degree for \fBgroup\fR or 0 if the operation is not supported by the underlying group implementation.
  357. .PP
  358. \&\fBEC_GROUP_get_field_type()\fR returns either \fBNID_X9_62_prime_field\fR for prime curves
  359. or \fBNID_X9_62_characteristic_two_field\fR for binary curves;
  360. these values are defined in the \fI<openssl/obj_mac.h>\fR header file.
  361. .PP
  362. \&\fBEC_GROUP_check_named_curve()\fR returns the nid of the matching named curve, otherwise it returns 0 for no match, or \-1 on error.
  363. .PP
  364. \&\fBEC_GROUP_get0_order()\fR returns an internal pointer to the group order.
  365. \&\fBEC_GROUP_order_bits()\fR returns the number of bits in the group order.
  366. \&\fBEC_GROUP_get0_cofactor()\fR returns an internal pointer to the group cofactor.
  367. \&\fBEC_GROUP_get0_field()\fR returns an internal pointer to the group field. For curves over \s-1GF\s0(p), this is the modulus; for curves
  368. over \s-1GF\s0(2^m), this is the irreducible polynomial defining the field.
  369. .PP
  370. \&\fBEC_GROUP_get0_seed()\fR returns a pointer to the seed that was used to generate the parameter b, or \s-1NULL\s0 if the seed is not
  371. specified. \fBEC_GROUP_get_seed_len()\fR returns the length of the seed or 0 if the seed is not specified.
  372. .PP
  373. \&\fBEC_GROUP_set_seed()\fR returns the length of the seed that has been set. If the supplied seed is \s-1NULL,\s0 or the supplied seed length is
  374. 0, the return value will be 1. On error 0 is returned.
  375. .PP
  376. \&\fBEC_GROUP_cmp()\fR returns 0 if the curves are equal, 1 if they are not equal, or \-1 on error.
  377. .PP
  378. \&\fBEC_GROUP_get_basis_type()\fR returns the values NID_X9_62_tpBasis or NID_X9_62_ppBasis (as defined in \fI<openssl/obj_mac.h>\fR) for a
  379. trinomial or pentanomial respectively. Alternatively in the event of an error a 0 is returned.
  380. .SH "SEE ALSO"
  381. .IX Header "SEE ALSO"
  382. \&\fBcrypto\fR\|(7), \fBEC_GROUP_new\fR\|(3),
  383. \&\fBEC_POINT_new\fR\|(3), \fBEC_POINT_add\fR\|(3), \fBEC_KEY_new\fR\|(3),
  384. \&\fBEC_GFp_simple_method\fR\|(3), \fBd2i_ECPKParameters\fR\|(3)
  385. .SH "HISTORY"
  386. .IX Header "HISTORY"
  387. \&\fBEC_GROUP_method_of()\fR was deprecated in OpenSSL 3.0.
  388. \&\fBEC_GROUP_get0_field()\fR, \fBEC_GROUP_check_named_curve()\fR and \fBEC_GROUP_get_field_type()\fR were added in OpenSSL 3.0.
  389. \&\fBEC_GROUP_get0_order()\fR, \fBEC_GROUP_order_bits()\fR and \fBEC_GROUP_get0_cofactor()\fR were added in OpenSSL 1.1.0.
  390. .SH "COPYRIGHT"
  391. .IX Header "COPYRIGHT"
  392. Copyright 2013\-2023 The OpenSSL Project Authors. All Rights Reserved.
  393. .PP
  394. Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use
  395. this file except in compliance with the License. You can obtain a copy
  396. in the file \s-1LICENSE\s0 in the source distribution or at
  397. <https://www.openssl.org/source/license.html>.