mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-06 18:29:50 +09:00
src/pki_crypto.c: Fix errors introduced by EC rework
- The nid is unused in the new context - The variable `params` is defined locally in the function, fixing redefinition Signed-off-by: Norbert Pocs <npocs@redhat.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
committed by
Jakub Jelen
parent
bc2e99dc3f
commit
4fb5af1da5
@@ -113,11 +113,16 @@ static int pki_key_ecdsa_to_nid(EC_KEY *k)
|
||||
static int pki_key_ecdsa_to_nid(EVP_PKEY *k)
|
||||
{
|
||||
char gname[25] = { 0 };
|
||||
int nid, rc;
|
||||
int rc;
|
||||
|
||||
rc = EVP_PKEY_get_utf8_string_param(k, "group", gname, 25, NULL);
|
||||
if (rc != 1)
|
||||
rc = EVP_PKEY_get_utf8_string_param(k,
|
||||
OSSL_PKEY_PARAM_GROUP_NAME,
|
||||
gname,
|
||||
25,
|
||||
NULL);
|
||||
if (rc != 1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return pki_key_ecgroup_name_to_nid(gname);
|
||||
}
|
||||
@@ -1912,7 +1917,7 @@ ssh_string pki_publickey_to_blob(const ssh_key key)
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
const void *pubkey;
|
||||
size_t pubkey_len;
|
||||
OSSL_PARAM *params = NULL, *locate_param = NULL;
|
||||
OSSL_PARAM *locate_param = NULL;
|
||||
#else
|
||||
EC_KEY *ec = NULL;
|
||||
#endif /* OPENSSL_VERSION_NUMBER */
|
||||
@@ -1952,7 +1957,6 @@ ssh_string pki_publickey_to_blob(const ssh_key key)
|
||||
#else
|
||||
rc = EVP_PKEY_todata(key->key, EVP_PKEY_PUBLIC_KEY, ¶ms);
|
||||
if (rc < 0) {
|
||||
OSSL_PARAM_free(params);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -1963,14 +1967,12 @@ ssh_string pki_publickey_to_blob(const ssh_key key)
|
||||
" public ECDSA key objects in the PKCS #11 device."
|
||||
" Unlike RSA, ECDSA public keys cannot be derived"
|
||||
" from their private keys.");
|
||||
OSSL_PARAM_free(params);
|
||||
goto fail;
|
||||
}
|
||||
#endif /* WITH_PKCS11_URI */
|
||||
|
||||
rc = OSSL_PARAM_get_octet_string_ptr(locate_param, &pubkey, &pubkey_len);
|
||||
if (rc != 1) {
|
||||
OSSL_PARAM_free(params);
|
||||
goto fail;
|
||||
}
|
||||
/* Convert the data to low-level representation */
|
||||
@@ -1992,9 +1994,6 @@ ssh_string pki_publickey_to_blob(const ssh_key key)
|
||||
|
||||
rc = ssh_buffer_add_ssh_string(buffer, e);
|
||||
if (rc < 0) {
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
OSSL_PARAM_free(params);
|
||||
#endif /* OPENSSL_VERSION_NUMBER */
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user