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

ECP keypair utility functions #7815

Merged

Commits on Dec 22, 2023

  1. New function mbedtls_ecp_keypair_get_group_id

    Add a simple function to get the group id from a key object.
    
    This information is available via mbedtls_ecp_export, but that function
    consumes a lot of memory, which is a waste if all you need is to identify
    the curve.
    
    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Dec 22, 2023
    Configuration menu
    Copy the full SHA
    e688610 View commit details
    Browse the repository at this point in the history
  2. Support partial export from mbedtls_ecp_keypair

    Sometimes you don't need to have all the parts of a key pair object. Relax
    the behavior of mbedtls_ecp_keypair so that you can extract just the parts
    that you need.
    
    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Dec 22, 2023
    Configuration menu
    Copy the full SHA
    ba5b5d6 View commit details
    Browse the repository at this point in the history
  3. Promise mbedtls_ecp_read_key doesn't overwrite the public key

    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Dec 22, 2023
    Configuration menu
    Copy the full SHA
    091a85a View commit details
    Browse the repository at this point in the history
  4. New function mbedtls_ecp_set_public_key

    Set the public key in a key pair. This complements mbedtls_ecp_read_key and
    the functions can be used in either order.
    
    Document the need to call check functions separately.
    
    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Dec 22, 2023
    Configuration menu
    Copy the full SHA
    2824032 View commit details
    Browse the repository at this point in the history
  5. New function mbedtls_ecp_keypair_calc_public

    For when you calculate or import a private key, and then need to calculate
    the public key.
    
    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Dec 22, 2023
    Configuration menu
    Copy the full SHA
    7ea7202 View commit details
    Browse the repository at this point in the history

Commits on Dec 24, 2023

  1. mbedtls_ecp_read_key: explain how to set the public key

    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Dec 24, 2023
    Configuration menu
    Copy the full SHA
    ad5e437 View commit details
    Browse the repository at this point in the history
  2. Rename variable that's a C++ keyword

    It gave uncrustify trouble
    (uncrustify/uncrustify#4044)
    
    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Dec 24, 2023
    Configuration menu
    Copy the full SHA
    6dd8738 View commit details
    Browse the repository at this point in the history
  3. New function mbedtls_ecp_write_public_key

    Directly export the public part of a key pair without having to go through
    intermediate objects (using mbedtls_ecp_point_write_binary would require a
    group object and a point object).
    
    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Dec 24, 2023
    Configuration menu
    Copy the full SHA
    62e33bc View commit details
    Browse the repository at this point in the history
  4. Use new mbedtls_ecp_keypair functions in sample programs

    This eliminates the use of MBEDTLS_PRIVATE in sample programs to access
    fields of an mbedtls_ecp_keypair structure.
    
    When displaying elliptic curve points, the program now display the
    coordinates in the standard form instead of the internal representation.
    
    The auxiliary function show_ecp_key is present in three programs. It's more
    complex than the previous code which was also triplicated. There's no good
    place for such auxiliary functions that don't belong in the library and are
    used in multiple sample programs.
    
    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Dec 24, 2023
    Configuration menu
    Copy the full SHA
    52cc2a6 View commit details
    Browse the repository at this point in the history
  5. Declare dependency on bignum in sample programs

    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Dec 24, 2023
    Configuration menu
    Copy the full SHA
    9552a52 View commit details
    Browse the repository at this point in the history
  6. Add ECP-heavy-only test cases to the driver parity analysis ignore list

    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Dec 24, 2023
    Configuration menu
    Copy the full SHA
    3b17ae7 View commit details
    Browse the repository at this point in the history
  7. Changelog entry for the new ECP functions

    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Dec 24, 2023
    Configuration menu
    Copy the full SHA
    28e9d86 View commit details
    Browse the repository at this point in the history

Commits on Jan 2, 2024

  1. Make input parameter const

    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Jan 2, 2024
    Configuration menu
    Copy the full SHA
    39b7bba View commit details
    Browse the repository at this point in the history
  2. Improve readability of null-argument tests

    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Jan 2, 2024
    Configuration menu
    Copy the full SHA
    5d86787 View commit details
    Browse the repository at this point in the history

Commits on Jan 3, 2024

  1. Remove useless guards on MBEDTLS_BIGNUM_C

    All of ECP requires the bignum module and there is no plan to change that,
    so guarding a few bits of code is just noise.
    
    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    a10d112 View commit details
    Browse the repository at this point in the history