-
Notifications
You must be signed in to change notification settings - Fork 19
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
RandomSource update - Validated #190
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Enables developers to supply their own custom RandomSource - Same four existing sources are still available - Updated RandomSource test to ensure test for randomness should always pass - Updated PseudoDeviceAddress to use SHA256 hash to cryptographically separate random address from random source - Passes all unit tests Signed-off-by: c19x <support@c19x.org>
herald/src/test/java/io/heraldprox/herald/sensor/datatype/RandomSourceTests.java
Show resolved
Hide resolved
herald/src/test/java/io/heraldprox/herald/sensor/datatype/RandomSourceTests.java
Show resolved
Hide resolved
herald/src/test/java/io/heraldprox/herald/sensor/datatype/RandomSourceTests.java
Show resolved
Hide resolved
Would it be possible to add a higher level test for PseudoMacAddress that validated each byte value for the mac had an even distribution and was comparable in every byte position? (I.e. to ensure that the first byte being, say, 00 was just as likely as its other values, and that the frequency was comparable with bytes 2-6's frequency of 00 too). |
Thanks for review.
|
- New random source that is non-blocking and uses application domain specific truly random entropy source as seeds - Uses SHA256 and truncation and separate one-time use PRNG from seed - Solution mitigates blocking caused by use of SecureRandom on idle systems, while offering similar security design for the application domain - Added uniform distribution tests for sequence value and initial value from one-time use PRNGs - Added performance test which showed new CSPRNG offers the fastest performance - Tests show all current solutions offer uniform distribution, thus tracking based on limited observations is impractical given there are too many candidate seeds that can yield the observations Signed-off-by: c19x <support@c19x.org>
- Added explanation of design concept - Introduced debug logging (commented out) to enable manual visual inspection - Validated by inspection - Tested on Pixel 3 and A20, and also passed cross-platform unit tests Signed-off-by: c19x <support@c19x.org>
|
|
- Cryptographically secure pseudo random number generator based on SecureRandom, SHA256, xor, truncation, and external entropy - Seeded by SecureRandom data on app initialisation, as system entropy is unlikely to be exhausted on an active device - Internal 256-bit state advanced by SHA256 hash of current state and truly random external entropy sources - Blocking avoided by using a background thread to replace internal state with SecureRandom data at a low rate of 6-24 hours - If SecureRandom does block, the non-blocking cryptographically secure state updates shall enable continuous operation - Eliminated reliance on LCG based PRNG - Internal state updates incorporate truly unpredictable external data, and also utilises cryptographically secure lossy and one-way functions, thus making discovery of internal state and exploitation of discovered state challenging - Passes all unit tests, including test for uniform distribution Signed-off-by: c19x <support@c19x.org>
|
|
- New implementation of cryptographically secure non-blocking random source that does not rely on SecureRandom - Experiments with previous solution (blocking SecureRandom runs in background thread) shows *ANY* call to SecureRandom on idle device is liable to cause blocking in wider subsystems - A single call to create a new instance of SecureRandom for reseeding the internal state was sufficient to interrupt continuous BLE operation for several minutes - New solution eliminates reliance on SecureRandom for reseeding by using thread scheduling as truly unpredictable random source that is guaranteed to be non-blocking - This concept is similar to that employed by Oracle and OpenJDK implementation of SecureRandom where the ThreadSeedGenerator acts as a fallback random source when /dev/random is exhausted Signed-off-by: c19x <support@c19x.org>
closes #118 |
|
- Added checks to ensure thread based entropy source is not vulnerable to system load attacks - Tested on A20 and Pixel3 in Faraday bag to confirm non-blocking even when there is no external influences - Advert refresh set to once every 3 minutes - Reseed set to once every minute - Logging set to OFF to minimise system activities - Test shows 100% continuity for 27 hours in idle state Signed-off-by: c19x <support@c19x.org>
Ready for merge
|
This was referenced May 31, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: c19x support@c19x.org
closes #189