boringssl/crypto/fipsmodule/ec
David Benjamin 5bcaa113e2 Tighten EC_KEY's association with its group.
This is to simplify
https://boringssl-review.googlesource.com/c/boringssl/+/24445/.

Setting or changing an EC_KEY's group after the public or private keys
have been configured is quite awkward w.r.t. consistency checks. It
becomes additionally messy if we mean to store private keys as
EC_SCALARs (and avoid the BIGNUM timing leak), whose size is
curve-dependent.

Instead, require that callers configure the group before setting either
half of the keypair. Additionally, reject EC_KEY_set_group calls that
change the group. This will simplify clearing one more BIGNUM timing
leak.

Update-Note: This will break code which sets the group and key in a
    weird order. I checked calls of EC_KEY_new and confirmed they all
    set the group first. If I missed any, let me know.

Change-Id: Ie89f90a318b31b6b98f71138e5ff3de5323bc9a6
Reviewed-on: https://boringssl-review.googlesource.com/24425
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
2018-01-03 22:15:11 +00:00
..
asm Revert ADX due to build issues. 2017-08-15 18:56:09 +00:00
ec_key.c Tighten EC_KEY's association with its group. 2018-01-03 22:15:11 +00:00
ec_montgomery.c ec/p256.c: fiat-crypto field arithmetic (64, 32) 2017-12-11 17:55:46 +00:00
ec_test.cc Tighten EC_KEY's association with its group. 2018-01-03 22:15:11 +00:00
ec.c Enable __asm__ and uint128_t code in clang-cl. 2017-12-11 22:46:26 +00:00
internal.h ec/p256.c: fiat-crypto field arithmetic (64, 32) 2017-12-11 17:55:46 +00:00
oct.c Check EC_POINT/EC_GROUP compatibility more accurately. 2017-10-28 08:02:50 +00:00
p224-64.c Enable __asm__ and uint128_t code in clang-cl. 2017-12-11 22:46:26 +00:00
p256-x86_64_test.cc Align the tables in P-256 select w[57] tests. 2017-08-09 01:04:57 +00:00
p256-x86_64_tests.txt
p256-x86_64-table.h Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
p256-x86_64.c ec/p256.c: fiat-crypto field arithmetic (64, 32) 2017-12-11 17:55:46 +00:00
p256-x86_64.h Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
simple.c Remove unused function. 2017-11-20 18:32:44 +00:00
util.c ec/p256.c: fiat-crypto field arithmetic (64, 32) 2017-12-11 17:55:46 +00:00
wnaf.c Make ECDSA signing 10% faster and plug some timing leaks. 2017-11-22 22:51:40 +00:00