aboutsummaryrefslogtreecommitdiff
path: root/include/libssh
diff options
context:
space:
mode:
authorAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2019-08-22 18:11:13 +0200
committerAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2019-09-24 16:49:35 +0200
commit2a2c1c98bf4129f4c70ec1fef6558c2e5af15e5d (patch)
tree96005f242de1ace1d2a8bc62b80dc37318e39e2f /include/libssh
parentbdcaf55b906bedb84df1cf0637137f674dd5ce64 (diff)
downloadlibssh-2a2c1c98bf4129f4c70ec1fef6558c2e5af15e5d.tar.gz
libssh-2a2c1c98bf4129f4c70ec1fef6558c2e5af15e5d.tar.xz
libssh-2a2c1c98bf4129f4c70ec1fef6558c2e5af15e5d.zip
pki_crypto: Use OpenSSL for Ed25519 signatures
Use OpenSSL to generate and verify Ed25519 signatures, if supported. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Diffstat (limited to 'include/libssh')
-rw-r--r--include/libssh/pki.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/libssh/pki.h b/include/libssh/pki.h
index 57736f83..e7a20156 100644
--- a/include/libssh/pki.h
+++ b/include/libssh/pki.h
@@ -30,7 +30,15 @@
#endif
#include "libssh/crypto.h"
+#ifdef HAVE_OPENSSL_ED25519
+/* If using OpenSSL implementation, define the signature lenght which would be
+ * defined in libssh/ed25519.h otherwise */
+#define ED25519_SIG_LEN 64
+#else
#include "libssh/ed25519.h"
+#endif
+/* This definition is used for both OpenSSL and internal implementations */
+#define ED25519_KEY_LEN 32
#define MAX_PUBKEY_SIZE 0x100000 /* 1M */
#define MAX_PRIVKEY_SIZE 0x400000 /* 4M */
@@ -61,8 +69,13 @@ struct ssh_key_struct {
void *ecdsa;
# endif /* HAVE_OPENSSL_EC_H */
#endif /* HAVE_LIBGCRYPT */
+#ifdef HAVE_OPENSSL_ED25519
+ uint8_t *ed25519_pubkey;
+ uint8_t *ed25519_privkey;
+#else
ed25519_pubkey *ed25519_pubkey;
ed25519_privkey *ed25519_privkey;
+#endif
void *cert;
enum ssh_keytypes_e cert_type;
};
@@ -79,7 +92,9 @@ struct ssh_signature_struct {
ssh_string rsa_sig;
struct mbedtls_ecdsa_sig ecdsa_sig;
#endif /* HAVE_LIBGCRYPT */
+#ifndef HAVE_OPENSSL_ED25519
ed25519_signature *ed25519_sig;
+#endif
ssh_string raw_sig;
};