PolarSSL v1.1.4
|
00001 00027 #ifndef POLARSSL_XTEA_H 00028 #define POLARSSL_XTEA_H 00029 00030 #include <string.h> 00031 00032 #ifdef _MSC_VER 00033 #include <basetsd.h> 00034 typedef UINT32 uint32_t; 00035 #else 00036 #include <inttypes.h> 00037 #endif 00038 00039 #define XTEA_ENCRYPT 1 00040 #define XTEA_DECRYPT 0 00041 00042 #define POLARSSL_ERR_XTEA_INVALID_INPUT_LENGTH -0x0028 00047 typedef struct 00048 { 00049 uint32_t k[4]; 00050 } 00051 xtea_context; 00052 00053 #ifdef __cplusplus 00054 extern "C" { 00055 #endif 00056 00063 void xtea_setup( xtea_context *ctx, unsigned char key[16] ); 00064 00075 int xtea_crypt_ecb( xtea_context *ctx, 00076 int mode, 00077 unsigned char input[8], 00078 unsigned char output[8] ); 00079 00093 int xtea_crypt_cbc( xtea_context *ctx, 00094 int mode, 00095 size_t length, 00096 unsigned char iv[8], 00097 unsigned char *input, 00098 unsigned char *output); 00099 00100 /* 00101 * \brief Checkup routine 00102 * 00103 * \return 0 if successful, or 1 if the test failed 00104 */ 00105 int xtea_self_test( int verbose ); 00106 00107 #ifdef __cplusplus 00108 } 00109 #endif 00110 00111 #endif /* xtea.h */