Skip to content

OpenSSL 1.1.1t: 32-bit builds using Visual Studio compiler broken #20280

Closed
@Dani-Hub

Description

@Dani-Hub

When attempting to build the recent 1.1.1t release sources from scratch using Visual Studio (In my example: VS 2019) under 32-bit, I'm getting the following build error:

[INFO] libcrypto-1_1.lib(rsa_sup_mul.obj) : error LNK2019: unresolved external symbol __umul128 referenced in function __mul_limb [XXX\win32-x86-vc142\apps\openssl.vcxproj]
[INFO] XXX\bin\openssl\win32-x86-vc142\Debug\openssl.exe : fatal error LNK1120: 1 unresolved externals [XXX\win32-x86-vc142\apps\openssl.vcxproj]
[INFO] ExitValue: 1

The root of the problem becomes more evident by the following preceding warning:

[INFO] XXX\src\crypto\bn\rsa_sup_mul.c(114,9): warning C4163: '_umul128': not available as an intrinsic function [XXX\win32-x86-vc142\crypto\crypto.vcxproj]

So, it seems that the existing preprocessor conditional in line 112 of /crypto/bn/rsa_sup_mul.c,

#elif (BN_BYTES == 8) && (defined _MSC_VER)

is insufficient to be entered for a 32-bit build and according to the referred to Microsoft documentation https://learn.microsoft.com/en-us/cpp/intrinsics/umul128?view=msvc-170 the _umul128 intrinsic is only on 64-bit available. I got the build fixed by extending the conditional to

#elif (BN_BYTES == 8) && (defined _MSC_VER) && defined(_WIN64)

which solved the problem.

I'm prepared to make a corresponding PULL request, if the direction of the fix seems plausible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    resolved: answeredThe issue contained a question which has been answeredtriaged: questionThe issue contains a question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions