1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-12-24 17:41:01 +03:00

psa_util: improve convert_raw_to_der_single_int()

Allow the function to support DER buffers than what it is nominally
required by the provided coordinates. In other words let's ignore
padding zeros in the raw number.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti
2024-02-05 12:06:46 +01:00
parent 315e4afc0a
commit 954ef4bbd5
4 changed files with 33 additions and 16 deletions

View File

@@ -191,7 +191,12 @@ static inline mbedtls_md_type_t mbedtls_md_type_from_psa_alg(psa_algorithm_t psa
* \param raw_len Length of \p raw in bytes.
* \param[out] der Buffer that will be filled with the converted DER
* output. It can overlap with raw buffer.
* \param der_size Size of \p der in bytes.
* \param der_size Size of \p der in bytes. Given \p bits parameter:
* * #MBEDTLS_ECDSA_MAX_SIG_LEN(\p bits) can be used
* to determine a large enough buffer for any
* \p raw input vector.
* * The minimum size might be smaller in case
* \p raw input vector contains padding zeros.
* \param[out] der_len On success it contains the amount of valid data
* (in bytes) written to \p der. It's undefined
* in case of failure.