Skip to content

Commit 81c5cf7

Browse files
Merge pull request #7339 from SparkiDev/regression_fixes_10
Regression testing fixes
2 parents 8684caa + d1b16f2 commit 81c5cf7

File tree

5 files changed

+50
-35
lines changed

5 files changed

+50
-35
lines changed

tests/api.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27834,11 +27834,11 @@ static int test_wc_PKCS7_VerifySignedData_RSA(void)
2783427834
struct tm tmpTimeStorage;
2783527835
struct tm* tmpTime = &tmpTimeStorage;
2783627836
#endif
27837-
#ifndef NO_PKCS7_STREAM
27838-
word32 z;
27839-
int ret;
27840-
#endif /* !NO_PKCS7_STREAM */
2784127837
#endif /* !NO_ASN && !NO_ASN_TIME */
27838+
#ifndef NO_PKCS7_STREAM
27839+
word32 z;
27840+
int ret;
27841+
#endif /* !NO_PKCS7_STREAM */
2784227842

2784327843
XMEMSET(&hash, 0, sizeof(wc_HashAlg));
2784427844

wolfcrypt/benchmark/benchmark.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8768,12 +8768,12 @@ void bench_rsa(int useDeviceID)
87688768
#elif defined(USE_CERT_BUFFERS_2048) || defined(USE_CERT_BUFFERS_3072)
87698769
bytes = 12;
87708770
#endif
8771-
ret = mp_read_unsigned_bin(rsaKey[i].n, &tmp[bytes], rsaKeySz/8);
8771+
ret = mp_read_unsigned_bin(&rsaKey[i]->n, &tmp[bytes], rsaKeySz/8);
87728772
if (ret != 0) {
87738773
printf("wc_RsaPrivateKeyDecode failed! %d\n", ret);
87748774
goto exit;
87758775
}
8776-
ret = mp_set_int(rsaKey[i].e, WC_RSA_EXPONENT);
8776+
ret = mp_set_int(&rsaKey[i]->e, WC_RSA_EXPONENT);
87778777
if (ret != 0) {
87788778
printf("wc_RsaPrivateKeyDecode failed! %d\n", ret);
87798779
goto exit;

wolfcrypt/src/cmac.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,8 @@ int wc_AesCmacVerify(const byte* check, word32 checkSz,
460460
Cmac cmac[1];
461461
#endif
462462

463-
if (check == NULL || (in == NULL && inSz > 0) || key == NULL || keySz == 0) {
463+
if (check == NULL || checkSz == 0 || (in == NULL && inSz > 0) ||
464+
key == NULL || keySz == 0) {
464465
return BAD_FUNC_ARG;
465466
}
466467

wolfcrypt/test/test.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16134,8 +16134,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t memory_test(void)
1613416134
#ifdef WOLFSSL_CERT_GEN
1613516135
static const char* rsaCaCertFile = CERT_ROOT "ca-cert.pem";
1613616136
#endif
16137-
#if (defined(WOLFSSL_ALT_NAMES) || defined(HAVE_PKCS7)) \
16138-
&& !defined(NO_ASN_TIME)
16137+
#if defined(WOLFSSL_ALT_NAMES) || defined(HAVE_PKCS7)
1613916138
static const char* rsaCaCertDerFile = CERT_ROOT "ca-cert.der";
1614016139
#endif
1614116140
#ifdef HAVE_PKCS7

wolfssl/test.h

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2541,37 +2541,42 @@ static WC_INLINE void CRL_CallBack(const char* url)
25412541
#endif
25422542

25432543
#ifndef NO_DH
2544-
static WC_INLINE void SetDH(WOLFSSL* ssl)
2545-
{
2546-
/* dh1024 p */
2547-
static const unsigned char p[] =
2544+
#if defined(WOLFSSL_SP_MATH) && !defined(WOLFSS_SP_MATH_ALL)
2545+
/* dh2048 p */
2546+
static const unsigned char test_dh_p[] =
25482547
{
2549-
0xE6, 0x96, 0x9D, 0x3D, 0x49, 0x5B, 0xE3, 0x2C, 0x7C, 0xF1, 0x80, 0xC3,
2550-
0xBD, 0xD4, 0x79, 0x8E, 0x91, 0xB7, 0x81, 0x82, 0x51, 0xBB, 0x05, 0x5E,
2551-
0x2A, 0x20, 0x64, 0x90, 0x4A, 0x79, 0xA7, 0x70, 0xFA, 0x15, 0xA2, 0x59,
2552-
0xCB, 0xD5, 0x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0x83
25602570
};
25612571

2562-
/* dh1024 g */
2563-
static const unsigned char g[] =
2572+
/* dh2048 g */
2573+
static const unsigned char test_dh_g[] =
25642574
{
25652575
0x02,
25662576
};
2567-
2568-
wolfSSL_SetTmpDH(ssl, p, sizeof(p), g, sizeof(g));
2569-
}
2570-
2571-
static WC_INLINE void SetDHCtx(WOLFSSL_CTX* ctx)
2572-
{
2577+
#else
25732578
/* dh1024 p */
2574-
static const unsigned char p[] =
2579+
static const unsigned char test_dh_p[] =
25752580
{
25762581
0xE6, 0x96, 0x9D, 0x3D, 0x49, 0x5B, 0xE3, 0x2C, 0x7C, 0xF1, 0x80, 0xC3,
25772582
0xBD, 0xD4, 0x79, 0x8E, 0x91, 0xB7, 0x81, 0x82, 0x51, 0xBB, 0x05, 0x5E,
@@ -2587,12 +2592,22 @@ static WC_INLINE void SetDHCtx(WOLFSSL_CTX* ctx)
25872592
};
25882593

25892594
/* dh1024 g */
2590-
static const unsigned char g[] =
2595+
static const unsigned char test_dh_g[] =
25912596
{
25922597
0x02,
25932598
};
2599+
#endif
25942600

2595-
wolfSSL_CTX_SetTmpDH(ctx, p, sizeof(p), g, sizeof(g));
2601+
static WC_INLINE void SetDH(WOLFSSL* ssl)
2602+
{
2603+
wolfSSL_SetTmpDH(ssl, test_dh_p, sizeof(test_dh_p), test_dh_g,
2604+
sizeof(test_dh_g));
2605+
}
2606+
2607+
static WC_INLINE void SetDHCtx(WOLFSSL_CTX* ctx)
2608+
{
2609+
wolfSSL_CTX_SetTmpDH(ctx, test_dh_p, sizeof(test_dh_p), test_dh_g,
2610+
sizeof(test_dh_g));
25962611
}
25972612
#endif /* NO_DH */
25982613

0 commit comments

Comments
 (0)