-
Notifications
You must be signed in to change notification settings - Fork 746
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
Updated the code with the review feedback #24574
base: master
Are you sure you want to change the base?
Updated the code with the review feedback #24574
Conversation
@moidx , Updated with feedback and as per format/style. |
// Disable EDN and CSRNG to simulate stalling | ||
LOG_INFO("Disabling EDN0, EDN1..."); | ||
CHECK_DIF_OK(dif_edn_stop(&edn0)); | ||
CHECK_DIF_OK(dif_edn_stop(&edn1)); | ||
busy_spin_micros(500); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the following function from entropy_testutils
:
TRY(entropy_testutils_stop_all());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted
LOG_INFO("Conditionally checking AES status after stopping EDN and CSRNG."); | ||
LOG_INFO("Waiting for AES to stall after PRNG reseed request..."); | ||
bool stall = false; | ||
CHECK_DIF_OK(dif_aes_get_status(&aes, kDifAesStatusStall, &stall)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The stall condition will only occur after you switch the key. You may have to load a couple of different keys because the PRNG may already be reseeded the first time you call it.
This check should go below after dif_aes_start(...)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted. Pushing "waiting for the stall" logic after dif_aes_start()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For loading keys more than once.
Steps will be as below:
generate first key = key
Generate key_share0[i] = kAesModesKey128[i] ^ kKeyShare1[i]
Load first key using dif_aes_start()
Then dif_aes_trigger()
generate second key = key2
Generate key2_share0[i] = kAesModesKey128[i] ^ kKeyShare1[i]+1 --> Different key generation
wait for stall
then enable entropy complex
load data
Load second key using dif_aes_start() later after enabling
Then dif_aes_trigger()
Please advice.
LOG_INFO("Disabling CSRNG..."); | ||
CHECK_DIF_OK(dif_csrng_stop(&csrng)); | ||
CHECK_DIF_OK(dif_entropy_src_stop(&entropy_src)); | ||
|
||
// Re-enable Entropy Source and CSRNG in the proper sequence | ||
LOG_INFO("Re-initializing Entropy Source and CSRNG..."); | ||
|
||
// Initialize and configure Entropy Source | ||
dif_entropy_src_config_t entropy_src_config = | ||
entropy_testutils_config_default(); | ||
CHECK_DIF_OK(dif_entropy_src_configure(&entropy_src, entropy_src_config, | ||
kDifToggleEnabled)); | ||
|
||
// Initialize and start CSRNG | ||
CHECK_DIF_OK(dif_csrng_configure(&csrng)); | ||
// set_edn_auto_mode(); | ||
LOG_INFO("Setting EDN to auto mode..."); | ||
TRY(entropy_testutils_auto_mode_init()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this code can be replaced for a single call:
TRY(entropy_testutils_auto_mode_init());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted
// Trigger PRNG reseed request | ||
LOG_INFO("Triggering PRNG reseed..."); | ||
CHECK_DIF_OK(dif_aes_trigger(&aes, kDifAesTriggerPrngReseed)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect to see a stall if entropy complex is disabled and you call this command. It may be a good idea to test this as well.
// T8: Load the plain text to trigger the encryption operation | ||
CHECK_DIF_OK(dif_aes_load_data(&aes, in_data_plain)); | ||
|
||
// Trigger AES reseed request, specific for manual operation case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kDifAesTriggerStart
is not the same as kDifAesTriggerPrngReseed
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Can you clarify more on this review comment wrt code?
Hi @github-gcontributor, Can you also do the following:
|
0e063c2
to
21a2971
Compare
@moidx, Please provide feedback on the changes.. |
21a2971
to
d244b08
Compare
Regarding point 4, Still issue is persistent: |
b62a3ec
to
50fd1cf
Compare
You are contributing to a public repo with a CLA from your company. The corporate email must be exposed in commits, else the contribution cannot be accepted. You must uncheck "Block command line pushes that expose my email" (or else get someone else from your organization to submit the change). Some people choose to have separate accounts for corporate work, and this enabled them to keep this safeguard for their personal account. I'm not sure if there is a way to make it more granular (like by repo or something). |
50fd1cf
to
b735a02
Compare
Sure, in that case let me change my id to corporate email. |
85dd686
to
cb56857
Compare
Signed-off-by: Varunkumar Trivedi <[email protected]>
cb56857
to
e8aeba7
Compare
No description provided.