summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES3
-rw-r--r--apps/apps.c2
-rw-r--r--apps/asn1pars.c4
-rw-r--r--apps/pkcs12.c2
-rw-r--r--crypto/asn1/a_bitstr.c7
-rw-r--r--crypto/asn1/a_bool.c4
-rw-r--r--crypto/asn1/a_bytes.c22
-rw-r--r--crypto/asn1/a_d2i_fp.c6
-rw-r--r--crypto/asn1/a_dup.c3
-rw-r--r--crypto/asn1/a_gentm.c2
-rw-r--r--crypto/asn1/a_hdr.c2
-rw-r--r--crypto/asn1/a_int.c10
-rw-r--r--crypto/asn1/a_object.c8
-rw-r--r--crypto/asn1/a_octet.c2
-rw-r--r--crypto/asn1/a_set.c4
-rw-r--r--crypto/asn1/a_utctm.c2
-rw-r--r--crypto/asn1/asn1.h61
-rw-r--r--crypto/asn1/asn1_gen.c8
-rw-r--r--crypto/asn1/asn1_lib.c44
-rw-r--r--crypto/asn1/asn1_mac.h30
-rw-r--r--crypto/asn1/asn1_par.c10
-rw-r--r--crypto/asn1/asn1t.h18
-rw-r--r--crypto/asn1/asn_pack.c6
-rw-r--r--crypto/asn1/d2i_pr.c6
-rw-r--r--crypto/asn1/d2i_pu.c2
-rw-r--r--crypto/asn1/evp_asn1.c4
-rw-r--r--crypto/asn1/tasn_dec.c66
-rw-r--r--crypto/asn1/tasn_utl.c2
-rw-r--r--crypto/asn1/x_bignum.c5
-rw-r--r--crypto/asn1/x_long.c5
-rw-r--r--crypto/asn1/x_name.c6
-rw-r--r--crypto/asn1/x_pkey.c2
-rw-r--r--crypto/asn1/x_pubkey.c16
-rw-r--r--crypto/asn1/x_x509.c4
-rw-r--r--crypto/evp/bio_enc.c4
-rw-r--r--crypto/evp/digest.c2
-rw-r--r--crypto/evp/encode.c4
-rw-r--r--crypto/evp/evp.h42
-rw-r--r--crypto/evp/evp_key.c2
-rw-r--r--crypto/evp/evp_pkey.c4
-rw-r--r--crypto/evp/p5_crpt.c3
-rw-r--r--crypto/evp/p5_crpt2.c5
-rw-r--r--crypto/evp/p_dec.c2
-rw-r--r--crypto/evp/p_enc.c2
-rw-r--r--crypto/evp/p_open.c5
-rw-r--r--crypto/evp/p_verify.c2
-rw-r--r--crypto/krb5/krb5_asn.h2
-rw-r--r--crypto/objects/obj_dat.c10
-rw-r--r--crypto/pem/pem_pkey.c3
-rw-r--r--crypto/pkcs12/p12_crpt.c3
-rw-r--r--crypto/pkcs12/p12_decr.c3
-rw-r--r--crypto/pkcs12/p12_npas.c3
-rw-r--r--crypto/pkcs7/pk7_attr.c3
-rw-r--r--crypto/rsa/rsa_saos.c3
-rw-r--r--crypto/rsa/rsa_sign.c4
-rw-r--r--crypto/x509/x509.h12
-rw-r--r--crypto/x509/x509_req.c3
-rw-r--r--crypto/x509/x509spki.c3
-rw-r--r--crypto/x509v3/v3_lib.c3
-rw-r--r--crypto/x509v3/v3_ocsp.c8
-rw-r--r--crypto/x509v3/v3_prn.c3
-rw-r--r--crypto/x509v3/x509v3.h6
-rw-r--r--ssl/s2_clnt.c2
-rw-r--r--ssl/s2_srvr.c6
-rw-r--r--ssl/s3_clnt.c10
-rw-r--r--ssl/s3_srvr.c5
-rw-r--r--ssl/ssl.h10
-rw-r--r--ssl/ssl_locl.h2
-rw-r--r--ssl/ssl_rsa.c14
69 files changed, 331 insertions, 245 deletions
diff --git a/CHANGES b/CHANGES
index a8866ad9a0..6029cce5b3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,9 @@
Changes between 0.9.7c and 0.9.8 [xx XXX xxxx]
+ *) Constify all or almost all d2i, c2i, s2i and r2i functions, along with
+ associated ASN1, EVP and SSL functions and old ASN1 macros.
+
*) BN_zero() only needs to set 'top' and 'neg' to zero for correct results,
and this should never fail. So the return value from the use of
BN_set_word() (which can fail due to needless expansion) is now deprecated;
diff --git a/apps/apps.c b/apps/apps.c
index 47b59b4545..eae1fedcd3 100644
--- a/apps/apps.c
+++ b/apps/apps.c
@@ -758,7 +758,7 @@ X509 *load_cert(BIO *err, const char *file, int format,
x=d2i_X509_bio(cert,NULL);
else if (format == FORMAT_NETSCAPE)
{
- unsigned char *p,*op;
+ const unsigned char *p,*op;
int size=0,i;
/* We sort of have to do it this way because it is sort of nice
diff --git a/apps/asn1pars.c b/apps/asn1pars.c
index c28b5ec194..305db15903 100644
--- a/apps/asn1pars.c
+++ b/apps/asn1pars.c
@@ -94,6 +94,7 @@ int MAIN(int argc, char **argv)
char *infile=NULL,*str=NULL,*prog,*oidfile=NULL, *derfile=NULL;
char *genstr=NULL, *genconf=NULL;
unsigned char *tmpbuf;
+ const unsigned char *ctmpbuf;
BUF_MEM *buf=NULL;
STACK *osk=NULL;
ASN1_TYPE *at=NULL;
@@ -317,7 +318,8 @@ bad:
tmpbuf+=j;
tmplen-=j;
atmp = at;
- at = d2i_ASN1_TYPE(NULL,&tmpbuf,tmplen);
+ ctmpbuf = tmpbuf;
+ at = d2i_ASN1_TYPE(NULL,&ctmpbuf,tmplen);
ASN1_TYPE_free(atmp);
if(!at)
{
diff --git a/apps/pkcs12.c b/apps/pkcs12.c
index cbd933667b..dd0d29bfaa 100644
--- a/apps/pkcs12.c
+++ b/apps/pkcs12.c
@@ -811,7 +811,7 @@ err:
int alg_print (BIO *x, X509_ALGOR *alg)
{
PBEPARAM *pbe;
- unsigned char *p;
+ const unsigned char *p;
p = alg->parameter->value.sequence->data;
pbe = d2i_PBEPARAM (NULL, &p, alg->parameter->value.sequence->length);
BIO_printf (bio_err, "%s, Iteration %ld\n",
diff --git a/crypto/asn1/a_bitstr.c b/crypto/asn1/a_bitstr.c
index f4ea96cd54..c1d3c28210 100644
--- a/crypto/asn1/a_bitstr.c
+++ b/crypto/asn1/a_bitstr.c
@@ -113,11 +113,12 @@ int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
return(ret);
}
-ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp,
- long len)
+ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
+ const unsigned char **pp, long len)
{
ASN1_BIT_STRING *ret=NULL;
- unsigned char *p,*s;
+ const unsigned char *p;
+ unsigned char *s;
int i;
if (len < 1)
diff --git a/crypto/asn1/a_bool.c b/crypto/asn1/a_bool.c
index 24333ea4d5..331acdf053 100644
--- a/crypto/asn1/a_bool.c
+++ b/crypto/asn1/a_bool.c
@@ -75,10 +75,10 @@ int i2d_ASN1_BOOLEAN(int a, unsigned char **pp)
return(r);
}
-int d2i_ASN1_BOOLEAN(int *a, unsigned char **pp, long length)
+int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, long length)
{
int ret= -1;
- unsigned char *p;
+ const unsigned char *p;
long len;
int inf,tag,xclass;
int i=0;
diff --git a/crypto/asn1/a_bytes.c b/crypto/asn1/a_bytes.c
index afd27b80e1..8d13f9c931 100644
--- a/crypto/asn1/a_bytes.c
+++ b/crypto/asn1/a_bytes.c
@@ -60,14 +60,15 @@
#include "cryptlib.h"
#include <openssl/asn1.h>
-static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c);
+static int asn1_collate_primitive(ASN1_STRING *a, ASN1_const_CTX *c);
/* type is a 'bitmap' of acceptable string types.
*/
-ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, unsigned char **pp,
+ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp,
long length, int type)
{
ASN1_STRING *ret=NULL;
- unsigned char *p,*s;
+ const unsigned char *p;
+ unsigned char *s;
long len;
int inf,tag,xclass;
int i=0;
@@ -153,11 +154,12 @@ int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass)
return(r);
}
-ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, long length,
- int Ptag, int Pclass)
+ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,
+ long length, int Ptag, int Pclass)
{
ASN1_STRING *ret=NULL;
- unsigned char *p,*s;
+ const unsigned char *p;
+ unsigned char *s;
long len;
int inf,tag,xclass;
int i=0;
@@ -185,7 +187,7 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, long length,
if (inf & V_ASN1_CONSTRUCTED)
{
- ASN1_CTX c;
+ ASN1_const_CTX c;
c.pp=pp;
c.p=p;
@@ -247,7 +249,7 @@ err:
* them into the one structure that is then returned */
/* There have been a few bug fixes for this function from
* Paul Keogh <paul.keogh@sse.ie>, many thanks to him */
-static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c)
+static int asn1_collate_primitive(ASN1_STRING *a, ASN1_const_CTX *c)
{
ASN1_STRING *os=NULL;
BUF_MEM b;
@@ -268,7 +270,7 @@ static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c)
{
if (c->inf & 1)
{
- c->eos=ASN1_check_infinite_end(&c->p,
+ c->eos=ASN1_const_check_infinite_end(&c->p,
(long)(c->max-c->p));
if (c->eos) break;
}
@@ -296,7 +298,7 @@ static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c)
num+=os->length;
}
- if (!asn1_Finish(c)) goto err;
+ if (!asn1_const_Finish(c)) goto err;
a->length=num;
if (a->data != NULL) OPENSSL_free(a->data);
diff --git a/crypto/asn1/a_d2i_fp.c b/crypto/asn1/a_d2i_fp.c
index b67b75e7c2..2e99e4c69a 100644
--- a/crypto/asn1/a_d2i_fp.c
+++ b/crypto/asn1/a_d2i_fp.c
@@ -107,14 +107,14 @@ err:
void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x)
{
BUF_MEM *b = NULL;
- unsigned char *p;
+ const unsigned char *p;
void *ret=NULL;
int len;
len = asn1_d2i_read_bio(in, &b);
if(len < 0) goto err;
- p=(unsigned char *)b->data;
+ p=(const unsigned char *)b->data;
ret=ASN1_item_d2i(x,&p,len, it);
err:
if (b != NULL) BUF_MEM_free(b);
@@ -146,7 +146,7 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
unsigned char *p;
int i;
int ret=-1;
- ASN1_CTX c;
+ ASN1_const_CTX c;
int want=HEADER_SIZE;
int eos=0;
#if defined(__GNUC__) && defined(__ia64)
diff --git a/crypto/asn1/a_dup.c b/crypto/asn1/a_dup.c
index 58a017884c..dc6826ad1b 100644
--- a/crypto/asn1/a_dup.c
+++ b/crypto/asn1/a_dup.c
@@ -91,7 +91,8 @@ char *ASN1_dup(int (*i2d)(), char *(*d2i)(), char *x)
void *ASN1_item_dup(const ASN1_ITEM *it, void *x)
{
- unsigned char *b = NULL, *p;
+ unsigned char *b = NULL;
+ const unsigned char *p;
long i;
void *ret;
diff --git a/crypto/asn1/a_gentm.c b/crypto/asn1/a_gentm.c
index 8581007868..ea8d7b96c8 100644
--- a/crypto/asn1/a_gentm.c
+++ b/crypto/asn1/a_gentm.c
@@ -181,7 +181,7 @@ err:
return(0);
}
-int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str)
+int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str)
{
ASN1_GENERALIZEDTIME t;
diff --git a/crypto/asn1/a_hdr.c b/crypto/asn1/a_hdr.c
index b1aad81f77..b354ae5865 100644
--- a/crypto/asn1/a_hdr.c
+++ b/crypto/asn1/a_hdr.c
@@ -76,7 +76,7 @@ int i2d_ASN1_HEADER(ASN1_HEADER *a, unsigned char **pp)
M_ASN1_I2D_finish();
}
-ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a, unsigned char **pp,
+ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a, const unsigned char **pp,
long length)
{
M_ASN1_D2I_vars(a,ASN1_HEADER *,ASN1_HEADER_new);
diff --git a/crypto/asn1/a_int.c b/crypto/asn1/a_int.c
index 4bb300c20b..5d76de79ba 100644
--- a/crypto/asn1/a_int.c
+++ b/crypto/asn1/a_int.c
@@ -155,11 +155,12 @@ int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)
/* Convert just ASN1 INTEGER content octets to ASN1_INTEGER structure */
-ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, unsigned char **pp,
+ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
long len)
{
ASN1_INTEGER *ret=NULL;
- unsigned char *p,*to,*s, *pend;
+ const unsigned char *p, *pend;
+ unsigned char *to,*s;
int i;
if ((a == NULL) || ((*a) == NULL))
@@ -247,11 +248,12 @@ err:
* with its MSB set as negative (it doesn't add a padding zero).
*/
-ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, unsigned char **pp,
+ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
long length)
{
ASN1_INTEGER *ret=NULL;
- unsigned char *p,*to,*s;
+ const unsigned char *p;
+ unsigned char *to,*s;
long len;
int inf,tag,xclass;
int i;
diff --git a/crypto/asn1/a_object.c b/crypto/asn1/a_object.c
index 124451d7a6..715042e6eb 100644
--- a/crypto/asn1/a_object.c
+++ b/crypto/asn1/a_object.c
@@ -189,10 +189,10 @@ int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a)
return(i);
}
-ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, unsigned char **pp,
+ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
long length)
{
- unsigned char *p;
+ const unsigned char *p;
long len;
int tag,xclass;
int inf,i;
@@ -219,11 +219,11 @@ err:
ASN1_OBJECT_free(ret);
return(NULL);
}
-ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, unsigned char **pp,
+ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
long len)
{
ASN1_OBJECT *ret=NULL;
- unsigned char *p;
+ const unsigned char *p;
int i;
/* only the ASN1_OBJECTs from the 'table' will have values
diff --git a/crypto/asn1/a_octet.c b/crypto/asn1/a_octet.c
index 9690bae0f1..24fd0f8e5a 100644
--- a/crypto/asn1/a_octet.c
+++ b/crypto/asn1/a_octet.c
@@ -66,6 +66,6 @@ ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *x)
int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b)
{ return M_ASN1_OCTET_STRING_cmp(a, b); }
-int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, unsigned char *d, int len)
+int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d, int len)
{ return M_ASN1_OCTET_STRING_set(x, d, len); }
diff --git a/crypto/asn1/a_set.c b/crypto/asn1/a_set.c
index 0f839822ff..f37408a311 100644
--- a/crypto/asn1/a_set.c
+++ b/crypto/asn1/a_set.c
@@ -153,10 +153,10 @@ SetBlob
return(r);
}
-STACK *d2i_ASN1_SET(STACK **a, unsigned char **pp, long length,
+STACK *d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length,
char *(*func)(), void (*free_func)(void *), int ex_tag, int ex_class)
{
- ASN1_CTX c;
+ ASN1_const_CTX c;
STACK *ret=NULL;
if ((a == NULL) || ((*a) == NULL))
diff --git a/crypto/asn1/a_utctm.c b/crypto/asn1/a_utctm.c
index 999852dae5..fea6590322 100644
--- a/crypto/asn1/a_utctm.c
+++ b/crypto/asn1/a_utctm.c
@@ -162,7 +162,7 @@ err:
return(0);
}
-int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, char *str)
+int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str)
{
ASN1_UTCTIME t;
diff --git a/crypto/asn1/asn1.h b/crypto/asn1/asn1.h
index a9ba2d6e9b..dbf0f636e2 100644
--- a/crypto/asn1/asn1.h
+++ b/crypto/asn1/asn1.h
@@ -160,6 +160,10 @@ struct X509_algor_st;
#define DECLARE_ASN1_SET_OF(type) /* filled in by mkstack.pl */
#define IMPLEMENT_ASN1_SET_OF(type) /* nothing, no longer needed */
+/* We MUST make sure that, except for constness, asn1_ctx_st and
+ asn1_const_ctx are exactly the same. Fortunately, as soon as
+ the old ASN1 parsing macros are gone, we can throw this away
+ as well... */
typedef struct asn1_ctx_st
{
unsigned char *p;/* work char pointer */
@@ -175,6 +179,21 @@ typedef struct asn1_ctx_st
int line; /* used in error processing */
} ASN1_CTX;
+typedef struct asn1_const_ctx_st
+ {
+ const unsigned char *p;/* work char pointer */
+ int eos; /* end of sequence read for indefinite encoding */
+ int error; /* error code to use when returning an error */
+ int inf; /* constructed if 0x20, indefinite is 0x21 */
+ int tag; /* tag from last 'get object' */
+ int xclass; /* class from last 'get object' */
+ long slen; /* length of last 'get object' */
+ const unsigned char *max; /* largest value of p allowed */
+ const unsigned char *q;/* temporary variable */
+ const unsigned char **pp;/* variable */
+ int line; /* used in error processing */
+ } ASN1_const_CTX;
+
/* These are used internally in the ASN1_OBJECT to keep track of
* whether the names and data need to be free()ed */
#define ASN1_OBJECT_FLAG_DYNAMIC 0x01 /* internal use */
@@ -276,7 +295,7 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name)
#define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \
- type *d2i_##name(type **a, unsigned char **in, long len); \
+ type *d2i_##name(type **a, const unsigned char **in, long len); \
int i2d_##name(type *a, unsigned char **out); \
DECLARE_ASN1_ITEM(itname)
@@ -712,9 +731,9 @@ void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
ASN1_OBJECT * ASN1_OBJECT_new(void );
void ASN1_OBJECT_free(ASN1_OBJECT *a);
int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp);
-ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp,
+ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
long length);
-ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp,
+ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
long length);
DECLARE_ASN1_ITEM(ASN1_OBJECT)
@@ -737,7 +756,7 @@ unsigned char * ASN1_STRING_data(ASN1_STRING *x);
DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING)
int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp);
-ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,unsigned char **pp,
+ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **pp,
long length);
int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
int length );
@@ -753,13 +772,13 @@ int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
BIT_STRING_BITNAME *tbl);
int i2d_ASN1_BOOLEAN(int a,unsigned char **pp);
-int d2i_ASN1_BOOLEAN(int *a,unsigned char **pp,long length);
+int d2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length);
DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)
int i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp);
-ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp,
+ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp,
long length);
-ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,unsigned char **pp,
+ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp,
long length);
ASN1_INTEGER * ASN1_INTEGER_dup(ASN1_INTEGER *x);
int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y);
@@ -768,7 +787,7 @@ DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)
int ASN1_UTCTIME_check(ASN1_UTCTIME *a);
ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t);
-int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, char *str);
+int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
#if 0
time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s);
@@ -776,12 +795,12 @@ time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s);
int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a);
ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t);
-int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str);
+int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);
DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a);
int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b);
-int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, unsigned char *data, int len);
+int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len);
DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING)
@@ -812,7 +831,7 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZE
int i2d_ASN1_SET(STACK *a, unsigned char **pp,
int (*func)(), int ex_tag, int ex_class, int is_set);
-STACK * d2i_ASN1_SET(STACK **a, unsigned char **pp, long length,
+STACK * d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length,
char *(*func)(), void (*free_func)(void *),
int ex_tag, int ex_class);
@@ -846,20 +865,22 @@ BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn);
int ASN1_PRINTABLE_type(unsigned char *s, int max);
int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass);
-ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp,
+ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,
long length, int Ptag, int Pcla