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

Add GetIdevCsr to libcaliptra. #1788

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions libcaliptra/examples/generic/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,28 @@ int rom_test_devid_csr(const test_info* info)
printf("IDEV CSR matches\n");
}

caliptra_req_idev_csr_complete();
caliptra_ready_for_firmware();

// Test Get Idev CSR now that a CSR is provisioned.
// GET IDEV CSR
struct caliptra_get_idev_csr_resp csr_resp = {0};

status = caliptra_get_idev_csr(&csr_resp, false);

if (status) {
printf("Get IDev CSR failed: 0x%x\n", status);
dump_caliptra_error_codes();
failure = 1;
} else {
if (memcmp(csr_resp.data, idev_csr_bytes, csr_resp.data_size) != 0) {
printf("IDEV CSR does not match\n");
failure = 1;
} else {
printf("Get IDev CSR: OK\n");
}
}

free((void*)caliptra_idevid_csr_buf.data);
return failure;
}
Expand Down
3 changes: 3 additions & 0 deletions libcaliptra/inc/caliptra_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ int caliptra_certify_key_extended(struct caliptra_certify_key_extended_req *req,
// FIPS version
int caliptra_fips_version(struct caliptra_fips_version_resp *resp, bool async);

// Get IDev CSR
int caliptra_get_idev_csr(struct caliptra_get_idev_csr_resp *resp, bool async);

// Self test start
int caliptra_self_test_start(bool async);

Expand Down
6 changes: 6 additions & 0 deletions libcaliptra/inc/caliptra_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ struct caliptra_capabilities_resp {
uint8_t capabilities[16];
};

struct caliptra_get_idev_csr_resp {
struct caliptra_resp_header hdr;
uint32_t data_size;
uint8_t data[512];
};

// DPE commands

#define DPE_MAGIC 0x44504543 // "DPEC"
Expand Down
15 changes: 15 additions & 0 deletions libcaliptra/src/caliptra_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,21 @@ int caliptra_fips_version(struct caliptra_fips_version_resp *resp, bool async)
return pack_and_execute_command(&p, async);
}

// Get IDev CSR
int caliptra_get_idev_csr(struct caliptra_get_idev_csr_resp *resp, bool async)
{
if (!resp)
{
return INVALID_PARAMS;
}

caliptra_checksum checksum = 0;

CREATE_PARCEL(p, OP_GET_IDEV_CSR, &checksum, resp);
clundin25 marked this conversation as resolved.
Show resolved Hide resolved

return pack_and_execute_command(&p, async);
}

// Self test start
int caliptra_self_test_start(bool async)
{
Expand Down
1 change: 1 addition & 0 deletions libcaliptra/src/caliptra_mbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enum mailbox_command {
OP_SELF_TEST_GET_RESULTS = 0x46504C67, // "FPGR"
OP_SHUTDOWN = 0x46505344, // "FPSD"
OP_CAPABILITIES = 0x43415053, // "CAPS"
OP_GET_IDEV_CSR = 0x49444352, // "IDCR"
};

struct parcel {
Expand Down
Loading