]>
git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/CryptRuntimeDxe/CryptRuntime.h
86476450f449916097fe353ebc4a96e0a1a67d87
2 Header file of Runtime Cryptographic Driver.
4 Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _CRYPT_RUNTIME_H_
16 #define _CRYPT_RUNTIME_H_
20 #include <Protocol/RuntimeCrypt.h>
22 #include <Library/DebugLib.h>
23 #include <Library/UefiDriverEntryPoint.h>
24 #include <Library/UefiBootServicesTableLib.h>
25 #include <Library/BaseCryptLib.h>
28 Retrieves the size, in bytes, of the context buffer required for SHA-256 operations.
30 @return The size, in bytes, of the context buffer required for SHA-256 operations.
35 RuntimeCryptSha256GetContextSize (
41 Initializes user-supplied memory pointed by Sha256Context as SHA-256 hash context for
44 If Sha256Context is NULL, then return FALSE.
46 @param[in, out] Sha256Context Pointer to SHA-256 Context being initialized.
48 @retval TRUE SHA-256 context initialization succeeded.
49 @retval FALSE SHA-256 context initialization failed.
54 RuntimeCryptSha256Init (
55 IN OUT VOID
*Sha256Context
60 Performs SHA-256 digest on a data buffer of the specified length. This function can
61 be called multiple times to compute the digest of long or discontinuous data streams.
63 If Sha256Context is NULL, then return FALSE.
65 @param[in, out] Sha256Context Pointer to the SHA-256 context.
66 @param[in] Data Pointer to the buffer containing the data to be hashed.
67 @param[in] DataLength Length of Data buffer in bytes.
69 @retval TRUE SHA-256 data digest succeeded.
70 @retval FALSE Invalid SHA-256 context. After Sha256Final function has been called, the
71 SHA-256 context cannot be reused.
76 RuntimeCryptSha256Update (
77 IN OUT VOID
*Sha256Context
,
84 Completes SHA-256 hash computation and retrieves the digest value into the specified
85 memory. After this function has been called, the SHA-256 context cannot be used again.
87 If Sha256Context is NULL, then return FALSE.
88 If HashValue is NULL, then return FALSE.
90 @param[in, out] Sha256Context Pointer to SHA-256 context
91 @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest
94 @retval TRUE SHA-256 digest computation succeeded.
95 @retval FALSE SHA-256 digest computation failed.
100 RuntimeCryptSha256Final (
101 IN OUT VOID
*Sha256Context
,
106 Allocates and Initializes one RSA Context for subsequent use.
108 @return Pointer to the RSA Context that has been initialized.
109 If the allocations fails, RsaNew() returns NULL.
120 Release the specified RSA Context.
122 @param[in] RsaContext Pointer to the RSA context to be released.
127 RuntimeCryptRsaFree (
132 Sets the tag-designated RSA key component into the established RSA context from
133 the user-specified nonnegative integer (octet string format represented in RSA
136 If RsaContext is NULL, then return FALSE.
138 @param[in, out] RsaContext Pointer to RSA context being set.
139 @param[in] KeyTag Tag of RSA key component being set.
140 @param[in] BigNumber Pointer to octet integer buffer.
141 @param[in] BnLength Length of big number buffer in bytes.
143 @return TRUE RSA key component was set successfully.
144 @return FALSE Invalid RSA key component tag.
149 RuntimeCryptRsaSetKey (
150 IN OUT VOID
*RsaContext
,
151 IN RSA_KEY_TAG KeyTag
,
152 IN CONST UINT8
*BigNumber
,
158 Verifies the RSA-SSA signature with EMSA-PKCS1-v1_5 encoding scheme defined in
161 If RsaContext is NULL, then return FALSE.
162 If MessageHash is NULL, then return FALSE.
163 If Signature is NULL, then return FALSE.
164 If HashLength is not equal to the size of MD5, SHA-1 or SHA-256 digest, return FALSE.
166 @param[in] RsaContext Pointer to RSA context for signature verification.
167 @param[in] MessageHash Pointer to octet message hash to be checked.
168 @param[in] HashLength Length of the message hash in bytes.
169 @param[in] Signature Pointer to RSA PKCS1-v1_5 signature to be verified.
170 @param[in] SigLength Length of signature in bytes.
172 @return TRUE Valid signature encoded in PKCS1-v1_5.
173 @return FALSE Invalid signature or invalid RSA context.
178 RuntimeCryptRsaPkcs1Verify (
180 IN CONST UINT8
*MessageHash
,