mbed TLS v2.2.0
xtea.h
Go to the documentation of this file.
1 
23 #ifndef MBEDTLS_XTEA_H
24 #define MBEDTLS_XTEA_H
25 
26 #if !defined(MBEDTLS_CONFIG_FILE)
27 #include "config.h"
28 #else
29 #include MBEDTLS_CONFIG_FILE
30 #endif
31 
32 #include <stddef.h>
33 #include <stdint.h>
34 
35 #define MBEDTLS_XTEA_ENCRYPT 1
36 #define MBEDTLS_XTEA_DECRYPT 0
37 
38 #define MBEDTLS_ERR_XTEA_INVALID_INPUT_LENGTH -0x0028
40 #if !defined(MBEDTLS_XTEA_ALT)
41 // Regular implementation
42 //
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
51 typedef struct
52 {
53  uint32_t k[4];
54 }
56 
63 
70 
77 void mbedtls_xtea_setup( mbedtls_xtea_context *ctx, const unsigned char key[16] );
78 
90  int mode,
91  const unsigned char input[8],
92  unsigned char output[8] );
93 
94 #if defined(MBEDTLS_CIPHER_MODE_CBC)
95 
108 int mbedtls_xtea_crypt_cbc( mbedtls_xtea_context *ctx,
109  int mode,
110  size_t length,
111  unsigned char iv[8],
112  const unsigned char *input,
113  unsigned char *output);
114 #endif /* MBEDTLS_CIPHER_MODE_CBC */
115 
116 #ifdef __cplusplus
117 }
118 #endif
119 
120 #else /* MBEDTLS_XTEA_ALT */
121 #include "xtea_alt.h"
122 #endif /* MBEDTLS_XTEA_ALT */
123 
124 #ifdef __cplusplus
125 extern "C" {
126 #endif
127 
133 int mbedtls_xtea_self_test( int verbose );
134 
135 #ifdef __cplusplus
136 }
137 #endif
138 
139 #endif /* xtea.h */
int mbedtls_xtea_crypt_ecb(mbedtls_xtea_context *ctx, int mode, const unsigned char input[8], unsigned char output[8])
XTEA cipher function.
void mbedtls_xtea_free(mbedtls_xtea_context *ctx)
Clear XTEA context.
Compatibility names (set of defines)
void mbedtls_xtea_init(mbedtls_xtea_context *ctx)
Initialize XTEA context.
void mbedtls_xtea_setup(mbedtls_xtea_context *ctx, const unsigned char key[16])
XTEA key schedule.
int mbedtls_xtea_self_test(int verbose)
Checkup routine.
XTEA context structure.
Definition: xtea.h:51