Make mbedtls_x509_get_sig_alg() public

Add mbedtls_x509_get_sig_alg() to the public API. This function is used by TF-A to parse Trusted
Board Boot certificates.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
David Horstmann 2026-10-21 16:36:50 +01:00
parent 3c2d2b43a5
commit ca03136971
2 changed files with 12 additions and 2 deletions

View File

@ -510,5 +510,17 @@ size_t mbedtls_x509_crt_parse_cn_inet_pton(const char *cn, void *dst);
*/
int mbedtls_x509_oid_get_md_alg(const mbedtls_asn1_buf *oid, mbedtls_md_type_t *md_alg);
/**
* \brief Translate a signature algorithm OID and parameters into PK sigalg
*
* \param sig_oid OID of the signature algorithm from the AlgorithmIdentifier type
* \param sig_params Signature parameters from the AlgorithmIdentifier type
* \param[out] md_alg The hash algorithm component of the signature algorithm (if any)
* \param[out] pk_alg The PK algorithm that corresponds to the signature algorithm
*
* \return 0 if successful, or a negative error code on failure
*/
int mbedtls_x509_get_sig_alg(const mbedtls_x509_buf *sig_oid, const mbedtls_x509_buf *sig_params,
mbedtls_md_type_t *md_alg, mbedtls_pk_sigalg_t *pk_alg);
#endif /* MBEDTLS_X509_H */

View File

@ -32,8 +32,6 @@ int mbedtls_x509_get_rsassa_pss_params(const mbedtls_x509_buf *params,
int *salt_len);
#endif
int mbedtls_x509_get_sig(unsigned char **p, const unsigned char *end, mbedtls_x509_buf *sig);
int mbedtls_x509_get_sig_alg(const mbedtls_x509_buf *sig_oid, const mbedtls_x509_buf *sig_params,
mbedtls_md_type_t *md_alg, mbedtls_pk_sigalg_t *pk_alg);
int mbedtls_x509_get_time(unsigned char **p, const unsigned char *end,
mbedtls_x509_time *t);
int mbedtls_x509_get_serial(unsigned char **p, const unsigned char *end,