OpenCoverage

dsa_key.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/dsa/dsa_key.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6static int dsa_builtin_keygen(DSA *dsa);-
7-
8int-
9DSA_generate_key(DSA *dsa)-
10{-
11 if (dsa->meth->dsa_keygen
dsa->meth->dsa_keygenDescription
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
)
0-2
12 return
never executed: return dsa->meth->dsa_keygen(dsa);
dsa->meth->dsa_keygen(dsa);
never executed: return dsa->meth->dsa_keygen(dsa);
0
13 return
executed 2 times by 2 tests: return dsa_builtin_keygen(dsa);
Executed by:
  • dsatest
  • libcrypto.so.44.0.1
dsa_builtin_keygen(dsa);
executed 2 times by 2 tests: return dsa_builtin_keygen(dsa);
Executed by:
  • dsatest
  • libcrypto.so.44.0.1
2
14}-
15-
16static int-
17dsa_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 ((
(ctx = BN_CTX_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
ctx = BN_CTX_new()) ==
(ctx = BN_CTX_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
0-2
30 ((void *)0)
(ctx = BN_CTX_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
0-2
31 )-
32 goto
never executed: goto err;
err;
never executed: goto err;
0
33-
34 if (dsa->priv_key ==
dsa->priv_key == ((void *)0)Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
FALSEnever evaluated
0-2
35 ((void *)0)
dsa->priv_key == ((void *)0)Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
FALSEnever evaluated
0-2
36 ) {-
37 if ((
(priv_key = BN...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
priv_key = BN_new()) ==
(priv_key = BN...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
0-2
38 ((void *)0)
(priv_key = BN...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
0-2
39 )-
40 goto
never executed: goto err;
err;
never executed: goto err;
0
41 }
executed 2 times by 2 tests: end of block
Executed by:
  • dsatest
  • libcrypto.so.44.0.1
else
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)
!BN_rand_range...v_key, dsa->q)Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
)
0-2
46 goto
never executed: goto err;
err;
never executed: goto err;
0
47 }
executed 2 times by 2 tests: end of block
Executed by:
  • dsatest
  • libcrypto.so.44.0.1
while (((
((priv_key)->top == 0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
priv_key)->top == 0)
((priv_key)->top == 0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
);
0-2
48-
49 if (dsa->pub_key ==
dsa->pub_key == ((void *)0)Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
FALSEnever evaluated
0-2
50 ((void *)0)
dsa->pub_key == ((void *)0)Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
FALSEnever evaluated
0-2
51 ) {-
52 if ((
(pub_key = BN_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
pub_key = BN_new()) ==
(pub_key = BN_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
0-2
53 ((void *)0)
(pub_key = BN_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
0-2
54 )-
55 goto
never executed: goto err;
err;
never executed: goto err;
0
56 }
executed 2 times by 2 tests: end of block
Executed by:
  • dsatest
  • libcrypto.so.44.0.1
else
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)
!BN_mod_exp_ct..., dsa->p, ctx)Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
)
0-2
65 goto
never executed: goto err;
err;
never executed: goto err;
0
66 }-
67-
68 dsa->priv_key = priv_key;-
69 dsa->pub_key = pub_key;-
70 ok = 1;-
71-
72err:
code before this statement executed 2 times by 2 tests: err:
Executed by:
  • dsatest
  • libcrypto.so.44.0.1
2
73 if (pub_key !=
pub_key != ((void *)0)Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
FALSEnever evaluated
0-2
74 ((void *)0)
pub_key != ((void *)0)Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
FALSEnever evaluated
0-2
75 && dsa->pub_key ==
dsa->pub_key == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
0-2
76 ((void *)0)
dsa->pub_key == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
0-2
77 )-
78 BN_free(pub_key);
never executed: BN_free(pub_key);
0
79 if (priv_key !=
priv_key != ((void *)0)Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
FALSEnever evaluated
0-2
80 ((void *)0)
priv_key != ((void *)0)Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
FALSEnever evaluated
0-2
81 && dsa->priv_key ==
dsa->priv_key == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
0-2
82 ((void *)0)
dsa->priv_key == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
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: return ok;
Executed by:
  • dsatest
  • libcrypto.so.44.0.1
ok;
executed 2 times by 2 tests: return ok;
Executed by:
  • dsatest
  • libcrypto.so.44.0.1
2
87}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2