Unable to use ED25519 hostkey

Hello,

I am trying to set an ED25519 hostkey like this: ret = ssh_bind_options_set(sbind, SSH_BIND_OPTIONS_HOSTKEY, privkey_path);, where privkey_path is a path to a file that contains an ED25519 private key I generated and is of this form:

-----BEGIN PRIVATE KEY-----
key data
-----END PRIVATE KEY-----

Now, when I call the function ssh_handle_key_exchange, I get the following error message: ssh_get_key_params: Out of memory. I tried to look a little bit into this and the problem might be that:

  • ssh_pki_export_privkey_to_pubkey gets called in ssh_get_key_params and then pki_key_dup is called,
  • in this function pki_ed25519_key_dup is called,
  • unlike RSA or EC there is no demote parameter, so if the original key has no public key nothing happens because of if (key->ed25519_pubkey != NULL),
  • I assume that when ssh_pki_export_pubkey_blob is later called in ssh_get_key_params it fails, because there is no public key.

Is this intended or am I doing something wrong?