Add ecdsa_from_keypair()
Also fix bug/limitation in mpi_copy: would segfault if src just initialised
and not set to a value yet. (This case occurs when copying a context which
contains only the public part of the key, eg.)
diff --git a/include/polarssl/ecdsa.h b/include/polarssl/ecdsa.h
index 15b90e6..47382e5 100644
--- a/include/polarssl/ecdsa.h
+++ b/include/polarssl/ecdsa.h
@@ -143,6 +143,16 @@
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng );
/**
+ * \brief Set an ECDSA context from an EC key pair
+ *
+ * \param ctx ECDSA context to set
+ * \param key EC key to use
+ *
+ * \return 0 on success, or a POLARSSL_ERR_ECP code.
+ */
+int ecdsa_from_keypair( ecdsa_context *ctx, const ecp_keypair *key );
+
+/**
* \brief Initialize context
*
* \param ctx Context to initialize