Mbed TLS v2.28.8
Loading...
Searching...
No Matches
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
33extern "C" {
34#endif
35
36#if !defined(MBEDTLS_XTEA_ALT)
37// Regular implementation
38//
39
43typedef struct mbedtls_xtea_context {
44 uint32_t k[4];
45}
47
48#else /* MBEDTLS_XTEA_ALT */
49#include "xtea_alt.h"
50#endif /* MBEDTLS_XTEA_ALT */
51
58
65
72void mbedtls_xtea_setup(mbedtls_xtea_context *ctx, const unsigned char key[16]);
73
85 int mode,
86 const unsigned char input[8],
87 unsigned char output[8]);
88
89#if defined(MBEDTLS_CIPHER_MODE_CBC)
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
118int mbedtls_xtea_self_test(int verbose);
119
120#endif /* MBEDTLS_SELF_TEST */
121
122#ifdef __cplusplus
123}
124#endif
125
126#endif /* xtea.h */
Configuration options (set of defines)
XTEA context structure.
Definition xtea.h:43
uint32_t k[4]
Definition xtea.h:44
struct mbedtls_xtea_context mbedtls_xtea_context
XTEA context structure.
void mbedtls_xtea_setup(mbedtls_xtea_context *ctx, const unsigned char key[16])
XTEA key schedule.
void mbedtls_xtea_free(mbedtls_xtea_context *ctx)
Clear XTEA context.
int mbedtls_xtea_crypt_ecb(mbedtls_xtea_context *ctx, int mode, const unsigned char input[8], unsigned char output[8])
XTEA cipher function.
int mbedtls_xtea_self_test(int verbose)
Checkup routine.
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.
void mbedtls_xtea_init(mbedtls_xtea_context *ctx)
Initialize XTEA context.