mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-21 14:00:51 +03:00
OpenSSH Key and ED25519 support #39 Added _libssh2_explicit_zero() to explicitly zero sensitive data in memory #120 * ED25519 Key file support - Requires OpenSSL 1.1.1 or later * OpenSSH Key format reading support - Supports RSA/DSA/ECDSA/ED25519 types * New string buffer reading functions - These add build-in bounds checking and convenance methods. Used for OpenSSL PEM file reading. * Added new tests for OpenSSH formatted Keys
This commit is contained in:
@@ -76,6 +76,11 @@
|
||||
# define LIBSSH2_ECDSA 1
|
||||
#endif
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10101000L && \
|
||||
!defined(LIBRESSL_VERSION_NUMBER)
|
||||
# define LIBSSH2_ED25519 1
|
||||
#endif
|
||||
|
||||
#ifdef OPENSSL_NO_MD5
|
||||
# define LIBSSH2_MD5 0
|
||||
#else
|
||||
@@ -306,7 +311,29 @@ typedef enum {
|
||||
libssh2_curve_type;
|
||||
#else
|
||||
#define _libssh2_ec_key void
|
||||
#endif
|
||||
#endif /* LIBSSH2_ECDSA */
|
||||
|
||||
#if LIBSSH2_ED25519
|
||||
|
||||
typedef struct {
|
||||
EVP_PKEY *public_key;
|
||||
EVP_PKEY *private_key;
|
||||
} libssh2_curve25519_keys;
|
||||
|
||||
#define libssh2_ed25519_ctx libssh2_curve25519_keys
|
||||
#define libssh2_x25519_ctx libssh2_curve25519_keys
|
||||
|
||||
#define _libssh2_ed25519_free(ctx) do { \
|
||||
if(ctx) { \
|
||||
if(ctx->public_key) EVP_PKEY_free(ctx->public_key); \
|
||||
if(ctx->private_key) EVP_PKEY_free(ctx->private_key); \
|
||||
free(ctx); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define _libssh2_x25519_free(ctx) _libssh2_ed25519_free(ctx)
|
||||
|
||||
#endif /* ED25519 */
|
||||
|
||||
#define _libssh2_cipher_type(name) const EVP_CIPHER *(*name)(void)
|
||||
#ifdef HAVE_OPAQUE_STRUCTS
|
||||
|
||||
Reference in New Issue
Block a user