diff options
Diffstat (limited to 'src/lib/libcrypto/bio')
-rw-r--r-- | src/lib/libcrypto/bio/Makefile.ssl | 216 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/b_dump.c | 32 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/b_print.c | 29 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/b_sock.c | 28 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bf_buff.c | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bio.h | 7 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bio_cb.c | 36 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bio_lib.c | 15 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_bio.c | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_conn.c | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_file.c | 12 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_log.c | 13 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_mem.c | 8 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_rtcp.c | 294 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_sock.c | 6 |
15 files changed, 590 insertions, 121 deletions
diff --git a/src/lib/libcrypto/bio/Makefile.ssl b/src/lib/libcrypto/bio/Makefile.ssl new file mode 100644 index 0000000000..dfcee03448 --- /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 8397cfab6a..983604fb49 100644 --- a/src/lib/libcrypto/bio/b_dump.c +++ b/src/lib/libcrypto/bio/b_dump.c | |||
@@ -104,38 +104,41 @@ int BIO_dump_indent(BIO *bio, const char *s, int len, int indent) | |||
104 | for(i=0;i<rows;i++) | 104 | for(i=0;i<rows;i++) |
105 | { | 105 | { |
106 | buf[0]='\0'; /* start with empty string */ | 106 | buf[0]='\0'; /* start with empty string */ |
107 | strcpy(buf,str); | 107 | strlcpy(buf,str,sizeof buf); |
108 | sprintf(tmp,"%04x - ",i*dump_width); | 108 | snprintf(tmp,sizeof tmp,"%04x - ",i*dump_width); |
109 | strcat(buf,tmp); | 109 | strlcat(buf,tmp,sizeof buf); |
110 | for(j=0;j<dump_width;j++) | 110 | for(j=0;j<dump_width;j++) |
111 | { | 111 | { |
112 | if (((i*dump_width)+j)>=len) | 112 | if (((i*dump_width)+j)>=len) |
113 | { | 113 | { |
114 | strcat(buf," "); | 114 | strlcat(buf," ",sizeof buf); |
115 | } | 115 | } |
116 | else | 116 | else |
117 | { | 117 | { |
118 | ch=((unsigned char)*(s+i*dump_width+j)) & 0xff; | 118 | ch=((unsigned char)*(s+i*dump_width+j)) & 0xff; |
119 | sprintf(tmp,"%02x%c",ch,j==7?'-':' '); | 119 | snprintf(tmp,sizeof tmp,"%02x%c",ch, |
120 | strcat(buf,tmp); | 120 | j==7?'-':' '); |
121 | strlcat(buf,tmp,sizeof buf); | ||
121 | } | 122 | } |
122 | } | 123 | } |
123 | strcat(buf," "); | 124 | strlcat(buf," ",sizeof buf); |
124 | for(j=0;j<dump_width;j++) | 125 | for(j=0;j<dump_width;j++) |
125 | { | 126 | { |
126 | if (((i*dump_width)+j)>=len) | 127 | if (((i*dump_width)+j)>=len) |
127 | break; | 128 | break; |
128 | ch=((unsigned char)*(s+i*dump_width+j)) & 0xff; | 129 | ch=((unsigned char)*(s+i*dump_width+j)) & 0xff; |
129 | #ifndef CHARSET_EBCDIC | 130 | #ifndef CHARSET_EBCDIC |
130 | sprintf(tmp,"%c",((ch>=' ')&&(ch<='~'))?ch:'.'); | 131 | snprintf(tmp,sizeof tmp,"%c", |
132 | ((ch>=' ')&&(ch<='~'))?ch:'.'); | ||
131 | #else | 133 | #else |
132 | sprintf(tmp,"%c",((ch>=os_toascii[' '])&&(ch<=os_toascii['~'])) | 134 | snprintf(tmp,sizeof tmp,"%c", |
133 | ? os_toebcdic[ch] | 135 | ((ch>=os_toascii[' '])&&(ch<=os_toascii['~'])) |
134 | : '.'); | 136 | ? os_toebcdic[ch] |
137 | : '.'); | ||
135 | #endif | 138 | #endif |
136 | strcat(buf,tmp); | 139 | strlcat(buf,tmp,sizeof buf); |
137 | } | 140 | } |
138 | strcat(buf,"\n"); | 141 | strlcat(buf,"\n",sizeof buf); |
139 | /* if this is the last call then update the ddt_dump thing so that | 142 | /* if this is the last call then update the ddt_dump thing so that |
140 | * we will move the selection point in the debug window | 143 | * we will move the selection point in the debug window |
141 | */ | 144 | */ |
@@ -144,7 +147,8 @@ int BIO_dump_indent(BIO *bio, const char *s, int len, int indent) | |||
144 | #ifdef TRUNCATE | 147 | #ifdef TRUNCATE |
145 | if (trunc > 0) | 148 | if (trunc > 0) |
146 | { | 149 | { |
147 | sprintf(buf,"%s%04x - <SPACES/NULS>\n",str,len+trunc); | 150 | snprintf(buf,sizeof buf,"%s%04x - <SPACES/NULS>\n",str, |
151 | len+trunc); | ||
148 | ret+=BIO_write(bio,(char *)buf,strlen(buf)); | 152 | ret+=BIO_write(bio,(char *)buf,strlen(buf)); |
149 | } | 153 | } |
150 | #endif | 154 | #endif |
diff --git a/src/lib/libcrypto/bio/b_print.c b/src/lib/libcrypto/bio/b_print.c index a9e552f245..80c9cb69db 100644 --- a/src/lib/libcrypto/bio/b_print.c +++ b/src/lib/libcrypto/bio/b_print.c | |||
@@ -378,7 +378,7 @@ _dopr( | |||
378 | case 'p': | 378 | case 'p': |
379 | value = (long)va_arg(args, void *); | 379 | value = (long)va_arg(args, void *); |
380 | fmtint(sbuffer, buffer, &currlen, maxlen, | 380 | fmtint(sbuffer, buffer, &currlen, maxlen, |
381 | value, 16, min, max, flags|DP_F_NUM); | 381 | value, 16, min, max, flags); |
382 | break; | 382 | break; |
383 | case 'n': /* XXX */ | 383 | case 'n': /* XXX */ |
384 | if (cflags == DP_C_SHORT) { | 384 | if (cflags == DP_C_SHORT) { |
@@ -482,9 +482,8 @@ fmtint( | |||
482 | int flags) | 482 | int flags) |
483 | { | 483 | { |
484 | int signvalue = 0; | 484 | int signvalue = 0; |
485 | char *prefix = ""; | ||
486 | unsigned LLONG uvalue; | 485 | unsigned LLONG uvalue; |
487 | char convert[DECIMAL_SIZE(value)+3]; | 486 | char convert[20]; |
488 | int place = 0; | 487 | int place = 0; |
489 | int spadlen = 0; | 488 | int spadlen = 0; |
490 | int zpadlen = 0; | 489 | int zpadlen = 0; |
@@ -502,10 +501,6 @@ fmtint( | |||
502 | else if (flags & DP_F_SPACE) | 501 | else if (flags & DP_F_SPACE) |
503 | signvalue = ' '; | 502 | signvalue = ' '; |
504 | } | 503 | } |
505 | if (flags & DP_F_NUM) { | ||
506 | if (base == 8) prefix = "0"; | ||
507 | if (base == 16) prefix = "0x"; | ||
508 | } | ||
509 | if (flags & DP_F_UP) | 504 | if (flags & DP_F_UP) |
510 | caps = 1; | 505 | caps = 1; |
511 | do { | 506 | do { |
@@ -513,13 +508,13 @@ fmtint( | |||
513 | (caps ? "0123456789ABCDEF" : "0123456789abcdef") | 508 | (caps ? "0123456789ABCDEF" : "0123456789abcdef") |
514 | [uvalue % (unsigned) base]; | 509 | [uvalue % (unsigned) base]; |
515 | uvalue = (uvalue / (unsigned) base); | 510 | uvalue = (uvalue / (unsigned) base); |
516 | } while (uvalue && (place < sizeof convert)); | 511 | } while (uvalue && (place < 20)); |
517 | if (place == sizeof convert) | 512 | if (place == 20) |
518 | place--; | 513 | place--; |
519 | convert[place] = 0; | 514 | convert[place] = 0; |
520 | 515 | ||
521 | zpadlen = max - place; | 516 | zpadlen = max - place; |
522 | spadlen = min - OSSL_MAX(max, place) - (signvalue ? 1 : 0) - strlen(prefix); | 517 | spadlen = min - OSSL_MAX(max, place) - (signvalue ? 1 : 0); |
523 | if (zpadlen < 0) | 518 | if (zpadlen < 0) |
524 | zpadlen = 0; | 519 | zpadlen = 0; |
525 | if (spadlen < 0) | 520 | if (spadlen < 0) |
@@ -541,12 +536,6 @@ fmtint( | |||
541 | if (signvalue) | 536 | if (signvalue) |
542 | doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue); | 537 | doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue); |
543 | 538 | ||
544 | /* prefix */ | ||
545 | while (*prefix) { | ||
546 | doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix); | ||
547 | prefix++; | ||
548 | } | ||
549 | |||
550 | /* zeros */ | 539 | /* zeros */ |
551 | if (zpadlen > 0) { | 540 | if (zpadlen > 0) { |
552 | while (zpadlen > 0) { | 541 | while (zpadlen > 0) { |
@@ -652,8 +641,8 @@ fmtfp( | |||
652 | (caps ? "0123456789ABCDEF" | 641 | (caps ? "0123456789ABCDEF" |
653 | : "0123456789abcdef")[intpart % 10]; | 642 | : "0123456789abcdef")[intpart % 10]; |
654 | intpart = (intpart / 10); | 643 | intpart = (intpart / 10); |
655 | } while (intpart && (iplace < sizeof iplace)); | 644 | } while (intpart && (iplace < 20)); |
656 | if (iplace == sizeof iplace) | 645 | if (iplace == 20) |
657 | iplace--; | 646 | iplace--; |
658 | iconvert[iplace] = 0; | 647 | iconvert[iplace] = 0; |
659 | 648 | ||
@@ -664,7 +653,7 @@ fmtfp( | |||
664 | : "0123456789abcdef")[fracpart % 10]; | 653 | : "0123456789abcdef")[fracpart % 10]; |
665 | fracpart = (fracpart / 10); | 654 | fracpart = (fracpart / 10); |
666 | } while (fplace < max); | 655 | } while (fplace < max); |
667 | if (fplace == sizeof fplace) | 656 | if (fplace == 20) |
668 | fplace--; | 657 | fplace--; |
669 | fconvert[fplace] = 0; | 658 | fconvert[fplace] = 0; |
670 | 659 | ||
@@ -703,7 +692,7 @@ fmtfp( | |||
703 | * Decimal point. This should probably use locale to find the correct | 692 | * Decimal point. This should probably use locale to find the correct |
704 | * char to print out. | 693 | * char to print out. |
705 | */ | 694 | */ |
706 | if (max > 0 || (flags & DP_F_NUM)) { | 695 | if (max > 0) { |
707 | doapr_outch(sbuffer, buffer, currlen, maxlen, '.'); | 696 | doapr_outch(sbuffer, buffer, currlen, maxlen, '.'); |
708 | 697 | ||
709 | while (fplace > 0) | 698 | while (fplace > 0) |
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c index 601a14f37c..7632c2d85e 100644 --- a/src/lib/libcrypto/bio/b_sock.c +++ b/src/lib/libcrypto/bio/b_sock.c | |||
@@ -83,7 +83,6 @@ | |||
83 | static int wsa_init_done=0; | 83 | static int wsa_init_done=0; |
84 | #endif | 84 | #endif |
85 | 85 | ||
86 | #if 0 | ||
87 | static unsigned long BIO_ghbn_hits=0L; | 86 | static unsigned long BIO_ghbn_hits=0L; |
88 | static unsigned long BIO_ghbn_miss=0L; | 87 | static unsigned long BIO_ghbn_miss=0L; |
89 | 88 | ||
@@ -94,7 +93,6 @@ static struct ghbn_cache_st | |||
94 | struct hostent *ent; | 93 | struct hostent *ent; |
95 | unsigned long order; | 94 | unsigned long order; |
96 | } ghbn_cache[GHBN_NUM]; | 95 | } ghbn_cache[GHBN_NUM]; |
97 | #endif | ||
98 | 96 | ||
99 | static int get_ip(const char *str,unsigned char *ip); | 97 | static int get_ip(const char *str,unsigned char *ip); |
100 | #if 0 | 98 | #if 0 |
@@ -232,7 +230,6 @@ int BIO_sock_error(int sock) | |||
232 | return(j); | 230 | return(j); |
233 | } | 231 | } |
234 | 232 | ||
235 | #if 0 | ||
236 | long BIO_ghbn_ctrl(int cmd, int iarg, char *parg) | 233 | long BIO_ghbn_ctrl(int cmd, int iarg, char *parg) |
237 | { | 234 | { |
238 | int i; | 235 | int i; |
@@ -270,7 +267,6 @@ long BIO_ghbn_ctrl(int cmd, int iarg, char *parg) | |||
270 | } | 267 | } |
271 | return(1); | 268 | return(1); |
272 | } | 269 | } |
273 | #endif | ||
274 | 270 | ||
275 | #if 0 | 271 | #if 0 |
276 | static struct hostent *ghbn_dup(struct hostent *a) | 272 | static struct hostent *ghbn_dup(struct hostent *a) |
@@ -467,12 +463,6 @@ int BIO_sock_init(void) | |||
467 | } | 463 | } |
468 | } | 464 | } |
469 | #endif /* OPENSSL_SYS_WINDOWS */ | 465 | #endif /* OPENSSL_SYS_WINDOWS */ |
470 | #ifdef WATT32 | ||
471 | extern int _watt_do_exit; | ||
472 | _watt_do_exit = 0; /* don't make sock_init() call exit() */ | ||
473 | if (sock_init()) | ||
474 | return (-1); | ||
475 | #endif | ||
476 | return(1); | 466 | return(1); |
477 | } | 467 | } |
478 | 468 | ||
@@ -482,9 +472,7 @@ void BIO_sock_cleanup(void) | |||
482 | if (wsa_init_done) | 472 | if (wsa_init_done) |
483 | { | 473 | { |
484 | wsa_init_done=0; | 474 | wsa_init_done=0; |
485 | #ifndef OPENSSL_SYS_WINCE | ||
486 | WSACancelBlockingCall(); | 475 | WSACancelBlockingCall(); |
487 | #endif | ||
488 | WSACleanup(); | 476 | WSACleanup(); |
489 | } | 477 | } |
490 | #endif | 478 | #endif |
@@ -492,7 +480,7 @@ void BIO_sock_cleanup(void) | |||
492 | 480 | ||
493 | #if !defined(OPENSSL_SYS_VMS) || __VMS_VER >= 70000000 | 481 | #if !defined(OPENSSL_SYS_VMS) || __VMS_VER >= 70000000 |
494 | 482 | ||
495 | int BIO_socket_ioctl(int fd, long type, void *arg) | 483 | int BIO_socket_ioctl(int fd, long type, unsigned long *arg) |
496 | { | 484 | { |
497 | int i; | 485 | int i; |
498 | 486 | ||
@@ -709,12 +697,12 @@ int BIO_accept(int sock, char **addr) | |||
709 | } | 697 | } |
710 | *addr=p; | 698 | *addr=p; |
711 | } | 699 | } |
712 | sprintf(*addr,"%d.%d.%d.%d:%d", | 700 | snprintf(*addr,24,"%d.%d.%d.%d:%d", |
713 | (unsigned char)(l>>24L)&0xff, | 701 | (unsigned char)(l>>24L)&0xff, |
714 | (unsigned char)(l>>16L)&0xff, | 702 | (unsigned char)(l>>16L)&0xff, |
715 | (unsigned char)(l>> 8L)&0xff, | 703 | (unsigned char)(l>> 8L)&0xff, |
716 | (unsigned char)(l )&0xff, | 704 | (unsigned char)(l )&0xff, |
717 | port); | 705 | port); |
718 | end: | 706 | end: |
719 | return(ret); | 707 | return(ret); |
720 | } | 708 | } |
@@ -742,7 +730,7 @@ int BIO_set_tcp_ndelay(int s, int on) | |||
742 | int BIO_socket_nbio(int s, int mode) | 730 | int BIO_socket_nbio(int s, int mode) |
743 | { | 731 | { |
744 | int ret= -1; | 732 | int ret= -1; |
745 | int l; | 733 | unsigned long l; |
746 | 734 | ||
747 | l=mode; | 735 | l=mode; |
748 | #ifdef FIONBIO | 736 | #ifdef FIONBIO |
diff --git a/src/lib/libcrypto/bio/bf_buff.c b/src/lib/libcrypto/bio/bf_buff.c index 1cecd70579..6ccda06596 100644 --- a/src/lib/libcrypto/bio/bf_buff.c +++ b/src/lib/libcrypto/bio/bf_buff.c | |||
@@ -482,7 +482,7 @@ static int buffer_gets(BIO *b, char *buf, int size) | |||
482 | size-=i; | 482 | size-=i; |
483 | ctx->ibuf_len-=i; | 483 | ctx->ibuf_len-=i; |
484 | ctx->ibuf_off+=i; | 484 | ctx->ibuf_off+=i; |
485 | if (flag || size == 0) | 485 | if ((flag) || (i == size)) |
486 | { | 486 | { |
487 | *buf='\0'; | 487 | *buf='\0'; |
488 | return(num); | 488 | return(num); |
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h index fbbc16d00c..c5caf253c9 100644 --- a/src/lib/libcrypto/bio/bio.h +++ b/src/lib/libcrypto/bio/bio.h | |||
@@ -244,7 +244,7 @@ typedef struct bio_method_st | |||
244 | long (_far *ctrl)(); | 244 | long (_far *ctrl)(); |
245 | int (_far *create)(); | 245 | int (_far *create)(); |
246 | int (_far *destroy)(); | 246 | int (_far *destroy)(); |
247 | long (_far *callback_ctrl)(); | 247 | long (_fat *callback_ctrl)(); |
248 | } BIO_METHOD; | 248 | } BIO_METHOD; |
249 | #endif | 249 | #endif |
250 | 250 | ||
@@ -522,7 +522,6 @@ int BIO_read(BIO *b, void *data, int len); | |||
522 | int BIO_gets(BIO *bp,char *buf, int size); | 522 | int BIO_gets(BIO *bp,char *buf, int size); |
523 | int BIO_write(BIO *b, const void *data, int len); | 523 | int BIO_write(BIO *b, const void *data, int len); |
524 | int BIO_puts(BIO *bp,const char *buf); | 524 | int BIO_puts(BIO *bp,const char *buf); |
525 | int BIO_indent(BIO *b,int indent,int max); | ||
526 | long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg); | 525 | long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg); |
527 | long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long)); | 526 | long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long)); |
528 | char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg); | 527 | char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg); |
@@ -585,7 +584,7 @@ struct hostent *BIO_gethostbyname(const char *name); | |||
585 | * and an appropriate error code is set). | 584 | * and an appropriate error code is set). |
586 | */ | 585 | */ |
587 | int BIO_sock_error(int sock); | 586 | int BIO_sock_error(int sock); |
588 | int BIO_socket_ioctl(int fd, long type, void *arg); | 587 | int BIO_socket_ioctl(int fd, long type, unsigned long *arg); |
589 | int BIO_socket_nbio(int fd,int mode); | 588 | int BIO_socket_nbio(int fd,int mode); |
590 | int BIO_get_port(const char *str, unsigned short *port_ptr); | 589 | int BIO_get_port(const char *str, unsigned short *port_ptr); |
591 | int BIO_get_host_ip(const char *str, unsigned char *ip); | 590 | int BIO_get_host_ip(const char *str, unsigned char *ip); |
@@ -609,7 +608,7 @@ int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, | |||
609 | 608 | ||
610 | void BIO_copy_next_retry(BIO *b); | 609 | void BIO_copy_next_retry(BIO *b); |
611 | 610 | ||
612 | /*long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);*/ | 611 | long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); |
613 | 612 | ||
614 | int BIO_printf(BIO *bio, const char *format, ...); | 613 | int BIO_printf(BIO *bio, const char *format, ...); |
615 | int BIO_vprintf(BIO *bio, const char *format, va_list args); | 614 | int BIO_vprintf(BIO *bio, const char *format, va_list args); |
diff --git a/src/lib/libcrypto/bio/bio_cb.c b/src/lib/libcrypto/bio/bio_cb.c index 0ffa4d2136..ee9159ebd8 100644 --- a/src/lib/libcrypto/bio/bio_cb.c +++ b/src/lib/libcrypto/bio/bio_cb.c | |||
@@ -70,55 +70,61 @@ long MS_CALLBACK BIO_debug_callback(BIO *bio, int cmd, const char *argp, | |||
70 | MS_STATIC char buf[256]; | 70 | MS_STATIC char buf[256]; |
71 | char *p; | 71 | char *p; |
72 | long r=1; | 72 | long r=1; |
73 | size_t p_maxlen; | ||
73 | 74 | ||
74 | if (BIO_CB_RETURN & cmd) | 75 | if (BIO_CB_RETURN & cmd) |
75 | r=ret; | 76 | r=ret; |
76 | 77 | ||
77 | sprintf(buf,"BIO[%08lX]:",(unsigned long)bio); | 78 | snprintf(buf,sizeof buf,"BIO[%08lX]:",(unsigned long)bio); |
78 | p= &(buf[14]); | 79 | p= &(buf[14]); |
80 | p_maxlen = sizeof buf - 14; | ||
79 | switch (cmd) | 81 | switch (cmd) |
80 | { | 82 | { |
81 | case BIO_CB_FREE: | 83 | case BIO_CB_FREE: |
82 | sprintf(p,"Free - %s\n",bio->method->name); | 84 | snprintf(p,p_maxlen,"Free - %s\n",bio->method->name); |
83 | break; | 85 | break; |
84 | case BIO_CB_READ: | 86 | case BIO_CB_READ: |
85 | if (bio->method->type & BIO_TYPE_DESCRIPTOR) | 87 | if (bio->method->type & BIO_TYPE_DESCRIPTOR) |
86 | sprintf(p,"read(%d,%d) - %s fd=%d\n",bio->num,argi,bio->method->name,bio->num); | 88 | snprintf(p,p_maxlen,"read(%d,%d) - %s fd=%d\n", |
89 | bio->num,argi,bio->method->name,bio->num); | ||
87 | else | 90 | else |
88 | sprintf(p,"read(%d,%d) - %s\n",bio->num,argi,bio->method->name); | 91 | snprintf(p,p_maxlen,"read(%d,%d) - %s\n", |
92 | bio->num,argi,bio->method->name); | ||
89 | break; | 93 | break; |
90 | case BIO_CB_WRITE: | 94 | case BIO_CB_WRITE: |
91 | if (bio->method->type & BIO_TYPE_DESCRIPTOR) | 95 | if (bio->method->type & BIO_TYPE_DESCRIPTOR) |
92 | sprintf(p,"write(%d,%d) - %s fd=%d\n",bio->num,argi,bio->method->name,bio->num); | 96 | snprintf(p,p_maxlen,"write(%d,%d) - %s fd=%d\n", |
97 | bio->num,argi,bio->method->name,bio->num); | ||
93 | else | 98 | else |
94 | sprintf(p,"write(%d,%d) - %s\n",bio->num,argi,bio->method->name); | 99 | snprintf(p,p_maxlen,"write(%d,%d) - %s\n", |
100 | bio->num,argi,bio->method->name); | ||
95 | break; | 101 | break; |
96 | case BIO_CB_PUTS: | 102 | case BIO_CB_PUTS: |
97 | sprintf(p,"puts() - %s\n",bio->method->name); | 103 | snprintf(p,p_maxlen,"puts() - %s\n",bio->method->name); |
98 | break; | 104 | break; |
99 | case BIO_CB_GETS: | 105 | case BIO_CB_GETS: |
100 | sprintf(p,"gets(%d) - %s\n",argi,bio->method->name); | 106 | snprintf(p,p_maxlen,"gets(%d) - %s\n",argi,bio->method->name); |
101 | break; | 107 | break; |
102 | case BIO_CB_CTRL: | 108 | case BIO_CB_CTRL: |
103 | sprintf(p,"ctrl(%d) - %s\n",argi,bio->method->name); | 109 | snprintf(p,p_maxlen,"ctrl(%d) - %s\n",argi,bio->method->name); |
104 | break; | 110 | break; |
105 | case BIO_CB_RETURN|BIO_CB_READ: | 111 | case BIO_CB_RETURN|BIO_CB_READ: |
106 | sprintf(p,"read return %ld\n",ret); | 112 | snprintf(p,p_maxlen,"read return %ld\n",ret); |
107 | break; | 113 | break; |
108 | case BIO_CB_RETURN|BIO_CB_WRITE: | 114 | case BIO_CB_RETURN|BIO_CB_WRITE: |
109 | sprintf(p,"write return %ld\n",ret); | 115 | snprintf(p,p_maxlen,"write return %ld\n",ret); |
110 | break; | 116 | break; |
111 | case BIO_CB_RETURN|BIO_CB_GETS: | 117 | case BIO_CB_RETURN|BIO_CB_GETS: |
112 | sprintf(p,"gets return %ld\n",ret); | 118 | snprintf(p,p_maxlen,"gets return %ld\n",ret); |
113 | break; | 119 | break; |
114 | case BIO_CB_RETURN|BIO_CB_PUTS: | 120 | case BIO_CB_RETURN|BIO_CB_PUTS: |
115 | sprintf(p,"puts return %ld\n",ret); | 121 | snprintf(p,p_maxlen,"puts return %ld\n",ret); |
116 | break; | 122 | break; |
117 | case BIO_CB_RETURN|BIO_CB_CTRL: | 123 | case BIO_CB_RETURN|BIO_CB_CTRL: |
118 | sprintf(p,"ctrl return %ld\n",ret); | 124 | snprintf(p,p_maxlen,"ctrl return %ld\n",ret); |
119 | break; | 125 | break; |
120 | default: | 126 | default: |
121 | sprintf(p,"bio callback - unknown type (%d)\n",cmd); | 127 | snprintf(p,p_maxlen,"bio callback - unknown type (%d)\n",cmd); |
122 | break; | 128 | break; |
123 | } | 129 | } |
124 | 130 | ||
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c index 692c8fb5c6..50df2238fa 100644 --- a/src/lib/libcrypto/bio/bio_lib.c +++ b/src/lib/libcrypto/bio/bio_lib.c | |||
@@ -272,18 +272,6 @@ int BIO_gets(BIO *b, char *in, int inl) | |||
272 | return(i); | 272 | return(i); |
273 | } | 273 | } |
274 | 274 | ||
275 | int BIO_indent(BIO *b,int indent,int max) | ||
276 | { | ||
277 | if(indent < 0) | ||
278 | indent=0; | ||
279 | if(indent > max) | ||
280 | indent=max; | ||
281 | while(indent--) | ||
282 | if(BIO_puts(b," ") != 1) | ||
283 | return 0; | ||
284 | return 1; | ||
285 | } | ||
286 | |||
287 | long BIO_int_ctrl(BIO *b, int cmd, long larg, int iarg) | 275 | long BIO_int_ctrl(BIO *b, int cmd, long larg, int iarg) |
288 | { | 276 | { |
289 | int i; | 277 | int i; |
@@ -395,8 +383,6 @@ BIO *BIO_pop(BIO *b) | |||
395 | if (b == NULL) return(NULL); | 383 | if (b == NULL) return(NULL); |
396 | ret=b->next_bio; | 384 | ret=b->next_bio; |
397 | 385 | ||
398 | BIO_ctrl(b,BIO_CTRL_POP,0,NULL); | ||
399 | |||
400 | if (b->prev_bio != NULL) | 386 | if (b->prev_bio != NULL) |
401 | b->prev_bio->next_bio=b->next_bio; | 387 | b->prev_bio->next_bio=b->next_bio; |
402 | if (b->next_bio != NULL) | 388 | if (b->next_bio != NULL) |
@@ -404,6 +390,7 @@ BIO *BIO_pop(BIO *b) | |||
404 | 390 | ||
405 | b->next_bio=NULL; | 391 | b->next_bio=NULL; |
406 | b->prev_bio=NULL; | 392 | b->prev_bio=NULL; |
393 | BIO_ctrl(b,BIO_CTRL_POP,0,NULL); | ||
407 | return(ret); | 394 | return(ret); |
408 | } | 395 | } |
409 | 396 | ||
diff --git a/src/lib/libcrypto/bio/bss_bio.c b/src/lib/libcrypto/bio/bss_bio.c index aa58dab046..1c485a4479 100644 --- a/src/lib/libcrypto/bio/bss_bio.c +++ b/src/lib/libcrypto/bio/bss_bio.c | |||
@@ -28,12 +28,13 @@ | |||
28 | 28 | ||
29 | #include <openssl/bio.h> | 29 | #include <openssl/bio.h> |
30 | #include <openssl/err.h> | 30 | #include <openssl/err.h> |
31 | #include <openssl/err.h> | ||
31 | #include <openssl/crypto.h> | 32 | #include <openssl/crypto.h> |
32 | 33 | ||
33 | #include "e_os.h" | 34 | #include "e_os.h" |
34 | 35 | ||
35 | /* VxWorks defines SSIZE_MAX with an empty value causing compile errors */ | 36 | /* VxWorks defines SSIZE_MAX with an empty value causing compile errors */ |
36 | #if defined(OPENSSL_SYS_VXWORKS) | 37 | #if defined(OPENSSL_SYS_VSWORKS) |
37 | # undef SSIZE_MAX | 38 | # undef SSIZE_MAX |
38 | #endif | 39 | #endif |
39 | #ifndef SSIZE_MAX | 40 | #ifndef SSIZE_MAX |
diff --git a/src/lib/libcrypto/bio/bss_conn.c b/src/lib/libcrypto/bio/bss_conn.c index 743db6ff94..81f27dba4c 100644 --- a/src/lib/libcrypto/bio/bss_conn.c +++ b/src/lib/libcrypto/bio/bss_conn.c | |||
@@ -519,10 +519,10 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
519 | else if (num == 2) | 519 | else if (num == 2) |
520 | { | 520 | { |
521 | char buf[16]; | 521 | char buf[16]; |
522 | unsigned char *p = ptr; | 522 | char *p = ptr; |
523 | 523 | ||
524 | sprintf(buf,"%d.%d.%d.%d", | 524 | snprintf(buf,sizeof buf,"%d.%d.%d.%d", |
525 | p[0],p[1],p[2],p[3]); | 525 | p[0],p[1],p[2],p[3]); |
526 | if (data->param_hostname != NULL) | 526 | if (data->param_hostname != NULL) |
527 | OPENSSL_free(data->param_hostname); | 527 | OPENSSL_free(data->param_hostname); |
528 | data->param_hostname=BUF_strdup(buf); | 528 | data->param_hostname=BUF_strdup(buf); |
@@ -530,9 +530,9 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
530 | } | 530 | } |
531 | else if (num == 3) | 531 | else if (num == 3) |
532 | { | 532 | { |
533 | char buf[DECIMAL_SIZE(int)+1]; | 533 | char buf[16]; |
534 | 534 | ||
535 | sprintf(buf,"%d",*(int *)ptr); | 535 | snprintf(buf,sizeof buf,"%d",*(int *)ptr); |
536 | if (data->param_port != NULL) | 536 | if (data->param_port != NULL) |
537 | OPENSSL_free(data->param_port); | 537 | OPENSSL_free(data->param_port); |
538 | data->param_port=BUF_strdup(buf); | 538 | data->param_port=BUF_strdup(buf); |
diff --git a/src/lib/libcrypto/bio/bss_file.c b/src/lib/libcrypto/bio/bss_file.c index a66600c1a3..18e7bb86e6 100644 --- a/src/lib/libcrypto/bio/bss_file.c +++ b/src/lib/libcrypto/bio/bss_file.c | |||
@@ -232,22 +232,22 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
232 | if (num & BIO_FP_APPEND) | 232 | if (num & BIO_FP_APPEND) |
233 | { | 233 | { |
234 | if (num & BIO_FP_READ) | 234 | if (num & BIO_FP_READ) |
235 | strcpy(p,"a+"); | 235 | strlcpy(p,"a+",sizeof p); |
236 | else strcpy(p,"a"); | 236 | else strlcpy(p,"a",sizeof p); |
237 | } | 237 | } |
238 | else if ((num & BIO_FP_READ) && (num & BIO_FP_WRITE)) | 238 | else if ((num & BIO_FP_READ) && (num & BIO_FP_WRITE)) |
239 | strcpy(p,"r+"); | 239 | strlcpy(p,"r+",sizeof p); |
240 | else if (num & BIO_FP_WRITE) | 240 | else if (num & BIO_FP_WRITE) |
241 | strcpy(p,"w"); | 241 | strlcpy(p,"w",sizeof p); |
242 | else if (num & BIO_FP_READ) | 242 | else if (num & BIO_FP_READ) |
243 | strcpy(p,"r"); | 243 | strlcpy(p,"r",sizeof p); |
244 | else | 244 | else |
245 | { | 245 | { |
246 | BIOerr(BIO_F_FILE_CTRL,BIO_R_BAD_FOPEN_MODE); | 246 | BIOerr(BIO_F_FILE_CTRL,BIO_R_BAD_FOPEN_MODE); |
247 | ret=0; | 247 | ret=0; |
248 | break; | 248 | break; |
249 | } | 249 | } |
250 | #if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_OS2) | 250 | #if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) |
251 | if (!(num & BIO_FP_TEXT)) | 251 | if (!(num & BIO_FP_TEXT)) |
252 | strcat(p,"b"); | 252 | strcat(p,"b"); |
253 | else | 253 | else |
diff --git a/src/lib/libcrypto/bio/bss_log.c b/src/lib/libcrypto/bio/bss_log.c index 1eb678cac0..a39d95297c 100644 --- a/src/lib/libcrypto/bio/bss_log.c +++ b/src/lib/libcrypto/bio/bss_log.c | |||
@@ -68,8 +68,7 @@ | |||
68 | 68 | ||
69 | #include "cryptlib.h" | 69 | #include "cryptlib.h" |
70 | 70 | ||
71 | #if defined(OPENSSL_SYS_WINCE) | 71 | #if defined(OPENSSL_SYS_WIN32) |
72 | #elif defined(OPENSSL_SYS_WIN32) | ||
73 | # include <process.h> | 72 | # include <process.h> |
74 | #elif defined(OPENSSL_SYS_VMS) | 73 | #elif defined(OPENSSL_SYS_VMS) |
75 | # include <opcdef.h> | 74 | # include <opcdef.h> |
@@ -78,7 +77,7 @@ | |||
78 | # include <starlet.h> | 77 | # include <starlet.h> |
79 | #elif defined(__ultrix) | 78 | #elif defined(__ultrix) |
80 | # include <sys/syslog.h> | 79 | # include <sys/syslog.h> |
81 | #elif (!defined(MSDOS) || defined(WATT32)) && !defined(OPENSSL_SYS_VXWORKS) && !defined(NO_SYSLOG) | 80 | #elif !defined(MSDOS) && !defined(OPENSSL_SYS_VXWORKS) && !defined(NO_SYSLOG) /* Unix */ |
82 | # include <syslog.h> | 81 | # include <syslog.h> |
83 | #endif | 82 | #endif |
84 | 83 | ||
@@ -275,7 +274,7 @@ static void xsyslog(BIO *bp, int priority, const char *string) | |||
275 | LPCSTR lpszStrings[2]; | 274 | LPCSTR lpszStrings[2]; |
276 | WORD evtype= EVENTLOG_ERROR_TYPE; | 275 | WORD evtype= EVENTLOG_ERROR_TYPE; |
277 | int pid = _getpid(); | 276 | int pid = _getpid(); |
278 | char pidbuf[DECIMAL_SIZE(pid)+4]; | 277 | char pidbuf[20]; |
279 | 278 | ||
280 | switch (priority) | 279 | switch (priority) |
281 | { | 280 | { |
@@ -374,15 +373,11 @@ static void xcloselog(BIO* bp) | |||
374 | { | 373 | { |
375 | } | 374 | } |
376 | 375 | ||
377 | #else /* Unix/Watt32 */ | 376 | #else /* Unix */ |
378 | 377 | ||
379 | static void xopenlog(BIO* bp, char* name, int level) | 378 | static void xopenlog(BIO* bp, char* name, int level) |
380 | { | 379 | { |
381 | #ifdef WATT32 /* djgpp/DOS */ | ||
382 | openlog(name, LOG_PID|LOG_CONS|LOG_NDELAY, level); | ||
383 | #else | ||
384 | openlog(name, LOG_PID|LOG_CONS, level); | 380 | openlog(name, LOG_PID|LOG_CONS, level); |
385 | #endif | ||
386 | } | 381 | } |
387 | 382 | ||
388 | static void xsyslog(BIO *bp, int priority, const char *string) | 383 | static void xsyslog(BIO *bp, int priority, const char *string) |
diff --git a/src/lib/libcrypto/bio/bss_mem.c b/src/lib/libcrypto/bio/bss_mem.c index a4edb711ae..28ff7582bf 100644 --- a/src/lib/libcrypto/bio/bss_mem.c +++ b/src/lib/libcrypto/bio/bss_mem.c | |||
@@ -190,7 +190,7 @@ static int mem_write(BIO *b, const char *in, int inl) | |||
190 | 190 | ||
191 | BIO_clear_retry_flags(b); | 191 | BIO_clear_retry_flags(b); |
192 | blen=bm->length; | 192 | blen=bm->length; |
193 | if (BUF_MEM_grow_clean(bm,blen+inl) != (blen+inl)) | 193 | if (BUF_MEM_grow(bm,blen+inl) != (blen+inl)) |
194 | goto end; | 194 | goto end; |
195 | memcpy(&(bm->data[blen]),in,inl); | 195 | memcpy(&(bm->data[blen]),in,inl); |
196 | ret=inl; | 196 | ret=inl; |
@@ -284,11 +284,7 @@ static int mem_gets(BIO *bp, char *buf, int size) | |||
284 | 284 | ||
285 | BIO_clear_retry_flags(bp); | 285 | BIO_clear_retry_flags(bp); |
286 | j=bm->length; | 286 | j=bm->length; |
287 | if (j <= 0) | 287 | if (j <= 0) return(0); |
288 | { | ||
289 | *buf='\0'; | ||
290 | return 0; | ||
291 | } | ||
292 | p=bm->data; | 288 | p=bm->data; |
293 | for (i=0; i<j; i++) | 289 | for (i=0; i<j; i++) |
294 | { | 290 | { |
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 2c1c405ec7..fdabd16d7e 100644 --- a/src/lib/libcrypto/bio/bss_sock.c +++ b/src/lib/libcrypto/bio/bss_sock.c | |||
@@ -64,12 +64,6 @@ | |||
64 | #include "cryptlib.h" | 64 | #include "cryptlib.h" |
65 | #include <openssl/bio.h> | 65 | #include <openssl/bio.h> |
66 | 66 | ||
67 | #ifdef WATT32 | ||
68 | #define sock_write SockWrite /* Watt-32 uses same names */ | ||
69 | #define sock_read SockRead | ||
70 | #define sock_puts SockPuts | ||
71 | #endif | ||
72 | |||
73 | static int sock_write(BIO *h, const char *buf, int num); | 67 | static int sock_write(BIO *h, const char *buf, int num); |
74 | static int sock_read(BIO *h, char *buf, int size); | 68 | static int sock_read(BIO *h, char *buf, int size); |
75 | static int sock_puts(BIO *h, const char *str); | 69 | static int sock_puts(BIO *h, const char *str); |