Signature wrapper for uECC
diff --git a/library/pk_wrap.c b/library/pk_wrap.c
index 2f175f5..c6f6302 100644
--- a/library/pk_wrap.c
+++ b/library/pk_wrap.c
@@ -613,7 +613,7 @@
     return( (int) len );
 }
 
-/* Transcode signature from PSA format to ASN.1 sequence.
+/* Transcode signature from uECC format to ASN.1 sequence.
  * See ecdsa_signature_to_asn1 in ecdsa.c, but with byte buffers instead of
  * MPIs, and in-place.
  *
@@ -647,16 +647,17 @@
                    unsigned char *sig, size_t *sig_len,
                    int (*f_rng)(void *, unsigned char *, size_t), void *p_rng )
 {
-    (void) ctx;
-    (void) md_alg;
-    (void) hash;
-    (void) hash_len;
-    (void) sig;
-    (void) sig_len;
+    const mbedtls_uecc_keypair *keypair = (const mbedtls_uecc_keypair *) ctx;
+    const struct uECC_Curve_t * uecc_curve = uECC_secp256r1();
+    
+    uECC_sign(keypair->private_key, hash, hash_len, sig, uecc_curve);
+
+    /* uECC owns its rng function pointer */
     (void) f_rng;
     (void) p_rng;
+    (void) md_alg;
 
-    return( 0 );
+    return( pk_ecdsa_sig_asn1_from_psa( sig, sig_len, 2*NUM_ECC_BYTES ) );
 }
 
 static void *uecc_ecdsa_alloc_wrap( void )
diff --git a/library/ssl_cli.c b/library/ssl_cli.c
index 4e99a80..5fd8e4c 100644
--- a/library/ssl_cli.c
+++ b/library/ssl_cli.c
@@ -3973,6 +3973,11 @@
         rs_ctx = &ssl->handshake->ecrs_ctx.pk;
 #endif
 
+#if defined(MBEDTLS_USE_TINYCRYPT)
+    if ( uECC_get_rng() == 0 )
+        uECC_set_rng(&mbetls_uecc_rng_wrapper);
+#endif
+
     if( ( ret = mbedtls_pk_sign_restartable( mbedtls_ssl_own_key( ssl ),
                          md_alg, hash_start, hashlen,
                          ssl->out_msg + 6 + offset, &n,