Lots of Win32 fixes for DTLS. 1. "unsigned long long" isn't portable changed: to BN_ULLONG. 2. The LL prefix isn't allowed in VC++ but it isn't needed where it is used. 2. Avoid lots of compiler warnings about signed/unsigned mismatches. 3. Include new library directory pqueue in mk1mf build system. 4. Update symbols.
diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c index fa6d27a..a0cb29b 100644 --- a/crypto/bio/bss_dgram.c +++ b/crypto/bio/bss_dgram.c
@@ -64,8 +64,6 @@ #define USE_SOCKETS #include "cryptlib.h" -#include <sys/socket.h> - #include <openssl/bio.h> #define IP_MTU 14 /* linux is lame */ @@ -174,13 +172,18 @@ bio_dgram_data *data = (bio_dgram_data *)b->ptr; struct sockaddr peer; - socklen_t peerlen = sizeof(peer); + int peerlen = sizeof(peer); if (out != NULL) { clear_socket_error(); memset(&peer, 0x00, peerlen); - ret=recvfrom(b->num,out,outl,0,&peer,&peerlen); + /* Last arg in recvfrom is signed on some platforms and + * unsigned on others. It is of type socklen_t on some + * but this is not universal. Cast to (void *) to avoid + * compiler warnings. + */ + ret=recvfrom(b->num,out,outl,0,&peer,(void *)&peerlen); if ( ! data->connected && ret > 0) BIO_ctrl(b, BIO_CTRL_DGRAM_CONNECT, 0, &peer); @@ -303,7 +306,7 @@ #endif case BIO_CTRL_DGRAM_QUERY_MTU: sockopt_len = sizeof(sockopt_val); - if ((ret = getsockopt(b->num, IPPROTO_IP, IP_MTU, &sockopt_val, + if ((ret = getsockopt(b->num, IPPROTO_IP, IP_MTU, (void *)&sockopt_val, &sockopt_len)) < 0 || sockopt_val < 0) { ret = 0; } else @@ -345,7 +348,7 @@ break; case BIO_CTRL_DGRAM_GET_RECV_TIMEOUT: if ( getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, - ptr, (socklen_t *)&ret) < 0) + ptr, (void *)&ret) < 0) { perror("getsockopt"); ret = -1; } break; case BIO_CTRL_DGRAM_SET_SEND_TIMEOUT: @@ -355,7 +358,7 @@ break; case BIO_CTRL_DGRAM_GET_SEND_TIMEOUT: if ( getsockopt(b->num, SOL_SOCKET, SO_SNDTIMEO, - ptr, (socklen_t *)&ret) < 0) + ptr, (void *)&ret) < 0) { perror("getsockopt"); ret = -1; } break; case BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP: @@ -369,6 +372,7 @@ else ret = 0; break; +#ifdef EMSGSIZE case BIO_CTRL_DGRAM_MTU_EXCEEDED: if ( data->_errno == EMSGSIZE) { @@ -378,6 +382,7 @@ else ret = 0; break; +#endif default: ret=0; break;
diff --git a/crypto/pqueue/pqueue.c b/crypto/pqueue/pqueue.c index 4cd9987..f4fa37f 100644 --- a/crypto/pqueue/pqueue.c +++ b/crypto/pqueue/pqueue.c
@@ -57,8 +57,9 @@ * */ +#include "cryptlib.h" +#include <openssl/bn.h> #include "pqueue.h" -#include "crypto.h" typedef struct _pqueue { @@ -67,7 +68,7 @@ } pqueue_s; pitem * -pitem_new(unsigned long long priority, void *data) +pitem_new(BN_ULLONG priority, void *data) { pitem *item = (pitem *) OPENSSL_malloc(sizeof(pitem)); if (item == NULL) return NULL; @@ -160,7 +161,7 @@ } pitem * -pqueue_find(pqueue_s *pq, unsigned long long priority) +pqueue_find(pqueue_s *pq, BN_ULLONG priority) { pitem *next, *prev = NULL; pitem *found = NULL;
diff --git a/crypto/pqueue/pqueue.h b/crypto/pqueue/pqueue.h index 2245950..2ac31e2 100644 --- a/crypto/pqueue/pqueue.h +++ b/crypto/pqueue/pqueue.h
@@ -68,14 +68,14 @@ typedef struct _pitem { - unsigned long long priority; + BN_ULLONG priority; void *data; struct _pitem *next; } pitem; typedef struct _pitem *piterator; -pitem *pitem_new(unsigned long long priority, void *data); +pitem *pitem_new(BN_ULLONG priority, void *data); void pitem_free(pitem *item); pqueue pqueue_new(void); @@ -84,7 +84,7 @@ pitem *pqueue_insert(pqueue pq, pitem *item); pitem *pqueue_peek(pqueue pq); pitem *pqueue_pop(pqueue pq); -pitem *pqueue_find(pqueue pq, unsigned long long priority); +pitem *pqueue_find(pqueue pq, BN_ULLONG priority); pitem *pqueue_iterator(pqueue pq); pitem *pqueue_next(piterator *iter);