mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-21 14:00:51 +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
@@ -434,7 +434,7 @@ read_private_key_from_file(void ** key_ctx,
|
||||
return (*key_ctx) ? 0 : -1;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
_libssh2_rsa_new_private_frommemory(libssh2_rsa_ctx ** rsa,
|
||||
LIBSSH2_SESSION * session,
|
||||
const char *filedata, size_t filedata_len,
|
||||
@@ -575,7 +575,7 @@ _libssh2_sha1_init(libssh2_sha1_ctx *ctx)
|
||||
|
||||
int
|
||||
_libssh2_sha1(const unsigned char *message, unsigned long len,
|
||||
unsigned char *out)
|
||||
unsigned char *out)
|
||||
{
|
||||
EVP_MD_CTX ctx;
|
||||
|
||||
@@ -588,6 +588,28 @@ _libssh2_sha1(const unsigned char *message, unsigned long len,
|
||||
return 1; /* error */
|
||||
}
|
||||
|
||||
int
|
||||
_libssh2_sha256_init(libssh2_sha256_ctx *ctx)
|
||||
{
|
||||
EVP_MD_CTX_init(ctx);
|
||||
return EVP_DigestInit(ctx, EVP_get_digestbyname("sha256"));
|
||||
}
|
||||
|
||||
int
|
||||
_libssh2_sha256(const unsigned char *message, unsigned long len,
|
||||
unsigned char *out)
|
||||
{
|
||||
EVP_MD_CTX ctx;
|
||||
|
||||
EVP_MD_CTX_init(&ctx);
|
||||
if(EVP_DigestInit(&ctx, EVP_get_digestbyname("sha256"))) {
|
||||
EVP_DigestUpdate(&ctx, message, len);
|
||||
EVP_DigestFinal(&ctx, out, NULL);
|
||||
return 0; /* success */
|
||||
}
|
||||
return 1; /* error */
|
||||
}
|
||||
|
||||
int
|
||||
_libssh2_md5_init(libssh2_md5_ctx *ctx)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user