FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
xtea.h
Go to the documentation of this file.
1 /*
2  * A 32-bit implementation of the XTEA algorithm
3  * Copyright (c) 2012 Samuel Pitoiset
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg 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 GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef AVUTIL_XTEA_H
23 #define AVUTIL_XTEA_H
24 
25 #include <stdint.h>
26 #include "version.h"
27 
28 /**
29  * @file
30  * @brief Public header for libavutil XTEA algorithm
31  * @defgroup lavu_xtea XTEA
32  * @ingroup lavu_crypto
33  * @{
34  */
35 
36 typedef struct AVXTEA {
37  uint32_t key[16];
38 } AVXTEA;
39 
40 /**
41  * Allocate an AVXTEA context.
42  */
43 AVXTEA *av_xtea_alloc(void);
44 
45 /**
46  * Initialize an AVXTEA context.
47  *
48  * @param ctx an AVXTEA context
49  * @param key a key of 16 bytes used for encryption/decryption
50  */
51 void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]);
52 
53 /**
54  * Encrypt or decrypt a buffer using a previously initialized context.
55  *
56  * @param ctx an AVXTEA context
57  * @param dst destination array, can be equal to src
58  * @param src source array, can be equal to dst
59  * @param count number of 8 byte blocks
60  * @param iv initialization vector for CBC mode, if NULL then ECB will be used
61  * @param decrypt 0 for encryption, 1 for decryption
62  */
63 void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src,
64  int count, uint8_t *iv, int decrypt);
65 
66 /**
67  * @}
68  */
69 
70 #endif /* AVUTIL_XTEA_H */
uint32_t key[16]
Definition: xtea.h:37
uint8_t
void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt)
Encrypt or decrypt a buffer using a previously initialized context.
Definition: xtea.c:170
void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16])
Initialize an AVXTEA context.
Definition: xtea.c:42
Libavutil version macros.
GLsizei count
Definition: opengl_enc.c:109
AVS_Value src
Definition: avisynth_c.h:482
Definition: xtea.h:36
AVXTEA * av_xtea_alloc(void)
Allocate an AVXTEA context.
Definition: xtea.c:37