Skip to content

Commit 4c0d1f0

Browse files
committed
Harden CMAC cleanup, RSA TLS bounds, test guard
1 parent 1d0fb43 commit 4c0d1f0

4 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/wp_cmac.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ static wp_CmacCtx* wp_cmac_new(WOLFPROV_CTX* provCtx)
9090
static void wp_cmac_free(wp_CmacCtx* macCtx)
9191
{
9292
if (macCtx != NULL) {
93+
#ifndef HAVE_FIPS
94+
wc_CmacFree(&macCtx->cmac);
95+
#endif
9396
OPENSSL_cleanse(macCtx->key, macCtx->keyLen);
9497
OPENSSL_clear_free(macCtx, sizeof(*macCtx));
9598
}

src/wp_rsa_asym.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,9 @@ static int wp_rsaa_decrypt(wp_RsaAsymCtx* ctx, unsigned char* out,
463463
if (ctx->clientVersion <= 0) {
464464
ok = 0;
465465
}
466+
if (ok && (outSize < WOLFSSL_MAX_MASTER_KEY_LENGTH)) {
467+
ok = 0;
468+
}
466469
if (ok) {
467470
byte mask;
468471
byte negMask;

test/unit.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ TEST_CASE test_case[] = {
202202
#ifdef WP_HAVE_SHAKE_256
203203
TEST_DECL(test_shake_256, NULL),
204204
#endif
205+
#ifdef WP_HAVE_DIGEST
205206
TEST_DECL(test_digest_multi_update, NULL),
207+
#endif
206208
#ifdef WP_HAVE_HMAC
207209
TEST_DECL(test_hmac_create, NULL),
208210
TEST_DECL(test_hmac_multi_update, NULL),

test/unit.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,10 @@ int test_sha3_512(void *data);
114114
#ifdef WP_HAVE_SHAKE_256
115115
int test_shake_256(void *data);
116116
#endif
117+
int test_digest_multi_update(void *data);
117118

118119
#endif /* WP_HAVE_DIGEST */
119120

120-
int test_digest_multi_update(void *data);
121-
122121
#ifdef WP_HAVE_HMAC
123122
int test_hmac_create(void *data);
124123
int test_hmac_multi_update(void *data);

0 commit comments

Comments
 (0)