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

Open
wants to merge 1 commit into
base: main
Choose a base branch
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.25%. Comparing base (29b9c72) to head (0197af6).

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.25%   +0.01%     
==========================================
  Files         652      652              
  Lines      183855   183815      -40     
  Branches    35849    35835      -14     
==========================================
- Hits       162233   162220      -13     
+ Misses      14908    14890      -18     
+ Partials     6714     6705       -9     
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.51% <100.00%> (ø)
src/crypto/crypto_dh.cc 61.53% <66.66%> (ø)
src/crypto/crypto_sig.cc 71.45% <83.33%> (-0.42%) ⬇️
src/crypto/crypto_common.cc 52.75% <75.00%> (-0.41%) ⬇️
src/crypto/crypto_ec.cc 67.05% <61.22%> (+0.97%) ⬆️
src/crypto/crypto_keys.cc 73.18% <71.21%> (+1.09%) ⬆️

... and 30 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

@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
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

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. 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.

5 participants