1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-29 01:03:57 +03:00

Changed all PUBLIC_KEY * to ssh_public_key

This commit is contained in:
Aris Adamantiadis
2009-07-24 22:02:32 +02:00
parent 91d0660cc3
commit fc5dd23afa
8 changed files with 34 additions and 34 deletions

View File

@@ -74,8 +74,8 @@ extern "C" {
#ifdef SSH_SAFE_NAMESPACE #ifdef SSH_SAFE_NAMESPACE
typedef struct ssh_string_struct STRING; typedef struct ssh_string_struct STRING;
typedef struct ssh_buffer_struct BUFFER; typedef struct ssh_buffer_struct BUFFER;
#endif
typedef struct ssh_public_key_struct PUBLIC_KEY; typedef struct ssh_public_key_struct PUBLIC_KEY;
#endif
typedef struct ssh_private_key_struct PRIVATE_KEY; typedef struct ssh_private_key_struct PRIVATE_KEY;
typedef struct ssh_channel_struct CHANNEL; typedef struct ssh_channel_struct CHANNEL;
typedef struct ssh_agent_struct AGENT; typedef struct ssh_agent_struct AGENT;
@@ -260,14 +260,14 @@ int ssh_fd_poll(SSH_SESSION *session,int *write, int *except);
int ssh_select(CHANNEL **channels, CHANNEL **outchannels, socket_t maxfd, int ssh_select(CHANNEL **channels, CHANNEL **outchannels, socket_t maxfd,
fd_set *readfds, struct timeval *timeout); fd_set *readfds, struct timeval *timeout);
void publickey_free(PUBLIC_KEY *key); void publickey_free(ssh_public_key key);
/* in keyfiles.c */ /* in keyfiles.c */
PRIVATE_KEY *privatekey_from_file(SSH_SESSION *session, const char *filename, PRIVATE_KEY *privatekey_from_file(SSH_SESSION *session, const char *filename,
int type, const char *passphrase); int type, const char *passphrase);
ssh_string publickey_to_string(PUBLIC_KEY *key); ssh_string publickey_to_string(ssh_public_key key);
PUBLIC_KEY *publickey_from_privatekey(PRIVATE_KEY *prv); ssh_public_key publickey_from_privatekey(PRIVATE_KEY *prv);
void privatekey_free(PRIVATE_KEY *prv); void privatekey_free(PRIVATE_KEY *prv);
ssh_string publickey_from_file(SSH_SESSION *session, const char *filename, ssh_string publickey_from_file(SSH_SESSION *session, const char *filename,
int *type); int *type);
@@ -377,7 +377,7 @@ int ssh_userauth_password(SSH_SESSION *session, const char *username, const char
int ssh_userauth_offer_pubkey(SSH_SESSION *session, const char *username, int type, ssh_string publickey); int ssh_userauth_offer_pubkey(SSH_SESSION *session, const char *username, int type, ssh_string publickey);
int ssh_userauth_pubkey(SSH_SESSION *session, const char *username, ssh_string publickey, PRIVATE_KEY *privatekey); int ssh_userauth_pubkey(SSH_SESSION *session, const char *username, ssh_string publickey, PRIVATE_KEY *privatekey);
int ssh_userauth_agent_pubkey(SSH_SESSION *session, const char *username, int ssh_userauth_agent_pubkey(SSH_SESSION *session, const char *username,
PUBLIC_KEY *publickey); ssh_public_key publickey);
int ssh_userauth_autopubkey(SSH_SESSION *session, const char *passphrase); int ssh_userauth_autopubkey(SSH_SESSION *session, const char *passphrase);
int ssh_userauth_kbdint(SSH_SESSION *session, const char *user, const char *submethods); int ssh_userauth_kbdint(SSH_SESSION *session, const char *user, const char *submethods);
int ssh_userauth_kbdint_getnprompts(SSH_SESSION *session); int ssh_userauth_kbdint_getnprompts(SSH_SESSION *session);

View File

@@ -665,17 +665,17 @@ PRIVATE_KEY *privatekey_make_rsa(SSH_SESSION *session, ssh_buffer buffer,
const char *type); const char *type);
PRIVATE_KEY *privatekey_from_string(SSH_SESSION *session, ssh_string privkey_s); PRIVATE_KEY *privatekey_from_string(SSH_SESSION *session, ssh_string privkey_s);
PUBLIC_KEY *publickey_make_dss(SSH_SESSION *session, ssh_buffer buffer); ssh_public_key publickey_make_dss(SSH_SESSION *session, ssh_buffer buffer);
PUBLIC_KEY *publickey_make_rsa(SSH_SESSION *session, ssh_buffer buffer, int type); ssh_public_key publickey_make_rsa(SSH_SESSION *session, ssh_buffer buffer, int type);
PUBLIC_KEY *publickey_from_string(SSH_SESSION *session, ssh_string pubkey_s); ssh_public_key publickey_from_string(SSH_SESSION *session, ssh_string pubkey_s);
SIGNATURE *signature_from_string(SSH_SESSION *session, ssh_string signature,PUBLIC_KEY *pubkey,int needed_type); SIGNATURE *signature_from_string(SSH_SESSION *session, ssh_string signature,ssh_public_key pubkey,int needed_type);
void signature_free(SIGNATURE *sign); void signature_free(SIGNATURE *sign);
ssh_string ssh_do_sign_with_agent(struct ssh_session *session, ssh_string ssh_do_sign_with_agent(struct ssh_session *session,
struct ssh_buffer_struct *buf, struct ssh_public_key_struct *publickey); struct ssh_buffer_struct *buf, struct ssh_public_key_struct *publickey);
ssh_string ssh_do_sign(SSH_SESSION *session,ssh_buffer sigbuf, ssh_string ssh_do_sign(SSH_SESSION *session,ssh_buffer sigbuf,
PRIVATE_KEY *privatekey); PRIVATE_KEY *privatekey);
ssh_string ssh_sign_session_id(SSH_SESSION *session, PRIVATE_KEY *privatekey); ssh_string ssh_sign_session_id(SSH_SESSION *session, PRIVATE_KEY *privatekey);
ssh_string ssh_encrypt_rsa1(SSH_SESSION *session, ssh_string data, PUBLIC_KEY *key); ssh_string ssh_encrypt_rsa1(SSH_SESSION *session, ssh_string data, ssh_public_key key);
/* channel.c */ /* channel.c */
void channel_handle(SSH_SESSION *session, int type); void channel_handle(SSH_SESSION *session, int type);
CHANNEL *channel_new(SSH_SESSION *session); CHANNEL *channel_new(SSH_SESSION *session);

View File

@@ -537,7 +537,7 @@ error:
* @see ssh_userauth_offer_pubkey() * @see ssh_userauth_offer_pubkey()
*/ */
int ssh_userauth_agent_pubkey(SSH_SESSION *session, const char *username, int ssh_userauth_agent_pubkey(SSH_SESSION *session, const char *username,
PUBLIC_KEY *publickey) { ssh_public_key publickey) {
ssh_string user = NULL; ssh_string user = NULL;
ssh_string service = NULL; ssh_string service = NULL;
ssh_string method = NULL; ssh_string method = NULL;

View File

@@ -875,7 +875,7 @@ static int match(const char *group, const char *object){
return 0; return 0;
} }
static int sig_verify(SSH_SESSION *session, PUBLIC_KEY *pubkey, static int sig_verify(SSH_SESSION *session, ssh_public_key pubkey,
SIGNATURE *signature, unsigned char *digest) { SIGNATURE *signature, unsigned char *digest) {
#ifdef HAVE_LIBGCRYPT #ifdef HAVE_LIBGCRYPT
gcry_error_t valid = 0; gcry_error_t valid = 0;
@@ -971,7 +971,7 @@ static int sig_verify(SSH_SESSION *session, PUBLIC_KEY *pubkey,
} }
int signature_verify(SSH_SESSION *session, ssh_string signature) { int signature_verify(SSH_SESSION *session, ssh_string signature) {
PUBLIC_KEY *pubkey = NULL; ssh_public_key pubkey = NULL;
SIGNATURE *sign = NULL; SIGNATURE *sign = NULL;
int err; int err;

View File

@@ -500,7 +500,7 @@ static int build_session_id1(SSH_SESSION *session, ssh_string servern,
} }
/* returns 1 if the modulus of k1 is < than the one of k2 */ /* returns 1 if the modulus of k1 is < than the one of k2 */
static int modulus_smaller(PUBLIC_KEY *k1, PUBLIC_KEY *k2){ static int modulus_smaller(ssh_public_key k1, ssh_public_key k2){
bignum n1; bignum n1;
bignum n2; bignum n2;
int res; int res;
@@ -529,8 +529,8 @@ static int modulus_smaller(PUBLIC_KEY *k1, PUBLIC_KEY *k2){
} }
#define ABS(A) ( (A)<0 ? -(A):(A) ) #define ABS(A) ( (A)<0 ? -(A):(A) )
static ssh_string encrypt_session_key(SSH_SESSION *session, PUBLIC_KEY *srvkey, static ssh_string encrypt_session_key(SSH_SESSION *session, ssh_public_key srvkey,
PUBLIC_KEY *hostkey, int slen, int hlen) { ssh_public_key hostkey, int slen, int hlen) {
unsigned char buffer[32] = {0}; unsigned char buffer[32] = {0};
int i; int i;
ssh_string data1 = NULL; ssh_string data1 = NULL;
@@ -614,8 +614,8 @@ int ssh_get_kex1(SSH_SESSION *session) {
ssh_string serverkey = NULL; ssh_string serverkey = NULL;
ssh_string hostkey = NULL; ssh_string hostkey = NULL;
ssh_string enc_session = NULL; ssh_string enc_session = NULL;
PUBLIC_KEY *srv = NULL; ssh_public_key srv = NULL;
PUBLIC_KEY *host = NULL; ssh_public_key host = NULL;
u32 server_bits; u32 server_bits;
u32 host_bits; u32 host_bits;
u32 protocol_flags; u32 protocol_flags;

View File

@@ -1470,7 +1470,7 @@ int ssh_write_knownhost(SSH_SESSION *session) {
if (strcmp(session->current_crypto->server_pubkey_type, "ssh-rsa1") == 0) { if (strcmp(session->current_crypto->server_pubkey_type, "ssh-rsa1") == 0) {
/* openssh uses a different format for ssh-rsa1 keys. /* openssh uses a different format for ssh-rsa1 keys.
Be compatible --kv */ Be compatible --kv */
PUBLIC_KEY *key; ssh_public_key key;
char *e_string = NULL; char *e_string = NULL;
char *n_string = NULL; char *n_string = NULL;
bignum e = NULL; bignum e = NULL;

View File

@@ -65,14 +65,14 @@ int ssh_type_from_name(const char *name) {
return -1; return -1;
} }
PUBLIC_KEY *publickey_make_dss(SSH_SESSION *session, ssh_buffer buffer) { ssh_public_key publickey_make_dss(SSH_SESSION *session, ssh_buffer buffer) {
ssh_string p = NULL; ssh_string p = NULL;
ssh_string q = NULL; ssh_string q = NULL;
ssh_string g = NULL; ssh_string g = NULL;
ssh_string pubkey = NULL; ssh_string pubkey = NULL;
PUBLIC_KEY *key = NULL; ssh_public_key key = NULL;
key = malloc(sizeof(PUBLIC_KEY)); key = malloc(sizeof(struct ssh_public_key_struct));
if (key == NULL) { if (key == NULL) {
buffer_free(buffer); buffer_free(buffer);
return NULL; return NULL;
@@ -151,13 +151,13 @@ error:
return NULL; return NULL;
} }
PUBLIC_KEY *publickey_make_rsa(SSH_SESSION *session, ssh_buffer buffer, ssh_public_key publickey_make_rsa(SSH_SESSION *session, ssh_buffer buffer,
int type) { int type) {
ssh_string e = NULL; ssh_string e = NULL;
ssh_string n = NULL; ssh_string n = NULL;
PUBLIC_KEY *key = NULL; ssh_public_key key = NULL;
key = malloc(sizeof(PUBLIC_KEY)); key = malloc(sizeof(struct ssh_public_key_struct));
if (key == NULL) { if (key == NULL) {
buffer_free(buffer); buffer_free(buffer);
return NULL; return NULL;
@@ -218,7 +218,7 @@ error:
return NULL; return NULL;
} }
void publickey_free(PUBLIC_KEY *key) { void publickey_free(ssh_public_key key) {
if (key == NULL) { if (key == NULL) {
return; return;
} }
@@ -245,7 +245,7 @@ void publickey_free(PUBLIC_KEY *key) {
SAFE_FREE(key); SAFE_FREE(key);
} }
PUBLIC_KEY *publickey_from_string(SSH_SESSION *session, ssh_string pubkey_s) { ssh_public_key publickey_from_string(SSH_SESSION *session, ssh_string pubkey_s) {
ssh_buffer tmpbuf = NULL; ssh_buffer tmpbuf = NULL;
ssh_string type_s = NULL; ssh_string type_s = NULL;
char *type_c = NULL; char *type_c = NULL;
@@ -296,8 +296,8 @@ error:
* \returns the public key * \returns the public key
* \see publickey_to_string() * \see publickey_to_string()
*/ */
PUBLIC_KEY *publickey_from_privatekey(PRIVATE_KEY *prv) { ssh_public_key publickey_from_privatekey(PRIVATE_KEY *prv) {
PUBLIC_KEY *key = NULL; ssh_public_key key = NULL;
#ifdef HAVE_LIBGCRYPT #ifdef HAVE_LIBGCRYPT
gcry_sexp_t sexp; gcry_sexp_t sexp;
const char *tmp = NULL; const char *tmp = NULL;
@@ -310,7 +310,7 @@ PUBLIC_KEY *publickey_from_privatekey(PRIVATE_KEY *prv) {
ssh_string n = NULL; ssh_string n = NULL;
#endif /* HAVE_LIBGCRYPT */ #endif /* HAVE_LIBGCRYPT */
key = malloc(sizeof(PUBLIC_KEY)); key = malloc(sizeof(struct ssh_public_key_struct));
if (key == NULL) { if (key == NULL) {
return NULL; return NULL;
} }
@@ -655,7 +655,7 @@ error:
* \returns a SSH String containing the public key * \returns a SSH String containing the public key
* \see string_free() * \see string_free()
*/ */
ssh_string publickey_to_string(PUBLIC_KEY *key) { ssh_string publickey_to_string(ssh_public_key key) {
ssh_string type = NULL; ssh_string type = NULL;
ssh_string ret = NULL; ssh_string ret = NULL;
ssh_buffer buf = NULL; ssh_buffer buf = NULL;
@@ -847,7 +847,7 @@ static ssh_string signature_to_string(SIGNATURE *sign) {
/* TODO : split this function in two so it becomes smaller */ /* TODO : split this function in two so it becomes smaller */
SIGNATURE *signature_from_string(SSH_SESSION *session, ssh_string signature, SIGNATURE *signature_from_string(SSH_SESSION *session, ssh_string signature,
PUBLIC_KEY *pubkey, int needed_type) { ssh_public_key pubkey, int needed_type) {
SIGNATURE *sign = NULL; SIGNATURE *sign = NULL;
ssh_buffer tmpbuf = NULL; ssh_buffer tmpbuf = NULL;
ssh_string rs = NULL; ssh_string rs = NULL;
@@ -1249,7 +1249,7 @@ ssh_string ssh_do_sign(SSH_SESSION *session, ssh_buffer sigbuf,
return signature; return signature;
} }
ssh_string ssh_encrypt_rsa1(SSH_SESSION *session, ssh_string data, PUBLIC_KEY *key) { ssh_string ssh_encrypt_rsa1(SSH_SESSION *session, ssh_string data, ssh_public_key key) {
ssh_string str = NULL; ssh_string str = NULL;
size_t len = string_len(data); size_t len = string_len(data);
size_t size = 0; size_t size = 0;

View File

@@ -329,7 +329,7 @@ static int dh_handshake_server(SSH_SESSION *session) {
ssh_string f; ssh_string f;
ssh_string pubkey; ssh_string pubkey;
ssh_string sign; ssh_string sign;
PUBLIC_KEY *pub; ssh_public_key pub;
PRIVATE_KEY *prv; PRIVATE_KEY *prv;
if (packet_wait(session, SSH2_MSG_KEXDH_INIT, 1) != SSH_OK) { if (packet_wait(session, SSH2_MSG_KEXDH_INIT, 1) != SSH_OK) {