From: James Almer Date: Tue, 28 Jul 2015 19:57:48 +0000 (-0300) Subject: xtea: add av_xtea_alloc() X-Git-Tag: android-x86-7.1-r1~252^2~2141 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=5d8bea3bb2357bb304f8f771a4107039037c5549;p=android-x86%2Fexternal-ffmpeg.git xtea: add av_xtea_alloc() Signed-off-by: James Almer Signed-off-by: Anton Khirnov --- diff --git a/doc/APIchanges b/doc/APIchanges index de22fa5dfb..cfab8c6d68 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -16,6 +16,7 @@ API changes, most recent first: 2015-xx-xx - lavu 54.17.0 xxxxxxx - Add av_blowfish_alloc(). xxxxxxx - Add av_rc4_alloc(). + xxxxxxx - Add av_xtea_alloc(). 2015-07-29 - 7e38340 - lavu 54.16.0 - hmac.h Add AV_HMAC_SHA224 and AV_HMAC_SHA256. diff --git a/libavutil/xtea.c b/libavutil/xtea.c index 53c0bfe603..43ba8fcd32 100644 --- a/libavutil/xtea.c +++ b/libavutil/xtea.c @@ -31,8 +31,20 @@ #include "avutil.h" #include "common.h" #include "intreadwrite.h" +#include "mem.h" #include "xtea.h" +#if !FF_API_CRYPTO_CONTEXT +struct AVXTEA { + uint32_t key[16]; +}; +#endif + +AVXTEA *av_xtea_alloc(void) +{ + return av_mallocz(sizeof(struct AVXTEA)); +} + void av_xtea_init(AVXTEA *ctx, const uint8_t key[16]) { int i; diff --git a/libavutil/xtea.h b/libavutil/xtea.h index 0fc3810dd2..4d7c5818d3 100644 --- a/libavutil/xtea.h +++ b/libavutil/xtea.h @@ -22,6 +22,7 @@ #define AVUTIL_XTEA_H #include +#include "version.h" /** * @file @@ -31,9 +32,18 @@ * @{ */ +#if FF_API_CRYPTO_CONTEXT typedef struct AVXTEA { uint32_t key[16]; } AVXTEA; +#else +typedef struct AVXTEA AVXTEA; +#endif + +/** + * Allocate an AVXTEA context. + */ +AVXTEA *av_xtea_alloc(void); /** * Initialize an AVXTEA context.