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

src: move evp stuff to ncrypto #54911

Closed
wants to merge 1 commit into from

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Sep 12, 2024

More incremental moving of crypto stuff to ncrypto ... there's a lot to so I'm chunking it up into smaller, more easily reviewed pieces.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/crypto
  • @nodejs/security-wg

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Sep 12, 2024
@nodejs-github-bot
Copy link
Collaborator

Copy link

codecov bot commented Sep 12, 2024

Codecov Report

Attention: Patch coverage is 70.86093% with 44 lines in your changes missing coverage. Please review.

Project coverage is 88.24%. Comparing base (0c8c107) to head (3f5d3ca).
Report is 54 commits behind head on main.

Files with missing lines Patch % Lines
src/crypto/crypto_ec.cc 61.22% 8 Missing and 11 partials ⚠️
src/crypto/crypto_keys.cc 71.21% 7 Missing and 12 partials ⚠️
src/crypto/crypto_common.cc 75.00% 0 Missing and 3 partials ⚠️
src/crypto/crypto_sig.cc 83.33% 0 Missing and 2 partials ⚠️
src/crypto/crypto_dh.cc 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #54911   +/-   ##
=======================================
  Coverage   88.23%   88.24%           
=======================================
  Files         652      652           
  Lines      183856   183816   -40     
  Branches    35856    35841   -15     
=======================================
- Hits       162229   162208   -21     
+ Misses      14903    14888   -15     
+ Partials     6724     6720    -4     
Files with missing lines Coverage Δ
src/crypto/crypto_cipher.cc 73.40% <100.00%> (ø)
src/crypto/crypto_dsa.cc 58.97% <100.00%> (ø)
src/crypto/crypto_keys.h 56.86% <100.00%> (ø)
src/crypto/crypto_rsa.cc 63.78% <100.00%> (+0.27%) ⬆️
src/crypto/crypto_dh.cc 61.53% <66.66%> (ø)
src/crypto/crypto_sig.cc 71.64% <83.33%> (+0.13%) ⬆️
src/crypto/crypto_common.cc 52.75% <75.00%> (-0.41%) ⬇️
src/crypto/crypto_ec.cc 67.05% <61.22%> (+0.49%) ⬆️
src/crypto/crypto_keys.cc 73.07% <71.21%> (+0.86%) ⬆️

... and 34 files with indirect coverage changes

Comment on lines +854 to +855
if (!error.IsEmpty()) env->isolate()->ThrowException(error);
return false;
Copy link
Member

Choose a reason for hiding this comment

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

You can just return at this point, since 857 is returning true.

default:
return false;
}
return key.id() == EVP_PKEY_ED25519 || key.id() == EVP_PKEY_ED448;
Copy link
Member

Choose a reason for hiding this comment

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

all of these functions can be constexpr

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's separately go through and make these kinds of improvements in one of the follow up PRs

@RedYetiDev RedYetiDev added crypto Issues and PRs related to the crypto subsystem. dependencies Pull requests that update a dependency file. labels Sep 13, 2024
@panva
Copy link
Member

panva commented Sep 14, 2024

@jasnell I feel that all these "move * to ncrypto" PRs that move stuff into a flat file structure are a step back in terms of the crypto subsystem refactoring that you've done in #35093. Do you plan on introducing a structure to it?

It refactors the Node.js src crypto internals so that they are more maintainable and organized.

@jasnell
Copy link
Member Author

jasnell commented Sep 20, 2024

Do you plan on introducing a structure to it?

Yes, once things are moved over to ncrypto, the plan is to restructure ncrypto to makes things cleaner and break things up. It's a bit cumbersome right now given the sheer size of the task and trying to break it down into digestable chunks... but I promise it will come out improved when we're done.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Collaborator

jasnell added a commit that referenced this pull request Sep 23, 2024
PR-URL: #54911
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
@jasnell
Copy link
Member Author

jasnell commented Sep 23, 2024

Landed in c4681d5

@jasnell jasnell closed this Sep 23, 2024
@aduh95 aduh95 added the dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. label Sep 25, 2024
targos pushed a commit that referenced this pull request Oct 4, 2024
PR-URL: #54911
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
@aduh95 aduh95 mentioned this pull request Oct 9, 2024
louwers pushed a commit to louwers/node that referenced this pull request Nov 2, 2024
PR-URL: nodejs#54911
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crypto Issues and PRs related to the crypto subsystem. dependencies Pull requests that update a dependency file. dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants