mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-20 02:42:09 +03:00
@@ -143,7 +143,7 @@ _libssh2_ecdsa_verify(libssh2_ecdsa_ctx * ctx,
|
|||||||
const unsigned char *m, size_t m_len);
|
const unsigned char *m, size_t m_len);
|
||||||
|
|
||||||
int
|
int
|
||||||
_libssh2_ecdsa_create_key(_libssh2_ec_key **out_private_key,
|
_libssh2_ecdsa_create_key(LIBSSH2_SESSION *session, _libssh2_ec_key **out_private_key,
|
||||||
unsigned char **out_public_key_octal,
|
unsigned char **out_public_key_octal,
|
||||||
size_t *out_public_key_octal_len, libssh2_curve_type curve_type);
|
size_t *out_public_key_octal_len, libssh2_curve_type curve_type);
|
||||||
|
|
||||||
@@ -172,8 +172,8 @@ _libssh2_ecdsa_curve_type_from_name(const char *name, libssh2_curve_type *out_ty
|
|||||||
#if LIBSSH2_ED25519
|
#if LIBSSH2_ED25519
|
||||||
|
|
||||||
int
|
int
|
||||||
_libssh2_curve25519_new(libssh2_ed25519_ctx **ctx, uint8_t **out_public_key,
|
_libssh2_curve25519_new(LIBSSH2_SESSION *session, libssh2_ed25519_ctx **ctx,
|
||||||
uint8_t **out_private_key);
|
uint8_t **out_public_key, uint8_t **out_private_key);
|
||||||
|
|
||||||
int
|
int
|
||||||
_libssh2_curve25519_gen_k(_libssh2_bn **k, uint8_t private_key[LIBSSH2_ED25519_KEY_LEN],
|
_libssh2_curve25519_gen_k(_libssh2_bn **k, uint8_t private_key[LIBSSH2_ED25519_KEY_LEN],
|
||||||
|
|||||||
@@ -2421,8 +2421,8 @@ kex_method_ecdh_key_exchange
|
|||||||
goto ecdh_clean_exit;
|
goto ecdh_clean_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = _libssh2_ecdsa_create_key(&key_state->private_key, &key_state->public_key_oct,
|
rc = _libssh2_ecdsa_create_key(session, &key_state->private_key,
|
||||||
&key_state->public_key_oct_len, type);
|
&key_state->public_key_oct, &key_state->public_key_oct_len, type);
|
||||||
|
|
||||||
if(rc != 0) {
|
if(rc != 0) {
|
||||||
ret = _libssh2_error(session, rc,
|
ret = _libssh2_error(session, rc,
|
||||||
@@ -2489,7 +2489,7 @@ kex_method_ecdh_key_exchange
|
|||||||
ecdh_clean_exit:
|
ecdh_clean_exit:
|
||||||
|
|
||||||
if(key_state->public_key_oct) {
|
if(key_state->public_key_oct) {
|
||||||
free(key_state->public_key_oct);
|
LIBSSH2_FREE(session, key_state->public_key_oct);
|
||||||
key_state->public_key_oct = NULL;
|
key_state->public_key_oct = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2988,7 +2988,7 @@ kex_method_curve25519_key_exchange
|
|||||||
goto clean_exit;
|
goto clean_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = _libssh2_curve25519_new(NULL, &key_state->curve25519_public_key,
|
rc = _libssh2_curve25519_new(session, NULL, &key_state->curve25519_public_key,
|
||||||
&key_state->curve25519_private_key);
|
&key_state->curve25519_private_key);
|
||||||
|
|
||||||
if( rc != 0 )
|
if( rc != 0 )
|
||||||
|
|||||||
@@ -1455,8 +1455,8 @@ _libssh2_ecdsa_new_private_frommemory(libssh2_ecdsa_ctx ** ec_ctx,
|
|||||||
#if LIBSSH2_ED25519
|
#if LIBSSH2_ED25519
|
||||||
|
|
||||||
int
|
int
|
||||||
_libssh2_curve25519_new(libssh2_x25519_ctx **out_ctx, unsigned char **out_public_key,
|
_libssh2_curve25519_new(LIBSSH2_SESSION *session, libssh2_x25519_ctx **out_ctx,
|
||||||
unsigned char **out_private_key)
|
unsigned char **out_public_key, unsigned char **out_private_key)
|
||||||
{
|
{
|
||||||
EVP_PKEY *key = NULL;
|
EVP_PKEY *key = NULL;
|
||||||
EVP_PKEY_CTX *pctx = NULL;
|
EVP_PKEY_CTX *pctx = NULL;
|
||||||
@@ -1501,7 +1501,7 @@ _libssh2_curve25519_new(libssh2_x25519_ctx **out_ctx, unsigned char **out_public
|
|||||||
goto cleanExit;
|
goto cleanExit;
|
||||||
|
|
||||||
if(out_private_key != NULL) {
|
if(out_private_key != NULL) {
|
||||||
*out_private_key = malloc(LIBSSH2_ED25519_KEY_LEN);
|
*out_private_key = LIBSSH2_ALLOC(session, LIBSSH2_ED25519_KEY_LEN);
|
||||||
if(*out_private_key == NULL)
|
if(*out_private_key == NULL)
|
||||||
goto cleanExit;
|
goto cleanExit;
|
||||||
|
|
||||||
@@ -1509,7 +1509,7 @@ _libssh2_curve25519_new(libssh2_x25519_ctx **out_ctx, unsigned char **out_public
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(out_public_key != NULL) {
|
if(out_public_key != NULL) {
|
||||||
*out_public_key = malloc(LIBSSH2_ED25519_KEY_LEN);
|
*out_public_key = LIBSSH2_ALLOC(session, LIBSSH2_ED25519_KEY_LEN);
|
||||||
if(*out_public_key == NULL)
|
if(*out_public_key == NULL)
|
||||||
goto cleanExit;
|
goto cleanExit;
|
||||||
|
|
||||||
@@ -2477,7 +2477,7 @@ _libssh2_ecdsa_new_private(libssh2_ecdsa_ctx ** ec_ctx,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
_libssh2_ecdsa_create_key(_libssh2_ec_key **out_private_key,
|
_libssh2_ecdsa_create_key(LIBSSH2_SESSION *session, _libssh2_ec_key **out_private_key,
|
||||||
unsigned char **out_public_key_octal,
|
unsigned char **out_public_key_octal,
|
||||||
size_t *out_public_key_octal_len, libssh2_curve_type curve_type)
|
size_t *out_public_key_octal_len, libssh2_curve_type curve_type)
|
||||||
{
|
{
|
||||||
@@ -2517,7 +2517,7 @@ _libssh2_ecdsa_create_key(_libssh2_ec_key **out_private_key,
|
|||||||
*out_private_key = private_key;
|
*out_private_key = private_key;
|
||||||
|
|
||||||
if(out_public_key_octal) {
|
if(out_public_key_octal) {
|
||||||
*out_public_key_octal = malloc(octal_len);
|
*out_public_key_octal = LIBSSH2_ALLOC(session, octal_len);
|
||||||
if(*out_public_key_octal == NULL) {
|
if(*out_public_key_octal == NULL) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto clean_exit;
|
goto clean_exit;
|
||||||
|
|||||||
Reference in New Issue
Block a user