#if defined(OPENSSL_SYS_VMS)
# include <sys/timeb.h>
+#elif defined(OPENSSL_SYS_NETWARE) && !defined(_WINSOCK2API_)
+# include <sys/timeval.h>
+#elif defined(OPENSSL_SYS_VXWORKS)
+# include <sys/times.h>
+#elif !defined(OPENSSL_SYS_WIN32)
+# include <sys/time.h>
#endif
static void get_current_time(struct timeval *t);
{
DTLS1_STATE *d1;
- if(!DTLS_RECORD_LAYER_new(&s->rlayer)) {
+ if (!DTLS_RECORD_LAYER_new(&s->rlayer)) {
return 0;
}
if (!ssl3_new(s))
return (0);
- if ((d1 = OPENSSL_malloc(sizeof *d1)) == NULL) {
+ if ((d1 = OPENSSL_malloc(sizeof(*d1))) == NULL) {
ssl3_free(s);
return (0);
}
- memset(d1, 0, sizeof *d1);
+ memset(d1, 0, sizeof(*d1));
d1->buffered_messages = pqueue_new();
d1->sent_messages = pqueue_new();
d1->mtu = 0;
if (!d1->buffered_messages || !d1->sent_messages) {
- if (d1->buffered_messages)
- pqueue_free(d1->buffered_messages);
- if (d1->sent_messages)
- pqueue_free(d1->sent_messages);
+ pqueue_free(d1->buffered_messages);
+ pqueue_free(d1->sent_messages);
OPENSSL_free(d1);
ssl3_free(s);
return (0);
dtls1_clear_queues(s);
- memset(s->d1, 0, sizeof(*(s->d1)));
+ memset(s->d1, 0, sizeof(*s->d1));
if (s->server) {
s->d1->cookie_len = sizeof(s->d1->cookie);
#ifndef OPENSSL_NO_SCTP
/* Disable timer for SCTP */
if (BIO_dgram_is_sctp(SSL_get_wbio(s))) {
- memset(&(s->d1->next_timeout), 0, sizeof(struct timeval));
+ memset(&s->d1->next_timeout, 0, sizeof(s->d1->next_timeout));
return;
}
#endif
if (s->d1->next_timeout.tv_sec < timenow.tv_sec ||
(s->d1->next_timeout.tv_sec == timenow.tv_sec &&
s->d1->next_timeout.tv_usec <= timenow.tv_usec)) {
- memset(timeleft, 0, sizeof(struct timeval));
+ memset(timeleft, 0, sizeof(*timeleft));
return timeleft;
}
* because of small devergences with socket timeouts.
*/
if (timeleft->tv_sec == 0 && timeleft->tv_usec < 15000) {
- memset(timeleft, 0, sizeof(struct timeval));
+ memset(timeleft, 0, sizeof(*timeleft));
}
return timeleft;
void dtls1_stop_timer(SSL *s)
{
/* Reset everything */
- memset(&(s->d1->timeout), 0, sizeof(struct dtls1_timeout_st));
- memset(&(s->d1->next_timeout), 0, sizeof(struct timeval));
+ memset(&s->d1->timeout, 0, sizeof(s->d1->timeout));
+ memset(&s->d1->next_timeout, 0, sizeof(s->d1->next_timeout));
s->d1->timeout_duration = 1;
BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT, 0,
&(s->d1->next_timeout));
int ret;
/* Ensure there is no state left over from a previous invocation */
- if(!SSL_clear(s))
+ if (!SSL_clear(s))
return -1;
SSL_set_options(s, SSL_OP_COOKIE_EXCHANGE);
s->init_off = 0;
/* Buffer the message to handle re-xmits */
- if(!dtls1_buffer_message(s, 0))
+ if (!dtls1_buffer_message(s, 0))
return 0;
return 1;