TianoCore EDK2 master
Loading...
Searching...
No Matches
BnTests.c File Reference
#include "TestBaseCryptLib.h"

Go to the source code of this file.

Data Structures

struct  BN_TEST_CONTEXT
 

Macros

#define MAX_TEST_DATA_SIZE   512
 
#define BYTES_OF_OPERATION_A   60
 
#define BITS_OF_OPERATION_A   480
 

Functions

STATIC BOOLEAN EqualBn2Bn (CONST VOID *Expected, CONST VOID *Actual)
 
STATIC BOOLEAN EqualBn2Bin (CONST VOID *Bn, CONST UINT8 *Buffer, CONST UINTN BufferSize)
 
UNIT_TEST_STATUS EFIAPI TestVerifyBnPreReq (UNIT_TEST_CONTEXT Context)
 
VOID EFIAPI TestVerifyBnCleanUp (UNIT_TEST_CONTEXT Context)
 
UNIT_TEST_STATUS EFIAPI TestVerifyBn (IN UNIT_TEST_CONTEXT Context)
 

Variables

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnOperationA []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnOperationB []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnOperationC []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnOperationExp []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnOperationMod []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnResultSum []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnResultSumMod []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnResultMulMod []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnResultDiv []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnResultMod []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnResultInverseMod []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnResultExpMod []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnResultRShift []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnResultUIntSet [] = { 0x12, 0x34, 0x56, 0x78 }
 
GLOBAL_REMOVE_IF_UNREFERENCED STATIC BN_TEST_CONTEXT mBnContext = { NULL, NULL, NULL, NULL, NULL }
 
TEST_DESC mBnTest []
 
UINTN mBnTestNum = ARRAY_SIZE (mBnTest)
 

Detailed Description

Application for BigNumber Primitives Validation.

Copyright (c) 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file BnTests.c.

Macro Definition Documentation

◆ BITS_OF_OPERATION_A

#define BITS_OF_OPERATION_A   480

Definition at line 16 of file BnTests.c.

◆ BYTES_OF_OPERATION_A

#define BYTES_OF_OPERATION_A   60

Definition at line 15 of file BnTests.c.

◆ MAX_TEST_DATA_SIZE

#define MAX_TEST_DATA_SIZE   512

Definition at line 14 of file BnTests.c.

Function Documentation

◆ EqualBn2Bin()

STATIC BOOLEAN EqualBn2Bin ( CONST VOID *  Bn,
CONST UINT8 *  Buffer,
CONST UINTN  BufferSize 
)

Definition at line 128 of file BnTests.c.

◆ EqualBn2Bn()

STATIC BOOLEAN EqualBn2Bn ( CONST VOID *  Expected,
CONST VOID *  Actual 
)

Definition at line 114 of file BnTests.c.

◆ TestVerifyBn()

UNIT_TEST_STATUS EFIAPI TestVerifyBn ( IN UNIT_TEST_CONTEXT  Context)

Definition at line 192 of file BnTests.c.

◆ TestVerifyBnCleanUp()

VOID EFIAPI TestVerifyBnCleanUp ( UNIT_TEST_CONTEXT  Context)

Definition at line 176 of file BnTests.c.

◆ TestVerifyBnPreReq()

UNIT_TEST_STATUS EFIAPI TestVerifyBnPreReq ( UNIT_TEST_CONTEXT  Context)

Definition at line 149 of file BnTests.c.

Variable Documentation

◆ BnOperationA

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnOperationA[]
Initial value:
= {
0x00, 0x00, 0x00, 0x00, 0x93, 0x61, 0x7a, 0xba, 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2, 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a,
0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8, 0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd,
0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e, 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f
}

Definition at line 18 of file BnTests.c.

◆ BnOperationB

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnOperationB[]
Initial value:
= {
0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad,
0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b, 0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07,
0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63, 0x1a, 0x8b, 0x60, 0x5a, 0x43, 0xff, 0x5b, 0xed,
0x80, 0x86, 0x07, 0x2b, 0xa1, 0xe7, 0xcc, 0x23, 0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7
}

Definition at line 25 of file BnTests.c.

◆ BnOperationC

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnOperationC[]
Initial value:
= {
0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63, 0x1a, 0x8b, 0x60, 0x5a, 0x43, 0xff, 0x5b, 0xed
}

Definition at line 32 of file BnTests.c.

◆ BnOperationExp

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnOperationExp[]
Initial value:
= {
0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63
}

Definition at line 36 of file BnTests.c.

◆ BnOperationMod

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnOperationMod[]
Initial value:
= {
0x48, 0xbe, 0xcb, 0xd5, 0x36, 0x2e, 0x93, 0x0b, 0x51, 0x45, 0x9c, 0x7d, 0xe7, 0xfe, 0x47, 0xaa,
0xc5, 0xd3, 0x4b, 0x4f, 0x06, 0x24, 0xb4, 0x31, 0x83, 0x55, 0xb5, 0xf0, 0xda, 0x14, 0xca, 0x46
}

Definition at line 40 of file BnTests.c.

◆ BnResultDiv

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnResultDiv[]
Initial value:
= {
0x02, 0x06, 0xA6, 0xDC, 0x2E, 0x97, 0x05, 0xEA, 0xCD, 0xF7, 0xAB, 0xCD, 0xE5, 0x9C, 0x33, 0x03,
0xCE, 0x3D, 0x7E, 0x63, 0x23, 0xB2, 0xEC, 0xED, 0x96, 0x9D, 0xC9, 0xBB, 0x78
}

