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

rijndael-api-fst.h

説明を見る。
00001 
00038 #ifndef __RIJNDAEL_API_FST_H
00039 #define __RIJNDAEL_API_FST_H
00040 
00041 //#include <stdio.h>
00042 #include "rijndael-alg-fst.h"
00043 
00044 /*  Generic Defines  */
00045 #define     DIR_ENCRYPT           0 /*  Are we encrpyting?  */
00046 #define     DIR_DECRYPT           1 /*  Are we decrpyting?  */
00047 #define     MODE_ECB              1 /*  Are we ciphering in ECB mode?   */
00048 #define     MODE_CBC              2 /*  Are we ciphering in CBC mode?   */
00049 #define     MODE_CFB1             3 /*  Are we ciphering in 1-bit CFB mode? */
00050 #define     TRUE                  1
00051 #define     FALSE                 0
00052 #define     BITSPERBLOCK        128 /* Default number of bits in a cipher block */
00053 
00054 /*  Error Codes  */
00055 #define     BAD_KEY_DIR          -1 /*  Key direction is invalid, e.g., unknown value */
00056 #define     BAD_KEY_MAT          -2 /*  Key material not of correct length */
00057 #define     BAD_KEY_INSTANCE     -3 /*  Key passed is not valid */
00058 #define     BAD_CIPHER_MODE      -4 /*  Params struct passed to cipherInit invalid */
00059 #define     BAD_CIPHER_STATE     -5 /*  Cipher in wrong state (e.g., not initialized) */
00060 #define     BAD_BLOCK_LENGTH     -6
00061 #define     BAD_CIPHER_INSTANCE  -7
00062 #define     BAD_DATA             -8 /*  Data contents are invalid, e.g., invalid padding */
00063 #define     BAD_OTHER            -9 /*  Unknown error */
00064 
00065 /*  Algorithm-specific Defines  */
00066 #define     MAX_KEY_SIZE         64 /* # of ASCII char's needed to represent a key */
00067 #define     MAX_IV_SIZE          16 /* # bytes needed to represent an IV  */
00068 
00069 /*  Typedefs  */
00070 #if 0
00071 typedef unsigned char   BYTE;
00072 #else
00073 #   ifndef WIN32
00074         typedef unsigned char   BYTE;
00075 #   else
00076 #       include <windows.h>
00077 #   endif
00078 #endif
00079 /*  The structure for key information */
00080 typedef struct {
00081     BYTE  direction;                /* Key used for encrypting or decrypting? */
00082     int   keyLen;                   /* Length of the key  */
00083     char  keyMaterial[MAX_KEY_SIZE+1];  /* Raw key data in ASCII, e.g., user input or KAT values */
00084     int   Nr;                       /* key-length-dependent number of rounds */
00085     u32   rk[4*(MAXNR + 1)];        /* key schedule */
00086     u32   ek[4*(MAXNR + 1)];        /* CFB1 key schedule (encryption only) */
00087 } keyInstance;
00088 
00089 /*  The structure for cipher information */
00090 typedef struct {                    /* changed order of the components */
00091     BYTE  mode;                     /* MODE_ECB, MODE_CBC, or MODE_CFB1 */
00092     BYTE  IV[MAX_IV_SIZE];          /* A possible Initialization Vector for ciphering */
00093 } cipherInstance;
00094 
00095 /*  Function prototypes  */
00096 
00097 int makeKey(keyInstance *key, BYTE direction, int keyLen, char *keyMaterial);
00098 
00099 int cipherInit(cipherInstance *cipher, BYTE mode, char *IV);
00100 
00101 int blockEncrypt(cipherInstance *cipher, keyInstance *key,
00102         BYTE *input, int inputLen, BYTE *outBuffer);
00103 
00104 int padEncrypt(cipherInstance *cipher, keyInstance *key,
00105         BYTE *input, int inputOctets, BYTE *outBuffer);
00106 
00107 int blockDecrypt(cipherInstance *cipher, keyInstance *key,
00108         BYTE *input, int inputLen, BYTE *outBuffer);
00109 
00110 int padDecrypt(cipherInstance *cipher, keyInstance *key,
00111         BYTE *input, int inputOctets, BYTE *outBuffer);
00112 
00113 #ifdef INTERMEDIATE_VALUE_KAT
00114 int cipherUpdateRounds(cipherInstance *cipher, keyInstance *key,
00115         BYTE *input, int inputLen, BYTE *outBuffer, int Rounds);
00116 #endif /* INTERMEDIATE_VALUE_KAT */
00117 
00118 #endif /* __RIJNDAEL_API_FST_H */

dkutil_cに対してTue Feb 22 02:01:50 2005に生成されました。 doxygen 1.3.6