Rename pk_init_ctx() -> pk_setup()
diff --git a/include/mbedtls/compat-1.3.h b/include/mbedtls/compat-1.3.h
index d19e04a..1173129 100644
--- a/include/mbedtls/compat-1.3.h
+++ b/include/mbedtls/compat-1.3.h
@@ -2230,8 +2230,8 @@
 #define pk_info_from_type mbedtls_pk_info_from_type
 #define pk_info_t mbedtls_pk_info_t
 #define pk_init mbedtls_pk_init
-#define pk_init_ctx mbedtls_pk_init_ctx
-#define pk_init_ctx_rsa_alt mbedtls_pk_init_ctx_rsa_alt
+#define pk_init_ctx mbedtls_pk_setup
+#define pk_init_ctx_rsa_alt mbedtls_pk_setup_rsa_alt
 #define pk_load_file mbedtls_pk_load_file
 #define pk_parse_key mbedtls_pk_parse_key
 #define pk_parse_keyfile mbedtls_pk_parse_keyfile
diff --git a/include/mbedtls/pk.h b/include/mbedtls/pk.h
index 3ed8b5e..ea6b5ed 100644
--- a/include/mbedtls/pk.h
+++ b/include/mbedtls/pk.h
@@ -197,9 +197,9 @@
  *                  MBEDTLS_ERR_PK_MALLOC_FAILED on allocation failure.
  *
  * \note            For contexts holding an RSA-alt key, use
- *                  \c mbedtls_pk_init_ctx_rsa_alt() instead.
+ *                  \c mbedtls_pk_setup_rsa_alt() instead.
  */
-int mbedtls_pk_init_ctx( mbedtls_pk_context *ctx, const mbedtls_pk_info_t *info );
+int mbedtls_pk_setup( mbedtls_pk_context *ctx, const mbedtls_pk_info_t *info );
 
 #if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
 /**
@@ -214,9 +214,9 @@
  * \return          0 on success, or MBEDTLS_ERR_PK_BAD_INPUT_DATA if the
  *                  context wasn't already initialized as RSA_ALT.
  *
- * \note            This function replaces \c mbedtls_pk_init_ctx() for RSA-alt.
+ * \note            This function replaces \c mbedtls_pk_setup() for RSA-alt.
  */
