summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/txt_db
diff options
context:
space:
mode:
authorbeck <>1999-09-29 04:37:45 +0000
committerbeck <>1999-09-29 04:37:45 +0000
commitde8f24ea083384bb66b32ec105dc4743c5663cdf (patch)
tree1412176ae62a3cab2cf2b0b92150fcbceaac6092 /src/lib/libcrypto/txt_db
parentcb929d29896bcb87c2a97417fbd03e50078fc178 (diff)
downloadopenbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.gz
openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.bz2
openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.zip
OpenSSL 0.9.4 merge
Diffstat (limited to 'src/lib/libcrypto/txt_db')
-rw-r--r--src/lib/libcrypto/txt_db/Makefile.ssl36
-rw-r--r--src/lib/libcrypto/txt_db/txt_db.c39
-rw-r--r--src/lib/libcrypto/txt_db/txt_db.h16
3 files changed, 37 insertions, 54 deletions
diff --git a/src/lib/libcrypto/txt_db/Makefile.ssl b/src/lib/libcrypto/txt_db/Makefile.ssl
index 76e511534f..552ea5580f 100644
--- a/src/lib/libcrypto/txt_db/Makefile.ssl
+++ b/src/lib/libcrypto/txt_db/Makefile.ssl
@@ -7,9 +7,11 @@ TOP= ../..
7CC= cc 7CC= cc
8INCLUDES= 8INCLUDES=
9CFLAG=-g 9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
10INSTALLTOP=/usr/local/ssl 12INSTALLTOP=/usr/local/ssl
11MAKE= make -f Makefile.ssl 13MAKE= make -f Makefile.ssl
12MAKEDEPEND= makedepend -f Makefile.ssl 14MAKEDEPEND= $(TOP)/util/domd $(TOP)
13MAKEFILE= Makefile.ssl 15MAKEFILE= Makefile.ssl
14AR= ar r 16AR= ar r
15 17
@@ -37,24 +39,23 @@ all: lib
37 39
38lib: $(LIBOBJ) 40lib: $(LIBOBJ)
39 $(AR) $(LIB) $(LIBOBJ) 41 $(AR) $(LIB) $(LIBOBJ)
40 sh $(TOP)/util/ranlib.sh $(LIB) 42 $(RANLIB) $(LIB)
41 @touch lib 43 @touch lib
42 44
43files: 45files:
44 perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO 46 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
45 47
46links: 48links:
47 /bin/rm -f Makefile 49 @$(TOP)/util/point.sh Makefile.ssl Makefile
48 $(TOP)/util/point.sh Makefile.ssl Makefile ; 50 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
49 $(TOP)/util/mklink.sh ../../include $(EXHEADER) 51 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
50 $(TOP)/util/mklink.sh ../../test $(TEST) 52 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
51 $(TOP)/util/mklink.sh ../../apps $(APPS)
52 53
53install: 54install:
54 @for i in $(EXHEADER) ; \ 55 @for i in $(EXHEADER) ; \
55 do \ 56 do \
56 (cp $$i $(INSTALLTOP)/include/$$i; \ 57 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
57 chmod 644 $(INSTALLTOP)/include/$$i ); \ 58 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
58 done; 59 done;
59 60
60tags: 61tags:
@@ -66,15 +67,20 @@ lint:
66 lint -DLINT $(INCLUDES) $(SRC)>fluff 67 lint -DLINT $(INCLUDES) $(SRC)>fluff
67 68
68depend: 69depend:
69 $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) 70 $(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
70 71
71dclean: 72dclean:
72 perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new 73 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
73 mv -f Makefile.new $(MAKEFILE) 74 mv -f Makefile.new $(MAKEFILE)
74 75
75clean: 76clean:
76 /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff 77 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
77
78errors:
79 78
80# DO NOT DELETE THIS LINE -- make depend depends on it. 79# DO NOT DELETE THIS LINE -- make depend depends on it.
80
81txt_db.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
82txt_db.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
83txt_db.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
84txt_db.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
85txt_db.o: ../../include/openssl/opensslv.h ../../include/openssl/stack.h
86txt_db.o: ../../include/openssl/txt_db.h ../cryptlib.h
diff --git a/src/lib/libcrypto/txt_db/txt_db.c b/src/lib/libcrypto/txt_db/txt_db.c
index e34ce4efa9..9a9fa5ce55 100644
--- a/src/lib/libcrypto/txt_db/txt_db.c
+++ b/src/lib/libcrypto/txt_db/txt_db.c
@@ -60,17 +60,15 @@
60#include <stdlib.h> 60#include <stdlib.h>
61#include <string.h> 61#include <string.h>
62#include "cryptlib.h" 62#include "cryptlib.h"
63#include "buffer.h" 63#include <openssl/buffer.h>
64#include "txt_db.h" 64#include <openssl/txt_db.h>
65 65
66#undef BUFSIZE 66#undef BUFSIZE
67#define BUFSIZE 512 67#define BUFSIZE 512
68 68
69char *TXT_DB_version="TXT_DB part of SSLeay 0.9.0b 29-Jun-1998"; 69const char *TXT_DB_version="TXT_DB" OPENSSL_VERSION_PTEXT;
70 70
71TXT_DB *TXT_DB_read(in,num) 71TXT_DB *TXT_DB_read(BIO *in, int num)
72BIO *in;
73int num;
74 { 72 {
75 TXT_DB *ret=NULL; 73 TXT_DB *ret=NULL;
76 int er=1; 74 int er=1;
@@ -158,7 +156,7 @@ int num;
158 if ((n != num) || (*f != '\0')) 156 if ((n != num) || (*f != '\0'))
159 { 157 {
160#if !defined(NO_STDIO) && !defined(WIN16) /* temporaty fix :-( */ 158#if !defined(NO_STDIO) && !defined(WIN16) /* temporaty fix :-( */
161 fprintf(stderr,"wrong number of fields on line %ld\n",ln); 159 fprintf(stderr,"wrong number of fields on line %ld (looking for field %d, got %d, '%s' left)\n",ln,num,n,f);
162#endif 160#endif
163 er=2; 161 er=2;
164 goto err; 162 goto err;
@@ -191,10 +189,7 @@ err:
191 return(ret); 189 return(ret);
192 } 190 }
193 191
194char **TXT_DB_get_by_index(db,idx,value) 192char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value)
195TXT_DB *db;
196int idx;
197char **value;
198 { 193 {
199 char **ret; 194 char **ret;
200 LHASH *lh; 195 LHASH *lh;
@@ -215,12 +210,8 @@ char **value;
215 return(ret); 210 return(ret);
216 } 211 }
217 212
218int TXT_DB_create_index(db,field,qual,hash,cmp) 213int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(),
219TXT_DB *db; 214 unsigned long (*hash)(), int (*cmp)())
220int field;
221int (*qual)();
222unsigned long (*hash)();
223int (*cmp)();
224 { 215 {
225 LHASH *idx; 216 LHASH *idx;
226 char *r; 217 char *r;
@@ -256,9 +247,7 @@ int (*cmp)();
256 return(1); 247 return(1);
257 } 248 }
258 249
259long TXT_DB_write(out,db) 250long TXT_DB_write(BIO *out, TXT_DB *db)
260BIO *out;
261TXT_DB *db;
262 { 251 {
263 long i,j,n,nn,l,tot=0; 252 long i,j,n,nn,l,tot=0;
264 char *p,**pp,*f; 253 char *p,**pp,*f;
@@ -306,9 +295,7 @@ err:
306 return(ret); 295 return(ret);
307 } 296 }
308 297
309int TXT_DB_insert(db,row) 298int TXT_DB_insert(TXT_DB *db, char **row)
310TXT_DB *db;
311char **row;
312 { 299 {
313 int i; 300 int i;
314 char **r; 301 char **r;
@@ -350,12 +337,14 @@ err:
350 return(0); 337 return(0);
351 } 338 }
352 339
353void TXT_DB_free(db) 340void TXT_DB_free(TXT_DB *db)
354TXT_DB *db;
355 { 341 {
356 int i,n; 342 int i,n;
357 char **p,*max; 343 char **p,*max;
358 344
345 if(db == NULL)
346 return;
347
359 if (db->index != NULL) 348 if (db->index != NULL)
360 { 349 {
361 for (i=db->num_fields-1; i>=0; i--) 350 for (i=db->num_fields-1; i>=0; i--)
diff --git a/src/lib/libcrypto/txt_db/txt_db.h b/src/lib/libcrypto/txt_db/txt_db.h
index aca6dae393..58b9de1353 100644
--- a/src/lib/libcrypto/txt_db/txt_db.h
+++ b/src/lib/libcrypto/txt_db/txt_db.h
@@ -63,8 +63,8 @@
63extern "C" { 63extern "C" {
64#endif 64#endif
65 65
66#include "stack.h" 66#include <openssl/stack.h>
67#include "lhash.h" 67#include <openssl/lhash.h>
68 68
69#define DB_ERROR_OK 0 69#define DB_ERROR_OK 0
70#define DB_ERROR_MALLOC 1 70#define DB_ERROR_MALLOC 1
@@ -85,7 +85,6 @@ typedef struct txt_db_st
85 char **arg_row; 85 char **arg_row;
86 } TXT_DB; 86 } TXT_DB;
87 87
88#ifndef NOPROTO
89#ifdef HEADER_BIO_H 88#ifdef HEADER_BIO_H
90TXT_DB *TXT_DB_read(BIO *in, int num); 89TXT_DB *TXT_DB_read(BIO *in, int num);
91long TXT_DB_write(BIO *out, TXT_DB *db); 90long TXT_DB_write(BIO *out, TXT_DB *db);
@@ -99,17 +98,6 @@ void TXT_DB_free(TXT_DB *db);
99char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value); 98char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value);
100int TXT_DB_insert(TXT_DB *db,char **value); 99int TXT_DB_insert(TXT_DB *db,char **value);
101 100
102#else
103
104TXT_DB *TXT_DB_read();
105long TXT_DB_write();
106int TXT_DB_create_index();
107void TXT_DB_free();
108char **TXT_DB_get_by_index();
109int TXT_DB_insert();
110
111#endif
112
113#ifdef __cplusplus 101#ifdef __cplusplus
114} 102}
115#endif 103#endif