pkcs11_client: implement RSA sign/verify

Make mbedtls_rsa_emsa_pkcs1_v15_encode_digestinfo from rsa.c public,
and use it in the pkcs11_client module.

pkcs11_client: refactor pkcs11_sign and pkcs11_verify to simplify
memory managmement. Implement these functions for RSA.
diff --git a/library/rsa.c b/library/rsa.c
index 9e4a213..7f1a745 100644
--- a/library/rsa.c
+++ b/library/rsa.c
@@ -1526,11 +1526,11 @@
 /* Encode a hash into a DigestInfo structure as specified by PKCS#1
  * (RFC 8017, EMSA-PKCS1-v1_5-ENCODE step 2).
  * Write to the left of p and set *p to the leftmost byte written. */
-static int rsa_emsa_pkcs1_v15_encode_digestinfo( unsigned char **p,
-                                                 unsigned char *start,
-                                                 mbedtls_md_type_t md_alg,
-                                                 const unsigned char *hash,
-                                                 size_t hashlen )
+int mbedtls_rsa_emsa_pkcs1_v15_encode_digestinfo( unsigned char **p,
+                                                  unsigned char *start,
+                                                  mbedtls_md_type_t md_alg,
+                                                  const unsigned char *hash,
+                                                  size_t hashlen )
 {
     const mbedtls_md_info_t *md_info;
     const char *oid;
@@ -1661,8 +1661,8 @@
     if( md_alg != MBEDTLS_MD_NONE )
         hashlen = 0;
 
-    ret = rsa_emsa_pkcs1_v15_encode_digestinfo( &p, dst,
-                                                md_alg, hash, hashlen );
+    ret = mbedtls_rsa_emsa_pkcs1_v15_encode_digestinfo( &p, dst,
+                                                        md_alg, hash, hashlen );
     if( ret != 0 )
         return( ret );