freeotfelib.h

来自「文件驱动加密,功能强大,可产生加密分区,支持AES,MD2,MD4,MD5MD2」· C头文件 代码 · 共 99 行

H
99
字号
// Description: 
// By Sarah Dean
// Email: sdean12@sdean12.org
// WWW:   http://www.FreeOTFE.org/
//
// -----------------------------------------------------------------------------
//


#ifndef _FreeOTFElib_H
#define _FreeOTFElib_H   1


#include <stdio.h>
#ifdef WINCE
#include <windows.h>  // Required for WCHAR
#else
#include <ntddk.h>
#include <ntdddisk.h>  // xxx -junk???
#endif

#include "FreeOTFEPlatform.h"


// =========================================================================
// Const definitions

// Length of the string representation of a GUID, in bytes
// The length of the string "{00000000-0000-0000-0000000000000000}"\0
//         i.e.              1234567890123456789012345678901234567  8
// WARNING: This omits any NULL terminator
#define GUID_STR_LENGTH  38
#define GUID_STRING_REP_CHAR_LENGTH   GUID_STR_LENGTH

// Length of the string representation of a GUID, in *bytes*
// WARNING: This omits any NULL terminator
#define GUID_STRING_REP_UNICODE_BYTE_LENGTH  (GUID_STR_LENGTH * sizeof(WCHAR))


// =========================================================================
// Function headers

// Convert the data passed in to it's ASCIIZ representation
// Note: outASCIIKey *must* be at least ((inKeyLength/4)+1) bytes long to store the ASCIIZ
//       representation of the key, including the terminating NULL
void ConvertDataToASCIIRep(
  unsigned int inKeyLength, // in Bits
  unsigned char* inKeyData,
  char* outASCIIKey
);


// Convert the specified nibble into a ASCII hex char
char _ConvertDataNibbleToASCIIChar(unsigned int nibble);


// Zero and free widestring memory
void SecZeroAndFreeWCHARMemory(
    IN WCHAR          *Memory
);

// Zero and free memory
void SecZeroAndFreeMemory(
    IN void          *Memory,
    IN unsigned int  Size
);

// Overwrite and zero memory
void SecZeroWCHARMemory(
    IN void          *Memory
);

// Overwrite and zero memory
void SecZeroMemory(
    IN void          *Memory,
    IN unsigned int  Size
);


// XOR block of memory
void XORBlock(
    IN   unsigned char*  InA,
    IN   unsigned char*  InB,
    OUT  unsigned char*  Out,
    IN   unsigned int    Size  // In Bytes
);

BOOLEAN GUIDToWCHAR(
    IN   GUID* ptrGUID,
    OUT  WCHAR** StringGUID
);


// =========================================================================
// =========================================================================

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?