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

node:crypto: add blake2b512, sha512-224, sha3-* #10383

Merged
merged 16 commits into from
Apr 24, 2024
Merged

Conversation

nektro
Copy link
Member

@nektro nektro commented Apr 20, 2024

Closes #4862

src/bun.zig Outdated Show resolved Hide resolved
@Jarred-Sumner
Copy link
Collaborator

The methods using std.crypto should go through its own struct because as-is this is going to be difficult to maintain when people ask for more crypto algorithms to be supported or when there's a breaking change in std.crypto

Copy link
Collaborator

@Jarred-Sumner Jarred-Sumner left a comment

Choose a reason for hiding this comment

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

A few comments

Copy link
Contributor

github-actions bot commented Apr 20, 2024

@nektro, your commit has failing tests :(

💪 2 failing tests Darwin AARCH64

💻 2 failing tests Darwin x64 baseline

🐧💪 3 failing tests Linux AARCH64

🐧🖥 4 failing tests Linux x64 baseline

🐧🖥 3 failing tests Linux x64

🪟💻 11 failing tests Windows x64 baseline

🪟💻 14 failing tests Windows x64

View logs

@nektro nektro requested a review from Jarred-Sumner April 23, 2024 06:03
Copy link
Collaborator

@Jarred-Sumner Jarred-Sumner left a comment

Choose a reason for hiding this comment

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

1 more comment

.evp => {},
.zig => |*inner| {
inner.final(output_digest_slice);
return encoding.encodeWithMaxSize(globalThis, BoringSSL.EVP_MAX_MD_SIZE, output_digest_slice[0..inner.digest_length]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

BoringSSL.EVP_MAX_MD_SIZE should be a different value here right?

Copy link
Member Author

Choose a reason for hiding this comment

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

BoringSSL.EVP_MAX_MD_SIZE is the max size of all digests, output_digest_slice is the size of the current digest

return encoding.encodeWithMaxSize(globalThis, BoringSSL.EVP_MAX_MD_SIZE, output_digest_slice[0..inner.digest_length]);
},
}

const out = this.evp.final(globalThis.bunVM().rareData().boringEngine(), output_digest_slice);
Copy link
Collaborator

Choose a reason for hiding this comment

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

can this be moved into the .evp branch?:

Copy link
Member Author

Choose a reason for hiding this comment

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

wanted to keep the diff small for the first iteration to make easier to review and test

return thisValue;
},
}

this.evp.update(buffer.slice());
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you move this to .evp =>

Copy link
Member Author

Choose a reason for hiding this comment

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

wanted to keep the diff small for the first iteration to make easier to review and test

@nektro nektro requested a review from Jarred-Sumner April 24, 2024 01:53
@Jarred-Sumner Jarred-Sumner merged commit e3689e7 into main Apr 24, 2024
45 of 52 checks passed
@Jarred-Sumner Jarred-Sumner deleted the nektro-patch-47166 branch April 24, 2024 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: Unsupported algorithm sha3-256
2 participants