diff options
Diffstat (limited to 'src/lib/libcrypto/bio')
-rw-r--r-- | src/lib/libcrypto/bio/Makefile | 221 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/Makefile.ssl | 216 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/b_dump.c | 75 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/b_print.c | 25 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/b_sock.c | 60 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bf_nbio.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bio.h | 133 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bio_err.c | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bio_lcl.h | 28 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bio_lib.c | 60 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_acpt.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_conn.c | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_fd.c | 30 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_file.c | 109 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_log.c | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_rtcp.c | 294 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_sock.c | 7 |
17 files changed, 880 insertions, 408 deletions
diff --git a/src/lib/libcrypto/bio/Makefile b/src/lib/libcrypto/bio/Makefile new file mode 100644 index 0000000000..1ef6c2fb9f --- /dev/null +++ b/src/lib/libcrypto/bio/Makefile | |||
@@ -0,0 +1,221 @@ | |||
1 | # | ||
2 | # OpenSSL/crypto/bio/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= bio | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
9 | CFLAG=-g | ||
10 | MAKEFILE= Makefile | ||
11 | AR= ar r | ||
12 | |||
13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
14 | |||
15 | GENERAL=Makefile | ||
16 | TEST= | ||
17 | APPS= | ||
18 | |||
19 | LIB=$(TOP)/libcrypto.a | ||
20 | LIBSRC= bio_lib.c bio_cb.c bio_err.c \ | ||
21 | bss_mem.c bss_null.c bss_fd.c \ | ||
22 | bss_file.c bss_sock.c bss_conn.c \ | ||
23 | bf_null.c bf_buff.c b_print.c b_dump.c \ | ||
24 | b_sock.c bss_acpt.c bf_nbio.c bss_log.c bss_bio.c \ | ||
25 | bss_dgram.c | ||
26 | # bf_lbuf.c | ||
27 | LIBOBJ= bio_lib.o bio_cb.o bio_err.o \ | ||
28 | bss_mem.o bss_null.o bss_fd.o \ | ||
29 | bss_file.o bss_sock.o bss_conn.o \ | ||
30 | bf_null.o bf_buff.o b_print.o b_dump.o \ | ||
31 | b_sock.o bss_acpt.o bf_nbio.o bss_log.o bss_bio.o \ | ||
32 | bss_dgram.o | ||
33 | # bf_lbuf.o | ||
34 | |||
35 | SRC= $(LIBSRC) | ||
36 | |||
37 | EXHEADER= bio.h | ||
38 | HEADER= bio_lcl.h $(EXHEADER) | ||
39 | |||
40 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
41 | |||
42 | top: | ||
43 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
44 | |||
45 | all: lib | ||
46 | |||
47 | lib: $(LIBOBJ) | ||
48 | $(AR) $(LIB) $(LIBOBJ) | ||
49 | $(RANLIB) $(LIB) || echo Never mind. | ||
50 | @touch lib | ||
51 | |||
52 | files: | ||
53 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
54 | |||
55 | links: | ||
56 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
57 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
58 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
59 | |||
60 | install: | ||
61 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
62 | @headerlist="$(EXHEADER)"; for i in $$headerlist; \ | ||
63 | do \ | ||
64 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
65 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
66 | done; | ||
67 | |||
68 | tags: | ||
69 | ctags $(SRC) | ||
70 | |||
71 | tests: | ||
72 | |||
73 | lint: | ||
74 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
75 | |||
76 | depend: | ||
77 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
78 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
79 | |||
80 | dclean: | ||
81 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
82 | mv -f Makefile.new $(MAKEFILE) | ||
83 | |||
84 | clean: | ||
85 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
86 | |||
87 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
88 | |||
89 | b_dump.o: ../../e_os.h ../../include/openssl/bio.h | ||
90 | b_dump.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
91 | b_dump.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
92 | b_dump.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
93 | b_dump.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
94 | b_dump.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
95 | b_dump.o: ../../include/openssl/symhacks.h ../cryptlib.h b_dump.c bio_lcl.h | ||
96 | b_print.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
97 | b_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
98 | b_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
99 | b_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
100 | b_print.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
101 | b_print.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
102 | b_print.o: ../../include/openssl/symhacks.h ../cryptlib.h b_print.c | ||
103 | b_sock.o: ../../e_os.h ../../include/openssl/bio.h | ||
104 | b_sock.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
105 | b_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
106 | b_sock.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
107 | b_sock.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
108 | b_sock.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
109 | b_sock.o: ../../include/openssl/symhacks.h ../cryptlib.h b_sock.c | ||
110 | bf_buff.o: ../../e_os.h ../../include/openssl/bio.h | ||
111 | bf_buff.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
112 | bf_buff.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
113 | bf_buff.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
114 | bf_buff.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
115 | bf_buff.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
116 | bf_buff.o: ../../include/openssl/symhacks.h ../cryptlib.h bf_buff.c | ||
117 | bf_nbio.o: ../../e_os.h ../../include/openssl/bio.h | ||
118 | bf_nbio.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
119 | bf_nbio.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
120 | bf_nbio.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
121 | bf_nbio.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
122 | bf_nbio.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
123 | bf_nbio.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
124 | bf_nbio.o: ../cryptlib.h bf_nbio.c | ||
125 | bf_null.o: ../../e_os.h ../../include/openssl/bio.h | ||
126 | bf_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
127 | bf_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
128 | bf_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
129 | bf_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
130 | bf_null.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
131 | bf_null.o: ../../include/openssl/symhacks.h ../cryptlib.h bf_null.c | ||
132 | bio_cb.o: ../../e_os.h ../../include/openssl/bio.h | ||
133 | bio_cb.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
134 | bio_cb.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
135 | bio_cb.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
136 | bio_cb.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
137 | bio_cb.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
138 | bio_cb.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_cb.c | ||
139 | bio_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
140 | bio_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
141 | bio_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
142 | bio_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
143 | bio_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
144 | bio_err.o: ../../include/openssl/symhacks.h bio_err.c | ||
145 | bio_lib.o: ../../e_os.h ../../include/openssl/bio.h | ||
146 | bio_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
147 | bio_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
148 | bio_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
149 | bio_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
150 | bio_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
151 | bio_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_lib.c | ||
152 | bss_acpt.o: ../../e_os.h ../../include/openssl/bio.h | ||
153 | bss_acpt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
154 | bss_acpt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
155 | bss_acpt.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
156 | bss_acpt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
157 | bss_acpt.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
158 | bss_acpt.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_acpt.c | ||
159 | bss_bio.o: ../../e_os.h ../../include/openssl/bio.h | ||
160 | bss_bio.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
161 | bss_bio.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
162 | bss_bio.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
163 | bss_bio.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
164 | bss_bio.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
165 | bss_bio.o: bss_bio.c | ||
166 | bss_conn.o: ../../e_os.h ../../include/openssl/bio.h | ||
167 | bss_conn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
168 | bss_conn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
169 | bss_conn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
170 | bss_conn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
171 | bss_conn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
172 | bss_conn.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_conn.c | ||
173 | bss_dgram.o: ../../e_os.h ../../include/openssl/bio.h | ||
174 | bss_dgram.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
175 | bss_dgram.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
176 | bss_dgram.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
177 | bss_dgram.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
178 | bss_dgram.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
179 | bss_dgram.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_dgram.c | ||
180 | bss_fd.o: ../../e_os.h ../../include/openssl/bio.h | ||
181 | bss_fd.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
182 | bss_fd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
183 | bss_fd.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
184 | bss_fd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
185 | bss_fd.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
186 | bss_fd.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_lcl.h bss_fd.c | ||
187 | bss_file.o: ../../e_os.h ../../include/openssl/bio.h | ||
188 | bss_file.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
189 | bss_file.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
190 | bss_file.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
191 | bss_file.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
192 | bss_file.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
193 | bss_file.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_lcl.h bss_file.c | ||
194 | bss_log.o: ../../e_os.h ../../include/openssl/bio.h | ||
195 | bss_log.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
196 | bss_log.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
197 | bss_log.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
198 | bss_log.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
199 | bss_log.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
200 | bss_log.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_log.c | ||
201 | bss_mem.o: ../../e_os.h ../../include/openssl/bio.h | ||
202 | bss_mem.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
203 | bss_mem.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
204 | bss_mem.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
205 | bss_mem.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
206 | bss_mem.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
207 | bss_mem.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_mem.c | ||
208 | bss_null.o: ../../e_os.h ../../include/openssl/bio.h | ||
209 | bss_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
210 | bss_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
211 | bss_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
212 | bss_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
213 | bss_null.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
214 | bss_null.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_null.c | ||
215 | bss_sock.o: ../../e_os.h ../../include/openssl/bio.h | ||
216 | bss_sock.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
217 | bss_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
218 | bss_sock.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
219 | bss_sock.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
220 | bss_sock.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
221 | bss_sock.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_sock.c | ||
diff --git a/src/lib/libcrypto/bio/Makefile.ssl b/src/lib/libcrypto/bio/Makefile.ssl new file mode 100644 index 0000000000..d0b9e297b0 --- /dev/null +++ b/src/lib/libcrypto/bio/Makefile.ssl | |||
@@ -0,0 +1,216 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/bio/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= bio | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALL_PREFIX= | ||
11 | OPENSSLDIR= /usr/local/ssl | ||
12 | INSTALLTOP=/usr/local/ssl | ||
13 | MAKE= make -f Makefile.ssl | ||
14 | MAKEDEPPROG= makedepend | ||
15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
16 | MAKEFILE= Makefile.ssl | ||
17 | AR= ar r | ||
18 | |||
19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
20 | |||
21 | GENERAL=Makefile | ||
22 | TEST= | ||
23 | APPS= | ||
24 | |||
25 | LIB=$(TOP)/libcrypto.a | ||
26 | LIBSRC= bio_lib.c bio_cb.c bio_err.c \ | ||
27 | bss_mem.c bss_null.c bss_fd.c \ | ||
28 | bss_file.c bss_sock.c bss_conn.c \ | ||
29 | bf_null.c bf_buff.c b_print.c b_dump.c \ | ||
30 | b_sock.c bss_acpt.c bf_nbio.c bss_log.c bss_bio.c | ||
31 | # bf_lbuf.c | ||
32 | LIBOBJ= bio_lib.o bio_cb.o bio_err.o \ | ||
33 | bss_mem.o bss_null.o bss_fd.o \ | ||
34 | bss_file.o bss_sock.o bss_conn.o \ | ||
35 | bf_null.o bf_buff.o b_print.o b_dump.o \ | ||
36 | b_sock.o bss_acpt.o bf_nbio.o bss_log.o bss_bio.o | ||
37 | # bf_lbuf.o | ||
38 | |||
39 | SRC= $(LIBSRC) | ||
40 | |||
41 | EXHEADER= bio.h | ||
42 | HEADER= bss_file.c $(EXHEADER) | ||
43 | |||
44 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
45 | |||
46 | top: | ||
47 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
48 | |||
49 | all: lib | ||
50 | |||
51 | lib: $(LIBOBJ) | ||
52 | $(AR) $(LIB) $(LIBOBJ) | ||
53 | $(RANLIB) $(LIB) || echo Never mind. | ||
54 | @touch lib | ||
55 | |||
56 | files: | ||
57 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
58 | |||
59 | links: | ||
60 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
61 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
62 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
63 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
64 | |||
65 | install: | ||
66 | @for i in $(EXHEADER); \ | ||
67 | do \ | ||
68 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
69 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
70 | done; | ||
71 | |||
72 | tags: | ||
73 | ctags $(SRC) | ||
74 | |||
75 | tests: | ||
76 | |||
77 | lint: | ||
78 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
79 | |||
80 | depend: | ||
81 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
82 | |||
83 | dclean: | ||
84 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
85 | mv -f Makefile.new $(MAKEFILE) | ||
86 | |||
87 | clean: | ||
88 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
89 | |||
90 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
91 | |||
92 | b_dump.o: ../../e_os.h ../../include/openssl/bio.h | ||
93 | b_dump.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
94 | b_dump.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
95 | b_dump.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
96 | b_dump.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
97 | b_dump.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
98 | b_dump.o: ../cryptlib.h b_dump.c | ||
99 | b_print.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
100 | b_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
101 | b_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
102 | b_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
103 | b_print.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
104 | b_print.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
105 | b_print.o: ../cryptlib.h b_print.c | ||
106 | b_sock.o: ../../e_os.h ../../include/openssl/bio.h | ||
107 | b_sock.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
108 | b_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
109 | b_sock.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
110 | b_sock.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
111 | b_sock.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
112 | b_sock.o: ../cryptlib.h b_sock.c | ||
113 | bf_buff.o: ../../e_os.h ../../include/openssl/bio.h | ||
114 | bf_buff.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
115 | bf_buff.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
116 | bf_buff.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
117 | bf_buff.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
118 | bf_buff.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
119 | bf_buff.o: ../cryptlib.h bf_buff.c | ||
120 | bf_nbio.o: ../../e_os.h ../../include/openssl/bio.h | ||
121 | bf_nbio.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
122 | bf_nbio.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
123 | bf_nbio.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
124 | bf_nbio.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
125 | bf_nbio.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
126 | bf_nbio.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
127 | bf_nbio.o: ../cryptlib.h bf_nbio.c | ||
128 | bf_null.o: ../../e_os.h ../../include/openssl/bio.h | ||
129 | bf_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
130 | bf_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
131 | bf_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
132 | bf_null.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
133 | bf_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
134 | bf_null.o: ../cryptlib.h bf_null.c | ||
135 | bio_cb.o: ../../e_os.h ../../include/openssl/bio.h | ||
136 | bio_cb.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
137 | bio_cb.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
138 | bio_cb.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
139 | bio_cb.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
140 | bio_cb.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
141 | bio_cb.o: ../cryptlib.h bio_cb.c | ||
142 | bio_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
143 | bio_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
144 | bio_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
145 | bio_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
146 | bio_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
147 | bio_err.o: bio_err.c | ||
148 | bio_lib.o: ../../e_os.h ../../include/openssl/bio.h | ||
149 | bio_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
150 | bio_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
151 | bio_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
152 | bio_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
153 | bio_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
154 | bio_lib.o: ../cryptlib.h bio_lib.c | ||
155 | bss_acpt.o: ../../e_os.h ../../include/openssl/bio.h | ||
156 | bss_acpt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
157 | bss_acpt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
158 | bss_acpt.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
159 | bss_acpt.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
160 | bss_acpt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
161 | bss_acpt.o: ../cryptlib.h bss_acpt.c | ||
162 | bss_bio.o: ../../e_os.h ../../include/openssl/bio.h | ||
163 | bss_bio.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
164 | bss_bio.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
165 | bss_bio.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
166 | bss_bio.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
167 | bss_bio.o: ../../include/openssl/symhacks.h bss_bio.c | ||
168 | bss_conn.o: ../../e_os.h ../../include/openssl/bio.h | ||
169 | bss_conn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
170 | bss_conn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
171 | bss_conn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
172 | bss_conn.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
173 | bss_conn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
174 | bss_conn.o: ../cryptlib.h bss_conn.c | ||
175 | bss_fd.o: ../../e_os.h ../../include/openssl/bio.h | ||
176 | bss_fd.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
177 | bss_fd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
178 | bss_fd.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
179 | bss_fd.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
180 | bss_fd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
181 | bss_fd.o: ../cryptlib.h bss_fd.c | ||
182 | bss_file.o: ../../e_os.h ../../include/openssl/bio.h | ||
183 | bss_file.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
184 | bss_file.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
185 | bss_file.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
186 | bss_file.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
187 | bss_file.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
188 | bss_file.o: ../cryptlib.h bss_file.c | ||
189 | bss_log.o: ../../e_os.h ../../include/openssl/bio.h | ||
190 | bss_log.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
191 | bss_log.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
192 | bss_log.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
193 | bss_log.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
194 | bss_log.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
195 | bss_log.o: ../cryptlib.h bss_log.c | ||
196 | bss_mem.o: ../../e_os.h ../../include/openssl/bio.h | ||
197 | bss_mem.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
198 | bss_mem.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
199 | bss_mem.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
200 | bss_mem.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
201 | bss_mem.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
202 | bss_mem.o: ../cryptlib.h bss_mem.c | ||
203 | bss_null.o: ../../e_os.h ../../include/openssl/bio.h | ||
204 | bss_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
205 | bss_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
206 | bss_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
207 | bss_null.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
208 | bss_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
209 | bss_null.o: ../cryptlib.h bss_null.c | ||
210 | bss_sock.o: ../../e_os.h ../../include/openssl/bio.h | ||
211 | bss_sock.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
212 | bss_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
213 | bss_sock.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
214 | bss_sock.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
215 | bss_sock.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
216 | bss_sock.o: ../cryptlib.h bss_sock.c | ||
diff --git a/src/lib/libcrypto/bio/b_dump.c b/src/lib/libcrypto/bio/b_dump.c index c80ecc4295..f671e722fa 100644 --- a/src/lib/libcrypto/bio/b_dump.c +++ b/src/lib/libcrypto/bio/b_dump.c | |||
@@ -62,32 +62,30 @@ | |||
62 | 62 | ||
63 | #include <stdio.h> | 63 | #include <stdio.h> |
64 | #include "cryptlib.h" | 64 | #include "cryptlib.h" |
65 | #include "bio_lcl.h" | 65 | #include <openssl/bio.h> |
66 | 66 | ||
67 | #define TRUNCATE | 67 | #define TRUNCATE |
68 | #define DUMP_WIDTH 16 | 68 | #define DUMP_WIDTH 16 |
69 | #define DUMP_WIDTH_LESS_INDENT(i) (DUMP_WIDTH-((i-(i>6?6:i)+3)/4)) | 69 | #define DUMP_WIDTH_LESS_INDENT(i) (DUMP_WIDTH-((i-(i>6?6:i)+3)/4)) |
70 | 70 | ||
71 | int BIO_dump_cb(int (*cb)(const void *data, size_t len, void *u), | 71 | int BIO_dump(BIO *bio, const char *s, int len) |
72 | void *u, const char *s, int len) | ||
73 | { | 72 | { |
74 | return BIO_dump_indent_cb(cb, u, s, len, 0); | 73 | return BIO_dump_indent(bio, s, len, 0); |
75 | } | 74 | } |
76 | 75 | ||
77 | int BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), | 76 | int BIO_dump_indent(BIO *bio, const char *s, int len, int indent) |
78 | void *u, const char *s, int len, int indent) | ||
79 | { | 77 | { |
80 | int ret=0; | 78 | int ret=0; |
81 | char buf[288+1],tmp[20],str[128+1]; | 79 | char buf[288+1],tmp[20],str[128+1]; |
82 | int i,j,rows,trc; | 80 | int i,j,rows,trunc; |
83 | unsigned char ch; | 81 | unsigned char ch; |
84 | int dump_width; | 82 | int dump_width; |
85 | 83 | ||
86 | trc=0; | 84 | trunc=0; |
87 | 85 | ||
88 | #ifdef TRUNCATE | 86 | #ifdef TRUNCATE |
89 | for(; (len > 0) && ((s[len-1] == ' ') || (s[len-1] == '\0')); len--) | 87 | for(; (len > 0) && ((s[len-1] == ' ') || (s[len-1] == '\0')); len--) |
90 | trc++; | 88 | trunc++; |
91 | #endif | 89 | #endif |
92 | 90 | ||
93 | if (indent < 0) | 91 | if (indent < 0) |
@@ -98,7 +96,7 @@ int BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), | |||
98 | memset(str,' ',indent); | 96 | memset(str,' ',indent); |
99 | } | 97 | } |
100 | str[indent]='\0'; | 98 | str[indent]='\0'; |
101 | 99 | ||
102 | dump_width=DUMP_WIDTH_LESS_INDENT(indent); | 100 | dump_width=DUMP_WIDTH_LESS_INDENT(indent); |
103 | rows=(len/dump_width); | 101 | rows=(len/dump_width); |
104 | if ((rows*dump_width)<len) | 102 | if ((rows*dump_width)<len) |
@@ -119,7 +117,7 @@ int BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), | |||
119 | { | 117 | { |
120 | ch=((unsigned char)*(s+i*dump_width+j)) & 0xff; | 118 | ch=((unsigned char)*(s+i*dump_width+j)) & 0xff; |
121 | BIO_snprintf(tmp,sizeof tmp,"%02x%c",ch, | 119 | BIO_snprintf(tmp,sizeof tmp,"%02x%c",ch, |
122 | j==7?'-':' '); | 120 | j==7?'-':' '); |
123 | BUF_strlcat(buf,tmp,sizeof buf); | 121 | BUF_strlcat(buf,tmp,sizeof buf); |
124 | } | 122 | } |
125 | } | 123 | } |
@@ -131,57 +129,28 @@ int BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), | |||
131 | ch=((unsigned char)*(s+i*dump_width+j)) & 0xff; | 129 | ch=((unsigned char)*(s+i*dump_width+j)) & 0xff; |
132 | #ifndef CHARSET_EBCDIC | 130 | #ifndef CHARSET_EBCDIC |
133 | BIO_snprintf(tmp,sizeof tmp,"%c", | 131 | BIO_snprintf(tmp,sizeof tmp,"%c", |
134 | ((ch>=' ')&&(ch<='~'))?ch:'.'); | 132 | ((ch>=' ')&&(ch<='~'))?ch:'.'); |
135 | #else | 133 | #else |
136 | BIO_snprintf(tmp,sizeof tmp,"%c", | 134 | BIO_snprintf(tmp,sizeof tmp,"%c", |
137 | ((ch>=os_toascii[' '])&&(ch<=os_toascii['~'])) | 135 | ((ch>=os_toascii[' '])&&(ch<=os_toascii['~'])) |
138 | ? os_toebcdic[ch] | 136 | ? os_toebcdic[ch] |
139 | : '.'); | 137 | : '.'); |
140 | #endif | 138 | #endif |
141 | BUF_strlcat(buf,tmp,sizeof buf); | 139 | BUF_strlcat(buf,tmp,sizeof buf); |
142 | } | 140 | } |
143 | BUF_strlcat(buf,"\n",sizeof buf); | 141 | BUF_strlcat(buf,"\n",sizeof buf); |
144 | /* if this is the last call then update the ddt_dump thing so | 142 | /* if this is the last call then update the ddt_dump thing so that |
145 | * that we will move the selection point in the debug window | 143 | * we will move the selection point in the debug window |
146 | */ | 144 | */ |
147 | ret+=cb((void *)buf,strlen(buf),u); | 145 | ret+=BIO_write(bio,(char *)buf,strlen(buf)); |
148 | } | 146 | } |
149 | #ifdef TRUNCATE | 147 | #ifdef TRUNCATE |
150 | if (trc > 0) | 148 | if (trunc > 0) |
151 | { | 149 | { |
152 | BIO_snprintf(buf,sizeof buf,"%s%04x - <SPACES/NULS>\n",str, | 150 | BIO_snprintf(buf,sizeof buf,"%s%04x - <SPACES/NULS>\n",str, |
153 | len+trc); | 151 | len+trunc); |
154 | ret+=cb((void *)buf,strlen(buf),u); | 152 | ret+=BIO_write(bio,(char *)buf,strlen(buf)); |
155 | } | 153 | } |
156 | #endif | 154 | #endif |
157 | return(ret); | 155 | return(ret); |
158 | } | 156 | } |
159 | |||
160 | #ifndef OPENSSL_NO_FP_API | ||
161 | static int write_fp(const void *data, size_t len, void *fp) | ||
162 | { | ||
163 | return UP_fwrite(data, len, 1, fp); | ||
164 | } | ||
165 | int BIO_dump_fp(FILE *fp, const char *s, int len) | ||
166 | { | ||
167 | return BIO_dump_cb(write_fp, fp, s, len); | ||
168 | } | ||
169 | int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent) | ||
170 | { | ||
171 | return BIO_dump_indent_cb(write_fp, fp, s, len, indent); | ||
172 | } | ||
173 | #endif | ||
174 | |||
175 | static int write_bio(const void *data, size_t len, void *bp) | ||
176 | { | ||
177 | return BIO_write((BIO *)bp, (const char *)data, len); | ||
178 | } | ||
179 | int BIO_dump(BIO *bp, const char *s, int len) | ||
180 | { | ||
181 | return BIO_dump_cb(write_bio, bp, s, len); | ||
182 | } | ||
183 | int BIO_dump_indent(BIO *bp, const char *s, int len, int indent) | ||
184 | { | ||
185 | return BIO_dump_indent_cb(write_bio, bp, s, len, indent); | ||
186 | } | ||
187 | |||
diff --git a/src/lib/libcrypto/bio/b_print.c b/src/lib/libcrypto/bio/b_print.c index 3a87b0ec0b..f2bd91d5a0 100644 --- a/src/lib/libcrypto/bio/b_print.c +++ b/src/lib/libcrypto/bio/b_print.c | |||
@@ -79,7 +79,7 @@ | |||
79 | #include <openssl/bn.h> /* To get BN_LLONG properly defined */ | 79 | #include <openssl/bn.h> /* To get BN_LLONG properly defined */ |
80 | #include <openssl/bio.h> | 80 | #include <openssl/bio.h> |
81 | 81 | ||
82 | #if defined(BN_LLONG) || defined(SIXTY_FOUR_BIT) | 82 | #ifdef BN_LLONG |
83 | # ifndef HAVE_LONG_LONG | 83 | # ifndef HAVE_LONG_LONG |
84 | # define HAVE_LONG_LONG 1 | 84 | # define HAVE_LONG_LONG 1 |
85 | # endif | 85 | # endif |
@@ -117,7 +117,7 @@ | |||
117 | 117 | ||
118 | #if HAVE_LONG_LONG | 118 | #if HAVE_LONG_LONG |
119 | # if defined(OPENSSL_SYS_WIN32) && !defined(__GNUC__) | 119 | # if defined(OPENSSL_SYS_WIN32) && !defined(__GNUC__) |
120 | # define LLONG __int64 | 120 | # define LLONG _int64 |
121 | # else | 121 | # else |
122 | # define LLONG long long | 122 | # define LLONG long long |
123 | # endif | 123 | # endif |
@@ -482,7 +482,7 @@ fmtint( | |||
482 | int flags) | 482 | int flags) |
483 | { | 483 | { |
484 | int signvalue = 0; | 484 | int signvalue = 0; |
485 | const char *prefix = ""; | 485 | char *prefix = ""; |
486 | unsigned LLONG uvalue; | 486 | unsigned LLONG uvalue; |
487 | char convert[DECIMAL_SIZE(value)+3]; | 487 | char convert[DECIMAL_SIZE(value)+3]; |
488 | int place = 0; | 488 | int place = 0; |
@@ -513,8 +513,8 @@ fmtint( | |||
513 | (caps ? "0123456789ABCDEF" : "0123456789abcdef") | 513 | (caps ? "0123456789ABCDEF" : "0123456789abcdef") |
514 | [uvalue % (unsigned) base]; | 514 | [uvalue % (unsigned) base]; |
515 | uvalue = (uvalue / (unsigned) base); | 515 | uvalue = (uvalue / (unsigned) base); |
516 | } while (uvalue && (place < (int)sizeof(convert))); | 516 | } while (uvalue && (place < sizeof convert)); |
517 | if (place == sizeof(convert)) | 517 | if (place == sizeof convert) |
518 | place--; | 518 | place--; |
519 | convert[place] = 0; | 519 | convert[place] = 0; |
520 | 520 | ||
@@ -619,7 +619,6 @@ fmtfp( | |||
619 | int caps = 0; | 619 | int caps = 0; |
620 | long intpart; | 620 | long intpart; |
621 | long fracpart; | 621 | long fracpart; |
622 | long max10; | ||
623 | 622 | ||
624 | if (max < 0) | 623 | if (max < 0) |
625 | max = 6; | 624 | max = 6; |
@@ -640,12 +639,11 @@ fmtfp( | |||
640 | 639 | ||
641 | /* we "cheat" by converting the fractional part to integer by | 640 | /* we "cheat" by converting the fractional part to integer by |
642 | multiplying by a factor of 10 */ | 641 | multiplying by a factor of 10 */ |
643 | max10 = roundv(pow_10(max)); | 642 | fracpart = roundv((pow_10(max)) * (ufvalue - intpart)); |
644 | fracpart = roundv(pow_10(max) * (ufvalue - intpart)); | ||
645 | 643 | ||
646 | if (fracpart >= max10) { | 644 | if (fracpart >= (long)pow_10(max)) { |
647 | intpart++; | 645 | intpart++; |
648 | fracpart -= max10; | 646 | fracpart -= (long)pow_10(max); |
649 | } | 647 | } |
650 | 648 | ||
651 | /* convert integer part */ | 649 | /* convert integer part */ |
@@ -654,7 +652,7 @@ fmtfp( | |||
654 | (caps ? "0123456789ABCDEF" | 652 | (caps ? "0123456789ABCDEF" |
655 | : "0123456789abcdef")[intpart % 10]; | 653 | : "0123456789abcdef")[intpart % 10]; |
656 | intpart = (intpart / 10); | 654 | intpart = (intpart / 10); |
657 | } while (intpart && (iplace < (int)sizeof(iconvert))); | 655 | } while (intpart && (iplace < sizeof iconvert)); |
658 | if (iplace == sizeof iconvert) | 656 | if (iplace == sizeof iconvert) |
659 | iplace--; | 657 | iplace--; |
660 | iconvert[iplace] = 0; | 658 | iconvert[iplace] = 0; |
@@ -808,6 +806,7 @@ int BIO_vprintf (BIO *bio, const char *format, va_list args) | |||
808 | } | 806 | } |
809 | 807 | ||
810 | /* As snprintf is not available everywhere, we provide our own implementation. | 808 | /* As snprintf is not available everywhere, we provide our own implementation. |
809 | * In case of overflow or error, this returns -1. | ||
811 | * This function has nothing to do with BIOs, but it's closely related | 810 | * This function has nothing to do with BIOs, but it's closely related |
812 | * to BIO_printf, and we need *some* name prefix ... | 811 | * to BIO_printf, and we need *some* name prefix ... |
813 | * (XXX the function should be renamed, but to what?) */ | 812 | * (XXX the function should be renamed, but to what?) */ |
@@ -832,10 +831,10 @@ int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) | |||
832 | _dopr(&buf, NULL, &n, &retlen, &truncated, format, args); | 831 | _dopr(&buf, NULL, &n, &retlen, &truncated, format, args); |
833 | 832 | ||
834 | if (truncated) | 833 | if (truncated) |
835 | /* In case of truncation, return -1 like traditional snprintf. | 834 | /* In case of truncation, return -1 unlike traditional snprintf. |
836 | * (Current drafts for ISO/IEC 9899 say snprintf should return | 835 | * (Current drafts for ISO/IEC 9899 say snprintf should return |
837 | * the number of characters that would have been written, | 836 | * the number of characters that would have been written, |
838 | * had the buffer been large enough.) */ | 837 | * had the buffer been large enough, as it did historically.) */ |
839 | return -1; | 838 | return -1; |
840 | else | 839 | else |
841 | return (retlen <= INT_MAX) ? (int)retlen : -1; | 840 | return (retlen <= INT_MAX) ? (int)retlen : -1; |
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c index ead477d8a2..c851298d1e 100644 --- a/src/lib/libcrypto/bio/b_sock.c +++ b/src/lib/libcrypto/bio/b_sock.c | |||
@@ -56,21 +56,14 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #ifndef OPENSSL_NO_SOCK | ||
60 | |||
59 | #include <stdio.h> | 61 | #include <stdio.h> |
60 | #include <stdlib.h> | 62 | #include <stdlib.h> |
61 | #include <errno.h> | 63 | #include <errno.h> |
62 | #define USE_SOCKETS | 64 | #define USE_SOCKETS |
63 | #include "cryptlib.h" | 65 | #include "cryptlib.h" |
64 | #include <openssl/bio.h> | 66 | #include <openssl/bio.h> |
65 | #if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_BSDSOCK) | ||
66 | #include <netdb.h> | ||
67 | #if defined(NETWARE_CLIB) | ||
68 | #include <sys/ioctl.h> | ||
69 | NETDB_DEFINE_CONTEXT | ||
70 | #endif | ||
71 | #endif | ||
72 | |||
73 | #ifndef OPENSSL_NO_SOCK | ||
74 | 67 | ||
75 | #ifdef OPENSSL_SYS_WIN16 | 68 | #ifdef OPENSSL_SYS_WIN16 |
76 | #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ | 69 | #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ |
@@ -86,7 +79,7 @@ NETDB_DEFINE_CONTEXT | |||
86 | #define MAX_LISTEN 32 | 79 | #define MAX_LISTEN 32 |
87 | #endif | 80 | #endif |
88 | 81 | ||
89 | #if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)) | 82 | #ifdef OPENSSL_SYS_WINDOWS |
90 | static int wsa_init_done=0; | 83 | static int wsa_init_done=0; |
91 | #endif | 84 | #endif |
92 | 85 | ||
@@ -182,11 +175,11 @@ int BIO_get_port(const char *str, unsigned short *port_ptr) | |||
182 | /* Note: under VMS with SOCKETSHR, it seems like the first | 175 | /* Note: under VMS with SOCKETSHR, it seems like the first |
183 | * parameter is 'char *', instead of 'const char *' | 176 | * parameter is 'char *', instead of 'const char *' |
184 | */ | 177 | */ |
178 | s=getservbyname( | ||
185 | #ifndef CONST_STRICT | 179 | #ifndef CONST_STRICT |
186 | s=getservbyname((char *)str,"tcp"); | 180 | (char *) |
187 | #else | ||
188 | s=getservbyname(str,"tcp"); | ||
189 | #endif | 181 | #endif |
182 | str,"tcp"); | ||
190 | if(s != NULL) | 183 | if(s != NULL) |
191 | *port_ptr=ntohs((unsigned short)s->s_port); | 184 | *port_ptr=ntohs((unsigned short)s->s_port); |
192 | CRYPTO_w_unlock(CRYPTO_LOCK_GETSERVBYNAME); | 185 | CRYPTO_w_unlock(CRYPTO_LOCK_GETSERVBYNAME); |
@@ -364,11 +357,7 @@ struct hostent *BIO_gethostbyname(const char *name) | |||
364 | #if 1 | 357 | #if 1 |
365 | /* Caching gethostbyname() results forever is wrong, | 358 | /* Caching gethostbyname() results forever is wrong, |
366 | * so we have to let the true gethostbyname() worry about this */ | 359 | * so we have to let the true gethostbyname() worry about this */ |
367 | #if (defined(NETWARE_BSDSOCK) && !defined(__NOVELL_LIBC__)) | ||
368 | return gethostbyname((char*)name); | ||
369 | #else | ||
370 | return gethostbyname(name); | 360 | return gethostbyname(name); |
371 | #endif | ||
372 | #else | 361 | #else |
373 | struct hostent *ret; | 362 | struct hostent *ret; |
374 | int i,lowi=0,j; | 363 | int i,lowi=0,j; |
@@ -408,11 +397,11 @@ struct hostent *BIO_gethostbyname(const char *name) | |||
408 | /* Note: under VMS with SOCKETSHR, it seems like the first | 397 | /* Note: under VMS with SOCKETSHR, it seems like the first |
409 | * parameter is 'char *', instead of 'const char *' | 398 | * parameter is 'char *', instead of 'const char *' |
410 | */ | 399 | */ |
400 | ret=gethostbyname( | ||
411 | # ifndef CONST_STRICT | 401 | # ifndef CONST_STRICT |
412 | ret=gethostbyname((char *)name); | 402 | (char *) |
413 | # else | ||
414 | ret=gethostbyname(name); | ||
415 | # endif | 403 | # endif |
404 | name); | ||
416 | 405 | ||
417 | if (ret == NULL) | 406 | if (ret == NULL) |
418 | goto end; | 407 | goto end; |
@@ -464,6 +453,9 @@ int BIO_sock_init(void) | |||
464 | { | 453 | { |
465 | int err; | 454 | int err; |
466 | 455 | ||
456 | #ifdef SIGINT | ||
457 | signal(SIGINT,(void (*)(int))BIO_sock_cleanup); | ||
458 | #endif | ||
467 | wsa_init_done=1; | 459 | wsa_init_done=1; |
468 | memset(&wsa_state,0,sizeof(wsa_state)); | 460 | memset(&wsa_state,0,sizeof(wsa_state)); |
469 | if (WSAStartup(0x0101,&wsa_state)!=0) | 461 | if (WSAStartup(0x0101,&wsa_state)!=0) |
@@ -481,26 +473,6 @@ int BIO_sock_init(void) | |||
481 | if (sock_init()) | 473 | if (sock_init()) |
482 | return (-1); | 474 | return (-1); |
483 | #endif | 475 | #endif |
484 | |||
485 | #if defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK) | ||
486 | WORD wVerReq; | ||
487 | WSADATA wsaData; | ||
488 | int err; | ||
489 | |||
490 | if (!wsa_init_done) | ||
491 | { | ||
492 | wsa_init_done=1; | ||
493 | wVerReq = MAKEWORD( 2, 0 ); | ||
494 | err = WSAStartup(wVerReq,&wsaData); | ||
495 | if (err != 0) | ||
496 | { | ||
497 | SYSerr(SYS_F_WSASTARTUP,err); | ||
498 | BIOerr(BIO_F_BIO_SOCK_INIT,BIO_R_WSASTARTUP); | ||
499 | return(-1); | ||
500 | } | ||
501 | } | ||
502 | #endif | ||
503 | |||
504 | return(1); | 476 | return(1); |
505 | } | 477 | } |
506 | 478 | ||
@@ -511,16 +483,10 @@ void BIO_sock_cleanup(void) | |||
511 | { | 483 | { |
512 | wsa_init_done=0; | 484 | wsa_init_done=0; |
513 | #ifndef OPENSSL_SYS_WINCE | 485 | #ifndef OPENSSL_SYS_WINCE |
514 | WSACancelBlockingCall(); /* Winsock 1.1 specific */ | 486 | WSACancelBlockingCall(); |
515 | #endif | 487 | #endif |
516 | WSACleanup(); | 488 | WSACleanup(); |
517 | } | 489 | } |
518 | #elif defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK) | ||
519 | if (wsa_init_done) | ||
520 | { | ||
521 | wsa_init_done=0; | ||
522 | WSACleanup(); | ||
523 | } | ||
524 | #endif | 490 | #endif |
525 | } | 491 | } |
526 | 492 | ||
diff --git a/src/lib/libcrypto/bio/bf_nbio.c b/src/lib/libcrypto/bio/bf_nbio.c index c72a23c2e1..1ce2bfacc0 100644 --- a/src/lib/libcrypto/bio/bf_nbio.c +++ b/src/lib/libcrypto/bio/bf_nbio.c | |||
@@ -127,7 +127,7 @@ static int nbiof_read(BIO *b, char *out, int outl) | |||
127 | { | 127 | { |
128 | NBIO_TEST *nt; | 128 | NBIO_TEST *nt; |
129 | int ret=0; | 129 | int ret=0; |
130 | #if 1 | 130 | #if 0 |
131 | int num; | 131 | int num; |
132 | unsigned char n; | 132 | unsigned char n; |
133 | #endif | 133 | #endif |
@@ -137,7 +137,7 @@ static int nbiof_read(BIO *b, char *out, int outl) | |||
137 | nt=(NBIO_TEST *)b->ptr; | 137 | nt=(NBIO_TEST *)b->ptr; |
138 | 138 | ||
139 | BIO_clear_retry_flags(b); | 139 | BIO_clear_retry_flags(b); |
140 | #if 1 | 140 | #if 0 |
141 | RAND_pseudo_bytes(&n,1); | 141 | RAND_pseudo_bytes(&n,1); |
142 | num=(n&0x07); | 142 | num=(n&0x07); |
143 | 143 | ||
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h index cecb6a7207..2eb703830f 100644 --- a/src/lib/libcrypto/bio/bio.h +++ b/src/lib/libcrypto/bio/bio.h | |||
@@ -59,14 +59,13 @@ | |||
59 | #ifndef HEADER_BIO_H | 59 | #ifndef HEADER_BIO_H |
60 | #define HEADER_BIO_H | 60 | #define HEADER_BIO_H |
61 | 61 | ||
62 | #include <openssl/e_os2.h> | ||
63 | |||
64 | #ifndef OPENSSL_NO_FP_API | 62 | #ifndef OPENSSL_NO_FP_API |
65 | # include <stdio.h> | 63 | # include <stdio.h> |
66 | #endif | 64 | #endif |
67 | #include <stdarg.h> | 65 | #include <stdarg.h> |
68 | 66 | ||
69 | #include <openssl/crypto.h> | 67 | #include <openssl/crypto.h> |
68 | #include <openssl/e_os2.h> | ||
70 | 69 | ||
71 | #ifdef __cplusplus | 70 | #ifdef __cplusplus |
72 | extern "C" { | 71 | extern "C" { |
@@ -94,8 +93,6 @@ extern "C" { | |||
94 | #define BIO_TYPE_BER (18|0x0200) /* BER -> bin filter */ | 93 | #define BIO_TYPE_BER (18|0x0200) /* BER -> bin filter */ |
95 | #define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ | 94 | #define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ |
96 | #define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */ | 95 | #define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */ |
97 | #define BIO_TYPE_DGRAM (21|0x0400|0x0100) | ||
98 | #define BIO_TYPE_COMP (23|0x0200) /* filter */ | ||
99 | 96 | ||
100 | #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ | 97 | #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ |
101 | #define BIO_TYPE_FILTER 0x0200 | 98 | #define BIO_TYPE_FILTER 0x0200 |
@@ -127,38 +124,6 @@ extern "C" { | |||
127 | 124 | ||
128 | #define BIO_CTRL_SET_FILENAME 30 /* BIO_s_file special */ | 125 | #define BIO_CTRL_SET_FILENAME 30 /* BIO_s_file special */ |
129 | 126 | ||
130 | /* dgram BIO stuff */ | ||
131 | #define BIO_CTRL_DGRAM_CONNECT 31 /* BIO dgram special */ | ||
132 | #define BIO_CTRL_DGRAM_SET_CONNECTED 32 /* allow for an externally | ||
133 | * connected socket to be | ||
134 | * passed in */ | ||
135 | #define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */ | ||
136 | #define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */ | ||
137 | #define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */ | ||
138 | #define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36 /* getsockopt, essentially */ | ||
139 | |||
140 | #define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37 /* flag whether the last */ | ||
141 | #define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38 /* I/O operation tiemd out */ | ||
142 | |||
143 | /* #ifdef IP_MTU_DISCOVER */ | ||
144 | #define BIO_CTRL_DGRAM_MTU_DISCOVER 39 /* set DF bit on egress packets */ | ||
145 | /* #endif */ | ||
146 | |||
147 | #define BIO_CTRL_DGRAM_QUERY_MTU 40 /* as kernel for current MTU */ | ||
148 | #define BIO_CTRL_DGRAM_GET_MTU 41 /* get cached value for MTU */ | ||
149 | #define BIO_CTRL_DGRAM_SET_MTU 42 /* set cached value for | ||
150 | * MTU. want to use this | ||
151 | * if asking the kernel | ||
152 | * fails */ | ||
153 | |||
154 | #define BIO_CTRL_DGRAM_MTU_EXCEEDED 43 /* check whether the MTU | ||
155 | * was exceed in the | ||
156 | * previous write | ||
157 | * operation */ | ||
158 | |||
159 | #define BIO_CTRL_DGRAM_SET_PEER 44 /* Destination for the data */ | ||
160 | |||
161 | |||
162 | /* modifiers */ | 127 | /* modifiers */ |
163 | #define BIO_FP_READ 0x02 | 128 | #define BIO_FP_READ 0x02 |
164 | #define BIO_FP_WRITE 0x04 | 129 | #define BIO_FP_WRITE 0x04 |
@@ -170,11 +135,6 @@ extern "C" { | |||
170 | #define BIO_FLAGS_IO_SPECIAL 0x04 | 135 | #define BIO_FLAGS_IO_SPECIAL 0x04 |
171 | #define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) | 136 | #define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) |
172 | #define BIO_FLAGS_SHOULD_RETRY 0x08 | 137 | #define BIO_FLAGS_SHOULD_RETRY 0x08 |
173 | #ifndef BIO_FLAGS_UPLINK | ||
174 | /* "UPLINK" flag denotes file descriptors provided by application. | ||
175 | It defaults to 0, as most platforms don't require UPLINK interface. */ | ||
176 | #define BIO_FLAGS_UPLINK 0 | ||
177 | #endif | ||
178 | 138 | ||
179 | /* Used in BIO_gethostbyname() */ | 139 | /* Used in BIO_gethostbyname() */ |
180 | #define BIO_GHBN_CTRL_HITS 1 | 140 | #define BIO_GHBN_CTRL_HITS 1 |
@@ -197,32 +157,28 @@ extern "C" { | |||
197 | */ | 157 | */ |
198 | #define BIO_FLAGS_MEM_RDONLY 0x200 | 158 | #define BIO_FLAGS_MEM_RDONLY 0x200 |
199 | 159 | ||
200 | typedef struct bio_st BIO; | 160 | #define BIO_set_flags(b,f) ((b)->flags|=(f)) |
201 | 161 | #define BIO_get_flags(b) ((b)->flags) | |
202 | void BIO_set_flags(BIO *b, int flags); | ||
203 | int BIO_test_flags(const BIO *b, int flags); | ||
204 | void BIO_clear_flags(BIO *b, int flags); | ||
205 | |||
206 | #define BIO_get_flags(b) BIO_test_flags(b, ~(0x0)) | ||
207 | #define BIO_set_retry_special(b) \ | 162 | #define BIO_set_retry_special(b) \ |
208 | BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)) | 163 | ((b)->flags|=(BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)) |
209 | #define BIO_set_retry_read(b) \ | 164 | #define BIO_set_retry_read(b) \ |
210 | BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)) | 165 | ((b)->flags|=(BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)) |
211 | #define BIO_set_retry_write(b) \ | 166 | #define BIO_set_retry_write(b) \ |
212 | BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)) | 167 | ((b)->flags|=(BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)) |
213 | 168 | ||
214 | /* These are normally used internally in BIOs */ | 169 | /* These are normally used internally in BIOs */ |
170 | #define BIO_clear_flags(b,f) ((b)->flags&= ~(f)) | ||
215 | #define BIO_clear_retry_flags(b) \ | 171 | #define BIO_clear_retry_flags(b) \ |
216 | BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) | 172 | ((b)->flags&= ~(BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) |
217 | #define BIO_get_retry_flags(b) \ | 173 | #define BIO_get_retry_flags(b) \ |
218 | BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) | 174 | ((b)->flags&(BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) |
219 | 175 | ||
220 | /* These should be used by the application to tell why we should retry */ | 176 | /* These should be used by the application to tell why we should retry */ |
221 | #define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ) | 177 | #define BIO_should_read(a) ((a)->flags & BIO_FLAGS_READ) |
222 | #define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE) | 178 | #define BIO_should_write(a) ((a)->flags & BIO_FLAGS_WRITE) |
223 | #define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL) | 179 | #define BIO_should_io_special(a) ((a)->flags & BIO_FLAGS_IO_SPECIAL) |
224 | #define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS) | 180 | #define BIO_retry_type(a) ((a)->flags & BIO_FLAGS_RWS) |
225 | #define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY) | 181 | #define BIO_should_retry(a) ((a)->flags & BIO_FLAGS_SHOULD_RETRY) |
226 | 182 | ||
227 | /* The next three are used in conjunction with the | 183 | /* The next three are used in conjunction with the |
228 | * BIO_should_io_special() condition. After this returns true, | 184 | * BIO_should_io_special() condition. After this returns true, |
@@ -251,14 +207,14 @@ void BIO_clear_flags(BIO *b, int flags); | |||
251 | #define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) | 207 | #define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) |
252 | #define BIO_cb_post(a) ((a)&BIO_CB_RETURN) | 208 | #define BIO_cb_post(a) ((a)&BIO_CB_RETURN) |
253 | 209 | ||
254 | long (*BIO_get_callback(const BIO *b)) (struct bio_st *,int,const char *,int, long,long); | 210 | #define BIO_set_callback(b,cb) ((b)->callback=(cb)) |
255 | void BIO_set_callback(BIO *b, | 211 | #define BIO_set_callback_arg(b,arg) ((b)->cb_arg=(char *)(arg)) |
256 | long (*callback)(struct bio_st *,int,const char *,int, long,long)); | 212 | #define BIO_get_callback_arg(b) ((b)->cb_arg) |
257 | char *BIO_get_callback_arg(const BIO *b); | 213 | #define BIO_get_callback(b) ((b)->callback) |
258 | void BIO_set_callback_arg(BIO *b, char *arg); | 214 | #define BIO_method_name(b) ((b)->method->name) |
215 | #define BIO_method_type(b) ((b)->method->type) | ||
259 | 216 | ||
260 | const char * BIO_method_name(const BIO *b); | 217 | typedef struct bio_st BIO; |
261 | int BIO_method_type(const BIO *b); | ||
262 | 218 | ||
263 | typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long); | 219 | typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long); |
264 | 220 | ||
@@ -532,18 +488,6 @@ size_t BIO_ctrl_get_write_guarantee(BIO *b); | |||
532 | size_t BIO_ctrl_get_read_request(BIO *b); | 488 | size_t BIO_ctrl_get_read_request(BIO *b); |
533 | int BIO_ctrl_reset_read_request(BIO *b); | 489 | int BIO_ctrl_reset_read_request(BIO *b); |
534 | 490 | ||
535 | /* ctrl macros for dgram */ | ||
536 | #define BIO_ctrl_dgram_connect(b,peer) \ | ||
537 | (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)peer) | ||
538 | #define BIO_ctrl_set_connected(b, state, peer) \ | ||
539 | (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, state, (char *)peer) | ||
540 | #define BIO_dgram_recv_timedout(b) \ | ||
541 | (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) | ||
542 | #define BIO_dgram_send_timedout(b) \ | ||
543 | (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) | ||
544 | #define BIO_dgram_set_peer(b,peer) \ | ||
545 | (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)peer) | ||
546 | |||
547 | /* These two aren't currently implemented */ | 491 | /* These two aren't currently implemented */ |
548 | /* int BIO_get_ex_num(BIO *bio); */ | 492 | /* int BIO_get_ex_num(BIO *bio); */ |
549 | /* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */ | 493 | /* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */ |
@@ -623,28 +567,15 @@ BIO_METHOD *BIO_f_buffer(void); | |||
623 | BIO_METHOD *BIO_f_linebuffer(void); | 567 | BIO_METHOD *BIO_f_linebuffer(void); |
624 | #endif | 568 | #endif |
625 | BIO_METHOD *BIO_f_nbio_test(void); | 569 | BIO_METHOD *BIO_f_nbio_test(void); |
626 | #ifndef OPENSSL_NO_DGRAM | ||
627 | BIO_METHOD *BIO_s_datagram(void); | ||
628 | #endif | ||
629 | |||
630 | /* BIO_METHOD *BIO_f_ber(void); */ | 570 | /* BIO_METHOD *BIO_f_ber(void); */ |
631 | 571 | ||
632 | int BIO_sock_should_retry(int i); | 572 | int BIO_sock_should_retry(int i); |
633 | int BIO_sock_non_fatal_error(int error); | 573 | int BIO_sock_non_fatal_error(int error); |
634 | int BIO_dgram_non_fatal_error(int error); | ||
635 | |||
636 | int BIO_fd_should_retry(int i); | 574 | int BIO_fd_should_retry(int i); |
637 | int BIO_fd_non_fatal_error(int error); | 575 | int BIO_fd_non_fatal_error(int error); |
638 | int BIO_dump_cb(int (*cb)(const void *data, size_t len, void *u), | ||
639 | void *u, const char *s, int len); | ||
640 | int BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), | ||
641 | void *u, const char *s, int len, int indent); | ||
642 | int BIO_dump(BIO *b,const char *bytes,int len); | 576 | int BIO_dump(BIO *b,const char *bytes,int len); |
643 | int BIO_dump_indent(BIO *b,const char *bytes,int len,int indent); | 577 | int BIO_dump_indent(BIO *b,const char *bytes,int len,int indent); |
644 | #ifndef OPENSSL_NO_FP_API | 578 | |
645 | int BIO_dump_fp(FILE *fp, const char *s, int len); | ||
646 | int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent); | ||
647 | #endif | ||
648 | struct hostent *BIO_gethostbyname(const char *name); | 579 | struct hostent *BIO_gethostbyname(const char *name); |
649 | /* We might want a thread-safe interface too: | 580 | /* We might want a thread-safe interface too: |
650 | * struct hostent *BIO_gethostbyname_r(const char *name, | 581 | * struct hostent *BIO_gethostbyname_r(const char *name, |
@@ -666,7 +597,6 @@ void BIO_sock_cleanup(void); | |||
666 | int BIO_set_tcp_ndelay(int sock,int turn_on); | 597 | int BIO_set_tcp_ndelay(int sock,int turn_on); |
667 | 598 | ||
668 | BIO *BIO_new_socket(int sock, int close_flag); | 599 | BIO *BIO_new_socket(int sock, int close_flag); |
669 | BIO *BIO_new_dgram(int fd, int close_flag); | ||
670 | BIO *BIO_new_fd(int fd, int close_flag); | 600 | BIO *BIO_new_fd(int fd, int close_flag); |
671 | BIO *BIO_new_connect(char *host_port); | 601 | BIO *BIO_new_connect(char *host_port); |
672 | BIO *BIO_new_accept(char *host_port); | 602 | BIO *BIO_new_accept(char *host_port); |
@@ -682,20 +612,10 @@ void BIO_copy_next_retry(BIO *b); | |||
682 | 612 | ||
683 | /*long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);*/ | 613 | /*long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);*/ |
684 | 614 | ||
685 | #ifdef __GNUC__ | 615 | int BIO_printf(BIO *bio, const char *format, ...); |
686 | # define __bio_h__attr__ __attribute__ | 616 | int BIO_vprintf(BIO *bio, const char *format, va_list args); |
687 | #else | 617 | int BIO_snprintf(char *buf, size_t n, const char *format, ...); |
688 | # define __bio_h__attr__(x) | 618 | int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args); |
689 | #endif | ||
690 | int BIO_printf(BIO *bio, const char *format, ...) | ||
691 | __bio_h__attr__((__format__(__printf__,2,3))); | ||
692 | int BIO_vprintf(BIO *bio, const char *format, va_list args) | ||
693 | __bio_h__attr__((__format__(__printf__,2,0))); | ||
694 | int BIO_snprintf(char *buf, size_t n, const char *format, ...) | ||
695 | __bio_h__attr__((__format__(__printf__,3,4))); | ||
696 | int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) | ||
697 | __bio_h__attr__((__format__(__printf__,3,0))); | ||
698 | #undef __bio_h__attr__ | ||
699 | 619 | ||
700 | /* BEGIN ERROR CODES */ | 620 | /* BEGIN ERROR CODES */ |
701 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 621 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
@@ -709,7 +629,6 @@ void ERR_load_BIO_strings(void); | |||
709 | #define BIO_F_ACPT_STATE 100 | 629 | #define BIO_F_ACPT_STATE 100 |
710 | #define BIO_F_BIO_ACCEPT 101 | 630 | #define BIO_F_BIO_ACCEPT 101 |
711 | #define BIO_F_BIO_BER_GET_HEADER 102 | 631 | #define BIO_F_BIO_BER_GET_HEADER 102 |
712 | #define BIO_F_BIO_CALLBACK_CTRL 131 | ||
713 | #define BIO_F_BIO_CTRL 103 | 632 | #define BIO_F_BIO_CTRL 103 |
714 | #define BIO_F_BIO_GETHOSTBYNAME 120 | 633 | #define BIO_F_BIO_GETHOSTBYNAME 120 |
715 | #define BIO_F_BIO_GETS 104 | 634 | #define BIO_F_BIO_GETS 104 |
diff --git a/src/lib/libcrypto/bio/bio_err.c b/src/lib/libcrypto/bio/bio_err.c index 6603f1c74d..8859a58ae4 100644 --- a/src/lib/libcrypto/bio/bio_err.c +++ b/src/lib/libcrypto/bio/bio_err.c | |||
@@ -73,7 +73,6 @@ static ERR_STRING_DATA BIO_str_functs[]= | |||
73 | {ERR_FUNC(BIO_F_ACPT_STATE), "ACPT_STATE"}, | 73 | {ERR_FUNC(BIO_F_ACPT_STATE), "ACPT_STATE"}, |
74 | {ERR_FUNC(BIO_F_BIO_ACCEPT), "BIO_accept"}, | 74 | {ERR_FUNC(BIO_F_BIO_ACCEPT), "BIO_accept"}, |
75 | {ERR_FUNC(BIO_F_BIO_BER_GET_HEADER), "BIO_BER_GET_HEADER"}, | 75 | {ERR_FUNC(BIO_F_BIO_BER_GET_HEADER), "BIO_BER_GET_HEADER"}, |
76 | {ERR_FUNC(BIO_F_BIO_CALLBACK_CTRL), "BIO_callback_ctrl"}, | ||
77 | {ERR_FUNC(BIO_F_BIO_CTRL), "BIO_ctrl"}, | 76 | {ERR_FUNC(BIO_F_BIO_CTRL), "BIO_ctrl"}, |
78 | {ERR_FUNC(BIO_F_BIO_GETHOSTBYNAME), "BIO_gethostbyname"}, | 77 | {ERR_FUNC(BIO_F_BIO_GETHOSTBYNAME), "BIO_gethostbyname"}, |
79 | {ERR_FUNC(BIO_F_BIO_GETS), "BIO_gets"}, | 78 | {ERR_FUNC(BIO_F_BIO_GETS), "BIO_gets"}, |
@@ -143,12 +142,15 @@ static ERR_STRING_DATA BIO_str_reasons[]= | |||
143 | 142 | ||
144 | void ERR_load_BIO_strings(void) | 143 | void ERR_load_BIO_strings(void) |
145 | { | 144 | { |
146 | #ifndef OPENSSL_NO_ERR | 145 | static int init=1; |
147 | 146 | ||
148 | if (ERR_func_error_string(BIO_str_functs[0].error) == NULL) | 147 | if (init) |
149 | { | 148 | { |
149 | init=0; | ||
150 | #ifndef OPENSSL_NO_ERR | ||
150 | ERR_load_strings(0,BIO_str_functs); | 151 | ERR_load_strings(0,BIO_str_functs); |
151 | ERR_load_strings(0,BIO_str_reasons); | 152 | ERR_load_strings(0,BIO_str_reasons); |
152 | } | ||
153 | #endif | 153 | #endif |
154 | |||
155 | } | ||
154 | } | 156 | } |
diff --git a/src/lib/libcrypto/bio/bio_lcl.h b/src/lib/libcrypto/bio/bio_lcl.h new file mode 100644 index 0000000000..dba2919d43 --- /dev/null +++ b/src/lib/libcrypto/bio/bio_lcl.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #include <openssl/bio.h> | ||
2 | |||
3 | #if BIO_FLAGS_UPLINK==0 | ||
4 | /* Shortcut UPLINK calls on most platforms... */ | ||
5 | #define UP_stdin stdin | ||
6 | #define UP_stdout stdout | ||
7 | #define UP_stderr stderr | ||
8 | #define UP_fprintf fprintf | ||
9 | #define UP_fgets fgets | ||
10 | #define UP_fread fread | ||
11 | #define UP_fwrite fwrite | ||
12 | #undef UP_fsetmod | ||
13 | #define UP_feof feof | ||
14 | #define UP_fclose fclose | ||
15 | |||
16 | #define UP_fopen fopen | ||
17 | #define UP_fseek fseek | ||
18 | #define UP_ftell ftell | ||
19 | #define UP_fflush fflush | ||
20 | #define UP_ferror ferror | ||
21 | #define UP_fileno fileno | ||
22 | |||
23 | #define UP_open open | ||
24 | #define UP_read read | ||
25 | #define UP_write write | ||
26 | #define UP_lseek lseek | ||
27 | #define UP_close close | ||
28 | #endif | ||
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c index 3f52ae953c..692c8fb5c6 100644 --- a/src/lib/libcrypto/bio/bio_lib.c +++ b/src/lib/libcrypto/bio/bio_lib.c | |||
@@ -141,56 +141,10 @@ int BIO_free(BIO *a) | |||
141 | void BIO_vfree(BIO *a) | 141 | void BIO_vfree(BIO *a) |
142 | { BIO_free(a); } | 142 | { BIO_free(a); } |
143 | 143 | ||
144 | void BIO_clear_flags(BIO *b, int flags) | ||
145 | { | ||
146 | b->flags &= ~flags; | ||
147 | } | ||
148 | |||
149 | int BIO_test_flags(const BIO *b, int flags) | ||
150 | { | ||
151 | return (b->flags & flags); | ||
152 | } | ||
153 | |||
154 | void BIO_set_flags(BIO *b, int flags) | ||
155 | { | ||
156 | b->flags |= flags; | ||
157 | } | ||
158 | |||
159 | long (*BIO_get_callback(const BIO *b))(struct bio_st *,int,const char *,int, long,long) | ||
160 | { | ||
161 | return b->callback; | ||
162 | } | ||
163 | |||
164 | void BIO_set_callback(BIO *b, long (*cb)(struct bio_st *,int,const char *,int, long,long)) | ||
165 | { | ||
166 | b->callback = cb; | ||
167 | } | ||
168 | |||
169 | void BIO_set_callback_arg(BIO *b, char *arg) | ||
170 | { | ||
171 | b->cb_arg = arg; | ||
172 | } | ||
173 | |||
174 | char * BIO_get_callback_arg(const BIO *b) | ||
175 | { | ||
176 | return b->cb_arg; | ||
177 | } | ||
178 | |||
179 | const char * BIO_method_name(const BIO *b) | ||
180 | { | ||
181 | return b->method->name; | ||
182 | } | ||
183 | |||
184 | int BIO_method_type(const BIO *b) | ||
185 | { | ||
186 | return b->method->type; | ||
187 | } | ||
188 | |||
189 | |||
190 | int BIO_read(BIO *b, void *out, int outl) | 144 | int BIO_read(BIO *b, void *out, int outl) |
191 | { | 145 | { |
192 | int i; | 146 | int i; |
193 | long (*cb)(BIO *,int,const char *,int,long,long); | 147 | long (*cb)(); |
194 | 148 | ||
195 | if ((b == NULL) || (b->method == NULL) || (b->method->bread == NULL)) | 149 | if ((b == NULL) || (b->method == NULL) || (b->method->bread == NULL)) |
196 | { | 150 | { |
@@ -222,7 +176,7 @@ int BIO_read(BIO *b, void *out, int outl) | |||
222 | int BIO_write(BIO *b, const void *in, int inl) | 176 | int BIO_write(BIO *b, const void *in, int inl) |
223 | { | 177 | { |
224 | int i; | 178 | int i; |
225 | long (*cb)(BIO *,int,const char *,int,long,long); | 179 | long (*cb)(); |
226 | 180 | ||
227 | if (b == NULL) | 181 | if (b == NULL) |
228 | return(0); | 182 | return(0); |
@@ -257,7 +211,7 @@ int BIO_write(BIO *b, const void *in, int inl) | |||
257 | int BIO_puts(BIO *b, const char *in) | 211 | int BIO_puts(BIO *b, const char *in) |
258 | { | 212 | { |
259 | int i; | 213 | int i; |
260 | long (*cb)(BIO *,int,const char *,int,long,long); | 214 | long (*cb)(); |
261 | 215 | ||
262 | if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) | 216 | if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) |
263 | { | 217 | { |
@@ -290,7 +244,7 @@ int BIO_puts(BIO *b, const char *in) | |||
290 | int BIO_gets(BIO *b, char *in, int inl) | 244 | int BIO_gets(BIO *b, char *in, int inl) |
291 | { | 245 | { |
292 | int i; | 246 | int i; |
293 | long (*cb)(BIO *,int,const char *,int,long,long); | 247 | long (*cb)(); |
294 | 248 | ||
295 | if ((b == NULL) || (b->method == NULL) || (b->method->bgets == NULL)) | 249 | if ((b == NULL) || (b->method == NULL) || (b->method->bgets == NULL)) |
296 | { | 250 | { |
@@ -351,7 +305,7 @@ char *BIO_ptr_ctrl(BIO *b, int cmd, long larg) | |||
351 | long BIO_ctrl(BIO *b, int cmd, long larg, void *parg) | 305 | long BIO_ctrl(BIO *b, int cmd, long larg, void *parg) |
352 | { | 306 | { |
353 | long ret; | 307 | long ret; |
354 | long (*cb)(BIO *,int,const char *,int,long,long); | 308 | long (*cb)(); |
355 | 309 | ||
356 | if (b == NULL) return(0); | 310 | if (b == NULL) return(0); |
357 | 311 | ||
@@ -378,13 +332,13 @@ long BIO_ctrl(BIO *b, int cmd, long larg, void *parg) | |||
378 | long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long)) | 332 | long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long)) |
379 | { | 333 | { |
380 | long ret; | 334 | long ret; |
381 | long (*cb)(BIO *,int,const char *,int,long,long); | 335 | long (*cb)(); |
382 | 336 | ||
383 | if (b == NULL) return(0); | 337 | if (b == NULL) return(0); |
384 | 338 | ||
385 | if ((b->method == NULL) || (b->method->callback_ctrl == NULL)) | 339 | if ((b->method == NULL) || (b->method->callback_ctrl == NULL)) |
386 | { | 340 | { |
387 | BIOerr(BIO_F_BIO_CALLBACK_CTRL,BIO_R_UNSUPPORTED_METHOD); | 341 | BIOerr(BIO_F_BIO_CTRL,BIO_R_UNSUPPORTED_METHOD); |
388 | return(-2); | 342 | return(-2); |
389 | } | 343 | } |
390 | 344 | ||
diff --git a/src/lib/libcrypto/bio/bss_acpt.c b/src/lib/libcrypto/bio/bss_acpt.c index d090b7272f..8ea1db158b 100644 --- a/src/lib/libcrypto/bio/bss_acpt.c +++ b/src/lib/libcrypto/bio/bss_acpt.c | |||
@@ -56,14 +56,14 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #ifndef OPENSSL_NO_SOCK | ||
60 | |||
59 | #include <stdio.h> | 61 | #include <stdio.h> |
60 | #include <errno.h> | 62 | #include <errno.h> |
61 | #define USE_SOCKETS | 63 | #define USE_SOCKETS |
62 | #include "cryptlib.h" | 64 | #include "cryptlib.h" |
63 | #include <openssl/bio.h> | 65 | #include <openssl/bio.h> |
64 | 66 | ||
65 | #ifndef OPENSSL_NO_SOCK | ||
66 | |||
67 | #ifdef OPENSSL_SYS_WIN16 | 67 | #ifdef OPENSSL_SYS_WIN16 |
68 | #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ | 68 | #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ |
69 | #else | 69 | #else |
diff --git a/src/lib/libcrypto/bio/bss_conn.c b/src/lib/libcrypto/bio/bss_conn.c index c14727855b..216780ed5e 100644 --- a/src/lib/libcrypto/bio/bss_conn.c +++ b/src/lib/libcrypto/bio/bss_conn.c | |||
@@ -56,14 +56,14 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #ifndef OPENSSL_NO_SOCK | ||
60 | |||
59 | #include <stdio.h> | 61 | #include <stdio.h> |
60 | #include <errno.h> | 62 | #include <errno.h> |
61 | #define USE_SOCKETS | 63 | #define USE_SOCKETS |
62 | #include "cryptlib.h" | 64 | #include "cryptlib.h" |
63 | #include <openssl/bio.h> | 65 | #include <openssl/bio.h> |
64 | 66 | ||
65 | #ifndef OPENSSL_NO_SOCK | ||
66 | |||
67 | #ifdef OPENSSL_SYS_WIN16 | 67 | #ifdef OPENSSL_SYS_WIN16 |
68 | #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ | 68 | #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ |
69 | #else | 69 | #else |
@@ -130,7 +130,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c) | |||
130 | int ret= -1,i; | 130 | int ret= -1,i; |
131 | unsigned long l; | 131 | unsigned long l; |
132 | char *p,*q; | 132 | char *p,*q; |
133 | int (*cb)(const BIO *,int,int)=NULL; | 133 | int (*cb)()=NULL; |
134 | 134 | ||
135 | if (c->info_callback != NULL) | 135 | if (c->info_callback != NULL) |
136 | cb=c->info_callback; | 136 | cb=c->info_callback; |
@@ -590,9 +590,9 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
590 | break; | 590 | break; |
591 | case BIO_CTRL_GET_CALLBACK: | 591 | case BIO_CTRL_GET_CALLBACK: |
592 | { | 592 | { |
593 | int (**fptr)(const BIO *bio,int state,int xret); | 593 | int (**fptr)(); |
594 | 594 | ||
595 | fptr=(int (**)(const BIO *bio,int state,int xret))ptr; | 595 | fptr=(int (**)())ptr; |
596 | *fptr=data->info_callback; | 596 | *fptr=data->info_callback; |
597 | } | 597 | } |
598 | break; | 598 | break; |
diff --git a/src/lib/libcrypto/bio/bss_fd.c b/src/lib/libcrypto/bio/bss_fd.c index 4c229bf641..5e3e187de6 100644 --- a/src/lib/libcrypto/bio/bss_fd.c +++ b/src/lib/libcrypto/bio/bss_fd.c | |||
@@ -60,19 +60,7 @@ | |||
60 | #include <errno.h> | 60 | #include <errno.h> |
61 | #define USE_SOCKETS | 61 | #define USE_SOCKETS |
62 | #include "cryptlib.h" | 62 | #include "cryptlib.h" |
63 | /* | 63 | #include <openssl/bio.h> |
64 | * As for unconditional usage of "UPLINK" interface in this module. | ||
65 | * Trouble is that unlike Unix file descriptors [which are indexes | ||
66 | * in kernel-side per-process table], corresponding descriptors on | ||
67 | * platforms which require "UPLINK" interface seem to be indexes | ||
68 | * in a user-land, non-global table. Well, in fact they are indexes | ||
69 | * in stdio _iob[], and recall that _iob[] was the very reason why | ||
70 | * "UPLINK" interface was introduced in first place. But one way on | ||
71 | * another. Neither libcrypto or libssl use this BIO meaning that | ||
72 | * file descriptors can only be provided by application. Therefore | ||
73 | * "UPLINK" calls are due... | ||
74 | */ | ||
75 | #include "bio_lcl.h" | ||
76 | 64 | ||
77 | static int fd_write(BIO *h, const char *buf, int num); | 65 | static int fd_write(BIO *h, const char *buf, int num); |
78 | static int fd_read(BIO *h, char *buf, int size); | 66 | static int fd_read(BIO *h, char *buf, int size); |
@@ -112,9 +100,9 @@ BIO *BIO_new_fd(int fd,int close_flag) | |||
112 | static int fd_new(BIO *bi) | 100 | static int fd_new(BIO *bi) |
113 | { | 101 | { |
114 | bi->init=0; | 102 | bi->init=0; |
115 | bi->num=-1; | 103 | bi->num=0; |
116 | bi->ptr=NULL; | 104 | bi->ptr=NULL; |
117 | bi->flags=BIO_FLAGS_UPLINK; /* essentially redundant */ | 105 | bi->flags=0; |
118 | return(1); | 106 | return(1); |
119 | } | 107 | } |
120 | 108 | ||
@@ -125,10 +113,10 @@ static int fd_free(BIO *a) | |||
125 | { | 113 | { |
126 | if (a->init) | 114 | if (a->init) |
127 | { | 115 | { |
128 | UP_close(a->num); | 116 | close(a->num); |
129 | } | 117 | } |
130 | a->init=0; | 118 | a->init=0; |
131 | a->flags=BIO_FLAGS_UPLINK; | 119 | a->flags=0; |
132 | } | 120 | } |
133 | return(1); | 121 | return(1); |
134 | } | 122 | } |
@@ -140,7 +128,7 @@ static int fd_read(BIO *b, char *out,int outl) | |||
140 | if (out != NULL) | 128 | if (out != NULL) |
141 | { | 129 | { |
142 | clear_sys_error(); | 130 | clear_sys_error(); |
143 | ret=UP_read(b->num,out,outl); | 131 | ret=read(b->num,out,outl); |
144 | BIO_clear_retry_flags(b); | 132 | BIO_clear_retry_flags(b); |
145 | if (ret <= 0) | 133 | if (ret <= 0) |
146 | { | 134 | { |
@@ -155,7 +143,7 @@ static int fd_write(BIO *b, const char *in, int inl) | |||
155 | { | 143 | { |
156 | int ret; | 144 | int ret; |
157 | clear_sys_error(); | 145 | clear_sys_error(); |
158 | ret=UP_write(b->num,in,inl); | 146 | ret=write(b->num,in,inl); |
159 | BIO_clear_retry_flags(b); | 147 | BIO_clear_retry_flags(b); |
160 | if (ret <= 0) | 148 | if (ret <= 0) |
161 | { | 149 | { |
@@ -175,11 +163,11 @@ static long fd_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
175 | case BIO_CTRL_RESET: | 163 | case BIO_CTRL_RESET: |
176 | num=0; | 164 | num=0; |
177 | case BIO_C_FILE_SEEK: | 165 | case BIO_C_FILE_SEEK: |
178 | ret=(long)UP_lseek(b->num,num,0); | 166 | ret=(long)lseek(b->num,num,0); |
179 | break; | 167 | break; |
180 | case BIO_C_FILE_TELL: | 168 | case BIO_C_FILE_TELL: |
181 | case BIO_CTRL_INFO: | 169 | case BIO_CTRL_INFO: |
182 | ret=(long)UP_lseek(b->num,0,1); | 170 | ret=(long)lseek(b->num,0,1); |
183 | break; | 171 | break; |
184 | case BIO_C_SET_FD: | 172 | case BIO_C_SET_FD: |
185 | fd_free(b); | 173 | fd_free(b); |
diff --git a/src/lib/libcrypto/bio/bss_file.c b/src/lib/libcrypto/bio/bss_file.c index 4df9927c43..58fade9f29 100644 --- a/src/lib/libcrypto/bio/bss_file.c +++ b/src/lib/libcrypto/bio/bss_file.c | |||
@@ -65,34 +65,12 @@ | |||
65 | #ifndef HEADER_BSS_FILE_C | 65 | #ifndef HEADER_BSS_FILE_C |
66 | #define HEADER_BSS_FILE_C | 66 | #define HEADER_BSS_FILE_C |
67 | 67 | ||
68 | #if defined(__linux) || defined(__sun) || defined(__hpux) | ||
69 | /* Following definition aliases fopen to fopen64 on above mentioned | ||
70 | * platforms. This makes it possible to open and sequentially access | ||
71 | * files larger than 2GB from 32-bit application. It does not allow to | ||
72 | * traverse them beyond 2GB with fseek/ftell, but on the other hand *no* | ||
73 | * 32-bit platform permits that, not with fseek/ftell. Not to mention | ||
74 | * that breaking 2GB limit for seeking would require surgery to *our* | ||
75 | * API. But sequential access suffices for practical cases when you | ||
76 | * can run into large files, such as fingerprinting, so we can let API | ||
77 | * alone. For reference, the list of 32-bit platforms which allow for | ||
78 | * sequential access of large files without extra "magic" comprise *BSD, | ||
79 | * Darwin, IRIX... | ||
80 | */ | ||
81 | #ifndef _FILE_OFFSET_BITS | ||
82 | #define _FILE_OFFSET_BITS 64 | ||
83 | #endif | ||
84 | #endif | ||
85 | |||
86 | #include <stdio.h> | 68 | #include <stdio.h> |
87 | #include <errno.h> | 69 | #include <errno.h> |
88 | #include "cryptlib.h" | 70 | #include "cryptlib.h" |
89 | #include "bio_lcl.h" | 71 | #include <openssl/bio.h> |
90 | #include <openssl/err.h> | 72 | #include <openssl/err.h> |
91 | 73 | ||
92 | #if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB) | ||
93 | #include <nwfileio.h> | ||
94 | #endif | ||
95 | |||
96 | #if !defined(OPENSSL_NO_STDIO) | 74 | #if !defined(OPENSSL_NO_STDIO) |
97 | 75 | ||
98 | static int MS_CALLBACK file_write(BIO *h, const char *buf, int num); | 76 | static int MS_CALLBACK file_write(BIO *h, const char *buf, int num); |
@@ -132,12 +110,8 @@ BIO *BIO_new_file(const char *filename, const char *mode) | |||
132 | return(NULL); | 110 | return(NULL); |
133 | } | 111 | } |
134 | if ((ret=BIO_new(BIO_s_file_internal())) == NULL) | 112 | if ((ret=BIO_new(BIO_s_file_internal())) == NULL) |
135 | { | ||
136 | fclose(file); | ||
137 | return(NULL); | 113 | return(NULL); |
138 | } | ||
139 | 114 | ||
140 | BIO_clear_flags(ret,BIO_FLAGS_UPLINK); /* we did fopen -> we disengage UPLINK */ | ||
141 | BIO_set_fp(ret,file,BIO_CLOSE); | 115 | BIO_set_fp(ret,file,BIO_CLOSE); |
142 | return(ret); | 116 | return(ret); |
143 | } | 117 | } |
@@ -149,7 +123,6 @@ BIO *BIO_new_fp(FILE *stream, int close_flag) | |||
149 | if ((ret=BIO_new(BIO_s_file())) == NULL) | 123 | if ((ret=BIO_new(BIO_s_file())) == NULL) |
150 | return(NULL); | 124 | return(NULL); |
151 | 125 | ||
152 | BIO_set_flags(ret,BIO_FLAGS_UPLINK); /* redundant, left for documentation puposes */ | ||
153 | BIO_set_fp(ret,stream,close_flag); | 126 | BIO_set_fp(ret,stream,close_flag); |
154 | return(ret); | 127 | return(ret); |
155 | } | 128 | } |
@@ -164,7 +137,6 @@ static int MS_CALLBACK file_new(BIO *bi) | |||
164 | bi->init=0; | 137 | bi->init=0; |
165 | bi->num=0; | 138 | bi->num=0; |
166 | bi->ptr=NULL; | 139 | bi->ptr=NULL; |
167 | bi->flags=BIO_FLAGS_UPLINK; /* default to UPLINK */ | ||
168 | return(1); | 140 | return(1); |
169 | } | 141 | } |
170 | 142 | ||
@@ -175,12 +147,8 @@ static int MS_CALLBACK file_free(BIO *a) | |||
175 | { | 147 | { |
176 | if ((a->init) && (a->ptr != NULL)) | 148 | if ((a->init) && (a->ptr != NULL)) |
177 | { | 149 | { |
178 | if (a->flags&BIO_FLAGS_UPLINK) | 150 | fclose((FILE *)a->ptr); |
179 | UP_fclose (a->ptr); | ||
180 | else | ||
181 | fclose (a->ptr); | ||
182 | a->ptr=NULL; | 151 | a->ptr=NULL; |
183 | a->flags=BIO_FLAGS_UPLINK; | ||
184 | } | 152 | } |
185 | a->init=0; | 153 | a->init=0; |
186 | } | 154 | } |
@@ -193,11 +161,8 @@ static int MS_CALLBACK file_read(BIO *b, char *out, int outl) | |||
193 | 161 | ||
194 | if (b->init && (out != NULL)) | 162 | if (b->init && (out != NULL)) |
195 | { | 163 | { |
196 | if (b->flags&BIO_FLAGS_UPLINK) | 164 | ret=fread(out,1,(int)outl,(FILE *)b->ptr); |
197 | ret=UP_fread(out,1,(int)outl,b->ptr); | 165 | if(ret == 0 && ferror((FILE *)b->ptr)) |
198 | else | ||
199 | ret=fread(out,1,(int)outl,(FILE *)b->ptr); | ||
200 | if(ret == 0 && (b->flags&BIO_FLAGS_UPLINK)?UP_ferror((FILE *)b->ptr):ferror((FILE *)b->ptr)) | ||
201 | { | 166 | { |
202 | SYSerr(SYS_F_FREAD,get_last_sys_error()); | 167 | SYSerr(SYS_F_FREAD,get_last_sys_error()); |
203 | BIOerr(BIO_F_FILE_READ,ERR_R_SYS_LIB); | 168 | BIOerr(BIO_F_FILE_READ,ERR_R_SYS_LIB); |
@@ -213,11 +178,7 @@ static int MS_CALLBACK file_write(BIO *b, const char *in, int inl) | |||
213 | 178 | ||
214 | if (b->init && (in != NULL)) | 179 | if (b->init && (in != NULL)) |
215 | { | 180 | { |
216 | if (b->flags&BIO_FLAGS_UPLINK) | 181 | if (fwrite(in,(int)inl,1,(FILE *)b->ptr)) |
217 | ret=UP_fwrite(in,(int)inl,1,b->ptr); | ||
218 | else | ||
219 | ret=fwrite(in,(int)inl,1,(FILE *)b->ptr); | ||
220 | if (ret) | ||
221 | ret=inl; | 182 | ret=inl; |
222 | /* ret=fwrite(in,1,(int)inl,(FILE *)b->ptr); */ | 183 | /* ret=fwrite(in,1,(int)inl,(FILE *)b->ptr); */ |
223 | /* according to Tim Hudson <tjh@cryptsoft.com>, the commented | 184 | /* according to Tim Hudson <tjh@cryptsoft.com>, the commented |
@@ -238,45 +199,20 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
238 | { | 199 | { |
239 | case BIO_C_FILE_SEEK: | 200 | case BIO_C_FILE_SEEK: |
240 | case BIO_CTRL_RESET: | 201 | case BIO_CTRL_RESET: |
241 | if (b->flags&BIO_FLAGS_UPLINK) | 202 | ret=(long)fseek(fp,num,SEEK_SET); |
242 | ret=(long)UP_fseek(b->ptr,num,0); | ||
243 | else | ||
244 | ret=(long)fseek(fp,num,0); | ||
245 | break; | 203 | break; |
246 | case BIO_CTRL_EOF: | 204 | case BIO_CTRL_EOF: |
247 | if (b->flags&BIO_FLAGS_UPLINK) | 205 | ret=(long)feof(fp); |
248 | ret=(long)UP_feof(fp); | ||
249 | else | ||
250 | ret=(long)feof(fp); | ||
251 | break; | 206 | break; |
252 | case BIO_C_FILE_TELL: | 207 | case BIO_C_FILE_TELL: |
253 | case BIO_CTRL_INFO: | 208 | case BIO_CTRL_INFO: |
254 | if (b->flags&BIO_FLAGS_UPLINK) | 209 | ret=ftell(fp); |
255 | ret=UP_ftell(b->ptr); | ||
256 | else | ||
257 | ret=ftell(fp); | ||
258 | break; | 210 | break; |
259 | case BIO_C_SET_FILE_PTR: | 211 | case BIO_C_SET_FILE_PTR: |
260 | file_free(b); | 212 | file_free(b); |
261 | b->shutdown=(int)num&BIO_CLOSE; | 213 | b->shutdown=(int)num&BIO_CLOSE; |
262 | b->ptr=ptr; | 214 | b->ptr=(char *)ptr; |
263 | b->init=1; | 215 | b->init=1; |
264 | #if BIO_FLAGS_UPLINK!=0 | ||
265 | #if defined(__MINGW32__) && defined(__MSVCRT__) && !defined(_IOB_ENTRIES) | ||
266 | #define _IOB_ENTRIES 20 | ||
267 | #endif | ||
268 | #if defined(_IOB_ENTRIES) | ||
269 | /* Safety net to catch purely internal BIO_set_fp calls */ | ||
270 | if ((size_t)ptr >= (size_t)stdin && | ||
271 | (size_t)ptr < (size_t)(stdin+_IOB_ENTRIES)) | ||
272 | BIO_clear_flags(b,BIO_FLAGS_UPLINK); | ||
273 | #endif | ||
274 | #endif | ||
275 | #ifdef UP_fsetmode | ||
276 | if (b->flags&BIO_FLAGS_UPLINK) | ||
277 | UP_fsetmode(b->ptr,num&BIO_FP_TEXT?'t':'b'); | ||
278 | else | ||
279 | #endif | ||
280 | { | 216 | { |
281 | #if defined(OPENSSL_SYS_WINDOWS) | 217 | #if defined(OPENSSL_SYS_WINDOWS) |
282 | int fd = fileno((FILE*)ptr); | 218 | int fd = fileno((FILE*)ptr); |
@@ -284,14 +220,6 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
284 | _setmode(fd,_O_TEXT); | 220 | _setmode(fd,_O_TEXT); |
285 | else | 221 | else |
286 | _setmode(fd,_O_BINARY); | 222 | _setmode(fd,_O_BINARY); |
287 | #elif defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB) | ||
288 | int fd = fileno((FILE*)ptr); | ||
289 | /* Under CLib there are differences in file modes | ||
290 | */ | ||
291 | if (num & BIO_FP_TEXT) | ||
292 | setmode(fd,O_TEXT); | ||
293 | else | ||
294 | setmode(fd,O_BINARY); | ||
295 | #elif defined(OPENSSL_SYS_MSDOS) | 223 | #elif defined(OPENSSL_SYS_MSDOS) |
296 | int fd = fileno((FILE*)ptr); | 224 | int fd = fileno((FILE*)ptr); |
297 | /* Set correct text/binary mode */ | 225 | /* Set correct text/binary mode */ |
@@ -344,12 +272,6 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
344 | else | 272 | else |
345 | strcat(p,"t"); | 273 | strcat(p,"t"); |
346 | #endif | 274 | #endif |
347 | #if defined(OPENSSL_SYS_NETWARE) | ||
348 | if (!(num & BIO_FP_TEXT)) | ||
349 | strcat(p,"b"); | ||
350 | else | ||
351 | strcat(p,"t"); | ||
352 | #endif | ||
353 | fp=fopen(ptr,p); | 275 | fp=fopen(ptr,p); |
354 | if (fp == NULL) | 276 | if (fp == NULL) |
355 | { | 277 | { |
@@ -359,9 +281,8 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
359 | ret=0; | 281 | ret=0; |
360 | break; | 282 | break; |
361 | } | 283 | } |
362 | b->ptr=fp; | 284 | b->ptr=(char *)fp; |
363 | b->init=1; | 285 | b->init=1; |
364 | BIO_clear_flags(b,BIO_FLAGS_UPLINK); /* we did fopen -> we disengage UPLINK */ | ||
365 | break; | 286 | break; |
366 | case BIO_C_GET_FILE_PTR: | 287 | case BIO_C_GET_FILE_PTR: |
367 | /* the ptr parameter is actually a FILE ** in this case. */ | 288 | /* the ptr parameter is actually a FILE ** in this case. */ |
@@ -378,10 +299,7 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
378 | b->shutdown=(int)num; | 299 | b->shutdown=(int)num; |
379 | break; | 300 | break; |
380 | case BIO_CTRL_FLUSH: | 301 | case BIO_CTRL_FLUSH: |
381 | if (b->flags&BIO_FLAGS_UPLINK) | 302 | fflush((FILE *)b->ptr); |
382 | UP_fflush(b->ptr); | ||
383 | else | ||
384 | fflush((FILE *)b->ptr); | ||
385 | break; | 303 | break; |
386 | case BIO_CTRL_DUP: | 304 | case BIO_CTRL_DUP: |
387 | ret=1; | 305 | ret=1; |
@@ -403,10 +321,7 @@ static int MS_CALLBACK file_gets(BIO *bp, char *buf, int size) | |||
403 | int ret=0; | 321 | int ret=0; |
404 | 322 | ||
405 | buf[0]='\0'; | 323 | buf[0]='\0'; |
406 | if (bp->flags&BIO_FLAGS_UPLINK) | 324 | fgets(buf,size,(FILE *)bp->ptr); |
407 | UP_fgets(buf,size,bp->ptr); | ||
408 | else | ||
409 | fgets(buf,size,(FILE *)bp->ptr); | ||
410 | if (buf[0] != '\0') | 325 | if (buf[0] != '\0') |
411 | ret=strlen(buf); | 326 | ret=strlen(buf); |
412 | return(ret); | 327 | return(ret); |
diff --git a/src/lib/libcrypto/bio/bss_log.c b/src/lib/libcrypto/bio/bss_log.c index 6360dbc820..1eb678cac0 100644 --- a/src/lib/libcrypto/bio/bss_log.c +++ b/src/lib/libcrypto/bio/bss_log.c | |||
@@ -78,8 +78,6 @@ | |||
78 | # include <starlet.h> | 78 | # include <starlet.h> |
79 | #elif defined(__ultrix) | 79 | #elif defined(__ultrix) |
80 | # include <sys/syslog.h> | 80 | # include <sys/syslog.h> |
81 | #elif defined(OPENSSL_SYS_NETWARE) | ||
82 | # define NO_SYSLOG | ||
83 | #elif (!defined(MSDOS) || defined(WATT32)) && !defined(OPENSSL_SYS_VXWORKS) && !defined(NO_SYSLOG) | 81 | #elif (!defined(MSDOS) || defined(WATT32)) && !defined(OPENSSL_SYS_VXWORKS) && !defined(NO_SYSLOG) |
84 | # include <syslog.h> | 82 | # include <syslog.h> |
85 | #endif | 83 | #endif |
diff --git a/src/lib/libcrypto/bio/bss_rtcp.c b/src/lib/libcrypto/bio/bss_rtcp.c new file mode 100644 index 0000000000..7dae485564 --- /dev/null +++ b/src/lib/libcrypto/bio/bss_rtcp.c | |||
@@ -0,0 +1,294 @@ | |||
1 | /* crypto/bio/bss_rtcp.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* Written by David L. Jones <jonesd@kcgl1.eng.ohio-state.edu> | ||
60 | * Date: 22-JUL-1996 | ||
61 | * Revised: 25-SEP-1997 Update for 0.8.1, BIO_CTRL_SET -> BIO_C_SET_FD | ||
62 | */ | ||
63 | /* VMS */ | ||
64 | #include <stdio.h> | ||
65 | #include <stdlib.h> | ||
66 | #include <string.h> | ||
67 | #include <errno.h> | ||
68 | #include "cryptlib.h" | ||
69 | #include <openssl/bio.h> | ||
70 | |||
71 | #include <iodef.h> /* VMS IO$_ definitions */ | ||
72 | #include <starlet.h> | ||
73 | |||
74 | typedef unsigned short io_channel; | ||
75 | /*************************************************************************/ | ||
76 | struct io_status { short status, count; long flags; }; | ||
77 | |||
78 | struct rpc_msg { /* Should have member alignment inhibited */ | ||
79 | char channel; /* 'A'-app data. 'R'-remote client 'G'-global */ | ||
80 | char function; /* 'G'-get, 'P'-put, 'C'-confirm, 'X'-close */ | ||
81 | unsigned short int length; /* Amount of data returned or max to return */ | ||
82 | char data[4092]; /* variable data */ | ||
83 | }; | ||
84 | #define RPC_HDR_SIZE (sizeof(struct rpc_msg) - 4092) | ||
85 | |||
86 | struct rpc_ctx { | ||
87 | int filled, pos; | ||
88 | struct rpc_msg msg; | ||
89 | }; | ||
90 | |||
91 | static int rtcp_write(BIO *h,const char *buf,int num); | ||
92 | static int rtcp_read(BIO *h,char *buf,int size); | ||
93 | static int rtcp_puts(BIO *h,const char *str); | ||
94 | static int rtcp_gets(BIO *h,char *str,int size); | ||
95 | static long rtcp_ctrl(BIO *h,int cmd,long arg1,void *arg2); | ||
96 | static int rtcp_new(BIO *h); | ||
97 | static int rtcp_free(BIO *data); | ||
98 | |||
99 | static BIO_METHOD rtcp_method= | ||
100 | { | ||
101 | BIO_TYPE_FD, | ||
102 | "RTCP", | ||
103 | rtcp_write, | ||
104 | rtcp_read, | ||
105 | rtcp_puts, | ||
106 | rtcp_gets, | ||
107 | rtcp_ctrl, | ||
108 | rtcp_new, | ||
109 | rtcp_free, | ||
110 | NULL, | ||
111 | }; | ||
112 | |||
113 | BIO_METHOD *BIO_s_rtcp(void) | ||
114 | { | ||
115 | return(&rtcp_method); | ||
116 | } | ||
117 | /*****************************************************************************/ | ||
118 | /* Decnet I/O routines. | ||
119 | */ | ||
120 | |||
121 | #ifdef __DECC | ||
122 | #pragma message save | ||
123 | #pragma message disable DOLLARID | ||
124 | #endif | ||
125 | |||
126 | static int get ( io_channel chan, char *buffer, int maxlen, int *length ) | ||
127 | { | ||
128 | int status; | ||
129 | struct io_status iosb; | ||
130 | status = sys$qiow ( 0, chan, IO$_READVBLK, &iosb, 0, 0, | ||
131 | buffer, maxlen, 0, 0, 0, 0 ); | ||
132 | if ( (status&1) == 1 ) status = iosb.status; | ||
133 | if ( (status&1) == 1 ) *length = iosb.count; | ||
134 | return status; | ||
135 | } | ||
136 | |||
137 | static int put ( io_channel chan, char *buffer, int length ) | ||
138 | { | ||
139 | int status; | ||
140 | struct io_status iosb; | ||
141 | status = sys$qiow ( 0, chan, IO$_WRITEVBLK, &iosb, 0, 0, | ||
142 | buffer, length, 0, 0, 0, 0 ); | ||
143 | if ( (status&1) == 1 ) status = iosb.status; | ||
144 | return status; | ||
145 | } | ||
146 | |||
147 | #ifdef __DECC | ||
148 | #pragma message restore | ||
149 | #endif | ||
150 | |||
151 | /***************************************************************************/ | ||
152 | |||
153 | static int rtcp_new(BIO *bi) | ||
154 | { | ||
155 | struct rpc_ctx *ctx; | ||
156 | bi->init=1; | ||
157 | bi->num=0; | ||
158 | bi->flags = 0; | ||
159 | bi->ptr=OPENSSL_malloc(sizeof(struct rpc_ctx)); | ||
160 | ctx = (struct rpc_ctx *) bi->ptr; | ||
161 | ctx->filled = 0; | ||
162 | ctx->pos = 0; | ||
163 | return(1); | ||
164 | } | ||
165 | |||
166 | static int rtcp_free(BIO *a) | ||
167 | { | ||
168 | if (a == NULL) return(0); | ||
169 | if ( a->ptr ) OPENSSL_free ( a->ptr ); | ||
170 | a->ptr = NULL; | ||
171 | return(1); | ||
172 | } | ||
173 | |||
174 | static int rtcp_read(BIO *b, char *out, int outl) | ||
175 | { | ||
176 | int status, length; | ||
177 | struct rpc_ctx *ctx; | ||
178 | /* | ||
179 | * read data, return existing. | ||
180 | */ | ||
181 | ctx = (struct rpc_ctx *) b->ptr; | ||
182 | if ( ctx->pos < ctx->filled ) { | ||
183 | length = ctx->filled - ctx->pos; | ||
184 | if ( length > outl ) length = outl; | ||
185 | memmove ( out, &ctx->msg.data[ctx->pos], length ); | ||
186 | ctx->pos += length; | ||
187 | return length; | ||
188 | } | ||
189 | /* | ||
190 | * Requst more data from R channel. | ||
191 | */ | ||
192 | ctx->msg.channel = 'R'; | ||
193 | ctx->msg.function = 'G'; | ||
194 | ctx->msg.length = sizeof(ctx->msg.data); | ||
195 | status = put ( b->num, (char *) &ctx->msg, RPC_HDR_SIZE ); | ||
196 | if ( (status&1) == 0 ) { | ||
197 | return -1; | ||
198 | } | ||
199 | /* | ||
200 | * Read. | ||
201 | */ | ||
202 | ctx->pos = ctx->filled = 0; | ||
203 | status = get ( b->num, (char *) &ctx->msg, sizeof(ctx->msg), &length ); | ||
204 | if ( (status&1) == 0 ) length = -1; | ||
205 | if ( ctx->msg.channel != 'R' || ctx->msg.function != 'C' ) { | ||
206 | length = -1; | ||
207 | } | ||
208 | ctx->filled = length - RPC_HDR_SIZE; | ||
209 | |||
210 | if ( ctx->pos < ctx->filled ) { | ||
211 | length = ctx->filled - ctx->pos; | ||
212 | if ( length > outl ) length = outl; | ||
213 | memmove ( out, ctx->msg.data, length ); | ||
214 | ctx->pos += length; | ||
215 | return length; | ||
216 | } | ||
217 | |||
218 | return length; | ||
219 | } | ||
220 | |||
221 | static int rtcp_write(BIO *b, const char *in, int inl) | ||
222 | { | ||
223 | int status, i, segment, length; | ||
224 | struct rpc_ctx *ctx; | ||
225 | /* | ||
226 | * Output data, send in chunks no larger that sizeof(ctx->msg.data). | ||
227 | */ | ||
228 | ctx = (struct rpc_ctx *) b->ptr; | ||
229 | for ( i = 0; i < inl; i += segment ) { | ||
230 | segment = inl - i; | ||
231 | if ( segment > sizeof(ctx->msg.data) ) segment = sizeof(ctx->msg.data); | ||
232 | ctx->msg.channel = 'R'; | ||
233 | ctx->msg.function = 'P'; | ||
234 | ctx->msg.length = segment; | ||
235 | memmove ( ctx->msg.data, &in[i], segment ); | ||
236 | status = put ( b->num, (char *) &ctx->msg, segment + RPC_HDR_SIZE ); | ||
237 | if ((status&1) == 0 ) { i = -1; break; } | ||
238 | |||
239 | status = get ( b->num, (char *) &ctx->msg, sizeof(ctx->msg), &length ); | ||
240 | if ( ((status&1) == 0) || (length < RPC_HDR_SIZE) ) { i = -1; break; } | ||
241 | if ( (ctx->msg.channel != 'R') || (ctx->msg.function != 'C') ) { | ||
242 | printf("unexpected response when confirming put %c %c\n", | ||
243 | ctx->msg.channel, ctx->msg.function ); | ||
244 | |||
245 | } | ||
246 | } | ||
247 | return(i); | ||
248 | } | ||
249 | |||
250 | static long rtcp_ctrl(BIO *b, int cmd, long num, void *ptr) | ||
251 | { | ||
252 | long ret=1; | ||
253 | |||
254 | switch (cmd) | ||
255 | { | ||
256 | case BIO_CTRL_RESET: | ||
257 | case BIO_CTRL_EOF: | ||
258 | ret = 1; | ||
259 | break; | ||
260 | case BIO_C_SET_FD: | ||
261 | b->num = num; | ||
262 | ret = 1; | ||
263 | break; | ||
264 | case BIO_CTRL_SET_CLOSE: | ||
265 | case BIO_CTRL_FLUSH: | ||
266 | case BIO_CTRL_DUP: | ||
267 | ret=1; | ||
268 | break; | ||
269 | case BIO_CTRL_GET_CLOSE: | ||
270 | case BIO_CTRL_INFO: | ||
271 | case BIO_CTRL_GET: | ||
272 | case BIO_CTRL_PENDING: | ||
273 | case BIO_CTRL_WPENDING: | ||
274 | default: | ||
275 | ret=0; | ||
276 | break; | ||
277 | } | ||
278 | return(ret); | ||
279 | } | ||
280 | |||
281 | static int rtcp_gets(BIO *bp, char *buf, int size) | ||
282 | { | ||
283 | return(0); | ||
284 | } | ||
285 | |||
286 | static int rtcp_puts(BIO *bp, const char *str) | ||
287 | { | ||
288 | int length; | ||
289 | if (str == NULL) return(0); | ||
290 | length = strlen ( str ); | ||
291 | if ( length == 0 ) return (0); | ||
292 | return rtcp_write ( bp,str, length ); | ||
293 | } | ||
294 | |||
diff --git a/src/lib/libcrypto/bio/bss_sock.c b/src/lib/libcrypto/bio/bss_sock.c index 472dd75821..2c1c405ec7 100644 --- a/src/lib/libcrypto/bio/bss_sock.c +++ b/src/lib/libcrypto/bio/bss_sock.c | |||
@@ -56,6 +56,8 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #ifndef OPENSSL_NO_SOCK | ||
60 | |||
59 | #include <stdio.h> | 61 | #include <stdio.h> |
60 | #include <errno.h> | 62 | #include <errno.h> |
61 | #define USE_SOCKETS | 63 | #define USE_SOCKETS |
@@ -246,7 +248,7 @@ int BIO_sock_non_fatal_error(int err) | |||
246 | { | 248 | { |
247 | switch (err) | 249 | switch (err) |
248 | { | 250 | { |
249 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_NETWARE) | 251 | #if defined(OPENSSL_SYS_WINDOWS) |
250 | # if defined(WSAEWOULDBLOCK) | 252 | # if defined(WSAEWOULDBLOCK) |
251 | case WSAEWOULDBLOCK: | 253 | case WSAEWOULDBLOCK: |
252 | # endif | 254 | # endif |
@@ -277,7 +279,7 @@ int BIO_sock_non_fatal_error(int err) | |||
277 | #endif | 279 | #endif |
278 | 280 | ||
279 | #ifdef EAGAIN | 281 | #ifdef EAGAIN |
280 | # if EWOULDBLOCK != EAGAIN | 282 | #if EWOULDBLOCK != EAGAIN |
281 | case EAGAIN: | 283 | case EAGAIN: |
282 | # endif | 284 | # endif |
283 | #endif | 285 | #endif |
@@ -300,3 +302,4 @@ int BIO_sock_non_fatal_error(int err) | |||
300 | } | 302 | } |
301 | return(0); | 303 | return(0); |
302 | } | 304 | } |
305 | #endif | ||