Fixup: Impl. MBEDTLS_PK_ECKEY, not MBEDTLS_PK_ECDSA, via TinyCrypt

The PK-type MBEDTLS_PK_ECDSA isn't really used by the library.
Especially, when parsing a generic EC key, a PK context of type
MBEDTLS_PK_ECKEY will be requested. Hence, to drop in TinyCrypt
for the legacy-ECC implementation, the PK type that TinyCrypt
implements must be MBEDTLS_PK_ECKEY.
diff --git a/include/mbedtls/pk_internal.h b/include/mbedtls/pk_internal.h
index 9ec2476..d3b501d 100644
--- a/include/mbedtls/pk_internal.h
+++ b/include/mbedtls/pk_internal.h
@@ -132,7 +132,7 @@
 #endif
 
 #if defined(MBEDTLS_USE_TINYCRYPT)
-extern const mbedtls_pk_info_t mbedtls_uecc_ecdsa_info;
+extern const mbedtls_pk_info_t mbedtls_uecc_eckey_info;
 #endif
 
 #if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
diff --git a/library/pk.c b/library/pk.c
index da34e56..161a135 100644
--- a/library/pk.c
+++ b/library/pk.c
@@ -115,19 +115,21 @@
             return( &mbedtls_rsa_info );
 #endif
 #if defined(MBEDTLS_ECP_C)
-        case MBEDTLS_PK_ECKEY:
-            return( &mbedtls_eckey_info );
         case MBEDTLS_PK_ECKEY_DH:
             return( &mbedtls_eckeydh_info );
 #endif
-#if defined(MBEDTLS_USE_TINYCRYPT)
-        case MBEDTLS_PK_ECDSA:
-            return( &mbedtls_uecc_ecdsa_info );
-#else
 #if defined(MBEDTLS_ECDSA_C)
         case MBEDTLS_PK_ECDSA:
             return( &mbedtls_ecdsa_info );
 #endif
+#if defined(MBEDTLS_USE_TINYCRYPT)
+        case MBEDTLS_PK_ECKEY:
+            return( &mbedtls_uecc_eckey_info );
+#else /* MBEDTLS_USE_TINYCRYPT */
+#if defined(MBEDTLS_ECP_C)
+        case MBEDTLS_PK_ECKEY:
+            return( &mbedtls_eckey_info );
+#endif
 #endif /* MBEDTLS_USE_TINYCRYPT */
         /* MBEDTLS_PK_RSA_ALT omitted on purpose */
         default:
diff --git a/library/pk_wrap.c b/library/pk_wrap.c
index c6f6302..cf60691 100644
--- a/library/pk_wrap.c
+++ b/library/pk_wrap.c
@@ -528,18 +528,19 @@
     return( 0 );
 }
 
-static size_t uecc_ecdsa_get_bitlen( const void *ctx )
+static size_t uecc_eckey_get_bitlen( const void *ctx )
 {
     (void) ctx;
     return( (size_t) 2 * NUM_ECC_BYTES );
 }
 
-static int uecc_ecdsa_can_do( mbedtls_pk_type_t type )
+static int uecc_eckey_can_do( mbedtls_pk_type_t type )
 {
-    return( type == MBEDTLS_PK_ECDSA );
+    return( type == MBEDTLS_PK_ECDSA ||
+            type == MBEDTLS_PK_ECKEY );
 }
 
-static int uecc_ecdsa_verify_wrap( void *ctx, mbedtls_md_type_t md_alg,
+static int uecc_eckey_verify_wrap( void *ctx, mbedtls_md_type_t md_alg,
                        const unsigned char *hash, size_t hash_len,
                        const unsigned char *sig, size_t sig_len )
 {
@@ -642,7 +643,7 @@
     return( 0 );
 }
 
-static int uecc_ecdsa_sign_wrap( void *ctx, mbedtls_md_type_t md_alg,
+static int uecc_eckey_sign_wrap( void *ctx, mbedtls_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 )
@@ -660,7 +661,7 @@
     return( pk_ecdsa_sig_asn1_from_psa( sig, sig_len, 2*NUM_ECC_BYTES ) );
 }
 
-static void *uecc_ecdsa_alloc_wrap( void )
+static void *uecc_eckey_alloc_wrap( void )
 {
     /*void *ctx = mbedtls_calloc( 1, sizeof( mbedtls_ecdsa_context ) );
 
@@ -671,25 +672,25 @@
     return NULL;
 }
 
-static void uecc_ecdsa_free_wrap( void *ctx )
+static void uecc_eckey_free_wrap( void *ctx )
 {
     (void) ctx;
     /*mbedtls_ecdsa_free( (mbedtls_ecdsa_context *) ctx );
     mbedtls_free( ctx );*/
 }
 
-const mbedtls_pk_info_t mbedtls_uecc_ecdsa_info = {
-    MBEDTLS_PK_ECDSA,
-    "ECDSA",
-    uecc_ecdsa_get_bitlen,
-    uecc_ecdsa_can_do,
-    uecc_ecdsa_verify_wrap,
-    uecc_ecdsa_sign_wrap,
+const mbedtls_pk_info_t mbedtls_uecc_eckey_info = {
+    MBEDTLS_PK_ECKEY,
+    "EC",
+    uecc_eckey_get_bitlen,
+    uecc_eckey_can_do,
+    uecc_eckey_verify_wrap,
+    uecc_eckey_sign_wrap,
     NULL,
     NULL,
     NULL,
-    uecc_ecdsa_alloc_wrap,
-    uecc_ecdsa_free_wrap,
+    uecc_eckey_alloc_wrap,
+    uecc_eckey_free_wrap,
     NULL,
 };
 #else
diff --git a/library/pkparse.c b/library/pkparse.c
index bc016be..7573bdc 100644
--- a/library/pkparse.c
+++ b/library/pkparse.c
@@ -1545,7 +1545,7 @@
 #endif /* MBEDTLS_RSA_C */
 
 #if defined(MBEDTLS_USE_TINYCRYPT)
-    pk_info = mbedtls_pk_info_from_type( MBEDTLS_PK_ECDSA );
+    pk_info = mbedtls_pk_info_from_type( MBEDTLS_PK_ECKEY );
     if( mbedtls_pk_setup( pk, pk_info ) == 0 &&
         pk_parse_key_sec1_der( mbedtls_uecc_pk( *pk),
                                key, keylen) == 0)