Commit 9b780e8
committed
src/x509.c: refactor wolfSSL_PEM_read_bio_X509_CRL onto the per-block reader
ReadPemFromBioToBuffer slurps the entire BIO in one shot, so iterative
callers like wolfSSL_PEM_read_bio_X509_CRL (and by extension
wolfSSL_X509_load_crl_file's BIO branch) saw EOF after the first block
and silently dropped every CRL after the first in a multi-CRL bundle.
Refactor wolfSSL_PEM_read_bio_X509_CRL to delegate to
wolfSSL_PEM_X509_X509_CRL_X509_PKEY_read_bio, which already reads one
PEM BEGIN/END pair per call and leaves the BIO positioned just past the
END line. Loop over it so we skip past intervening cert/key blocks and
return the next CRL in the stream — matching OpenSSL's
PEM_read_bio_X509_CRL, verified against OpenSSL 3.0.13 with cases
{cert,CRL}, {CRL,cert}, {CRL,cert,CRL}, {key,CRL}, {CRL,key,CRL}: in
each case OpenSSL skips non-CRL blocks until EOF.
To make those helpers callable from the new site, drop their `static`
qualifier (wolfSSL_PEM_X509_X509_CRL_X509_PKEY_read_bio for the per-block
read, wolfSSL_X509_PKEY_free to free defensively-allocated keys parsed
from intervening non-CRL blocks) and declare both WOLFSSL_LOCAL in
internal.h under their existing OPENSSL_ALL[/NO_BIO] gates.
Also register the previously-orphaned test_wolfSSL_X509_load_crl_file
(its slot in TEST_OSSL_X509_LOOKUP_DECLS was a duplicated
test_wolfSSL_X509_LOOKUP_ctrl_hash_dir entry), update its assertion for
crl2.pem (which already contains two CRLs) to expect 2 instead of 1, and
add a multi-CRL bundle case that builds a memory BIO from
crl.pem + server-cert.pem + crl2.pem and asserts that the reader walks
past the cert and returns all 3 CRLs before NULL.1 parent 1c9555c commit 9b780e8
4 files changed
Lines changed: 81 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13499 | 13499 | | |
13500 | 13500 | | |
13501 | 13501 | | |
13502 | | - | |
13503 | | - | |
13504 | | - | |
13505 | | - | |
13506 | 13502 | | |
13507 | 13503 | | |
13508 | 13504 | | |
13509 | 13505 | | |
13510 | | - | |
13511 | | - | |
13512 | | - | |
13513 | | - | |
13514 | | - | |
13515 | | - | |
13516 | | - | |
13517 | | - | |
13518 | | - | |
13519 | | - | |
| 13506 | + | |
| 13507 | + | |
| 13508 | + | |
| 13509 | + | |
| 13510 | + | |
| 13511 | + | |
| 13512 | + | |
| 13513 | + | |
| 13514 | + | |
| 13515 | + | |
| 13516 | + | |
| 13517 | + | |
| 13518 | + | |
| 13519 | + | |
| 13520 | + | |
| 13521 | + | |
13520 | 13522 | | |
13521 | 13523 | | |
13522 | | - | |
13523 | | - | |
13524 | | - | |
13525 | | - | |
13526 | | - | |
13527 | | - | |
13528 | | - | |
| 13524 | + | |
| 13525 | + | |
13529 | 13526 | | |
13530 | 13527 | | |
13531 | | - | |
13532 | 13528 | | |
13533 | 13529 | | |
13534 | 13530 | | |
| |||
13711 | 13707 | | |
13712 | 13708 | | |
13713 | 13709 | | |
13714 | | - | |
| 13710 | + | |
13715 | 13711 | | |
13716 | 13712 | | |
13717 | 13713 | | |
| |||
13737 | 13733 | | |
13738 | 13734 | | |
13739 | 13735 | | |
13740 | | - | |
| 13736 | + | |
13741 | 13737 | | |
13742 | 13738 | | |
13743 | 13739 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
315 | 326 | | |
316 | 327 | | |
317 | 328 | | |
| |||
342 | 353 | | |
343 | 354 | | |
344 | 355 | | |
345 | | - | |
| 356 | + | |
346 | 357 | | |
347 | 358 | | |
348 | 359 | | |
| |||
394 | 405 | | |
395 | 406 | | |
396 | 407 | | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
397 | 447 | | |
398 | 448 | | |
399 | 449 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7469 | 7469 | | |
7470 | 7470 | | |
7471 | 7471 | | |
| 7472 | + | |
| 7473 | + | |
| 7474 | + | |
| 7475 | + | |
| 7476 | + | |
| 7477 | + | |
| 7478 | + | |
| 7479 | + | |
| 7480 | + | |
7472 | 7481 | | |
7473 | 7482 | | |
7474 | 7483 | | |
| |||
0 commit comments