Changed naming and prototype convention for x509write functions

CSR writing functions now start with x509write_csr_*()
DER writing functions now have the context at the start instead of the
end conforming to other modules.
diff --git a/library/x509write.c b/library/x509write.c
index 3302636..0e6e4bf 100644
--- a/library/x509write.c
+++ b/library/x509write.c
@@ -41,12 +41,12 @@
 #define polarssl_free       free
 #endif
 
-void x509cert_req_init( x509_cert_req *ctx )
+void x509write_csr_init( x509_csr *ctx )
 {
-    memset( ctx, 0, sizeof(x509_cert_req) );
+    memset( ctx, 0, sizeof(x509_csr) );
 }
 
-void x509cert_req_free( x509_cert_req *ctx )
+void x509write_csr_free( x509_csr *ctx )
 {
     x509_req_name *cur;
 
@@ -56,20 +56,20 @@
         polarssl_free( cur );
     }
 
-    memset( ctx, 0, sizeof(x509_cert_req) );
+    memset( ctx, 0, sizeof(x509_csr) );
 }
 
-void x509cert_req_set_md_alg( x509_cert_req *ctx, md_type_t md_alg )
+void x509write_csr_set_md_alg( x509_csr *ctx, md_type_t md_alg )
 {
     ctx->md_alg = md_alg;
 }
 
-void x509cert_req_set_rsa_key( x509_cert_req *ctx, rsa_context *rsa )
+void x509write_csr_set_rsa_key( x509_csr *ctx, rsa_context *rsa )
 {
     ctx->rsa = rsa;
 }
 
-int x509cert_req_set_subject_name( x509_cert_req *ctx, char *subject_name )
+int x509write_csr_set_subject_name( x509_csr *ctx, char *subject_name )
 {
     int ret = 0;
     char *s = subject_name, *c = s;
@@ -148,7 +148,7 @@
     return( ret );
 }
 
-int x509_write_pubkey_der( unsigned char *buf, size_t size, rsa_context *rsa )
+int x509write_pubkey_der( rsa_context *rsa, unsigned char *buf, size_t size )
 {
     int ret;
     unsigned char *c;
@@ -190,7 +190,7 @@
     return( len );
 }
 
-int x509_write_key_der( unsigned char *buf, size_t size, rsa_context *rsa )
+int x509write_key_der( rsa_context *rsa, unsigned char *buf, size_t size )
 {
     int ret;
     unsigned char *c;
@@ -293,8 +293,7 @@
     return( len );
 }
 
-int x509_write_cert_req( x509_cert_req *ctx, unsigned char *buf,
-                         size_t size )
+int x509write_csr_der( x509_csr *ctx, unsigned char *buf, size_t size )
 {
     int ret;
     const char *sig_oid;