summaryrefslogtreecommitdiffstats
path: root/ssl/s3_enc.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-09-07 11:34:39 +0100
committerMatt Caswell <matt@openssl.org>2016-11-04 12:09:45 +0000
commit7ee8627f6eb7cf63b34d2701d76bb66f6db811e5 (patch)
tree3cc2467dedda4c802868d9ff2c00ca6b979e4ea6 /ssl/s3_enc.c
parenteda757514ea3018c8510b4738b5e37479aeadc5e (diff)
Convert libssl writing for size_t
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'ssl/s3_enc.c')
-rw-r--r--ssl/s3_enc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c
index 56bd34a3d1..f32b68a0b3 100644
--- a/ssl/s3_enc.c
+++ b/ssl/s3_enc.c
@@ -356,13 +356,18 @@ void ssl3_free_digest_list(SSL *s)
s->s3->handshake_dgst = NULL;
}
-int ssl3_finish_mac(SSL *s, const unsigned char *buf, int len)
+int ssl3_finish_mac(SSL *s, const unsigned char *buf, size_t len)
{
- if (s->s3->handshake_dgst == NULL)
+ if (s->s3->handshake_dgst == NULL) {
+ int ret;
/* Note: this writes to a memory BIO so a failure is a fatal error */
- return BIO_write(s->s3->handshake_buffer, (void *)buf, len) == len;
- else
+ if (len > INT_MAX)
+ return 0;
+ ret = BIO_write(s->s3->handshake_buffer, (void *)buf, (int)len);
+ return ret > 0 && ret == (int)len;
+ } else {
return EVP_DigestUpdate(s->s3->handshake_dgst, buf, len);
+ }
}
int ssl3_digest_cached_records(SSL *s, int keep)