Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add internal multi-backend entropy system #10748

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

Merged
merged 24 commits into from
May 1, 2025

Conversation

0xEAB
Copy link
Member

@0xEAB 0xEAB commented Apr 11, 2025

This provides a entropy (CSPRNG) multi-backend system for internal use.

This patch should be reviewed thoroughly. Thanks!

Obsoletes dlang/dmd#21158.
Replaces #10739 and #10741.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @0xEAB!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + phobos#10748"

@0xEAB 0xEAB force-pushed the entropy-library branch 5 times, most recently from 75430df to cfa3fcf Compare April 11, 2025 03:40
@0xEAB 0xEAB force-pushed the entropy-library branch from cfa3fcf to 30cb823 Compare April 11, 2025 04:16
Copy link
Contributor

@LightBender LightBender left a comment

Choose a reason for hiding this comment

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

For now I am OK with this because it's V2. But we need to have a long conversation about how to handle platform level interfaces in V3 that doesn't involve shoving everything into scattered internal folders.

@thewilsonator
Copy link
Contributor

std/internal/entropy/entropy.d(59:6)[warn]: Public declaration 'forceEntropySource' is undocumented.
std/internal/entropy/common.d(15:6)[warn]: Public declaration 'EntropySource' has no documented example.
std/internal/entropy/common.d(48:6)[warn]: Public declaration 'EntropyStatus' has no documented example.
std/internal/entropy/common.d(59:8)[warn]: Public declaration 'EntropyResult' has no documented example.
std/internal/entropy/common.d(61:19)[warn]: Public declaration 'status' is undocumented.
std/internal/entropy/common.d(62:19)[warn]: Public declaration 'source' is undocumented.
std/internal/entropy/common.d(128:22)[warn]: A public function needs to contain a `Returns` section.
std/internal/entropy/common.d(128:27)[warn]: Public declaration 'isOK' has no documented example.
std/internal/entropy/common.d(128:52)[warn]: Parameter value isn't documented in the `Params` section.
std/internal/entropy/common.d(134:22)[warn]: A public function needs to contain a `Returns` section.
std/internal/entropy/common.d(134:27)[warn]: Public declaration 'isUnavailable' has no documented example.
std/internal/entropy/common.d(134:61)[warn]: Parameter value isn't documented in the `Params` section.

return getEntropy(buffer[0 .. length]);
}

// Used to manually set the entropy source to use
Copy link
Contributor

Choose a reason for hiding this comment

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

Public declaration 'forceEntropySource' is undocumented.
```
Use `///`

Copy link
Member Author

Choose a reason for hiding this comment

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

IMHO it doesn’t make much sense to document functionality in std.internal anyway.
I’m a bit surprised that I don’t get away with it unlike other modules in said package.
To be honest, I’m tempted to just add exclusions for the files in dscanner.ini.

Copy link
Member Author

Choose a reason for hiding this comment

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

At this point, I think I have documented things to an extent that goes far beyond what could be reasonably required for an internal module. I’ll look into D-Scanner warnings that are still left, but I get more and more tempted to add exclusions. (I’ve already added one for the has-public-examples check.)

@0xEAB
Copy link
Member Author

0xEAB commented Apr 18, 2025

For now I am OK with this because it's V2. But we need to have a long conversation about how to handle platform level interfaces in V3 that doesn't involve shoving everything into scattered internal folders.

Sure thing!

I’m only improvising here and I wasn’t really sure how to organize the code. I went with a multi-module approach for encapsulation reasons. Although I have to admit the value of having that is questionable at best.
If someone were to suggest something better, I’d not be averse to implementing that change.

@ibuclaw
Copy link
Member

ibuclaw commented Apr 19, 2025

Each of these package files are so small, it's probably not worth having them split per platform. Just one module and version as appropriate is perfectly fine.

@0xEAB
Copy link
Member Author

0xEAB commented Apr 20, 2025

Blocked by dlang/dmd#21280 for now.

@0xEAB 0xEAB removed the Review:Needs Changelog A changelog entry needs to be added to /changelog label Apr 21, 2025
@0xEAB
Copy link
Member Author

0xEAB commented May 1, 2025

Adam approved this a few weeks ago: #10748 (review)

@0xEAB
Copy link
Member Author

0xEAB commented May 1, 2025

I’m not sure who defeated whom, but the style check finally passes.

@0xEAB 0xEAB requested review from ibuclaw and thewilsonator May 1, 2025 21:56
@thewilsonator thewilsonator merged commit f20bd75 into dlang:master May 1, 2025
10 checks passed
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.

6 participants