ASN Template documentation: add more content

Added a bunch of content about how to use ASN templates.
Added a section with a list of things to do when adding a new template.
Added mappiong of ASN.1 notation to template lines.
Added ASN.1 type specific information.
Added a checklist at the end to head off the common issues.
Added references to ASN_TEMPLATE.md.
Added other informatrion.
pull/11244/head
Sean Parkinson 2026-08-24 10:52:23 +10:00
parent cb138b22a2
commit 78c2528c56
4 changed files with 1302 additions and 12 deletions

View File

@ -150,6 +150,7 @@ set the macros in `user_settings.h` or your build flags.
| `wolfssl/internal.h` | Internal -- do not use from applications |
| `src/` | TLS implementation (ssl.c, tls13.c, dtls13.c, internal.c) |
| `wolfcrypt/src/` | Crypto implementations |
| `wolfcrypt/src/ASN_TEMPLATE.md` | How ASN.1 structures are described and parsed/encoded -- read before touching `asn.c` |
| `wolfcrypt/src/port/` | ~30 hardware/OS crypto ports: arm, intel, Espressif, Renesas, st, nxp, atmel, silabs, psa, kcapi, caam, liboqs, ... |
| `examples/client/`, `examples/server/` | Full-featured reference apps; run with `-h` for all flags |
| `examples/tls13/` | Minimal TLS 1.3 samples, incl. in-memory I/O (no sockets) |

File diff suppressed because it is too large Load Diff

View File

@ -33,6 +33,11 @@
*
* Provides routines to convert BER into DER. Replaces indefinite length
* encoded items with explicit lengths.
*
* ASN.1 structures are described by templates - tables of ASNItem shared by
* the decoding and encoding routines. Writing one is documented in
* wolfcrypt/src/ASN_TEMPLATE.md; read it before adding support for a new
* ASN.1 structure.
*/
#include <wolfssl/wolfcrypt/libwolfssl_sources.h>

View File

@ -261,7 +261,12 @@ enum ASNItem_DataType {
#endif
};
/* A template entry describing an ASN.1 item. */
/* A template entry describing an ASN.1 item.
*
* Templates are tables of these, used by both GetASN_Items() to decode and
* SizeASN_Items()/SetASN_Items() to encode. How to write one is documented
* in wolfcrypt/src/ASN_TEMPLATE.md - read that before adding a template.
*/
typedef struct ASNItem {
/* Depth of ASN.1 item - how many constructed ASN.1 items above. */
byte depth;