diff options
author | Bodo Möller <bodo@openssl.org> | 2008-08-14 21:37:51 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2008-08-14 21:37:51 +0000 |
commit | 2e415778f2f5a633f50a719d9f46b09e26be13ec (patch) | |
tree | 1a06640b2ecc97daff6210bb7834a19c24abc476 /crypto/evp | |
parent | 1cbf663a6c89dcf8f7706d30a8bae675e2e0199a (diff) |
Don't use assertions to check application-provided arguments;
and don't unnecessarily fail on input size 0.
Diffstat (limited to 'crypto/evp')
-rw-r--r-- | crypto/evp/evp_enc.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index a1904993bf..6e582c458d 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -279,7 +279,12 @@ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, { 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->cipher->do_cipher(ctx,out,in,inl)) @@ -381,10 +386,10 @@ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, int fix_len; unsigned int b; - if (inl == 0) + if (inl <= 0) { - *outl=0; - return 1; + *outl = 0; + return inl == 0; } if (ctx->flags & EVP_CIPH_NO_PADDING) |