OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
OcCryptoLib.h File Reference

Go to the source code of this file.

Data Structures

struct  AES_CONTEXT_
 
struct  CHACHA_CONTEXT_
 
struct  MD5_CONTEXT_
 
struct  SHA1_CONTEXT_
 
struct  SHA256_CONTEXT_
 
struct  SHA512_CONTEXT_
 
struct  OC_RSA_PUBLIC_KEY_HDR
 
struct  OC_RSA_PUBLIC_KEY
 

Macros

#define CONFIG_AES_KEY_SIZE   16
 
#define OC_CRYPTO_SUPPORTS_SHA256   1
 
#define OC_CRYPTO_SUPPORTS_SHA384   1
 
#define OC_CRYPTO_SUPPORTS_SHA512   1
 
#define OC_CRYPTO_SUPPORTS_SHA1   1
 
#define OC_CRYPTO_SUPPORTS_MD5   1
 
#define MD5_DIGEST_SIZE   16
 
#define SHA1_DIGEST_SIZE   20
 
#define SHA256_DIGEST_SIZE   32
 
#define SHA384_DIGEST_SIZE   48
 
#define SHA512_DIGEST_SIZE   64
 
#define OC_MAX_SHA_DIGEST_SIZE   SHA512_DIGEST_SIZE
 
#define SHA256_BLOCK_SIZE   64
 
#define SHA512_BLOCK_SIZE   128
 
#define SHA384_BLOCK_SIZE   SHA512_BLOCK_SIZE
 
#define AES_BLOCK_SIZE   16
 
#define AES_KEY_EXP_SIZE   176
 
#define CHACHA_KEY_SIZE   32
 
#define CHACHA_IV_SIZE   12
 
#define OC_PASSWORD_MAX_LEN   32
 
#define OC_PASSWORD_MAX_RETRIES   3
 
#define RSA_MOD_MAX_SIZE   BASE_16KB
 
#define RSA_SCRATCH_BUFFER_SIZE(ModulusSize)
 

Typedefs

typedef enum OC_SIG_HASH_TYPE_ OC_SIG_HASH_TYPE
 
typedef struct AES_CONTEXT_ AES_CONTEXT
 
typedef struct CHACHA_CONTEXT_ CHACHA_CONTEXT
 
typedef struct MD5_CONTEXT_ MD5_CONTEXT
 
typedef struct SHA1_CONTEXT_ SHA1_CONTEXT
 
typedef struct SHA256_CONTEXT_ SHA256_CONTEXT
 
typedef struct SHA512_CONTEXT_ SHA512_CONTEXT
 
typedef SHA512_CONTEXT SHA384_CONTEXT
 

Enumerations

enum  OC_SIG_HASH_TYPE_ { OcSigHashTypeSha256 , OcSigHashTypeSha384 , OcSigHashTypeSha512 , OcSigHashTypeMax }
 

Functions

 STATIC_ASSERT (sizeof(OC_RSA_PUBLIC_KEY_HDR)==16, "The PK header struct is malformed.")
 
 STATIC_ASSERT (sizeof(OC_RSA_PUBLIC_KEY_HDR)==sizeof(OC_RSA_PUBLIC_KEY_HDR), "The PK struct is malformed.")
 
VOID AesInitCtxIv (OUT AES_CONTEXT *Context, IN CONST UINT8 *Key, IN CONST UINT8 *Iv)
 
VOID AesSetCtxIv (OUT AES_CONTEXT *Context, IN CONST UINT8 *Iv)
 
VOID AesCbcEncryptBuffer (IN OUT AES_CONTEXT *Context, IN OUT UINT8 *Data, IN UINT32 Len)
 
VOID AesCbcDecryptBuffer (IN OUT AES_CONTEXT *Context, IN OUT UINT8 *Data, IN UINT32 Len)
 
VOID AesCtrXcryptBuffer (IN OUT AES_CONTEXT *Context, IN OUT UINT8 *Data, IN UINT32 Len)
 
VOID ChaChaInitCtx (OUT CHACHA_CONTEXT *Context, IN CONST UINT8 *Key, IN CONST UINT8 *Iv, IN UINT32 Counter)
 
