Merge pull request #3679 from julek-wolfssl/dtls-window

Correct old DTLS msg rcv update
This commit is contained in:
John Safranek 2021-01-26 12:20:59 -08:00 committed by GitHub
commit d0e2566ad8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7224,8 +7224,8 @@ DtlsMsg* DtlsMsgInsert(DtlsMsg* head, DtlsMsg* item)
DtlsMsg* cur = head->next;
DtlsMsg* prev = head;
while (cur) {
if (item->epoch <= head->epoch &&
item->seq < head->seq) {
if (item->epoch <= cur->epoch &&
item->seq < cur->seq) {
item->next = cur;
prev->next = item;
break;
@ -13272,11 +13272,11 @@ static WC_INLINE int DtlsUpdateWindow(WOLFSSL* ssl)
if (cur_hi == *next_hi) {
curLT = cur_lo < *next_lo;
diff = curLT ? *next_lo - cur_lo : cur_lo - *next_lo;
diff = curLT ? *next_lo - cur_lo - 1 : cur_lo - *next_lo + 1;
}
else {
curLT = cur_hi < *next_hi;
diff = curLT ? cur_lo - *next_lo : *next_lo - cur_lo;
diff = curLT ? cur_lo - *next_lo - 1 : *next_lo - cur_lo + 1;
}
if (curLT) {
@ -13294,7 +13294,6 @@ static WC_INLINE int DtlsUpdateWindow(WOLFSSL* ssl)
word32 oldWindow[WOLFSSL_DTLS_WINDOW_WORDS];
temp = 0;
diff++;
idx = diff / DTLS_WORD_BITS;
newDiff = diff % DTLS_WORD_BITS;