00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #ifndef MBEDTLS_XTEA_H
00050 #define MBEDTLS_XTEA_H
00051
00052 #if !defined(MBEDTLS_CONFIG_FILE)
00053 #include "config.h"
00054 #else
00055 #include MBEDTLS_CONFIG_FILE
00056 #endif
00057
00058 #include <stddef.h>
00059 #include <stdint.h>
00060
00061 #define MBEDTLS_XTEA_ENCRYPT 1
00062 #define MBEDTLS_XTEA_DECRYPT 0
00063
00064 #define MBEDTLS_ERR_XTEA_INVALID_INPUT_LENGTH -0x0028
00065 #define MBEDTLS_ERR_XTEA_HW_ACCEL_FAILED -0x0029
00067 #if !defined(MBEDTLS_XTEA_ALT)
00068
00069
00070
00071 #ifdef __cplusplus
00072 extern "C" {
00073 #endif
00074
00078 typedef struct
00079 {
00080 uint32_t k[4];
00081 }
00082 mbedtls_xtea_context;
00083
00089 void mbedtls_xtea_init( mbedtls_xtea_context *ctx );
00090
00096 void mbedtls_xtea_free( mbedtls_xtea_context *ctx );
00097
00104 void mbedtls_xtea_setup( mbedtls_xtea_context *ctx, const unsigned char key[16] );
00105
00116 int mbedtls_xtea_crypt_ecb( mbedtls_xtea_context *ctx,
00117 int mode,
00118 const unsigned char input[8],
00119 unsigned char output[8] );
00120
00121 #if defined(MBEDTLS_CIPHER_MODE_CBC)
00122
00135 int mbedtls_xtea_crypt_cbc( mbedtls_xtea_context *ctx,
00136 int mode,
00137 size_t length,
00138 unsigned char iv[8],
00139 const unsigned char *input,
00140 unsigned char *output);
00141 #endif
00142
00143 #ifdef __cplusplus
00144 }
00145 #endif
00146
00147 #else
00148 #include "xtea_alt.h"
00149 #endif
00150
00151 #ifdef __cplusplus
00152 extern "C" {
00153 #endif
00154
00160 int mbedtls_xtea_self_test( int verbose );
00161
00162 #ifdef __cplusplus
00163 }
00164 #endif
00165
00166 #endif