summaryrefslogtreecommitdiffstats
path: root/crypto/conf
diff options
context:
space:
mode:
authorBen Laurie <ben@openssl.org>2002-01-18 16:51:05 +0000
committerBen Laurie <ben@openssl.org>2002-01-18 16:51:05 +0000
commit9dd5ae65533ec43e66efe66e1bbcddce4cb05509 (patch)
tree7150828e2bcb1ac5c92435ddc3dee259facd72e7 /crypto/conf
parente1e876072d813ac55a4a0b2c17ff55a0b27d1689 (diff)
Constification, add config to /dev/crypto.
Diffstat (limited to 'crypto/conf')
-rw-r--r--crypto/conf/conf.h41
-rw-r--r--crypto/conf/conf_api.c17
-rw-r--r--crypto/conf/conf_api.h12
-rw-r--r--crypto/conf/conf_def.c12
-rw-r--r--crypto/conf/conf_lib.c18
-rw-r--r--crypto/conf/conf_mod.c36
6 files changed, 76 insertions, 60 deletions
diff --git a/crypto/conf/conf.h b/crypto/conf/conf.h
index 41816d92f6..df84fa4de4 100644
--- a/crypto/conf/conf.h
+++ b/crypto/conf/conf.h
@@ -93,9 +93,9 @@ struct conf_method_st
int (*destroy)(CONF *conf);
int (*destroy_data)(CONF *conf);
int (*load_bio)(CONF *conf, BIO *bp, long *eline);
- int (*dump)(CONF *conf, BIO *bp);
- int (*is_number)(CONF *conf, char c);
- int (*to_int)(CONF *conf, char c);
+ int (*dump)(const CONF *conf, BIO *bp);
+ int (*is_number)(const CONF *conf, char c);
+ int (*to_int)(const CONF *conf, char c);
int (*load)(CONF *conf, const char *name, long *eline);
};
@@ -105,7 +105,7 @@ typedef struct conf_imodule_st CONF_IMODULE;
typedef struct conf_module_st CONF_MODULE;
/* DSO module function typedefs */
-typedef int conf_init_func(CONF_IMODULE *md, CONF *cnf);
+typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf);
typedef void conf_finish_func(CONF_IMODULE *md);
#define CONF_MFLAGS_IGNORE_ERRORS 0x1
@@ -120,9 +120,9 @@ LHASH *CONF_load(LHASH *conf,const char *file,long *eline);
LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline);
#endif
LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline);
-STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section);
-char *CONF_get_string(LHASH *conf,char *group,char *name);
-long CONF_get_number(LHASH *conf,char *group,char *name);
+STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section);
+char *CONF_get_string(LHASH *conf,const char *group,const char *name);
+long CONF_get_number(LHASH *conf,const char *group,const char *name);
void CONF_free(LHASH *conf);
int CONF_dump_fp(LHASH *conf, FILE *out);
int CONF_dump_bio(LHASH *conf, BIO *out);
@@ -153,11 +153,12 @@ int NCONF_load(CONF *conf,const char *file,long *eline);
int NCONF_load_fp(CONF *conf, FILE *fp,long *eline);
#endif
int NCONF_load_bio(CONF *conf, BIO *bp,long *eline);
-STACK_OF(CONF_VALUE) *NCONF_get_section(CONF *conf,char *section);
-char *NCONF_get_string(CONF *conf,char *group,char *name);
-int NCONF_get_number_e(CONF *conf,char *group,char *name,long *result);
-int NCONF_dump_fp(CONF *conf, FILE *out);
-int NCONF_dump_bio(CONF *conf, BIO *out);
+STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section);
+char *NCONF_get_string(const CONF *conf,const char *group,const char *name);
+int NCONF_get_number_e(const CONF *conf,const char *group,const char *name,
+ long *result);
+int NCONF_dump_fp(const CONF *conf, FILE *out);
+int NCONF_dump_bio(const CONF *conf, BIO *out);
#if 0 /* The following function has no error checking,
and should therefore be avoided */
@@ -168,19 +169,21 @@ long NCONF_get_number(CONF *conf,char *group,char *name);
/* Module functions */
-int CONF_modules_load(CONF *cnf, char *appname, unsigned long flags);
-int CONF_modules_load_file(char *filename, char *appname, unsigned long flags);
+int CONF_modules_load(const CONF *cnf, const char *appname,
+ unsigned long flags);
+int CONF_modules_load_file(const char *filename, const char *appname,
+ unsigned long flags);
void CONF_modules_unload(int all);
void CONF_modules_finish(void);
int CONF_module_add(const char *name, conf_init_func *ifunc,
conf_finish_func *ffunc);
-char *CONF_imodule_get_name(CONF_IMODULE *md);
-char *CONF_imodule_get_value(CONF_IMODULE *md);
-void *CONF_imodule_get_usr_data(CONF_IMODULE *md);
+const char *CONF_imodule_get_name(const CONF_IMODULE *md);
+const char *CONF_imodule_get_value(const CONF_IMODULE *md);
+void *CONF_imodule_get_usr_data(const CONF_IMODULE *md);
void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data);
-CONF_MODULE *CONF_imodule_get_module(CONF_IMODULE *md);
-unsigned long CONF_imodule_get_flags(CONF_IMODULE *md);
+CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md);
+unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md);
void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags);
void *CONF_module_get_usr_data(CONF_MODULE *pmod);
void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data);
diff --git a/crypto/conf/conf_api.c b/crypto/conf/conf_api.c
index 9615df5873..0032baa711 100644
--- a/crypto/conf/conf_api.c
+++ b/crypto/conf/conf_api.c
@@ -81,19 +81,20 @@ static unsigned long hash(const void *v_void);
static int cmp_conf(const void *a_void,const void *b_void);
/* Up until OpenSSL 0.9.5a, this was get_section */
-CONF_VALUE *_CONF_get_section(CONF *conf, char *section)
+CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section)
{
CONF_VALUE *v,vv;
if ((conf == NULL) || (section == NULL)) return(NULL);
vv.name=NULL;
- vv.section=section;
+ vv.section=(char *)section;
v=(CONF_VALUE *)lh_retrieve(conf->data,&vv);
return(v);
}
/* Up until OpenSSL 0.9.5a, this was CONF_get_section */
-STACK_OF(CONF_VALUE) *_CONF_get_section_values(CONF *conf, char *section)
+STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf,
+ const char *section)
{
CONF_VALUE *v;
@@ -128,7 +129,7 @@ int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value)
return 1;
}
-char *_CONF_get_string(CONF *conf, char *section, char *name)
+char *_CONF_get_string(const CONF *conf, const char *section, const char *name)
{
CONF_VALUE *v,vv;
char *p;
@@ -138,8 +139,8 @@ char *_CONF_get_string(CONF *conf, char *section, char *name)
{
if (section != NULL)
{
- vv.name=name;
- vv.section=section;
+ vv.name=(char *)name;
+ vv.section=(char *)section;
v=(CONF_VALUE *)lh_retrieve(conf->data,&vv);
if (v != NULL) return(v->value);
if (strcmp(section,"ENV") == 0)
@@ -149,7 +150,7 @@ char *_CONF_get_string(CONF *conf, char *section, char *name)
}
}
vv.section="default";
- vv.name=name;
+ vv.name=(char *)name;
v=(CONF_VALUE *)lh_retrieve(conf->data,&vv);
if (v != NULL)
return(v->value);
@@ -273,7 +274,7 @@ static int cmp_conf(const void *a_void,const void *b_void)
}
/* Up until OpenSSL 0.9.5a, this was new_section */
-CONF_VALUE *_CONF_new_section(CONF *conf, char *section)
+CONF_VALUE *_CONF_new_section(CONF *conf, const char *section)
{
STACK *sk=NULL;
int ok=0,i;
diff --git a/crypto/conf/conf_api.h b/crypto/conf/conf_api.h
index a5cc17b233..87a954aff6 100644
--- a/crypto/conf/conf_api.h
+++ b/crypto/conf/conf_api.h
@@ -67,15 +67,17 @@ extern "C" {
#endif
/* Up until OpenSSL 0.9.5a, this was new_section */
-CONF_VALUE *_CONF_new_section(CONF *conf, char *section);
+CONF_VALUE *_CONF_new_section(CONF *conf, const char *section);
/* Up until OpenSSL 0.9.5a, this was get_section */
-CONF_VALUE *_CONF_get_section(CONF *conf, char *section);
+CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section);
/* Up until OpenSSL 0.9.5a, this was CONF_get_section */
-STACK_OF(CONF_VALUE) *_CONF_get_section_values(CONF *conf, char *section);
+STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf,
+ const char *section);
int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value);
-char *_CONF_get_string(CONF *conf, char *section, char *name);
-long _CONF_get_number(CONF *conf, char *section, char *name);
+char *_CONF_get_string(const CONF *conf, const char *section,
+ const char *name);
+long _CONF_get_number(const CONF *conf, const char *section, const char *name);
int _CONF_new_data(CONF *conf);
void _CONF_free_data(CONF *conf);
diff --git a/crypto/conf/conf_def.c b/crypto/conf/conf_def.c
index 6d12b40652..04d128bc75 100644
--- a/crypto/conf/conf_def.c
+++ b/crypto/conf/conf_def.c
@@ -83,9 +83,9 @@ static int def_destroy(CONF *conf);
static int def_destroy_data(CONF *conf);
static int def_load(CONF *conf, const char *name, long *eline);
static int def_load_bio(CONF *conf, BIO *bp, long *eline);
-static int def_dump(CONF *conf, BIO *bp);
-static int def_is_number(CONF *conf, char c);
-static int def_to_int(CONF *conf, char c);
+static int def_dump(const CONF *conf, BIO *bp);
+static int def_is_number(const CONF *conf, char c);
+static int def_to_int(const CONF *conf, char c);
const char *CONF_def_version="CONF_def" OPENSSL_VERSION_PTEXT;
@@ -716,18 +716,18 @@ static void dump_value(CONF_VALUE *a, BIO *out)
static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_value, CONF_VALUE *, BIO *)
-static int def_dump(CONF *conf, BIO *out)
+static int def_dump(const CONF *conf, BIO *out)
{
lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_value), out);
return 1;
}
-static int def_is_number(CONF *conf, char c)
+static int def_is_number(const CONF *conf, char c)
{
return IS_NUMBER(conf,c);
}
-static int def_to_int(CONF *conf, char c)
+static int def_to_int(const CONF *conf, char c)
{
return c - '0';
}
diff --git a/crypto/conf/conf_lib.c b/crypto/conf/conf_lib.c
index 4f0c1c6fc7..7998f34c7b 100644
--- a/crypto/conf/conf_lib.c
+++ b/crypto/conf/conf_lib.c
@@ -137,7 +137,7 @@ LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline)
return NULL;
}
-STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section)
+STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section)
{
if (conf == NULL)
{
@@ -151,7 +151,7 @@ STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section)
}
}
-char *CONF_get_string(LHASH *conf,char *group,char *name)
+char *CONF_get_string(LHASH *conf,const char *group,const char *name)
{
if (conf == NULL)
{
@@ -165,7 +165,7 @@ char *CONF_get_string(LHASH *conf,char *group,char *name)
}
}
-long CONF_get_number(LHASH *conf,char *group,char *name)
+long CONF_get_number(LHASH *conf,const char *group,const char *name)
{
int status;
long result = 0;
@@ -294,7 +294,7 @@ int NCONF_load_bio(CONF *conf, BIO *bp,long *eline)
return conf->meth->load_bio(conf, bp, eline);
}
-STACK_OF(CONF_VALUE) *NCONF_get_section(CONF *conf,char *section)
+STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section)
{
if (conf == NULL)
{
@@ -311,7 +311,7 @@ STACK_OF(CONF_VALUE) *NCONF_get_section(CONF *conf,char *section)
return _CONF_get_section_values(conf, section);
}
-char *NCONF_get_string(CONF *conf,char *group,char *name)
+char *NCONF_get_string(const CONF *conf,const char *group,const char *name)
{
char *s = _CONF_get_string(conf, group, name);
@@ -327,10 +327,12 @@ char *NCONF_get_string(CONF *conf,char *group,char *name)
}
CONFerr(CONF_F_NCONF_GET_STRING,
CONF_R_NO_VALUE);
+ ERR_add_error_data(4,"group=",group," name=",name);
return NULL;
}
-int NCONF_get_number_e(CONF *conf,char *group,char *name,long *result)
+int NCONF_get_number_e(const CONF *conf,const char *group,const char *name,
+ long *result)
{
char *str;
@@ -355,7 +357,7 @@ int NCONF_get_number_e(CONF *conf,char *group,char *name,long *result)
}
#ifndef OPENSSL_NO_FP_API
-int NCONF_dump_fp(CONF *conf, FILE *out)
+int NCONF_dump_fp(const CONF *conf, FILE *out)
{
BIO *btmp;
int ret;
@@ -369,7 +371,7 @@ int NCONF_dump_fp(CONF *conf, FILE *out)
}
#endif
-int NCONF_dump_bio(CONF *conf, BIO *out)
+int NCONF_dump_bio(const CONF *conf, BIO *out)
{
if (conf == NULL)
{
diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c
index f1950ea16d..e2e357fe6a 100644
--- a/crypto/conf/conf_mod.c
+++ b/crypto/conf/conf_mod.c
@@ -108,16 +108,20 @@ static STACK_OF(CONF_IMODULE) *initialized_modules = NULL;
static void module_free(CONF_MODULE *md);
static void module_finish(CONF_IMODULE *imod);
-static int module_run(CONF *cnf, char *name, char *value, unsigned long flags);
+static int module_run(const CONF *cnf, char *name, char *value,
+ unsigned long flags);
static CONF_MODULE *module_add(DSO *dso, const char *name,
conf_init_func *ifunc, conf_finish_func *ffunc);
static CONF_MODULE *module_find(char *name);
-static int module_init(CONF_MODULE *pmod, char *name, char *value, CONF *cnf);
-static CONF_MODULE *module_load_dso(CONF *cnf, char *name, char *value, unsigned long flags);
+static int module_init(CONF_MODULE *pmod, char *name, char *value,
+ const CONF *cnf);
+static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value,
+ unsigned long flags);
/* Main function: load modules from a CONF structure */
-int CONF_modules_load(CONF *cnf, char *appname, unsigned long flags)
+int CONF_modules_load(const CONF *cnf, const char *appname,
+ unsigned long flags)
{
STACK_OF(CONF_VALUE) *values;
CONF_VALUE *vl;
@@ -155,7 +159,8 @@ int CONF_modules_load(CONF *cnf, char *appname, unsigned long flags)
}
-int CONF_modules_load_file(char *filename, char *appname, unsigned long flags)
+int CONF_modules_load_file(const char *filename, const char *appname,
+ unsigned long flags)
{
CONF *conf = NULL;
int ret = 0;
@@ -174,7 +179,8 @@ int CONF_modules_load_file(char *filename, char *appname, unsigned long flags)
return ret;
}
-static int module_run(CONF *cnf, char *name, char *value, unsigned long flags)
+static int module_run(const CONF *cnf, char *name, char *value,
+ unsigned long flags)
{
CONF_MODULE *md;
int ret;
@@ -212,7 +218,8 @@ static int module_run(CONF *cnf, char *name, char *value, unsigned long flags)
}
/* Load a module from a DSO */
-static CONF_MODULE *module_load_dso(CONF *cnf, char *name, char *value, unsigned long flags)
+static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value,
+ unsigned long flags)
{
DSO *dso = NULL;
conf_init_func *ifunc;
@@ -263,7 +270,7 @@ static CONF_MODULE *module_load_dso(CONF *cnf, char *name, char *value, unsigned
/* add module to list */
static CONF_MODULE *module_add(DSO *dso, const char *name,
- conf_init_func *ifunc, conf_finish_func *ffunc)
+ conf_init_func *ifunc, conf_finish_func *ffunc)
{
CONF_MODULE *tmod = NULL;
if (supported_modules == NULL)
@@ -318,7 +325,8 @@ static CONF_MODULE *module_find(char *name)
}
/* initialize a module */
-static int module_init(CONF_MODULE *pmod, char *name, char *value, CONF *cnf)
+static int module_init(CONF_MODULE *pmod, char *name, char *value,
+ const CONF *cnf)
{
int ret = 1;
int init_called = 0;
@@ -467,17 +475,17 @@ void CONF_modules_free(void)
/* Utility functions */
-char *CONF_imodule_get_name(CONF_IMODULE *md)
+const char *CONF_imodule_get_name(const CONF_IMODULE *md)
{
return md->name;
}
-char *CONF_imodule_get_value(CONF_IMODULE *md)
+const char *CONF_imodule_get_value(const CONF_IMODULE *md)
{
return md->value;
}
-void *CONF_imodule_get_usr_data(CONF_IMODULE *md)
+void *CONF_imodule_get_usr_data(const CONF_IMODULE *md)
{
return md->usr_data;
}
@@ -487,12 +495,12 @@ void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data)
md->usr_data = usr_data;
}
-CONF_MODULE *CONF_imodule_get_module(CONF_IMODULE *md)
+CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md)
{
return md->pmod;
}
-unsigned long CONF_imodule_get_flags(CONF_IMODULE *md)
+unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md)
{
return md->flags;
}