[PR3597] Advance to the next state variant when reusing messages.
[openssl.git] / ssl / d1_pkt.c
index 611fc8db5769fb749ac7a289be7f7de2150f6738..2952bccc5eb58ab8dfd3796581851cb73ae62c95 100644 (file)
@@ -758,9 +758,8 @@ int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek)
                if (!ssl3_setup_buffers(s))
                        return(-1);
 
-    /* XXX: check what the second '&& type' is about */
        if ((type && (type != SSL3_RT_APPLICATION_DATA) && 
-               (type != SSL3_RT_HANDSHAKE) && type) ||
+               (type != SSL3_RT_HANDSHAKE)) ||
            (peek && (type != SSL3_RT_APPLICATION_DATA)))
                {
                SSLerr(SSL_F_DTLS1_READ_BYTES, ERR_R_INTERNAL_ERROR);
@@ -1633,7 +1632,7 @@ int do_dtls1_write(SSL *s, int type, const unsigned char *buf, unsigned int len,
        if (eivlen)
                wr->length += eivlen;
 
-       s->method->ssl3_enc->enc(s,1);
+       if(s->method->ssl3_enc->enc(s,1) < 1) goto err;
 
        /* record length after mac and block padding */
 /*     if (type == SSL3_RT_APPLICATION_DATA ||