OpenCoverage

kexc25519.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssh/src/kexc25519.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8extern int crypto_scalarmult_curve25519(u_char a[32],-
9 const u_char b[32], const u_char c[32])-
10 __attribute__(())-
11 __attribute__(())-
12 __attribute__(());-
13-
14void-
15kexc25519_keygen(u_char key[32], u_char pub[32])-
16{-
17 static const u_char basepoint[32] = {9};-
18-
19 arc4random_buf(key, 32);-
20 crypto_scalarmult_curve25519(pub, key, basepoint);-
21}
executed 40 times by 1 test: end of block
Executed by:
  • test_kex
40
22-
23int-
24kexc25519_shared_key(const u_char key[32],-
25 const u_char pub[32], struct sshbuf *out)-
26{-
27 u_char shared_key[32];-
28 int r;-
29-
30-
31 explicit_bzero(shared_key, 32);-
32 if (timingsafe_bcmp(pub, shared_key, 32) == 0
timingsafe_bcm..._key, 32) == 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
)
0-40
33 return
never executed: return -20;
-20;
never executed: return -20;
0
34-
35 crypto_scalarmult_curve25519(shared_key, key, pub);-
36-
37-
38-
39 sshbuf_reset(out);-
40 r = sshbuf_put_bignum2_bytes(out, shared_key, 32);-
41 explicit_bzero(shared_key, 32);-
42 return
executed 40 times by 1 test: return r;
Executed by:
  • test_kex
r;
executed 40 times by 1 test: return r;
Executed by:
  • test_kex
40
43}-
44-
45int-
46kex_c25519_hash(-
47 int hash_alg,-
48 const char *client_version_string,-
49 const char *server_version_string,-
50 const u_char *ckexinit, size_t ckexinitlen,-
51 const u_char *skexinit, size_t skexinitlen,-
52 const u_char *serverhostkeyblob, size_t sbloblen,-
53 const u_char client_dh_pub[32],-
54 const u_char server_dh_pub[32],-
55 const u_char *shared_secret, size_t secretlen,-
56 u_char *hash, size_t *hashlen)-
57{-
58 struct sshbuf *b;-
59 int r;-
60-
61 if (*
*hashlen < ssh...ytes(hash_alg)Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
hashlen < ssh_digest_bytes(hash_alg)
*hashlen < ssh...ytes(hash_alg)Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
)
0-40
62 return
never executed: return -10;
-10;
never executed: return -10;
0
63 if ((
(b = sshbuf_ne...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
b = sshbuf_new()) ==
(b = sshbuf_ne...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
0-40
64 ((void *)0)
(b = sshbuf_ne...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
0-40
65 )-
66 return
never executed: return -2;
-2;
never executed: return -2;
0
67 if ((
(r = sshbuf_pu...n_string)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
r = sshbuf_put_cstring(b, client_version_string)) < 0
(r = sshbuf_pu...n_string)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
||
0-40
68 (
(r = sshbuf_pu...n_string)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
r = sshbuf_put_cstring(b, server_version_string)) < 0
(r = sshbuf_pu...n_string)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
||
0-40
69-
70 (
(r = sshbuf_pu...nitlen+1)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
r = sshbuf_put_u32(b, ckexinitlen+1)) < 0
(r = sshbuf_pu...nitlen+1)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
||
0-40
71 (
(r = sshbuf_put_u8(b, 20)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
r = sshbuf_put_u8(b, 20)) < 0
(r = sshbuf_put_u8(b, 20)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
||
0-40
72 (
(r = sshbuf_pu...xinitlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
r = sshbuf_put(b, ckexinit, ckexinitlen)) < 0
(r = sshbuf_pu...xinitlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
||
0-40
73 (
(r = sshbuf_pu...nitlen+1)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
r = sshbuf_put_u32(b, skexinitlen+1)) < 0
(r = sshbuf_pu...nitlen+1)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
||
0-40
74 (
(r = sshbuf_put_u8(b, 20)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
r = sshbuf_put_u8(b, 20)) < 0
(r = sshbuf_put_u8(b, 20)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
||
0-40
75 (
(r = sshbuf_pu...xinitlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
r = sshbuf_put(b, skexinit, skexinitlen)) < 0
(r = sshbuf_pu...xinitlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
||
0-40
76 (
(r = sshbuf_pu...sbloblen)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
r = sshbuf_put_string(b, serverhostkeyblob, sbloblen)) < 0
(r = sshbuf_pu...sbloblen)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
||
0-40
77 (
(r = sshbuf_pu..._pub, 32)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
r = sshbuf_put_string(b, client_dh_pub, 32)) < 0
(r = sshbuf_pu..._pub, 32)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
||
0-40
78 (
(r = sshbuf_pu..._pub, 32)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
r = sshbuf_put_string(b, server_dh_pub, 32)) < 0
(r = sshbuf_pu..._pub, 32)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
||
0-40
79 (
(r = sshbuf_pu...ecretlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
r = sshbuf_put(b, shared_secret, secretlen)) < 0
(r = sshbuf_pu...ecretlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
) {
0-40
80 sshbuf_free(b);-
81 return
never executed: return r;
r;
never executed: return r;
0
82 }-
83-
84-
85-
86 if (ssh_digest_buffer(hash_alg, b, hash, *hashlen) != 0
ssh_digest_buf...*hashlen) != 0Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test_kex
) {
0-40
87 sshbuf_free(b);-
88 return
never executed: return -22;
-22;
never executed: return -22;
0
89 }-
90 sshbuf_free(b);-
91 *hashlen = ssh_digest_bytes(hash_alg);-
92-
93-
94-
95 return
executed 40 times by 1 test: return 0;
Executed by:
  • test_kex
0;
executed 40 times by 1 test: return 0;
Executed by:
  • test_kex
40
96}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2