-int mbedtls_pk_init_ctx_rsa_alt( mbedtls_pk_context *ctx, void * key,
+int mbedtls_pk_setup_rsa_alt( mbedtls_pk_context *ctx, void * key,
                          mbedtls_pk_rsa_alt_decrypt_func decrypt_func,
                          mbedtls_pk_rsa_alt_sign_func sign_func,
                          mbedtls_pk_rsa_alt_key_len_func key_len_func );
diff --git a/library/pk.c b/library/pk.c
index 043f8e3..ebdc063 100644
--- a/library/pk.c
+++ b/library/pk.c
@@ -99,7 +99,7 @@
 /*
  * Initialise context
  */
-int mbedtls_pk_init_ctx( mbedtls_pk_context *ctx, const mbedtls_pk_info_t *info )
+int mbedtls_pk_setup( mbedtls_pk_context *ctx, const mbedtls_pk_info_t *info )
 {
     if( ctx == NULL || info == NULL || ctx->pk_info != NULL )
         return( MBEDTLS_ERR_PK_BAD_INPUT_DATA );
@@ -116,7 +116,7 @@
 /*
  * Initialize an RSA-alt context
  */
-int mbedtls_pk_init_ctx_rsa_alt( mbedtls_pk_context *ctx, void * key,
+int mbedtls_pk_setup_rsa_alt( mbedtls_pk_context *ctx, void * key,
                          mbedtls_pk_rsa_alt_decrypt_func decrypt_func,
                          mbedtls_pk_rsa_alt_sign_func sign_func,
                          mbedtls_pk_rsa_alt_key_len_func key_len_func )
diff --git a/library/pkparse.c b/library/pkparse.c
index 8e1aa6e..f8800f8 100644
--- a/library/pkparse.c
+++ b/library/pkparse.c
@@ -607,7 +607,7 @@
     if( ( pk_info = mbedtls_pk_info_from_type( pk_alg ) ) == NULL )
         return( MBEDTLS_ERR_PK_UNKNOWN_PK_ALG );
 
-    if( ( ret = mbedtls_pk_init_ctx( pk, pk_info ) ) != 0 )
+    if( ( ret = mbedtls_pk_setup( pk, pk_info ) ) != 0 )
         return( ret );
 
 #if defined(MBEDTLS_RSA_C)
@@ -902,7 +902,7 @@
     if( ( pk_info = mbedtls_pk_info_from_type( pk_alg ) ) == NULL )
         return( MBEDTLS_ERR_PK_UNKNOWN_PK_ALG );
 
-    if( ( ret = mbedtls_pk_init_ctx( pk, pk_info ) ) != 0 )
+    if( ( ret = mbedtls_pk_setup( pk, pk_info ) ) != 0 )
         return( ret );
 
 #if defined(MBEDTLS_RSA_C)
@@ -1085,7 +1085,7 @@
         if( ( pk_info = mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == NULL )
             return( MBEDTLS_ERR_PK_UNKNOWN_PK_ALG );
 
-        if( ( ret = mbedtls_pk_init_ctx( pk, pk_info                    ) ) != 0 ||
+        if( ( ret = mbedtls_pk_setup( pk, pk_info                    ) ) != 0 ||
             ( ret = pk_parse_key_pkcs1_der( mbedtls_pk_rsa( *pk ),
                                             pem.buf, pem.buflen ) ) != 0 )
         {
@@ -1117,7 +1117,7 @@
         if( ( pk_info = mbedtls_pk_info_from_type( MBEDTLS_PK_ECKEY ) ) == NULL )
             return( MBEDTLS_ERR_PK_UNKNOWN_PK_ALG );
 
-        if( ( ret = mbedtls_pk_init_ctx( pk, pk_info                   ) ) != 0 ||
+        if( ( ret = mbedtls_pk_setup( pk, pk_info                   ) ) != 0 ||
             ( ret = pk_parse_key_sec1_der( mbedtls_pk_ec( *pk ),
                                            pem.buf, pem.buflen ) ) != 0 )
         {
@@ -1217,7 +1217,7 @@
     if( ( pk_info = mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == NULL )
         return( MBEDTLS_ERR_PK_UNKNOWN_PK_ALG );
 
-    if( ( ret = mbedtls_pk_init_ctx( pk, pk_info                           ) ) != 0 ||
+    if( ( ret = mbedtls_pk_setup( pk, pk_info                           ) ) != 0 ||
         ( ret = pk_parse_key_pkcs1_der( mbedtls_pk_rsa( *pk ), key, keylen ) ) == 0 )
     {
         return( 0 );
@@ -1230,7 +1230,7 @@
     if( ( pk_info = mbedtls_pk_info_from_type( MBEDTLS_PK_ECKEY ) ) == NULL )
         return( MBEDTLS_ERR_PK_UNKNOWN_PK_ALG );
 
-    if( ( ret = mbedtls_pk_init_ctx( pk, pk_info                         ) ) != 0 ||
+    if( ( ret = mbedtls_pk_setup( pk, pk_info                         ) ) != 0 ||
         ( ret = pk_parse_key_sec1_der( mbedtls_pk_ec( *pk ), key, keylen ) ) == 0 )
     {
         return( 0 );
diff --git a/programs/pkey/gen_key.c b/programs/pkey/gen_key.c
index 8aa193c..13d23fc 100644
--- a/programs/pkey/gen_key.c
+++ b/programs/pkey/gen_key.c
@@ -311,9 +311,9 @@
     mbedtls_printf( "\n  . Generating the private key ..." );
     fflush( stdout );
 
-    if( ( ret = mbedtls_pk_init_ctx( &key, mbedtls_pk_info_from_type( opt.type ) ) ) != 0 )
+    if( ( ret = mbedtls_pk_setup( &key, mbedtls_pk_info_from_type( opt.type ) ) ) != 0 )
     {
-        mbedtls_printf( " failed\n  !  mbedtls_pk_init_ctx returned -0x%04x", -ret );
+        mbedtls_printf( " failed\n  !  mbedtls_pk_setup returned -0x%04x", -ret );
         goto exit;
     }
 
diff --git a/scripts/data_files/rename-1.3-2.0.txt b/scripts/data_files/rename-1.3-2.0.txt
index 1bd8c3c..26cf6a2 100644
--- a/scripts/data_files/rename-1.3-2.0.txt
+++ b/scripts/data_files/rename-1.3-2.0.txt
@@ -1757,8 +1757,8 @@
 pk_info_from_type mbedtls_pk_info_from_type
 pk_info_t mbedtls_pk_info_t
 pk_init mbedtls_pk_init
-pk_init_ctx mbedtls_pk_init_ctx
-pk_init_ctx_rsa_alt mbedtls_pk_init_ctx_rsa_alt
+pk_init_ctx mbedtls_pk_setup
+pk_init_ctx_rsa_alt mbedtls_pk_setup_rsa_alt
 pk_load_file mbedtls_pk_load_file
 pk_parse_key mbedtls_pk_parse_key
 pk_parse_keyfile mbedtls_pk_parse_keyfile
diff --git a/tests/suites/test_suite_pk.function b/tests/suites/test_suite_pk.function
index cecc3f7..aab26f4 100644
--- a/tests/suites/test_suite_pk.function
+++ b/tests/suites/test_suite_pk.function
@@ -70,7 +70,7 @@
 
     mbedtls_pk_init( &pk );
 
-    TEST_ASSERT( mbedtls_pk_init_ctx( &pk, mbedtls_pk_info_from_type( type ) ) == 0 );
+    TEST_ASSERT( mbedtls_pk_setup( &pk, mbedtls_pk_info_from_type( type ) ) == 0 );
     TEST_ASSERT( pk_genkey( &pk ) == 0 );
 
     TEST_ASSERT( (int) mbedtls_pk_get_type( &pk ) == type );
@@ -101,7 +101,7 @@
 #if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
     if( mbedtls_pk_get_type( &prv ) == MBEDTLS_PK_RSA )
     {
-        TEST_ASSERT( mbedtls_pk_init_ctx_rsa_alt( &alt, mbedtls_pk_rsa( prv ),
+        TEST_ASSERT( mbedtls_pk_setup_rsa_alt( &alt, mbedtls_pk_rsa( prv ),
                      mbedtls_rsa_decrypt_func, mbedtls_rsa_sign_func, mbedtls_rsa_key_len_func ) == 0 );
         TEST_ASSERT( mbedtls_pk_check_pair( &pub, &alt ) == ret );
     }
@@ -131,7 +131,7 @@
     memset( hash_result, 0x00, 1000 );
     memset( result_str, 0x00, 1000 );
 
-    TEST_ASSERT( mbedtls_pk_init_ctx( &pk, mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == 0 );
+    TEST_ASSERT( mbedtls_pk_setup( &pk, mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == 0 );
     rsa = mbedtls_pk_rsa( pk );
 
     rsa->len = mod / 8;
@@ -175,7 +175,7 @@
     memset( hash_result, 0x00, 1000 );
     memset( result_str, 0x00, 1000 );
 
-    TEST_ASSERT( mbedtls_pk_init_ctx( &pk, mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == 0 );
+    TEST_ASSERT( mbedtls_pk_setup( &pk, mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == 0 );
     rsa = mbedtls_pk_rsa( pk );
 
     rsa->len = mod / 8;
@@ -233,7 +233,7 @@
     memset( sig, 0, sizeof( sig ) );    sig_len = unhexify(sig, sig_str);
     memset( key, 0, sizeof( key ) );    key_len = unhexify(key, key_str);
 
-    TEST_ASSERT( mbedtls_pk_init_ctx( &pk, mbedtls_pk_info_from_type( type ) ) == 0 );
+    TEST_ASSERT( mbedtls_pk_setup( &pk, mbedtls_pk_info_from_type( type ) ) == 0 );
 
     TEST_ASSERT( mbedtls_pk_can_do( &pk, MBEDTLS_PK_ECDSA ) );
     eckey = mbedtls_pk_ec( pk );
@@ -262,7 +262,7 @@
     memset( hash, 0x2a, sizeof hash );
     memset( sig, 0, sizeof sig );
 
-    TEST_ASSERT( mbedtls_pk_init_ctx( &pk, mbedtls_pk_info_from_type( type ) ) == 0 );
+    TEST_ASSERT( mbedtls_pk_setup( &pk, mbedtls_pk_info_from_type( type ) ) == 0 );
     TEST_ASSERT( pk_genkey( &pk ) == 0 );
 
     TEST_ASSERT( mbedtls_pk_sign( &pk, MBEDTLS_MD_SHA256, hash, sizeof hash,
@@ -299,7 +299,7 @@
     res_len = unhexify( result, result_hex );
 
     mbedtls_pk_init( &pk );
-    TEST_ASSERT( mbedtls_pk_init_ctx( &pk, mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == 0 );
+    TEST_ASSERT( mbedtls_pk_setup( &pk, mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == 0 );
     rsa = mbedtls_pk_rsa( pk );
 
     rsa->len = mod / 8;
@@ -345,7 +345,7 @@
     cipher_len = unhexify( cipher, cipher_hex );
 
     /* init pk-rsa context */
-    TEST_ASSERT( mbedtls_pk_init_ctx( &pk, mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == 0 );
+    TEST_ASSERT( mbedtls_pk_setup( &pk, mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == 0 );
     rsa = mbedtls_pk_rsa( pk );
 
     /* load public key */
@@ -399,7 +399,7 @@
     memset( output,     0, sizeof( output ) );
     memset( input,      0, sizeof( input ) );
 
-    TEST_ASSERT( mbedtls_pk_init_ctx( &pk, mbedtls_pk_info_from_type( type ) ) == 0 );
+    TEST_ASSERT( mbedtls_pk_setup( &pk, mbedtls_pk_info_from_type( type ) ) == 0 );
 
     TEST_ASSERT( mbedtls_pk_encrypt( &pk, input, sizeof( input ),
                              output, &olen, sizeof( output ),
@@ -440,7 +440,7 @@
     memset( test, 0, sizeof test );
 
     /* Initiliaze PK RSA context with random key */
-    TEST_ASSERT( mbedtls_pk_init_ctx( &rsa,
+    TEST_ASSERT( mbedtls_pk_setup( &rsa,
                               mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == 0 );
     TEST_ASSERT( pk_genkey( &rsa ) == 0 );
 
@@ -448,7 +448,7 @@
     TEST_ASSERT( mbedtls_rsa_copy( &raw, mbedtls_pk_rsa( rsa ) ) == 0 );
 
     /* Initialize PK RSA_ALT context */
-    TEST_ASSERT( mbedtls_pk_init_ctx_rsa_alt( &alt, (void *) &raw,
+    TEST_ASSERT( mbedtls_pk_setup_rsa_alt( &alt, (void *) &raw,
                  mbedtls_rsa_decrypt_func, mbedtls_rsa_sign_func, mbedtls_rsa_key_len_func ) == 0 );
 
     /* Test administrative functions */