reth icon indicating copy to clipboard operation
reth copied to clipboard

fix: use consistent RNG source for ECIES nonce generation

Open viktorking7 opened this issue 1 month ago • 1 comments

Description

Problem: ECIES initialization was mixing randomness sources by using B256::random() for nonce generation while using a local RNG for ephemeral keys. This creates inconsistent entropy sources in cryptographic operations.

Solution: Generate nonce using the same local RNG instance that's already created for ephemeral key generation.

Changes:

  • Replace B256::random() with rng.fill_bytes() in new_client() and new_server()
  • Add RngCore import for fill_bytes() method

viktorking7 avatar Sep 28 '25 11:09 viktorking7