[rkp] Generate EC P-256 key pair for the RKP HAL
This cl generates the EC P-256 key pair needed by the RKP HAL.
The MAC of the public key and wrapping of the private key will be
handled in subsequent cls.
Bug: 299055662
Test: atest rialto_test
Change-Id: I253130e62bbf70cb5a7abe1a056fc4f77d30aa6e
diff --git a/rialto/src/requests/rkp.rs b/rialto/src/requests/rkp.rs
index a73b9f4..66d3603 100644
--- a/rialto/src/requests/rkp.rs
+++ b/rialto/src/requests/rkp.rs
@@ -13,8 +13,9 @@
// limitations under the License.
//! This module contains functions related to the attestation of the
-//! service VM via the RKP (Remote Key Provisionning) server.
+//! service VM via the RKP (Remote Key Provisioning) server.
+use super::ec_key::EcKey;
use alloc::vec::Vec;
use core::result;
use diced_open_dice::DiceArtifacts;
@@ -25,7 +26,13 @@
pub(super) fn generate_ecdsa_p256_key_pair(
_dice_artifacts: &dyn DiceArtifacts,
) -> Result<EcdsaP256KeyPair> {
- // TODO(b/299055662): Generate the key pair.
+ let ec_key = EcKey::new_p256()?;
+
+ // TODO(b/279425980): Encrypt the private key in a key blob.
+ // Remove the printing of the private key.
+ log::debug!("Private key: {:?}", ec_key.private_key()?.as_slice());
+
+ // TODO(b/300068317): Build MACed public key.
let key_pair = EcdsaP256KeyPair { maced_public_key: Vec::new(), key_blob: Vec::new() };
Ok(key_pair)
}