4
* Copyright (C) 2006-2010, Paul Bakker <polarssl_maintainer at polarssl.org>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License along
18
* with this program; if not, write to the Free Software Foundation, Inc.,
19
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
#ifndef POLARSSL_XTEA_H
22
#define POLARSSL_XTEA_H
26
typedef UINT32 uint32_t;
31
#define XTEA_ENCRYPT 1
32
#define XTEA_DECRYPT 0
36
* \brief XTEA context structure
40
uint32_t k[4]; /*!< key */
49
* \brief XTEA key schedule
51
* \param ctx XTEA context to be initialized
52
* \param key the secret key
54
void xtea_setup( xtea_context *ctx, unsigned char key[16] );
57
* \brief XTEA cipher function
59
* \param ctx XTEA context
60
* \param mode XTEA_ENCRYPT or XTEA_DECRYPT
61
* \param input 8-byte input block
62
* \param output 8-byte output block
64
* \return 0 if successful
66
int xtea_crypt_ecb( xtea_context *ctx,
68
unsigned char input[8],
69
unsigned char output[8] );
72
* \brief Checkup routine
74
* \return 0 if successful, or 1 if the test failed
76
int xtea_self_test( int verbose );