OpenCoverage

dtls1_bitmap.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/ssl/record/dtls1_bitmap.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3static 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
l1 > l2Description
TRUEevaluated 5384 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1450 times by 1 test
Evaluated by:
  • libssl.so.1.1
&& ret < 0
ret < 0Description
TRUEnever evaluated
FALSEevaluated 5384 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-5384
15 return
never executed: return 128;
128;
never executed: return 128;
0
16 else if (l2 > l1
l2 > l1Description
TRUEevaluated 22 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 6812 times by 1 test
Evaluated by:
  • libssl.so.1.1
&& ret > 0
ret > 0Description
TRUEnever evaluated
FALSEevaluated 22 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-6812
17 return
never executed: return -128;
-128;
never executed: return -128;
0
18-
19 if (ret > 128
ret > 128Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 6815 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
19-6815
20 return
executed 19 times by 1 test: return 128;
Executed by:
  • libssl.so.1.1
128;
executed 19 times by 1 test: return 128;
Executed by:
  • libssl.so.1.1
19
21 else if (ret < -128
ret < -128Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 6810 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
5-6810
22 return
executed 5 times by 1 test: return -128;
Executed by:
  • libssl.so.1.1
-128;
executed 5 times by 1 test: return -128;
Executed by:
  • libssl.so.1.1
5
23 else-
24 return
executed 6810 times by 1 test: return (int)ret;
Executed by:
  • libssl.so.1.1
(int)ret;
executed 6810 times by 1 test: return (int)ret;
Executed by:
  • libssl.so.1.1
6810
25}-
26-
27int 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
cmp > 0Description
TRUEevaluated 2693 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 732 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
732-2693
35 SSL3_RECORD_set_seq_num(((&s->rlayer)->rrec), seq);-
36 return
executed 2693 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 2693 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
2693
37 }-
38 shift = -cmp;-
39 if (shift >= sizeof(bitmap->map) * 8
shift >= sizeo...tmap->map) * 8Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 727 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
5-727
40 return
executed 5 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
0;
executed 5 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
5
41 else if (bitmap->map & (1UL << shift)
bitmap->map & (1UL << shift)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 725 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
2-725
42 return
executed 2 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
0;
executed 2 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
2
43-
44 SSL3_RECORD_set_seq_num(((&s->rlayer)->rrec), seq);-
45 return
executed 725 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 725 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
725
46}-
47-
48void 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
cmp > 0Description
TRUEevaluated 2691 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 718 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
718-2691
56 shift = cmp;-
57 if (shift < sizeof(bitmap->map) * 8
shift < sizeof...tmap->map) * 8Description
TRUEevaluated 2682 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
9-2682
58 bitmap->map <<= shift, bitmap->map |= 1UL;
executed 2682 times by 1 test: bitmap->map <<= shift, bitmap->map |= 1UL;
Executed by:
  • libssl.so.1.1
2682
59 else-
60 bitmap->map = 1UL;
executed 9 times by 1 test: bitmap->map = 1UL;
Executed by:
  • libssl.so.1.1
9
61 memcpy(bitmap->max_seq_num, seq, 8);-
62 }
executed 2691 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else {
2691
63 shift = -cmp;-
64 if (shift < sizeof(bitmap->map) * 8
shift < sizeof...tmap->map) * 8Description
TRUEevaluated 718 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
)
0-718
65 bitmap->map |= 1UL << shift;
executed 718 times by 1 test: bitmap->map |= 1UL << shift;
Executed by:
  • libssl.so.1.1
718
66 }
executed 718 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
718
67}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2