#include "../ssl_locl.h"
#include "statem_locl.h"
#include <openssl/buffer.h>
-#include <openssl/rand.h>
#include <openssl/objects.h>
#include <openssl/evp.h>
#include <openssl/x509.h>
}
}
- used_len = BIO_wpending(SSL_get_wbio(s)) + DTLS1_RT_HEADER_LENGTH
+ used_len = BIO_wpending(s->wbio) + DTLS1_RT_HEADER_LENGTH
+ mac_size + blocksize;
if (s->d1->mtu > used_len)
curr_mtu = s->d1->mtu - used_len;
/*
* grr.. we could get an error if MTU picked was wrong
*/
- ret = BIO_flush(SSL_get_wbio(s));
+ ret = BIO_flush(s->wbio);
if (ret <= 0) {
s->rwstate = SSL_WRITING;
return ret;
xlen = ret - DTLS1_HM_HEADER_LENGTH;
}
- ssl3_finish_mac(s, p, xlen);
+ if (!ssl3_finish_mac(s, p, xlen))
+ return -1;
}
if (ret == s->init_num) {
msg_len += DTLS1_HM_HEADER_LENGTH;
}
- ssl3_finish_mac(s, p, msg_len);
+ if (!ssl3_finish_mac(s, p, msg_len))
+ return 0;
if (s->msg_callback)
s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE,
p, msg_len, s, s->msg_callback_arg);
*len = i;
return 0;
}
- if(recvd_type == SSL3_RT_CHANGE_CIPHER_SPEC) {
+ if (recvd_type == SSL3_RT_CHANGE_CIPHER_SPEC) {
if (wire[0] != SSL3_MT_CCS) {
al = SSL_AD_UNEXPECTED_MESSAGE;
SSLerr(SSL_F_DTLS_GET_REASSEMBLED_MESSAGE,
s->init_num = 0;
goto redo;
- } else { /* Incorrectly formated Hello request */
+ } else { /* Incorrectly formatted Hello request */
al = SSL_AD_UNEXPECTED_MESSAGE;
SSLerr(SSL_F_DTLS_GET_REASSEMBLED_MESSAGE,
int dtls1_read_failed(SSL *s, int code)
{
if (code > 0) {
- fprintf(stderr, "dtls1_read_failed(); invalid state reached\n");
+ SSLerr(SSL_F_DTLS1_READ_FAILED, ERR_R_INTERNAL_ERROR);
return 1;
}
dtls1_get_queue_priority
(frag->msg_header.seq,
frag->msg_header.is_ccs),
- &found) <= 0 && found) {
- fprintf(stderr, "dtls1_retransmit_message() failed\n");
+ &found) <= 0)
return -1;
- }
}
return 1;
item = pqueue_find(s->d1->sent_messages, seq64be);
if (item == NULL) {
- fprintf(stderr, "retransmit: message %d non-existant\n", seq);
+ SSLerr(SSL_F_DTLS1_RETRANSMIT_MESSAGE, ERR_R_INTERNAL_ERROR);
*found = 0;
return 0;
}
s->d1->retransmitting = 0;
- (void)BIO_flush(SSL_get_wbio(s));
+ (void)BIO_flush(s->wbio);
return ret;
}