Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MD5 symbols missing from Windows library #45445

Closed
mohd-akram opened this issue Nov 13, 2022 · 3 comments · Fixed by #45486
Closed

MD5 symbols missing from Windows library #45445

mohd-akram opened this issue Nov 13, 2022 · 3 comments · Fixed by #45486

Comments

@mohd-akram
Copy link
Contributor

Version

v18.12.1

Platform

Microsoft Windows NT 10.0.22000.0 x64

Subsystem

No response

What steps will reproduce the bug?

  1. Run node-gyp rebuild on Windows

md5.c:

#include <openssl/md5.h>

void hash(void)
{
        MD5_CTX c;
        MD5_Init(&c);
        MD5_Update(&c, NULL, 0);
        MD5_Final(NULL, &c);
}

binding.gyp:

{ 'targets': [{ 'target_name': 'md5', 'sources': ['md5.c'] }] }

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior?

Builds successfully as it does on other platforms (and Node.js 16 on Windows).

What do you see instead?

md5.obj : error LNK2001: unresolved external symbol MD5_Update [C:\Users\User\Development\md5\build\md5.vcxproj]
md5.obj : error LNK2001: unresolved external symbol MD5_Final [C:\Users\User\Development\md5\build\md5.vcxproj]
md5.obj : error LNK2001: unresolved external symbol MD5_Init [C:\Users\User\Development\md5\build\md5.vcxproj]

Additional information

No response

@bnoordhuis
Copy link
Member

bnoordhuis commented Nov 13, 2022

That's because the MD5_*() family of functions has been deprecated in openssl 3.0.

That could be fixed by adding DEPRECATEDIN_3_0 to mkssldef_flags in node.gyp but that also enables a ton of other deprecated stuff (edit: over 1,000 extra symbols.)

It's probably better to use the EVP interface, EVP_md5().

diff --git a/node.gyp b/node.gyp
index a22af3b479a..07a7cbd5536 100644
--- a/node.gyp
+++ b/node.gyp
@@ -823,7 +823,8 @@
               '-CAES,BF,BIO,DES,DH,DSA,EC,ECDH,ECDSA,ENGINE,EVP,HMAC,MD4,MD5,'
               'PSK,RC2,RC4,RSA,SHA,SHA0,SHA1,SHA256,SHA512,SOCK,STDIO,TLSEXT,'
               'UI,FP_API,TLS1_METHOD,TLS1_1_METHOD,TLS1_2_METHOD,SCRYPT,OCSP,'
-              'NEXTPROTONEG,RMD160,CAST,DEPRECATEDIN_1_1_0,DEPRECATEDIN_1_2_0',
+              'NEXTPROTONEG,RMD160,CAST,DEPRECATEDIN_1_1_0,DEPRECATEDIN_1_2_0,'
+              'DEPRECATEDIN_3_0',
               # Defines.
               '-DWIN32',
               # Symbols to filter from the export list.

@mohd-akram
Copy link
Contributor Author

The code that's using it is not mine, it's in a library. Looking at it another way, that's 1,000+ incompatibilities between Node.js on Windows and other platforms :D, and compiling on Windows is already painful.

@bnoordhuis
Copy link
Member

You're welcome to open a pull request and see how it's received. libopenssl.a is exported with -Wl,--whole-archive on linux so it's reasonable to do something similar on windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants