PolarSSL v1.3.9
xtea.h
Go to the documentation of this file.
1
27#ifndef POLARSSL_XTEA_H
28#define POLARSSL_XTEA_H
29
30#if !defined(POLARSSL_CONFIG_FILE)
31#include "config.h"
32#else
33#include POLARSSL_CONFIG_FILE
34#endif
35
36#include <string.h>
37
38#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
39#include <basetsd.h>
40typedef UINT32 uint32_t;
41#else
42#include <inttypes.h>
43#endif
44
45#define XTEA_ENCRYPT 1
46#define XTEA_DECRYPT 0
47
48#define POLARSSL_ERR_XTEA_INVALID_INPUT_LENGTH -0x0028
50#if !defined(POLARSSL_XTEA_ALT)
51// Regular implementation
52//
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
61typedef struct
62{
63 uint32_t k[4];
64}
66
73
80
87void xtea_setup( xtea_context *ctx, const unsigned char key[16] );
88
100 int mode,
101 const unsigned char input[8],
102 unsigned char output[8] );
103
104#if defined(POLARSSL_CIPHER_MODE_CBC)
119 int mode,
120 size_t length,
121 unsigned char iv[8],
122 const unsigned char *input,
123 unsigned char *output);
124#endif /* POLARSSL_CIPHER_MODE_CBC */
125
126#ifdef __cplusplus
127}
128#endif
129
130#else /* POLARSSL_XTEA_ALT */
131#include "xtea_alt.h"
132#endif /* POLARSSL_XTEA_ALT */
133
134#ifdef __cplusplus
135extern "C" {
136#endif
137
143int xtea_self_test( int verbose );
144
145#ifdef __cplusplus
146}
147#endif
148
149#endif /* xtea.h */
Configuration options (set of defines)
XTEA context structure.
Definition xtea.h:62
int xtea_self_test(int verbose)
Checkup routine.
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.
void xtea_free(xtea_context *ctx)
Clear XTEA context.
int xtea_crypt_ecb(xtea_context *ctx, int mode, const unsigned char input[8], unsigned char output[8])
XTEA cipher function.
void xtea_init(xtea_context *ctx)
Initialize XTEA context.
void xtea_setup(xtea_context *ctx, const unsigned char key[16])
XTEA key schedule.