From 668fed47964da20712f857752016a036db739b69 Mon Sep 17 00:00:00 2001 From: toddouska Date: Thu, 2 Oct 2014 10:18:11 -0700 Subject: [PATCH 1/3] don't allow scr and fake indication together --- .gitignore | 1 + configure.ac | 4 ++++ src/internal.c | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index 25b8b71d8..e40a82164 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.lo *.la *.o +*.patch *.deps *.libs *.cache diff --git a/configure.ac b/configure.ac index 415aab035..c2a0499d7 100644 --- a/configure.ac +++ b/configure.ac @@ -1342,6 +1342,10 @@ AC_ARG_ENABLE([secure-renegotiation], if test "x$ENABLED_SECURE_RENEGOTIATION" = "xyes" then + if test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes" + then + AC_MSG_ERROR([cannot enable renegotiation-indication and secure-renegotiation.]) + fi AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SECURE_RENEGOTIATION" fi diff --git a/src/internal.c b/src/internal.c index 02faec4d2..0b8fb43df 100644 --- a/src/internal.c +++ b/src/internal.c @@ -63,6 +63,10 @@ CYASSL_CALLBACKS needs LARGE_STATIC_BUFFERS, please add LARGE_STATIC_BUFFERS #endif +#if defined(HAVE_SECURE_RENEGOTIATION) && defined(HAVE_RENEGOTIATION_INDICATION) + #error Cannot use both secure-renegotiation and renegotiation-indication +#endif + static int BuildMessage(CYASSL* ssl, byte* output, int outSz, const byte* input, int inSz, int type); From 3f01f097e763336f4506f1b9795bb0a73a6202e5 Mon Sep 17 00:00:00 2001 From: toddouska Date: Thu, 2 Oct 2014 10:43:06 -0700 Subject: [PATCH 2/3] allow scr sessoin ticket --- src/internal.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/internal.c b/src/internal.c index 0b8fb43df..717d694e4 100644 --- a/src/internal.c +++ b/src/internal.c @@ -10432,6 +10432,10 @@ int DoSessionTicket(CYASSL* ssl, ssl->session.ticketBornOn = 0; } + if (ssl->keys.encryptionOn) { + *inOutIdx += ssl->keys.padSz; + } + return BuildFinished(ssl, &ssl->verifyHashes, server); } #endif /* HAVE_SESSION_TICKET */ From 24bfade87418886a85dc1b6fcae18cef9a3afd3d Mon Sep 17 00:00:00 2001 From: toddouska Date: Fri, 3 Oct 2014 12:03:20 -0700 Subject: [PATCH 3/3] catch user error with write() after WANT_WRITE with short size --- src/internal.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/internal.c b/src/internal.c index 717d694e4..b436ec2c9 100644 --- a/src/internal.c +++ b/src/internal.c @@ -2986,6 +2986,12 @@ int GrowInputBuffer(CYASSL* ssl, int size, int usedLength) /* check available size into output buffer, make room if needed */ int CheckAvailableSize(CYASSL *ssl, int size) { + + if (size < 0) { + CYASSL_MSG("CheckAvailableSize() called with negative number"); + return BAD_FUNC_ARG; + } + if (ssl->buffers.outputBuffer.bufferSize - ssl->buffers.outputBuffer.length < (word32)size) { if (GrowOutputBuffer(ssl, size) < 0) @@ -7148,6 +7154,11 @@ int SendData(CYASSL* ssl, const void* data, int sz) /* advance sent to previous sent + plain size just sent */ sent = ssl->buffers.prevSent + ssl->buffers.plainSz; CYASSL_MSG("sent write buffered data"); + + if (sent > sz) { + CYASSL_MSG("error: write() after WANT_WRITE with short size"); + return ssl->error = BAD_FUNC_ARG; + } } }