Skip to content

Remove use of pk_debug() #10460

@mpg

Description

@mpg

Remove all uses of mbedtls_pk_debug() in ssl_debug.c and simplify the way public keys are printed in debug logs.

Currently after calling pk_debug() we do some parsing of the output in order to print out separately N and E for RSA keys, and X and Y for ECC keys. That's overkill. This was to ensure compatibility with the old output format, whose original implementation relied heavily on the ability to break abstraction barriers and access internals of rsa.h and ecp.h. We no longer live in that world, an I don't think we need to go to such lengths to preserve the old output format of the debug log.

Instead, let's just print out the public key in the PSA format (which is pretty compact), using mbedtls_pk_write_pubkey_psa() introduced by Mbed-TLS/TF-PSA-Crypto#529

If we have to change some test data due to the change of format, I think that's OK: debug output is not guaranteed to remain stable.

Depends on: Mbed-TLS/TF-PSA-Crypto#529

Metadata

Metadata

Assignees

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