00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef MBEDTLS_XTEA_H
00025 #define MBEDTLS_XTEA_H
00026
00027 #if !defined(MBEDTLS_CONFIG_FILE)
00028 #include "config.h"
00029 #else
00030 #include MBEDTLS_CONFIG_FILE
00031 #endif
00032
00033 #include <stddef.h>
00034 #include <stdint.h>
00035
00036 #define MBEDTLS_XTEA_ENCRYPT 1
00037 #define MBEDTLS_XTEA_DECRYPT 0
00038
00039 #define MBEDTLS_ERR_XTEA_INVALID_INPUT_LENGTH -0x0028
00040 #define MBEDTLS_ERR_XTEA_HW_ACCEL_FAILED -0x0029
00042 #if !defined(MBEDTLS_XTEA_ALT)
00043
00044
00045
00046 #ifdef __cplusplus
00047 extern "C" {
00048 #endif
00049
00053 typedef struct
00054 {
00055 uint32_t k[4];
00056 }
00057 mbedtls_xtea_context;
00058
00064 void mbedtls_xtea_init( mbedtls_xtea_context *ctx );
00065
00071 void mbedtls_xtea_free( mbedtls_xtea_context *ctx );
00072
00079 void mbedtls_xtea_setup( mbedtls_xtea_context *ctx, const unsigned char key[16] );
00080
00091 int mbedtls_xtea_crypt_ecb( mbedtls_xtea_context *ctx,
00092 int mode,
00093 const unsigned char input[8],
00094 unsigned char output[8] );
00095
00096 #if defined(MBEDTLS_CIPHER_MODE_CBC)
00097
00110 int mbedtls_xtea_crypt_cbc( mbedtls_xtea_context *ctx,
00111 int mode,
00112 size_t length,
00113 unsigned char iv[8],
00114 const unsigned char *input,
00115 unsigned char *output);
00116 #endif
00117
00118 #ifdef __cplusplus
00119 }
00120 #endif
00121
00122 #else
00123 #include "xtea_alt.h"
00124 #endif
00125
00126 #ifdef __cplusplus
00127 extern "C" {
00128 #endif
00129
00135 int mbedtls_xtea_self_test( int verbose );
00136
00137 #ifdef __cplusplus
00138 }
00139 #endif
00140
00141 #endif