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

Go to the source code of this file.

Data Structures

struct  BLOCK_CIPHER_TEST_CONTEXT
 

Typedefs

typedef UINTN(EFIAPI * EFI_BLOCK_CIPHER_GET_CONTEXT_SIZE) (VOID)
 
typedef BOOLEAN(EFIAPI * EFI_BLOCK_CIPHER_INIT) (OUT VOID *BlockCipherContext, IN CONST UINT8 *Key, IN UINTN KeyLength)
 
typedef BOOLEAN(EFIAPI * EFI_BLOCK_CIPHER_ECB_ENCRYPT_DECRYPT) (IN VOID *BlockCipherContext, IN CONST UINT8 *Input, IN UINTN InputSize, OUT UINT8 *Output)
 
typedef BOOLEAN(EFIAPI * EFI_BLOCK_CIPHER_CBC_ENCRYPT_DECRYPT) (IN VOID *BlockCipherContext, IN CONST UINT8 *Input, IN UINTN InputSize, IN CONST UINT8 *Ivec, OUT UINT8 *Output)
 
typedef BOOLEAN(EFIAPI * EFI_BLOCK_CIPHER_RESET) (IN OUT VOID *BlockCipherContext)
 

Functions

UNIT_TEST_STATUS EFIAPI TestVerifyBLockCiperPreReq (UNIT_TEST_CONTEXT Context)
 
VOID EFIAPI TestVerifyBLockCiperCleanUp (UNIT_TEST_CONTEXT Context)
 
UNIT_TEST_STATUS EFIAPI TestVerifyBLockCiper (UNIT_TEST_CONTEXT Context)
 

Variables

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcbData []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcbKey []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcbCipher []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcb2Cipher []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesCbcData []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesCbcKey []
 
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TdesCbcIvec []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesCbc3Cipher []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128EcbData []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128EcbKey []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128EcbCipher []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes192EcbData []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes192EcbKey []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes192EcbCipher []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes256EcbData []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes256EcbKey []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes256EcbCipher []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcData []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcKey []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcIvec []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcCipher []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Arc4Data []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Arc4Key []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Arc4Cipher []
 
BLOCK_CIPHER_TEST_CONTEXT mAes128CbcTestCtx = { AesGetContextSize, AesInit, NULL, NULL, AesCbcEncrypt, AesCbcDecrypt, NULL, Aes128CbcKey, 128, Aes128CbcIvec, Aes128CbcData, sizeof (Aes128CbcData), Aes128CbcCipher, sizeof (Aes128CbcCipher) }
 
TEST_DESC mBlockCipherTest []
 
UINTN mBlockCipherTestNum = ARRAY_SIZE (mBlockCipherTest)
 

Detailed Description

Application for Block Cipher Primitives Validation.

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

Definition in file BlockCipherTests.c.

Typedef Documentation

◆ EFI_BLOCK_CIPHER_CBC_ENCRYPT_DECRYPT

typedef BOOLEAN(EFIAPI * EFI_BLOCK_CIPHER_CBC_ENCRYPT_DECRYPT) (IN VOID *BlockCipherContext, IN CONST UINT8 *Input, IN UINTN InputSize, IN CONST UINT8 *Ivec, OUT UINT8 *Output)

Definition at line 152 of file BlockCipherTests.c.

◆ EFI_BLOCK_CIPHER_ECB_ENCRYPT_DECRYPT

typedef BOOLEAN(EFIAPI * EFI_BLOCK_CIPHER_ECB_ENCRYPT_DECRYPT) (IN VOID *BlockCipherContext, IN CONST UINT8 *Input, IN UINTN InputSize, OUT UINT8 *Output)

Definition at line 143 of file BlockCipherTests.c.

◆ EFI_BLOCK_CIPHER_GET_CONTEXT_SIZE

typedef UINTN(EFIAPI * EFI_BLOCK_CIPHER_GET_CONTEXT_SIZE) (VOID)

Definition at line 129 of file BlockCipherTests.c.

◆ EFI_BLOCK_CIPHER_INIT

