mbedtls_ecdsa_raw_to_der() function
Convert an ECDSA signature from raw format to DER ASN.1 format.
Arguments
bits
Size of each coordinate in bits.
raw
Buffer that contains the signature in raw format.
raw_len
Length of \p raw in bytes. This must be PSA_BITS_TO_BYTES(bits) bytes.
der
Buffer that will be filled with the converted DER output. It can overlap with raw buffer.
der_size
Size of \p der in bytes. It is enough if \p der_size is at least the size of the actual output. (The size of the output can vary depending on the presence of leading zeros in the data.) You can use #MBEDTLS_ECDSA_MAX_SIG_LEN(\p bits) to determine a size that is large enough for all signatures for a given value of \p bits.
der_len
On success it contains the amount of valid data (in bytes) written to \p der. It's undefined in case of failure.
mbedtls_ecdsa_raw_to_der() calls 3 functions:
![]()
mbedtls_ecdsa_raw_to_der()
mbedtls_ecdsa_raw_to_der():
![]()
mbedtls_ecdsa_raw_to_der()