1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-20 02:42:09 +03:00

Must init HMAC_CTX before using it.

Must init ctx before using it or openssl will reuse the hmac which is not thread safe and causes a crash.
Added libssh2_hmac_ctx_init macro.
This commit is contained in:
Will Cosgrove
2015-03-12 16:28:26 +00:00
committed by Alexander Lamaison
parent fed47c34e4
commit 14d9ee01bc
4 changed files with 5 additions and 0 deletions

View File

@@ -121,6 +121,8 @@ int libssh2_md5_init(libssh2_md5_ctx *);
void libssh2_md5(const unsigned char *message, unsigned long len, unsigned char *out);
#define libssh2_hmac_ctx HMAC_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())
#define libssh2_hmac_md5_init(ctx, key, keylen) \