OpenCoverage

kexc25519s.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssh/src/kexc25519s.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7static int input_kex_c25519_init(int, u_int32_t, struct ssh *);-
8-
9int-
10kexc25519_server(struct ssh *ssh)-
11{-
12 debug("expecting SSH2_MSG_KEX_ECDH_INIT");-
13 ssh_dispatch_set(ssh, 30, &input_kex_c25519_init);-
14 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
15}-
16-
17static int-
18input_kex_c25519_init(int type, u_int32_t seq, struct ssh *ssh)-
19{-
20 struct kex *kex = ssh->kex;-
21 struct sshkey *server_host_private, *server_host_public;-
22 struct sshbuf *shared_secret = -
23 ((void *)0)-
24 ;-
25 u_char *server_host_key_blob = -
26 ((void *)0)-
27 , *signature = -
28 ((void *)0)-
29 ;-
30 u_char server_key[32];-
31 u_char *client_pubkey = -
32 ((void *)0)-
33 ;-
34 u_char server_pubkey[32];-
35 u_char hash[64];-
36 size_t slen, pklen, sbloblen, hashlen;-
37 int r;-
38-
39-
40 kexc25519_keygen(server_key, server_pubkey);-
41-
42-
43-
44 if (kex->load_host_public_key ==
kex->load_host...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
45 ((void *)0)
kex->load_host...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
46 ||-
47 kex->load_host_private_key ==
kex->load_host...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
48 ((void *)0)
kex->load_host...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
49 ) {-
50 r = -10;-
51 goto
never executed: goto out;
out;
never executed: goto out;
0
52 }-
53 server_host_public = kex->load_host_public_key(kex->hostkey_type,-
54 kex->hostkey_nid, ssh);-
55 server_host_private = kex->load_host_private_key(kex->hostkey_type,-
56 kex->hostkey_nid, ssh);-
57 if (server_host_public ==
server_host_pu...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
58 ((void *)0)
server_host_pu...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
59 ) {-
60 r = -36;-
61 goto
never executed: goto out;
out;
never executed: goto out;
0
62 }-
63-
64 if ((
(r = sshpkt_ge... &pklen)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = sshpkt_get_string(ssh, &client_pubkey, &pklen)) != 0
(r = sshpkt_ge... &pklen)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
||
0-20
65 (
(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
66 goto
never executed: goto out;
out;
never executed: goto out;
0
67 if (pklen != 32
pklen != 32Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
) {
0-20
68 r = -21;-
69 goto
never executed: goto out;
out;
never executed: goto out;
0
70 }-
71-
72-
73-
74-
75 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
76 ((void *)0)
(shared_secret...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
77 ) {-
78 r = -2;-
79 goto
never executed: goto out;
out;
never executed: goto out;
0
80 }-
81 if ((
(r = kexc25519...d_secret)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = kexc25519_shared_key(server_key, client_pubkey,
(r = kexc25519...d_secret)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
82 shared_secret)) < 0
(r = kexc25519...d_secret)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
)
0-20
83 goto
never executed: goto out;
out;
never executed: goto out;
0
84-
85-
86 if ((
(r = sshkey_to...bloblen)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = sshkey_to_blob(server_host_public, &server_host_key_blob,
(r = sshkey_to...bloblen)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
87 &sbloblen)) != 0
(r = sshkey_to...bloblen)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
)
0-20
88 goto
never executed: goto out;
out;
never executed: goto out;
0
89 hashlen = sizeof(hash);-
90 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
91 kex->hash_alg,
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
92 kex->client_version_string,
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
93 kex->server_version_string,
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
94 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
95 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
96 server_host_key_blob, sbloblen,
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
97 client_pubkey,
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
98 server_pubkey,
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
99 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
100 hash, &hashlen)) < 0
(r = kex_c2551...&hashlen)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
)
0-20
101 goto
never executed: goto out;
out;
never executed: goto out;
0
102-
103-
104 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
105 ((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
106 ) {-
107 kex->session_id_len = hashlen;-
108 kex->session_id = malloc(kex->session_id_len);-
109 if (kex->session_id ==
kex->session_id == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • test_kex
0-4
110 ((void *)0)
kex->session_id == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • test_kex
0-4
111 ) {-
112 r = -2;-
113 goto
never executed: goto out;
out;
never executed: goto out;
0
114 }-
115 memcpy(kex->session_id, hash, kex->session_id_len);-
116 }
executed 4 times by 1 test: end of block
Executed by:
  • test_kex
4
117-
118-
119 if ((
(r = kex->sign...->compat)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = kex->sign(server_host_private, server_host_public, &signature,
(r = kex->sign...->compat)) < 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
0-20
120 &slen, hash, hashlen, kex->hostkey_alg, ssh->compat)) < 0
(r = kex->sign...->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 ((
(r = sshpkt_st...ssh, 31)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = sshpkt_start(ssh, 31)) != 0
(r = sshpkt_st...ssh, 31)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
||
0-20
125 (
(r = sshpkt_pu...bloblen)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = sshpkt_put_string(ssh, server_host_key_blob, sbloblen)) != 0
(r = sshpkt_pu...bloblen)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
||
0-20
126 (
(r = sshpkt_pu...pubkey))) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = sshpkt_put_string(ssh, server_pubkey, sizeof(server_pubkey))) != 0
(r = sshpkt_pu...pubkey))) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
||
0-20
127 (
(r = sshpkt_pu...e, slen)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
r = sshpkt_put_string(ssh, signature, slen)) != 0
(r = sshpkt_pu...e, slen)) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test_kex
||
0-20
128 (
(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
129 goto
never executed: goto out;
out;
never executed: goto out;
0
130-
131 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
132 r = kex_send_newkeys(ssh);
executed 20 times by 1 test: r = kex_send_newkeys(ssh);
Executed by:
  • test_kex
20
133out:
code before this statement executed 20 times by 1 test: out:
Executed by:
  • test_kex
20
134 explicit_bzero(hash, sizeof(hash));-
135 explicit_bzero(server_key, sizeof(server_key));-
136 free(server_host_key_blob);-
137 free(signature);-
138 free(client_pubkey);-
139 sshbuf_free(shared_secret);-
140 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
141}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2