Merged
Conversation
1aff107 to
73db403
Compare
Contributor
|
This does fix the issue for me:
|
fjmolinas
reviewed
Sep 11, 2020
Comment on lines
+44
to
+64
| uint8_t tmp, j, k; | ||
| j = i % len; | ||
| k = i % CPUID_LEN; | ||
|
|
||
| /* xor with CPU ID */ | ||
| out[j] ^= cid[k]; | ||
|
|
||
| /* get 'random' position */ | ||
| sum += out[j]; | ||
| k = sum % (j + 1); | ||
|
|
||
| /* shuffle bytes */ | ||
| tmp = out[j]; | ||
| out[j] = out[k]; | ||
| out[k] = tmp; |
Contributor
There was a problem hiding this comment.
Is this a common shuffling alorithm?
Contributor
There was a problem hiding this comment.
Ah nice, mind adding a reference? You can squash right away!
Contributor
Author
There was a problem hiding this comment.
I added a comment.
The CPU ID can have large parts that are identical between devices. To add some more entropy to the generated IDs, shuffle the bytes.
73db403 to
28d1936
Compare
This was referenced Oct 19, 2020
This file contains hidden or 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
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.
Contribution description
The CPU ID can have large parts that are identical between devices.
To add some more entropy to the generated IDs, shuffle the bytes.
Testing procedure
On two
weact-f411ceboards (same stm32 CPU) this generatesand
Issues/PRs references
#14634 (comment)