メインページ | アルファベット順一覧 | 構成 | ファイル一覧 | 構成メンバ | ファイルメンバ | 関連ページ

# dkcArcfour.h

説明を見る。

    00001
    00005 #ifndef  DKUTIL_C_ARCFOUR_H
    00006 #define  DKUTIL_C_ARCFOUR_H
    00007 #include "dkcOSIndependent.h"
    00008
    00009
    00010 //**********************************************************
    00011 //RC4互換アルゴリズム Arcfour
    00012 //参考：
    00013 //http://www21.ocn.ne.jp/~k-west/SSLandTLS/draft-kaukonen-cipher-arcfour-03-Ja.txt
    00014 //**********************************************************
    00015
    00017 typedef struct dkc_Arcfour_State{
    00018     unsigned char mi;
    00019     unsigned char mj;
    00020     unsigned char msbox[256];
    00021 }DKC_ARCFOUR_STATE;
    00022
    00030 DKC_EXTERN DKC_ARCFOUR_STATE * WINAPI dkcAllocArcfour(const unsigned char *key,size_t keylen);
    00031
    00036 DKC_EXTERN int WINAPI dkcFreeArcfour(DKC_ARCFOUR_STATE **p);
    00037
    00042 DKC_EXTERN unsigned char WINAPI dkcArcfourProcess(DKC_ARCFOUR_STATE *p);
    00043 #define dkcArcfourByte(s) dkcArcfourProcess(s)
    00044
    00052 DKC_EXTERN int WINAPI dkcArcfourEncrypt(DKC_ARCFOUR_STATE *p,
    00053     unsigned char *dest,size_t destsize,
    00054     const unsigned char *src,size_t srcsize);
    00055
    00056 DKC_EXTERN void WINAPI dkcArcfourEncryptNoDest(DKC_ARCFOUR_STATE *p,
    00057     unsigned char *dest_and_src,size_t dest_and_srcsize);
    00058
    00059 #define dkcArcfourDecrypt(p,dest,destsize,src,srcsize) \
    00060     dkcArcfourEncrypt(p,dest,destsize,src,srcsize)
    00061
    00062 #define dkcArcfourDecryptNoDest(p,dest_and_src,dest_and_srcsize) \
    00063     dkcArcfourEncryptNoDest(p,dest_and_src,dest_and_srcsize)
    00064
    00065
    00067 typedef struct dkc_Arcfour2byte_State{
    00068     unsigned short mi;
    00069     unsigned short mj;
    00070     unsigned short msbox[USHRT_MAX];
    00071 }DKC_ARCFOUR2BYTE_STATE;
    00072
    00073
    00074 DKC_EXTERN DKC_ARCFOUR2BYTE_STATE * WINAPI dkcAllocArcfour2Byte(const unsigned char *key,size_t keylen);
    00075
    00076
    00077 DKC_EXTERN int WINAPI dkcFreeArcfour2Byte(DKC_ARCFOUR2BYTE_STATE **p);
    00078
    00079
    00080 DKC_EXTERN unsigned short WINAPI dkcArcfour2ByteProcess(DKC_ARCFOUR2BYTE_STATE *p);
    00081
    00085 DKC_EXTERN int WINAPI dkcArcfour2ByteEncrypt(DKC_ARCFOUR2BYTE_STATE *p,
    00086     unsigned char *dest,size_t destsize,
    00087     const unsigned char *src,size_t srcsize);
    00088
    00089
    00090 DKC_EXTERN int WINAPI dkcArcfour2ByteEncryptNoDest(DKC_ARCFOUR2BYTE_STATE *p,
    00091     unsigned char *dest_and_src,size_t dest_and_srcsize);
    00092
    00093 #define dkcArcfour2ByteDecrypt(p,dest,destsize,src,srcsize) \
    00094     dkcArcfour2ByteEncrypt(p,dest,destsize,src,srcsize)
    00095
    00096 #define dkcArcfour2ByteDecryptNoDest(p,dest_and_src,dest_and_srcsize) \
    00097     dkcArcfour2ByteEncryptNoDest(p,dest_and_src,dest_and_srcsize)
    00098
    00099
    00100
    00101 #if !defined( DKUTIL_C_ARCFOUR_C ) &&  defined(USE_DKC_INDEPENDENT_INCLUDE)
    00102 #   include "dkcArcfour.c"
    00103 #endif
    00104
    00105 #endif //end of include once