PolarSSL v1.3.3
xtea.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_XTEA_H
28 #define POLARSSL_XTEA_H
29 
30 #include "config.h"
31 
32 #include <string.h>
33 
34 #if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
35 #include <basetsd.h>
36 typedef UINT32 uint32_t;
37 #else
38 #include <inttypes.h>
39 #endif
40 
41 #define XTEA_ENCRYPT 1
42 #define XTEA_DECRYPT 0
43 
44 #define POLARSSL_ERR_XTEA_INVALID_INPUT_LENGTH -0x0028
46 #if !defined(POLARSSL_XTEA_ALT)
47 // Regular implementation
48 //
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
57 typedef struct
58 {
59  uint32_t k[4];
60 }
62 
69 void xtea_setup( xtea_context *ctx, const unsigned char key[16] );
70 
82  int mode,
83  const unsigned char input[8],
84  unsigned char output[8] );
85 
86 #if defined(POLARSSL_CIPHER_MODE_CBC)
87 
100 int xtea_crypt_cbc( xtea_context *ctx,
101  int mode,
102  size_t length,
103  unsigned char iv[8],
104  const unsigned char *input,
105  unsigned char *output);
106 #endif /* POLARSSL_CIPHER_MODE_CBC */
107 
108 #ifdef __cplusplus
109 }
110 #endif
111 
112 #else /* POLARSSL_XTEA_ALT */
113 #include "xtea_alt.h"
114 #endif /* POLARSSL_XTEA_ALT */
115 
116 #ifdef __cplusplus
117 extern "C" {
118 #endif
119 
125 int xtea_self_test( int verbose );
126 
127 #ifdef __cplusplus
128 }
129 #endif
130 
131 #endif /* xtea.h */
Configuration options (set of defines)
int xtea_crypt_ecb(xtea_context *ctx, int mode, const unsigned char input[8], unsigned char output[8])
XTEA cipher function.
void xtea_setup(xtea_context *ctx, const unsigned char key[16])
XTEA key schedule.
int xtea_crypt_cbc(xtea_context *ctx, int mode, size_t length, unsigned char iv[8], const unsigned char *input, unsigned char *output)
XTEA CBC cipher function.
XTEA context structure.
Definition: xtea.h:57
int xtea_self_test(int verbose)
Checkup routine.