[rkp] Add request/response for ECDSA P256 key pair generation
This cl adds the request and response protocol for the ECDSA P256
key pair generation needed for the IRemotelyProvisionedComponent
implementation.
Bug: 299055662
Test: atest rialto_test
Change-Id: Ib3b8519e3833a6617fc6daa878777b9e0499f751
diff --git a/rialto/src/requests/api.rs b/rialto/src/requests/api.rs
index 11fdde4..05a386e 100644
--- a/rialto/src/requests/api.rs
+++ b/rialto/src/requests/api.rs
@@ -14,16 +14,23 @@
//! This module contains the main API for the request processing module.
+use super::rkp;
+use crate::error::Result;
use alloc::vec::Vec;
use service_vm_comm::{Request, Response};
/// Processes a request and returns the corresponding response.
/// This function serves as the entry point for the request processing
/// module.
-pub fn process_request(request: Request) -> Response {
- match request {
+pub fn process_request(request: Request) -> Result<Response> {
+ let response = match request {
Request::Reverse(v) => Response::Reverse(reverse(v)),
- }
+ Request::GenerateEcdsaP256KeyPair => {
+ let res = rkp::generate_ecdsa_p256_key_pair()?;
+ Response::GenerateEcdsaP256KeyPair(res)
+ }
+ };
+ Ok(response)
}
fn reverse(payload: Vec<u8>) -> Vec<u8> {