Skip to content

Unit tests fail in Fedora 42 with distro's OpenSSL 3.2.4 #266

Open
@dagood

Description

@dagood

My dev machine happens to be Fedora, and I noticed that the tests aren't working for me at ca56270. But... I checked all the tags since v2.0.0 and none of them succeeded with the current Fedora OpenSSL version, so this might just be some Fedora build quirk that might not be worth accounting for in the test suite.

To try to avoid env factors, I repro'd with a Dockerfile. Output from podman build . > build.log:

STEP 7/7: RUN go1.24.1 test ./...
Using libcrypto.so.3
OpenSSL version: OpenSSL 3.2.4 11 Feb 2025
FIPS enabled: true
FIPS capable: true
--- FAIL: TestRSAEncryptDecryptPKCS1 (0.00s)
    --- FAIL: TestRSAEncryptDecryptPKCS1/2048 (0.02s)
        rsa_test.go:33: EncryptPKCS1v15: EVP_PKEY_encrypt
            openssl error(s):
            error:1C8000A5:Provider routines::illegal or unsupported padding mode
            	providers/implementations/asymciphers/rsa_enc.c:166
    --- FAIL: TestRSAEncryptDecryptPKCS1/3072 (0.14s)
        rsa_test.go:33: EncryptPKCS1v15: EVP_PKEY_encrypt
            openssl error(s):
            error:1C8000A5:Provider routines::illegal or unsupported padding mode
            	providers/implementations/asymciphers/rsa_enc.c:166
--- FAIL: TestRSAEncryptDecryptPKCS1_MissingPrecomputedValues (0.15s)
    --- FAIL: TestRSAEncryptDecryptPKCS1_MissingPrecomputedValues/dp=true,dq=true,qinv=false (0.00s)
        rsa_test.go:33: EncryptPKCS1v15: EVP_PKEY_encrypt
            openssl error(s):
            error:1C8000A5:Provider routines::illegal or unsupported padding mode
            	providers/implementations/asymciphers/rsa_enc.c:166
    --- FAIL: TestRSAEncryptDecryptPKCS1_MissingPrecomputedValues/dp=false,dq=false,qinv=true (0.00s)
        rsa_test.go:33: EncryptPKCS1v15: EVP_PKEY_encrypt
            openssl error(s):
            error:1C8000A5:Provider routines::illegal or unsupported padding mode
            	providers/implementations/asymciphers/rsa_enc.c:166
    --- FAIL: TestRSAEncryptDecryptPKCS1_MissingPrecomputedValues/dp=false,dq=true,qinv=false (0.00s)
        rsa_test.go:33: EncryptPKCS1v15: EVP_PKEY_encrypt
            openssl error(s):
            error:1C8000A5:Provider routines::illegal or unsupported padding mode
            	providers/implementations/asymciphers/rsa_enc.c:166
    --- FAIL: TestRSAEncryptDecryptPKCS1_MissingPrecomputedValues/dp=true,dq=false,qinv=false (0.00s)
        rsa_test.go:33: EncryptPKCS1v15: EVP_PKEY_encrypt
            openssl error(s):
            error:1C8000A5:Provider routines::illegal or unsupported padding mode
            	providers/implementations/asymciphers/rsa_enc.c:166
    --- FAIL: TestRSAEncryptDecryptPKCS1_MissingPrecomputedValues/dp=false,dq=true,qinv=true (0.00s)
        rsa_test.go:33: EncryptPKCS1v15: EVP_PKEY_encrypt
            openssl error(s):
            error:1C8000A5:Provider routines::illegal or unsupported padding mode
            	providers/implementations/asymciphers/rsa_enc.c:166
    --- FAIL: TestRSAEncryptDecryptPKCS1_MissingPrecomputedValues/dp=true,dq=true,qinv=true (0.00s)
        rsa_test.go:33: EncryptPKCS1v15: EVP_PKEY_encrypt
            openssl error(s):
            error:1C8000A5:Provider routines::illegal or unsupported padding mode
            	providers/implementations/asymciphers/rsa_enc.c:166
    --- FAIL: TestRSAEncryptDecryptPKCS1_MissingPrecomputedValues/dp=true,dq=false,qinv=true (0.00s)
        rsa_test.go:33: EncryptPKCS1v15: EVP_PKEY_encrypt
            openssl error(s):
            error:1C8000A5:Provider routines::illegal or unsupported padding mode
            	providers/implementations/asymciphers/rsa_enc.c:166
    --- FAIL: TestRSAEncryptDecryptPKCS1_MissingPrecomputedValues/dp=false,dq=false,qinv=false (0.00s)
        rsa_test.go:33: EncryptPKCS1v15: EVP_PKEY_encrypt
            openssl error(s):
            error:1C8000A5:Provider routines::illegal or unsupported padding mode
            	providers/implementations/asymciphers/rsa_enc.c:166
FAIL
FAIL	github.com/golang-fips/openssl/v2	1.086s
?   	github.com/golang-fips/openssl/v2/bbig	[no test files]
?   	github.com/golang-fips/openssl/v2/cmd/checkheader	[no test files]
?   	github.com/golang-fips/openssl/v2/cmd/genaesmodes	[no test files]
?   	github.com/golang-fips/openssl/v2/cmd/gentestvectors	[no test files]
?   	github.com/golang-fips/openssl/v2/cmd/mkcgo	[no test files]
?   	github.com/golang-fips/openssl/v2/internal/cryptotest	[no test files]
?   	github.com/golang-fips/openssl/v2/internal/mkcgo	[no test files]
FAIL

(The errors emitted also contain many trailing nul characters that I had to remove from the file (build.log) to make copy-paste work. Maybe we aren't converting C string OpenSSL errors to Go strings properly? (Edit: fixed by #265.))

The Dockerfile:

FROM fedora:42

RUN dnf install -y \
        ca-certificates \
        git \
        gcc \
        golang \
    && dnf clean all

ENV PATH="/root/go/bin:${PATH}"

RUN go install golang.org/dl/go1.24.1@latest \
    && go1.24.1 download

ADD . /w
WORKDIR /w

RUN go1.24.1 test ./...

A similar Dockerfile based on buildpack-deps:bookworm (debian) seems to work fine.

Working Dockerfile
FROM buildpack-deps:bookworm

RUN apt update && apt install -y \
        ca-certificates \
        git \
        gcc \
        golang \
    && apt clean all

ENV PATH="/root/go/bin:${PATH}"

RUN go install golang.org/dl/go1.24.1@latest \
    && go1.24.1 download

ADD . /w
WORKDIR /w

RUN go1.24.1 test ./...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions