#include "polarssl/config.h"
#include "polarssl/xtea.h"
#include <string.h>
#include <stdio.h>
Go to the source code of this file.
Functions | |
void | xtea_setup (xtea_context *ctx, const unsigned char key[16]) |
XTEA key schedule. | |
int | xtea_crypt_ecb (xtea_context *ctx, int mode, const unsigned char input[8], unsigned char output[8]) |
XTEA cipher function. | |
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. | |
int | xtea_self_test (int verbose) |
Checkup routine. | |
Variables | |
static const unsigned char | xtea_test_key [6][16] |
static const unsigned char | xtea_test_pt [6][8] |
static const unsigned char | xtea_test_ct [6][8] |
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.
ctx | XTEA context | |
mode | XTEA_ENCRYPT or XTEA_DECRYPT | |
length | the length of input, multiple of 8 | |
iv | initialization vector for CBC mode | |
input | input block | |
output | output block |
Definition at line 118 of file xtea.c.
References POLARSSL_ERR_XTEA_INVALID_INPUT_LENGTH, xtea_crypt_ecb(), and XTEA_DECRYPT.
int xtea_crypt_ecb | ( | xtea_context * | ctx, | |
int | mode, | |||
const unsigned char | input[8], | |||
unsigned char | output[8] | |||
) |
XTEA cipher function.
ctx | XTEA context | |
mode | XTEA_ENCRYPT or XTEA_DECRYPT | |
input | 8-byte input block | |
output | 8-byte output block |
Definition at line 75 of file xtea.c.
References GET_UINT32_BE, xtea_context::k, PUT_UINT32_BE, and XTEA_ENCRYPT.
Referenced by test_suite_xtea_decrypt_ecb(), test_suite_xtea_encrypt_ecb(), xtea_crypt_cbc(), and xtea_self_test().
int xtea_self_test | ( | int | verbose | ) |
Checkup routine.
Definition at line 214 of file xtea.c.
References xtea_crypt_ecb(), XTEA_ENCRYPT, xtea_setup(), xtea_test_ct, xtea_test_key, and xtea_test_pt.
Referenced by test_suite_xtea_selftest().
void xtea_setup | ( | xtea_context * | ctx, | |
const unsigned char | key[16] | |||
) |
XTEA key schedule.
ctx | XTEA context to be initialized | |
key | the secret key |
Definition at line 60 of file xtea.c.
References GET_UINT32_BE, and xtea_context::k.
Referenced by test_suite_xtea_decrypt_ecb(), test_suite_xtea_encrypt_ecb(), and xtea_self_test().
const unsigned char xtea_test_ct[6][8] [static] |
{ { 0x49, 0x7d, 0xf3, 0xd0, 0x72, 0x61, 0x2c, 0xb5 }, { 0xe7, 0x8f, 0x2d, 0x13, 0x74, 0x43, 0x41, 0xd8 }, { 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41 }, { 0xa0, 0x39, 0x05, 0x89, 0xf8, 0xb8, 0xef, 0xa5 }, { 0xed, 0x23, 0x37, 0x5a, 0x82, 0x1a, 0x8c, 0x2d }, { 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41 } }
Definition at line 201 of file xtea.c.
Referenced by xtea_self_test().
const unsigned char xtea_test_key[6][16] [static] |
{ { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
Definition at line 175 of file xtea.c.
Referenced by xtea_self_test().
const unsigned char xtea_test_pt[6][8] [static] |
{ { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48 }, { 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41 }, { 0x5a, 0x5b, 0x6e, 0x27, 0x89, 0x48, 0xd7, 0x7f }, { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48 }, { 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41 }, { 0x70, 0xe1, 0x22, 0x5d, 0x6e, 0x4e, 0x76, 0x55 } }
Definition at line 191 of file xtea.c.
Referenced by xtea_self_test().