summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2022-11-22 21:54:01 +0000
committertb <>2022-11-22 21:54:01 +0000
commit83218b0f577c41d8cd32381934d706b6af28f396 (patch)
tree6b2684f7e6ac21a0dee458408ccecf5137f66ab4
parente1c308e7ce8fba992e4048924843cd615a00ee3d (diff)
downloadopenbsd-83218b0f577c41d8cd32381934d706b6af28f396.tar.gz
openbsd-83218b0f577c41d8cd32381934d706b6af28f396.tar.bz2
openbsd-83218b0f577c41d8cd32381934d706b6af28f396.zip
Fix some whitespace and comment formatting
-rw-r--r--src/lib/libcrypto/ec/ec_lcl.h82
1 files changed, 45 insertions, 37 deletions
diff --git a/src/lib/libcrypto/ec/ec_lcl.h b/src/lib/libcrypto/ec/ec_lcl.h
index f0a5618be2..dc005d0d23 100644
--- a/src/lib/libcrypto/ec/ec_lcl.h
+++ b/src/lib/libcrypto/ec/ec_lcl.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_lcl.h,v 1.20 2022/06/30 11:14:47 tb Exp $ */ 1/* $OpenBSD: ec_lcl.h,v 1.21 2022/11/22 21:54:01 tb Exp $ */
2/* 2/*
3 * Originally written by Bodo Moeller for the OpenSSL project. 3 * Originally written by Bodo Moeller for the OpenSSL project.
4 */ 4 */
@@ -10,7 +10,7 @@
10 * are met: 10 * are met:
11 * 11 *
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 14 *
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in 16 * notice, this list of conditions and the following disclaimer in
@@ -58,13 +58,13 @@
58/* ==================================================================== 58/* ====================================================================
59 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. 59 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
60 * 60 *
61 * Portions of the attached software ("Contribution") are developed by 61 * Portions of the attached software ("Contribution") are developed by
62 * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. 62 * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
63 * 63 *
64 * The Contribution is licensed pursuant to the OpenSSL open source 64 * The Contribution is licensed pursuant to the OpenSSL open source
65 * license provided above. 65 * license provided above.
66 * 66 *
67 * The elliptic curve binary polynomial software is originally written by 67 * The elliptic curve binary polynomial software is originally written by
68 * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories. 68 * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.
69 * 69 *
70 */ 70 */
@@ -146,9 +146,9 @@ struct ec_method_st {
146 146
147 /* used by EC_POINT_point2oct, EC_POINT_oct2point: */ 147 /* used by EC_POINT_point2oct, EC_POINT_oct2point: */
148 size_t (*point2oct)(const EC_GROUP *, const EC_POINT *, point_conversion_form_t form, 148 size_t (*point2oct)(const EC_GROUP *, const EC_POINT *, point_conversion_form_t form,
149 unsigned char *buf, size_t len, BN_CTX *); 149 unsigned char *buf, size_t len, BN_CTX *);
150 int (*oct2point)(const EC_GROUP *, EC_POINT *, 150 int (*oct2point)(const EC_GROUP *, EC_POINT *,
151 const unsigned char *buf, size_t len, BN_CTX *); 151 const unsigned char *buf, size_t len, BN_CTX *);
152 152
153 /* used by EC_POINT_add, EC_POINT_dbl, ECP_POINT_invert: */ 153 /* used by EC_POINT_add, EC_POINT_dbl, ECP_POINT_invert: */
154 int (*add)(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *); 154 int (*add)(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *);
@@ -214,32 +214,35 @@ struct ec_group_st {
214 214
215 /* The following members are handled by the method functions, 215 /* The following members are handled by the method functions,
216 * even if they appear generic */ 216 * even if they appear generic */
217 217
218 BIGNUM field; /* Field specification. 218 BIGNUM field; /*
219 * For curves over GF(p), this is the modulus; 219 * Field specification.
220 * for curves over GF(2^m), this is the 220 * For curves over GF(p), this is the modulus;
221 * irreducible polynomial defining the field. 221 * for curves over GF(2^m), this is the
222 */ 222 * irreducible polynomial defining the field.
223 223 */
224 int poly[6]; /* Field specification for curves over GF(2^m). 224
225 * The irreducible f(t) is then of the form: 225 int poly[6]; /*
226 * t^poly[0] + t^poly[1] + ... + t^poly[k] 226 * Field specification for curves over GF(2^m).
227 * where m = poly[0] > poly[1] > ... > poly[k] = 0. 227 * The irreducible f(t) is then of the form:
228 * The array is terminated with poly[k+1]=-1. 228 * t^poly[0] + t^poly[1] + ... + t^poly[k]
229 * All elliptic curve irreducibles have at most 5 229 * where m = poly[0] > poly[1] > ... > poly[k] = 0.
230 * non-zero terms. 230 * The array is terminated with poly[k+1]=-1.
231 */ 231 * All elliptic curve irreducibles have at most 5
232 232 * non-zero terms.
233 BIGNUM a, b; /* Curve coefficients. 233 */
234 * (Here the assumption is that BIGNUMs can be used 234
235 * or abused for all kinds of fields, not just GF(p).) 235 BIGNUM a, b; /*
236 * For characteristic > 3, the curve is defined 236 * Curve coefficients.
237 * by a Weierstrass equation of the form 237 * (Here the assumption is that BIGNUMs can be used
238 * y^2 = x^3 + a*x + b. 238 * or abused for all kinds of fields, not just GF(p).)
239 * For characteristic 2, the curve is defined by 239 * For characteristic > 3, the curve is defined
240 * an equation of the form 240 * by a Weierstrass equation of the form
241 * y^2 + x*y = x^3 + a*x^2 + b. 241 * y^2 = x^3 + a*x + b.
242 */ 242 * For characteristic 2, the curve is defined by
243 * an equation of the form
244 * y^2 + x*y = x^3 + a*x^2 + b.
245 */
243 246
244 int a_is_minus3; /* enable optimized point arithmetics for special case */ 247 int a_is_minus3; /* enable optimized point arithmetics for special case */
245 248
@@ -262,7 +265,7 @@ struct ec_key_st {
262 unsigned int enc_flag; 265 unsigned int enc_flag;
263 point_conversion_form_t conv_form; 266 point_conversion_form_t conv_form;
264 267
265 int references; 268 int references;
266 int flags; 269 int flags;
267 270
268 EC_EXTRA_DATA *method_data; 271 EC_EXTRA_DATA *method_data;
@@ -290,13 +293,18 @@ int ec_group_simple_order_bits(const EC_GROUP *group);
290struct ec_point_st { 293struct ec_point_st {
291 const EC_METHOD *meth; 294 const EC_METHOD *meth;
292 295
293 /* All members except 'meth' are handled by the method functions, 296 /*
294 * even if they appear generic */ 297 * All members except 'meth' are handled by the method functions,
298 * even if they appear generic.
299 */
295 300
301 /*
302 * Jacobian projective coordinates: (X, Y, Z) represents (X/Z^2, Y/Z^3)
303 * if Z != 0
304 */
296 BIGNUM X; 305 BIGNUM X;
297 BIGNUM Y; 306 BIGNUM Y;
298 BIGNUM Z; /* Jacobian projective coordinates: 307 BIGNUM Z;
299 * (X, Y, Z) represents (X/Z^2, Y/Z^3) if Z != 0 */
300 int Z_is_one; /* enable optimized point arithmetics for special case */ 308 int Z_is_one; /* enable optimized point arithmetics for special case */
301} /* EC_POINT */; 309} /* EC_POINT */;
302 310