summaryrefslogtreecommitdiffstats
path: root/test/evp_test.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2017-01-25 09:26:35 +0000
committerMatt Caswell <matt@openssl.org>2017-01-25 15:02:45 +0000
commitef055ec536a3c6e698dd9f45b41d57a32366b4fa (patch)
tree8bcdec2741f8932a18a6ece3618aa76f2a2bd815 /test/evp_test.c
parent7141ba31969d0b378d08104a51f8f99b9187b9d5 (diff)
Adjust in and in_len instead of donelen
Don't use the temp variable donelen in the non-aad fragmented code path. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2275)
Diffstat (limited to 'test/evp_test.c')
-rw-r--r--test/evp_test.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/test/evp_test.c b/test/evp_test.c
index f0e8ca35c0..e1a5f14328 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -1012,7 +1012,6 @@ static int cipher_test_enc(struct evp_test *t, int enc,
EVP_CIPHER_CTX_set_padding(ctx, 0);
err = "CIPHERUPDATE_ERROR";
tmplen = 0;
- donelen = 0;
if (!frag) {
/* We supply the data all in one go */
if (!EVP_CipherUpdate(ctx, tmp + out_misalign, &tmplen, in, in_len))
@@ -1023,18 +1022,20 @@ static int cipher_test_enc(struct evp_test *t, int enc,
if (!EVP_CipherUpdate(ctx, tmp + out_misalign, &chunklen, in, 1))
goto err;
tmplen += chunklen;
- donelen = 1;
+ in++;
+ in_len--;
}
- if (in_len > 2) {
+ if (in_len > 1) {
if (!EVP_CipherUpdate(ctx, tmp + out_misalign + tmplen, &chunklen,
- in + donelen, in_len - 2))
+ in, in_len - 1))
goto err;
tmplen += chunklen;
- donelen += in_len - 2;
+ in += in_len - 1;
+ in_len = 1;
}
- if (in_len > 1 ) {
+ if (in_len > 0 ) {
if (!EVP_CipherUpdate(ctx, tmp + out_misalign + tmplen, &chunklen,
- in + donelen, 1))
+ in, 1))
goto err;
tmplen += chunklen;
}