Definition at line 66 of file BnTests.c.

◆ BnResultExpMod

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnResultExpMod[]
Initial value:
= {
0x39, 0xf8, 0x74, 0xa0, 0xe8, 0x02, 0x8b, 0xf2, 0x22, 0x62, 0x82, 0x4c, 0xe0, 0xed, 0x63, 0x48,
0xb9, 0xa2, 0xaa, 0xbc, 0xba, 0xb1, 0xd3, 0x6a, 0x02, 0xfd, 0xf3, 0x0e, 0x3a, 0x19, 0x39, 0x37
}

Definition at line 84 of file BnTests.c.

◆ BnResultInverseMod

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnResultInverseMod[]
Initial value:
= {
0x3a, 0xeb, 0xc5, 0x98, 0x9c, 0x22, 0xd6, 0x76, 0x7d, 0x1c, 0xc6, 0xd6, 0xbb, 0x1b, 0xed, 0xfd,
0x0f, 0x34, 0xbf, 0xe0, 0x2b, 0x4a, 0x26, 0xc3, 0xc0, 0xd9, 0x57, 0xc7, 0x11, 0xc0, 0xd6, 0x35
}

Definition at line 78 of file BnTests.c.

◆ BnResultMod

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnResultMod[]
Initial value:
= {
0x06, 0x2A, 0x8D, 0x06, 0x9D, 0x14, 0x53, 0x3B, 0x05, 0xD9, 0x86, 0x00, 0xA5, 0xB9, 0x05, 0x7F,
0xC1, 0x82, 0xEC, 0x23, 0x44, 0x23, 0xC8, 0xA2, 0x42, 0xB3, 0x43, 0xB8, 0x7C, 0xD6, 0xB1, 0xCF
}

Definition at line 72 of file BnTests.c.

◆ BnResultMulMod

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnResultMulMod[]
Initial value:
= {
0x01, 0xDB, 0xD2, 0x82, 0xC9, 0x24, 0x66, 0x2A, 0x96, 0x05, 0x11, 0xF2, 0x31, 0xF0, 0xCB, 0x28,
0xBA, 0x5C, 0xBE, 0x7D, 0xEE, 0x37, 0x25, 0xB1, 0x24, 0x7E, 0x15, 0xAB, 0xCD, 0x86, 0x8E, 0x39
}

Definition at line 60 of file BnTests.c.

◆ BnResultRShift

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnResultRShift[]
Initial value:
= {
0x93, 0x61, 0x7a, 0xba, 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2, 0x0a, 0x9e, 0xee, 0xe6,0x4b, 0x55, 0xd3, 0x9a,
0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8, 0x36, 0xba, 0x3c, 0x23,0xa3, 0xfe, 0xeb, 0xbd
}

Definition at line 90 of file BnTests.c.

◆ BnResultSum

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnResultSum[]
Initial value:
= {
0xb0, 0x03, 0x61, 0xa4, 0x29, 0x78, 0xf5, 0x57, 0x80, 0x52, 0x72, 0xab, 0xa0, 0x20, 0x56, 0xde,
0xdd, 0xe7, 0x6f, 0x8d, 0xcf, 0x4c, 0xdd, 0x2d, 0xc0, 0x3f, 0x2c, 0x4f, 0xe6, 0x1c, 0x23, 0xa1,
0x48, 0xbe, 0xcb, 0xd5, 0x36, 0x2e, 0x93, 0x0b, 0x51, 0x45, 0x9c, 0x7d, 0xe7, 0xfe, 0x47, 0xaa,
0xc5, 0xd3, 0x4b, 0x4f, 0x06, 0x24, 0xb4, 0x31, 0x83, 0x55, 0xb5, 0xf0, 0xda, 0x14, 0xca, 0x46
}

Definition at line 46 of file BnTests.c.

◆ BnResultSumMod

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnResultSumMod[]
Initial value:
= {
0x16, 0x0a, 0xcf, 0x78, 0x20, 0xac, 0x31, 0x53, 0xd9, 0x0f, 0x22, 0xfc, 0x08, 0x8d, 0xde, 0x0d,
0x29, 0xf4, 0x07, 0xdd, 0xfa, 0xf5, 0x61, 0xd4, 0x1a, 0xe5, 0xa1, 0xef, 0x4a, 0x37, 0xfe, 0xec
}

Definition at line 54 of file BnTests.c.

◆ BnResultUIntSet

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 BnResultUIntSet[] = { 0x12, 0x34, 0x56, 0x78 }

Definition at line 97 of file BnTests.c.

◆ mBnContext

Definition at line 107 of file BnTests.c.

◆ mBnTest

TEST_DESC mBnTest[]
Initial value:
= {
{ "TestVerifyBn()", "CryptoPkg.BaseCryptLib.BigNumber", TestVerifyBn, TestVerifyBnPreReq, TestVerifyBnCleanUp, &mBnContext },
}

Definition at line 259 of file BnTests.c.

◆ mBnTestNum

UINTN mBnTestNum = ARRAY_SIZE (mBnTest)

Definition at line 266 of file BnTests.c.