edk2/ArmVirtPkg/Library/ArmCcaBootSyncCryptoLib/ArmCcaBootSyncCrypto.h
Sami Mujawar 3fa842faf9 ArmVirtPkg: Add Crypto helper library for Boot Sync
Introduce a helper library that implements wrappers for the
cryptographic functionality required by the Arm Boot Sync
Blocks protocol implementation.

This library implements the following:
 - Key Exchange: ECDH key using the ECC Curve-P384
 - Key Derivation: SHA512 HMAC-based Extract-and-Expand HKDF
 - Encryption/Decryption: AEAD AES-GCM authenticated encryption
                          and decryption

Also register the library class in ArmVirtPkg.dec, wire the
instance into the KvmTool guest firmware and update the CI YAML
file to add CryptoPkg/CryptoPkg.dec as an acceptable dependency.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
2026-07-20 23:02:37 +00:00

37 lines
1,010 B
C

/** @file
Boot Sync Crypto definitions.
Copyright (c) 2024, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Glossary:
- BS - Boot Sync
@par Reference(s):
- Realm Host Interface (RHI) Specification, version 1.0-alp0
(https://developer.arm.com/documentation/den0148/)
**/
#pragma once
/**
A structure for storing the cryptographic key context and associated
parameters and data.
*/
typedef struct ArmCcaBootSyncKeyContext {
/// Pointer to the key context.
VOID *EcContext;
/// Cryptographic curve Nid.
UINTN EcCurveNid;
/// Pointer to the public key.
UINT8 *PublicKey;
/// Public key size
UINTN PublicKeySize;
/// Pointer to the Common key.
UINT8 *CommonKey;
/// Common key size.
UINTN CommonKeySize;
} ARM_CCA_BOOTSYNC_KEY_CONTEXT;
// For P-384, the PublicSize is 96. First 48-byte is X, Second 48-byte is Y.
#define ECC_CURVE_P384_PUB_KEY_SIZE 96