diff options
author | Andy Polyakov <appro@openssl.org> | 2005-06-07 22:21:14 +0000 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2005-06-07 22:21:14 +0000 |
commit | dffdb56b7f5ac13102cd3639c115349d3ce2fa01 (patch) | |
tree | aee2300f3d663ab0af4ec8166e1c28d8b8bd97e4 /ssl/d1_both.c | |
parent | a78c0632edd4c9c257362045dbf7c8ca4a045052 (diff) |
"Liberate" dtls from BN dependency. Fix bug in replay/update.
Diffstat (limited to 'ssl/d1_both.c')
-rw-r--r-- | ssl/d1_both.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/ssl/d1_both.c b/ssl/d1_both.c index 92661a9e3b..dfe2bab88c 100644 --- a/ssl/d1_both.c +++ b/ssl/d1_both.c @@ -442,7 +442,7 @@ dtls1_buffer_handshake_fragment(SSL *s, struct hm_header_st* msg_hdr) { hm_fragment *frag = NULL; pitem *item = NULL; - PQ_64BIT seq64; + unsigned char seq64be[8]; frag = dtls1_hm_fragment_new(msg_hdr->frag_len); if ( frag == NULL) @@ -453,15 +453,14 @@ dtls1_buffer_handshake_fragment(SSL *s, struct hm_header_st* msg_hdr) memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr)); - pq_64bit_init(&seq64); - pq_64bit_assign_word(&seq64, msg_hdr->seq); + memset(seq64be,0,sizeof(seq64be)); + seq64be[6] = (unsigned char)(msg_hdr->seq>>8); + seq64be[7] = (unsigned char)(msg_hdr->seq); - item = pitem_new(seq64, frag); + item = pitem_new(seq64be, frag); if ( item == NULL) goto err; - pq_64bit_free(&seq64); - pqueue_insert(s->d1->buffered_messages, item); return 1; @@ -1043,7 +1042,7 @@ dtls1_buffer_message(SSL *s, int is_ccs) { pitem *item; hm_fragment *frag; - PQ_64BIT seq64; + unsigned char seq64be[8]; /* this function is called immediately after a message has * been serialized */ @@ -1071,11 +1070,11 @@ dtls1_buffer_message(SSL *s, int is_ccs) frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; frag->msg_header.is_ccs = is_ccs; - pq_64bit_init(&seq64); - pq_64bit_assign_word(&seq64, frag->msg_header.seq); + memset(seq64be,0,sizeof(seq64be)); + seq64be[6] = (unsigned char)(frag->msg_header.seq>>8); + seq64be[7] = (unsigned char)(frag->msg_header.seq); - item = pitem_new(seq64, frag); - pq_64bit_free(&seq64); + item = pitem_new(seq64be, frag); if ( item == NULL) { dtls1_hm_fragment_free(frag); @@ -1101,7 +1100,7 @@ dtls1_retransmit_message(SSL *s, unsigned short seq, unsigned long frag_off, pitem *item; hm_fragment *frag ; unsigned long header_length; - PQ_64BIT seq64; + unsigned char seq64be[8]; /* OPENSSL_assert(s->init_num == 0); @@ -1109,11 +1108,11 @@ dtls1_retransmit_message(SSL *s, unsigned short seq, unsigned long frag_off, */ /* XDTLS: the requested message ought to be found, otherwise error */ - pq_64bit_init(&seq64); - pq_64bit_assign_word(&seq64, seq); + memset(seq64be,0,sizeof(seq64be)); + seq64be[6] = (unsigned char)(seq>>8); + seq64be[7] = (unsigned char)seq; - item = pqueue_find(s->d1->sent_messages, seq64); - pq_64bit_free(&seq64); + item = pqueue_find(s->d1->sent_messages, seq64be); if ( item == NULL) { fprintf(stderr, "retransmit: message %d non-existant\n", seq); |