summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/lhash
diff options
context:
space:
mode:
authorbeck <>2000-03-19 11:13:58 +0000
committerbeck <>2000-03-19 11:13:58 +0000
commit796d609550df3a33fc11468741c5d2f6d3df4c11 (patch)
tree6c6d539061caa20372dad0ac4ddb1dfae2fbe7fe /src/lib/libcrypto/lhash
parent5be3114c1fd7e0dfea1e38d3abb4cbba75244419 (diff)
downloadopenbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.tar.gz
openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.tar.bz2
openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.zip
OpenSSL 0.9.5 merge
*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2 if you are using the ssl26 packages for ssh and other things to work you will need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs
Diffstat (limited to 'src/lib/libcrypto/lhash')
-rw-r--r--src/lib/libcrypto/lhash/Makefile.ssl7
-rw-r--r--src/lib/libcrypto/lhash/lhash.c40
-rw-r--r--src/lib/libcrypto/lhash/lhash.h14
3 files changed, 29 insertions, 32 deletions
diff --git a/src/lib/libcrypto/lhash/Makefile.ssl b/src/lib/libcrypto/lhash/Makefile.ssl
index d6845d6caa..eef4000460 100644
--- a/src/lib/libcrypto/lhash/Makefile.ssl
+++ b/src/lib/libcrypto/lhash/Makefile.ssl
@@ -82,7 +82,8 @@ lh_stats.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
82lh_stats.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h 82lh_stats.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
83lh_stats.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 83lh_stats.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
84lh_stats.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 84lh_stats.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
85lh_stats.o: ../../include/openssl/opensslv.h ../../include/openssl/stack.h 85lh_stats.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
86lh_stats.o: ../cryptlib.h 86lh_stats.o: ../../include/openssl/stack.h ../cryptlib.h
87lhash.o: ../../include/openssl/crypto.h ../../include/openssl/lhash.h 87lhash.o: ../../include/openssl/crypto.h ../../include/openssl/lhash.h
88lhash.o: ../../include/openssl/opensslv.h ../../include/openssl/stack.h 88lhash.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
89lhash.o: ../../include/openssl/stack.h
diff --git a/src/lib/libcrypto/lhash/lhash.c b/src/lib/libcrypto/lhash/lhash.c
index 801322beb6..6a340a2403 100644
--- a/src/lib/libcrypto/lhash/lhash.c
+++ b/src/lib/libcrypto/lhash/lhash.c
@@ -64,11 +64,11 @@
64 * 64 *
65 * 2.1 eay - Added an 'error in last operation' flag. eay 6-May-98 65 * 2.1 eay - Added an 'error in last operation' flag. eay 6-May-98
66 * 66 *
67 * 2.0 eay - Fixed a bug that occured when using lh_delete 67 * 2.0 eay - Fixed a bug that occurred when using lh_delete
68 * from inside lh_doall(). As entries were deleted, 68 * from inside lh_doall(). As entries were deleted,
69 * the 'table' was 'contract()ed', making some entries 69 * the 'table' was 'contract()ed', making some entries
70 * jump from the end of the table to the start, there by 70 * jump from the end of the table to the start, there by
71 * skiping the lh_doall() processing. eay - 4/12/95 71 * skipping the lh_doall() processing. eay - 4/12/95
72 * 72 *
73 * 1.9 eay - Fixed a memory leak in lh_free, the LHASH_NODEs 73 * 1.9 eay - Fixed a memory leak in lh_free, the LHASH_NODEs
74 * were not being free()ed. 21/11/95 74 * were not being free()ed. 21/11/95
@@ -107,12 +107,9 @@ const char *lh_version="lhash" OPENSSL_VERSION_PTEXT;
107#define UP_LOAD (2*LH_LOAD_MULT) /* load times 256 (default 2) */ 107#define UP_LOAD (2*LH_LOAD_MULT) /* load times 256 (default 2) */
108#define DOWN_LOAD (LH_LOAD_MULT) /* load times 256 (default 1) */ 108#define DOWN_LOAD (LH_LOAD_MULT) /* load times 256 (default 1) */
109 109
110
111#define P_CP char *
112#define P_CPP char *,char *
113static void expand(LHASH *lh); 110static void expand(LHASH *lh);
114static void contract(LHASH *lh); 111static void contract(LHASH *lh);
115static LHASH_NODE **getrn(LHASH *lh, char *data, unsigned long *rhash); 112static LHASH_NODE **getrn(LHASH *lh, void *data, unsigned long *rhash);
116 113
117LHASH *lh_new(unsigned long (*h)(), int (*c)()) 114LHASH *lh_new(unsigned long (*h)(), int (*c)())
118 { 115 {
@@ -152,7 +149,7 @@ LHASH *lh_new(unsigned long (*h)(), int (*c)())
152 ret->error=0; 149 ret->error=0;
153 return(ret); 150 return(ret);
154err1: 151err1:
155 Free((char *)ret); 152 Free(ret);
156err0: 153err0:
157 return(NULL); 154 return(NULL);
158 } 155 }
@@ -175,15 +172,15 @@ void lh_free(LHASH *lh)
175 n=nn; 172 n=nn;
176 } 173 }
177 } 174 }
178 Free((char *)lh->b); 175 Free(lh->b);
179 Free((char *)lh); 176 Free(lh);
180 } 177 }
181 178
182char *lh_insert(LHASH *lh, char *data) 179void *lh_insert(LHASH *lh, void *data)
183 { 180 {
184 unsigned long hash; 181 unsigned long hash;
185 LHASH_NODE *nn,**rn; 182 LHASH_NODE *nn,**rn;
186 char *ret; 183 void *ret;
187 184
188 lh->error=0; 185 lh->error=0;
189 if (lh->up_load <= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)) 186 if (lh->up_load <= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))
@@ -217,11 +214,11 @@ char *lh_insert(LHASH *lh, char *data)
217 return(ret); 214 return(ret);
218 } 215 }
219 216
220char *lh_delete(LHASH *lh, char *data) 217void *lh_delete(LHASH *lh, void *data)
221 { 218 {
222 unsigned long hash; 219 unsigned long hash;
223 LHASH_NODE *nn,**rn; 220 LHASH_NODE *nn,**rn;
224 char *ret; 221 void *ret;
225 222
226 lh->error=0; 223 lh->error=0;
227 rn=getrn(lh,data,&hash); 224 rn=getrn(lh,data,&hash);
@@ -236,7 +233,7 @@ char *lh_delete(LHASH *lh, char *data)
236 nn= *rn; 233 nn= *rn;
237 *rn=nn->next; 234 *rn=nn->next;
238 ret=nn->data; 235 ret=nn->data;
239 Free((char *)nn); 236 Free(nn);
240 lh->num_delete++; 237 lh->num_delete++;
241 } 238 }
242 239
@@ -248,11 +245,11 @@ char *lh_delete(LHASH *lh, char *data)
248 return(ret); 245 return(ret);
249 } 246 }
250 247
251char *lh_retrieve(LHASH *lh, char *data) 248void *lh_retrieve(LHASH *lh, void *data)
252 { 249 {
253 unsigned long hash; 250 unsigned long hash;
254 LHASH_NODE **rn; 251 LHASH_NODE **rn;
255 char *ret; 252 void *ret;
256 253
257 lh->error=0; 254 lh->error=0;
258 rn=getrn(lh,data,&hash); 255 rn=getrn(lh,data,&hash);
@@ -275,7 +272,7 @@ void lh_doall(LHASH *lh, void (*func)())
275 lh_doall_arg(lh,func,NULL); 272 lh_doall_arg(lh,func,NULL);
276 } 273 }
277 274
278void lh_doall_arg(LHASH *lh, void (*func)(), char *arg) 275void lh_doall_arg(LHASH *lh, void (*func)(), void *arg)
279 { 276 {
280 int i; 277 int i;
281 LHASH_NODE *a,*n; 278 LHASH_NODE *a,*n;
@@ -332,7 +329,7 @@ static void expand(LHASH *lh)
332 if ((lh->p) >= lh->pmax) 329 if ((lh->p) >= lh->pmax)
333 { 330 {
334 j=(int)lh->num_alloc_nodes*2; 331 j=(int)lh->num_alloc_nodes*2;
335 n=(LHASH_NODE **)Realloc((char *)lh->b, 332 n=(LHASH_NODE **)Realloc(lh->b,
336 (unsigned int)sizeof(LHASH_NODE *)*j); 333 (unsigned int)sizeof(LHASH_NODE *)*j);
337 if (n == NULL) 334 if (n == NULL)
338 { 335 {
@@ -360,7 +357,7 @@ static void contract(LHASH *lh)
360 lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */ 357 lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */
361 if (lh->p == 0) 358 if (lh->p == 0)
362 { 359 {
363 n=(LHASH_NODE **)Realloc((char *)lh->b, 360 n=(LHASH_NODE **)Realloc(lh->b,
364 (unsigned int)(sizeof(LHASH_NODE *)*lh->pmax)); 361 (unsigned int)(sizeof(LHASH_NODE *)*lh->pmax));
365 if (n == NULL) 362 if (n == NULL)
366 { 363 {
@@ -391,7 +388,7 @@ static void contract(LHASH *lh)
391 } 388 }
392 } 389 }
393 390
394static LHASH_NODE **getrn(LHASH *lh, char *data, unsigned long *rhash) 391static LHASH_NODE **getrn(LHASH *lh, void *data, unsigned long *rhash)
395 { 392 {
396 LHASH_NODE **ret,*n1; 393 LHASH_NODE **ret,*n1;
397 unsigned long hash,nn; 394 unsigned long hash,nn;
@@ -426,8 +423,7 @@ static LHASH_NODE **getrn(LHASH *lh, char *data, unsigned long *rhash)
426 } 423 }
427 424
428/* 425/*
429static unsigned long lh_strhash(str) 426unsigned long lh_strhash(char *str)
430char *str;
431 { 427 {
432 int i,l; 428 int i,l;
433 unsigned long ret=0; 429 unsigned long ret=0;
diff --git a/src/lib/libcrypto/lhash/lhash.h b/src/lib/libcrypto/lhash/lhash.h
index 6e5a1fe708..6f6eeb2698 100644
--- a/src/lib/libcrypto/lhash/lhash.h
+++ b/src/lib/libcrypto/lhash/lhash.h
@@ -73,7 +73,7 @@ extern "C" {
73 73
74typedef struct lhash_node_st 74typedef struct lhash_node_st
75 { 75 {
76 char *data; 76 void *data;
77 struct lhash_node_st *next; 77 struct lhash_node_st *next;
78#ifndef NO_HASH_COMP 78#ifndef NO_HASH_COMP
79 unsigned long hash; 79 unsigned long hash;
@@ -116,13 +116,13 @@ typedef struct lhash_st
116 * in lh_insert(). */ 116 * in lh_insert(). */
117#define lh_error(lh) ((lh)->error) 117#define lh_error(lh) ((lh)->error)
118 118
119LHASH *lh_new(unsigned long (*h)(), int (*c)()); 119LHASH *lh_new(unsigned long (*h)(/* void *a */), int (*c)(/* void *a,void *b */));
120void lh_free(LHASH *lh); 120void lh_free(LHASH *lh);
121char *lh_insert(LHASH *lh, char *data); 121void *lh_insert(LHASH *lh, void *data);
122char *lh_delete(LHASH *lh, char *data); 122void *lh_delete(LHASH *lh, void *data);
123char *lh_retrieve(LHASH *lh, char *data); 123void *lh_retrieve(LHASH *lh, void *data);
124void lh_doall(LHASH *lh, void (*func)(/* char *b */)); 124 void lh_doall(LHASH *lh, void (*func)(/*void *b*/));
125void lh_doall_arg(LHASH *lh, void (*func)(/*char *a,char *b*/),char *arg); 125void lh_doall_arg(LHASH *lh, void (*func)(/*void *a,void *b*/),void *arg);
126unsigned long lh_strhash(const char *c); 126unsigned long lh_strhash(const char *c);
127 127
128#ifndef NO_FP_API 128#ifndef NO_FP_API