typedef BOOLEAN(EFIAPI * EFI_BLOCK_CIPHER_INIT) (OUT VOID *BlockCipherContext, IN CONST UINT8 *Key, IN UINTN KeyLength)

Definition at line 135 of file BlockCipherTests.c.

◆ EFI_BLOCK_CIPHER_RESET

typedef BOOLEAN(EFIAPI * EFI_BLOCK_CIPHER_RESET) (IN OUT VOID *BlockCipherContext)

Definition at line 162 of file BlockCipherTests.c.

Function Documentation

◆ TestVerifyBLockCiper()

UNIT_TEST_STATUS EFIAPI TestVerifyBLockCiper ( UNIT_TEST_CONTEXT  Context)

Definition at line 229 of file BlockCipherTests.c.

◆ TestVerifyBLockCiperCleanUp()

VOID EFIAPI TestVerifyBLockCiperCleanUp ( UNIT_TEST_CONTEXT  Context)

Definition at line 215 of file BlockCipherTests.c.

◆ TestVerifyBLockCiperPreReq()

UNIT_TEST_STATUS EFIAPI TestVerifyBLockCiperPreReq ( UNIT_TEST_CONTEXT  Context)

Definition at line 196 of file BlockCipherTests.c.

Variable Documentation

◆ Aes128CbcCipher

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcCipher[]
Initial value:
= {
0xd2, 0x96, 0xcd, 0x94, 0xc2, 0xcc, 0xcf, 0x8a, 0x3a, 0x86, 0x30, 0x28, 0xb5, 0xe1, 0xdc, 0x0a,
0x75, 0x86, 0x60, 0x2d, 0x25, 0x3c, 0xff, 0xf9, 0x1b, 0x82, 0x66, 0xbe, 0xa6, 0xd6, 0x1a, 0xb1
}

Definition at line 107 of file BlockCipherTests.c.

◆ Aes128CbcData

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcData[]
Initial value:
= {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
}

Definition at line 94 of file BlockCipherTests.c.

◆ Aes128CbcIvec

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcIvec[]
Initial value:
= {
0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28, 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58
}

Definition at line 103 of file BlockCipherTests.c.

◆ Aes128CbcKey

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcKey[]
Initial value:
= {
0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0, 0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a
}

Definition at line 99 of file BlockCipherTests.c.

◆ Aes128EcbCipher

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128EcbCipher[]
Initial value:
= {
0x6d, 0x25, 0x1e, 0x69, 0x44, 0xb0, 0x51, 0xe0, 0x4e, 0xaa, 0x6f, 0xb4, 0xdb, 0xf7, 0x84, 0x65
}

Definition at line 64 of file BlockCipherTests.c.

◆ Aes128EcbData

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128EcbData[]
Initial value:
= {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}

Definition at line 56 of file BlockCipherTests.c.

◆ Aes128EcbKey

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128EcbKey[]
Initial value:
= {
0x10, 0xa5, 0x88, 0x69, 0xd7, 0x4b, 0xe5, 0xa3, 0x74, 0xcf, 0x86, 0x7c, 0xfb, 0x47, 0x38, 0x59
}

Definition at line 60 of file BlockCipherTests.c.

◆ Aes192EcbCipher

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes192EcbCipher[]
Initial value:
= {
0xdd, 0x8a, 0x49, 0x35, 0x14, 0x23, 0x1c, 0xbf, 0x56, 0xec, 0xce, 0xe4, 0xc4, 0x08, 0x89, 0xfb
}

Definition at line 77 of file BlockCipherTests.c.

◆ Aes192EcbData

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes192EcbData[]
Initial value:
= {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}

Definition at line 68 of file BlockCipherTests.c.

◆ Aes192EcbKey

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes192EcbKey[]
Initial value:
= {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
}

Definition at line 72 of file BlockCipherTests.c.

◆ Aes256EcbCipher

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes256EcbCipher[]
Initial value:
= {
0x5c, 0x9d, 0x84, 0x4e, 0xd4, 0x6f, 0x98, 0x85, 0x08, 0x5e, 0x5d, 0x6a, 0x4f, 0x94, 0xc7, 0xd7
}

