From 8d28d5f81b81f68a69db1c67e24bcfc092614346 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Wed, 13 Dec 2000 17:15:03 +0000 Subject: [PATCH] Constification of the data of a hash table. This means the callback functions need to be constified, and therefore meant a number of easy changes a little everywhere. Now, if someone could explain to me why OBJ_dup() cheats... --- apps/openssl.c | 8 ++++---- crypto/asn1/a_object.c | 2 +- crypto/asn1/asn1.h | 2 +- crypto/conf/conf_api.c | 8 ++++---- crypto/err/err.c | 16 ++++++++-------- crypto/lhash/lhash.c | 24 ++++++++++++------------ crypto/lhash/lhash.h | 26 +++++++++++++------------- crypto/mem.c | 20 ++++++++++---------- crypto/mem_dbg.c | 18 ++++++++++-------- crypto/objects/o_names.c | 8 ++++---- crypto/objects/obj_dat.c | 23 ++++++++++++----------- crypto/objects/obj_lib.c | 7 ++++--- crypto/objects/objects.h | 17 +++++++++-------- 13 files changed, 92 insertions(+), 87 deletions(-) diff --git a/apps/openssl.c b/apps/openssl.c index 14cb93ee26..4ec9606a06 100644 --- a/apps/openssl.c +++ b/apps/openssl.c @@ -79,9 +79,9 @@ * functions. */ /* static unsigned long MS_CALLBACK hash(FUNCTION *a); */ -static unsigned long MS_CALLBACK hash(void *a_void); +static unsigned long MS_CALLBACK hash(const void *a_void); /* static int MS_CALLBACK cmp(FUNCTION *a,FUNCTION *b); */ -static int MS_CALLBACK cmp(void *a_void,void *b_void); +static int MS_CALLBACK cmp(const void *a_void,const void *b_void); static LHASH *prog_init(void ); static int do_cmd(LHASH *prog,int argc,char *argv[]); LHASH *config=NULL; @@ -367,14 +367,14 @@ static LHASH *prog_init(void) } /* static int MS_CALLBACK cmp(FUNCTION *a, FUNCTION *b) */ -static int MS_CALLBACK cmp(void *a_void, void *b_void) +static int MS_CALLBACK cmp(const void *a_void, const void *b_void) { return(strncmp(((FUNCTION *)a_void)->name, ((FUNCTION *)b_void)->name,8)); } /* static unsigned long MS_CALLBACK hash(FUNCTION *a) */ -static unsigned long MS_CALLBACK hash(void *a_void) +static unsigned long MS_CALLBACK hash(const void *a_void) { return(lh_strhash(((FUNCTION *)a_void)->name)); } diff --git a/crypto/asn1/a_object.c b/crypto/asn1/a_object.c index 20caa2d3bd..71ce7c3896 100644 --- a/crypto/asn1/a_object.c +++ b/crypto/asn1/a_object.c @@ -302,7 +302,7 @@ void ASN1_OBJECT_free(ASN1_OBJECT *a) } ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, - char *sn, char *ln) + const char *sn, const char *ln) { ASN1_OBJECT o; diff --git a/crypto/asn1/asn1.h b/crypto/asn1/asn1.h index a068035947..060395a9ec 100644 --- a/crypto/asn1/asn1.h +++ b/crypto/asn1/asn1.h @@ -758,7 +758,7 @@ int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a); 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); + const char *sn, const char *ln); int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); long ASN1_INTEGER_get(ASN1_INTEGER *a); diff --git a/crypto/conf/conf_api.c b/crypto/conf/conf_api.c index 8216e64525..bf84cecc1e 100644 --- a/crypto/conf/conf_api.c +++ b/crypto/conf/conf_api.c @@ -73,9 +73,9 @@ static void value_free_stack(CONF_VALUE *a,LHASH *conf); /* We don't use function pointer casting or wrapper functions - but cast each * callback parameter inside the callback functions. */ /* static unsigned long hash(CONF_VALUE *v); */ -static unsigned long hash(void *v_void); +static unsigned long hash(const void *v_void); /* static int cmp_conf(CONF_VALUE *a,CONF_VALUE *b); */ -static int cmp_conf(void *a_void,void *b_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) @@ -239,14 +239,14 @@ static void value_free_stack(CONF_VALUE *a, LHASH *conf) } /* static unsigned long hash(CONF_VALUE *v) */ -static unsigned long hash(void *v_void) +static unsigned long hash(const void *v_void) { CONF_VALUE *v = (CONF_VALUE *)v_void; return((lh_strhash(v->section)<<2)^lh_strhash(v->name)); } /* static int cmp_conf(CONF_VALUE *a, CONF_VALUE *b) */ -static int cmp_conf(void *a_void, void *b_void) +static int cmp_conf(const void *a_void,const void *b_void) { int i; CONF_VALUE *a = (CONF_VALUE *)a_void; diff --git a/crypto/err/err.c b/crypto/err/err.c index 48eed688a6..1f517cb5f4 100644 --- a/crypto/err/err.c +++ b/crypto/err/err.c @@ -124,13 +124,13 @@ static LHASH *error_hash=NULL; static LHASH *thread_hash=NULL; /* static unsigned long err_hash(ERR_STRING_DATA *a); */ -static unsigned long err_hash(void *a_void); +static unsigned long err_hash(const void *a_void); /* static int err_cmp(ERR_STRING_DATA *a, ERR_STRING_DATA *b); */ -static int err_cmp(void *a_void, void *b_void); +static int err_cmp(const void *a_void, const void *b_void); /* static unsigned long pid_hash(ERR_STATE *pid); */ -static unsigned long pid_hash(void *pid_void); +static unsigned long pid_hash(const void *pid_void); /* static int pid_cmp(ERR_STATE *a,ERR_STATE *pid); */ -static int pid_cmp(void *a_void,void *pid_void); +static int pid_cmp(const void *a_void,const void *pid_void); static unsigned long get_error_values(int inc,const char **file,int *line, const char **data,int *flags); @@ -626,7 +626,7 @@ const char *ERR_reason_error_string(unsigned long e) } /* static unsigned long err_hash(ERR_STRING_DATA *a) */ -static unsigned long err_hash(void *a_void) +static unsigned long err_hash(const void *a_void) { unsigned long ret,l; @@ -636,20 +636,20 @@ static unsigned long err_hash(void *a_void) } /* static int err_cmp(ERR_STRING_DATA *a, ERR_STRING_DATA *b) */ -static int err_cmp(void *a_void, void *b_void) +static int err_cmp(const void *a_void, const void *b_void) { return((int)(((ERR_STRING_DATA *)a_void)->error - ((ERR_STRING_DATA *)b_void)->error)); } /* static unsigned long pid_hash(ERR_STATE *a) */ -static unsigned long pid_hash(void *a_void) +static unsigned long pid_hash(const void *a_void) { return(((ERR_STATE *)a_void)->pid*13); } /* static int pid_cmp(ERR_STATE *a, ERR_STATE *b) */ -static int pid_cmp(void *a_void, void *b_void) +static int pid_cmp(const void *a_void, const void *b_void) { return((int)((long)((ERR_STATE *)a_void)->pid - (long)((ERR_STATE *)b_void)->pid)); diff --git a/crypto/lhash/lhash.c b/crypto/lhash/lhash.c index 60699f45cc..874647af6b 100644 --- a/crypto/lhash/lhash.c +++ b/crypto/lhash/lhash.c @@ -109,7 +109,7 @@ const char *lh_version="lhash" OPENSSL_VERSION_PTEXT; static void expand(LHASH *lh); static void contract(LHASH *lh); -static LHASH_NODE **getrn(LHASH *lh, void *data, unsigned long *rhash); +static LHASH_NODE **getrn(LHASH *lh, const void *data, unsigned long *rhash); LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c) { @@ -176,11 +176,11 @@ void lh_free(LHASH *lh) OPENSSL_free(lh); } -void *lh_insert(LHASH *lh, void *data) +void *lh_insert(LHASH *lh, const void *data) { unsigned long hash; LHASH_NODE *nn,**rn; - void *ret; + const void *ret; lh->error=0; if (lh->up_load <= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)) @@ -211,14 +211,14 @@ void *lh_insert(LHASH *lh, void *data) (*rn)->data=data; lh->num_replace++; } - return(ret); + return((void *)ret); } -void *lh_delete(LHASH *lh, void *data) +void *lh_delete(LHASH *lh, const void *data) { unsigned long hash; LHASH_NODE *nn,**rn; - void *ret; + const void *ret; lh->error=0; rn=getrn(lh,data,&hash); @@ -242,14 +242,14 @@ void *lh_delete(LHASH *lh, void *data) (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))) contract(lh); - return(ret); + return((void *)ret); } -void *lh_retrieve(LHASH *lh, void *data) +void *lh_retrieve(LHASH *lh, const void *data) { unsigned long hash; LHASH_NODE **rn; - void *ret; + const void *ret; lh->error=0; rn=getrn(lh,data,&hash); @@ -264,7 +264,7 @@ void *lh_retrieve(LHASH *lh, void *data) ret= (*rn)->data; lh->num_retrieve++; } - return(ret); + return((void *)ret); } void lh_doall(LHASH *lh, LHASH_DOALL_FN_TYPE func) @@ -279,7 +279,7 @@ void lh_doall(LHASH *lh, LHASH_DOALL_FN_TYPE func) lh_doall_arg(lh, (LHASH_DOALL_ARG_FN_TYPE)func, NULL); } -void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg) +void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, const void *arg) { int i; LHASH_NODE *a,*n; @@ -395,7 +395,7 @@ static void contract(LHASH *lh) } } -static LHASH_NODE **getrn(LHASH *lh, void *data, unsigned long *rhash) +static LHASH_NODE **getrn(LHASH *lh, const void *data, unsigned long *rhash) { LHASH_NODE **ret,*n1; unsigned long hash,nn; diff --git a/crypto/lhash/lhash.h b/crypto/lhash/lhash.h index 6420512079..3c5355885f 100644 --- a/crypto/lhash/lhash.h +++ b/crypto/lhash/lhash.h @@ -77,17 +77,17 @@ extern "C" { typedef struct lhash_node_st { - void *data; + const void *data; struct lhash_node_st *next; #ifndef NO_HASH_COMP unsigned long hash; #endif } LHASH_NODE; -typedef int (*LHASH_COMP_FN_TYPE)(void *, void *); -typedef unsigned long (*LHASH_HASH_FN_TYPE)(void *); -typedef void (*LHASH_DOALL_FN_TYPE)(void *); -typedef void (*LHASH_DOALL_ARG_FN_TYPE)(void *, void *); +typedef int (*LHASH_COMP_FN_TYPE)(const void *, const void *); +typedef unsigned long (*LHASH_HASH_FN_TYPE)(const void *); +typedef void (*LHASH_DOALL_FN_TYPE)(const void *); +typedef void (*LHASH_DOALL_ARG_FN_TYPE)(const void *, const void *); /* Macros for declaring and implementing type-safe wrappers for LHASH callbacks. * This way, callbacks can be provided to LHASH structures without function @@ -98,18 +98,18 @@ typedef void (*LHASH_DOALL_ARG_FN_TYPE)(void *, void *); /* First: "hash" functions */ #define DECLARE_LHASH_HASH_FN(f_name,o_type) \ - unsigned long f_name##_LHASH_HASH(void *); + unsigned long f_name##_LHASH_HASH(const void *); #define IMPLEMENT_LHASH_HASH_FN(f_name,o_type) \ - unsigned long f_name##_LHASH_HASH(void *arg) { \ + unsigned long f_name##_LHASH_HASH(const void *arg) { \ o_type a = (o_type)arg; \ return f_name(a); } #define LHASH_HASH_FN(f_name) f_name##_LHASH_HASH /* Second: "compare" functions */ #define DECLARE_LHASH_COMP_FN(f_name,o_type) \ - int f_name##_LHASH_COMP(void *, void *); + int f_name##_LHASH_COMP(const void *, const void *); #define IMPLEMENT_LHASH_COMP_FN(f_name,o_type) \ - int f_name##_LHASH_COMP(void *arg1, void *arg2) { \ + int f_name##_LHASH_COMP(const void *arg1, const void *arg2) { \ o_type a = (o_type)arg1; \ o_type b = (o_type)arg2; \ return f_name(a,b); } @@ -153,11 +153,11 @@ typedef struct lhash_st LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c); void lh_free(LHASH *lh); -void *lh_insert(LHASH *lh, void *data); -void *lh_delete(LHASH *lh, void *data); -void *lh_retrieve(LHASH *lh, void *data); +void *lh_insert(LHASH *lh, const void *data); +void *lh_delete(LHASH *lh, const void *data); +void *lh_retrieve(LHASH *lh, const void *data); void lh_doall(LHASH *lh, LHASH_DOALL_FN_TYPE func); -void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg); +void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, const void *arg); unsigned long lh_strhash(const char *c); unsigned long lh_num_items(const LHASH *lh); diff --git a/crypto/mem.c b/crypto/mem.c index 3b5b2bbc68..4e4b894ab7 100644 --- a/crypto/mem.c +++ b/crypto/mem.c @@ -181,8 +181,8 @@ void *CRYPTO_malloc_locked(int num, const char *file, int line) malloc_debug_func(NULL, num, file, line, 0); } ret = malloc_locked_func(num); -#ifdef LEVITTE_DEBUG - fprintf(stderr, "LEVITTE_DEBUG: > 0x%p (%d)\n", ret, num); +#ifdef LEVITTE_DEBUG_MEM + fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); #endif if (malloc_debug_func != NULL) malloc_debug_func(ret, num, file, line, 1); @@ -194,8 +194,8 @@ void CRYPTO_free_locked(void *str) { if (free_debug_func != NULL) free_debug_func(str, 0); -#ifdef LEVITTE_DEBUG - fprintf(stderr, "LEVITTE_DEBUG: < 0x%p\n", str); +#ifdef LEVITTE_DEBUG_MEM + fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str); #endif free_locked_func(str); if (free_debug_func != NULL) @@ -213,8 +213,8 @@ void *CRYPTO_malloc(int num, const char *file, int line) malloc_debug_func(NULL, num, file, line, 0); } ret = malloc_func(num); -#ifdef LEVITTE_DEBUG - fprintf(stderr, "LEVITTE_DEBUG: > 0x%p (%d)\n", ret, num); +#ifdef LEVITTE_DEBUG_MEM + fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); #endif if (malloc_debug_func != NULL) malloc_debug_func(ret, num, file, line, 1); @@ -229,8 +229,8 @@ void *CRYPTO_realloc(void *str, int num, const char *file, int line) if (realloc_debug_func != NULL) realloc_debug_func(str, NULL, num, file, line, 0); ret = realloc_func(str,num); -#ifdef LEVITTE_DEBUG - fprintf(stderr, "LEVITTE_DEBUG: | 0x%p -> 0x%p (%d)\n", str, ret, num); +#ifdef LEVITTE_DEBUG_MEM + fprintf(stderr, "LEVITTE_DEBUG_MEM: | 0x%p -> 0x%p (%d)\n", str, ret, num); #endif if (realloc_debug_func != NULL) realloc_debug_func(str, ret, num, file, line, 1); @@ -242,8 +242,8 @@ void CRYPTO_free(void *str) { if (free_debug_func != NULL) free_debug_func(str, 0); -#ifdef LEVITTE_DEBUG - fprintf(stderr, "LEVITTE_DEBUG: < 0x%p\n", str); +#ifdef LEVITTE_DEBUG_MEM + fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str); #endif free_func(str); if (free_debug_func != NULL) diff --git a/crypto/mem_dbg.c b/crypto/mem_dbg.c index 8e48e25fbd..9ed8184e45 100644 --- a/crypto/mem_dbg.c +++ b/crypto/mem_dbg.c @@ -220,34 +220,36 @@ long CRYPTO_dbg_get_options(void) } /* static int mem_cmp(MEM *a, MEM *b) */ -static int mem_cmp(void *a_void, void *b_void) +static int mem_cmp(const void *a_void, const void *b_void) { - return((char *)((MEM *)a_void)->addr - (char *)((MEM *)b_void)->addr); + return((const char *)((MEM *)a_void)->addr + - (const char *)((MEM *)b_void)->addr); } /* static unsigned long mem_hash(MEM *a) */ -static unsigned long mem_hash(void *a_void) +static unsigned long mem_hash(const void *a_void) { unsigned long ret; - ret=(unsigned long)((MEM *)a_void)->addr; + ret=(unsigned long)((const MEM *)a_void)->addr; ret=ret*17851+(ret>>14)*7+(ret>>4)*251; return(ret); } /* static int app_info_cmp(APP_INFO *a, APP_INFO *b) */ -static int app_info_cmp(void *a_void, void *b_void) +static int app_info_cmp(const void *a_void, const void *b_void) { - return(((APP_INFO *)a_void)->thread != ((APP_INFO *)b_void)->thread); + return(((const APP_INFO *)a_void)->thread + != ((const APP_INFO *)b_void)->thread); } /* static unsigned long app_info_hash(APP_INFO *a) */ -static unsigned long app_info_hash(void *a_void) +static unsigned long app_info_hash(const void *a_void) { unsigned long ret; - ret=(unsigned long)((APP_INFO *)a_void)->thread; + ret=(unsigned long)((const APP_INFO *)a_void)->thread; ret=ret*17851+(ret>>14)*7+(ret>>4)*251; return(ret); diff --git a/crypto/objects/o_names.c b/crypto/objects/o_names.c index a5b1aacd66..367ee2bdef 100644 --- a/crypto/objects/o_names.c +++ b/crypto/objects/o_names.c @@ -29,9 +29,9 @@ static STACK_OF(NAME_FUNCS) *name_funcs_stack; * need for macro-generated wrapper functions. */ /* static unsigned long obj_name_hash(OBJ_NAME *a); */ -static unsigned long obj_name_hash(void *a_void); +static unsigned long obj_name_hash(const void *a_void); /* static int obj_name_cmp(OBJ_NAME *a,OBJ_NAME *b); */ -static int obj_name_cmp(void *a_void,void *b_void); +static int obj_name_cmp(const void *a_void,const void *b_void); int OBJ_NAME_init(void) { @@ -88,7 +88,7 @@ int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *), } /* static int obj_name_cmp(OBJ_NAME *a, OBJ_NAME *b) */ -static int obj_name_cmp(void *a_void, void *b_void) +static int obj_name_cmp(const void *a_void, const void *b_void) { int ret; OBJ_NAME *a = (OBJ_NAME *)a_void; @@ -110,7 +110,7 @@ static int obj_name_cmp(void *a_void, void *b_void) } /* static unsigned long obj_name_hash(OBJ_NAME *a) */ -static unsigned long obj_name_hash(void *a_void) +static unsigned long obj_name_hash(const void *a_void) { unsigned long ret; OBJ_NAME *a = (OBJ_NAME *)a_void; diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c index 0057da29bd..9d47c8fb8d 100644 --- a/crypto/objects/obj_dat.c +++ b/crypto/objects/obj_dat.c @@ -109,9 +109,9 @@ static int ln_cmp(const void *a, const void *b) } /* static unsigned long add_hash(ADDED_OBJ *ca) */ -static unsigned long add_hash(void *ca_void) +static unsigned long add_hash(const void *ca_void) { - ASN1_OBJECT *a; + const ASN1_OBJECT *a; int i; unsigned long ret=0; unsigned char *p; @@ -145,7 +145,7 @@ static unsigned long add_hash(void *ca_void) } /* static int add_cmp(ADDED_OBJ *ca, ADDED_OBJ *cb) */ -static int add_cmp(void *ca_void, void *cb_void) +static int add_cmp(const void *ca_void, const void *cb_void) { ASN1_OBJECT *a,*b; int i; @@ -224,7 +224,7 @@ int OBJ_new_nid(int num) return(i); } -int OBJ_add_object(ASN1_OBJECT *obj) +int OBJ_add_object(const ASN1_OBJECT *obj) { ASN1_OBJECT *o; ADDED_OBJ *ao[4]={NULL,NULL,NULL,NULL},*aop; @@ -360,7 +360,7 @@ const char *OBJ_nid2ln(int n) } } -int OBJ_obj2nid(ASN1_OBJECT *a) +int OBJ_obj2nid(const ASN1_OBJECT *a) { ASN1_OBJECT **op; ADDED_OBJ ad,*adp; @@ -373,7 +373,7 @@ int OBJ_obj2nid(ASN1_OBJECT *a) if (added != NULL) { ad.type=ADDED_DATA; - ad.obj=a; + ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */ adp=(ADDED_OBJ *)lh_retrieve(added,&ad); if (adp != NULL) return (adp->obj->nid); } @@ -427,7 +427,7 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name) return op; } -int OBJ_obj2txt(char *buf, int buf_len, ASN1_OBJECT *a, int no_name) +int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) { int i,idx=0,n=0,len,nid; unsigned long l; @@ -493,7 +493,7 @@ int OBJ_obj2txt(char *buf, int buf_len, ASN1_OBJECT *a, int no_name) return(n); } -int OBJ_txt2nid(char *s) +int OBJ_txt2nid(const char *s) { ASN1_OBJECT *obj; int nid; @@ -552,10 +552,11 @@ static int obj_cmp(const void *ap, const void *bp) return(memcmp(a->data,b->data,a->length)); } -char *OBJ_bsearch(char *key, char *base, int num, int size, int (*cmp)(const void *, const void *)) +const char *OBJ_bsearch(const char *key, const char *base, int num, int size, + int (*cmp)(const void *, const void *)) { int l,h,i,c; - char *p; + const char *p; if (num == 0) return(NULL); l=0; @@ -634,7 +635,7 @@ int OBJ_create_objects(BIO *in) /* return(num); */ } -int OBJ_create(char *oid, char *sn, char *ln) +int OBJ_create(const char *oid, const char *sn, const char *ln) { int ok=0; ASN1_OBJECT *op=NULL; diff --git a/crypto/objects/obj_lib.c b/crypto/objects/obj_lib.c index 0c71639eba..b0b0f2ff24 100644 --- a/crypto/objects/obj_lib.c +++ b/crypto/objects/obj_lib.c @@ -62,7 +62,7 @@ #include #include -ASN1_OBJECT *OBJ_dup(ASN1_OBJECT *o) +ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o) { ASN1_OBJECT *r; int i; @@ -70,7 +70,8 @@ ASN1_OBJECT *OBJ_dup(ASN1_OBJECT *o) if (o == NULL) return(NULL); if (!(o->flags & ASN1_OBJECT_FLAG_DYNAMIC)) - return(o); + return((ASN1_OBJECT *)o); /* XXX: ugh! Why? What kind of + duplication is this??? */ r=ASN1_OBJECT_new(); if (r == NULL) @@ -116,7 +117,7 @@ err: return(NULL); } -int OBJ_cmp(ASN1_OBJECT *a, ASN1_OBJECT *b) +int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b) { int ret; diff --git a/crypto/objects/objects.h b/crypto/objects/objects.h index 8918683aab..e98e92e993 100644 --- a/crypto/objects/objects.h +++ b/crypto/objects/objects.h @@ -997,24 +997,25 @@ void OBJ_NAME_do_all(int type,void (*fn)(const OBJ_NAME *,void *arg), void OBJ_NAME_do_all_sorted(int type,void (*fn)(const OBJ_NAME *,void *arg), void *arg); -ASN1_OBJECT * OBJ_dup(ASN1_OBJECT *o); +ASN1_OBJECT * OBJ_dup(const ASN1_OBJECT *o); ASN1_OBJECT * OBJ_nid2obj(int n); const char * OBJ_nid2ln(int n); const char * OBJ_nid2sn(int n); -int OBJ_obj2nid(ASN1_OBJECT *o); +int OBJ_obj2nid(const ASN1_OBJECT *o); ASN1_OBJECT * OBJ_txt2obj(const char *s, int no_name); -int OBJ_obj2txt(char *buf, int buf_len, ASN1_OBJECT *a, int no_name); -int OBJ_txt2nid(char *s); +int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name); +int OBJ_txt2nid(const char *s); int OBJ_ln2nid(const char *s); int OBJ_sn2nid(const char *s); -int OBJ_cmp(ASN1_OBJECT *a,ASN1_OBJECT *b); -char * OBJ_bsearch(char *key,char *base,int num,int size,int (*cmp)(const void *, const void *)); +int OBJ_cmp(const ASN1_OBJECT *a,const ASN1_OBJECT *b); +const char * OBJ_bsearch(const char *key,const char *base,int num,int size, + int (*cmp)(const void *, const void *)); void ERR_load_OBJ_strings(void ); int OBJ_new_nid(int num); -int OBJ_add_object(ASN1_OBJECT *obj); -int OBJ_create(char *oid,char *sn,char *ln); +int OBJ_add_object(const ASN1_OBJECT *obj); +int OBJ_create(const char *oid,const char *sn,const char *ln); void OBJ_cleanup(void ); int OBJ_create_objects(BIO *in); -- 2.34.1