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/Improve Hardware RNG for ODROID C1 #170

Merged
merged 2 commits into from Mar 24, 2016
Merged

Fix/Improve Hardware RNG for ODROID C1 #170

merged 2 commits into from Mar 24, 2016

Conversation

gparent
Copy link

@gparent gparent commented Mar 24, 2016

Hello

From what I understand, by commiting efa186d which disables CONFIG_PM_RUNTIME, the init routines for the HW RNG are neither defined nor (obviously) automatically ran by the PM system and therefore entropy validation fails when rngd tries to use the device.

On a typical start up of rngd, this leads to the following series of messages , as seen on the forums, which understandably confuses poor user ctmme.

rngd 2-unofficial-mt.14 starting up...
block failed FIPS test: 0x17
block failed FIPS test: 0x17
block failed FIPS test: 0x17
Too many consecutive bad blocks of data, check entropy source!
Throttling down entropy source read speed...
block failed FIPS test: 0x17
block failed FIPS test: 0x17
block failed FIPS test: 0x17
block failed FIPS test: 0x17
block failed FIPS test: 0x17
block failed FIPS test: 0x17
block failed FIPS test: 0x17

Eventually it fails and rngd will bail out in the usual case.

My pull request is two-fold:

  • It extracts the initialization/teardown code to separate functions matching the signature expected by struct hwrng callbacks, while keeping the power management code working the same way.
  • It sets the initialization and cleanup callback of that struct so the code is called even when CONFIG_PM_RUNTIME is undefined. However I'm not sure the cleanup callback is needed here.

As this is my first kernel patch and I'm in no way familiar with the power management systems, please review thoroughly. In particular I wonder if assigning .cleanup is needed, and I'm not 100% sure the two calls that are added in the resume/suspend functions are side-effect free.

This fixes #157

@gparent gparent changed the title Fix Hardware RNG for ODROID C1 Fix/Improve Hardware RNG for ODROID C1 Mar 24, 2016
@mdrjr mdrjr merged commit 37ffc2a into hardkernel:odroidc-3.10.y Mar 24, 2016
@mdrjr
Copy link
Collaborator

mdrjr commented Mar 24, 2016

Thank you so much for this one :)

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.

None yet

2 participants