| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
discussed with jsing
|
| |
|
|
|
|
| |
discussed with jsing
|
|
|
|
|
|
|
|
|
|
|
|
| |
The caller can provide an r which will be added to the ECDSA_SIG unchecked.
This can happen via ECDSA_{,do_}sign_ex() or ECDSA_sign_setup() or else via
a custom sign_sig() handler. Therefore add a check that it is in the bounds
required.
Since k was long thrown away, there's no way to check kinv, so it needs to
be trusted. Misdesigned APIs that will output garbage everywhere...
ok jsing
|
|
|
|
|
|
|
|
| |
Use variable names that correspond more closely to the standard. Use an
additional variable for s^-1 for readability. Annotate the code with
the corresponding steps from FIPS 186-5.
ok jsing
|
|
|
|
| |
ok jsing
|
|
|
|
|
|
|
| |
This pushes a few variables no longer needed in ossl_ecdsa_sign_sig() into
ecdsa_compute_s() separating API logic and pure computation a bit more.
ok beck
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Make it take an EC_KEY instead of a group order in preparation for further
cleanup. Rename m into e to match the standard better. Also buy some vowels
for jsing.
ok beck jsing
|
|
|
|
|
|
|
|
| |
ossl_ecdsa_sign_sig() is already complicated enough. The math bit is
entirely self contained and does not need to obfuscate control flow
and logic.
with feedback from and ok jsing
|
|
|
|
|
|
|
|
| |
The only reason ckinv exists is to be able to avoid a copy. This copy
leaks some timing info, that will be mitigated in a subsequent step.
It is an unused or at least uncommonly used codepath.
ok jsing
|
|
|
|
|
|
|
|
|
|
|
| |
If the caller supplied both kinv and r, we don't loop but rather throw
an undocumented error code that no one uses, which is intended to tell
the caller to run ECDSA_sign_setup() and try again.
Use a boolean that indicates this situation so that the logic becomes
a bit more transparent.
ok jsing
|
| |
|
| |
|
|
|
|
| |
requested by jsing
|
|
|
|
|
|
|
|
| |
This is confusing, as both sides involved should be unsigned. The ec
code is undecided on whether the group order can be negative. It should
never be, so lets see what happen with this slightly stricter check.
discussed with jsing
|
|
|
|
|
|
|
| |
The checks whether r and s lie in the interval [1, order) were a bit
uglier than necessary. Clean this up.
ok beck jsing
|
| |
|
|
|
|
| |
ok beck jsing
|
|
|
|
| |
ok beck jsing
|
|
|
|
| |
ok beck jsing
|
|
|
|
| |
Requested by jsing
|
|
|
|
|
|
|
| |
Make it single exit and use API more idiomatically and some other
cosmetics.
ok beck jsing
|
|
|
|
| |
ok jsing
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Both these functions use a BN_CTX internally to deal with the EC API
that usually requires one. However, they don't actually make use of it.
Get the BIGNUMs from the BN_CTX instead, which simplifies the cleanup.
Also defer allocation of the ECDSA_SIG to the very end. Instead of using
its internal r and s, use two local r and s variables and transfer those
to the ECDSA_SIG on success.
ok beck jsing
|
| |
|
|
|
|
| |
suggested by jsing
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
This avoids some silly dances in ECDSA signature generation by replacing
them with a single API call. Also garbage collect the now unnecessary
range.
ok beck jsing
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Now that they no longer use static methods, they can move where they
belong. Also make the static method const, as it should have been all
along.
|
|
|
|
|
|
|
|
| |
Now that it is no longer possible to set a custom {ECDH,ECDSA}_METHOD,
EC_KEY_METHOD can just call the relevant method directly without the
need for this extra contortion.
ok jsing
|
|
|
|
| |
ok jsing
|
|
|
|
| |
discussed with jsing
|
|
|
|
|
| |
this in ossl_ecdsa_sign() and propagate the return code.
OK jsing@ tb@
|
|
|
|
| |
ok jsing
|
|
|
|
| |
ok jsing
|
|
|
|
|
|
|
| |
BN_clear_free() is a wrapper that calls BN_free() - call BN_free() directly
instead.
ok tb@
|
|
|
|
|
|
|
|
| |
This makes sure that the elliptic curve is not completely stupid.
This is conservative enough: the smallest named groups that we support
have an order of 112 bits.
ok beck jsing
|
|
|
|
|
|
|
|
|
|
|
|
| |
ECDSA is essentially the same thing as DSA, except that it is slightly
less stupid. Signing specifies an infinite loop, which is only possible
with arbitrary ECDSA domain parameters. Fortunately, most use of ECDSA
in the wild is based on well-known groups, so it is known a priori that
the loop is not infinite. Still, infinite loops are bad. A retry is
unlikely, 32 retries have a probability of ~2^-8000. So it's pretty
safe to error out.
ok beck jsing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names
used for internal headers. Move all these headers we inherited from
OpenSSL to *_local.h, reserving the name *_internal.h for our own code.
Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h.
constant_time_locl.h is moved to constant_time.h since it's special.
Adjust all .c files in libcrypto, libssl and regress.
The diff is mechanical with the exception of tls13_quic.c, where
#include <ssl_locl.h> was fixed manually.
discussed with jsing,
no objection bcook
|
|
|
|
| |
Pointed out by and ok jsing
|