CryptoPkg: Add EC key retrieving and signature interface.

This patch is used to retrieve EC key from PEM and X509 and
carry out the EC-DSA signature and verify it.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4102

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Signed-off-by: Qi Zhang <qi1.zhang@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
Qi Zhang
2022-10-12 10:47:58 +08:00
committed by mergify[bot]
parent f80580f56b
commit f21a1d48fe
10 changed files with 837 additions and 0 deletions

View File

@@ -292,3 +292,31 @@ X509GetTBSCert (
ASSERT (FALSE);
return FALSE;
}
/**
Retrieve the EC Public Key from one DER-encoded X509 certificate.
@param[in] Cert Pointer to the DER-encoded X509 certificate.
@param[in] CertSize Size of the X509 certificate in bytes.
@param[out] EcContext Pointer to new-generated EC DSA context which contain the retrieved
EC public key component. Use EcFree() function to free the
resource.
If Cert is NULL, then return FALSE.
If EcContext is NULL, then return FALSE.
@retval TRUE EC Public Key was retrieved successfully.
@retval FALSE Fail to retrieve EC public key from X509 certificate.
**/
BOOLEAN
EFIAPI
EcGetPublicKeyFromX509 (
IN CONST UINT8 *Cert,
IN UINTN CertSize,
OUT VOID **EcContext
)
{
ASSERT (FALSE);
return FALSE;
}