summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2005-04-27 16:27:14 +0000
committerDr. Stephen Henson <steve@openssl.org>2005-04-27 16:27:14 +0000
commit6c61726b2af78a1985178d31e551351231b54b10 (patch)
treea8dbb193224405b5a6900138c9649c8a59ab0d6f /ssl
parentcd202fe2f9d3cd44c361ba56b158ef400a75dc39 (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 'ssl')
-rw-r--r--ssl/d1_both.c14
-rw-r--r--ssl/d1_pkt.c60
-rw-r--r--ssl/dtls1.h6
-rw-r--r--ssl/s3_srvr.c2
-rw-r--r--ssl/ssl3.h2
-rw-r--r--ssl/ssl_locl.h12
6 files changed, 48 insertions, 48 deletions
diff --git a/ssl/d1_both.c b/ssl/d1_both.c
index 40d71e29d2..6b8dd8080e 100644
--- a/ssl/d1_both.c
+++ b/ssl/d1_both.c
@@ -222,7 +222,7 @@ int dtls1_do_write(SSL *s, int type)
if ( s->init_off == 0 && type == SSL3_RT_HANDSHAKE)
OPENSSL_assert(s->init_num ==
- s->d1->w_msg_hdr.msg_len + DTLS1_HM_HEADER_LENGTH);
+ (int)s->d1->w_msg_hdr.msg_len + DTLS1_HM_HEADER_LENGTH);
frag_off = 0;
while( s->init_num)
@@ -289,7 +289,7 @@ int dtls1_do_write(SSL *s, int type)
/* bad if this assert fails, only part of the handshake
* message got sent. but why would this happen? */
- OPENSSL_assert(len == ret);
+ OPENSSL_assert(len == (unsigned int)ret);
if (type == SSL3_RT_HANDSHAKE && ! s->d1->retransmitting)
/* should not be done for 'Hello Request's, but in that case
@@ -360,7 +360,7 @@ long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok)
else if ( i <= 0 && !*ok)
return i;
- if (s->d1->r_msg_hdr.msg_len == s->init_num - DTLS1_HM_HEADER_LENGTH)
+ if (s->d1->r_msg_hdr.msg_len == (unsigned int)s->init_num - DTLS1_HM_HEADER_LENGTH)
{
memset(&(s->d1->r_msg_hdr), 0x00, sizeof(struct hm_header_st));
@@ -413,7 +413,7 @@ dtls1_retrieve_buffered_fragment(SSL *s, unsigned long *copied)
frag = (hm_fragment *)item->data;
if ( s->d1->handshake_read_seq == frag->msg_header.seq &&
- frag->msg_header.frag_off <= s->init_num - DTLS1_HM_HEADER_LENGTH)
+ frag->msg_header.frag_off <= (unsigned int)s->init_num - DTLS1_HM_HEADER_LENGTH)
{
pqueue_pop(s->d1->buffered_messages);
overlap = s->init_num - DTLS1_HM_HEADER_LENGTH
@@ -685,7 +685,7 @@ dtls1_get_message_fragment(SSL *s, int st1, int stn, long max, int *ok)
/* XDTLS: an incorrectly formatted fragment should cause the
* handshake to fail */
- OPENSSL_assert(i == frag_len);
+ OPENSSL_assert(i == (int)frag_len);
#if 0
/* Successfully read a fragment.
@@ -1049,12 +1049,12 @@ dtls1_buffer_message(SSL *s, int is_ccs)
if ( is_ccs)
{
OPENSSL_assert(s->d1->w_msg_hdr.msg_len +
- DTLS1_CCS_HEADER_LENGTH == s->init_num);
+ DTLS1_CCS_HEADER_LENGTH == (unsigned int)s->init_num);
}
else
{
OPENSSL_assert(s->d1->w_msg_hdr.msg_len +
- DTLS1_HM_HEADER_LENGTH == s->init_num);
+ DTLS1_HM_HEADER_LENGTH == (unsigned int)s->init_num);
}
frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len;
diff --git a/ssl/d1_pkt.c b/ssl/d1_pkt.c
index af71e38954..09f1626313 100644
--- a/ssl/d1_pkt.c
+++ b/ssl/d1_pkt.c
@@ -124,7 +124,7 @@
static int have_handshake_fragment(SSL *s, int type, unsigned char *buf,
int len, int peek);
static int dtls1_record_replay_check(SSL *s, DTLS1_BITMAP *bitmap,
- unsigned long long *seq_num);
+ BN_ULLONG *seq_num);
static void dtls1_record_bitmap_update(SSL *s, DTLS1_BITMAP *bitmap);
static DTLS1_BITMAP *dtls1_get_bitmap(SSL *s, SSL3_RECORD *rr,
unsigned int *is_next_epoch);
@@ -133,10 +133,10 @@ static int dtls1_record_needs_buffering(SSL *s, SSL3_RECORD *rr,
unsigned short *priority, unsigned long *offset);
#endif
static int dtls1_buffer_record(SSL *s, record_pqueue *q,
- unsigned long long priority);
+ BN_ULLONG priority);
static int dtls1_process_record(SSL *s);
-static unsigned long long bytes_to_long_long(unsigned char *bytes);
-static void long_long_to_bytes(unsigned long long num, unsigned char *bytes);
+static BN_ULLONG bytes_to_long_long(unsigned char *bytes);
+static void long_long_to_bytes(BN_ULLONG num, unsigned char *bytes);
static void dtls1_clear_timeouts(SSL *s);
@@ -161,7 +161,7 @@ dtls1_copy_record(SSL *s, pitem *item)
static int
-dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned long long priority)
+dtls1_buffer_record(SSL *s, record_pqueue *queue, BN_ULLONG priority)
{
DTLS1_RECORD_DATA *rdata;
pitem *item;
@@ -275,9 +275,9 @@ static int
dtls1_get_buffered_record(SSL *s)
{
pitem *item;
- unsigned long long priority =
- (((unsigned long long)s->d1->handshake_read_seq) << 32) |
- ((unsigned long long)s->d1->r_msg_hdr.frag_off);
+ BN_ULLONG priority =
+ (((BN_ULLONG)s->d1->handshake_read_seq) << 32) |
+ ((BN_ULLONG)s->d1->r_msg_hdr.frag_off);
if ( ! SSL_in_init(s)) /* if we're not (re)negotiating,
nothing buffered */
@@ -482,7 +482,7 @@ int dtls1_get_record(SSL *s)
unsigned char *p;
short version;
DTLS1_BITMAP *bitmap;
- unsigned long long read_sequence;
+ BN_ULLONG read_sequence;
unsigned int is_next_epoch;
rr= &(s->s3->rrec);
@@ -1243,7 +1243,7 @@ int dtls1_write_bytes(SSL *s, int type, const void *buf_, int len)
return i;
}
- if ( s->s3->wnum + i == len)
+ if ( (int)s->s3->wnum + i == len)
s->s3->wnum = 0;
else
s->s3->wnum += i;
@@ -1419,7 +1419,7 @@ int do_dtls1_write(SSL *s, int type, const unsigned char *buf, unsigned int len,
/* buffer the record, making it easy to handle retransmits */
if ( type == SSL3_RT_HANDSHAKE || type == SSL3_RT_CHANGE_CIPHER_SPEC)
dtls1_buffer_record(s, wr->data, wr->length,
- *((unsigned long long *)&(s->s3->write_sequence[0])));
+ *((BN_ULLONG *)&(s->s3->write_sequence[0])));
#endif
ssl3_record_sequence_update(&(s->s3->write_sequence[0]));
@@ -1451,10 +1451,10 @@ err:
static int dtls1_record_replay_check(SSL *s, DTLS1_BITMAP *bitmap,
- unsigned long long *seq_num)
+ BN_ULLONG *seq_num)
{
- unsigned long long mask = 0x0000000000000001LL;
- unsigned long long rcd_num;
+ BN_ULLONG mask = 0x0000000000000001L;
+ BN_ULLONG rcd_num;
rcd_num = bytes_to_long_long(s->s3->read_sequence);
@@ -1479,17 +1479,17 @@ static int dtls1_record_replay_check(SSL *s, DTLS1_BITMAP *bitmap,
static void dtls1_record_bitmap_update(SSL *s, DTLS1_BITMAP *bitmap)
{
unsigned int shift;
- unsigned long long mask = 0x0000000000000001L;
- unsigned long long rcd_num;
+ BN_ULLONG mask = 0x0000000000000001L;
+ BN_ULLONG rcd_num;
rcd_num = bytes_to_long_long(s->s3->read_sequence);
if (rcd_num >= bitmap->max_seq_num)
{
- shift = rcd_num - bitmap->max_seq_num + 1;
+ shift = (unsigned int)(rcd_num - bitmap->max_seq_num) + 1;
bitmap->max_seq_num = rcd_num + 1;
bitmap->map <<= shift;
- bitmap->map |= 0x0000000000000001LL;
+ bitmap->map |= 0x0000000000000001L;
}
else
{
@@ -1570,7 +1570,7 @@ dtls1_get_bitmap(SSL *s, SSL3_RECORD *rr, unsigned int *is_next_epoch)
return &s->d1->bitmap;
/* Only HM and ALERT messages can be from the next epoch */
- else if (rr->epoch == s->d1->r_epoch + 1 &&
+ else if (rr->epoch == (unsigned long)(s->d1->r_epoch + 1) &&
(rr->type == SSL3_RT_HANDSHAKE ||
rr->type == SSL3_RT_ALERT))
{
@@ -1669,25 +1669,25 @@ dtls1_reset_seq_numbers(SSL *s, int rw)
}
-static unsigned long long
+static BN_ULLONG
bytes_to_long_long(unsigned char *bytes)
{
- unsigned long long num;
+ BN_ULLONG num;
- num = (((unsigned long long)bytes[0]) << 56) |
- (((unsigned long long)bytes[1]) << 48) |
- (((unsigned long long)bytes[2]) << 40) |
- (((unsigned long long)bytes[3]) << 32) |
- (((unsigned long long)bytes[4]) << 24) |
- (((unsigned long long)bytes[5]) << 16) |
- (((unsigned long long)bytes[6]) << 8) |
- (((unsigned long long)bytes[7]) );
+ num = (((BN_ULLONG)bytes[0]) << 56) |
+ (((BN_ULLONG)bytes[1]) << 48) |
+ (((BN_ULLONG)bytes[2]) << 40) |
+ (((BN_ULLONG)bytes[3]) << 32) |
+ (((BN_ULLONG)bytes[4]) << 24) |
+ (((BN_ULLONG)bytes[5]) << 16) |
+ (((BN_ULLONG)bytes[6]) << 8) |
+ (((BN_ULLONG)bytes[7]) );
return num;
}
static void
-long_long_to_bytes(unsigned long long num, unsigned char *bytes)
+long_long_to_bytes(BN_ULLONG num, unsigned char *bytes)
{
bytes[0] = (unsigned char)((num >> 56)&0xff);
bytes[1] = (unsigned char)((num >> 48)&0xff);
diff --git a/ssl/dtls1.h b/ssl/dtls1.h
index 4543ef75bb..5ec13720cd 100644
--- a/ssl/dtls1.h
+++ b/ssl/dtls1.h
@@ -90,9 +90,9 @@ extern "C" {
typedef struct dtls1_bitmap_st
{
- unsigned long long map;
+ BN_ULLONG map;
unsigned long length; /* sizeof the bitmap in bits */
- unsigned long long max_seq_num; /* max record number seen so far */
+ BN_ULLONG max_seq_num; /* max record number seen so far */
} DTLS1_BITMAP;
struct hm_header_st
@@ -163,7 +163,7 @@ typedef struct dtls1_state_st
unsigned short handshake_read_seq;
/* only matters for handshake messages */
- unsigned long long next_expected_seq_num;
+ BN_ULLONG next_expected_seq_num;
/* Received handshake records (processed and unprocessed) */
record_pqueue unprocessed_rcds;
diff --git a/ssl/s3_srvr.c b/ssl/s3_srvr.c
index db6986877f..b9ff6319a8 100644
--- a/ssl/s3_srvr.c
+++ b/ssl/s3_srvr.c
@@ -677,7 +677,7 @@ int ssl3_check_client_hello(SSL *s)
int ssl3_get_client_hello(SSL *s)
{
int i,j,ok,al,ret= -1;
- int cookie_len;
+ unsigned int cookie_len;
long n;
unsigned long id;
unsigned char *p,*d,*q;
diff --git a/ssl/ssl3.h b/ssl/ssl3.h
index 437e3b62b2..162bc79e04 100644
--- a/ssl/ssl3.h
+++ b/ssl/ssl3.h
@@ -295,7 +295,7 @@ typedef struct ssl3_record_st
/*rw*/ unsigned char *input; /* where the decode bytes are */
/*r */ unsigned char *comp; /* only used with decompression - malloc()ed */
/*r */ unsigned long epoch; /* epoch number, needed by DTLS1 */
-/*r */ unsigned long long seq_num; /* sequence number, needed by DTLS1 */
+/*r */ BN_ULLONG seq_num; /* sequence number, needed by DTLS1 */
} SSL3_RECORD;
typedef struct ssl3_buffer_st
diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h
index 054d8b2b8d..54b34d48ac 100644
--- a/ssl/ssl_locl.h
+++ b/ssl/ssl_locl.h
@@ -183,12 +183,12 @@
*((c)++)=(unsigned char)(((l)>> 8)&0xff), \
*((c)++)=(unsigned char)(((l) )&0xff))
-#define n2l6(c,l) (l =((unsigned long long)(*((c)++)))<<40, \
- l|=((unsigned long long)(*((c)++)))<<32, \
- l|=((unsigned long long)(*((c)++)))<<24, \
- l|=((unsigned long long)(*((c)++)))<<16, \
- l|=((unsigned long long)(*((c)++)))<< 8, \
- l|=((unsigned long long)(*((c)++))))
+#define n2l6(c,l) (l =((BN_ULLONG)(*((c)++)))<<40, \
+ l|=((BN_ULLONG)(*((c)++)))<<32, \
+ l|=((BN_ULLONG)(*((c)++)))<<24, \
+ l|=((BN_ULLONG)(*((c)++)))<<16, \
+ l|=((BN_ULLONG)(*((c)++)))<< 8, \
+ l|=((BN_ULLONG)(*((c)++))))
/* NOTE - c is not incremented as per l2c */
#define l2cn(l1,l2,c,n) { \