diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-08-02 10:38:12 +0200 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-08-02 10:38:12 +0200 |
commit | 9ed59f16e005554fe412bcc05b2ed40688f4fd16 (patch) | |
tree | 2827c201867aaa7610ec8042a122295cf53b44f8 /libavutil | |
parent | 988ddfea5e32226448e353766c8d9b610914e087 (diff) | |
parent | 7a7df34c91e16ea8936f59524145a2cdd6b790f9 (diff) | |
download | ffmpeg-9ed59f16e005554fe412bcc05b2ed40688f4fd16.tar.gz |
Merge commit '7a7df34c91e16ea8936f59524145a2cdd6b790f9'
* commit '7a7df34c91e16ea8936f59524145a2cdd6b790f9':
blowfish: add av_blowfish_alloc()
Conflicts:
doc/APIchanges
libavutil/version.h
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/blowfish.c | 15 | ||||
-rw-r--r-- | libavutil/blowfish.h | 10 | ||||
-rw-r--r-- | libavutil/version.h | 5 |
3 files changed, 29 insertions, 1 deletions
diff --git a/libavutil/blowfish.c b/libavutil/blowfish.c index 3821427570..4f7e4dfd6c 100644 --- a/libavutil/blowfish.c +++ b/libavutil/blowfish.c @@ -24,8 +24,18 @@ #include "avutil.h" #include "common.h" #include "intreadwrite.h" +#include "mem.h" #include "blowfish.h" +#if !FF_API_CRYPTO_CONTEXT +#define AV_BF_ROUNDS 16 + +struct AVBlowfish { + uint32_t p[AV_BF_ROUNDS + 2]; + uint32_t s[4][256]; +}; +#endif + static const uint32_t orig_p[AV_BF_ROUNDS + 2] = { 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344, 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89, @@ -300,6 +310,11 @@ static const uint32_t orig_s[4][256] = { + ctx->s[3][ Xl & 0xFF])\ ^ P; +AVBlowfish *av_blowfish_alloc(void) +{ + return av_mallocz(sizeof(struct AVBlowfish)); +} + av_cold void av_blowfish_init(AVBlowfish *ctx, const uint8_t *key, int key_len) { uint32_t data, data_l, data_r; diff --git a/libavutil/blowfish.h b/libavutil/blowfish.h index 0b004532de..d163fd3578 100644 --- a/libavutil/blowfish.h +++ b/libavutil/blowfish.h @@ -23,6 +23,7 @@ #define AVUTIL_BLOWFISH_H #include <stdint.h> +#include "version.h" /** * @defgroup lavu_blowfish Blowfish @@ -30,12 +31,21 @@ * @{ */ +#if FF_API_CRYPTO_CONTEXT #define AV_BF_ROUNDS 16 typedef struct AVBlowfish { uint32_t p[AV_BF_ROUNDS + 2]; uint32_t s[4][256]; } AVBlowfish; +#else +typedef struct AVBlowfish AVBlowfish; +#endif + +/** + * Allocate an AVBlowfish context. + */ +AVBlowfish *av_blowfish_alloc(void); /** * Initialize an AVBlowfish context. diff --git a/libavutil/version.h b/libavutil/version.h index b10f3e120f..653f530631 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -56,7 +56,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 54 -#define LIBAVUTIL_VERSION_MINOR 29 +#define LIBAVUTIL_VERSION_MINOR 30 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ @@ -125,6 +125,9 @@ #ifndef FF_API_HMAC #define FF_API_HMAC (LIBAVUTIL_VERSION_MAJOR < 55) #endif +#ifndef FF_API_CRYPTO_CONTEXT +#define FF_API_CRYPTO_CONTEXT (LIBAVUTIL_VERSION_MAJOR < 56) +#endif #ifndef FF_CONST_AVUTIL55 #if LIBAVUTIL_VERSION_MAJOR >= 55 |