openSSL compatibility, EVP_CipherUpdate, if(inlen == 0)return 1;

This commit is contained in:
Takashi Kojo 2018-04-01 12:13:18 +09:00
parent 87c1658ab8
commit 1c0b84d47d
2 changed files with 13 additions and 2 deletions

View File

@ -315,12 +315,13 @@ WOLFSSL_API int wolfSSL_EVP_CipherUpdate(WOLFSSL_EVP_CIPHER_CTX *ctx,
int blocks;
int fill;
*outl = 0;
if ((ctx == NULL) || (inl < 0) ||
(outl == NULL)|| (out == NULL) || (in == NULL)) return BAD_FUNC_ARG;
WOLFSSL_ENTER("wolfSSL_EVP_CipherUpdate");
if (inl == 0) return WOLFSSL_FAILURE;
*outl = 0;
if (inl == 0) return WOLFSSL_SUCCESS;
if (ctx->bufUsed > 0) { /* concatinate them if there is anything */
fill = fillBuff(ctx, in, inl);
inl -= fill;

View File

@ -12146,6 +12146,15 @@ int openssl_test(void)
int outlen ;
int total = 0;
EVP_CIPHER_CTX_init(&en);
if (EVP_CipherInit(&en, EVP_aes_128_cbc(),
(unsigned char*)key, (unsigned char*)iv, 1) == 0)
return -5960;
/* openSSL compatibility, if(inlen == 0)return 1; */
if (EVP_CipherUpdate(&en, (byte*)cipher, &outlen,
(byte*)cbcPlain, 0) == 0)
return -5960;
EVP_CIPHER_CTX_init(&en);
if (EVP_CipherInit(&en, EVP_aes_128_cbc(),
(unsigned char*)key, (unsigned char*)iv, 1) == 0)
@ -12269,6 +12278,7 @@ int openssl_test(void)
if (XMEMCMP(plain, cbcPlain, 18))
return -3448;
}
#endif /* WOLFSSL_AES_128 */
#endif /* ifndef NO_AES */