forked from wolfSSL/wolfssl
wolfSSL_EVP_CipherInit_ex handle ENGINE argument and add a sanity check
This commit is contained in:
@@ -11677,6 +11677,11 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD *md)
|
|||||||
const WOLFSSL_EVP_MD* type)
|
const WOLFSSL_EVP_MD* type)
|
||||||
{
|
{
|
||||||
WOLFSSL_ENTER("EVP_DigestInit");
|
WOLFSSL_ENTER("EVP_DigestInit");
|
||||||
|
|
||||||
|
if (ctx == NULL || type == NULL) {
|
||||||
|
return BAD_FUNC_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
if (XSTRNCMP(type, "SHA256", 6) == 0) {
|
if (XSTRNCMP(type, "SHA256", 6) == 0) {
|
||||||
ctx->macType = SHA256;
|
ctx->macType = SHA256;
|
||||||
wolfSSL_SHA256_Init((SHA256_CTX*)&ctx->hash);
|
wolfSSL_SHA256_Init((SHA256_CTX*)&ctx->hash);
|
||||||
|
@@ -86,6 +86,17 @@ WOLFSSL_API int wolfSSL_EVP_EncryptFinal(WOLFSSL_EVP_CIPHER_CTX *ctx,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WOLFSSL_API int wolfSSL_EVP_CipherInit_ex(WOLFSSL_EVP_CIPHER_CTX* ctx,
|
||||||
|
const WOLFSSL_EVP_CIPHER* type,
|
||||||
|
WOLFSSL_ENGINE *impl,
|
||||||
|
unsigned char* key, unsigned char* iv,
|
||||||
|
int enc)
|
||||||
|
{
|
||||||
|
(void)impl;
|
||||||
|
return wolfSSL_EVP_CipherInit(ctx, type, key, iv, enc);
|
||||||
|
}
|
||||||
|
|
||||||
WOLFSSL_API int wolfSSL_EVP_EncryptFinal_ex(WOLFSSL_EVP_CIPHER_CTX *ctx,
|
WOLFSSL_API int wolfSSL_EVP_EncryptFinal_ex(WOLFSSL_EVP_CIPHER_CTX *ctx,
|
||||||
unsigned char *out, int *outl)
|
unsigned char *out, int *outl)
|
||||||
{
|
{
|
||||||
|
@@ -174,6 +174,7 @@ typedef struct WOLFSSL_EVP_CIPHER_CTX {
|
|||||||
} WOLFSSL_EVP_CIPHER_CTX;
|
} WOLFSSL_EVP_CIPHER_CTX;
|
||||||
|
|
||||||
typedef int WOLFSSL_ENGINE ;
|
typedef int WOLFSSL_ENGINE ;
|
||||||
|
typedef WOLFSSL_ENGINE ENGINE;
|
||||||
|
|
||||||
WOLFSSL_API void wolfSSL_EVP_init(void);
|
WOLFSSL_API void wolfSSL_EVP_init(void);
|
||||||
WOLFSSL_API int wolfSSL_EVP_MD_size(const WOLFSSL_EVP_MD* md);
|
WOLFSSL_API int wolfSSL_EVP_MD_size(const WOLFSSL_EVP_MD* md);
|
||||||
@@ -360,7 +361,7 @@ typedef WOLFSSL_EVP_CIPHER_CTX EVP_CIPHER_CTX;
|
|||||||
#define EVP_CIPHER_CTX_key_length wolfSSL_EVP_CIPHER_CTX_key_length
|
#define EVP_CIPHER_CTX_key_length wolfSSL_EVP_CIPHER_CTX_key_length
|
||||||
#define EVP_CIPHER_CTX_set_key_length wolfSSL_EVP_CIPHER_CTX_set_key_length
|
#define EVP_CIPHER_CTX_set_key_length wolfSSL_EVP_CIPHER_CTX_set_key_length
|
||||||
#define EVP_CipherInit wolfSSL_EVP_CipherInit
|
#define EVP_CipherInit wolfSSL_EVP_CipherInit
|
||||||
#define EVP_CipherInit_ex wolfSSL_EVP_CipherInit
|
#define EVP_CipherInit_ex wolfSSL_EVP_CipherInit_ex
|
||||||
#define EVP_EncryptInit wolfSSL_EVP_EncryptInit
|
#define EVP_EncryptInit wolfSSL_EVP_EncryptInit
|
||||||
#define EVP_EncryptInit_ex wolfSSL_EVP_EncryptInit_ex
|
#define EVP_EncryptInit_ex wolfSSL_EVP_EncryptInit_ex
|
||||||
#define EVP_DecryptInit wolfSSL_EVP_DecryptInit
|
#define EVP_DecryptInit wolfSSL_EVP_DecryptInit
|
||||||
|
Reference in New Issue
Block a user