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

fix Use of weak random number generator #3578

Merged
merged 5 commits into from
Aug 2, 2022

Conversation

huof6829
Copy link
Contributor

Description

fix weak random in api and blocksync

Fixes #3537

Type of change

Please delete options that are not relevant.

  • [] Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Code refactor or improvement
  • [] Breaking change (fix or feature that would cause a new or changed behavior of existing functionality)
  • [] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [] make test
  • [] fullsync
  • [] Other test (please specify)

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • [] My code follows the style guidelines of this project
  • [] I have performed a self-review of my code
  • [] I have commented my code, particularly in hard-to-understand areas
  • [] I have made corresponding changes to the documentation
  • [] My changes generate no new warnings
  • [] I have added tests that prove my fix is effective or that my feature works
  • [] New and existing unit tests pass locally with my changes
  • [] Any dependent changes have been merged and published in downstream modules

@huof6829 huof6829 requested a review from a team as a code owner July 28, 2022 10:21
@codecov
Copy link

codecov bot commented Jul 28, 2022

Codecov Report

Merging #3578 (aa6943e) into master (a20e489) will decrease coverage by 1.31%.
The diff coverage is 56.95%.

@@            Coverage Diff             @@
##           master    #3578      +/-   ##
==========================================
- Coverage   75.43%   74.12%   -1.32%     
==========================================
  Files         247      255       +8     
  Lines       22845    23415     +570     
==========================================
+ Hits        17233    17356     +123     
- Misses       4685     5134     +449     
+ Partials      927      925       -2     
Impacted Files Coverage Δ
action/protocol/staking/read_state.go 15.38% <0.00%> (ø)
api/grpcserver.go 79.49% <ø> (+0.55%) ⬆️
api/websocket.go 5.17% <0.00%> (-0.19%) ⬇️
blockchain/blockchain.go 0.89% <0.00%> (ø)
blockchain/filedao/filedao_legacy.go 85.80% <ø> (ø)
blockchain/filedao/filedao_v2.go 98.51% <ø> (ø)
blockchain/pubsubmanager.go 0.00% <0.00%> (ø)
blocksync/blocksync.go 72.90% <0.00%> (ø)
config/config.go 94.06% <ø> (+9.31%) ⬆️
db/db_bolt.go 72.51% <ø> (-0.19%) ⬇️
... and 75 more

Help us with your feedback. Take ten seconds to tell us how you rate us.

for ; n < len(p); n++ {
p[n] = byte(Uint32())
}
return
Copy link
Member

Choose a reason for hiding this comment

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

optimize to fill 4 bytes for every Uint32() call

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@Liuhaai Liuhaai merged commit 84eed24 into iotexproject:master Aug 2, 2022
@huof6829 huof6829 deleted the fix_weak_random branch August 4, 2022 14:01
dustinxie pushed a commit that referenced this pull request Oct 5, 2022
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.

Use of weak random number generator (math/rand instead of crypto/rand)
3 participants