pki_crypto: Reformat pki_private_key_to_pem

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Sahana Prasad <sahana@redhat.com>
This commit is contained in:
Jakub Jelen
2025-01-23 11:40:54 +01:00
parent 3372c2ad78
commit 12b8eed093

View File

@@ -918,7 +918,8 @@ ssh_string pki_private_key_to_pem(const ssh_key key,
/* In OpenSSL, the input is the private key seed only, which means /* In OpenSSL, the input is the private key seed only, which means
* the first half of the SSH private key (the second half is the * the first half of the SSH private key (the second half is the
* public key) */ * public key) */
pkey = EVP_PKEY_new_raw_private_key(EVP_PKEY_ED25519, NULL, pkey = EVP_PKEY_new_raw_private_key(EVP_PKEY_ED25519,
NULL,
(const uint8_t *)key->ed25519_privkey, (const uint8_t *)key->ed25519_privkey,
ED25519_KEY_LEN); ED25519_KEY_LEN);
if (pkey == NULL) { if (pkey == NULL) {
@@ -938,7 +939,9 @@ ssh_string pki_private_key_to_pem(const ssh_key key,
case SSH_KEYTYPE_ED25519_CERT01: case SSH_KEYTYPE_ED25519_CERT01:
case SSH_KEYTYPE_UNKNOWN: case SSH_KEYTYPE_UNKNOWN:
default: default:
SSH_LOG(SSH_LOG_TRACE, "Unknown or invalid private key type %d", key->type); SSH_LOG(SSH_LOG_TRACE,
"Unknown or invalid private key type %d",
key->type);
goto err; goto err;
} }
if (rc != 1) { if (rc != 1) {