Skip to content

Commit 432f777

Browse files
authored
Merge pull request #122 from SparkiDev/we_ossl_unit_2
AES-GCM: fix smothering of error
2 parents e3363ef + 7b514c6 commit 432f777

File tree

5 files changed

+45
-3
lines changed

5 files changed

+45
-3
lines changed
File renamed without changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/test/ocspapitest.c b/test/ocspapitest.c
2+
index 43b03e3f..d9d01ac2 100644
3+
--- a/test/ocspapitest.c
4+
+++ b/test/ocspapitest.c
5+
@@ -105,7 +105,7 @@ static int test_resp_signer(void)
6+
|| !TEST_ptr(extra_certs)
7+
|| !TEST_true(get_cert_and_key(&signer, &key))
8+
|| !TEST_true(sk_X509_push(extra_certs, signer))
9+
- || !TEST_true(OCSP_basic_sign(bs, signer, key, EVP_sha1(),
10+
+ || !TEST_true(OCSP_basic_sign(bs, signer, key, EVP_sha256(),
11+
NULL, OCSP_NOCERTS)))
12+
goto err;
13+
if (!TEST_true(OCSP_resp_get0_signer(bs, &tmp, extra_certs))
14+
@@ -117,7 +117,7 @@ static int test_resp_signer(void)
15+
bs = make_dummy_resp();
16+
tmp = NULL;
17+
if (!TEST_ptr(bs)
18+
- || !TEST_true(OCSP_basic_sign(bs, signer, key, EVP_sha1(),
19+
+ || !TEST_true(OCSP_basic_sign(bs, signer, key, EVP_sha256(),
20+
NULL, 0)))
21+
goto err;
22+
if (!TEST_true(OCSP_resp_get0_signer(bs, &tmp, NULL))

scripts/openssl-unit-tests.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,15 @@ run_patched_tests() {
323323
TEST="$TEST evptests.txt"
324324
fi
325325
# main is the common file for 1.1.1b tests
326-
if [ "$TEST" == "main" -o "$TEST" == "apps" -o "$TEST" == "openssl" ]; then
326+
if [ "$TEST" == "main" ]; then
327+
continue
328+
fi
329+
# apps and openssl are common files for openssl superapp in 1.1.1b tests
330+
if [ "$TEST" == "apps" -o "$TEST" == "openssl" ]; then
331+
continue
332+
fi
333+
# ocspapitest is a 1.1.1b tests that needs setup with a recipe
334+
if [ "$TEST" == "ocspapitest" ]; then
327335
continue
328336
fi
329337
if [[ "$TEST" == *".conf.in"* ]]; then
@@ -412,8 +420,18 @@ test_openssl_111b() {
412420
run_111recipe "test_ssl_test_ctx"
413421
run_111recipe "test_sslcorrupt"
414422
run_111recipe "test_x509_store"
423+
run_111recipe "test_pkcs7"
415424
run_111recipe "test_cms"
416425
run_111recipe "test_cmsapi"
426+
run_111recipe "test_crl"
427+
run_111recipe "test_rsa"
428+
if [ $WOLFSSL_FIPS = "0" ]; then
429+
# Uses a 512-bit RSA key to check using SHA512 and full salt length.
430+
run_111recipe "test_rsapss"
431+
fi
432+
run_111recipe "test_x509_check_cert_pkey"
433+
run_111recipe "test_ocsp"
434+
run_111recipe "test_sslapi"
417435

418436
# individual test runs (recipe is preferred)
419437
# for SSL_TEST in "01-simple.conf" "02-protocol-version.conf" \

src/we_aes_gcm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,9 @@ static int we_aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
359359
OPENSSL_free(aes->aad);
360360
aes->aad = NULL;
361361
aes->aadLen = 0;
362-
ret = (int)len;
362+
if (ret == 1) {
363+
ret = (int)len;
364+
}
363365
}
364366
else if ((ret == 1) && (len == 0)) {
365367
/* Final called and nothing to do - no data output. */

src/we_digest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ static int we_digest_cleanup(EVP_MD_CTX *ctx)
866866
digest = (we_Digest *)EVP_MD_CTX_md_data(ctx);
867867

868868
/* Free the digest unless no hash initialized. */
869-
if (digest != NULL) {
869+
if ((digest != NULL) && (digest->hashType != 0)) {
870870
rc = wc_HashFree(&digest->hash, digest->hashType);
871871
if (rc != 0) {
872872
WOLFENGINE_ERROR_FUNC(WE_LOG_DIGEST, "wc_HashFree", rc);

0 commit comments

Comments
 (0)