//====================================================================== // IRIS-SUBPモニタプログラム Blowfish関数 //====================================================================== #ifndef _IRIS_SUBP_BLOWFISH_H #define _IRIS_SUBP_BLOWFISH_H #include "IrisSubpMonTarget.h" typedef struct { unsigned int P[16 + 2]; unsigned int S[4][256]; } BLOWFISH_CTX; void InitBlowfish(BLOWFISH_CTX *ctx, const unsigned char *key, int keyLen); void EncryptByBlowfish(const BLOWFISH_CTX *ctx, unsigned int *xl, unsigned int *xr); void DecryptByBlowfish(const BLOWFISH_CTX *ctx, unsigned int *xl, unsigned int *xr); #ifndef DISABLE_SECURE_CODE void InitBlowfishFook(BLOWFISH_CTX *ctx, const unsigned char *key, int keyLen); void EncryptByBlowfishFook0(const BLOWFISH_CTX *ctx, unsigned int *xl, unsigned int *xr); void EncryptByBlowfishFook1(const BLOWFISH_CTX *ctx, unsigned int *x); void EncryptByBlowfishFook2(const BLOWFISH_CTX *ctx, unsigned int *x); void DecryptByBlowfishFook(const BLOWFISH_CTX *ctx, unsigned int *x); #else #define InitBlowfishFook() InitBlowfish() #define EncryptByBlowfishFook0(ctx, xl, xr) EncryptByBlowfish(ctx, xl, xr) #define EncryptByBlowfishFook1(ctx, x) EncryptByBlowfish(ctx, &(x)[1], &(x)[0]) #define EncryptByBlowfishFook2(ctx, x) EncryptByBlowfish(ctx, &(x)[2], &(x)[1]) #define DecryptByBlowfishFook(ctx, x) DecryptByBlowfish(ctx, &(x)[1], &(x)[0]) #endif // DISABLE_SECURE_CODE #ifndef ENABLE_TEST_BLOWFISH extern const BLOWFISH_CTX blowfishInitTable; // 初期化テーブル #else extern const BLOWFISH_CTX blowfishTestTable; // (テスト版) #endif // ENABLE_TEST_BLOWFISH #endif // _IRIS_SUBP_BLOWFISH_H