8000 src: refactor DH groups to delete crypto_groups.h by tniessen · Pull Request #43896 · nodejs/node · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@tniessen
Copy link
Member

Rewrite FindDiffieHellmanGroup() using OpenSSL helper functions to obtain the required constants directly, instead of loading them from our own crypto_groups.h and converting them to BIGNUMs.

This also removes the need for the struct modp_group, so we can delete crypto_groups.h altogether.

cc @nodejs/cpp-reviewers

Rewrite FindDiffieHellmanGroup() using OpenSSL helper functions to
obtain the required constants directly, instead of loading them from
our own crypto_groups.h and converting them to BIGNUMs.

This also removes the need for the struct modp_group, so we can delete
crypto_groups.h altogether.
@tniessen tniessen added crypto Issues and PRs related to the crypto subsystem. lib / src Issues and PRs related to general changes in the lib or src directory. labels Jul 18, 2022
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/crypto

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Jul 18, 2022
@panva panva added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 19, 2022
@github-actions github-actions bot removed t 8000 he request-ci Add this label to start a Jenkins CI on a PR. label Jul 19, 2022
@nodejs-github-bot

This comment was marked as outdated.

@tniessen tniessen removed the lib / src Issues and PRs related to general changes in the lib or src directory. label Jul 19, 2022
@nodejs-github-bot
Copy link
Collaborator

@tniessen
Copy link
Member Author

@nodejs/cpp-reviewers @nodejs/crypto To aid reviews: this PR mainly changes how we obtain the large prime numbers making up standardized DH groups. Instead of defining these constants in crypto_groups.h, we can retrieve the values from OpenSSL.

An existing test guarantees that the constants remain correct:

const hashes = {
modp1: '630e9acd2cc63f7e80d8507624ba60ac0757201a',
modp2: '18f7aa964484137f57bca64b21917a385b6a0b60',
modp5: 'c0a8eec0c2c8a5ec2f9c26f9661eb339a010ec61',
modp14: 'af5455606fe74cec49782bb374e4c63c9b1d132c',
modp15: '7bdd39e5cdbb9748113933e5c2623b559c534e74',
modp16: 'daea5277a7ad0116e734a8e0d2f297ef759d1161',
modp17: '3b62aaf0142c2720f0bf26a9589b0432c00eadc1',
modp18: 'a870b491bbbec9b131ae9878d07449d32e54f160',
};
for (const name in hashes) {
const group = crypto.getDiffieHellman(name);
const private_key = group.getPrime('hex');
const hash1 = hashes[name];
const hash2 = crypto.createHash('sha1')
.update(private_key.toUpperCase()).digest('hex');
assert.strictEqual(hash1, hash2);
assert.strictEqual(group.getGenerator('hex'), '02');
}

@tniessen tniessen added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 23, 2022
tniessen added a commit to tniessen/node that referenced this pull request Jul 25, 2022
Instead of referring users to perl to find information about supported
MODP groups in crypto_groups.h, explicitly list the groups with their
respective strengths and with references to the defining RFC sections.

Refs: nodejs#43896
@tniessen tniessen added the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 25, 2022
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 25, 2022
@nodejs-github-bot nodejs-github-bot merged commit 3e6e908 into nodejs:main Jul 25, 2022
@nodejs-github-bot
Copy link
Collaborator

Landed in 3e6e908

danielleadams pushed a commit that referenced this pull request Jul 26, 2022
Rewrite FindDiffieHellmanGroup() using OpenSSL helper functions to
obtain the required constants directly, instead of loading them from
our own crypto_groups.h and converting them to BIGNUMs.

This also removes the need for the struct modp_group, so we can delete
crypto_groups.h altogether.

PR-URL: #43896
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
@danielleadams danielleadams mentioned this pull request Jul 26, 2022
tniessen added a commit to tniessen/node that referenced this pull request Jul 27, 2022
The referenced header file does not exist anymore.

Refs: nodejs#43896
ruyadorno pushed a commit that referenced this pull request Aug 23, 2022
The referenced header file does not exist anymore.

Refs: #43896

PR-URL: #44012
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Feng Yu <F3n67u@outlook.com>
targos pushed a commit that referenced this pull request Sep 5, 2022
Instead of referring users to perl to find information about supported
MODP groups in crypto_groups.h, explicitly list the groups with their
respective strengths and with references to the defining RFC sections.

Refs: #43896

PR-URL: #43986
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
targos pushed a commit that referenced this pull request Sep 5, 2022
The referenced header file does not exist anymore.

Refs: #43896

PR-URL: #44012
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Feng Yu <F3n67u@outlook.com>
Fyko pushed a commit to Fyko/node that referenced this pull request Sep 15, 2022
Rewrite FindDiffieHellmanGroup() using OpenSSL helper functions to
obtain the required constants directly, instead of loading them from
our own crypto_groups.h and converting them to BIGNUMs.

This also removes the need for the struct modp_group, so we can delete
crypto_groups.h altogether.

PR-URL: nodejs#43896
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Fyko pushed a commit to Fyko/node that referenced this pull request Sep 15, 2022
Instead of referring users to perl to find information about supported
MODP groups in crypto_groups.h, explicitly list the groups with their
respective strengths and with references to the defining RFC sections.

Refs: nodejs#43896

PR-URL: nodejs#43986
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Fyko pushed a commit to Fyko/node that referenced this pull request Sep 15, 2022
The referenced header file does not exist anymore.

Refs: nodejs#43896

PR-URL: nodejs#44012
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Feng Yu <F3n67u@outlook.com>
juanarbol pushed a commit that referenced this pull request Oct 10, 2022
Instead of referring users to perl to find information about supported
MODP groups in crypto_groups.h, explicitly list the groups with their
respective strengths and with references to the defining RFC sections.

Refs: #43896

PR-URL: #43986
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
juanarbol pushed a commit that referenced this pull request Oct 10, 2022
The referenced header file does not exist anymore.

Refs: #43896

PR-URL: #44012
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Feng Yu <F3n67u@outlook.com>
juanarbol pushed a commit that referenced this pull request Oct 11, 2022
Instead of referring users to perl to find information about supported
MODP groups in crypto_groups.h, explicitly list the groups with their
respective strengths and with references to the defining RFC sections.

Refs: #43896

PR-URL: #43986
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
juanarbol pushed a commit that referenced this pull request Oct 11, 2022
The referenced header file does not exist anymore.

Refs: #43896

PR-URL: #44012
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Feng Yu <F3n67u@outlook.com>
codebytere added a commit to electron/electron that referenced this pull request Oct 13, 2022
codebytere added a commit to electron/electron that referenced this pull request Oct 13, 2022
codebytere added a commit to electron/electron that referenced this pull request Oct 13, 2022
codebytere added a commit to electron/electron that referenced this pull request Oct 13, 2022
codebytere added a commit to electron/electron that referenced this pull request Oct 17, 2022
codebytere added a commit to electron/electron that referenced this pull request Oct 19, 2022
codebytere added a commit to electron/electron that referenced this pull request Oct 19, 2022
codebytere added a commit to electron/electron that referenced this pull request Oct 24, 2022
codebytere added a commit to electron/electron that referenced this pull request Nov 8, 2022