Skip to content

Commit 7d485df

Browse files
committed
Fix from review
1 parent 3bf4f7e commit 7d485df

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

tests/api/test_pkcs12.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ int test_wc_PKCS12_encrypted_content_bounds(void)
316316
sizeof(pkcs12Passwd) - 1, NULL, inKey, inKeySz, inCert, inCertSz,
317317
&inCa, -1, -1, 2048, 2048, 0, NULL));
318318

319-
/* Serialize to DER use int intermediate to avoid word32 truncation
319+
/* Serialize to DER - use int intermediate to avoid word32 truncation
320320
* of negative error codes from wc_i2d_PKCS12(). */
321321
ExpectIntGE((exportRet = wc_i2d_PKCS12(pkcs12Export, &pkcs12Der, NULL)), 0);
322322
pkcs12DerSz = (word32)exportRet;
@@ -346,7 +346,7 @@ int test_wc_PKCS12_encrypted_content_bounds(void)
346346

347347
#endif
348348

349-
/* Part 2: True regression test craft a malformed PKCS#12 whose decrypted
349+
/* Part 2: True regression test - craft a malformed PKCS#12 whose decrypted
350350
* SafeBags SEQUENCE claims a length that exceeds the decrypted content
351351
* bounds (contentSz) but fits within the stale ContentInfo bounds
352352
* (ci->dataSz). Before the fix, the parser used ci->dataSz, allowing a
@@ -361,7 +361,7 @@ int test_wc_PKCS12_encrypted_content_bounds(void)
361361
static const byte regIv[16] = {0};
362362

363363
/* Malformed SafeBags plaintext (one AES block = 16 bytes).
364-
* The outer SEQUENCE claims length 100 this exceeds the decrypted
364+
* The outer SEQUENCE claims length 100 - this exceeds the decrypted
365365
* content size (16) but fits inside the stale ci->dataSz (127) that
366366
* the unfixed code used as the parsing bound. */
367367
static const byte regPlaintext[16] = {
@@ -374,7 +374,7 @@ int test_wc_PKCS12_encrypted_content_bounds(void)
374374
* Structure: PFX { version 3, authSafe { DATA { AuthenticatedSafe {
375375
* EncryptedData { PBES2(AES-256-CBC, HMAC-SHA256, PBKDF2)
376376
* <ciphertext placeholder at offset 154> } } } } }
377-
* No MacData macIter=0 skips MAC verification. */
377+
* No MacData - macIter=0 skips MAC verification. */
378378
byte regDer[170] = {
379379
0x30, 0x81, 0xA7, /* PFX SEQ (167) */
380380
0x02, 0x01, 0x03, /* version 3 */
@@ -416,7 +416,7 @@ int test_wc_PKCS12_encrypted_content_bounds(void)
416416
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
417417
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
418418
0x80, 0x10, /* [0] IMPLICIT CT (16) */
419-
/* 16 bytes ciphertext filled at runtime */
419+
/* 16 bytes ciphertext - filled at runtime */
420420
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
421421
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
422422
};
@@ -446,7 +446,7 @@ int test_wc_PKCS12_encrypted_content_bounds(void)
446446
/* Patch ciphertext into the DER template at offset 154 */
447447
XMEMCPY(regDer + 154, regCiphertext, sizeof(regCiphertext));
448448

449-
/* Parse the crafted PKCS#12 d2i should succeed (outer structure
449+
/* Parse the crafted PKCS#12 - d2i should succeed (outer structure
450450
* is valid), but wc_PKCS12_parse must fail because GetSequence
451451
* rejects SEQUENCE length 100 against contentSz 16. */
452452
ExpectNotNull(regP12 = wc_PKCS12_new_ex(NULL));

0 commit comments

Comments
 (0)