#include "SSLRecordInternal.h"
#include "sslDebug.h"
#include "cipherSpecs.h"
-#include "sslUtils.h"
#include "tls_record_internal.h"
#include <AssertMacros.h>
tls_record_parse_header(ctx->filter, header, &contentLen, &content_type);
if(content_type&0x80) {
+ sslDebugLog("Detected SSL2 record in SSLReadRecordInternal");
// Looks like SSL2 record, reset expectations.
head = 2;
err=tls_record_parse_ssl2_header(ctx->filter, header, &contentLen, &content_type);
check(ctx->partialReadBuffer.length>=head+contentLen);
- if(head+contentLen>ctx->partialReadBuffer.length)
+ if(head+contentLen>ctx->partialReadBuffer.length) {
+ sslDebugLog("overflow in SSLReadRecordInternal");
return errSSLRecordRecordOverflow;
+ }
if (ctx->amountRead < head + contentLen)
- { readData.length = head + contentLen - ctx->amountRead;
+ {
+ readData.length = head + contentLen - ctx->amountRead;
readData.data = ctx->partialReadBuffer.data + ctx->amountRead;
len = readData.length;
err = sslIoRead(readData, &len, ctx);
if(err != 0)
- { if (err == errSSLRecordWouldBlock)
- ctx->amountRead += len;
+ {
+ if (err == errSSLRecordWouldBlock)
+ {
+ ctx->amountRead += len;
+ }
return err;
}
ctx->amountRead += len;
/* There was an underflow - For TLS, we return errSSLRecordClosedAbort for historical reason - see ssl-44-crashes test */
if(sz==0) {
sslErrorLog("underflow in SSLReadRecordInternal");
- if(ctx->dtls) {
+ if(ctx->sslCtx->isDTLS) {
// For DTLS, we should just drop it.
return errSSLRecordUnexpectedRecord;
} else {
SSLSetInternalRecordLayerProtocolVersion(SSLRecordContextRef ref, SSLProtocolVersion negVersion)
{
struct SSLRecordInternalContext *ctx = ref;
- return tls_record_set_protocol_version(ctx->filter, negVersion);
+ return tls_record_set_protocol_version(ctx->filter, (tls_protocol_version) negVersion);
}
static int
switch (option) {
case kSSLRecordOptionSendOneByteRecord:
return tls_record_set_record_splitting(ctx->filter, value);
- break;
default:
return 0;
- break;
}
}