Skip to content

Commit

Permalink
crypto: add CFRG curves to Web Crypto API
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Aug 24, 2022
1 parent 7176048 commit 6671ea4
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 5 deletions.
2 changes: 0 additions & 2 deletions lib/asar/fs-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,6 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
return Promise.resolve(archive.stat(filePath) !== false);
};

console.log(fs);

const { existsSync } = fs;
fs.existsSync = (pathArgument: string) => {
const pathInfo = splitPath(pathArgument);
Expand Down
47 changes: 45 additions & 2 deletions patches/node/fix_crypto_tests_to_run_with_bssl.patch
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ index b06f2fa2c53ea72f9a66f0d002dd9281d0259a0f..864fffeebfad75d95416fd47efdea7f2

const server = https.createServer(opts, (req, res) => {
diff --git a/test/parallel/test-webcrypto-derivebits.js b/test/parallel/test-webcrypto-derivebits.js
index 442423954b10b2ee1696eb7db56eaa4c88492122..93bdf4d33e440d2506605473f9f8611a548ae48b 100644
index 442423954b10b2ee1696eb7db56eaa4c88492122..c65610245e7e328d5e844afc48f8f685c49be3b7 100644
--- a/test/parallel/test-webcrypto-derivebits.js
+++ b/test/parallel/test-webcrypto-derivebits.js
@@ -37,6 +37,7 @@ const { subtle } = require('crypto').webcrypto;
Expand All @@ -967,8 +967,21 @@ index 442423954b10b2ee1696eb7db56eaa4c88492122..93bdf4d33e440d2506605473f9f8611a

// Test PBKDF2 bit derivation
{
@@ -101,6 +103,7 @@ const { subtle } = require('crypto').webcrypto;
tests.then(common.mustCall());
}

+/*
// Test X25519 and X448 bit derivation
{
async function test(name) {
@@ -126,3 +129,4 @@ const { subtle } = require('crypto').webcrypto;
test('X25519').then(common.mustCall());
test('X448').then(common.mustCall());
}
+*/
diff --git a/test/parallel/test-webcrypto-derivekey.js b/test/parallel/test-webcrypto-derivekey.js
index f8eb996000ec899abafbfd558f4f49bad2c69c9a..4c68dbf42f965e02e224af4dfb4368b717c7fec7 100644
index f8eb996000ec899abafbfd558f4f49bad2c69c9a..0bf5c7811eeccff6194d8df41887df0a86a53823 100644
--- a/test/parallel/test-webcrypto-derivekey.js
+++ b/test/parallel/test-webcrypto-derivekey.js
@@ -46,6 +46,7 @@ const { webcrypto: { subtle }, KeyObject } = require('crypto');
Expand All @@ -987,6 +1000,19 @@ index f8eb996000ec899abafbfd558f4f49bad2c69c9a..4c68dbf42f965e02e224af4dfb4368b7

// Test PBKDF2 key derivation
{
@@ -151,6 +153,7 @@ const { webcrypto: { subtle }, KeyObject } = require('crypto');
})().then(common.mustCall());
}

+/*
// Test X25519 and X448 key derivation
{
async function test(name) {
@@ -185,3 +188,4 @@ const { webcrypto: { subtle }, KeyObject } = require('crypto');
test('X25519').then(common.mustCall());
test('X448').then(common.mustCall());
}
+*/
diff --git a/test/parallel/test-webcrypto-encrypt-decrypt-rsa.js b/test/parallel/test-webcrypto-encrypt-decrypt-rsa.js
index 151eebd36c9765df086a020ba42920b2442b1b77..efe97ff2499cba909ac5500d827364fa389a0469 100644
--- a/test/parallel/test-webcrypto-encrypt-decrypt-rsa.js
Expand All @@ -1000,6 +1026,23 @@ index 151eebd36c9765df086a020ba42920b2442b1b77..efe97ff2499cba909ac5500d827364fa
});
}

diff --git a/test/parallel/test-webcrypto-sign-verify.js b/test/parallel/test-webcrypto-sign-verify.js
index 6c6b15781549a4b37781bf0b8014054dc5d8c746..142d41b169c836201660d78c19383f3ffc469407 100644
--- a/test/parallel/test-webcrypto-sign-verify.js
+++ b/test/parallel/test-webcrypto-sign-verify.js
@@ -105,6 +105,7 @@ const { subtle } = require('crypto').webcrypto;
test('hello world').then(common.mustCall());
}

+/*
// Test Sign/Verify Ed25519
{
async function test(data) {
@@ -144,3 +145,4 @@ const { subtle } = require('crypto').webcrypto;

test('hello world').then(common.mustCall());
}
+*/
diff --git a/test/parallel/test-webcrypto-wrap-unwrap.js b/test/parallel/test-webcrypto-wrap-unwrap.js
index 1094845c73e14313860ad476fb7baba2a11b5af4..51972b4b34b191ac59145889dbf2da5c0d407dbe 100644
--- a/test/parallel/test-webcrypto-wrap-unwrap.js
Expand Down
5 changes: 4 additions & 1 deletion script/node-disabled-tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,17 @@
"parallel/test-trace-events-worker-metadata",
"parallel/test-v8-untrusted-code-mitigations",
"parallel/test-webcrypto-derivebits-node-dh",
"parallel/test-webcrypto-derivebits-cfrg",
"parallel/test-webcrypto-derivekey-cfrg",
"parallel/test-webcrypto-ed25519-ed448",
"parallel/test-webcrypto-encrypt-decrypt",
"parallel/test-webcrypto-encrypt-decrypt-aes",
"parallel/test-webcrypto-encrypt-decrypt-rsa",
"parallel/test-webcrypto-export-import-cfrg",
"parallel/test-webcrypto-keygen",
"parallel/test-webcrypto-rsa-pss-params",
"parallel/test-webcrypto-sign-verify-node-dsa",
"parallel/test-webcrypto-x25519-x448",
"parallel/test-webcrypto-sign-verify-eddsa",
"parallel/test-worker-debug",
"parallel/test-worker-stdio",
"parallel/test-zlib-unused-weak",
Expand Down

0 comments on commit 6671ea4

Please sign in to comment.