Add ecdh_make_server_params (untested yet)
diff --git a/include/polarssl/ecdh.h b/include/polarssl/ecdh.h
index 2f1e51d..9928503 100644
--- a/include/polarssl/ecdh.h
+++ b/include/polarssl/ecdh.h
@@ -34,11 +34,12 @@
  */
 typedef struct
 {
-    ecp_group grp;  /*!<  ellipitic curve used  */
-    mpi d;          /*!<  our secret value      */
-    ecp_point Q;    /*!<  our public value      */
-    ecp_point Qp;   /*!<  peer's public value   */
-    mpi z;          /*!<  shared secret         */
+    ecp_group grp;      /*!<  ellipitic curve used      */
+    mpi d;              /*!<  our secret value          */
+    ecp_point Q;        /*!<  our public value          */
+    ecp_point Qp;       /*!<  peer's public value       */
+    mpi z;              /*!<  shared secret             */
+    int point_format;   /*!<  format for point export   */
 }
 ecdh_context;
 
@@ -91,6 +92,25 @@
 void ecdh_free( ecdh_context *ctx );
 
 /**
+ * \brief           Setup and write the ServerKeyExhange parameters
+ *
+ * \param ctx       ECDH context
+ * \param buf       destination buffer
+ * \param olen      number of chars written
+ * \param f_rng     RNG function
+ * \param p_rng     RNG parameter
+ *
+ * \note            This function assumes that ctx->grp has already been
+ *                  properly set (for example using ecp_use_known_dp).
+ *
+ * \return          0 if successful, or an POLARSSL_ERR_ECP_XXX error code
+ */
+int ecdh_make_server_params( ecdh_context *ctx, size_t *olen,
+                             unsigned char *buf, size_t blen,
+                             int (*f_rng)(void *, unsigned char *, size_t),
+                             void *p_rng );
+
+/**
  * \brief          Checkup routine
  *
  * \return         0 if successful, or 1 if the test failed
diff --git a/library/ecdh.c b/library/ecdh.c
index 0e2cfdf..32f044a 100644
--- a/library/ecdh.c
+++ b/library/ecdh.c
@@ -85,9 +85,9 @@
     ecp_point_init( &ctx->Q   );
     ecp_point_init( &ctx->Qp  );
     mpi_init      ( &ctx->z   );
+    ctx->point_format = POLARSSL_ECP_PF_UNCOMPRESSED;
 }
 
-
 /*
  * Free context
  */
@@ -103,6 +103,40 @@
     mpi_free      ( &ctx->z   );
 }
 
+/*
+ * Setup and write the ServerKeyExhange parameters
+ *      struct {
+ *          ECParameters    curve_params;
+ *          ECPoint         public;
+ *      } ServerECDHParams;
+ */
+int ecdh_make_server_params( ecdh_context *ctx, size_t *olen,
+                             unsigned char *buf, size_t blen,
+                             int (*f_rng)(void *, unsigned char *, size_t),
+                             void *p_rng )
+{
+    int ret;
+    size_t grp_len, pt_len;
+
+    if( ( ret = ecdh_gen_public( &ctx->grp, &ctx->d, &ctx->Q, f_rng, p_rng ) )
+                != 0 )
+        return( ret );
+
+    if( ( ret = ecp_tls_write_group( &ctx->grp, &grp_len, buf, blen ) )
+                != 0 )
+        return( ret );
+
+    buf += grp_len;
+    blen -= grp_len;
+
+    if( ( ret = ecp_tls_write_point( &ctx->grp, &ctx->Q, ctx->point_format,
+                                     &pt_len, buf, blen ) ) != 0 )
+        return( ret );
+
+    *olen = grp_len + pt_len;
+    return 0;
+}
+
 
 #if defined(POLARSSL_SELF_TEST)