00001
00004 #ifndef XYSSL_DES_H
00005 #define XYSSL_DES_H
00006
00007 #define DES_ENCRYPT 1
00008 #define DES_DECRYPT 0
00009
00013 typedef struct
00014 {
00015 int mode;
00016 unsigned long sk[32];
00017 }
00018 des_context;
00019
00023 typedef struct
00024 {
00025 int mode;
00026 unsigned long sk[96];
00027 }
00028 des3_context;
00029
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033
00040 void des_setkey_enc( des_context *ctx, unsigned char key[8] );
00041
00048 void des_setkey_dec( des_context *ctx, unsigned char key[8] );
00049
00056 void des3_set2key_enc( des3_context *ctx, unsigned char key[16] );
00057
00064 void des3_set2key_dec( des3_context *ctx, unsigned char key[16] );
00065
00072 void des3_set3key_enc( des3_context *ctx, unsigned char key[24] );
00073
00080 void des3_set3key_dec( des3_context *ctx, unsigned char key[24] );
00081
00089 void des_crypt_ecb( des_context *ctx,
00090 unsigned char input[8],
00091 unsigned char output[8] );
00092
00103 void des_crypt_cbc( des_context *ctx,
00104 int mode,
00105 int length,
00106 unsigned char iv[8],
00107 unsigned char *input,
00108 unsigned char *output );
00109
00117 void des3_crypt_ecb( des3_context *ctx,
00118 unsigned char input[8],
00119 unsigned char output[8] );
00120
00131 void des3_crypt_cbc( des3_context *ctx,
00132 int mode,
00133 int length,
00134 unsigned char iv[8],
00135 unsigned char *input,
00136 unsigned char *output );
00137
00138
00139
00140
00141
00142
00143 int des_self_test( int verbose );
00144
00145 #ifdef __cplusplus
00146 }
00147 #endif
00148
00149 #endif