| 2544 | } |
| 2545 | |
| 2546 | static cbm_daemon_runtime_application_status_t application_ui_readiness_proof( |
| 2547 | cbm_daemon_application_t *application, const uint8_t *request, uint32_t request_length, |
| 2548 | uint8_t **response_out, uint32_t *response_length_out) { |
| 2549 | if (!application->ui_readiness_secret_set || |
| 2550 | request_length != APPLICATION_UI_READINESS_REQUEST_SIZE) { |
| 2551 | return CBM_DAEMON_RUNTIME_APPLICATION_REJECTED; |
| 2552 | } |
| 2553 | uint8_t *proof = malloc(CBM_SHA256_DIGEST_LEN); |
| 2554 | if (!proof) { |
| 2555 | return CBM_DAEMON_RUNTIME_APPLICATION_HANDLER_ERROR; |
| 2556 | } |
| 2557 | cbm_hmac_sha256(application->ui_readiness_secret, sizeof(application->ui_readiness_secret), |
| 2558 | request + 1, CBM_SHA256_DIGEST_LEN, proof); |
| 2559 | *response_out = proof; |
| 2560 | *response_length_out = CBM_SHA256_DIGEST_LEN; |
| 2561 | return CBM_DAEMON_RUNTIME_APPLICATION_OK; |
| 2562 | } |
| 2563 | |
| 2564 | static cbm_daemon_runtime_application_status_t application_request_dispatch( |
| 2565 | cbm_daemon_application_t *application, cbm_daemon_application_session_t *session, |
no test coverage detected