提交 7a7df34c 编写于 作者: J James Almer 提交者: Anton Khirnov

blowfish: add av_blowfish_alloc()

Signed-off-by: NJames Almer <jamrial@gmail.com>
Signed-off-by: NAnton Khirnov <anton@khirnov.net>
上级 cd4d9df2
...@@ -13,6 +13,9 @@ libavutil: 2014-08-09 ...@@ -13,6 +13,9 @@ libavutil: 2014-08-09
API changes, most recent first: API changes, most recent first:
2015-xx-xx - lavu 54.17.0
xxxxxxx - Add av_blowfish_alloc().
2015-07-29 - 7e38340 - lavu 54.16.0 - hmac.h 2015-07-29 - 7e38340 - lavu 54.16.0 - hmac.h
Add AV_HMAC_SHA224 and AV_HMAC_SHA256. Add AV_HMAC_SHA224 and AV_HMAC_SHA256.
......
...@@ -24,8 +24,18 @@ ...@@ -24,8 +24,18 @@
#include "avutil.h" #include "avutil.h"
#include "common.h" #include "common.h"
#include "intreadwrite.h" #include "intreadwrite.h"
#include "mem.h"
#include "blowfish.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] = { static const uint32_t orig_p[AV_BF_ROUNDS + 2] = {
0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344, 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,
0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89, 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89,
...@@ -312,6 +322,11 @@ static void F(AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, int i) ...@@ -312,6 +322,11 @@ static void F(AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, int i)
*xr = Xl; *xr = Xl;
} }
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) av_cold void av_blowfish_init(AVBlowfish *ctx, const uint8_t *key, int key_len)
{ {
uint32_t data, data_l, data_r; uint32_t data, data_l, data_r;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#define AVUTIL_BLOWFISH_H #define AVUTIL_BLOWFISH_H
#include <stdint.h> #include <stdint.h>
#include "version.h"
/** /**
* @defgroup lavu_blowfish Blowfish * @defgroup lavu_blowfish Blowfish
...@@ -29,12 +30,21 @@ ...@@ -29,12 +30,21 @@
* @{ * @{
*/ */
#if FF_API_CRYPTO_CONTEXT
#define AV_BF_ROUNDS 16 #define AV_BF_ROUNDS 16
typedef struct AVBlowfish { typedef struct AVBlowfish {
uint32_t p[AV_BF_ROUNDS + 2]; uint32_t p[AV_BF_ROUNDS + 2];
uint32_t s[4][256]; uint32_t s[4][256];
} AVBlowfish; } AVBlowfish;
#else
typedef struct AVBlowfish AVBlowfish;
#endif
/**
* Allocate an AVBlowfish context.
*/
AVBlowfish *av_blowfish_alloc(void);
/** /**
* Initialize an AVBlowfish context. * Initialize an AVBlowfish context.
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
*/ */
#define LIBAVUTIL_VERSION_MAJOR 54 #define LIBAVUTIL_VERSION_MAJOR 54
#define LIBAVUTIL_VERSION_MINOR 16 #define LIBAVUTIL_VERSION_MINOR 17
#define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
...@@ -114,6 +114,9 @@ ...@@ -114,6 +114,9 @@
#ifndef FF_API_DLOG #ifndef FF_API_DLOG
#define FF_API_DLOG (LIBAVUTIL_VERSION_MAJOR < 55) #define FF_API_DLOG (LIBAVUTIL_VERSION_MAJOR < 55)
#endif #endif
#ifndef FF_API_CRYPTO_CONTEXT
#define FF_API_CRYPTO_CONTEXT (LIBAVUTIL_VERSION_MAJOR < 56)
#endif
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册