Hack webpack to not use MD4
OpenSSL 3 removed support for MD4, the default hashFunction.
As the issue describes, the proper fix here is to move to webpack 5.
Moving to webpack 5 requires numerous changes.
Attempted moving to webpack 5 but migration requires a ton of changes.
This solution is from:
https://github.com/webpack/webpack/issues/13572#issuecomment-923736472
This should enable the new Yocto bump to pass.
Tested: npm install && npm run-script build and loaded those onto a
Witherspoon system. Yocto bump with this change built.
Change-Id: I5818fc49c8e0f0df7911edc069ff75a9b047dd21
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/webpack.config.js b/webpack.config.js
index 58bf47d..2a3ce85 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,5 +1,14 @@
'use strict';
+// OpenSSL 3 does not support md4, webpack 4 hardcodes md4 in many places
+// https://github.com/webpack/webpack/issues/13572#issuecomment-923736472
+// As the issue suggests we should update to webpack 5, doing so requires a lot
+// of changes. TODO: Remove after updating to webpack v5.54.0+
+const crypto = require('crypto');
+const crypto_orig_createHash = crypto.createHash;
+crypto.createHash = algorithm =>
+ crypto_orig_createHash(algorithm == 'md4' ? 'sha256' : algorithm);
+
// Modules
var webpack = require('webpack');
var autoprefixer = require('autoprefixer');