Print this page
4853 illumos-gate is not lint-clean when built with openssl 1.0
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/openssl/libsunw_ssl/bio_ssl.c
+++ new/usr/src/lib/openssl/libsunw_ssl/bio_ssl.c
1 1 /* ssl/bio_ssl.c */
2 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 3 * All rights reserved.
4 4 *
5 5 * This package is an SSL implementation written
6 6 * by Eric Young (eay@cryptsoft.com).
7 7 * The implementation was written so as to conform with Netscapes SSL.
8 8 *
9 9 * This library is free for commercial and non-commercial use as long as
10 10 * the following conditions are aheared to. The following conditions
11 11 * apply to all code found in this distribution, be it the RC4, RSA,
12 12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 13 * included with this distribution is covered by the same copyright terms
14 14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 15 *
16 16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 17 * the code are not to be removed.
18 18 * If this package is used in a product, Eric Young should be given attribution
19 19 * as the author of the parts of the library used.
20 20 * This can be in the form of a textual message at program startup or
21 21 * in documentation (online or textual) provided with the package.
22 22 *
23 23 * Redistribution and use in source and binary forms, with or without
24 24 * modification, are permitted provided that the following conditions
25 25 * are met:
26 26 * 1. Redistributions of source code must retain the copyright
27 27 * notice, this list of conditions and the following disclaimer.
28 28 * 2. Redistributions in binary form must reproduce the above copyright
29 29 * notice, this list of conditions and the following disclaimer in the
30 30 * documentation and/or other materials provided with the distribution.
31 31 * 3. All advertising materials mentioning features or use of this software
32 32 * must display the following acknowledgement:
33 33 * "This product includes cryptographic software written by
34 34 * Eric Young (eay@cryptsoft.com)"
35 35 * The word 'cryptographic' can be left out if the rouines from the library
36 36 * being used are not cryptographic related :-).
37 37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 38 * the apps directory (application code) you must include an acknowledgement:
39 39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 40 *
41 41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 51 * SUCH DAMAGE.
52 52 *
↓ open down ↓ |
52 lines elided |
↑ open up ↑ |
53 53 * The licence and distribution terms for any publically available version or
54 54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 55 * copied and put under another distribution licence
56 56 * [including the GNU Public Licence.]
57 57 */
58 58
59 59 #include <stdio.h>
60 60 #include <stdlib.h>
61 61 #include <string.h>
62 62 #include <errno.h>
63 +#include <openssl/opensslconf.h>
63 64 #include <openssl/crypto.h>
64 65 #include <openssl/bio.h>
65 66 #include <openssl/err.h>
66 67 #include <openssl/ssl.h>
67 68
68 69 static int ssl_write(BIO *h, const char *buf, int num);
69 70 static int ssl_read(BIO *h, char *buf, int size);
70 71 static int ssl_puts(BIO *h, const char *str);
71 72 static long ssl_ctrl(BIO *h, int cmd, long arg1, void *arg2);
72 73 static int ssl_new(BIO *h);
73 74 static int ssl_free(BIO *data);
74 75 static long ssl_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
75 76 typedef struct bio_ssl_st
76 77 {
77 78 SSL *ssl; /* The ssl handle :-) */
78 79 /* re-negotiate every time the total number of bytes is this size */
79 80 int num_renegotiates;
80 81 unsigned long renegotiate_count;
81 82 unsigned long byte_count;
82 83 unsigned long renegotiate_timeout;
83 84 unsigned long last_time;
84 85 } BIO_SSL;
85 86
86 87 static BIO_METHOD methods_sslp=
87 88 {
88 89 BIO_TYPE_SSL,"ssl",
89 90 ssl_write,
90 91 ssl_read,
91 92 ssl_puts,
92 93 NULL, /* ssl_gets, */
93 94 ssl_ctrl,
94 95 ssl_new,
95 96 ssl_free,
96 97 ssl_callback_ctrl,
97 98 };
98 99
99 100 BIO_METHOD *BIO_f_ssl(void)
100 101 {
101 102 return(&methods_sslp);
102 103 }
103 104
104 105 static int ssl_new(BIO *bi)
105 106 {
106 107 BIO_SSL *bs;
107 108
108 109 bs=(BIO_SSL *)OPENSSL_malloc(sizeof(BIO_SSL));
109 110 if (bs == NULL)
110 111 {
111 112 BIOerr(BIO_F_SSL_NEW,ERR_R_MALLOC_FAILURE);
112 113 return(0);
113 114 }
114 115 memset(bs,0,sizeof(BIO_SSL));
115 116 bi->init=0;
116 117 bi->ptr=(char *)bs;
117 118 bi->flags=0;
118 119 return(1);
119 120 }
120 121
121 122 static int ssl_free(BIO *a)
122 123 {
123 124 BIO_SSL *bs;
124 125
125 126 if (a == NULL) return(0);
126 127 bs=(BIO_SSL *)a->ptr;
127 128 if (bs->ssl != NULL) SSL_shutdown(bs->ssl);
128 129 if (a->shutdown)
129 130 {
130 131 if (a->init && (bs->ssl != NULL))
131 132 SSL_free(bs->ssl);
132 133 a->init=0;
133 134 a->flags=0;
134 135 }
135 136 if (a->ptr != NULL)
136 137 OPENSSL_free(a->ptr);
137 138 return(1);
138 139 }
139 140
140 141 static int ssl_read(BIO *b, char *out, int outl)
141 142 {
142 143 int ret=1;
143 144 BIO_SSL *sb;
144 145 SSL *ssl;
145 146 int retry_reason=0;
146 147 int r=0;
147 148
148 149 if (out == NULL) return(0);
149 150 sb=(BIO_SSL *)b->ptr;
150 151 ssl=sb->ssl;
151 152
152 153 BIO_clear_retry_flags(b);
153 154
154 155 #if 0
155 156 if (!SSL_is_init_finished(ssl))
156 157 {
157 158 /* ret=SSL_do_handshake(ssl); */
158 159 if (ret > 0)
159 160 {
160 161
161 162 outflags=(BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY);
162 163 ret= -1;
163 164 goto end;
164 165 }
165 166 }
166 167 #endif
167 168 /* if (ret > 0) */
168 169 ret=SSL_read(ssl,out,outl);
169 170
170 171 switch (SSL_get_error(ssl,ret))
171 172 {
172 173 case SSL_ERROR_NONE:
173 174 if (ret <= 0) break;
174 175 if (sb->renegotiate_count > 0)
175 176 {
176 177 sb->byte_count+=ret;
177 178 if (sb->byte_count > sb->renegotiate_count)
178 179 {
179 180 sb->byte_count=0;
180 181 sb->num_renegotiates++;
181 182 SSL_renegotiate(ssl);
182 183 r=1;
183 184 }
184 185 }
185 186 if ((sb->renegotiate_timeout > 0) && (!r))
186 187 {
187 188 unsigned long tm;
188 189
189 190 tm=(unsigned long)time(NULL);
190 191 if (tm > sb->last_time+sb->renegotiate_timeout)
191 192 {
192 193 sb->last_time=tm;
193 194 sb->num_renegotiates++;
194 195 SSL_renegotiate(ssl);
195 196 }
196 197 }
197 198
198 199 break;
199 200 case SSL_ERROR_WANT_READ:
200 201 BIO_set_retry_read(b);
201 202 break;
202 203 case SSL_ERROR_WANT_WRITE:
203 204 BIO_set_retry_write(b);
204 205 break;
205 206 case SSL_ERROR_WANT_X509_LOOKUP:
206 207 BIO_set_retry_special(b);
207 208 retry_reason=BIO_RR_SSL_X509_LOOKUP;
208 209 break;
209 210 case SSL_ERROR_WANT_ACCEPT:
210 211 BIO_set_retry_special(b);
211 212 retry_reason=BIO_RR_ACCEPT;
212 213 break;
213 214 case SSL_ERROR_WANT_CONNECT:
214 215 BIO_set_retry_special(b);
215 216 retry_reason=BIO_RR_CONNECT;
216 217 break;
217 218 case SSL_ERROR_SYSCALL:
218 219 case SSL_ERROR_SSL:
219 220 case SSL_ERROR_ZERO_RETURN:
220 221 default:
221 222 break;
222 223 }
223 224
224 225 b->retry_reason=retry_reason;
225 226 return(ret);
226 227 }
227 228
228 229 static int ssl_write(BIO *b, const char *out, int outl)
229 230 {
230 231 int ret,r=0;
231 232 int retry_reason=0;
232 233 SSL *ssl;
233 234 BIO_SSL *bs;
234 235
235 236 if (out == NULL) return(0);
236 237 bs=(BIO_SSL *)b->ptr;
237 238 ssl=bs->ssl;
238 239
239 240 BIO_clear_retry_flags(b);
240 241
241 242 /* ret=SSL_do_handshake(ssl);
242 243 if (ret > 0) */
243 244 ret=SSL_write(ssl,out,outl);
244 245
245 246 switch (SSL_get_error(ssl,ret))
246 247 {
247 248 case SSL_ERROR_NONE:
248 249 if (ret <= 0) break;
249 250 if (bs->renegotiate_count > 0)
250 251 {
251 252 bs->byte_count+=ret;
252 253 if (bs->byte_count > bs->renegotiate_count)
253 254 {
254 255 bs->byte_count=0;
255 256 bs->num_renegotiates++;
256 257 SSL_renegotiate(ssl);
257 258 r=1;
258 259 }
259 260 }
260 261 if ((bs->renegotiate_timeout > 0) && (!r))
261 262 {
262 263 unsigned long tm;
263 264
264 265 tm=(unsigned long)time(NULL);
265 266 if (tm > bs->last_time+bs->renegotiate_timeout)
266 267 {
267 268 bs->last_time=tm;
268 269 bs->num_renegotiates++;
269 270 SSL_renegotiate(ssl);
270 271 }
271 272 }
272 273 break;
273 274 case SSL_ERROR_WANT_WRITE:
274 275 BIO_set_retry_write(b);
275 276 break;
276 277 case SSL_ERROR_WANT_READ:
277 278 BIO_set_retry_read(b);
278 279 break;
279 280 case SSL_ERROR_WANT_X509_LOOKUP:
280 281 BIO_set_retry_special(b);
281 282 retry_reason=BIO_RR_SSL_X509_LOOKUP;
282 283 break;
283 284 case SSL_ERROR_WANT_CONNECT:
284 285 BIO_set_retry_special(b);
285 286 retry_reason=BIO_RR_CONNECT;
286 287 case SSL_ERROR_SYSCALL:
287 288 case SSL_ERROR_SSL:
288 289 default:
289 290 break;
290 291 }
291 292
292 293 b->retry_reason=retry_reason;
293 294 return(ret);
294 295 }
295 296
296 297 static long ssl_ctrl(BIO *b, int cmd, long num, void *ptr)
297 298 {
298 299 SSL **sslp,*ssl;
299 300 BIO_SSL *bs;
300 301 BIO *dbio,*bio;
301 302 long ret=1;
302 303
303 304 bs=(BIO_SSL *)b->ptr;
304 305 ssl=bs->ssl;
305 306 if ((ssl == NULL) && (cmd != BIO_C_SET_SSL))
306 307 return(0);
307 308 switch (cmd)
308 309 {
309 310 case BIO_CTRL_RESET:
310 311 SSL_shutdown(ssl);
311 312
312 313 if (ssl->handshake_func == ssl->method->ssl_connect)
313 314 SSL_set_connect_state(ssl);
314 315 else if (ssl->handshake_func == ssl->method->ssl_accept)
315 316 SSL_set_accept_state(ssl);
316 317
317 318 SSL_clear(ssl);
318 319
319 320 if (b->next_bio != NULL)
320 321 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
321 322 else if (ssl->rbio != NULL)
322 323 ret=BIO_ctrl(ssl->rbio,cmd,num,ptr);
323 324 else
324 325 ret=1;
325 326 break;
326 327 case BIO_CTRL_INFO:
327 328 ret=0;
328 329 break;
329 330 case BIO_C_SSL_MODE:
330 331 if (num) /* client mode */
331 332 SSL_set_connect_state(ssl);
332 333 else
333 334 SSL_set_accept_state(ssl);
334 335 break;
335 336 case BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT:
336 337 ret=bs->renegotiate_timeout;
337 338 if (num < 60) num=5;
338 339 bs->renegotiate_timeout=(unsigned long)num;
339 340 bs->last_time=(unsigned long)time(NULL);
340 341 break;
341 342 case BIO_C_SET_SSL_RENEGOTIATE_BYTES:
342 343 ret=bs->renegotiate_count;
343 344 if ((long)num >=512)
344 345 bs->renegotiate_count=(unsigned long)num;
345 346 break;
346 347 case BIO_C_GET_SSL_NUM_RENEGOTIATES:
347 348 ret=bs->num_renegotiates;
348 349 break;
349 350 case BIO_C_SET_SSL:
350 351 if (ssl != NULL)
351 352 {
352 353 ssl_free(b);
353 354 if (!ssl_new(b))
354 355 return 0;
355 356 }
356 357 b->shutdown=(int)num;
357 358 ssl=(SSL *)ptr;
358 359 ((BIO_SSL *)b->ptr)->ssl=ssl;
359 360 bio=SSL_get_rbio(ssl);
360 361 if (bio != NULL)
361 362 {
362 363 if (b->next_bio != NULL)
363 364 BIO_push(bio,b->next_bio);
364 365 b->next_bio=bio;
365 366 CRYPTO_add(&bio->references,1,CRYPTO_LOCK_BIO);
366 367 }
367 368 b->init=1;
368 369 break;
369 370 case BIO_C_GET_SSL:
370 371 if (ptr != NULL)
371 372 {
372 373 sslp=(SSL **)ptr;
373 374 *sslp=ssl;
374 375 }
375 376 else
376 377 ret=0;
377 378 break;
378 379 case BIO_CTRL_GET_CLOSE:
379 380 ret=b->shutdown;
380 381 break;
381 382 case BIO_CTRL_SET_CLOSE:
382 383 b->shutdown=(int)num;
383 384 break;
384 385 case BIO_CTRL_WPENDING:
385 386 ret=BIO_ctrl(ssl->wbio,cmd,num,ptr);
386 387 break;
387 388 case BIO_CTRL_PENDING:
388 389 ret=SSL_pending(ssl);
389 390 if (ret == 0)
390 391 ret=BIO_pending(ssl->rbio);
391 392 break;
392 393 case BIO_CTRL_FLUSH:
393 394 BIO_clear_retry_flags(b);
394 395 ret=BIO_ctrl(ssl->wbio,cmd,num,ptr);
395 396 BIO_copy_next_retry(b);
396 397 break;
397 398 case BIO_CTRL_PUSH:
398 399 if ((b->next_bio != NULL) && (b->next_bio != ssl->rbio))
399 400 {
400 401 SSL_set_bio(ssl,b->next_bio,b->next_bio);
401 402 CRYPTO_add(&b->next_bio->references,1,CRYPTO_LOCK_BIO);
402 403 }
403 404 break;
404 405 case BIO_CTRL_POP:
405 406 /* Only detach if we are the BIO explicitly being popped */
406 407 if (b == ptr)
407 408 {
408 409 /* Shouldn't happen in practice because the
409 410 * rbio and wbio are the same when pushed.
410 411 */
411 412 if (ssl->rbio != ssl->wbio)
412 413 BIO_free_all(ssl->wbio);
413 414 if (b->next_bio != NULL)
414 415 CRYPTO_add(&b->next_bio->references,-1,CRYPTO_LOCK_BIO);
415 416 ssl->wbio=NULL;
416 417 ssl->rbio=NULL;
417 418 }
418 419 break;
419 420 case BIO_C_DO_STATE_MACHINE:
420 421 BIO_clear_retry_flags(b);
421 422
422 423 b->retry_reason=0;
423 424 ret=(int)SSL_do_handshake(ssl);
424 425
425 426 switch (SSL_get_error(ssl,(int)ret))
426 427 {
427 428 case SSL_ERROR_WANT_READ:
428 429 BIO_set_flags(b,
429 430 BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY);
430 431 break;
431 432 case SSL_ERROR_WANT_WRITE:
432 433 BIO_set_flags(b,
433 434 BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY);
434 435 break;
435 436 case SSL_ERROR_WANT_CONNECT:
436 437 BIO_set_flags(b,
437 438 BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY);
438 439 b->retry_reason=b->next_bio->retry_reason;
439 440 break;
440 441 default:
441 442 break;
442 443 }
443 444 break;
444 445 case BIO_CTRL_DUP:
445 446 dbio=(BIO *)ptr;
446 447 if (((BIO_SSL *)dbio->ptr)->ssl != NULL)
447 448 SSL_free(((BIO_SSL *)dbio->ptr)->ssl);
448 449 ((BIO_SSL *)dbio->ptr)->ssl=SSL_dup(ssl);
449 450 ((BIO_SSL *)dbio->ptr)->renegotiate_count=
450 451 ((BIO_SSL *)b->ptr)->renegotiate_count;
451 452 ((BIO_SSL *)dbio->ptr)->byte_count=
452 453 ((BIO_SSL *)b->ptr)->byte_count;
453 454 ((BIO_SSL *)dbio->ptr)->renegotiate_timeout=
454 455 ((BIO_SSL *)b->ptr)->renegotiate_timeout;
455 456 ((BIO_SSL *)dbio->ptr)->last_time=
456 457 ((BIO_SSL *)b->ptr)->last_time;
457 458 ret=(((BIO_SSL *)dbio->ptr)->ssl != NULL);
458 459 break;
459 460 case BIO_C_GET_FD:
460 461 ret=BIO_ctrl(ssl->rbio,cmd,num,ptr);
461 462 break;
462 463 case BIO_CTRL_SET_CALLBACK:
463 464 {
464 465 #if 0 /* FIXME: Should this be used? -- Richard Levitte */
465 466 SSLerr(SSL_F_SSL_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
466 467 ret = -1;
467 468 #else
468 469 ret=0;
469 470 #endif
470 471 }
471 472 break;
472 473 case BIO_CTRL_GET_CALLBACK:
473 474 {
474 475 void (**fptr)(const SSL *xssl,int type,int val);
475 476
476 477 fptr=(void (**)(const SSL *xssl,int type,int val))ptr;
477 478 *fptr=SSL_get_info_callback(ssl);
478 479 }
479 480 break;
480 481 default:
481 482 ret=BIO_ctrl(ssl->rbio,cmd,num,ptr);
482 483 break;
483 484 }
484 485 return(ret);
485 486 }
486 487
487 488 static long ssl_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
488 489 {
489 490 SSL *ssl;
490 491 BIO_SSL *bs;
491 492 long ret=1;
492 493
493 494 bs=(BIO_SSL *)b->ptr;
494 495 ssl=bs->ssl;
495 496 switch (cmd)
496 497 {
497 498 case BIO_CTRL_SET_CALLBACK:
498 499 {
499 500 /* FIXME: setting this via a completely different prototype
500 501 seems like a crap idea */
501 502 SSL_set_info_callback(ssl,(void (*)(const SSL *,int,int))fp);
502 503 }
503 504 break;
504 505 default:
505 506 ret=BIO_callback_ctrl(ssl->rbio,cmd,fp);
506 507 break;
507 508 }
508 509 return(ret);
509 510 }
510 511
511 512 static int ssl_puts(BIO *bp, const char *str)
512 513 {
513 514 int n,ret;
514 515
515 516 n=strlen(str);
516 517 ret=BIO_write(bp,str,n);
517 518 return(ret);
518 519 }
519 520
520 521 BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx)
521 522 {
522 523 #ifndef OPENSSL_NO_SOCK
523 524 BIO *ret=NULL,*buf=NULL,*ssl=NULL;
524 525
525 526 if ((buf=BIO_new(BIO_f_buffer())) == NULL)
526 527 return(NULL);
527 528 if ((ssl=BIO_new_ssl_connect(ctx)) == NULL)
528 529 goto err;
529 530 if ((ret=BIO_push(buf,ssl)) == NULL)
530 531 goto err;
531 532 return(ret);
532 533 err:
533 534 if (buf != NULL) BIO_free(buf);
534 535 if (ssl != NULL) BIO_free(ssl);
535 536 #endif
536 537 return(NULL);
537 538 }
538 539
539 540 BIO *BIO_new_ssl_connect(SSL_CTX *ctx)
540 541 {
541 542 #ifndef OPENSSL_NO_SOCK
542 543 BIO *ret=NULL,*con=NULL,*ssl=NULL;
543 544
544 545 if ((con=BIO_new(BIO_s_connect())) == NULL)
545 546 return(NULL);
546 547 if ((ssl=BIO_new_ssl(ctx,1)) == NULL)
547 548 goto err;
548 549 if ((ret=BIO_push(ssl,con)) == NULL)
549 550 goto err;
550 551 return(ret);
551 552 err:
552 553 if (con != NULL) BIO_free(con);
553 554 #endif
554 555 return(NULL);
555 556 }
556 557
557 558 BIO *BIO_new_ssl(SSL_CTX *ctx, int client)
558 559 {
559 560 BIO *ret;
560 561 SSL *ssl;
561 562
562 563 if ((ret=BIO_new(BIO_f_ssl())) == NULL)
563 564 return(NULL);
564 565 if ((ssl=SSL_new(ctx)) == NULL)
565 566 {
566 567 BIO_free(ret);
567 568 return(NULL);
568 569 }
569 570 if (client)
570 571 SSL_set_connect_state(ssl);
571 572 else
572 573 SSL_set_accept_state(ssl);
573 574
574 575 BIO_set_ssl(ret,ssl,BIO_CLOSE);
575 576 return(ret);
576 577 }
577 578
578 579 int BIO_ssl_copy_session_id(BIO *t, BIO *f)
579 580 {
580 581 t=BIO_find_type(t,BIO_TYPE_SSL);
581 582 f=BIO_find_type(f,BIO_TYPE_SSL);
582 583 if ((t == NULL) || (f == NULL))
583 584 return(0);
584 585 if ( (((BIO_SSL *)t->ptr)->ssl == NULL) ||
585 586 (((BIO_SSL *)f->ptr)->ssl == NULL))
586 587 return(0);
587 588 SSL_copy_session_id(((BIO_SSL *)t->ptr)->ssl,((BIO_SSL *)f->ptr)->ssl);
588 589 return(1);
589 590 }
590 591
591 592 void BIO_ssl_shutdown(BIO *b)
592 593 {
593 594 SSL *s;
594 595
595 596 while (b != NULL)
596 597 {
597 598 if (b->method->type == BIO_TYPE_SSL)
598 599 {
599 600 s=((BIO_SSL *)b->ptr)->ssl;
600 601 SSL_shutdown(s);
601 602 break;
602 603 }
603 604 b=b->next_bio;
604 605 }
605 606 }
↓ open down ↓ |
533 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX