summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/EC_GROUP_check.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/EC_GROUP_check.3')
-rw-r--r--src/lib/libcrypto/man/EC_GROUP_check.3157
1 files changed, 157 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/EC_GROUP_check.3 b/src/lib/libcrypto/man/EC_GROUP_check.3
new file mode 100644
index 0000000000..e000be212b
--- /dev/null
+++ b/src/lib/libcrypto/man/EC_GROUP_check.3
@@ -0,0 +1,157 @@
1.\" $OpenBSD: EC_GROUP_check.3,v 1.1 2025/04/25 19:57:12 tb Exp $
2.\"
3.\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: April 25 2025 $
18.Dt EC_GROUP_CHECK 3
19.Os
20.Sh NAME
21.Nm EC_GROUP_check_discriminant ,
22.Nm EC_GROUP_check
23.Nd partially check validity of
24.Vt EC_GROUP
25objects
26.Sh SYNOPSIS
27.In openssl/bn.h
28.In openssl/ec.h
29.Pp
30Deprecated:
31.Pp
32.Ft "int"
33.Fo EC_GROUP_check_discriminant
34.Fa "const EC_GROUP *group"
35.Fa "BN_CTX *ctx"
36.Fc
37.Ft "int"
38.Fo EC_GROUP_check
39.Fa "const EC_GROUP *group"
40.Fa "BN_CTX *ctx"
41.Fc
42.Sh DESCRIPTION
43These functions are deprecated.
44Only standardized curves built into the library should be used, see
45.Xr EC_GROUP_new_by_curve_name 3 .
46For builtin curves far more thorough checks than the minimal checks
47performed by these functions have been performed.
48.Pp
49These functions have an optional
50.Fa ctx
51argument which is used to avoid the cost of repeated allocation of
52auxiliary
53.Vt BIGNUM
54objects.
55.Pp
56.Fn EC_GROUP_check_discriminant
57can be called after
58.Xr EC_GROUP_new_curve_GFp 3
59to verify that
60.Fa group Ns 's
61parameters have non-zero discriminant 4a^3 + 27b^2 modulo p.
62Assuming that
63.Fa p
64is a prime number larger than three
65this implies that the Weierstrass equation defines an elliptic curve.
66.Pp
67.Fn EC_GROUP_check
68partially verifies that
69.Fa group
70represents an an elliptic curve and that
71.Fa generator
72is a point on the curve whose order divides
73.Fa order .
74It checks with
75.Fn EC_GROUP_check_discriminant
76that the discriminant is non-zero
77and then verifies that that
78.Fa order
79is non-zero and that the product
80.Fa generator No * Fa order
81is the point at infinity.
82This implies that
83.Fa order
84is an integer multiple of the
85.Fa generator Ns 's
86.Fa order .
87The verification that
88.Fa p
89is a prime
90and that
91.Fa order
92is the
93.Fa generator Ns 's
94order are skipped because they are too expensive.
95.Sh RETURN VALUES
96.Fn EC_GROUP_check_discriminant
97returns 1 on success and 0 on failure.
98Failure modes include that the discriminant is zero modulo
99.Fa p
100and memory allocation failure.
101.Pp
102.Fn EC_GROUP_check
103returns 1 on success and 0 on failure.
104.Sh ERRORS
105Diagnostics for
106.Fn EC_GROUP_check
107that can be retrieved with
108.Xr ERR_get_error 3 ,
109.Xr ERR_GET_REASON 3 ,
110and
111.Xr ERR_reason_error_string 3
112include:
113.Bl -tag -width Ds
114.It Dv EC_R_DISCRIMINANT_IS_ZERO Qq "discriminant is zero"
115.Fn EC_GROUP_check_discriminant
116failed because the discriminant is zero or for some other reason.
117.It Dv EC_R_UNDEFINED_GENERATOR Qq "undefined generator"
118no generator is set on
119.Fa group ,
120for example because a call to
121.Xr EC_GROUP_set_generator 3
122is missing.
123.It Dv EC_R_POINT_IS_NOT_ON_CURVE Qq "point is not on curve"
124a generator is set, but it is not a point on the curve represented by
125.Fa group .
126.It Dv EC_R_UNDEFINED_ORDER Qq "undefined order"
127the
128.Fa order
129set on
130.Fa group
131is zero.
132.It Dv EC_R_INVALID_GROUP_ORDER Qq "invalid group order"
133.Fa generator No * Fa order
134is not the point at infinity.
135.El
136.Sh SEE ALSO
137.Xr BN_CTX_new 3 ,
138.Xr BN_is_zero 3 ,
139.Xr crypto 3 ,
140.Xr d2i_ECPKParameters 3 ,
141.Xr EC_GROUP_get_curve_name 3 ,
142.Xr EC_GROUP_new_by_curve_name 3 ,
143.Xr EC_GROUP_new_curve_GFp 3 ,
144.Xr EC_KEY_METHOD_new 3 ,
145.Xr EC_KEY_new 3 ,
146.Xr EC_POINT_add 3 ,
147.Xr EC_POINT_get_affine_coordinates 3 ,
148.Xr EC_POINT_new 3 ,
149.Xr EC_POINT_point2oct 3 ,
150.Xr ECDH_compute_key 3 ,
151.Xr ECDSA_SIG_new 3
152.Sh HISTORY
153.Fn EC_GROUP_check
154and
155.Fn EC_GROUP_check_discriminant
156first appeared in OpenSSL 0.9.8 and have been available since
157.Ox 4.5 .