Fixed that selfsign copies issuer_name to subject_name
diff --git a/ChangeLog b/ChangeLog
index 28fd648..2a2130c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,7 @@
    * Prevent possible alignment warnings on casting from char * to 'aligned *'
    * Misc fixes and additions to dependency checks
    * Const correctness
+   * cert_write with selfsign should use issuer_name as subject_name
 
 = PolarSSL 1.3.1 released on 2013-10-15
 Features
diff --git a/programs/x509/cert_write.c b/programs/x509/cert_write.c
index 8e4951e..f72f623 100644
--- a/programs/x509/cert_write.c
+++ b/programs/x509/cert_write.c
@@ -512,7 +512,7 @@
 
     if( opt.selfsign )
     {
-        opt.issuer_name = opt.subject_name;
+        opt.subject_name = opt.issuer_name;
         subject_key = issuer_key;
     }