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

# 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 dkcArcfourByte(DKC_ARCFOUR_STATE *p);
    00051 DKC_EXTERN int WINAPI dkcArcfourEncrypt(DKC_ARCFOUR_STATE *p,
    00052     unsigned char *dest,size_t destsize,
    00053     const unsigned char *src,size_t srcsize);
    00054
    00055 DKC_EXTERN void WINAPI dkcArcfourEncryptNoDest(DKC_ARCFOUR_STATE *p,
    00056     unsigned char *dest_and_src,size_t dest_and_srcsize);
    00057
    00058 #define dkcArcfourDecrypt(p,dest,destsize,src,srcsize) \
    00059     dkcArcfourEncrypt(p,dest,destsize,src,srcsize)
    00060
    00061 #define dkcArcfourDecryptNoDest(p,dest_and_src,dest_and_srcsize) \
    00062     dkcArcfourEncryptNoDest(p,dest_and_src,dest_and_srcsize)
    00063
    00064
    00066 typedef struct dkc_Arcfour2byte_State{
    00067     unsigned short mi;
    00068     unsigned short mj;
    00069     unsigned short msbox[USHRT_MAX];
    00070 }DKC_ARCFOUR2BYTE_STATE;
    00071
    00072
    00073 DKC_EXTERN DKC_ARCFOUR2BYTE_STATE * WINAPI dkcAllocArcfour2Byte(const unsigned char *key,size_t keylen);
    00074
    00075
    00076 DKC_EXTERN int WINAPI dkcFreeArcfour2Byte(DKC_ARCFOUR2BYTE_STATE **p);
    00077
    00078
    00079 DKC_EXTERN unsigned short WINAPI dkcArcfour2ByteProcess(DKC_ARCFOUR2BYTE_STATE *p);
    00080
    00084 DKC_EXTERN int WINAPI dkcArcfour2ByteEncrypt(DKC_ARCFOUR2BYTE_STATE *p,
    00085     unsigned char *dest,size_t destsize,
    00086     const unsigned char *src,size_t srcsize);
    00087
    00088
    00089 DKC_EXTERN int WINAPI dkcArcfour2ByteEncryptNoDest(DKC_ARCFOUR2BYTE_STATE *p,
    00090     unsigned char *dest_and_src,size_t dest_and_srcsize);
    00091
    00092 #define dkcArcfour2ByteDecrypt(p,dest,destsize,src,srcsize) \
    00093     dkcArcfour2ByteEncrypt(p,dest,destsize,src,srcsize)
    00094
    00095 #define dkcArcfour2ByteDecryptNoDest(p,dest_and_src,dest_and_srcsize) \
    00096     dkcArcfour2ByteEncryptNoDest(p,dest_and_src,dest_and_srcsize)
    00097
    00098
    00099
    00100 #if !defined( DKUTIL_C_ARCFOUR_C ) &&  defined(USE_DKC_INDEPENDENT_INCLUDE)
    00101 #   include "dkcArcfour.c"
    00102 #endif
    00103
    00104 #endif //end of include once