Constify some input buffers in asn1
authorFdaSilvaYY <fdasilvayy@gmail.com>
Sun, 12 Jun 2016 09:17:50 +0000 (11:17 +0200)
committerRich Salz <rsalz@openssl.org>
Wed, 15 Jun 2016 17:22:38 +0000 (13:22 -0400)
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1215)

crypto/asn1/asn_moid.c
crypto/asn1/asn_mstbl.c
crypto/asn1/t_bitst.c
include/openssl/asn1.h

index 9bffee62f781ab9adfa3f6b2034f219e856901ed..8176b7600832a8ef81026592b09d99ae180b7bb0 100644 (file)
@@ -18,7 +18,7 @@
 
 /* Simple ASN1 OID module: add all objects in a given section */
 
-static int do_create(char *value, char *name);
+static int do_create(const char *value, const char *name);
 
 static int oid_module_init(CONF_IMODULE *md, const CONF *cnf)
 {
@@ -57,11 +57,12 @@ void ASN1_add_oid_module(void)
  * shortname = some long name, 1.2.3.4
  */
 
-static int do_create(char *value, char *name)
+static int do_create(const char *value, const char *name)
 {
     int nid;
     ASN1_OBJECT *oid;
-    char *ln, *ostr, *p, *lntmp;
+    const char *ln, *ostr, *p;
+    char *lntmp;
     p = strrchr(value, ',');
     if (!p) {
         ln = name;
index 196dd56f06af4909c79e006744b2c2f93328f0df..8260939002a70c15be853cb1a81d41279260ea74 100644 (file)
@@ -16,7 +16,7 @@
 
 /* Multi string module: add table entries from a given section */
 
-static int do_tcreate(char *value, char *name);
+static int do_tcreate(const char *value, const char *name);
 
 static int stbl_module_init(CONF_IMODULE *md, const CONF *cnf)
 {
@@ -55,7 +55,7 @@ void ASN1_add_stable_module(void)
  * n1:v1, n2:v2,... where name is "min", "max", "mask" or "flags".
  */
 
-static int do_tcreate(char *value, char *name)
+static int do_tcreate(const char *value, const char *name)
 {
     char *eptr;
     int nid, i, rv = 0;
index 0c3a2393ba350ebe410b455a6e8b0c3814b3188f..c0aeca4c78ccb545e469ef1bc4938b70cf970c46 100644 (file)
@@ -30,7 +30,7 @@ int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
     return 1;
 }
 
-int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
+int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value,
                             BIT_STRING_BITNAME *tbl)
 {
     int bitnum;
@@ -44,7 +44,7 @@ int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
     return 1;
 }
 
-int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl)
+int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl)
 {
     BIT_STRING_BITNAME *bnam;
     for (bnam = tbl; bnam->lname; bnam++) {
index 7e2f72039f4886b479f06eaf561b622803377fff..4bae492f06d362f165e1085d759fb3b99c642cb8 100644 (file)
@@ -553,8 +553,8 @@ int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a,
 
 int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
                                BIT_STRING_BITNAME *tbl, int indent);
-int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl);
-int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
+int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl);
+int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value,
                             BIT_STRING_BITNAME *tbl);
 
 DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)