Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 1396487 - Extra test case for ACK, fragmentation and reassembly, …
…r=ekr

--HG--
branch : NSS_TLS13_DRAFT19_BRANCH
extra : rebase_source : efa18584232a3b8f19848697aa020b67e2f0eb4f
extra : amend_source : f9d2d9a15ed05bb25eb6449c415bd13c849634b2
extra : source : 43518e7771a283d035c6b22a36c45149aabebe07
  • Loading branch information
martinthomson committed Sep 7, 2017
1 parent e57db9b commit 08db6cf
Show file tree
Hide file tree
Showing 11 changed files with 332 additions and 52 deletions.
1 change: 1 addition & 0 deletions cpputil/tls_parser.h
Expand Up @@ -25,6 +25,7 @@ const uint8_t kTlsAlertType = 21;
const uint8_t kTlsHandshakeType = 22;
const uint8_t kTlsApplicationDataType = 23;
const uint8_t kTlsAltHandshakeType = 24;
const uint8_t kTlsAckType = 25;

const uint8_t kTlsHandshakeClientHello = 1;
const uint8_t kTlsHandshakeServerHello = 2;
Expand Down
23 changes: 13 additions & 10 deletions gtests/ssl_gtest/libssl_internals.c
Expand Up @@ -73,6 +73,7 @@ SECStatus SSLInt_SetMTU(PRFileDesc *fd, PRUint16 mtu) {
return SECFailure;
}
ss->ssl3.mtu = mtu;
ss->ssl3.hs.rtRetries = 0; /* Avoid DTLS shrinking the MTU any more. */
return SECSuccess;
}

Expand Down Expand Up @@ -109,20 +110,22 @@ void SSLInt_PrintTls13CipherSpecs(const char *label, PRFileDesc *fd) {
}
}

/* Force a retransmission timer expiry by backdating when the timer
* was started. We could set the remaining time to 0 but then backoff
* would not work properly if we decide to test it. */
void SSLInt_ForceRtTimerExpiry(PRFileDesc *fd) {
/* Force a timer expiry by backdating when all active timers were started. We
* could set the remaining time to 0 but then backoff would not work properly if
* we decide to test it. */
SECStatus SSLInt_ShiftDtlsTimers(PRFileDesc *fd, PRIntervalTime shift) {
size_t i;
sslSocket *ss = ssl_FindSocket(fd);
if (!ss) {
return;
return SECFailure;
}

if (!ss->ssl3.hs.rtTimer->cb) return;

ss->ssl3.hs.rtTimer->started =
PR_IntervalNow() -
PR_MillisecondsToInterval(ss->ssl3.hs.rtTimer->timeout + 1);
for (i = 0; i < PR_ARRAY_SIZE(ss->ssl3.hs.timers); ++i) {
if (ss->ssl3.hs.timers[i].cb) {
ss->ssl3.hs.timers[i].started -= shift;
}
}
return SECSuccess;
}

#define CHECK_SECRET(secret) \
Expand Down
2 changes: 1 addition & 1 deletion gtests/ssl_gtest/libssl_internals.h
Expand Up @@ -26,7 +26,7 @@ void SSLInt_ClearSelfEncryptKey();
void SSLInt_SetSelfEncryptMacKey(PK11SymKey *key);
PRInt32 SSLInt_CountTls13CipherSpecs(PRFileDesc *fd);
void SSLInt_PrintTls13CipherSpecs(const char *label, PRFileDesc *fd);
void SSLInt_ForceRtTimerExpiry(PRFileDesc *fd);
SECStatus SSLInt_ShiftDtlsTimers(PRFileDesc *fd, PRIntervalTime shift);
SECStatus SSLInt_SetMTU(PRFileDesc *fd, PRUint16 mtu);
PRBool SSLInt_CheckSecretsDestroyed(PRFileDesc *fd);
PRBool SSLInt_DamageClientHsTrafficSecret(PRFileDesc *fd);
Expand Down

0 comments on commit 08db6cf

Please sign in to comment.