mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-02 10:53:16 +03:00
Use LIBSSH2_* instead of OPENSSL_NO_* (should ultimately be possible
to chose by ./configure?).
This commit is contained in:
@@ -552,11 +552,11 @@ LIBSSH2_HOSTKEY_METHOD **libssh2_hostkey_methods(void)
|
||||
LIBSSH2_API const char *libssh2_hostkey_hash(LIBSSH2_SESSION *session, int hash_type)
|
||||
{
|
||||
switch (hash_type) {
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
#if LIBSSH2_MD5
|
||||
case LIBSSH2_HOSTKEY_HASH_MD5:
|
||||
return (char *)session->server_hostkey_md5;
|
||||
break;
|
||||
#endif /* ! OPENSSL_NO_MD5 */
|
||||
#endif /* ! LIBSSH2_MD5 */
|
||||
case LIBSSH2_HOSTKEY_HASH_SHA1:
|
||||
return (char *)session->server_hostkey_sha1;
|
||||
break;
|
||||
|
||||
@@ -155,7 +155,7 @@ static int libssh2_kex_method_diffie_hellman_groupGP_sha1_key_exchange(LIBSSH2_S
|
||||
memcpy(session->server_hostkey, s, session->server_hostkey_len);
|
||||
s += session->server_hostkey_len;
|
||||
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
#if LIBSSH2_MD5
|
||||
{
|
||||
libssh2_md5_ctx fingerprint_ctx;
|
||||
|
||||
@@ -174,7 +174,7 @@ static int libssh2_kex_method_diffie_hellman_groupGP_sha1_key_exchange(LIBSSH2_S
|
||||
_libssh2_debug(session, LIBSSH2_DBG_KEX, "Server's MD5 Fingerprint: %s", fingerprint);
|
||||
}
|
||||
#endif /* LIBSSH2_DEBUG_KEX */
|
||||
#endif /* ! OPENSSL_NO_MD5 */
|
||||
#endif /* ! LIBSSH2_MD5 */
|
||||
|
||||
{
|
||||
libssh2_sha1_ctx fingerprint_ctx;
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
|
||||
#include <gcrypt.h>
|
||||
|
||||
#define LIBSSH2_MD5 1
|
||||
|
||||
#define MD5_DIGEST_LENGTH 16
|
||||
#define SHA_DIGEST_LENGTH 20
|
||||
|
||||
|
||||
@@ -208,9 +208,9 @@ struct _LIBSSH2_SESSION {
|
||||
*/
|
||||
unsigned char *server_hostkey;
|
||||
unsigned long server_hostkey_len;
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
#if LIBSSH2_MD5
|
||||
unsigned char server_hostkey_md5[MD5_DIGEST_LENGTH];
|
||||
#endif /* ! OPENSSL_NO_MD5 */
|
||||
#endif /* ! LIBSSH2_MD5 */
|
||||
unsigned char server_hostkey_sha1[SHA_DIGEST_LENGTH];
|
||||
|
||||
/* (remote as source of data -- packet_read ) */
|
||||
|
||||
@@ -44,6 +44,12 @@
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/pem.h>
|
||||
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
# define LIBSSH2_MD5 0
|
||||
#else
|
||||
# define LIBSSH2_MD5 1
|
||||
#endif
|
||||
|
||||
#define libssh2_random(buf, len) \
|
||||
RAND_bytes ((buf), (len))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user