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.1] Honor OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT as set and default to UNCOMPRESSED #19681

Closed

Commits on Nov 26, 2022

  1. Honor OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT as set and default t…

    …o UNCOMPRESSED
    
    Originally the code to im/export the EC pubkey was meant to be consumed
    only by the im/export functions when crossing the provider boundary.
    Having our providers exporting to a COMPRESSED format octet string made
    sense to avoid memory waste, as it wasn't exposed outside the provider
    API, and providers had all tools available to convert across the three
    formats.
    
    Later on, with openssl#13139 deprecating the `EC_KEY_*` functions, more state
    was added among the params imported/exported on an EC provider-native
    key (including `OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT`, although it
    did not affect the format used to export `OSSL_PKEY_PARAM_PUB_KEY`).
    
    Finally, in openssl#14800, `EVP_PKEY_todata()` was introduced and prominently
    exposed directly to users outside the provider API, and the choice of
    COMPRESSED over UNCOMPRESSED as the default became less sensible in
    light of usability, given the latter is more often needed by
    applications and protocols.
    
    This commit fixes it, by using `EC_KEY_get_conv_form()` to get the
    point format from the internal state (an `EC_KEY` under the hood) of the
    provider-side object, and using it on
    `EVP_PKEY_export()`/`EVP_PKEY_todata()` to format
    `OSSL_PKEY_PARAM_PUB_KEY`.
    The default for an `EC_KEY` was already UNCOMPRESSED, and it is altered
    if the user sets `OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT` via
    `EVP_PKEY_fromdata()`, `EVP_PKEY_set_params()`, or one of the
    more specialized methods.
    
    For symmetry, this commit also alters `ec_pkey_export_to()` in
    `crypto/ec/ec_ameth.c`, part of the `EVP_PKEY_ASN1_METHOD` for legacy EC
    keys: it exclusively used COMPRESSED format, and now it honors the
    conversion format specified in the EC_KEY object being exported to a
    provider when this function is called.
    
    Fixes openssl#16595
    romen committed Nov 26, 2022
    Configuration menu
    Copy the full SHA
    2aa506e View commit details
    Browse the repository at this point in the history
  2. fixup! Honor OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT as set and de…

    …fault to UNCOMPRESSED
    
    Add a CHANGES entry
    romen committed Nov 26, 2022
    Configuration menu
    Copy the full SHA
    36b04f1 View commit details
    Browse the repository at this point in the history
  3. fixup! fixup! Honor OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT as set…

    … and default to UNCOMPRESSED
    romen committed Nov 26, 2022
    Configuration menu
    Copy the full SHA
    5bb20e6 View commit details
    Browse the repository at this point in the history

Commits on Nov 27, 2022

  1. Configuration menu
    Copy the full SHA
    dc11f2e View commit details
    Browse the repository at this point in the history

Commits on Nov 28, 2022

  1. fixup! Honor OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT as set and de…

    …fault to UNCOMPRESSED
    
    Expand documentation about `OSSL_PKEY_PARAM_PUB_KEY` and mention the
    3.1 change in behavior for our providers.
    romen committed Nov 28, 2022
    Configuration menu
    Copy the full SHA
    811a7b9 View commit details
    Browse the repository at this point in the history