mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
Maintenance: DTLS
1. Updated the window scrolling. There was a couple off-by-one errors in the DTLS window handling. They canceled each other out, but there was a rare case where they would shift too much.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user