ThePassionate opened a new pull request, #3996: URL: https://github.com/apache/nuttx-apps/pull/3996
## Summary The `hmac` crypto test fails two HMAC-SHA224 cases on current master: ``` 8: hmac mismatch 1bf1c20e5b2e253f51395e1f22e15206b399241d72a9a1a4602d3e31 95e9a0db962095adaebe9b2d6f0dbce2d499f112f2d2b7273fa6870e match sha224 failed 8: hmac mismatch 767df35c24cd61a4d7d3f0f4c3a2f253998a1e4a4e54223c19951410 3a854166ac5d9f023f54d517d0b39dbd946770db9c2b95c9f6f565d1 match sha224 failed ``` The first line of each pair is the expected value in `sha224_result[]`, the second is what /dev/crypto returns. These are the two 131-byte key cases (key = 0xaa x 131), which are exactly RFC 4231 test cases 6 and 7. The values returned by /dev/crypto match RFC 4231 and Python's `hmac.new(key, msg, hashlib.sha224)`; the expected values in the test do not. This PR replaces `sha224_result[3]` and `sha224_result[4]` with the RFC 4231 values. I recomputed all 20 expected values in the test (MD5/SHA1/SHA224/SHA256 x 5 cases) with Python `hmac`, and these two were the only mismatches. ## Impact Test data only (testing/drivers/crypto/hmac.c). No change to the kernel, build or any other test. ## Testing Host: Ubuntu 22.04.5 LTS, x86_64, gcc 13.1.0, cmake 3.23.0, ninja Board: sim:crypto nuttx: master 066314c6373 (unmodified) apps: master 8c8152915 + this PR ``` cmake -S nuttx -B build -G Ninja -DBOARD_CONFIG=sim:crypto -DNUTTX_APPS_DIR=../apps # CONFIG_NSH_BUILTIN_APPS=y so that hmac can be run from nsh cmake --build build ./build/nuttx ``` Before (apps master): ``` nsh> hmac hmac md5 success x5 hmac sha1 success x5 hmac sha224 success x3 8: hmac mismatch ... match sha224 failed 8: hmac mismatch ... match sha224 failed hmac sha256 success x5 ``` After (this PR): ``` nsh> hmac hmac md5 success hmac md5 success hmac md5 success hmac md5 success hmac md5 success hmac sha1 success hmac sha1 success hmac sha1 success hmac sha1 success hmac sha1 success hmac sha224 success hmac sha224 success hmac sha224 success hmac sha224 success hmac sha224 success hmac sha256 success hmac sha256 success hmac sha256 success hmac sha256 success hmac sha256 success ``` -- 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]