VOID ChaChaCryptBuffer (IN OUT CHACHA_CONTEXT *Context, IN CONST UINT8 *Source, OUT UINT8 *Destination, IN UINT32 Length)
 
VOID Md5Init (MD5_CONTEXT *Context)
 
VOID Md5Update (MD5_CONTEXT *Context, CONST UINT8 *Data, UINTN Len)
 
VOID Md5Final (MD5_CONTEXT *Context, UINT8 *Hash)
 
VOID Md5 (UINT8 *Hash, UINT8 *Data, UINTN Len)
 
VOID Sha1Init (SHA1_CONTEXT *Context)
 
VOID Sha1Update (SHA1_CONTEXT *Context, CONST UINT8 *Data, UINTN Len)
 
VOID Sha1Final (SHA1_CONTEXT *Context, UINT8 *Hash)
 
VOID Sha1 (UINT8 *Hash, UINT8 *Data, UINTN Len)
 
VOID Sha256Init (SHA256_CONTEXT *Context)
 
VOID Sha256Update (SHA256_CONTEXT *Context, CONST UINT8 *Data, UINTN Len)
 
VOID Sha256Final (SHA256_CONTEXT *Context, UINT8 *HashDigest)
 
VOID Sha256 (UINT8 *Hash, CONST UINT8 *Data, UINTN Len)
 
VOID Sha512Init (SHA512_CONTEXT *Context)
 
VOID Sha512Update (SHA512_CONTEXT *Context, CONST UINT8 *Data, UINTN Len)
 
VOID Sha512Final (SHA512_CONTEXT *Context, UINT8 *HashDigest)
 
VOID Sha512 (UINT8 *Hash, CONST UINT8 *Data, UINTN Len)
 
VOID Sha384Init (SHA384_CONTEXT *Context)
 
VOID Sha384Update (SHA384_CONTEXT *Context, CONST UINT8 *Data, UINTN Len)
 
VOID Sha384Final (SHA384_CONTEXT *Context, UINT8 *HashDigest)
 
VOID Sha384 (UINT8 *Hash, CONST UINT8 *Data, UINTN Len)
 
BOOLEAN EFIAPI TryEnableAccel (VOID)
 
INTN SigVerifyShaHashBySize (IN CONST VOID *Data, IN UINTN DataSize, IN CONST UINT8 *Hash, IN UINTN HashSize)
 
 STATIC_ASSERT (RSA_MOD_MAX_SIZE<=MAX_UINTN/3U, "The definition of RSA_SCRATCH_BUFFER_SIZE may cause an overflow")
 
BOOLEAN RsaVerifySigHashFromKey (IN CONST OC_RSA_PUBLIC_KEY *Key, IN CONST UINT8 *Signature, IN UINTN SignatureSize, IN CONST UINT8 *Hash, IN UINTN HashSize, IN OC_SIG_HASH_TYPE Algorithm, IN VOID *Scratch)
 
BOOLEAN RsaVerifySigHashFromKeyDynalloc (IN CONST OC_RSA_PUBLIC_KEY *Key, IN CONST UINT8 *Signature, IN UINTN SignatureSize, IN CONST UINT8 *Hash, IN UINTN HashSize, IN OC_SIG_HASH_TYPE Algorithm)
 
BOOLEAN RsaVerifySigDataFromKey (IN CONST OC_RSA_PUBLIC_KEY *Key, IN CONST UINT8 *Signature, IN UINTN SignatureSize, IN CONST UINT8 *Data, IN UINTN DataSize, IN OC_SIG_HASH_TYPE Algorithm, IN VOID *Scratch)
 
BOOLEAN RsaVerifySigDataFromKeyDynalloc (IN CONST OC_RSA_PUBLIC_KEY *Key, IN CONST UINT8 *Signature, IN UINTN SignatureSize, IN CONST UINT8 *Data, IN UINTN DataSize, IN OC_SIG_HASH_TYPE Algorithm)
 
