Skip to content

Split original ASN.1 code from asn.c into asn_orig.c#9920

Open
dgarske wants to merge 4 commits intowolfSSL:masterfrom
dgarske:asn_old
Open

Split original ASN.1 code from asn.c into asn_orig.c#9920
dgarske wants to merge 4 commits intowolfSSL:masterfrom
dgarske:asn_old

Conversation

@dgarske
Copy link
Contributor

@dgarske dgarske commented Mar 9, 2026

Move non-template (WOLFSSL_ASN_ORIGINAL) code into asn_orig.c and include from asn.c.

Copilot AI review requested due to automatic review settings March 9, 2026 05:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves the non-template ASN.1 implementation into a separate asn_orig.c file and ensures it’s included in distributed source archives.

Changes:

  • Adds the new wolfcrypt/src/asn_orig.c file to Automake’s EXTRA_DIST so it’s shipped in release tarballs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@dgarske
Copy link
Contributor Author

dgarske commented Mar 9, 2026

Jenkins retest this please

@dgarske dgarske requested a review from SparkiDev March 9, 2026 09:00
@dgarske dgarske self-assigned this Mar 9, 2026
@dgarske dgarske added the Not For This Release Not for release 5.9.0 label Mar 9, 2026
@dgarske
Copy link
Contributor Author

dgarske commented Mar 9, 2026

Jenkins retest this please

2 similar comments
@dgarske
Copy link
Contributor Author

dgarske commented Mar 9, 2026

Jenkins retest this please

@dgarske
Copy link
Contributor Author

dgarske commented Mar 10, 2026

Jenkins retest this please

Copilot AI review requested due to automatic review settings March 16, 2026 20:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@dgarske
Copy link
Contributor Author

dgarske commented Mar 16, 2026

Jenkins retest this please

@dgarske
Copy link
Contributor Author

dgarske commented Mar 17, 2026

Jenkins retest this please - history lost

@LinuxJedi LinuxJedi requested review from wolfSSL-Fenrir-bot and removed request for wolfSSL-Fenrir-bot March 18, 2026 18:32
@dgarske
Copy link
Contributor Author

dgarske commented Mar 19, 2026

Jenkins retest this please

dgarske added 4 commits March 19, 2026 14:56
Move non-template (WOLFSSL_ASN_ORIGINAL) code into asn_orig.c and include from asn.c.
Add settings.h include before the compile guard in asn_orig.c so
WOLFSSL_IGNORE_FILE_WARN is available when compiled separately.
Add -Wno-pedantic for asn_orig.c in async examples Makefile to
suppress empty translation unit warning.
Three fixes for guard-context correctness in the ASN.1 code split:

1. Strip WOLFSSL_ASN_ORIG_INCLUDED from forward declaration wrappers.
   The file-guard was being applied to fwd decls in asn.c, but at the
   fwd-decl site that macro is not yet defined, so #ifndef ... #else
   inverted the condition and hid all declarations.

2. Add outer feature guard tracking. Large feature sections (HAVE_OCSP,
   HAVE_CRL, WOLFSSL_CERT_GEN, etc.) that span many functions in asn.c
   are now tracked and re-emitted around the corresponding blocks in
   asn_orig.c, fixing 'unknown type name' errors in minimal builds.

3. Collect multi-line #if continuations in the outer guard map so that
   full guard conditions (e.g. #if !defined(NO_RSA) && \ continued
   across lines) are stored and compared as complete strings, preventing
   duplicate guard emission.

Both modes build and pass tests (5 PASS, 0 FAIL each):
  ./configure --enable-asn=original && make check
  ./configure && make check
Forward declarations in asn.c and asn_orig.c now use guard transitions
(same mechanism as the function bodies) so consecutive declarations with
the same feature guard are grouped in a single #ifdef/#endif block rather
than each having its own open/close pair.

Also removed the now-redundant _find_func_outer_guards calls from
_emit_split_body_orig; outer feature guard context is emitted at the
generate_asn_orig loop level, not inside the per-block emitters.

Both modes still build and pass tests (5 PASS, 0 FAIL each).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Not For This Release Not for release 5.9.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants