-
Notifications
You must be signed in to change notification settings - Fork 50
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
libcaliptra: add SHA accelerator API #1637
base: main
Are you sure you want to change the base?
Conversation
|
a103c9f
to
219441c
Compare
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 think there are some issues when it comes to obtaining and releasing the lock. It think there should also be a test that performs these operations with a known answer to ensure this is working.
3eef2a0
to
c1d16d7
Compare
505ae38
to
c9f6499
Compare
Signed-off-by: Marvin Drees <[email protected]>
@@ -225,6 +225,18 @@ void caliptra_req_idev_csr_start(); | |||
// Clear IDEV CSR request. | |||
void caliptra_req_idev_csr_complete(); | |||
|
|||
// Computes the SHA hash using the specified mode and endianess. | |||
int caliptra_compute_sha(int mode, int endian, uint32_t* data, uint32_t data_len, uint32_t* hash, uint32_t mbox_start_addr); |
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.
So this is a hash over data in the mailbox? Can the function name or comment clarify that?
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 can change that yes, if I remember correctly a user would need to specify the mbox regs and then it computes the hash over it. I will also update the name of the parameters a bit then as it could help users of the function.
@@ -671,6 +670,63 @@ int rt_test_all_commands(const test_info* info) | |||
printf("Certify Key Extended: OK\n"); | |||
} | |||
|
|||
// SHA Engine Tests |
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.
Can there be a test for caliptra_compute_sha as well?
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.
Sure thing, it would test the same functionality but just in a different input way but shouldn't be too hard to add another test for that as well.
@@ -0,0 +1,14 @@ | |||
// Licensed under the Apache-2.0 license |
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.
These should come from caliptra_top_reg.h. See the other examples in caliptra_fuses.h and caliptra_mbox.h. That file comes from the HW repo submodule (hw/latest/rtl/src/soc_ifc/rtl/caliptra_top_reg.h)
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 must have missed those declarations, will update 👍
Resolves #1361 by providing an abstraction above the
caliptra_write_u32
andcaliptra_read_u32
function calls according to the info at https://chipsalliance.github.io/caliptra-rtl/main/external-regs/?p=caliptra_top_reg.sha512_acc_csr