aboutsummaryrefslogtreecommitdiff
path: root/libssh
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2010-05-01 20:32:27 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2010-05-01 20:32:27 +0200
commit430e570629d663efdf550ea4f9669a1fc0bb40f9 (patch)
treeaae89ca427480fbd900eea77ff4fdf88c849da1a /libssh
parent65dc4f1186a20718046471d1d5339afff3ec7933 (diff)
downloadlibssh-430e570629d663efdf550ea4f9669a1fc0bb40f9.tar.gz
libssh-430e570629d663efdf550ea4f9669a1fc0bb40f9.tar.xz
libssh-430e570629d663efdf550ea4f9669a1fc0bb40f9.zip
Added pki.[ch] files as a new standard API for PKs
Right now it's just a wrapper to the existing calls but soon it's gona be the effective implementation and other calls will be wrappers.
Diffstat (limited to 'libssh')
-rw-r--r--libssh/CMakeLists.txt1
-rw-r--r--libssh/kex.c5
-rw-r--r--libssh/keyfiles.c14
3 files changed, 12 insertions, 8 deletions
diff --git a/libssh/CMakeLists.txt b/libssh/CMakeLists.txt
index 10dd845..7046180 100644
--- a/libssh/CMakeLists.txt
+++ b/libssh/CMakeLists.txt
@@ -99,6 +99,7 @@ set(libssh_SRCS
options.c
packet.c
pcap.c
+ pki.c
poll.c
session.c
scp.c
diff --git a/libssh/kex.c b/libssh/kex.c
index ca67894..17c2746 100644
--- a/libssh/kex.c
+++ b/libssh/kex.c
@@ -333,7 +333,10 @@ void ssh_list_kex(ssh_session session, KEX *kex) {
#ifdef DEBUG_CRYPTO
ssh_print_hexa("session cookie", kex->cookie, 16);
#endif
-
+ if(kex->methods==NULL){
+ ssh_log(session, SSH_LOG_RARE,"kex->methods is NULL");
+ return;
+ }
for(i = 0; i < 10; i++) {
ssh_log(session, SSH_LOG_FUNCTIONS, "%s: %s",
ssh_kex_nums[i], kex->methods[i]);
diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c
index 6a687c5..e9ea3aa 100644
--- a/libssh/keyfiles.c
+++ b/libssh/keyfiles.c
@@ -641,8 +641,8 @@ static int privatekey_type_from_file(FILE *fp) {
*
* @param[in] filename The filename of the the private key.
*
- * @param[in] type The type of the private key. This could be TYPE_DSS or
- * TYPE_RSA. Pass 0 to automatically detect the type.
+ * @param[in] type The type of the private key. This could be SSH_KEYTYPE_DSS or
+ * SSH_KEYTYPE_RSA. Pass 0 to automatically detect the type.
*
* @param[in] passphrase The passphrase to decrypt the private key. Set to null
* if none is needed or it is unknown.
@@ -799,15 +799,15 @@ ssh_private_key privatekey_from_file(ssh_session session, const char *filename,
/**
* @brief returns the type of a private key
- * @param privatekey[in] the private key handle
- * @returns one of TYPE_RSA,TYPE_DSS,TYPE_RSA1
- * @returns 0 if the type is unknown
+ * @param[in] privatekey the private key handle
+ * @returns one of SSH_KEYTYPE_RSA,SSH_KEYTYPE_DSS,SSH_KEYTYPE_RSA1
+ * @returns SSH_KEYTYPE_UNKNOWN if the type is unknown
* @see privatekey_from_file
* @see ssh_userauth_offer_pubkey
*/
-int ssh_privatekey_type(ssh_private_key privatekey){
+enum ssh_keytypes_e ssh_privatekey_type(ssh_private_key privatekey){
if (privatekey==NULL)
- return 0;
+ return SSH_KEYTYPE_UNKNOWN;
return privatekey->type;
}