BOOLEAN RsaVerifySigDataFromData (IN CONST UINT8 *Modulus, IN UINTN ModulusSize, IN UINT32 Exponent, IN CONST UINT8 *Signature, IN UINTN SignatureSize, IN CONST UINT8 *Data, IN UINTN DataSize, IN OC_SIG_HASH_TYPE Algorithm)
 
INTN SecureCompareMem (IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
 
VOID * SecureZeroMem (OUT VOID *Buffer, IN UINTN Length)
 
VOID OcHashPasswordSha512 (IN CONST UINT8 *Password, IN UINT32 PasswordSize, IN CONST UINT8 *Salt, IN UINT32 SaltSize, OUT UINT8 *Hash)
 
BOOLEAN OcVerifyPasswordSha512 (IN CONST UINT8 *Password, IN UINT32 PasswordSize, IN CONST UINT8 *Salt, IN UINT32 SaltSize, IN CONST UINT8 *RefHash)
 

Detailed Description

OcCryptoLib

Copyright (c) 2018, savvas

All rights reserved.

This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

Definition in file OcCryptoLib.h.

Macro Definition Documentation

◆ AES_BLOCK_SIZE

#define AES_BLOCK_SIZE   16

Definition at line 61 of file OcCryptoLib.h.

◆ AES_KEY_EXP_SIZE

#define AES_KEY_EXP_SIZE   176

Definition at line 71 of file OcCryptoLib.h.

◆ CHACHA_IV_SIZE

#define CHACHA_IV_SIZE   12

Definition at line 84 of file OcCryptoLib.h.

◆ CHACHA_KEY_SIZE

#define CHACHA_KEY_SIZE   32

Definition at line 79 of file OcCryptoLib.h.

◆ CONFIG_AES_KEY_SIZE

#define CONFIG_AES_KEY_SIZE   16

Definition at line 26 of file OcCryptoLib.h.

◆ MD5_DIGEST_SIZE

#define MD5_DIGEST_SIZE   16

Definition at line 43 of file OcCryptoLib.h.

◆ OC_CRYPTO_SUPPORTS_MD5

#define OC_CRYPTO_SUPPORTS_MD5   1

Definition at line 37 of file OcCryptoLib.h.

◆ OC_CRYPTO_SUPPORTS_SHA1

#define OC_CRYPTO_SUPPORTS_SHA1   1

Definition at line 36 of file OcCryptoLib.h.

◆ OC_CRYPTO_SUPPORTS_SHA256

#define OC_CRYPTO_SUPPORTS_SHA256   1

Definition at line 33 of file OcCryptoLib.h.

◆ OC_CRYPTO_SUPPORTS_SHA384

#define OC_CRYPTO_SUPPORTS_SHA384   1

Definition at line 34 of file OcCryptoLib.h.

◆ OC_CRYPTO_SUPPORTS_SHA512

#define OC_CRYPTO_SUPPORTS_SHA512   1

Definition at line 35 of file OcCryptoLib.h.

◆ OC_MAX_SHA_DIGEST_SIZE

#define OC_MAX_SHA_DIGEST_SIZE   SHA512_DIGEST_SIZE

Definition at line 49 of file OcCryptoLib.h.

◆ OC_PASSWORD_MAX_LEN

#define OC_PASSWORD_MAX_LEN   32

Definition at line 89 of file OcCryptoLib.h.

◆ OC_PASSWORD_MAX_RETRIES

#define OC_PASSWORD_MAX_RETRIES   3

Definition at line 94 of file OcCryptoLib.h.

◆ RSA_MOD_MAX_SIZE

#define RSA_MOD_MAX_SIZE   BASE_16KB

Definition at line 425 of file OcCryptoLib.h.

◆ RSA_SCRATCH_BUFFER_SIZE

#define RSA_SCRATCH_BUFFER_SIZE ( ModulusSize)
Value:
((ModulusSize) * 3U)
Parameters
[in]ModulusSizeModulus size in bytes. Must be at most RSA_MOD_MAX_SIZE.

Definition at line 431 of file OcCryptoLib.h.

◆ SHA1_DIGEST_SIZE

#define SHA1_DIGEST_SIZE   20

Definition at line 44 of file OcCryptoLib.h.

◆ SHA256_BLOCK_SIZE

#define SHA256_BLOCK_SIZE   64

Definition at line 54 of file OcCryptoLib.h.

◆ SHA256_DIGEST_SIZE

#define SHA256_DIGEST_SIZE   32

Definition at line 45 of file OcCryptoLib.h.

◆ SHA384_BLOCK_SIZE

#define SHA384_BLOCK_SIZE   SHA512_BLOCK_SIZE

Definition at line 56 of file OcCryptoLib.h.

◆ SHA384_DIGEST_SIZE

#define SHA384_DIGEST_SIZE   48

Definition at line 46 of file OcCryptoLib.h.

◆ SHA512_BLOCK_SIZE

#define SHA512_BLOCK_SIZE   128

Definition at line 55 of file OcCryptoLib.h.

◆ SHA512_DIGEST_SIZE

#define SHA512_DIGEST_SIZE   64

Definition at line 47 of file OcCryptoLib.h.

Typedef Documentation

◆ AES_CONTEXT

typedef struct AES_CONTEXT_ AES_CONTEXT

◆ CHACHA_CONTEXT

◆ MD5_CONTEXT

typedef struct MD5_CONTEXT_ MD5_CONTEXT

◆ OC_SIG_HASH_TYPE

◆ SHA1_CONTEXT

typedef struct SHA1_CONTEXT_ SHA1_CONTEXT

◆ SHA256_CONTEXT

◆ SHA384_CONTEXT

Definition at line 146 of file OcCryptoLib.h.

◆ SHA512_CONTEXT

Enumeration Type Documentation

◆ OC_SIG_HASH_TYPE_

Enumerator
OcSigHashTypeSha256 
OcSigHashTypeSha384 
OcSigHashTypeSha512 
OcSigHashTypeMax 

Definition at line 101 of file OcCryptoLib.h.

Function Documentation

◆ AesCbcDecryptBuffer()

VOID AesCbcDecryptBuffer ( IN OUT AES_CONTEXT * Context,
IN OUT UINT8 * Data,
IN UINT32 Len )

Definition at line 611 of file Aes.c.

◆ AesCbcEncryptBuffer()

VOID AesCbcEncryptBuffer ( IN OUT AES_CONTEXT * Context,
IN OUT UINT8 * Data,
IN UINT32 Len )

Definition at line 586 of file Aes.c.

◆ AesCtrXcryptBuffer()

VOID AesCtrXcryptBuffer ( IN OUT AES_CONTEXT * Context,
IN OUT UINT8 * Data,
IN UINT32 Len )

Definition at line 634 of file Aes.c.

◆ AesInitCtxIv()

VOID AesInitCtxIv ( OUT AES_CONTEXT * Context,
IN CONST UINT8 * Key,
IN CONST UINT8 * Iv )

Definition at line 250 of file Aes.c.

◆ AesSetCtxIv()

VOID AesSetCtxIv ( OUT AES_CONTEXT * Context,
IN CONST UINT8 * Iv )

Definition at line 261 of file Aes.c.

◆ ChaChaCryptBuffer()

VOID ChaChaCryptBuffer ( IN OUT CHACHA_CONTEXT * Context,
IN CONST UINT8 * Source,
OUT UINT8 * Destination,
IN UINT32 Length )

Perform ChaCha encryption/decryption. Source may match Destination.

Parameters
[in,out]ContextChaCha context.
[in]SourceData for transformation.
[out]DestinationResulting data.
[in]LengthData and ciphertext lengths.

Definition at line 74 of file ChaCha.c.

◆ ChaChaInitCtx()

VOID ChaChaInitCtx ( OUT CHACHA_CONTEXT * Context,
IN CONST UINT8 * Key,
IN CONST UINT8 * Iv,
IN UINT32 Counter )

Setup ChaCha context (IETF variant).

Parameters
[out]ContextChaCha context.
[in]KeyChaCha 256-bit key.
[in]IvChaCha 96-bit initialisation vector.
[in]CounterChaCha 32-bit counter.

Definition at line 48 of file ChaCha.c.

◆ Md5()

VOID Md5 ( UINT8 * Hash,
UINT8 * Data,
UINTN Len )

◆ Md5Final()

VOID Md5Final ( MD5_CONTEXT * Context,
UINT8 * Hash )

◆ Md5Init()

VOID Md5Init ( MD5_CONTEXT * Context)

◆ Md5Update()

VOID Md5Update ( MD5_CONTEXT * Context,
CONST UINT8 * Data,
UINTN Len )

◆ OcHashPasswordSha512()

VOID OcHashPasswordSha512 ( IN CONST UINT8 * Password,
IN UINT32 PasswordSize,
IN CONST UINT8 * Salt,
IN UINT32 SaltSize,
OUT UINT8 * Hash )

Hash Password and Salt into a PasswordHash. The used hash function is SHA-512, thus the caller must ensure RefHash is at least 64 bytes in size.

Parameters
[in]PasswordThe entered password to hash.
[in]PasswordSizeThe size, in bytes, of Password.
[in]SaltThe cryptographic salt appended to Password on hash.
[in]SaltSizeThe size, in bytes, of Salt.
[in]HashThe SHA-512 hash of Password and Salt.

Definition at line 17 of file PasswordHash.c.

◆ OcVerifyPasswordSha512()

BOOLEAN OcVerifyPasswordSha512 ( IN CONST UINT8 * Password,
IN UINT32 PasswordSize,
IN CONST UINT8 * Salt,
IN UINT32 SaltSize,
IN CONST UINT8 * RefHash )

Verify Password and Salt against RefHash. The used hash function is SHA-512, thus the caller must ensure RefHash is at least 64 bytes in size.

Parameters
[in]PasswordThe entered password to verify.
[in]PasswordSizeThe size, in bytes, of Password.
[in]SaltThe cryptographic salt appended to Password on hash.
[in]SaltSizeThe size, in bytes, of Salt.
[in]RefHashThe SHA-512 hash of the reference password and Salt.
Returns
Whether Password and Salt cryptographically match RefHash.

Definition at line 69 of file PasswordHash.c.

◆ RsaVerifySigDataFromData()

BOOLEAN RsaVerifySigDataFromData ( IN CONST UINT8 * Modulus,
IN UINTN ModulusSize,
IN UINT32 Exponent,
IN CONST UINT8 * Signature,
IN UINTN SignatureSize,
IN CONST UINT8 * Data,
IN UINTN DataSize,
IN OC_SIG_HASH_TYPE Algorithm )

Verify RSA PKCS1.5 signed data against its signature. The modulus' size must be a multiple of the configured BIGNUM word size. This will be true for any conventional RSA, which use two's potencies.

Parameters
[in]ModulusThe RSA modulus byte array.
[in]ModulusSizeThe size, in bytes, of Modulus.
[in]ExponentThe RSA exponent.
[in]SignatureThe RSA signature to be verified.
[in]SignatureSizeSize, in bytes, of Signature.
[in]DataThe signed data to verify.
[in]DataSizeSize, in bytes, of Data.
[in]AlgorithmThe RSA algorithm used.
Returns
Whether the signature has been successfully verified as valid.

Definition at line 488 of file RsaDigitalSign.c.

◆ RsaVerifySigDataFromKey()

BOOLEAN RsaVerifySigDataFromKey ( IN CONST OC_RSA_PUBLIC_KEY * Key,
IN CONST UINT8 * Signature,
IN UINTN SignatureSize,
IN CONST UINT8 * Data,
IN UINTN DataSize,
IN OC_SIG_HASH_TYPE Algorithm,
IN VOID * Scratch )

Verify RSA PKCS1.5 signed data against its signature. The modulus' size must be a multiple of the configured BIGNUM word size. This will be true for any conventional RSA, which use two's potencies. The exponent is always 65537 as per the format specification.

Parameters
[in]KeyThe RSA Public Key.
[in]SignatureThe RSA signature to be verified.
[in]SignatureSizeSize, in bytes, of Signature.
[in]DataThe signed data to verify.
[in]DataSizeSize, in bytes, of Data.
[in]AlgorithmThe RSA algorithm used.
[in]ScratchScratch buffer 3xModulo.
Returns
Whether the signature has been successfully verified as valid.

Definition at line 673 of file RsaDigitalSign.c.

◆ RsaVerifySigDataFromKeyDynalloc()

BOOLEAN RsaVerifySigDataFromKeyDynalloc ( IN CONST OC_RSA_PUBLIC_KEY * Key,
IN CONST UINT8 * Signature,
IN UINTN SignatureSize,
IN CONST UINT8 * Data,
IN UINTN DataSize,
IN OC_SIG_HASH_TYPE Algorithm )

Verify RSA PKCS1.5 signed data against its signature. The modulus' size must be a multiple of the configured BIGNUM word size. This will be true for any conventional RSA, which use two's potencies. The exponent is always 65537 as per the format specification.

Parameters
[in]KeyThe RSA Public Key.
[in]SignatureThe RSA signature to be verified.
[in]SignatureSizeSize, in bytes, of Signature.
[in]DataThe signed data to verify.
[in]DataSizeSize, in bytes, of Data.
[in]AlgorithmThe RSA algorithm used.
Returns
Whether the signature has been successfully verified as valid.

Definition at line 715 of file RsaDigitalSign.c.

◆ RsaVerifySigHashFromKey()

BOOLEAN RsaVerifySigHashFromKey ( IN CONST OC_RSA_PUBLIC_KEY * Key,
IN CONST UINT8 * Signature,
IN UINTN SignatureSize,
IN CONST UINT8 * Hash,
IN UINTN HashSize,
IN OC_SIG_HASH_TYPE Algorithm,
IN VOID * Scratch )

Verify a RSA PKCS1.5 signature against an expected hash. The exponent is always 65537 as per the format specification.

Parameters
[in]KeyThe RSA Public Key.
[in]SignatureThe RSA signature to be verified.
[in]SignatureSizeSize, in bytes, of Signature.
[in]HashThe Hash digest of the signed data.
[in]HashSizeSize, in bytes, of Hash.
[in]AlgorithmThe RSA algorithm used.
[in]ScratchScratch buffer 3xModulo.
Returns
Whether the signature has been successfully verified as valid.

Definition at line 589 of file RsaDigitalSign.c.

◆ RsaVerifySigHashFromKeyDynalloc()

BOOLEAN RsaVerifySigHashFromKeyDynalloc ( IN CONST OC_RSA_PUBLIC_KEY * Key,
IN CONST UINT8 * Signature,
IN UINTN SignatureSize,
IN CONST UINT8 * Hash,
IN UINTN HashSize,
IN OC_SIG_HASH_TYPE Algorithm )

Verify a RSA PKCS1.5 signature against an expected hash. The exponent is always 65537 as per the format specification.

Parameters
[in]KeyThe RSA Public Key.
[in]SignatureThe RSA signature to be verified.
[in]SignatureSizeSize, in bytes, of Signature.
[in]HashThe Hash digest of the signed data.
[in]HashSizeSize, in bytes, of Hash.
[in]AlgorithmThe RSA algorithm used.
Returns
Whether the signature has been successfully verified as valid.

Definition at line 631 of file RsaDigitalSign.c.

◆ SecureCompareMem()

INTN SecureCompareMem ( IN CONST VOID * DestinationBuffer,
IN CONST VOID * SourceBuffer,
IN UINTN Length )

Performs a cryptographically secure comparison of the contents of two buffers.

This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer in a cryptographically secure fashion. This especially implies that different lengths of the longest shared prefix do not change execution time in a way relevant to security.

If Length > 0 and DestinationBuffer is NULL, then ASSERT(). If Length > 0 and SourceBuffer is NULL, then ASSERT(). If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().

Parameters
DestinationBufferThe pointer to the destination buffer to compare.
SourceBufferThe pointer to the source buffer to compare.
LengthThe number of bytes to compare.
Returns
0 All Length bytes of the two buffers are identical.
Return values
-1The two buffers are not identical within Length bytes.

Definition at line 17 of file SecureMem.c.

◆ SecureZeroMem()

VOID * SecureZeroMem ( OUT VOID * Buffer,
IN UINTN Length )

Performs a cryptographically secure memory zeroing.

If Length > 0 and Buffer is NULL, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().

Parameters
[out]BufferThe pointer to the destination buffer to zero.
[in]LengthThe number of bytes to zero.
Returns
Buffer.

Definition at line 73 of file SecureMem.c.

◆ Sha1()

VOID Sha1 ( UINT8 * Hash,
UINT8 * Data,
UINTN Len )

◆ Sha1Final()

VOID Sha1Final ( SHA1_CONTEXT * Context,
UINT8 * Hash )

◆ Sha1Init()

VOID Sha1Init ( SHA1_CONTEXT * Context)

◆ Sha1Update()

VOID Sha1Update ( SHA1_CONTEXT * Context,
CONST UINT8 * Data,
UINTN Len )

◆ Sha256()

VOID Sha256 ( UINT8 * Hash,
CONST UINT8 * Data,
UINTN Len )

◆ Sha256Final()

VOID Sha256Final ( SHA256_CONTEXT * Context,
UINT8 * HashDigest )

◆ Sha256Init()

VOID Sha256Init ( SHA256_CONTEXT * Context)

◆ Sha256Update()

VOID Sha256Update ( SHA256_CONTEXT * Context,
CONST UINT8 * Data,
UINTN Len )

◆ Sha384()

VOID Sha384 ( UINT8 * Hash,
CONST UINT8 * Data,
UINTN Len )

◆ Sha384Final()

VOID Sha384Final ( SHA384_CONTEXT * Context,
UINT8 * HashDigest )

◆ Sha384Init()

VOID Sha384Init ( SHA384_CONTEXT * Context)

◆ Sha384Update()

VOID Sha384Update ( SHA384_CONTEXT * Context,
CONST UINT8 * Data,
UINTN Len )

◆ Sha512()

VOID Sha512 ( UINT8 * Hash,
CONST UINT8 * Data,
UINTN Len )

◆ Sha512Final()

VOID Sha512Final ( SHA512_CONTEXT * Context,
UINT8 * HashDigest )

◆ Sha512Init()

VOID Sha512Init ( SHA512_CONTEXT * Context)

◆ Sha512Update()

VOID Sha512Update ( SHA512_CONTEXT * Context,
CONST UINT8 * Data,
UINTN Len )

◆ SigVerifyShaHashBySize()

INTN SigVerifyShaHashBySize ( IN CONST VOID * Data,
IN UINTN DataSize,
IN CONST UINT8 * Hash,
IN UINTN HashSize )

Verifies Data against Hash with the appropiate SHA2 algorithm for HashSize.

Parameters
[in]DataThe data to verify the hash of.
[in]DataSizeThe, in bytes, of Data.
[in]HashThe reference hash to verify against.
[in]HashSizeThe size, in bytes, of Hash.
Returns
0 All HashSize bytes of the two buffers are identical.
Return values
Non-zeroIf HashSize is not a valid SHA2 digest size, -1. Otherwise, the first mismatched byte in Data's hash subtracted from the first mismatched byte in Hash.

Definition at line 87 of file RsaDigitalSign.c.

◆ STATIC_ASSERT() [1/3]

STATIC_ASSERT ( RSA_MOD_MAX_SIZE<=MAX_UINTN/ 3U,
"The definition of RSA_SCRATCH_BUFFER_SIZE may cause an overflow"  )

◆ STATIC_ASSERT() [2/3]

STATIC_ASSERT ( sizeof(OC_RSA_PUBLIC_KEY_HDR) = =16,
"The PK header struct is malformed."  )

◆ STATIC_ASSERT() [3/3]

STATIC_ASSERT ( sizeof(OC_RSA_PUBLIC_KEY_HDR) = =sizeof(OC_RSA_PUBLIC_KEY_HDR),
"The PK struct is malformed."  )

◆ TryEnableAccel()

BOOLEAN EFIAPI TryEnableAccel ( VOID )

Definition at line 34 of file Sha512AccelDummy.c.