Skip to content

Remove use of pk_get_type() #10455

@mpg

Description

@mpg

The function mbedtls_pk_get_type() is not public and we should stop using it. The old concept of pk_type_t was ambiguous, so there will be different replacements depending of what it was used for.

  1. Key type as in "RSA or ECC?" (hint: the result is used distinguishing "RSA or RSASSA_PSS" vs "ECKEY or ECKEY_DH or ECDSA" which is really an overly complicated way of spelling RSA or ECC) -> use mbedtls_pk_get_key_type() (introduced by PK: add mbedtls_pk_get_key_type() TF-PSA-Crypto#509) plus PSA macros like PSA_KEY_TYPE_IS_RSA() and PSA_KEY_TYPE_IS_ECC().
  2. Indication of ownership of the underlying PSA key (hint: checking for equality with PK_OPAQUE) -> store ownership information elsewhere.
  3. Algorithm identifier (hint: when it's cast to pk_sigalg_t) -> this one is more tricky and should be reviewed on a case by case basis.
  4. Key type with policy information, to distinguish between ECKEY_DH public keys (forbidding ECDSA) and ECKEY public keys (allowing both ECDH and ECDSA).

Metadata

Metadata

Assignees

No one assigned

    Labels

    archivedDo not use - historically applied to archived issuessize-sEstimated task size: small (~2d)

    Type

    Projects

    Status

    1.0 Followup

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions