Skip to content

Commit 5057f8d

Browse files
committed
Fix Coverity issue iwth WOLFSSL_GENERAL_ALIGNMENT
1 parent 4838588 commit 5057f8d

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
@@ -11119,15 +11119,15 @@ static WC_INLINE int GrowAnOutputBuffer(WOLFSSL* ssl,
1111911119
bufferStatic* outputBuffer, int size)
1112011120
{
1112111121
byte* tmp;
11122-
#if WOLFSSL_GENERAL_ALIGNMENT > 0
11122+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1112311123
byte hdrSz = ssl->options.dtls ? DTLS_RECORD_HEADER_SZ :
1112411124
RECORD_HEADER_SZ;
1112511125
byte align = WOLFSSL_GENERAL_ALIGNMENT;
1112611126
#else
1112711127
const byte align = WOLFSSL_GENERAL_ALIGNMENT;
1112811128
#endif
1112911129

11130-
#if WOLFSSL_GENERAL_ALIGNMENT > 0
11130+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1113111131
/* the encrypted data will be offset from the front of the buffer by
1113211132
the header, if the user wants encrypted alignment they need
1113311133
to define their alignment requirement */
@@ -11143,7 +11143,7 @@ static WC_INLINE int GrowAnOutputBuffer(WOLFSSL* ssl,
1114311143
if (tmp == NULL)
1114411144
return MEMORY_E;
1114511145

11146-
#if WOLFSSL_GENERAL_ALIGNMENT > 0
11146+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1114711147
if (align)
1114811148
tmp += align - hdrSz;
1114911149
#endif
@@ -11164,7 +11164,7 @@ static WC_INLINE int GrowAnOutputBuffer(WOLFSSL* ssl,
1116411164
DYNAMIC_TYPE_OUT_BUFFER);
1116511165
}
1116611166

11167-
#if WOLFSSL_GENERAL_ALIGNMENT > 0
11167+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1116811168
if (align)
1116911169
outputBuffer->offset = align - hdrSz;
1117011170
else
@@ -11190,7 +11190,7 @@ byte* GetOutputBuffer(WOLFSSL* ssl)
1119011190
static WC_INLINE int GrowOutputBuffer(WOLFSSL* ssl, int size)
1119111191
{
1119211192
byte* tmp;
11193-
#if WOLFSSL_GENERAL_ALIGNMENT > 0
11193+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1119411194
byte hdrSz = ssl->options.dtls ? DTLS_RECORD_HEADER_SZ :
1119511195
RECORD_HEADER_SZ;
1119611196
byte align = WOLFSSL_GENERAL_ALIGNMENT;
@@ -11199,7 +11199,7 @@ static WC_INLINE int GrowOutputBuffer(WOLFSSL* ssl, int size)
1119911199
#endif
1120011200
word32 newSz;
1120111201

11202-
#if WOLFSSL_GENERAL_ALIGNMENT > 0
11202+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1120311203
/* the encrypted data will be offset from the front of the buffer by
1120411204
the header, if the user wants encrypted alignment they need
1120511205
to define their alignment requirement */
@@ -11222,7 +11222,7 @@ static WC_INLINE int GrowOutputBuffer(WOLFSSL* ssl, int size)
1122211222
if (tmp == NULL)
1122311223
return MEMORY_E;
1122411224

11225-
#if WOLFSSL_GENERAL_ALIGNMENT > 0
11225+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1122611226
if (align)
1122711227
tmp += align - hdrSz;
1122811228
#endif
@@ -11248,7 +11248,7 @@ static WC_INLINE int GrowOutputBuffer(WOLFSSL* ssl, int size)
1124811248
}
1124911249
ssl->buffers.outputBuffer.dynamicFlag = 1;
1125011250

11251-
#if WOLFSSL_GENERAL_ALIGNMENT > 0
11251+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1125211252
if (align)
1125311253
ssl->buffers.outputBuffer.offset = align - hdrSz;
1125411254
else
@@ -11265,14 +11265,14 @@ static WC_INLINE int GrowOutputBuffer(WOLFSSL* ssl, int size)
1126511265
int GrowInputBuffer(WOLFSSL* ssl, int size, int usedLength)
1126611266
{
1126711267
byte* tmp;
11268-
#if defined(WOLFSSL_DTLS) || WOLFSSL_GENERAL_ALIGNMENT > 0
11268+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1126911269
byte align = ssl->options.dtls ? WOLFSSL_GENERAL_ALIGNMENT : 0;
1127011270
byte hdrSz = DTLS_RECORD_HEADER_SZ;
1127111271
#else
1127211272
const byte align = WOLFSSL_GENERAL_ALIGNMENT;
1127311273
#endif
1127411274

11275-
#if defined(WOLFSSL_DTLS) || WOLFSSL_GENERAL_ALIGNMENT > 0
11275+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1127611276
/* the encrypted data will be offset from the front of the buffer by
1127711277
the dtls record header, if the user wants encrypted alignment they need
1127811278
to define their alignment requirement. in tls we read record header
@@ -11296,7 +11296,7 @@ int GrowInputBuffer(WOLFSSL* ssl, int size, int usedLength)
1129611296
if (tmp == NULL)
1129711297
return MEMORY_E;
1129811298

11299-
#if defined(WOLFSSL_DTLS) || WOLFSSL_GENERAL_ALIGNMENT > 0
11299+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1130011300
if (align)
1130111301
tmp += align - hdrSz;
1130211302
#endif
@@ -11325,7 +11325,7 @@ int GrowInputBuffer(WOLFSSL* ssl, int size, int usedLength)
1132511325
}
1132611326

1132711327
ssl->buffers.inputBuffer.dynamicFlag = 1;
11328-
#if defined(WOLFSSL_DTLS) || WOLFSSL_GENERAL_ALIGNMENT > 0
11328+
#if defined(WOLFSSL_DTLS) || (WOLFSSL_GENERAL_ALIGNMENT > 0)
1132911329
if (align)
1133011330
ssl->buffers.inputBuffer.offset = align - hdrSz;
1133111331
else

0 commit comments

Comments
 (0)