Commit 6c8603f
committed
preTBS: address review of BC/EJBCA CSR interop commit
Followup to a56735e. Tightens the new CSR-attribute decoder path and
GenerateCsrPreTBS based on review:
DecodeCertReqAttrValue (X9.146 cases)
- Propagate the underlying decoder error instead of clobbering with
ASN_PARSE_E. Callers can now distinguish MEMORY_E, ASN_BITSTR_E,
ASN_OBJECT_ID_E, etc. from a generic parse failure.
- New CheckSinglePkcs10AttrValue() helper enforces that the SET OF
AttributeValue holds exactly one TLV. Rejects an over-stuffed SET
that would silently feed only the first value to the decoder.
- Updated function docstring to enumerate the X9.146 cases and the
new ASN_OBJECT_ID_E return when an X9.146 attribute appears at
both the top level and nested inside extensionRequest (already
detected by VERIFY_AND_SET_OID; just wasn't documented).
OidFromId / oidCsrAttrType
- Register SUBJ_ALT_PUB_KEY_INFO_OID, ALT_SIG_ALG_OID and
ALT_SIG_VAL_OID under oidCsrAttrType so the OID validation in
GetObjectId can match them against the canonical bytes. Previously
the cases worked by accident because GetObjectId silently accepts
unknown OIDs (per the existing TODO at line ~7348); if that TODO is
ever resolved the new path would have broken.
GenerateCsrPreTBS
- Renamed the encoding selector from `bcMode` (int 0/1, two
semantically-distinct states) to `topLevelAttr` with a doc comment.
- Added an explicit comment in the topLevelAttr branch explaining why
the lamps-draft "altSigValue must be last" enforcement is *not*
applied here (PKCS#10 attributes is SET OF, ordering is determined
by DER's SET OF rule, removing one element leaves the SET sorted).
- Added a sanity check on the lamps-draft branch: if the cert claims
the lamps-draft encoding (no top-level altSigValue attribute) but
the parser didn't populate dCert->extensions / extensionsIdx, fail
with ASN_PARSE_E rather than walking off the end of an incomplete
DecodedCert.
Interop coverage unchanged but re-validated:
- BC -> wolfSSL: cert + CSR alt sigs verify (BouncyCastle 1.80.2
artefacts, the JAR EJBCA-CE 9.x bundles).
- wolfSSL CSR -> BC issuer -> wolfSSL: BC issues a dual-alg cert
from a wolfSSL CSR; wolfSSL verifies the issued cert.
- All 9 self-tests under --enable-dual-alg-certs --enable-experimental
--enable-dilithium --enable-mldsa --enable-certreq --enable-certgen
--enable-keygen still pass (default config: clean -Werror, 0 fail).
Note: a wolfSSL self-test that exercises the BC top-level encoding in
isolation still requires either a hand-crafted (~4 KB) DER fixture or
a runtime BouncyCastle dependency, neither of which are appropriate
for the in-tree test suite right now. The integration test tooling
under /tmp/ejbca-interop/ remains the reproducer.1 parent a56735e commit 6c8603f
1 file changed
Lines changed: 109 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5184 | 5184 | | |
5185 | 5185 | | |
5186 | 5186 | | |
| 5187 | + | |
| 5188 | + | |
| 5189 | + | |
| 5190 | + | |
| 5191 | + | |
| 5192 | + | |
| 5193 | + | |
| 5194 | + | |
| 5195 | + | |
5187 | 5196 | | |
5188 | 5197 | | |
5189 | 5198 | | |
| |||
6722 | 6731 | | |
6723 | 6732 | | |
6724 | 6733 | | |
| 6734 | + | |
| 6735 | + | |
| 6736 | + | |
| 6737 | + | |
| 6738 | + | |
| 6739 | + | |
| 6740 | + | |
| 6741 | + | |
| 6742 | + | |
| 6743 | + | |
| 6744 | + | |
| 6745 | + | |
| 6746 | + | |
| 6747 | + | |
6725 | 6748 | | |
6726 | 6749 | | |
6727 | 6750 | | |
| |||
21107 | 21130 | | |
21108 | 21131 | | |
21109 | 21132 | | |
| 21133 | + | |
| 21134 | + | |
| 21135 | + | |
| 21136 | + | |
| 21137 | + | |
| 21138 | + | |
| 21139 | + | |
| 21140 | + | |
| 21141 | + | |
| 21142 | + | |
| 21143 | + | |
| 21144 | + | |
| 21145 | + | |
| 21146 | + | |
| 21147 | + | |
| 21148 | + | |
| 21149 | + | |
| 21150 | + | |
| 21151 | + | |
| 21152 | + | |
| 21153 | + | |
| 21154 | + | |
| 21155 | + | |
| 21156 | + | |
| 21157 | + | |
| 21158 | + | |
| 21159 | + | |
| 21160 | + | |
| 21161 | + | |
| 21162 | + | |
21110 | 21163 | | |
| 21164 | + | |
| 21165 | + | |
| 21166 | + | |
| 21167 | + | |
| 21168 | + | |
| 21169 | + | |
| 21170 | + | |
| 21171 | + | |
| 21172 | + | |
21111 | 21173 | | |
21112 | 21174 | | |
21113 | 21175 | | |
21114 | 21176 | | |
21115 | 21177 | | |
21116 | | - | |
21117 | | - | |
| 21178 | + | |
| 21179 | + | |
21118 | 21180 | | |
| 21181 | + | |
| 21182 | + | |
21119 | 21183 | | |
21120 | 21184 | | |
21121 | 21185 | | |
| |||
21226 | 21290 | | |
21227 | 21291 | | |
21228 | 21292 | | |
21229 | | - | |
21230 | | - | |
21231 | | - | |
21232 | | - | |
21233 | | - | |
21234 | | - | |
21235 | | - | |
21236 | | - | |
21237 | | - | |
21238 | | - | |
21239 | | - | |
21240 | | - | |
| 21293 | + | |
| 21294 | + | |
| 21295 | + | |
| 21296 | + | |
| 21297 | + | |
| 21298 | + | |
| 21299 | + | |
| 21300 | + | |
21241 | 21301 | | |
21242 | 21302 | | |
21243 | | - | |
21244 | | - | |
21245 | | - | |
| 21303 | + | |
| 21304 | + | |
| 21305 | + | |
21246 | 21306 | | |
21247 | 21307 | | |
21248 | 21308 | | |
21249 | 21309 | | |
21250 | | - | |
21251 | | - | |
21252 | | - | |
| 21310 | + | |
| 21311 | + | |
| 21312 | + | |
21253 | 21313 | | |
21254 | 21314 | | |
21255 | 21315 | | |
21256 | 21316 | | |
21257 | | - | |
21258 | | - | |
21259 | | - | |
| 21317 | + | |
| 21318 | + | |
| 21319 | + | |
21260 | 21320 | | |
21261 | 21321 | | |
21262 | 21322 | | |
| |||
30330 | 30390 | | |
30331 | 30391 | | |
30332 | 30392 | | |
30333 | | - | |
| 30393 | + | |
| 30394 | + | |
| 30395 | + | |
| 30396 | + | |
| 30397 | + | |
| 30398 | + | |
30334 | 30399 | | |
30335 | 30400 | | |
30336 | 30401 | | |
| |||
30434 | 30499 | | |
30435 | 30500 | | |
30436 | 30501 | | |
30437 | | - | |
| 30502 | + | |
30438 | 30503 | | |
30439 | 30504 | | |
30440 | 30505 | | |
| |||
30448 | 30513 | | |
30449 | 30514 | | |
30450 | 30515 | | |
30451 | | - | |
| 30516 | + | |
30452 | 30517 | | |
30453 | 30518 | | |
30454 | | - | |
| 30519 | + | |
| 30520 | + | |
| 30521 | + | |
| 30522 | + | |
| 30523 | + | |
| 30524 | + | |
| 30525 | + | |
| 30526 | + | |
| 30527 | + | |
| 30528 | + | |
30455 | 30529 | | |
30456 | 30530 | | |
30457 | 30531 | | |
| |||
30465 | 30539 | | |
30466 | 30540 | | |
30467 | 30541 | | |
| 30542 | + | |
| 30543 | + | |
| 30544 | + | |
| 30545 | + | |
| 30546 | + | |
| 30547 | + | |
| 30548 | + | |
30468 | 30549 | | |
30469 | 30550 | | |
30470 | 30551 | | |
| |||
30559 | 30640 | | |
30560 | 30641 | | |
30561 | 30642 | | |
30562 | | - | |
| 30643 | + | |
30563 | 30644 | | |
30564 | 30645 | | |
30565 | 30646 | | |
| |||
0 commit comments