提交 2e415778 编写于 作者: B Bodo Möller

Don't use assertions to check application-provided arguments;

and don't unnecessarily fail on input size 0.
上级 1cbf663a
...@@ -279,7 +279,12 @@ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, ...@@ -279,7 +279,12 @@ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
{ {
int i,j,bl; int i,j,bl;
OPENSSL_assert(inl > 0); if (inl <= 0)
{
*outl = 0;
return inl == 0;
}
if(ctx->buf_len == 0 && (inl&(ctx->block_mask)) == 0) if(ctx->buf_len == 0 && (inl&(ctx->block_mask)) == 0)
{ {
if(ctx->cipher->do_cipher(ctx,out,in,inl)) if(ctx->cipher->do_cipher(ctx,out,in,inl))
...@@ -381,10 +386,10 @@ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, ...@@ -381,10 +386,10 @@ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
int fix_len; int fix_len;
unsigned int b; unsigned int b;
if (inl == 0) if (inl <= 0)
{ {
*outl=0; *outl = 0;
return 1; return inl == 0;
} }
if (ctx->flags & EVP_CIPH_NO_PADDING) if (ctx->flags & EVP_CIPH_NO_PADDING)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册