OpenCoverage

kexc25519c.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssh/src/kexc25519c.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8static int-
9input_kex_c25519_reply(int type, u_int32_t seq, struct ssh *ssh);-
10-
11int-
12kexc25519_client(struct ssh *ssh)-
13{-
14 struct kex *kex = ssh->kex;-
15 int r;-
16-
17 kexc25519_keygen(kex->c25519_client_key, kex->c25519_client_pubkey);-
18-
19-
20-
21-
22 if ((
(r = sshpkt_st...ssh, 30)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = sshpkt_start(ssh, 30)) != 0
(r = sshpkt_st...ssh, 30)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
||
0-20
23 (
(r = sshpkt_pu...pubkey))) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = sshpkt_put_string(ssh, kex->c25519_client_pubkey,
(r = sshpkt_pu...pubkey))) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
24 sizeof(kex->c25519_client_pubkey))) != 0
(r = sshpkt_pu...pubkey))) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
||
0-20
25 (
(r = sshpkt_send(ssh)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = sshpkt_send(ssh)) != 0
(r = sshpkt_send(ssh)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
)
0-20
26 return
never executed: return r;
r;
never executed: return r;
0
27-
28 debug("expecting SSH2_MSG_KEX_ECDH_REPLY");-
29 ssh_dispatch_set(ssh, 31, &input_kex_c25519_reply);-
30 return
executed 20 times by 1 test: return 0;
Executed by:
  • test_kex
0;
executed 20 times by 1 test: return 0;
Executed by:
  • test_kex
20
31}-
32-
33static int-
34input_kex_c25519_reply(int type, u_int32_t seq, struct ssh *ssh)-
35{-
36 struct kex *kex = ssh->kex;-
37 struct sshkey *server_host_key = -
38 ((void *)0)-
39 ;-
40 struct sshbuf *shared_secret = -
41 ((void *)0)-
42 ;-
43 u_char *server_pubkey = -
44 ((void *)0)-
45 ;-
46 u_char *server_host_key_blob = -
47 ((void *)0)-
48 , *signature = -
49 ((void *)0)-
50 ;-
51 u_char hash[64];-
52 size_t slen, pklen, sbloblen, hashlen;-
53 int r;-
54-
55 if (kex->verify_host_key ==
kex->verify_ho...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
56 ((void *)0)
kex->verify_ho...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
57 ) {-
58 r = -10;-
59 goto
never executed: goto out;
out;
never executed: goto out;
0
60 }-
61-
62-
63 if ((
(r = sshpkt_ge...bloblen)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = sshpkt_get_string(ssh, &server_host_key_blob,
(r = sshpkt_ge...bloblen)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
64 &sbloblen)) != 0
(r = sshpkt_ge...bloblen)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
||
0-20
65 (
(r = sshkey_fr...ost_key)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = sshkey_from_blob(server_host_key_blob, sbloblen,
(r = sshkey_fr...ost_key)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
66 &server_host_key)) != 0
(r = sshkey_fr...ost_key)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
)
0-20
67 goto
never executed: goto out;
out;
never executed: goto out;
0
68 if (server_host_key->type != kex->hostkey_type
server_host_ke...->hostkey_typeDescription
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
||
0-20
69 (kex->hostkey_type == KEY_ECDSA
kex->hostkey_type == KEY_ECDSADescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • test_kex
FALSEevaluated 15 times by 1 test
Evaluated by:
  • test_kex
&&
5-15
70 server_host_key->ecdsa_nid != kex->hostkey_nid
server_host_ke...x->hostkey_nidDescription
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • test_kex
)) {
0-5
71 r = -13;-
72 goto
never executed: goto out;
out;
never executed: goto out;
0
73 }-
74 if (kex->verify_host_key(server_host_key, ssh) == -1
kex->verify_ho...ey, ssh) == -1Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
) {
0-20
75 r = -21;-
76 goto
never executed: goto out;
out;
never executed: goto out;
0
77 }-
78-
79-
80-
81 if ((
(r = sshpkt_ge... &pklen)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = sshpkt_get_string(ssh, &server_pubkey, &pklen)) != 0
(r = sshpkt_ge... &pklen)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
||
0-20
82 (
(r = sshpkt_ge..., &slen)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = sshpkt_get_string(ssh, &signature, &slen)) != 0
(r = sshpkt_ge..., &slen)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
||
0-20
83 (
(r = sshpkt_get_end(ssh)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = sshpkt_get_end(ssh)) != 0
(r = sshpkt_get_end(ssh)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
)
0-20
84 goto
never executed: goto out;
out;
never executed: goto out;
0
85 if (pklen != 32
pklen != 32Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
) {
0-20
86 r = -21;-
87 goto
never executed: goto out;
out;
never executed: goto out;
0
88 }-
89-
90-
91-
92-
93-
94 if ((
(shared_secret...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
shared_secret = sshbuf_new()) ==
(shared_secret...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
95 ((void *)0)
(shared_secret...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
96 ) {-
97 r = -2;-
98 goto
never executed: goto out;
out;
never executed: goto out;
0
99 }-
100 if ((
(r = kexc25519...d_secret)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = kexc25519_shared_key(kex->c25519_client_key, server_pubkey,
(r = kexc25519...d_secret)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
101 shared_secret)) < 0
(r = kexc25519...d_secret)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
)
0-20
102 goto
never executed: goto out;
out;
never executed: goto out;
0
103-
104-
105 hashlen = sizeof(hash);-
106 if ((
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = kex_c25519_hash(
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
107 kex->hash_alg,
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
108 kex->client_version_string,
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
109 kex->server_version_string,
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
110 sshbuf_ptr(kex->my), sshbuf_len(kex->my),
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
111 sshbuf_ptr(kex->peer), sshbuf_len(kex->peer),
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
112 server_host_key_blob, sbloblen,
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
113 kex->c25519_client_pubkey,
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
114 server_pubkey,
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
115 sshbuf_ptr(shared_secret), sshbuf_len(shared_secret),
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
116 hash, &hashlen)) < 0
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
)
0-20
117 goto
never executed: goto out;
out;
never executed: goto out;
0
118-
119 if ((
(r = sshkey_ve...>compat)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = sshkey_verify(server_host_key, signature, slen, hash, hashlen,
(r = sshkey_ve...>compat)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
120 kex->hostkey_alg, ssh->compat)) != 0
(r = sshkey_ve...>compat)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
)
0-20
121 goto
never executed: goto out;
out;
never executed: goto out;
0
122-
123-
124 if (kex->session_id ==
kex->session_id == ((void *)0)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • test_kex
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_kex
4-16
125 ((void *)0)
kex->session_id == ((void *)0)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • test_kex
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_kex
4-16
126 ) {-
127 kex->session_id_len = hashlen;-
128 kex->session_id = malloc(kex->session_id_len);-
129 if (kex->session_id ==
kex->session_id == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • test_kex
0-4
130 ((void *)0)
kex->session_id == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • test_kex
0-4
131 ) {-
132 r = -2;-
133 goto
never executed: goto out;
out;
never executed: goto out;
0
134 }-
135 memcpy(kex->session_id, hash, kex->session_id_len);-
136 }
executed 4 times by 1 test: end of block
Executed by:
  • test_kex
4
137-
138 if ((
(r = kex_deriv..._secret)) == 0Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
FALSEnever evaluated
r = kex_derive_keys(ssh, hash, hashlen, shared_secret)) == 0
(r = kex_deriv..._secret)) == 0Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
FALSEnever evaluated
)
0-20
139 r = kex_send_newkeys(ssh);
executed 20 times by 1 test: r = kex_send_newkeys(ssh);
Executed by:
  • test_kex
20
140out:
code before this statement executed 20 times by 1 test: out:
Executed by:
  • test_kex
20
141 explicit_bzero(hash, sizeof(hash));-
142 explicit_bzero(kex->c25519_client_key, sizeof(kex->c25519_client_key));-
143 free(server_host_key_blob);-
144 free(server_pubkey);-
145 free(signature);-
146 sshkey_free(server_host_key);-
147 sshbuf_free(shared_secret);-
148 return
executed 20 times by 1 test: return r;
Executed by:
  • test_kex
r;
executed 20 times by 1 test: return r;
Executed by:
  • test_kex
20
149}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2