Keep retransmit window size architecture-independent.

Parameters like these should not change between 32-bit and 64-bit. 64 is also
the value recommended in RFC 6347, section 4.1.2.6. Document those fields while
I'm here.

Change-Id: I8481ee0765ff3d261a96a2e1a53b6ad6695b2d42
Reviewed-on: https://boringssl-review.googlesource.com/2222
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/include/openssl/dtls1.h b/include/openssl/dtls1.h
index 2069aed..ac097ce 100644
--- a/include/openssl/dtls1.h
+++ b/include/openssl/dtls1.h
@@ -103,11 +103,12 @@
 
 typedef struct dtls1_bitmap_st
 	{
-	unsigned long map;		/* track 32 packets on 32-bit systems
-					   and 64 - on 64-bit systems */
-	unsigned char max_seq_num[8];	/* max record number seen so far,
-					   64-bit value in big-endian
-					   encoding */
+	/* map is a bit mask of the last 64 sequence numbers. Bit
+	 * |1<<i| corresponds to |max_seq_num - i|. */
+	uint64_t map;
+	/* max_seq_num is the largest sequence number seen so far. It
+	 * is a 64-bit value in big-endian encoding. */
+	uint8_t max_seq_num[8];
 	} DTLS1_BITMAP;
 
 struct dtls1_retransmit_state
diff --git a/ssl/d1_pkt.c b/ssl/d1_pkt.c
index a5a27f1..2022ece 100644
--- a/ssl/d1_pkt.c
+++ b/ssl/d1_pkt.c
@@ -1452,7 +1452,7 @@
 	shift = -cmp;
 	if (shift >= sizeof(bitmap->map)*8)
 		return 0; /* stale, outside the window */
-	else if (bitmap->map & (1UL<<shift))
+	else if (bitmap->map & (((uint64_t) 1) << shift))
 		return 0; /* record previously received */
 
 	memcpy (s->s3->rrec.seq_num,seq,8);
@@ -1479,7 +1479,7 @@
 	else	{
 		shift = -cmp;
 		if (shift < sizeof(bitmap->map)*8)
-			bitmap->map |= 1UL<<shift;
+			bitmap->map |= ((uint64_t) 1) << shift;
 		}
 	}