提交 7d727231 编写于 作者: N Nils Larsch

some const fixes

上级 69740c2b
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
#undef NON_MAIN #undef NON_MAIN
typedef struct { typedef struct {
char *name; const char *name;
unsigned long flag; unsigned long flag;
unsigned long mask; unsigned long mask;
} NAME_EX_TBL; } NAME_EX_TBL;
...@@ -1269,7 +1269,7 @@ static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_T ...@@ -1269,7 +1269,7 @@ static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_T
return 0; return 0;
} }
void print_name(BIO *out, char *title, X509_NAME *nm, unsigned long lflags) void print_name(BIO *out, const char *title, X509_NAME *nm, unsigned long lflags)
{ {
char *buf; char *buf;
char mline = 0; char mline = 0;
...@@ -1774,7 +1774,7 @@ int index_index(CA_DB *db) ...@@ -1774,7 +1774,7 @@ int index_index(CA_DB *db)
return 1; return 1;
} }
int save_index(char *dbfile, char *suffix, CA_DB *db) int save_index(const char *dbfile, const char *suffix, CA_DB *db)
{ {
char buf[3][BSIZE]; char buf[3][BSIZE];
BIO *out = BIO_new(BIO_s_file()); BIO *out = BIO_new(BIO_s_file());
...@@ -1841,7 +1841,7 @@ int save_index(char *dbfile, char *suffix, CA_DB *db) ...@@ -1841,7 +1841,7 @@ int save_index(char *dbfile, char *suffix, CA_DB *db)
return 0; return 0;
} }
int rotate_index(char *dbfile, char *new_suffix, char *old_suffix) int rotate_index(const char *dbfile, const char *new_suffix, const char *old_suffix)
{ {
char buf[5][BSIZE]; char buf[5][BSIZE];
int i,j; int i,j;
...@@ -2281,7 +2281,8 @@ int args_verify(char ***pargs, int *pargc, ...@@ -2281,7 +2281,8 @@ int args_verify(char ***pargs, int *pargc,
} }
static void nodes_print(BIO *out, char *name, STACK_OF(X509_POLICY_NODE) *nodes) static void nodes_print(BIO *out, const char *name,
STACK_OF(X509_POLICY_NODE) *nodes)
{ {
X509_POLICY_NODE *node; X509_POLICY_NODE *node;
int i; int i;
......
...@@ -254,7 +254,7 @@ void program_name(char *in,char *out,int size); ...@@ -254,7 +254,7 @@ void program_name(char *in,char *out,int size);
int chopup_args(ARGS *arg,char *buf, int *argc, char **argv[]); int chopup_args(ARGS *arg,char *buf, int *argc, char **argv[]);
#ifdef HEADER_X509_H #ifdef HEADER_X509_H
int dump_cert_text(BIO *out, X509 *x); int dump_cert_text(BIO *out, X509 *x);
void print_name(BIO *out, char *title, X509_NAME *nm, unsigned long lflags); void print_name(BIO *out, const char *title, X509_NAME *nm, unsigned long lflags);
#endif #endif
int set_cert_ex(unsigned long *flags, const char *arg); int set_cert_ex(unsigned long *flags, const char *arg);
int set_name_ex(unsigned long *flags, const char *arg); int set_name_ex(unsigned long *flags, const char *arg);
...@@ -280,7 +280,7 @@ char *make_config_name(void); ...@@ -280,7 +280,7 @@ char *make_config_name(void);
/* Functions defined in ca.c and also used in ocsp.c */ /* Functions defined in ca.c and also used in ocsp.c */
int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
ASN1_GENERALIZEDTIME **pinvtm, char *str); ASN1_GENERALIZEDTIME **pinvtm, const char *str);
#define DB_type 0 #define DB_type 0
#define DB_exp_date 1 #define DB_exp_date 1
...@@ -310,8 +310,8 @@ int rotate_serial(char *serialfile, char *new_suffix, char *old_suffix); ...@@ -310,8 +310,8 @@ int rotate_serial(char *serialfile, char *new_suffix, char *old_suffix);
int rand_serial(BIGNUM *b, ASN1_INTEGER *ai); int rand_serial(BIGNUM *b, ASN1_INTEGER *ai);
CA_DB *load_index(char *dbfile, DB_ATTR *dbattr); CA_DB *load_index(char *dbfile, DB_ATTR *dbattr);
int index_index(CA_DB *db); int index_index(CA_DB *db);
int save_index(char *dbfile, char *suffix, CA_DB *db); int save_index(const char *dbfile, const char *suffix, CA_DB *db);
int rotate_index(char *dbfile, char *new_suffix, char *old_suffix); int rotate_index(const char *dbfile, const char *new_suffix, const char *old_suffix);
void free_index(CA_DB *db); void free_index(CA_DB *db);
int index_name_cmp(const char **a, const char **b); int index_name_cmp(const char **a, const char **b);
int parse_yesno(char *str, int def); int parse_yesno(char *str, int def);
......
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
#define REV_KEY_COMPROMISE 3 /* Value is cert key compromise time */ #define REV_KEY_COMPROMISE 3 /* Value is cert key compromise time */
#define REV_CA_COMPROMISE 4 /* Value is CA key compromise time */ #define REV_CA_COMPROMISE 4 /* Value is CA key compromise time */
static char *ca_usage[]={ static const char *ca_usage[]={
"usage: ca args\n", "usage: ca args\n",
"\n", "\n",
" -verbose - Talk alot while doing things\n", " -verbose - Talk alot while doing things\n",
...@@ -192,7 +192,7 @@ extern int EF_PROTECT_BELOW; ...@@ -192,7 +192,7 @@ extern int EF_PROTECT_BELOW;
extern int EF_ALIGNMENT; extern int EF_ALIGNMENT;
#endif #endif
static void lookup_fail(char *name,char *tag); static void lookup_fail(const char *name, const char *tag);
static int certify(X509 **xret, char *infile,EVP_PKEY *pkey,X509 *x509, static int certify(X509 **xret, char *infile,EVP_PKEY *pkey,X509 *x509,
const EVP_MD *dgst,STACK_OF(CONF_VALUE) *policy,CA_DB *db, const EVP_MD *dgst,STACK_OF(CONF_VALUE) *policy,CA_DB *db,
BIGNUM *serial, char *subj, int multirdn, int email_dn, char *startdate, BIGNUM *serial, char *subj, int multirdn, int email_dn, char *startdate,
...@@ -225,7 +225,7 @@ static int get_certificate_status(const char *ser_status, CA_DB *db); ...@@ -225,7 +225,7 @@ static int get_certificate_status(const char *ser_status, CA_DB *db);
static int do_updatedb(CA_DB *db); static int do_updatedb(CA_DB *db);
static int check_time_format(char *str); static int check_time_format(char *str);
char *make_revocation_str(int rev_type, char *rev_arg); char *make_revocation_str(int rev_type, char *rev_arg);
int make_revoked(X509_REVOKED *rev, char *str); int make_revoked(X509_REVOKED *rev, const char *str);
int old_entry_print(BIO *bp, ASN1_OBJECT *obj, ASN1_STRING *str); int old_entry_print(BIO *bp, ASN1_OBJECT *obj, ASN1_STRING *str);
static CONF *conf=NULL; static CONF *conf=NULL;
static CONF *extconf=NULL; static CONF *extconf=NULL;
...@@ -300,7 +300,8 @@ int MAIN(int argc, char **argv) ...@@ -300,7 +300,8 @@ int MAIN(int argc, char **argv)
X509_REVOKED *r=NULL; X509_REVOKED *r=NULL;
ASN1_TIME *tmptm; ASN1_TIME *tmptm;
ASN1_INTEGER *tmpser; ASN1_INTEGER *tmpser;
char **pp,*p,*f; char *p,*f;
const char **pp;
int i,j; int i,j;
const EVP_MD *dgst=NULL; const EVP_MD *dgst=NULL;
STACK_OF(CONF_VALUE) *attribs=NULL; STACK_OF(CONF_VALUE) *attribs=NULL;
...@@ -857,7 +858,7 @@ bad: ...@@ -857,7 +858,7 @@ bad:
/* Lets check some fields */ /* Lets check some fields */
for (i=0; i<sk_num(db->db->data); i++) for (i=0; i<sk_num(db->db->data); i++)
{ {
pp=(char **)sk_value(db->db->data,i); pp=(const char **)sk_value(db->db->data,i);
if ((pp[DB_type][0] != DB_TYPE_REV) && if ((pp[DB_type][0] != DB_TYPE_REV) &&
(pp[DB_rev_date][0] != '\0')) (pp[DB_rev_date][0] != '\0'))
{ {
...@@ -1501,7 +1502,7 @@ err: ...@@ -1501,7 +1502,7 @@ err:
OPENSSL_EXIT(ret); OPENSSL_EXIT(ret);
} }
static void lookup_fail(char *name, char *tag) static void lookup_fail(const char *name, const char *tag)
{ {
BIO_printf(bio_err,"variable lookup failed for %s::%s\n",name,tag); BIO_printf(bio_err,"variable lookup failed for %s::%s\n",name,tag);
} }
...@@ -1646,7 +1647,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst, ...@@ -1646,7 +1647,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
X509_NAME_ENTRY *tne,*push; X509_NAME_ENTRY *tne,*push;
EVP_PKEY *pktmp; EVP_PKEY *pktmp;
int ok= -1,i,j,last,nid; int ok= -1,i,j,last,nid;
char *p; const char *p;
CONF_VALUE *cv; CONF_VALUE *cv;
char *row[DB_NUMBER],**rrow=NULL,**irow=NULL; char *row[DB_NUMBER],**rrow=NULL,**irow=NULL;
char buf[25]; char buf[25];
...@@ -2654,7 +2655,7 @@ err: ...@@ -2654,7 +2655,7 @@ err:
return (cnt); return (cnt);
} }
static char *crl_reasons[] = { static const char *crl_reasons[] = {
/* CRL reason strings */ /* CRL reason strings */
"unspecified", "unspecified",
"keyCompromise", "keyCompromise",
...@@ -2682,7 +2683,8 @@ static char *crl_reasons[] = { ...@@ -2682,7 +2683,8 @@ static char *crl_reasons[] = {
char *make_revocation_str(int rev_type, char *rev_arg) char *make_revocation_str(int rev_type, char *rev_arg)
{ {
char *reason = NULL, *other = NULL, *str; char *other = NULL, *str;
const char *reason = NULL;
ASN1_OBJECT *otmp; ASN1_OBJECT *otmp;
ASN1_UTCTIME *revtm = NULL; ASN1_UTCTIME *revtm = NULL;
int i; int i;
...@@ -2776,7 +2778,7 @@ char *make_revocation_str(int rev_type, char *rev_arg) ...@@ -2776,7 +2778,7 @@ char *make_revocation_str(int rev_type, char *rev_arg)
*/ */
int make_revoked(X509_REVOKED *rev, char *str) int make_revoked(X509_REVOKED *rev, const char *str)
{ {
char *tmp = NULL; char *tmp = NULL;
int reason_code = -1; int reason_code = -1;
...@@ -2869,7 +2871,7 @@ int old_entry_print(BIO *bp, ASN1_OBJECT *obj, ASN1_STRING *str) ...@@ -2869,7 +2871,7 @@ int old_entry_print(BIO *bp, ASN1_OBJECT *obj, ASN1_STRING *str)
return 1; return 1;
} }
int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, ASN1_GENERALIZEDTIME **pinvtm, char *str) int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, ASN1_GENERALIZEDTIME **pinvtm, const char *str)
{ {
char *tmp = NULL; char *tmp = NULL;
char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p; char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p;
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
#undef PROG #undef PROG
#define PROG ciphers_main #define PROG ciphers_main
static char *ciphers_usage[]={ static const char *ciphers_usage[]={
"usage: ciphers args\n", "usage: ciphers args\n",
" -v - verbose mode, a textual listing of the ciphers in SSLeay\n", " -v - verbose mode, a textual listing of the ciphers in SSLeay\n",
" -ssl2 - SSL2 mode\n", " -ssl2 - SSL2 mode\n",
...@@ -84,7 +84,7 @@ int MAIN(int argc, char **argv) ...@@ -84,7 +84,7 @@ int MAIN(int argc, char **argv)
{ {
int ret=1,i; int ret=1,i;
int verbose=0; int verbose=0;
char **pp; const char **pp;
const char *p; const char *p;
int badops=0; int badops=0;
SSL_CTX *ctx=NULL; SSL_CTX *ctx=NULL;
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
#undef POSTFIX #undef POSTFIX
#define POSTFIX ".rvk" #define POSTFIX ".rvk"
static char *crl_usage[]={ static const char *crl_usage[]={
"usage: crl args\n", "usage: crl args\n",
"\n", "\n",
" -inform arg - input format - default PEM (DER or PEM)\n", " -inform arg - input format - default PEM (DER or PEM)\n",
...@@ -108,7 +108,7 @@ int MAIN(int argc, char **argv) ...@@ -108,7 +108,7 @@ int MAIN(int argc, char **argv)
char *infile=NULL,*outfile=NULL; char *infile=NULL,*outfile=NULL;
int hash=0,issuer=0,lastupdate=0,nextupdate=0,noout=0,text=0; int hash=0,issuer=0,lastupdate=0,nextupdate=0,noout=0,text=0;
int fingerprint = 0; int fingerprint = 0;
char **pp; const char **pp;
X509_STORE *store = NULL; X509_STORE *store = NULL;
X509_STORE_CTX ctx; X509_STORE_CTX ctx;
X509_LOOKUP *lookup = NULL; X509_LOOKUP *lookup = NULL;
......
...@@ -349,7 +349,7 @@ bad: ...@@ -349,7 +349,7 @@ bad:
crv_len = EC_get_builtin_curves(NULL, 0); crv_len = EC_get_builtin_curves(NULL, 0);
curves = OPENSSL_malloc(sizeof(EC_builtin_curve) * crv_len); curves = OPENSSL_malloc((int)(sizeof(EC_builtin_curve) * crv_len));
if (curves == NULL) if (curves == NULL)
goto end; goto end;
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
#undef PROG #undef PROG
#define PROG engine_main #define PROG engine_main
static char *engine_usage[]={ static const char *engine_usage[]={
"usage: engine opts [engine ...]\n", "usage: engine opts [engine ...]\n",
" -v[v[v[v]]] - verbose mode, for each engine, list its 'control commands'\n", " -v[v[v[v]]] - verbose mode, for each engine, list its 'control commands'\n",
" -vv will additionally display each command's description\n", " -vv will additionally display each command's description\n",
......
...@@ -220,7 +220,8 @@ int main(int Argc, char *Argv[]) ...@@ -220,7 +220,8 @@ int main(int Argc, char *Argv[])
#define PROG_NAME_SIZE 39 #define PROG_NAME_SIZE 39
char pname[PROG_NAME_SIZE+1]; char pname[PROG_NAME_SIZE+1];
FUNCTION f,*fp; FUNCTION f,*fp;
MS_STATIC char *prompt,buf[1024]; MS_STATIC const char *prompt;
MS_STATIC char buf[1024];
char *to_free=NULL; char *to_free=NULL;
int n,i,ret=0; int n,i,ret=0;
int argc; int argc;
...@@ -488,7 +489,7 @@ static LHASH *prog_init(void) ...@@ -488,7 +489,7 @@ static LHASH *prog_init(void)
{ {
LHASH *ret; LHASH *ret;
FUNCTION *f; FUNCTION *f;
int i; size_t i;
/* Purely so it looks nice when the user hits ? */ /* Purely so it looks nice when the user hits ? */
for(i=0,f=functions ; f->name != NULL ; ++f,++i) for(i=0,f=functions ; f->name != NULL ; ++f,++i)
...@@ -506,12 +507,12 @@ static LHASH *prog_init(void) ...@@ -506,12 +507,12 @@ static LHASH *prog_init(void)
/* static int MS_CALLBACK cmp(FUNCTION *a, FUNCTION *b) */ /* static int MS_CALLBACK cmp(FUNCTION *a, FUNCTION *b) */
static int MS_CALLBACK cmp(const void *a_void, const void *b_void) static int MS_CALLBACK cmp(const void *a_void, const void *b_void)
{ {
return(strncmp(((FUNCTION *)a_void)->name, return(strncmp(((const FUNCTION *)a_void)->name,
((FUNCTION *)b_void)->name,8)); ((const FUNCTION *)b_void)->name,8));
} }
/* static unsigned long MS_CALLBACK hash(FUNCTION *a) */ /* static unsigned long MS_CALLBACK hash(FUNCTION *a) */
static unsigned long MS_CALLBACK hash(const void *a_void) static unsigned long MS_CALLBACK hash(const void *a_void)
{ {
return(lh_strhash(((FUNCTION *)a_void)->name)); return(lh_strhash(((const FUNCTION *)a_void)->name));
} }
...@@ -359,13 +359,13 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt) ...@@ -359,13 +359,13 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt)
for (i = 0; i < 1000; i++) for (i = 0; i < 1000; i++)
{ {
EVP_DigestInit_ex(&md2,EVP_md5(), NULL); EVP_DigestInit_ex(&md2,EVP_md5(), NULL);
EVP_DigestUpdate(&md2, (i & 1) ? (unsigned char *) passwd : buf, EVP_DigestUpdate(&md2, (i & 1) ? (unsigned const char *) passwd : buf,
(i & 1) ? passwd_len : sizeof buf); (i & 1) ? passwd_len : sizeof buf);
if (i % 3) if (i % 3)
EVP_DigestUpdate(&md2, salt_out, salt_len); EVP_DigestUpdate(&md2, salt_out, salt_len);
if (i % 7) if (i % 7)
EVP_DigestUpdate(&md2, passwd, passwd_len); EVP_DigestUpdate(&md2, passwd, passwd_len);
EVP_DigestUpdate(&md2, (i & 1) ? buf : (unsigned char *) passwd, EVP_DigestUpdate(&md2, (i & 1) ? buf : (unsigned const char *) passwd,
(i & 1) ? sizeof buf : passwd_len); (i & 1) ? sizeof buf : passwd_len);
EVP_DigestFinal_ex(&md2, buf, NULL); EVP_DigestFinal_ex(&md2, buf, NULL);
} }
......
...@@ -83,7 +83,7 @@ int dump_certs_keys_p12(BIO *out, PKCS12 *p12, char *pass, int passlen, int opti ...@@ -83,7 +83,7 @@ int dump_certs_keys_p12(BIO *out, PKCS12 *p12, char *pass, int passlen, int opti
int dump_certs_pkeys_bags(BIO *out, STACK_OF(PKCS12_SAFEBAG) *bags, char *pass, int dump_certs_pkeys_bags(BIO *out, STACK_OF(PKCS12_SAFEBAG) *bags, char *pass,
int passlen, int options, char *pempass); int passlen, int options, char *pempass);
int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bags, char *pass, int passlen, int options, char *pempass); int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bags, char *pass, int passlen, int options, char *pempass);
int print_attribs(BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst, char *name); int print_attribs(BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst,const char *name);
void hex_prin(BIO *out, unsigned char *buf, int len); void hex_prin(BIO *out, unsigned char *buf, int len);
int alg_print(BIO *x, X509_ALGOR *alg); int alg_print(BIO *x, X509_ALGOR *alg);
int cert_load(BIO *in, STACK_OF(X509) *sk); int cert_load(BIO *in, STACK_OF(X509) *sk);
...@@ -857,7 +857,7 @@ int cert_load(BIO *in, STACK_OF(X509) *sk) ...@@ -857,7 +857,7 @@ int cert_load(BIO *in, STACK_OF(X509) *sk)
/* Generalised attribute print: handle PKCS#8 and bag attributes */ /* Generalised attribute print: handle PKCS#8 and bag attributes */
int print_attribs (BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst, char *name) int print_attribs (BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst,const char *name)
{ {
X509_ATTRIBUTE *attr; X509_ATTRIBUTE *attr;
ASN1_TYPE *av; ASN1_TYPE *av;
......
...@@ -130,16 +130,16 @@ static int prompt_info(X509_REQ *req, ...@@ -130,16 +130,16 @@ static int prompt_info(X509_REQ *req,
static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *sk, static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *sk,
STACK_OF(CONF_VALUE) *attr, int attribs, STACK_OF(CONF_VALUE) *attr, int attribs,
unsigned long chtype); unsigned long chtype);
static int add_attribute_object(X509_REQ *req, char *text, static int add_attribute_object(X509_REQ *req, char *text, const char *def,
char *def, char *value, int nid, int n_min, char *value, int nid, int n_min,
int n_max, unsigned long chtype); int n_max, unsigned long chtype);
static int add_DN_object(X509_NAME *n, char *text, char *def, char *value, static int add_DN_object(X509_NAME *n, char *text, const char *def, char *value,
int nid,int n_min,int n_max, unsigned long chtype, int mval); int nid,int n_min,int n_max, unsigned long chtype, int mval);
#ifndef OPENSSL_NO_RSA #ifndef OPENSSL_NO_RSA
static int MS_CALLBACK req_cb(int p, int n, BN_GENCB *cb); static int MS_CALLBACK req_cb(int p, int n, BN_GENCB *cb);
#endif #endif
static int req_check_len(int len,int n_min,int n_max); static int req_check_len(int len,int n_min,int n_max);
static int check_end(char *str, char *end); static int check_end(const char *str, const char *end);
#ifndef MONOLITH #ifndef MONOLITH
static char *default_config_file=NULL; static char *default_config_file=NULL;
#endif #endif
...@@ -1280,7 +1280,8 @@ static int prompt_info(X509_REQ *req, ...@@ -1280,7 +1280,8 @@ static int prompt_info(X509_REQ *req,
char buf[100]; char buf[100];
int nid, mval; int nid, mval;
long n_min,n_max; long n_min,n_max;
char *type,*def,*value; char *type, *value;
const char *def;
CONF_VALUE *v; CONF_VALUE *v;
X509_NAME *subj; X509_NAME *subj;
subj = X509_REQ_get_subject_name(req); subj = X509_REQ_get_subject_name(req);
...@@ -1506,7 +1507,7 @@ static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *dn_sk, ...@@ -1506,7 +1507,7 @@ static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *dn_sk,
} }
static int add_DN_object(X509_NAME *n, char *text, char *def, char *value, static int add_DN_object(X509_NAME *n, char *text, const char *def, char *value,
int nid, int n_min, int n_max, unsigned long chtype, int mval) int nid, int n_min, int n_max, unsigned long chtype, int mval)
{ {
int i,ret=0; int i,ret=0;
...@@ -1562,8 +1563,8 @@ err: ...@@ -1562,8 +1563,8 @@ err:
return(ret); return(ret);
} }
static int add_attribute_object(X509_REQ *req, char *text, static int add_attribute_object(X509_REQ *req, char *text, const char *def,
char *def, char *value, int nid, int n_min, char *value, int nid, int n_min,
int n_max, unsigned long chtype) int n_max, unsigned long chtype)
{ {
int i; int i;
...@@ -1660,10 +1661,10 @@ static int req_check_len(int len, int n_min, int n_max) ...@@ -1660,10 +1661,10 @@ static int req_check_len(int len, int n_min, int n_max)
} }
/* Check if the end of a string matches 'end' */ /* Check if the end of a string matches 'end' */
static int check_end(char *str, char *end) static int check_end(const char *str, const char *end)
{ {
int elen, slen; int elen, slen;
char *tmp; const char *tmp;
elen = strlen(end); elen = strlen(end);
slen = strlen(str); slen = strlen(str);
if(elen > slen) return 1; if(elen > slen) return 1;
......
...@@ -308,7 +308,7 @@ bad: ...@@ -308,7 +308,7 @@ bad:
BIO_printf(out,"RSA key ok\n"); BIO_printf(out,"RSA key ok\n");
else if (r == 0) else if (r == 0)
{ {
long err; unsigned long err;
while ((err = ERR_peek_error()) != 0 && while ((err = ERR_peek_error()) != 0 &&
ERR_GET_LIB(err) == ERR_LIB_RSA && ERR_GET_LIB(err) == ERR_LIB_RSA &&
......
...@@ -283,7 +283,7 @@ long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp, ...@@ -283,7 +283,7 @@ long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
void MS_CALLBACK apps_ssl_info_callback(const SSL *s, int where, int ret) void MS_CALLBACK apps_ssl_info_callback(const SSL *s, int where, int ret)
{ {
char *str; const char *str;
int w; int w;
w=where& ~SSL_ST_MASK; w=where& ~SSL_ST_MASK;
...@@ -346,14 +346,14 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void * ...@@ -346,14 +346,14 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *
if (len > 0) if (len > 0)
{ {
switch (((unsigned char*)buf)[0]) switch (((const unsigned char*)buf)[0])
{ {
case 0: case 0:
str_details1 = ", ERROR:"; str_details1 = ", ERROR:";
str_details2 = " ???"; str_details2 = " ???";
if (len >= 3) if (len >= 3)
{ {
unsigned err = (((unsigned char*)buf)[1]<<8) + ((unsigned char*)buf)[2]; unsigned err = (((const unsigned char*)buf)[1]<<8) + ((const unsigned char*)buf)[2];
switch (err) switch (err)
{ {
...@@ -422,7 +422,7 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void * ...@@ -422,7 +422,7 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *
if (len == 2) if (len == 2)
{ {
switch (((unsigned char*)buf)[0]) switch (((const unsigned char*)buf)[0])
{ {
case 1: case 1:
str_details1 = ", warning"; str_details1 = ", warning";
...@@ -433,7 +433,7 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void * ...@@ -433,7 +433,7 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *
} }
str_details2 = " ???"; str_details2 = " ???";
switch (((unsigned char*)buf)[1]) switch (((const unsigned char*)buf)[1])
{ {
case 0: case 0:
str_details2 = " close_notify"; str_details2 = " close_notify";
...@@ -514,7 +514,7 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void * ...@@ -514,7 +514,7 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *
if (len > 0) if (len > 0)
{ {
switch (((unsigned char*)buf)[0]) switch (((const unsigned char*)buf)[0])
{ {
case 0: case 0:
str_details1 = ", HelloRequest"; str_details1 = ", HelloRequest";
...@@ -567,7 +567,7 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void * ...@@ -567,7 +567,7 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *
{ {
if (i % 16 == 0 && i > 0) if (i % 16 == 0 && i > 0)
BIO_printf(bio, "\n "); BIO_printf(bio, "\n ");
BIO_printf(bio, " %02x", ((unsigned char*)buf)[i]); BIO_printf(bio, " %02x", ((const unsigned char*)buf)[i]);
} }
if (i < len) if (i < len)
BIO_printf(bio, " ..."); BIO_printf(bio, " ...");
......
...@@ -1020,7 +1020,7 @@ static void print_stuff(BIO *bio, SSL *s, int full) ...@@ -1020,7 +1020,7 @@ static void print_stuff(BIO *bio, SSL *s, int full)
{ {
X509 *peer=NULL; X509 *peer=NULL;
char *p; char *p;
static char *space=" "; static const char *space=" ";
char buf[BUFSIZ]; char buf[BUFSIZ];
STACK_OF(X509) *sk; STACK_OF(X509) *sk;
STACK_OF(X509_NAME) *sk2; STACK_OF(X509_NAME) *sk2;
......
...@@ -239,7 +239,7 @@ extern int verify_depth; ...@@ -239,7 +239,7 @@ extern int verify_depth;
static char *cipher=NULL; static char *cipher=NULL;
static int s_server_verify=SSL_VERIFY_NONE; static int s_server_verify=SSL_VERIFY_NONE;
static int s_server_session_id_context = 1; /* anything will do */ static int s_server_session_id_context = 1; /* anything will do */
static char *s_cert_file=TEST_CERT,*s_key_file=NULL; static const char *s_cert_file=TEST_CERT,*s_key_file=NULL;
static char *s_dcert_file=NULL,*s_dkey_file=NULL; static char *s_dcert_file=NULL,*s_dkey_file=NULL;
#ifdef FIONBIO #ifdef FIONBIO
static int s_nbio=0; static int s_nbio=0;
...@@ -1281,7 +1281,7 @@ static int sv_body(char *hostname, int s, unsigned char *context) ...@@ -1281,7 +1281,7 @@ static int sv_body(char *hostname, int s, unsigned char *context)
} }
if (buf[0] == 'P') if (buf[0] == 'P')
{ {
static char *str="Lets print some clear text\n"; static const char *str="Lets print some clear text\n";
BIO_write(SSL_get_wbio(con),str,strlen(str)); BIO_write(SSL_get_wbio(con),str,strlen(str));
} }
if (buf[0] == 'S') if (buf[0] == 'S')
...@@ -1633,7 +1633,7 @@ static int www_body(char *hostname, int s, unsigned char *context) ...@@ -1633,7 +1633,7 @@ static int www_body(char *hostname, int s, unsigned char *context)
char *p; char *p;
X509 *peer; X509 *peer;
STACK_OF(SSL_CIPHER) *sk; STACK_OF(SSL_CIPHER) *sk;
static char *space=" "; static const char *space=" ";
BIO_puts(io,"HTTP/1.0 200 ok\r\nContent-type: text/html\r\n\r\n"); BIO_puts(io,"HTTP/1.0 200 ok\r\nContent-type: text/html\r\n\r\n");
BIO_puts(io,"<HTML><BODY BGCOLOR=\"#ffffff\">\n"); BIO_puts(io,"<HTML><BODY BGCOLOR=\"#ffffff\">\n");
...@@ -1713,7 +1713,7 @@ static int www_body(char *hostname, int s, unsigned char *context) ...@@ -1713,7 +1713,7 @@ static int www_body(char *hostname, int s, unsigned char *context)
{ {
BIO *file; BIO *file;
char *p,*e; char *p,*e;
static char *text="HTTP/1.0 200 ok\r\nContent-type: text/plain\r\n\r\n"; static const char *text="HTTP/1.0 200 ok\r\nContent-type: text/plain\r\n\r\n";
/* skip the '/' */ /* skip the '/' */
p= &(buf[5]); p= &(buf[5]);
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
#undef PROG #undef PROG
#define PROG sess_id_main #define PROG sess_id_main
static char *sess_id_usage[]={ static const char *sess_id_usage[]={
"usage: sess_id args\n", "usage: sess_id args\n",
"\n", "\n",
" -inform arg - input format - default PEM (DER or PEM)\n", " -inform arg - input format - default PEM (DER or PEM)\n",
...@@ -95,7 +95,7 @@ int MAIN(int argc, char **argv) ...@@ -95,7 +95,7 @@ int MAIN(int argc, char **argv)
int informat,outformat; int informat,outformat;
char *infile=NULL,*outfile=NULL,*context=NULL; char *infile=NULL,*outfile=NULL,*context=NULL;
int cert=0,noout=0,text=0; int cert=0,noout=0,text=0;
char **pp; const char **pp;
apps_startup(); apps_startup();
......
...@@ -87,7 +87,7 @@ int MAIN(int argc, char **argv) ...@@ -87,7 +87,7 @@ int MAIN(int argc, char **argv)
int operation = 0; int operation = 0;
int ret = 0; int ret = 0;
char **args; char **args;
char *inmode = "r", *outmode = "w"; const char *inmode = "r", *outmode = "w";
char *infile = NULL, *outfile = NULL; char *infile = NULL, *outfile = NULL;
char *signerfile = NULL, *recipfile = NULL; char *signerfile = NULL, *recipfile = NULL;
char *certfile = NULL, *keyfile = NULL, *contfile=NULL; char *certfile = NULL, *keyfile = NULL, *contfile=NULL;
......
...@@ -87,7 +87,8 @@ int MAIN(int argc, char **argv) ...@@ -87,7 +87,8 @@ int MAIN(int argc, char **argv)
int verify=0,noout=0,pubkey=0; int verify=0,noout=0,pubkey=0;
char *infile = NULL,*outfile = NULL,*prog; char *infile = NULL,*outfile = NULL,*prog;
char *passargin = NULL, *passin = NULL; char *passargin = NULL, *passin = NULL;
char *spkac = "SPKAC", *spksect = "default", *spkstr = NULL; const char *spkac = "SPKAC", *spksect = "default";
char *spkstr = NULL;
char *challenge = NULL, *keyfile = NULL; char *challenge = NULL, *keyfile = NULL;
CONF *conf = NULL; CONF *conf = NULL;
NETSCAPE_SPKI *spki = NULL; NETSCAPE_SPKI *spki = NULL;
...@@ -200,7 +201,7 @@ bad: ...@@ -200,7 +201,7 @@ bad:
} }
spki = NETSCAPE_SPKI_new(); spki = NETSCAPE_SPKI_new();
if(challenge) ASN1_STRING_set(spki->spkac->challenge, if(challenge) ASN1_STRING_set(spki->spkac->challenge,
challenge, strlen(challenge)); challenge, (int)strlen(challenge));
NETSCAPE_SPKI_set_pubkey(spki, pkey); NETSCAPE_SPKI_set_pubkey(spki, pkey);
NETSCAPE_SPKI_sign(spki, pkey, EVP_md5()); NETSCAPE_SPKI_sign(spki, pkey, EVP_md5());
spkstr = NETSCAPE_SPKI_b64_encode(spki); spkstr = NETSCAPE_SPKI_b64_encode(spki);
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
#define POSTFIX ".srl" #define POSTFIX ".srl"
#define DEF_DAYS 30 #define DEF_DAYS 30
static char *x509_usage[]={ static const char *x509_usage[]={
"usage: x509 args\n", "usage: x509 args\n",
" -inform arg - input format - default PEM (one of DER, NET or PEM)\n", " -inform arg - input format - default PEM (one of DER, NET or PEM)\n",
" -outform arg - output format - default PEM (one of DER, NET or PEM)\n", " -outform arg - output format - default PEM (one of DER, NET or PEM)\n",
...@@ -179,7 +179,7 @@ int MAIN(int argc, char **argv) ...@@ -179,7 +179,7 @@ int MAIN(int argc, char **argv)
int C=0; int C=0;
int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0; int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0;
int pprint = 0; int pprint = 0;
char **pp; const char **pp;
X509_STORE *ctx=NULL; X509_STORE *ctx=NULL;
X509_REQ *rq=NULL; X509_REQ *rq=NULL;
int fingerprint=0; int fingerprint=0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册