mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-20 02:42:09 +03:00
kex: Added diffie-hellman-group-exchange-sha256 support
... and fixed HMAC_Init depricated usage Closes #48
This commit is contained in:
committed by
Daniel Stenberg
parent
92fff06e27
commit
fc4a969a05
@@ -124,6 +124,17 @@ int _libssh2_sha1(const unsigned char *message, unsigned long len,
|
||||
unsigned char *out);
|
||||
#define libssh2_sha1(x,y,z) _libssh2_sha1(x,y,z)
|
||||
|
||||
#define libssh2_sha256_ctx EVP_MD_CTX
|
||||
|
||||
/* returns 0 in case of failure */
|
||||
int _libssh2_sha256_init(libssh2_sha256_ctx *ctx);
|
||||
#define libssh2_sha256_init(x) _libssh2_sha256_init(x)
|
||||
#define libssh2_sha256_update(ctx, data, len) EVP_DigestUpdate(&(ctx), data, len)
|
||||
#define libssh2_sha256_final(ctx, out) EVP_DigestFinal(&(ctx), out, NULL)
|
||||
int _libssh2_sha256(const unsigned char *message, unsigned long len,
|
||||
unsigned char *out);
|
||||
#define libssh2_sha256(x,y,z) _libssh2_sha256(x,y,z)
|
||||
|
||||
#define libssh2_md5_ctx EVP_MD_CTX
|
||||
|
||||
/* returns 0 in case of failure */
|
||||
@@ -136,21 +147,26 @@ int _libssh2_md5_init(libssh2_md5_ctx *);
|
||||
#define libssh2_hmac_ctx_init(ctx) \
|
||||
HMAC_CTX_init(&ctx)
|
||||
#define libssh2_hmac_sha1_init(ctx, key, keylen) \
|
||||
HMAC_Init(ctx, key, keylen, EVP_sha1())
|
||||
HMAC_Init_ex(ctx, key, keylen, EVP_sha1(), NULL)
|
||||
#define libssh2_hmac_md5_init(ctx, key, keylen) \
|
||||
HMAC_Init(ctx, key, keylen, EVP_md5())
|
||||
HMAC_Init_ex(ctx, key, keylen, EVP_md5(), NULL)
|
||||
#define libssh2_hmac_ripemd160_init(ctx, key, keylen) \
|
||||
HMAC_Init(ctx, key, keylen, EVP_ripemd160())
|
||||
HMAC_Init_ex(ctx, key, keylen, EVP_ripemd160(), NULL)
|
||||
#define libssh2_hmac_sha256_init(ctx, key, keylen) \
|
||||
HMAC_Init(ctx, key, keylen, EVP_sha256())
|
||||
HMAC_Init_ex(ctx, key, keylen, EVP_sha256(), NULL)
|
||||
#define libssh2_hmac_sha512_init(ctx, key, keylen) \
|
||||
HMAC_Init(ctx, key, keylen, EVP_sha512())
|
||||
HMAC_Init_ex(ctx, key, keylen, EVP_sha512(), NULL)
|
||||
|
||||
#define libssh2_hmac_update(ctx, data, datalen) \
|
||||
HMAC_Update(&(ctx), data, datalen)
|
||||
#define libssh2_hmac_final(ctx, data) HMAC_Final(&(ctx), data, NULL)
|
||||
#define libssh2_hmac_cleanup(ctx) HMAC_cleanup(ctx)
|
||||
|
||||
#define libssh2_crypto_init() OpenSSL_add_all_algorithms()
|
||||
#define libssh2_crypto_init() \
|
||||
OpenSSL_add_all_algorithms(); \
|
||||
ENGINE_load_builtin_engines(); \
|
||||
ENGINE_register_all_complete()
|
||||
|
||||
#define libssh2_crypto_exit()
|
||||
|
||||
#define libssh2_rsa_ctx RSA
|
||||
|
||||
Reference in New Issue
Block a user