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

[seraphis] crypto: add blake2b #9198

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

UkoeHB
Copy link
Contributor

@UkoeHB UkoeHB commented Feb 22, 2024

This is a PR in my 'upstreaming seraphis_lib project', the changes here are not used anywhere yet.

  • Adds Blake2b to src/crypto. The code is lifted almost verbatim from randomx.
  • Updates the Blake2b test vectors to point to src/crypto/blake2b.h. Test with ctest -R hash-blake2b in the tests/hash folder in your build directory.

/// END: blake2-impl.h

void clear_internal_memory(void *mem, const size_t length) {
memwipe(mem, length);
Copy link
Contributor Author

@UkoeHB UkoeHB Feb 22, 2024

Choose a reason for hiding this comment

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

Adding this memwipe is the main difference with the randomx version, which comments out all calls to clear_internal_memory().

Comment on lines 89 to 96
// crypto namespace (fixes naming collisions with libsodium)
#define blake2b_init crypto_blake2b_init
#define blake2b_init_key crypto_blake2b_init_key
#define blake2b_init_param crypto_blake2b_init_param
#define blake2b_update crypto_blake2b_update
#define blake2b_final crypto_blake2b_final
#define blake2b crypto_blake2b
#define blake2b_long crypto_blake2b_long
Copy link
Contributor Author

@UkoeHB UkoeHB Feb 22, 2024

Choose a reason for hiding this comment

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

Setting the namespace to crypto is the only other difference from randomx, which uses the randomx namespace.

@jeffro256
Copy link
Contributor

Could you please revert whitespace diffs from the RandomX Blake2b file?

@UkoeHB
Copy link
Contributor Author

UkoeHB commented Mar 21, 2024

Could you please revert whitespace diffs from the RandomX Blake2b file?

@jeffro256 done, looks like someone in the history of these files was not using spaces for tabs...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants