Mbed TLS v2.28.8
include
mbedtls
xtea.h
Go to the documentation of this file.
1
6
/*
7
* Copyright The Mbed TLS Contributors
8
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9
*/
10
#ifndef MBEDTLS_XTEA_H
11
#define MBEDTLS_XTEA_H
12
13
#if !defined(MBEDTLS_CONFIG_FILE)
14
#include "
mbedtls/config.h
"
15
#else
16
#include MBEDTLS_CONFIG_FILE
17
#endif
18
19
#include <stddef.h>
20
#include <stdint.h>
21
22
#define MBEDTLS_XTEA_ENCRYPT 1
23
#define MBEDTLS_XTEA_DECRYPT 0
24
26
#define MBEDTLS_ERR_XTEA_INVALID_INPUT_LENGTH -0x0028
27
28
/* MBEDTLS_ERR_XTEA_HW_ACCEL_FAILED is deprecated and should not be used. */
30
#define MBEDTLS_ERR_XTEA_HW_ACCEL_FAILED -0x0029
31
32
#ifdef __cplusplus
33
extern
"C"
{
34
#endif
35
36
#if !defined(MBEDTLS_XTEA_ALT)
37
// Regular implementation
38
//
39
43
typedef
struct
mbedtls_xtea_context
{
44
uint32_t
k
[4];
45
}
46
mbedtls_xtea_context
;
47
48
#else
/* MBEDTLS_XTEA_ALT */
49
#include "xtea_alt.h"
50
#endif
/* MBEDTLS_XTEA_ALT */
51
57
void
mbedtls_xtea_init
(
mbedtls_xtea_context
*ctx);
58
64
void
mbedtls_xtea_free
(
mbedtls_xtea_context
*ctx);
65
72
void
mbedtls_xtea_setup
(
mbedtls_xtea_context
*ctx,
const
unsigned
char
key[16]);
73
84
int
mbedtls_xtea_crypt_ecb
(
mbedtls_xtea_context
*ctx,
85
int
mode,
86
const
unsigned
char
input[8],
87
unsigned
char
output[8]);
88
89
#if defined(MBEDTLS_CIPHER_MODE_CBC)
90
103
int
mbedtls_xtea_crypt_cbc
(
mbedtls_xtea_context
*ctx,
104
int
mode,
105
size_t
length,
106
unsigned
char
iv[8],
107
const
unsigned
char
*input,
108
unsigned
char
*output);
109
#endif
/* MBEDTLS_CIPHER_MODE_CBC */
110
111
#if defined(MBEDTLS_SELF_TEST)
112
118
int
mbedtls_xtea_self_test
(
int
verbose);
119
120
#endif
/* MBEDTLS_SELF_TEST */
121
122
#ifdef __cplusplus
123
}
124
#endif
125
126
#endif
/* xtea.h */
mbedtls_xtea_context
struct mbedtls_xtea_context mbedtls_xtea_context
XTEA context structure.
mbedtls_xtea_setup
void mbedtls_xtea_setup(mbedtls_xtea_context *ctx, const unsigned char key[16])
XTEA key schedule.
mbedtls_xtea_init
void mbedtls_xtea_init(mbedtls_xtea_context *ctx)
Initialize XTEA context.
mbedtls_xtea_crypt_cbc
int mbedtls_xtea_crypt_cbc(mbedtls_xtea_context *ctx, int mode, size_t length, unsigned char iv[8], const unsigned char *input, unsigned char *output)
XTEA CBC cipher function.
mbedtls_xtea_self_test
int mbedtls_xtea_self_test(int verbose)
Checkup routine.
mbedtls_xtea_free
void mbedtls_xtea_free(mbedtls_xtea_context *ctx)
Clear XTEA context.
mbedtls_xtea_context
XTEA context structure.
Definition:
xtea.h:43
mbedtls_xtea_context::k
uint32_t k[4]
Definition:
xtea.h:44
config.h
Configuration options (set of defines)
mbedtls_xtea_crypt_ecb
int mbedtls_xtea_crypt_ecb(mbedtls_xtea_context *ctx, int mode, const unsigned char input[8], unsigned char output[8])
XTEA cipher function.
Generated on Wed Apr 24 2024 20:07:29 for Mbed TLS v2.28.8 by
1.8.17