Added POLARSSL_PK_PARSE_C and POLARSSL_PK_WRITE_C
diff --git a/include/polarssl/config.h b/include/polarssl/config.h
index f75d94d..23bbae0 100644
--- a/include/polarssl/config.h
+++ b/include/polarssl/config.h
@@ -1185,6 +1185,34 @@
 #define POLARSSL_PK_C
 
 /**
+ * \def POLARSSL_PK_PARSE_C
+ *
+ * Enable the generic public (asymetric) key parser.
+ *
+ * Module:  library/pkparse.c
+ * Caller:  library/x509parse.c
+ *
+ * Requires: POLARSSL_PK_C
+ *
+ * Uncomment to enable generic public key parse functions.
+ */
+#define POLARSSL_PK_PARSE_C
+
+/**
+ * \def POLARSSL_PK_WRITE_C
+ *
+ * Enable the generic public (asymetric) key write.
+ *
+ * Module:  library/pkwrite.c
+ * Caller:  library/x509write.c
+ *
+ * Requires: POLARSSL_PK_C
+ *
+ * Uncomment to enable generic public key write functions.
+ */
+#define POLARSSL_PK_WRITE_C
+
+/**
  * \def POLARSSL_PKCS5_C
  *
  * Enable PKCS#5 functions
@@ -1379,7 +1407,7 @@
  *          library/ssl_tls.c
  *
  * Requires: POLARSSL_ASN1_PARSE_C, POLARSSL_BIGNUM_C, POLARSSL_OID_C,
- *           POLARSSL_PK_C
+ *           POLARSSL_PK_PARSE_C
  *
  * This module is required for X.509 certificate parsing.
  */
@@ -1392,7 +1420,7 @@
  *
  * Module:  library/x509write.c
  *
- * Requires: POLARSSL_BIGNUM_C, POLARSSL_OID_C, POLARSSL_PK_C
+ * Requires: POLARSSL_BIGNUM_C, POLARSSL_OID_C, POLARSSL_PK_WRITE_C
  *
  * This module is required for X.509 certificate request writing.
  */
@@ -1562,6 +1590,14 @@
 #error "POLARSSL_PEM_C defined, but not all prerequisites"
 #endif
 
+#if defined(POLARSSL_PK_PARSE_C) && !defined(POLARSSL_PK_C)
+#error "POLARSSL_PK_PARSE_C defined, but not all prerequisites"
+#endif
+
+#if defined(POLARSSL_PK_WRITE_C) && !defined(POLARSSL_PK_C)
+#error "POLARSSL_PK_WRITE_C defined, but not all prerequisites"
+#endif
+
 #if defined(POLARSSL_PKCS11_C) && !defined(POLARSSL_PK_C)
 #error "POLARSSL_PKCS11_C defined, but not all prerequisites"
 #endif
@@ -1614,13 +1650,13 @@
 
 #if defined(POLARSSL_X509_PARSE_C) && ( !defined(POLARSSL_BIGNUM_C) ||  \
     !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_PARSE_C) ||      \
-    !defined(POLARSSL_PK_C) )
+    !defined(POLARSSL_PK_PARSE_C) )
 #error "POLARSSL_X509_PARSE_C defined, but not all prerequisites"
 #endif
 
 #if defined(POLARSSL_X509_WRITE_C) && ( !defined(POLARSSL_BIGNUM_C) ||  \
     !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_WRITE_C) ||      \
-    !defined(POLARSSL_RSA_C) )
+    !defined(POLARSSL_RSA_C) || !defined(POLARSSL_PK_WRITE_C) )
 #error "POLARSSL_X509_WRITE_C defined, but not all prerequisites"
 #endif
 
diff --git a/include/polarssl/pk.h b/include/polarssl/pk.h
index 584f77f..e1fdf89 100644
--- a/include/polarssl/pk.h
+++ b/include/polarssl/pk.h
@@ -389,6 +389,7 @@
  */
 pk_type_t pk_get_type( const pk_context *ctx );
 
+#if defined(POLARSSL_PK_PARSE_C)
 /** \ingroup x509_module */
 /**
  * \brief           Parse a private key
@@ -443,7 +444,9 @@
  */
 int pk_parse_public_keyfile( pk_context *ctx, const char *path );
 #endif /* POLARSSL_FS_IO */
