Expose ecdsa_signature_to_asn1
Expose ecdsa_signature_to_asn1 in the API. It's useful when converting
between RFC 4492 format and other representations that might be used
in external crypto processors.
diff --git a/include/mbedtls/ecdsa.h b/include/mbedtls/ecdsa.h
index 3666ffe..c0088db 100644
--- a/include/mbedtls/ecdsa.h
+++ b/include/mbedtls/ecdsa.h
@@ -236,6 +236,28 @@
#endif /* MBEDTLS_ECDSA_DETERMINISTIC */
/**
+ * \brief Convert a signature from numbers to ASN.1
+ *
+ * \param r First number of the signature
+ * \param s Second number of the signature
+ * \param sig Buffer that will hold the signature
+ * \param slen Length of the signature written
+ * \param ssize Size of the sig buffer
+ *
+ * \note The size of the buffer \c ssize should be at least
+ * `MBEDTLS_ECDSA_MAX_SIG_LEN(grp->pbits)` bytes long if
+ * the signature was produced from curve \c grp,
+ * otherwise this function will return an error.
+ *
+ * \return 0 if successful,
+ * or a MBEDTLS_ERR_MPI_XXX or MBEDTLS_ERR_ASN1_XXX error code
+ *
+ */
+int ecdsa_signature_to_asn1( const mbedtls_mpi *r, const mbedtls_mpi *s,
+ unsigned char *sig, size_t *slen,
+ size_t ssize );
+
+/**
* \brief Read and verify an ECDSA signature
*
* \param ctx ECDSA context