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
00050
00051 #ifndef MBEDTLS_XTEA_H
00052 #define MBEDTLS_XTEA_H
00053
00054 #if !defined(MBEDTLS_CONFIG_FILE)
00055 #include "config.h"
00056 #else
00057 #include MBEDTLS_CONFIG_FILE
00058 #endif
00059
00060 #include <stddef.h>
00061 #include <stdint.h>
00062
00063 #define MBEDTLS_XTEA_ENCRYPT 1
00064 #define MBEDTLS_XTEA_DECRYPT 0
00065
00066 #define MBEDTLS_ERR_XTEA_INVALID_INPUT_LENGTH -0x0028
00067 #define MBEDTLS_ERR_XTEA_HW_ACCEL_FAILED -0x0029
00069 #if !defined(MBEDTLS_XTEA_ALT)
00070
00071
00072
00073 #ifdef __cplusplus
00074 extern "C" {
00075 #endif
00076
00080 typedef struct
00081 {
00082 uint32_t k[4];
00083 }
00084 mbedtls_xtea_context;
00085
00091 void mbedtls_xtea_init( mbedtls_xtea_context *ctx );
00092
00098 void mbedtls_xtea_free( mbedtls_xtea_context *ctx );
00099
00106 void mbedtls_xtea_setup( mbedtls_xtea_context *ctx, const unsigned char key[16] );
00107
00118 int mbedtls_xtea_crypt_ecb( mbedtls_xtea_context *ctx,
00119 int mode,
00120 const unsigned char input[8],
00121 unsigned char output[8] );
00122
00123 #if defined(MBEDTLS_CIPHER_MODE_CBC)
00124
00137 int mbedtls_xtea_crypt_cbc( mbedtls_xtea_context *ctx,
00138 int mode,
00139 size_t length,
00140 unsigned char iv[8],
00141 const unsigned char *input,
00142 unsigned char *output);
00143 #endif
00144
00145 #ifdef __cplusplus
00146 }
00147 #endif
00148
00149 #else
00150 #include "xtea_alt.h"
00151 #endif
00152
00153 #ifdef __cplusplus
00154 extern "C" {
00155 #endif
00156
00162 int mbedtls_xtea_self_test( int verbose );
00163
00164 #ifdef __cplusplus
00165 }
00166 #endif
00167
00168 #endif