| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
| |
Reduces an upcoming diff which is hard enough to review without these
distractions.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Of course the four stunning beauties in there aren't printing anything.
the hex family converts an elliptic curve point's X9.62 encoding into a
hex string (which kind of makes sense, you can print that if you want).
Much more astounding is EC_POINT_point2bn() where the X9.62 octet string
is interpreted as a BIGNUM. Yes, the bignum's hex digits are the point
conversion form followed by the affine coordinate(s) of the elliptic
curve point, and yes you can choose between compressed, uncompressed,
and hybrid encoding, why do you ask? This doesn't really make any sense
whatsoever but of course you can also print that if you really want to.
Of course the beloved platinum members of the "gotta try every terrible
OpenSSL interface" club had to use and expose this.
|
|
|
|
|
| |
This can't be perfectly symmetric, but the logic is now roughly the same
in both these functions.
|
| |
|
| |
|
|
|
|
|
| |
No need to guard free() with a NULL check, check explicitly against 0
and rename p to seed.
|
| |
|
|
|
|
| |
Some test cases are disabled since they exercise an upcoming bug fix.
|
| |
|
|
|
|
| |
CID 511280
|
| |
|
|
|
|
|
|
| |
point to an octet string and match with the initial octet string.
would have caught the regression found by anton
|
|
|
|
|
|
|
|
| |
This is annoying since it undoes some polishing done before commit and
reintroduces an unpleasant asymmetry.
found by anton via openssl-ruby tests
ok jsing
|
|
|
|
| |
... is obviously r.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Factor ad-hoc inline code into helper functions. Use CBB and
BN_bn2binpad() instead of batshit crazy skip loops and pointer
banging. With all this done, the function becomes relatively
streamlined and pretty much symmetric with the new oct2point()
implementation.
ok jsing
|
|
|
|
|
|
|
|
|
| |
Transform the spaghetti in here into something more readable. Factor
various inline checks into helper functions to make the logic clearer.
This is a bit longer but a lot safer and simpler. It accepts exactly
the same input as the original version.
ok jsing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The SEC 1 standard defines various ways of encoding an elliptic curve
point as ASN.1 octet string. It's also used for the public key, which
isn't an octet string but a bit string for whatever historic reason.
The public API is incomplete and inconvenient, so we need to jump
through a few hoops to support it and to preserve our own sanity.
Split a small helper function out of ec_GFp_simple_point2oct() that
checks that a uint8_t represents a valid point conversion form. It
supports exactly the four possible variants and helps translating
from point_conversion_form_t at the API boundary.
Reject the form for the point at infinity since the function has
historically done that even for the case that the point actually is
the point at infinity.
ok jsing
|
| |
|
|
|
|
| |
breaks tree as noted by krw
|
| |
|
|
|
|
| |
ok jsing
|
|
|
|
|
|
|
|
|
| |
All internal uses of EC_METHOD_get_field_type() and EC_GROUP_method_of()
are chained together. Implement this as a single API call that takes a
group and use it throughout. Gets rid of another eyesore in this part of
the tree. Not that there will be a shortage of eyesores anytime soon...
ok jsing
|
|
|
|
|
|
|
|
| |
We can just reach into the group to obtain its EC_GROUP_METHOD. After all
ec_local.h has to be in scope. This will permit marking this ugly API as
unused internally after the next commit.
ok jsing
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
This makes the thing a bit easier on the eyes and improves greppability.
ok joshua jsing
|
|
|
|
| |
ok joshua jsing
|
|
|
|
|
|
| |
Move the IA32 specific code to arch/{amd64,i386}/crypto_cpu_caps.c, rather
than polluting cryptlib.c with machine dependent code. A stub version of
crypto_cpu_caps_ia32() still remains for now.
|
|
|
|
|
|
|
| |
This has been unused for a long time - it can be found in the attic if
someone wants to clean it up and enable it in the future.
ok tb@
|
| |
|
|
|
|
| |
EC_GROUP_check() is quite simple. It doesn't need to use its own file.
|
| |
|
|
|
|
|
| |
This makes the internal curve test in ectest.c superfluous.
Also fix a logic error.
|
|
|
|
|
| |
When determining the minimum of nitems and EC_CURVE_LIST_LENGTH
we need neither an extra variable nor a ternary operator.
|
|
|
|
|
|
|
| |
Rename struct ec_list_element into struct ec_curve. Accordingly, curve_list
becomes struct ec_curve ec_curve_list[]. Adjust internal API to match.
suggested by jsing
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
EC parameters are very general. While there are some minimal sanity checks,
for the parameters due to DoS risks found in the last decade, the elliptic
curve code is poorly written and a target rich environment for NULL
dereferences, busy loops, expensive computations and whatever other
nastiness you can think of. It is not too hard to come up with parameters
that reach very ugly code. While we have removed for the worst of it (the
"fast" nist code and GF2m come to mind), the code very much resembles the
Augean Stables.
Unfortunately, curve parameters are still in use - even mandatory in some
contexts - for example in machine-readable travel documents signed by ICAO
country signing certification authorities (see ICAO Doc 9303).
To avoid many of these DoS vectors, start enforcing that we know what the
curve parameters are about, namely that they correspond to a builtin curve.
This way we know that the parameters are at least as good as the standards
we implement and checking this is cheap:
Translate curve parameters into the ad hoc representation in the builtin
curve code and check there's a match. That's very cheap since most curves
are distinguished by cofactor and parameter length and we need to use an
actual parameter comparison for at most half a dozen curves, usually only
one or two.
ok jsing
|
| |
|
|
|
|
|
|
|
| |
This is the same CPU capabilities code that is now used for amd64. Like
amd64 we now only populate OPENSSL_ia32cap_P with bits used by perlasm.
Discussed with tb@
|
| |
|