mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-02 01:17:52 +03:00
Get rid of CRYPTO
This commit is contained in:
@@ -272,7 +272,7 @@ struct ssh_options_struct {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct ssh_crypto_struct {
|
struct ssh_crypto_struct {
|
||||||
bignum e,f,x,k,y;
|
bignum e,f,x,k,y;
|
||||||
unsigned char session_id[SHA_DIGEST_LEN];
|
unsigned char session_id[SHA_DIGEST_LEN];
|
||||||
|
|
||||||
@@ -292,7 +292,7 @@ typedef struct ssh_crypto_struct {
|
|||||||
int do_compress_in; /* don't set them, set the option instead */
|
int do_compress_in; /* don't set them, set the option instead */
|
||||||
void *compress_out_ctx; /* don't touch it */
|
void *compress_out_ctx; /* don't touch it */
|
||||||
void *compress_in_ctx; /* really, don't */
|
void *compress_in_ctx; /* really, don't */
|
||||||
} CRYPTO;
|
};
|
||||||
|
|
||||||
struct ssh_keys_struct {
|
struct ssh_keys_struct {
|
||||||
const char *privatekey;
|
const char *privatekey;
|
||||||
@@ -486,8 +486,8 @@ int decompress_buffer(ssh_session session,ssh_buffer buf, size_t maxlen);
|
|||||||
/* wrapper.c */
|
/* wrapper.c */
|
||||||
int crypt_set_algorithms(ssh_session );
|
int crypt_set_algorithms(ssh_session );
|
||||||
int crypt_set_algorithms_server(ssh_session session);
|
int crypt_set_algorithms_server(ssh_session session);
|
||||||
CRYPTO *crypto_new(void);
|
struct ssh_crypto_struct *crypto_new(void);
|
||||||
void crypto_free(CRYPTO *crypto);
|
void crypto_free(struct ssh_crypto_struct *crypto);
|
||||||
|
|
||||||
/* crc32.c */
|
/* crc32.c */
|
||||||
uint32_t ssh_crc32(const char *buf, uint32_t len);
|
uint32_t ssh_crc32(const char *buf, uint32_t len);
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ struct ssh_session_struct {
|
|||||||
KEX client_kex;
|
KEX client_kex;
|
||||||
ssh_buffer in_hashbuf;
|
ssh_buffer in_hashbuf;
|
||||||
ssh_buffer out_hashbuf;
|
ssh_buffer out_hashbuf;
|
||||||
CRYPTO *current_crypto;
|
struct ssh_crypto_struct *current_crypto;
|
||||||
CRYPTO *next_crypto; /* next_crypto is going to be used after a SSH2_MSG_NEWKEYS */
|
struct ssh_crypto_struct *next_crypto; /* next_crypto is going to be used after a SSH2_MSG_NEWKEYS */
|
||||||
|
|
||||||
ssh_channel channels; /* linked list of channels */
|
ssh_channel channels; /* linked list of channels */
|
||||||
int maxchannel;
|
int maxchannel;
|
||||||
|
|||||||
@@ -1168,7 +1168,7 @@ ssh_buffer ssh_userauth_build_digest(ssh_session session, ssh_message msg, char
|
|||||||
string public key algorithm name
|
string public key algorithm name
|
||||||
string public key to be used for authentication
|
string public key to be used for authentication
|
||||||
*/
|
*/
|
||||||
CRYPTO *crypto = session->current_crypto ? session->current_crypto :
|
struct ssh_crypto_struct *crypto = session->current_crypto ? session->current_crypto :
|
||||||
session->next_crypto;
|
session->next_crypto;
|
||||||
ssh_buffer buffer = NULL;
|
ssh_buffer buffer = NULL;
|
||||||
ssh_string session_id = NULL;
|
ssh_string session_id = NULL;
|
||||||
@@ -1220,7 +1220,7 @@ error:
|
|||||||
* the content of sigbuf */
|
* the content of sigbuf */
|
||||||
ssh_string ssh_do_sign(ssh_session session, ssh_buffer sigbuf,
|
ssh_string ssh_do_sign(ssh_session session, ssh_buffer sigbuf,
|
||||||
ssh_private_key privatekey) {
|
ssh_private_key privatekey) {
|
||||||
CRYPTO *crypto = session->current_crypto ? session->current_crypto :
|
struct ssh_crypto_struct *crypto = session->current_crypto ? session->current_crypto :
|
||||||
session->next_crypto;
|
session->next_crypto;
|
||||||
unsigned char hash[SHA_DIGEST_LEN + 1] = {0};
|
unsigned char hash[SHA_DIGEST_LEN + 1] = {0};
|
||||||
ssh_string session_str = NULL;
|
ssh_string session_str = NULL;
|
||||||
@@ -1384,7 +1384,7 @@ ssh_string ssh_encrypt_rsa1(ssh_session session, ssh_string data, ssh_public_key
|
|||||||
|
|
||||||
/* this function signs the session id */
|
/* this function signs the session id */
|
||||||
ssh_string ssh_sign_session_id(ssh_session session, ssh_private_key privatekey) {
|
ssh_string ssh_sign_session_id(ssh_session session, ssh_private_key privatekey) {
|
||||||
CRYPTO *crypto=session->current_crypto ? session->current_crypto :
|
struct ssh_crypto_struct *crypto=session->current_crypto ? session->current_crypto :
|
||||||
session->next_crypto;
|
session->next_crypto;
|
||||||
unsigned char hash[SHA_DIGEST_LEN + 1] = {0};
|
unsigned char hash[SHA_DIGEST_LEN + 1] = {0};
|
||||||
ssh_string signature = NULL;
|
ssh_string signature = NULL;
|
||||||
|
|||||||
@@ -769,20 +769,18 @@ static void cipher_free(struct crypto_struct *cipher) {
|
|||||||
SAFE_FREE(cipher);
|
SAFE_FREE(cipher);
|
||||||
}
|
}
|
||||||
|
|
||||||
CRYPTO *crypto_new(void) {
|
struct ssh_crypto_struct *crypto_new(void) {
|
||||||
CRYPTO *crypto;
|
struct ssh_crypto_struct *crypto;
|
||||||
|
|
||||||
crypto = malloc(sizeof(CRYPTO));
|
crypto = malloc(sizeof(struct ssh_crypto_struct));
|
||||||
if (crypto == NULL) {
|
if (crypto == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
ZERO_STRUCTP(crypto);
|
||||||
memset(crypto, 0, sizeof(CRYPTO));
|
|
||||||
|
|
||||||
return crypto;
|
return crypto;
|
||||||
}
|
}
|
||||||
|
|
||||||
void crypto_free(CRYPTO *crypto){
|
void crypto_free(struct ssh_crypto_struct *crypto){
|
||||||
if (crypto == NULL) {
|
if (crypto == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user