diff --git a/include/mbedtls/x509.h b/include/mbedtls/x509.h index cae6e255e3..d29736cd62 100644 --- a/include/mbedtls/x509.h +++ b/include/mbedtls/x509.h @@ -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 */ diff --git a/library/x509_internal.h b/library/x509_internal.h index f68b6593bd..7b65331736 100644 --- a/library/x509_internal.h +++ b/library/x509_internal.h @@ -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,