Nicer interface between PK and debug.

Finally get rid of pk_context.type member, too.
diff --git a/library/pk.c b/library/pk.c
index ce3b88a..f3c64cb 100644
--- a/library/pk.c
+++ b/library/pk.c
@@ -56,7 +56,6 @@
         return;
 
     ctx->info = NULL;
-    ctx->type = POLARSSL_PK_NONE;
     ctx->data = NULL;
 }
 
@@ -72,7 +71,6 @@
     ctx->data = NULL;
 
     ctx->info = NULL;
-    ctx->type = POLARSSL_PK_NONE;
 }
 
 /*
@@ -107,11 +105,13 @@
 {
     const pk_info_t *info;
 
-    if( ctx->type == type )
-        return( 0 );
+    if( ctx->info != NULL )
+    {
+        if( ctx->info->type == type )
+            return 0;
 
-    if( ctx->type != POLARSSL_PK_NONE )
         return( POLARSSL_ERR_PK_TYPE_MISMATCH );
+    }
 
     if( ( info = pk_info_from_type( type ) ) == NULL )
         return( POLARSSL_ERR_PK_TYPE_MISMATCH );
@@ -119,7 +119,6 @@
     if( ( ctx->data = info->ctx_alloc_func() ) == NULL )
         return( POLARSSL_ERR_PK_MALLOC_FAILED );
 
-    ctx->type = type;
     ctx->info = info;
 
     return( 0 );
@@ -160,3 +159,15 @@
 
     return( ctx->info->get_size( ctx->data ) );
 }
+
+/*
+ * Export debug information
+ */
+int pk_debug( const pk_context *ctx, pk_debug_item *items )
+{
+    if( ctx == NULL || ctx->info == NULL )
+        return( POLARSSL_ERR_PK_TYPE_MISMATCH ); // TODO
+
+    ctx->info->debug_func( ctx->data, items );
+    return( 0 );
+}