From d5a25ae0deeabc9baaacef64f4c23fbd0c2d67e9 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Mon, 2 Feb 2015 14:03:50 +0000 Subject: [PATCH] Move ssl3_pending into the record layer Reviewed-by: Richard Levitte --- ssl/record/rec_layer.h | 1 + ssl/record/s3_pkt.c | 9 +++++++++ ssl/s3_lib.c | 10 ---------- ssl/ssl_locl.h | 1 - 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/ssl/record/rec_layer.h b/ssl/record/rec_layer.h index a4f0eb837c..4fb374de56 100644 --- a/ssl/record/rec_layer.h +++ b/ssl/record/rec_layer.h @@ -171,6 +171,7 @@ void RECORD_LAYER_release(RECORD_LAYER *rl); int RECORD_LAYER_read_pending(RECORD_LAYER *rl); int RECORD_LAYER_write_pending(RECORD_LAYER *rl); int RECORD_LAYER_set_data(RECORD_LAYER *rl, const unsigned char *buf, int len); +__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); diff --git a/ssl/record/s3_pkt.c b/ssl/record/s3_pkt.c index 0695d813b1..7653d8b8d6 100644 --- a/ssl/record/s3_pkt.c +++ b/ssl/record/s3_pkt.c @@ -201,6 +201,15 @@ int RECORD_LAYER_set_data(RECORD_LAYER *rl, const unsigned char *buf, int len) return 1; } +int ssl3_pending(const SSL *s) +{ + if (s->rstate == SSL_ST_READ_BODY) + return 0; + + return (SSL3_RECORD_get_type(&s->rlayer.rrec) == SSL3_RT_APPLICATION_DATA) + ? SSL3_RECORD_get_length(&s->rlayer.rrec) : 0; +} + int ssl3_read_n(SSL *s, int n, int max, int extend) { /* diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index 2b745f60a3..c2f964d194 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -3078,16 +3078,6 @@ const SSL_CIPHER *ssl3_get_cipher(unsigned int u) return (NULL); } -int ssl3_pending(const SSL *s) -{ - if (s->rstate == SSL_ST_READ_BODY) - return 0; - - return (SSL3_RECORD_get_type(RECORD_LAYER_get_rrec(&s->rlayer)) - == SSL3_RT_APPLICATION_DATA) - ? SSL3_RECORD_get_length(RECORD_LAYER_get_rrec(&s->rlayer)) : 0; -} - int ssl3_set_handshake_header(SSL *s, int htype, unsigned long len) { unsigned char *p = (unsigned char *)s->init_buf->data; diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h index e0dd259788..323a00df1e 100644 --- a/ssl/ssl_locl.h +++ b/ssl/ssl_locl.h @@ -2099,7 +2099,6 @@ __owur long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg); __owur long ssl3_ctx_ctrl(SSL_CTX *s, int cmd, long larg, void *parg); __owur long ssl3_callback_ctrl(SSL *s, int cmd, void (*fp) (void)); __owur long ssl3_ctx_callback_ctrl(SSL_CTX *s, int cmd, void (*fp) (void)); -__owur int ssl3_pending(const SSL *s); void ssl3_record_sequence_update(unsigned char *seq); __owur int ssl3_do_change_cipher_spec(SSL *ssl); -- 2.40.0