* commit '7a7df34c91e16ea8936f59524145a2cdd6b790f9': blowfish: add av_blowfish_alloc() Conflicts: doc/APIchanges libavutil/version.h
Unified · Split
| @@ -15,6 +15,9 @@ libavutil: 2014-08-09 · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | API changes, most recent first: | 16 | API changes, most recent first: |
| 17 | 17 | ||
| 18 | 2015-xx-xx - lavu 54.30.0 | ||
| 19 | xxxxxxx - Add av_blowfish_alloc(). | ||
| 20 | |||
| 18 | 2015-xx-xx - lavc 56.35.0 - avcodec.h | 21 | 2015-xx-xx - lavc 56.35.0 - avcodec.h |
| 19 | xxxxxxxxx - Rename CODEC_FLAG* defines to AV_CODEC_FLAG*. | 22 | xxxxxxxxx - Rename CODEC_FLAG* defines to AV_CODEC_FLAG*. |
| 20 | xxxxxxxxx - Rename CODEC_CAP_* defines to AV_CODEC_CAP_*. | 23 | xxxxxxxxx - Rename CODEC_CAP_* defines to AV_CODEC_CAP_*. |
| @@ -24,8 +24,18 @@ · 23 unmodified lines | |||
| 24 | #include "avutil.h" | 24 | #include "avutil.h" |
| 25 | #include "common.h" | 25 | #include "common.h" |
| 26 | #include "intreadwrite.h" | 26 | #include "intreadwrite.h" |
| 27 | #include "mem.h" | ||
| 27 | #include "blowfish.h" | 28 | #include "blowfish.h" |
| 28 | 29 | ||
| 30 | #if !FF_API_CRYPTO_CONTEXT | ||
| 31 | #define AV_BF_ROUNDS 16 | ||
| 32 | |||
| 33 | struct AVBlowfish { | ||
| 34 | uint32_t p[AV_BF_ROUNDS + 2]; | ||
| 35 | uint32_t s[4][256]; | ||
| 36 | }; | ||
| 37 | #endif | ||
| 38 | |||
| 29 | static const uint32_t orig_p[AV_BF_ROUNDS + 2] = { | 39 | static const uint32_t orig_p[AV_BF_ROUNDS + 2] = { |
| 30 | 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344, | 40 | 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344, |
| 31 | 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89, | 41 | 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89, |
| @@ -300,6 +310,11 @@ static const uint32_t orig_s[4][256] = { · 268 unmodified lines | |||
| 300 | + ctx->s[3][ Xl & 0xFF])\ | 310 | + ctx->s[3][ Xl & 0xFF])\ |
| 301 | ^ P; | 311 | ^ P; |
| 302 | 312 | ||
| 313 | AVBlowfish *av_blowfish_alloc(void) | ||
| 314 | { | ||
| 315 | return av_mallocz(sizeof(struct AVBlowfish)); | ||
| 316 | } | ||
| 317 | |||
| 303 | av_cold void av_blowfish_init(AVBlowfish *ctx, const uint8_t *key, int key_len) | 318 | av_cold void av_blowfish_init(AVBlowfish *ctx, const uint8_t *key, int key_len) |
| 304 | { | 319 | { |
| 305 | uint32_t data, data_l, data_r; | 320 | uint32_t data, data_l, data_r; |
| @@ -23,6 +23,7 @@ · 22 unmodified lines | |||
| 23 | #define AVUTIL_BLOWFISH_H | 23 | #define AVUTIL_BLOWFISH_H |
| 24 | 24 | ||
| 25 | #include <stdint.h> | 25 | #include <stdint.h> |
| 26 | #include "version.h" | ||
| 26 | 27 | ||
| 27 | /** | 28 | /** |
| 28 | * @defgroup lavu_blowfish Blowfish | 29 | * @defgroup lavu_blowfish Blowfish |
| @@ -30,12 +31,21 @@ · 1 unmodified line | |||
| 30 | * @{ | 31 | * @{ |
| 31 | */ | 32 | */ |
| 32 | 33 | ||
| 34 | #if FF_API_CRYPTO_CONTEXT | ||
| 33 | #define AV_BF_ROUNDS 16 | 35 | #define AV_BF_ROUNDS 16 |
| 34 | 36 | ||
| 35 | typedef struct AVBlowfish { | 37 | typedef struct AVBlowfish { |
| 36 | uint32_t p[AV_BF_ROUNDS + 2]; | 38 | uint32_t p[AV_BF_ROUNDS + 2]; |
| 37 | uint32_t s[4][256]; | 39 | uint32_t s[4][256]; |
| 38 | } AVBlowfish; | 40 | } AVBlowfish; |
| 41 | #else | ||
| 42 | typedef struct AVBlowfish AVBlowfish; | ||
| 43 | #endif | ||
| 44 | |||
| 45 | /** | ||
| 46 | * Allocate an AVBlowfish context. | ||
| 47 | */ | ||
| 48 | AVBlowfish *av_blowfish_alloc(void); | ||
| 39 | 49 | ||
| 40 | /** | 50 | /** |
| 41 | * Initialize an AVBlowfish context. | 51 | * Initialize an AVBlowfish context. |
| @@ -56,7 +56,7 @@ · 55 unmodified lines | |||
| 56 | */ | 56 | */ |
| 57 | 57 | ||
| 58 | #define LIBAVUTIL_VERSION_MAJOR 54 | 58 | #define LIBAVUTIL_VERSION_MAJOR 54 |
| 59 | #define LIBAVUTIL_VERSION_MINOR 29 | 59 | #define LIBAVUTIL_VERSION_MINOR 30 |
| 60 | #define LIBAVUTIL_VERSION_MICRO 100 | 60 | #define LIBAVUTIL_VERSION_MICRO 100 |
| 61 | 61 | ||
| 62 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ | 62 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |
| @@ -125,6 +125,9 @@ · 62 unmodified lines | |||
| 125 | #ifndef FF_API_HMAC | 125 | #ifndef FF_API_HMAC |
| 126 | #define FF_API_HMAC (LIBAVUTIL_VERSION_MAJOR < 55) | 126 | #define FF_API_HMAC (LIBAVUTIL_VERSION_MAJOR < 55) |
| 127 | #endif | 127 | #endif |
| 128 | #ifndef FF_API_CRYPTO_CONTEXT | ||
| 129 | #define FF_API_CRYPTO_CONTEXT (LIBAVUTIL_VERSION_MAJOR < 56) | ||
| 130 | #endif | ||
| 128 | 131 | ||
| 129 | #ifndef FF_CONST_AVUTIL55 | 132 | #ifndef FF_CONST_AVUTIL55 |
| 130 | #if LIBAVUTIL_VERSION_MAJOR >= 55 | 133 | #if LIBAVUTIL_VERSION_MAJOR >= 55 |