mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 12:14:38 +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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window[idx] & (1 << (newDiff - 1))) {
|
if (window[idx] & (1 << newDiff)) {
|
||||||
WOLFSSL_MSG("Current record sequence number already received.");
|
WOLFSSL_MSG("Current record sequence number already received.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -12209,7 +12209,7 @@ static WC_INLINE int DtlsUpdateWindow(WOLFSSL* ssl)
|
|||||||
word32 newDiff = diff % DTLS_WORD_BITS;
|
word32 newDiff = diff % DTLS_WORD_BITS;
|
||||||
|
|
||||||
if (idx < WOLFSSL_DTLS_WINDOW_WORDS)
|
if (idx < WOLFSSL_DTLS_WINDOW_WORDS)
|
||||||
window[idx] |= (1 << (newDiff - 1));
|
window[idx] |= (1 << newDiff);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (diff >= DTLS_SEQ_BITS)
|
if (diff >= DTLS_SEQ_BITS)
|
||||||
@@ -12231,7 +12231,7 @@ static WC_INLINE int DtlsUpdateWindow(WOLFSSL* ssl)
|
|||||||
else {
|
else {
|
||||||
temp |= (oldWindow[i-idx] << newDiff);
|
temp |= (oldWindow[i-idx] << newDiff);
|
||||||
window[i] = temp;
|
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