Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(3.x) Known result tests for EC compression compatibility validation + #16624 changes #18320

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 3 additions & 1 deletion crypto/ec/ec_ameth.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,10 @@ int ec_pkey_export_to(const EVP_PKEY *from, void *to_keydata,

if (pub_point != NULL) {
/* convert pub_point to a octet string according to the SECG standard */
point_conversion_form_t format = EC_KEY_get_conv_form(eckey);

if ((pub_key_buflen = EC_POINT_point2buf(ecg, pub_point,
POINT_CONVERSION_COMPRESSED,
format,
&pub_key_buf, bnctx)) == 0
|| !OSSL_PARAM_BLD_push_octet_string(tmpl,
OSSL_PKEY_PARAM_PUB_KEY,
Expand Down
8 changes: 4 additions & 4 deletions doc/man7/EVP_PKEY-EC.pod
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ Enable Cofactor DH (ECC CDH) if this value is 1, otherwise it uses normal EC DH
if the value is zero. The cofactor variant multiplies the shared secret by the
EC curve's cofactor (note for some curves the cofactor is 1).

See also L<EVP_KEYEXCH-ECDH(7)> for the related
B<OSSL_EXCHANGE_PARAM_EC_ECDH_COFACTOR_MODE> parameter that can be set on a
per-operation basis.

=item "encoding" (B<OSSL_PKEY_PARAM_EC_ENCODING>) <UTF8 string>

Set the format used for serializing the EC group parameters.
Expand All @@ -104,10 +108,6 @@ but is equivalent to "named-nist" for the OpenSSL FIPS provider.
Setting this value to 0 indicates that the public key should not be included when
encoding the private key. The default value of 1 will include the public key.

See also L<EVP_KEYEXCH-ECDH(7)> for the related
B<OSSL_EXCHANGE_PARAM_EC_ECDH_COFACTOR_MODE> parameter that can be set on a
per-operation basis.

=item "pub" (B<OSSL_PKEY_PARAM_PUB_KEY>) <octet string>

The public key value in EC point format.
Expand Down
4 changes: 3 additions & 1 deletion providers/implementations/keymgmt/ec_kmgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@ int key_to_params(const EC_KEY *eckey, OSSL_PARAM_BLD *tmpl,

if (p != NULL || tmpl != NULL) {
/* convert pub_point to a octet string according to the SECG standard */
point_conversion_form_t format = EC_KEY_get_conv_form(eckey);

if ((pub_key_len = EC_POINT_point2buf(ecg, pub_point,
POINT_CONVERSION_COMPRESSED,
format,
pub_key, bnctx)) == 0
|| !ossl_param_build_set_octet_string(tmpl, p,
OSSL_PKEY_PARAM_PUB_KEY,
Expand Down
6 changes: 5 additions & 1 deletion test/build.info
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ IF[{- !$disabled{tests} -}]
versions \
aborttest test_test pkcs12_format_test pkcs12_api_test \
sanitytest rsa_complex exdatatest bntest \
ecstresstest gmdifftest pbelutest \
ecstresstest ec_comp_test gmdifftest pbelutest \
destest mdc2test sha_test \
exptest pbetest localetest evp_pkey_ctx_new_from_name\
evp_pkey_provided_test evp_test evp_extra_test evp_extra_test2 \
Expand Down Expand Up @@ -108,6 +108,10 @@ IF[{- !$disabled{tests} -}]
INCLUDE[ectest]=../include ../apps/include
DEPEND[ectest]=../libcrypto.a libtestutil.a

SOURCE[ec_comp_test]=ec_comp_test.c
INCLUDE[ec_comp_test]=../include ../apps/include
DEPEND[ec_comp_test]=../libcrypto libtestutil.a

SOURCE[ecstresstest]=ecstresstest.c
INCLUDE[ecstresstest]=../include ../apps/include
DEPEND[ecstresstest]=../libcrypto libtestutil.a
Expand Down
Loading