Merge pull request #2610 from ejohnstown/maintenance-DTLS

Maintenance: DTLS
This commit is contained in:
toddouska
2019-11-26 15:17:22 -08:00
committed by GitHub
3 changed files with 7 additions and 13 deletions

View File

@ -12122,7 +12122,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;
}
@ -12229,7 +12229,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)
@ -12251,7 +12251,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);
}
}
}
@ -12549,7 +12549,6 @@ static int ChachaAEADEncrypt(WOLFSSL* ssl, byte* out, const byte* input,
#ifdef WOLFSSL_DTLS
if (ssl->options.dtls) {
additionalSrc -= DTLS_HANDSHAKE_EXTRA;
DtlsSEQIncrement(ssl, CUR_ORDER);
}
#endif
@ -13089,11 +13088,6 @@ static WC_INLINE int Encrypt(WOLFSSL* ssl, byte* out, const byte* input, word16
#endif
if (ssl->encrypt.nonce)
ForceZero(ssl->encrypt.nonce, AESGCM_NONCE_SZ);
#ifdef WOLFSSL_DTLS
if (ssl->options.dtls)
DtlsSEQIncrement(ssl, CUR_ORDER);
#endif
}
#endif /* BUILD_AESGCM || HAVE_AESCCM */
break;
@ -22943,10 +22937,6 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
if ((ret = DtlsMsgPoolSave(ssl, output, sendSz)) != 0)
return ret;
}
if (ssl->options.dtls) {
DtlsSEQIncrement(ssl, CUR_ORDER);
}
#endif
if (ssl->options.groupMessages)

View File

@ -568,6 +568,8 @@ void mp_rshb (mp_int *c, int x)
mp_digit r, rr;
mp_digit D = x;
if (mp_iszero(c)) return;
/* mask */
mask = (((mp_digit)1) << D) - 1;

View File

@ -3176,6 +3176,8 @@ void fp_rshb(fp_int *c, int x)
fp_digit r, rr;
fp_digit D = x;
if (fp_iszero(c)) return;
/* mask */
mask = (((fp_digit)1) << D) - 1;