Skip to content

Aws::Utils::HashingUtils::CalculateMD5() returns empty ByteBuffer on SLES15SP7 ARM64 (aarch64) with OpenSSL 3.2.3 #3594

@hqho

Description

@hqho

Describe the bug

On SLES15SP7 aarch64 (ARM64) with system OpenSSL 3.2.3 and libcurl 8.14.1, calling Aws::Utils::HashingUtils::CalculateMD5() returns an empty Aws::Utils::ByteBuffer (length = 0). This causes S3 multi-delete requests (which require Content-MD5) to be sent with an empty MD5 header and fail with InvalidDigest: The Content-MD5 you specified was invalid. The same SDK + OpenSSL configuration works on x86_64 SP7; the bug appears specific to ARM64 SP7.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

=== Platform Information ===
Architecture: x86_64
OpenSSL version: OpenSSL 3.2.3 3 Sep 2024

=== MD5 Calculation Test ===
Test payload: test-object-1test-object-2
Payload size: 137 bytes

Calling Aws::Utils::HashingUtils::CalculateMD5()...
MD5 ByteBuffer length: 16 (expected: 16)
SUCCESS: MD5 calculation returned correct length
Base64 MD5: kaK1wnr5JyA5xE9bdzBuiw==
Base64 length: 24 (expected: 24)

Current Behavior

=== Platform Information ===
Architecture: ARM64 (aarch64)
OpenSSL version: OpenSSL 3.2.3 3 Sep 2024

=== MD5 Calculation Test ===
Test payload: test-object-1test-object-2
Payload size: 137 bytes

Calling Aws::Utils::HashingUtils::CalculateMD5()...
MD5 ByteBuffer length: 0 (expected: 16)
ERROR: CalculateMD5() returned EMPTY ByteBuffer!

Reproduction Steps

#include <iostream>
#include <string>
#include <aws/core/Aws.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <openssl/opensslv.h>

int main(int argc, char* argv[]) {
    // Initialize AWS SDK
    Aws::SDKOptions options;
    Aws::InitAPI(options);

    // Print platform and OpenSSL info
    std::cout << "=== Platform Information ===" << std::endl;
#ifdef __aarch64__
    std::cout << "Architecture: ARM64 (aarch64)" << std::endl;
#elif defined(__x86_64__)
    std::cout << "Architecture: x86_64" << std::endl;
#else
    std::cout << "Architecture: Unknown" << std::endl;
#endif

    std::cout << "OpenSSL version: " << OPENSSL_VERSION_TEXT << std::endl;
    std::cout << std::endl;

    // Test payload (similar to DeleteObjects XML)
    std::string test_payload = 
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
        "<Delete>"
        "<Object><Key>test-object-1</Key></Object>"
        "<Object><Key>test-object-2</Key></Object>"
        "</Delete>";

    std::cout << "=== MD5 Calculation Test ===" << std::endl;
    std::cout << "Test payload: " << test_payload << std::endl;
    std::cout << "Payload size: " << test_payload.length() << " bytes" << std::endl;
    std::cout << std::endl;

    // Calculate MD5 using AWS SDK
    std::cout << "Calling Aws::Utils::HashingUtils::CalculateMD5()..." << std::endl;
    auto md5_bytebuffer = Aws::Utils::HashingUtils::CalculateMD5(test_payload);
    
    std::cout << "MD5 ByteBuffer length: " << md5_bytebuffer.GetLength() 
              << " (expected: 16)" << std::endl;

    if (md5_bytebuffer.GetLength() == 0) {
        std::cout << "ERROR: CalculateMD5() returned EMPTY ByteBuffer!" << std::endl;
    } else if (md5_bytebuffer.GetLength() == 16) {
        std::cout << "✓ SUCCESS: MD5 calculation returned correct length" << std::endl;
        
        // Calculate Base64 encoding
        auto base64_md5 = Aws::Utils::HashingUtils::Base64Encode(md5_bytebuffer);
        std::cout << "Base64 MD5: " << base64_md5.c_str() << std::endl;
        std::cout << "Base64 length: " << base64_md5.length() << " (expected: 24)" << std::endl;
    } else {
        std::cout << "ERROR: Unexpected MD5 ByteBuffer length!" << std::endl;
    }

    std::cout << std::endl;

    // Cleanup AWS SDK
    Aws::ShutdownAPI(options);

    return (md5_bytebuffer.GetLength() == 16) ? 0 : 1;
}

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### AWS CPP SDK version used

1.11.630

### Compiler and Version used

gcc (SUSE Linux) 14.3.0

### Operating System and version

SLES15SP7

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.response-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 10 days.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions