X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=ssl%2Frecord%2Fssl3_record.c;h=49ba00b49087af0c7c72e1d73713610d4f7c7f6c;hp=33122626ec2114947fc5b47056cede73d4fdc206;hb=ea71906ed7437671c434fccddc8c4c41bb3aeb51;hpb=94777c9c86a2b2ea2726c49d6c8f61078558beba diff --git a/ssl/record/ssl3_record.c b/ssl/record/ssl3_record.c index 33122626ec..49ba00b490 100644 --- a/ssl/record/ssl3_record.c +++ b/ssl/record/ssl3_record.c @@ -157,24 +157,6 @@ void SSL3_RECORD_release(SSL3_RECORD *r, unsigned int num_recs) } } -int SSL3_RECORD_setup(SSL3_RECORD *r, unsigned int num_recs) -{ - unsigned int i; - - for (i = 0; i < num_recs; i++) { - if (r[i].comp == NULL) - r[i].comp = (unsigned char *) - OPENSSL_malloc(SSL3_RT_MAX_ENCRYPTED_LENGTH); - if (r[i].comp == NULL) { - if (i > 0) - SSL3_RECORD_release(r, i); - return 0; - } - } - - return 1; -} - void SSL3_RECORD_set_seq_num(SSL3_RECORD *r, const unsigned char *seq_num) { memcpy(r->seq_num, seq_num, SEQ_NUM_SIZE); @@ -185,7 +167,7 @@ void SSL3_RECORD_set_seq_num(SSL3_RECORD *r, const unsigned char *seq_num) * Peeks ahead into "read_ahead" data to see if we have a whole record waiting * for us in the buffer. */ -static int have_whole_app_data_record_waiting(SSL *s) +static int ssl3_record_app_data_waiting(SSL *s) { SSL3_BUFFER *rbuf; int left, len; @@ -443,7 +425,7 @@ int ssl3_get_record(SSL *s) && s->enc_read_ctx != NULL && (EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(s->enc_read_ctx)) & EVP_CIPH_FLAG_PIPELINE) - && have_whole_app_data_record_waiting(s)); + && ssl3_record_app_data_waiting(s)); /* @@ -626,16 +608,23 @@ int ssl3_do_uncompress(SSL *ssl, SSL3_RECORD *rr) #ifndef OPENSSL_NO_COMP int i; + if (rr->comp == NULL) { + rr->comp = (unsigned char *) + OPENSSL_malloc(SSL3_RT_MAX_ENCRYPTED_LENGTH); + } + if (rr->comp == NULL) + return 0; + i = COMP_expand_block(ssl->expand, rr->comp, SSL3_RT_MAX_PLAIN_LENGTH, rr->data, (int)rr->length); if (i < 0) - return (0); + return 0; else rr->length = i; rr->data = rr->comp; #endif - return (1); + return 1; } int ssl3_do_compress(SSL *ssl, SSL3_RECORD *wr) @@ -657,7 +646,7 @@ int ssl3_do_compress(SSL *ssl, SSL3_RECORD *wr) } /*- - * ssl3_enc encrypts/decrypts the record in |s->wrec| / |s->rrec|, respectively. + * ssl3_enc encrypts/decrypts |numpipes| records in |inrecs| * * Returns: * 0: (in non-constant time) if the record is publically invalid (i.e. too @@ -730,7 +719,7 @@ int ssl3_enc(SSL *s, SSL3_RECORD *inrecs, unsigned int numpipes, int send) } /*- - * tls1_enc encrypts/decrypts the record in |s->wrec| / |s->rrec|, respectively. + * tls1_enc encrypts/decrypts |numpipes| in |recs|. * * Returns: * 0: (in non-constant time) if the record is publically invalid (i.e. too