[test] Vertically test explicit EC params API patterns
authorNicola Tuveri <nic.tuv@gmail.com>
Tue, 21 Jul 2020 15:04:38 +0000 (18:04 +0300)
committerNicola Tuveri <nic.tuv@gmail.com>
Wed, 29 Jul 2020 20:45:57 +0000 (23:45 +0300)
commitf5384f064ec2ef9f1975877da46e6f64c776427c
tree9f1b777a3ec849a43bb86d68fe8343631e0347fa
parent79410c5f8b139c423be436810b4fe4de4637fc24
[test] Vertically test explicit EC params API patterns

This commit adds a new test (run on all the built-in curves) to create
`EC_GROUP` with **unknown** *explicit parameters*: from a built-in group
we create an alternative group from scratch that differs in the
generator used.

At the `EC_GROUP` layer we perform a basic math check to ensure that the
math on the alternative group still makes sense, using comparable
results from the origin group.

We then create two `EC_KEY` objects on top of this alternative group and
run key generation from the `EC_KEY` layer.

Then we promote these two `EC_KEY`s to `EVP_PKEY` objects and try to
run the derive operation at the highest abstraction layer, comparing
results in both directions.

Finally, we create provider-native keys using `EVP_PKEY_fromdata` and
data derived from the previous objects, we compute an equivalent shared
secret from these provider keys, and compare it to the result obtained
from the previous steps.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12507)
test/ectest.c