mbed TLS v2.16.3
include
mbedtls
xtea.h
Go to the documentation of this file.
1
6
/*
7
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
8
* SPDX-License-Identifier: Apache-2.0
9
*
10
* Licensed under the Apache License, Version 2.0 (the "License"); you may
11
* not use this file except in compliance with the License.
12
* You may obtain a copy of the License at
13
*
14
* http://www.apache.org/licenses/LICENSE-2.0
15
*
16
* Unless required by applicable law or agreed to in writing, software
17
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
* See the License for the specific language governing permissions and
20
* limitations under the License.
21
*
22
* This file is part of mbed TLS (https://tls.mbed.org)
23
*/
24
#ifndef MBEDTLS_XTEA_H
25
#define MBEDTLS_XTEA_H
26
27
#if !defined(MBEDTLS_CONFIG_FILE)
28
#include "
config.h
"
29
#else
30
#include MBEDTLS_CONFIG_FILE
31
#endif
32
33
#include <stddef.h>
34
#include <stdint.h>
35
36
#define MBEDTLS_XTEA_ENCRYPT 1
37
#define MBEDTLS_XTEA_DECRYPT 0
38
39
#define MBEDTLS_ERR_XTEA_INVALID_INPUT_LENGTH -0x0028
41
/* MBEDTLS_ERR_XTEA_HW_ACCEL_FAILED is deprecated and should not be used. */
42
#define MBEDTLS_ERR_XTEA_HW_ACCEL_FAILED -0x0029
44
#ifdef __cplusplus
45
extern
"C"
{
46
#endif
47
48
#if !defined(MBEDTLS_XTEA_ALT)
49
// Regular implementation
50
//
51
55
typedef
struct
mbedtls_xtea_context
56
{
57
uint32_t
k
[4];
58
}
59
mbedtls_xtea_context
;
60
61
#else
/* MBEDTLS_XTEA_ALT */
62
#include "xtea_alt.h"
63
#endif
/* MBEDTLS_XTEA_ALT */
64
70
void
mbedtls_xtea_init
(
mbedtls_xtea_context
*ctx );
71
77
void
mbedtls_xtea_free
(
mbedtls_xtea_context
*ctx );
78
85
void
mbedtls_xtea_setup
(
mbedtls_xtea_context
*ctx,
const
unsigned
char
key[16] );
86
97
int
mbedtls_xtea_crypt_ecb
(
mbedtls_xtea_context
*ctx,
98
int
mode,
99
const
unsigned
char
input[8],
100
unsigned
char
output[8] );
101
102
#if defined(MBEDTLS_CIPHER_MODE_CBC)
103
116
int
mbedtls_xtea_crypt_cbc
(
mbedtls_xtea_context
*ctx,
117
int
mode,
118
size_t
length,
119
unsigned
char
iv[8],
120
const
unsigned
char
*input,
121
unsigned
char
*output);
122
#endif
/* MBEDTLS_CIPHER_MODE_CBC */
123
124
#if defined(MBEDTLS_SELF_TEST)
125
131
int
mbedtls_xtea_self_test
(
int
verbose );
132
133
#endif
/* MBEDTLS_SELF_TEST */
134
135
#ifdef __cplusplus
136
}
137
#endif
138
139
#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:55
mbedtls_xtea_context::k
uint32_t k[4]
Definition:
xtea.h:57
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 Tue Jan 21 2020 12:33:50 for mbed TLS v2.16.3 by
1.8.17