X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=CryptoPkg%2FInclude%2FLibrary%2FBaseCryptLib.h;h=67837aec1dd284ff93bb3eab406d60fa490e64f5;hp=0745e9316d4f8d73e0fda25c16f89eed0f4dce73;hb=a8f37449c7e355e6402e3876c9db9e11d875164f;hpb=b7d320f8117ed2fffe001b1a0b7bfcd4f40fafc4 diff --git a/CryptoPkg/Include/Library/BaseCryptLib.h b/CryptoPkg/Include/Library/BaseCryptLib.h index 0745e9316d..67837aec1d 100644 --- a/CryptoPkg/Include/Library/BaseCryptLib.h +++ b/CryptoPkg/Include/Library/BaseCryptLib.h @@ -4,7 +4,7 @@ primitives (Hash Serials, HMAC, RSA, Diffie-Hellman, etc) for UEFI security functionality enabling. -Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2016, Intel Corporation. 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 @@ -18,6 +18,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #ifndef __BASE_CRYPT_LIB_H__ #define __BASE_CRYPT_LIB_H__ +#include + /// /// MD4 digest size in bytes /// @@ -38,6 +40,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. /// #define SHA256_DIGEST_SIZE 32 +/// +/// SHA-384 digest size in bytes +/// +#define SHA384_DIGEST_SIZE 48 + +/// +/// SHA-512 digest size in bytes +/// +#define SHA512_DIGEST_SIZE 64 + /// /// TDES block size in bytes /// @@ -69,7 +81,10 @@ typedef enum { /** Retrieves the size, in bytes, of the context buffer required for MD4 hash operations. + If this interface is not supported, then return zero. + @return The size, in bytes, of the context buffer required for MD4 hash operations. + @retval 0 This interface is not supported. **/ UINTN @@ -82,12 +97,14 @@ Md4GetContextSize ( Initializes user-supplied memory pointed by Md4Context as MD4 hash context for subsequent use. - If Md4Context is NULL, then ASSERT(). + If Md4Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[out] Md4Context Pointer to MD4 context being initialized. @retval TRUE MD4 context initialization succeeded. @retval FALSE MD4 context initialization failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -99,14 +116,16 @@ Md4Init ( /** Makes a copy of an existing MD4 context. - If Md4Context is NULL, then ASSERT(). - If NewMd4Context is NULL, then ASSERT(). + If Md4Context is NULL, then return FALSE. + If NewMd4Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] Md4Context Pointer to MD4 context being copied. @param[out] NewMd4Context Pointer to new MD4 context. @retval TRUE MD4 context copy succeeded. @retval FALSE MD4 context copy failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -124,7 +143,8 @@ Md4Duplicate ( MD4 context should be already correctly intialized by Md4Init(), and should not be finalized by Md4Final(). Behavior with invalid context is undefined. - If Md4Context is NULL, then ASSERT(). + If Md4Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in, out] Md4Context Pointer to the MD4 context. @param[in] Data Pointer to the buffer containing the data to be hashed. @@ -132,6 +152,7 @@ Md4Duplicate ( @retval TRUE MD4 data digest succeeded. @retval FALSE MD4 data digest failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -151,8 +172,9 @@ Md4Update ( MD4 context should be already correctly intialized by Md4Init(), and should not be finalized by Md4Final(). Behavior with invalid MD4 context is undefined. - If Md4Context is NULL, then ASSERT(). - If HashValue is NULL, then ASSERT(). + If Md4Context is NULL, then return FALSE. + If HashValue is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in, out] Md4Context Pointer to the MD4 context. @param[out] HashValue Pointer to a buffer that receives the MD4 digest @@ -160,6 +182,7 @@ Md4Update ( @retval TRUE MD4 digest computation succeeded. @retval FALSE MD4 digest computation failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -169,10 +192,39 @@ Md4Final ( OUT UINT8 *HashValue ); +/** + Computes the MD4 message digest of a input data buffer. + + This function performs the MD4 message digest of a given data buffer, and places + the digest value into the specified memory. + + If this interface is not supported, then return FALSE. + + @param[in] Data Pointer to the buffer containing the data to be hashed. + @param[in] DataSize Size of Data buffer in bytes. + @param[out] HashValue Pointer to a buffer that receives the MD4 digest + value (16 bytes). + + @retval TRUE MD4 digest computation succeeded. + @retval FALSE MD4 digest computation failed. + @retval FALSE This interface is not supported. + +**/ +BOOLEAN +EFIAPI +Md4HashAll ( + IN CONST VOID *Data, + IN UINTN DataSize, + OUT UINT8 *HashValue + ); + /** Retrieves the size, in bytes, of the context buffer required for MD5 hash operations. + If this interface is not supported, then return zero. + @return The size, in bytes, of the context buffer required for MD5 hash operations. + @retval 0 This interface is not supported. **/ UINTN @@ -185,12 +237,14 @@ Md5GetContextSize ( Initializes user-supplied memory pointed by Md5Context as MD5 hash context for subsequent use. - If Md5Context is NULL, then ASSERT(). + If Md5Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[out] Md5Context Pointer to MD5 context being initialized. @retval TRUE MD5 context initialization succeeded. @retval FALSE MD5 context initialization failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -202,14 +256,16 @@ Md5Init ( /** Makes a copy of an existing MD5 context. - If Md5Context is NULL, then ASSERT(). - If NewMd5Context is NULL, then ASSERT(). + If Md5Context is NULL, then return FALSE. + If NewMd5Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] Md5Context Pointer to MD5 context being copied. @param[out] NewMd5Context Pointer to new MD5 context. @retval TRUE MD5 context copy succeeded. @retval FALSE MD5 context copy failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -227,7 +283,8 @@ Md5Duplicate ( MD5 context should be already correctly intialized by Md5Init(), and should not be finalized by Md5Final(). Behavior with invalid context is undefined. - If Md5Context is NULL, then ASSERT(). + If Md5Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in, out] Md5Context Pointer to the MD5 context. @param[in] Data Pointer to the buffer containing the data to be hashed. @@ -235,6 +292,7 @@ Md5Duplicate ( @retval TRUE MD5 data digest succeeded. @retval FALSE MD5 data digest failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -254,8 +312,9 @@ Md5Update ( MD5 context should be already correctly intialized by Md5Init(), and should not be finalized by Md5Final(). Behavior with invalid MD5 context is undefined. - If Md5Context is NULL, then ASSERT(). - If HashValue is NULL, then ASSERT(). + If Md5Context is NULL, then return FALSE. + If HashValue is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in, out] Md5Context Pointer to the MD5 context. @param[out] HashValue Pointer to a buffer that receives the MD5 digest @@ -263,6 +322,7 @@ Md5Update ( @retval TRUE MD5 digest computation succeeded. @retval FALSE MD5 digest computation failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -272,10 +332,39 @@ Md5Final ( OUT UINT8 *HashValue ); +/** + Computes the MD5 message digest of a input data buffer. + + This function performs the MD5 message digest of a given data buffer, and places + the digest value into the specified memory. + + If this interface is not supported, then return FALSE. + + @param[in] Data Pointer to the buffer containing the data to be hashed. + @param[in] DataSize Size of Data buffer in bytes. + @param[out] HashValue Pointer to a buffer that receives the MD5 digest + value (16 bytes). + + @retval TRUE MD5 digest computation succeeded. + @retval FALSE MD5 digest computation failed. + @retval FALSE This interface is not supported. + +**/ +BOOLEAN +EFIAPI +Md5HashAll ( + IN CONST VOID *Data, + IN UINTN DataSize, + OUT UINT8 *HashValue + ); + /** Retrieves the size, in bytes, of the context buffer required for SHA-1 hash operations. + If this interface is not supported, then return zero. + @return The size, in bytes, of the context buffer required for SHA-1 hash operations. + @retval 0 This interface is not supported. **/ UINTN @@ -288,12 +377,14 @@ Sha1GetContextSize ( Initializes user-supplied memory pointed by Sha1Context as SHA-1 hash context for subsequent use. - If Sha1Context is NULL, then ASSERT(). + If Sha1Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[out] Sha1Context Pointer to SHA-1 context being initialized. @retval TRUE SHA-1 context initialization succeeded. @retval FALSE SHA-1 context initialization failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -305,14 +396,16 @@ Sha1Init ( /** Makes a copy of an existing SHA-1 context. - If Sha1Context is NULL, then ASSERT(). - If NewSha1Context is NULL, then ASSERT(). + If Sha1Context is NULL, then return FALSE. + If NewSha1Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] Sha1Context Pointer to SHA-1 context being copied. @param[out] NewSha1Context Pointer to new SHA-1 context. @retval TRUE SHA-1 context copy succeeded. @retval FALSE SHA-1 context copy failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -330,7 +423,8 @@ Sha1Duplicate ( SHA-1 context should be already correctly intialized by Sha1Init(), and should not be finalized by Sha1Final(). Behavior with invalid context is undefined. - If Sha1Context is NULL, then ASSERT(). + If Sha1Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in, out] Sha1Context Pointer to the SHA-1 context. @param[in] Data Pointer to the buffer containing the data to be hashed. @@ -338,6 +432,7 @@ Sha1Duplicate ( @retval TRUE SHA-1 data digest succeeded. @retval FALSE SHA-1 data digest failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -357,8 +452,9 @@ Sha1Update ( SHA-1 context should be already correctly intialized by Sha1Init(), and should not be finalized by Sha1Final(). Behavior with invalid SHA-1 context is undefined. - If Sha1Context is NULL, then ASSERT(). - If HashValue is NULL, then ASSERT(). + If Sha1Context is NULL, then return FALSE. + If HashValue is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in, out] Sha1Context Pointer to the SHA-1 context. @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest @@ -366,6 +462,7 @@ Sha1Update ( @retval TRUE SHA-1 digest computation succeeded. @retval FALSE SHA-1 digest computation failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -375,6 +472,32 @@ Sha1Final ( OUT UINT8 *HashValue ); +/** + Computes the SHA-1 message digest of a input data buffer. + + This function performs the SHA-1 message digest of a given data buffer, and places + the digest value into the specified memory. + + If this interface is not supported, then return FALSE. + + @param[in] Data Pointer to the buffer containing the data to be hashed. + @param[in] DataSize Size of Data buffer in bytes. + @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest + value (20 bytes). + + @retval TRUE SHA-1 digest computation succeeded. + @retval FALSE SHA-1 digest computation failed. + @retval FALSE This interface is not supported. + +**/ +BOOLEAN +EFIAPI +Sha1HashAll ( + IN CONST VOID *Data, + IN UINTN DataSize, + OUT UINT8 *HashValue + ); + /** Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations. @@ -391,7 +514,7 @@ Sha256GetContextSize ( Initializes user-supplied memory pointed by Sha256Context as SHA-256 hash context for subsequent use. - If Sha256Context is NULL, then ASSERT(). + If Sha256Context is NULL, then return FALSE. @param[out] Sha256Context Pointer to SHA-256 context being initialized. @@ -408,14 +531,16 @@ Sha256Init ( /** Makes a copy of an existing SHA-256 context. - If Sha256Context is NULL, then ASSERT(). - If NewSha256Context is NULL, then ASSERT(). + If Sha256Context is NULL, then return FALSE. + If NewSha256Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] Sha256Context Pointer to SHA-256 context being copied. @param[out] NewSha256Context Pointer to new SHA-256 context. @retval TRUE SHA-256 context copy succeeded. @retval FALSE SHA-256 context copy failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -433,7 +558,7 @@ Sha256Duplicate ( SHA-256 context should be already correctly intialized by Sha256Init(), and should not be finalized by Sha256Final(). Behavior with invalid context is undefined. - If Sha256Context is NULL, then ASSERT(). + If Sha256Context is NULL, then return FALSE. @param[in, out] Sha256Context Pointer to the SHA-256 context. @param[in] Data Pointer to the buffer containing the data to be hashed. @@ -460,8 +585,8 @@ Sha256Update ( SHA-256 context should be already correctly intialized by Sha256Init(), and should not be finalized by Sha256Final(). Behavior with invalid SHA-256 context is undefined. - If Sha256Context is NULL, then ASSERT(). - If HashValue is NULL, then ASSERT(). + If Sha256Context is NULL, then return FALSE. + If HashValue is NULL, then return FALSE. @param[in, out] Sha256Context Pointer to the SHA-256 context. @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest @@ -478,6 +603,293 @@ Sha256Final ( OUT UINT8 *HashValue ); +/** + Computes the SHA-256 message digest of a input data buffer. + + This function performs the SHA-256 message digest of a given data buffer, and places + the digest value into the specified memory. + + If this interface is not supported, then return FALSE. + + @param[in] Data Pointer to the buffer containing the data to be hashed. + @param[in] DataSize Size of Data buffer in bytes. + @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest + value (32 bytes). + + @retval TRUE SHA-256 digest computation succeeded. + @retval FALSE SHA-256 digest computation failed. + @retval FALSE This interface is not supported. + +**/ +BOOLEAN +EFIAPI +Sha256HashAll ( + IN CONST VOID *Data, + IN UINTN DataSize, + OUT UINT8 *HashValue + ); + +/** + Retrieves the size, in bytes, of the context buffer required for SHA-384 hash operations. + + @return The size, in bytes, of the context buffer required for SHA-384 hash operations. + +**/ +UINTN +EFIAPI +Sha384GetContextSize ( + VOID + ); + +/** + Initializes user-supplied memory pointed by Sha384Context as SHA-384 hash context for + subsequent use. + + If Sha384Context is NULL, then return FALSE. + + @param[out] Sha384Context Pointer to SHA-384 context being initialized. + + @retval TRUE SHA-384 context initialization succeeded. + @retval FALSE SHA-384 context initialization failed. + +**/ +BOOLEAN +EFIAPI +Sha384Init ( + OUT VOID *Sha384Context + ); + +/** + Makes a copy of an existing SHA-384 context. + + If Sha384Context is NULL, then return FALSE. + If NewSha384Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. + + @param[in] Sha384Context Pointer to SHA-384 context being copied. + @param[out] NewSha384Context Pointer to new SHA-384 context. + + @retval TRUE SHA-384 context copy succeeded. + @retval FALSE SHA-384 context copy failed. + @retval FALSE This interface is not supported. + +**/ +BOOLEAN +EFIAPI +Sha384Duplicate ( + IN CONST VOID *Sha384Context, + OUT VOID *NewSha384Context + ); + +/** + Digests the input data and updates SHA-384 context. + + This function performs SHA-384 digest on a data buffer of the specified size. + It can be called multiple times to compute the digest of long or discontinuous data streams. + SHA-384 context should be already correctly intialized by Sha384Init(), and should not be finalized + by Sha384Final(). Behavior with invalid context is undefined. + + If Sha384Context is NULL, then return FALSE. + + @param[in, out] Sha384Context Pointer to the SHA-384 context. + @param[in] Data Pointer to the buffer containing the data to be hashed. + @param[in] DataSize Size of Data buffer in bytes. + + @retval TRUE SHA-384 data digest succeeded. + @retval FALSE SHA-384 data digest failed. + +**/ +BOOLEAN +EFIAPI +Sha384Update ( + IN OUT VOID *Sha384Context, + IN CONST VOID *Data, + IN UINTN DataSize + ); + +/** + Completes computation of the SHA-384 digest value. + + This function completes SHA-384 hash computation and retrieves the digest value into + the specified memory. After this function has been called, the SHA-384 context cannot + be used again. + SHA-384 context should be already correctly intialized by Sha384Init(), and should not be + finalized by Sha384Final(). Behavior with invalid SHA-384 context is undefined. + + If Sha384Context is NULL, then return FALSE. + If HashValue is NULL, then return FALSE. + + @param[in, out] Sha384Context Pointer to the SHA-384 context. + @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest + value (48 bytes). + + @retval TRUE SHA-384 digest computation succeeded. + @retval FALSE SHA-384 digest computation failed. + +**/ +BOOLEAN +EFIAPI +Sha384Final ( + IN OUT VOID *Sha384Context, + OUT UINT8 *HashValue + ); + +/** + Computes the SHA-384 message digest of a input data buffer. + + This function performs the SHA-384 message digest of a given data buffer, and places + the digest value into the specified memory. + + If this interface is not supported, then return FALSE. + + @param[in] Data Pointer to the buffer containing the data to be hashed. + @param[in] DataSize Size of Data buffer in bytes. + @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest + value (48 bytes). + + @retval TRUE SHA-384 digest computation succeeded. + @retval FALSE SHA-384 digest computation failed. + @retval FALSE This interface is not supported. + +**/ +BOOLEAN +EFIAPI +Sha384HashAll ( + IN CONST VOID *Data, + IN UINTN DataSize, + OUT UINT8 *HashValue + ); + +/** + Retrieves the size, in bytes, of the context buffer required for SHA-512 hash operations. + + @return The size, in bytes, of the context buffer required for SHA-512 hash operations. + +**/ +UINTN +EFIAPI +Sha512GetContextSize ( + VOID + ); + +/** + Initializes user-supplied memory pointed by Sha512Context as SHA-512 hash context for + subsequent use. + + If Sha512Context is NULL, then return FALSE. + + @param[out] Sha512Context Pointer to SHA-512 context being initialized. + + @retval TRUE SHA-512 context initialization succeeded. + @retval FALSE SHA-512 context initialization failed. + +**/ +BOOLEAN +EFIAPI +Sha512Init ( + OUT VOID *Sha512Context + ); + +/** + Makes a copy of an existing SHA-512 context. + + If Sha512Context is NULL, then return FALSE. + If NewSha512Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. + + @param[in] Sha512Context Pointer to SHA-512 context being copied. + @param[out] NewSha512Context Pointer to new SHA-512 context. + + @retval TRUE SHA-512 context copy succeeded. + @retval FALSE SHA-512 context copy failed. + @retval FALSE This interface is not supported. + +**/ +BOOLEAN +EFIAPI +Sha512Duplicate ( + IN CONST VOID *Sha512Context, + OUT VOID *NewSha512Context + ); + +/** + Digests the input data and updates SHA-512 context. + + This function performs SHA-512 digest on a data buffer of the specified size. + It can be called multiple times to compute the digest of long or discontinuous data streams. + SHA-512 context should be already correctly intialized by Sha512Init(), and should not be finalized + by Sha512Final(). Behavior with invalid context is undefined. + + If Sha512Context is NULL, then return FALSE. + + @param[in, out] Sha512Context Pointer to the SHA-512 context. + @param[in] Data Pointer to the buffer containing the data to be hashed. + @param[in] DataSize Size of Data buffer in bytes. + + @retval TRUE SHA-512 data digest succeeded. + @retval FALSE SHA-512 data digest failed. + +**/ +BOOLEAN +EFIAPI +Sha512Update ( + IN OUT VOID *Sha512Context, + IN CONST VOID *Data, + IN UINTN DataSize + ); + +/** + Completes computation of the SHA-512 digest value. + + This function completes SHA-512 hash computation and retrieves the digest value into + the specified memory. After this function has been called, the SHA-512 context cannot + be used again. + SHA-512 context should be already correctly intialized by Sha512Init(), and should not be + finalized by Sha512Final(). Behavior with invalid SHA-512 context is undefined. + + If Sha512Context is NULL, then return FALSE. + If HashValue is NULL, then return FALSE. + + @param[in, out] Sha512Context Pointer to the SHA-512 context. + @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest + value (64 bytes). + + @retval TRUE SHA-512 digest computation succeeded. + @retval FALSE SHA-512 digest computation failed. + +**/ +BOOLEAN +EFIAPI +Sha512Final ( + IN OUT VOID *Sha512Context, + OUT UINT8 *HashValue + ); + +/** + Computes the SHA-512 message digest of a input data buffer. + + This function performs the SHA-512 message digest of a given data buffer, and places + the digest value into the specified memory. + + If this interface is not supported, then return FALSE. + + @param[in] Data Pointer to the buffer containing the data to be hashed. + @param[in] DataSize Size of Data buffer in bytes. + @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest + value (64 bytes). + + @retval TRUE SHA-512 digest computation succeeded. + @retval FALSE SHA-512 digest computation failed. + @retval FALSE This interface is not supported. + +**/ +BOOLEAN +EFIAPI +Sha512HashAll ( + IN CONST VOID *Data, + IN UINTN DataSize, + OUT UINT8 *HashValue + ); //===================================================================================== // MAC (Message Authentication Code) Primitive @@ -486,7 +898,10 @@ Sha256Final ( /** Retrieves the size, in bytes, of the context buffer required for HMAC-MD5 operations. + If this interface is not supported, then return zero. + @return The size, in bytes, of the context buffer required for HMAC-MD5 operations. + @retval 0 This interface is not supported. **/ UINTN @@ -499,7 +914,8 @@ HmacMd5GetContextSize ( Initializes user-supplied memory pointed by HmacMd5Context as HMAC-MD5 context for subsequent use. - If HmacMd5Context is NULL, then ASSERT(). + If HmacMd5Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[out] HmacMd5Context Pointer to HMAC-MD5 context being initialized. @param[in] Key Pointer to the user-supplied key. @@ -507,6 +923,7 @@ HmacMd5GetContextSize ( @retval TRUE HMAC-MD5 context initialization succeeded. @retval FALSE HMAC-MD5 context initialization failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -520,14 +937,16 @@ HmacMd5Init ( /** Makes a copy of an existing HMAC-MD5 context. - If HmacMd5Context is NULL, then ASSERT(). - If NewHmacMd5Context is NULL, then ASSERT(). + If HmacMd5Context is NULL, then return FALSE. + If NewHmacMd5Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] HmacMd5Context Pointer to HMAC-MD5 context being copied. @param[out] NewHmacMd5Context Pointer to new HMAC-MD5 context. @retval TRUE HMAC-MD5 context copy succeeded. @retval FALSE HMAC-MD5 context copy failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -545,7 +964,8 @@ HmacMd5Duplicate ( HMAC-MD5 context should be already correctly intialized by HmacMd5Init(), and should not be finalized by HmacMd5Final(). Behavior with invalid context is undefined. - If HmacMd5Context is NULL, then ASSERT(). + If HmacMd5Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in, out] HmacMd5Context Pointer to the HMAC-MD5 context. @param[in] Data Pointer to the buffer containing the data to be digested. @@ -553,6 +973,7 @@ HmacMd5Duplicate ( @retval TRUE HMAC-MD5 data digest succeeded. @retval FALSE HMAC-MD5 data digest failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -572,8 +993,9 @@ HmacMd5Update ( HMAC-MD5 context should be already correctly intialized by HmacMd5Init(), and should not be finalized by HmacMd5Final(). Behavior with invalid HMAC-MD5 context is undefined. - If HmacMd5Context is NULL, then ASSERT(). - If HashValue is NULL, then ASSERT(). + If HmacMd5Context is NULL, then return FALSE. + If HashValue is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in, out] HmacMd5Context Pointer to the HMAC-MD5 context. @param[out] HashValue Pointer to a buffer that receives the HMAC-MD5 digest @@ -581,6 +1003,7 @@ HmacMd5Update ( @retval TRUE HMAC-MD5 digest computation succeeded. @retval FALSE HMAC-MD5 digest computation failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -593,7 +1016,10 @@ HmacMd5Final ( /** Retrieves the size, in bytes, of the context buffer required for HMAC-SHA1 operations. + If this interface is not supported, then return zero. + @return The size, in bytes, of the context buffer required for HMAC-SHA1 operations. + @retval 0 This interface is not supported. **/ UINTN @@ -606,7 +1032,8 @@ HmacSha1GetContextSize ( Initializes user-supplied memory pointed by HmacSha1Context as HMAC-SHA1 context for subsequent use. - If HmacSha1Context is NULL, then ASSERT(). + If HmacSha1Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[out] HmacSha1Context Pointer to HMAC-SHA1 context being initialized. @param[in] Key Pointer to the user-supplied key. @@ -614,6 +1041,7 @@ HmacSha1GetContextSize ( @retval TRUE HMAC-SHA1 context initialization succeeded. @retval FALSE HMAC-SHA1 context initialization failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -627,14 +1055,16 @@ HmacSha1Init ( /** Makes a copy of an existing HMAC-SHA1 context. - If HmacSha1Context is NULL, then ASSERT(). - If NewHmacSha1Context is NULL, then ASSERT(). + If HmacSha1Context is NULL, then return FALSE. + If NewHmacSha1Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] HmacSha1Context Pointer to HMAC-SHA1 context being copied. @param[out] NewHmacSha1Context Pointer to new HMAC-SHA1 context. @retval TRUE HMAC-SHA1 context copy succeeded. @retval FALSE HMAC-SHA1 context copy failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -652,7 +1082,8 @@ HmacSha1Duplicate ( HMAC-SHA1 context should be already correctly intialized by HmacSha1Init(), and should not be finalized by HmacSha1Final(). Behavior with invalid context is undefined. - If HmacSha1Context is NULL, then ASSERT(). + If HmacSha1Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in, out] HmacSha1Context Pointer to the HMAC-SHA1 context. @param[in] Data Pointer to the buffer containing the data to be digested. @@ -660,6 +1091,7 @@ HmacSha1Duplicate ( @retval TRUE HMAC-SHA1 data digest succeeded. @retval FALSE HMAC-SHA1 data digest failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -679,8 +1111,9 @@ HmacSha1Update ( HMAC-SHA1 context should be already correctly intialized by HmacSha1Init(), and should not be finalized by HmacSha1Final(). Behavior with invalid HMAC-SHA1 context is undefined. - If HmacSha1Context is NULL, then ASSERT(). - If HashValue is NULL, then ASSERT(). + If HmacSha1Context is NULL, then return FALSE. + If HashValue is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in, out] HmacSha1Context Pointer to the HMAC-SHA1 context. @param[out] HashValue Pointer to a buffer that receives the HMAC-SHA1 digest @@ -688,6 +1121,7 @@ HmacSha1Update ( @retval TRUE HMAC-SHA1 digest computation succeeded. @retval FALSE HMAC-SHA1 digest computation failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -697,6 +1131,123 @@ HmacSha1Final ( OUT UINT8 *HmacValue ); +/** + Retrieves the size, in bytes, of the context buffer required for HMAC-SHA256 operations. + + If this interface is not supported, then return zero. + + @return The size, in bytes, of the context buffer required for HMAC-SHA256 operations. + @retval 0 This interface is not supported. + +**/ +UINTN +EFIAPI +HmacSha256GetContextSize ( + VOID + ); + +/** + Initializes user-supplied memory pointed by HmacSha256Context as HMAC-SHA256 context for + subsequent use. + + If HmacSha256Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. + + @param[out] HmacSha256Context Pointer to HMAC-SHA256 context being initialized. + @param[in] Key Pointer to the user-supplied key. + @param[in] KeySize Key size in bytes. + + @retval TRUE HMAC-SHA256 context initialization succeeded. + @retval FALSE HMAC-SHA256 context initialization failed. + @retval FALSE This interface is not supported. + +**/ +BOOLEAN +EFIAPI +HmacSha256Init ( + OUT VOID *HmacSha256Context, + IN CONST UINT8 *Key, + IN UINTN KeySize + ); + +/** + Makes a copy of an existing HMAC-SHA256 context. + + If HmacSha256Context is NULL, then return FALSE. + If NewHmacSha256Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. + + @param[in] HmacSha256Context Pointer to HMAC-SHA256 context being copied. + @param[out] NewHmacSha256Context Pointer to new HMAC-SHA256 context. + + @retval TRUE HMAC-SHA256 context copy succeeded. + @retval FALSE HMAC-SHA256 context copy failed. + @retval FALSE This interface is not supported. + +**/ +BOOLEAN +EFIAPI +HmacSha256Duplicate ( + IN CONST VOID *HmacSha256Context, + OUT VOID *NewHmacSha256Context + ); + +/** + Digests the input data and updates HMAC-SHA256 context. + + This function performs HMAC-SHA256 digest on a data buffer of the specified size. + It can be called multiple times to compute the digest of long or discontinuous data streams. + HMAC-SHA256 context should be already correctly initialized by HmacSha256Init(), and should not + be finalized by HmacSha256Final(). Behavior with invalid context is undefined. + + If HmacSha256Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. + + @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context. + @param[in] Data Pointer to the buffer containing the data to be digested. + @param[in] DataSize Size of Data buffer in bytes. + + @retval TRUE HMAC-SHA256 data digest succeeded. + @retval FALSE HMAC-SHA256 data digest failed. + @retval FALSE This interface is not supported. + +**/ +BOOLEAN +EFIAPI +HmacSha256Update ( + IN OUT VOID *HmacSha256Context, + IN CONST VOID *Data, + IN UINTN DataSize + ); + +/** + Completes computation of the HMAC-SHA256 digest value. + + This function completes HMAC-SHA256 hash computation and retrieves the digest value into + the specified memory. After this function has been called, the HMAC-SHA256 context cannot + be used again. + HMAC-SHA256 context should be already correctly initialized by HmacSha256Init(), and should + not be finalized by HmacSha256Final(). Behavior with invalid HMAC-SHA256 context is undefined. + + If HmacSha256Context is NULL, then return FALSE. + If HashValue is NULL, then return FALSE. + If this interface is not supported, then return FALSE. + + @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context. + @param[out] HashValue Pointer to a buffer that receives the HMAC-SHA256 digest + value (32 bytes). + + @retval TRUE HMAC-SHA256 digest computation succeeded. + @retval FALSE HMAC-SHA256 digest computation failed. + @retval FALSE This interface is not supported. + +**/ +BOOLEAN +EFIAPI +HmacSha256Final ( + IN OUT VOID *HmacSha256Context, + OUT UINT8 *HmacValue + ); //===================================================================================== // Symmetric Cryptography Primitive @@ -705,7 +1256,10 @@ HmacSha1Final ( /** Retrieves the size, in bytes, of the context buffer required for TDES operations. + If this interface is not supported, then return zero. + @return The size, in bytes, of the context buffer required for TDES operations. + @retval 0 This interface is not supported. **/ UINTN @@ -718,16 +1272,17 @@ TdesGetContextSize ( Initializes user-supplied memory as TDES context for subsequent use. This function initializes user-supplied memory pointed by TdesContext as TDES context. - In addtion, it sets up all TDES key materials for subsequent encryption and decryption + In addition, it sets up all TDES key materials for subsequent encryption and decryption operations. There are 3 key options as follows: KeyLength = 64, Keying option 1: K1 == K2 == K3 (Backward compatibility with DES) KeyLength = 128, Keying option 2: K1 != K2 and K3 = K1 (Less Security) KeyLength = 192 Keying option 3: K1 != K2 != K3 (Strongest) - If TdesContext is NULL, then ASSERT(). - If Key is NULL, then ASSERT(). - If KeyLength is not valid, then ASSERT(). + If TdesContext is NULL, then return FALSE. + If Key is NULL, then return FALSE. + If KeyLength is not valid, then return FALSE. + If this interface is not supported, then return FALSE. @param[out] TdesContext Pointer to TDES context being initialized. @param[in] Key Pointer to the user-supplied TDES key. @@ -735,6 +1290,7 @@ TdesGetContextSize ( @retval TRUE TDES context initialization succeeded. @retval FALSE TDES context initialization failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -755,10 +1311,11 @@ TdesInit ( TdesContext should be already correctly initialized by TdesInit(). Behavior with invalid TDES context is undefined. - If TdesContext is NULL, then ASSERT(). - If Input is NULL, then ASSERT(). - If InputSize is not multiple of block size (8 bytes), then ASSERT(). - If Output is NULL, then ASSERT(). + If TdesContext is NULL, then return FALSE. + If Input is NULL, then return FALSE. + If InputSize is not multiple of block size (8 bytes), then return FALSE. + If Output is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] TdesContext Pointer to the TDES context. @param[in] Input Pointer to the buffer containing the data to be encrypted. @@ -767,6 +1324,7 @@ TdesInit ( @retval TRUE TDES encryption succeeded. @retval FALSE TDES encryption failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -788,10 +1346,11 @@ TdesEcbEncrypt ( TdesContext should be already correctly initialized by TdesInit(). Behavior with invalid TDES context is undefined. - If TdesContext is NULL, then ASSERT(). - If Input is NULL, then ASSERT(). - If InputSize is not multiple of block size (8 bytes), then ASSERT(). - If Output is NULL, then ASSERT(). + If TdesContext is NULL, then return FALSE. + If Input is NULL, then return FALSE. + If InputSize is not multiple of block size (8 bytes), then return FALSE. + If Output is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] TdesContext Pointer to the TDES context. @param[in] Input Pointer to the buffer containing the data to be decrypted. @@ -800,6 +1359,7 @@ TdesEcbEncrypt ( @retval TRUE TDES decryption succeeded. @retval FALSE TDES decryption failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -822,11 +1382,12 @@ TdesEcbDecrypt ( TdesContext should be already correctly initialized by TdesInit(). Behavior with invalid TDES context is undefined. - If TdesContext is NULL, then ASSERT(). - If Input is NULL, then ASSERT(). - If InputSize is not multiple of block size (8 bytes), then ASSERT(). - If Ivec is NULL, then ASSERT(). - If Output is NULL, then ASSERT(). + If TdesContext is NULL, then return FALSE. + If Input is NULL, then return FALSE. + If InputSize is not multiple of block size (8 bytes), then return FALSE. + If Ivec is NULL, then return FALSE. + If Output is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] TdesContext Pointer to the TDES context. @param[in] Input Pointer to the buffer containing the data to be encrypted. @@ -836,6 +1397,7 @@ TdesEcbDecrypt ( @retval TRUE TDES encryption succeeded. @retval FALSE TDES encryption failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -859,11 +1421,12 @@ TdesCbcEncrypt ( TdesContext should be already correctly initialized by TdesInit(). Behavior with invalid TDES context is undefined. - If TdesContext is NULL, then ASSERT(). - If Input is NULL, then ASSERT(). - If InputSize is not multiple of block size (8 bytes), then ASSERT(). - If Ivec is NULL, then ASSERT(). - If Output is NULL, then ASSERT(). + If TdesContext is NULL, then return FALSE. + If Input is NULL, then return FALSE. + If InputSize is not multiple of block size (8 bytes), then return FALSE. + If Ivec is NULL, then return FALSE. + If Output is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] TdesContext Pointer to the TDES context. @param[in] Input Pointer to the buffer containing the data to be encrypted. @@ -873,6 +1436,7 @@ TdesCbcEncrypt ( @retval TRUE TDES decryption succeeded. @retval FALSE TDES decryption failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -888,7 +1452,10 @@ TdesCbcDecrypt ( /** Retrieves the size, in bytes, of the context buffer required for AES operations. + If this interface is not supported, then return zero. + @return The size, in bytes, of the context buffer required for AES operations. + @retval 0 This interface is not supported. **/ UINTN @@ -901,13 +1468,14 @@ AesGetContextSize ( Initializes user-supplied memory as AES context for subsequent use. This function initializes user-supplied memory pointed by AesContext as AES context. - In addtion, it sets up all AES key materials for subsequent encryption and decryption + In addition, it sets up all AES key materials for subsequent encryption and decryption operations. There are 3 options for key length, 128 bits, 192 bits, and 256 bits. - If AesContext is NULL, then ASSERT(). - If Key is NULL, then ASSERT(). - If KeyLength is not valid, then ASSERT(). + If AesContext is NULL, then return FALSE. + If Key is NULL, then return FALSE. + If KeyLength is not valid, then return FALSE. + If this interface is not supported, then return FALSE. @param[out] AesContext Pointer to AES context being initialized. @param[in] Key Pointer to the user-supplied AES key. @@ -915,6 +1483,7 @@ AesGetContextSize ( @retval TRUE AES context initialization succeeded. @retval FALSE AES context initialization failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -935,10 +1504,11 @@ AesInit ( AesContext should be already correctly initialized by AesInit(). Behavior with invalid AES context is undefined. - If AesContext is NULL, then ASSERT(). - If Input is NULL, then ASSERT(). - If InputSize is not multiple of block size (16 bytes), then ASSERT(). - If Output is NULL, then ASSERT(). + If AesContext is NULL, then return FALSE. + If Input is NULL, then return FALSE. + If InputSize is not multiple of block size (16 bytes), then return FALSE. + If Output is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] AesContext Pointer to the AES context. @param[in] Input Pointer to the buffer containing the data to be encrypted. @@ -947,6 +1517,7 @@ AesInit ( @retval TRUE AES encryption succeeded. @retval FALSE AES encryption failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -968,10 +1539,11 @@ AesEcbEncrypt ( AesContext should be already correctly initialized by AesInit(). Behavior with invalid AES context is undefined. - If AesContext is NULL, then ASSERT(). - If Input is NULL, then ASSERT(). - If InputSize is not multiple of block size (16 bytes), then ASSERT(). - If Output is NULL, then ASSERT(). + If AesContext is NULL, then return FALSE. + If Input is NULL, then return FALSE. + If InputSize is not multiple of block size (16 bytes), then return FALSE. + If Output is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] AesContext Pointer to the AES context. @param[in] Input Pointer to the buffer containing the data to be decrypted. @@ -980,6 +1552,7 @@ AesEcbEncrypt ( @retval TRUE AES decryption succeeded. @retval FALSE AES decryption failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1002,11 +1575,12 @@ AesEcbDecrypt ( AesContext should be already correctly initialized by AesInit(). Behavior with invalid AES context is undefined. - If AesContext is NULL, then ASSERT(). - If Input is NULL, then ASSERT(). - If InputSize is not multiple of block size (16 bytes), then ASSERT(). - If Ivec is NULL, then ASSERT(). - If Output is NULL, then ASSERT(). + If AesContext is NULL, then return FALSE. + If Input is NULL, then return FALSE. + If InputSize is not multiple of block size (16 bytes), then return FALSE. + If Ivec is NULL, then return FALSE. + If Output is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] AesContext Pointer to the AES context. @param[in] Input Pointer to the buffer containing the data to be encrypted. @@ -1016,6 +1590,7 @@ AesEcbDecrypt ( @retval TRUE AES encryption succeeded. @retval FALSE AES encryption failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1039,11 +1614,12 @@ AesCbcEncrypt ( AesContext should be already correctly initialized by AesInit(). Behavior with invalid AES context is undefined. - If AesContext is NULL, then ASSERT(). - If Input is NULL, then ASSERT(). - If InputSize is not multiple of block size (16 bytes), then ASSERT(). - If Ivec is NULL, then ASSERT(). - If Output is NULL, then ASSERT(). + If AesContext is NULL, then return FALSE. + If Input is NULL, then return FALSE. + If InputSize is not multiple of block size (16 bytes), then return FALSE. + If Ivec is NULL, then return FALSE. + If Output is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] AesContext Pointer to the AES context. @param[in] Input Pointer to the buffer containing the data to be encrypted. @@ -1053,6 +1629,7 @@ AesCbcEncrypt ( @retval TRUE AES decryption succeeded. @retval FALSE AES decryption failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1068,7 +1645,10 @@ AesCbcDecrypt ( /** Retrieves the size, in bytes, of the context buffer required for ARC4 operations. + If this interface is not supported, then return zero. + @return The size, in bytes, of the context buffer required for ARC4 operations. + @retval 0 This interface is not supported. **/ UINTN @@ -1081,12 +1661,13 @@ Arc4GetContextSize ( Initializes user-supplied memory as ARC4 context for subsequent use. This function initializes user-supplied memory pointed by Arc4Context as ARC4 context. - In addtion, it sets up all ARC4 key materials for subsequent encryption and decryption + In addition, it sets up all ARC4 key materials for subsequent encryption and decryption operations. - If Arc4Context is NULL, then ASSERT(). - If Key is NULL, then ASSERT(). - If KeySize does not in the range of [5, 256] bytes, then ASSERT(). + If Arc4Context is NULL, then return FALSE. + If Key is NULL, then return FALSE. + If KeySize does not in the range of [5, 256] bytes, then return FALSE. + If this interface is not supported, then return FALSE. @param[out] Arc4Context Pointer to ARC4 context being initialized. @param[in] Key Pointer to the user-supplied ARC4 key. @@ -1094,6 +1675,7 @@ Arc4GetContextSize ( @retval TRUE ARC4 context initialization succeeded. @retval FALSE ARC4 context initialization failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1112,9 +1694,10 @@ Arc4Init ( Arc4Context should be already correctly initialized by Arc4Init(). Behavior with invalid ARC4 context is undefined. - If Arc4Context is NULL, then ASSERT(). - If Input is NULL, then ASSERT(). - If Output is NULL, then ASSERT(). + If Arc4Context is NULL, then return FALSE. + If Input is NULL, then return FALSE. + If Output is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] Arc4Context Pointer to the ARC4 context. @param[in] Input Pointer to the buffer containing the data to be encrypted. @@ -1123,6 +1706,7 @@ Arc4Init ( @retval TRUE ARC4 encryption succeeded. @retval FALSE ARC4 encryption failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1142,9 +1726,10 @@ Arc4Encrypt ( Arc4Context should be already correctly initialized by Arc4Init(). Behavior with invalid ARC4 context is undefined. - If Arc4Context is NULL, then ASSERT(). - If Input is NULL, then ASSERT(). - If Output is NULL, then ASSERT(). + If Arc4Context is NULL, then return FALSE. + If Input is NULL, then return FALSE. + If Output is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] Arc4Context Pointer to the ARC4 context. @param[in] Input Pointer to the buffer containing the data to be decrypted. @@ -1153,6 +1738,7 @@ Arc4Encrypt ( @retval TRUE ARC4 decryption succeeded. @retval FALSE ARC4 decryption failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1172,12 +1758,14 @@ Arc4Decrypt ( Contrary to ARC4Init(), Arc4Reset() requires no secret key as input, but ARC4 context should be already correctly initialized by ARC4Init(). - If Arc4Context is NULL, then ASSERT(). + If Arc4Context is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in, out] Arc4Context Pointer to the ARC4 context. @retval TRUE ARC4 reset succeeded. @retval FALSE ARC4 reset failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1206,7 +1794,7 @@ RsaNew ( /** Release the specified RSA context. - If RsaContext is NULL, then ASSERT(). + If RsaContext is NULL, then return FALSE. @param[in] RsaContext Pointer to the RSA context to be released. @@ -1225,7 +1813,7 @@ RsaFree ( represented in RSA PKCS#1). If BigNumber is NULL, then the specified key componenet in RSA context is cleared. - If RsaContext is NULL, then ASSERT(). + If RsaContext is NULL, then return FALSE. @param[in, out] RsaContext Pointer to RSA context being set. @param[in] KeyTag Tag of RSA key component being set. @@ -1259,9 +1847,10 @@ RsaSetKey ( If the BigNumber buffer is too small to hold the contents of the key, FALSE is returned and BnSize is set to the required buffer size to obtain the key. - If RsaContext is NULL, then ASSERT(). - If BnSize is NULL, then ASSERT(). - If BnSize is large enough but BigNumber is NULL, then ASSERT(). + If RsaContext is NULL, then return FALSE. + If BnSize is NULL, then return FALSE. + If BnSize is large enough but BigNumber is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in, out] RsaContext Pointer to RSA context being set. @param[in] KeyTag Tag of RSA key component being set. @@ -1272,6 +1861,7 @@ RsaSetKey ( @retval TRUE RSA key component was retrieved successfully. @retval FALSE Invalid RSA key component tag. @retval FALSE BnSize is too small. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1293,15 +1883,17 @@ RsaGetKey ( Before this function can be invoked, pseudorandom number generator must be correctly initialized by RandomSeed(). - If RsaContext is NULL, then ASSERT(). + If RsaContext is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in, out] RsaContext Pointer to RSA context being set. @param[in] ModulusLength Length of RSA modulus N in bits. @param[in] PublicExponent Pointer to RSA public exponent. - @param[in] PublicExponentSize Size of RSA public exponent buffer in bytes. + @param[in] PublicExponentSize Size of RSA public exponent buffer in bytes. @retval TRUE RSA key component was generated successfully. @retval FALSE Invalid RSA key component tag. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1315,6 +1907,8 @@ RsaGenerateKey ( /** Validates key components of RSA context. + NOTE: This function performs integrity checks on all the RSA key material, so + the RSA key structure must contain all the private key data. This function validates key compoents of RSA context in following aspects: - Whether p is a prime @@ -1322,12 +1916,14 @@ RsaGenerateKey ( - Whether n = p * q - Whether d*e = 1 mod lcm(p-1,q-1) - If RsaContext is NULL, then ASSERT(). + If RsaContext is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] RsaContext Pointer to RSA context to check. @retval TRUE RSA key components are valid. @retval FALSE RSA key components are not valid. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1344,10 +1940,11 @@ RsaCheckKey ( If the Signature buffer is too small to hold the contents of signature, FALSE is returned and SigSize is set to the required buffer size to obtain the signature. - If RsaContext is NULL, then ASSERT(). - If MessageHash is NULL, then ASSERT(). - If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then ASSERT(). - If SigSize is large enough but Signature is NULL, then ASSERT(). + If RsaContext is NULL, then return FALSE. + If MessageHash is NULL, then return FALSE. + If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then return FALSE. + If SigSize is large enough but Signature is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] RsaContext Pointer to RSA context for signature generation. @param[in] MessageHash Pointer to octet message hash to be signed. @@ -1359,6 +1956,7 @@ RsaCheckKey ( @retval TRUE Signature successfully generated in PKCS1-v1_5. @retval FALSE Signature generation failed. @retval FALSE SigSize is too small. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1375,10 +1973,10 @@ RsaPkcs1Sign ( Verifies the RSA-SSA signature with EMSA-PKCS1-v1_5 encoding scheme defined in RSA PKCS#1. - If RsaContext is NULL, then ASSERT(). - If MessageHash is NULL, then ASSERT(). - If Signature is NULL, then ASSERT(). - If HashSize is not equal to the size of MD5, SHA-1, SHA-256 digest, then ASSERT(). + If RsaContext is NULL, then return FALSE. + If MessageHash is NULL, then return FALSE. + If Signature is NULL, then return FALSE. + If HashSize is not equal to the size of MD5, SHA-1, SHA-256 digest, then return FALSE. @param[in] RsaContext Pointer to RSA context for signature verification. @param[in] MessageHash Pointer to octet message hash to be checked. @@ -1396,13 +1994,17 @@ RsaPkcs1Verify ( IN VOID *RsaContext, IN CONST UINT8 *MessageHash, IN UINTN HashSize, - IN UINT8 *Signature, + IN CONST UINT8 *Signature, IN UINTN SigSize ); /** Retrieve the RSA Private Key from the password-protected PEM key data. + If PemData is NULL, then return FALSE. + If RsaContext is NULL, then return FALSE. + If this interface is not supported, then return FALSE. + @param[in] PemData Pointer to the PEM-encoded key data to be retrieved. @param[in] PemSize Size of the PEM key data in bytes. @param[in] Password NULL-terminated passphrase used for encrypted PEM key data. @@ -1410,11 +2012,9 @@ RsaPkcs1Verify ( RSA private key component. Use RsaFree() function to free the resource. - If PemData is NULL, then ASSERT(). - If RsaContext is NULL, then ASSERT(). - @retval TRUE RSA Private Key was retrieved successfully. @retval FALSE Invalid PEM key data or incorrect password. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1429,17 +2029,19 @@ RsaGetPrivateKeyFromPem ( /** Retrieve the RSA Public Key from one DER-encoded X509 certificate. + If Cert is NULL, then return FALSE. + If RsaContext is NULL, then return FALSE. + If this interface is not supported, then return FALSE. + @param[in] Cert Pointer to the DER-encoded X509 certificate. @param[in] CertSize Size of the X509 certificate in bytes. @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved RSA public key component. Use RsaFree() function to free the resource. - If Cert is NULL, then ASSERT(). - If RsaContext is NULL, then ASSERT(). - @retval TRUE RSA Public Key was retrieved successfully. @retval FALSE Fail to retrieve RSA public key from X509 certificate. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1453,18 +2055,20 @@ RsaGetPublicKeyFromX509 ( /** Retrieve the subject bytes from one X.509 certificate. + If Cert is NULL, then return FALSE. + If SubjectSize is NULL, then return FALSE. + If this interface is not supported, then return FALSE. + @param[in] Cert Pointer to the DER-encoded X509 certificate. @param[in] CertSize Size of the X509 certificate in bytes. @param[out] CertSubject Pointer to the retrieved certificate subject bytes. @param[in, out] SubjectSize The size in bytes of the CertSubject buffer on input, and the size of buffer returned CertSubject on output. - If Cert is NULL, then ASSERT(). - If SubjectSize is NULL, then ASSERT(). - @retval TRUE The certificate subject retrieved successfully. @retval FALSE Invalid certificate, or the SubjectSize is too small for the result. The SubjectSize will be updated with the required size. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1479,17 +2083,19 @@ X509GetSubjectName ( /** Verify one X509 certificate was issued by the trusted CA. + If Cert is NULL, then return FALSE. + If CACert is NULL, then return FALSE. + If this interface is not supported, then return FALSE. + @param[in] Cert Pointer to the DER-encoded X509 certificate to be verified. @param[in] CertSize Size of the X509 certificate in bytes. @param[in] CACert Pointer to the DER-encoded trusted CA certificate. @param[in] CACertSize Size of the CA Certificate in bytes. - If Cert is NULL, then ASSERT(). - If CACert is NULL, then ASSERT(). - @retval TRUE The certificate was issued by the trusted CA. @retval FALSE Invalid certificate or the certificate was not issued by the given trusted CA. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1504,8 +2110,9 @@ X509VerifyCert ( /** Construct a X509 object from DER-encoded certificate data. - If Cert is NULL, then ASSERT(). - If SingleX509Cert is NULL, then ASSERT(). + If Cert is NULL, then return FALSE. + If SingleX509Cert is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] Cert Pointer to the DER-encoded certificate data. @param[in] CertSize The size of certificate data in bytes. @@ -1513,6 +2120,7 @@ X509VerifyCert ( @retval TRUE The X509 object generation succeeded. @retval FALSE The operation failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1526,30 +2134,32 @@ X509ConstructCertificate ( /** Construct a X509 stack object from a list of DER-encoded certificate data. - If X509Stack is NULL, then ASSERT(). + If X509Stack is NULL, then return FALSE. + If this interface is not supported, then return FALSE. - @param[in, out] X509Stack On input, pointer to an existing X509 stack object. + @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object. On output, pointer to the X509 stack object with new inserted X509 certificate. @param ... A list of DER-encoded single certificate data followed by certificate size. A NULL terminates the list. The pairs are the arguments to X509ConstructCertificate(). - + @retval TRUE The X509 stack construction succeeded. @retval FALSE The construction operation failed. + @retval FALSE This interface is not supported. **/ BOOLEAN EFIAPI X509ConstructCertificateStack ( IN OUT UINT8 **X509Stack, - ... + ... ); /** Release the specified X509 object. - If X509Cert is NULL, then ASSERT(). + If the interface is not supported, then ASSERT(). @param[in] X509Cert Pointer to the X509 object to be released. @@ -1563,7 +2173,7 @@ X509Free ( /** Release the specified X509 stack object. - If X509Stack is NULL, then ASSERT(). + If the interface is not supported, then ASSERT(). @param[in] X509Stack Pointer to the X509 stack object to be released. @@ -1574,11 +2184,157 @@ X509StackFree ( IN VOID *X509Stack ); +/** + Retrieve the TBSCertificate from one given X.509 certificate. + + @param[in] Cert Pointer to the given DER-encoded X509 certificate. + @param[in] CertSize Size of the X509 certificate in bytes. + @param[out] TBSCert DER-Encoded To-Be-Signed certificate. + @param[out] TBSCertSize Size of the TBS certificate in bytes. + + If Cert is NULL, then return FALSE. + If TBSCert is NULL, then return FALSE. + If TBSCertSize is NULL, then return FALSE. + If this interface is not supported, then return FALSE. + + @retval TRUE The TBSCertificate was retrieved successfully. + @retval FALSE Invalid X.509 certificate. + +**/ +BOOLEAN +EFIAPI +X509GetTBSCert ( + IN CONST UINT8 *Cert, + IN UINTN CertSize, + OUT UINT8 **TBSCert, + OUT UINTN *TBSCertSize + ); + +/** + Derives a key from a password using a salt and iteration count, based on PKCS#5 v2.0 + password based encryption key derivation function PBKDF2, as specified in RFC 2898. + + If Password or Salt or OutKey is NULL, then return FALSE. + If the hash algorithm could not be determined, then return FALSE. + If this interface is not supported, then return FALSE. + + @param[in] PasswordLength Length of input password in bytes. + @param[in] Password Pointer to the array for the password. + @param[in] SaltLength Size of the Salt in bytes. + @param[in] Salt Pointer to the Salt. + @param[in] IterationCount Number of iterations to perform. Its value should be + greater than or equal to 1. + @param[in] DigestSize Size of the message digest to be used (eg. SHA256_DIGEST_SIZE). + NOTE: DigestSize will be used to determine the hash algorithm. + Only SHA1_DIGEST_SIZE or SHA256_DIGEST_SIZE is supported. + @param[in] KeyLength Size of the derived key buffer in bytes. + @param[out] OutKey Pointer to the output derived key buffer. + + @retval TRUE A key was derived successfully. + @retval FALSE One of the pointers was NULL or one of the sizes was too large. + @retval FALSE The hash algorithm could not be determined from the digest size. + @retval FALSE The key derivation operation failed. + @retval FALSE This interface is not supported. + +**/ +BOOLEAN +EFIAPI +Pkcs5HashPassword ( + IN UINTN PasswordLength, + IN CONST CHAR8 *Password, + IN UINTN SaltLength, + IN CONST UINT8 *Salt, + IN UINTN IterationCount, + IN UINTN DigestSize, + IN UINTN KeyLength, + OUT UINT8 *OutKey + ); + +/** + Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7: + Cryptographic Message Syntax Standard". The input signed data could be wrapped + in a ContentInfo structure. + + If P7Data, CertStack, StackLength, TrustedCert or CertLength is NULL, then + return FALSE. If P7Length overflow, then return FAlSE. + If this interface is not supported, then return FALSE. + + @param[in] P7Data Pointer to the PKCS#7 message to verify. + @param[in] P7Length Length of the PKCS#7 message in bytes. + @param[out] CertStack Pointer to Signer's certificates retrieved from P7Data. + It's caller's responsiblity to free the buffer. + @param[out] StackLength Length of signer's certificates in bytes. + @param[out] TrustedCert Pointer to a trusted certificate from Signer's certificates. + It's caller's responsiblity to free the buffer. + @param[out] CertLength Length of the trusted certificate in bytes. + + @retval TRUE The operation is finished successfully. + @retval FALSE Error occurs during the operation. + @retval FALSE This interface is not supported. + +**/ +BOOLEAN +EFIAPI +Pkcs7GetSigners ( + IN CONST UINT8 *P7Data, + IN UINTN P7Length, + OUT UINT8 **CertStack, + OUT UINTN *StackLength, + OUT UINT8 **TrustedCert, + OUT UINTN *CertLength + ); + +/** + Wrap function to use free() to free allocated memory for certificates. + + If this interface is not supported, then ASSERT(). + + @param[in] Certs Pointer to the certificates to be freed. + +**/ +VOID +EFIAPI +Pkcs7FreeSigners ( + IN UINT8 *Certs + ); + +/** + Retrieves all embedded certificates from PKCS#7 signed data as described in "PKCS #7: + Cryptographic Message Syntax Standard", and outputs two certificate lists chained and + unchained to the signer's certificates. + The input signed data could be wrapped in a ContentInfo structure. + + @param[in] P7Data Pointer to the PKCS#7 message. + @param[in] P7Length Length of the PKCS#7 message in bytes. + @param[out] SignerChainCerts Pointer to the certificates list chained to signer's + certificate. It's caller's responsiblity to free the buffer. + @param[out] ChainLength Length of the chained certificates list buffer in bytes. + @param[out] UnchainCerts Pointer to the unchained certificates lists. It's caller's + responsiblity to free the buffer. + @param[out] UnchainLength Length of the unchained certificates list buffer in bytes. + + @retval TRUE The operation is finished successfully. + @retval FALSE Error occurs during the operation. + +**/ +BOOLEAN +EFIAPI +Pkcs7GetCertificatesList ( + IN CONST UINT8 *P7Data, + IN UINTN P7Length, + OUT UINT8 **SignerChainCerts, + OUT UINTN *ChainLength, + OUT UINT8 **UnchainCerts, + OUT UINTN *UnchainLength + ); + /** Creates a PKCS#7 signedData as described in "PKCS #7: Cryptographic Message Syntax Standard, version 1.5". This interface is only intended to be used for application to perform PKCS#7 functionality validation. + If this interface is not supported, then return FALSE. + @param[in] PrivateKey Pointer to the PEM-formatted private key data for data signing. @param[in] PrivateKeySize Size of the PEM private key data in bytes. @@ -1595,6 +2351,7 @@ X509StackFree ( @retval TRUE PKCS#7 data signing succeeded. @retval FALSE PKCS#7 data signing failed. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1612,40 +2369,74 @@ Pkcs7Sign ( ); /** - Verifies the validility of a PKCS#7 signed data as described in "PKCS #7: Cryptographic - Message Syntax Standard". + Verifies the validility of a PKCS#7 signed data as described in "PKCS #7: + Cryptographic Message Syntax Standard". The input signed data could be wrapped + in a ContentInfo structure. - If P7Data is NULL, then ASSERT(). + If P7Data, TrustedCert or InData is NULL, then return FALSE. + If P7Length, CertLength or DataLength overflow, then return FAlSE. + If this interface is not supported, then return FALSE. @param[in] P7Data Pointer to the PKCS#7 message to verify. - @param[in] P7Size Size of the PKCS#7 message in bytes. + @param[in] P7Length Length of the PKCS#7 message in bytes. @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which is used for certificate chain verification. - @param[in] CertSize Size of the trusted certificate in bytes. + @param[in] CertLength Length of the trusted certificate in bytes. @param[in] InData Pointer to the content to be verified. - @param[in] DataSize Size of InData in bytes. + @param[in] DataLength Length of InData in bytes. @retval TRUE The specified PKCS#7 signed data is valid. @retval FALSE Invalid PKCS#7 signed data. + @retval FALSE This interface is not supported. **/ BOOLEAN EFIAPI Pkcs7Verify ( IN CONST UINT8 *P7Data, - IN UINTN P7Size, + IN UINTN P7Length, IN CONST UINT8 *TrustedCert, - IN UINTN CertSize, + IN UINTN CertLength, IN CONST UINT8 *InData, - IN UINTN DataSize + IN UINTN DataLength + ); + +/** + Extracts the attached content from a PKCS#7 signed data if existed. The input signed + data could be wrapped in a ContentInfo structure. + + If P7Data, Content, or ContentSize is NULL, then return FALSE. If P7Length overflow, + then return FAlSE. If the P7Data is not correctly formatted, then return FALSE. + + Caution: This function may receive untrusted input. So this function will do + basic check for PKCS#7 data structure. + + @param[in] P7Data Pointer to the PKCS#7 signed data to process. + @param[in] P7Length Length of the PKCS#7 signed data in bytes. + @param[out] Content Pointer to the extracted content from the PKCS#7 signedData. + It's caller's responsiblity to free the buffer. + @param[out] ContentSize The size of the extracted content in bytes. + + @retval TRUE The P7Data was correctly formatted for processing. + @retval FALSE The P7Data was not correctly formatted for processing. + +*/ +BOOLEAN +EFIAPI +Pkcs7GetAttachedContent ( + IN CONST UINT8 *P7Data, + IN UINTN P7Length, + OUT VOID **Content, + OUT UINTN *ContentSize ); /** Verifies the validility of a PE/COFF Authenticode Signature as described in "Windows Authenticode Portable Executable Signature Format". - If AuthData is NULL, then ASSERT(). - If ImageHash is NULL, then ASSERT(). + If AuthData is NULL, then return FALSE. + If ImageHash is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed PE/COFF image to be verified. @@ -1660,6 +2451,7 @@ Pkcs7Verify ( @retval TRUE The specified Authenticode Signature is valid. @retval FALSE Invalid Authenticode Signature. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1673,6 +2465,36 @@ AuthenticodeVerify ( IN UINTN HashSize ); +/** + Verifies the validility of a RFC3161 Timestamp CounterSignature embedded in PE/COFF Authenticode + signature. + + If AuthData is NULL, then return FALSE. + If this interface is not supported, then return FALSE. + + @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed + PE/COFF image to be verified. + @param[in] DataSize Size of the Authenticode Signature in bytes. + @param[in] TsaCert Pointer to a trusted/root TSA certificate encoded in DER, which + is used for TSA certificate chain verification. + @param[in] CertSize Size of the trusted certificate in bytes. + @param[out] SigningTime Return the time of timestamp generation time if the timestamp + signature is valid. + + @retval TRUE The specified Authenticode includes a valid RFC3161 Timestamp CounterSignature. + @retval FALSE No valid RFC3161 Timestamp CounterSignature in the specified Authenticode data. + +**/ +BOOLEAN +EFIAPI +ImageTimestampVerify ( + IN CONST UINT8 *AuthData, + IN UINTN DataSize, + IN CONST UINT8 *TsaCert, + IN UINTN CertSize, + OUT EFI_TIME *SigningTime + ); + //===================================================================================== // DH Key Exchange Primitive //===================================================================================== @@ -1682,6 +2504,7 @@ AuthenticodeVerify ( @return Pointer to the Diffie-Hellman Context that has been initialized. If the allocations fails, DhNew() returns NULL. + If the interface is not supported, DhNew() returns NULL. **/ VOID * @@ -1693,7 +2516,7 @@ DhNew ( /** Release the specified DH context. - If DhContext is NULL, then ASSERT(). + If the interface is not supported, then ASSERT(). @param[in] DhContext Pointer to the DH context to be released. @@ -1709,12 +2532,13 @@ DhFree ( Given generator g, and length of prime number p in bits, this function generates p, and sets DH context according to value of g and p. - + Before this function can be invoked, pseudorandom number generator must be correctly initialized by RandomSeed(). - If DhContext is NULL, then ASSERT(). - If Prime is NULL, then ASSERT(). + If DhContext is NULL, then return FALSE. + If Prime is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in, out] DhContext Pointer to the DH context. @param[in] Generator Value of generator. @@ -1724,6 +2548,7 @@ DhFree ( @retval TRUE DH pamameter generation succeeded. @retval FALSE Value of Generator is not supported. @retval FALSE PRNG fails to generate random prime number with PrimeLength. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1741,8 +2566,9 @@ DhGenerateParameter ( Given generator g, and prime number p, this function and sets DH context accordingly. - If DhContext is NULL, then ASSERT(). - If Prime is NULL, then ASSERT(). + If DhContext is NULL, then return FALSE. + If Prime is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in, out] DhContext Pointer to the DH context. @param[in] Generator Value of generator. @@ -1754,6 +2580,7 @@ DhGenerateParameter ( @retval FALSE Value of Generator is not suitable for the Prime. @retval FALSE Value of Prime is not a prime number. @retval FALSE Value of Prime is not a safe prime number. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1768,14 +2595,15 @@ DhSetParameter ( /** Generates DH public key. - This function generates random secret exponent, and computes the public key, which is + This function generates random secret exponent, and computes the public key, which is returned via parameter PublicKey and PublicKeySize. DH context is updated accordingly. If the PublicKey buffer is too small to hold the public key, FALSE is returned and PublicKeySize is set to the required buffer size to obtain the public key. - If DhContext is NULL, then ASSERT(). - If PublicKeySize is NULL, then ASSERT(). - If PublicKeySize is large enough but PublicKey is NULL, then ASSERT(). + If DhContext is NULL, then return FALSE. + If PublicKeySize is NULL, then return FALSE. + If PublicKeySize is large enough but PublicKey is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[in, out] DhContext Pointer to the DH context. @param[out] PublicKey Pointer to the buffer to receive generated public key. @@ -1785,6 +2613,7 @@ DhSetParameter ( @retval TRUE DH public key generation succeeded. @retval FALSE DH public key generation failed. @retval FALSE PublicKeySize is not large enough. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1799,12 +2628,14 @@ DhGenerateKey ( Computes exchanged common key. Given peer's public key, this function computes the exchanged common key, based on its own - context including value of prime modulus and random secret exponent. + context including value of prime modulus and random secret exponent. - If DhContext is NULL, then ASSERT(). - If PeerPublicKey is NULL, then ASSERT(). - If KeySize is NULL, then ASSERT(). - If KeySize is large enough but Key is NULL, then ASSERT(). + If DhContext is NULL, then return FALSE. + If PeerPublicKey is NULL, then return FALSE. + If KeySize is NULL, then return FALSE. + If Key is NULL, then return FALSE. + If KeySize is not large enough, then return FALSE. + If this interface is not supported, then return FALSE. @param[in, out] DhContext Pointer to the DH context. @param[in] PeerPublicKey Pointer to the peer's public key. @@ -1816,6 +2647,7 @@ DhGenerateKey ( @retval TRUE DH exchanged key generation succeeded. @retval FALSE DH exchanged key generation failed. @retval FALSE KeySize is not large enough. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1838,6 +2670,7 @@ DhComputeKey ( This function sets up the seed value for the pseudorandom number generator. If Seed is not NULL, then the seed passed in is used. If Seed is NULL, then default seed is used. + If this interface is not supported, then return FALSE. @param[in] Seed Pointer to seed value. If NULL, default seed is used. @@ -1846,6 +2679,7 @@ DhComputeKey ( @retval TRUE Pseudorandom number generator has enough entropy for random generation. @retval FALSE Pseudorandom number generator does not have enough entropy for random generation. + @retval FALSE This interface is not supported. **/ BOOLEAN @@ -1858,13 +2692,15 @@ RandomSeed ( /** Generates a pseudorandom byte stream of the specified size. - If Output is NULL, then ASSERT(). + If Output is NULL, then return FALSE. + If this interface is not supported, then return FALSE. @param[out] Output Pointer to buffer to receive random value. @param[in] Size Size of randome bytes to generate. @retval TRUE Pseudorandom byte stream generated successfully. @retval FALSE Pseudorandom number generator fails to generate due to lack of entropy. + @retval FALSE This interface is not supported. **/ BOOLEAN