Definition at line 90 of file BlockCipherTests.c.

◆ Aes256EcbData

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes256EcbData[]
Initial value:
= {
0x01, 0x47, 0x30, 0xf8, 0x0a, 0xc6, 0x25, 0xfe, 0x84, 0xf0, 0x26, 0xc6, 0x0b, 0xfd, 0x54, 0x7d
}

Definition at line 81 of file BlockCipherTests.c.

◆ Aes256EcbKey

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes256EcbKey[]
Initial value:
= {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}

Definition at line 85 of file BlockCipherTests.c.

◆ Arc4Cipher

Initial value:
= {
0x74, 0x94, 0xC2, 0xE7, 0x10, 0x4B, 0x08, 0x79
}

Definition at line 124 of file BlockCipherTests.c.

◆ Arc4Data

Initial value:
= {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}

Definition at line 116 of file BlockCipherTests.c.

◆ Arc4Key

Initial value:
= {
0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF
}

Definition at line 120 of file BlockCipherTests.c.

◆ mAes128CbcTestCtx

BLOCK_CIPHER_TEST_CONTEXT mAes128CbcTestCtx = { AesGetContextSize, AesInit, NULL, NULL, AesCbcEncrypt, AesCbcDecrypt, NULL, Aes128CbcKey, 128, Aes128CbcIvec, Aes128CbcData, sizeof (Aes128CbcData), Aes128CbcCipher, sizeof (Aes128CbcCipher) }

Definition at line 192 of file BlockCipherTests.c.

◆ mBlockCipherTest

TEST_DESC mBlockCipherTest[]
Initial value:
= {
{ "TestVerifyAes128Cbc()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mAes128CbcTestCtx },
}

Definition at line 276 of file BlockCipherTests.c.

◆ mBlockCipherTestNum

UINTN mBlockCipherTestNum = ARRAY_SIZE (mBlockCipherTest)

Definition at line 290 of file BlockCipherTests.c.

◆ TdesCbc3Cipher

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesCbc3Cipher[]
Initial value:
= {
0x3F, 0xE3, 0x01, 0xC9, 0x62, 0xAC, 0x01, 0xD0,
0x22, 0x13, 0x76, 0x3C, 0x1C, 0xBD, 0x4C, 0xDC,
0x79, 0x96, 0x57, 0xC0, 0x64, 0xEC, 0xF5, 0xD4
}

Definition at line 47 of file BlockCipherTests.c.

◆ TdesCbcData

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesCbcData[]
Initial value:
= {
0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
0x4E, 0x6F, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
0x68, 0x65, 0x20, 0x74, 0x69, 0x6D, 0x65, 0x20
}

Definition at line 31 of file BlockCipherTests.c.

◆ TdesCbcIvec

GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TdesCbcIvec[]
Initial value:
= {
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10
}

Definition at line 43 of file BlockCipherTests.c.

◆ TdesCbcKey

Initial value:
= {
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
0xf1, 0xe0, 0xd3, 0xc2, 0xb5, 0xa4, 0x97, 0x86,
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10
}

Definition at line 37 of file BlockCipherTests.c.

◆ TdesEcb2Cipher

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcb2Cipher[]
Initial value:
= {
0x92, 0x95, 0xB5, 0x9B, 0xB3, 0x84, 0x73, 0x6E,
}

Definition at line 27 of file BlockCipherTests.c.

◆ TdesEcbCipher

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcbCipher[]
Initial value:
= {
0x8C, 0xA6, 0x4D, 0xE9, 0xC1, 0xB1, 0x23, 0xA7,
}

Definition at line 23 of file BlockCipherTests.c.

◆ TdesEcbData

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcbData[]
Initial value:
= {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}

Definition at line 14 of file BlockCipherTests.c.

◆ TdesEcbKey

Initial value:
= {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
}

Definition at line 18 of file BlockCipherTests.c.