+#endif /* POLARSSL_PK_PARSE_C */
 
+#if defined(POLARSSL_PK_WRITE_C)
 /**
  * \brief           Write a private key to a PKCS#1 or SEC1 DER structure
  *                  Note: data is written at the end of the buffer! Use the
@@ -497,12 +500,14 @@
  */
 int pk_write_key_pem( pk_context *key, unsigned char *buf, size_t size );
 #endif /* POLARSSL_BASE64_C */
+#endif /* POLARSSL_PK_WRITE_C */
 
 /*
  * WARNING: Low-level functions. You probably do not want to use these unless
  *          you are certain you do ;)
  */
 
+#if defined(POLARSSL_PK_PARSE_C)
 /**
  * \brief           Parse a SubjectPublicKeyInfo DER structure
  *
@@ -514,7 +519,9 @@
  */
 int pk_parse_get_pubkey( unsigned char **p, const unsigned char *end,
                          pk_context *pk );
+#endif /* POLARSSL_PK_PARSE_C */
 
+#if defined(POLARSSL_PK_WRITE_C)
 /**
  * \brief           Write a subjectPublicKey to ASN.1 data
  *                  Note: function works backwards in data buffer
@@ -527,6 +534,7 @@
  */
 int pk_write_pubkey( unsigned char **p, unsigned char *start,
                      const pk_context *key );
+#endif /* POLARSSL_PK_WRITE_C */
 
 #ifdef __cplusplus
 }
diff --git a/library/pkparse.c b/library/pkparse.c
index e04bbea..2d244f1 100644
--- a/library/pkparse.c
+++ b/library/pkparse.c
@@ -25,7 +25,7 @@
 
 #include "polarssl/config.h"
 
-#if defined(POLARSSL_PK_C)
+#if defined(POLARSSL_PK_PARSE_C)
 
 #include "polarssl/pk.h"
 #include "polarssl/asn1.h"
@@ -954,4 +954,4 @@
     return( ret );
 }
 
-#endif /* POLARSSL_PK_C */
+#endif /* POLARSSL_PK_PARSE_C */
diff --git a/library/pkwrite.c b/library/pkwrite.c
index 741df08..022281d 100644
--- a/library/pkwrite.c
+++ b/library/pkwrite.c
@@ -25,7 +25,7 @@
 
 #include "polarssl/config.h"
 
-#if defined(POLARSSL_PK_C)
+#if defined(POLARSSL_PK_WRITE_C)
 
 #include "polarssl/pk.h"
 #include "polarssl/asn1write.h"
@@ -386,4 +386,4 @@
 }
 #endif /* POLARSSL_BASE64_C */
 
-#endif /* POLARSSL_PK_C */
+#endif /* POLARSSL_PK_WRITE_C */
diff --git a/tests/suites/test_suite_pkparse.function b/tests/suites/test_suite_pkparse.function
index 9d8d8d8..5cdd844 100644
--- a/tests/suites/test_suite_pkparse.function
+++ b/tests/suites/test_suite_pkparse.function
@@ -5,7 +5,7 @@
 /* END_HEADER */
 
 /* BEGIN_DEPENDENCIES
- * depends_on:POLARSSL_PK_C:POLARSSL_BIGNUM_C
+ * depends_on:POLARSSL_PK_PARSE_C:POLARSSL_BIGNUM_C
  * END_DEPENDENCIES
  */
 
diff --git a/tests/suites/test_suite_pkwrite.function b/tests/suites/test_suite_pkwrite.function
index ce74d71..455b9aa 100644
--- a/tests/suites/test_suite_pkwrite.function
+++ b/tests/suites/test_suite_pkwrite.function
@@ -5,7 +5,7 @@
 /* END_HEADER */
 
 /* BEGIN_DEPENDENCIES
- * depends_on:POLARSSL_PK_C:POLARSSL_BIGNUM_C:POLARSSL_FS_IO
+ * depends_on:POLARSSL_PK_WRITE_C:POLARSSL_BIGNUM_C:POLARSSL_FS_IO
  * END_DEPENDENCIES
  */