OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
SecureMem.c File Reference
#include "CryptoInternal.h"

Go to the source code of this file.

Functions

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

Detailed Description

Copyright (C) 2019, Download-Fritz. 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 SecureMem.c.

Function Documentation

◆ 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.