Skip to content

Commit 6320177

Browse files
committed
change to WOLFPROV_MSG_DEBUG
1 parent 31b717a commit 6320177

33 files changed

+272
-219
lines changed

include/wolfprovider/wp_logging.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
* Define these macros in this header to control logging at compile time:
8484
* NOTE: wolfProvider needs to be built with --debug to enable the logging first
8585
* before we can set the log level and components.
86-
*
86+
*
8787
* WOLFPROV_LOG_LEVEL_FILTER Sets the log level. Use WP_LOG_* constants from enum below.
8888
* Examples:
8989
* - WP_LOG_ERROR (only errors)
@@ -114,6 +114,8 @@ enum wolfProv_LogType {
114114
WP_LOG_LEAVE = 0x0004, /* logs function leave */
115115
WP_LOG_INFO = 0x0008, /* logs informative messages */
116116
WP_LOG_VERBOSE = 0x0010, /* logs encrypted/decrypted/digested data */
117+
/* To see the return code from wolfssl, you must add WP_LOG_DEBUG to the
118+
* WOLFPROV_LOG_LEVEL_FILTER */
117119
WP_LOG_DEBUG = 0x0020, /* logs debug-level detailed information */
118120
WP_LOG_TRACE = 0x0040, /* logs trace-level ultra-detailed information */
119121

@@ -140,7 +142,7 @@ enum wolfProv_LogComponents {
140142
WP_LOG_KE = 0x0020, /* key agreement (DH, ECDH) */
141143
WP_LOG_KDF = 0x0040, /* password base key derivation algorithms */
142144
WP_LOG_PROVIDER = 0x0080, /* all provider specific logs */
143-
145+
144146
/* Granular algorithm family categories */
145147
WP_LOG_RSA = 0x0001, /* RSA operations */
146148
WP_LOG_ECC = 0x0002, /* ECC operations */

src/wp_aes_aead.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ static int wp_aesgcm_get_rand_iv(wp_AeadCtx* ctx, unsigned char* out,
869869

870870
rc = wc_AesGcmInit(&ctx->aes, NULL, 0, ctx->iv, (word32)ctx->ivLen);
871871
if (rc != 0) {
872-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesGcmInit failed with rc=%d", rc);
872+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesGcmInit failed with rc=%d", rc);
873873
ok = 0;
874874
}
875875
#endif
@@ -973,7 +973,7 @@ static int wp_aesgcm_tls_iv_set_fixed(wp_AeadCtx* ctx, unsigned char* iv,
973973
rc = wc_AesGcmSetIV(&ctx->aes, (word32)ctx->ivLen, iv,
974974
(word32)len, wp_provctx_get_rng(ctx->provCtx));
975975
if (rc != 0) {
976-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesGcmSetIV failed with rc=%d", rc);
976+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesGcmSetIV failed with rc=%d", rc);
977977
ok = 0;
978978
}
979979
}
@@ -1040,14 +1040,14 @@ static int wp_aesgcm_einit(wp_AeadCtx* ctx, const unsigned char *key,
10401040
if ((ivLen == 0) && (key != NULL)) {
10411041
rc = wc_AesGcmSetKey(aes, key, (word32)keyLen);
10421042
if (rc != 0) {
1043-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesGcmSetKey failed with rc=%d", rc);
1043+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesGcmSetKey failed with rc=%d", rc);
10441044
ok = 0;
10451045
}
10461046
}
10471047
else if (key != NULL) {
10481048
rc = wc_AesGcmEncryptInit(aes, key, (word32)keyLen, iv, (word32)ivLen);
10491049
if (rc != 0) {
1050-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesGcmEncryptInit failed with rc=%d", rc);
1050+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesGcmEncryptInit failed with rc=%d", rc);
10511051
ok = 0;
10521052
}
10531053
}
@@ -1056,7 +1056,7 @@ static int wp_aesgcm_einit(wp_AeadCtx* ctx, const unsigned char *key,
10561056
if (ok && (key != NULL)) {
10571057
int rc = wc_AesGcmSetKey(aes, key, (word32)keyLen);
10581058
if (rc != 0) {
1059-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesGcmSetKey failed with rc=%d", rc);
1059+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesGcmSetKey failed with rc=%d", rc);
10601060
ok = 0;
10611061
}
10621062
}
@@ -1112,7 +1112,7 @@ static int wp_aesgcm_dinit(wp_AeadCtx *ctx, const unsigned char *key,
11121112
if (ok && key != NULL) {
11131113
int rc = wc_AesGcmDecryptInit(aes, key, (word32)keyLen, iv, (word32)ivLen);
11141114
if (rc != 0) {
1115-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesGcmDecryptInit failed with rc=%d", rc);
1115+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesGcmDecryptInit failed with rc=%d", rc);
11161116
ok = 0;
11171117
}
11181118
}
@@ -1125,7 +1125,7 @@ static int wp_aesgcm_dinit(wp_AeadCtx *ctx, const unsigned char *key,
11251125
if (ok && (key != NULL)) {
11261126
int rc = wc_AesGcmSetKey(aes, key, (word32)keyLen);
11271127
if (rc != 0) {
1128-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesGcmSetKey failed with rc=%d", rc);
1128+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesGcmSetKey failed with rc=%d", rc);
11291129
ok = 0;
11301130
}
11311131
}
@@ -1209,7 +1209,7 @@ static int wp_aesgcm_tls_cipher(wp_AeadCtx* ctx, unsigned char* out,
12091209
(word32)ctx->ivLen, out + len, EVP_GCM_TLS_TAG_LEN,
12101210
ctx->buf, EVP_AEAD_TLS1_AAD_LEN);
12111211
if (rc != 0) {
1212-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesGcmEncrypt failed with rc=%d", rc);
1212+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesGcmEncrypt failed with rc=%d", rc);
12131213
ok = 0;
12141214
}
12151215
}
@@ -1218,7 +1218,7 @@ static int wp_aesgcm_tls_cipher(wp_AeadCtx* ctx, unsigned char* out,
12181218
(word32)ctx->ivLen, in + len, EVP_GCM_TLS_TAG_LEN, ctx->buf,
12191219
EVP_AEAD_TLS1_AAD_LEN);
12201220
if (rc != 0) {
1221-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesGcmDecrypt failed with rc=%d", rc);
1221+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesGcmDecrypt failed with rc=%d", rc);
12221222
OPENSSL_cleanse(out, len);
12231223
ok = 0;
12241224
}
@@ -1275,7 +1275,7 @@ static int wp_aesgcm_stream_update(wp_AeadCtx *ctx, unsigned char *out,
12751275
if (ctx->ivState == IV_STATE_BUFFERED) {
12761276
rc = wc_AesGcmInit(&ctx->aes, NULL, 0, ctx->iv, (word32)ctx->ivLen);
12771277
if (rc != 0) {
1278-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesGcmInit failed with rc=%d", rc);
1278+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesGcmInit failed with rc=%d", rc);
12791279
ok = 0;
12801280
}
12811281

@@ -1309,7 +1309,7 @@ static int wp_aesgcm_stream_update(wp_AeadCtx *ctx, unsigned char *out,
13091309
}
13101310
}
13111311
else {
1312-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesGcmEncryptUpdate/wc_AesGcmDecryptUpdate failed with rc=%d", rc);
1312+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesGcmEncryptUpdate/wc_AesGcmDecryptUpdate failed with rc=%d", rc);
13131313
ok = 0;
13141314
}
13151315

@@ -1367,7 +1367,7 @@ static int wp_aesgcm_stream_final(wp_AeadCtx *ctx, unsigned char *out,
13671367
rc = wc_AesGcmDecryptFinal(aes, ctx->buf, (word32)ctx->tagLen);
13681368
}
13691369
if (rc != 0) {
1370-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesGcmEncryptFinal/wc_AesGcmDecryptFinal failed with rc=%d", rc);
1370+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesGcmEncryptFinal/wc_AesGcmDecryptFinal failed with rc=%d", rc);
13711371
ok = 0;
13721372
}
13731373
}
@@ -1425,7 +1425,7 @@ static int wp_aesgcm_encdec(wp_AeadCtx *ctx, unsigned char *out, size_t* outLen,
14251425
if (ok) {
14261426
rc = wc_AesGcmSetExtIV(&ctx->aes, iv, (word32)ctx->ivLen);
14271427
if (rc != 0) {
1428-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesGcmSetExtIV failed with rc=%d", rc);
1428+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesGcmSetExtIV failed with rc=%d", rc);
14291429
ok = 0;
14301430
}
14311431

@@ -1442,7 +1442,7 @@ static int wp_aesgcm_encdec(wp_AeadCtx *ctx, unsigned char *out, size_t* outLen,
14421442
(word32)ctx->inLen, iv, (word32)ctx->ivLen, ctx->buf,
14431443
(word32)ctx->tagLen, ctx->aad, (word32)ctx->aadLen);
14441444
if (rc != 0) {
1445-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesGcmEncrypt_ex failed with rc=%d", rc);
1445+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesGcmEncrypt_ex failed with rc=%d", rc);
14461446
ok = 0;
14471447
}
14481448
if (ok) {
@@ -1461,7 +1461,7 @@ static int wp_aesgcm_encdec(wp_AeadCtx *ctx, unsigned char *out, size_t* outLen,
14611461
ctx->authErr = 1;
14621462
}
14631463
if (rc != 0) {
1464-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesGcmDecrypt failed with rc=%d", rc);
1464+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesGcmDecrypt failed with rc=%d", rc);
14651465
ok = 0;
14661466
}
14671467
}
@@ -1475,7 +1475,7 @@ static int wp_aesgcm_encdec(wp_AeadCtx *ctx, unsigned char *out, size_t* outLen,
14751475
(word32)ctx->inLen, iv, (word32)ctx->ivLen, (byte*)tmpTag,
14761476
(word32)ctx->tagLen, ctx->aad, (word32)ctx->aadLen);
14771477
if (rc != 0) {
1478-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesGcmEncrypt_ex failed with rc=%d", rc);
1478+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesGcmEncrypt_ex failed with rc=%d", rc);
14791479
ok = 0;
14801480
}
14811481
}
@@ -1757,7 +1757,7 @@ static int wp_aesccm_init(wp_AeadCtx* ctx, const unsigned char *key,
17571757
if (ok && (key != NULL)) {
17581758
rc = wc_AesCcmSetKey(&ctx->aes, key, (word32)keyLen);
17591759
if (rc != 0) {
1760-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesCcmSetKey failed with rc=%d", rc);
1760+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesCcmSetKey failed with rc=%d", rc);
17611761
ok = 0;
17621762
}
17631763
}
@@ -1867,15 +1867,15 @@ static int wp_aesccm_tls_cipher(wp_AeadCtx* ctx, unsigned char* out,
18671867
if (ctx->enc) {
18681868
rc = wc_AesCcmSetNonce(&ctx->aes, ctx->iv, (word32)ctx->ivLen);
18691869
if (rc != 0) {
1870-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesCcmSetNonce failed with rc=%d", rc);
1870+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesCcmSetNonce failed with rc=%d", rc);
18711871
ok = 0;
18721872
}
18731873
else {
18741874
rc = wc_AesCcmEncrypt_ex(&ctx->aes, out, in, (word32)len,
18751875
ctx->iv, (word32)ctx->ivLen, out + len, (word32)ctx->tagLen,
18761876
ctx->buf, (word32)ctx->tlsAadLen);
18771877
if (rc != 0) {
1878-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesCcmEncrypt_ex failed with rc=%d", rc);
1878+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesCcmEncrypt_ex failed with rc=%d", rc);
18791879
ok = 0;
18801880
}
18811881
}
@@ -1885,7 +1885,7 @@ static int wp_aesccm_tls_cipher(wp_AeadCtx* ctx, unsigned char* out,
18851885
(word32)ctx->ivLen, in + len, (word32)ctx->tagLen, ctx->buf,
18861886
(word32)ctx->tlsAadLen);
18871887
if (rc != 0) {
1888-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesCcmDecrypt failed with rc=%d", rc);
1888+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesCcmDecrypt failed with rc=%d", rc);
18891889
ok = 0;
18901890
}
18911891
}
@@ -1928,7 +1928,7 @@ static int wp_aesccm_encdec(wp_AeadCtx *ctx, unsigned char *out,
19281928
if (!ctx->ivSet) {
19291929
rc = wc_AesCcmSetNonce(&ctx->aes, ctx->iv, (word32)ctx->ivLen);
19301930
if (rc != 0) {
1931-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesCcmSetNonce failed with rc=%d", rc);
1931+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesCcmSetNonce failed with rc=%d", rc);
19321932
ok = 0;
19331933
}
19341934
}
@@ -1939,7 +1939,7 @@ static int wp_aesccm_encdec(wp_AeadCtx *ctx, unsigned char *out,
19391939
ctx->iv, (word32)ctx->ivLen, ctx->buf, (word32)ctx->tagLen,
19401940
ctx->aad, (word32)ctx->aadLen);
19411941
if (rc != 0) {
1942-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesCcmEncrypt_ex failed with rc=%d", rc);
1942+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesCcmEncrypt_ex failed with rc=%d", rc);
19431943
ok = 0;
19441944
}
19451945
}
@@ -1952,7 +1952,7 @@ static int wp_aesccm_encdec(wp_AeadCtx *ctx, unsigned char *out,
19521952
ctx->authErr = 1;
19531953
}
19541954
if (rc != 0) {
1955-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesCcmDecrypt failed with rc=%d", rc);
1955+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesCcmDecrypt failed with rc=%d", rc);
19561956
ok = 0;
19571957
}
19581958
if (ok) {

src/wp_aes_block.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ static int wp_aes_init_iv(wp_AesBlockCtx *ctx, const unsigned char *iv,
267267
XMEMCPY(ctx->oiv, iv, ivLen);
268268
rc = wc_AesSetIV(&ctx->aes, iv);
269269
if (rc != 0) {
270-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesSetIV failed with rc=%d", rc);
270+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesSetIV failed with rc=%d", rc);
271271
ok = 0;
272272
}
273273
}
@@ -331,7 +331,7 @@ static int wp_aes_block_init(wp_AesBlockCtx *ctx, const unsigned char *key,
331331
int rc = wc_AesSetKey(&ctx->aes, key, (word32)ctx->keyLen, ctx->iv,
332332
enc ? AES_ENCRYPTION : AES_DECRYPTION);
333333
if (rc != 0) {
334-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesSetKey failed with rc=%d", rc);
334+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesSetKey failed with rc=%d", rc);
335335
ok = 0;
336336
}
337337
}
@@ -405,9 +405,15 @@ static int wp_aes_block_doit(wp_AesBlockCtx *ctx, unsigned char *out,
405405
if (ctx->mode == EVP_CIPH_CBC_MODE) {
406406
if (ctx->enc) {
407407
rc = wc_AesCbcEncrypt(&ctx->aes, out, in, (word32)inLen);
408+
if (rc != 0) {
409+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesCbcEncrypt failed with rc=%d", rc);
410+
}
408411
}
409412
else {
410413
rc = wc_AesCbcDecrypt(&ctx->aes, out, in, (word32)inLen);
414+
if (rc != 0) {
415+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesCbcDecrypt failed with rc=%d", rc);
416+
}
411417
}
412418
XMEMCPY(ctx->iv, ctx->aes.reg, ctx->ivLen);
413419
}
@@ -417,9 +423,15 @@ static int wp_aes_block_doit(wp_AesBlockCtx *ctx, unsigned char *out,
417423
if (ctx->mode == EVP_CIPH_ECB_MODE) {
418424
if (ctx->enc) {
419425
rc = wc_AesEcbEncrypt(&ctx->aes, out, in, (word32)inLen);
426+
if (rc != 0) {
427+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesEcbEncrypt failed with rc=%d", rc);
428+
}
420429
}
421430
else {
422431
rc = wc_AesEcbDecrypt(&ctx->aes, out, in, (word32)inLen);
432+
if (rc != 0) {
433+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesEcbDecrypt failed with rc=%d", rc);
434+
}
423435
}
424436
}
425437
else

src/wp_aes_stream.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ static int wp_aes_stream_init(wp_AesStreamCtx *ctx, const unsigned char *key,
322322
int rc = wc_AesSetKey(&ctx->aes, key, (word32)ctx->keyLen, iv,
323323
dir);
324324
if (rc != 0) {
325-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesSetKey failed with rc=%d", rc);
325+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesSetKey failed with rc=%d", rc);
326326
ok = 0;
327327
}
328328
}
@@ -405,7 +405,7 @@ static int wp_aes_cts_encrypt(wp_AesStreamCtx *ctx, unsigned char *out,
405405
XMEMCPY(&ctx->aes.reg, ctx->iv, ctx->ivLen);
406406
rc = wc_AesCbcEncrypt(&ctx->aes, out, in, blocks * AES_BLOCK_SIZE);
407407
if (rc != 0) {
408-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesCbcEncrypt failed with rc=%d", rc);
408+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesCbcEncrypt failed with rc=%d", rc);
409409
ok = 0;
410410
}
411411
if (ok) {
@@ -420,7 +420,7 @@ static int wp_aes_cts_encrypt(wp_AesStreamCtx *ctx, unsigned char *out,
420420
rc = wc_AesCbcEncrypt(&ctx->aes, ctsBlock, ctsBlock,
421421
AES_BLOCK_SIZE * 2);
422422
if (rc != 0) {
423-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesCbcEncrypt failed with rc=%d", rc);
423+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesCbcEncrypt failed with rc=%d", rc);
424424
ok = 0;
425425
}
426426
if (ok) {
@@ -463,7 +463,7 @@ static int wp_aes_cts_decrypt(wp_AesStreamCtx *ctx, unsigned char *out,
463463
XMEMCPY(&ctx->aes.reg, ctx->iv, ctx->ivLen);
464464
rc = wc_AesCbcDecrypt(&ctx->aes, out, in, blocks * AES_BLOCK_SIZE);
465465
if (rc != 0) {
466-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesCbcDecrypt failed with rc=%d", rc);
466+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesCbcDecrypt failed with rc=%d", rc);
467467
ok = 0;
468468
}
469469
if (ok) {
@@ -478,7 +478,7 @@ static int wp_aes_cts_decrypt(wp_AesStreamCtx *ctx, unsigned char *out,
478478
XMEMCPY(&ctx->aes.reg, ctsBlock + AES_BLOCK_SIZE, AES_BLOCK_SIZE);
479479
rc = wc_AesCbcDecrypt(&ctx->aes, tmp, ctsBlock, AES_BLOCK_SIZE);
480480
if (rc != 0) {
481-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesCbcDecrypt failed with rc=%d", rc);
481+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesCbcDecrypt failed with rc=%d", rc);
482482
ok = 0;
483483
}
484484
}
@@ -490,7 +490,7 @@ static int wp_aes_cts_decrypt(wp_AesStreamCtx *ctx, unsigned char *out,
490490
rc = wc_AesCbcDecrypt(&ctx->aes, out, ctsBlock + AES_BLOCK_SIZE,
491491
AES_BLOCK_SIZE);
492492
if (rc != 0) {
493-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesCbcDecrypt failed with rc=%d", rc);
493+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesCbcDecrypt failed with rc=%d", rc);
494494
ok = 0;
495495
}
496496
if (ok) {
@@ -531,7 +531,7 @@ static int wp_aes_stream_doit(wp_AesStreamCtx *ctx, unsigned char *out,
531531
XMEMCPY(&ctx->aes.reg, ctx->iv, ctx->ivLen);
532532
rc = wc_AesCtrEncrypt(&ctx->aes, out, in, (word32)inLen);
533533
if (rc != 0) {
534-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesCtrEncrypt failed with rc=%d", rc);
534+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesCtrEncrypt failed with rc=%d", rc);
535535
ok = 0;
536536
}
537537
if (ok) {
@@ -551,7 +551,7 @@ static int wp_aes_stream_doit(wp_AesStreamCtx *ctx, unsigned char *out,
551551
rc = wc_AesCfbDecrypt(&ctx->aes, out, in, (word32)inLen);
552552
}
553553
if (rc != 0) {
554-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesCfbEncrypt/wc_AesCfbDecrypt failed with rc=%d", rc);
554+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesCfbEncrypt/wc_AesCfbDecrypt failed with rc=%d", rc);
555555
ok = 0;
556556
}
557557
if (ok) {

src/wp_aes_wrap.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static int wp_aes_wrap_init(wp_AesWrapCtx *ctx, const unsigned char *key,
269269
int rc = wc_AesSetKey(&ctx->aes, key, (word32)ctx->keyLen, iv,
270270
wrap ? AES_ENCRYPTION : AES_DECRYPTION);
271271
if (rc != 0) {
272-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesSetKey failed with rc=%d", rc);
272+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesSetKey failed with rc=%d", rc);
273273
ok = 0;
274274
}
275275
#else
@@ -366,15 +366,15 @@ static int wp_aes_wrap_update(wp_AesWrapCtx *ctx, unsigned char *out,
366366
if (ctx->wrap) {
367367
rc = wc_AesKeyWrap_ex(&ctx->aes, in, (word32)inLen, out, outSz, iv);
368368
if (rc <= 0) {
369-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesKeyWrap_ex failed with rc=%d", rc);
369+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesKeyWrap_ex failed with rc=%d", rc);
370370
ok = 0;
371371
}
372372
}
373373
else {
374374
rc = wc_AesKeyUnWrap_ex(&ctx->aes, in, (word32)inLen, out, outSz,
375375
iv);
376376
if (rc <= 0) {
377-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesKeyUnWrap_ex failed with rc=%d", rc);
377+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesKeyUnWrap_ex failed with rc=%d", rc);
378378
ok = 0;
379379
}
380380
}
@@ -383,15 +383,15 @@ static int wp_aes_wrap_update(wp_AesWrapCtx *ctx, unsigned char *out,
383383
rc = wc_AesKeyWrap(ctx->key, ctx->keyLen, in, inLen, out, outSz,
384384
iv);
385385
if (rc <= 0) {
386-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesKeyWrap failed with rc=%d", rc);
386+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesKeyWrap failed with rc=%d", rc);
387387
ok = 0;
388388
}
389389
}
390390
else {
391391
rc = wc_AesKeyUnWrap(ctx->key, ctx->keyLen, in, inLen, out, outSz,
392392
iv);
393393
if (rc <= 0) {
394-
WOLFPROV_MSG(WP_LOG_AES, "wc_AesKeyUnWrap failed with rc=%d", rc);
394+
WOLFPROV_MSG_DEBUG(WP_LOG_DEBUG, "wc_AesKeyUnWrap failed with rc=%d", rc);
395395
ok = 0;
396396
}
397397
#endif

0 commit comments

Comments
 (0)