From: FdaSilvaYY Date: Sun, 12 Jun 2016 09:17:50 +0000 (+0200) Subject: Constify some input buffers in asn1 X-Git-Tag: OpenSSL_1_1_0-pre6~430 X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=fa3a84422dac112fa68eebb29d14df9c1d7acf00;hp=dc423f898e7d15913d31fee311502239d4167266 Constify some input buffers in asn1 Reviewed-by: Kurt Roeckx Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/1215) --- diff --git a/crypto/asn1/asn_moid.c b/crypto/asn1/asn_moid.c index 9bffee62f7..8176b76008 100644 --- a/crypto/asn1/asn_moid.c +++ b/crypto/asn1/asn_moid.c @@ -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; diff --git a/crypto/asn1/asn_mstbl.c b/crypto/asn1/asn_mstbl.c index 196dd56f06..8260939002 100644 --- a/crypto/asn1/asn_mstbl.c +++ b/crypto/asn1/asn_mstbl.c @@ -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; diff --git a/crypto/asn1/t_bitst.c b/crypto/asn1/t_bitst.c index 0c3a2393ba..c0aeca4c78 100644 --- a/crypto/asn1/t_bitst.c +++ b/crypto/asn1/t_bitst.c @@ -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++) { diff --git a/include/openssl/asn1.h b/include/openssl/asn1.h index 7e2f72039f..4bae492f06 100644 --- a/include/openssl/asn1.h +++ b/include/openssl/asn1.h @@ -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)