Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/dsa/dsa_key.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | - | |||||||||||||
6 | static int dsa_builtin_keygen(DSA *dsa); | - | ||||||||||||
7 | - | |||||||||||||
8 | int | - | ||||||||||||
9 | DSA_generate_key(DSA *dsa) | - | ||||||||||||
10 | { | - | ||||||||||||
11 | if (dsa->meth->dsa_keygen
| 0-2 | ||||||||||||
12 | return never executed: dsa->meth->dsa_keygen(dsa);return dsa->meth->dsa_keygen(dsa); never executed: return dsa->meth->dsa_keygen(dsa); | 0 | ||||||||||||
13 | return executed 2 times by 2 tests: dsa_builtin_keygen(dsa);return dsa_builtin_keygen(dsa); Executed by:
executed 2 times by 2 tests: return dsa_builtin_keygen(dsa); Executed by:
| 2 | ||||||||||||
14 | } | - | ||||||||||||
15 | - | |||||||||||||
16 | static int | - | ||||||||||||
17 | dsa_builtin_keygen(DSA *dsa) | - | ||||||||||||
18 | { | - | ||||||||||||
19 | int ok = 0; | - | ||||||||||||
20 | BN_CTX *ctx = | - | ||||||||||||
21 | ((void *)0) | - | ||||||||||||
22 | ; | - | ||||||||||||
23 | BIGNUM *pub_key = | - | ||||||||||||
24 | ((void *)0) | - | ||||||||||||
25 | , *priv_key = | - | ||||||||||||
26 | ((void *)0) | - | ||||||||||||
27 | ; | - | ||||||||||||
28 | - | |||||||||||||
29 | if ((
| 0-2 | ||||||||||||
30 | ((void *)0)
| 0-2 | ||||||||||||
31 | ) | - | ||||||||||||
32 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
33 | - | |||||||||||||
34 | if (dsa->priv_key ==
| 0-2 | ||||||||||||
35 | ((void *)0)
| 0-2 | ||||||||||||
36 | ) { | - | ||||||||||||
37 | if ((
| 0-2 | ||||||||||||
38 | ((void *)0)
| 0-2 | ||||||||||||
39 | ) | - | ||||||||||||
40 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
41 | } executed 2 times by 2 tests: elseend of block Executed by:
| 2 | ||||||||||||
42 | priv_key=dsa->priv_key; never executed: priv_key=dsa->priv_key; | 0 | ||||||||||||
43 | - | |||||||||||||
44 | do { | - | ||||||||||||
45 | if (!BN_rand_range(priv_key, dsa->q)
| 0-2 | ||||||||||||
46 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
47 | } executed 2 times by 2 tests: while (((end of block Executed by:
| 0-2 | ||||||||||||
48 | - | |||||||||||||
49 | if (dsa->pub_key ==
| 0-2 | ||||||||||||
50 | ((void *)0)
| 0-2 | ||||||||||||
51 | ) { | - | ||||||||||||
52 | if ((
| 0-2 | ||||||||||||
53 | ((void *)0)
| 0-2 | ||||||||||||
54 | ) | - | ||||||||||||
55 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
56 | } executed 2 times by 2 tests: elseend of block Executed by:
| 2 | ||||||||||||
57 | pub_key=dsa->pub_key; never executed: pub_key=dsa->pub_key; | 0 | ||||||||||||
58 | - | |||||||||||||
59 | { | - | ||||||||||||
60 | BIGNUM prk; | - | ||||||||||||
61 | - | |||||||||||||
62 | ((&prk)->d=(priv_key)->d, (&prk)->top=(priv_key)->top, (&prk)->dmax=(priv_key)->dmax, (&prk)->neg=(priv_key)->neg, (&prk)->flags=(((&prk)->flags & 0x01) | ((priv_key)->flags & ~0x01) | 0x02 | (0x04))); | - | ||||||||||||
63 | - | |||||||||||||
64 | if (!BN_mod_exp_ct(pub_key, dsa->g, &prk, dsa->p, ctx)
| 0-2 | ||||||||||||
65 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
66 | } | - | ||||||||||||
67 | - | |||||||||||||
68 | dsa->priv_key = priv_key; | - | ||||||||||||
69 | dsa->pub_key = pub_key; | - | ||||||||||||
70 | ok = 1; | - | ||||||||||||
71 | - | |||||||||||||
72 | err: code before this statement executed 2 times by 2 tests: err: Executed by:
| 2 | ||||||||||||
73 | if (pub_key !=
| 0-2 | ||||||||||||
74 | ((void *)0)
| 0-2 | ||||||||||||
75 | && dsa->pub_key ==
| 0-2 | ||||||||||||
76 | ((void *)0)
| 0-2 | ||||||||||||
77 | ) | - | ||||||||||||
78 | BN_free(pub_key); never executed: BN_free(pub_key); | 0 | ||||||||||||
79 | if (priv_key !=
| 0-2 | ||||||||||||
80 | ((void *)0)
| 0-2 | ||||||||||||
81 | && dsa->priv_key ==
| 0-2 | ||||||||||||
82 | ((void *)0)
| 0-2 | ||||||||||||
83 | ) | - | ||||||||||||
84 | BN_free(priv_key); never executed: BN_free(priv_key); | 0 | ||||||||||||
85 | BN_CTX_free(ctx); | - | ||||||||||||
86 | return executed 2 times by 2 tests: ok;return ok; Executed by:
executed 2 times by 2 tests: return ok; Executed by:
| 2 | ||||||||||||
87 | } | - | ||||||||||||
Switch to Source code | Preprocessed file |