Skip to content

Commit e3eed7c

Browse files
committed
Fix Coverity issue iwth WOLFSSL_GENERAL_ALIGNMENT
1 parent 7a0c40e commit e3eed7c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/internal.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11085,15 +11085,15 @@ static WC_INLINE int GrowAnOutputBuffer(WOLFSSL* ssl,
1108511085
bufferStatic* outputBuffer, int size)
1108611086
{
1108711087
byte* tmp;
11088-
#if WOLFSSL_GENERAL_ALIGNMENT > 0
11088+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1108911089
byte hdrSz = ssl->options.dtls ? DTLS_RECORD_HEADER_SZ :
1109011090
RECORD_HEADER_SZ;
1109111091
byte align = WOLFSSL_GENERAL_ALIGNMENT;
1109211092
#else
1109311093
const byte align = WOLFSSL_GENERAL_ALIGNMENT;
1109411094
#endif
1109511095

11096-
#if WOLFSSL_GENERAL_ALIGNMENT > 0
11096+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1109711097
/* the encrypted data will be offset from the front of the buffer by
1109811098
the header, if the user wants encrypted alignment they need
1109911099
to define their alignment requirement */
@@ -11109,7 +11109,7 @@ static WC_INLINE int GrowAnOutputBuffer(WOLFSSL* ssl,
1110911109
if (tmp == NULL)
1111011110
return MEMORY_E;
1111111111

11112-
#if WOLFSSL_GENERAL_ALIGNMENT > 0
11112+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1111311113
if (align)
1111411114
tmp += align - hdrSz;
1111511115
#endif
@@ -11130,7 +11130,7 @@ static WC_INLINE int GrowAnOutputBuffer(WOLFSSL* ssl,
1113011130
DYNAMIC_TYPE_OUT_BUFFER);
1113111131
}
1113211132

11133-
#if WOLFSSL_GENERAL_ALIGNMENT > 0
11133+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1113411134
if (align)
1113511135
outputBuffer->offset = align - hdrSz;
1113611136
else
@@ -11156,7 +11156,7 @@ byte* GetOutputBuffer(WOLFSSL* ssl)
1115611156
static WC_INLINE int GrowOutputBuffer(WOLFSSL* ssl, int size)
1115711157
{
1115811158
byte* tmp;
11159-
#if WOLFSSL_GENERAL_ALIGNMENT > 0
11159+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1116011160
byte hdrSz = ssl->options.dtls ? DTLS_RECORD_HEADER_SZ :
1116111161
RECORD_HEADER_SZ;
1116211162
byte align = WOLFSSL_GENERAL_ALIGNMENT;
@@ -11165,7 +11165,7 @@ static WC_INLINE int GrowOutputBuffer(WOLFSSL* ssl, int size)
1116511165
#endif
1116611166
word32 newSz;
1116711167

11168-
#if WOLFSSL_GENERAL_ALIGNMENT > 0
11168+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1116911169
/* the encrypted data will be offset from the front of the buffer by
1117011170
the header, if the user wants encrypted alignment they need
1117111171
to define their alignment requirement */
@@ -11188,7 +11188,7 @@ static WC_INLINE int GrowOutputBuffer(WOLFSSL* ssl, int size)
1118811188
if (tmp == NULL)
1118911189
return MEMORY_E;
1119011190

11191-
#if WOLFSSL_GENERAL_ALIGNMENT > 0
11191+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1119211192
if (align)
1119311193
tmp += align - hdrSz;
1119411194
#endif
@@ -11214,7 +11214,7 @@ static WC_INLINE int GrowOutputBuffer(WOLFSSL* ssl, int size)
1121411214
}
1121511215
ssl->buffers.outputBuffer.dynamicFlag = 1;
1121611216

11217-
#if WOLFSSL_GENERAL_ALIGNMENT > 0
11217+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1121811218
if (align)
1121911219
ssl->buffers.outputBuffer.offset = align - hdrSz;
1122011220
else
@@ -11231,14 +11231,14 @@ static WC_INLINE int GrowOutputBuffer(WOLFSSL* ssl, int size)
1123111231
int GrowInputBuffer(WOLFSSL* ssl, int size, int usedLength)
1123211232
{
1123311233
byte* tmp;
11234-
#if defined(WOLFSSL_DTLS) || WOLFSSL_GENERAL_ALIGNMENT > 0
11234+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1123511235
byte align = ssl->options.dtls ? WOLFSSL_GENERAL_ALIGNMENT : 0;
1123611236
byte hdrSz = DTLS_RECORD_HEADER_SZ;
1123711237
#else
1123811238
const byte align = WOLFSSL_GENERAL_ALIGNMENT;
1123911239
#endif
1124011240

11241-
#if defined(WOLFSSL_DTLS) || WOLFSSL_GENERAL_ALIGNMENT > 0
11241+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1124211242
/* the encrypted data will be offset from the front of the buffer by
1124311243
the dtls record header, if the user wants encrypted alignment they need
1124411244
to define their alignment requirement. in tls we read record header
@@ -11262,7 +11262,7 @@ int GrowInputBuffer(WOLFSSL* ssl, int size, int usedLength)
1126211262
if (tmp == NULL)
1126311263
return MEMORY_E;
1126411264

11265-
#if defined(WOLFSSL_DTLS) || WOLFSSL_GENERAL_ALIGNMENT > 0
11265+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1126611266
if (align)
1126711267
tmp += align - hdrSz;
1126811268
#endif
@@ -11291,7 +11291,7 @@ int GrowInputBuffer(WOLFSSL* ssl, int size, int usedLength)
1129111291
}
1129211292

1129311293
ssl->buffers.inputBuffer.dynamicFlag = 1;
11294-
#if defined(WOLFSSL_DTLS) || WOLFSSL_GENERAL_ALIGNMENT > 0
11294+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1129511295
if (align)
1129611296
ssl->buffers.inputBuffer.offset = align - hdrSz;
1129711297
else

0 commit comments

Comments
 (0)