Fix MD5 hash mismatch on big-endian systems (s390x)#177
Open
Anemptyship wants to merge 3 commits intoAcademySoftwareFoundation:mainfrom
Open
Fix MD5 hash mismatch on big-endian systems (s390x)#177Anemptyship wants to merge 3 commits intoAcademySoftwareFoundation:mainfrom
Anemptyship wants to merge 3 commits intoAcademySoftwareFoundation:mainfrom
Conversation
- Make md5_trans() endian-safe by explicitly decoding bytes to u32 words - Use compile-time check to preserve zero-copy performance on little-endian - Fix md5_finish() to write length and digest in little-endian byte order - Add md5_update_16() for safe 16-bit pixel data processing Signed-off-by: Anemptyship <hanbin1931@gmail.com>
|
successfully tested on my s390x system, thanks |
Contributor
|
Tested on Fedora rawhide (44) on our s390x builders, works fine! |
- oapv_port.h: Introduce cross-platform endianness swap and conversion macros (OAPV_SWAP*, OAPV_LE32_TO_CPU). - oapv_util.c: Replace manual byte swapping with new macros in MD5 transform to improve readability and maintainability. - Standardize endianness handling across the codebase. Signed-off-by: Anemptyship <hanbin1931@gmail.com>
- Add cross-compilation job for s390x using QEMU - Increase test timeouts in CMakeLists.txt for emulated environment Signed-off-by: Anemptyship <hanbin1931@gmail.com>
Contributor
Author
|
Refactor Endianness Handling
CI Update
|
Contributor
Author
|
@kpchoi @dariusz-f |
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.
Fixes #149
Summary
Fix test failures on s390x (big-endian) architecture where MD5 hash verification failed with
hash:mismatcherrors.Root Cause
The existing MD5 implementation in src/oapv_util.c was not endian-safe. It cast byte arrays directly to
u32*pointers, causing data to be interpreted in host byte order instead of the little-endian order required by the MD5 specification (RFC 1321).Changes
const u8 *and decode bytes tou32words explicitly in little-endian order.#ifdef __BYTE_ORDER__to preserve zero-copy performance on little-endian systems (x86/ARM).Testing