Go to the documentation of this file.
32 #define TRACE_LEVEL SSH_TRACE_LEVEL
43 #if (SSH_SUPPORT == ENABLED)
50 static const char_t *
const sshSupportedKexAlgos[] =
52 #if (SSH_HYBRID_KEX_SUPPORT == ENABLED && SSH_SNTRUP761_SUPPORT == ENABLED && \
53 SSH_CURVE25519_SUPPORT == ENABLED && SSH_SHA512_SUPPORT == ENABLED)
54 "sntrup761x25519-sha512",
55 "sntrup761x25519-sha512@openssh.com",
57 #if (SSH_HYBRID_KEX_SUPPORT == ENABLED && SSH_MLKEM768_SUPPORT == ENABLED && \
58 SSH_CURVE25519_SUPPORT == ENABLED && SSH_SHA256_SUPPORT == ENABLED)
59 "mlkem768x25519-sha256",
61 #if (SSH_HYBRID_KEX_SUPPORT == ENABLED && SSH_MLKEM768_SUPPORT == ENABLED && \
62 SSH_NISTP256_SUPPORT == ENABLED && SSH_SHA256_SUPPORT == ENABLED)
63 "mlkem768nistp256-sha256",
65 #if (SSH_HYBRID_KEX_SUPPORT == ENABLED && SSH_MLKEM1024_SUPPORT == ENABLED && \
66 SSH_NISTP384_SUPPORT == ENABLED && SSH_SHA384_SUPPORT == ENABLED)
67 "mlkem1024nistp384-sha384",
69 #if (SSH_ECDH_KEX_SUPPORT == ENABLED && SSH_CURVE25519_SUPPORT == ENABLED && \
70 SSH_SHA256_SUPPORT == ENABLED)
72 "curve25519-sha256@libssh.org",
74 #if (SSH_ECDH_KEX_SUPPORT == ENABLED && SSH_CURVE448_SUPPORT == ENABLED && \
75 SSH_SHA512_SUPPORT == ENABLED)
78 #if (SSH_ECDH_KEX_SUPPORT == ENABLED && SSH_NISTP256_SUPPORT == ENABLED && \
79 SSH_SHA256_SUPPORT == ENABLED)
82 #if (SSH_ECDH_KEX_SUPPORT == ENABLED && SSH_NISTP384_SUPPORT == ENABLED && \
83 SSH_SHA384_SUPPORT == ENABLED)
86 #if (SSH_ECDH_KEX_SUPPORT == ENABLED && SSH_NISTP521_SUPPORT == ENABLED && \
87 SSH_SHA512_SUPPORT == ENABLED)
90 #if (SSH_DH_GEX_KEX_SUPPORT == ENABLED && SSH_SHA256_SUPPORT == ENABLED)
91 "diffie-hellman-group-exchange-sha256",
93 #if (SSH_DH_GEX_KEX_SUPPORT == ENABLED && SSH_SHA384_SUPPORT == ENABLED)
94 "diffie-hellman-group-exchange-sha384@ssh.com",
96 #if (SSH_DH_GEX_KEX_SUPPORT == ENABLED && SSH_SHA512_SUPPORT == ENABLED)
97 "diffie-hellman-group-exchange-sha512@ssh.com",
99 #if (SSH_DH_KEX_SUPPORT == ENABLED && SSH_SHA256_SUPPORT == ENABLED && \
100 SSH_MAX_DH_MODULUS_SIZE >= 2048 && SSH_MIN_DH_MODULUS_SIZE <= 2048)
101 "diffie-hellman-group14-sha256",
103 #if (SSH_DH_KEX_SUPPORT == ENABLED && SSH_SHA512_SUPPORT == ENABLED && \
104 SSH_MAX_DH_MODULUS_SIZE >= 3072 && SSH_MIN_DH_MODULUS_SIZE <= 3072)
105 "diffie-hellman-group15-sha512",
107 #if (SSH_DH_KEX_SUPPORT == ENABLED && SSH_SHA512_SUPPORT == ENABLED && \
108 SSH_MAX_DH_MODULUS_SIZE >= 4096 && SSH_MIN_DH_MODULUS_SIZE <= 4096)
109 "diffie-hellman-group16-sha512",
111 #if (SSH_DH_KEX_SUPPORT == ENABLED && SSH_SHA512_SUPPORT == ENABLED && \
112 SSH_MAX_DH_MODULUS_SIZE >= 6144 && SSH_MIN_DH_MODULUS_SIZE <= 6144)
113 "diffie-hellman-group17-sha512",
115 #if (SSH_DH_KEX_SUPPORT == ENABLED && SSH_SHA512_SUPPORT == ENABLED && \
116 SSH_MAX_DH_MODULUS_SIZE >= 8192 && SSH_MIN_DH_MODULUS_SIZE <= 8192)
117 "diffie-hellman-group18-sha512",
119 #if (SSH_RSA_KEX_SUPPORT == ENABLED && SSH_SHA256_SUPPORT == ENABLED && \
120 SSH_MAX_RSA_MODULUS_SIZE >= 2048)
123 #if (SSH_DH_GEX_KEX_SUPPORT == ENABLED && SSH_SHA224_SUPPORT == ENABLED)
124 "diffie-hellman-group-exchange-sha224@ssh.com",
126 #if (SSH_DH_GEX_KEX_SUPPORT == ENABLED && SSH_SHA1_SUPPORT == ENABLED)
127 "diffie-hellman-group-exchange-sha1",
129 #if (SSH_DH_KEX_SUPPORT == ENABLED && SSH_SHA1_SUPPORT == ENABLED && \
130 SSH_MAX_DH_MODULUS_SIZE >= 2048 && SSH_MIN_DH_MODULUS_SIZE <= 2048)
131 "diffie-hellman-group14-sha1",
133 #if (SSH_DH_KEX_SUPPORT == ENABLED && SSH_SHA1_SUPPORT == ENABLED && \
134 SSH_MAX_DH_MODULUS_SIZE >= 1024 && SSH_MIN_DH_MODULUS_SIZE <= 1024)
135 "diffie-hellman-group1-sha1",
137 #if (SSH_RSA_KEX_SUPPORT == ENABLED && SSH_SHA1_SUPPORT == ENABLED && \
138 SSH_MAX_RSA_MODULUS_SIZE >= 1024)
150 #if (SSH_ED25519_SIGN_SUPPORT == ENABLED && SSH_CERT_SUPPORT == ENABLED)
152 "ssh-ed25519-cert-v01@openssh.com",
153 "ssh-ed25519-cert-v01@openssh.com",
157 #if (SSH_ED25519_SIGN_SUPPORT == ENABLED)
164 #if (SSH_ED448_SIGN_SUPPORT == ENABLED)
171 #if (SSH_ECDSA_SIGN_SUPPORT == ENABLED && SSH_NISTP256_SUPPORT == ENABLED && \
172 SSH_SHA256_SUPPORT == ENABLED && SSH_CERT_SUPPORT == ENABLED)
174 "ecdsa-sha2-nistp256-cert-v01@openssh.com",
175 "ecdsa-sha2-nistp256-cert-v01@openssh.com",
176 "ecdsa-sha2-nistp256"
179 #if (SSH_ECDSA_SIGN_SUPPORT == ENABLED && SSH_NISTP256_SUPPORT == ENABLED && \
180 SSH_SHA256_SUPPORT == ENABLED)
182 "ecdsa-sha2-nistp256",
183 "ecdsa-sha2-nistp256",
184 "ecdsa-sha2-nistp256"
187 #if (SSH_ECDSA_SIGN_SUPPORT == ENABLED && SSH_NISTP384_SUPPORT == ENABLED && \
188 SSH_SHA384_SUPPORT == ENABLED && SSH_CERT_SUPPORT == ENABLED)
190 "ecdsa-sha2-nistp384-cert-v01@openssh.com",
191 "ecdsa-sha2-nistp384-cert-v01@openssh.com",
192 "ecdsa-sha2-nistp384"
195 #if (SSH_ECDSA_SIGN_SUPPORT == ENABLED && SSH_NISTP384_SUPPORT == ENABLED && \
196 SSH_SHA384_SUPPORT == ENABLED)
198 "ecdsa-sha2-nistp384",
199 "ecdsa-sha2-nistp384",
200 "ecdsa-sha2-nistp384"
203 #if (SSH_ECDSA_SIGN_SUPPORT == ENABLED && SSH_NISTP521_SUPPORT == ENABLED && \
204 SSH_SHA512_SUPPORT == ENABLED && SSH_CERT_SUPPORT == ENABLED)
206 "ecdsa-sha2-nistp521-cert-v01@openssh.com",
207 "ecdsa-sha2-nistp521-cert-v01@openssh.com",
208 "ecdsa-sha2-nistp521"
211 #if (SSH_ECDSA_SIGN_SUPPORT == ENABLED && SSH_NISTP521_SUPPORT == ENABLED && \
212 SSH_SHA512_SUPPORT == ENABLED)
214 "ecdsa-sha2-nistp521",
215 "ecdsa-sha2-nistp521",
216 "ecdsa-sha2-nistp521"
219 #if (SSH_RSA_SIGN_SUPPORT == ENABLED && SSH_SHA256_SUPPORT == ENABLED && \
220 SSH_CERT_SUPPORT == ENABLED)
222 "rsa-sha2-256-cert-v01@openssh.com",
223 "ssh-rsa-cert-v01@openssh.com",
227 #if (SSH_RSA_SIGN_SUPPORT == ENABLED && SSH_SHA256_SUPPORT == ENABLED)
234 #if (SSH_RSA_SIGN_SUPPORT == ENABLED && SSH_SHA512_SUPPORT == ENABLED && \
235 SSH_CERT_SUPPORT == ENABLED)
237 "rsa-sha2-512-cert-v01@openssh.com",
238 "ssh-rsa-cert-v01@openssh.com",
242 #if (SSH_RSA_SIGN_SUPPORT == ENABLED && SSH_SHA512_SUPPORT == ENABLED)
249 #if (SSH_RSA_SIGN_SUPPORT == ENABLED && SSH_SHA1_SUPPORT == ENABLED && \
250 SSH_CERT_SUPPORT == ENABLED)
252 "ssh-rsa-cert-v01@openssh.com",
253 "ssh-rsa-cert-v01@openssh.com",
257 #if (SSH_RSA_SIGN_SUPPORT == ENABLED && SSH_SHA1_SUPPORT == ENABLED)
264 #if (SSH_DSA_SIGN_SUPPORT == ENABLED && SSH_SHA1_SUPPORT == ENABLED && \
265 SSH_CERT_SUPPORT == ENABLED)
267 "ssh-dss-cert-v01@openssh.com",
268 "ssh-dss-cert-v01@openssh.com",
272 #if (SSH_DSA_SIGN_SUPPORT == ENABLED && SSH_SHA1_SUPPORT == ENABLED)
286 static const char_t *
const sshSupportedEncAlgos[] =
288 #if (SSH_CHACHA20_POLY1305_SUPPORT == ENABLED)
289 "chacha20-poly1305@openssh.com",
291 #if (SSH_AES_128_SUPPORT == ENABLED && SSH_GCM_CIPHER_SUPPORT == ENABLED)
292 "aes128-gcm@openssh.com",
294 #if (SSH_AES_256_SUPPORT == ENABLED && SSH_GCM_CIPHER_SUPPORT == ENABLED)
295 "aes256-gcm@openssh.com",
297 #if (SSH_AES_128_SUPPORT == ENABLED && SSH_RFC5647_SUPPORT == ENABLED)
300 #if (SSH_AES_256_SUPPORT == ENABLED && SSH_RFC5647_SUPPORT == ENABLED)
303 #if (SSH_CAMELLIA_128_SUPPORT == ENABLED && SSH_RFC5647_SUPPORT == ENABLED)
304 "AEAD_CAMELLIA_128_GCM",
306 #if (SSH_CAMELLIA_256_SUPPORT == ENABLED && SSH_RFC5647_SUPPORT == ENABLED)
307 "AEAD_CAMELLIA_256_GCM",
309 #if (SSH_AES_128_SUPPORT == ENABLED && SSH_CTR_CIPHER_SUPPORT == ENABLED)
312 #if (SSH_AES_192_SUPPORT == ENABLED && SSH_CTR_CIPHER_SUPPORT == ENABLED)
315 #if (SSH_AES_256_SUPPORT == ENABLED && SSH_CTR_CIPHER_SUPPORT == ENABLED)
318 #if (SSH_TWOFISH_128_SUPPORT == ENABLED && SSH_CTR_CIPHER_SUPPORT == ENABLED)
321 #if (SSH_TWOFISH_192_SUPPORT == ENABLED && SSH_CTR_CIPHER_SUPPORT == ENABLED)
324 #if (SSH_TWOFISH_256_SUPPORT == ENABLED && SSH_CTR_CIPHER_SUPPORT == ENABLED)
327 #if (SSH_SERPENT_128_SUPPORT == ENABLED && SSH_CTR_CIPHER_SUPPORT == ENABLED)
330 #if (SSH_SERPENT_192_SUPPORT == ENABLED && SSH_CTR_CIPHER_SUPPORT == ENABLED)
333 #if (SSH_SERPENT_256_SUPPORT == ENABLED && SSH_CTR_CIPHER_SUPPORT == ENABLED)
336 #if (SSH_CAMELLIA_128_SUPPORT == ENABLED && SSH_CTR_CIPHER_SUPPORT == ENABLED)
339 #if (SSH_CAMELLIA_192_SUPPORT == ENABLED && SSH_CTR_CIPHER_SUPPORT == ENABLED)
342 #if (SSH_CAMELLIA_256_SUPPORT == ENABLED && SSH_CTR_CIPHER_SUPPORT == ENABLED)
345 #if (SSH_AES_128_SUPPORT == ENABLED && SSH_CBC_CIPHER_SUPPORT == ENABLED)
348 #if (SSH_AES_192_SUPPORT == ENABLED && SSH_CBC_CIPHER_SUPPORT == ENABLED)
351 #if (SSH_AES_256_SUPPORT == ENABLED && SSH_CBC_CIPHER_SUPPORT == ENABLED)
354 #if (SSH_TWOFISH_128_SUPPORT == ENABLED && SSH_CBC_CIPHER_SUPPORT == ENABLED)
357 #if (SSH_TWOFISH_192_SUPPORT == ENABLED && SSH_CBC_CIPHER_SUPPORT == ENABLED)
360 #if (SSH_TWOFISH_256_SUPPORT == ENABLED && SSH_CBC_CIPHER_SUPPORT == ENABLED)
364 #if (SSH_SERPENT_128_SUPPORT == ENABLED && SSH_CBC_CIPHER_SUPPORT == ENABLED)
367 #if (SSH_SERPENT_192_SUPPORT == ENABLED && SSH_CBC_CIPHER_SUPPORT == ENABLED)
370 #if (SSH_SERPENT_256_SUPPORT == ENABLED && SSH_CBC_CIPHER_SUPPORT == ENABLED)
373 #if (SSH_CAMELLIA_128_SUPPORT == ENABLED && SSH_CBC_CIPHER_SUPPORT == ENABLED)
376 #if (SSH_CAMELLIA_192_SUPPORT == ENABLED && SSH_CBC_CIPHER_SUPPORT == ENABLED)
379 #if (SSH_CAMELLIA_256_SUPPORT == ENABLED && SSH_CBC_CIPHER_SUPPORT == ENABLED)
382 #if (SSH_SEED_SUPPORT == ENABLED && SSH_CBC_CIPHER_SUPPORT == ENABLED)
385 #if (SSH_3DES_SUPPORT == ENABLED && SSH_CTR_CIPHER_SUPPORT == ENABLED)
388 #if (SSH_3DES_SUPPORT == ENABLED && SSH_CBC_CIPHER_SUPPORT == ENABLED)
391 #if (SSH_BLOWFISH_SUPPORT == ENABLED && SSH_CTR_CIPHER_SUPPORT == ENABLED)
394 #if (SSH_BLOWFISH_SUPPORT == ENABLED && SSH_CBC_CIPHER_SUPPORT == ENABLED)
397 #if (SSH_IDEA_SUPPORT == ENABLED && SSH_CTR_CIPHER_SUPPORT == ENABLED)
400 #if (SSH_IDEA_SUPPORT == ENABLED && SSH_CBC_CIPHER_SUPPORT == ENABLED)
403 #if (SSH_CAST128_SUPPORT == ENABLED && SSH_CTR_CIPHER_SUPPORT == ENABLED)
406 #if (SSH_CAST128_SUPPORT == ENABLED && SSH_CBC_CIPHER_SUPPORT == ENABLED)
409 #if (SSH_RC4_256_SUPPORT == ENABLED && SSH_STREAM_CIPHER_SUPPORT == ENABLED)
412 #if (SSH_RC4_128_SUPPORT == ENABLED && SSH_STREAM_CIPHER_SUPPORT == ENABLED)
415 #if (SSH_RC4_SUPPORT == ENABLED && SSH_STREAM_CIPHER_SUPPORT == ENABLED)
425 static const char_t *
const sshSupportedMacAlgos[] =
427 #if (SSH_HMAC_SUPPORT == ENABLED && SSH_SHA256_SUPPORT == ENABLED && \
428 SSH_ETM_SUPPORT == ENABLED)
429 "hmac-sha2-256-etm@openssh.com",
431 #if (SSH_HMAC_SUPPORT == ENABLED && SSH_SHA256_SUPPORT == ENABLED)
434 #if (SSH_HMAC_SUPPORT == ENABLED && SSH_SHA512_SUPPORT == ENABLED && \
435 SSH_ETM_SUPPORT == ENABLED)
436 "hmac-sha2-512-etm@openssh.com",
438 #if (SSH_HMAC_SUPPORT == ENABLED && SSH_SHA512_SUPPORT == ENABLED)
441 #if (SSH_HMAC_SUPPORT == ENABLED && SSH_SHA1_SUPPORT == ENABLED && \
442 SSH_ETM_SUPPORT == ENABLED)
443 "hmac-sha1-etm@openssh.com",
445 #if (SSH_HMAC_SUPPORT == ENABLED && SSH_SHA1_SUPPORT == ENABLED)
448 #if (SSH_HMAC_SUPPORT == ENABLED && SSH_RIPEMD160_SUPPORT == ENABLED && \
449 SSH_ETM_SUPPORT == ENABLED)
450 "hmac-ripemd160-etm@openssh.com",
452 #if (SSH_HMAC_SUPPORT == ENABLED && SSH_RIPEMD160_SUPPORT == ENABLED)
454 "hmac-ripemd160@openssh.com",
456 #if (SSH_HMAC_SUPPORT == ENABLED && SSH_MD5_SUPPORT == ENABLED && \
457 SSH_ETM_SUPPORT == ENABLED)
458 "hmac-md5-etm@openssh.com",
460 #if (SSH_HMAC_SUPPORT == ENABLED && SSH_MD5_SUPPORT == ENABLED)
463 #if (SSH_HMAC_SUPPORT == ENABLED && SSH_SHA1_96_SUPPORT == ENABLED && \
464 SSH_ETM_SUPPORT == ENABLED)
465 "hmac-sha1-96-etm@openssh.com",
467 #if (SSH_HMAC_SUPPORT == ENABLED && SSH_SHA1_96_SUPPORT == ENABLED)
470 #if (SSH_HMAC_SUPPORT == ENABLED && SSH_MD5_96_SUPPORT == ENABLED && \
471 SSH_ETM_SUPPORT == ENABLED)
472 "hmac-md5-96-etm@openssh.com",
474 #if (SSH_HMAC_SUPPORT == ENABLED && SSH_MD5_96_SUPPORT == ENABLED)
477 #if (SSH_AES_128_SUPPORT == ENABLED && SSH_RFC5647_SUPPORT == ENABLED)
480 #if (SSH_AES_256_SUPPORT == ENABLED && SSH_RFC5647_SUPPORT == ENABLED)
483 #if (SSH_CAMELLIA_128_SUPPORT == ENABLED && SSH_RFC5647_SUPPORT == ENABLED)
484 "AEAD_CAMELLIA_128_GCM",
486 #if (SSH_CAMELLIA_256_SUPPORT == ENABLED && SSH_RFC5647_SUPPORT == ENABLED)
487 "AEAD_CAMELLIA_256_GCM",
497 static const char_t *
const sshSupportedCompressionAlgos[] =
520 n =
sizeof(uint32_t);
523 for(i = 0; i <
arraysize(sshSupportedKexAlgos); i++)
528 #if (SSH_RSA_KEX_SUPPORT == ENABLED)
536 sshSupportedKexAlgos[i]) >= 0)
543 #if (SSH_DH_GEX_KEX_SUPPORT == ENABLED)
568 if(
n !=
sizeof(uint32_t))
581 #if (SSH_EXT_INFO_SUPPORT == ENABLED)
586 if(!connection->newKeysSent)
588 const char_t *indicatorName;
591 if(
n !=
sizeof(uint32_t))
601 indicatorName =
"ext-info-c";
605 indicatorName =
"ext-info-s";
616 #if (SSH_KEX_STRICT_SUPPORT == ENABLED)
619 if(!connection->newKeysSent)
621 const char_t *indicatorName;
624 if(
n !=
sizeof(uint32_t))
634 indicatorName =
"kex-strict-c-v00@openssh.com";
638 indicatorName =
"kex-strict-s-v00@openssh.com";
677 n =
sizeof(uint32_t);
680 for(i = 0; i <
arraysize(sshSupportedHostKeyAlgos); i++)
683 entry = &sshSupportedHostKeyAlgos[i];
692 if(
n !=
sizeof(uint32_t))
746 arraysize(sshSupportedMacAlgos) - 1,
p, written);
764 arraysize(sshSupportedCompressionAlgos),
p, written);
785 n =
sizeof(uint32_t);
788 for(i = 0; i <
arraysize(sshSupportedHostKeyAlgos); i++)
791 entry = &sshSupportedHostKeyAlgos[i];
794 if(
n !=
sizeof(uint32_t))
827 const char_t *
const *supportedAlgoList,
uint_t supportedAlgoListLen)
832 const char_t *selectedAlgo;
841 for(i = 0; i < supportedAlgoListLen && selectedAlgo == NULL; i++)
844 for(j = 0; selectedAlgo == NULL; j++)
854 selectedAlgo = supportedAlgoList[i];
868 for(j = 0; selectedAlgo == NULL; j++)
874 for(i = 0; i < supportedAlgoListLen && selectedAlgo == NULL; i++)
881 selectedAlgo = supportedAlgoList[i];
911 const char_t *selectedAlgo;
920 for(i = 0; i <
arraysize(sshSupportedKexAlgos) &&
921 selectedAlgo == NULL; i++)
924 for(j = 0; selectedAlgo == NULL; j++)
934 selectedAlgo = sshSupportedKexAlgos[i];
948 for(j = 0; selectedAlgo == NULL; j++)
954 for(i = 0; i <
arraysize(sshSupportedKexAlgos) &&
955 selectedAlgo == NULL; i++)
960 #if (SSH_RSA_KEX_SUPPORT == ENABLED)
967 sshSupportedKexAlgos[i]) >= 0)
969 selectedAlgo = sshSupportedKexAlgos[i];
974 #if (SSH_DH_GEX_KEX_SUPPORT == ENABLED)
984 selectedAlgo = sshSupportedKexAlgos[i];
992 selectedAlgo = sshSupportedKexAlgos[i];
1005 #if (SSH_EXT_INFO_SUPPORT == ENABLED)
1010 if(!connection->newKeysSent)
1012 const char_t *indicatorName;
1019 indicatorName =
"ext-info-s";
1023 indicatorName =
"ext-info-c";
1029 connection->extInfoReceived =
TRUE;
1033 connection->extInfoReceived =
FALSE;
1038 #if (SSH_KEX_STRICT_SUPPORT == ENABLED)
1041 if(!connection->newKeysSent)
1043 const char_t *indicatorName;
1050 indicatorName =
"kex-strict-s-v00@openssh.com";
1054 indicatorName =
"kex-strict-c-v00@openssh.com";
1060 connection->kexStrictReceived =
TRUE;
1064 connection->kexStrictReceived =
FALSE;
1070 return selectedAlgo;
1087 const char_t *selectedAlgo;
1091 selectedAlgo = NULL;
1097 for(i = 0; i <
arraysize(sshSupportedHostKeyAlgos) &&
1098 selectedAlgo == NULL; i++)
1101 entry = &sshSupportedHostKeyAlgos[i];
1104 for(j = 0; selectedAlgo == NULL; j++)
1128 for(j = 0; selectedAlgo == NULL; j++)
1134 for(i = 0; i <
arraysize(sshSupportedHostKeyAlgos) &&
1135 selectedAlgo == NULL; i++)
1138 entry = &sshSupportedHostKeyAlgos[i];
1162 return selectedAlgo;
1178 return sshSelectAlgo(context, peerAlgoList, sshSupportedEncAlgos,
1194 const char_t *selectedAlgo;
1196 #if (SSH_GCM_CIPHER_SUPPORT == ENABLED || SSH_CHACHA20_POLY1305_SUPPORT == ENABLED)
1203 selectedAlgo = sshSupportedMacAlgos[
arraysize(sshSupportedMacAlgos) - 1];
1207 #if (SSH_RFC5647_SUPPORT == ENABLED)
1216 selectedAlgo = encAlgo;
1224 selectedAlgo =
sshSelectAlgo(context, peerAlgoList, sshSupportedMacAlgos,
1229 return selectedAlgo;
1245 return sshSelectAlgo(context, peerAlgoList, sshSupportedCompressionAlgos,
1246 arraysize(sshSupportedCompressionAlgos));
1265 const char_t *selectedAlgo;
1269 selectedAlgo = NULL;
1272 for(i = 0; i <
arraysize(sshSupportedHostKeyAlgos) &&
1273 selectedAlgo == NULL; i++)
1276 entry = &sshSupportedHostKeyAlgos[i];
1282 if(peerAlgoList != NULL)
1285 for(j = 0; selectedAlgo == NULL; j++)
1313 return selectedAlgo;
1326 const char_t *keyFormatId;
1333 for(i = 0; i <
arraysize(sshSupportedHostKeyAlgos) &&
1334 keyFormatId == NULL; i++)
1337 entry = &sshSupportedHostKeyAlgos[i];
1360 const char_t *signFormatId;
1364 signFormatId = NULL;
1367 for(i = 0; i <
arraysize(sshSupportedHostKeyAlgos) &&
1368 signFormatId == NULL; i++)
1371 entry = &sshSupportedHostKeyAlgos[i];
1381 return signFormatId;
1403 correct =
sshGetName(kexAlgoList, 0, &preferredKexAlgo);
1409 correct =
sshGetName(hostKeyAlgoList, 0, &preferredHostKeyAlgo);
1419 !
sshCompareString(&preferredHostKeyAlgo, sshSupportedHostKeyAlgos[0].publicKeyAlgo))
1486 if(
sshCompareAlgo(kexAlgo,
"diffie-hellman-group-exchange-sha1") ||
1487 sshCompareAlgo(kexAlgo,
"diffie-hellman-group-exchange-sha256") ||
1488 sshCompareAlgo(kexAlgo,
"diffie-hellman-group-exchange-sha224@ssh.com") ||
1489 sshCompareAlgo(kexAlgo,
"diffie-hellman-group-exchange-sha384@ssh.com") ||
1490 sshCompareAlgo(kexAlgo,
"diffie-hellman-group-exchange-sha512@ssh.com"))
1563 sshCompareString(publicKeyAlgo,
"ecdsa-sha2-nistp256-cert-v01@openssh.com") ||
1564 sshCompareString(publicKeyAlgo,
"ecdsa-sha2-nistp384-cert-v01@openssh.com") ||
1565 sshCompareString(publicKeyAlgo,
"ecdsa-sha2-nistp521-cert-v01@openssh.com") ||
const char_t * sshSelectEncAlgo(SshContext *context, const SshNameList *peerAlgoList)
Encryption algorithm negotiation.
const char_t * publicKeyAlgo
Public key algorithm.
error_t sshFormatKexAlgoList(SshConnection *connection, uint8_t *p, size_t *written)
Format the list of key exchange algorithms.
bool_t sshGetName(const SshNameList *nameList, uint_t index, SshString *name)
Get the element at specified index.
error_t sshFormatNameList(const char_t *const nameList[], uint_t nameListLen, uint8_t *p, size_t *written)
Format a comma-separated list of names.
int_t sshSelectDhGexGroup(SshContext *context, uint32_t minDhModulusSize, uint32_t preferredDhModulusSize, uint32_t maxDhModulusSize)
Select a Diffie-Hellman group that best matches client's request.
bool_t sshIsDhKexAlgo(const char_t *kexAlgo)
Test if the specified algorithm is a Diffie-Hellman key exchange algorithm.
error_t sshFormatMacAlgoList(SshContext *context, uint8_t *p, size_t *written)
Format the list of integrity algorithms.
bool_t sshCompareString(const SshString *string, const char_t *value)
Compare a binary string against the supplied value.
const char_t * sshSelectPublicKeyAlgo(SshContext *context, const char_t *keyFormatId, const SshNameList *peerAlgoList)
Public key algorithm selection.
bool_t sshIsCertPublicKeyAlgo(const SshString *publicKeyAlgo)
Test if the specified public key algorithm is using certificates.
error_t sshFormatPublicKeyAlgoList(SshContext *context, uint8_t *p, size_t *written)
Format the list of public key algorithms.
const char_t * sshGetKeyFormatId(const SshString *publicKeyAlgo)
Get the key format identifier used by a given public key algorithm.
DH GEX (Diffie-Hellman Group Exchange) key exchange.
bool_t sshIsHybridKexAlgo(const char_t *kexAlgo)
Test if the specified algorithm is a PQ-hybrid key exchange algorithm.
bool_t sshIsDhGexKexAlgo(const char_t *kexAlgo)
Test if the specified algorithm is a DH GEX key exchange algorithm.
bool_t sshCompareAlgo(const char_t *name1, const char_t *name2)
Compare algorithm names.
String containing a comma-separated list of names.
@ SSH_OPERATION_MODE_SERVER
@ SSH_OPERATION_MODE_CLIENT
bool_t sshIsRsaKexAlgo(const char_t *kexAlgo)
Test if the specified algorithm is an RSA key exchange algorithm.
error_t sshFormatHostKeyAlgoList(SshContext *context, uint8_t *p, size_t *written)
Format the list of host key algorithms.
const char_t * sshSelectCompressionAlgo(SshContext *context, const SshNameList *peerAlgoList)
Compression algorithm negotiation.
const char_t * sshSelectKexAlgo(SshConnection *connection, const SshNameList *peerAlgoList)
Key exchange algorithm negotiation.
const char_t * keyFormatId
Key format identifier.
const char_t * sshSelectAlgo(SshContext *context, const SshNameList *peerAlgoList, const char_t *const *supportedAlgoList, uint_t supportedAlgoListLen)
Generic algorithm negotiation.
error_t sshFormatEncAlgoList(SshContext *context, uint8_t *p, size_t *written)
Format the list of encryption algorithms.
#define SSH_MAX_DH_MODULUS_SIZE
const char_t * sshSelectHostKeyAlgo(SshContext *context, const SshNameList *peerAlgoList)
Host key algorithm negotiation.
#define SSH_MIN_DH_MODULUS_SIZE
bool_t sshIsX509CertPublicKeyAlgo(const SshString *publicKeyAlgo)
Test if the specified public key algorithm is using X.509 certificates.
int_t sshSelectHostKey(SshContext *context, const char_t *hostKeyAlgo)
Select a host key that matches then specified algorithm.
int_t sshSelectTransientRsaKey(SshContext *context, const char_t *kexAlgo)
Select a transient RSA key.
bool_t sshIsEcdhKexAlgo(const char_t *kexAlgo)
Test if the specified algorithm is an ECDH key exchange algorithm.
int_t sshFindName(const SshNameList *nameList, const char_t *name)
Search a name list for a given name.
SSH algorithm negotiation.
bool_t sshIsGuessCorrect(SshContext *context, const SshNameList *kexAlgoList, const SshNameList *hostKeyAlgoList)
Check whether the other party's guess is correct.
const char_t * sshSelectMacAlgo(SshContext *context, const char_t *encAlgo, const SshNameList *peerAlgoList)
Integrity algorithm negotiation.
error_t sshFormatCompressionAlgoList(SshContext *context, uint8_t *p, size_t *written)
Format the list of compression algorithms.
const char_t * signFormatId
Signature format identifier.
#define SSH_PREFERRED_DH_MODULUS_SIZE
const char_t * sshGetSignFormatId(const SshString *publicKeyAlgo)
Get the signature format identifier used by a given public key algorithm.