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:
John Safranek
2019-11-20 13:29:16 -08:00
parent 188eb45433
commit 71690fc73a

View File

@@ -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);
}
}
}