feat: add Canonical EXI encoding support for ISO 15118-2/-20 Plug & Charge#126
Open
jayharper wants to merge 4 commits intoEVerest:mainfrom
Open
feat: add Canonical EXI encoding support for ISO 15118-2/-20 Plug & Charge#126jayharper wants to merge 4 commits intoEVerest:mainfrom
jayharper wants to merge 4 commits intoEVerest:mainfrom
Conversation
…harge Add opt-in Canonical EXI code generation (canonical_exi_enabled config flag) for ISO 15118-2 and ISO 15118-20 Plug & Charge XML signature workflows. When enabled, the generator produces a 2-mode runtime system: - mode=0 (EXI_MODE_STANDARD): schema-informed standard EXI (0x80 header, bit-packed) - mode=1 (EXI_MODE_CANONICAL): Canonical EXI for Plug & Charge (0x80 header, bit-packed, type-aware encoding per W3C Canonical EXI specification) Key changes: - Runtime canonical_mode field in exi_bitstream_t struct, set by caller - W3C-compliant canonical attribute ordering (xsi:type, xsi:nil, then lexicographic by local_name + namespace_uri) - Recursive schema import processing for complete fragment grammar discovery - String table partition prefix encoding for canonical string values - base64Binary decoder fix for correct nesting depth - New error codes for canonical decoding validation - exi_types_encoder.h included in all encoder configurations The feature is disabled by default (canonical_exi_enabled = 0). Set to 1 in config.py to generate canonical EXI code paths. Validated against EXIficient reference implementation (8/8 fragment digest match, RSA-SHA512 + ECDSA-SHA256 signature verification) and Keysight SL1550A EVCC live hardware (byte-identical 2,247-byte canonical output). Signed-off-by: jharper <jharper@anl.gov>
07c6f08 to
a1c87d4
Compare
|
Hello @jayharper , |
Add exi_types_encoder.c.jinja and exi_types_encoder.h.jinja templates for generating the EXI type encoder (hexBinary, base64Binary). Register the new templates in config.py so the generator produces exi_types_encoder.c and exi_types_encoder.h alongside the existing exi_types_decoder files. Signed-off-by: jharper <jharper@anl.gov>
Author
|
@kwoyhope Good catch — the Regarding exi_bitstream_t stream;
exi_bitstream_init(&stream, buffer, buffer_size, 0, NULL);
stream.canonical_mode = EXI_MODE_CANONICAL; // 1 = Canonical EXI for Plug & Charge
// ... then call the encode functions as normalThe two modes:
The generated encoder code and |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 8 |
| Duplication | 0 |
TIP This summary will be updated as you push new changes. Give us feedback
Signed-off-by: jharper <jharper@anl.gov>
Fixes Codacy "statement has no effect" warning in tools_config.py. Signed-off-by: jharper <jharper@anl.gov>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
Adds opt-in Canonical EXI code generation for ISO 15118-2 and ISO 15118-20 Plug & Charge XML signature workflows (digest computation over EXI-encoded signed fragments).
When
canonical_exi_enabled = 1is set inconfig.py, the generator produces a 2-mode runtime system controlled by acanonical_modefield onexi_bitstream_t:EXI_MODE_STANDARD): schema-informed standard EXI — existing behavior, unchangedEXI_MODE_CANONICAL): Canonical EXI for Plug & Charge — 0x80 header, bit-packed, type-aware encoding per W3C Canonical EXI specificationThe feature is disabled by default (
canonical_exi_enabled = 0), so existing users are unaffected.What changed
Generator (Python):
canonical_exi_enabledconfig flag threaded throughFileGenerator,tools_config, and Jinja template renderingSchemaAnalyzer(xsi:type first, xsi:nil second, then lexicographic by local_name + namespace_uri)namespace_urifield added toParticledataclass for attribute sort keyTemplates (Jinja → generated C):
exi_bitstream_tgainscanonical_modefield andEXI_MODE_STANDARD/EXI_MODE_CANONICALconstantsexi_basetypes_encoderaddsexi_basetypes_encoder_string_len()for string table partition prefix encodingexi_types_decoderaddsdecode_exi_type_base64_binary()for base64Binary decodingDecodeTypeBase64BinarySimple.jinjafix for correct nesting depthEXI_ERROR__INVALID_LEXICAL_VALUE,EXI_ERROR__NUMERIC_OVERFLOW) for canonical decoding validationexi_types_encoder.hadded to all encoder include listsValidation
Issue ticket number and link
Closes #116
Checklist before requesting a review