OpenCoverage

bn_mpi.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/bn/bn_mpi.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2int BN_bn2mpi(const BIGNUM *a, unsigned char *d)-
3{-
4 int bits;-
5 int num = 0;-
6 int ext = 0;-
7 long l;-
8-
9 bits = BN_num_bits(a);-
10 num = (bits + 7) / 8;-
11 if (bits > 0
bits > 0Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
2-10
12 ext = ((bits & 0x07) == 0);-
13 }
executed 10 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
10
14 if (d ==
d == ((void *)0)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
6
15 ((void *)0)
d == ((void *)0)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
6
16 )-
17 return
executed 6 times by 1 test: return (num + 4 + ext);
Executed by:
  • libcrypto.so.1.1
(num + 4 + ext);
executed 6 times by 1 test: return (num + 4 + ext);
Executed by:
  • libcrypto.so.1.1
6
18-
19 l = num + ext;-
20 d[0] = (unsigned char)(l >> 24) & 0xff;-
21 d[1] = (unsigned char)(l >> 16) & 0xff;-
22 d[2] = (unsigned char)(l >> 8) & 0xff;-
23 d[3] = (unsigned char)(l) & 0xff;-
24 if (ext
extDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
1-5
25 d[4] = 0;
executed 1 time by 1 test: d[4] = 0;
Executed by:
  • libcrypto.so.1.1
1
26 num = BN_bn2bin(a, &(d[4 + ext]));-
27 if (a->neg
a->negDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
2-4
28 d[4] |= 0x80;
executed 2 times by 1 test: d[4] |= 0x80;
Executed by:
  • libcrypto.so.1.1
2
29 return
executed 6 times by 1 test: return (num + 4 + ext);
Executed by:
  • libcrypto.so.1.1
(num + 4 + ext);
executed 6 times by 1 test: return (num + 4 + ext);
Executed by:
  • libcrypto.so.1.1
6
30}-
31-
32BIGNUM *BN_mpi2bn(const unsigned char *d, int n, BIGNUM *ain)-
33{-
34 long len;-
35 int neg = 0;-
36 BIGNUM *a = -
37 ((void *)0)-
38 ;-
39-
40 if (n < 4
n < 4Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-6
41 ERR_put_error(3,(112),(106),__FILE__,49);-
42 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
43 ((void *)0)
never executed: return ((void *)0) ;
0
44 ;
never executed: return ((void *)0) ;
0
45 }-
46 len = ((long)d[0] << 24) | ((long)d[1] << 16) | ((int)d[2] << 8) | (int)-
47 d[3];-
48 if ((
(len + 4) != nDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
len + 4) != n
(len + 4) != nDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-6
49 ERR_put_error(3,(112),(104),__FILE__,55);-
50 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
51 ((void *)0)
never executed: return ((void *)0) ;
0
52 ;
never executed: return ((void *)0) ;
0
53 }-
54-
55 if (ain ==
ain == ((void *)0)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-6
56 ((void *)0)
ain == ((void *)0)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-6
57 )-
58 a = BN_new();
executed 6 times by 1 test: a = BN_new();
Executed by:
  • libcrypto.so.1.1
6
59 else-
60 a = ain;
never executed: a = ain;
0
61-
62 if (a ==
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-6
63 ((void *)0)
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-6
64 )-
65 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
66 ((void *)0)
never executed: return ((void *)0) ;
0
67 ;
never executed: return ((void *)0) ;
0
68-
69 if (len == 0
len == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1-5
70 a->neg = 0;-
71 a->top = 0;-
72 return
executed 1 time by 1 test: return a;
Executed by:
  • libcrypto.so.1.1
a;
executed 1 time by 1 test: return a;
Executed by:
  • libcrypto.so.1.1
1
73 }-
74 d += 4;-
75 if ((*
(*d) & 0x80Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
d) & 0x80
(*d) & 0x80Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
2-3
76 neg = 1;
executed 2 times by 1 test: neg = 1;
Executed by:
  • libcrypto.so.1.1
2
77 if (BN_bin2bn(d, (int)len, a) ==
BN_bin2bn(d, (...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-5
78 ((void *)0)
BN_bin2bn(d, (...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-5
79 ) {-
80 if (ain ==
ain == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
81 ((void *)0)
ain == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
82 )-
83 BN_free(a);
never executed: BN_free(a);
0
84 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
85 ((void *)0)
never executed: return ((void *)0) ;
0
86 ;
never executed: return ((void *)0) ;
0
87 }-
88 a->neg = neg;-
89 if (neg
negDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
2-3
90 BN_clear_bit(a, BN_num_bits(a) - 1);-
91 }
executed 2 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
2
92 ;-
93 return
executed 5 times by 1 test: return a;
Executed by:
  • libcrypto.so.1.1
a;
executed 5 times by 1 test: return a;
Executed by:
  • libcrypto.so.1.1
5
94}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2