diff options
author | Matt Caswell <matt@openssl.org> | 2015-03-31 13:57:46 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2015-05-16 09:20:38 +0100 |
commit | a3680c8f9c33d4190c367572645980ccdb9d5bbf (patch) | |
tree | 9f3d8c4400d5fe070f3ef3a306a42d34f10bf65c /ssl/record | |
parent | 13c9bb3ecec5f847b4c5295249e039d386e2d10e (diff) |
Version negotiation rewrite cleanup
Following the version negotiation rewrite all of the previous code that was
dedicated to version negotiation can now be deleted - all six source files
of it!!
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Diffstat (limited to 'ssl/record')
-rw-r--r-- | ssl/record/README | 16 | ||||
-rw-r--r-- | ssl/record/rec_layer_s23.c | 114 | ||||
-rw-r--r-- | ssl/record/record.h | 2 |
3 files changed, 6 insertions, 126 deletions
diff --git a/ssl/record/README b/ssl/record/README index 6870b53138..987e9fd305 100644 --- a/ssl/record/README +++ b/ssl/record/README @@ -21,7 +21,7 @@ The source files map to components as follows: dtls1_bitmap.c -> DTLS1_BITMAP component ssl3_buffer.c -> SSL3_BUFFER component ssl3_record.c -> SSL3_RECORD component -rec_layer_s23.c, rec_layer_s3.c, rec_layer_d1.c -> RECORD_LAYER component +rec_layer_s3.c, rec_layer_d1.c -> RECORD_LAYER component The RECORD_LAYER component is a facade pattern, i.e. it provides a simplified interface to the record layer for the rest of libssl. The other 3 components are @@ -46,9 +46,6 @@ Conceptually it looks like this: | | | RECORD_LAYER | | | - | rec_layer_s23.c | - | ^ | - | | | | rec_layer_s3.c | | ^ | | _________|__________ | @@ -69,10 +66,9 @@ Conceptually it looks like this: |_______________| |_______________| |________________| -The three RECORD_LAYER source files build progressively on each other, i.e. -the simplest is rec_layer_s23.c. This provides the most basic functions used -for version negotiation. Next rec_layer_s3.c adds the SSL/TLS layer. Finally -rec_layer_d1.c builds off of the SSL/TLS code to provide DTLS specific -capabilities. It uses some DTLS specific RECORD_LAYER component members which -should only be accessed from rec_layer_d1.c. These are held in the +The two RECORD_LAYER source files build on each other, i.e. +the main one is rec_layer_s3.c which provides the core SSL/TLS layer. The second +one is rec_layer_d1.c which builds off of the SSL/TLS code to provide DTLS +specific capabilities. It uses some DTLS specific RECORD_LAYER component members +which should only be accessed from rec_layer_d1.c. These are held in the DTLS1_RECORD_LAYER struct. diff --git a/ssl/record/rec_layer_s23.c b/ssl/record/rec_layer_s23.c deleted file mode 100644 index eb09be1e3a..0000000000 --- a/ssl/record/rec_layer_s23.c +++ /dev/null @@ -1,114 +0,0 @@ -/* ssl/record/rec_layer_s23.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include <stdio.h> -#include <errno.h> -#define USE_SOCKETS -#include "../ssl_locl.h" -#include <openssl/evp.h> -#include <openssl/buffer.h> - -int ssl23_write_bytes(SSL *s) -{ - int i, num, tot; - char *buf; - - buf = s->init_buf->data; - tot = s->init_off; - num = s->init_num; - for (;;) { - s->rwstate = SSL_WRITING; - i = BIO_write(s->wbio, &(buf[tot]), num); - if (i <= 0) { - s->init_off = tot; - s->init_num = num; - return (i); - } - s->rwstate = SSL_NOTHING; - if (i == num) - return (tot + i); - - num -= i; - tot += i; - } -} - -/* return regularly only when we have read (at least) 'n' bytes */ -int ssl23_read_bytes(SSL *s, int n) -{ - unsigned char *p; - int j; - - if (s->rlayer.packet_length < (unsigned int)n) { - p = s->rlayer.packet; - - for (;;) { - s->rwstate = SSL_READING; - j = BIO_read(s->rbio, - (char *)&(p[s->rlayer.packet_length]), - n - s->rlayer.packet_length); - if (j <= 0) - return (j); - s->rwstate = SSL_NOTHING; - s->rlayer.packet_length += j; - if (s->rlayer.packet_length >= (unsigned int)n) - return (s->rlayer.packet_length); - } - } - return (n); -} diff --git a/ssl/record/record.h b/ssl/record/record.h index a778998196..cf1607ccb4 100644 --- a/ssl/record/record.h +++ b/ssl/record/record.h @@ -328,8 +328,6 @@ int RECORD_LAYER_setup_comp_buffer(RECORD_LAYER *rl); int RECORD_LAYER_is_sslv2_record(RECORD_LAYER *rl); int RECORD_LAYER_get_rrec_length(RECORD_LAYER *rl); __owur int ssl3_pending(const SSL *s); -__owur int ssl23_read_bytes(SSL *s, int n); -__owur int ssl23_write_bytes(SSL *s); __owur int ssl3_write_bytes(SSL *s, int type, const void *buf, int len); __owur int do_ssl3_write(SSL *s, int type, const unsigned char *buf, unsigned int len, int create_empty_fragment); |