| 2651 | } |
| 2652 | |
| 2653 | static cbm_daemon_runtime_application_status_t application_ui_readiness_proof( |
| 2654 | cbm_daemon_application_t *application, const uint8_t *request, uint32_t request_length, |
| 2655 | uint8_t **response_out, uint32_t *response_length_out) { |
| 2656 | if (!application->ui_readiness_secret_set || |
| 2657 | request_length != APPLICATION_UI_READINESS_REQUEST_SIZE) { |
| 2658 | return CBM_DAEMON_RUNTIME_APPLICATION_REJECTED; |
| 2659 | } |
| 2660 | uint8_t *proof = malloc(CBM_SHA256_DIGEST_LEN); |
| 2661 | if (!proof) { |
| 2662 | return CBM_DAEMON_RUNTIME_APPLICATION_HANDLER_ERROR; |
| 2663 | } |
| 2664 | cbm_hmac_sha256(application->ui_readiness_secret, sizeof(application->ui_readiness_secret), |
| 2665 | request + 1, CBM_SHA256_DIGEST_LEN, proof); |
| 2666 | *response_out = proof; |
| 2667 | *response_length_out = CBM_SHA256_DIGEST_LEN; |
| 2668 | return CBM_DAEMON_RUNTIME_APPLICATION_OK; |
| 2669 | } |
| 2670 | |
| 2671 | static cbm_daemon_runtime_application_status_t application_request_dispatch( |
| 2672 | cbm_daemon_application_t *application, cbm_daemon_application_session_t *session, |
no test coverage detected