|
29 | 29 | /* All libssh supported host-key, key-exchange, encryption and mac algorithms as of version 0.10.90 */
|
30 | 30 |
|
31 | 31 | static const char *supported_hostkey_algs[] = {
|
32 |
| - "ssh-ed25519-cert-v01@openssh.com", "ecdsa-sha2-nistp521-cert-v01@openssh.com", |
33 |
| - "ecdsa-sha2-nistp384-cert-v01@openssh.com", "ecdsa-sha2-nistp256-cert-v01@openssh.com", |
34 |
| - "rsa-sha2-512-cert-v01@openssh.com", "rsa-sha2-256-cert-v01@openssh.com", |
35 |
| - "ssh-rsa-cert-v01@openssh.com", "ssh-dss-cert-v01@openssh.com", |
| 32 | + "openssh-ssh-ed25519-cert-v01", "openssh-ecdsa-sha2-nistp521-cert-v01", |
| 33 | + "openssh-ecdsa-sha2-nistp384-cert-v01", "openssh-ecdsa-sha2-nistp256-cert-v01", |
| 34 | + "openssh-rsa-sha2-512-cert-v01", "openssh-rsa-sha2-256-cert-v01", |
| 35 | + "openssh-ssh-rsa-cert-v01", "openssh-ssh-dss-cert-v01", |
36 | 36 | "ssh-ed25519", "ecdsa-sha2-nistp521", "ecdsa-sha2-nistp384", "ecdsa-sha2-nistp256",
|
37 | 37 | "rsa-sha2-512", "rsa-sha2-256", "ssh-rsa", "ssh-dss", NULL
|
38 | 38 | };
|
39 | 39 |
|
40 | 40 | static const char *supported_kex_algs[] = {
|
41 |
| - "diffie-hellman-group-exchange-sha1", "curve25519-sha256", "curve25519-sha256@libssh.org", |
| 41 | + "diffie-hellman-group-exchange-sha1", "curve25519-sha256", "libssh-curve25519-sha256", |
42 | 42 | "ecdh-sha2-nistp256", "ecdh-sha2-nistp384", "ecdh-sha2-nistp521", "diffie-hellman-group18-sha512",
|
43 | 43 | "diffie-hellman-group16-sha512", "diffie-hellman-group-exchange-sha256", "diffie-hellman-group14-sha256", NULL
|
44 | 44 | };
|
45 | 45 |
|
46 | 46 | static const char *supported_encryption_algs[] = {
|
47 |
| - "chacha20-poly1305@openssh.com", "aes256-gcm@openssh.com", "aes128-gcm@openssh.com", |
| 47 | + "openssh-chacha20-poly1305", "openssh-aes256-gcm", "openssh-aes128-gcm", |
48 | 48 | "aes256-ctr", "aes192-ctr", "aes128-ctr", "aes256-cbc", "aes192-cbc", "aes128-cbc",
|
49 | 49 | "blowfish-cbc", "triple-des-cbc", "none", NULL
|
50 | 50 | };
|
51 | 51 |
|
52 | 52 | static const char *supported_mac_algs[] = {
|
53 |
| - "hmac-sha2-256-etm@openssh.com", "hmac-sha2-512-etm@openssh.com", "hmac-sha1-etm@openssh.com", |
| 53 | + "openssh-hmac-sha2-256-etm", "openssh-hmac-sha2-512-etm", "openssh-hmac-sha1-etm", |
54 | 54 | "hmac-sha2-256", "hmac-sha2-512", "hmac-sha1", NULL
|
55 | 55 | };
|
56 | 56 |
|
@@ -1609,11 +1609,38 @@ nc_server_config_none(const struct lyd_node *node, NC_OPERATION op)
|
1609 | 1609 | }
|
1610 | 1610 |
|
1611 | 1611 | static int
|
1612 |
| -nc_server_config_transport_params(const char *alg, char **alg_store, NC_OPERATION op) |
| 1612 | +nc_server_config_transport_params(const char *algorithm, char **alg_store, NC_OPERATION op) |
1613 | 1613 | {
|
1614 | 1614 | int ret = 0, alg_found = 0;
|
1615 |
| - char *substr, *haystack; |
1616 |
| - size_t alg_len = strlen(alg); |
| 1615 | + char *substr, *haystack, *alg = NULL; |
| 1616 | + size_t alg_len; |
| 1617 | + |
| 1618 | + if (!strncmp(algorithm, "openssh-", 8)) { |
| 1619 | + /* if the name starts with openssh, convert it to it's original libssh accepted form */ |
| 1620 | + asprintf( &alg, "%[email protected]", algorithm + 8); |
| 1621 | + if (!alg) { |
| 1622 | + ERRMEM; |
| 1623 | + ret = 1; |
| 1624 | + goto cleanup; |
| 1625 | + } |
| 1626 | + } else if (!strncmp(algorithm, "libssh-", 7)) { |
| 1627 | + /* if the name starts with libssh, convert it to it's original libssh accepted form */ |
| 1628 | + asprintf( &alg, "%[email protected]", algorithm + 7); |
| 1629 | + if (!alg) { |
| 1630 | + ERRMEM; |
| 1631 | + ret = 1; |
| 1632 | + goto cleanup; |
| 1633 | + } |
| 1634 | + } else { |
| 1635 | + alg = strdup(algorithm); |
| 1636 | + if (!alg) { |
| 1637 | + ERRMEM; |
| 1638 | + ret = 1; |
| 1639 | + goto cleanup; |
| 1640 | + } |
| 1641 | + } |
| 1642 | + |
| 1643 | + alg_len = strlen(alg); |
1617 | 1644 |
|
1618 | 1645 | if ((op == NC_OP_CREATE) || (op == NC_OP_REPLACE)) {
|
1619 | 1646 | if (!*alg_store) {
|
@@ -1660,6 +1687,7 @@ nc_server_config_transport_params(const char *alg, char **alg_store, NC_OPERATIO
|
1660 | 1687 | }
|
1661 | 1688 |
|
1662 | 1689 | cleanup:
|
| 1690 | + free(alg); |
1663 | 1691 | return ret;
|
1664 | 1692 | }
|
1665 | 1693 |
|
|
0 commit comments