Skip to content

Commit

Permalink
HSD-15012124940: Enhanced return codes of INTEL_FCS_DEV_SEND_CERTIFIC…
Browse files Browse the repository at this point in the history
…ATE to differentiate between non-provisioned device and authentication fail (#6)

* HSD-15012124940: Enhanced return codes of INTEL_FCS_DEV_SEND_CERTIFICATE to differentiate between non-provisioned device and authentication fail

* Currently
- Return codes to not show / identify if the device is non-provisioned or an auth fail.
- The prior trails in IPS 00636832  suggest that the SDM has the knowledge of the fail condition but its not passed.

To address this problems,
- Now we added mbox status mesmber to the ioct structure to pass the mbox response from the driver to Application.
- In this fcs client application, we are checking the STATUS and MBOX STATUS and giving the return code accordingly.
- Added mbox_status member to the IOCTL structure in the include/intel_fcs-ioctl.h file.

Signed-off-by: Durga Surya Rajesh Aki <durgax.surya.rajesh.aki@intel.com>

---------

Signed-off-by: Durga Surya Rajesh Aki <durgax.surya.rajesh.aki@intel.com>
  • Loading branch information
RajeshAki committed Mar 23, 2023
1 parent e2d3076 commit f17a512
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
6 changes: 4 additions & 2 deletions include/intel_fcs-ioctl.h
Expand Up @@ -14,8 +14,8 @@

/* define macro to be used to fix the size of struct intel_fcs_dev_ioctl */
#define INTEL_FCS_IOCTL_MAX_SZ 256U
/* the header include the 8 bytes stucture padding and 4 bytes status */
#define INTEL_FCS_IOCTL_HEADER_SZ 12U
/* the header include the 8 bytes stucture padding, 4 bytes status and 4 bytes mailbox status*/
#define INTEL_FCS_IOCTL_HEADER_SZ 16U
#define INTEL_FCS_IOCTL_PLACEHOLDER_SZ (INTEL_FCS_IOCTL_MAX_SZ - \
INTEL_FCS_IOCTL_HEADER_SZ) / 4

Expand Down Expand Up @@ -469,6 +469,8 @@ struct intel_fcs_dev_ioctl {
struct fcs_random_number_gen_ext rn_gen_ext;
struct fcs_sdos_data_ext data_sdos_ext;
} com_paras;

int mbox_status;
};

/**
Expand Down
27 changes: 26 additions & 1 deletion src/fcs_client.c
Expand Up @@ -36,6 +36,14 @@
(struct fcs_hps_vab_certificate_data, \
fcs_sha384[0]))

/* Certificate Process Status */
#define AUTHENTICATION_FAILED 0xF0000003
#define DEV_NOT_OWNED 0xF0000004

/* Mail Box Response Codes */
#define MBOX_RESP_AUTHENTICATION_FAIL 0X0A
#define MBOX_RESP_INVALID_CERTIFICATE 0X80

#define NOT_ALLOWED_UNDER_SECURITY_SETTINGS 0x85

#define SDOS_MAGIC_WORD 0xACBDBDED
Expand Down Expand Up @@ -447,6 +455,15 @@ static int fcs_validate_hps_image_buf(const void *cdata, size_t csize,
printf("ioctl return status=0x%x size=%d\n",
dev_ioctl->status, dev_ioctl->com_paras.s_request.size);

printf("mbox_status=0x%x\n", dev_ioctl->mbox_status);

if (dev_ioctl->mbox_status == MBOX_RESP_INVALID_CERTIFICATE || dev_ioctl->mbox_status == MBOX_RESP_AUTHENTICATION_FAIL)
dev_ioctl->com_paras.c_request.c_status = AUTHENTICATION_FAILED;
else if (dev_ioctl->mbox_status == NOT_ALLOWED_UNDER_SECURITY_SETTINGS)
dev_ioctl->com_paras.c_request.c_status = DEV_NOT_OWNED;
else
dev_ioctl->mbox_status = 0x0;

status = dev_ioctl->status;
if (status)
printf("Certificate Error: 0x%X\n",
Expand Down Expand Up @@ -702,7 +719,15 @@ static int fcs_service_counter_set(char *filename, int test)

fcs_send_ioctl_request(dev_ioctl, INTEL_FCS_DEV_SEND_CERTIFICATE);

printf("ioctl return status=%d\n", dev_ioctl->status);
printf("ioctl return status=%d mbox_status=0x%x\n", dev_ioctl->status, dev_ioctl->mbox_status);

if (dev_ioctl->mbox_status == MBOX_RESP_INVALID_CERTIFICATE || dev_ioctl->mbox_status == MBOX_RESP_AUTHENTICATION_FAIL)
dev_ioctl->com_paras.c_request.c_status = AUTHENTICATION_FAILED;
else if (dev_ioctl->mbox_status == NOT_ALLOWED_UNDER_SECURITY_SETTINGS)
dev_ioctl->com_paras.c_request.c_status = DEV_NOT_OWNED;
else
dev_ioctl->mbox_status = 0x0;

status = dev_ioctl->status;

if (status)
Expand Down

0 comments on commit f17a512

Please sign in to comment.