Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/rsa/rsa_mp.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | void rsa_multip_info_free_ex(RSA_PRIME_INFO *pinfo) | - | ||||||||||||
3 | { | - | ||||||||||||
4 | - | |||||||||||||
5 | BN_clear_free(pinfo->pp); | - | ||||||||||||
6 | CRYPTO_free(pinfo, __FILE__, 19); | - | ||||||||||||
7 | } executed 8639 times by 1 test: end of block Executed by:
| 8639 | ||||||||||||
8 | - | |||||||||||||
9 | void rsa_multip_info_free(RSA_PRIME_INFO *pinfo) | - | ||||||||||||
10 | { | - | ||||||||||||
11 | - | |||||||||||||
12 | BN_clear_free(pinfo->r); | - | ||||||||||||
13 | BN_clear_free(pinfo->d); | - | ||||||||||||
14 | BN_clear_free(pinfo->t); | - | ||||||||||||
15 | rsa_multip_info_free_ex(pinfo); | - | ||||||||||||
16 | } executed 8639 times by 1 test: end of block Executed by:
| 8639 | ||||||||||||
17 | - | |||||||||||||
18 | RSA_PRIME_INFO *rsa_multip_info_new(void) | - | ||||||||||||
19 | { | - | ||||||||||||
20 | RSA_PRIME_INFO *pinfo; | - | ||||||||||||
21 | - | |||||||||||||
22 | - | |||||||||||||
23 | if ((
| 0-13 | ||||||||||||
24 | ((void *)0)
| 0-13 | ||||||||||||
25 | ) { | - | ||||||||||||
26 | ERR_put_error(4,(166),((1|64)),__FILE__,37); | - | ||||||||||||
27 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||
28 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
29 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
30 | } | - | ||||||||||||
31 | if ((
| 0-13 | ||||||||||||
32 | ((void *)0)
| 0-13 | ||||||||||||
33 | ) | - | ||||||||||||
34 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
35 | if ((
| 0-13 | ||||||||||||
36 | ((void *)0)
| 0-13 | ||||||||||||
37 | ) | - | ||||||||||||
38 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
39 | if ((
| 0-13 | ||||||||||||
40 | ((void *)0)
| 0-13 | ||||||||||||
41 | ) | - | ||||||||||||
42 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
43 | if ((
| 0-13 | ||||||||||||
44 | ((void *)0)
| 0-13 | ||||||||||||
45 | ) | - | ||||||||||||
46 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
47 | - | |||||||||||||
48 | return executed 13 times by 1 test: pinfo;return pinfo; Executed by:
executed 13 times by 1 test: return pinfo; Executed by:
| 13 | ||||||||||||
49 | - | |||||||||||||
50 | err: | - | ||||||||||||
51 | BN_free(pinfo->r); | - | ||||||||||||
52 | BN_free(pinfo->d); | - | ||||||||||||
53 | BN_free(pinfo->t); | - | ||||||||||||
54 | BN_free(pinfo->pp); | - | ||||||||||||
55 | CRYPTO_free(pinfo, __FILE__, 56); | - | ||||||||||||
56 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||
57 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
58 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
59 | } | - | ||||||||||||
60 | - | |||||||||||||
61 | - | |||||||||||||
62 | int rsa_multip_calc_product(RSA *rsa) | - | ||||||||||||
63 | { | - | ||||||||||||
64 | RSA_PRIME_INFO *pinfo; | - | ||||||||||||
65 | BIGNUM *p1 = | - | ||||||||||||
66 | ((void *)0) | - | ||||||||||||
67 | , *p2 = | - | ||||||||||||
68 | ((void *)0) | - | ||||||||||||
69 | ; | - | ||||||||||||
70 | BN_CTX *ctx = | - | ||||||||||||
71 | ((void *)0) | - | ||||||||||||
72 | ; | - | ||||||||||||
73 | int i, rv = 0, ex_primes; | - | ||||||||||||
74 | - | |||||||||||||
75 | if ((
| 2-167 | ||||||||||||
76 | - | |||||||||||||
77 | goto executed 2 times by 1 test: err;goto err; Executed by:
executed 2 times by 1 test: goto err; Executed by:
| 2 | ||||||||||||
78 | } | - | ||||||||||||
79 | - | |||||||||||||
80 | if ((
| 0-167 | ||||||||||||
81 | ((void *)0)
| 0-167 | ||||||||||||
82 | ) | - | ||||||||||||
83 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
84 | - | |||||||||||||
85 | - | |||||||||||||
86 | p1 = rsa->p; | - | ||||||||||||
87 | p2 = rsa->q; | - | ||||||||||||
88 | - | |||||||||||||
89 | for (i = 0; i < ex_primes
| 167-3947 | ||||||||||||
90 | pinfo = sk_RSA_PRIME_INFO_value(rsa->prime_infos, i); | - | ||||||||||||
91 | if (pinfo->pp ==
| 1-3946 | ||||||||||||
92 | ((void *)0)
| 1-3946 | ||||||||||||
93 | ) { | - | ||||||||||||
94 | pinfo->pp = BN_secure_new(); | - | ||||||||||||
95 | if (pinfo->pp ==
| 0-3946 | ||||||||||||
96 | ((void *)0)
| 0-3946 | ||||||||||||
97 | ) | - | ||||||||||||
98 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
99 | } executed 3946 times by 1 test: end of block Executed by:
| 3946 | ||||||||||||
100 | if (!BN_mul(pinfo->pp, p1, p2, ctx)
| 0-3947 | ||||||||||||
101 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
102 | - | |||||||||||||
103 | p1 = pinfo->pp; | - | ||||||||||||
104 | p2 = pinfo->r; | - | ||||||||||||
105 | } executed 3947 times by 1 test: end of block Executed by:
| 3947 | ||||||||||||
106 | - | |||||||||||||
107 | rv = 1; | - | ||||||||||||
108 | err: code before this statement executed 167 times by 1 test: err: Executed by:
| 167 | ||||||||||||
109 | BN_CTX_free(ctx); | - | ||||||||||||
110 | return executed 169 times by 1 test: rv;return rv; Executed by:
executed 169 times by 1 test: return rv; Executed by:
| 169 | ||||||||||||
111 | } | - | ||||||||||||
112 | - | |||||||||||||
113 | int rsa_multip_cap(int bits) | - | ||||||||||||
114 | { | - | ||||||||||||
115 | int cap = 5; | - | ||||||||||||
116 | - | |||||||||||||
117 | if (bits < 1024
| 3-23 | ||||||||||||
118 | cap = 2; executed 3 times by 1 test: cap = 2; Executed by:
| 3 | ||||||||||||
119 | else if (bits < 4096
| 8-15 | ||||||||||||
120 | cap = 3; executed 15 times by 1 test: cap = 3; Executed by:
| 15 | ||||||||||||
121 | else if (bits < 8192
| 4 | ||||||||||||
122 | cap = 4; executed 4 times by 1 test: cap = 4; Executed by:
| 4 | ||||||||||||
123 | - | |||||||||||||
124 | if (cap > 5
| 0-26 | ||||||||||||
125 | cap = 5; never executed: cap = 5; | 0 | ||||||||||||
126 | - | |||||||||||||
127 | return executed 26 times by 1 test: cap;return cap; Executed by:
executed 26 times by 1 test: return cap; Executed by:
| 26 | ||||||||||||
128 | } | - | ||||||||||||
Switch to Source code | Preprocessed file |