forked from wolfSSL/wolfssl
openSSL compatibility, EVP_CipherUpdate, if(inlen == 0)return 1;
This commit is contained in:
@@ -315,12 +315,13 @@ WOLFSSL_API int wolfSSL_EVP_CipherUpdate(WOLFSSL_EVP_CIPHER_CTX *ctx,
|
|||||||
int blocks;
|
int blocks;
|
||||||
int fill;
|
int fill;
|
||||||
|
|
||||||
*outl = 0;
|
|
||||||
if ((ctx == NULL) || (inl < 0) ||
|
if ((ctx == NULL) || (inl < 0) ||
|
||||||
(outl == NULL)|| (out == NULL) || (in == NULL)) return BAD_FUNC_ARG;
|
(outl == NULL)|| (out == NULL) || (in == NULL)) return BAD_FUNC_ARG;
|
||||||
WOLFSSL_ENTER("wolfSSL_EVP_CipherUpdate");
|
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 */
|
if (ctx->bufUsed > 0) { /* concatinate them if there is anything */
|
||||||
fill = fillBuff(ctx, in, inl);
|
fill = fillBuff(ctx, in, inl);
|
||||||
inl -= fill;
|
inl -= fill;
|
||||||
|
@@ -12146,6 +12146,15 @@ int openssl_test(void)
|
|||||||
int outlen ;
|
int outlen ;
|
||||||
int total = 0;
|
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);
|
EVP_CIPHER_CTX_init(&en);
|
||||||
if (EVP_CipherInit(&en, EVP_aes_128_cbc(),
|
if (EVP_CipherInit(&en, EVP_aes_128_cbc(),
|
||||||
(unsigned char*)key, (unsigned char*)iv, 1) == 0)
|
(unsigned char*)key, (unsigned char*)iv, 1) == 0)
|
||||||
@@ -12269,6 +12278,7 @@ int openssl_test(void)
|
|||||||
if (XMEMCMP(plain, cbcPlain, 18))
|
if (XMEMCMP(plain, cbcPlain, 18))
|
||||||
return -3448;
|
return -3448;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif /* WOLFSSL_AES_128 */
|
#endif /* WOLFSSL_AES_128 */
|
||||||
#endif /* ifndef NO_AES */
|
#endif /* ifndef NO_AES */
|
||||||
|
Reference in New Issue
Block a user