Skip to content

Commit 6e5b181

Browse files
authored
Merge pull request #268 from JeremiahM37/wolfprovErrorMsg
Extending error printing for silent wolfssl errors
2 parents 049d702 + 4b74109 commit 6e5b181

34 files changed

+303
-6
lines changed

include/wolfprovider/wp_logging.h

Lines changed: 6 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 */
@@ -257,6 +259,7 @@ void WOLFPROV_LEAVE_SILENT_EX(int type, const char* func, const char* msg,
257259
void WOLFPROV_MSG(int type, const char* fmt, ...);
258260
void WOLFPROV_MSG_VERBOSE(int type, const char* fmt, ...);
259261
void WOLFPROV_MSG_DEBUG(int type, const char* fmt, ...);
262+
void WOLFPROV_MSG_DEBUG_RETCODE(int type, const char* func_name, int rc);
260263
void WOLFPROV_MSG_TRACE(int type, const char* fmt, ...);
261264
void WOLFPROV_ERROR_LINE(int type, int err, const char* file, int line);
262265
void WOLFPROV_ERROR_MSG_LINE(int type, const char* msg, const char* file,
@@ -277,6 +280,7 @@ void WOLFPROV_BUFFER(int type, const unsigned char* buffer,
277280
#define WOLFPROV_MSG(t, m, ...)
278281
#define WOLFPROV_MSG_VERBOSE(t, m, ...)
279282
#define WOLFPROV_MSG_DEBUG(t, m, ...)
283+
#define WOLFPROV_MSG_DEBUG_RETCODE(t, f, r)
280284
#define WOLFPROV_MSG_TRACE(t, m, ...)
281285
#define WOLFPROV_ERROR(t, e)
282286
#define WOLFPROV_ERROR_MSG(t, e)

src/wp_aes_aead.c

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ static int wp_aead_get_params(OSSL_PARAM params[], unsigned int md,
720720
{
721721
int ok = 1;
722722
OSSL_PARAM* p;
723-
723+
724724
WOLFPROV_ENTER(WP_LOG_AES, "wp_aead_get_params");
725725

726726
p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_MODE);
@@ -869,6 +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_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesGcmInit", rc);
872873
ok = 0;
873874
}
874875
#endif
@@ -972,6 +973,7 @@ static int wp_aesgcm_tls_iv_set_fixed(wp_AeadCtx* ctx, unsigned char* iv,
972973
rc = wc_AesGcmSetIV(&ctx->aes, (word32)ctx->ivLen, iv,
973974
(word32)len, wp_provctx_get_rng(ctx->provCtx));
974975
if (rc != 0) {
976+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesGcmSetIV", rc);
975977
ok = 0;
976978
}
977979
}
@@ -1038,12 +1040,14 @@ static int wp_aesgcm_einit(wp_AeadCtx* ctx, const unsigned char *key,
10381040
if ((ivLen == 0) && (key != NULL)) {
10391041
rc = wc_AesGcmSetKey(aes, key, (word32)keyLen);
10401042
if (rc != 0) {
1043+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesGcmSetKey", rc);
10411044
ok = 0;
10421045
}
10431046
}
10441047
else if (key != NULL) {
10451048
rc = wc_AesGcmEncryptInit(aes, key, (word32)keyLen, iv, (word32)ivLen);
10461049
if (rc != 0) {
1050+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesGcmEncryptInit", rc);
10471051
ok = 0;
10481052
}
10491053
}
@@ -1052,6 +1056,7 @@ static int wp_aesgcm_einit(wp_AeadCtx* ctx, const unsigned char *key,
10521056
if (ok && (key != NULL)) {
10531057
int rc = wc_AesGcmSetKey(aes, key, (word32)keyLen);
10541058
if (rc != 0) {
1059+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesGcmSetKey", rc);
10551060
ok = 0;
10561061
}
10571062
}
@@ -1105,7 +1110,9 @@ static int wp_aesgcm_dinit(wp_AeadCtx *ctx, const unsigned char *key,
11051110
}
11061111
#ifdef WOLFSSL_AESGCM_STREAM
11071112
if (ok && key != NULL) {
1108-
if (wc_AesGcmDecryptInit(aes, key, (word32)keyLen, iv, (word32)ivLen) != 0) {
1113+
int rc = wc_AesGcmDecryptInit(aes, key, (word32)keyLen, iv, (word32)ivLen);
1114+
if (rc != 0) {
1115+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesGcmDecryptInit", rc);
11091116
ok = 0;
11101117
}
11111118
}
@@ -1118,6 +1125,7 @@ static int wp_aesgcm_dinit(wp_AeadCtx *ctx, const unsigned char *key,
11181125
if (ok && (key != NULL)) {
11191126
int rc = wc_AesGcmSetKey(aes, key, (word32)keyLen);
11201127
if (rc != 0) {
1128+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesGcmSetKey", rc);
11211129
ok = 0;
11221130
}
11231131
}
@@ -1201,6 +1209,7 @@ static int wp_aesgcm_tls_cipher(wp_AeadCtx* ctx, unsigned char* out,
12011209
(word32)ctx->ivLen, out + len, EVP_GCM_TLS_TAG_LEN,
12021210
ctx->buf, EVP_AEAD_TLS1_AAD_LEN);
12031211
if (rc != 0) {
1212+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesGcmEncrypt", rc);
12041213
ok = 0;
12051214
}
12061215
}
@@ -1209,6 +1218,7 @@ static int wp_aesgcm_tls_cipher(wp_AeadCtx* ctx, unsigned char* out,
12091218
(word32)ctx->ivLen, in + len, EVP_GCM_TLS_TAG_LEN, ctx->buf,
12101219
EVP_AEAD_TLS1_AAD_LEN);
12111220
if (rc != 0) {
1221+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesGcmDecrypt", rc);
12121222
OPENSSL_cleanse(out, len);
12131223
ok = 0;
12141224
}
@@ -1265,6 +1275,7 @@ static int wp_aesgcm_stream_update(wp_AeadCtx *ctx, unsigned char *out,
12651275
if (ctx->ivState == IV_STATE_BUFFERED) {
12661276
rc = wc_AesGcmInit(&ctx->aes, NULL, 0, ctx->iv, (word32)ctx->ivLen);
12671277
if (rc != 0) {
1278+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesGcmInit", rc);
12681279
ok = 0;
12691280
}
12701281

@@ -1298,6 +1309,7 @@ static int wp_aesgcm_stream_update(wp_AeadCtx *ctx, unsigned char *out,
12981309
}
12991310
}
13001311
else {
1312+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesGcmEncryptUpdate/wc_AesGcmDecryptUpdate", rc);
13011313
ok = 0;
13021314
}
13031315

@@ -1355,6 +1367,7 @@ static int wp_aesgcm_stream_final(wp_AeadCtx *ctx, unsigned char *out,
13551367
rc = wc_AesGcmDecryptFinal(aes, ctx->buf, (word32)ctx->tagLen);
13561368
}
13571369
if (rc != 0) {
1370+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesGcmEncryptFinal/wc_AesGcmDecryptFinal", rc);
13581371
ok = 0;
13591372
}
13601373
}
@@ -1412,6 +1425,7 @@ static int wp_aesgcm_encdec(wp_AeadCtx *ctx, unsigned char *out, size_t* outLen,
14121425
if (ok) {
14131426
rc = wc_AesGcmSetExtIV(&ctx->aes, iv, (word32)ctx->ivLen);
14141427
if (rc != 0) {
1428+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesGcmSetExtIV", rc);
14151429
ok = 0;
14161430
}
14171431

@@ -1428,6 +1442,7 @@ static int wp_aesgcm_encdec(wp_AeadCtx *ctx, unsigned char *out, size_t* outLen,
14281442
(word32)ctx->inLen, iv, (word32)ctx->ivLen, ctx->buf,
14291443
(word32)ctx->tagLen, ctx->aad, (word32)ctx->aadLen);
14301444
if (rc != 0) {
1445+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesGcmEncrypt_ex", rc);
14311446
ok = 0;
14321447
}
14331448
if (ok) {
@@ -1446,6 +1461,7 @@ static int wp_aesgcm_encdec(wp_AeadCtx *ctx, unsigned char *out, size_t* outLen,
14461461
ctx->authErr = 1;
14471462
}
14481463
if (rc != 0) {
1464+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesGcmDecrypt", rc);
14491465
ok = 0;
14501466
}
14511467
}
@@ -1459,6 +1475,7 @@ static int wp_aesgcm_encdec(wp_AeadCtx *ctx, unsigned char *out, size_t* outLen,
14591475
(word32)ctx->inLen, iv, (word32)ctx->ivLen, (byte*)tmpTag,
14601476
(word32)ctx->tagLen, ctx->aad, (word32)ctx->aadLen);
14611477
if (rc != 0) {
1478+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesGcmEncrypt_ex", rc);
14621479
ok = 0;
14631480
}
14641481
}
@@ -1740,6 +1757,7 @@ static int wp_aesccm_init(wp_AeadCtx* ctx, const unsigned char *key,
17401757
if (ok && (key != NULL)) {
17411758
rc = wc_AesCcmSetKey(&ctx->aes, key, (word32)keyLen);
17421759
if (rc != 0) {
1760+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesCcmSetKey", rc);
17431761
ok = 0;
17441762
}
17451763
}
@@ -1849,13 +1867,15 @@ static int wp_aesccm_tls_cipher(wp_AeadCtx* ctx, unsigned char* out,
18491867
if (ctx->enc) {
18501868
rc = wc_AesCcmSetNonce(&ctx->aes, ctx->iv, (word32)ctx->ivLen);
18511869
if (rc != 0) {
1870+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesCcmSetNonce", rc);
18521871
ok = 0;
18531872
}
18541873
else {
18551874
rc = wc_AesCcmEncrypt_ex(&ctx->aes, out, in, (word32)len,
18561875
ctx->iv, (word32)ctx->ivLen, out + len, (word32)ctx->tagLen,
18571876
ctx->buf, (word32)ctx->tlsAadLen);
18581877
if (rc != 0) {
1878+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesCcmEncrypt_ex", rc);
18591879
ok = 0;
18601880
}
18611881
}
@@ -1865,6 +1885,7 @@ static int wp_aesccm_tls_cipher(wp_AeadCtx* ctx, unsigned char* out,
18651885
(word32)ctx->ivLen, in + len, (word32)ctx->tagLen, ctx->buf,
18661886
(word32)ctx->tlsAadLen);
18671887
if (rc != 0) {
1888+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesCcmDecrypt", rc);
18681889
ok = 0;
18691890
}
18701891
}
@@ -1907,6 +1928,7 @@ static int wp_aesccm_encdec(wp_AeadCtx *ctx, unsigned char *out,
19071928
if (!ctx->ivSet) {
19081929
rc = wc_AesCcmSetNonce(&ctx->aes, ctx->iv, (word32)ctx->ivLen);
19091930
if (rc != 0) {
1931+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesCcmSetNonce", rc);
19101932
ok = 0;
19111933
}
19121934
}
@@ -1917,6 +1939,7 @@ static int wp_aesccm_encdec(wp_AeadCtx *ctx, unsigned char *out,
19171939
ctx->iv, (word32)ctx->ivLen, ctx->buf, (word32)ctx->tagLen,
19181940
ctx->aad, (word32)ctx->aadLen);
19191941
if (rc != 0) {
1942+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesCcmEncrypt_ex", rc);
19201943
ok = 0;
19211944
}
19221945
}
@@ -1929,6 +1952,7 @@ static int wp_aesccm_encdec(wp_AeadCtx *ctx, unsigned char *out,
19291952
ctx->authErr = 1;
19301953
}
19311954
if (rc != 0) {
1955+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesCcmDecrypt", rc);
19321956
ok = 0;
19331957
}
19341958
if (ok) {

src/wp_aes_block.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +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_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesSetIV", rc);
270271
ok = 0;
271272
}
272273
}
@@ -330,6 +331,7 @@ static int wp_aes_block_init(wp_AesBlockCtx *ctx, const unsigned char *key,
330331
int rc = wc_AesSetKey(&ctx->aes, key, (word32)ctx->keyLen, ctx->iv,
331332
enc ? AES_ENCRYPTION : AES_DECRYPTION);
332333
if (rc != 0) {
334+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesSetKey", rc);
333335
ok = 0;
334336
}
335337
}
@@ -403,9 +405,15 @@ static int wp_aes_block_doit(wp_AesBlockCtx *ctx, unsigned char *out,
403405
if (ctx->mode == EVP_CIPH_CBC_MODE) {
404406
if (ctx->enc) {
405407
rc = wc_AesCbcEncrypt(&ctx->aes, out, in, (word32)inLen);
408+
if (rc != 0) {
409+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesCbcEncrypt", rc);
410+
}
406411
}
407412
else {
408413
rc = wc_AesCbcDecrypt(&ctx->aes, out, in, (word32)inLen);
414+
if (rc != 0) {
415+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesCbcDecrypt", rc);
416+
}
409417
}
410418
XMEMCPY(ctx->iv, ctx->aes.reg, ctx->ivLen);
411419
}
@@ -415,9 +423,15 @@ static int wp_aes_block_doit(wp_AesBlockCtx *ctx, unsigned char *out,
415423
if (ctx->mode == EVP_CIPH_ECB_MODE) {
416424
if (ctx->enc) {
417425
rc = wc_AesEcbEncrypt(&ctx->aes, out, in, (word32)inLen);
426+
if (rc != 0) {
427+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesEcbEncrypt", rc);
428+
}
418429
}
419430
else {
420431
rc = wc_AesEcbDecrypt(&ctx->aes, out, in, (word32)inLen);
432+
if (rc != 0) {
433+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesEcbDecrypt", rc);
434+
}
421435
}
422436
}
423437
else

src/wp_aes_stream.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +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_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesSetKey", rc);
325326
ok = 0;
326327
}
327328
}
@@ -404,6 +405,7 @@ static int wp_aes_cts_encrypt(wp_AesStreamCtx *ctx, unsigned char *out,
404405
XMEMCPY(&ctx->aes.reg, ctx->iv, ctx->ivLen);
405406
rc = wc_AesCbcEncrypt(&ctx->aes, out, in, blocks * AES_BLOCK_SIZE);
406407
if (rc != 0) {
408+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesCbcEncrypt", rc);
407409
ok = 0;
408410
}
409411
if (ok) {
@@ -418,6 +420,7 @@ static int wp_aes_cts_encrypt(wp_AesStreamCtx *ctx, unsigned char *out,
418420
rc = wc_AesCbcEncrypt(&ctx->aes, ctsBlock, ctsBlock,
419421
AES_BLOCK_SIZE * 2);
420422
if (rc != 0) {
423+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesCbcEncrypt", rc);
421424
ok = 0;
422425
}
423426
if (ok) {
@@ -460,6 +463,7 @@ static int wp_aes_cts_decrypt(wp_AesStreamCtx *ctx, unsigned char *out,
460463
XMEMCPY(&ctx->aes.reg, ctx->iv, ctx->ivLen);
461464
rc = wc_AesCbcDecrypt(&ctx->aes, out, in, blocks * AES_BLOCK_SIZE);
462465
if (rc != 0) {
466+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesCbcDecrypt", rc);
463467
ok = 0;
464468
}
465469
if (ok) {
@@ -474,6 +478,7 @@ static int wp_aes_cts_decrypt(wp_AesStreamCtx *ctx, unsigned char *out,
474478
XMEMCPY(&ctx->aes.reg, ctsBlock + AES_BLOCK_SIZE, AES_BLOCK_SIZE);
475479
rc = wc_AesCbcDecrypt(&ctx->aes, tmp, ctsBlock, AES_BLOCK_SIZE);
476480
if (rc != 0) {
481+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesCbcDecrypt", rc);
477482
ok = 0;
478483
}
479484
}
@@ -485,6 +490,7 @@ static int wp_aes_cts_decrypt(wp_AesStreamCtx *ctx, unsigned char *out,
485490
rc = wc_AesCbcDecrypt(&ctx->aes, out, ctsBlock + AES_BLOCK_SIZE,
486491
AES_BLOCK_SIZE);
487492
if (rc != 0) {
493+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesCbcDecrypt", rc);
488494
ok = 0;
489495
}
490496
if (ok) {
@@ -525,6 +531,7 @@ static int wp_aes_stream_doit(wp_AesStreamCtx *ctx, unsigned char *out,
525531
XMEMCPY(&ctx->aes.reg, ctx->iv, ctx->ivLen);
526532
rc = wc_AesCtrEncrypt(&ctx->aes, out, in, (word32)inLen);
527533
if (rc != 0) {
534+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesCtrEncrypt", rc);
528535
ok = 0;
529536
}
530537
if (ok) {
@@ -544,6 +551,7 @@ static int wp_aes_stream_doit(wp_AesStreamCtx *ctx, unsigned char *out,
544551
rc = wc_AesCfbDecrypt(&ctx->aes, out, in, (word32)inLen);
545552
}
546553
if (rc != 0) {
554+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesCfbEncrypt/wc_AesCfbDecrypt", rc);
547555
ok = 0;
548556
}
549557
if (ok) {

src/wp_aes_wrap.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +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_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesSetKey", rc);
272273
ok = 0;
273274
}
274275
#else
@@ -365,13 +366,15 @@ static int wp_aes_wrap_update(wp_AesWrapCtx *ctx, unsigned char *out,
365366
if (ctx->wrap) {
366367
rc = wc_AesKeyWrap_ex(&ctx->aes, in, (word32)inLen, out, outSz, iv);
367368
if (rc <= 0) {
369+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesKeyWrap_ex", rc);
368370
ok = 0;
369371
}
370372
}
371373
else {
372374
rc = wc_AesKeyUnWrap_ex(&ctx->aes, in, (word32)inLen, out, outSz,
373375
iv);
374376
if (rc <= 0) {
377+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesKeyUnWrap_ex", rc);
375378
ok = 0;
376379
}
377380
}
@@ -380,13 +383,15 @@ static int wp_aes_wrap_update(wp_AesWrapCtx *ctx, unsigned char *out,
380383
rc = wc_AesKeyWrap(ctx->key, ctx->keyLen, in, inLen, out, outSz,
381384
iv);
382385
if (rc <= 0) {
386+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesKeyWrap", rc);
383387
ok = 0;
384388
}
385389
}
386390
else {
387391
rc = wc_AesKeyUnWrap(ctx->key, ctx->keyLen, in, inLen, out, outSz,
388392
iv);
389393
if (rc <= 0) {
394+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_DEBUG, "wc_AesKeyUnWrap", rc);
390395
ok = 0;
391396
}
392397
#endif

0 commit comments

Comments
 (0)