Add tests and fix bugs for RSA-alt contexts
diff --git a/library/pk.c b/library/pk.c
index 80eccc9..cfde265 100644
--- a/library/pk.c
+++ b/library/pk.c
@@ -258,6 +258,9 @@
     if( ctx == NULL || ctx->pk_info == NULL )
         return( POLARSSL_ERR_PK_BAD_INPUT_DATA );
 
+    if( ctx->pk_info->debug_func == NULL )
+        return( POLARSSL_ERR_PK_TYPE_MISMATCH );
+
     ctx->pk_info->debug_func( ctx->pk_ctx, items );
     return( 0 );
 }