Const correctness
diff --git a/library/x509_create.c b/library/x509_create.c
index 4a15e7d..cc7f954 100644
--- a/library/x509_create.c
+++ b/library/x509_create.c
@@ -31,11 +31,11 @@
#include "polarssl/asn1write.h"
#include "polarssl/oid.h"
-int x509_string_to_names( asn1_named_data **head, char *name )
+int x509_string_to_names( asn1_named_data **head, const char *name )
{
int ret = 0;
- char *s = name, *c = s;
- char *end = s + strlen( s );
+ const char *s = name, *c = s;
+ const char *end = s + strlen( s );
const char *oid = NULL;
int in_tag = 1;
asn1_named_data *cur;
diff --git a/library/x509write_crt.c b/library/x509write_crt.c
index 86b4034..15a1194 100644
--- a/library/x509write_crt.c
+++ b/library/x509write_crt.c
@@ -81,12 +81,14 @@
ctx->issuer_key = key;
}
-int x509write_crt_set_subject_name( x509write_cert *ctx, char *subject_name )
+int x509write_crt_set_subject_name( x509write_cert *ctx,
+ const char *subject_name )
{
return x509_string_to_names( &ctx->subject, subject_name );
}
-int x509write_crt_set_issuer_name( x509write_cert *ctx, char *issuer_name )
+int x509write_crt_set_issuer_name( x509write_cert *ctx,
+ const char *issuer_name )
{
return x509_string_to_names( &ctx->issuer, issuer_name );
}
@@ -101,8 +103,8 @@
return( 0 );
}
-int x509write_crt_set_validity( x509write_cert *ctx, char *not_before,
- char *not_after )
+int x509write_crt_set_validity( x509write_cert *ctx, const char *not_before,
+ const char *not_after )
{
if( strlen(not_before) != X509_RFC5280_UTC_TIME_LEN - 1 ||
strlen(not_after) != X509_RFC5280_UTC_TIME_LEN - 1 )
diff --git a/library/x509write_csr.c b/library/x509write_csr.c
index febed67..3a49aee 100644
--- a/library/x509write_csr.c
+++ b/library/x509write_csr.c
@@ -66,7 +66,8 @@
ctx->key = key;
}
-int x509write_csr_set_subject_name( x509write_csr *ctx, char *subject_name )
+int x509write_csr_set_subject_name( x509write_csr *ctx,
+ const char *subject_name )
{
return x509_string_to_names( &ctx->subject, subject_name );
}