diff --git a/src/internal.c b/src/internal.c index cd4954713..5e834bc7d 100644 --- a/src/internal.c +++ b/src/internal.c @@ -12102,7 +12102,7 @@ static WC_INLINE int DtlsCheckWindow(WOLFSSL* ssl) return 0; } - if (window[idx] & (1 << (newDiff - 1))) { + if (window[idx] & (1 << newDiff)) { WOLFSSL_MSG("Current record sequence number already received."); return 0; } @@ -12209,7 +12209,7 @@ static WC_INLINE int DtlsUpdateWindow(WOLFSSL* ssl) word32 newDiff = diff % DTLS_WORD_BITS; if (idx < WOLFSSL_DTLS_WINDOW_WORDS) - window[idx] |= (1 << (newDiff - 1)); + window[idx] |= (1 << newDiff); } else { if (diff >= DTLS_SEQ_BITS) @@ -12231,7 +12231,7 @@ static WC_INLINE int DtlsUpdateWindow(WOLFSSL* ssl) else { temp |= (oldWindow[i-idx] << newDiff); window[i] = temp; - temp = oldWindow[i-idx] >> (DTLS_WORD_BITS - newDiff); + temp = oldWindow[i-idx] >> (DTLS_WORD_BITS - newDiff - 1); } } }