diff options
| author | jsing <> | 2015-03-27 12:29:54 +0000 |
|---|---|---|
| committer | jsing <> | 2015-03-27 12:29:54 +0000 |
| commit | e4bb8802504ce04db08be8266b9377e800301e84 (patch) | |
| tree | d1107e1e9c18e2392e54fb1e385c31262c4dbd2e /src/lib/libssl/s3_both.c | |
| parent | 3c33e1429e1b0d6e6a121c97b536af97a1fd8e0a (diff) | |
| download | openbsd-e4bb8802504ce04db08be8266b9377e800301e84.tar.gz openbsd-e4bb8802504ce04db08be8266b9377e800301e84.tar.bz2 openbsd-e4bb8802504ce04db08be8266b9377e800301e84.zip | |
Factor out the init_buf initialisation code, rather than duplicating it
in four different places.
ok doug@ guenther@
Diffstat (limited to 'src/lib/libssl/s3_both.c')
| -rw-r--r-- | src/lib/libssl/s3_both.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/lib/libssl/s3_both.c b/src/lib/libssl/s3_both.c index a2ce9e9fa3..633bf5bb7b 100644 --- a/src/lib/libssl/s3_both.c +++ b/src/lib/libssl/s3_both.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: s3_both.c,v 1.37 2014/12/14 21:49:29 bcook Exp $ */ | 1 | /* $OpenBSD: s3_both.c,v 1.38 2015/03/27 12:29:54 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -607,6 +607,27 @@ ssl_verify_alarm_type(long type) | |||
| 607 | } | 607 | } |
| 608 | 608 | ||
| 609 | int | 609 | int |
| 610 | ssl3_setup_init_buffer(SSL *s) | ||
| 611 | { | ||
| 612 | BUF_MEM *buf = NULL; | ||
| 613 | |||
| 614 | if (s->init_buf != NULL) | ||
| 615 | return (1); | ||
| 616 | |||
| 617 | if ((buf = BUF_MEM_new()) == NULL) | ||
| 618 | goto err; | ||
| 619 | if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) | ||
| 620 | goto err; | ||
| 621 | |||
| 622 | s->init_buf = buf; | ||
| 623 | return (1); | ||
| 624 | |||
| 625 | err: | ||
| 626 | BUF_MEM_free(buf); | ||
| 627 | return (0); | ||
| 628 | } | ||
| 629 | |||
| 630 | int | ||
| 610 | ssl3_setup_read_buffer(SSL *s) | 631 | ssl3_setup_read_buffer(SSL *s) |
| 611 | { | 632 | { |
| 612 | unsigned char *p; | 633 | unsigned char *p; |
| @@ -673,7 +694,6 @@ err: | |||
| 673 | return 0; | 694 | return 0; |
| 674 | } | 695 | } |
| 675 | 696 | ||
| 676 | |||
| 677 | int | 697 | int |
| 678 | ssl3_setup_buffers(SSL *s) | 698 | ssl3_setup_buffers(SSL *s) |
| 679 | { | 699 | { |
| @@ -699,4 +719,3 @@ ssl3_release_read_buffer(SSL *s) | |||
| 699 | s->s3->rbuf.buf = NULL; | 719 | s->s3->rbuf.buf = NULL; |
| 700 | return 1; | 720 | return 1; |
| 701 | } | 721 | } |
| 702 | |||
