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

add wasm md4 implementation #14584

Merged
merged 6 commits into from Oct 28, 2021
Merged

add wasm md4 implementation #14584

merged 6 commits into from Oct 28, 2021

Conversation

sokra
Copy link
Member

@sokra sokra commented Oct 27, 2021

expose createHash is loader context

fixes #14532

What kind of change does this PR introduce?
bugfix

Did you add tests for your changes?
yes

Does this PR introduce a breaking change?
no

What needs to be documented once your changes are merged?
nothing

@webpack-bot
Copy link
Contributor

For maintainers only:

  • This needs to be documented (issue in webpack/webpack.js.org will be filed when merged)
  • This needs to be backported to webpack 4 (issue will be created when merged)

expose createHash is loader context
@webpack-bot
Copy link
Contributor

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

@thecrypticace
Copy link

Passing note: I think this will need to be shared with / updated in loader-utils 2.x that used md4 in getHashDigest as well. I noticed that the Node 17 output.hashFunction fix doesn't work for when using css modules because of css-loader defaultGetLocalIdent -> loader-utils interpolateName -> loader-utils getHashDigest with md4.

}

function body(size: u32): void {
let _A = A;
Copy link
Member

@vankop vankop Oct 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just interesting what is a reason of this variables? (you can use A,B,C,D) same for a,b,c,d
using in current block reduce module size?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A is a global and _A a local var. I tried to avoid accessing globals too often

digest(type) {
const { exports, buffered, mem, digestSize } = this;
exports.final(buffered);
this.instancesPool.push(this);
Copy link
Member

@vankop vankop Oct 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe instancesPool does not make much sense.. 64kb ram is a lot =)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they are not pooled this would call new WebAssembly.Instance very often. I assumed that might be expensive, but I can try to benchmark if that's true.

@@ -539,7 +539,9 @@ class NormalModule extends Module {
? getContextifyInContext()(request)
: getContextify()(context, request);
},
createHash
createHash: type => {
return createHash(type || compilation.outputOptions.hashFunction);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@sokra sokra merged commit 0f6c78c into main Oct 28, 2021
@sokra sokra deleted the hash/md4 branch October 28, 2021 20:58
nullterminated added a commit to nullterminated/chrome-extension-typescript-starter that referenced this pull request May 5, 2022
When using latest node, webpack produces an error,

Error: error:0308010C:digital envelope routines::unsupported

webpack/webpack#14532

This is due to the webpack version being 5.53.0 when running npm install.  The error is fixed in 5.61.0 by the following merged pull request,

webpack/webpack#14584

https://github.com/webpack/webpack/releases/tag/v5.61.0

When I set 5.61.0 as the minimum I now get 5.72.0 version which is latest. Build completes without error.
archlinux-github pushed a commit to archlinux/svntogit-community that referenced this pull request Nov 5, 2022
webpack reports an error with OpenSSL 3 [1] as webpack uses md4, which
is available only from the legacy provider. Newer webpack adds a wasm
implementation of md4 [2], while buildbot uses very old webpack [3].

[1] webpack/webpack#14532
[2] webpack/webpack#14584
[3] https://github.com/buildbot/buildbot/blob/v3.6.1/www/build_common/package.json#L35

git-svn-id: file:///srv/repos/svn-community/svn@1342283 9fca08f4-af9d-4005-b8df-a31f2cc04f65
archlinux-github pushed a commit to archlinux/svntogit-community that referenced this pull request Nov 5, 2022
webpack reports an error with OpenSSL 3 [1] as webpack uses md4, which
is available only from the legacy provider. Newer webpack adds a wasm
implementation of md4 [2], while buildbot uses very old webpack [3].

[1] webpack/webpack#14532
[2] webpack/webpack#14584
[3] https://github.com/buildbot/buildbot/blob/v3.6.1/www/build_common/package.json#L35



git-svn-id: file:///srv/repos/svn-community/svn@1342283 9fca08f4-af9d-4005-b8df-a31f2cc04f65
BrycenG007 pushed a commit to BrycenG007/chrome-extension-template that referenced this pull request Mar 31, 2023
When using latest node, webpack produces an error,

Error: error:0308010C:digital envelope routines::unsupported

webpack/webpack#14532

This is due to the webpack version being 5.53.0 when running npm install.  The error is fixed in 5.61.0 by the following merged pull request,

webpack/webpack#14584

https://github.com/webpack/webpack/releases/tag/v5.61.0

When I set 5.61.0 as the minimum I now get 5.72.0 version which is latest. Build completes without error.
PrettyBabyMiki added a commit to PrettyBabyMiki/React-extension that referenced this pull request Apr 1, 2023
When using latest node, webpack produces an error,

Error: error:0308010C:digital envelope routines::unsupported

webpack/webpack#14532

This is due to the webpack version being 5.53.0 when running npm install.  The error is fixed in 5.61.0 by the following merged pull request,

webpack/webpack#14584

https://github.com/webpack/webpack/releases/tag/v5.61.0

When I set 5.61.0 as the minimum I now get 5.72.0 version which is latest. Build completes without error.
EliasSbehat pushed a commit to EliasSbehat/chrome_extension_TS_boilerplate that referenced this pull request Apr 24, 2023
When using latest node, webpack produces an error,

Error: error:0308010C:digital envelope routines::unsupported

webpack/webpack#14532

This is due to the webpack version being 5.53.0 when running npm install.  The error is fixed in 5.61.0 by the following merged pull request,

webpack/webpack#14584

https://github.com/webpack/webpack/releases/tag/v5.61.0

When I set 5.61.0 as the minimum I now get 5.72.0 version which is latest. Build completes without error.
dragonworr added a commit to dragonworr/chrome-extension-typescript-starter that referenced this pull request Jun 14, 2023
When using latest node, webpack produces an error,

Error: error:0308010C:digital envelope routines::unsupported

webpack/webpack#14532

This is due to the webpack version being 5.53.0 when running npm install.  The error is fixed in 5.61.0 by the following merged pull request,

webpack/webpack#14584

https://github.com/webpack/webpack/releases/tag/v5.61.0

When I set 5.61.0 as the minimum I now get 5.72.0 version which is latest. Build completes without error.
mt-dfrey added a commit to moneytree/mt-link-javascript-sdk that referenced this pull request Oct 5, 2023
node 17 switched to openssl 3, which has some incompatibilities with
older versions, see https://nodejs.org/en/blog/release/v17.0.0#openssl-3-0

webpack 4 relies on the older openssl version, only webpack 5 and newer
uses openssl 3, see
webpack/webpack#14532 (comment)
webpack/webpack#14584

That's why we use the --openssl-legacy-provider node option when running
webpack.
mt-dfrey added a commit to moneytree/mt-link-javascript-sdk that referenced this pull request Oct 5, 2023
node 17 switched to openssl 3, which has some incompatibilities with
older versions, see https://nodejs.org/en/blog/release/v17.0.0#openssl-3-0

webpack 4 relies on the older openssl version, only webpack 5 and newer
uses openssl 3, see
webpack/webpack#14532 (comment)
webpack/webpack#14584

That's why we use the --openssl-legacy-provider node option when running
webpack.
luca-vari added a commit to AnikaLegal/intake that referenced this pull request Nov 14, 2023
Node v17.0.0 changed to use OpenSSL 3.0 which no longer allows certain hashing
algorithms by default. This breaks the version of webpack and, as a
consequence, storybook we are currently using as it uses one of the now
disallowed algorithms (MD4). This is fixed in later versions of webpack where
support was added to generate MD4 hashs directly rather than via OpenSSL.

To resolve this in webpack I have updated to the earliest version that contains
their fix, v4.47.0. This version was chosen rather than a more recent version
so we don't have to update all of our dependencies at this time.

I have used a different approach for storybook as it would require considerable
time and effort to update to a version that uses a fixed version of webpack. We
just allow OpenSSL to use "legacy" algorithms using the
NODE_OPTIONS=--openssl-legacy-provider environment variable.

See for discussion:

- https://stackoverflow.com/a/73027407
- webpack/webpack#14532
- https://nodejs.org/en/blog/release/v17.0.0#openssl-30

See for fix in webpack:

- webpack/webpack#14584
- https://github.com/webpack/webpack/releases/tag/v4.47.0
luca-vari added a commit to AnikaLegal/intake that referenced this pull request Nov 14, 2023
* Resolve "error:0308010C:digital envelope routines::unsupported"

Node v17.0.0 changed to use OpenSSL 3.0 which no longer allows certain hashing
algorithms by default. This breaks the version of webpack and, as a
consequence, storybook we are currently using as it uses one of the 
now-disallowed algorithms (MD4). This is fixed in later versions of webpack where
support was added to generate MD4 hashs directly rather than via OpenSSL.

To resolve this in webpack I have updated to the earliest version that contains
their fix, v4.47.0. This version was chosen rather than a more recent version
so we don't have to update all of our dependencies at this time.

I have used a different approach for storybook as it would require considerable
time and effort to update to a version that uses a fixed version of webpack. We
just allow OpenSSL to use "legacy" algorithms using the
NODE_OPTIONS=--openssl-legacy-provider environment variable.

See for discussion:

- https://stackoverflow.com/a/73027407
- webpack/webpack#14532
- https://nodejs.org/en/blog/release/v17.0.0#openssl-30

See for fix in webpack:

- webpack/webpack#14584
- https://github.com/webpack/webpack/releases/tag/v4.47.0
LucSPI added a commit to LucSPI/chrome-extension-typescript that referenced this pull request Feb 12, 2024
When using latest node, webpack produces an error,

Error: error:0308010C:digital envelope routines::unsupported

webpack/webpack#14532

This is due to the webpack version being 5.53.0 when running npm install.  The error is fixed in 5.61.0 by the following merged pull request,

webpack/webpack#14584

https://github.com/webpack/webpack/releases/tag/v5.61.0

When I set 5.61.0 as the minimum I now get 5.72.0 version which is latest. Build completes without error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nodejs 17: digital envelope routines::unsupported
5 participants