Change initialization of EVP_CIPHER_CTX to use API function instead of trying to calloc().
Fix some warnings noted from build output.
This commit is contained in:
parent
497ba442be
commit
2dddae738f
@ -51,7 +51,7 @@ WINPR_RC4_CTX* winpr_RC4_New_Internal(const BYTE* key, size_t keylen, BOOL overr
|
||||
return NULL;
|
||||
|
||||
#if defined(WITH_OPENSSL)
|
||||
if (!(ctx = (WINPR_RC4_CTX*) calloc(1, sizeof(EVP_CIPHER_CTX))))
|
||||
if (!(ctx = EVP_CIPHER_CTX_new()))
|
||||
return NULL;
|
||||
|
||||
EVP_CIPHER* evp = EVP_rc4();
|
||||
@ -82,12 +82,12 @@ WINPR_RC4_CTX* winpr_RC4_New_Internal(const BYTE* key, size_t keylen, BOOL overr
|
||||
|
||||
WINPR_RC4_CTX* winpr_RC4_New_Allow_FIPS(const BYTE* key, size_t keylen)
|
||||
{
|
||||
winpr_RC4_New_Internal(key, keylen, TRUE);
|
||||
return winpr_RC4_New_Internal(key, keylen, TRUE);
|
||||
}
|
||||
|
||||
WINPR_RC4_CTX* winpr_RC4_New(const BYTE* key, size_t keylen)
|
||||
{
|
||||
winpr_RC4_New_Internal(key, keylen, FALSE);
|
||||
return winpr_RC4_New_Internal(key, keylen, FALSE);
|
||||
}
|
||||
|
||||
BOOL winpr_RC4_Update(WINPR_RC4_CTX* ctx, size_t length, const BYTE* input, BYTE* output)
|
||||
@ -110,7 +110,7 @@ void winpr_RC4_Free(WINPR_RC4_CTX* ctx)
|
||||
return;
|
||||
|
||||
#if defined(WITH_OPENSSL)
|
||||
EVP_CIPHER_CTX_cleanup((EVP_CIPHER_CTX *) ctx);
|
||||
EVP_CIPHER_CTX_free((EVP_CIPHER_CTX *) ctx);
|
||||
#elif defined(WITH_MBEDTLS) && defined(MBEDTLS_ARC4_C)
|
||||
mbedtls_arc4_free((mbedtls_arc4_context*) ctx);
|
||||
free(ctx);
|
||||
|
@ -336,7 +336,7 @@ WINPR_DIGEST_CTX* winpr_Digest_New(void)
|
||||
}
|
||||
|
||||
#if defined(WITH_OPENSSL)
|
||||
BOOL winpr_Digest_Init_Internal(WINPR_DIGEST_CTX* ctx, WINPR_MD_TYPE md, EVP_MD* evp)
|
||||
BOOL winpr_Digest_Init_Internal(WINPR_DIGEST_CTX* ctx, WINPR_MD_TYPE md, const EVP_MD* evp)
|
||||
{
|
||||
EVP_MD_CTX* mdctx = (EVP_MD_CTX*) ctx;
|
||||
|
||||
@ -378,7 +378,7 @@ BOOL winpr_Digest_Init_MD5_Allow_FIPS(WINPR_DIGEST_CTX* ctx)
|
||||
{
|
||||
#if defined(WITH_OPENSSL)
|
||||
EVP_MD_CTX* mdctx = (EVP_MD_CTX*) ctx;
|
||||
EVP_MD* evp = EVP_md5();
|
||||
const EVP_MD* evp = EVP_md5();
|
||||
EVP_MD_CTX_set_flags(mdctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
|
||||
winpr_Digest_Init_Internal(ctx, WINPR_MD_MD5, evp);
|
||||
#elif defined(WITH_MBEDTLS)
|
||||
@ -389,7 +389,7 @@ BOOL winpr_Digest_Init_MD5_Allow_FIPS(WINPR_DIGEST_CTX* ctx)
|
||||
BOOL winpr_Digest_Init(WINPR_DIGEST_CTX* ctx, WINPR_MD_TYPE md)
|
||||
{
|
||||
#if defined(WITH_OPENSSL)
|
||||
EVP_MD* evp = winpr_openssl_get_evp_md(md);
|
||||
const EVP_MD* evp = winpr_openssl_get_evp_md(md);
|
||||
winpr_Digest_Init_Internal(ctx, md, evp);
|
||||
#else
|
||||
winpr_Digest_Init_Internal(ctx, md);
|
||||
|
Loading…
Reference in New Issue
Block a user