| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/ssl/record/dtls1_bitmap.c | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | static int satsub64be(const unsigned char *v1, const unsigned char *v2) | - | ||||||||||||
| 4 | { | - | ||||||||||||
| 5 | int64_t ret; | - | ||||||||||||
| 6 | uint64_t l1, l2; | - | ||||||||||||
| 7 | - | |||||||||||||
| 8 | (l1 =((uint64_t)(*((v1)++)))<<56, l1|=((uint64_t)(*((v1)++)))<<48, l1|=((uint64_t)(*((v1)++)))<<40, l1|=((uint64_t)(*((v1)++)))<<32, l1|=((uint64_t)(*((v1)++)))<<24, l1|=((uint64_t)(*((v1)++)))<<16, l1|=((uint64_t)(*((v1)++)))<< 8, l1|=((uint64_t)(*((v1)++)))); | - | ||||||||||||
| 9 | (l2 =((uint64_t)(*((v2)++)))<<56, l2|=((uint64_t)(*((v2)++)))<<48, l2|=((uint64_t)(*((v2)++)))<<40, l2|=((uint64_t)(*((v2)++)))<<32, l2|=((uint64_t)(*((v2)++)))<<24, l2|=((uint64_t)(*((v2)++)))<<16, l2|=((uint64_t)(*((v2)++)))<< 8, l2|=((uint64_t)(*((v2)++)))); | - | ||||||||||||
| 10 | - | |||||||||||||
| 11 | ret = l1 - l2; | - | ||||||||||||
| 12 | - | |||||||||||||
| 13 | - | |||||||||||||
| 14 | if (l1 > l2 
 
 | 0-5384 | ||||||||||||
| 15 | return never executed: 128; return 128;never executed:  return 128; | 0 | ||||||||||||
| 16 | else if (l2 > l1 
 
 | 0-6812 | ||||||||||||
| 17 | return never executed: -128; return -128;never executed:  return -128; | 0 | ||||||||||||
| 18 | - | |||||||||||||
| 19 | if (ret > 128 
 | 19-6815 | ||||||||||||
| 20 | return executed 19 times by 1 test: 128; return 128;Executed by: 
 executed 19 times by 1 test:  return 128;Executed by: 
 | 19 | ||||||||||||
| 21 | else if (ret < -128 
 | 5-6810 | ||||||||||||
| 22 | return executed 5 times by 1 test: -128; return -128;Executed by: 
 executed 5 times by 1 test:  return -128;Executed by: 
 | 5 | ||||||||||||
| 23 | else | - | ||||||||||||
| 24 | return executed 6810 times by 1 test: (int)ret; return (int)ret;Executed by: 
 executed 6810 times by 1 test:  return (int)ret;Executed by: 
 | 6810 | ||||||||||||
| 25 | } | - | ||||||||||||
| 26 | - | |||||||||||||
| 27 | int dtls1_record_replay_check(SSL *s, DTLS1_BITMAP *bitmap) | - | ||||||||||||
| 28 | { | - | ||||||||||||
| 29 | int cmp; | - | ||||||||||||
| 30 | unsigned int shift; | - | ||||||||||||
| 31 | const unsigned char *seq = s->rlayer.read_sequence; | - | ||||||||||||
| 32 | - | |||||||||||||
| 33 | cmp = satsub64be(seq, bitmap->max_seq_num); | - | ||||||||||||
| 34 | if (cmp > 0 
 | 732-2693 | ||||||||||||
| 35 | SSL3_RECORD_set_seq_num(((&s->rlayer)->rrec), seq); | - | ||||||||||||
| 36 | return executed 2693 times by 1 test: 1; return 1;Executed by: 
 executed 2693 times by 1 test:  return 1;Executed by: 
 | 2693 | ||||||||||||
| 37 | } | - | ||||||||||||
| 38 | shift = -cmp; | - | ||||||||||||
| 39 | if (shift >= sizeof(bitmap->map) * 8 
 | 5-727 | ||||||||||||
| 40 | return executed 5 times by 1 test: 0; return 0;Executed by: 
 executed 5 times by 1 test:  return 0;Executed by: 
 | 5 | ||||||||||||
| 41 | else if (bitmap->map & (1UL << shift) 
 | 2-725 | ||||||||||||
| 42 | return executed 2 times by 1 test: 0; return 0;Executed by: 
 executed 2 times by 1 test:  return 0;Executed by: 
 | 2 | ||||||||||||
| 43 | - | |||||||||||||
| 44 | SSL3_RECORD_set_seq_num(((&s->rlayer)->rrec), seq); | - | ||||||||||||
| 45 | return executed 725 times by 1 test: 1; return 1;Executed by: 
 executed 725 times by 1 test:  return 1;Executed by: 
 | 725 | ||||||||||||
| 46 | } | - | ||||||||||||
| 47 | - | |||||||||||||
| 48 | void dtls1_record_bitmap_update(SSL *s, DTLS1_BITMAP *bitmap) | - | ||||||||||||
| 49 | { | - | ||||||||||||
| 50 | int cmp; | - | ||||||||||||
| 51 | unsigned int shift; | - | ||||||||||||
| 52 | const unsigned char *seq = ((&s->rlayer)->read_sequence); | - | ||||||||||||
| 53 | - | |||||||||||||
| 54 | cmp = satsub64be(seq, bitmap->max_seq_num); | - | ||||||||||||
| 55 | if (cmp > 0 
 | 718-2691 | ||||||||||||
| 56 | shift = cmp; | - | ||||||||||||
| 57 | if (shift < sizeof(bitmap->map) * 8 
 | 9-2682 | ||||||||||||
| 58 | bitmap->map <<= shift, bitmap->map |= 1UL; executed 2682 times by 1 test:  bitmap->map <<= shift, bitmap->map |= 1UL;Executed by: 
 | 2682 | ||||||||||||
| 59 | else | - | ||||||||||||
| 60 | bitmap->map = 1UL; executed 9 times by 1 test:  bitmap->map = 1UL;Executed by: 
 | 9 | ||||||||||||
| 61 | memcpy(bitmap->max_seq_num, seq, 8); | - | ||||||||||||
| 62 | } executed 2691 times by 1 test: else { end of blockExecuted by: 
 | 2691 | ||||||||||||
| 63 | shift = -cmp; | - | ||||||||||||
| 64 | if (shift < sizeof(bitmap->map) * 8 
 | 0-718 | ||||||||||||
| 65 | bitmap->map |= 1UL << shift; executed 718 times by 1 test:  bitmap->map |= 1UL << shift;Executed by: 
 | 718 | ||||||||||||
| 66 | } executed 718 times by 1 test:  end of blockExecuted by: 
 | 718 | ||||||||||||
| 67 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |