X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=test%2Fevp_test.c;h=494a46b3183d475eb914d4e3db6b82fcfe284d3e;hp=f0e8ca35c0d0091855f519ae8f5c1a2460a68ae3;hb=1f9e00a6fcd7138f399c6a968625cf0d2d61a438;hpb=7141ba31969d0b378d08104a51f8f99b9187b9d5 diff --git a/test/evp_test.c b/test/evp_test.c index f0e8ca35c0..494a46b318 100644 --- a/test/evp_test.c +++ b/test/evp_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2015-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -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,29 +1022,27 @@ 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; } } - if (cdat->aead == EVP_CIPH_CCM_MODE) - tmpflen = 0; - else { - err = "CIPHERFINAL_ERROR"; - if (!EVP_CipherFinal_ex(ctx, tmp + out_misalign + tmplen, &tmpflen)) - goto err; - } + err = "CIPHERFINAL_ERROR"; + if (!EVP_CipherFinal_ex(ctx, tmp + out_misalign + tmplen, &tmpflen)) + goto err; err = "LENGTH_MISMATCH"; if (out_len != (size_t)(tmplen + tmpflen)) goto err; @@ -1197,6 +1194,13 @@ static int mac_test_init(struct evp_test *t, const char *alg) #else t->skip = 1; return 1; +#endif + } else if (strcmp(alg, "SipHash") == 0) { +#ifndef OPENSSL_NO_SIPHASH + type = EVP_PKEY_SIPHASH; +#else + t->skip = 1; + return 1; #endif } else return 0; @@ -1251,7 +1255,7 @@ static int mac_test_run(struct evp_test *t) size_t mac_len; #ifdef OPENSSL_NO_DES - if (strstr(mdata->alg, "DES") != NULL) { + if (mdata->alg != NULL && strstr(mdata->alg, "DES") != NULL) { /* Skip DES */ err = NULL; goto err;