pineapple/externals/vcpkg/ports/librtmp/handshake.patch

36 lines
1.4 KiB
Diff
Raw Normal View History

2022-07-23 03:01:36 +02:00
diff --git a/librtmp/handshake.h b/librtmp/handshake.h
index 98bf3c877..0819152bd 100644
--- a/librtmp/handshake.h
+++ b/librtmp/handshake.h
@@ -66,9 +66,9 @@ typedef gcry_cipher_hd_t RC4_handle;
#if OPENSSL_VERSION_NUMBER < 0x0090800 || !defined(SHA256_DIGEST_LENGTH)
#error Your OpenSSL is too old, need 0.9.8 or newer with SHA256
#endif
-#define HMAC_setup(ctx, key, len) HMAC_CTX_init(&ctx); HMAC_Init_ex(&ctx, key, len, EVP_sha256(), 0)
-#define HMAC_crunch(ctx, buf, len) HMAC_Update(&ctx, buf, len)
-#define HMAC_finish(ctx, dig, dlen) HMAC_Final(&ctx, dig, &dlen); HMAC_CTX_cleanup(&ctx)
+#define HMAC_setup(ctx, key, len) ctx = HMAC_CTX_new(); HMAC_Init_ex(ctx, key, len, EVP_sha256(), 0)
+#define HMAC_crunch(ctx, buf, len) HMAC_Update(ctx, buf, len)
+#define HMAC_finish(ctx, dig, dlen) HMAC_Final(ctx, dig, &dlen); HMAC_CTX_free(ctx)
typedef RC4_KEY * RC4_handle;
#define RC4_alloc(h) *h = malloc(sizeof(RC4_KEY))
@@ -114,7 +114,7 @@ static void InitRC4Encryption
{
uint8_t digest[SHA256_DIGEST_LENGTH];
unsigned int digestLen = 0;
- HMAC_CTX ctx;
+ HMAC_CTX *ctx;
RC4_alloc(rc4keyIn);
RC4_alloc(rc4keyOut);
@@ -263,7 +263,7 @@ HMACsha256(const uint8_t *message, size_t messageLen, const uint8_t *key,
size_t keylen, uint8_t *digest)
{
unsigned int digestLen;
- HMAC_CTX ctx;
+ HMAC_CTX *ctx;
HMAC_setup(ctx, key, keylen);
HMAC_crunch(ctx, message, messageLen);