⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aes_tst.h

📁 关于AES加密算法的VC源代码
💻 H
字号:

// I retain copyright in this code but I encourage its free use provided
// that I don't carry any responsibility for the results. I am especially 
// happy to see it used in free and open source software. If you do use 
// it I would appreciate an acknowledgement of its origin in the code or
// the product that results and I would also appreciate knowing a liitle
// about the use to which it is being put.
//
// Dr B. R. Gladman <brg@gladman.uk.net> 1st June 2001.

// The following definitions are required for testing only, They are not needed 
// for AES (Rijndael) implementation.  They are used to allow C, C++ and DLL 
// data access and subroutine calls to be expressed in the same form in the 
// testing code.

#define ref_path    "..\\testvals\\"				// path for test vector files
#define out_path    "..\\outvals\\"					// path for output files
#define dll_path    "..\\aes_dll\\release\\aes"     // path for DLL

#if defined(AES_IN_CPP)

#define f_set_key(a,b,c,d)  (a)->set_key((b),(c),(d))
#define f_encrypt(a,b,c)    (a)->encrypt((b),(c))
#define f_decrypt(a,b,c)    (a)->decrypt((b),(c))
#define f_set_blk(a,b)      (a)->set_blk((b))

#elif !defined(AES_DLL)

#define f_set_key(a,b,c,d)  set_key((b),(c),(d),(a))
#define f_encrypt(a,b,c)    encrypt((b),(c),(a))
#define f_decrypt(a,b,c)    decrypt((b),(c),(a))
#define f_set_blk(a,b)      set_blk((b),(a))

#else

typedef cf_dec f_ky(const byte key[], const word klen, const enum aes_key mode, aes *ctx);
typedef cf_dec f_ed(const byte in_blk[], byte out_blk[], const aes *ctx);
typedef cf_dec f_bl(const word blen, aes *ctx);

typedef struct  // initialised with subroutine addresses when the DLL is loaded
{   f_ky    *fn_set_key;
    f_ed    *fn_encrypt;
    f_ed    *fn_decrypt;
    f_bl    *fn_set_blk;
} fn_ptrs;

#define f_dat(a,b)          (a->b)
#define f_set_key(a,b,c,d)  (fn.fn_set_key)((b),(c),(d),(a))
#define f_encrypt(a,b,c)    (fn.fn_encrypt)((b),(c),(a))
#define f_decrypt(a,b,c)    (fn.fn_decrypt)((b),(c),(a))
#define f_set_blk(a,b)      (fn.fn_set_blk)((b),(a))

#endif

⌨️ 快捷键说明

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