| 3238 | } |
| 3239 | |
| 3240 | static cbm_daemon_runtime_application_status_t application_ui_readiness_proof( |
| 3241 | cbm_daemon_application_t *application, const uint8_t *request, uint32_t request_length, |
| 3242 | uint8_t **response_out, uint32_t *response_length_out) { |
| 3243 | if (!application->ui_readiness_secret_set || |
| 3244 | request_length != APPLICATION_UI_READINESS_REQUEST_SIZE) { |
| 3245 | return CBM_DAEMON_RUNTIME_APPLICATION_REJECTED; |
| 3246 | } |
| 3247 | uint8_t *proof = malloc(CBM_SHA256_DIGEST_LEN); |
| 3248 | if (!proof) { |
| 3249 | return CBM_DAEMON_RUNTIME_APPLICATION_HANDLER_ERROR; |
| 3250 | } |
| 3251 | cbm_hmac_sha256(application->ui_readiness_secret, sizeof(application->ui_readiness_secret), |
| 3252 | request + 1, CBM_SHA256_DIGEST_LEN, proof); |
| 3253 | *response_out = proof; |
| 3254 | *response_length_out = CBM_SHA256_DIGEST_LEN; |
| 3255 | return CBM_DAEMON_RUNTIME_APPLICATION_OK; |
| 3256 | } |
| 3257 | |
| 3258 | static cbm_daemon_runtime_application_status_t application_request_dispatch( |
| 3259 | cbm_daemon_application_t *application, cbm_daemon_application_session_t *session, |
no test coverage detected