aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAris <aris@badcode.be>2014-09-03 09:44:10 +0200
committerAndreas Schneider <asn@cryptomilk.org>2014-09-07 22:07:34 +0200
commit93c7b81b4ea1046bd2f65f4a510d5966786e8d3d (patch)
tree2c0a3f5f94731bb390627757e4491f00600a428b /include
parent93e82fa0c0f930609cb6f352b3e5d7c45945bac7 (diff)
downloadlibssh-93c7b81b4ea1046bd2f65f4a510d5966786e8d3d.tar.gz
libssh-93c7b81b4ea1046bd2f65f4a510d5966786e8d3d.tar.xz
libssh-93c7b81b4ea1046bd2f65f4a510d5966786e8d3d.zip
ed25519: Generate, sign and verify keys.
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'include')
-rw-r--r--include/libssh/pki.h5
-rw-r--r--include/libssh/pki_priv.h14
2 files changed, 19 insertions, 0 deletions
diff --git a/include/libssh/pki.h b/include/libssh/pki.h
index 89a0f982..9f9ddf4a 100644
--- a/include/libssh/pki.h
+++ b/include/libssh/pki.h
@@ -21,6 +21,7 @@
#ifndef PKI_H_
#define PKI_H_
+#include "libssh/priv.h"
#ifdef HAVE_OPENSSL_EC_H
#include <openssl/ec.h>
#endif
@@ -29,6 +30,7 @@
#endif
#include "libssh/crypto.h"
+#include "libssh/ed25519.h"
#define MAX_PUBKEY_SIZE 0x100000 /* 1M */
#define MAX_PRIVKEY_SIZE 0x400000 /* 4M */
@@ -55,6 +57,8 @@ struct ssh_key_struct {
void *ecdsa;
#endif /* HAVE_OPENSSL_EC_H */
#endif
+ ed25519_pubkey *ed25519_pubkey;
+ ed25519_privkey *ed25519_privkey;
void *cert;
};
@@ -74,6 +78,7 @@ struct ssh_signature_struct {
void *ecdsa_sig;
# endif
#endif
+ ed25519_signature *ed25519_sig;
};
typedef struct ssh_signature_struct *ssh_signature;
diff --git a/include/libssh/pki_priv.h b/include/libssh/pki_priv.h
index 0cbe8b72..0aaadb60 100644
--- a/include/libssh/pki_priv.h
+++ b/include/libssh/pki_priv.h
@@ -41,6 +41,8 @@ ssh_key pki_key_dup(const ssh_key key, int demote);
int pki_key_generate_rsa(ssh_key key, int parameter);
int pki_key_generate_dss(ssh_key key, int parameter);
int pki_key_generate_ecdsa(ssh_key key, int parameter);
+int pki_key_generate_ed25519(ssh_key key);
+
int pki_key_compare(const ssh_key k1,
const ssh_key k2,
enum ssh_keycmp_e what);
@@ -91,4 +93,16 @@ ssh_signature pki_do_sign(const ssh_key privkey,
ssh_signature pki_do_sign_sessionid(const ssh_key key,
const unsigned char *hash,
size_t hlen);
+int pki_ed25519_sign(const ssh_key privkey, ssh_signature sig,
+ const unsigned char *hash, size_t hlen);
+int pki_ed25519_verify(const ssh_key pubkey, ssh_signature sig,
+ const unsigned char *hash, size_t hlen);
+int pki_ed25519_key_cmp(const ssh_key k1,
+ const ssh_key k2,
+ enum ssh_keycmp_e what);
+int pki_ed25519_key_dup(ssh_key new, const ssh_key key);
+int pki_ed25519_public_key_to_blob(ssh_buffer buffer, ssh_key key);
+ssh_string pki_ed25519_sig_to_blob(ssh_signature sig);
+int pki_ed25519_sig_from_blob(ssh_signature sig, ssh_string sig_blob);
+
#endif /* PKI_PRIV_H_ */