aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/asn1
diff options
context:
space:
mode:
authorBen Laurie <ben@openssl.org>1999-04-17 21:25:43 +0000
committerBen Laurie <ben@openssl.org>1999-04-17 21:25:43 +0000
commite778802f53c8d47e96a6e4cbc776eb6e1d4c461a (patch)
tree719d4dd0fc69b355c6d8329af1f90b2c4f603548 /crypto/asn1
parentd77b3054cd87c2b13fa0169931f74b8e0dac5252 (diff)
downloadopenssl-e778802f53c8d47e96a6e4cbc776eb6e1d4c461a.tar.gz
Massive constification.
Diffstat (limited to 'crypto/asn1')
-rw-r--r--crypto/asn1/a_object.c19
-rw-r--r--crypto/asn1/a_set.c4
-rw-r--r--crypto/asn1/a_sign.c2
-rw-r--r--crypto/asn1/a_verify.c4
-rw-r--r--crypto/asn1/asn1.h4
-rw-r--r--crypto/asn1/asn1_lib.c2
-rw-r--r--crypto/asn1/asn1_par.c7
-rw-r--r--crypto/asn1/f_enum.c2
-rw-r--r--crypto/asn1/f_int.c2
-rw-r--r--crypto/asn1/f_string.c2
-rw-r--r--crypto/asn1/n_pkey.c4
-rw-r--r--crypto/asn1/t_pkey.c10
-rw-r--r--crypto/asn1/t_req.c3
-rw-r--r--crypto/asn1/t_x509.c13
-rw-r--r--crypto/asn1/x_x509.c4
15 files changed, 45 insertions, 37 deletions
diff --git a/crypto/asn1/a_object.c b/crypto/asn1/a_object.c
index a476960d9a..9eff09509c 100644
--- a/crypto/asn1/a_object.c
+++ b/crypto/asn1/a_object.c
@@ -90,11 +90,12 @@ unsigned char **pp;
int a2d_ASN1_OBJECT(out,olen,buf,num)
unsigned char *out;
int olen;
-char *buf;
+const char *buf;
int num;
{
int i,first,len=0,c;
- char tmp[24],*p;
+ char tmp[24];
+ const char *p;
unsigned long l;
if (num == 0)
@@ -188,7 +189,7 @@ ASN1_OBJECT *a;
int i,idx=0,n=0,len,nid;
unsigned long l;
unsigned char *p;
- char *s;
+ const char *s;
char tbuf[32];
if (buf_len <= 0) return(0);
@@ -246,9 +247,9 @@ ASN1_OBJECT *a;
}
else
{
- s=(char *)OBJ_nid2ln(nid);
+ s=OBJ_nid2ln(nid);
if (s == NULL)
- s=(char *)OBJ_nid2sn(nid);
+ s=OBJ_nid2sn(nid);
strncpy(buf,s,buf_len);
n=strlen(s);
}
@@ -355,8 +356,10 @@ ASN1_OBJECT *a;
if (a == NULL) return;
if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS)
{
- if (a->sn != NULL) Free(a->sn);
- if (a->ln != NULL) Free(a->ln);
+#ifndef CONST_STRICT /* disable purely for compile-time strict const checking. Doing this on a "real" compile will cause mempory leaks */
+ if (a->sn != NULL) Free((void *)a->sn);
+ if (a->ln != NULL) Free((void *)a->ln);
+#endif
a->sn=a->ln=NULL;
}
if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA)
@@ -366,7 +369,7 @@ ASN1_OBJECT *a;
a->length=0;
}
if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC)
- Free((char *)a);
+ Free(a);
}
ASN1_OBJECT *ASN1_OBJECT_create(nid,data,len,sn,ln)
diff --git a/crypto/asn1/a_set.c b/crypto/asn1/a_set.c
index a140cc14ad..34000ecf7d 100644
--- a/crypto/asn1/a_set.c
+++ b/crypto/asn1/a_set.c
@@ -73,8 +73,8 @@ typedef struct
*/
static int SetBlobCmp(const void *elem1, const void *elem2 )
{
- MYBLOB *b1 = (MYBLOB *)elem1;
- MYBLOB *b2 = (MYBLOB *)elem2;
+ const MYBLOB *b1 = (const MYBLOB *)elem1;
+ const MYBLOB *b2 = (const MYBLOB *)elem2;
int r;
r = memcmp(b1->pbData, b2->pbData,
diff --git a/crypto/asn1/a_sign.c b/crypto/asn1/a_sign.c
index 9ae9370c04..d3ae78b7b4 100644
--- a/crypto/asn1/a_sign.c
+++ b/crypto/asn1/a_sign.c
@@ -75,7 +75,7 @@ X509_ALGOR *algor2;
ASN1_BIT_STRING *signature;
char *data;
EVP_PKEY *pkey;
-EVP_MD *type;
+const EVP_MD *type;
{
EVP_MD_CTX ctx;
unsigned char *p,*buf_in=NULL,*buf_out=NULL;
diff --git a/crypto/asn1/a_verify.c b/crypto/asn1/a_verify.c
index 09e7fc05bb..dc5db9288b 100644
--- a/crypto/asn1/a_verify.c
+++ b/crypto/asn1/a_verify.c
@@ -76,7 +76,7 @@ char *data;
EVP_PKEY *pkey;
{
EVP_MD_CTX ctx;
- EVP_MD *type;
+ const EVP_MD *type;
unsigned char *p,*buf_in=NULL;
int ret= -1,i,inl;
@@ -89,7 +89,7 @@ EVP_PKEY *pkey;
}
inl=i2d(data,NULL);
- buf_in=(unsigned char *)Malloc((unsigned int)inl);
+ buf_in=Malloc((unsigned int)inl);
if (buf_in == NULL)
{
ASN1err(ASN1_F_ASN1_VERIFY,ERR_R_MALLOC_FAILURE);
diff --git a/crypto/asn1/asn1.h b/crypto/asn1/asn1.h
index 2ea7bc4bcf..5a2cee1b9a 100644
--- a/crypto/asn1/asn1.h
+++ b/crypto/asn1/asn1.h
@@ -150,7 +150,7 @@ typedef struct asn1_ctx_st
#define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08 /* internal use */
typedef struct asn1_object_st
{
- char *sn,*ln;
+ const char *sn,*ln;
int nid;
int length;
unsigned char *data;
@@ -561,7 +561,7 @@ int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type);
#endif
int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a);
-int a2d_ASN1_OBJECT(unsigned char *out,int olen, char *buf, int num);
+int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num);
ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len,
char *sn, char *ln);
diff --git a/crypto/asn1/asn1_lib.c b/crypto/asn1/asn1_lib.c
index 5c6fdb78ff..a18c7e7075 100644
--- a/crypto/asn1/asn1_lib.c
+++ b/crypto/asn1/asn1_lib.c
@@ -69,7 +69,7 @@ static int asn1_get_length();
static void asn1_put_length();
#endif
-char *ASN1_version="ASN.1" OPENSSL_VERSION_PTEXT;
+const char *ASN1_version="ASN.1" OPENSSL_VERSION_PTEXT;
int ASN1_check_infinite_end(p,len)
unsigned char **p;
diff --git a/crypto/asn1/asn1_par.c b/crypto/asn1/asn1_par.c
index bde3a3b2c3..9cddfb497b 100644
--- a/crypto/asn1/asn1_par.c
+++ b/crypto/asn1/asn1_par.c
@@ -79,9 +79,10 @@ int xclass;
int constructed;
int indent;
{
- static char *fmt="%-18s";
- static char *fmt2="%2d %-15s";
- char *p,str[128],*p2=NULL;
+ static const char fmt[]="%-18s";
+ static const char fmt2[]="%2d %-15s";
+ char str[128];
+ const char *p,*p2=NULL;
if (constructed & V_ASN1_CONSTRUCTED)
p="cons: ";
diff --git a/crypto/asn1/f_enum.c b/crypto/asn1/f_enum.c
index 13b06f5037..515f1dc42d 100644
--- a/crypto/asn1/f_enum.c
+++ b/crypto/asn1/f_enum.c
@@ -68,7 +68,7 @@ BIO *bp;
ASN1_ENUMERATED *a;
{
int i,n=0;
- static char *h="0123456789ABCDEF";
+ static const char *h="0123456789ABCDEF";
char buf[2];
if (a == NULL) return(0);
diff --git a/crypto/asn1/f_int.c b/crypto/asn1/f_int.c
index 4817c45cb7..a877e0cd52 100644
--- a/crypto/asn1/f_int.c
+++ b/crypto/asn1/f_int.c
@@ -66,7 +66,7 @@ BIO *bp;
ASN1_INTEGER *a;
{
int i,n=0;
- static char *h="0123456789ABCDEF";
+ static const char *h="0123456789ABCDEF";
char buf[2];
if (a == NULL) return(0);
diff --git a/crypto/asn1/f_string.c b/crypto/asn1/f_string.c
index ab2837824e..e7ca97f9eb 100644
--- a/crypto/asn1/f_string.c
+++ b/crypto/asn1/f_string.c
@@ -67,7 +67,7 @@ ASN1_STRING *a;
int type;
{
int i,n=0;
- static char *h="0123456789ABCDEF";
+ static const char *h="0123456789ABCDEF";
char buf[2];
if (a == NULL) return(0);
diff --git a/crypto/asn1/n_pkey.c b/crypto/asn1/n_pkey.c
index 9649847866..d9bf417738 100644
--- a/crypto/asn1/n_pkey.c
+++ b/crypto/asn1/n_pkey.c
@@ -138,7 +138,9 @@ int (*cb)();
l[2]=i2d_X509_ALGOR(alg,NULL);
l[3]=ASN1_object_size(1,l[2]+l[1],V_ASN1_SEQUENCE);
+#ifndef CONST_STRICT
os.data=(unsigned char *)"private-key";
+#endif
os.length=11;
l[4]=i2d_ASN1_OCTET_STRING(&os,NULL);
@@ -195,7 +197,7 @@ int (*cb)();
i2d_ASN1_OCTET_STRING(&os2,&p);
ret=l[5];
err:
- if (os2.data != NULL) Free((char *)os2.data);
+ if (os2.data != NULL) Free(os2.data);
if (alg != NULL) X509_ALGOR_free(alg);
if (pkey != NULL) NETSCAPE_PKEY_free(pkey);
r=r;
diff --git a/crypto/asn1/t_pkey.c b/crypto/asn1/t_pkey.c
index bc518d59a2..8a960f9cb2 100644
--- a/crypto/asn1/t_pkey.c
+++ b/crypto/asn1/t_pkey.c
@@ -75,7 +75,7 @@
*/
#ifndef NOPROTO
-static int print(BIO *fp,char *str,BIGNUM *num,
+static int print(BIO *fp,const char *str,BIGNUM *num,
unsigned char *buf,int off);
#else
static int print();
@@ -108,7 +108,8 @@ BIO *bp;
RSA *x;
int off;
{
- char str[128],*s;
+ char str[128];
+ const char *s;
unsigned char *m=NULL;
int i,ret=0;
@@ -231,13 +232,14 @@ err:
static int print(bp,number,num,buf,off)
BIO *bp;
-char *number;
+const char *number;
BIGNUM *num;
unsigned char *buf;
int off;
{
int n,i;
- char str[128],*neg;
+ char str[128];
+ const char *neg;
if (num == NULL) return(1);
neg=(num->neg)?"-":"";
diff --git a/crypto/asn1/t_req.c b/crypto/asn1/t_req.c
index a44b8266d3..bc05ff6c0e 100644
--- a/crypto/asn1/t_req.c
+++ b/crypto/asn1/t_req.c
@@ -89,7 +89,8 @@ X509_REQ *x;
{
unsigned long l;
int i,n;
- char *s,*neg;
+ char *s;
+ const char *neg;
X509_REQ_INFO *ri;
EVP_PKEY *pkey;
STACK *sk;
diff --git a/crypto/asn1/t_x509.c b/crypto/asn1/t_x509.c
index 12e170488f..1ab2caef19 100644
--- a/crypto/asn1/t_x509.c
+++ b/crypto/asn1/t_x509.c
@@ -100,7 +100,7 @@ X509 *x;
X509_CINF *ci;
ASN1_INTEGER *bs;
EVP_PKEY *pkey=NULL;
- char *neg;
+ const char *neg;
X509_EXTENSION *ex;
ASN1_STRING *str=NULL;
@@ -275,6 +275,11 @@ ASN1_TIME *tm;
return(0);
}
+static const char *mon[12]=
+ {
+ "Jan","Feb","Mar","Apr","May","Jun",
+ "Jul","Aug","Sep","Oct","Nov","Dec"
+ };
int ASN1_GENERALIZEDTIME_print(bp,tm)
BIO *bp;
@@ -282,9 +287,6 @@ ASN1_GENERALIZEDTIME *tm;
{
char *v;
int gmt=0;
- static char *mon[12]={
- "Jan","Feb","Mar","Apr","May","Jun",
- "Jul","Aug","Sep","Oct","Nov","Dec"};
int i;
int y=0,M=0,d=0,h=0,m=0,s=0;
@@ -321,9 +323,6 @@ ASN1_UTCTIME *tm;
{
char *v;
int gmt=0;
- static char *mon[12]={
- "Jan","Feb","Mar","Apr","May","Jun",
- "Jul","Aug","Sep","Oct","Nov","Dec"};
int i;
int y=0,M=0,d=0,h=0,m=0,s=0;
diff --git a/crypto/asn1/x_x509.c b/crypto/asn1/x_x509.c
index e235abb231..8e7d214d21 100644
--- a/crypto/asn1/x_x509.c
+++ b/crypto/asn1/x_x509.c
@@ -108,8 +108,8 @@ long length;
M_ASN1_D2I_get(ret->cert_info,d2i_X509_CINF);
M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR);
M_ASN1_D2I_get(ret->signature,d2i_ASN1_BIT_STRING);
-if (ret->name != NULL) Free(ret->name);
-ret->name=X509_NAME_oneline(ret->cert_info->subject,NULL,0);
+ if (ret->name != NULL) Free(ret->name);
+ ret->name=X509_NAME_oneline(ret->cert_info->subject,NULL,0);
M_ASN1_D2I_Finish(a,X509_free,ASN1_F_D2I_X509);
}