diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2005-04-27 16:27:14 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2005-04-27 16:27:14 +0000 |
commit | 6c61726b2af78a1985178d31e551351231b54b10 (patch) | |
tree | a8dbb193224405b5a6900138c9649c8a59ab0d6f /crypto | |
parent | cd202fe2f9d3cd44c361ba56b158ef400a75dc39 (diff) |
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.
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/bio/bss_dgram.c | 19 | ||||
-rw-r--r-- | crypto/pqueue/pqueue.c | 7 | ||||
-rw-r--r-- | crypto/pqueue/pqueue.h | 6 |
3 files changed, 19 insertions, 13 deletions
diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c index fa6d27adc7..a0cb29b3dc 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 @@ static int dgram_read(BIO *b, char *out, int outl) 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 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) #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 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) 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 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) 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 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) else ret = 0; break; +#ifdef EMSGSIZE case BIO_CTRL_DGRAM_MTU_EXCEEDED: if ( data->_errno == EMSGSIZE) { @@ -378,6 +382,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) else ret = 0; break; +#endif default: ret=0; break; diff --git a/crypto/pqueue/pqueue.c b/crypto/pqueue/pqueue.c index 4cd9987919..f4fa37fe64 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 @@ typedef struct _pqueue } 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 @@ pqueue_pop(pqueue_s *pq) } 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 22459508a9..2ac31e21f0 100644 --- a/crypto/pqueue/pqueue.h +++ b/crypto/pqueue/pqueue.h @@ -68,14 +68,14 @@ typedef struct _pqueue *pqueue; 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 @@ void pqueue_free(pqueue pq); 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); |