summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/lhash
diff options
context:
space:
mode:
authorbeck <>2000-12-15 02:58:47 +0000
committerbeck <>2000-12-15 02:58:47 +0000
commit9200bb13d15da4b2a23e6bc92c20e95b74aa2113 (patch)
tree5c52d628ec1e34be76e7ef2a4235d248b7c44d24 /src/lib/libcrypto/lhash
parente131d25072e3d4197ba4b9bcc0d1b27d34d6488d (diff)
downloadopenbsd-9200bb13d15da4b2a23e6bc92c20e95b74aa2113.tar.gz
openbsd-9200bb13d15da4b2a23e6bc92c20e95b74aa2113.tar.bz2
openbsd-9200bb13d15da4b2a23e6bc92c20e95b74aa2113.zip
openssl-engine-0.9.6 merge
Diffstat (limited to 'src/lib/libcrypto/lhash')
-rw-r--r--src/lib/libcrypto/lhash/Makefile.ssl10
-rw-r--r--src/lib/libcrypto/lhash/lh_stats.c5
-rw-r--r--src/lib/libcrypto/lhash/lh_test.c2
-rw-r--r--src/lib/libcrypto/lhash/lhash.c20
-rw-r--r--src/lib/libcrypto/lhash/lhash.h14
5 files changed, 30 insertions, 21 deletions
diff --git a/src/lib/libcrypto/lhash/Makefile.ssl b/src/lib/libcrypto/lhash/Makefile.ssl
index eef4000460..6c3d442e22 100644
--- a/src/lib/libcrypto/lhash/Makefile.ssl
+++ b/src/lib/libcrypto/lhash/Makefile.ssl
@@ -83,7 +83,9 @@ lh_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/safestack.h 85lh_stats.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
86lh_stats.o: ../../include/openssl/stack.h ../cryptlib.h 86lh_stats.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
87lhash.o: ../../include/openssl/crypto.h ../../include/openssl/lhash.h 87lh_stats.o: ../cryptlib.h
88lhash.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 88lhash.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
89lhash.o: ../../include/openssl/stack.h 89lhash.o: ../../include/openssl/lhash.h ../../include/openssl/opensslv.h
90lhash.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
91lhash.o: ../../include/openssl/symhacks.h
diff --git a/src/lib/libcrypto/lhash/lh_stats.c b/src/lib/libcrypto/lhash/lh_stats.c
index 80b931c12b..ee0600060e 100644
--- a/src/lib/libcrypto/lhash/lh_stats.c
+++ b/src/lib/libcrypto/lhash/lh_stats.c
@@ -63,9 +63,12 @@
63 * and things should work as expected */ 63 * and things should work as expected */
64#include "cryptlib.h" 64#include "cryptlib.h"
65 65
66#ifndef NO_BIO
67#include <openssl/bio.h>
68#endif
66#include <openssl/lhash.h> 69#include <openssl/lhash.h>
67 70
68#ifndef HEADER_BIO_H 71#ifdef NO_BIO
69 72
70void lh_stats(LHASH *lh, FILE *out) 73void lh_stats(LHASH *lh, FILE *out)
71 { 74 {
diff --git a/src/lib/libcrypto/lhash/lh_test.c b/src/lib/libcrypto/lhash/lh_test.c
index 08138b52c3..6008781e57 100644
--- a/src/lib/libcrypto/lhash/lh_test.c
+++ b/src/lib/libcrypto/lhash/lh_test.c
@@ -77,7 +77,7 @@ main()
77 if (buf[0] == '\0') break; 77 if (buf[0] == '\0') break;
78 buf[256]='\0'; 78 buf[256]='\0';
79 i=strlen(buf); 79 i=strlen(buf);
80 p=Malloc(i+1); 80 p=OPENSSL_malloc(i+1);
81 memcpy(p,buf,i+1); 81 memcpy(p,buf,i+1);
82 lh_insert(conf,p); 82 lh_insert(conf,p);
83 } 83 }
diff --git a/src/lib/libcrypto/lhash/lhash.c b/src/lib/libcrypto/lhash/lhash.c
index 7eb92a18bc..7da14620a4 100644
--- a/src/lib/libcrypto/lhash/lhash.c
+++ b/src/lib/libcrypto/lhash/lhash.c
@@ -116,9 +116,9 @@ LHASH *lh_new(unsigned long (*h)(), int (*c)())
116 LHASH *ret; 116 LHASH *ret;
117 int i; 117 int i;
118 118
119 if ((ret=(LHASH *)Malloc(sizeof(LHASH))) == NULL) 119 if ((ret=(LHASH *)OPENSSL_malloc(sizeof(LHASH))) == NULL)
120 goto err0; 120 goto err0;
121 if ((ret->b=(LHASH_NODE **)Malloc(sizeof(LHASH_NODE *)*MIN_NODES)) == NULL) 121 if ((ret->b=(LHASH_NODE **)OPENSSL_malloc(sizeof(LHASH_NODE *)*MIN_NODES)) == NULL)
122 goto err1; 122 goto err1;
123 for (i=0; i<MIN_NODES; i++) 123 for (i=0; i<MIN_NODES; i++)
124 ret->b[i]=NULL; 124 ret->b[i]=NULL;
@@ -149,7 +149,7 @@ LHASH *lh_new(unsigned long (*h)(), int (*c)())
149 ret->error=0; 149 ret->error=0;
150 return(ret); 150 return(ret);
151err1: 151err1:
152 Free(ret); 152 OPENSSL_free(ret);
153err0: 153err0:
154 return(NULL); 154 return(NULL);
155 } 155 }
@@ -168,12 +168,12 @@ void lh_free(LHASH *lh)
168 while (n != NULL) 168 while (n != NULL)
169 { 169 {
170 nn=n->next; 170 nn=n->next;
171 Free(n); 171 OPENSSL_free(n);
172 n=nn; 172 n=nn;
173 } 173 }
174 } 174 }
175 Free(lh->b); 175 OPENSSL_free(lh->b);
176 Free(lh); 176 OPENSSL_free(lh);
177 } 177 }
178 178
179void *lh_insert(LHASH *lh, void *data) 179void *lh_insert(LHASH *lh, void *data)
@@ -190,7 +190,7 @@ void *lh_insert(LHASH *lh, void *data)
190 190
191 if (*rn == NULL) 191 if (*rn == NULL)
192 { 192 {
193 if ((nn=(LHASH_NODE *)Malloc(sizeof(LHASH_NODE))) == NULL) 193 if ((nn=(LHASH_NODE *)OPENSSL_malloc(sizeof(LHASH_NODE))) == NULL)
194 { 194 {
195 lh->error++; 195 lh->error++;
196 return(NULL); 196 return(NULL);
@@ -233,7 +233,7 @@ void *lh_delete(LHASH *lh, void *data)
233 nn= *rn; 233 nn= *rn;
234 *rn=nn->next; 234 *rn=nn->next;
235 ret=nn->data; 235 ret=nn->data;
236 Free(nn); 236 OPENSSL_free(nn);
237 lh->num_delete++; 237 lh->num_delete++;
238 } 238 }
239 239
@@ -329,7 +329,7 @@ static void expand(LHASH *lh)
329 if ((lh->p) >= lh->pmax) 329 if ((lh->p) >= lh->pmax)
330 { 330 {
331 j=(int)lh->num_alloc_nodes*2; 331 j=(int)lh->num_alloc_nodes*2;
332 n=(LHASH_NODE **)Realloc(lh->b, 332 n=(LHASH_NODE **)OPENSSL_realloc(lh->b,
333 (unsigned int)sizeof(LHASH_NODE *)*j); 333 (unsigned int)sizeof(LHASH_NODE *)*j);
334 if (n == NULL) 334 if (n == NULL)
335 { 335 {
@@ -357,7 +357,7 @@ static void contract(LHASH *lh)
357 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 :-( */
358 if (lh->p == 0) 358 if (lh->p == 0)
359 { 359 {
360 n=(LHASH_NODE **)Realloc(lh->b, 360 n=(LHASH_NODE **)OPENSSL_realloc(lh->b,
361 (unsigned int)(sizeof(LHASH_NODE *)*lh->pmax)); 361 (unsigned int)(sizeof(LHASH_NODE *)*lh->pmax));
362 if (n == NULL) 362 if (n == NULL)
363 { 363 {
diff --git a/src/lib/libcrypto/lhash/lhash.h b/src/lib/libcrypto/lhash/lhash.h
index d315fd9c6d..b8ff021906 100644
--- a/src/lib/libcrypto/lhash/lhash.h
+++ b/src/lib/libcrypto/lhash/lhash.h
@@ -63,14 +63,18 @@
63#ifndef HEADER_LHASH_H 63#ifndef HEADER_LHASH_H
64#define HEADER_LHASH_H 64#define HEADER_LHASH_H
65 65
66#ifdef __cplusplus
67extern "C" {
68#endif
69
70#ifndef NO_FP_API 66#ifndef NO_FP_API
71#include <stdio.h> 67#include <stdio.h>
72#endif 68#endif
73 69
70#ifndef NO_BIO
71#include <openssl/bio.h>
72#endif
73
74#ifdef __cplusplus
75extern "C" {
76#endif
77
74typedef struct lhash_node_st 78typedef struct lhash_node_st
75 { 79 {
76 void *data; 80 void *data;
@@ -132,7 +136,7 @@ void lh_node_stats(LHASH *lh, FILE *out);
132void lh_node_usage_stats(LHASH *lh, FILE *out); 136void lh_node_usage_stats(LHASH *lh, FILE *out);
133#endif 137#endif
134 138
135#ifdef HEADER_BIO_H 139#ifndef NO_BIO
136void lh_stats_bio(LHASH *lh, BIO *out); 140void lh_stats_bio(LHASH *lh, BIO *out);
137void lh_node_stats_bio(LHASH *lh, BIO *out); 141void lh_node_stats_bio(LHASH *lh, BIO *out);
138void lh_node_usage_stats_bio(LHASH *lh, BIO *out); 142void lh_node_usage_stats_bio(LHASH *lh, BIO *out);