ThePassionate opened a new pull request, #22063:
URL: https://github.com/apache/nuttx/pull/22063
## Summary
Extend the CRC support of the crypto framework from the single hardcoded
reflected CRC-32 to a general, parameterized CRC engine:
* **crypto/crc32: support selectable polynomial in the crc32 xform** - the
session key selects the parameters by length: a 16-byte key carries the full
`{polynomial, initial, xorout, reflect_in, reflect_out}` set, a 12-byte key
carries `{polynomial, initial, xorout}`, and the legacy 4-byte key keeps the
pre-inverted start value of the standard reflected CRC-32 unchanged.
* **crypto/crc: add crc8 and crc16 xforms** - new `CRYPTO_CRC8` /
`CRYPTO_CRC16` algorithm ids with the same 5-parameter key form; the update is
a generic MSB-first bit-by-bit polynomial division with optional input/output
reflection.
* **crypto/crc: support reflect in/out for the crc xforms** - the reflect
flags apply to crc8/16/32 uniformly; the polynomial is defined as the MSB-first
(left-shift) form for all widths.
The setkey path bounds the copy to the context size (the key length is
user-controlled and was previously unchecked).
## Impact
* New algorithm ids 46/47 (`CRYPTO_ALGORITHM_MAX` 45 -> 47). The legacy
4-byte CRC-32 key behaves exactly as before (the pre-existing crc32 test passes
byte-for-byte on every commit of this series).
## Testing
Board sim:sim/crypto, with the companion test PR in nuttx-apps:
* `crc32` legacy: 8/8 vectors unchanged
* `crc32` parameterized: 40/40 (four 5-field vectors + one 12-byte MPEG-2
vector, each with one-shot and split updates)
* `crc8`: 40/40 (SAE J1850, AUTOSAR, ROHC, two reflected-input cases)
* `crc16`: 32/32 (CCITT/KERMIT, CCITT-FALSE, IBM, XMODEM)
All vectors extracted from the source tree with a script and verified on the
host first. Regression: aescbc, hmac, aescmac, aesctr, aesxts, des3cbc,
chacha20, chachapoly all pass.
`tools/checkpatch.sh -c -u -m -g <base>..HEAD` passes; `tools/refresh.sh
--silent sim:crypto` reports no defconfig change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]