Introduce pk_sign() and use it in ssl
diff --git a/include/polarssl/pk.h b/include/polarssl/pk.h
index fb0e92e..cc8a2fc 100644
--- a/include/polarssl/pk.h
+++ b/include/polarssl/pk.h
@@ -129,6 +129,13 @@
const unsigned char *hash, size_t hash_len,
const unsigned char *sig, size_t sig_len );
+ /** Make signature */
+ int (*sign_func)( void *ctx, md_type_t md_alg,
+ const unsigned char *hash, size_t hash_len,
+ unsigned char *sig, size_t *sig_len,
+ int (*f_rng)(void *, unsigned char *, size_t),
+ void *p_rng );
+
/** Allocate a new context */
void * (*ctx_alloc_func)( void );
@@ -219,6 +226,25 @@
const unsigned char *sig, size_t sig_len );
/**
+ * \brief Make signature
+ *
+ * \param ctx PK context to use
+ * \param md_alg Hash algorithm used
+ * \param hash Hash of the message to sign
+ * \param hash_len Hash length
+ * \param sig Place to write the signature
+ * \param sig_len Number of bytes written
+ * \param f_rng RNG function
+ * \param p_rng RNG parameter
+ *
+ * \return 0 on success, or a specific error code.
+ */
+int pk_sign( pk_context *ctx, md_type_t md_alg,
+ const unsigned char *hash, size_t hash_len,
+ unsigned char *sig, size_t *sig_len,
+ int (*f_rng)(void *, unsigned char *, size_t), void *p_rng );
+
+/**
* \brief Export debug information
*
* \param ctx Context to use
diff --git a/include/polarssl/ssl.h b/include/polarssl/ssl.h
index b98551b..9a1d220 100644
--- a/include/polarssl/ssl.h
+++ b/include/polarssl/ssl.h
@@ -580,6 +580,7 @@
*/
pk_context *pk_key; /*!< own private key */
#if defined(POLARSSL_RSA_C)
+ int rsa_use_alt; /*<! flag for alt (temporary) */
void *rsa_key; /*!< own RSA private key */
rsa_decrypt_func rsa_decrypt; /*!< function for RSA decrypt*/
rsa_sign_func rsa_sign; /*!< function for RSA sign */