📄 bc_rijn.h
字号:
/***************************************************************************************
* File: bc_rijn.h
*
* Purpose: Declarations of the Rijndael functions (ECB, CBC and CFB mode)
* We use it with 16-bytes blocks and 256-bit key
*
* Rijndael algorithm's authors:
* Joan Daemen
* Vincent Rijmen
*
* Code in aes_tab.h, aes.h, aes.c files are written by Dr B. R. Gladman <brg@gladman.uk.net>
*
***************************************************************************************/
#ifndef __BC_RIJNDAEL
#define __BC_RIJNDAEL
#define SERVICE_NAME "BC_RIJN"
#define DISPLAY_NAME "RIJNDAEL"
#define ALGORITHM_ID 0xF0
#define DRIVER_MAJOR_VERSION 0
#define DRIVER_MINOR_VERSION 1
// Key length in bits - required for external definitions of
// BestCrypt Algorithm modules
#define KEY_LENGTH 256
// number of bits per block
#define R_BLOCK_SIZE 128
// We have to reserve space both for encryption and decryption keys,
// The following structure is the same as defined in aes.c,
// excluding the fields that are not used in our case, when we
// use a definite block size (16 bytes)
#define BC_BLOCK_SIZE 16
#define BLOCK_LENGTH BC_BLOCK_SIZE
typedef struct
{
DWORD Nkey; // the number of 32-bit words in the key input block
DWORD Nrnd; // the number of cipher rounds
DWORD e_key[4 * BC_BLOCK_SIZE]; // the encryption key schedule
DWORD d_key[4 * BC_BLOCK_SIZE]; // the decryption key schedule
BYTE mode; // encrypt, decrypt or both
} BC_AES_STRUCT;
// the value is in bits
#define KEY_LENGTH_EXTENDED (sizeof(BC_AES_STRUCT) * 8)
/******* Exported functions *********/
#define IN
BOOL
KeyExtend( PUCHAR KeySource,
PDWORD KeyDestination );
/*
Encryption and decryption in Cipher Block Chaining (CBC) mode
*/
VOID
Encrypt( DWORD *IVector,
DWORD *KeyAdress,
DWORD *SrcBuffer,
DWORD *DstBuffer,
DWORD Length ); // in bytes
VOID
Decrypt( DWORD *IVector,
DWORD *KeyAdress,
DWORD *SrcBuffer,
DWORD *DstBuffer,
DWORD Length ); // in bytes
/*
Encryption and decryption in 32-bit Cipher-Feedback (CFB) mode
*/
VOID
encrypt_CFB( DWORD *IVector,
DWORD *KeyAddress,
DWORD *SrcBuffer,
DWORD *DstBuffer,
DWORD Length ); /* in bytes */
VOID
decrypt_CFB( DWORD *IVector,
DWORD *KeyAddress,
DWORD *SrcBuffer,
DWORD *DstBuffer,
DWORD Length ); /* in bytes */
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -